23#include <gsl/gsl_interp.h>
28#include "pism/util/io/LocalInterpCtx.hh"
29#include "pism/util/Grid.hh"
31#include "pism/util/error_handling.hh"
32#include "pism/util/Interpolation1D.hh"
51 double subset_x_max,
int &x_start,
int &x_count) {
52 auto x_size = (
int)x.size();
54 x_start = (
int)gsl_interp_bsearch(x.data(), subset_x_min, 0, x_size - 1);
56 auto x_end = (
int)gsl_interp_bsearch(x.data(), subset_x_max, 0, x_size - 1) + 1;
58 x_end = std::min(x_size - 1, x_end);
60 x_count = x_end - x_start + 1;
103 const auto &xx = internal_grid.
x;
104 const auto &yy = internal_grid.
y;
107 const double x_min_proc = xx[internal_grid.
xs],
108 x_max_proc = xx[internal_grid.
xs + internal_grid.
xm - 1],
109 y_min_proc = yy[internal_grid.
ys],
110 y_max_proc = yy[internal_grid.
ys + internal_grid.
ym - 1];
128 &xx[internal_grid.
xs], internal_grid.
xm);
131 &yy[internal_grid.
ys], internal_grid.
ym);
133 std::vector<double> zz = {0.0};
134 z = std::make_shared<Interpolation1D>(type, zz, zz);
std::array< int, 4 > count
std::shared_ptr< Interpolation1D > z
std::array< int, 4 > start
std::shared_ptr< Interpolation1D > x
LocalInterpCtx(const grid::InputGridInfo &input_grid, const grid::DistributedGridInfo &internal_grid, InterpolationType type)
std::shared_ptr< Interpolation1D > y
unsigned int ys
Starting index of the patch owned by the current MPI rank (X direction)
unsigned int xs
Starting index (in the X direction) of the patch owned by the current MPI rank.
std::vector< double > y
y coordinates
std::vector< double > x
x coordinates
#define PISM_ERROR_LOCATION
static void subset_start_and_count(const std::vector< double > &x, double subset_x_min, double subset_x_max, int &x_start, int &x_count)
Compute start and count for getting a subset of x.