MFEM
v3.4
Finite element discretization library
|
#include <datacollection.hpp>
Public Types | |
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 |
Public Member Functions | |
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... | |
GridFunction * | GetField (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... | |
ParGridFunction * | GetParField (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... | |
QuadratureFunction * | GetQField (const std::string &q_field_name) |
Get a pointer to a QuadratureFunction in the collection. More... | |
const FieldMapType & | GetFieldMap () const |
Get a const reference to the internal field map. More... | |
const QFieldMapType & | GetQFieldMap () const |
Get a const reference to the internal q-field map. More... | |
Mesh * | GetMesh () |
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 | Save () |
Save the collection to disk. 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 void | Load (int cycle_=0) |
Load the collection. Not implemented in the base class DataCollection. 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 | 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... | |
Static Protected Member Functions | |
static int | create_directory (const std::string &dir_name, const Mesh *mesh, int myid) |
Protected Attributes | |
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 |
Mesh * | mesh |
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... | |
bool | own_data |
Should the collection delete its mesh and fields. More... | |
int | error |
Error state. More... | |
Static Protected Attributes | |
static const int | precision_default = 6 |
Default value for precision. More... | |
static const int | pad_digits_default = 6 |
Default value for pad_digits_*. More... | |
A class for collecting finite element data that is part of the same simulation. Currently, this class groups together grid functions (fields), quadrature functions (q-fields), and the mesh that they are defined on.
Definition at line 126 of file datacollection.hpp.
Definition at line 137 of file datacollection.hpp.
Definition at line 136 of file datacollection.hpp.
Definition at line 135 of file datacollection.hpp.
Definition at line 141 of file datacollection.hpp.
Definition at line 140 of file datacollection.hpp.
Definition at line 139 of file datacollection.hpp.
anonymous enum |
Errors returned by Error()
Enumerator | |
---|---|
NO_ERROR | |
READ_ERROR | |
WRITE_ERROR |
Definition at line 374 of file datacollection.hpp.
Format constants to be used with SetFormat().
Derived classes can define their own format enumerations and override the method SetFormat() to perform input validation.
Enumerator | |
---|---|
SERIAL_FORMAT |
MFEM's serial ascii format, using the methods Mesh::Print() / ParMesh::Print(), and GridFunction::Save() / ParGridFunction::Save(). |
PARALLEL_FORMAT |
MFEM's parallel ascii format, using the methods ParMesh::ParPrint() and GridFunction::Save() / ParGridFunction::Save(). |
Definition at line 146 of file datacollection.hpp.
|
explicit |
Initialize the collection with its name and Mesh.
When mesh_ is NULL, then the real mesh can be set with SetMesh().
Definition at line 72 of file datacollection.cpp.
|
virtual |
Delete the mesh and fields if owned by the collection.
Definition at line 326 of file datacollection.cpp.
|
staticprotected |
Definition at line 31 of file datacollection.cpp.
|
protected |
Delete data owned by the DataCollection including field information.
Definition at line 319 of file datacollection.cpp.
|
protected |
Delete data owned by the DataCollection keeping field information.
Definition at line 309 of file datacollection.cpp.
|
inlinevirtual |
Remove a grid function from the collection.
Reimplemented in mfem::SidreDataCollection.
Definition at line 245 of file datacollection.hpp.
|
inlinevirtual |
Remove a QuadratureFunction from the collection.
Definition at line 255 of file datacollection.hpp.
|
inline |
Get the current error state.
Definition at line 377 of file datacollection.hpp.
|
inline |
Get the name of the collection.
Definition at line 331 of file datacollection.hpp.
|
inline |
Return the associated MPI communicator or MPI_COMM_NULL.
Definition at line 269 of file datacollection.hpp.
|
inline |
Get time cycle (for time-dependent simulations)
Definition at line 324 of file datacollection.hpp.
|
inline |
Get a pointer to a grid function in the collection.
Returns NULL if field_name is not in the collection.
Definition at line 264 of file datacollection.hpp.
|
protected |
Definition at line 251 of file datacollection.cpp.
|
inline |
Get a const reference to the internal field map.
The keys in the map are the field names and the values are pointers to GridFunctions.
Definition at line 291 of file datacollection.hpp.
|
inline |
Get a pointer to the mesh in the collection.
Definition at line 301 of file datacollection.hpp.
|
protected |
Definition at line 246 of file datacollection.cpp.
|
protected |
Definition at line 241 of file datacollection.cpp.
|
inline |
Get a pointer to a parallel grid function in the collection.
Returns NULL if field_name is not in the collection.
Definition at line 275 of file datacollection.hpp.
|
inline |
Get the path where the DataCollection will be saved.
Definition at line 353 of file datacollection.hpp.
|
inline |
Get a pointer to a QuadratureFunction in the collection.
Returns NULL if field_name is not in the collection.
Definition at line 285 of file datacollection.hpp.
|
inline |
Get a const reference to the internal q-field map.
The keys in the map are the q-field names and the values are pointers to QuadratureFunctions.
Definition at line 297 of file datacollection.hpp.
|
inline |
Get physical time (for time-dependent simulations)
Definition at line 326 of file datacollection.hpp.
|
inline |
Get the simulation time step (for time-dependent simulations)
Definition at line 328 of file datacollection.hpp.
|
inline |
Check if a grid function is part of the collection.
Definition at line 259 of file datacollection.hpp.
|
inline |
Check if a QuadratureFunction with the given name is in the collection.
Definition at line 280 of file datacollection.hpp.
|
virtual |
Load the collection. Not implemented in the base class DataCollection.
Reimplemented in mfem::VisItDataCollection, mfem::SidreDataCollection, and mfem::ConduitDataCollection.
Definition at line 179 of file datacollection.cpp.
|
inlinevirtual |
Add a grid function to the collection.
Reimplemented in mfem::VisItDataCollection, and mfem::SidreDataCollection.
Definition at line 241 of file datacollection.hpp.
|
inlinevirtual |
Add a QuadratureFunction to the collection.
Definition at line 249 of file datacollection.hpp.
|
inline |
Reset the error state.
Definition at line 379 of file datacollection.hpp.
|
virtual |
Save the collection to disk.
By default, everything is saved in the "prefix_path" directory with subdirectory name "collection_name" or "collection_name_cycle" for time-dependent simulations.
Reimplemented in mfem::VisItDataCollection, mfem::SidreDataCollection, and mfem::ConduitDataCollection.
Definition at line 184 of file datacollection.cpp.
|
virtual |
Save one field, assuming the collection directory already exists.
Definition at line 291 of file datacollection.cpp.
|
virtual |
Save the mesh, creating the collection directory.
Definition at line 203 of file datacollection.cpp.
|
protected |
Save one field to disk, assuming the collection directory exists.
Definition at line 267 of file datacollection.cpp.
|
protected |
Save one q-field to disk, assuming the collection directory exists.
Definition at line 279 of file datacollection.cpp.
|
virtual |
Save one q-field, assuming the collection directory already exists.
Definition at line 300 of file datacollection.cpp.
|
inline |
Set time cycle (for time-dependent simulations)
Definition at line 316 of file datacollection.hpp.
|
virtual |
Set the desired output mesh and data format.
See the enumeration Format for valid options. Derived classes can define their own format enumerations and override this method to perform input validation.
Definition at line 150 of file datacollection.cpp.
|
virtual |
Set/change the mesh associated with the collection.
When passed a Mesh, assumes the serial case: MPI rank id is set to 0 and MPI num_procs is set to 1. When passed a ParMesh, MPI info from the ParMesh is used to set the DataCollection's MPI rank and num_procs.
Reimplemented in mfem::VisItDataCollection, and mfem::SidreDataCollection.
Definition at line 113 of file datacollection.cpp.
|
virtual |
Set/change the mesh associated with the collection.
For this case, comm is used to set the DataCollection's MPI rank id and MPI num_procs, which influences the how files are saved for domain decomposed meshes.
Reimplemented in mfem::VisItDataCollection, and mfem::SidreDataCollection.
Definition at line 137 of file datacollection.cpp.
|
inline |
Set the ownership of collection data.
Definition at line 333 of file datacollection.hpp.
|
inline |
Set the number of digits used for both the cycle and the MPI rank.
Definition at line 338 of file datacollection.hpp.
|
inline |
Set the number of digits used for the cycle.
Definition at line 340 of file datacollection.hpp.
|
inline |
Set the number of digits used for the MPI rank in filenames.
Definition at line 342 of file datacollection.hpp.
|
inline |
Set the precision (number of digits) used for the text output of doubles.
Definition at line 336 of file datacollection.hpp.
void mfem::DataCollection::SetPrefixPath | ( | const std::string & | prefix | ) |
Set the path where the DataCollection will be saved.
Definition at line 163 of file datacollection.cpp.
|
inline |
Set physical time (for time-dependent simulations)
Definition at line 318 of file datacollection.hpp.
|
inline |
Set the simulation time step (for time-dependent simulations)
Definition at line 321 of file datacollection.hpp.
|
protected |
Append rank to any output file names.
Definition at line 185 of file datacollection.hpp.
|
protected |
Time cycle; for time-dependent simulations cycle >= 0, otherwise = -1.
When cycle >= 0, it is appended to directory names.
Definition at line 175 of file datacollection.hpp.
|
protected |
Error state.
Definition at line 213 of file datacollection.hpp.
|
protected |
A FieldMap mapping registered field names to GridFunction pointers.
Definition at line 165 of file datacollection.hpp.
|
protected |
Output mesh format: see the Format enumeration.
Definition at line 207 of file datacollection.hpp.
|
protected |
Associated MPI communicator.
Definition at line 193 of file datacollection.hpp.
|
protected |
The (common) mesh for the collected fields.
Definition at line 171 of file datacollection.hpp.
|
protected |
MPI rank (in parallel)
Definition at line 188 of file datacollection.hpp.
|
protected |
Name of the collection, used as a directory name when saving.
Definition at line 158 of file datacollection.hpp.
|
protected |
Number of MPI ranks (in parallel)
Definition at line 190 of file datacollection.hpp.
|
protected |
Should the collection delete its mesh and fields.
Definition at line 210 of file datacollection.hpp.
|
protected |
Number of digits used for the cycle and MPI rank in filenames.
Definition at line 199 of file datacollection.hpp.
|
staticprotected |
Default value for pad_digits_*.
Definition at line 204 of file datacollection.hpp.
|
protected |
Definition at line 199 of file datacollection.hpp.
|
protected |
Precision (number of digits) used for the text output of doubles.
Definition at line 197 of file datacollection.hpp.
|
staticprotected |
Default value for precision.
Definition at line 202 of file datacollection.hpp.
|
protected |
A path where the directory with results is saved. If not empty, it has '/' at the end.
Definition at line 162 of file datacollection.hpp.
|
protected |
A FieldMap mapping registered names to QuadratureFunction pointers.
Definition at line 168 of file datacollection.hpp.
|
protected |
Serial or parallel run? False iff mesh is a ParMesh.
Definition at line 183 of file datacollection.hpp.
|
protected |
Physical time (for time-dependent simulations)
Definition at line 177 of file datacollection.hpp.
|
protected |
Time step i.e. delta_t (for time-dependent simulations)
Definition at line 180 of file datacollection.hpp.