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

#include <ClumpyGeometryDecorator.hpp>

Inheritance diagram for ClumpyGeometryDecorator:
Inheritance graph
[legend]

Public Member Functions

double clumpFraction () const
 
double clumpRadius () const
 
bool cutoffClumps () const
 
double density (Position bfr) const override
 
Position generatePosition () const override
 
Geometrygeometry () const
 
int numClumps () const
 
int seed () const
 
double SigmaX () const override
 
double SigmaY () const override
 
double SigmaZ () const override
 
SmoothingKernelsmoothingKernel () const
 
- Public Member Functions inherited from GenGeometry
int dimension () const override
 
virtual double density (Position bfr) const =0
 
virtual int dimension () const =0
 
virtual Position generatePosition () const =0
 
virtual double SigmaX () const =0
 
virtual double SigmaY () const =0
 
virtual double SigmaZ () 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
 

Protected Member Functions

 ClumpyGeometryDecorator ()
 
void setupSelfAfter () override
 
- Protected Member Functions inherited from GenGeometry
 GenGeometry ()
 
- Protected Member Functions inherited from Geometry
 Geometry ()
 
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 ()
 

Private Types

using BaseType = GenGeometry
 
using ItemType = ClumpyGeometryDecorator
 

Private Attributes

double _clumpFraction
 
double _clumpRadius
 
std::vector< Vec_clumpv
 
bool _cutoffClumps
 
Geometry_geometry
 
int _numClumps
 
int _seed
 
SmoothingKernel_smoothingKernel
 

Friends

class ItemRegistry
 

Detailed Description

The ClumpyGeometryDecorator class is a geometry decorator that adds clumpiness to any geometry. It basically assigns a fraction \(f\) of the mass of the original geometry to compact clumps, which are distributed statistically according to the same distribution. The properties of a ClumpyGeometryDecorator object are a reference to the original Geometry object being decorated, and the characteristics that describe the clumpiness, i.e. the fraction \(f\) of the mass locked in clumps, the total number \(N\) of clumps, the scale radius \(h\) of a single clump, and the kernel \(W({\bf{r}},h)\) that describes the mass distribution of a single clump. If the original geometry is characterized by the density \(\rho_{\text{orig}}({\bf{r}})\), the new, clumpy stellar geometry is described by

\[ \rho({\bf{r}}) = (1-f)\, \rho_{\text{orig}} ({\bf{r}}) + \frac{f}{N} \sum_{i=1}^N W({\bf{r}}-{\bf{r}}_i,h). \]

where \({\bf{r}}_i\) is the location of the centre of the \(i\)'th clump, each of them randomly drawn from the three-dimensional probability density \(p({\bf{r}})\, {\text{d}}{\bf{r}} = \rho_{\text{orig}}({\bf{r}})\, {\text{d}}{\bf{r}}\).

By default, this class uses the standard random generator also used by other classes during setup. Consecutive executions of the same ski file will produce the same clump positions (even if the simulation is configured to have multiple parallel execution threads or processes). On the other hand, multiple occurrences of the ClumpyGeometryDecorator in a given ski file will always produce a different set of clump positions, because consecutive portions of the pseudo-random sequence are being employed. While this is usually just fine, in some models one might want to line up, for example, the clumps in a medium distribution with those in a source distribution. Therefore, if a nonzero value is specified for the seed property, the clump positions are generated using a temporary random number generator initialized with that seed. Configuring the same seed for two ClumpyGeometryDecorator instances will line up the respective clump positions, assuming the underlying geometry and the number of clumps are identical.

Constructor & Destructor Documentation

◆ ClumpyGeometryDecorator()

ClumpyGeometryDecorator::ClumpyGeometryDecorator ( )
inlineprotected

Default constructor for concrete Item subclass ClumpyGeometryDecorator : "a decorator that adds clumpiness to any geometry" .

Member Function Documentation

◆ clumpFraction()

ClumpyGeometryDecorator::clumpFraction ( ) const
inline

This function returns the value of the discoverable double property clumpFraction : "the fraction of the mass locked up in clumps" .

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

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

◆ clumpRadius()

ClumpyGeometryDecorator::clumpRadius ( ) const
inline

This function returns the value of the discoverable double property clumpRadius : "the scale radius of a single clump" .

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

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

◆ cutoffClumps()

ClumpyGeometryDecorator::cutoffClumps ( ) const
inline

This function returns the value of the discoverable Boolean property cutoffClumps : "cut off clumps at the boundary of the underlying geometry" .

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

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.

◆ density()

double ClumpyGeometryDecorator::density ( Position  bfr) const
overridevirtual

This function returns the density \(\rho({\bf{r}})\) at the position \({\bf{r}}\).

Implements Geometry.

◆ generatePosition()

Position ClumpyGeometryDecorator::generatePosition ( ) const
overridevirtual

This function generates a random position from the geometry, by drawing a random point from the three-dimensional probability density \(p({\bf{r}})\, {\text{d}}{\bf{r}} = \rho({\bf{r}})\, {\text{d}}{\bf{r}}\).

Implements Geometry.

◆ geometry()

Geometry * ClumpyGeometryDecorator::geometry ( ) const
inline

This function returns the value of the discoverable item property geometry : "the geometry to be made clumpy" .

◆ numClumps()

ClumpyGeometryDecorator::numClumps ( ) const
inline

This function returns the value of the discoverable integer property numClumps : "the total number of clumps" .

The minimum value for this property is "1" .

◆ seed()

ClumpyGeometryDecorator::seed ( ) const
inline

This function returns the value of the discoverable integer property seed : "the seed for the random clump position generator, or zero to use the default generator" .

The minimum value for this property is "0" .

The maximum value for this property is "1000000" .

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

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.

◆ setupSelfAfter()

void ClumpyGeometryDecorator::setupSelfAfter ( )
overrideprotectedvirtual

This function generates the \(N\) random positions corresponding to the centers of the individual clumps. They are chosen as random positions generated from the original geometry that is being decorated.

Reimplemented from SimulationItem.

◆ SigmaX()

double ClumpyGeometryDecorator::SigmaX ( ) const
overridevirtual

This pure virtual function returns the X-axis surface density. It simply passes on the value returned by the geometry being decorated.

Implements Geometry.

◆ SigmaY()

double ClumpyGeometryDecorator::SigmaY ( ) const
overridevirtual

This pure virtual function returns the Y-axis surface density. It simply passes on the value returned by the geometry being decorated.

Implements Geometry.

◆ SigmaZ()

double ClumpyGeometryDecorator::SigmaZ ( ) const
overridevirtual

This pure virtual function returns the Z-axis surface density. It simply passes on the value returned by the geometry being decorated.

Implements Geometry.

◆ smoothingKernel()

ClumpyGeometryDecorator::smoothingKernel ( ) const
inline

This function returns the value of the discoverable item property smoothingKernel : "the smoothing kernel that describes the density of a single clump" .

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

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.


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