MFEM  v4.2.0
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
sidredatacollection.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2020, Lawrence Livermore National Security, LLC. Produced
2 // at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3 // LICENSE and NOTICE for details. LLNL-CODE-806117.
4 //
5 // This file is part of the MFEM library. For more information and source code
6 // availability visit https://mfem.org.
7 //
8 // MFEM is free software; you can redistribute it and/or modify it under the
9 // terms of the BSD-3 license. We welcome feedback and contributions, see file
10 // CONTRIBUTING.md for details.
11 
12 #ifndef MFEM_SIDREDATACOLLECTION
13 #define MFEM_SIDREDATACOLLECTION
14 
15 #include "../config/config.hpp"
16 
17 #ifdef MFEM_USE_SIDRE
18 
19 #include "datacollection.hpp"
20 
21 // Ignore warnings from the axom/sidre header (GCC + Clang versions)
22 #ifdef MFEM_HAVE_GCC_PRAGMA_DIAGNOSTIC
23 # pragma GCC diagnostic push
24 # if defined(__clang__)
25 # pragma GCC diagnostic ignored "-Wextra-semi"
26 # else // real GCC?
27 # pragma GCC diagnostic ignored "-Wpedantic"
28 # endif
29 #endif
30 #include <axom/sidre.hpp>
31 #ifdef MFEM_HAVE_GCC_PRAGMA_DIAGNOSTIC
32 # pragma GCC diagnostic pop
33 #endif
34 
35 namespace mfem
36 {
37 
38 /** @brief Data collection with Sidre routines following the Conduit mesh
39  blueprint specification. */
40 /** SidreDataCollection provides an HDF5-based file format for visualization or
41  restart capability. This functionality is aimed primarily at customers of
42  LLNL's axom project that run problems at extreme scales.
43 
44  For more information, see:
45  - Sidre component of LLNL's axom project (to be open-sourced), http://goo.gl/cZyJdn
46  - LLNL conduit/blueprint library, https://github.com/LLNL/conduit
47  - HDF5 library, https://support.hdfgroup.org/HDF5
48 
49  The layout created in the Sidre DataStore is: (`"──"` denote groups,
50  `"─•"` denote views, `"─>"` denote links, i.e. shallow-copy view)
51 
52  <root>
53  ├── <collection-name>_global (global group)
54  │ └── blueprint_index
55  │ └── <collection-name> (bp_index group)
56  │ ├── state
57  │ │ ├─• cycle
58  │ │ ├─• time
59  │ │ └─• number_of_domains = <mesh-mpi-comm-size>
60  │ ├── coordsets
61  │ │ └── coords
62  │ │ ├─• path = "<bp-path>/coordsets/coords"
63  │ │ ├─• type ─> <bp-grp>/coordsets/coords/type = "explicit"
64  │ │ └─• coord_system = "x"|"xy"|"xyz"
65  │ ├── topologies
66  │ │ ├── mesh
67  │ │ │ ├─• path = "<bp-path>/topologies/mesh"
68  │ │ │ ├─• type ─> <bp-grp>/topologies/mesh/type = "unstructured"
69  │ │ │ ├─• coordset ─> <bp-grp>/topologies/mesh/coordset = "coords"
70  │ │ │ ├─• grid_function ─> <bp-grp>/topologies/mesh/grid_function = "<nodes-field-name>"
71  │ │ │ └─• boundary_topology ─> <bp-grp>/topologies/mesh/boundary_topology = "boundary"
72  │ │ └── boundary
73  │ │ ├─• path = "<bp-path>/topologies/mesh"
74  │ │ ├─• type ─> <bp-grp>/topologies/boundary/type = "unstructured"
75  │ │ └─• coordset ─> <bp-grp>/topologies/boundary/coordset = "coords"
76  │ └── fields
77  │ ├── mesh_material_attribute
78  │ │ ├─• path = "<bp-path>/fields/mesh_material_attribute"
79  │ │ ├─• association ─> <bp-grp>/fields/mesh_material_attribute/association = "element"
80  │ │ ├─• topology ─> <bp-grp>/fields/mesh_material_attribute/topology = "mesh"
81  │ │ └─• number_of_components = 1
82  │ ├── boundary_material_attribute
83  │ │ ├─• path = "<bp-path>/fields/boundary_material_attribute"
84  │ │ ├─• association ─> <bp-grp>/fields/boundary_material_attribute/association = "element"
85  │ │ ├─• topology ─> <bp-grp>/fields/boundary_material_attribute/topology = "boundary"
86  │ │ └─• number_of_components = 1
87  │ ├── grid-function-1
88  │ │ ├─• path = "<bp-path>/fields/grid-function-1"
89  │ │ ├─• basis ─> <bp-grp>/fields/grid-function-1/basis = "<fe-coll-name>"
90  │ │ ├─• topology ─> <bp-grp>/fields/grid-function-1/topology = "mesh"
91  │ │ └─• number_of_components = gf1->VectorDim()
92  │ ├── grid-function-2
93  │ │ ├─• path = "<bp-path>/fields/grid-function-2"
94  │ │ ├─• basis ─> <bp-grp>/fields/grid-function-2/basis = "<fe-coll-name>"
95  │ │ ├─• topology ─> <bp-grp>/fields/grid-function-2/topology = "mesh"
96  │ │ └─• number_of_components = gf2->VectorDim()
97  │ ├── ...
98  │ ...
99  └── <collection-name> (domain group)
100  ├── blueprint (blueprint group)
101  │ ├── state
102  │ │ ├─• cycle
103  │ │ ├─• time
104  │ │ ├─• domain = <mesh-mpi-rank>
105  │ │ └─• time_step
106  │ ├── coordsets
107  │ │ └── coords
108  │ │ ├─• type = "explicit"
109  │ │ └── values
110  │ │ ├─• x = view in <vertex-coords-buffer>/<ext-double-data>
111  │ │ ├─• y = view in <vertex-coords-buffer>/<ext-double-data>
112  │ │ └─• z = view in <vertex-coords-buffer>/<ext-double-data>
113  │ ├── topologies
114  │ │ ├── mesh
115  │ │ │ ├─• type = "unstructured"
116  │ │ │ ├── elements
117  │ │ │ │ ├─• shape = "points"|"lines"|...
118  │ │ │ │ └─• connectivity = <vert-idx-array>
119  │ │ │ ├─• coordset = "coords"
120  │ │ │ ├─• grid_function = "<nodes-field-name>"
121  │ │ │ └─• boundary_topology = "boundary"
122  │ │ └── boundary
123  │ │ ├─• type = "unstructured"
124  │ │ ├── elements
125  │ │ │ ├─• shape = "points"|"lines"|...
126  │ │ │ └─• connectivity = <vert-idx-array>
127  │ │ └─• coordset = "coords"
128  │ └── fields
129  │ ├── mesh_material_attribute
130  │ │ ├─• association = "element"
131  │ │ ├─• topology = "mesh"
132  │ │ └─• values = <attr-array>
133  │ ├── boundary_material_attribute
134  │ │ ├─• association = "element"
135  │ │ ├─• topology = "boundary"
136  │ │ └─• values = <attr-array>
137  │ ├── grid-function-1 (name can include path)
138  │ │ ├─• basis = "<fe-coll-name>"
139  │ │ ├─• topology = "mesh"
140  │ │ └─• values = <ext-double-array>/<named-buffer> (vdim == 1)
141  │ ├── grid-function-2 (name can include path)
142  │ │ ├─• basis = "<fe-coll-name>"
143  │ │ ├─• topology = "mesh"
144  │ │ └── values (vdim > 1)
145  │ │ ├─• x0 = view into <ext-double-array>/<named-buffer>
146  │ │ ├─• x1 = view into <ext-double-array>/<named-buffer>
147  │ │ └─• x2 = view into <ext-double-array>/<named-buffer>
148  │ ├── ...
149  │ ...
150  └── named_buffers (named_buffers group)
151  ├─• vertex_coords = <double-array>
152  ├─• grid-function-1 = <double-array>
153  ├─• grid-function-2 = <double-array>
154  ...
155 
156  @note blueprint_index is used both in serial and in parallel. In parallel,
157  only rank 0 will add entries to the blueprint index.
158 
159  @note QuadratureFunction%s (q-fields) are not supported.
160 
161  @note SidreDataCollection does not manage the FiniteElementSpace%s and
162  FiniteElementCollection%s associated with registered GridFunction%s.
163  Therefore, field registration is left to the user of SidreDataCollection and
164  there are no methods that automatically register GridFunction%s using just
165  the content of the Sidre DataStore. Such capabilities can be implemented in
166  a derived class, adding any desired object management routines.
167 
168  @warning This class is still _experimental_, meaning that in future
169  releases, it may not be backward compatible, and the output files generated
170  by the current version may become unreadable.
171 */
173 {
174 public:
177 
178 public:
179 
180  /// Constructor that allocates and initializes a Sidre DataStore.
181  /**
182  @param[in] collection_name Name of the collection used as a file name
183  when saving
184  @param[in] the_mesh Mesh shared by all grid functions in the
185  collection (can be NULL)
186  @param[in] owns_mesh_data Does the SidreDC own the mesh vertices?
187 
188  With this constructor, the SidreDataCollection owns the allocated Sidre
189  DataStore.
190  */
191  SidreDataCollection(const std::string& collection_name,
192  Mesh *the_mesh = NULL,
193  bool owns_mesh_data = false);
194 
195  /// Constructor that links to an external Sidre DataStore.
196  /** Specifically, the global and domain groups can be at arbitrary paths.
197 
198  @param[in] collection_name Name of the collection used as a file name
199  when saving
200  @param[in] bp_index_grp Pointer to the blueprint index group in the
201  datastore, see the above schematic
202  @param[in] domain_grp Pointer to the domain group in the datastore,
203  see the above schematic
204  @param[in] owns_mesh_data Does the SidreDC own the mesh vertices?
205 
206  With this constructor, the SidreDataCollection does not own the Sidre
207  DataStore.
208  @note No mesh or fields are read from the given Groups. The mesh has
209  to be set with SetMesh() and fields registered with RegisterField().
210  */
211  SidreDataCollection(const std::string& collection_name,
212  axom::sidre::Group * bp_index_grp,
213  axom::sidre::Group * domain_grp,
214  bool owns_mesh_data = false);
215 
216 #ifdef MFEM_USE_MPI
217  /// Associate an MPI communicator with the collection.
218  /** If no mesh was associated with the collection, this method should be
219  called before using any of the Load() methods to read parallel data. */
220  void SetComm(MPI_Comm comm);
221 #endif
222 
223  /// Register a GridFunction in the Sidre DataStore.
224  /** This method is a shortcut for the call
225  `RegisterField(field_name, gf, field_name, 0)`.
226  */
227  virtual void RegisterField(const std::string &field_name, GridFunction *gf)
228  {
229  RegisterField(field_name, gf, field_name, 0);
230  }
231 
232  /// Register a GridFunction in the Sidre DataStore.
233  /** The registration procedure is as follows:
234  - if (@a gf's data is NULL), allocate named buffer with the name
235  @a buffer_name with size _offset + gf->FESpace()->GetVSize()_ and use
236  its data (plus the given @a offset) to set @a gf's data;
237  - else, if (DataStore has a named buffer @a buffer_name), replace @a gf's
238  data array with that named buffer plus the given @a offset;
239  - else, use @a gf's data as external data associated with @a field_name
240  in the DataStore;
241  - register @a field_name in #field_map.
242 
243  Both the @a field_name and @a buffer_name can contain a path prefix.
244  @note If @a field_name or @a buffer_name is empty, the method does
245  nothing.
246  @note If the GridFunction pointer @a gf or it's FiniteElementSpace
247  pointer are NULL, the method does nothing.
248  */
249  void RegisterField(const std::string &field_name, GridFunction *gf,
250  const std::string &buffer_name,
251  axom::sidre::IndexType offset);
252 
253  /// Registers an attribute field in the Sidre DataStore
254  /** The registration process is similar to that of RegisterField()
255  The attribute field is associated with the elements of the mesh
256  when @a is_bdry is false, and with the boundary elements, when
257  @a is_bdry is true.
258  @sa RegisterField() */
259  void RegisterAttributeField(const std::string& name, bool is_bdry);
260  void DeregisterAttributeField(const std::string& name);
261 
262  /** Returns a pointer to the attribute field associated with
263  @a field_name, or NULL when there is no associated field */
264  Array<int>* GetAttributeField(const std::string& field_name) const
265  { return attr_map.Get(field_name); }
266 
267  /** Checks if there is an attribute field associated with @a field_name */
268  bool HasAttributeField(const std::string& field_name) const
269  { return attr_map.Has(field_name); }
270 
271  /** Checks if any rank in the mesh has boundary elements */
272  bool HasBoundaryMesh() const;
273 
274  /// Set the name of the mesh nodes field.
275  /** This name will be used by SetMesh() to register the mesh nodes, if not
276  already registered. Also, this method should be called if the mesh nodes
277  GridFunction was or will be registered directly by the user. The default
278  value for the name is "mesh_nodes". */
279  void SetMeshNodesName(const std::string &nodes_name)
280  {
281  if (!nodes_name.empty()) { m_meshNodesGFName = nodes_name; }
282  }
283 
284  /// De-register @a field_name from the SidreDataCollection.
285  /** The field is removed from the #field_map and the DataStore, including
286  deleting it from the named_buffers group, if allocated. */
287  virtual void DeregisterField(const std::string& field_name);
288 
289  /// Delete all owned data.
290  virtual ~SidreDataCollection();
291 
292  /// Set/change the mesh associated with the collection
293  /** Uses the field name "mesh_nodes" or the value set by SetMeshNodesName()
294  to register the mesh nodes GridFunction, if the mesh uses nodes. */
295  virtual void SetMesh(Mesh *new_mesh);
296 
297 #ifdef MFEM_USE_MPI
298  /// Set/change the mesh associated with the collection
299  /** Uses the field name "mesh_nodes" or the value set by SetMeshNodesName()
300  to register the mesh nodes GridFunction, if the mesh uses nodes. */
301  virtual void SetMesh(MPI_Comm comm, Mesh *new_mesh);
302 #endif
303 
304  /// Reset the domain and global datastore group pointers.
305  /** These are set in the constructor, but if a host code changes the
306  datastore contents ( such as wiping out the datastore and loading in new
307  contents from a file, i.e. a restart ) these pointers will need to be
308  reset to valid groups in the datastore.
309  @sa Load(const std::string &path, const std::string &protocol).
310  */
311  void SetGroupPointers(axom::sidre::Group * global_grp,
312  axom::sidre::Group * domain_grp);
313 
314  axom::sidre::Group * GetBPGroup() { return m_bp_grp; }
315  axom::sidre::Group * GetBPIndexGroup() { return m_bp_index_grp; }
316 
317  /// Prepare the DataStore for writing
318  virtual void PrepareToSave();
319 
320  /// Save the collection to file.
321  /** This method calls `Save(collection_name, "sidre_hdf5")`. */
322  virtual void Save();
323 
324  /// Save the collection to @a filename.
325  /** The collection path prefix is prepended to the @a filename and the
326  current cycle is appended, if cycle >= 0. */
327  void Save(const std::string& filename, const std::string& protocol);
328 
329  /// Load the Sidre DataStore from file.
330  /** No mesh or fields are read from the loaded DataStore.
331 
332  If the data collection created the datastore, it knows the layout of
333  where the domain and global groups are, and can restore them after the
334  Load().
335 
336  If, however, the data collection does not own the datastore (e.g. it did
337  not create the datastore), the host code must reset these pointers after
338  the load operation, using SetGroupPointers(), and also reset the state
339  variables, using UpdateStateFromDS().
340  */
341  void Load(const std::string& path, const std::string& protocol);
342 
343  /// Load SidreDataCollection from file.
344  /** The used file path is based on the current prefix path, collection name,
345  and the given @a cycle_. The protocol is "sidre_hdf5".
346  @sa Load(const std::string &path, const std::string &protocol).
347  */
348  virtual void Load(int cycle_ = 0)
349  {
350  SetCycle(cycle_);
351  Load(get_file_path(name), "sidre_hdf5");
352  }
353 
354  /// Load external data after registering externally owned fields.
355  void LoadExternalData(const std::string& path);
356 
357  /** @brief Updates the DataCollection's cycle, time, and time-step variables
358  with the values from the data store. */
359  void UpdateStateFromDS();
360 
361  /** @brief Updates the data store's cycle, time, and time-step variables with
362  the values from the SidreDataCollection. */
363  void UpdateStateToDS();
364 
365  /** @name Methods for named buffer access and manipulation. */
366  ///@{
367 
368  /** @brief Get a pointer to the sidre::View holding the named buffer for
369  @a buffer_name. */
370  /** If such named buffer is not allocated, the method returns NULL.
371  @note To access the underlying pointer, use View::getData().
372  @note To query the size of the buffer, use View::getNumElements().
373  */
374  axom::sidre::View *
375  GetNamedBuffer(const std::string& buffer_name) const
376  {
377  return named_buffers_grp()->hasView(buffer_name)
378  ? named_buffers_grp()->getView(buffer_name)
379  : NULL;
380  }
381 
382  /// Return newly allocated or existing named buffer for @a buffer_name.
383  /** The buffer is stored in the named_buffers group. If the currently
384  allocated buffer size is smaller than @a sz, then the buffer is
385  reallocated with size @a sz, destroying its contents.
386  @note To access the underlying pointer, use View::getData().
387  */
388  axom::sidre::View *
389  AllocNamedBuffer(const std::string& buffer_name,
390  axom::sidre::IndexType sz,
391  axom::sidre::TypeID type =
392  axom::sidre::DOUBLE_ID);
393 
394  /// Deallocate the named buffer @a buffer_name.
395  void FreeNamedBuffer(const std::string& buffer_name)
396  { named_buffers_grp()->destroyViewAndData(buffer_name); }
397 
398  ///@}
399 
400 private:
401  // Used if the Sidre data collection is providing the datastore itself.
402  const bool m_owns_datastore;
403 
404  // TODO - Need to evaluate if this bool member can be combined with own_data
405  // in parent data collection class. m_owns_mesh_data indicates whether the
406  // Sidre dc owns the mesh element data and node positions gf. The DC base
407  // class own_data indicates if the dc owns the mesh object pointer itself and
408  // GF objects. Can we use one flag and just have DC own all objects vs none?
409  const bool m_owns_mesh_data;
410 
411  // Name to be used for registering the mesh nodes in the SidreDataCollection.
412  // This name is used by SetMesh() and can be overwritten by the method
413  // SetMeshNodesName().
414  // Default value: "mesh_nodes".
415  std::string m_meshNodesGFName;
416 
417  // If the data collection owns the datastore, it will store a pointer to it.
418  // Otherwise, this pointer is NULL.
419  axom::sidre::DataStore * m_datastore_ptr;
420 
421 protected:
422  axom::sidre::Group *named_buffers_grp() const;
423 
424  axom::sidre::View *
425  alloc_view(axom::sidre::Group *grp,
426  const std::string &view_name);
427 
428  axom::sidre::View *
429  alloc_view(axom::sidre::Group *grp,
430  const std::string &view_name,
431  const axom::sidre::DataType &dtype);
432 
433  axom::sidre::Group *
434  alloc_group(axom::sidre::Group *grp,
435  const std::string &group_name);
436 
437  // return the filename based on prefix_path, collection name and cycle.
438  std::string get_file_path(const std::string &filename) const;
439 
440 private:
441  // If the data collection does not own the datastore, it will need pointers
442  // to the blueprint and blueprint index group to use.
443  axom::sidre::Group * m_bp_grp;
444  axom::sidre::Group * m_bp_index_grp;
445 
446  // This is stored for convenience.
447  axom::sidre::Group * m_named_bufs_grp;
448 
449  // Private helper functions
450 
451  void RegisterFieldInBPIndex(const std::string& field_name,
452  GridFunction *gf);
453  void DeregisterFieldInBPIndex(const std::string & field_name);
454 
455  void RegisterAttributeFieldInBPIndex(const std::string& attr_name);
456  void DeregisterAttributeFieldInBPIndex(const std::string& attr_name);
457 
458  /** @brief Return a string with the conduit blueprint name for the given
459  Element::Type. */
460  std::string getElementName( Element::Type elementEnum );
461 
462  /**
463  * \brief A private helper function to set up the views associated with the
464  data of a scalar valued grid function in the blueprint style.
465  * \pre gf is not null
466  * \note This function is expected to be called by RegisterField()
467  * \note Handles cases where hierarchy is already set up,
468  * where the data was allocated by this data collection
469  * and where the gridfunction data is external to Sidre
470  */
471  void addScalarBasedGridFunction(const std::string& field_name,
472  GridFunction* gf,
473  const std::string &buffer_name,
474  axom::sidre::IndexType offset);
475 
476  /**
477  * \brief A private helper function to set up the views associated with the
478  data of a vector valued grid function in the blueprint style.
479  * \pre gf is not null
480  * \note This function is expected to be called by RegisterField()
481  * \note Handles cases where hierarchy is already set up,
482  * where the data was allocated by this data collection
483  * and where the gridfunction data is external to Sidre
484  */
485  void addVectorBasedGridFunction(const std::string& field_name,
486  GridFunction* gf,
487  const std::string &buffer_name,
488  axom::sidre::IndexType offset);
489 
490  /** @brief A private helper function to set up the Views associated with
491  attribute field named @a field_name */
492  void addIntegerAttributeField(const std::string& field_name, bool is_bdry);
493 
494  /// Sets up the four main mesh blueprint groups.
495  /**
496  * \param hasBP Indicates whether the blueprint has already been set up.
497  */
498  void createMeshBlueprintStubs(bool hasBP);
499 
500  /// Sets up the mesh blueprint 'state' group.
501  /**
502  * \param hasBP Indicates whether the blueprint has already been set up.
503  */
504  void createMeshBlueprintState(bool hasBP);
505 
506  /// Sets up the mesh blueprint 'coordsets' group.
507  /**
508  * \param hasBP Indicates whether the blueprint has already been set up.
509  */
510  void createMeshBlueprintCoordset(bool hasBP);
511 
512  /// Sets up the mesh blueprint 'topologies' group.
513  /**
514  * This method is called from SetMesh().
515  * \param hasBP Indicates whether the blueprint has already been set up.
516  * \param mesh_name The name of the topology.
517  * \note Valid values for @a mesh_name are "mesh" and "boundary" and the
518  former has to be created with this method before the latter.
519  */
520  void createMeshBlueprintTopologies(bool hasBP, const std::string& mesh_name);
521 
522 #ifdef MFEM_USE_MPI
523  /// Sets up the mesh blueprint 'adjacencies' group.
524  /**
525  * \param hasBP Indicates whether the blueprint has already been set up.
526  * \note Only valid when using parallel meshes
527  */
528  void createMeshBlueprintAdjacencies(bool hasBP);
529 #endif
530 
531  /// Verifies that the contents of the mesh blueprint data is valid.
532  void verifyMeshBlueprint();
533 };
534 
535 } // end namespace mfem
536 
537 #endif
538 
539 #endif
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.
Definition: gridfunc.hpp:30
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.
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.
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.
Definition: element.hpp:41
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&#39;s cycle, time, and time-step variables with the values from the SidreDataColle...
NamedFieldsMap< Array< int > > AttributeFieldMap
void UpdateStateFromDS()
Updates the DataCollection&#39;s cycle, time, and time-step variables with the values from the data store...
virtual ~SidreDataCollection()
Delete all owned data.
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.
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.
virtual void Load(int cycle_=0)
Load SidreDataCollection from file.
void DeregisterAttributeField(const std::string &name)
axom::sidre::Group * named_buffers_grp() const