12#ifndef MFEM_SIDREDATACOLLECTION
13#define MFEM_SIDREDATACOLLECTION
22#ifdef MFEM_HAVE_GCC_PRAGMA_DIAGNOSTIC
23# pragma GCC diagnostic push
24# if defined(__clang__)
25# pragma GCC diagnostic ignored "-Wextra-semi"
27# pragma GCC diagnostic ignored "-Wpedantic"
30#include <axom/sidre.hpp>
31#ifdef MFEM_HAVE_GCC_PRAGMA_DIAGNOSTIC
32# pragma GCC diagnostic pop
192 Mesh *the_mesh = NULL,
193 bool owns_mesh_data =
false);
212 axom::sidre::Group * bp_index_grp,
213 axom::sidre::Group * domain_grp,
214 bool owns_mesh_data =
false);
250 const std::string &buffer_name,
251 axom::sidre::IndexType offset);
281 if (!nodes_name.empty()) { m_meshNodesGFName = nodes_name; }
301 virtual void SetMesh(MPI_Comm comm,
Mesh *new_mesh);
312 axom::sidre::Group * domain_grp);
327 void Save(
const std::string& filename,
const std::string& protocol);
341 void Load(
const std::string& path,
const std::string& protocol);
348 virtual void Load(
int cycle_ = 0)
390 axom::sidre::IndexType sz,
391 axom::sidre::TypeID type =
392 axom::sidre::DOUBLE_ID);
402 const bool m_owns_datastore;
409 const bool m_owns_mesh_data;
415 std::string m_meshNodesGFName;
419 axom::sidre::DataStore * m_datastore_ptr;
426 const std::string &view_name);
430 const std::string &view_name,
431 const axom::sidre::DataType &dtype);
435 const std::string &group_name);
438 std::string
get_file_path(
const std::string &filename)
const;
443 axom::sidre::Group * m_bp_grp;
444 axom::sidre::Group * m_bp_index_grp;
447 axom::sidre::Group * m_named_bufs_grp;
451 void RegisterFieldInBPIndex(
const std::string& field_name,
453 void DeregisterFieldInBPIndex(
const std::string & field_name);
455 void RegisterAttributeFieldInBPIndex(
const std::string& attr_name);
456 void DeregisterAttributeFieldInBPIndex(
const std::string& attr_name);
471 void addScalarBasedGridFunction(
const std::string& field_name,
473 const std::string &buffer_name,
474 axom::sidre::IndexType offset);
485 void addVectorBasedGridFunction(
const std::string& field_name,
487 const std::string &buffer_name,
488 axom::sidre::IndexType offset);
492 void addIntegerAttributeField(
const std::string& field_name,
bool is_bdry);
498 void createMeshBlueprintStubs(
bool hasBP);
504 void createMeshBlueprintState(
bool hasBP);
510 void createMeshBlueprintCoordset(
bool hasBP);
520 void createMeshBlueprintTopologies(
bool hasBP,
const std::string& mesh_name);
528 void createMeshBlueprintAdjacencies(
bool hasBP);
532 void verifyMeshBlueprint();
void SetCycle(int c)
Set time cycle (for time-dependent simulations)
std::string name
Name of the collection, used as a directory name when saving.
Type
Constants for the classes derived from Element.
Class for grid function - Vector with associated FE space.
Lightweight adaptor over an std::map from strings to pointer to T.
bool Has(const std::string &fname) const
Predicate to check if a field is associated with name fname.
T * Get(const std::string &fname) const
Get a pointer to the field associated with name fname.
Data collection with Sidre routines following the Conduit mesh blueprint specification.
virtual void Save()
Save the collection to file.
void RegisterAttributeField(const std::string &name, bool is_bdry)
Registers an attribute field in the Sidre DataStore.
void SetGroupPointers(axom::sidre::Group *global_grp, axom::sidre::Group *domain_grp)
Reset the domain and global datastore group pointers.
void FreeNamedBuffer(const std::string &buffer_name)
Deallocate the named buffer buffer_name.
NamedFieldsMap< Array< int > > AttributeFieldMap
virtual void DeregisterField(const std::string &field_name)
De-register field_name from the SidreDataCollection.
axom::sidre::Group * named_buffers_grp() const
std::string get_file_path(const std::string &filename) const
axom::sidre::Group * GetBPGroup()
axom::sidre::View * AllocNamedBuffer(const std::string &buffer_name, axom::sidre::IndexType sz, axom::sidre::TypeID type=axom::sidre::DOUBLE_ID)
Return newly allocated or existing named buffer for buffer_name.
void Load(const std::string &path, const std::string &protocol)
Load the Sidre DataStore from file.
axom::sidre::View * GetNamedBuffer(const std::string &buffer_name) const
Get a pointer to the sidre::View holding the named buffer for buffer_name.
SidreDataCollection(const std::string &collection_name, Mesh *the_mesh=NULL, bool owns_mesh_data=false)
Constructor that allocates and initializes a Sidre DataStore.
void SetComm(MPI_Comm comm)
Associate an MPI communicator with the collection.
virtual void RegisterField(const std::string &field_name, GridFunction *gf)
Register a GridFunction in the Sidre DataStore.
axom::sidre::Group * GetBPIndexGroup()
void UpdateStateToDS()
Updates the data store's cycle, time, and time-step variables with the values from the SidreDataColle...
void UpdateStateFromDS()
Updates the DataCollection's cycle, time, and time-step variables with the values from the data store...
bool HasAttributeField(const std::string &field_name) const
axom::sidre::View * alloc_view(axom::sidre::Group *grp, const std::string &view_name)
bool HasBoundaryMesh() const
virtual void PrepareToSave()
Prepare the DataStore for writing.
virtual void SetMesh(Mesh *new_mesh)
Set/change the mesh associated with the collection.
virtual void Load(int cycle_=0)
Load SidreDataCollection from file.
AttributeFieldMap attr_map
virtual ~SidreDataCollection()
Delete all owned data.
Array< int > * GetAttributeField(const std::string &field_name) const
void LoadExternalData(const std::string &path)
Load external data after registering externally owned fields.
void SetMeshNodesName(const std::string &nodes_name)
Set the name of the mesh nodes field.
void DeregisterAttributeField(const std::string &name)
axom::sidre::Group * alloc_group(axom::sidre::Group *grp, const std::string &group_name)