#include <CellSnapshot.hpp>
Public Member Functions | |
double | density (int m) const override |
double | density (Position bfr) const override |
Box | extent () const override |
Position | generatePosition () const override |
Position | generatePosition (int m) const override |
void | getEntities (EntityCollection &entities, Position bfr) const override |
void | getEntities (EntityCollection &entities, Position bfr, Direction bfk) const override |
double | mass () const override |
int | numEntities () const override |
Position | position (int m) const override |
void | readAndClose () override |
double | volume (int m) const override |
![]() | |
Snapshot () | |
virtual | ~Snapshot () |
double | age (int m) const |
double | bias (int m) const |
void | close () |
double | currentMass (int m) const |
virtual double | density (int m) const =0 |
virtual double | density (Position bfr) const =0 |
virtual Box | extent () const =0 |
virtual Position | generatePosition () const =0 |
virtual Position | generatePosition (int m) const =0 |
virtual void | getEntities (EntityCollection &entities, Position bfr) const =0 |
virtual void | getEntities (EntityCollection &entities, Position bfr, Direction bfk) const =0 |
bool | hasAge () const |
bool | hasBias () const |
bool | hasCurrentMass () const |
bool | hasInitialMass () const |
bool | hasMagneticField () const |
bool | hasMetallicity () const |
bool | hasParameters () const |
bool | hasTemperature () const |
bool | hasVelocity () const |
bool | hasVelocityDispersion () const |
bool | holdsNumber () const |
void | importBias () |
void | importBox () |
void | importCurrentMass () |
void | importMagneticField () |
void | importMass () |
void | importMassDensity () |
void | importMetallicity () |
void | importNumber () |
void | importNumberDensity () |
void | importParameters (const vector< SnapshotParameter > ¶meters) |
void | importPosition () |
void | importSize () |
void | importTemperature () |
void | importVelocity () |
void | importVelocityDispersion () |
double | initialMass (int m) const |
Vec | magneticField (int m) const |
Vec | magneticField (Position bfr) const |
virtual double | mass () const =0 |
double | metallicity (int m) const |
double | metallicity (Position bfr) const |
virtual int | numEntities () const =0 |
void | open (const SimulationItem *item, string filename, string description) |
void | parameters (int m, Array ¶ms) const |
void | parameters (Position bfr, Array ¶ms) const |
virtual Position | position (int m) const =0 |
virtual void | readAndClose () |
void | setCoordinateSystem (CoordinateSystem coordinateSystem) |
void | setMassDensityPolicy (double multiplier, double maxTemperature, bool useMetallicity) |
void | setNeedGetEntities () |
double | SigmaX () const |
double | SigmaY () const |
double | SigmaZ () const |
double | temperature (int m) const |
double | temperature (Position bfr) const |
void | useColumns (string columns) |
Vec | velocity (int m) const |
Vec | velocity (Position bfr) const |
double | velocityDispersion (int m) const |
double | volume () const |
virtual double | volume (int m) const =0 |
Protected Member Functions | |
const Array & | properties (int m) const override |
![]() | |
int | ageIndex () const |
int | biasIndex () const |
int | boxIndex () const |
void | calculateDensityAndMass (Array &rhov, Array &cumrhov, double &mass) |
int | currentMassIndex () const |
int | densityIndex () const |
bool | hasMassDensityPolicy () const |
TextInFile * | infile () |
int | initialMassIndex () const |
Log * | log () const |
void | logMassStatistics (int numIgnored, double totalOriginalMass, double totalMetallicMass, double totalEffectiveMass) |
int | magneticFieldIndex () const |
int | massIndex () const |
double | maxTemperature () const |
int | metallicityIndex () const |
double | multiplier () const |
bool | needGetEntities () const |
int | numParameters () const |
int | parametersIndex () const |
int | positionIndex () const |
virtual const Array & | properties (int m) const =0 |
Random * | random () const |
void | setContext (const SimulationItem *item) |
int | sizeIndex () const |
int | temperatureIndex () const |
Units * | units () const |
bool | useMetallicity () const |
bool | useTemperatureCutoff () const |
int | velocityDispersionIndex () const |
int | velocityIndex () const |
Private Member Functions | |
Box | boxForCell (int m) const |
Private Attributes | |
Array | _cumrhov |
double | _mass |
vector< Array > | _propv |
Array | _rhov |
BoxSearch | _search |
Additional Inherited Members | |
![]() | |
enum class | CoordinateSystem { CARTESIAN , CYLINDRICAL , SPHERICAL } |
A CellSnapshot object represents the data in a Cartesian mesh-based snapshot imported from a column text file. Each line in the text file represents a cuboidal cell lined up with the coordinate axes, specifying the coordinates of the lower-left and upper-right corners of the cell along with properties such as the density in the cell. The intention is for the cells to define a partition of the spatial domain, and usually they will, however this is not enforced. When two or more cells overlap at a given position, the properties for that position will be taken from the cell that is listed first in the imported file. When no cells overlap a given position, the density at that position is considered to be zero. To avoid thin slices of zero density between cells, the coordinates for common walls or corners in neighboring cells should be identical.
This class is an alternative to the AdaptiveMeshSnapshot class, which requires listing cells in Morton order. This can be hard to accomplish, especially when extracting a particular subdomain from a larger mesh. In contrast, the CellSnapshot class allows cells to be listed in arbitrary order and allows the spatial partition to be imperfect. For example, the outer border of the domain can be ragged, with some cells extending farther out than others.
This class is based on the Snapshot class; it uses the facilities offered there to configure and read the snapshot data, and it implements all functions in the general Snapshot public interface. If the snapshot configuration requires the ability to determine the density at a given spatial position, an effort is made to accelerate the search for the cell containing that position even for a large number of cells.
|
private |
This function returns the bounding box representing the cell with the given index. If the index is out of range, the behavior is undefined.
|
overridevirtual |
This function returns the mass density associated with the cell with index m. If no density policy has been set or no mass information is being imported, or if the index is out of range, the behavior is undefined.
Implements Snapshot.
|
overridevirtual |
This function returns the mass density of the cell containing the specified point
Implements Snapshot.
|
overridevirtual |
This function returns the bounding box lined up with the coordinate axes surrounding all cells.
Implements Snapshot.
|
overridevirtual |
This function returns a random position within the spatial domain of the snapshot, drawn from the mass density distribution represented by the snapshot. The function first selects a random cell from the discrete probability distribution formed by the respective cell masses, and then generates a random position within that cell. If no density policy has been set or no mass information is being imported, the behavior is undefined.
Implements Snapshot.
|
overridevirtual |
This function returns a random position drawn uniformly from the cell with index m. If the index is out of range, the behavior is undefined.
Implements Snapshot.
|
overridevirtual |
This function sets the specified entity collection to the cell containing the specified point
Implements Snapshot.
|
overridevirtual |
This function replaces the contents of the specified entity collection by the set of cells that overlap the specified path with starting point
Implements Snapshot.
|
overridevirtual |
This function returns the total mass represented by the snapshot, in other words the sum of the masses of all cells. If no density policy has been set or no mass information is being imported, the behavior is undefined.
Implements Snapshot.
|
overridevirtual |
This function returns the number of cells in the snapshot.
Implements Snapshot.
|
overridevirtual |
This function returns the position of the center of the cell with index m. If the index is out of range, the behavior is undefined.
Implements Snapshot.
|
overrideprotectedvirtual |
This function returns a reference to an array containing the imported properties (in column order) for the cell with index
Implements Snapshot.
|
overridevirtual |
This function reads the snapshot data from the input file, honoring the options set through the configuration functions, stores the data for later use, and closes the file by calling the base class Snapshot::readAndClose() function.
Cells with an associated temperature above the cutoff temperature (if one has been configured) are assigned a density value of zero, so that they have zero mass regardless of the imported mass/density properties. Note that we cannot simply ignore these cells because an empty cell may overlap and thus hide (a portion of) a nonempty cell later in the list.
The function also logs some statistical information about the import. If the snapshot configuration requires the ability to determine the density at a given spatial position, this function builds a data structure that accelerates the search for the appropriate cell.
Reimplemented from Snapshot.
|
overridevirtual |
This function returns the volume of the cell with index m. If the index is out of range, the behavior is undefined.
Implements Snapshot.