|
Peano
|
Read a Peano patch file back into memory. More...
#include <PeanoTextPatchFileReader.h>

Data Structures | |
| struct | Content |
| Whole content of a file. More... | |
| struct | Header |
| Information from the first lines of a file. More... | |
| struct | Patch |
| One patch of the file. More... | |
Public Types | |
| enum class | Format { ASCII , Binary } |
Public Member Functions | |
| virtual | ~PeanoTextPatchFileReader ()=default |
| Content | read (const std::string &fileName) const |
| Read the whole file. | |
Static Public Member Functions | |
| static Header | readHeader (const std::string &fileName) |
| Read only the header of a file. | |
Protected Member Functions | |
| virtual void | readValues (std::istream &in, int numberOfValues, std::vector< double > &values) const |
| Read the quantities of one patch. | |
| virtual Format | getFormat () const |
| Format this reader supports. | |
Read a Peano patch file back into memory.
The reader complements tarch::plotter::griddata::blockstructured::PeanoTextPatchFileWriter and tarch::plotter::griddata::blockstructured::PeanoBinaryPatchFileWriter. The file format is described in Visualisation. This class reads files with format ASCII, i.e. files where the quantities of a patch are written as text. tarch::reader::PeanoBinaryPatchFileReader extends it for format Binary.
Both formats share the whole structure of the file but the quantities of the patches. Therefore, the routine read() is the same for both readers and the subclass only overwrites readValues(). To find out which reader is the right one, call readHeader() first. It looks at the first lines of the file only, i.e. it is cheap.
The reader reads the cell data of a file, i.e. the cell-values of the patches. It does not read vertex data and it ignores the mappings.
Definition at line 40 of file PeanoTextPatchFileReader.h.
|
strong |
| Enumerator | |
|---|---|
| ASCII | |
| Binary | |
Definition at line 42 of file PeanoTextPatchFileReader.h.
|
virtualdefault |
|
protectedvirtual |
Format this reader supports.
Reimplemented in tarch::reader::PeanoBinaryPatchFileReader.
| Content tarch::reader::PeanoTextPatchFileReader::read | ( | const std::string & | fileName | ) | const |
Read the whole file.
The routine terminates the application if it cannot open the file, if the file claims a format other than the one the reader supports, or if the file is corrupted.
|
static |
Read only the header of a file.
This is the light-touch routine: It runs through the first lines of the file until it has found the dimensions and does not parse any patch. Use it to find out which reader to instantiate.
A file without a format line is an ASCII file. The routine terminates the application if it cannot open the file.
|
protectedvirtual |
Read the quantities of one patch.
The routine is called after the line begin cell-values has been read. It has to leave the stream such that the next line to be read is the line end cell-values.
| in | Stream of the file, opened in binary mode. |
| numberOfValues | Number of doubles the patch holds. Derived from the cell metadata and the dimensions. |
| values | Output. Is cleared first. |
Reimplemented in tarch::reader::PeanoBinaryPatchFileReader.