Peano 4
Loading...
Searching...
No Matches
toolbox::particles::FileReaderHDF5 Class Reference

An HDF5 file reader This class works if and only if you have compiled Peano using –with-hdf5. More...

#include <FileReaderHDF5.h>

Collaboration diagram for toolbox::particles::FileReaderHDF5:

Public Member Functions

void readHDF5File (const std::string &filename)
 Read HDF5 file in SWIFT format.
 
std::list< tarch::la::Vector< Dimensions, double > > getParticlesWithinVoxel (const tarch::la::Vector< Dimensions, double > &x, const tarch::la::Vector< Dimensions, double > &h, bool remove)
 Take particles from database which fall into given voxel.
 
void clear ()
 
bool empty () const
 
bool getNumberOfCoordinates () const
 
void clearVoxel ()
 Clear data of a voxel carried by this instance of FileReaderHDF5.
 
bool isVoxelEmpty () const
 Check whether voxel data carried by this instance of FileReaderHDF5 is empty.
 
std::vector< tarch::la::Vector< Dimensions, double > > getVelocityWithinVoxel () const
 
std::vector< double > getMassWithinVoxel () const
 
std::vector< double > getSmoothingLengthWithinVoxel () const
 
std::vector< double > getInternalEnergyWithinVoxel () const
 
std::vector< intgetParticleIDsWithinVoxel () const
 

Private Attributes

std::list< tarch::la::Vector< Dimensions, double > > _Coordinates
 
std::vector< tarch::la::Vector< Dimensions, double > > _Velocity
 
std::vector< double > _Mass
 
std::vector< double > _SmoothingLength
 
std::vector< double > _InternalEnergy
 
std::vector< int_ParticleIDs
 
std::list< int_ParticleIndex
 
std::vector< tarch::la::Vector< Dimensions, double > > _VelocityWithinVoxel
 
std::vector< double > _MassWithinVoxel
 
std::vector< double > _SmoothingLengthWithinVoxel
 
std::vector< double > _InternalEnergyWithinVoxel
 
std::vector< int_ParticleIDsWithinVoxel
 

Static Private Attributes

static tarch::logging::Log _log
 

Detailed Description

An HDF5 file reader This class works if and only if you have compiled Peano using –with-hdf5.

Particle coordinates are stored in list containers. Importantly, this will be used by the getParticlesWithinVoxel method to retrieve particles from each cell (and then remove them if desired). Other HDF5 groups are stored in vector containers so we can use subscripts to access them. @TODO use templates to unify the readers for the different return types.

Definition at line 35 of file FileReaderHDF5.h.

Member Function Documentation

◆ clear()

void toolbox::particles::FileReaderHDF5::clear ( )

Definition at line 578 of file FileReaderHDF5.cpp.

Referenced by peano4.output.Makefile.Makefile::__init__().

Here is the caller graph for this function:

◆ clearVoxel()

void toolbox::particles::FileReaderHDF5::clearVoxel ( )

Clear data of a voxel carried by this instance of FileReaderHDF5.

Definition at line 507 of file FileReaderHDF5.cpp.

◆ empty()

bool toolbox::particles::FileReaderHDF5::empty ( ) const

Definition at line 588 of file FileReaderHDF5.cpp.

◆ getInternalEnergyWithinVoxel()

std::vector< double > toolbox::particles::FileReaderHDF5::getInternalEnergyWithinVoxel ( ) const

Definition at line 613 of file FileReaderHDF5.cpp.

◆ getMassWithinVoxel()

std::vector< double > toolbox::particles::FileReaderHDF5::getMassWithinVoxel ( ) const

Definition at line 603 of file FileReaderHDF5.cpp.

◆ getNumberOfCoordinates()

bool toolbox::particles::FileReaderHDF5::getNumberOfCoordinates ( ) const

Definition at line 593 of file FileReaderHDF5.cpp.

◆ getParticleIDsWithinVoxel()

std::vector< int > toolbox::particles::FileReaderHDF5::getParticleIDsWithinVoxel ( ) const

Definition at line 618 of file FileReaderHDF5.cpp.

◆ getParticlesWithinVoxel()

std::list< tarch::la::Vector< Dimensions, double > > toolbox::particles::FileReaderHDF5::getParticlesWithinVoxel ( const tarch::la::Vector< Dimensions, double > & x,
const tarch::la::Vector< Dimensions, double > & h,
bool remove )

Take particles from database which fall into given voxel.

Overlapping vs. non-overlapping domain decomposition

In an SPMD environment, it is convenient to make each rank maintain its own input database. As a consequence, ranks have redundant particles and we will have to clean up eventually. To mirror this behaviour in the multithreaded context, we can remove particles whenever we assign them to an inner vertex, but we should also hand them out redundantly for boundary vertices.

Parameters
xCenter of voxel. If you use this within touchVertexFirstTime(), you can use the vertex position, i.e. the x() operation of the marker. If you use this function within a cell event, you can use x() as well, as it returns the centre.
hSize of voxel. If you use this function within a cell event, just pass in h(). If you use it within a vertex event, you should scale h with 0.5.
removeRemove a particle form the internal database if it is a match. In most cases, removing the particles immediately speeds up things, even though we then have a lot of (uneccessary) locks.
See also
peano4::datamanagement::CellMarker::x()
peano4::datamanagement::VertexMarker::x()

Definition at line 523 of file FileReaderHDF5.cpp.

References tarch::la::greaterEquals(), h, and tarch::la::smallerEquals().

Here is the call graph for this function:

◆ getSmoothingLengthWithinVoxel()

std::vector< double > toolbox::particles::FileReaderHDF5::getSmoothingLengthWithinVoxel ( ) const

Definition at line 608 of file FileReaderHDF5.cpp.

◆ getVelocityWithinVoxel()

std::vector< tarch::la::Vector< Dimensions, double > > toolbox::particles::FileReaderHDF5::getVelocityWithinVoxel ( ) const

Definition at line 598 of file FileReaderHDF5.cpp.

◆ isVoxelEmpty()

bool toolbox::particles::FileReaderHDF5::isVoxelEmpty ( ) const

Check whether voxel data carried by this instance of FileReaderHDF5 is empty.

Definition at line 515 of file FileReaderHDF5.cpp.

◆ readHDF5File()

void toolbox::particles::FileReaderHDF5::readHDF5File ( const std::string & filename)

Read HDF5 file in SWIFT format.

The coordinates are stored into lists, which allow efficient manipulation for inserting/removing entries later on, see getParticlesWithinVoxel below.

Parameters
filenamestring with file name of the HDF5 file.

Definition at line 12 of file FileReaderHDF5.cpp.

References _Coordinates, _InternalEnergy, _Mass, _ParticleIDs, _ParticleIndex, _SmoothingLength, _Velocity, logError, and logInfo.

Field Documentation

◆ _Coordinates

std::list< tarch::la::Vector<Dimensions,double> > toolbox::particles::FileReaderHDF5::_Coordinates
private

Definition at line 40 of file FileReaderHDF5.h.

Referenced by readHDF5File().

◆ _InternalEnergy

std::vector<double> toolbox::particles::FileReaderHDF5::_InternalEnergy
private

Definition at line 46 of file FileReaderHDF5.h.

Referenced by readHDF5File().

◆ _InternalEnergyWithinVoxel

std::vector<double> toolbox::particles::FileReaderHDF5::_InternalEnergyWithinVoxel
private

Definition at line 61 of file FileReaderHDF5.h.

◆ _log

tarch::logging::Log toolbox::particles::FileReaderHDF5::_log
staticprivate

Definition at line 37 of file FileReaderHDF5.h.

◆ _Mass

std::vector<double> toolbox::particles::FileReaderHDF5::_Mass
private

Definition at line 44 of file FileReaderHDF5.h.

Referenced by readHDF5File().

◆ _MassWithinVoxel

std::vector<double> toolbox::particles::FileReaderHDF5::_MassWithinVoxel
private

Definition at line 59 of file FileReaderHDF5.h.

◆ _ParticleIDs

std::vector<int> toolbox::particles::FileReaderHDF5::_ParticleIDs
private

Definition at line 47 of file FileReaderHDF5.h.

Referenced by readHDF5File().

◆ _ParticleIDsWithinVoxel

std::vector<int> toolbox::particles::FileReaderHDF5::_ParticleIDsWithinVoxel
private

Definition at line 62 of file FileReaderHDF5.h.

◆ _ParticleIndex

std::list<int> toolbox::particles::FileReaderHDF5::_ParticleIndex
private

Definition at line 52 of file FileReaderHDF5.h.

Referenced by readHDF5File().

◆ _SmoothingLength

std::vector<double> toolbox::particles::FileReaderHDF5::_SmoothingLength
private

Definition at line 45 of file FileReaderHDF5.h.

Referenced by readHDF5File().

◆ _SmoothingLengthWithinVoxel

std::vector<double> toolbox::particles::FileReaderHDF5::_SmoothingLengthWithinVoxel
private

Definition at line 60 of file FileReaderHDF5.h.

◆ _Velocity

std::vector< tarch::la::Vector<Dimensions,double> > toolbox::particles::FileReaderHDF5::_Velocity
private

Definition at line 43 of file FileReaderHDF5.h.

Referenced by readHDF5File().

◆ _VelocityWithinVoxel

std::vector< tarch::la::Vector<Dimensions,double> > toolbox::particles::FileReaderHDF5::_VelocityWithinVoxel
private

Definition at line 58 of file FileReaderHDF5.h.


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