LifeV
ExporterHDF5Mesh3D< MeshType > Class Template Reference

Class derived from ExporterHDF5 to provide I/O for the mesh partitions (RegionMesh only) More...

#include <ExporterHDF5Mesh3D.hpp>

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

Public Types

typedef MeshType mesh_Type
 
typedef ExporterHDF5< MeshTypebase
 
typedef base::meshPtr_Type meshPtr_Type
 
typedef base::vector_Type vector_Type
 
typedef base::vectorPtr_Type vectorPtr_Type
 
typedef base::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 > > serialMeshPtr_Type
 
typedef DOFInterface3Dto3D interface_Type
 
typedef std::shared_ptr< interface_TypeinterfacePtr_Type
 
typedef std::vector< interfacePtr_TypeinterfaceVector_Type
 
typedef std::shared_ptr< interfaceVector_TypeinterfaceVectorPtr_Type
 
- Public Types inherited from ExporterHDF5< MeshType >
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
 
- 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
 

Private Attributes

serialMeshPtr_Type M_serialMesh
 
meshPtr_Type M_parallelMesh
 
graphPtr_Type M_graph
 
std::vector< interfaceVectorPtr_TypeM_DOFInterfaces
 
std::vector< std::string > M_interfaceTypes
 
std::vector< IntM_firstInterfaceFlags
 
std::vector< IntM_secondInterfaceFlags
 
std::shared_ptr< Epetra_Comm > M_comm
 

Constructor & Destructor

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

Pubic Methods

virtual void postProcess (const Real &time)
 Post-process the variables added to the list. More...
 
void addPartitionGraph (const graphPtr_Type &graph, std::shared_ptr< Epetra_Comm > &comm)
 Add the partition graph to the post processing data file. More...
 
void addMeshPartitionAll (const serialMeshPtr_Type &meshPointer, std::shared_ptr< Epetra_Comm > &comm)
 Add all of the mesh partitions to the post processing data file (serial operation) More...
 
void addMyMeshPartition (const meshPtr_Type &, std::shared_ptr< Epetra_Comm > &)
 Add to HDF5 file the mesh partition that belongs to the current process (parallel operation) More...
 
void addDOFInterface (const interfaceVectorPtr_Type &interfaces, const std::string &type, const Int &firstInterfaceFlag, const Int &secondInterfaceFlag, const std::shared_ptr< Epetra_Comm > &comm)
 Add a DOF interface for writing to file. More...
 
Int queryStoredInterfaceNumber ()
 Get the number of stored DOF interfaces. More...
 
std::vector< std::string > queryStoredInterfaceTypes ()
 Get the types of the stored DOF interfaces. More...
 
graphPtr_Type getGraph ()
 Return a pointer to the graph. More...
 
meshPtr_Type getMeshPartition ()
 Return a pointer to the mesh partition that corresponds to the current MPI rank. More...
 
std::shared_ptr< std::map< UInt, UInt > > getStoredInterface (Int k)
 Return a pointer to the k-th interface stored inside the file. More...
 
void setComm (const std::shared_ptr< Epetra_Comm > &comm)
 Set the M_comm data member. More...
 

Private methods

void writeGraph ()
 
void writePartition (meshPtr_Type partition, std::string &suffix)
 
void writeParallelMesh ()
 
void writeSerialMesh ()
 
void writeInterfaces ()
 

Additional Inherited Members

- Public Member Functions inherited from ExporterHDF5< MeshType >
 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...
 
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...
 
void setDataFromGetPot (const GetPot &dataFile, const std::string &section="exporter")
 Set data from file. More...
 
MapEpetraType mapType () const
 returns the type of the map to use for the VectorEpetra More...
 
- 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...
 
- Static Public Attributes inherited from ExporterHDF5< MeshType >
static MapEpetraType const MapType
 returns the type of the map to use for the VectorEpetra More...
 
- Protected Member Functions inherited from ExporterHDF5< MeshType >
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 Member Functions inherited from Exporter< MeshType >
void computePostfix ()
 compute postfix More...
 
- Protected Attributes inherited from ExporterHDF5< MeshType >
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...
 
- 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::ExporterHDF5Mesh3D< MeshType >

Class derived from ExporterHDF5 to provide I/O for the mesh partitions (RegionMesh only)

Author
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 );

Guidelines when operating with partition information:

  1. Use different objects for import and export
  2. When exporting graph and partition(s) create a ExporterHDF5 to be used for output. Call methods: addPartitionGraph, addMeshPartitionAll, or addMyMeshPartition Call postProcess to write data Call CloseFile
  3. When importing graph and/or partition create a ExporterHDF5 to be used for input, Call loadGraph and partitionMesh::update, call loadMyPartition Call CloseFile

Definition at line 76 of file ExporterHDF5Mesh3D.hpp.

Member Typedef Documentation

◆ mesh_Type

Definition at line 79 of file ExporterHDF5Mesh3D.hpp.

◆ base

Definition at line 80 of file ExporterHDF5Mesh3D.hpp.

◆ meshPtr_Type

Definition at line 81 of file ExporterHDF5Mesh3D.hpp.

◆ vector_Type

Definition at line 82 of file ExporterHDF5Mesh3D.hpp.

◆ vectorPtr_Type

Definition at line 83 of file ExporterHDF5Mesh3D.hpp.

◆ exporterData_Type

◆ hdf5_Type

typedef EpetraExt::HDF5 hdf5_Type

Definition at line 86 of file ExporterHDF5Mesh3D.hpp.

◆ hdf5Ptr_Type

typedef std::shared_ptr<hdf5_Type> hdf5Ptr_Type

Definition at line 87 of file ExporterHDF5Mesh3D.hpp.

◆ graph_Type

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

Definition at line 88 of file ExporterHDF5Mesh3D.hpp.

◆ graphPtr_Type

typedef std::shared_ptr<graph_Type> graphPtr_Type

Definition at line 89 of file ExporterHDF5Mesh3D.hpp.

◆ serialMeshPtr_Type

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

Definition at line 90 of file ExporterHDF5Mesh3D.hpp.

◆ interface_Type

Definition at line 92 of file ExporterHDF5Mesh3D.hpp.

◆ interfacePtr_Type

typedef std::shared_ptr<interface_Type> interfacePtr_Type

Definition at line 93 of file ExporterHDF5Mesh3D.hpp.

◆ interfaceVector_Type

Definition at line 94 of file ExporterHDF5Mesh3D.hpp.

◆ interfaceVectorPtr_Type

Definition at line 97 of file ExporterHDF5Mesh3D.hpp.

Constructor & Destructor Documentation

◆ ExporterHDF5Mesh3D() [1/3]

ExporterHDF5Mesh3D ( )
inline

Empty Constructor for ExporterHDF5Mesh3D.

Definition at line 104 of file ExporterHDF5Mesh3D.hpp.

◆ ExporterHDF5Mesh3D() [2/3]

ExporterHDF5Mesh3D ( const GetPot dataFile,
meshPtr_Type  mesh,
const std::string &  prefix,
const Int procId 
)

Constructor for ExporterHDF5Mesh3D.

Parameters
dataFilethe 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 244 of file ExporterHDF5Mesh3D.hpp.

◆ ExporterHDF5Mesh3D() [3/3]

ExporterHDF5Mesh3D ( const GetPot dataFile,
const std::string &  prefix 
)

Constructor for ExporterHDF5Mesh3D without prefix and procID.

Parameters
dataFilethe 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 252 of file ExporterHDF5Mesh3D.hpp.

◆ ~ExporterHDF5Mesh3D()

virtual ~ExporterHDF5Mesh3D ( )
inlinevirtual

Destructor for ExporterHDF5Mesh3D.

Definition at line 129 of file ExporterHDF5Mesh3D.hpp.

Member Function Documentation

◆ postProcess()

void postProcess ( const Real time)
virtual

Post-process the variables added to the list.

Parameters
timethe solver time

Reimplemented from ExporterHDF5< MeshType >.

Definition at line 277 of file ExporterHDF5Mesh3D.hpp.

◆ addPartitionGraph()

void addPartitionGraph ( const graphPtr_Type graph,
std::shared_ptr< Epetra_Comm > &  comm 
)
inline

Add the partition graph to the post processing data file.

Add the partition graph to the post processing data file.

Parameters
graph- shared_ptr<vector<vector<Int> > > - shared pointer to the partition graph data structure (as returned by partitionMesh::graph() )
comm- Epetra_Comm* - raw pointer to the Epetra communicator to be used

Definition at line 144 of file ExporterHDF5Mesh3D.hpp.

◆ addMeshPartitionAll()

void addMeshPartitionAll ( const serialMeshPtr_Type meshPointer,
std::shared_ptr< Epetra_Comm > &  comm 
)
inline

Add all of the mesh partitions to the post processing data file (serial operation)

Add all of the mesh partitions to the post processing data file.

Parameters
meshPointer- shared_ptr<vector<shared_ptr<MeshType> > > - shared pointer to the vector storing pointers to the mesh partitions (as returned by partitionMesh::meshAllPartitions() )
comm- Epetra_Comm* - raw pointer to the Epetra communicator to be used

Definition at line 157 of file ExporterHDF5Mesh3D.hpp.

◆ addMyMeshPartition()

void addMyMeshPartition ( const meshPtr_Type ,
std::shared_ptr< Epetra_Comm > &   
)
inline

Add to HDF5 file the mesh partition that belongs to the current process (parallel operation)

After the mesh partition is loaded from the HDF5 file, the simulation is run and ExporterHDF5Mesh3D::postProcess() is called, the original contents of the HDF5 will be lost. To keep mesh partition, call: ExporterHDF5Mesh3D::addMyMeshPartition() before calling ExporterHDF5Mesh3D::postProcess();

Parameters
meshPointer- shared_ptr<Mesh> - shared pointer to a mesh partition (as returned by partitionMesh::mesh() )
comm- Epetra_Comm* - raw pointer to the Epetra communicator to be used

Definition at line 174 of file ExporterHDF5Mesh3D.hpp.

◆ addDOFInterface()

void addDOFInterface ( const interfaceVectorPtr_Type interfaces,
const std::string &  type,
const Int firstInterfaceFlag,
const Int secondInterfaceFlag,
const std::shared_ptr< Epetra_Comm > &  comm 
)

Add a DOF interface for writing to file.

Add a DOF interface to the member vector M_interfaceData, for writing to the HDF5 file. Call once for each interface that is to be written.

Definition at line 262 of file ExporterHDF5Mesh3D.hpp.

◆ queryStoredInterfaceNumber()

int queryStoredInterfaceNumber ( )

Get the number of stored DOF interfaces.

Definition at line 367 of file ExporterHDF5Mesh3D.hpp.

◆ queryStoredInterfaceTypes()

std::vector< std::string > queryStoredInterfaceTypes ( )

Get the types of the stored DOF interfaces.

Definition at line 385 of file ExporterHDF5Mesh3D.hpp.

◆ getGraph()

Return a pointer to the graph.

Definition at line 411 of file ExporterHDF5Mesh3D.hpp.

◆ getMeshPartition()

ExporterHDF5Mesh3D< MeshType >::meshPtr_Type getMeshPartition ( )

Return a pointer to the mesh partition that corresponds to the current MPI rank.

Definition at line 454 of file ExporterHDF5Mesh3D.hpp.

◆ getStoredInterface()

std::shared_ptr< std::map< UInt, UInt > > getStoredInterface ( Int  k)

Return a pointer to the k-th interface stored inside the file.

Definition at line 710 of file ExporterHDF5Mesh3D.hpp.

◆ setComm()

void setComm ( const std::shared_ptr< Epetra_Comm > &  comm)
inline

Set the M_comm data member.

Definition at line 208 of file ExporterHDF5Mesh3D.hpp.

◆ writeGraph()

void writeGraph ( )
private

Definition at line 752 of file ExporterHDF5Mesh3D.hpp.

◆ writePartition()

void writePartition ( meshPtr_Type  partition,
std::string &  suffix 
)
private

Definition at line 795 of file ExporterHDF5Mesh3D.hpp.

◆ writeParallelMesh()

void writeParallelMesh ( )
private

Definition at line 1035 of file ExporterHDF5Mesh3D.hpp.

◆ writeSerialMesh()

void writeSerialMesh ( )
private

Definition at line 1015 of file ExporterHDF5Mesh3D.hpp.

◆ writeInterfaces()

void writeInterfaces ( )
private

Definition at line 1047 of file ExporterHDF5Mesh3D.hpp.

Field Documentation

◆ M_serialMesh

serialMeshPtr_Type M_serialMesh
private

Definition at line 227 of file ExporterHDF5Mesh3D.hpp.

◆ M_parallelMesh

meshPtr_Type M_parallelMesh
private

Definition at line 228 of file ExporterHDF5Mesh3D.hpp.

◆ M_graph

graphPtr_Type M_graph
private

Definition at line 229 of file ExporterHDF5Mesh3D.hpp.

◆ M_DOFInterfaces

std::vector<interfaceVectorPtr_Type> M_DOFInterfaces
private

Definition at line 231 of file ExporterHDF5Mesh3D.hpp.

◆ M_interfaceTypes

std::vector<std::string> M_interfaceTypes
private

Definition at line 232 of file ExporterHDF5Mesh3D.hpp.

◆ M_firstInterfaceFlags

std::vector<Int> M_firstInterfaceFlags
private

Definition at line 233 of file ExporterHDF5Mesh3D.hpp.

◆ M_secondInterfaceFlags

std::vector<Int> M_secondInterfaceFlags
private

Definition at line 234 of file ExporterHDF5Mesh3D.hpp.

◆ M_comm

std::shared_ptr<Epetra_Comm> M_comm
private

Definition at line 235 of file ExporterHDF5Mesh3D.hpp.


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