|
Peano
|
Plot Peano's mesh data in Peano's text file format. More...
#include <PeanoTextPatchFileWriter.h>


Data Structures | |
| class | CellDataWriter |
| class | VertexDataWriter |
Public Types | |
| enum class | IndexFileMode |
Public Member Functions | |
| PeanoTextPatchFileWriter (int dimension, const std::string &fileName, const std::string &indexFileName, IndexFileMode appendToIndexFile, double timeStamp, int precision=6) | |
| Create a new Peano text file output. | |
| virtual | ~PeanoTextPatchFileWriter () |
| Destructor. | |
| virtual CellDataWriter * | createCellDataWriter (const std::string &identifier, int unknownsPerAxis, int recordsPerCell, const std::string &description) override |
| Caller has to destroy this instance manually. | |
| virtual CellDataWriter * | createCellDataWriter (const std::string &identifier, int unknownsPerAxis, int recordsPerCell, const std::string &description, const std::string &metaData) override |
| Create cell data writer. | |
| virtual CellDataWriter * | createCellDataWriter (const std::string &identifier, int unknownsPerAxis, int recordsPerCell, const std::string &description, const std::string &metaData, double *mapping) override |
| Create writer. | |
| virtual VertexDataWriter * | createVertexDataWriter (const std::string &identifier, int unknownsPerAxis, int recordsPerVertex, const std::string &description) override |
| Caller has to destroy this instance manually. | |
| virtual VertexDataWriter * | createVertexDataWriter (const std::string &identifier, int unknownsPerAxis, int recordsPerVertex, const std::string &description, const std::string &metaData) override |
| Create vertex data writer. | |
| virtual VertexDataWriter * | createVertexDataWriter (const std::string &identifier, int unknownsPerAxis, int recordsPerVertex, const std::string &description, const std::string &metaData, double *mapping) override |
| Create writer. | |
| virtual int | plotPatch (const tarch::la::Vector< 2, double > &offset, const tarch::la::Vector< 2, double > &size) override |
| virtual int | plotPatch (const tarch::la::Vector< 3, double > &offset, const tarch::la::Vector< 3, double > &size) override |
| virtual bool | writeToFile () override |
| virtual bool | isOpen () override |
| virtual void | clear () override |
| Clear local data. | |
Public Member Functions inherited from tarch.plotter::griddata::blockstructured::PatchWriter | |
| virtual | ~PatchWriter ()=default |
Protected Member Functions | |
| void | writeMetaData (const std::string &metaData) |
| void | writeMapping (int totalEntries, double *values) |
| void | createBackupOfMetaFile () |
| void | createEmptyIndexFile () |
| void | addNewDatasetToIndexFile (double timestamp) |
| void | addNewFileToCurrentDataSetInIndexFile (const std::string &filename) |
| double | getLatestTimeStepInIndexFile () const |
| Find latest time step in index file. | |
Protected Attributes | |
| std::string | _fileName |
| std::string | _indexFile |
| bool | _writtenToFile |
| int | _dimensions |
| int | _patchCounter |
| std::stringstream | _snapshotFileOut |
| bool | _haveWrittenAtLeastOnePatch |
Static Protected Attributes | |
| static tarch::logging::Log | _log |
| static const std::string | HEADER |
Plot Peano's mesh data in Peano's text file format.
Consult the general plotting remarks on rationale and patterns behind the realisation of this class. This is a technical view. If you are interested in the file format that is written, you have to read the documentation of the Peano patch file format.
There are different configuration modes. They are passed as an argument to the constructor:
The last one is the most sophisticated variant and deserves further explanation. First of all, the code searches for the index (or meta) file. If there is none, the code basically falls back to IndexFileMode::CreateNew, i.e. creates a new index file.
If there is a file, we open it and look what the latest time stamp in there is. For this, we call getLatestTimeStepInIndexFile(). If that time stamp is bigger than the current time stamp, we know that this index file is from a previous run. We create a backup (some people do appreciate if we do so) and then again create a new index file.
If our own time stamp matches the last time stamp in the index file, we know that the current dump is one (of many) dumps by a spacetree which contributes towards the overall picture. That is, we add our own data set to the existing time stamp.
If our own time stamp is bigger than the last one, we know that we are the first plotter of all the plotters out there which started to dump the data of the next time stamp. We append a new section for a new dump and add our own file there.
Definition at line 73 of file PeanoTextPatchFileWriter.h.
|
strong |
Definition at line 224 of file PeanoTextPatchFileWriter.h.
| tarch.plotter::griddata::blockstructured::PeanoTextPatchFileWriter::PeanoTextPatchFileWriter | ( | int | dimension, |
| const std::string & | fileName, | ||
| const std::string & | indexFileName, | ||
| IndexFileMode | appendToIndexFile, | ||
| double | timeStamp, | ||
| int | precision = 6 |
||
| ) |
Create a new Peano text file output.
An instance of this class has to be owned by each action set that wants to dump data.
If appendToIndexFile is IndexFileMode::AppendNewData and no index file exists yet, the constructor has to both create that index file (which, via createEmptyIndexFile(), already writes one dataset section for timeStamp) and decide whether the current writer's own timeStamp is "newer" than whatever is already in the index file, to decide if a further, separate dataset section is required. That decision has to be made by calling getLatestTimeStepInIndexFile() after the index file has been (re)created if it had to be - not before. Comparing against the "no data yet" state that getLatestTimeStepInIndexFile() reports for a file that does not exist yet would make the writer for the very first data set of a run believe it also has to open a second, empty dataset section for its own (freshly written) time stamp, and every later writer for that same time stamp would then register its data in that spurious second section rather than the first, correct one. If you touch the ordering of operations in the AppendNewData branch of the implementation, preserve this "decide only after creating/recreating" order.
| dimension | I make this a free parameter, even though most codes will pass in the compile time parameter Dimensions. However, there are codes which plot submanifolds for example or want to write 3d data within a 2d code, as they implement a 2.5d model. |
| fileName | Name of the file to write. Has to be unique per dump. |
| indexFileName | Name of the index file. Can we empty if you select NoIndexFile. |
| precision | Number of significant digits of all floating point numbers in the file: patch offsets and sizes, mappings and data. The cell and vertex data writers start with this precision and can lower or raise it via CellDataWriter::setPrecision(). The writer does not round or truncate any value beyond this precision. Small values are written as they are (no flush to zero), so a file written with 17 digits (std::numeric_limits<double>::max_digits10) holds the doubles bit-exact, e.g. for a checkpoint. Keep at least six digits on deep adaptive meshes, as the patch offsets otherwise become imprecise. |
|
virtual |
Destructor.
The destructor is empty, i.e. if you destroy this object, your data are lost. You have to dump the data beforehand manually by calling writeToFile().
|
protected |
|
protected |
|
overridevirtual |
Clear local data.
Clear the writer, i.e. erase all the data. However, as the writer does not track how many vertex and cell writers you've created, it's up to you to ensure that none of these instances is left. So we clear the core data, but we do not clear the data within any data writer which you have created by calling routines such as createCellDataWriter().
Implements tarch.plotter::griddata::blockstructured::PatchWriter.
Referenced by peano4.api.output.Makefile.Makefile::__init__().

|
protected |
|
overridevirtual |
Caller has to destroy this instance manually.
Implements tarch.plotter::griddata::blockstructured::PatchWriter.
|
overridevirtual |
Create cell data writer.
Wrapper around createCellDataWriter(std::string, int, int, std::string, std::string, double*) with default values. Please consult description of the more elaborate routine for details.
Implements tarch.plotter::griddata::blockstructured::PatchWriter.
|
overridevirtual |
Create writer.
Caller has to destroy this instance manually.
| identifier | Name of your data. I recommend to stick to C++ identifier rules for this one, i.e. no fancy chars and no spaces |
| unknownsPerAxis | We plot a (logically) Cartesian piece of data. This is the number of unknowns per axis |
| recordsPerVertex | Number of entries stores per unknown. Data is, by default, written as AoS |
| description | This is a description of the data. Should be a one-liner. |
| metaData | Further meta data without prescribed semantics. Can be a longer text block. |
| mapping | Array of positions within a unit cube/square. It is an AoS of vectors within the unit square which distorts all the plotting points within the logical Cartesian mesh imposed over the unit cube. By default, all data are Cartesian and spaced out equidistantly, i.e. if you have 4x4 data points per cell, then you get a chess board pattern of 16 smaller cubes over the cell in 2d. However, you might prefer something like Gauss Lobatto nodes, and then the data are not spaced out uniformly anymore. |
Implements tarch.plotter::griddata::blockstructured::PatchWriter.
|
protected |
|
overridevirtual |
Caller has to destroy this instance manually.
Implements tarch.plotter::griddata::blockstructured::PatchWriter.
|
overridevirtual |
Create vertex data writer.
Wrapper around createVertexDataWriter(std::string, int, int, std::string, std::string, double*) with default values. Please consult description of the more elaborate routine for details.
Implements tarch.plotter::griddata::blockstructured::PatchWriter.
|
overridevirtual |
Create writer.
Caller has to destroy this instance manually.
| identifier | Name of your data. I recommend to stick to C++ identifier rules for this one, i.e. no fancy chars and no spaces |
| unknownsPerAxis | We plot a (logically) Cartesian piece of data. This is the number of unknowns per axis |
| recordsPerVertex | Number of entries stores per unknown. Data is, by default, written as AoS |
| description | This is a description of the data. Should be a one-liner. |
| metaData | Further meta data without prescribed semantics. Can be a longer text block. |
| mapping | Array of positions within a unit cube/square. It is an AoS of vectors within the unit square which distorts all the plotting points within the logical Cartesian mesh imposed over the unit cube. By default, all data are Cartesian and spaced out equidistantly, i.e. if you have 4x4 data points per cell, then you get a chess board pattern of 16 smaller cubes over the cell in 2d. However, you might prefer something like Gauss Lobatto nodes, and then the data are not spaced out uniformly anymore. |
Implements tarch.plotter::griddata::blockstructured::PatchWriter.
|
protected |
Find latest time step in index file.
This routine runs through the index file and searches for the latest entry in there which looks similar to
It will then return the value of this time stamp.
|
overridevirtual |
Implements tarch.plotter::griddata::blockstructured::PatchWriter.
|
overridevirtual |
Implements tarch.plotter::griddata::blockstructured::PatchWriter.
|
overridevirtual |
Implements tarch.plotter::griddata::blockstructured::PatchWriter.
|
protected |
|
protected |
|
overridevirtual |
Implements tarch.plotter::griddata::blockstructured::PatchWriter.
|
protected |
Definition at line 83 of file PeanoTextPatchFileWriter.h.
Referenced by exaparty.api.Project.Project::__configure_makefile(), api.Project.Project::__configure_makefile(), exaparty.api.Project.Project::__export_constants(), api.Project.Project::__export_constants(), exahype2.api.Project.Project::__export_constants(), api.Project.Project::__init__(), solvers.api.ContinuousGalerkinDiscretisationGaussLobattoWithBlockJacobi.ContinuousGalerkinDiscretisationGaussLobattoWithBlockJacobi::_construct_narrow_to_interior_matrix(), scenarios.elastic_planar_waves.ElasticPlanarWaves::analytical_solution(), tarch.plotter.api.output.Visualiser.PatchFileData::apply_renderer_to_data(), exahype2.api.dslhype.SyntaxTree.Matrix::index(), scenarios.elastic_planar_waves.ElasticPlanarWaves::initial_conditions(), exahype2.api.dslhype.SyntaxTree.TSimpleMemref::print_mlir(), exahype2.api.dslhype.SyntaxTree.TDataBlock::print_mlir(), exaparty.api.Project.Project::set_global_simulation_parameters(), api.Project.Project::set_global_simulation_parameters(), api.Project.Project::set_global_simulation_parameters(), exahype2.api.Project.Project::set_global_simulation_parameters(), and scenarios.scenario.Scenario::set_global_simulation_parameters().
|
protected |
Definition at line 78 of file PeanoTextPatchFileWriter.h.
|
protected |
Definition at line 88 of file PeanoTextPatchFileWriter.h.
|
protected |
Definition at line 79 of file PeanoTextPatchFileWriter.h.
|
staticprotected |
Definition at line 75 of file PeanoTextPatchFileWriter.h.
|
protected |
Definition at line 85 of file PeanoTextPatchFileWriter.h.
|
protected |
Definition at line 87 of file PeanoTextPatchFileWriter.h.
|
protected |
Definition at line 81 of file PeanoTextPatchFileWriter.h.
|
staticprotected |
Definition at line 76 of file PeanoTextPatchFileWriter.h.