The SKIRT project
advanced radiative transfer for astrophysics
BoxCellDensityMixIn Class Referenceabstract

#include <BoxCellDensityMixIn.hpp>

Inheritance diagram for BoxCellDensityMixIn:

Public Member Functions

double numberDensity (int h, int m) const override
Public Member Functions inherited from DensityInCellInterface
virtual ~DensityInCellInterface ()

Protected Member Functions

 BoxCellDensityMixIn ()
virtual Box cellBox (int m) const =0
bool offersInterface () const
void setup (SimulationItem *item)
Protected Member Functions inherited from DensityInCellInterface
 DensityInCellInterface ()

Private Attributes

bool _enabled
vector< MassInBoxInterface * > _mibv

Detailed Description

The BoxCellDensityMixIn class implements the DensityInCellInterface for spatial grids that have spatial cells in the form of axes-aligned bounding boxes, and that reside in a simulation where all medium components offer the MassInBoxInterface (e.g., imported smoothed particles).

Eligible spatial grid classes should inherit ("mix-in") this class so that the medium density in a cell can be calculated directly without the need for random sampling.

Constructor & Destructor Documentation

◆ BoxCellDensityMixIn()

BoxCellDensityMixIn::BoxCellDensityMixIn ( )
protected

The default constructor initializes the data members to indicate that the DensityInCellInterface is disabled.

Member Function Documentation

◆ cellBox()

virtual Box BoxCellDensityMixIn::cellBox ( int m) const
protectedpure virtual

This function must be implemented in the inheriting class. It returns the axis-aligned bounding box defining the cell with index \(m\),

Implemented in CartesianSpatialGrid, and TreeSpatialGrid.

◆ numberDensity()

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

This function implements the DensityInCellInterface. It returns the number density for medium component h in the spatial grid cell with index m.

Implements DensityInCellInterface.

◆ offersInterface()

bool BoxCellDensityMixIn::offersInterface ( ) const
protected

This function must be called from the inheriting class to implement its offersInterface() function. It returns true if the DensityInCellInterface is enabled, and false if not. The function assumes that setup() has properly been called.

◆ setup()

void BoxCellDensityMixIn::setup ( SimulationItem * item)
protected

This function must be called from the inheriting class during setup. It verifies whether the DensityInCellInterface can actually be enabled and if so, caches some information to accelerate the operation later on. Specifically, the interface can be enabled only if all medium components in the simulation offer the MassInBoxInterface.

The argument is used to locate the medium components in the simulation; it should point to the inheriting class.


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