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

#include <ImportedMedium.hpp>

Inheritance diagram for ImportedMedium:
Inheritance graph
[legend]

Public Member Functions

Vec bulkVelocity (Position bfr) const override
 
int dimension () const override
 
string filename () const
 
Position generatePosition () const override
 
bool hasMagneticField () const override
 
bool hasMetallicity () const override
 
bool hasParameters () const override
 
bool hasTemperature () const override
 
bool hasVariableMix () const override
 
bool hasVelocity () const override
 
bool importMagneticField () const
 
bool importMetallicity () const
 
bool importTemperature () const
 
bool importVariableMixParams () const
 
bool importVelocity () const
 
Vec magneticField (Position bfr) const override
 
double mass () const override
 
double massDensity (Position bfr) const override
 
double massFraction () const
 
MaterialMixmaterialMix () const
 
MaterialMixFamilymaterialMixFamily () const
 
double maxTemperature () const
 
double metallicity (Position bfr) const override
 
const MaterialMixmix () const override
 
const MaterialMixmix (Position bfr) const override
 
double number () const override
 
double numberDensity (Position bfr) const override
 
int numSites () const override
 
double opticalDepthX (double lambda) const override
 
double opticalDepthY (double lambda) const override
 
double opticalDepthZ (double lambda) const override
 
void parameters (Position bfr, Array &params) const override
 
Position sitePosition (int index) const override
 
const Snapshotsnapshot () const
 
double temperature (Position bfr) const override
 
string useColumns () const
 
virtual Vec bulkVelocity (Position bfr) const =0
 
virtual int dimension () const =0
 
virtual Position generatePosition () const =0
 
virtual bool hasMagneticField () const =0
 
virtual bool hasMetallicity () const =0
 
virtual bool hasParameters () const =0
 
virtual bool hasTemperature () const =0
 
virtual bool hasVariableMix () const =0
 
virtual bool hasVelocity () const =0
 
virtual Vec magneticField (Position bfr) const =0
 
virtual double mass () const =0
 
virtual double massDensity (Position bfr) const =0
 
virtual double metallicity (Position bfr) const =0
 
virtual const MaterialMixmix () const =0
 
virtual const MaterialMixmix (Position bfr) const =0
 
virtual double number () const =0
 
virtual double numberDensity (Position bfr) const =0
 
virtual double opticalDepthX (double lambda) const =0
 
virtual double opticalDepthY (double lambda) const =0
 
virtual double opticalDepthZ (double lambda) const =0
 
virtual void parameters (Position bfr, Array &params) const =0
 
virtual double temperature (Position bfr) 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 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 SiteListInterface
virtual ~SiteListInterface ()
 
virtual int numSites () const =0
 
virtual Position sitePosition (int index) const =0
 

Protected Member Functions

 ImportedMedium ()
 
 ~ImportedMedium ()
 
virtual SnapshotcreateAndOpenSnapshot ()=0
 
void setupSelfAfter () override
 
- Protected Member Functions inherited from Medium
 Medium ()
 
- 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 SiteListInterface
 SiteListInterface ()
 

Private Types

using BaseType = Medium
 
using ItemType = ImportedMedium
 

Private Attributes

string _filename
 
bool _importMagneticField
 
bool _importMetallicity
 
bool _importTemperature
 
bool _importVariableMixParams
 
bool _importVelocity
 
double _massFraction
 
MaterialMix_materialMix
 
MaterialMixFamily_materialMixFamily
 
double _maxTemperature
 
Snapshot_snapshot
 
string _useColumns
 

Friends

class ItemRegistry
 

Detailed Description

ImportedMedium is an abstract class representing transfer media for which the spatial material density distribution (and, optionally, related properties such as the bulk velocity) is imported from an input file. The input data is usually derived from a hydrodynamical simulation snapshot. Various types of snapshots are supported by subclasses of this class. Refer to the subclass documentation for information on the file format.

When an item of this type is used, the names provided by the conditional value expression "Dimension3,SiteListInterface" are inserted into the name sets used for evaluating Boolean expressions.

Properties of sub-types of this type are listed in user interfaces somewhere in between the properties of this type.

Constructor & Destructor Documentation

◆ ImportedMedium()

ImportedMedium::ImportedMedium ( )
inlineprotected

Default constructor for abstract Item subclass ImportedMedium : "a transfer medium imported from snapshot data" .

◆ ~ImportedMedium()

ImportedMedium::~ImportedMedium ( )
protected

The destructor deletes the snapshot object, if present.

Member Function Documentation

◆ bulkVelocity()

Vec ImportedMedium::bulkVelocity ( Position  bfr) const
overridevirtual

This function returns the bulk velocity of the medium at the specified position. If the importVelocity flag is enabled, it simply calls the corresponding function in the snapshot object; otherwise it returns zero velocity.

Implements Medium.

◆ createAndOpenSnapshot()

virtual Snapshot * ImportedMedium::createAndOpenSnapshot ( )
protectedpure virtual

This function constructs a new Snapshot object of the type appropriate for the subclass, calls its open() function, configures the mass or density column, and returns a pointer to the object. Ownership of the Snapshot object is transferred to the caller.

Implemented in AdaptiveMeshMedium, CellMedium, ParticleMedium, and VoronoiMeshMedium.

◆ dimension()

int ImportedMedium::dimension ( ) const
overridevirtual

This function returns the dimension of the medium, which is always 3 for an imported medium.

Implements Medium.

◆ filename()

string ImportedMedium::filename ( ) const
inline

This function returns the value of the discoverable string property filename : "the name of the file to be imported" .

◆ generatePosition()

Position ImportedMedium::generatePosition ( ) const
overridevirtual

This function generates a random position sampled from the medium's spatial density distribution. It simply calls the corresponding function in the snapshot object. In the current implementation, the conversion from number to mass is the same throughout the medium's spatial domain, meaning that there is no difference between sampling from the number density or the mass density. This may change in the future.

Implements Medium.

◆ hasMagneticField()

bool ImportedMedium::hasMagneticField ( ) const
overridevirtual

This function returns true if the importMagneticField flag is enabled for the medium.

Implements Medium.

◆ hasMetallicity()

bool ImportedMedium::hasMetallicity ( ) const
overridevirtual

This function returns true if the medium has a gas or electron material mix and the importMetallicity flag is enabled for the medium.

Implements Medium.

◆ hasParameters()

bool ImportedMedium::hasParameters ( ) const
overridevirtual

This function returns true if custom input model parameters are available for this medium. See the parameters() function for more information.

Implements Medium.

◆ hasTemperature()

bool ImportedMedium::hasTemperature ( ) const
overridevirtual

This function returns true if the medium has a gas or electron material mix and the importTemperature flag is enabled for the medium.

Implements Medium.

◆ hasVariableMix()

bool ImportedMedium::hasVariableMix ( ) const
overridevirtual

This function returns the configured value of the importVariableMixParams flag. If true, this medium may return a different MaterialMix object depending on the specified position. If false, the same object is always returned.

Implements Medium.

◆ hasVelocity()

bool ImportedMedium::hasVelocity ( ) const
overridevirtual

This function returns true if the importVelocity flag is enabled for the medium.

Implements Medium.

◆ importMagneticField()

ImportedMedium::importMagneticField ( ) const
inline

This function returns the value of the discoverable Boolean property importMagneticField : "import magnetic field components (3 columns)" .

The default value for this property is given by the conditional value expression "false" .

This property is displayed only if the Boolean expression "Level3" evaluates to true after replacing the names by true or false depending on their presence.

When a value is entered for this property, the names provided by the conditional value expression "importMagneticField:MagneticField" are inserted into the name sets used for evaluating Boolean expressions.

◆ importMetallicity()

ImportedMedium::importMetallicity ( ) const
inline

This function returns the value of the discoverable Boolean property importMetallicity : "import a metallicity column" .

The default value for this property is given by the conditional value expression "false" .

◆ importTemperature()

ImportedMedium::importTemperature ( ) const
inline

This function returns the value of the discoverable Boolean property importTemperature : "import a temperature column" .

The default value for this property is given by the conditional value expression "false" .

◆ importVariableMixParams()

ImportedMedium::importVariableMixParams ( ) const
inline

This function returns the value of the discoverable Boolean property importVariableMixParams : "import parameter(s) to select a spatially varying material mix" .

The default value for this property is given by the conditional value expression "false" .

This property is displayed only if the Boolean expression "(!NonIdentitySpatialCellLibrary)&Level2" evaluates to true after replacing the names by true or false depending on their presence.

◆ importVelocity()

ImportedMedium::importVelocity ( ) const
inline

This function returns the value of the discoverable Boolean property importVelocity : "import velocity components (3 columns)" .

The default value for this property is given by the conditional value expression "false" .

This property is relevant only if the Boolean expression "Panchromatic" evaluates to true after replacing the names by true or false depending on their presence.

This property is displayed only if the Boolean expression "Level2" evaluates to true after replacing the names by true or false depending on their presence.

When a value is entered for this property, the names provided by the conditional value expression "importVelocity:MediumVelocity" are inserted into the name sets used for evaluating Boolean expressions.

◆ magneticField()

Vec ImportedMedium::magneticField ( Position  bfr) const
overridevirtual

This function returns the magnetic field vector of the medium at the specified position. If the importMagneticField flag is enabled, it simply calls the corresponding function in the snapshot object; otherwise it returns a zero magnetic field.

Implements Medium.

◆ mass()

double ImportedMedium::mass ( ) const
overridevirtual

This function returns the total mass in the medium. The function uses the default material mix (the one at the origin) throughout the complete spatial domain; if the importVariableMixParams flag is enabled, this is an approximation.

Implements Medium.

◆ massDensity()

double ImportedMedium::massDensity ( Position  bfr) const
overridevirtual

This function returns the mass density of the medium at the specified position.

Implements Medium.

◆ massFraction()

ImportedMedium::massFraction ( ) const
inline

This function returns the value of the discoverable double property massFraction : "the fraction of the mass to be included (or one to include all)" .

The minimum value for this property is "[0" .

The maximum value for this property is "1]" .

The default value for this property is given by the conditional value expression "1" .

◆ materialMix()

ImportedMedium::materialMix ( ) const
inline

This function returns the value of the discoverable item property materialMix : "the material type and properties throughout the medium" .

The default value for this property is given by the conditional value expression "MeanInterstellarDustMix" .

This property is relevant only if the Boolean expression "!importVariableMixParams" evaluates to true after replacing the names by true or false depending on their presence.

◆ materialMixFamily()

ImportedMedium::materialMixFamily ( ) const
inline

This function returns the value of the discoverable item property materialMixFamily : "the material mix family addressed by the imported parameter(s)" .

The default value for this property is given by the conditional value expression "SelectDustMixFamily" .

This property is relevant only if the Boolean expression "importVariableMixParams" evaluates to true after replacing the names by true or false depending on their presence.

◆ maxTemperature()

ImportedMedium::maxTemperature ( ) const
inline

This function returns the value of the discoverable double property maxTemperature : "the maximum temperature for included mass (or zero to include all)" .

This property represents a physical quantity of type "temperature" .

The minimum value for this property is "[0 K" .

The maximum value for this property is "1000000 K]" .

The default value for this property is given by the conditional value expression "0 K" .

This property is relevant only if the Boolean expression "importTemperature" evaluates to true after replacing the names by true or false depending on their presence.

◆ metallicity()

double ImportedMedium::metallicity ( Position  bfr) const
overridevirtual

This function returns the metallicity of the medium at the specified position, if defined in the input model. Specifically, if the medium has a gas or electron material mix and the importMetallicity flag is enabled, the function returns the imported metallicity at the specified position. Otherwise, the function returns zero.

Implements Medium.

◆ mix() [1/2]

const MaterialMix * ImportedMedium::mix ( ) const
overridevirtual

This function returns a default MaterialMix object representative of the material properties of the medium.

If the importVariableMixParams flag is enabled, a default material mix is selected from the configured material mix family using the appropriate number of parameters with a value of zero. If the flag is disabled, the fixed configured material mix is returned.

Implements Medium.

◆ mix() [2/2]

const MaterialMix * ImportedMedium::mix ( Position  bfr) const
overridevirtual

This function returns the MaterialMix object defining the material properties for the medium at the specified position.

If the importVariableMixParams flag is enabled, the appropriate material mix is selected from the configured material mix family based on the value of the imported parameters for the specified position. If the flag is disabled, the fixed configured material mix is returned regardless of position.

Implements Medium.

◆ number()

double ImportedMedium::number ( ) const
overridevirtual

This function returns the total number of material entities in the medium. The function uses the default material mix (the one at the origin) throughout the complete spatial domain; if the importVariableMixParams flag is enabled, this is an approximation.

Implements Medium.

◆ numberDensity()

double ImportedMedium::numberDensity ( Position  bfr) const
overridevirtual

This function returns the number density of the medium at the specified position.

Implements Medium.

◆ numSites()

int ImportedMedium::numSites ( ) const
overridevirtual

This function returns the number of entities (particles or cells) used for defining the density distribution represented by the snapshot. The function is part of the SiteListInterface. It simply calls the corresponding function in the snapshot object.

Implements SiteListInterface.

◆ opticalDepthX()

double ImportedMedium::opticalDepthX ( double  lambda) const
overridevirtual

This function returns the optical depth of the medium at wavelength \(\lambda\) along the full X axis of the model coordinate system. The function uses the default material mix (the one at the origin) throughout the complete spatial domain; if the importVariableMixParams flag is enabled, this is an approximation.

Implements Medium.

◆ opticalDepthY()

double ImportedMedium::opticalDepthY ( double  lambda) const
overridevirtual

This function returns the optical depth of the medium at wavelength \(\lambda\) along the full Y axis of the model coordinate system. The function uses the default material mix (the one at the origin) throughout the complete spatial domain; if the importVariableMixParams flag is enabled, this is an approximation.

Implements Medium.

◆ opticalDepthZ()

double ImportedMedium::opticalDepthZ ( double  lambda) const
overridevirtual

This function returns the optical depth of the medium at wavelength \(\lambda\) along the full Z axis of the model coordinate system. The function uses the default material mix (the one at the origin) throughout the complete spatial domain; if the importVariableMixParams flag is enabled, this is an approximation.

Implements Medium.

◆ parameters()

void ImportedMedium::parameters ( Position  bfr,
Array params 
) const
overridevirtual

If custom input model parameters are available for this medium, this function stores the parameter values at the specified position into the given array. If the position is outside the domain, the parameter values default to zero. If no custom input model parameters are available for this medium, the array is resized to zero length.

For an imported medium that is configured with a material mix, custom input model parameters are imported from the snapshot as requested by the MaterialMix::parameterInfo() function. The number and order of parameters returned by this function then reflects the number and order of parameter descriptions returned by the MaterialMix::parameterInfo() function. If the medium is configured with a material mix family, any imported parameters are used to select a member of the material mix family at each location, and this function returns an empty array. In other words, requests by material mix family members for custom input model parameters are ignored.

Implements Medium.

◆ setupSelfAfter()

void ImportedMedium::setupSelfAfter ( )
overrideprotectedvirtual

This function imports the snapshot data from the input file through a Snapshot object of the appropriate type. Specifically, it first calls the createSnapshot() function, which must be implemented in a subclass, to construct and open a Snapshot object of the appropriate type. It then passes the user-configurable options of this class to the Snapshot object and tells it to import the data.

Reimplemented from SimulationItem.

◆ sitePosition()

Position ImportedMedium::sitePosition ( int  index) const
overridevirtual

This function returns the coordinates of the entity (particle or cell) with the specified zero-based index. If the index is out of range, the behavior is undefined. The function is part of the SiteListInterface. It simply calls the corresponding function in the snapshot object.

Implements SiteListInterface.

◆ snapshot()

const Snapshot * ImportedMedium::snapshot ( ) const

This function returns (a pointer to) the snapshot object associated with this imported medium. It is intended to provide InputModelProbe instances with direct access to the snapshot for probing imported information that is not otherwise made available to the simulation. To preserve proper data encapsulation, this function should not be called from anywhere else in the simulation machinery.

◆ temperature()

double ImportedMedium::temperature ( Position  bfr) const
overridevirtual

This function returns the temperature of the medium at the specified position, if defined in the input model. Specifically, if the medium has a gas or electron material mix and the importTemperature flag is enabled, the function returns the imported temperature at the specified position. Otherwise, the function returns zero.

Implements Medium.

◆ useColumns()

ImportedMedium::useColumns ( ) const
inline

This function returns the value of the discoverable string property useColumns : "a list of names corresponding to columns in the file to be imported" .

The default value for this property is given by the conditional value expression "" .

This property is required only if the Boolean expression "false" evaluates to true after replacing the names by true or false depending on their presence.

This property is displayed only if the Boolean expression "Level3" evaluates to true after replacing the names by true or false depending on their presence.


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