The SKIRT project
advanced radiative transfer for astrophysics
TreePolicy Class Referenceabstract

#include <TreePolicy.hpp>

Inheritance diagram for TreePolicy:

Public Member Functions

virtual vector< TreeNode * > constructTree (TreeNode *root)=0
int maxLevel () const
int minLevel () 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

Protected Member Functions

 TreePolicy ()
void setupSelfBefore () override
Protected Member Functions inherited from SimulationItem
 SimulationItem ()
virtual bool offersInterface (const std::type_info &interfaceTypeInfo) const
virtual void setupSelfAfter ()
Protected Member Functions inherited from Item
 Item ()

Private Types

using BaseType
using ItemType

Private Attributes

int _maxLevel
int _minLevel

Friends

class ItemRegistry

Detailed Description

TreePolicy is an abstract class that represents the configurable options and the corresponding implementation mechanisms for constructing spatial tree grids, as a service to the PolicyTreeSpatialGrid class. Encapsulating these policies in a separate class hierarchy allows offering and possibly combining different policies without complicating the TreeSpatialGrid class hierarchy.

The public interface of TreePolicy class offers just a single function that is invoked by the PolicyTreeSpatialGrid class during setup to construct the tree hierarchy and all TreeNode instances in it.

Constructor & Destructor Documentation

◆ TreePolicy()

TreePolicy::TreePolicy ( )
inlineprotected

Default constructor for abstract Item subclass TreePolicy: "a spatial tree grid construction policy".

Member Function Documentation

◆ constructTree()

virtual vector< TreeNode * > TreePolicy::constructTree ( TreeNode * root)
pure virtual

This function must be implemented in a subclass. It constructs the hierarchical tree and all (interconnected) nodes forming the tree. All nodes are instances of the same TreeNode subclass as the root node passed as an argument. The function returns a list of pointers to all created nodes (leaf and nonleaf). Ownership of the nodes resides in this returned list (not in the node hierarchy itself) and is thus handed to the caller.

Each (leaf and nonleaf) node is given an identifier (ID) corresponding to its index in the list. The first node in the list is the root node of tree, i.e. the node passed as an argument. By definition, the root node has an ID of zero.

This function also causes the nodes to construct neighbor lists, interconnecting the nodes according to their spatial relationship. The neighbor lists are sorted so that the neighbors with the largest overlapping border area are listed first, increasing (on average) the probability of locating the correct neighbor early in the list.

Implemented in DensityTreePolicy, and SiteListTreePolicy.

◆ maxLevel()

int TreePolicy::maxLevel ( ) const
inline

This function returns the value of the discoverable integer property maxLevel: "the maximum level of grid refinement".

The minimum value for this property is "0".

The maximum value for this property is "99".

The default value for this property is given by the conditional value expression "OctTreeGrid:7;BinTreeGrid:21".

◆ minLevel()

int TreePolicy::minLevel ( ) const
inline

This function returns the value of the discoverable integer property minLevel: "the minimum level of grid refinement".

The minimum value for this property is "0".

The maximum value for this property is "99".

The default value for this property is given by the conditional value expression "OctTreeGrid:3;BinTreeGrid:9".

◆ setupSelfBefore()

void TreePolicy::setupSelfBefore ( )
overrideprotectedvirtual

This function verifies that the maximum level is not below the minimum level.

Reimplemented from SimulationItem.


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