The SKIRT project
advanced radiative transfer for astrophysics
Public Member Functions | Protected Member Functions | Private Types | Private Attributes | Friends | List of all members
AdaptiveMeshSpatialGrid Class Reference

#include <AdaptiveMeshSpatialGrid.hpp>

Inheritance diagram for AdaptiveMeshSpatialGrid:
Inheritance graph
[legend]

Public Member Functions

Box boundingBox () const override
 
int cellIndex (Position bfr) const override
 
Position centralPositionInCell (int m) const override
 
std::unique_ptr< PathSegmentGeneratorcreatePathSegmentGenerator () const override
 
double diagonal (int m) const override
 
int dimension () const override
 
double numberDensity (int h, int m) const override
 
int numCells () const override
 
Position randomPositionInCell (int m) const override
 
void setupSelfBefore () override
 
double volume (int m) const override
 
- 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< PathSegmentGeneratorcreatePathSegmentGenerator () 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 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
 
- Public Member Functions inherited from DensityInCellInterface
virtual ~DensityInCellInterface ()
 
virtual double numberDensity (int h, int m) const =0
 

Protected Member Functions

 AdaptiveMeshSpatialGrid ()
 
bool offersInterface (const std::type_info &interfaceTypeInfo) 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 SpatialGrid
 SpatialGrid ()
 
Randomrandom () 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 ()
 
- Protected Member Functions inherited from DensityInCellInterface
 DensityInCellInterface ()
 

Private Types

using BaseType = SpatialGrid
 
using ItemType = AdaptiveMeshSpatialGrid
 

Private Attributes

AdaptiveMeshSnapshot_mesh
 
double _norm
 

Friends

class ItemRegistry
 

Detailed Description

An instance of the AdaptiveMeshSpatialGrid class represents a three-dimensional spatial grid, the structure of which is described by an imported adaptive mesh. In fact, this class directly uses the adaptive mesh created by an AdaptiveMeshGeometry or AdaptiveMeshMedium object. For this to work, the medium system must include at least one component that uses an imported AdaptiveMeshSnapshot to represent its spatial distribution. If multiple media components are based on an imported AdaptiveMeshSnapshot, the first component (in configuration order) is used for the spatial grid.

This item type is allowed only if the Boolean expression "AdaptiveMeshInterface" 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.

Constructor & Destructor Documentation

◆ AdaptiveMeshSpatialGrid()

AdaptiveMeshSpatialGrid::AdaptiveMeshSpatialGrid ( )
inlineprotected

Default constructor for concrete Item subclass AdaptiveMeshSpatialGrid : "a spatial grid taken from an imported adaptive mesh snapshot" .

Member Function Documentation

◆ boundingBox()

Box AdaptiveMeshSpatialGrid::boundingBox ( ) const
overridevirtual

This function returns the bounding box that encloses the grid.

Implements SpatialGrid.

◆ cellIndex()

int AdaptiveMeshSpatialGrid::cellIndex ( Position  bfr) const
overridevirtual

This function returns the index \(m\) of the cell that contains the position \({\bf{r}}\).

Implements SpatialGrid.

◆ centralPositionInCell()

Position AdaptiveMeshSpatialGrid::centralPositionInCell ( int  m) const
overridevirtual

This function returns the central location of the cell with index \(m\).

Implements SpatialGrid.

◆ createPathSegmentGenerator()

std::unique_ptr< PathSegmentGenerator > AdaptiveMeshSpatialGrid::createPathSegmentGenerator ( ) const
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. For the adaptive mesh grid, the path segment generator is actually implemented in the AdaptiveMeshSnapshot class.

Implements SpatialGrid.

◆ diagonal()

double AdaptiveMeshSpatialGrid::diagonal ( int  m) const
overridevirtual

This function returns the diagonal of the cell with index \(m\).

Implements SpatialGrid.

◆ dimension()

int AdaptiveMeshSpatialGrid::dimension ( ) const
overridevirtual

This function returns the dimension of the grid, which is always 3 for an adaptive mesh.

Implements SpatialGrid.

◆ numberDensity()

double AdaptiveMeshSpatialGrid::numberDensity ( int  h,
int  m 
) const
overridevirtual

This function implements the DensityInCellInterface interface. It returns the number density for medium component \(h\) in the grid cell with index \(m\). For an adaptive mesh grid, this interface can be offered only when the medium system consists of a single component, which then, by definition, supplies the adaptive mesh. Thus, the component index \(h\) passed to this function should always be zero; in fact, its value is actually ignored.

Implements DensityInCellInterface.

◆ numCells()

int AdaptiveMeshSpatialGrid::numCells ( ) const
overridevirtual

This function returns the number of cells in the grid.

Implements SpatialGrid.

◆ offersInterface()

bool AdaptiveMeshSpatialGrid::offersInterface ( const std::type_info &  interfaceTypeInfo) const
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 true if the medium system consists of a single component, and false otherwise. For other requested interfaces, the function invokes its counterpart in the base class.

Reimplemented from SimulationItem.

◆ randomPositionInCell()

Position AdaptiveMeshSpatialGrid::randomPositionInCell ( int  m) const
overridevirtual

This function returns a random location from the cell with index \(m\).

Implements SpatialGrid.

◆ setupSelfBefore()

void AdaptiveMeshSpatialGrid::setupSelfBefore ( )
overridevirtual

This function locates the adaptive mesh snapshot in the simulation hierarchy, and remembers a pointer to it.

Reimplemented from SimulationItem.

◆ volume()

double AdaptiveMeshSpatialGrid::volume ( int  m) const
overridevirtual

This function returns the volume of the cell with index \(m\).

Implements SpatialGrid.

◆ write_xy()

void AdaptiveMeshSpatialGrid::write_xy ( SpatialGridPlotFile outfile) const
overrideprotectedvirtual

This function writes the intersection of the grid structure with the xy plane to the specified SpatialGridPlotFile object.

Reimplemented from SpatialGrid.

◆ write_xyz()

void AdaptiveMeshSpatialGrid::write_xyz ( SpatialGridPlotFile outfile) const
overrideprotectedvirtual

This function writes 3D information for all cells in the grid structure to the specified SpatialGridPlotFile object.

Reimplemented from SpatialGrid.

◆ write_xz()

void AdaptiveMeshSpatialGrid::write_xz ( SpatialGridPlotFile outfile) const
overrideprotectedvirtual

This function writes the intersection of the grid structure with the xz plane to the specified SpatialGridPlotFile object.

Reimplemented from SpatialGrid.

◆ write_yz()

void AdaptiveMeshSpatialGrid::write_yz ( SpatialGridPlotFile outfile) const
overrideprotectedvirtual

This function writes the intersection of the grid structure with the yz plane to the specified SpatialGridPlotFile object.

Reimplemented from SpatialGrid.


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