14#ifdef MFEM_USE_CONDUIT
18#include <conduit_relay.hpp>
19#include <conduit_blueprint.hpp>
24using namespace conduit;
41 relay_protocol(
"hdf5")
50 const std::string& coll_name,
53 relay_protocol(
"hdf5")
56 MPI_Comm_rank(comm, &
myid);
76 MFEM_ABORT(
"Error creating directory: " << dir_name);
85 if (!blueprint::mesh::verify(n_mesh,verify_info))
87 MFEM_ABORT(
"Conduit Mesh Blueprint Verify Failed:\n"
88 << verify_info.to_json());
95 std::string
name = itr->first;
103 n_mesh[
"fields"][
name]);
111 std::string
name = qf_itr->first;
114 n_mesh[
"fields"][
name]);
147 int num_domains = n_root[
"number_of_trees"].to_int();
152 MFEM_WARNING(
"num_procs must equal num_domains");
173#if defined(MFEM_USE_DOUBLE)
174 CONDUIT_NATIVE_DOUBLE_ID;
175#elif defined(MFEM_USE_SINGLE)
178#error Unknown MFEM precision
188 const std::string &main_toplogy_name,
201 std::string topo_name = main_toplogy_name;
205 topo_name = n_mesh[
"topologies"].schema().child_name(0);
208 MFEM_ASSERT(n_mesh.has_path(
"topologies/" + topo_name),
209 "Expected topology named \"" + topo_name +
"\" "
210 "(node is missing path \"topologies/" + topo_name +
"\")");
213 std::string coords_name =
214 n_mesh[
"topologies"][topo_name][
"coordset"].as_string();
217 MFEM_ASSERT(n_mesh.has_path(
"coordsets/" + coords_name),
218 "Expected topology named \"" + coords_name +
"\" "
219 "(node is missing path \"coordsets/" + coords_name +
"\")");
221 const Node &n_coordset = n_mesh[
"coordsets"][coords_name];
222 const Node &n_coordset_vals = n_coordset[
"values"];
225 int ndims = n_coordset_vals.number_of_children();
228 int num_verts = n_coordset_vals[0].dtype().number_of_elements();
230 const real_t *verts_ptr = NULL;
239 blueprint::mcarray::is_interleaved(n_coordset_vals) )
243 verts_ptr = n_coordset_vals[0].value();
250 NodeConstIterator itr = n_coordset_vals.children();
251 while (itr.has_next())
253 const Node &c_vals = itr.next();
254 std::string c_name = itr.name();
259 n_tmp[c_name].set_external(c_vals);
282 Node &n_conv_coords_vals = n_conv[
"coordsets"][coords_name][
"values"];
283 blueprint::mcarray::to_interleaved(n_tmp,
285 verts_ptr = n_conv_coords_vals[0].value();
290 const Node &n_mesh_topo = n_mesh[
"topologies"][topo_name];
291 std::string mesh_ele_shape = n_mesh_topo[
"elements/shape"].as_string();
296 const Node &n_mesh_conn = n_mesh_topo[
"elements/connectivity"];
298 const int *elem_indices = NULL;
300 if (n_mesh_conn.dtype().is_int() &&
301 n_mesh_conn.is_compact() )
303 elem_indices = n_mesh_topo[
"elements/connectivity"].value();
307 Node &n_mesh_conn_conv=
308 n_conv[
"topologies"][topo_name][
"elements/connectivity"];
309 n_mesh_conn.to_int_array(n_mesh_conn_conv);
310 elem_indices = n_mesh_conn_conv.value();
314 n_mesh_topo[
"elements/connectivity"].dtype().number_of_elements();
315 num_mesh_ele = num_mesh_ele / num_idxs_per_ele;
318 const int *bndry_indices = NULL;
319 int num_bndry_ele = 0;
324 if ( n_mesh_topo.has_child(
"boundary_topology") )
326 std::string bndry_topo_name = n_mesh_topo[
"boundary_topology"].as_string();
335 if (n_mesh[
"topologies"].has_child(bndry_topo_name))
337 const Node &n_bndry_topo = n_mesh[
"topologies"][bndry_topo_name];
338 std::string bndry_ele_shape = n_bndry_topo[
"elements/shape"].as_string();
340 bndry_geo = ShapeNameToGeomType(bndry_ele_shape);
343 const Node &n_bndry_conn = n_bndry_topo[
"elements/connectivity"];
346 if ( n_bndry_conn.dtype().is_int() &&
347 n_bndry_conn.is_compact())
349 bndry_indices = n_bndry_conn.value();
353 Node &n_bndry_conn_conv =
354 n_conv[
"topologies"][bndry_topo_name][
"elements/connectivity"];
355 n_bndry_conn.to_int_array(n_bndry_conn_conv);
356 bndry_indices = (n_bndry_conn_conv).value();
361 n_bndry_topo[
"elements/connectivity"].dtype().number_of_elements();
362 num_bndry_ele = num_bndry_ele / num_idxs_per_bndry_ele;
370 const int *mesh_atts = NULL;
371 const int *bndry_atts = NULL;
380 std::string main_att_name =
"";
382 const Node &n_fields = n_mesh[
"fields"];
383 NodeConstIterator itr = n_fields.children();
385 while ( itr.has_next() && main_att_name ==
"" )
388 std::string fld_name = itr.name();
389 if ( fld_name.find(
"boundary") == std::string::npos &&
390 fld_name.find(
"_attribute") != std::string::npos )
392 main_att_name = fld_name;
396 if ( main_att_name !=
"" )
398 const Node &n_mesh_atts_vals = n_fields[main_att_name][
"values"];
401 if (n_mesh_atts_vals.dtype().is_int() &&
402 n_mesh_atts_vals.is_compact() )
404 mesh_atts = n_mesh_atts_vals.value();
408 Node &n_mesh_atts_vals_conv = n_conv[
"fields"][main_att_name][
"values"];
409 n_mesh_atts_vals.to_int_array(n_mesh_atts_vals_conv);
410 mesh_atts = n_mesh_atts_vals_conv.value();
422 std::string bnd_att_name =
"";
423 itr = n_fields.children();
425 while ( itr.has_next() && bnd_att_name ==
"" )
428 std::string fld_name = itr.name();
429 if ( fld_name.find(
"boundary") != std::string::npos &&
430 fld_name.find(
"_attribute") != std::string::npos )
432 bnd_att_name = fld_name;
436 if ( bnd_att_name !=
"" )
439 const Node &n_bndry_atts_vals =n_fields[bnd_att_name][
"values"];
442 if ( n_bndry_atts_vals.dtype().is_int() &&
443 n_bndry_atts_vals.is_compact())
445 bndry_atts = n_bndry_atts_vals.value();
449 Node &n_bndry_atts_vals_conv = n_conv[
"fields"][bnd_att_name][
"values"];
450 n_bndry_atts_vals.to_int_array(n_bndry_atts_vals_conv);
451 bndry_atts = n_bndry_atts_vals_conv.value();
475 const_cast<real_t*
>(verts_ptr),
478 const_cast<int*
>(elem_indices),
481 const_cast<int*
>(mesh_atts),
484 const_cast<int*
>(bndry_indices),
487 const_cast<int*
>(bndry_atts),
493 if (n_mesh_topo.has_child(
"grid_function"))
495 std::string nodes_gf_name = n_mesh_topo[
"grid_function"].as_string();
498 const Node &n_mesh_gf = n_mesh[
"fields"][nodes_gf_name];
507 if (zero_copy && !n_conv.dtype().is_empty())
542 const real_t *vals_ptr = NULL;
548 if (n_field[
"values"].dtype().is_object())
550 vdim = n_field[
"values"].number_of_children();
558 if (n_field[
"values"].is_contiguous())
561 vals_ptr = n_field[
"values"].child(0).value();
564 else if (blueprint::mcarray::is_interleaved(n_field[
"values"]))
568 vals_ptr = n_field[
"values"].child(0).value();
574 blueprint::mcarray::to_contiguous(n_field[
"values"],
576 vals_ptr = n_conv[
"values"].child(0).value();
584 NodeConstIterator itr = n_field[
"values"].children();
585 while (itr.has_next())
587 const Node &c_vals = itr.next();
588 std::string c_name = itr.name();
593 n_tmp[c_name].set_external(c_vals);
604 blueprint::mcarray::to_contiguous(n_tmp,
606 vals_ptr = n_conv[
"values"].child(0).value();
612 n_field[
"values"].is_compact())
614 vals_ptr = n_field[
"values"].value();
620 vals_ptr = n_conv[
"values"].value();
624 if (zero_copy && !n_conv.dtype().is_empty())
631 std::string fec_name = n_field[
"basis"].as_string();
674 const real_t *vals_ptr = NULL;
677 if (n_field[
"values"].dtype().is_object())
679 vdim = n_field[
"values"].number_of_children();
688 if (blueprint::mcarray::is_interleaved(n_field[
"values"]))
691 vals_ptr = n_field[
"values"].child(0).value();
697 blueprint::mcarray::to_interleaved(n_field[
"values"],
699 vals_ptr = n_conv[
"values"].child(0).value();
707 NodeConstIterator itr = n_field[
"values"].children();
708 while (itr.has_next())
710 const Node &c_vals = itr.next();
711 std::string c_name = itr.name();
716 n_tmp[c_name].set_external(c_vals);
727 blueprint::mcarray::to_interleaved(n_tmp,
729 vals_ptr = n_conv[
"values"].child(0).value();
735 n_field[
"values"].is_compact())
737 vals_ptr = n_field[
"values"].value();
743 vals_ptr = n_conv[
"values"].value();
747 if (zero_copy && !n_conv.dtype().is_empty())
761 std::string qf_name = n_field[
"basis"].as_string();
762 const char *qf_name_cstr = qf_name.c_str();
763 if (!strncmp(qf_name_cstr,
"QF_", 3))
766 qf_order = atoi(qf_name_cstr + 3);
768 const char *qf_vdim_cstr = strstr(qf_name_cstr+3,
"_");
769 if (qf_vdim_cstr == NULL)
771 MFEM_ABORT(
"Error parsing quadrature function description string: "
772 << qf_name << std::endl
773 <<
"Expected: QF_{ORDER}_{VDIM}");
776 qf_vdim = atoi(qf_vdim_cstr+1);
780 MFEM_ABORT(
"Error parsing quadrature function description string: "
781 << qf_name << std::endl
782 <<
"Expected: QF_{ORDER}_{VDIM}");
784 MFEM_VERIFY(qf_vdim == vdim,
"vector dimension mismatch: vdim = " << vdim
785 <<
", qf_vdim = " << qf_vdim);
815 const std::string &coordset_name,
816 const std::string &main_topology_name,
817 const std::string &boundary_topology_name,
818 const std::string &main_adjset_name)
822 MFEM_ASSERT(
dim >= 1 &&
dim <= 3,
"invalid mesh dimension");
834 MFEM_ASSERT( ( stride == 3 *
sizeof(
real_t) ),
835 "Unexpected stride for Vertex");
837 Node &n_mesh_coords = n_mesh[
"coordsets"][coordset_name];
838 n_mesh_coords[
"type"] =
"explicit";
843 n_mesh_coords[
"values/x"].set_external(coords_ptr,
850 n_mesh_coords[
"values/y"].set_external(coords_ptr,
857 n_mesh_coords[
"values/z"].set_external(coords_ptr,
867 Node &n_topo = n_mesh[
"topologies"][main_topology_name];
869 n_topo[
"type"] =
"unstructured";
870 n_topo[
"coordset"] = coordset_name;
874 std::string ele_shape = ElementTypeToShapeName(ele_type);
876 n_topo[
"elements/shape"] = ele_shape;
880 if (gf_mesh_nodes != NULL)
882 n_topo[
"grid_function"] =
"mesh_nodes";
893 int num_conn_idxs = num_ele * idxs_per_ele;
895 n_topo[
"elements/connectivity"].set(DataType::c_int(num_conn_idxs));
897 int *conn_ptr = n_topo[
"elements/connectivity"].value();
899 for (
int i=0; i < num_ele; i++)
904 memcpy(conn_ptr, ele_verts, idxs_per_ele *
sizeof(
int));
906 conn_ptr += idxs_per_ele;
909 if (gf_mesh_nodes != NULL)
912 n_mesh[
"fields/mesh_nodes"],
920 Node &n_mesh_att = n_mesh[
"fields/element_attribute"];
922 n_mesh_att[
"association"] =
"element";
923 n_mesh_att[
"topology"] = main_topology_name;
924 n_mesh_att[
"values"].set(DataType::c_int(num_ele));
926 int_array att_vals = n_mesh_att[
"values"].value();
927 for (
int i = 0; i < num_ele; i++)
939 n_topo[
"boundary_topology"] = boundary_topology_name;
941 Node &n_bndry_topo = n_mesh[
"topologies"][boundary_topology_name];
943 n_bndry_topo[
"type"] =
"unstructured";
944 n_bndry_topo[
"coordset"] = coordset_name;
953 std::string bndry_ele_shape = ElementTypeToShapeName(bndry_ele_type);
954 n_bndry_topo[
"elements/shape"] = bndry_ele_shape;
959 int num_bndry_conn_idxs = num_bndry_ele * bndry_idxs_per_ele;
961 n_bndry_topo[
"elements/connectivity"].set(DataType::c_int(num_bndry_conn_idxs));
963 int *bndry_conn_ptr = n_bndry_topo[
"elements/connectivity"].value();
965 for (
int i=0; i < num_bndry_ele; i++)
968 const int *bndry_ele_verts = bndry_ele->
GetVertices();
970 memcpy(bndry_conn_ptr, bndry_ele_verts, bndry_idxs_per_ele *
sizeof(
int));
972 bndry_conn_ptr += bndry_idxs_per_ele;
979 Node &n_bndry_mesh_att = n_mesh[
"fields/boundary_attribute"];
981 n_bndry_mesh_att[
"association"] =
"element";
982 n_bndry_mesh_att[
"topology"] = boundary_topology_name;
983 n_bndry_mesh_att[
"values"].set(DataType::c_int(num_bndry_ele));
985 int_array bndry_att_vals = n_bndry_mesh_att[
"values"].value();
986 for (
int i = 0; i < num_bndry_ele; i++)
1004 Node &n_adjset = n_mesh[
"adjsets"][main_adjset_name];
1006 n_adjset[
"association"] =
"vertex";
1007 n_adjset[
"topology"] = main_topology_name;
1008 n_adjset[
"groups"].set(DataType::object());
1011 const int local_rank = pmesh->
GetMyRank();
1012 const int num_groups = pmesh_gtopo.
NGroups();
1014 for (
int i = 1; i < num_groups; i++)
1016 const int num_group_nbrs = pmesh_gtopo.
GetGroupSize(i);
1017 const int *group_nbrs = pmesh_gtopo.
GetGroup(i);
1024 std::string group_name =
"group";
1026 for (
int j = 0; j < num_group_nbrs; j++)
1031 for (
int j = 0; j < num_group_nbrs; j++)
1033 group_name +=
"_" + std::to_string(group_ranks[j]);
1041 Node &n_group = n_adjset[
"groups"][group_name];
1043 n_group[
"neighbors"].set(group_ranks.
GetData(), group_ranks.
Size());
1044 n_group[
"values"].set(DataType::c_int(num_group_verts));
1046 int_array group_vals = n_group[
"values"].value();
1047 for (
int j = 0; j < num_group_verts; j++)
1064 Node &n_domid = n_mesh[
"state/domain_id"];
1065 n_domid.set(local_rank);
1074 const std::string &main_topology_name)
1077 n_field[
"topology"] = main_topology_name;
1084 n_field[
"values"].set_external(
const_cast<real_t *
>(gf->
HostRead()),
1097 index_t stride =
sizeof(
real_t) * entry_stride;
1099 for (
int d = 0; d < vdim; d++)
1101 std::ostringstream oss;
1103 std::string comp_name = oss.str();
1104 n_field[
"values"][comp_name].set_external(
const_cast<real_t *
>(gf->
HostRead()),
1108 offset +=
sizeof(
real_t) * vdim_stride;
1119 const std::string &main_topology_name)
1129 std::ostringstream oss;
1130 oss <<
"QF_" << qf_order <<
"_" << qf_vdim;
1132 n_field[
"basis"] = oss.str();
1133 n_field[
"topology"] = main_topology_name;
1138 n_field[
"values"].set_external(
const_cast<real_t *
>(qf->
HostRead()),
1148 index_t stride =
sizeof(
real_t) * qf_vdim;
1150 for (
int d = 0; d < qf_vdim; d++)
1152 std::ostringstream oss;
1154 std::string comp_name = oss.str();
1155 n_field[
"values"][comp_name].set_external(
const_cast<real_t *
>(qf->
HostRead()),
1159 offset +=
sizeof(
real_t);
1192 const std::string &relay_protocol_)
1221 std::ostringstream oss;
1238 const std::string &relay_protocol_)
1241 std::string root_proto =
"json";
1243 if (relay_protocol_ ==
"hdf5")
1245 root_proto = relay_protocol_;
1250 Node &n_bp_idx = n_root[
"blueprint_index"];
1252 blueprint::mesh::generate_index(n_mesh,
1264 std::string gf_name = itr->first;
1267 Node &idx_gf_ncomps = n_bp_idx[
"mesh/fields"][gf_name][
"number_of_components"];
1270 if ( idx_gf_ncomps.to_int() != gf->
VectorDim() )
1276 n_root[
"protocol/name"] = relay_protocol_;
1277 n_root[
"protocol/version"] =
"0.3.1";
1281 n_root[
"number_of_files"] = num_domains;
1282 n_root[
"number_of_trees"] = num_domains;
1284 n_root[
"tree_pattern"] =
"";
1287 n_root[
"blueprint_index/mesh/state/time"] =
time;
1288 n_root[
"blueprint_index/mesh/state/time_step"] =
time_step;
1289 n_root[
"blueprint_index/mesh/state/cycle"] =
cycle;
1298 const std::string &relay_protocol_)
1300 relay::io::save(n_mesh,
MeshFileName(domain_id, relay_protocol_));
1310 std::string root_protocol =
"json";
1314 root_protocol =
"hdf5";
1318 relay::io::load(
RootFileName(), root_protocol, root_out);
1325 std::string root_json = root_out.to_json();
1327 int json_str_size = root_json.size() + 1;
1330 int mpi_status = MPI_Bcast((
void*)&json_str_size,
1336 if (mpi_status != MPI_SUCCESS)
1338 MFEM_ABORT(
"Broadcast of root file json string size failed");
1342 mpi_status = MPI_Bcast((
void*)root_json.c_str(),
1348 if (mpi_status != MPI_SUCCESS)
1350 MFEM_ABORT(
"Broadcast of root file json string failed");
1360 int json_str_size = -1;
1361 int mpi_status = MPI_Bcast(&json_str_size,
1367 if (mpi_status != MPI_SUCCESS)
1369 MFEM_ABORT(
"Broadcast of root file json string size failed");
1373 char *json_buff =
new char[json_str_size];
1374 mpi_status = MPI_Bcast(json_buff,
1380 if (mpi_status != MPI_SUCCESS)
1382 MFEM_ABORT(
"Broadcast of root file json string failed");
1386 Generator g(std::string(json_buff),
"json");
1389 delete [] json_buff;
1397 const std::string &relay_protocol_)
1403 relay::io::load(
MeshFileName(domain_id, relay_protocol_), n_mesh);
1407 if (!blueprint::mesh::verify(n_mesh,verify_info))
1409 MFEM_ABORT(
"Conduit Mesh Blueprint Verify Failed:\n"
1410 << verify_info.to_json());
1417 NodeConstIterator itr = n_mesh[
"fields"].children();
1419 std::string nodes_gf_name =
"";
1421 const Node &n_topo = n_mesh[
"topologies/main"];
1422 if (n_topo.has_child(
"grid_function"))
1424 nodes_gf_name = n_topo[
"grid_function"].as_string();
1427 while (itr.has_next())
1429 const Node &n_field = itr.next();
1430 std::string field_name = itr.name();
1434 if ( field_name != nodes_gf_name &&
1435 field_name.find(
"_attribute") == std::string::npos
1454ConduitDataCollection::ElementTypeToShapeName(
Element::Type element_type)
1463 switch (element_type)
1480ConduitDataCollection::ShapeNameToGeomType(
const std::string &shape_name)
1486 if (shape_name ==
"point")
1490 else if (shape_name ==
"line")
1494 else if (shape_name ==
"tri")
1498 else if (shape_name ==
"quad")
1502 else if (shape_name ==
"tet")
1506 else if (shape_name ==
"hex")
1512 MFEM_ABORT(
"Unsupported Element Shape: " << shape_name);
void DeleteFirst(const T &el)
Delete the first entry with value == 'el'.
void Sort()
Sorts the array in ascending order. This requires operator< to be defined for T.
int Size() const
Return the logical size of the array.
T * GetData()
Returns the data.
static Mesh * BlueprintMeshToMesh(const conduit::Node &n_mesh, const std::string &main_toplogy_name="", bool zero_copy=false)
Constructs and MFEM mesh from a Conduit Blueprint Description.
std::string RootFileName()
Returns blueprint root file name for the current cycle.
void SaveRootFile(int num_domains, const conduit::Node &n_mesh, const std::string &file_protocol)
Saves root file for the current cycle.
void LoadMeshAndFields(int domain_id, const std::string &file_protocol)
Loads all meshes and fields of a given domain id for the current cycle.
static GridFunction * BlueprintFieldToGridFunction(Mesh *mesh, const conduit::Node &n_field, bool zero_copy=false)
Constructs and MFEM Grid Function from a Conduit Blueprint Description.
virtual void Load(int cycle=0)
Load the collection based blueprint data.
static void MeshToBlueprintMesh(Mesh *m, conduit::Node &out, const std::string &coordset_name="coords", const std::string &main_topology_name="main", const std::string &boundary_topology_name="boundary", const std::string &main_adjset_name="main_adjset")
Describes a MFEM mesh using the mesh blueprint.
std::string MeshDirectoryName()
Returns the mesh output directory for the current cycle.
void SetProtocol(const std::string &protocol)
Set the Conduit relay i/o protocol to use.
std::string MeshFileName(int domain_id, const std::string &file_protocol="hdf5")
Returns the mesh file name for a given domain at the current cycle.
static void GridFunctionToBlueprintField(GridFunction *gf, conduit::Node &out, const std::string &main_topology_name="main")
Describes a MFEM grid function using the mesh blueprint.
std::string MeshFilePattern(const std::string &file_protocol="hdf5")
Returns the mesh file pattern for the current cycle.
static QuadratureFunction * BlueprintFieldToQuadratureFunction(Mesh *mesh, const conduit::Node &n_field, bool zero_copy=false)
Constructs and MFEM Quadrature Function from a Conduit Blueprint Description.
static void QuadratureFunctionToBlueprintField(QuadratureFunction *qf, conduit::Node &out, const std::string &main_topology_name="main")
Describes a MFEM quadrature function using the mesh blueprint.
virtual void Save()
Save the collection and a Conduit blueprint root file.
void SaveMeshAndFields(int domain_id, const conduit::Node &n_mesh, const std::string &file_protocol)
Saves all meshes and fields for the current cycle.
std::string relay_protocol
virtual ~ConduitDataCollection()
We will delete the mesh and fields if we own them.
void LoadRootFile(conduit::Node &n_root_out)
Loads contents of the root field for the current cycle into n_root_out.
ConduitDataCollection(const std::string &collection_name, Mesh *mesh=NULL)
Constructor. The collection name is used when saving the data.
int cycle
Time cycle; for time-dependent simulations cycle >= 0, otherwise = -1.
real_t time
Physical time (for time-dependent simulations)
bool own_data
Should the collection delete its mesh and fields.
static int create_directory(const std::string &dir_name, const Mesh *mesh, int myid)
void DeleteAll()
Delete data owned by the DataCollection including field information.
GFieldMap::const_iterator FieldMapConstIterator
QFieldMap::const_iterator QFieldMapConstIterator
int pad_digits_cycle
Number of digits used for the cycle and MPI rank in filenames.
std::string prefix_path
A path where the directory with results is saved. If not empty, it has '/' at the end.
int myid
MPI rank (in parallel)
real_t time_step
Time step i.e. delta_t (for time-dependent simulations)
int num_procs
Number of MPI ranks (in parallel)
bool appendRankToFileName
Append rank to any output file names.
std::string name
Name of the collection, used as a directory name when saving.
MPI_Comm m_comm
Associated MPI communicator.
Mesh * mesh
The (common) mesh for the collected fields.
Abstract data type element.
Geometry::Type GetGeometryType() const
virtual void GetVertices(Array< int > &v) const =0
Get the indices defining the vertices.
virtual Type GetType() const =0
Returns element's type.
Type
Constants for the classes derived from Element.
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
static FiniteElementCollection * New(const char *name)
Factory method: return a newly allocated FiniteElementCollection according to the given name.
virtual const char * Name() const
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
int GetNDofs() const
Returns number of degrees of freedom. This is the number of Local Degrees of Freedom.
Ordering::Type GetOrdering() const
Return the ordering method.
const FiniteElementCollection * FEColl() const
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
int GetVDim() const
Returns the vector dimension of the finite element space.
static const int NumVerts[NumGeom]
Class for grid function - Vector with associated FE space.
void MakeOwner(FiniteElementCollection *fec_)
Make the GridFunction the owner of fec_owned and fes.
FiniteElementSpace * FESpace()
int VectorDim() const
Shortcut for calling FiniteElementSpace::GetVectorDim() on the underlying fes.
int GetNeighborRank(int i) const
Return the MPI rank of neighbor 'i'.
const int * GetGroup(int g) const
Return a pointer to a list of neighbors for a given group. Neighbor 0 is the local processor.
int GetGroupSize(int g) const
Get the number of processors in a group.
int NGroups() const
Return the number of groups.
Element::Type GetElementType(int i) const
Returns the type of element i.
int GetAttribute(int i) const
Return the attribute of element i.
Geometry::Type GetTypicalElementGeometry() const
If the local mesh is not empty, return GetElementGeometry(0); otherwise, return a typical Geometry pr...
int GetBdrAttribute(int i) const
Return the attribute of boundary element i.
const Element * GetElement(int i) const
Return pointer to the i'th element object.
int GetNE() const
Returns number of elements.
const Element * GetBdrElement(int i) const
Return pointer to the i'th boundary element object.
int SpaceDimension() const
Dimension of the physical space containing the mesh.
void GetNodes(Vector &node_coord) const
int GetNV() const
Returns number of vertices. Vertices are only at the corners of elements, where you would expect them...
int GetNBE() const
Returns number of boundary elements.
void NewNodes(GridFunction &nodes, bool make_owner=false)
Replace the internal node GridFunction with the given GridFunction.
virtual bool HasBoundaryElements() const
Checks if the mesh has boundary elements.
const real_t * GetVertex(int i) const
Return pointer to vertex i's coordinates.
void Register(const std::string &fname, T *field, bool own_data)
Register field field with name fname.
iterator end()
Returns an end iterator to the registered fields.
iterator begin()
Returns a begin iterator to the registered fields.
void clear()
Clears the map of registered fields without reclaiming memory.
Class for parallel meshes.
int GroupVertex(int group, int i) const
Accessors for entities within a shared group structure.
int GroupNVertices(int group) const
Represents values or vectors of values at quadrature points on a mesh.
QuadratureSpaceBase * GetSpace()
Get the associated QuadratureSpaceBase object.
void SetOwnsSpace(bool own)
Set the QuadratureSpaceBase ownership flag.
int GetVDim() const
Get the vector dimension.
void SetSpace(QuadratureSpaceBase *qspace_, int vdim_=-1)
Change the QuadratureSpaceBase and optionally the vector dimension.
int GetSize() const
Return the total number of quadrature points.
int GetOrder() const
Return the order of the quadrature rule(s) used by all elements.
Class representing the storage layout of a QuadratureFunction.
virtual const real_t * HostRead() const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), false).
int Size() const
Returns the size of the vector.
constexpr conduit::index_t mfem_precision_conduit_id
std::string to_padded_string(int i, int digits)
Convert an integer to a 0-padded string with the given number of digits.
std::array< int, NCMesh::MaxFaceNodes > nodes