MFEM v4.9.0
Finite element discretization library
Loading...
Searching...
No Matches
mfem::ParaViewDataCollectionBase Class Reference

Abstract base class for ParaViewDataCollection and ParaViewHDFDataCollection. More...

#include <datacollection.hpp>

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

Public Member Functions

 ParaViewDataCollectionBase (const std::string &name, Mesh *mesh)
 
void SetLevelsOfDetail (int levels_of_detail_)
 Set the refinement level.
 
void SetCompressionLevel (int compression_level_)
 Set the zlib compression level.
 
void SetHighOrderOutput (bool high_order_output_)
 Sets whether or not to output the data as high-order elements (false by default).
 
void SetBoundaryOutput (bool bdr_output_)
 Configures collection to save only fields evaluated on boundaries of the mesh.
 
int GetCompressionLevel () const
 If compression is enabled, return the compression level, else return 0.
 
void SetDataFormat (VTKFormat fmt)
 Set the data format for the ParaView output files.
 
bool IsBinaryFormat () const
 Returns true if the output format is BINARY or BINARY32, false if ASCII.
 
void UseRestartMode (bool restart_mode_)
 Enable or disable restart mode.
 
- Public Member Functions inherited from mfem::DataCollection
 DataCollection (const std::string &collection_name, Mesh *mesh_=NULL)
 Initialize the collection with its name and Mesh.
 
virtual void RegisterField (const std::string &field_name, GridFunction *gf)
 Add a grid function to the collection.
 
virtual void DeregisterField (const std::string &field_name)
 Remove a grid function from the collection.
 
virtual void RegisterQField (const std::string &field_name, QuadratureFunction *qf)
 Add a QuadratureFunction to the collection.
 
virtual void DeregisterQField (const std::string &field_name)
 Remove a QuadratureFunction from the collection.
 
bool HasField (const std::string &field_name) const
 Check if a grid function is part of the collection.
 
GridFunctionGetField (const std::string &field_name)
 Get a pointer to a grid function in the collection.
 
MPI_Comm GetComm () const
 Return the associated MPI communicator or MPI_COMM_NULL.
 
ParGridFunctionGetParField (const std::string &field_name)
 Get a pointer to a parallel grid function in the collection.
 
bool HasQField (const std::string &field_name) const
 Check if a QuadratureFunction with the given name is in the collection.
 
QuadratureFunctionGetQField (const std::string &field_name)
 Get a pointer to a QuadratureFunction in the collection.
 
const FieldMapTypeGetFieldMap () const
 Get a const reference to the internal field map.
 
const QFieldMapTypeGetQFieldMap () const
 Get a const reference to the internal q-field map.
 
MeshGetMesh ()
 Get a pointer to the mesh in the collection.
 
virtual void SetMesh (Mesh *new_mesh)
 Set/change the mesh associated with the collection.
 
virtual void SetMesh (MPI_Comm comm, Mesh *new_mesh)
 Set/change the mesh associated with the collection.
 
void SetCycle (int c)
 Set time cycle (for time-dependent simulations)
 
void SetTime (real_t t)
 Set physical time (for time-dependent simulations)
 
void SetTimeStep (real_t ts)
 Set the simulation time step (for time-dependent simulations)
 
int GetCycle () const
 Get time cycle (for time-dependent simulations)
 
real_t GetTime () const
 Get physical time (for time-dependent simulations)
 
real_t GetTimeStep () const
 Get the simulation time step (for time-dependent simulations)
 
const std::string & GetCollectionName () const
 Get the name of the collection.
 
void SetOwnData (bool o)
 Set the ownership of collection data.
 
void SetPrecision (int prec)
 Set the precision (number of digits) used for the text output of doubles.
 
virtual void SetPadDigits (int digits)
 Set the number of digits used for both the cycle and the MPI rank.
 
virtual void SetPadDigitsCycle (int digits)
 Set the number of digits used for the cycle.
 
virtual void SetPadDigitsRank (int digits)
 Set the number of digits used for the MPI rank in filenames.
 
virtual void SetFormat (int fmt)
 Set the desired output mesh and data format.
 
virtual void SetCompression (bool comp)
 Set the flag for use of gz compressed files.
 
void SetPrefixPath (const std::string &prefix)
 Set the path where the DataCollection will be saved.
 
const std::string & GetPrefixPath () const
 Get the path where the DataCollection will be saved.
 
virtual void Save ()
 Save the collection to disk.
 
virtual void SaveMesh ()
 Save the mesh, creating the collection directory.
 
virtual void SaveField (const std::string &field_name)
 Save one field, assuming the collection directory already exists.
 
virtual void SaveQField (const std::string &field_name)
 Save one q-field, assuming the collection directory already exists.
 
virtual void Load (int cycle_=0)
 Load the collection. Not implemented in the base class DataCollection.
 
virtual ~DataCollection ()
 Delete the mesh and fields if owned by the collection.
 
int Error () const
 Get the current error state.
 
void ResetError (int err_state=No_Error)
 Reset the error state.
 

Protected Attributes

int levels_of_detail = 1
 
int compression_level = -1
 
bool high_order_output = false
 
bool restart_mode = false
 
bool bdr_output = false
 
VTKFormat pv_data_format = VTKFormat::BINARY
 
- Protected Attributes inherited from mfem::DataCollection
std::string name
 Name of the collection, used as a directory name when saving.
 
std::string prefix_path
 A path where the directory with results is saved. If not empty, it has '/' at the end.
 
GFieldMap field_map
 
QFieldMap q_field_map
 
Meshmesh
 The (common) mesh for the collected fields.
 
int cycle
 Time cycle; for time-dependent simulations cycle >= 0, otherwise = -1.
 
real_t time
 Physical time (for time-dependent simulations)
 
real_t time_step
 Time step i.e. delta_t (for time-dependent simulations)
 
bool serial
 Serial or parallel run? False iff mesh is a ParMesh.
 
bool appendRankToFileName
 Append rank to any output file names.
 
int myid
 MPI rank (in parallel)
 
int num_procs
 Number of MPI ranks (in parallel)
 
MPI_Comm m_comm
 Associated MPI communicator.
 
int precision
 Precision (number of digits) used for the text output of doubles.
 
int pad_digits_cycle
 Number of digits used for the cycle and MPI rank in filenames.
 
int pad_digits_rank
 
int format
 Output mesh format: see the Format enumeration.
 
int compression
 
bool own_data
 Should the collection delete its mesh and fields.
 
int error
 Error state.
 

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 , 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
 
- Protected Member Functions inherited from mfem::DataCollection
void DeleteData ()
 Delete data owned by the DataCollection keeping field information.
 
void DeleteAll ()
 Delete data owned by the DataCollection including field information.
 
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.
 
void SaveOneQField (const QFieldMapIterator &it)
 Save one q-field to disk, assuming the collection directory exists.
 
- Static Protected Member Functions inherited from mfem::DataCollection
static int create_directory (const std::string &dir_name, const Mesh *mesh, int myid)
 
- Static Protected Attributes inherited from mfem::DataCollection
static const int precision_default = 6
 Default value for precision.
 
static const int pad_digits_default = 6
 Default value for pad_digits_*.
 

Detailed Description

Abstract base class for ParaViewDataCollection and ParaViewHDFDataCollection.

Definition at line 513 of file datacollection.hpp.

Constructor & Destructor Documentation

◆ ParaViewDataCollectionBase()

mfem::ParaViewDataCollectionBase::ParaViewDataCollectionBase ( const std::string & name,
Mesh * mesh )

Definition at line 797 of file datacollection.cpp.

Member Function Documentation

◆ GetCompressionLevel()

int mfem::ParaViewDataCollectionBase::GetCompressionLevel ( ) const

If compression is enabled, return the compression level, else return 0.

Definition at line 831 of file datacollection.cpp.

◆ IsBinaryFormat()

bool mfem::ParaViewDataCollectionBase::IsBinaryFormat ( ) const

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

Definition at line 841 of file datacollection.cpp.

◆ SetBoundaryOutput()

void mfem::ParaViewDataCollectionBase::SetBoundaryOutput ( bool bdr_output_)

Configures collection to save only fields evaluated on boundaries of the mesh.

Definition at line 818 of file datacollection.cpp.

◆ SetCompressionLevel()

void mfem::ParaViewDataCollectionBase::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.

The initial compression level is 0 if MFEM is compiled with MFEM_USE_ZLIB turned off, and -1 otherwise.

Any nonzero compression level will enable compression.

Definition at line 823 of file datacollection.cpp.

◆ SetDataFormat()

void mfem::ParaViewDataCollectionBase::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.

The initial format is VTKFormat::BINARY.

VTKFormat::ASCII is not supported by ParaViewHDFDataCollection.

Definition at line 836 of file datacollection.cpp.

◆ SetHighOrderOutput()

void mfem::ParaViewDataCollectionBase::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 813 of file datacollection.cpp.

◆ SetLevelsOfDetail()

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

Set the refinement level.

In "low-order mode", every element is uniformly split based on the levels of detail. In "high-order mode", this sets the polynomial degree for the element transformations.

The initial value is 1.

Definition at line 808 of file datacollection.cpp.

◆ UseRestartMode()

void mfem::ParaViewDataCollectionBase::UseRestartMode ( bool restart_mode_)

Enable or disable restart mode.

If restart is enabled, new writes will preserve timestep metadata for any solutions prior to the currently defined time.

Definition at line 846 of file datacollection.cpp.

Member Data Documentation

◆ bdr_output

bool mfem::ParaViewDataCollectionBase::bdr_output = false
protected

Definition at line 520 of file datacollection.hpp.

◆ compression_level

int mfem::ParaViewDataCollectionBase::compression_level = -1
protected

Definition at line 517 of file datacollection.hpp.

◆ high_order_output

bool mfem::ParaViewDataCollectionBase::high_order_output = false
protected

Definition at line 518 of file datacollection.hpp.

◆ levels_of_detail

int mfem::ParaViewDataCollectionBase::levels_of_detail = 1
protected

Definition at line 516 of file datacollection.hpp.

◆ pv_data_format

VTKFormat mfem::ParaViewDataCollectionBase::pv_data_format = VTKFormat::BINARY
protected

Definition at line 521 of file datacollection.hpp.

◆ restart_mode

bool mfem::ParaViewDataCollectionBase::restart_mode = false
protected

Definition at line 519 of file datacollection.hpp.


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