#include <ParticleSnapshot.hpp>
Public Member Functions | |
ParticleSnapshot () | |
~ParticleSnapshot () | |
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 |
void | setSmoothingKernel (const SmoothingKernel *kernel) |
double | volume (int m) const override |
Public Member Functions inherited from Snapshot | |
Snapshot () | |
virtual | ~Snapshot () |
double | age (int m) const |
double | age (Position bfr) const |
double | currentMass (int m) const |
double | currentMass (Position bfr) 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 | 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 | 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 |
double | initialMass (Position bfr) 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 | 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 | velocityDispersion (Position bfr) const |
double | volume () const |
virtual double | volume (int m) const =0 |
Protected Member Functions | |
int | nearestEntity (Position bfr) const override |
const Array & | properties (int m) const override |
Protected Member Functions inherited from Snapshot | |
int | ageIndex () const |
int | boxIndex () const |
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 |
virtual int | nearestEntity (Position bfr) const =0 |
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 Attributes | |
Array | _cumrhov |
ParticleGrid * | _grid |
const SmoothingKernel * | _kernel |
double | _mass |
vector< Array > | _propv |
vector< Particle > | _pv |
A ParticleSnapshot object represents the data in a smoothed particle (SPH) snapshot imported from a column text file. The 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. In addition it offers functionality that is specific to this snapshot type, such as, for example, the ability to use an arbitrary smoothing kernel for the particles in the snapshot.
If the snapshot configuration requires the ability to determine the density at a given spatial position, a lot of effort is made to accelerate the density interpolation over a potentially large number of smoothed particles.
ParticleSnapshot::ParticleSnapshot | ( | ) |
The default constructor initializes the snapshot in an invalid state; it is provided here so that we don't need to expose the inplemetation of the private Particle class.
ParticleSnapshot::~ParticleSnapshot | ( | ) |
The destructor deletes the smoothed particle grid, if it was constructed.
|
overridevirtual |
This function returns the effective mass density associated with the particle 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 represented by the snapshot at a given point \({\bf{r}}\), determined by interpolating (conceptually) over all smoothed particles. If the point is outside the domain, the function returns zero. 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 bounding box surrounding all particles lined up with the coordinate axes. The function assumes a kernel with finite support to determine the extent of each particle.
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 particle from the discrete probability distribution formed by the respective particle masses, and then generates a random position from the smoothing kernel of that particle. 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 from the smoothing kernel of the particle with index m. If the index is out of range, the behavior is undefined.
Implements Snapshot.
|
overridevirtual |
This function replaces the contents of the specified entity collection by the set of particles with a smoothing kernel that overlaps the specified point \({\bf{r}}\). The weight corresponding to each particle is set to the particle's smoothing kernel value at the given point. If the given point does not overlap any particle, the collection will be empty. If the search data structures were not created, invoking this function causes undefined behavior.
Implements Snapshot.
|
overridevirtual |
This function replaces the contents of the specified entity collection by the set of particles with a smoothing kernel that overlaps the specified path with starting point \({\bf{r}}\) and direction \({\bf{k}}\). The weight of each particle is given by the effective length seen by the path as it crosses the particle's smoothing kernel. If the path does not overlap any particle, the collection will be empty. If the search data structures were not created, invoking this function causes undefined behavior.
Implements Snapshot.
|
overridevirtual |
This function returns the total mass represented by the snapshot, in other words the sum of the masses of all particles. If no density policy has been set or no mass information is being imported, the behavior is undefined.
Implements Snapshot.
|
overrideprotectedvirtual |
This function returns the index \(0\le m \le N_\mathrm{ent}-1\) of the particle whose center is nearest to the specified point \({\bf{r}}\), or -1 if the point is outside the domain, if there are no particles in the snapshot, or if the search data structures were not created.
Implements Snapshot.
|
overridevirtual |
This function returns the number of particles in the snapshot.
Implements Snapshot.
|
overridevirtual |
This function returns the position for the particle 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 particle with index \(0\le m \le N_\mathrm{ent}-1\). If the index is out of range, the behavior is undefined.
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 finally closes the file by calling the base class Snapshot::readAndClose() function. 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 density interpolation over a potentially large number of smoothed particles.
Reimplemented from Snapshot.
void ParticleSnapshot::setSmoothingKernel | ( | const SmoothingKernel * | kernel | ) |
This function sets the smoothing kernel used for interpolating the smoothed particles. This function must be called during configuration. There is no default; failing to set the smoothing kernel results in undefined behavior.
|
overridevirtual |
This function returns the effective volume of the particle 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.