23 #include <gsl/gsl_interp.h>
28 #include "pism/util/io/LocalInterpCtx.hh"
29 #include "pism/util/Grid.hh"
31 #include "pism/util/Context.hh"
32 #include "pism/util/Logger.hh"
33 #include "pism/util/error_handling.hh"
34 #include "pism/util/interpolation.hh"
53 double subset_x_max,
int &x_start,
int &x_count) {
54 auto x_size = (int)x.size();
56 x_start = (int)gsl_interp_bsearch(x.data(), subset_x_min, 0, x_size - 1);
58 auto x_end = (int)gsl_interp_bsearch(x.data(), subset_x_max, 0, x_size - 1) + 1;
62 x_count = x_end - x_start + 1;
105 const double x_min_proc = internal_grid.
x(internal_grid.
xs()),
106 x_max_proc = internal_grid.
x(internal_grid.
xs() + internal_grid.
xm() - 1),
107 y_min_proc = internal_grid.
y(internal_grid.
ys()),
108 y_max_proc = internal_grid.
y(internal_grid.
ys() + internal_grid.
ym() - 1);
126 &internal_grid.
x()[internal_grid.
xs()], internal_grid.
xm());
129 &internal_grid.
y()[internal_grid.
ys()], internal_grid.
ym());
131 std::vector<double> zz = {0.0};
132 z = std::make_shared<Interpolation>(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::array< int, 4 > start
LocalInterpCtx(const grid::InputGridInfo &input_grid, const Grid &internal_grid, InterpolationType type)
std::shared_ptr< Interpolation > y
std::shared_ptr< Interpolation > z
std::shared_ptr< Interpolation > x
#define PISM_ERROR_LOCATION
double max(const array::Scalar &input)
Finds maximum over all the values in an array::Scalar object. Ignores ghosts.
double min(const array::Scalar &input)
Finds minimum over all the values in an array::Scalar object. Ignores ghosts.
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.