#include <ClumpySphericalSpatialGrid.hpp>

Public Member Functions | |
| ~ClumpySphericalSpatialGrid () | |
| 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 |
| string | filename () 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 StructuredSphereSpatialGrid | |
| int | cellIndex (Position bfr) const override |
| Position | centralPositionInCell (int m) const override |
| double | diagonal (int m) const override |
| int | dimension () const override |
| Mesh * | meshAzimuthal () const |
| 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 |
| double | minRadius () 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 |
Protected Member Functions | |
| ClumpySphericalSpatialGrid () | |
| double | meshEpsilonScale () const 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 StructuredSphereSpatialGrid | |
| StructuredSphereSpatialGrid () | |
| bool | getCoords (int m, double &rmin, double &thetamin, double &phimin, double &rmax, double &thetamax, double &phimax) const |
| int | index (int i, int j, int k) const |
| 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 |
| void | writeMeridionalStructure (SpatialGridPlotFile *outfile) const |
| Protected Member Functions inherited from SphereSpatialGrid | |
| SphereSpatialGrid () | |
| void | setupSelfBefore () override |
| Protected Member Functions inherited from SpatialGrid | |
| SpatialGrid () | |
| Random * | random () const |
| Protected Member Functions inherited from SimulationItem | |
| SimulationItem () | |
| virtual bool | offersInterface (const std::type_info &interfaceTypeInfo) const |
| Protected Member Functions inherited from Item | |
| Item () | |
Private Types | |
| using | BaseType |
| using | Clump |
| using | ItemType |
Private Attributes | |
| SphericalClumpBVH * | _bvh |
| vector< Clump > | _clumps |
| string | _filename |
| int | _numClumps |
Friends | |
| class | ItemRegistry |
| class | MySegmentGenerator |
Additional Inherited Members | |
| Static Protected Member Functions inherited from SphereSpatialGrid | |
| static int | initPolarGrid (Array &thetav, Array &cosv, const Mesh *mesh) |
| Protected Attributes inherited from StructuredSphereSpatialGrid | |
| vector< double > | _cellVolume |
| Array | _cosv |
| Array | _cv |
| double | _eps |
| int | _Ncells |
| int | _Nphi |
| int | _Nr |
| int | _Ntheta |
| Array | _phiv |
| Array | _rv |
| Array | _sinv |
| Array | _thetav |
An instance of the ClumpySphericalSpatialGrid class represents a spatial grid that superposes a classic 3D spherical grid (as offered by the StructuredSphereSpatialGrid class) with a set of spherical clumps. It is intended for models that need a multi-scale clump geometry – as used, for example, in some models of the obscuring structure around Active Galactic Nuclei – combined with a background medium that need not be uniform.
Geometry of the grid
The spatial domain of this grid is the spherical shell bounded by the inner and outer radii \(r_\text{min}\ge0\) and \(r_\text{max}>r_\text{min}\) (the inner radius may be exactly zero, so that the domain includes the origin). Any medium outside of this shell is ignored.
Within this shell, a classic 3D grid in spherical coordinates is defined through three sets of grid points exactly as described for the StructuredSphereSpatialGrid class (radial, polar and azimuthal meshes). In addition, a number of spheres ("clumps") with centers and radii loaded from an input file are superposed on this structured grid. The clumps must be fully contained in the domain and are not allowed to overlap each other, but a clump is allowed to straddle the walls of one or more cells of the structured grid.
The grid cells partitioning the spatial domain thus consist of a number of spheres (the clumps) plus the cells of the structured grid, each of the latter reduced in volume by the portion of any clumps overlapping it. As a consequence, medium properties will be uniform within each clump, and uniform within each structured-grid cell that is not overlapped by a clump.
Configuring the medium
During setup, as for any spatial grid, SKIRT will sample the medium properties within each spatial cell from the configured medium distribution. While any type of configuration will work, it makes most sense to specify a medium distribution that closely matches the geometry of this specialty grid. This can be accomplished by using a ParticleMedium with the UniformSmoothingKernel to match the spheres in the grid geometry. The background medium can be specified through any built-in geometry, such as a ShellGeometry or more likely a TorusGeometry. In the latter case, it is worthwile to ensure that the polar mesh configured for this specialty grid includes grid points exactly matching the opening angle boundaries of the torus.
If the model includes multiple media types, different medium components can be combined (for example, one ParticleMedium for dust clumps and another one for gas clumps).
The first four columns of the ParticleMedium import file specify the center position and radius of each clump. The same file can be read by this specialty grid class to define the spheres; the additional columns in the file are ignored. (If there are multiple ParticleMedium instances, the import files should be concatenated to define all spheres).
This specialty grid class removes spheres from the imported list that (1) do not fully lie inside the spherical shell domain or (2) overlap any of the previously read spheres. Obviously, the ParticleMedium does NOT do this. As a result, the mass of these spheres will be taken into account while sampling the density of the spatial grid cells, most likely distorting the intended values. It is therefore best to ensure that the imported spheres are disjoint and inside the domain.
This item type is displayed only if the Boolean expression "Level3" evaluates to true after replacing the names by true or false depending on their presence.
|
inlineprotected |
Default constructor for concrete Item subclass ClumpySphericalSpatialGrid: "a specialty spatial grid superposing a 3D spherical grid with spherical clumps".
| ClumpySphericalSpatialGrid::~ClumpySphericalSpatialGrid | ( | ) |
The destructor destroys the BVH data structure.
|
overridevirtual |
This function returns the index \(m\) of the cell that contains the position \({\bf{r}}\), or -1 if the position is outside the domain. Cell indices \(0\) through \(N_\text{clumps}-1\) refer to the clumps, in the order in which they were retained during setup; cell indices \(N_\text{clumps}\) and up refer to the cells of the structured grid, offset by \(N_\text{clumps}\) from the index that StructuredSphereSpatialGrid::cellIndex() would assign them on its own. Because a clump can straddle the walls of one or more structured cells, the position is tested against the clumps first (using the bounding volume hierarchy, which gives an exact answer regardless of how thin a clump's overlap with a given structured cell is); only if it is not inside any clump is it located in the structured grid.
Implements SpatialGrid.
|
overridevirtual |
This function returns the central location of the cell with index \(m\). For a clump, this is the center of the sphere. For a structured cell, the function first tries the nominal cell-center position; if that position happens to be inside one of the clumps, a random position is returned instead.
Implements SpatialGrid.
|
overridevirtual |
This function creates and hands over ownership of a path segment generator (an instance of a PathSegmentGenerator subclass) appropriate for this spatial grid type.
Implements SpatialGrid.
|
overridevirtual |
This function returns the diagonal of the cell with index \(m\). For a clump, this is the diagonal of the sphere. For a structured cell, this is the distance between the cell's inner/lower and outer/upper corners, exactly as for the StructuredSphereSpatialGrid class.
Implements SpatialGrid.
|
inline |
This function returns the value of the discoverable string property filename: "the name of the file defining the spherical clumps".
|
overrideprotectedvirtual |
This function returns a more conservative (larger) epsilon scale factor than the base class's default, since paths in this class cross more boundaries of more varied kinds (structured-cell walls interleaved with clump entries and exits) within a given region.
Reimplemented from StructuredSphereSpatialGrid.
|
overridevirtual |
This function returns the number of cells in the grid, which equals the number of spherical clumps plus the number of cells in the structured grid.
Implements SpatialGrid.
|
overridevirtual |
This function returns a random location from the cell with index \(m\). For a clump, a random position within the sphere is generated through analytical inversion. For a structured cell, a random position within the cell's nominal spherical-coordinate ranges is generated through analytical inversion, which is then rejected iteratively as long as it happens to be inside one of the clumps.
Implements SpatialGrid.
|
overridevirtual |
This function calls the setup of the base class to build the structured grid, reads the input file defining the spherical clumps, and builds the data structures needed for the operation of the grid, including the Monte Carlo estimate of the volume of each structured cell that is reduced by one or more overlapping clumps.
Reimplemented from SimulationItem.
|
overridevirtual |
This function returns the volume of the cell with index \(m\). For a clump, this is the spherical volume. For a structured cell, this is the nominal cell volume minus the combined volume of the portions of any overlapping clumps, as estimated (and cached) during setup.
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 the grid structure to the specified SpatialGridPlotFile object. It calls the base class implementation to write the structured grid, and then adds a coarse wireframe sphere for each clump.
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.