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

#include <ClipGeometryDecorator.hpp>

Inheritance diagram for ClipGeometryDecorator:
Inheritance graph
[legend]

Public Types

enum class  Remove : int { Inside , Outside }
 

Public Member Functions

double density (Position bfr) const override
 
Position generatePosition () const override
 
Geometrygeometry () const
 
Remove remove () const
 
double SigmaX () const override
 
double SigmaY () const override
 
double SigmaZ () const override
 
- Public Member Functions inherited from Geometry
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

 ClipGeometryDecorator ()
 
virtual bool inside (Position bfr) const =0
 
double norm () const
 
void setupSelfAfter () override
 
- 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 = Geometry
 
using ItemType = ClipGeometryDecorator
 

Private Attributes

Geometry_geometry
 
double _norm
 
Remove _remove
 

Friends

class ItemRegistry
 

Detailed Description

The abstract ClipGeometryDecorator class implements a decorator that adjusts another geometry by setting the density equal to zero inside or outside a region defined in a subclass. Each ClipGeometryDecorator subclass must implement the virtual functions dimension() and inside(). The decorator increases the density in the remaining region with a constant factor to ensure that the total mass remains equal to one. The current implementation does not properly adjust the surface densities along the coordinate axes for the mass taken away by the cavity.

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

Member Enumeration Documentation

◆ Remove

enum class ClipGeometryDecorator::Remove : int
strong

The enumeration type indicating which region to remove (Inside or Outside).

Inside : "the inner region (creating a cavity)" .

Outside : "the outer region (cropping)" .

Constructor & Destructor Documentation

◆ ClipGeometryDecorator()

ClipGeometryDecorator::ClipGeometryDecorator ( )
inlineprotected

Default constructor for abstract Item subclass ClipGeometryDecorator : "a decorator that clips another geometry" .

Member Function Documentation

◆ density()

double ClipGeometryDecorator::density ( Position  bfr) const
overridevirtual

This function returns the density \(\rho({\bf{r}})\) at the position \({\bf{r}}\). It is zero in the removed region, and equal to the density of the geometry being decorated elsewhere, after an adjustment is made to account for the clipping.

Implements Geometry.

◆ generatePosition()

Position ClipGeometryDecorator::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}}\). It repeatedly calls the density() function for the geometry being decorated until a position is returned that does not lie in the removed region.

Implements Geometry.

◆ geometry()

Geometry * ClipGeometryDecorator::geometry ( ) const
inline

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

◆ inside()

virtual bool ClipGeometryDecorator::inside ( Position  bfr) const
protectedpure virtual

This pure virtual function, to be implemented by a subclass, returns true if the specified position is inside the boundary defined by the subclass, i.e. the point is in the region that would be carved away when creating a cavity, or in the region that would be retained when cropping.

Implemented in BoxClipGeometryDecorator, CylindricalClipGeometryDecorator, and SphericalClipGeometryDecorator.

◆ norm()

double ClipGeometryDecorator::norm ( ) const
protected

This function returns the normalization factor calculated by this class during setup.

◆ remove()

Remove ClipGeometryDecorator::remove ( ) const
inline

This function returns the value of the discoverable Remove enumeration property remove : "the region to be removed" .

◆ setupSelfAfter()

void ClipGeometryDecorator::setupSelfAfter ( )
overrideprotectedvirtual

This function estimates the fraction \(\chi\) of the mass from the original model taken away by the clipping. It samples the density of the geometry being decorated, and counts the number of generated positions that fall in the removed region. This value is used to renormalize the decorated density distribution to unity: the factor by which the original density has to be multiplied is simply \(1/(1-\chi)\).

Reimplemented from SimulationItem.

◆ SigmaX()

double ClipGeometryDecorator::SigmaX ( ) const
overridevirtual

This function returns the X-axis surface density, i.e. the integration of the density along the entire X-axis,

\[ \Sigma_X = \int_{-\infty}^\infty \rho(x,0,0)\,{\text{d}}x. \]

It returns the corresponding value of the geometry being decorated after re-normalization.

Implements Geometry.

Reimplemented in CylindricalClipGeometryDecorator.

◆ SigmaY()

double ClipGeometryDecorator::SigmaY ( ) const
overridevirtual

This function returns the Y-axis surface density, i.e. the integration of the density along the entire Y-axis,

\[ \Sigma_Y = \int_{-\infty}^\infty \rho(0,y,0)\,{\text{d}}y. \]

It returns the corresponding value of the geometry being decorated after re-normalization.

Implements Geometry.

Reimplemented in CylindricalClipGeometryDecorator.

◆ SigmaZ()

double ClipGeometryDecorator::SigmaZ ( ) const
overridevirtual

This function returns the Z-axis surface density, i.e. the integration of the density along the entire Z-axis,

\[ \Sigma_Z = \int_{-\infty}^\infty \rho(0,0,z)\,{\text{d}}z. \]

It returns the corresponding value of the geometry being decorated after re-normalization.

Implements Geometry.

Reimplemented in CylindricalClipGeometryDecorator.


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