#include <SpatialCellLibrary.hpp>
Public Member Functions | |
virtual vector< int > | mapping (const Array &bv) const =0 |
virtual int | numEntries () const =0 |
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 | |
SpatialCellLibrary () | |
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 = SimulationItem |
using | ItemType = SpatialCellLibrary |
Friends | |
class | ItemRegistry |
SpatialCellLibrary is an abstract base class for providing spatial cell grouping schemes called libraries. A library maps a number of spatial cells to a single library entry based on some predefined scheme, such as similarities in the stored radiation field or other cell properties. This in turn allows a client to perform common (possibly approximate) calculations for all of the cells mapped to the same library entry, trading accuracy for speed. This base class offers just an interface that must be implemented in each subclass.
The SpatialCellLibrary class and its subclasses support the implementation of a library mechanism as described in Baes et al. (2011, ApJS, 196, 22). Instead of calculating the emission spectrum individually for every spatial cell in the system, a library is constructed, a template spectrum is calculated for each library entry, and these templates are used for all spatial cells mapped to the corresponding library entry. Obviously, the spectral templates in the library should be chosen/constructed in such a way that they can represent the whole range of actual spectra encountered in the simulation. In other words, the library should span the entire parameter space of interstellar radiation fields. Different subclasses of the SpatialCellLibrary class achieve this goal to different degrees of sophistication, with a better coverage of the parameter space typically at the cost of a more resource-intensive library construction.
|
inlineprotected |
Default constructor for abstract Item subclass SpatialCellLibrary : "a library scheme for grouping spatial cells" .
|
pure virtual |
This function returns a vector nv with length \(N_\text{cells}\) that maps each cell index \(m\) to the corresponding library entry index \(n_m\). The indices in the returned vector are in the range \([-1,N_\text{entries}-1]\). An index value of -1 indicates that the cell is not included in the mapping and should not be used (for example, because the cell will produce a negligible amount of emission or no emission at all).
The argument array bv with length \(N_\text{cells}\) provides a value passed from the caller for each cell in the spatial grid. If the value is zero, the cell will not be used by the caller regardless of the returned mapping index, and thus it can safely be omitted from the mapping (i.e. given an index of -1). If the bv value for the cell is nonzero, the caller plans to use the cell, but it will still refrain from doing so if the library decides not to map the cell (i.e. give it an index of -1).
This function must be implemented by each subclass.
Implemented in AllCellsLibrary, FieldStrengthCellLibrary, and TemperatureWavelengthCellLibrary.
|
pure virtual |
This function returns the number of entries \(N_\text{entries}\) in the library. Library entries might remain unused in the sense that none of the indices returned by the mapping() function point to these entries. This function must be implemented by each subclass.
Implemented in AllCellsLibrary, FieldStrengthCellLibrary, and TemperatureWavelengthCellLibrary.