#include <SourceSystem.hpp>
Public Member Functions | |
int | dimension () const |
void | installLaunchCallBack (ProbePhotonPacketInterface *callback) |
void | launch (PhotonPacket *pp, size_t historyIndex) const |
double | luminosity () const |
double | maxWavelength () const |
double | minWavelength () const |
int | numSources () const |
void | prepareForLaunch (size_t numPackets) |
double | sourceBias () const |
const vector< Source * > & | sources () const |
const vector< double > & | wavelengths () const |
![]() | |
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 |
![]() | |
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 | |
SourceSystem () | |
void | setupSelfAfter () override |
![]() | |
SimulationItem () | |
virtual bool | offersInterface (const std::type_info &interfaceTypeInfo) const |
virtual void | setupSelfAfter () |
virtual void | setupSelfBefore () |
![]() | |
Item () | |
Private Types | |
using | BaseType = SimulationItem |
using | ItemType = SourceSystem |
Private Attributes | |
vector< ProbePhotonPacketInterface * > | _callbackv |
vector< size_t > | _Iv |
double | _L |
double | _Lpp |
Array | _Lv |
double | _maxWavelength |
double | _minWavelength |
double | _sourceBias |
vector< Source * > | _sources |
vector< double > | _wavelengths |
Array | _Wv |
Friends | |
class | ItemRegistry |
An instance of the SourceSystem class represents a complete primary source system, which is the superposition of one or more sources. Each source provides a complete description of its radiation, including the spatial and spectral distribution and characteristics such as anisotropy and polarization.
One key task of the SourceSystem object is to distribute photon packet launches across the sources. In principle, this should/could be achieved by randomly selecting a source for each launch through sampling from an appropriate probability distribution. However, for some sources, a deterministic approach allows significant performance optimizations. Because the number of photon packets should be and usually is (much) larger than the number of (sub)sources, a deterministic approach can be considered to be equivalent to the randomized procedure.
The idea is to iterate through the sources and launch consecutive photon packets from each. A source consisting of many subsources (such as particles or cells) can then use a similar approach, iterating over these components. The implementation can now construct and cache relevant data structures (such as a cumulative spectral distribution) for each subsource, and release the information as soon as the iteration moves on to the next subsource. Because photon packets can (and often are) launched in parallel, these data structures must be allocated in thread-local storage, but that is only a minor complication.
For each primary emission segment (i.e. a sequence of photon packet launches) in the simulation, the MonteCarloSimulation object uses the following procedure. It first determines the number of photon packets to be launched from the simulation configuration. This number
To achieve the goals described above, the SourceSystem::prepareForLaunch() function maps consecutive history index ranges to each of the sources being held. This mapping is also passed on to each source, so that it can (but doesn't have to) implement a similar approach for its subsources. The number of photon packets allocated to each source is determined as follows:
where
|
inlineprotected |
Default constructor for concrete Item subclass SourceSystem : "a primary source system" .
int SourceSystem::dimension | ( | ) | const |
This function returns the dimension of the source system, which depends on the (lack of) symmetry in the geometries of its components. A value of 1 means spherical symmetry, 2 means axial symmetry and 3 means none of these symmetries. The source with the least symmetry (i.e. the highest dimension) determines the result for the whole system.
void SourceSystem::installLaunchCallBack | ( | ProbePhotonPacketInterface * | callback | ) |
This function installs the specified interface as photon packet launch call-back. The function probePhotonPacket() provided by the interface will be called for each photon packet that is ready to be launched.
void SourceSystem::launch | ( | PhotonPacket * | pp, |
size_t | historyIndex | ||
) | const |
This function causes the photon packet pp to be launched from one of the sources in the source system using the given history index. The photon packet's contents is fully (re-)initialized so that it is ready to start its lifecycle.
double SourceSystem::luminosity | ( | ) | const |
This function returns the bolometric luminosity
|
inline |
This function returns the value of the discoverable double property maxWavelength : "the longest wavelength of photon packets launched from primary sources" .
This property represents a physical quantity of type "wavelength" .
The minimum value for this property is "1 pm" .
The maximum value for this property is "1 m" .
The default value for this property is given by the conditional value expression "100 micron" .
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.
|
inline |
This function returns the value of the discoverable double property minWavelength : "the shortest wavelength of photon packets launched from primary sources" .
This property represents a physical quantity of type "wavelength" .
The minimum value for this property is "1 pm" .
The maximum value for this property is "1 m" .
The default value for this property is given by the conditional value expression "0.09 micron" .
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.
int SourceSystem::numSources | ( | ) | const |
This function returns the number of sources in the source system.
void SourceSystem::prepareForLaunch | ( | size_t | numPackets | ) |
This function prepares the mapping of history indices to sources; see the description in the class header for more information.
|
overrideprotectedvirtual |
This function obtains the bolometric luminosity of each source for later use.
Reimplemented from SimulationItem.
|
inline |
This function returns the value of the discoverable double property sourceBias : "the fraction of photon packets distributed uniformly across primary sources" .
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 "0.5" .
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.
|
inline |
This function returns the value of the discoverable item list property sources : "the primary sources" .
The default value for this property is given by the conditional value expression "GeometricSource" .
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.
|
inline |
This function returns the value of the discoverable double list property wavelengths : "the discrete wavelengths of photon packets launched from primary sources" .
This property represents a physical quantity of type "wavelength" .
The minimum value for this property is "1 pm" .
The maximum value for this property is "1 m" .
The default value for this property is given by the conditional value expression "0.55 micron" .
This property is relevant only if the Boolean expression "Oligochromatic" evaluates to true after replacing the names by true or false depending on their presence.