#include <Sphere2DSpatialGrid.hpp>
Public Member Functions | |
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 |
int | dimension () const override |
Mesh * | meshPolar () const |
Mesh * | meshRadial () const |
int | numCells () const override |
Position | randomPositionInCell (int m) const override |
void | setupSelfAfter () override |
double | volume (int m) const override |
Public Member Functions inherited from SphereSpatialGrid | |
Box | boundingBox () const override |
double | maxRadius () const |
Public Member Functions inherited from SpatialGrid | |
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 |
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 |
Protected Member Functions | |
Sphere2DSpatialGrid () | |
void | write_xy (SpatialGridPlotFile *outfile) const override |
void | write_xz (SpatialGridPlotFile *outfile) const override |
Protected Member Functions inherited from SphereSpatialGrid | |
SphereSpatialGrid () | |
Protected Member Functions inherited from SpatialGrid | |
SpatialGrid () | |
Random * | random () const |
void | setupSelfBefore () override |
virtual void | write_xy (SpatialGridPlotFile *outfile) const |
virtual void | write_xyz (SpatialGridPlotFile *outfile) const |
virtual void | write_xz (SpatialGridPlotFile *outfile) const |
virtual void | write_yz (SpatialGridPlotFile *outfile) const |
Protected Member Functions inherited from SimulationItem | |
SimulationItem () | |
virtual bool | offersInterface (const std::type_info &interfaceTypeInfo) const |
virtual void | setupSelfAfter () |
virtual void | setupSelfBefore () |
Protected Member Functions inherited from Item | |
Item () | |
Private Types | |
using | BaseType = SphereSpatialGrid |
using | ItemType = Sphere2DSpatialGrid |
Private Member Functions | |
int | index (int i, int k) const |
void | invertIndex (int m, int &i, int &k) const |
Private Attributes | |
Array | _cv |
Mesh * | _meshPolar |
Mesh * | _meshRadial |
int | _Nr |
int | _Ntheta |
Array | _rv |
Array | _thetav |
Friends | |
class | ItemRegistry |
class | MySegmentGenerator |
The Sphere2DSpatialGrid class is subclass of the SphereSpatialGrid class, and represents axisymmetric spatial grids based on spherical coordinates. The grid is defined in the meridional plane and rotated around the Z-axis. The meridional grid is specified through a set of \(N_r+1\) radial grid points \(r_i\) (with \(i=0,\ldots,N_r\)) and a set of \(N_\theta+1\) angular grid points \(\theta_k\) (with \(k=0,\ldots,N_\theta\)). In total there are \(N_{\text{cells}} = N_r\,N_\theta\) cells in the grid.
This item type is allowed only if the Boolean expression "!Dimension3" evaluates to true after replacing the names by true or false depending on their presence.
This item type is displayed only if the Boolean expression "Level2" evaluates to true after replacing the names by true or false depending on their presence.
|
inlineprotected |
Default constructor for concrete Item subclass Sphere2DSpatialGrid : "an axisymmetric spatial grid in spherical coordinates" .
|
overridevirtual |
This function returns the number of the cell that contains the position \({\bf{r}}\). In this class, the function determines the radial and angular bin indices and calculates the correct cell index based on these two numbers.
Implements SpatialGrid.
|
overridevirtual |
This function returns the central location from the cell with index \(m\). In this class, the function first determines the radial and angular bin indices \(i\) and \(k\) that correspond to the cell index \(m\). The spherical coordinates of the central position are subsequently determined from
\[ \begin{split} r &= \frac{r_i + r_{i+1}}{2} \\ \theta &= \frac{\theta_k + \theta_{k+1}}{2} \\ \phi &= 0. \end{split} \]
Implements SpatialGrid.
|
overridevirtual |
This function creates and hands over ownership of a path segment generator (an instance of a PathSegmentGenerator subclass) appropriate for a 2D spherical grid, implemented as a private PathSegmentGenerator subclass. The algorithm used to construct the path is described below.
We represent the path by its parameter equation \({\bf{x}}={\bf{r}}+s\,{\bf{k}}\), and we assume that \({\bf{k}}\) is a unit vector. The two intersection points with a radial boundary sphere \({\bf{x}}^2=R^2\) are obtained by solving the quadratic equation \(s^2 + 2\,({\bf{r}}\cdot{\bf{k}})\,s + ({\bf{r}}^2-R^2)=0\) for \(s\). The two intersection points with an angular boundary cone \(x_z^2=c^2\,{\bf{x}}^2\) (with \(c=\cos\theta\)) are obtained by solving the quadratic equation \((c^2-k_z^2)\,s^2 + 2\,(c^2\,{\bf{r}}\cdot{\bf{k}}-r_z k_z)\,s + (c^2\,{\bf{r}}^2-r_z^2)=0\) for \(s\). The intersection points with the reflected cone are always more distant than the other cell boundaries (the requirement to include the xy-plane \(\theta=\pi/2\) in the grid ensures that this is true) and thus these phantom points are automatically ignored.
Implements SpatialGrid.
|
overridevirtual |
This function returns the "diagonal" of the cell with index \(m\). For 2D spherical grids, it returns the distance between the outer/upper and inner/lower corners of the cell in the meridional plane.
Implements SpatialGrid.
|
overridevirtual |
This function returns the dimension of the grid, which is 2 for this class.
Implements SpatialGrid.
|
private |
This private function returns the cell index corresponding to the radial index \(i\) and the angular index \(k\). The correspondence is simply \(m=k+N_\theta\,i\).
|
private |
This private function calculates the radial index \(i\) and the angular index \(k\) from a cell index \(m\). As the correspondence between \(m\), \(i\) and \(k\) is given by \(m=k+N_\theta\,i\), one directly obtains \(i=\lfloor m/N_\theta \rfloor\) and \(k=m\!\mod N_\theta\).
|
inline |
This function returns the value of the discoverable item property meshPolar : "the bin distribution in the polar 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 meshRadial : "the bin distribution in the radial 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.
|
overridevirtual |
This function returns a random location from the cell with index \(m\). In this class, the function first determines the radial and angular bin indices \(i\) and \(k\) that correspond to the cell index \(m\). Then a random radius \(r\), a random inclination \(\theta\), and a random azimuth \(\phi\) are determined using
\[ \begin{split} r &= \left( r_i^3 + {\cal{X}}_1\,(r_{i+1}^3-r_i^3) \right)^{1/3} \\ \cos\theta &= \cos\theta_k + {\cal{X}}_2\, (\cos\theta_{k+1}-\cos\theta_k) \\ \phi &= 2\pi\,{\cal{X}}_3, \end{split} \]
with \({\cal{X}}_1\), \({\cal{X}}_2\) and \({\cal{X}}_3\) three uniform deviates.
Implements SpatialGrid.
|
overridevirtual |
This function sets up a number of data members. It also pre-calculates and stores the opening angle cosines \(c_k = \cos\theta_k\) for the boundary cones in the angular grid, to help speed up calculations in the path() method.
Reimplemented from SimulationItem.
|
overridevirtual |
This function returns the volume of the cell with index \(m\). In this class, the function determines the radial and angular bin indices \(i\) and \(k\) that correspond to the cell index \(m\), and then calculates the volume as
\[ V = \frac{2\pi}{3} \left(r_{i+1}^3-r_i^3\right) \left(\cos\theta_k-\cos\theta_{k+1}\right). \]
Implements SpatialGrid.
|
overrideprotectedvirtual |
This function writes the intersection of the grid with the xy plane to the specified SpatialGridPlotFile object.
Reimplemented from SpatialGrid.
|
overrideprotectedvirtual |
This function writes the intersection of the grid with the xz plane to the specified SpatialGridPlotFile object.
Reimplemented from SpatialGrid.