The SKIRT project
advanced radiative transfer for astrophysics
Sphere3DSpatialGrid Class Reference

#include <Sphere3DSpatialGrid.hpp>

Inheritance diagram for Sphere3DSpatialGrid:

Public Member Functions

std::unique_ptr< PathSegmentGeneratorcreatePathSegmentGenerator () 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
MeshmeshAzimuthal () const
MeshmeshPolar () const
MeshmeshRadial () 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 ItemgetItemProperty (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)
Itemoperator= (const Item &)=delete
Itemparent () 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

 Sphere3DSpatialGrid ()
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
virtual double meshEpsilonScale () 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 ()
Randomrandom () 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 ItemType

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

Detailed Description

The Sphere3DSpatialGrid class is a trivial concrete subclass of the StructuredSphereSpatialGrid class, adding nothing beyond the structured grid itself – see the StructuredSphereSpatialGrid class for a description of the grid's geometry. This class provides the path segment generator appropriate for a plain structured grid (i.e. one without any additional embedded geometry).

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.

Constructor & Destructor Documentation

◆ Sphere3DSpatialGrid()

Sphere3DSpatialGrid::Sphere3DSpatialGrid ( )
inlineprotected

Default constructor for concrete Item subclass Sphere3DSpatialGrid: "a 3D spatial grid in spherical coordinates".

Member Function Documentation

◆ createPathSegmentGenerator()

std::unique_ptr< PathSegmentGenerator > Sphere3DSpatialGrid::createPathSegmentGenerator ( ) const
overridevirtual

This function creates and hands over ownership of a path segment generator (an instance of a PathSegmentGenerator subclass) appropriate for a 3D spherical grid, implemented as a private PathSegmentGenerator subclass.

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.

The intersection point with a meriodonal plane \(\sin\varphi_* x = \cos\varphi_* y\) is obtained by

\[ s = -\;\frac{r_\text{x}\sin\varphi_* - r_\text{y}\cos\varphi_*} {k_\text{x}\sin\varphi_* - k_\text{y}\cos\varphi_*} \]

The requirement that \(\varphi_{j+1}-\varphi_j\le2\pi/3\) ensures that the intersection point with the reflected half-plane is always more distant than the other cell boundaries thus that phantom point is automatically ignored.

The segment generator progresses the starting point of the path through the grid along the path's direction. For each step along the way, it calculates the distances to the intersections with all candidate borders of the current cell, and then selects the nearest intersection point.

Implements SpatialGrid.


The documentation for this class was generated from the following file: