Provides a reader for waLBerla geometry files.
Note that the data is stored in binary form. There is no correction for other binary data representations on different architectures (e.g. different endianness)! An opened file is automatically closed upon destruction.
T | The underlying datatype that is stored in binary form in the geometry file |
#include <VoxelFileReader.h>
Public Member Functions | |
VoxelFileReader () | |
Constructs on empty geometry file. More... | |
VoxelFileReader (const std::string &_filename) | |
Opens an existing geometry file. More... | |
VoxelFileReader (const std::string &_filename, uint_t _xSize, uint_t _ySize, uint_t _zSize, T value=T()) | |
Creates a new geometry file with extends xSize x ySize x zSize. More... | |
VoxelFileReader (const std::string &_filename, uint_t _xSize, uint_t _ySize, uint_t _zSize, const T *values) | |
Creates a new geometry file with extends xSize x ySize x zSize. More... | |
void | open (const std::string &_filename) |
Opens an existing geometry file. More... | |
void | create (const std::string &_filename, uint_t _xSize, uint_t _ySize, uint_t _zSize, T value=T()) |
Creates a new geometry file with extends xSize x ySize x zSize. More... | |
void | create (const std::string &_filename, uint_t _xSize, uint_t _ySize, uint_t _zSize, const T *values) |
Creates a new geometry file with extends xSize x ySize x zSize. More... | |
void | close () |
Closes an opened geometry file. More... | |
bool | isOpen () const |
Query if a geometry file is open. More... | |
const std::string & | filename () const |
Gets the filename of the opened geometry file. More... | |
uint_t | numCells () const |
Gets the number of cells of the currently loaded geometry file. More... | |
uint_t | xSize () const |
Gets the extend of the geometry file in x direction. More... | |
uint_t | ySize () const |
Gets the extend of the geometry file in y direction. More... | |
uint_t | zSize () const |
Gets the extend of the geometry file in z direction. More... | |
void | read (const CellInterval &cellInterval, std::vector< T > &data) const |
Reads a block of data from the opened geometry file. More... | |
void | write (const CellInterval &cellInterval, const std::vector< T > &data) |
Writes a block of data to the geometry file. More... | |
Private Attributes | |
BasicVoxelFileReader< T > | geometryFile_ |
The low-level geometry file reader. More... | |
walberla::geometry::VoxelFileReader< T >::VoxelFileReader |
Constructs on empty geometry file.
walberla::geometry::VoxelFileReader< T >::VoxelFileReader | ( | const std::string & | _filename | ) |
Opens an existing geometry file.
_filename | Name (path) of the file. |
walberla::geometry::VoxelFileReader< T >::VoxelFileReader | ( | const std::string & | _filename, |
uint_t | _xSize, | ||
uint_t | _ySize, | ||
uint_t | _zSize, | ||
T | value = T() |
||
) |
Creates a new geometry file with extends xSize x ySize x zSize.
_filename | Name (path) of the file. |
_xSize | Extend of the geometry file in x direction. |
_ySize | Extend of the geometry file in y direction. |
_zSize | Extend of the geometry file in z direction. |
value | The value the cells are initialized with. Defaults to T(). |
walberla::geometry::VoxelFileReader< T >::VoxelFileReader | ( | const std::string & | _filename, |
uint_t | _xSize, | ||
uint_t | _ySize, | ||
uint_t | _zSize, | ||
const T * | values | ||
) |
Creates a new geometry file with extends xSize x ySize x zSize.
_filename | Name (path) of the file. |
_xSize | Extend of the geometry file in x direction. |
_ySize | Extend of the geometry file in y direction. |
_zSize | Extend of the geometry file in z direction. |
values | An array of size xSize * ySize * zSize with the values to initialize the geometry file with. |
void walberla::geometry::VoxelFileReader< T >::close |
Closes an opened geometry file.
If no geometry file is open, this does nothing.
void walberla::geometry::VoxelFileReader< T >::create | ( | const std::string & | _filename, |
uint_t | _xSize, | ||
uint_t | _ySize, | ||
uint_t | _zSize, | ||
const T * | values | ||
) |
Creates a new geometry file with extends xSize x ySize x zSize.
An already opened file gets closed beforehand.
_filename | Name (path) of the file. |
_xSize | Extend of the geometry file in x direction. |
_ySize | Extend of the geometry file in y direction. |
_zSize | Extend of the geometry file in z direction. |
values | An array of size xSize * ySize * zSize with the values to initialize the geometry file with. |
void walberla::geometry::VoxelFileReader< T >::create | ( | const std::string & | _filename, |
uint_t | _xSize, | ||
uint_t | _ySize, | ||
uint_t | _zSize, | ||
T | value = T() |
||
) |
Creates a new geometry file with extends xSize x ySize x zSize.
An already opened file gets closed beforehand.
_filename | Name (path) of the file. |
_xSize | Extend of the geometry file in x direction. |
_ySize | Extend of the geometry file in y direction. |
_zSize | Extend of the geometry file in z direction. |
value | The value the cells are initialized with. Defaults to T(). |
const std::string & walberla::geometry::VoxelFileReader< T >::filename |
Gets the filename of the opened geometry file.
bool walberla::geometry::VoxelFileReader< T >::isOpen |
Query if a geometry file is open.
uint_t walberla::geometry::VoxelFileReader< T >::numCells |
void walberla::geometry::VoxelFileReader< T >::open | ( | const std::string & | _filename | ) |
Opens an existing geometry file.
An already opened file gets closed beforehand.
_filename | Name (path) of the file. |
void walberla::geometry::VoxelFileReader< T >::read | ( | const CellInterval & | cellInterval, |
std::vector< T > & | data | ||
) | const |
Reads a block of data from the opened geometry file.
cellInterval | The axis-aligned bounding box of the block of data to be read. | |
[out] | data | The vector the read data is stored to. The Storage order is zyx. (Meaning your innermost loop should iterate over x) |
void walberla::geometry::VoxelFileReader< T >::write | ( | const CellInterval & | cellInterval, |
const std::vector< T > & | data | ||
) |
Writes a block of data to the geometry file.
cellInterval | The axis-aligned bounding box of the block of data to be written. |
data | The vector holding the data to bw written to the geometry file. The Storage order is zyx. (Meaning your innermost loop should iterate over x) |
uint_t walberla::geometry::VoxelFileReader< T >::xSize |
Gets the extend of the geometry file in x direction.
uint_t walberla::geometry::VoxelFileReader< T >::ySize |
Gets the extend of the geometry file in y direction.
uint_t walberla::geometry::VoxelFileReader< T >::zSize |
Gets the extend of the geometry file in z direction.
|
private |
The low-level geometry file reader.