![]() |
Peano
|
An HDF5 file reader This class works if and only if you have compiled Peano using –with-hdf5. More...
#include <FileReaderHDF5.h>
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< int > | getParticleIDsWithinVoxel () 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 |
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.
void toolbox::particles::FileReaderHDF5::clear | ( | ) |
Definition at line 578 of file FileReaderHDF5.cpp.
Referenced by peano4.output.Makefile.Makefile::__init__().
void toolbox::particles::FileReaderHDF5::clearVoxel | ( | ) |
Clear data of a voxel carried by this instance of FileReaderHDF5.
Definition at line 507 of file FileReaderHDF5.cpp.
bool toolbox::particles::FileReaderHDF5::empty | ( | ) | const |
Definition at line 588 of file FileReaderHDF5.cpp.
std::vector< double > toolbox::particles::FileReaderHDF5::getInternalEnergyWithinVoxel | ( | ) | const |
Definition at line 613 of file FileReaderHDF5.cpp.
std::vector< double > toolbox::particles::FileReaderHDF5::getMassWithinVoxel | ( | ) | const |
Definition at line 603 of file FileReaderHDF5.cpp.
bool toolbox::particles::FileReaderHDF5::getNumberOfCoordinates | ( | ) | const |
Definition at line 593 of file FileReaderHDF5.cpp.
std::vector< int > toolbox::particles::FileReaderHDF5::getParticleIDsWithinVoxel | ( | ) | const |
Definition at line 618 of file FileReaderHDF5.cpp.
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.
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.
x | Center 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. |
h | Size 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. |
remove | Remove 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. |
Definition at line 523 of file FileReaderHDF5.cpp.
References tarch::la::greaterEquals(), and tarch::la::smallerEquals().
std::vector< double > toolbox::particles::FileReaderHDF5::getSmoothingLengthWithinVoxel | ( | ) | const |
Definition at line 608 of file FileReaderHDF5.cpp.
std::vector< tarch::la::Vector< Dimensions, double > > toolbox::particles::FileReaderHDF5::getVelocityWithinVoxel | ( | ) | const |
Definition at line 598 of file FileReaderHDF5.cpp.
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.
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.
filename | string 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.
|
private |
Definition at line 40 of file FileReaderHDF5.h.
Referenced by readHDF5File().
|
private |
Definition at line 46 of file FileReaderHDF5.h.
Referenced by readHDF5File().
|
private |
Definition at line 61 of file FileReaderHDF5.h.
|
staticprivate |
Definition at line 37 of file FileReaderHDF5.h.
|
private |
Definition at line 44 of file FileReaderHDF5.h.
Referenced by readHDF5File().
|
private |
Definition at line 59 of file FileReaderHDF5.h.
|
private |
Definition at line 47 of file FileReaderHDF5.h.
Referenced by readHDF5File().
|
private |
Definition at line 62 of file FileReaderHDF5.h.
|
private |
Definition at line 52 of file FileReaderHDF5.h.
Referenced by readHDF5File().
|
private |
Definition at line 45 of file FileReaderHDF5.h.
Referenced by readHDF5File().
|
private |
Definition at line 60 of file FileReaderHDF5.h.
|
private |
Definition at line 43 of file FileReaderHDF5.h.
Referenced by readHDF5File().
|
private |
Definition at line 58 of file FileReaderHDF5.h.