#include <CartesianSpatialGrid.hpp>

Public Member Functions | |
| Box | cellBox (int m) const override |
| 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 |
| Mesh * | meshX () const |
| Mesh * | meshY () const |
| Mesh * | meshZ () const |
| int | numCells () const override |
| Position | randomPositionInCell (int m) const override |
| double | volume (int m) const override |
| Public Member Functions inherited from BoxSpatialGrid | |
| 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 |
| Public Member Functions inherited from SpatialGrid | |
| virtual void | writeGridPlotFiles (const SimulationItem *probe) const |
| Public Member Functions inherited from SimulationItem | |
| 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 |
| Public Member Functions inherited from Item | |
| 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 |
| Public Member Functions inherited from Box | |
| 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 |
| void | extend (const Box &box) |
| 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 |
| Public Member Functions inherited from BoxCellDensityMixIn | |
| double | numberDensity (int h, int m) const override |
| Public Member Functions inherited from DensityInCellInterface | |
| virtual | ~DensityInCellInterface () |
Protected Member Functions | |
| CartesianSpatialGrid () | |
| bool | offersInterface (const std::type_info &interfaceTypeInfo) const override |
| void | setupSelfAfter () override |
| void | write_xy (SpatialGridPlotFile *outfile) const override |
| void | write_xyz (SpatialGridPlotFile *outfile) const override |
| void | write_xz (SpatialGridPlotFile *outfile) const override |
| void | write_yz (SpatialGridPlotFile *outfile) const override |
| Protected Member Functions inherited from BoxSpatialGrid | |
| BoxSpatialGrid () | |
| void | setupSelfBefore () override |
| Protected Member Functions inherited from SpatialGrid | |
| SpatialGrid () | |
| Random * | random () const |
| void | setupSelfBefore () override |
| Protected Member Functions inherited from SimulationItem | |
| SimulationItem () | |
| Protected Member Functions inherited from Item | |
| Item () | |
| Protected Member Functions inherited from Box | |
| void | setExtent (const Box &extent) |
| void | setExtent (double xmin, double ymin, double zmin, double xmax, double ymax, double zmax) |
| Protected Member Functions inherited from BoxCellDensityMixIn | |
| BoxCellDensityMixIn () | |
| bool | offersInterface () const |
| void | setup (SimulationItem *item) |
| Protected Member Functions inherited from DensityInCellInterface | |
| DensityInCellInterface () | |
Private Types | |
| using | BaseType |
| using | ItemType |
Private Member Functions | |
| Box | box (int m) const |
| int | index (int i, int j, int k) const |
Private Attributes | |
| Mesh * | _meshX |
| Mesh * | _meshY |
| Mesh * | _meshZ |
| int | _Nx |
| int | _Ny |
| int | _Nz |
| Array | _xv |
| Array | _yv |
| Array | _zv |
Friends | |
| class | ItemRegistry |
| class | MySegmentGenerator |
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 cuboid lined up with the Cartesian coordinate axes. Then cells do not necessarily all have the same size or axis ratios.
|
inlineprotected |
Default constructor for concrete Item subclass CartesianSpatialGrid: "a Cartesian spatial grid".
|
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} \]
|
overridevirtual |
This function returns the box defining the cell with index \(m\), as required by the BoxCellDensityMixIn class. The function determines the bin indices \(i\), \(j\) and \(k\) corresponding to the X, Y and Z directions and returns the corresponding coordinates.
Implements BoxCellDensityMixIn.
|
overridevirtual |
This function returns the index \(m\) of the cell that contains the position \({\bf{r}}\). For a cartesian grid, the function determines the bin indices in the X, Y and Z directions and calculates the correct index based on these indices.
Implements SpatialGrid.
|
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.
|
overridevirtual |
This function creates and hands over ownership of a path segment generator (an instance of a PathSegmentGenerator subclass) appropriate for a cartesian grid, implemented as a private PathSegmentGenerator subclass.
The algorithm used to construct the path is fairly straightforward because all cells are cuboids lined up with the coordinate axes and the neighboring cells are easily found by manipulating cell indices.
Implements SpatialGrid.
|
overridevirtual |
This function returns the diagonal of the cell with index \(m\). For a cartesian grid, the function determines the bin indices \(i\), \(j\) and \(k\) corresponding to the X, Y and Z directions. The diagonal is then easily calculated as \(d = \sqrt{ (x_{i+1}-x_i)^2 + (y_{j+1}-y_j)^2 + (z_{k+1}-z_k)^2 }\).
Implements SpatialGrid.
|
private |
This function returns the index \(m\) corresponding to the three bin indices \(i\), \(j\) and \(k\). The correspondence is \(m=k+j\,N_z+i\,N_y\,N_z\).
|
inline |
This function returns the value of the discoverable item property meshX: "the bin distribution in the X direction".
The default value for this property is given by the conditional value expression "LinMesh".
|
inline |
This function returns the value of the discoverable item property meshY: "the bin distribution in the Y direction".
The default value for this property is given by the conditional value expression "LinMesh".
|
inline |
This function returns the value of the discoverable item property meshZ: "the bin distribution in the Z direction".
The default value for this property is given by the conditional value expression "LinMesh".
|
overridevirtual |
This function returns the number of cells in the grid.
Implements SpatialGrid.
|
overrideprotectedvirtual |
This function is used by the interface() function to ensure that the receiving item can actually offer the specified interface. If the requested interface is the DensityInCellInterface, the implementation in this class returns the value returned by the BoxCellDensityMixIn::offersInterface() function. For other requested interfaces, the function invokes its counterpart in the base class.
Reimplemented from SimulationItem.
|
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.
|
overrideprotectedvirtual |
This function sets up a number of data members that depend on the Mesh objects configured for this grid.
Reimplemented from SimulationItem.
|
overridevirtual |
This function returns the volume of the cell with index \(m\). For a cartesian grid, the function determines the bin indices \(i\), \(j\) and \(k\) corresponding to the X, Y and Z directions. The volume is then easily calculated as \(V = (x_{i+1}-x_i)\, (y_{j+1}-y_j)\, (z_{k+1}-z_k) \).
Implements SpatialGrid.
|
overrideprotectedvirtual |
This function writes the intersection of the grid structure with the xy plane to the specified SpatialGridPlotFile object.
Reimplemented from SpatialGrid.
|
overrideprotectedvirtual |
This function writes 3D information for all cells in the grid structure to the specified SpatialGridPlotFile object.
Reimplemented from SpatialGrid.
|
overrideprotectedvirtual |
This function writes the intersection of the grid structure with the xz plane to the specified SpatialGridPlotFile object.
Reimplemented from SpatialGrid.
|
overrideprotectedvirtual |
This function writes the intersection of the grid structure with the yz plane to the specified SpatialGridPlotFile object.
Reimplemented from SpatialGrid.