Triumvirate C++ API 0.5.0.post1.dev301+g026f21751
Three-point clustering measurements in large-scale structure analyses.
Loading...
Searching...
No Matches
trv::ParticleCatalogue Class Reference

Particle catalogue. More...

#include <particles.hpp>

+ Collaboration diagram for trv::ParticleCatalogue:

Public Member Functions

 ParticleCatalogue (int verbose=-1)
 Construct the particle catalogue with initial values.
 
 ~ParticleCatalogue ()
 Destruct the particle catalogue.
 
void initialise_particles (const int num)
 Initialise particle data container.
 
void finalise_particles ()
 Finalise particle data container.
 
void reset_particles ()
 Reset particle data container.
 
ParticleDataoperator[] (const int pid)
 Return individual particle information.
 
int load_catalogue_file (const std::string &catalogue_filepath, const std::string &catalogue_columns, const std::string &catalogue_dataset="", double volume=0.)
 Read in a catalogue file.
 
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.
 
void calc_total_weights ()
 Calculate total overall weight of particles.
 
void calc_pos_extents (bool init=true)
 Calculate the extents of particle positions.
 
void offset_coords (const double dpos[3])
 Offset particle positions by a given vector.
 
void offset_coords_for_periodicity (const double boxsize[3])
 Offset particle positions for periodic boundary conditions.
 

Static Public Member Functions

static void centre_in_box (ParticleCatalogue &catalogue, const double boxsize[3])
 Centre a catalogue in a box.
 
static void centre_in_box (ParticleCatalogue &catalogue, ParticleCatalogue &catalogue_ref, const double boxsize[3])
 Centre a pair of catalogues in a box.
 
static void pad_in_box (ParticleCatalogue &catalogue, const double boxsize[3], const double boxsize_pad[3])
 Pad a catalogue in a box.
 
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.
 
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.
 
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.
 

Public Attributes

std::string source
 catalogue source
 
ParticleDatapdata = nullptr
 particle data
 
int ntotal = 0
 total number of particles
 
double wtotal = 0.
 total overall weight of particles
 
double wstotal = 0.
 total sample weight of particles
 
double pos_min [3] = {0., 0., 0.}
 minimum particle coordinates
 
double pos_max [3] = {0., 0., 0.}
 maximum particle coordinates
 
double pos_span [3] = {0., 0., 0.}
 span of particle coordinates
 

Detailed Description

Particle catalogue.

The catalogue object contains particle data and summary information, as well as methods for computing its attributes.

Definition at line 78 of file particles.hpp.

Constructor & Destructor Documentation

◆ ParticleCatalogue()

trv::ParticleCatalogue::ParticleCatalogue ( int verbose = -1)
explicit

Construct the particle catalogue with initial values.

Parameters
verboseLogger verbosity (default is -1 for no change).
Note
verbose is optional and used to control the logging level when an instance is created as a standalone without ParameterSet .

Definition at line 39 of file particles.cpp.

+ Here is the caller graph for this function:

◆ ~ParticleCatalogue()

trv::ParticleCatalogue::~ParticleCatalogue ( )

Destruct the particle catalogue.

Definition at line 45 of file particles.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ initialise_particles()

void trv::ParticleCatalogue::initialise_particles ( const int num)

Initialise particle data container.

Attention
This method does not set the values of trv::ParticleCatalogue::pdata, trv::ParticleCatalogue::wtotal, trv::ParticleCatalogue::wstotal, trv::ParticleCatalogue::pos_min or trv::ParticleCatalogue::pos_max, or trv::ParticleCatalogue::pos_span.
Parameters
numNumber of data units (i.e. particles).

Definition at line 47 of file particles.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ finalise_particles()

void trv::ParticleCatalogue::finalise_particles ( )

Finalise particle data container.

Definition at line 68 of file particles.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reset_particles()

void trv::ParticleCatalogue::reset_particles ( )

Reset 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.

Definition at line 72 of file particles.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator[]()

ParticleData & trv::ParticleCatalogue::operator[] ( const int pid)

Return individual particle information.

Parameters
pidParticle index.
Returns
Individual particle data.

Definition at line 85 of file particles.cpp.

◆ load_catalogue_file()

int trv::ParticleCatalogue::load_catalogue_file ( const std::string & catalogue_filepath,
const std::string & catalogue_columns,
const std::string & catalogue_dataset = "",
double volume = 0. )

Read in a catalogue file.

Parameters
catalogue_filepathCatalogue file path.
catalogue_columnsCatalogue data column names (as a comma-separated list without space or an attribute name prefixed by "attr:").
catalogue_datasetCatalogue dataset name/path (default is empty; for HDF5 files only).
volumeCatalogue volume (default is 0.) used for computing the default 'nz' value when the field is missing.
Returns
Exit status.
Note
If catalogue_dataset is empty for HDF5 files, the first dataset found is used (which may not be the intended one).
If catalogue_columns is empty for HDF5 files, the first dataset attribute found is used (which may not be the intended one).

Definition at line 94 of file particles.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_particle_data()

int trv::ParticleCatalogue::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,wcParticle data by column.
Returns
Exit status.

Definition at line 512 of file particles.cpp.

+ Here is the call graph for this function:

◆ calc_total_weights()

void trv::ParticleCatalogue::calc_total_weights ( )

Calculate total overall weight of particles.

Attention
This method resets trv::ParticleCatalogue::wtotal and trv::ParticleCatalogue::wstotal.

Definition at line 570 of file particles.cpp.

+ Here is the caller graph for this function:

◆ calc_pos_extents()

void trv::ParticleCatalogue::calc_pos_extents ( bool init = true)

Calculate the extents of particle positions.

Parameters
initInitialisation flag (default is true).
Attention
This method resets trv::ParticleCatalogue::pos_min, trv::ParticleCatalogue::pos_max and trv::ParticleCatalogue::pos_span.

Definition at line 604 of file particles.cpp.

+ Here is the caller graph for this function:

◆ offset_coords()

void trv::ParticleCatalogue::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.

Definition at line 658 of file particles.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ offset_coords_for_periodicity()

void trv::ParticleCatalogue::offset_coords_for_periodicity ( const double boxsize[3])

Offset particle positions for periodic boundary conditions.

Parameters
boxsizePeriodic box size in each dimension.

Definition at line 678 of file particles.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ centre_in_box() [1/2]

void trv::ParticleCatalogue::centre_in_box ( ParticleCatalogue & catalogue,
const double boxsize[3] )
static

Centre a catalogue in a box.

Parameters
catalogueParticle catalogue.
boxsizeBox size in each dimension.

Definition at line 701 of file particles.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ centre_in_box() [2/2]

void trv::ParticleCatalogue::centre_in_box ( ParticleCatalogue & catalogue,
ParticleCatalogue & catalogue_ref,
const double boxsize[3] )
static

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.

Parameters
cataloguePrimary particle catalogue.
catalogue_refSecondary reference particle catalogue.
boxsizeBox size in each dimension.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 732 of file particles.cpp.

+ Here is the call graph for this function:

◆ pad_in_box() [1/2]

void trv::ParticleCatalogue::pad_in_box ( ParticleCatalogue & catalogue,
const double boxsize[3],
const double boxsize_pad[3] )
static

Pad a catalogue in a box.

The amount of padding is a fraction of the box size.

Parameters
catalogueParticle catalogue.
boxsizeBox size in each dimension.
boxsize_padBox size padding factor in each dimension.

Definition at line 780 of file particles.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pad_in_box() [2/2]

void trv::ParticleCatalogue::pad_in_box ( ParticleCatalogue & catalogue,
ParticleCatalogue & catalogue_ref,
const double boxsize[3],
const double boxsize_pad[3] )
static

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.

Parameters
cataloguePrimary particle catalogue.
catalogue_refSecondary reference particle catalogue.
boxsizeBox size in each dimension.
boxsize_padBox size padding factor in each dimension.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 809 of file particles.cpp.

+ Here is the call graph for this function:

◆ pad_grids() [1/2]

void trv::ParticleCatalogue::pad_grids ( ParticleCatalogue & catalogue,
const double boxsize[3],
const int ngrid[3],
const double ngrid_pad[3] )
static

Pad a catalogue in a box.

The amount of padding is a multiple of the mesh grid size.

Parameters
catalogueParticle catalogue.
boxsizeBox size in each dimension.
ngridGrid cell number in each dimension.
ngrid_padGrid cell number factor for padding.

Definition at line 855 of file particles.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pad_grids() [2/2]

void trv::ParticleCatalogue::pad_grids ( ParticleCatalogue & catalogue,
ParticleCatalogue & catalogue_ref,
const double boxsize[3],
const int ngrid[3],
const double ngrid_pad[3] )
static

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.

Parameters
cataloguePrimary particle catalogue.
catalogue_refSecondary reference particle catalogue.
boxsizeBox size in each dimension.
ngridGrid cell number in each dimension.
ngrid_padGrid cell number factor for padding.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 872 of file particles.cpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ source

std::string trv::ParticleCatalogue::source

catalogue source

Definition at line 80 of file particles.hpp.

◆ pdata

ParticleData* trv::ParticleCatalogue::pdata = nullptr

particle data

Definition at line 82 of file particles.hpp.

◆ ntotal

int trv::ParticleCatalogue::ntotal = 0

total number of particles

Definition at line 84 of file particles.hpp.

◆ wtotal

double trv::ParticleCatalogue::wtotal = 0.

total overall weight of particles

Definition at line 85 of file particles.hpp.

◆ wstotal

double trv::ParticleCatalogue::wstotal = 0.

total sample weight of particles

Definition at line 86 of file particles.hpp.

◆ pos_min

double trv::ParticleCatalogue::pos_min[3] = {0., 0., 0.}

minimum particle coordinates

Definition at line 88 of file particles.hpp.

◆ pos_max

double trv::ParticleCatalogue::pos_max[3] = {0., 0., 0.}

maximum particle coordinates

Definition at line 89 of file particles.hpp.

◆ pos_span

double trv::ParticleCatalogue::pos_span[3] = {0., 0., 0.}

span of particle coordinates

Definition at line 90 of file particles.hpp.


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