The SKIRT project
advanced radiative transfer for astrophysics
Probe Class Referenceabstract

#include <Probe.hpp>

Inheritance diagram for Probe:

Public Member Functions

string itemName () const override
int iter () const
string probeName () const
void probePrimary (int iter)
void probeRun ()
void probeSecondary (int iter)
void probeSetup ()
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
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

Protected Types

enum class  When { Setup , Run , Primary , Secondary }

Protected Member Functions

 Probe ()
virtual void initialize ()
virtual void probe ()=0
virtual When when () 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 ()

Private Types

using BaseType
using ItemType

Private Attributes

int _iter
string _probeName

Friends

class ItemRegistry

Detailed Description

Probe is an abstract class representing probes that output information on internal simulation data before or during the simulation run. Refer to the ProbeSystem class for more information.

Probe subclasses must adhere to the following rules. In this discussion, target refers to the item(s) in the simulation hierarchy from which the probe retrieves information.

  • Data encapsulation: a probe can use public interfaces only, even if these interfaces are in some cases written specifically to support the probe (refer to the scenarios described in the ProbeSystem class).
  • Read-only access: a probe cannot (cause to) change the data structures held by the target. There are two exceptions to this rule: (1) during its own setup, a probe can cause setup of a target through the find() or interface() functions, and (2) a probe can use a public function, provided by the target for this purpose, to install a call-back function that will be invoked by the target.
  • Interprobe independence: a probe cannot look for or depend on another probe, nor on the order of the various probes in the list held by the probe system.

Member Enumeration Documentation

◆ When

enum class Probe::When
strongprotected

This enumeration indicates when to perform probing: after setup, after the complete simulation run, or after primary/secondary emission iterations.

Constructor & Destructor Documentation

◆ Probe()

Probe::Probe ( )
inlineprotected

Default constructor for abstract Item subclass Probe: "a probe".

Member Function Documentation

◆ initialize()

virtual void Probe::initialize ( )
protectedvirtual

This function is called after the simulation has been fully setup but before the probe() function is called. It can implemented by a subclass that needs to perform some initialization that requires the simulation to be fully setup. The default implementation in this base class does nothing.

Reimplemented in LaunchedPacketsProbe.

◆ itemName()

string Probe::itemName ( ) const
overridevirtual

This function returns the probe name as human-readable name for the simulation item, so that it can be used in log messages to identify the probe and differentiate it from other probes.

Reimplemented from SimulationItem.

◆ iter()

int Probe::iter ( ) const

During the execution of the probePrimary() or probeSecondary() function, this function returns the current one-based primary or secondary emission iteration index. Otherwise the function returns zero.

◆ probe()

◆ probeName()

string Probe::probeName ( ) const
inline

This function returns the value of the discoverable string property probeName: "the name for this probe".

◆ probePrimary()

void Probe::probePrimary ( int iter)

This function is called at the end of each iteration over primary emission, i.e. after all photon packets have been processed and the medium state and the radiation field have been updated if needed. The function argument specifies the one-based iteration index. If when() returns Primary, this function saves the iteration index and calls probe(); otherwise it does nothing.

◆ probeRun()

void Probe::probeRun ( )

This function is called at the end of the run phase, i.e. after all photon packets have been emitted and detected. If when() returns Run, this function calls probe(); otherwise it does nothing.

◆ probeSecondary()

void Probe::probeSecondary ( int iter)

This function is called at the end of each iteration over secondary emission, i.e. after all photon packets have been processed and the medium state and the radiation field have been updated if needed. In some execution flows, the iteration may include both a primary and secondary emission segment. The function argument specifies the one-based iteration index. If when() returns Secondary, this function saves the iteration index and calls probe(); otherwise it does nothing.

◆ probeSetup()

void Probe::probeSetup ( )

This function is called at the end of the setup phase, i.e. after all simulation items have performed setup. It first calls initialize(), and if when() returns Setup, it then calls probe().

◆ when()

virtual When Probe::when ( ) const
protectedvirtual

This function returns an enumeration indicating when probing should be performed for this probe. The default implementation in this base class returns Setup. A subclass needs to override this function only if it (may) require probing at a different time.

Reimplemented in DustAbsorptionPerCellProbe, LaunchedPacketsProbe, RadiationFieldProbe, SecondaryDustLuminosityProbe, SecondaryLineLuminosityProbe, SpatialGridWhenFormProbe, and SpecialtyWhenProbe.


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