The SKIRT project
advanced radiative transfer for astrophysics
FileTreeSpatialGrid Class Reference

#include <FileTreeSpatialGrid.hpp>

Inheritance diagram for FileTreeSpatialGrid:

Public Member Functions

string filename () 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

 FileTreeSpatialGrid ()
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

string _filename

Friends

class ItemRegistry

Detailed Description

FileTreeSpatialGrid is a concrete subclass of the TreeSpatialGrid class that constructs a hierarchical tree grid from the topological description loaded from a data file. In the most common use case, the data file has been created in a previous simulation through the TreeSpatialGridTopologyProbe. The tree grid in the current simulation will then be identical to the one in the previous simulation. This can be useful in situations where multiple simulations are being performed on input models with the same (or a very similar) spatial distribution of the transfer medium. Constructing a tree grid based on the medium density distribution takes time (because of the large number of density samples required), and the tree is likely to differ slightly between various runs (because the density is sampled at random positions, and the random number sequence varies because of parallelization). Loading the tree from the topology data file is much faster and guarantees that all simulations use identical tree grids.

After a brief descriptive header, the input file contains lines with just a single integer number. The first line specifies the number of children for each nonleaf node (2 for a binary tree, 8 for an octtree, or 0 if the root node is not subdivided). The second line contains 1 if the root node is subdivided, or 0 if not. The following lines similarly contain 1 or 0 indicating subdivision for any children of the preceding node, recursively, in a depth-first traversal of the tree.

Note that the topology data stored in the input file is scale-free. When configuring the FileTreeSpatialGrid in the simulation loading the topology, the user must specify the extent of the spatial domain.

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.

Constructor & Destructor Documentation

◆ FileTreeSpatialGrid()

FileTreeSpatialGrid::FileTreeSpatialGrid ( )
inlineprotected

Default constructor for concrete Item subclass FileTreeSpatialGrid: "a tree-based spatial grid loaded from a topology data file".

Member Function Documentation

◆ constructTree()

vector< TreeNode * > FileTreeSpatialGrid::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 recontructs the tree described in the configured tree topology data file.

Implements TreeSpatialGrid.

◆ filename()

string FileTreeSpatialGrid::filename ( ) const
inline

This function returns the value of the discoverable string property filename: "the name of the file with the tree topology data".


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