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

#include <OligoWavelengthDistribution.hpp>

Inheritance diagram for OligoWavelengthDistribution:
Inheritance graph
[legend]

Public Member Functions

 OligoWavelengthDistribution (OligoWavelengthGrid *wavelengthGrid)
 
double generateWavelength () const override
 
double probability (double wavelength) const override
 
virtual double generateWavelength () const =0
 
virtual double probability (double wavelength) 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
 

Private Attributes

double _probability
 
const Array_wavelengths
 

Additional Inherited Members

- Protected Member Functions inherited from WavelengthDistribution
 WavelengthDistribution ()
 
Randomrandom () const
 
void setupSelfBefore () override
 
- 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 ()
 

Detailed Description

OligoWavelengthDistribution is a subclass of the WavelengthDistribution class representing the wavelength probability distribution of primary-source photon packets emitted in an oligochromatic simulation. In principle, the class implements a probability distribution that has a constant nonzero value inside a set of narrow ranges placed around the oligochromatic wavelengths in the simulation, corresponding to the bins defined by the oligo wavelength grid. These bins all have the same half bin width given by 1/1000 of the shortest wavelength in the list (see the OligoWavelengthGrid class). As a result, after normalization, the constant value of the probability distribution inside each of the bins is given by \(1 / (N_\text{bins} \,w_\text{bin})\).

In practice, in the interest of performance, rather than distributing the generated wavelengths across each bin, the class always generates exactly one of the discrete oligochromatic wavelengths. Also, the class always returns the normalized constant probability value regardless of the specified wavelength. This is acceptable because in an oligochromatic simulation this value is queried only for one of the discrete wavelengths anyway.

The oligo wavelength distribution in a simulation is created programmatically rather than directly configured by the user. The list of wavelengths and the bin width are specified by passing an OligoWavelengthGrid instance to the constructor, which used the relevant information from this object.

Constructor & Destructor Documentation

◆ OligoWavelengthDistribution()

OligoWavelengthDistribution::OligoWavelengthDistribution ( OligoWavelengthGrid wavelengthGrid)
explicit

This constructor can be invoked programmatically to create an oligochromatic wavelength distribution. Before the constructor returns, the newly created object is hooked up as a child to the specified oligochromatic wavelength grid (so it will automatically be deleted), and its setup() function has been called.

Member Function Documentation

◆ generateWavelength()

double OligoWavelengthDistribution::generateWavelength ( ) const
overridevirtual

This function draws a random wavelength from the wavelength distribution. For this class, it returns one of the discrete oligochromatic wavelengths with equal probability.

Implements WavelengthDistribution.

◆ probability()

double OligoWavelengthDistribution::probability ( double  wavelength) const
overridevirtual

This function returns the probability of the distribution at the given wavelength. For this class, the function always returns the normalized constant probability value \(1 / (N_\text{bins} \,w_\text{bin})\) regardless of the specified wavelength. This is acceptable because in an oligochromatic simulation this function is called only for one of the discrete wavelengths anyway.

Implements WavelengthDistribution.


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