13 #include "../config/config.hpp"
20 #include <spio/IOManager.hpp>
27 namespace sidre = axom::sidre;
35 Mesh * the_mesh,
bool own_mesh_data)
37 m_owns_datastore(true),
38 m_owns_mesh_data(own_mesh_data),
39 m_meshNodesGFName(
"mesh_nodes")
41 m_datastore_ptr =
new sidre::DataStore();
43 sidre::Group * global_grp =
44 m_datastore_ptr->getRoot()->createGroup(collection_name +
"_global");
45 sidre::Group * domain_grp =
46 m_datastore_ptr->getRoot()->createGroup(collection_name);
48 bp_grp = domain_grp->createGroup(
"blueprint");
50 bp_index_grp = global_grp->createGroup(
"blueprint_index/" +
name);
52 named_bufs_grp = domain_grp->createGroup(
"named_buffers");
61 m_comm = MPI_COMM_NULL;
73 axom::sidre::Group* global_grp,
74 axom::sidre::Group* domain_grp,
77 m_owns_datastore(false),
78 m_owns_mesh_data(own_mesh_data),
79 m_meshNodesGFName(
"mesh_nodes"),
82 bp_grp = domain_grp->createGroup(
"blueprint");
85 bp_index_grp = global_grp->createGroup(
"blueprint_index/" +
name);
87 named_bufs_grp = domain_grp->createGroup(
"named_buffers");
90 m_comm = MPI_COMM_NULL;
98 delete m_datastore_ptr;
108 MPI_Comm_rank(m_comm, &
myid);
116 MFEM_ASSERT(named_bufs_grp != NULL,
117 "No group 'named_buffers' in data collection. Verify that"
118 " SetMesh was called to set the mesh in the data collection.");
119 return named_bufs_grp;
125 const std::string &view_name)
127 MFEM_ASSERT(grp,
"Group pointer is NULL");
128 sidre::View *v = NULL;
130 if (! grp->hasView(view_name) )
132 v = grp->createView(view_name);
133 MFEM_ASSERT(v,
"error allocating View " << view_name
134 <<
" in group " << grp->getPathName());
138 v = grp->getView(view_name);
147 const std::string &view_name,
148 const axom::sidre::DataType &dtype)
150 MFEM_ASSERT(grp,
"Group pointer is NULL");
151 sidre::View *v = NULL;
153 if (! grp->hasView(view_name))
155 v = grp->createView(view_name, dtype);
156 MFEM_ASSERT(v,
"error allocating View " << view_name
157 <<
" in group " << grp->getPathName());
161 v = grp->getView(view_name);
162 MFEM_ASSERT(v->getSchema().dtype().equals(dtype),
"");
170 const std::string &group_name)
172 MFEM_ASSERT(grp,
"Group pointer is NULL");
173 sidre::Group *g = NULL;
175 if (! grp->hasGroup(group_name) )
177 g = grp->createGroup(group_name);
178 MFEM_ASSERT(g,
"error allocating Group " << group_name
179 <<
" in group " << grp->getPathName());
183 g = grp->getGroup(group_name);
192 std::stringstream fNameSstr;
203 return fNameSstr.str();
208 axom::sidre::SidreLength sz,
209 axom::sidre::TypeID type)
211 sz = std::max(sz, sidre::SidreLength(0));
213 sidre::View *v = NULL;
215 if (! f->hasView(buffer_name) )
218 v = f->createViewAndAllocate(buffer_name, type, sz);
222 v = f->getView(buffer_name);
223 MFEM_ASSERT(v->getTypeID() == type,
"type does not match existing type");
229 if (!v->isApplied() || v->getNumElements() < sz)
233 sidre::DataType dtype(v->getSchema().dtype());
234 dtype.set_number_of_elements(sz);
235 f->destroyViewAndData(buffer_name);
236 v = f->createViewAndAllocate(buffer_name, dtype);
239 MFEM_ASSERT(v && v->isApplied(),
"allocation failed");
244 void SidreDataCollection::createMeshBlueprintStubs(
bool hasBP)
248 bp_grp->createGroup(
"state");
249 bp_grp->createGroup(
"coordsets");
250 bp_grp->createGroup(
"topologies");
251 bp_grp->createGroup(
"fields");
257 bp_index_grp->createGroup(
"state");
258 bp_index_grp->createGroup(
"coordsets");
259 bp_index_grp->createGroup(
"topologies");
260 bp_index_grp->createGroup(
"fields");
265 void SidreDataCollection::createMeshBlueprintState(
bool hasBP)
270 bp_grp->createViewScalar(
"state/cycle", 0);
271 bp_grp->createViewScalar(
"state/time", 0.);
272 bp_grp->createViewScalar(
"state/domain",
myid);
273 bp_grp->createViewScalar(
"state/time_step", 0.);
279 bp_index_grp->createViewScalar(
"state/cycle", 0);
280 bp_index_grp->createViewScalar(
"state/time", 0.);
281 bp_index_grp->createViewScalar(
"state/number_of_domains",
num_procs);
286 void SidreDataCollection::createMeshBlueprintCoordset(
bool hasBP)
289 MFEM_ASSERT(dim >= 1 && dim <= 3,
"invalid mesh dimension");
292 const int NUM_COORDS =
sizeof(
mfem::Vertex) /
sizeof(
double);
295 const int coordset_len = NUM_COORDS * num_vertices;
300 bp_grp->createViewString(
"coordsets/coords/type",
"explicit");
302 sidre::DataType dtype =
303 sidre::DataType::c_double(num_vertices);
304 const size_t stride = dtype.stride();
305 dtype.set_stride(stride*NUM_COORDS);
308 sidre::View *vx, *vy = NULL, *vz = NULL;
309 vx = bp_grp->createView(
"coordsets/coords/values/x", dtype);
313 dtype.set_offset(dtype.offset() + stride);
314 vy = bp_grp->createView(
"coordsets/coords/values/y", dtype);
318 dtype.set_offset(dtype.offset() + stride);
319 vz = bp_grp->createView(
"coordsets/coords/values/z", dtype);
322 if (m_owns_mesh_data)
325 sidre::Buffer* coordbuf =
328 vx->attachBuffer(coordbuf);
329 if (dim >= 2) { vy->attachBuffer(coordbuf); }
330 if (dim >= 3) { vz->attachBuffer(coordbuf); }
336 vx->setExternalDataPtr(coordbuf);
337 if (dim >= 2) { vy->setExternalDataPtr(coordbuf); }
338 if (dim >= 3) { vz->setExternalDataPtr(coordbuf); }
346 bp_index_grp->createViewString(
347 "coordsets/coords/path", bp_grp->getPathName() +
"/coordsets/coords");
349 bp_index_grp->getGroup(
"coordsets/coords")->copyView(
350 bp_grp->getView(
"coordsets/coords/type") );
352 bp_index_grp->createViewString(
353 "coordsets/coords/coord_system/type",
"cartesian");
357 bp_index_grp->createView(
"coordsets/coords/coord_system/axes/x");
361 bp_index_grp->createView(
"coordsets/coords/coord_system/axes/y");
366 bp_index_grp->createView(
"coordsets/coords/coord_system/axes/z");
370 if (m_owns_mesh_data)
372 double *coord_values =
GetNamedBuffer(
"vertex_coords")->getData();
379 void SidreDataCollection::
380 createMeshBlueprintTopologies(
bool hasBP,
const std::string& mesh_name)
382 const bool isBdry = (mesh_name ==
"boundary");
384 const int num_elements = !isBdry
388 MFEM_VERIFY(num_elements > 0,
389 "TODO: processors with 0 " << mesh_name <<
" elements");
391 const int element_size = !isBdry
395 const int num_indices = num_elements * element_size;
403 const std::string eltTypeStr =
405 ? getElementName( static_cast<Element::Type>(
407 : getElementName( static_cast<Element::Type>(
408 mesh->GetBdrElement(0)->GetType() ) );
410 const std::string mesh_topo_str =
"topologies/" + mesh_name;
411 const std::string mesh_attr_str =
"fields/"+mesh_name+
"_material_attribute";
415 sidre::Group* topology_grp = bp_grp->createGroup(mesh_topo_str);
418 topology_grp->createViewString(
"type",
"unstructured");
420 topology_grp->createViewString(
"elements/shape", eltTypeStr);
421 topology_grp->createViewAndAllocate(
422 "elements/connectivity", sidre::INT_ID, num_indices);
423 topology_grp->createViewString(
"coordset",
"coords");
429 topology_grp->createViewString(
"grid_function",m_meshNodesGFName);
433 sidre::Group* attr_grp = bp_grp->createGroup(mesh_attr_str);
434 attr_grp->createViewString(
"association",
"element");
435 attr_grp->createViewAndAllocate(
"values", sidre::INT_ID, num_elements);
436 attr_grp->createViewString(
"topology", mesh_name);
443 const std::string bp_grp_path = bp_grp->getPathName();
451 bp_index_grp->getGroup(
"topologies/mesh")
452 ->copyView( bp_grp->getView(
"topologies/mesh/boundary_topology") );
455 sidre::Group *bp_index_topo_grp =
456 bp_index_grp->createGroup(mesh_topo_str);
457 sidre::Group *topology_grp = bp_grp->getGroup(mesh_topo_str);
459 bp_index_topo_grp->createViewString(
460 "path", bp_grp_path +
"/" + mesh_topo_str);
461 bp_index_topo_grp->copyView( topology_grp->getView(
"type") );
462 bp_index_topo_grp->copyView( topology_grp->getView(
"coordset") );
468 bp_index_topo_grp->copyView(topology_grp->getView(
"grid_function"));
472 sidre::Group *bp_index_attr_grp =
473 bp_index_grp->createGroup(mesh_attr_str);
474 sidre::Group *attr_grp = bp_grp->getGroup(mesh_attr_str);
476 bp_index_attr_grp->createViewString(
477 "path", bp_grp_path +
"/" + mesh_attr_str );
478 bp_index_attr_grp->copyView( attr_grp->getView(
"association") );
479 bp_index_attr_grp->copyView( attr_grp->getView(
"topology") );
481 int number_of_components = 1;
482 bp_index_attr_grp->createViewScalar(
"number_of_components",
483 number_of_components);
487 sidre::View* conn_view =
488 bp_grp->getGroup(mesh_topo_str)->getView(
"elements/connectivity");
489 sidre::View* attr_view =
490 bp_grp->getGroup(mesh_attr_str)->getView(
"values");
492 Array<int> conn_array(conn_view->getData<
int*>(), num_indices);
493 Array<int> attr_array(attr_view->getData<
int*>(), num_elements);
502 MFEM_ASSERT(!conn_array.OwnsData(),
"");
503 MFEM_ASSERT(!attr_array.OwnsData(),
"");
508 void SidreDataCollection::createMeshBlueprintAdjacencies(
bool hasBP)
510 ParMesh *pmesh =
dynamic_cast<ParMesh*
>(
mesh);
512 const int GRP_SZ = 25;
513 char group_str[GRP_SZ];
517 MFEM_VERIFY(hasBP ==
false,
"The case hasBP == true is not supported yet!");
519 sidre::Group* adjset_grp = NULL;
520 if (pmesh->GetNGroups() > 1)
522 adjset_grp = bp_grp->createGroup(
"adjsets/mesh");
523 adjset_grp->createViewString(
"association",
"vertex");
524 adjset_grp->createViewString(
"topology",
"mesh");
526 if (
myid == 0) { bp_index_grp->createGroup(
"adjsets"); }
529 for (
int gi = 1; gi < pmesh->GetNGroups(); ++gi)
531 int num_gneighbors = pmesh->gtopo.GetGroupSize(gi);
532 int num_gvertices = pmesh->GroupNVertices(gi);
535 if (num_gneighbors > 1 && num_gvertices > 0)
537 std::snprintf(group_str, GRP_SZ,
"groups/g%d_%d",
538 pmesh->gtopo.GetGroupMasterRank(gi),
539 pmesh->gtopo.GetGroupMasterGroup(gi));
540 sidre::Group* group_grp = adjset_grp->createGroup(group_str);
542 sidre::View* gneighbors_view =
543 group_grp->createViewAndAllocate(
544 "neighbors", sidre::INT_ID, num_gneighbors - 1);
545 int* gneighbors_data = gneighbors_view->getData<
int*>();
548 const int* gneighbors = pmesh->gtopo.GetGroup(gi);
549 for (
int ni = 0, noff = 0; ni < num_gneighbors; ++ni)
551 if ( gneighbors[ni] == 0 )
557 gneighbors_data[ni - noff] =
558 pmesh->gtopo.GetNeighborRank(gneighbors[ni]);
562 sidre::View* gvertices_view =
563 group_grp->createViewAndAllocate(
564 "values", sidre::INT_ID, num_gvertices);
565 int* gvertices_data = gvertices_view->getData<
int*>();
567 for (
int vi = 0; vi < num_gvertices; ++vi)
569 gvertices_data[vi] = pmesh->GroupVertex(gi, vi);
577 void SidreDataCollection::verifyMeshBlueprint()
589 bool hasBP = bp_grp->getNumViews() > 0 || bp_grp->getNumGroups() > 0;
590 bool has_bnd_elts = (new_mesh->
GetNBE() > 0);
592 createMeshBlueprintStubs(hasBP);
593 createMeshBlueprintState(hasBP);
594 createMeshBlueprintCoordset(hasBP);
599 createMeshBlueprintTopologies(hasBP,
"mesh");
604 bp_grp->createViewString(
"topologies/mesh/boundary_topology",
"boundary");
607 createMeshBlueprintTopologies(hasBP,
"boundary");
612 m_comm = new_pmesh ? new_pmesh->
GetComm() : MPI_COMM_NULL;
615 createMeshBlueprintAdjacencies(hasBP);
625 sidre::View *v_bp_nodes_name =
626 bp_grp->getView(
"topologies/mesh/grid_function");
627 std::string bp_nodes_name(v_bp_nodes_name->getString());
630 MFEM_VERIFY(m_meshNodesGFName == bp_nodes_name,
631 "mismatch of requested and blueprint mesh nodes names");
635 if (m_owns_mesh_data)
646 MFEM_ASSERT(nodes->
Size() == sz,
"");
647 std::memcpy(gfData, nodes->
GetData(),
sizeof(double) * sz);
668 MFEM_VERIFY(new_mesh->
OwnsNodes(),
"mesh does not own its nodes, "
669 "can not take ownership");
677 axom::sidre::Group *domain_grp)
679 MFEM_VERIFY(domain_grp->hasGroup(
"blueprint"),
680 "Domain group does not contain a blueprint group.");
681 MFEM_VERIFY(global_grp->hasGroup(
"blueprint_index/" +
name),
682 "Global group does not contain a blueprint index group.");
684 bp_grp = domain_grp->getGroup(
"blueprint");
685 bp_index_grp = global_grp->getGroup(
"blueprint_index/" +
name);
686 named_bufs_grp = domain_grp->getGroup(
"named_buffers");
690 const std::string& protocol)
696 if (m_comm != MPI_COMM_NULL)
698 axom::spio::IOManager reader(m_comm);
699 reader.read(bp_grp->getDataStore()->getRoot(), path);
704 bp_grp->load(path, protocol);
713 if (m_owns_datastore)
716 m_datastore_ptr->getRoot()->getGroup(
name));
725 if (m_comm != MPI_COMM_NULL)
727 axom::spio::IOManager reader(m_comm);
728 reader.loadExternalData(bp_grp->getDataStore()->getRoot(), path);
733 bp_grp->loadExternalData(path);
739 SetTime( bp_grp->getView(
"state/time")->getData<
double>() );
740 SetCycle( bp_grp->getView(
"state/cycle")->getData<
int>() );
741 SetTimeStep( bp_grp->getView(
"state/time_step")->getData<
double>() );
746 bp_grp->getView(
"state/cycle")->setScalar(
GetCycle());
747 bp_grp->getView(
"state/time")->setScalar(
GetTime());
748 bp_grp->getView(
"state/time_step")->setScalar(
GetTimeStep());
752 bp_index_grp->getView(
"state/cycle")->setScalar(
GetCycle());
753 bp_index_grp->getView(
"state/time")->setScalar(
time);
759 verifyMeshBlueprint();
765 std::string filename =
name;
766 std::string protocol =
"sidre_hdf5";
768 Save(filename, protocol);
772 const std::string& protocol)
780 sidre::Group * blueprint_indicies_grp = bp_index_grp->getParent();
782 if (m_comm != MPI_COMM_NULL)
784 axom::spio::IOManager writer(m_comm);
785 sidre::DataStore *datastore = bp_grp->getDataStore();
786 writer.write(datastore->getRoot(),
num_procs, file_path, protocol);
789 if (protocol ==
"sidre_hdf5")
791 writer.writeGroupToRootFile(blueprint_indicies_grp,
792 file_path +
".root");
797 writer.write(blueprint_indicies_grp, 1,
798 file_path +
".root", protocol);
806 bp_grp->save(file_path, protocol);
808 blueprint_indicies_grp
809 ->save(file_path +
".root", protocol);
814 void SidreDataCollection::
815 addScalarBasedGridFunction(
const std::string &field_name,
GridFunction *gf,
816 const std::string &buffer_name,
817 axom::sidre::SidreLength offset)
819 sidre::Group* grp = bp_grp->getGroup(
"fields/" + field_name);
820 MFEM_ASSERT(grp != NULL,
"field " << field_name <<
" does not exist");
847 MFEM_ASSERT(bv->hasBuffer() && bv->isDescribed(),
"");
850 MFEM_ASSERT(bv->getSchema().dtype().offset() == 0,
"");
851 MFEM_ASSERT(bv->getNumElements() >= offset + numDofs,
"");
855 vv->attachBuffer(bv->getBuffer())
856 ->apply(sidre::DOUBLE_ID, numDofs, offset);
865 vv->setExternalDataPtr(sidre::DOUBLE_ID, numDofs, gf->
GetData());
867 MFEM_ASSERT((numDofs > 0 && vv->isApplied()) ||
868 (numDofs == 0 && vv->isEmpty() && vv->isDescribed()),
869 "invalid View state");
870 MFEM_ASSERT(numDofs == 0 || vv->getData() == gf->
GetData(),
871 "View data is different from GridFunction data");
872 MFEM_ASSERT(vv->getNumElements() == numDofs,
873 "View size is different from GridFunction size");
877 void SidreDataCollection::
878 addVectorBasedGridFunction(
const std::string& field_name, GridFunction *gf,
879 const std::string &buffer_name,
880 axom::sidre::SidreLength offset)
882 sidre::Group* grp = bp_grp->getGroup(
"fields/" + field_name);
883 MFEM_ASSERT(grp != NULL,
"field " << field_name <<
" does not exist");
885 const int FLD_SZ = 20;
886 char fidxName[FLD_SZ];
888 int vdim = gf->FESpace()->GetVDim();
889 int ndof = gf->FESpace()->GetNDofs();
892 if (gf->GetData() == NULL)
915 sidre::DataType dtype = sidre::DataType::c_double(ndof);
918 dtype.set_stride(dtype.stride()*entry_stride);
923 MFEM_ASSERT(bv->hasBuffer() && bv->isDescribed(),
"");
926 MFEM_ASSERT(bv->getSchema().dtype().offset() == 0,
"");
927 dtype.set_offset(dtype.element_bytes()*offset);
929 for (
int d = 0; d < vdim; d++)
931 std::snprintf(fidxName, FLD_SZ,
"x%d", d);
932 sidre::View *xv =
alloc_view(vg, fidxName, dtype);
933 xv->attachBuffer(bv->getBuffer());
934 dtype.set_offset(dtype.offset() + dtype.element_bytes()*vdim_stride);
937 gf->NewDataAndSize(bv->getData<
double*>() + offset, vdim*ndof);
941 for (
int d = 0; d < vdim; d++)
943 std::snprintf(fidxName, FLD_SZ,
"x%d", d);
944 sidre::View *xv =
alloc_view(vg, fidxName, dtype);
945 xv->setExternalDataPtr(gf->GetData());
946 dtype.set_offset(dtype.offset() + dtype.element_bytes()*vdim_stride);
951 for (
int d = 0; d < vdim; d++)
953 std::snprintf(fidxName, FLD_SZ,
"x%d", d);
954 sidre::View *xv = vg->getView(fidxName);
955 MFEM_ASSERT((ndof > 0 && xv->isApplied()) ||
956 (ndof == 0 && xv->isEmpty() && xv->isDescribed()),
957 "invalid View state");
958 MFEM_ASSERT(ndof == 0 || xv->getData() == gf->GetData() + d*vdim_stride,
959 "View data is different from GridFunction data");
960 MFEM_ASSERT(xv->getNumElements() == ndof,
961 "View size is different from GridFunction size");
968 void SidreDataCollection::
969 RegisterFieldInBPIndex(
const std::string& field_name, GridFunction *gf)
971 sidre::Group *bp_field_grp = bp_grp->getGroup(
"fields/" + field_name);
972 sidre::Group *bp_index_field_grp =
973 bp_index_grp->createGroup(
"fields/" + field_name);
975 bp_index_field_grp->createViewString(
"path", bp_field_grp->getPathName() );
976 bp_index_field_grp->copyView( bp_field_grp->getView(
"topology") );
977 bp_index_field_grp->copyView( bp_field_grp->getView(
"basis") );
982 const int number_of_components = gf->VectorDim();
983 bp_index_field_grp->createViewScalar(
"number_of_components",
984 number_of_components);
989 void SidreDataCollection::
990 DeregisterFieldInBPIndex(
const std::string& field_name)
992 sidre::Group * fields_grp = bp_index_grp->getGroup(
"fields");
993 MFEM_VERIFY(fields_grp->hasGroup(field_name),
994 "No field exists in blueprint index with name " <<
name);
999 fields_grp->destroyGroup(field_name);
1004 const std::string &buffer_name,
1005 axom::sidre::SidreLength offset)
1007 if ( field_name.empty() || buffer_name.empty() ||
1008 gf == NULL || gf->
FESpace() == NULL )
1014 sidre::Group* f = bp_grp->getGroup(
"fields");
1016 if (f->hasGroup( field_name ))
1028 if (field_name != m_meshNodesGFName)
1030 MFEM_WARNING(
"field with the name '" << field_name<<
"' is already "
1031 "registered, overwriting the old field");
1038 sidre::Group* grp = f->createGroup( field_name );
1048 v =
alloc_view(grp,
"topology")->setString(
"mesh");
1051 "GridFunction size does not match FiniteElementSpace size");
1060 addScalarBasedGridFunction(field_name, gf, buffer_name, offset);
1065 addVectorBasedGridFunction(field_name, gf, buffer_name, offset);
1071 RegisterFieldInBPIndex(field_name, gf);
1083 sidre::Group * fields_grp = bp_grp->getGroup(
"fields");
1084 MFEM_VERIFY(fields_grp->hasGroup(field_name),
1085 "No field exists in blueprint with name " << field_name);
1092 fields_grp->destroyGroup(field_name);
1097 DeregisterFieldInBPIndex(field_name);
1105 std::string SidreDataCollection::getElementName(
Element::Type elementEnum)
1112 switch (elementEnum)
axom::sidre::View * alloc_view(axom::sidre::Group *grp, const std::string &view_name)
const double * GetVertex(int i) const
Return pointer to vertex i's coordinates.
void NewDataAndSize(double *d, int s)
Set the Vector data and size, deleting the old data, if owned.
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)
double GetTime() const
Get physical time (for time-dependent simulations)
bool appendRankToFileName
Append rank to any output file names.
virtual void SetMesh(Mesh *new_mesh)
Set/change the mesh associated with the collection.
void DeleteAll()
Delete data owned by the DataCollection including field information.
virtual void RegisterField(const std::string &field_name, GridFunction *gf)
Register a GridFunction in the Sidre DataStore.
int GetNBE() const
Returns number of boundary elements.
int pad_digits_cycle
Number of digits used for the cycle and MPI rank in filenames.
int Size() const
Returns the size of the vector.
int GetNE() const
Returns number of elements.
bool HasField(const std::string &name) const
Check if a grid function is part of the collection.
virtual void DeregisterField(const std::string &field_name)
Remove a grid function from the collection.
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.
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.
bool own_data
Should the collection delete its mesh and fields.
axom::sidre::View * GetNamedBuffer(const std::string &buffer_name) const
Get a pointer to the sidre::View holding the named buffer for buffer_name.
double GetTimeStep() const
Get the simulation time step (for time-dependent simulations)
double time
Physical time (for time-dependent simulations)
Mesh * mesh
The (common) mesh for the collected fields.
bool serial
Serial or parallel run?
int GetCycle() const
Get time cycle (for time-dependent simulations)
Type
Constants for the classes derived from Element.
static int create_directory(const std::string &dir_name, const Mesh *mesh, int myid)
void SetNodesOwner(bool nodes_owner)
Set the mesh nodes ownership flag.
const Element * GetElement(int i) const
void SetGroupPointers(axom::sidre::Group *global_grp, axom::sidre::Group *domain_grp)
Reset the domain and global datastore group pointers.
int GetVDim() const
Returns vector dimension.
FiniteElementSpace * FESpace()
void UpdateStateToDS()
Updates the data store's cycle, time, and time-step variables with the values from the SidreDataColle...
void SetTime(double t)
Set physical time (for time-dependent simulations)
int SpaceDimension() const
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.
int myid
MPI rank (in parallel)
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)
int GetElementBaseGeometry(int i=0) const
int GetNV() const
Returns number of vertices. Vertices are only at the corners of elements, where you would expect them...
void SetTimeStep(double ts)
Set the simulation time step (for time-dependent simulations)
virtual const char * Name() const
bool OwnsNodes() const
Return the mesh nodes ownership flag.
const FiniteElementSpace * GetNodalFESpace() const
void GetBdrElementData(int geom, Array< int > &bdr_elem_vtx, Array< int > &bdr_attr) const
virtual void Save()
Save the collection to file.
virtual int GetNVertices() const =0
void FreeNamedBuffer(const std::string &buffer_name)
Deallocate the named buffer buffer_name.
const FiniteElementCollection * FEColl() const
void GetNodes(Vector &node_coord) const
void SetComm(MPI_Comm comm)
Associate an MPI communicator with the collection.
virtual void SetMesh(Mesh *new_mesh)
Set/change the mesh associated with the collection.
void ChangeVertexDataOwnership(double *vertices, int len_vertices, bool zerocopy=false)
Set the internal Vertex array to point to the given vertices array without assuming ownership of the ...
virtual void RegisterField(const std::string &field_name, GridFunction *gf)
Add a grid function to the collection.
std::string name
Name of the collection, used as a directory name when saving.
int num_procs
Number of MPI ranks (in parallel)
Class for parallel meshes.
int GetBdrElementBaseGeometry(int i=0) const
const Element * GetBdrElement(int i) const
void GetElementData(const Array< Element * > &elem_array, int geom, Array< int > &elem_vtx, Array< int > &attr) const
virtual int GetType() const =0
Returns element's type.
axom::sidre::Group * named_buffers_grp() const