12 #ifndef MFEM_SIDREDATACOLLECTION
13 #define MFEM_SIDREDATACOLLECTION
15 #include "../config/config.hpp"
20 #ifdef MFEM_HAVE_GCC_PRAGMA_DIAGNOSTIC
21 # pragma GCC diagnostic push
22 # if defined(__clang__)
23 # pragma GCC diagnostic ignored "-Wextra-semi"
25 # pragma GCC diagnostic ignored "-Wpedantic"
28 #include <sidre/sidre.hpp>
29 #ifdef MFEM_HAVE_GCC_PRAGMA_DIAGNOSTIC
30 # pragma GCC diagnostic pop
190 Mesh *the_mesh = NULL,
191 bool owns_mesh_data =
false);
210 axom::sidre::Group * bp_index_grp,
211 axom::sidre::Group * domain_grp,
212 bool owns_mesh_data =
false);
248 const std::string &buffer_name,
249 axom::sidre::SidreLength offset);
279 if (!nodes_name.empty()) { m_meshNodesGFName = nodes_name; }
299 virtual void SetMesh(MPI_Comm comm,
Mesh *new_mesh);
310 axom::sidre::Group * domain_grp);
325 void Save(
const std::string& filename,
const std::string& protocol);
339 void Load(
const std::string& path,
const std::string& protocol);
346 virtual void Load(
int cycle_ = 0)
388 axom::sidre::SidreLength sz,
389 axom::sidre::TypeID type =
390 axom::sidre::DOUBLE_ID);
400 const bool m_owns_datastore;
407 const bool m_owns_mesh_data;
413 std::string m_meshNodesGFName;
417 axom::sidre::DataStore * m_datastore_ptr;
424 const std::string &view_name);
428 const std::string &view_name,
429 const axom::sidre::DataType &dtype);
433 const std::string &group_name);
436 std::string
get_file_path(
const std::string &filename)
const;
441 axom::sidre::Group * m_bp_grp;
442 axom::sidre::Group * m_bp_index_grp;
445 axom::sidre::Group * m_named_bufs_grp;
449 void RegisterFieldInBPIndex(
const std::string& field_name,
451 void DeregisterFieldInBPIndex(
const std::string & field_name);
453 void RegisterAttributeFieldInBPIndex(
const std::string& attr_name);
454 void DeregisterAttributeFieldInBPIndex(
const std::string& attr_name);
469 void addScalarBasedGridFunction(
const std::string& field_name,
471 const std::string &buffer_name,
472 axom::sidre::SidreLength offset);
483 void addVectorBasedGridFunction(
const std::string& field_name,
485 const std::string &buffer_name,
486 axom::sidre::SidreLength offset);
490 void addIntegerAttributeField(
const std::string& field_name,
bool is_bdry);
496 void createMeshBlueprintStubs(
bool hasBP);
502 void createMeshBlueprintState(
bool hasBP);
508 void createMeshBlueprintCoordset(
bool hasBP);
518 void createMeshBlueprintTopologies(
bool hasBP,
const std::string& mesh_name);
526 void createMeshBlueprintAdjacencies(
bool hasBP);
530 void verifyMeshBlueprint();
axom::sidre::View * alloc_view(axom::sidre::Group *grp, const std::string &view_name)
bool HasAttributeField(const std::string &field_name) const
axom::sidre::Group * GetBPGroup()
Class for grid function - Vector with associated FE space.
void Load(const std::string &path, const std::string &protocol)
Load the Sidre DataStore from file.
void SetCycle(int c)
Set time cycle (for time-dependent simulations)
virtual void SetMesh(Mesh *new_mesh)
Set/change the mesh associated with the collection.
virtual void RegisterField(const std::string &field_name, GridFunction *gf)
Register a GridFunction in the Sidre DataStore.
SidreDataCollection(const std::string &collection_name, Mesh *the_mesh=NULL, bool owns_mesh_data=false)
Constructor that allocates and initializes a Sidre DataStore.
void LoadExternalData(const std::string &path)
Load external data after registering externally owned fields.
bool Has(const std::string &fname) const
Predicate to check if a field is associated with name fname.
axom::sidre::View * AllocNamedBuffer(const std::string &buffer_name, axom::sidre::SidreLength sz, axom::sidre::TypeID type=axom::sidre::DOUBLE_ID)
Return newly allocated or existing named buffer for buffer_name.
virtual void DeregisterField(const std::string &field_name)
De-register field_name from the SidreDataCollection.
axom::sidre::View * GetNamedBuffer(const std::string &buffer_name) const
Get a pointer to the sidre::View holding the named buffer for buffer_name.
Data collection with Sidre routines following the Conduit mesh blueprint specification.
void SetMeshNodesName(const std::string &nodes_name)
Set the name of the mesh nodes field.
bool HasBoundaryMesh() const
void RegisterAttributeField(const std::string &name, bool is_bdry)
Registers an attribute field in the Sidre DataStore.
axom::sidre::Group * GetBPIndexGroup()
Type
Constants for the classes derived from Element.
void SetGroupPointers(axom::sidre::Group *global_grp, axom::sidre::Group *domain_grp)
Reset the domain and global datastore group pointers.
void UpdateStateToDS()
Updates the data store's cycle, time, and time-step variables with the values from the SidreDataColle...
NamedFieldsMap< Array< int > > AttributeFieldMap
void UpdateStateFromDS()
Updates the DataCollection's cycle, time, and time-step variables with the values from the data store...
virtual ~SidreDataCollection()
Delete all owned data.
AttributeFieldMap attr_map
std::string get_file_path(const std::string &filename) const
virtual void PrepareToSave()
Prepare the DataStore for writing.
axom::sidre::Group * alloc_group(axom::sidre::Group *grp, const std::string &group_name)
Array< int > * GetAttributeField(const std::string &field_name) const
virtual void Save()
Save the collection to file.
Lightweight adaptor over an std::map from strings to pointer to T.
void FreeNamedBuffer(const std::string &buffer_name)
Deallocate the named buffer buffer_name.
void SetComm(MPI_Comm comm)
Associate an MPI communicator with the collection.
T * Get(const std::string &fname) const
Get a pointer to the field associated with name fname.
std::string name
Name of the collection, used as a directory name when saving.
virtual void Load(int cycle_=0)
Load SidreDataCollection from file.
void DeregisterAttributeField(const std::string &name)
axom::sidre::Group * named_buffers_grp() const