Class ParticleCatalogue#
Defined in File particles.hpp
Nested Relationships#
Nested Types#
Class Documentation#
-
class ParticleCatalogue#
Particle catalogue.
The catalogue object contains particle data and summary information, as well as methods for computing its attributes.
Public Functions
-
ParticleCatalogue(int verbose = -1)#
Construct the particle catalogue with initial values.
Note
verbose
is optional and used to control the logging level when an instance is created as a standalone withoutParameterSet
.- Parameters
verbose – Logger verbosity (default is -1 for no change).
-
~ParticleCatalogue()#
Destruct the particle catalogue.
-
void initialise_particles(const int num)#
Initialise particle data container.
- Attention
This method does not set the values of trv::ParticleCatalogue::ParticleData, trv::ParticleCatalogue::wtotal, trv::ParticleCatalogue::wstotal, trv::ParticleCatalogue::pos_min or trv::ParticleCatalogue::pos_max, or trv::ParticleCatalogue::pos_span.
- Parameters
num – Number of data units (i.e. particles).
-
void finalise_particles()#
Finalise particle data container.
This is an explicit method to free the resources occupied by trv::ParticleCatalogue::pdata and may be called outside the class destructor.
-
ParticleData &operator[](const int pid)#
Return individual particle information.
- Parameters
pid – Particle index.
- Returns
Individual particle data.
-
int load_catalogue_file(const std::string &catalogue_filepath, const std::string &catalogue_columns, double volume = 0.)#
Read in a catalogue file.
- Parameters
catalogue_filepath – Catalogue file path.
catalogue_columns – Catalogue data column names (comma-separated without space).
volume – Catalogue volume (default is 0.) used for computing the default ‘nz’ value when the field is missing.
- Returns
Exit status.
-
int load_particle_data(std::vector<double> x, std::vector<double> y, std::vector<double> z, std::vector<double> nz, std::vector<double> ws, std::vector<double> wc)#
Read in particle data.
- Parameters
x, y, z, nz, ws, wc – Particle data by column.
- Returns
Exit status.
-
void calc_total_weights()#
Calculate total overall weight of particles.
- Attention
This method resets trv::ParticleCatalogue::wtotal and trv::ParticleCatalogue::wstotal.
-
void calc_pos_extents()#
Calculate the extents of particle positions.
- Attention
This method resets trv::ParticleCatalogue::pos_min, trv::ParticleCatalogue::pos_max and trv::ParticleCatalogue::pos_span.
-
void offset_coords(const double dpos[3])#
Offset particle positions by a given vector.
The position specified by the input vector is the new origin.
- Parameters
dpos – (Subtractive) offset position vector.
-
void offset_coords_for_periodicity(const double boxsize[3])#
Offset particle positions for periodic boundary conditions.
- Parameters
boxsize – Periodic box size in each dimension.
Public Members
-
std::string source#
catalogue source
-
struct trv::ParticleCatalogue::ParticleData *pdata#
particle data
-
int ntotal#
total number of particles
-
double wtotal#
total overall weight of particles
-
double wstotal#
total sample weight of particles
-
double pos_min[3]#
minimum values of particle coordinates
-
double pos_max[3]#
maximum values of particle coordinates
-
double pos_span[3]#
span of particle coordinates
Public Static Functions
-
static void centre_in_box(ParticleCatalogue &catalogue, const double boxsize[3])#
Centre a catalogue in a box.
- Parameters
catalogue – Particle catalogue.
boxsize – Box size in each dimension.
-
static void centre_in_box(ParticleCatalogue &catalogue, ParticleCatalogue &catalogue_ref, const double boxsize[3])#
Centre a pair of catalogues in a box.
The secondary catalogue’s centre is used as the reference point to also offset the primary catalogue’s particle positions.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
- Parameters
catalogue – Primary particle catalogue.
catalogue_ref – Secondary reference particle catalogue.
boxsize – Box size in each dimension.
-
static void pad_in_box(ParticleCatalogue &catalogue, const double boxsize[3], const double boxsize_pad[3])#
Pad a catalogue in a box.
The amount of padding is a fraction of the box size.
- Parameters
catalogue – Particle catalogue.
boxsize – Box size in each dimension.
boxsize_pad – Box size padding factor in each dimension.
-
static void pad_in_box(ParticleCatalogue &catalogue, ParticleCatalogue &catalogue_ref, const double boxsize[3], const double boxsize_pad[3])#
Pad a pair of catalogues in a box.
The amount of padding is a fraction of the box size.
The secondary catalogue’s extents are used as the reference points to also offset the primary catalogue’s particle positions.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
- Parameters
catalogue – Primary particle catalogue.
catalogue_ref – Secondary reference particle catalogue.
boxsize – Box size in each dimension.
boxsize_pad – Box size padding factor in each dimension.
-
static void pad_grids(ParticleCatalogue &catalogue, const double boxsize[3], const int ngrid[3], const double ngrid_pad[3])#
Pad a catalogue in a box.
The amount of padding is a multiple of the mesh grid size.
- Parameters
catalogue – Particle catalogue.
boxsize – Box size in each dimension.
ngrid – Grid number in each dimension.
ngrid_pad – Grid number factor for padding.
-
static void pad_grids(ParticleCatalogue &catalogue, ParticleCatalogue &catalogue_ref, const double boxsize[3], const int ngrid[3], const double ngrid_pad[3])#
Pad a catalogue in a box.
The amount of padding is a multiple of the mesh grid size.
The secondary catalogue’s extents are used as the reference points to also offset the primary catalogue’s particle positions.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
- Parameters
catalogue – Primary particle catalogue.
catalogue_ref – Secondary reference particle catalogue.
boxsize – Box size in each dimension.
ngrid – Grid number in each dimension.
ngrid_pad – Grid number factor for padding.
-
struct ParticleData#
Particle data container.
-
ParticleCatalogue(int verbose = -1)#