|
int | cellIndex (Position bfr) const override |
|
Position | centralPositionInCell (int m) const override |
|
std::unique_ptr< PathSegmentGenerator > | createPathSegmentGenerator () const override |
|
double | diagonal (int m) const override |
|
MoveableMesh * | meshX () const |
|
MoveableMesh * | meshY () const |
|
MoveableMesh * | meshZ () const |
|
int | numCells () const override |
|
Position | randomPositionInCell (int m) const override |
|
double | volume (int m) const override |
|
Box | boundingBox () const override |
|
int | dimension () const override |
|
double | maxX () const |
|
double | maxY () const |
|
double | maxZ () const |
|
double | minX () const |
|
double | minY () const |
|
double | minZ () const |
|
virtual Box | boundingBox () const =0 |
|
virtual int | cellIndex (Position bfr) const =0 |
|
virtual Position | centralPositionInCell (int m) const =0 |
|
virtual std::unique_ptr< PathSegmentGenerator > | createPathSegmentGenerator () const =0 |
|
virtual double | diagonal (int m) const =0 |
|
virtual int | dimension () const =0 |
|
virtual int | numCells () const =0 |
|
virtual Position | randomPositionInCell (int m) const =0 |
|
virtual double | volume (int m) const =0 |
|
virtual void | writeGridPlotFiles (const SimulationItem *probe) const |
|
template<class T > |
T * | find (bool setup=true) const |
|
template<class T > |
T * | interface (int levels=-999999, bool setup=true) const |
|
virtual string | itemName () const |
|
void | setup () |
|
string | typeAndName () const |
|
| Item (const Item &)=delete |
|
virtual | ~Item () |
|
void | addChild (Item *child) |
|
const vector< Item * > & | children () const |
|
virtual void | clearItemListProperty (const PropertyDef *property) |
|
void | destroyChild (Item *child) |
|
virtual bool | getBoolProperty (const PropertyDef *property) const |
|
virtual vector< double > | getDoubleListProperty (const PropertyDef *property) const |
|
virtual double | getDoubleProperty (const PropertyDef *property) const |
|
virtual string | getEnumProperty (const PropertyDef *property) const |
|
virtual int | getIntProperty (const PropertyDef *property) const |
|
virtual vector< Item * > | getItemListProperty (const PropertyDef *property) const |
|
virtual Item * | getItemProperty (const PropertyDef *property) const |
|
virtual string | getStringProperty (const PropertyDef *property) const |
|
int | getUtilityProperty (string name) const |
|
virtual void | insertIntoItemListProperty (const PropertyDef *property, int index, Item *item) |
|
Item & | operator= (const Item &)=delete |
|
Item * | parent () const |
|
virtual void | removeFromItemListProperty (const PropertyDef *property, int index) |
|
virtual void | setBoolProperty (const PropertyDef *property, bool value) |
|
virtual void | setDoubleListProperty (const PropertyDef *property, vector< double > value) |
|
virtual void | setDoubleProperty (const PropertyDef *property, double value) |
|
virtual void | setEnumProperty (const PropertyDef *property, string value) |
|
virtual void | setIntProperty (const PropertyDef *property, int value) |
|
virtual void | setItemProperty (const PropertyDef *property, Item *item) |
|
virtual void | setStringProperty (const PropertyDef *property, string value) |
|
void | setUtilityProperty (string name, int value) |
|
virtual string | type () const |
|
| Box () |
|
| Box (double xmin, double ymin, double zmin, double xmax, double ymax, double zmax) |
|
| Box (Vec rmin, Vec rmax) |
|
void | cellIndices (int &i, int &j, int &k, Vec r, int nx, int ny, int nz) const |
|
Vec | center () const |
|
bool | contains (const Box &box) const |
|
bool | contains (double x, double y, double z) const |
|
bool | contains (Vec r) const |
|
double | diagonal () const |
|
const Box & | extent () const |
|
void | extent (double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) const |
|
Vec | fracPos (double xfrac, double yfrac, double zfrac) const |
|
Vec | fracPos (int xd, int yd, int zd, int xn, int yn, int zn) const |
|
bool | intersects (const Box &box) const |
|
bool | intersects (Vec r, const Vec k, double &smin, double &smax) const |
|
bool | intersects (Vec rc, double r) const |
|
Vec | rmax () const |
|
Vec | rmin () const |
|
double | volume () const |
|
Vec | widths () const |
|
double | xmax () const |
|
double | xmin () const |
|
double | xwidth () const |
|
double | ymax () const |
|
double | ymin () const |
|
double | ywidth () const |
|
double | zmax () const |
|
double | zmin () const |
|
double | zwidth () const |
|
The CartesianSpatialGrid class is subclass of the BoxSpatialGrid class, and represents three-dimensional spatial grids based on a regular Cartesian grid. Each cell in such a grid is a little cuboid (not necessarily all with the same size or axis ratios).
Box CartesianSpatialGrid::box |
( |
int |
m | ) |
const |
|
private |
This function calculates the three bin indices \(i\), \(j\) and \(k\) of the cell index \(m\), and then returns the coordinates of the corresponding cell as a Box object. Since the relation between the index and the three bin indices is \(m=k+j\,N_z+i\,N_y\,N_z\), we can use the formulae
\[ \begin{split} i &= \lfloor
m/(N_y\,N_z) \rfloor \\ j &= \lfloor (m-i\,N_y\,N_z)/N_z \rfloor \\ k &=
m\,{\text{mod}}\,N_z. \end{split} \]
Position CartesianSpatialGrid::centralPositionInCell |
( |
int |
m | ) |
const |
|
overridevirtual |
This function returns the central location from the cell with index \(m\). For a cartesian grid, the function first determines the bin indices \(i\) and \(k\) in the X, Y and Z directions that correspond to the index \(m\). Then the coordinates \(x\), \(y\) and \(z\) are determined using
\[ \begin{split} x &= \frac{x_i + x_{i+1}}{2} \\
y &= \frac{y_j + y_{j+1}}{2} \\ z &= \frac{z_k + z_{k+1}}{2} \end{split} \]
A position with these cartesian coordinates is returned.
Implements SpatialGrid.
Position CartesianSpatialGrid::randomPositionInCell |
( |
int |
m | ) |
const |
|
overridevirtual |
This function returns a random location from the cell with index \(m\). For a cartesian grid, the function first determines the bin indices \(i\) and \(k\) in the X, Y and Z directions that correspond to the index \(m\). Then random coordinates \(x\), \(y\) and \(z\) are determined using
\[ \begin{split} x &= x_i + {\cal{X}}_1\,(x_{i+1}-x_i) \\
y &= y_j + {\cal{X}}_2\,(y_{j+1}-y_j) \\ z &= z_k + {\cal{X}}_3\, (z_{k+1}-z_k),
\end{split} \]
with \({\cal{X}}_1\), \({\cal{X}}_2\) and \({\cal{X}}_3\) three uniform deviates. A position with these cartesian coordinates is returned.
Implements SpatialGrid.