LifeV
ExporterHDF5< MeshType > Class Template Reference

Hdf5 data exporter, implementation of Exporter. More...

#include <ExporterHDF5.hpp>

+ Inheritance diagram for ExporterHDF5< MeshType >:
+ Collaboration diagram for ExporterHDF5< MeshType >:

Public typedefs

typedef MeshType mesh_Type
 
typedef Exporter< MeshTypesuper
 
typedef super::meshPtr_Type meshPtr_Type
 
typedef super::vector_Type vector_Type
 
typedef super::vectorPtr_Type vectorPtr_Type
 
typedef super::exporterData_Type exporterData_Type
 
typedef EpetraExt::HDF5 hdf5_Type
 
typedef std::shared_ptr< hdf5_Typehdf5Ptr_Type
 
typedef std::vector< std::vector< Int > > graph_Type
 
typedef std::shared_ptr< graph_TypegraphPtr_Type
 
typedef std::shared_ptr< std::vector< meshPtr_Type > > serial_meshPtr_Type
 

Static members

static MapEpetraType const MapType
 returns the type of the map to use for the VectorEpetra More...
 

Constructor & Destructor

 ExporterHDF5 ()
 Empty Constructor for ExporterHDF5. More...
 
 ExporterHDF5 (const GetPot &dfile, meshPtr_Type mesh, const std::string &prefix, const Int &procId)
 Constructor for ExporterHDF5. More...
 
 ExporterHDF5 (const GetPot &dfile, const std::string &prefix)
 Constructor for ExporterHDF5 without prefix and procID. More...
 
virtual ~ExporterHDF5 ()
 Destructor for ExporterHDF5. More...
 

Public Methods

virtual void postProcess (const Real &time)
 Post-process the variables added to the list. More...
 
UInt importFromTime (const Real &Time)
 Import data from previous simulations at a certain time. More...
 
Real importFromIter (const UInt &)
 Import data from previous simulations at a certain time. More...
 
void import (const Real &startTime, const Real &dt)
 Import data from previous simulations. More...
 
void import (const Real &time)
 Import data from previous simulations. More...
 
void closeFile ()
 Close the Hdf5 file. More...
 
void readVariable (exporterData_Type &dvar)
 Read variable. More...
 

Set Methods

void setDataFromGetPot (const GetPot &dataFile, const std::string &section="exporter")
 Set data from file. More...
 

Get Methods

MapEpetraType mapType () const
 returns the type of the map to use for the VectorEpetra More...
 

Protected Methods

void defineShape ()
 Define the shape of the elements. More...
 
void writeInitXdmf ()
 write empty xdmf file More...
 
void writeXdmf (const Real &time)
 append to xdmf file More...
 
void writeCloseLinesXdmf ()
 save position and write closing lines More...
 
void removeCloseLinesXdmf ()
 remove closing lines More...
 
void writeTopology (std::ofstream &xdmf)
 
void writeGeometry (std::ofstream &xdmf)
 
void writeAttributes (std::ofstream &xdmf)
 
void writeScalarDatastructure (std::ofstream &xdmf, const exporterData_Type &dvar)
 
void writeVectorDatastructure (std::ofstream &xdmf, const exporterData_Type &dvar)
 
void writeVariable (const exporterData_Type &dvar)
 
void writeScalar (const exporterData_Type &dvar)
 
void writeVector (const exporterData_Type &dvar)
 
void writeGeometry ()
 
void readScalar (exporterData_Type &dvar)
 A method to read a scalar field (to be implemented in derived classes) More...
 
void readVector (exporterData_Type &dvar)
 A method to read a vector field (to be implemented in derived classes) More...
 

Protected data members

hdf5Ptr_Type M_HDF5
 
std::ofstream M_xdmf
 
const std::string M_closingLines
 
std::streampos M_closingLinesPosition
 
std::string M_outputFileName
 
bool M_printConnectivity
 do we want to write on file the connectivity? More...
 

Additional Inherited Members

- Public Types inherited from Exporter< MeshType >
typedef MeshType mesh_Type
 
typedef std::shared_ptr< MeshTypemeshPtr_Type
 
typedef Epetra_Comm comm_Type
 
typedef std::shared_ptr< comm_TypecommPtr_Type
 
typedef ExporterData< mesh_TypeexporterData_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_TypedataVector_Type
 
typedef dataVector_Type::iterator dataVectorIterator_Type
 
typedef std::multimap< WhereEnum, UIntwhereToDataIdMap_Type
 
typedef std::multimap< FE_TYPE, UIntfeTypeToDataIdMap_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 &regime=exporterData_Type::UnsteadyRegime, const WhereEnum &where=exporterData_Type::Node)
 Adds a new variable to be post-processed. More...
 
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)
 
const UIntsave () const
 returns how many time steps between two snapshots More...
 
const UInttimeIndexStart () const
 returns the time index of the first snapshot More...
 
const UInttimeIndex () const
 returns the time index of the current snapshot More...
 
- Protected Member Functions inherited from Exporter< MeshType >
void computePostfix ()
 compute postfix 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< RealM_timeSteps
 the list of time steps (for use in import procedures) More...
 

Detailed Description

template<typename MeshType>
class LifeV::ExporterHDF5< MeshType >

Hdf5 data exporter, implementation of Exporter.

Author
Simone Deparis simon.nosp@m.e.de.nosp@m.paris.nosp@m.@epf.nosp@m.l.ch
Radu Popescu radu..nosp@m.pope.nosp@m.scu@e.nosp@m.pfl..nosp@m.ch

Usage: two steps

  1. first: add the variables using addVariable
  2. second: call postProcess( time );

Definition at line 83 of file ExporterHDF5.hpp.

Member Typedef Documentation

◆ mesh_Type

Definition at line 89 of file ExporterHDF5.hpp.

◆ super

Definition at line 90 of file ExporterHDF5.hpp.

◆ meshPtr_Type

Definition at line 91 of file ExporterHDF5.hpp.

◆ vector_Type

Definition at line 92 of file ExporterHDF5.hpp.

◆ vectorPtr_Type

Definition at line 93 of file ExporterHDF5.hpp.

◆ exporterData_Type

Definition at line 94 of file ExporterHDF5.hpp.

◆ hdf5_Type

typedef EpetraExt::HDF5 hdf5_Type

Definition at line 96 of file ExporterHDF5.hpp.

◆ hdf5Ptr_Type

typedef std::shared_ptr<hdf5_Type> hdf5Ptr_Type

Definition at line 97 of file ExporterHDF5.hpp.

◆ graph_Type

typedef std::vector<std::vector<Int> > graph_Type

Definition at line 98 of file ExporterHDF5.hpp.

◆ graphPtr_Type

typedef std::shared_ptr<graph_Type> graphPtr_Type

Definition at line 99 of file ExporterHDF5.hpp.

◆ serial_meshPtr_Type

typedef std::shared_ptr<std::vector<meshPtr_Type> > serial_meshPtr_Type

Definition at line 100 of file ExporterHDF5.hpp.

Constructor & Destructor Documentation

◆ ExporterHDF5() [1/3]

Empty Constructor for ExporterHDF5.

Definition at line 261 of file ExporterHDF5.hpp.

◆ ExporterHDF5() [2/3]

ExporterHDF5 ( const GetPot dfile,
meshPtr_Type  mesh,
const std::string &  prefix,
const Int procId 
)

Constructor for ExporterHDF5.

Parameters
dfilethe GetPot data file where you must provide an [exporter] section with: "start" (start index for sections in the hdf5 data structure 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)
meshthe mesh
theprefix for the case file (ex. "test" for test.case)
theprocId determines de CPU id. if negative, it ussemes there is only one processor

Definition at line 271 of file ExporterHDF5.hpp.

◆ ExporterHDF5() [3/3]

ExporterHDF5 ( const GetPot dfile,
const std::string &  prefix 
)

Constructor for ExporterHDF5 without prefix and procID.

Parameters
dfilethe GetPot data file where you must provide an [exporter] section with: "start" (start index for sections in the hdf5 data structure 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)
meshthe mesh

Definition at line 283 of file ExporterHDF5.hpp.

◆ ~ExporterHDF5()

virtual ~ExporterHDF5 ( )
inlinevirtual

Destructor for ExporterHDF5.

Definition at line 139 of file ExporterHDF5.hpp.

Member Function Documentation

◆ postProcess()

void postProcess ( const Real time)
virtual

Post-process the variables added to the list.

Parameters
timethe solver time

Implements Exporter< MeshType >.

Reimplemented in ExporterHDF5Mesh3D< MeshType >.

Definition at line 297 of file ExporterHDF5.hpp.

◆ importFromTime()

UInt importFromTime ( const Real Time)
virtual

Import data from previous simulations at a certain time.

Parameters
Timethe time of the data to be imported
Returns
number of iteration corresponding at the time step

Implements Exporter< MeshType >.

Definition at line 355 of file ExporterHDF5.hpp.

◆ importFromIter()

Real importFromIter ( const UInt iter)

Import data from previous simulations at a certain time.

Parameters
Timethe time of the data to be imported
Returns
the simulation time corresponding to the iteration

Definition at line 424 of file ExporterHDF5.hpp.

◆ import() [1/2]

void import ( const Real startTime,
const Real dt 
)
virtual

Import data from previous simulations.

Parameters
timethe solver time

Implements Exporter< MeshType >.

Definition at line 512 of file ExporterHDF5.hpp.

◆ import() [2/2]

void import ( const Real time)
virtual

Import data from previous simulations.

Parameters
timethe solver time

! Simone

!!! Simone

Implements Exporter< MeshType >.

Definition at line 529 of file ExporterHDF5.hpp.

◆ closeFile()

void closeFile ( )
inlinevirtual

Close the Hdf5 file.

Close the HDF5 file.

Reimplemented from Exporter< MeshType >.

Definition at line 177 of file ExporterHDF5.hpp.

◆ readVariable()

void readVariable ( exporterData_Type dvar)
virtual

Read variable.

! Simone

Reimplemented from Exporter< MeshType >.

Definition at line 562 of file ExporterHDF5.hpp.

◆ setDataFromGetPot()

void setDataFromGetPot ( const GetPot dataFile,
const std::string &  section = "exporter" 
)
virtual

Set data from file.

Parameters
dataFiledata file.
sectionsection in the data file.

Reimplemented from Exporter< MeshType >.

Definition at line 576 of file ExporterHDF5.hpp.

◆ mapType()

MapEpetraType mapType ( ) const
virtual

returns the type of the map to use for the VectorEpetra

Implements Exporter< MeshType >.

Definition at line 586 of file ExporterHDF5.hpp.

◆ defineShape()

void defineShape ( )
protected

Define the shape of the elements.

Definition at line 595 of file ExporterHDF5.hpp.

◆ writeInitXdmf()

void writeInitXdmf ( )
protected

write empty xdmf file

Definition at line 601 of file ExporterHDF5.hpp.

◆ writeXdmf()

void writeXdmf ( const Real time)
protected

append to xdmf file

Definition at line 632 of file ExporterHDF5.hpp.

◆ writeCloseLinesXdmf()

void writeCloseLinesXdmf ( )
protected

save position and write closing lines

Definition at line 704 of file ExporterHDF5.hpp.

◆ removeCloseLinesXdmf()

void removeCloseLinesXdmf ( )
protected

remove closing lines

Definition at line 717 of file ExporterHDF5.hpp.

◆ writeTopology()

void writeTopology ( std::ofstream &  xdmf)
protected

Definition at line 723 of file ExporterHDF5.hpp.

◆ writeGeometry() [1/2]

void writeGeometry ( std::ofstream &  xdmf)
protected

Definition at line 770 of file ExporterHDF5.hpp.

◆ writeAttributes()

void writeAttributes ( std::ofstream &  xdmf)
protected

Definition at line 811 of file ExporterHDF5.hpp.

◆ writeScalarDatastructure()

void writeScalarDatastructure ( std::ofstream &  xdmf,
const exporterData_Type dvar 
)
protected

Definition at line 840 of file ExporterHDF5.hpp.

◆ writeVectorDatastructure()

void writeVectorDatastructure ( std::ofstream &  xdmf,
const exporterData_Type dvar 
)
protected

Definition at line 882 of file ExporterHDF5.hpp.

◆ writeVariable()

void writeVariable ( const exporterData_Type dvar)
protected

Definition at line 918 of file ExporterHDF5.hpp.

◆ writeScalar()

void writeScalar ( const exporterData_Type dvar)
protected

Definition at line 933 of file ExporterHDF5.hpp.

◆ writeVector()

void writeVector ( const exporterData_Type dvar)
protected

Definition at line 967 of file ExporterHDF5.hpp.

◆ writeGeometry() [2/2]

void writeGeometry ( )
protected

Definition at line 1030 of file ExporterHDF5.hpp.

◆ readScalar()

void readScalar ( exporterData_Type dvar)
protectedvirtual

A method to read a scalar field (to be implemented in derived classes)

Parameters
dvarthe ExporterData object

Implements Exporter< MeshType >.

Definition at line 1216 of file ExporterHDF5.hpp.

◆ readVector()

void readVector ( exporterData_Type dvar)
protectedvirtual

A method to read a vector field (to be implemented in derived classes)

Parameters
dvarthe ExporterData object

Implements Exporter< MeshType >.

Definition at line 1240 of file ExporterHDF5.hpp.

Field Documentation

◆ MapType

MapEpetraType const MapType
static

returns the type of the map to use for the VectorEpetra

Definition at line 105 of file ExporterHDF5.hpp.

◆ M_HDF5

hdf5Ptr_Type M_HDF5
protected

Definition at line 240 of file ExporterHDF5.hpp.

◆ M_xdmf

std::ofstream M_xdmf
protected

Definition at line 241 of file ExporterHDF5.hpp.

◆ M_closingLines

const std::string M_closingLines
protected

Definition at line 243 of file ExporterHDF5.hpp.

◆ M_closingLinesPosition

std::streampos M_closingLinesPosition
protected

Definition at line 244 of file ExporterHDF5.hpp.

◆ M_outputFileName

std::string M_outputFileName
protected

Definition at line 245 of file ExporterHDF5.hpp.

◆ M_printConnectivity

bool M_printConnectivity
protected

do we want to write on file the connectivity?

Definition at line 248 of file ExporterHDF5.hpp.


The documentation for this class was generated from the following file: