12 #ifndef MFEM_DATACOLLECTION
13 #define MFEM_DATACOLLECTION
15 #include "../config/config.hpp"
74 void SaveOneField(
const std::map<std::string,GridFunction*>::iterator &it);
119 virtual void SaveField(
const char *field_name);
192 void Load(
int _cycle = 0);
virtual void SaveMesh()
Save the mesh, creating the collection directory.
void SetPrecision(int prec)
Set the precision (number of digits) used for the text output of doubles.
std::map< std::string, GridFunction * > field_map
The fields and their names (used when saving)
Class for grid function - Vector with associated FE space.
bool HasField(const char *name)
Check if a grid function is part of the collection.
void SetCycle(int c)
Set time cycle (for time-dependent simulations)
virtual void RegisterField(const char *field_name, GridFunction *gf)
Add a grid function to the collection and update the root file.
void DeleteAll()
Delete data owned by the DataCollection including field information.
Helper class for VisIt visualization data.
double GetTime()
Get physical time (for time-dependent simulations)
virtual void Save()
Save the collection and a VisIt root file.
int Error() const
Get the current error state.
bool own_data
Should the collection delete its mesh and fields.
double time
Physical time (for time-dependent simulations)
void ResetError(int err=NO_ERROR)
Reset the error state.
Mesh * mesh
The (common) mesh for the collected fields.
void SetPadDigits(int digits)
Set the number of digits used for the cycle and MPI rank in filenames.
VisItFieldInfo(std::string _association, int _num_components)
bool serial
Serial or parallel run? If false, append rank (myid) to file names.
void ParseVisItRootString(std::string json)
Read in a VisIt root file in JSON format.
Data collection with VisIt I/O routines.
int visit_max_levels_of_detail
GridFunction * GetField(const char *field_name)
void DeleteData()
Delete data owned by the DataCollection keeping field information.
static const int pad_digits_default
Default value for pad_digits.
virtual void SaveField(const char *field_name)
Save one field, assuming the collection directory already exists.
void Load(int _cycle=0)
Load the collection based on its VisIt data (described in its root file)
void SetTime(double t)
Set physical time (for time-dependent simulations)
void SetOwnData(bool o)
Set the ownership of collection data.
virtual ~VisItDataCollection()
We will delete the mesh and fields if we own them.
std::map< std::string, VisItFieldInfo > field_info_map
void LoadVisItRootFile(std::string root_name)
int precision
Precision (number of digits) used for the text output of doubles.
int myid
MPI rank (in parallel)
const char * GetCollectionName()
Get the name of the collection.
static const int precision_default
Default value for precision.
void SetMaxLevelsOfDetail(int max_levels_of_detail)
Set VisIt parameter: maximum levels of detail for the MultiresControl.
virtual ~DataCollection()
Delete the mesh and fields if owned by the collection.
int GetCycle()
Get time cycle (for time-dependent simulations)
void SaveRootFile()
Save a VisIt root file for the collection.
VisItDataCollection(const char *collection_name)
virtual void RegisterField(const char *field_name, GridFunction *gf)
Add a grid function to the collection.
DataCollection(const char *collection_name)
Create an empty collection with the given name.
Mesh * GetMesh()
Get a pointer to the mesh in the collection.
int pad_digits
Number of digits used for the cycle and MPI rank in filenames.
virtual void SetMesh(Mesh *new_mesh)
Set/change the mesh associated with the collection.
std::string name
Name of the collection, used as a directory name when saving.
virtual void SetMesh(Mesh *new_mesh)
Set/change the mesh associated with the collection.
void SaveOneField(const std::map< std::string, GridFunction * >::iterator &it)
Save one field to disk, assuming the collection directory exists.
int num_procs
Number of MPI ranks (in parallel)
std::string GetVisItRootString()
Prepare the VisIt root file in JSON format for the current collection.