|
waLBerla 7.2
|
Provides a low level reader for waLBerla geometry files.
| T | The underlying datatype that is stored in binary form in the geometry file |
#include <BasicVoxelFileReader.h>
Public Member Functions | |
| BasicVoxelFileReader () | |
| Constructs on empty geometry file. | |
| BasicVoxelFileReader (const std::string &_filename) | |
| Opens an existing geometry file. | |
| BasicVoxelFileReader (const std::string &_filename, std::size_t _xSize, std::size_t _ySize, std::size_t _zSize, T value=T()) | |
| Creates a new geometry file with extends xSize x ySize x zSize. | |
| BasicVoxelFileReader (const std::string &_filename, std::size_t _xSize, std::size_t _ySize, std::size_t _zSize, const T *values) | |
| Creates a new geometry file with extends xSize x ySize x zSize. | |
| ~BasicVoxelFileReader () | |
| Destructor that closes the file if necessary. | |
| void | open (const std::string &_filename) |
| Opens an existing geometry file. | |
| void | create (const std::string &_filename, std::size_t _xSize, std::size_t _ySize, std::size_t _zSize, T value=T()) |
| Creates a new geometry file with extends xSize x ySize x zSize. | |
| void | create (const std::string &_filename, std::size_t _xSize, std::size_t _ySize, std::size_t _zSize, const T *values) |
| Creates a new geometry file with extends xSize x ySize x zSize. | |
| void | close () |
| Closes an opened geometry file. | |
| bool | isOpen () const |
| Query if a geometry file is open. | |
| const std::string & | filename () const |
| Gets the filename of the opened geometry file. | |
| std::size_t | numCells () const |
| Gets the number of cells of the currently loaded geometry file. | |
| std::size_t | xSize () const |
| Gets the extend of the geometry file in x direction. | |
| std::size_t | ySize () const |
| Gets the extend of the geometry file in y direction. | |
| std::size_t | zSize () const |
| Gets the extend of the geometry file in z direction. | |
| void | read (const CellAABB &cellAABB, std::vector< T > &data) const |
| Reads a block of data from the opened geometry file. | |
| void | write (const CellAABB &cellAABB, const std::vector< T > &data) |
| Writes a block of data to the geometry file. | |
Private Attributes | |
| std::fstream | filestream_ |
| fstream object managing the opened file | |
| std::string | filename_ |
| Filename of the geometry file currently opened. | |
| std::streampos | dataBegin_ |
| Position in the stream where to raw data starts. | |
| std::size_t | xSize_ |
| Extend of the currently open geometry file in x direction. | |
| std::size_t | ySize_ |
| Extend of the currently open geometry file in y direction. | |
| std::size_t | zSize_ |
| Extend of the currently open geometry file in z direction. | |
| walberla::geometry::BasicVoxelFileReader< T >::BasicVoxelFileReader | ( | ) |
Constructs on empty geometry file.
| walberla::geometry::BasicVoxelFileReader< T >::BasicVoxelFileReader | ( | const std::string & | _filename | ) |
Opens an existing geometry file.
| _filename | Name (path) of the file. |
| std::runtime_error | on I/O errors. |
| walberla::geometry::BasicVoxelFileReader< T >::BasicVoxelFileReader | ( | const std::string & | _filename, |
| std::size_t | _xSize, | ||
| std::size_t | _ySize, | ||
| std::size_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(). |
| std::runtime_error | on I/O errors. |
| walberla::geometry::BasicVoxelFileReader< T >::BasicVoxelFileReader | ( | const std::string & | _filename, |
| std::size_t | _xSize, | ||
| std::size_t | _ySize, | ||
| std::size_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. |
| std::runtime_error | on I/O errors. |
| walberla::geometry::BasicVoxelFileReader< T >::~BasicVoxelFileReader | ( | ) |
Destructor that closes the file if necessary.
| void walberla::geometry::BasicVoxelFileReader< T >::close | ( | ) |
Closes an opened geometry file.
If no geometry file is open, this does nothing.
| void walberla::geometry::BasicVoxelFileReader< T >::create | ( | const std::string & | _filename, |
| std::size_t | _xSize, | ||
| std::size_t | _ySize, | ||
| std::size_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. |
| std::runtime_error | on I/O errors. |
| void walberla::geometry::BasicVoxelFileReader< T >::create | ( | const std::string & | _filename, |
| std::size_t | _xSize, | ||
| std::size_t | _ySize, | ||
| std::size_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(). |
| std::runtime_error | on I/O errors. |
| const std::string & walberla::geometry::BasicVoxelFileReader< T >::filename | ( | ) | const |
Gets the filename of the opened geometry file.
| bool walberla::geometry::BasicVoxelFileReader< T >::isOpen | ( | ) | const |
Query if a geometry file is open.
| std::size_t walberla::geometry::BasicVoxelFileReader< T >::numCells | ( | ) | const |
| void walberla::geometry::BasicVoxelFileReader< T >::open | ( | const std::string & | _filename | ) |
Opens an existing geometry file.
An already opened file gets closed beforehand.
| _filename | Name (path) of the file. |
| std::runtime_error | on I/O errors. |
| std::runtime_error | if the loaded geometry file's format is corrupt |
| void walberla::geometry::BasicVoxelFileReader< T >::read | ( | const CellAABB & | cellAABB, |
| std::vector< T > & | data ) const |
Reads a block of data from the opened geometry file.
| cellAABB | 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) |
| std::runtime_error | on I/O errors. |
| void walberla::geometry::BasicVoxelFileReader< T >::write | ( | const CellAABB & | cellAABB, |
| const std::vector< T > & | data ) |
Writes a block of data to the geometry file.
| cellAABB | 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) |
| std::runtime_error | on I/O errors. |
| std::size_t walberla::geometry::BasicVoxelFileReader< T >::xSize | ( | ) | const |
Gets the extend of the geometry file in x direction.
| std::size_t walberla::geometry::BasicVoxelFileReader< T >::ySize | ( | ) | const |
Gets the extend of the geometry file in y direction.
| std::size_t walberla::geometry::BasicVoxelFileReader< T >::zSize | ( | ) | const |
Gets the extend of the geometry file in z direction.
|
private |
Position in the stream where to raw data starts.
|
private |
Filename of the geometry file currently opened.
|
mutableprivate |
fstream object managing the opened file
|
private |
Extend of the currently open geometry file in x direction.
|
private |
Extend of the currently open geometry file in y direction.
|
private |
Extend of the currently open geometry file in z direction.