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 double x_min_proc = internal_grid.
x(internal_grid.
xs()),
104 x_max_proc = internal_grid.
x(internal_grid.
xs() + internal_grid.
xm() - 1),
105 y_min_proc = internal_grid.
y(internal_grid.
ys()),
106 y_max_proc = internal_grid.
y(internal_grid.
ys() + internal_grid.
ym() - 1);
124 &internal_grid.
x()[internal_grid.
xs()], internal_grid.
xm());
127 &internal_grid.
y()[internal_grid.
ys()], internal_grid.
ym());
129 std::vector<double> zz = {0.0};
130 z = std::make_shared<Interpolation1D>(type, zz, zz);
const std::vector< double > & x() const
X-coordinates.
const std::vector< double > & y() const
Y-coordinates.
int ys() const
Global starting index of this processor's subset.
int xs() const
Global starting index of this processor's subset.
int xm() const
Width of this processor's sub-domain.
int ym() const
Width of this processor's sub-domain.
Describes the PISM grid and the distribution of data across processors.
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 &internal_grid, InterpolationType type)
std::shared_ptr< Interpolation1D > y
#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.