PISM, A Parallel Ice Sheet Model  stable v2.1-1-g6902d5502 committed by Ed Bueler on 2023-12-20 08:38:27 -0800

◆ subset_start_and_count()

static void pism::subset_start_and_count ( const std::vector< double > &  x,
double  subset_x_min,
double  subset_x_max,
int &  x_start,
int &  x_count 
)
static

Compute start and count for getting a subset of x.

Given a grid x we find x_start and x_count so that [subset_x_min, subset_x_max] is in [x[x_start], x[x_start + x_count]].

x_start and x_count define the smallest subset of x with this property.

Note that x_start + x_count <= x.size() as long as x is strictly increasing.

Parameters
[in]xinput grid (defined interpolation domain)
[in]subset_x_minminimum x of a subset (interpolation range)
[in]subset_x_maxmaxumum x of a subset (interpolation range)
[out]x_startstarting index
[out]x_countnumber of elements required

Definition at line 52 of file LocalInterpCtx.cc.

References pism::array::min().

Referenced by pism::LocalInterpCtx::LocalInterpCtx().