26 #include <queso/InterpolationSurrogateHelper.h>
29 #include <queso/asserts.h>
35 const std::vector<unsigned int>& n_points )
41 unsigned int dim = coord_indices.size();
48 unsigned int global_index = coord_indices[0];
50 for(
unsigned int d = 1; d <
dim; d++ )
55 unsigned int idx = coord_indices[d];
57 for(
int local_d = d-1; local_d >=0; local_d -= 1)
59 idx *= n_points[local_d];
69 const std::vector<unsigned int>& n_points,
70 std::vector<unsigned int>& coord_indices )
73 unsigned int dim = n_points.size();
75 coord_indices.resize(dim);
79 unsigned int tmp = global;
81 for(
int d = dim-1; d > 0; d -= 1 )
84 coord_indices[d] = tmp/np;
85 tmp -= coord_indices[d]*np;
89 coord_indices[0] = tmp;
98 unsigned int value = 1;
100 for(
unsigned int d = 0; d < term; d++ )
102 value *= n_points[d];
static void globalToCoord(unsigned int global, const std::vector< unsigned int > &n_points, std::vector< unsigned int > &coord_indices)
Inverse of coordToGlobal map.
#define queso_assert_equal_to(expr1, expr2)
static unsigned int coordToGlobal(const std::vector< unsigned int > &coord_indices, const std::vector< unsigned int > &n_points)
Map coordinate indices to a singal global index.
#define queso_assert_less(expr1, expr2)
static unsigned int compute_npoints_factor(const std::vector< unsigned int > &n_points, unsigned int term)
Helper function.