28#ifndef _OPALX_FIELDS_THREEDGRID_HH_
29#define _OPALX_FIELDS_THREEDGRID_HH_
85 double dX,
double dY,
double dZ,
double minX,
double minY,
double minZ,
86 int numberOfXCoords,
int numberOfYCoords,
int numberOfZCoords);
110 ThreeDGrid(std::vector<double>
x, std::vector<double>
y, std::vector<double>
z);
119 inline double&
x(
const int& i) {
return x_m[i - 1]; }
125 inline double&
y(
const int& j) {
return y_m[j - 1]; }
131 inline double&
z(
const int& k) {
return z_m[k - 1]; }
137 inline const double&
x(
const int& i)
const {
return x_m[i - 1]; }
143 inline const double&
y(
const int& j)
const {
return y_m[j - 1]; }
149 inline const double&
z(
const int& j)
const {
return z_m[j - 1]; }
152 inline int xSize()
const {
return static_cast<int>(
x_m.size()); }
155 inline int ySize()
const {
return static_cast<int>(
y_m.size()); }
158 inline int zSize()
const {
return static_cast<int>(
z_m.size()); }
161 std::vector<double>
xVector() {
return std::vector<double>(
x_m); }
164 std::vector<double>
yVector() {
return std::vector<double>(
y_m); }
167 std::vector<double>
zVector() {
return std::vector<double>(
z_m); }
183 inline void xLowerBound(
const double&
x,
int& xIndex)
const;
190 inline void yLowerBound(
const double&
y,
int& yIndex)
const;
197 inline void zLowerBound(
const double&
z,
int& zIndex)
const;
205 const double&
x,
int& xIndex,
const double&
y,
int& yIndex,
const double&
z,
217 inline double minX()
const;
220 inline double maxX()
const;
223 inline double minY()
const;
226 inline double maxY()
const;
229 inline double minZ()
const;
232 inline double maxZ()
const;
235 inline void setX(
int nXCoords,
double*
x);
238 inline void setY(
int nYCoords,
double*
y);
241 inline void setZ(
int nZCoords,
double*
z);
341 double*
x =
new double[
x_m.size()];
342 for (
unsigned int i = 0; i <
x_m.size(); i++)
348 double*
y =
new double[
y_m.size()];
349 for (
unsigned int i = 0; i <
y_m.size(); i++)
355 double*
z =
new double[
z_m.size()];
356 for (
unsigned int i = 0; i <
z_m.size(); i++)
362 const double& x,
int& xIndex,
const double& y,
int& yIndex,
const double& z,
370 const double& x,
const double& y,
const double& z,
Mesh::Iterator& it)
const {
381 xIndex =
static_cast<int>(std::floor((
x -
x_m[0]) / (
x_m[1] -
x_m[0])));
389 yIndex =
static_cast<int>(std::floor((
y -
y_m[0]) / (
y_m[1] -
y_m[0])));
396 zIndex =
static_cast<int>(std::floor((
z -
z_m[0]) / (
z_m[1] -
z_m[0])));
std::vector< int > getState() const
Base class for meshing routines.
Mesh::Iterator begin() const
void yLowerBound(const double &y, int &yIndex) const
friend bool operator>(const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
void setY(int nYCoords, double *y)
void setZ(int nZCoords, double *z)
void setConstantSpacing()
std::vector< double > zVector()
std::vector< double > xVector()
friend Mesh::Iterator & operator++(Mesh::Iterator &lhs)
friend bool operator<(const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
std::vector< double > y_m
const double & y(const int &j) const
virtual void getPosition(const Mesh::Iterator &it, double *position) const
static void vectorLowerBound(std::vector< double > vec, double x, int &index)
Mesh::Iterator end() const
std::vector< double > x_m
virtual Mesh::Iterator & subEquals(Mesh::Iterator &lhs, int difference) const
const double & x(const int &i) const
void remove(VectorMap *map)
friend bool operator!=(const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
std::vector< double > z_m
const double & z(const int &j) const
friend Mesh::Iterator operator-(const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
void zLowerBound(const double &z, int &zIndex) const
friend Mesh::Iterator & operator--(Mesh::Iterator &lhs)
bool getConstantSpacing() const
void xLowerBound(const double &x, int &xIndex) const
friend Mesh::Iterator & operator+=(Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
friend bool operator==(const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
std::vector< double > yVector()
virtual Mesh::Iterator & subOne(Mesh::Iterator &lhs) 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
void setX(int nXCoords, double *x)
friend Mesh::Iterator operator+(const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
int getPositionDimension() const
virtual Mesh::Iterator & addOne(Mesh::Iterator &lhs) const
virtual Mesh::Iterator & addEquals(Mesh::Iterator &lhs, int difference) const
friend Mesh::Iterator & operator-=(Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
int toInteger(const Mesh::Iterator &lhs) const
void lowerBound(const double &x, int &xIndex, const double &y, int &yIndex, const double &z, int &zIndex) const
friend bool operator>=(const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
std::vector< VectorMap * > maps_m
Mesh::Iterator getNearest(const double *position) const
friend Mesh::Iterator operator++(Mesh::Iterator &lhs, int)