MFEM  v4.2.0
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Protected Member Functions | List of all members
mfem::ParaViewDataCollection Class Reference

Helper class for ParaView visualization data. More...

#include <datacollection.hpp>

Inheritance diagram for mfem::ParaViewDataCollection:
[legend]
Collaboration diagram for mfem::ParaViewDataCollection:
[legend]

Public Member Functions

 ParaViewDataCollection (const std::string &collection_name, mfem::Mesh *mesh_=NULL)
 Constructor. The collection name is used when saving the data. More...
 
void SetLevelsOfDetail (int levels_of_detail_)
 
virtual void Save () override
 
void SetDataFormat (VTKFormat fmt)
 
void SetCompressionLevel (int compression_level_)
 
void SetCompression (bool compression_) override
 
bool IsBinaryFormat () const
 Returns true if the output format is BINARY or BINARY32, false if ASCII. More...
 
void SetHighOrderOutput (bool high_order_output_)
 
virtual void Load (int cycle_=0) override
 Load the collection - not implemented in the ParaView writer. More...
 
- Public Member Functions inherited from mfem::DataCollection
 DataCollection (const std::string &collection_name, Mesh *mesh_=NULL)
 Initialize the collection with its name and Mesh. More...
 
virtual void RegisterField (const std::string &field_name, GridFunction *gf)
 Add a grid function to the collection. More...
 
virtual void DeregisterField (const std::string &field_name)
 Remove a grid function from the collection. More...
 
virtual void RegisterQField (const std::string &q_field_name, QuadratureFunction *qf)
 Add a QuadratureFunction to the collection. More...
 
virtual void DeregisterQField (const std::string &field_name)
 Remove a QuadratureFunction from the collection. More...
 
bool HasField (const std::string &name) const
 Check if a grid function is part of the collection. More...
 
GridFunctionGetField (const std::string &field_name)
 Get a pointer to a grid function in the collection. More...
 
MPI_Comm GetComm () const
 Return the associated MPI communicator or MPI_COMM_NULL. More...
 
ParGridFunctionGetParField (const std::string &field_name)
 Get a pointer to a parallel grid function in the collection. More...
 
bool HasQField (const std::string &q_field_name) const
 Check if a QuadratureFunction with the given name is in the collection. More...
 
QuadratureFunctionGetQField (const std::string &q_field_name)
 Get a pointer to a QuadratureFunction in the collection. More...
 
const FieldMapTypeGetFieldMap () const
 Get a const reference to the internal field map. More...
 
const QFieldMapTypeGetQFieldMap () const
 Get a const reference to the internal q-field map. More...
 
MeshGetMesh ()
 Get a pointer to the mesh in the collection. More...
 
virtual void SetMesh (Mesh *new_mesh)
 Set/change the mesh associated with the collection. More...
 
virtual void SetMesh (MPI_Comm comm, Mesh *new_mesh)
 Set/change the mesh associated with the collection. More...
 
void SetCycle (int c)
 Set time cycle (for time-dependent simulations) More...
 
void SetTime (double t)
 Set physical time (for time-dependent simulations) More...
 
void SetTimeStep (double ts)
 Set the simulation time step (for time-dependent simulations) More...
 
int GetCycle () const
 Get time cycle (for time-dependent simulations) More...
 
double GetTime () const
 Get physical time (for time-dependent simulations) More...
 
double GetTimeStep () const
 Get the simulation time step (for time-dependent simulations) More...
 
const std::string & GetCollectionName () const
 Get the name of the collection. More...
 
void SetOwnData (bool o)
 Set the ownership of collection data. More...
 
void SetPrecision (int prec)
 Set the precision (number of digits) used for the text output of doubles. More...
 
void SetPadDigits (int digits)
 Set the number of digits used for both the cycle and the MPI rank. More...
 
void SetPadDigitsCycle (int digits)
 Set the number of digits used for the cycle. More...
 
void SetPadDigitsRank (int digits)
 Set the number of digits used for the MPI rank in filenames. More...
 
virtual void SetFormat (int fmt)
 Set the desired output mesh and data format. More...
 
void SetPrefixPath (const std::string &prefix)
 Set the path where the DataCollection will be saved. More...
 
const std::string & GetPrefixPath () const
 Get the path where the DataCollection will be saved. More...
 
virtual void SaveMesh ()
 Save the mesh, creating the collection directory. More...
 
virtual void SaveField (const std::string &field_name)
 Save one field, assuming the collection directory already exists. More...
 
virtual void SaveQField (const std::string &q_field_name)
 Save one q-field, assuming the collection directory already exists. More...
 
virtual ~DataCollection ()
 Delete the mesh and fields if owned by the collection. More...
 
int Error () const
 Get the current error state. More...
 
void ResetError (int err=NO_ERROR)
 Reset the error state. More...
 

Protected Member Functions

void SaveDataVTU (std::ostream &out, int ref)
 
void SaveGFieldVTU (std::ostream &out, int ref_, const FieldMapIterator &it)
 
void SaveQFieldVTU (std::ostream &out, int ref, const QFieldMapIterator &it)
 
const char * GetDataFormatString () const
 
const char * GetDataTypeString () const
 
std::string GenerateCollectionPath ()
 
std::string GenerateVTUFileName ()
 
std::string GenerateVTUFileName (int rank)
 
std::string GenerateVTUPath ()
 
std::string GeneratePVDFileName ()
 
std::string GeneratePVTUFileName ()
 
std::string GeneratePVTUPath ()
 
- Protected Member Functions inherited from mfem::DataCollection
void DeleteData ()
 Delete data owned by the DataCollection keeping field information. More...
 
void DeleteAll ()
 Delete data owned by the DataCollection including field information. More...
 
std::string GetMeshShortFileName () const
 
std::string GetMeshFileName () const
 
std::string GetFieldFileName (const std::string &field_name) const
 
void SaveOneField (const FieldMapIterator &it)
 Save one field to disk, assuming the collection directory exists. More...
 
void SaveOneQField (const QFieldMapIterator &it)
 Save one q-field to disk, assuming the collection directory exists. More...
 

Additional Inherited Members

- Public Types inherited from mfem::DataCollection
enum  Format { SERIAL_FORMAT = 0, PARALLEL_FORMAT = 1 }
 Format constants to be used with SetFormat(). More...
 
enum  { NO_ERROR = 0, READ_ERROR = 1, WRITE_ERROR = 2 }
 Errors returned by Error() More...
 
typedef GFieldMap::MapType FieldMapType
 
typedef GFieldMap::iterator FieldMapIterator
 
typedef GFieldMap::const_iterator FieldMapConstIterator
 
typedef QFieldMap::MapType QFieldMapType
 
typedef QFieldMap::iterator QFieldMapIterator
 
typedef QFieldMap::const_iterator QFieldMapConstIterator
 
- Static Protected Member Functions inherited from mfem::DataCollection
static int create_directory (const std::string &dir_name, const Mesh *mesh, int myid)
 
- Protected Attributes inherited from mfem::DataCollection
std::string name
 Name of the collection, used as a directory name when saving. More...
 
std::string prefix_path
 A path where the directory with results is saved. If not empty, it has '/' at the end. More...
 
GFieldMap field_map
 
QFieldMap q_field_map
 
Meshmesh
 The (common) mesh for the collected fields. More...
 
int cycle
 Time cycle; for time-dependent simulations cycle >= 0, otherwise = -1. More...
 
double time
 Physical time (for time-dependent simulations) More...
 
double time_step
 Time step i.e. delta_t (for time-dependent simulations) More...
 
bool serial
 Serial or parallel run? False iff mesh is a ParMesh. More...
 
bool appendRankToFileName
 Append rank to any output file names. More...
 
int myid
 MPI rank (in parallel) More...
 
int num_procs
 Number of MPI ranks (in parallel) More...
 
MPI_Comm m_comm
 Associated MPI communicator. More...
 
int precision
 Precision (number of digits) used for the text output of doubles. More...
 
int pad_digits_cycle
 Number of digits used for the cycle and MPI rank in filenames. More...
 
int pad_digits_rank
 
int format
 Output mesh format: see the Format enumeration. More...
 
int compression
 
bool own_data
 Should the collection delete its mesh and fields. More...
 
int error
 Error state. More...
 
- Static Protected Attributes inherited from mfem::DataCollection
static const int precision_default = 6
 Default value for precision. More...
 
static const int pad_digits_default = 6
 Default value for pad_digits_*. More...
 

Detailed Description

Helper class for ParaView visualization data.

Definition at line 484 of file datacollection.hpp.

Constructor & Destructor Documentation

mfem::ParaViewDataCollection::ParaViewDataCollection ( const std::string &  collection_name,
mfem::Mesh mesh_ = NULL 
)

Constructor. The collection name is used when saving the data.

If mesh_ is NULL, then the mesh can be set later by calling SetMesh(). Before saving the data collection, some parameters in the collection can be adjusted, e.g. SetPadDigits(), SetPrefixPath(), etc.

Definition at line 761 of file datacollection.cpp.

Member Function Documentation

std::string mfem::ParaViewDataCollection::GenerateCollectionPath ( )
protected

Definition at line 786 of file datacollection.cpp.

std::string mfem::ParaViewDataCollection::GeneratePVDFileName ( )
protected

Definition at line 805 of file datacollection.cpp.

std::string mfem::ParaViewDataCollection::GeneratePVTUFileName ( )
protected

Definition at line 811 of file datacollection.cpp.

std::string mfem::ParaViewDataCollection::GeneratePVTUPath ( )
protected

Definition at line 793 of file datacollection.cpp.

std::string mfem::ParaViewDataCollection::GenerateVTUFileName ( )
protected

Definition at line 817 of file datacollection.cpp.

std::string mfem::ParaViewDataCollection::GenerateVTUFileName ( int  rank)
protected

Definition at line 822 of file datacollection.cpp.

std::string mfem::ParaViewDataCollection::GenerateVTUPath ( )
protected

Definition at line 799 of file datacollection.cpp.

const char * mfem::ParaViewDataCollection::GetDataFormatString ( ) const
protected

Definition at line 1094 of file datacollection.cpp.

const char * mfem::ParaViewDataCollection::GetDataTypeString ( ) const
protected

Definition at line 1106 of file datacollection.cpp.

bool mfem::ParaViewDataCollection::IsBinaryFormat ( ) const

Returns true if the output format is BINARY or BINARY32, false if ASCII.

Definition at line 1066 of file datacollection.cpp.

void mfem::ParaViewDataCollection::Load ( int  cycle_ = 0)
overridevirtual

Load the collection - not implemented in the ParaView writer.

Reimplemented from mfem::DataCollection.

Definition at line 781 of file datacollection.cpp.

void mfem::ParaViewDataCollection::Save ( )
overridevirtual

Save the collection - the directory name is constructed based on the cycle value

Reimplemented from mfem::DataCollection.

Definition at line 828 of file datacollection.cpp.

void mfem::ParaViewDataCollection::SaveDataVTU ( std::ostream &  out,
int  ref 
)
protected

Definition at line 938 of file datacollection.cpp.

void mfem::ParaViewDataCollection::SaveGFieldVTU ( std::ostream &  out,
int  ref_,
const FieldMapIterator it 
)
protected

Definition at line 980 of file datacollection.cpp.

void mfem::ParaViewDataCollection::SaveQFieldVTU ( std::ostream &  out,
int  ref,
const QFieldMapIterator it 
)
protected

Definition at line 974 of file datacollection.cpp.

void mfem::ParaViewDataCollection::SetCompression ( bool  compression_)
overridevirtual

Enable or disable zlib compression. If the input is true, use the default zlib compression level (unless the compression level has previously been set by calling SetCompressionLevel).

Reimplemented from mfem::DataCollection.

Definition at line 1083 of file datacollection.cpp.

void mfem::ParaViewDataCollection::SetCompressionLevel ( int  compression_level_)

Set the zlib compression level. 0 indicates no compression, -1 indicates the default compression level. Otherwise, specify a number between 1 and 9, 1 being the fastest, and 9 being the best compression. Compression only takes effect if the output format is BINARY or BINARY32. MFEM must be compiled with MFEM_USE_ZLIB = YES.

Definition at line 1076 of file datacollection.cpp.

void mfem::ParaViewDataCollection::SetDataFormat ( VTKFormat  fmt)

Set the data format for the ParaView output files. Possible options are VTKFormat::ASCII, VTKFormat::BINARY, and VTKFormat::BINARY32. The ASCII and BINARY options output double precision data, whereas the BINARY32 option outputs single precision data.

Definition at line 1061 of file datacollection.cpp.

void mfem::ParaViewDataCollection::SetHighOrderOutput ( bool  high_order_output_)

Sets whether or not to output the data as high-order elements (false by default). Reading high-order data requires ParaView 5.5 or later.

Definition at line 1071 of file datacollection.cpp.

void mfem::ParaViewDataCollection::SetLevelsOfDetail ( int  levels_of_detail_)

Set refinement levels - every element is uniformly split based on levels_of_detail_

Definition at line 776 of file datacollection.cpp.


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