LifeV
|
ExporterVTK data exporter. More...
#include <ExporterVTK.hpp>
Public Types | |
enum | VTK_CELL { VTK_VERTEX = 1, VTK_POLY_VERTEX = 2, VTK_LINE = 3, VTK_POLY_LINE = 4, VTK_TRIANGLE = 5, VTK_TRIANGLE_STRIP = 6, VTK_POLYGON = 7, VTK_PIXEL = 8, VTK_QUAD = 9, VTK_TETRA = 10, VTK_VOXEL = 11, VTK_HEXAHEDRON = 12, VTK_WEDGE = 13, VTK_PYRAMID = 14, VTK_QUADRATIC_EDGE = 21, VTK_QUADRATIC_TRIANGLE = 22, VTK_QUADRATIC_QUAD = 23, VTK_QUADRATIC_TETRA = 24, VTK_QUADRATIC_HEXAHEDRON = 25 } |
enum | EXPORT_MODE { ASCII_EXPORT = 1, BINARY_EXPORT = 2 } |
enum | FLOAT_PRECISION { SINGLE_PRECISION = 1, DOUBLE_PRECISION = 2 } |
typedef MeshType | mesh_Type |
typedef Exporter< mesh_Type > | super |
typedef super::meshPtr_Type | meshPtr_Type |
typedef super::commPtr_Type | commPtr_Type |
typedef super::feSpacePtr_Type | feSpacePtr_Type |
typedef super::exporterData_Type | exporterData_Type |
typedef super::feTypeToDataIdMap_Type::iterator | feTypeToDataIdMap_Type_Type |
typedef const exporterData_Type::WhereEnum & | where_Type |
Static members | |
static MapEpetraType const | MapType |
returns the type of the map to use for the VectorEpetra More... | |
Constructors & Destructor | |
ExporterVTK () | |
Default constructor. More... | |
ExporterVTK (const GetPot &data_file, const std::string prefix) | |
virtual | ~ExporterVTK () |
Destructor. More... | |
ExporterVTK (const ExporterVTK &example) | |
Copy constructor. More... | |
Public Methods | |
virtual void | postProcess (const Real &time) |
Post-process the variables added to the list. More... | |
virtual UInt | importFromTime (const Real &) |
Import data from previous simulations at a certain time. More... | |
virtual void | import (const Real &, const Real &) |
Import data from previous simulations and rebuild the internal time counters. More... | |
virtual void | import (const Real &Tstart) |
Import data from previous simulations. More... | |
void | exportPID (meshPtr_Type, commPtr_Type comm, const bool=false) |
temporary: the method should work form the Exporter class More... | |
virtual void | setDataFromGetPot (const GetPot &dataFile, const std::string §ion="exporter") |
Set data from file. More... | |
Get methods | |
virtual MapEpetraType | mapType () const |
returns the type of the map to use for the VectorEpetra More... | |
Private methods | |
UInt | whichCellType (const feSpacePtr_Type &_feSpacePtr) |
void | composePVTUStream (const exporterData_Type &dvar, std::stringstream &pVTUStringStream) |
void | createPointsMaps (const feSpacePtr_Type &_feSpacePtr, std::map< UInt, UInt > &globalToLocalPointsMap, std::map< UInt, UInt > &localToGlobalPointsMap, std::vector< Vector > &coordinatesOfPoints) |
void | composeVTKCollection (const std::string &variableName, std::stringstream &vtkCollectionStringStream) |
void | composeVTUHeaderStream (UInt numPoints, std::stringstream &vtuHeaderStringStream) |
void | composeVTUFooterStream (std::stringstream &vtuFooterStringStream) |
void | composeVTUGeoStream (const feSpacePtr_Type &_feSpacePtr, const std::map< UInt, UInt > &globalToLocalPointsMap, const std::vector< Vector > &coordinatesOfPoints, std::stringstream &vtuGeoStringStream) |
void | composeTypeDataHeaderStream (where_Type where, std::stringstream &typeDataHeaderStringStream) |
void | composeTypeDataFooterStream (where_Type where, std::stringstream &typeDataFooterStringStream) |
void | composeDataArrayStream (const exporterData_Type &dvar, const std::map< UInt, UInt > &localToGlobalMap, std::stringstream &dataArraysStringStream) |
void | composeDataArrayStream (where_Type where, std::stringstream &dataArraysStringStream) |
virtual void | readScalar (ExporterData< mesh_Type > &) |
The scalar reader (specialization of the parent class method) More... | |
virtual void | readVector (ExporterData< mesh_Type > &) |
The vector reader (specialization of the parent class method) More... | |
void | readVTUFiles (exporterData_Type &dvar) |
The reader for VTU files. More... | |
void | readBinaryData (const std::string &line, std::vector< Real > &values, const UInt &numBits) |
A routine for loading values stored in binary format in a VTU file. More... | |
void | readASCIIData (const std::string &line, std::vector< Real > &values) |
A routine for loading values stored in ASCII format in a VTU file. More... | |
Private members | |
EXPORT_MODE | M_exportMode |
FLOAT_PRECISION | M_floatPrecision |
std::map< std::string, std::list< std::string > > | M_pvtuFiles |
Additional Inherited Members | |
Public Types inherited from Exporter< MeshType > | |
typedef MeshType | mesh_Type |
typedef std::shared_ptr< MeshType > | meshPtr_Type |
typedef Epetra_Comm | comm_Type |
typedef std::shared_ptr< comm_Type > | commPtr_Type |
typedef ExporterData< mesh_Type > | exporterData_Type |
typedef exporterData_Type::vector_Type | vector_Type |
typedef exporterData_Type::vectorPtr_Type | vectorPtr_Type |
typedef exporterData_Type::feSpace_Type | feSpace_Type |
typedef exporterData_Type::feSpacePtr_Type | feSpacePtr_Type |
typedef exporterData_Type::WhereEnum | WhereEnum |
typedef exporterData_Type::FieldTypeEnum | FieldTypeEnum |
typedef exporterData_Type::FieldRegimeEnum | FieldRegimeEnum |
typedef std::vector< exporterData_Type > | dataVector_Type |
typedef dataVector_Type::iterator | dataVectorIterator_Type |
typedef std::multimap< WhereEnum, UInt > | whereToDataIdMap_Type |
typedef std::multimap< FE_TYPE, UInt > | feTypeToDataIdMap_Type |
Public Member Functions inherited from Exporter< MeshType > | |
Exporter () | |
Empty constructor for Exporter. More... | |
Exporter (const GetPot &dfile, const std::string &prefix) | |
Constructor for Exporter without prefix and procID. More... | |
virtual | ~Exporter () |
Destructor. More... | |
void | addVariable (const FieldTypeEnum &type, const std::string &variableName, const feSpacePtr_Type &feSpacePtr, const vectorPtr_Type &vectorPtr, const UInt &start, const FieldRegimeEnum ®ime=exporterData_Type::UnsteadyRegime, const WhereEnum &where=exporterData_Type::Node) |
Adds a new variable to be post-processed. More... | |
virtual void | readVariable (exporterData_Type &dvar) |
virtual void | exportPID (meshPtr_Type &mesh, commPtr_Type &comm, const bool binaryFormat=false) |
Export the Processor ID as P0 variable. More... | |
void | exportRegionMarkerID (std::shared_ptr< MeshType > mesh, std::shared_ptr< Epetra_Comm > comm) |
Export the region marker ID as P0 variable. More... | |
virtual void | exportFlags (std::shared_ptr< MeshType > mesh, std::shared_ptr< Epetra_Comm > comm, flag_Type const &flag=EntityFlags::ALL) |
Export entity flags. More... | |
void | setPrefix (const std::string &prefix) |
Set prefix. More... | |
void | setPostDir (const std::string &Directory) |
Set the folder for pre/postprocessing. More... | |
void | setTimeIndex (const UInt &timeIndex) |
Set the current time index. More... | |
void | setTimeIndexStart (const UInt &timeIndexStart) |
Set the time index of the first file. More... | |
void | setSave (const UInt &save) |
Set how many time step between two snapshots. More... | |
void | setMultimesh (const bool &multimesh) |
Set if to save the mesh at each time step. More... | |
virtual void | setMeshProcId (const meshPtr_Type mesh, const int &procId) |
virtual void | closeFile () |
Close the output file. More... | |
const UInt & | save () const |
returns how many time steps between two snapshots More... | |
const UInt & | timeIndexStart () const |
returns the time index of the first snapshot More... | |
const UInt & | timeIndex () const |
returns the time index of the current snapshot More... | |
Protected Member Functions inherited from Exporter< MeshType > | |
void | computePostfix () |
compute postfix More... | |
virtual void | readScalar (exporterData_Type &dvar)=0 |
A method to read a scalar field (to be implemented in derived classes) More... | |
virtual void | readVector (exporterData_Type &dvar)=0 |
A method to read a vector field (to be implemented in derived classes) More... | |
Protected Attributes inherited from Exporter< MeshType > | |
std::string | M_prefix |
the file prefix More... | |
std::string | M_postDir |
the name of the folder where to read or write files More... | |
UInt | M_timeIndexStart |
the time index of the first snapshot More... | |
UInt | M_timeIndex |
the time index of the current snapshot More... | |
UInt | M_save |
how many time steps between subsequent snapshots More... | |
bool | M_multimesh |
do we want to save the mesh with each snapshot? More... | |
UInt | M_timeIndexWidth |
how many digits (in the file suffix) for the time index More... | |
meshPtr_Type | M_mesh |
a pointer to the mesh More... | |
Int | M_procId |
the ID of the process More... | |
std::string | M_postfix |
the file suffix More... | |
UInt | M_numImportProc |
how many processes produced the data that we want to import More... | |
whereToDataIdMap_Type | M_whereToDataIdMap |
a map to retrieve all data located in the same geo entities (node or element) More... | |
feTypeToDataIdMap_Type | M_feTypeToDataIdMap |
a map to retrieve all data defined in the same FE space More... | |
dataVector_Type | M_dataVector |
the vector of ExporterData objects More... | |
std::list< Real > | M_timeSteps |
the list of time steps (for use in import procedures) More... | |
ExporterVTK data exporter.
Definition at line 57 of file ExporterVTK.hpp.
Definition at line 113 of file ExporterVTK.hpp.
Definition at line 114 of file ExporterVTK.hpp.
typedef super::meshPtr_Type meshPtr_Type |
Definition at line 115 of file ExporterVTK.hpp.
typedef super::commPtr_Type commPtr_Type |
Definition at line 116 of file ExporterVTK.hpp.
Definition at line 117 of file ExporterVTK.hpp.
Definition at line 118 of file ExporterVTK.hpp.
typedef super::feTypeToDataIdMap_Type::iterator feTypeToDataIdMap_Type_Type |
Definition at line 120 of file ExporterVTK.hpp.
typedef const exporterData_Type::WhereEnum& where_Type |
Definition at line 121 of file ExporterVTK.hpp.
enum VTK_CELL |
A list of the cell types admitted in VTK
Definition at line 68 of file ExporterVTK.hpp.
enum EXPORT_MODE |
The export modes currently supported are ascii and binary
Enumerator | |
---|---|
ASCII_EXPORT | |
BINARY_EXPORT |
Definition at line 98 of file ExporterVTK.hpp.
enum FLOAT_PRECISION |
Currently supported are single and double precision
Enumerator | |
---|---|
SINGLE_PRECISION | |
DOUBLE_PRECISION |
Definition at line 107 of file ExporterVTK.hpp.
ExporterVTK | ( | ) |
Default constructor.
Definition at line 399 of file ExporterVTK.hpp.
ExporterVTK | ( | const GetPot & | data_file, |
const std::string | prefix | ||
) |
Constructor for ExporterVTK
data_file | the GetPot data file where you must provide an [exporter] section with: "start" (start index for filenames 0 for 000, 1 for 001 etc.), "save" (how many time steps per postprocessing) "multimesh" (=true if the mesh has to be saved at each post-processing step) |
the | prefix for the output file (ex. "test" for test.vtu) |
Definition at line 407 of file ExporterVTK.hpp.
|
private |
Copy constructor.
|
virtual |
Destructor.
Definition at line 455 of file ExporterVTK.hpp.
|
virtual |
Post-process the variables added to the list.
time | the solver time |
Implements Exporter< MeshType >.
Definition at line 493 of file ExporterVTK.hpp.
Import data from previous simulations at a certain time.
Time | the time of the data to be imported |
Not yet implemented for ExporterVTK
Implements Exporter< MeshType >.
Definition at line 173 of file ExporterVTK.hpp.
Import data from previous simulations and rebuild the internal time counters.
importTime | the time of the snapshot to be imported |
dt | the time step, is used to rebuild the history up to now |
Not yet implemented for ExporterVTK
Implements Exporter< MeshType >.
Definition at line 186 of file ExporterVTK.hpp.
|
virtual |
Import data from previous simulations.
importTime | the time of the snapshot to be imported |
Implements Exporter< MeshType >.
Definition at line 577 of file ExporterVTK.hpp.
|
inline |
temporary: the method should work form the Exporter class
Definition at line 198 of file ExporterVTK.hpp.
|
virtual |
Set data from file.
dataFile | data file. |
section | section in the data file. |
Reimplemented from Exporter< MeshType >.
Definition at line 418 of file ExporterVTK.hpp.
|
virtual |
returns the type of the map to use for the VectorEpetra
Implements Exporter< MeshType >.
Definition at line 608 of file ExporterVTK.hpp.
|
private |
_feSpacePtr | a point to the FE space descriptor |
Definition at line 619 of file ExporterVTK.hpp.
|
private |
This method fills a buffer for the *.pvtu file. We will have a PVTU file for each ExporterData object, basically listing the names of the VTU files containing the "partitioned" data.
dvar | the ExporterData object | |
[out] | pVTUStringStream | the stringstream object (a file buffer) |
Definition at line 1054 of file ExporterVTK.hpp.
|
private |
This method creates the data structures needed by each processor to retrieve the point global IDs and coordinates.
_feSpacePtr | a pointer to the FE Space descriptor | |
[out] | globalToLocalPointsMap | the key of this map is the global ID of the point, the value is the position in the local data structure |
[out] | localToGlobalPointsMap | the key of this map is the position in the local data structure, the value is the global ID of the point |
[out] | coordinatesOfPoints | a nDimensionsxnumPoints matrix, storing the nDimensions coordinates of the numPoints points |
Definition at line 1153 of file ExporterVTK.hpp.
|
private |
This method fills a buffer for the VTK collection (a *.pvd file).
time | the current time | |
[out] | vtkCollectionStringStream | the stringstream object (a file buffer) |
Definition at line 1237 of file ExporterVTK.hpp.
|
private |
This method fills a buffer for the header part of a *.vtu file.
numPoints | we need to specify the dimension of the data set written in the VTU file | |
[out] | vtuHeaderStringStream | the stringstream object (a file buffer) |
Definition at line 1342 of file ExporterVTK.hpp.
|
private |
This method fills a buffer for the footer part of a *.vtu file.
[out] | vtuHeaderStringStream | the stringstream object (a file buffer) |
Definition at line 1358 of file ExporterVTK.hpp.
|
private |
This method writes in a buffer (according to the VTK XML format) 1- the list of points' coordinates 2- the connectivity of the cells 3- the offsets of the connectivity list 4- the type of each cell
_feSpacePtr | a pointer to the FE Space descriptor |
globalToLocalPointsMap | the key of this map is the global ID of the point, the value is the position in the local data structure |
coordinatesOfPoints | a nDimensionsxnumPoints matrix, storing the nDimensions coordinates of the numPoints points |
Definition at line 1268 of file ExporterVTK.hpp.
|
private |
This method writes in a buffer (according to the VTK XML format) the header of the Data section of the file. This section may be named PointData or CellData, and to allow for several DataArrays to be grouped inside a single PointData or CellData environment, we need a separate method taking care of the header (footer)
where | Node or Cell |
typeDataHeaderStringStream | the stringstream object (a file buffer) |
Definition at line 1373 of file ExporterVTK.hpp.
|
private |
where | Node or Cell |
typeDataHeaderStringStream | the stringstream object (a file buffer) |
Definition at line 1399 of file ExporterVTK.hpp.
|
private |
This method writes in a buffer (according to the VTK XML format) the content of the Data section of the file.
dvar | the ExporterData object |
localToGlobalMap | a map to query the dvar object for global IDs |
dataArraysStringStream | the stringstream object (a file buffer) |
Definition at line 666 of file ExporterVTK.hpp.
|
private |
Definition at line 981 of file ExporterVTK.hpp.
|
inlineprivatevirtual |
The scalar reader (specialization of the parent class method)
dvar | the ExporterData object |
Definition at line 343 of file ExporterVTK.hpp.
|
inlineprivatevirtual |
The vector reader (specialization of the parent class method)
dvar | the ExporterData object |
Definition at line 351 of file ExporterVTK.hpp.
|
private |
The reader for VTU files.
dvar | the ExporterData object |
Definition at line 783 of file ExporterVTK.hpp.
|
private |
A routine for loading values stored in binary format in a VTU file.
line | a line read from file |
values | the list of values extracted from the line |
numBits | the size of data to be read |
Definition at line 890 of file ExporterVTK.hpp.
|
private |
A routine for loading values stored in ASCII format in a VTU file.
line | a line read from file |
values | the list of values extracted from the line |
Definition at line 960 of file ExporterVTK.hpp.
|
static |
returns the type of the map to use for the VectorEpetra
Definition at line 127 of file ExporterVTK.hpp.
|
private |
Definition at line 377 of file ExporterVTK.hpp.
|
private |
Definition at line 379 of file ExporterVTK.hpp.
|
private |
Definition at line 381 of file ExporterVTK.hpp.