HyPar
1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
|
Find grid point indices corresponding to a spatial interval. More...
#include <mathfunctions.h>
Go to the source code of this file.
Functions | |
void | FindInterval (double a, double b, double *x, int N, int *imin, int *imax) |
Find grid point indices corresponding to a spatial interval.
Definition in file FindInterval.c.
void FindInterval | ( | double | a, |
double | b, | ||
double * | x, | ||
int | N, | ||
int * | imin, | ||
int * | imax | ||
) |
Given an interval \(\left[a,b\right], a\leq b\), find grid indices imin and imax, such that
\begin{align} imin &= \min\ i\ {\rm satisfying}\ x_i \geq a\\ imax &= \max\ i\ {\rm satisfying}\ x_i \leq b \end{align}
where \(\left\{x_i; 0\leq i < N , x_i < x_{i+1} \forall i \right\}\) represents a 1-dimensional grid.
Note: This function handles 1-dimensional intervals and grids only.
a | Lower bound of interval |
b | Upper bound of interval |
x | Array of spatial coordinates representing a grid |
N | Number of grid points / size of x |
imin | Lowest grid index within [a,b] |
imax | Highest grid index within [a,b] |
Definition at line 19 of file FindInterval.c.