28 #ifndef _CLASSIC_FIELDS_NDGRID_HH_
29 #define _CLASSIC_FIELDS_NDGRID_HH_
38 namespace interpolation {
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);
372 for (
unsigned int i=0; i<it.
getState().size(); i++)
373 position[i] =
coord_m[i][it[i]-1];
390 #endif // _CLASSIC_FIELDS_NDGRID_HH_
friend Mesh::Iterator operator+(const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed we want its recipients to know that what they have is not the so that any problems introduced by others will not reflect on the original authors reputations any free program is threatened constantly by software patents We wish to avoid the danger that redistributors of a free program will individually obtain patent in effect making the program proprietary To prevent we have made it clear that any patent must be licensed for everyone s free use or not licensed at all The precise terms and conditions for distribution and modification follow GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR DISTRIBUTION AND MODIFICATION This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License The refers to any such program or and a work based on the Program means either the Program or any derivative work under copyright a work containing the Program or a portion of it
friend bool operator==(const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
friend bool operator<(const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
double max(const int &dimension) const
void setCoord(int dimension, int nCoords, double *x)
double min(const int &dimension) const
NDGrid()
////// NDGrid ///////
Mesh::Iterator end() const
virtual Mesh::Iterator & subEquals(Mesh::Iterator &lhs, int difference) const
friend bool operator>=(const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
friend bool operator!=(const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
friend bool operator>(const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
Base class for meshing routines.
friend bool operator<=(const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
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)
std::vector< double > coordVector(const int &dimension) const
virtual bool isGreater(const Mesh::Iterator &lhs, const Mesh::Iterator &rhs) const
void lowerBound(const std::vector< double > &pos, std::vector< int > &xIndex) const
void setConstantSpacing(bool spacing)
friend Mesh::Iterator operator++(Mesh::Iterator &lhs, int)
void coordLowerBound(const double &x, const int &dimension, int &xIndex) const
int toInteger(const Mesh::Iterator &lhs) const
std::vector< std::vector< double > > coord_m
friend Mesh::Iterator & operator+=(Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
std::vector< int > getState() const
friend Mesh::Iterator operator--(Mesh::Iterator &lhs, int)
double & coord(const int &index, const int &dimension)
int size(const int &dimension) const
constexpr double e
The value of .
double * newCoordArray(const int &dimension) const
virtual Mesh::Iterator & addEquals(Mesh::Iterator &lhs, int difference) const
virtual Mesh::Iterator & subOne(Mesh::Iterator &lhs) const
virtual Mesh::Iterator & addOne(Mesh::Iterator &lhs) const
Mesh::Iterator begin() const
PETE_TUTree< FnFloor, typename T::PETE_Expr_t > floor(const PETE_Expr< T > &l)
friend Mesh::Iterator operator-(const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
bool getConstantSpacing() const
Mesh::Iterator getNearest(const double *position) const
int getPositionDimension() const