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

#include <StateVariable.hpp>

Public Types

enum class  Identifier {
  Volume , BulkVelocity , MagneticField , NumberDensity ,
  Metallicity , Temperature , Custom
}
 

Public Member Functions

int customIndex () const
 
const string & description () const
 
char format () const
 
Identifier identifier () const
 
const string & quantity () const
 

Static Public Member Functions

static StateVariable bulkVelocity ()
 
static StateVariable custom (int customIndex, string description, string quantity, char format='e')
 
static StateVariable magneticField ()
 
static StateVariable metallicity ()
 
static StateVariable numberDensity ()
 
static StateVariable temperature ()
 
static StateVariable volume ()
 

Private Member Functions

 StateVariable (Identifier identifier, int customIndex, string description, string quantity, char format)
 

Private Attributes

int _customIndex
 
string _description
 
char _format
 
Identifier _identifier
 
string _quantity
 

Detailed Description

StateVariable is a helper class for holding metadata about a medium state variable. For example, the MaterialMix::specificStateVariableInfo() function returns a list of StateVariable instances describing the specific state variables used by the receiving material mix. This allows the MediumSystem class to allocate storage for the appropriate set of state variables, and it allows probing the relevant medium state variables for output.

For each spatial cell in the simulation, the medium state includes a set of common state variables shared by all medium components and a set of specific state variables for each individual medium component. Refer to the MediumState class for a list of state variables that may be present in each of these sets.

Each StateVariable instance includes an identifier specifying one of the supported state variables. Multiple custom variables can be specified by adding an index \(0 \le k < K\) to the base identifier, where \(K\) is the total number of custom variables. The StateVariable instance also includes a human-readable description of the quantity being represented, a unit system quantity definition (string), and a text output format specifier. This information allows custom variables to be output by generic probes or to be handled by portions of the code that cooperate specifically with this type of material mix, such as recipes for adjusting the medium state based on the calculated radiation field.

This class includes explicit support for the known state variables. Use one of the factory functions to construct a StateVariable instance.

Member Enumeration Documentation

◆ Identifier

enum class StateVariable::Identifier
strong

This enumeration lists the identifiers for the supported state variables as indicated in the table in the class header.

Constructor & Destructor Documentation

◆ StateVariable()

StateVariable::StateVariable ( Identifier  identifier,
int  customIndex,
string  description,
string  quantity,
char  format 
)
private

This constructor initializes a state variiable object with the given information for each field. The constructor is private; to construct a StateVariable instance, use one of the factory functions instead.

Member Function Documentation

◆ bulkVelocity()

static StateVariable StateVariable::bulkVelocity ( )
static

This function returns a StateVariable instance of type BulkVelocity.

◆ custom()

static StateVariable StateVariable::custom ( int  customIndex,
string  description,
string  quantity,
char  format = 'e' 
)
static

This function returns a StateVariable instance of type Custom with the specified index and descriptive information. The latter includes a human-readable description of the quantity being represented, a unit system quantity definition, and a text output format specifier, i.e. 'd' for integer notation (even if the value is stored as a double), 'f' for fixed point notation, 'e' for scientific notation, and 'g' for the most concise 'f' or 'e'. The default format specifier is 'e'.

◆ customIndex()

int StateVariable::customIndex ( ) const
inline

This function returns the custom index for the state variable if it is of type Custom, or zero otherwise.

◆ description()

const string & StateVariable::description ( ) const
inline

This function returns human-readable description for the state variable.

◆ format()

char StateVariable::format ( ) const
inline

This function returns the format specifier for the state variable, i.e. 'd' for integer notation (even if the value is stored as a double), 'f' for fixed point notation, 'e' for scientific notation, and 'g' for the most concise 'f' or 'e'.

◆ identifier()

Identifier StateVariable::identifier ( ) const
inline

This function returns the identifier for the state variable. All custom variables have the same identifier; they can be told apart through the customIndex() function().

◆ magneticField()

static StateVariable StateVariable::magneticField ( )
static

This function returns a StateVariable instance of type MagneticField.

◆ metallicity()

static StateVariable StateVariable::metallicity ( )
static

This function returns a StateVariable instance of type Metallicity.

◆ numberDensity()

static StateVariable StateVariable::numberDensity ( )
static

This function returns a StateVariable instance of type NumberDensity.

◆ quantity()

const string & StateVariable::quantity ( ) const
inline

This function returns the string defining the physical quantity represented by the state variable.

◆ temperature()

static StateVariable StateVariable::temperature ( )
static

This function returns a StateVariable instance of type Temperature.

◆ volume()

static StateVariable StateVariable::volume ( )
static

This function returns a StateVariable instance of type Volume.


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