group_particles
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
Callback< AFields > Struct Template Referenceabstract

The abstract base class the user should inherit from. More...

#include <callback.hpp>

Inheritance diagram for Callback< AFields >:
Inheritance graph
[legend]

Classes

class  BaseProperties
 Type describing either a group or a particle. More...
 
class  GrpProperties
 Specialization of the Callback::BaseProperties type to groups. More...
 
struct  PrtProperties
 Specialization of the Callback::BaseProperties type to particles. More...
 

Public Member Functions

virtual bool grp_chunk (size_t chunk_idx, std::string &fname) const =0
 Where to find the group files.
 
virtual bool prt_chunk (size_t chunk_idx, std::string &fname) const =0
 Where to find the particle files.
 
virtual std::string grp_name () const =0
 Where to find the group fields in the hdf5 file.
 
virtual std::string prt_name () const =0
 Where to find the particle fields in the hdf5 file.
 
virtual void read_grp_meta_init (std::shared_ptr< H5::H5File > fptr)
 Allows the user to read meta-data from the 0th group chunk.
 
virtual void read_prt_meta_init (std::shared_ptr< H5::H5File > fptr)
 Allows the user to read meta-data from the 0th particle chunk.
 
virtual void read_grp_meta (size_t chunk_idx, std::shared_ptr< H5::H5File > fptr, size_t &Ngroups) const =0
 Inform the code how many groups there are in a group chunk.
 
virtual void read_prt_meta (size_t chunk_idx, std::shared_ptr< H5::H5File > fptr, coord_t &Bsize, size_t &Nparts) const =0
 Inform the code how large the box is and how many particles there are in a particle chunk.
 
virtual bool grp_select (const GrpProperties &grp) const
 Inform the code whether a group should be considered.
 
virtual void grp_action (const GrpProperties &grp)=0
 Action to take for each group for which grp_select returned true.
 
virtual coord_t grp_radius (const GrpProperties &grp) const =0
 Inform the code how large this group is.
 
virtual void prt_action (size_t grp_idx, const GrpProperties &grp, const PrtProperties &prt, coord_t Rsq)=0
 Action to take for each particle that falls within grp_radius from a group.
 
virtual coord_t prt_coord_rescale () const
 Rescaling of particle coordinates.
 
virtual void prt_modify (PrtProperties &prt)
 Modifications to particle properties.
 

Detailed Description

template<typename AFields>
struct Callback< AFields >

The abstract base class the user should inherit from.

Template Parameters
AFieldsa type constructed from the AllFields template.

By overriding this classes methods, the user defines the functionality of the code.

See the documentation for group_particles for the order in which the non-const methods are called.

Member Function Documentation

◆ grp_chunk()

template<typename AFields >
virtual bool Callback< AFields >::grp_chunk ( size_t  chunk_idx,
std::string &  fname 
) const
pure virtual

Where to find the group files.

Parameters
[in]chunk_idxindex of the group chunk the code wants to read (starting from 0).
[out]fnamefile name corresponding to this index.
Returns
true if there is a chunk corresponding to chunk_idx, false otherwise. By definition, must return true for chunk_idx=0.
Note
see CallbackUtils::chunk for some overrides.

◆ prt_chunk()

template<typename AFields >
virtual bool Callback< AFields >::prt_chunk ( size_t  chunk_idx,
std::string &  fname 
) const
pure virtual

Where to find the particle files.

Parameters
[in]chunk_idxindex of the particle chunk the code wants to read (starting from 0).
[out]fnamefile name corresponding to this index.
Returns
true if there is a chunk corresponding to chunk_idx, false otherwise. By definition, must return true for chunk_idx=0.
Note
see CallbackUtils::chunk for some overrides.

◆ grp_name()

template<typename AFields >
virtual std::string Callback< AFields >::grp_name ( ) const
pure virtual

Where to find the group fields in the hdf5 file.

Remarks
for Illustris-type formats, "Group/"
Note
see CallbackUtils::name for some overrides.

◆ prt_name()

template<typename AFields >
virtual std::string Callback< AFields >::prt_name ( ) const
pure virtual

Where to find the particle fields in the hdf5 file.

Remarks
for Illustris-type formats, "PartType.../"
Note
see CallbackUtils::name for some overrides.

◆ read_grp_meta_init()

template<typename AFields >
virtual void Callback< AFields >::read_grp_meta_init ( std::shared_ptr< H5::H5File >  fptr)
inlinevirtual

Allows the user to read meta-data from the 0th group chunk.

Parameters
[in]fptrPoints to the opened 0th group chunk.
Remarks
This function is trivially implemented, so does not need to be overriden.
Note
see CallbackUtils::meta_init for some overrides.

◆ read_prt_meta_init()

template<typename AFields >
virtual void Callback< AFields >::read_prt_meta_init ( std::shared_ptr< H5::H5File >  fptr)
inlinevirtual

Allows the user to read meta-data from the 0th particle chunk.

Parameters
[in]fptrPoints to the opened 0th particle chunk.
Remarks
This function is trivially implemented, so does not need to be overriden.
Note
see CallbackUtils::meta_init for some overrides.

◆ read_grp_meta()

template<typename AFields >
virtual void Callback< AFields >::read_grp_meta ( size_t  chunk_idx,
std::shared_ptr< H5::H5File >  fptr,
size_t &  Ngroups 
) const
pure virtual

Inform the code how many groups there are in a group chunk.

Parameters
[in]chunk_idxindex of the group chunk, starting from 0.
[in]fptrpointer to the opened group chunk file.
[out]Ngroupsto be filled with the number of groups in this file.
Remarks
In principle, the code could infer Ngroups from the size of the data arrays stored in the file, but it is safer to have this additional check.
Note
see CallbackUtils::meta for some overrides.

◆ read_prt_meta()

template<typename AFields >
virtual void Callback< AFields >::read_prt_meta ( size_t  chunk_idx,
std::shared_ptr< H5::H5File >  fptr,
coord_t Bsize,
size_t &  Nparts 
) const
pure virtual

Inform the code how large the box is and how many particles there are in a particle chunk.

Parameters
[in]chunk_idxindex of the particle chunk, starting from 0.
[in]fptrpointer to the opened particle chunk file.
[out]Bsizeto be filled with the size of the simulation box. This should always be the same; the code checks this assumption as an additional safety feature. Units are the same as the ones used in the data arrays.
[out]Npartsto be filled with the number of particles in this file.
Remarks
In principle, the code could infer Nparts from the size of the data arrays stored in the file, but it is safer to have this additional check.
Note
see CallbackUtils::meta for some overrides.

◆ grp_select()

template<typename AFields >
virtual bool Callback< AFields >::grp_select ( const GrpProperties grp) const
inlinevirtual

Inform the code whether a group should be considered.

Parameters
[in]grpproperties of this group.
Returns
whether this group should be considered.
Remarks
This function is trivially implemented, so does not need to be overriden.
Note
see CallbackUtils::select for some overrides.

◆ grp_action()

template<typename AFields >
virtual void Callback< AFields >::grp_action ( const GrpProperties grp)
pure virtual

Action to take for each group for which grp_select returned true.

Parameters
[in]grpproperties of this group.
Remarks
This function will be called in the order of groups encountered, corresponding to the grp_idx argument in the prt_action method.
Warning
There can be a cross-reaction with certain overrides of the prt_action method. In that case, overriding this method directly will lead to a compiler error. It is advised that the user always uses inheritance from the CallbackUtils::grp_action::MultiGrpAction interface to indirectly override this method.
Note
see CallbackUtils::grp_action for some overrides.

◆ grp_radius()

template<typename AFields >
virtual coord_t Callback< AFields >::grp_radius ( const GrpProperties grp) const
pure virtual

Inform the code how large this group is.

Parameters
[in]grpproperties of this group.
Returns
the radius of this group. Only particles falling within this distance from the group coordinate will be passed to the prt_action method.
Note
see CallbackUtils::radius for some overrides.

◆ prt_action()

template<typename AFields >
virtual void Callback< AFields >::prt_action ( size_t  grp_idx,
const GrpProperties grp,
const PrtProperties prt,
coord_t  Rsq 
)
pure virtual

Action to take for each particle that falls within grp_radius from a group.

Parameters
[in]grp_idxindex of this group, corresponding to the order in which grp_action was called.
[in]grpproperties of this group. Well-designed code should not need to use this argument, as the required data products can be reduced more efficiently in the grp_action method.
[in]prtproperties of this particle.
[in]Rsqsquared distance between this particle's coordinate and this group's coordinate. The code already computes this so the user should be able to use it without re-computing it.
Note
see CallbackUtils::prt_action for some overrides.

◆ prt_coord_rescale()

template<typename AFields >
virtual coord_t Callback< AFields >::prt_coord_rescale ( ) const
inlinevirtual

Rescaling of particle coordinates.

Returns
the factor by which the particle coordinates will be rescaled
Note
this is also applied to the box size.
only applied to the zeroth particle field (the primary coordinate), regardless of whether there are other coordinate-like fields
primary purpose is to resolve units mismatch between particle and group catalogs.

◆ prt_modify()

template<typename AFields >
virtual void Callback< AFields >::prt_modify ( PrtProperties prt)
inlinevirtual

Modifications to particle properties.

Parameters
[in,out]prtproperties of the particle, to be modified
Note
this is called after coordinate rescaling has been applied
original motivation is to implement RSD

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