The SKIRT project
advanced radiative transfer for astrophysics
PolicyTreeSpatialGrid Class Reference

#include <PolicyTreeSpatialGrid.hpp>

Inheritance diagram for PolicyTreeSpatialGrid:

Public Types

enum class  TreeType : int { OctTree , BinTree }

Public Member Functions

TreePolicypolicy () const
TreeType treeType () const
Public Member Functions inherited from TreeSpatialGrid
 ~TreeSpatialGrid ()
int cellIndex (Position bfr) const override
Position centralPositionInCell (int m) const override
std::unique_ptr< PathSegmentGeneratorcreatePathSegmentGenerator () const override
double diagonal (int m) const override
int numCells () const override
Position randomPositionInCell (int m) const override
double volume (int m) const override
void writeTopology (TextOutFile *outfile) const
Public Member Functions inherited from BoxSpatialGrid
Box boundingBox () const override
int dimension () const override
double maxX () const
double maxY () const
double maxZ () const
double minX () const
double minY () const
double minZ () const
Public Member Functions inherited from SpatialGrid
virtual void writeGridPlotFiles (const SimulationItem *probe) const
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
Public Member Functions inherited from Box
 Box ()
 Box (double xmin, double ymin, double zmin, double xmax, double ymax, double zmax)
 Box (Vec rmin, Vec rmax)
void cellIndices (int &i, int &j, int &k, Vec r, int nx, int ny, int nz) const
Vec center () const
bool contains (const Box &box) const
bool contains (double x, double y, double z) const
bool contains (Vec r) const
double diagonal () const
void extend (const Box &box)
const Boxextent () const
void extent (double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) const
Vec fracPos (double xfrac, double yfrac, double zfrac) const
Vec fracPos (int xd, int yd, int zd, int xn, int yn, int zn) const
bool intersects (const Box &box) const
bool intersects (Vec r, const Vec k, double &smin, double &smax) const
bool intersects (Vec rc, double r) const
Vec rmax () const
Vec rmin () const
double volume () const
Vec widths () const
double xmax () const
double xmin () const
double xwidth () const
double ymax () const
double ymin () const
double ywidth () const
double zmax () const
double zmin () const
double zwidth () const

Protected Member Functions

 PolicyTreeSpatialGrid ()
vector< TreeNode * > constructTree () override
Protected Member Functions inherited from TreeSpatialGrid
 TreeSpatialGrid ()
void setupSelfAfter () override
void write_xy (SpatialGridPlotFile *outfile) const override
void write_xyz (SpatialGridPlotFile *outfile) const override
void write_xz (SpatialGridPlotFile *outfile) const override
void write_yz (SpatialGridPlotFile *outfile) const override
Protected Member Functions inherited from BoxSpatialGrid
 BoxSpatialGrid ()
void setupSelfBefore () override
Protected Member Functions inherited from SpatialGrid
 SpatialGrid ()
Randomrandom () const
void setupSelfBefore () override
Protected Member Functions inherited from SimulationItem
 SimulationItem ()
virtual bool offersInterface (const std::type_info &interfaceTypeInfo) const
Protected Member Functions inherited from Item
 Item ()
Protected Member Functions inherited from Box
void setExtent (const Box &extent)
void setExtent (double xmin, double ymin, double zmin, double xmax, double ymax, double zmax)

Private Types

using BaseType
using ItemType

Private Attributes

TreePolicy_policy
TreeType _treeType

Friends

class ItemRegistry

Detailed Description

PolicyTreeSpatialGrid is a concrete subclass of the TreeSpatialGrid class representing three-dimensional spatial grids with cuboidal cells organized in a hierarchical tree. The tree's root node encloses the complete spatial domain, and nodes on subsequent levels recursively divide space into ever finer nodes. The depth of the tree can vary from place to place. The leaf nodes (those that are not further subdivided) are the actual spatial cells.

This class offers a user-configurable option to select the tree type. Depending on the type of node employed, the tree can become an octtree (8 children per node) or a binary tree (2 children per node). Other node types could be implemented, as long as they are cuboids lined up with the coordinate axes.

The actual tree construction, other than the choice of node type, is delegated to a user-configurable policy instance. Encapsulating the configurable options and the corresponding implementation mechanisms for constructing spatial tree grids in a separate class hierarchy allows offering and possibly combining different policies without complicating the TreeSpatialGrid class hierarchy.

Member Enumeration Documentation

◆ TreeType

enum class PolicyTreeSpatialGrid::TreeType : int
strong

The enumeration type indicating the type of tree to be constructed: an octtree (8 children per node) or a binary tree (2 children per node).

OctTree : "an octtree (8 children per node)".

BinTree : "a binary tree (2 children per node)".

Constructor & Destructor Documentation

◆ PolicyTreeSpatialGrid()

PolicyTreeSpatialGrid::PolicyTreeSpatialGrid ( )
inlineprotected

Default constructor for concrete Item subclass PolicyTreeSpatialGrid: "a tree-based spatial grid".

Member Function Documentation

◆ constructTree()

vector< TreeNode * > PolicyTreeSpatialGrid::constructTree ( )
overrideprotectedvirtual

This function constructs the hierarchical tree and all (interconnected) nodes forming the tree as described for the corresponding pure virtual function in the base class. For this class, this function merely creates a root node of the appropriate type for the tree type configured by the user, and then invokes the constructTree() function of the policy configured by the user.

Implements TreeSpatialGrid.

◆ policy()

TreePolicy * PolicyTreeSpatialGrid::policy ( ) const
inline

This function returns the value of the discoverable item property policy: "the tree construction policy (configuration options)".

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

◆ treeType()

TreeType PolicyTreeSpatialGrid::treeType ( ) const
inline

This function returns the value of the discoverable TreeType enumeration property treeType: "the type of tree".

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

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.

When a value is entered for this property, the names provided by the conditional value expression "treeTypeOctTree:OctTreeGrid;treeTypeBinTree:BinTreeGrid" are inserted into the name sets used for evaluating Boolean expressions.


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