28#ifndef _CLASSIC_FIELDS_NDGRID_HH_
29#define _CLASSIC_FIELDS_NDGRID_HH_
84 NDGrid(
int nDimensions,
int*
size,
double* spacing,
double*
min);
94 NDGrid(std::vector<int>
size, std::vector<const double *> gridCoordinates);
107 NDGrid(std::vector< std::vector<double> > gridCoordinates);
125 inline double&
coord(
const int& index,
const int& dimension);
137 inline const double&
coord(
const int& index,
const int& dimension)
const;
147 inline int size(
const int& dimension)
const;
157 inline std::vector<double>
coordVector(
const int& dimension)
const;
181 inline void coordLowerBound(
const double& x,
const int& dimension,
int& xIndex)
const;
195 inline void lowerBound(
const std::vector<double>& pos, std::vector<int>& xIndex)
const;
198 inline double min(
const int& dimension)
const;
201 inline double max(
const int& dimension)
const;
209 inline void setCoord(
int dimension,
int nCoords,
double * x);
303 return coord_m[dimension][index-1];
307 return coord_m[dimension][index-1];
311 return coord_m[dimension].size();
320 double x0 =
coord_m[dimension][0];
321 double x1 =
coord_m[dimension][1];
322 xIndex =
static_cast<int>(
std::floor((x - x0)/(x1-x0)));
323 int coordSize =
static_cast<int>(
coord_m[dimension].size());
324 if (xIndex >= coordSize) {
325 xIndex = coordSize-1;
326 }
else if (xIndex < -1) {
330 const std::vector<double>& c_t(
coord_m[dimension]);
331 xIndex = std::lower_bound(c_t.begin(), c_t.end(), x)-c_t.begin()-1;
336 xIndex = std::vector<int> (pos.size());
337 for(
unsigned int i=0; i < pos.size(); i++) {
355 coord_m[dimension] = std::vector<double>(x, x+nCoords);
373 position[i] =
coord_m[i][it[i]-1];
PETE_TUTree< FnFloor, typename T::PETE_Expr_t > floor(const PETE_Expr< T > &l)
constexpr double e
The value of.
Base class for meshing routines.
std::vector< int > getState() const
virtual Mesh::Iterator & addEquals(Mesh::Iterator &lhs, int difference) const
virtual Mesh::Iterator & addOne(Mesh::Iterator &lhs) const
friend bool operator>(const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
virtual Mesh::Iterator & subOne(Mesh::Iterator &lhs) const
Mesh::Iterator begin() const
void coordLowerBound(const double &x, const int &dimension, int &xIndex) const
int toInteger(const Mesh::Iterator &lhs) const
friend Mesh::Iterator & operator++(Mesh::Iterator &lhs)
friend bool operator<(const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
double max(const int &dimension) const
Mesh::Iterator end() const
std::vector< std::vector< double > > coord_m
int getPositionDimension() const
Mesh::Iterator getNearest(const double *position) const
void setCoord(int dimension, int nCoords, double *x)
friend bool operator!=(const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
double min(const int &dimension) const
double * newCoordArray(const int &dimension) const
friend Mesh::Iterator operator-(const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
friend Mesh::Iterator & operator--(Mesh::Iterator &lhs)
friend Mesh::Iterator & operator+=(Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
friend bool operator==(const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
NDGrid()
////// NDGrid ///////
void lowerBound(const std::vector< double > &pos, std::vector< int > &xIndex) const
friend bool operator<=(const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
friend Mesh::Iterator operator--(Mesh::Iterator &lhs, int)
void setConstantSpacing(bool spacing)
friend Mesh::Iterator operator+(const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
virtual Mesh::Iterator & subEquals(Mesh::Iterator &lhs, int difference) const
std::vector< VectorMap * > maps_m
void getPosition(const Mesh::Iterator &it, double *position) const
friend Mesh::Iterator & operator-=(Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
int size(const int &dimension) const
std::vector< double > coordVector(const int &dimension) const
double & coord(const int &index, const int &dimension)
bool getConstantSpacing() const
friend bool operator>=(const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
friend Mesh::Iterator operator++(Mesh::Iterator &lhs, int)
virtual bool isGreater(const Mesh::Iterator &lhs, const Mesh::Iterator &rhs) const