MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
mfem::VisItDataCollection Class Reference

Data collection with VisIt I/O routines. More...

#include <datacollection.hpp>

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

Public Member Functions

 VisItDataCollection (const std::string &collection_name, Mesh *mesh_=NULL)
 Constructor. The collection name is used when saving the data.
 
 VisItDataCollection (MPI_Comm comm, const std::string &collection_name, Mesh *mesh_=NULL)
 Construct a parallel VisItDataCollection to be loaded from files.
 
virtual void SetMesh (Mesh *new_mesh) override
 Set/change the mesh associated with the collection.
 
virtual void SetMesh (MPI_Comm comm, Mesh *new_mesh) override
 Set/change the mesh associated with the collection.
 
virtual void RegisterField (const std::string &field_name, GridFunction *gf) override
 Add a grid function to the collection and update the root file.
 
virtual void RegisterQField (const std::string &q_field_name, QuadratureFunction *qf) override
 Add a quadrature function to the collection and update the root file.
 
virtual void SetPadDigits (int digits) override
 
void SetLevelsOfDetail (int levels_of_detail)
 Set VisIt parameter: default levels of detail for the MultiresControl.
 
void SetMaxLevelsOfDetail (int max_levels_of_detail)
 Set VisIt parameter: maximum levels of detail for the MultiresControl.
 
void DeleteAll ()
 Delete all data owned by VisItDataCollection including field data information.
 
virtual void Save () override
 Save the collection and a VisIt root file.
 
void SaveRootFile ()
 Save a VisIt root file for the collection.
 
virtual void Load (int cycle_=0) override
 Load the collection based on its VisIt data (described in its root file)
 
virtual ~VisItDataCollection ()
 We will delete the mesh and fields if we own them.
 
- 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 DeregisterField (const std::string &field_name)
 Remove a grid function from 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 &q_field_name) const
 Check if a QuadratureFunction with the given name is in the collection.
 
QuadratureFunctionGetQField (const std::string &q_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.
 
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 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 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 &q_field_name)
 Save one q-field, assuming the collection directory already exists.
 
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 Types

typedef std::map< std::string, VisItFieldInfo >::iterator FieldInfoMapIterator
 

Protected Member Functions

std::string GetVisItRootString ()
 Prepare the VisIt root file in JSON format for the current collection.
 
void ParseVisItRootString (const std::string &json)
 Read in a VisIt root file in JSON format.
 
void UpdateMeshInfo ()
 
void LoadVisItRootFile (const std::string &root_name)
 
void LoadMesh ()
 
void LoadFields ()
 
- 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.
 

Protected Attributes

int spatial_dim
 
int topo_dim
 
int visit_levels_of_detail
 
int visit_max_levels_of_detail
 
std::map< std::string, VisItFieldInfofield_info_map
 
- 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
 
- 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

Data collection with VisIt I/O routines.

Definition at line 419 of file datacollection.hpp.

Member Typedef Documentation

◆ FieldInfoMapIterator

typedef std::map<std::string,VisItFieldInfo>::iterator mfem::VisItDataCollection::FieldInfoMapIterator
protected

Definition at line 428 of file datacollection.hpp.

Constructor & Destructor Documentation

◆ VisItDataCollection() [1/2]

mfem::VisItDataCollection::VisItDataCollection ( const std::string & collection_name,
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 either SetMesh() or Load(). The latter works only in serial.

Definition at line 365 of file datacollection.cpp.

◆ VisItDataCollection() [2/2]

mfem::VisItDataCollection::VisItDataCollection ( MPI_Comm comm,
const std::string & collection_name,
Mesh * mesh_ = NULL )

Construct a parallel VisItDataCollection to be loaded from files.

Before loading the collection with Load(), some parameters in the collection can be adjusted, e.g. SetPadDigits(), SetPrefixPath(), etc.

Definition at line 379 of file datacollection.cpp.

◆ ~VisItDataCollection()

virtual mfem::VisItDataCollection::~VisItDataCollection ( )
inlinevirtual

We will delete the mesh and fields if we own them.

Definition at line 501 of file datacollection.hpp.

Member Function Documentation

◆ DeleteAll()

void mfem::VisItDataCollection::DeleteAll ( )

Delete all data owned by VisItDataCollection including field data information.

Definition at line 465 of file datacollection.cpp.

◆ GetVisItRootString()

std::string mfem::VisItDataCollection::GetVisItRootString ( )
protected

Prepare the VisIt root file in JSON format for the current collection.

Definition at line 652 of file datacollection.cpp.

◆ Load()

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

Load the collection based on its VisIt data (described in its root file)

Reimplemented from mfem::DataCollection.

Definition at line 493 of file datacollection.cpp.

◆ LoadFields()

void mfem::VisItDataCollection::LoadFields ( )
protected

Definition at line 599 of file datacollection.cpp.

◆ LoadMesh()

void mfem::VisItDataCollection::LoadMesh ( )
protected

Definition at line 564 of file datacollection.cpp.

◆ LoadVisItRootFile()

void mfem::VisItDataCollection::LoadVisItRootFile ( const std::string & root_name)
protected

Definition at line 548 of file datacollection.cpp.

◆ ParseVisItRootString()

void mfem::VisItDataCollection::ParseVisItRootString ( const std::string & json)
protected

Read in a VisIt root file in JSON format.

Definition at line 699 of file datacollection.cpp.

◆ RegisterField()

void mfem::VisItDataCollection::RegisterField ( const std::string & field_name,
GridFunction * gf )
overridevirtual

Add a grid function to the collection and update the root file.

Reimplemented from mfem::DataCollection.

Definition at line 415 of file datacollection.cpp.

◆ RegisterQField()

void mfem::VisItDataCollection::RegisterQField ( const std::string & q_field_name,
QuadratureFunction * qf )
overridevirtual

Add a quadrature function to the collection and update the root file.

Visualization of quadrature function is not supported in VisIt(3.12). A patch has been sent to VisIt developers in June 2020.

Reimplemented from mfem::DataCollection.

Definition at line 436 of file datacollection.cpp.

◆ Save()

void mfem::VisItDataCollection::Save ( )
overridevirtual

Save the collection and a VisIt root file.

Reimplemented from mfem::DataCollection.

Definition at line 471 of file datacollection.cpp.

◆ SaveRootFile()

void mfem::VisItDataCollection::SaveRootFile ( )

Save a VisIt root file for the collection.

Definition at line 477 of file datacollection.cpp.

◆ SetLevelsOfDetail()

void mfem::VisItDataCollection::SetLevelsOfDetail ( int levels_of_detail)

Set VisIt parameter: default levels of detail for the MultiresControl.

Definition at line 455 of file datacollection.cpp.

◆ SetMaxLevelsOfDetail()

void mfem::VisItDataCollection::SetMaxLevelsOfDetail ( int max_levels_of_detail)

Set VisIt parameter: maximum levels of detail for the MultiresControl.

Definition at line 460 of file datacollection.cpp.

◆ SetMesh() [1/2]

void mfem::VisItDataCollection::SetMesh ( Mesh * new_mesh)
overridevirtual

Set/change the mesh associated with the collection.

Reimplemented from mfem::DataCollection.

Definition at line 397 of file datacollection.cpp.

◆ SetMesh() [2/2]

void mfem::VisItDataCollection::SetMesh ( MPI_Comm comm,
Mesh * new_mesh )
overridevirtual

Set/change the mesh associated with the collection.

Reimplemented from mfem::DataCollection.

Definition at line 405 of file datacollection.cpp.

◆ SetPadDigits()

virtual void mfem::VisItDataCollection::SetPadDigits ( int digits)
inlineoverridevirtual

Set the number of digits used for both the cycle and the MPI rank

Note
VisIt seems to require 6 pad digits for the MPI rank. Therefore, this function uses this default value. This behavior can be overridden by calling SetPadDigitsCycle() and SetPadDigitsRank() instead.

Reimplemented from mfem::DataCollection.

Definition at line 478 of file datacollection.hpp.

◆ UpdateMeshInfo()

void mfem::VisItDataCollection::UpdateMeshInfo ( )
protected

Definition at line 346 of file datacollection.cpp.

Member Data Documentation

◆ field_info_map

std::map<std::string, VisItFieldInfo> mfem::VisItDataCollection::field_info_map
protected

Definition at line 427 of file datacollection.hpp.

◆ spatial_dim

int mfem::VisItDataCollection::spatial_dim
protected

Definition at line 424 of file datacollection.hpp.

◆ topo_dim

int mfem::VisItDataCollection::topo_dim
protected

Definition at line 424 of file datacollection.hpp.

◆ visit_levels_of_detail

int mfem::VisItDataCollection::visit_levels_of_detail
protected

Definition at line 425 of file datacollection.hpp.

◆ visit_max_levels_of_detail

int mfem::VisItDataCollection::visit_max_levels_of_detail
protected

Definition at line 426 of file datacollection.hpp.


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