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]);
151 int num_domains = n_root[
"number_of_trees"].to_int();
156 MFEM_WARNING(
"num_procs must equal num_domains");
177#if defined(MFEM_USE_DOUBLE)
178 CONDUIT_NATIVE_DOUBLE_ID;
179#elif defined(MFEM_USE_SINGLE)
182#error Unknown MFEM precision
192 const std::string &main_toplogy_name,
205 std::string topo_name = main_toplogy_name;
209 topo_name = n_mesh[
"topologies"].schema().child_name(0);
212 MFEM_ASSERT(n_mesh.has_path(
"topologies/" + topo_name),
213 "Expected topology named \"" + topo_name +
"\" "
214 "(node is missing path \"topologies/" + topo_name +
"\")");
217 std::string coords_name =
218 n_mesh[
"topologies"][topo_name][
"coordset"].as_string();
221 MFEM_ASSERT(n_mesh.has_path(
"coordsets/" + coords_name),
222 "Expected topology named \"" + coords_name +
"\" "
223 "(node is missing path \"coordsets/" + coords_name +
"\")");
225 const Node &n_coordset = n_mesh[
"coordsets"][coords_name];
226 const Node &n_coordset_vals = n_coordset[
"values"];
229 int ndims = n_coordset_vals.number_of_children();
232 int num_verts = n_coordset_vals[0].dtype().number_of_elements();
234 const real_t *verts_ptr = NULL;
243 blueprint::mcarray::is_interleaved(n_coordset_vals) )
247 verts_ptr = n_coordset_vals[0].value();
254 NodeConstIterator itr = n_coordset_vals.children();
255 while (itr.has_next())
257 const Node &c_vals = itr.next();
258 std::string c_name = itr.name();
263 n_tmp[c_name].set_external(c_vals);
286 Node &n_conv_coords_vals = n_conv[
"coordsets"][coords_name][
"values"];
287 blueprint::mcarray::to_interleaved(n_tmp,
289 verts_ptr = n_conv_coords_vals[0].value();
294 const Node &n_mesh_topo = n_mesh[
"topologies"][topo_name];
295 std::string mesh_ele_shape = n_mesh_topo[
"elements/shape"].as_string();
300 const Node &n_mesh_conn = n_mesh_topo[
"elements/connectivity"];
302 const int *elem_indices = NULL;
304 if (n_mesh_conn.dtype().is_int() &&
305 n_mesh_conn.is_compact() )
307 elem_indices = n_mesh_topo[
"elements/connectivity"].value();
311 Node &n_mesh_conn_conv=
312 n_conv[
"topologies"][topo_name][
"elements/connectivity"];
313 n_mesh_conn.to_int_array(n_mesh_conn_conv);
314 elem_indices = n_mesh_conn_conv.value();
318 n_mesh_topo[
"elements/connectivity"].dtype().number_of_elements();
319 num_mesh_ele = num_mesh_ele / num_idxs_per_ele;
322 const int *bndry_indices = NULL;
323 int num_bndry_ele = 0;
328 if ( n_mesh_topo.has_child(
"boundary_topology") )
330 std::string bndry_topo_name = n_mesh_topo[
"boundary_topology"].as_string();
339 if (n_mesh[
"topologies"].has_child(bndry_topo_name))
341 const Node &n_bndry_topo = n_mesh[
"topologies"][bndry_topo_name];
342 std::string bndry_ele_shape = n_bndry_topo[
"elements/shape"].as_string();
344 bndry_geo = ShapeNameToGeomType(bndry_ele_shape);
347 const Node &n_bndry_conn = n_bndry_topo[
"elements/connectivity"];
350 if ( n_bndry_conn.dtype().is_int() &&
351 n_bndry_conn.is_compact())
353 bndry_indices = n_bndry_conn.value();
357 Node &n_bndry_conn_conv =
358 n_conv[
"topologies"][bndry_topo_name][
"elements/connectivity"];
359 n_bndry_conn.to_int_array(n_bndry_conn_conv);
360 bndry_indices = (n_bndry_conn_conv).value();
365 n_bndry_topo[
"elements/connectivity"].dtype().number_of_elements();
366 num_bndry_ele = num_bndry_ele / num_idxs_per_bndry_ele;
374 const int *mesh_atts = NULL;
375 const int *bndry_atts = NULL;
384 std::string main_att_name =
"";
386 const Node &n_fields = n_mesh[
"fields"];
387 NodeConstIterator itr = n_fields.children();
389 while ( itr.has_next() && main_att_name ==
"" )
392 std::string fld_name = itr.name();
393 if ( fld_name.find(
"boundary") == std::string::npos &&
394 fld_name.find(
"_attribute") != std::string::npos )
396 main_att_name = fld_name;
400 if ( main_att_name !=
"" )
402 const Node &n_mesh_atts_vals = n_fields[main_att_name][
"values"];
405 if (n_mesh_atts_vals.dtype().is_int() &&
406 n_mesh_atts_vals.is_compact() )
408 mesh_atts = n_mesh_atts_vals.value();
412 Node &n_mesh_atts_vals_conv = n_conv[
"fields"][main_att_name][
"values"];
413 n_mesh_atts_vals.to_int_array(n_mesh_atts_vals_conv);
414 mesh_atts = n_mesh_atts_vals_conv.value();
426 std::string bnd_att_name =
"";
427 itr = n_fields.children();
429 while ( itr.has_next() && bnd_att_name ==
"" )
432 std::string fld_name = itr.name();
433 if ( fld_name.find(
"boundary") != std::string::npos &&
434 fld_name.find(
"_attribute") != std::string::npos )
436 bnd_att_name = fld_name;
440 if ( bnd_att_name !=
"" )
443 const Node &n_bndry_atts_vals =n_fields[bnd_att_name][
"values"];
446 if ( n_bndry_atts_vals.dtype().is_int() &&
447 n_bndry_atts_vals.is_compact())
449 bndry_atts = n_bndry_atts_vals.value();
453 Node &n_bndry_atts_vals_conv = n_conv[
"fields"][bnd_att_name][
"values"];
454 n_bndry_atts_vals.to_int_array(n_bndry_atts_vals_conv);
455 bndry_atts = n_bndry_atts_vals_conv.value();
479 const_cast<real_t*
>(verts_ptr),
482 const_cast<int*
>(elem_indices),
485 const_cast<int*
>(mesh_atts),
488 const_cast<int*
>(bndry_indices),
491 const_cast<int*
>(bndry_atts),
497 if (n_mesh_topo.has_child(
"grid_function"))
499 std::string nodes_gf_name = n_mesh_topo[
"grid_function"].as_string();
502 const Node &n_mesh_gf = n_mesh[
"fields"][nodes_gf_name];
511 if (zero_copy && !n_conv.dtype().is_empty())
546 const real_t *vals_ptr = NULL;
552 if (n_field[
"values"].dtype().is_object())
554 vdim = n_field[
"values"].number_of_children();
562 if (n_field[
"values"].is_contiguous())
565 vals_ptr = n_field[
"values"].child(0).value();
568 else if (blueprint::mcarray::is_interleaved(n_field[
"values"]))
572 vals_ptr = n_field[
"values"].child(0).value();
578 blueprint::mcarray::to_contiguous(n_field[
"values"],
580 vals_ptr = n_conv[
"values"].child(0).value();
588 NodeConstIterator itr = n_field[
"values"].children();
589 while (itr.has_next())
591 const Node &c_vals = itr.next();
592 std::string c_name = itr.name();
597 n_tmp[c_name].set_external(c_vals);
608 blueprint::mcarray::to_contiguous(n_tmp,
610 vals_ptr = n_conv[
"values"].child(0).value();
616 n_field[
"values"].is_compact())
618 vals_ptr = n_field[
"values"].value();
624 vals_ptr = n_conv[
"values"].value();
628 if (zero_copy && !n_conv.dtype().is_empty())
635 std::string fec_name = n_field[
"basis"].as_string();
678 const real_t *vals_ptr = NULL;
681 if (n_field[
"values"].dtype().is_object())
683 vdim = n_field[
"values"].number_of_children();
692 if (blueprint::mcarray::is_interleaved(n_field[
"values"]))
695 vals_ptr = n_field[
"values"].child(0).value();
701 blueprint::mcarray::to_interleaved(n_field[
"values"],
703 vals_ptr = n_conv[
"values"].child(0).value();
711 NodeConstIterator itr = n_field[
"values"].children();
712 while (itr.has_next())
714 const Node &c_vals = itr.next();
715 std::string c_name = itr.name();
720 n_tmp[c_name].set_external(c_vals);
731 blueprint::mcarray::to_interleaved(n_tmp,
733 vals_ptr = n_conv[
"values"].child(0).value();
739 n_field[
"values"].is_compact())
741 vals_ptr = n_field[
"values"].value();
747 vals_ptr = n_conv[
"values"].value();
751 if (zero_copy && !n_conv.dtype().is_empty())
765 std::string qf_name = n_field[
"basis"].as_string();
766 const char *qf_name_cstr = qf_name.c_str();
767 if (!strncmp(qf_name_cstr,
"QF_", 3))
770 qf_order = atoi(qf_name_cstr + 3);
772 const char *qf_vdim_cstr = strstr(qf_name_cstr+3,
"_");
773 if (qf_vdim_cstr == NULL)
775 MFEM_ABORT(
"Error parsing quadrature function description string: "
776 << qf_name << std::endl
777 <<
"Expected: QF_{ORDER}_{VDIM}");
780 qf_vdim = atoi(qf_vdim_cstr+1);
784 MFEM_ABORT(
"Error parsing quadrature function description string: "
785 << qf_name << std::endl
786 <<
"Expected: QF_{ORDER}_{VDIM}");
788 MFEM_VERIFY(qf_vdim == vdim,
"vector dimension mismatch: vdim = " << vdim
789 <<
", qf_vdim = " << qf_vdim);
819 const std::string &coordset_name,
820 const std::string &main_topology_name,
821 const std::string &boundary_topology_name,
822 const std::string &main_adjset_name)
826 MFEM_ASSERT(
dim >= 1 &&
dim <= 3,
"invalid mesh dimension");
838 MFEM_ASSERT( ( stride == 3 *
sizeof(
real_t) ),
839 "Unexpected stride for Vertex");
841 Node &n_mesh_coords = n_mesh[
"coordsets"][coordset_name];
842 n_mesh_coords[
"type"] =
"explicit";
847 n_mesh_coords[
"values/x"].set_external(coords_ptr,
854 n_mesh_coords[
"values/y"].set_external(coords_ptr,
861 n_mesh_coords[
"values/z"].set_external(coords_ptr,
871 Node &n_topo = n_mesh[
"topologies"][main_topology_name];
873 n_topo[
"type"] =
"unstructured";
874 n_topo[
"coordset"] = coordset_name;
878 std::string ele_shape = ElementTypeToShapeName(ele_type);
880 n_topo[
"elements/shape"] = ele_shape;
884 if (gf_mesh_nodes != NULL)
886 n_topo[
"grid_function"] =
"mesh_nodes";
897 int num_conn_idxs = num_ele * idxs_per_ele;
899 n_topo[
"elements/connectivity"].set(DataType::c_int(num_conn_idxs));
901 int *conn_ptr = n_topo[
"elements/connectivity"].value();
903 for (
int i=0; i < num_ele; i++)
908 memcpy(conn_ptr, ele_verts, idxs_per_ele *
sizeof(
int));
910 conn_ptr += idxs_per_ele;
913 if (gf_mesh_nodes != NULL)
916 n_mesh[
"fields/mesh_nodes"],
924 Node &n_mesh_att = n_mesh[
"fields/element_attribute"];
926 n_mesh_att[
"association"] =
"element";
927 n_mesh_att[
"topology"] = main_topology_name;
928 n_mesh_att[
"values"].set(DataType::c_int(num_ele));
930 int_array att_vals = n_mesh_att[
"values"].value();
931 for (
int i = 0; i < num_ele; i++)
943 n_topo[
"boundary_topology"] = boundary_topology_name;
945 Node &n_bndry_topo = n_mesh[
"topologies"][boundary_topology_name];
947 n_bndry_topo[
"type"] =
"unstructured";
948 n_bndry_topo[
"coordset"] = coordset_name;
957 std::string bndry_ele_shape = ElementTypeToShapeName(bndry_ele_type);
958 n_bndry_topo[
"elements/shape"] = bndry_ele_shape;
963 int num_bndry_conn_idxs = num_bndry_ele * bndry_idxs_per_ele;
965 n_bndry_topo[
"elements/connectivity"].set(DataType::c_int(num_bndry_conn_idxs));
967 int *bndry_conn_ptr = n_bndry_topo[
"elements/connectivity"].value();
969 for (
int i=0; i < num_bndry_ele; i++)
972 const int *bndry_ele_verts = bndry_ele->
GetVertices();
974 memcpy(bndry_conn_ptr, bndry_ele_verts, bndry_idxs_per_ele *
sizeof(
int));
976 bndry_conn_ptr += bndry_idxs_per_ele;
983 Node &n_bndry_mesh_att = n_mesh[
"fields/boundary_attribute"];
985 n_bndry_mesh_att[
"association"] =
"element";
986 n_bndry_mesh_att[
"topology"] = boundary_topology_name;
987 n_bndry_mesh_att[
"values"].set(DataType::c_int(num_bndry_ele));
989 int_array bndry_att_vals = n_bndry_mesh_att[
"values"].value();
990 for (
int i = 0; i < num_bndry_ele; i++)
1008 Node &n_adjset = n_mesh[
"adjsets"][main_adjset_name];
1010 n_adjset[
"association"] =
"vertex";
1011 n_adjset[
"topology"] = main_topology_name;
1012 n_adjset[
"groups"].set(DataType::object());
1015 const int local_rank = pmesh->
GetMyRank();
1016 const int num_groups = pmesh_gtopo.
NGroups();
1018 for (
int i = 1; i < num_groups; i++)
1020 const int num_group_nbrs = pmesh_gtopo.
GetGroupSize(i);
1021 const int *group_nbrs = pmesh_gtopo.
GetGroup(i);
1028 std::string group_name =
"group";
1030 for (
int j = 0; j < num_group_nbrs; j++)
1035 for (
int j = 0; j < num_group_nbrs; j++)
1037 group_name +=
"_" + std::to_string(group_ranks[j]);
1045 Node &n_group = n_adjset[
"groups"][group_name];
1047 n_group[
"neighbors"].set(group_ranks.
GetData(), group_ranks.
Size());
1048 n_group[
"values"].set(DataType::c_int(num_group_verts));
1050 int_array group_vals = n_group[
"values"].value();
1051 for (
int j = 0; j < num_group_verts; j++)
1068 Node &n_domid = n_mesh[
"state/domain_id"];
1069 n_domid.set(local_rank);
1078 const std::string &main_topology_name)
1081 n_field[
"topology"] = main_topology_name;
1088 n_field[
"values"].set_external(
const_cast<real_t *
>(gf->
HostRead()),
1101 index_t stride =
sizeof(
real_t) * entry_stride;
1103 for (
int d = 0; d < vdim; d++)
1105 std::ostringstream oss;
1107 std::string comp_name = oss.str();
1108 n_field[
"values"][comp_name].set_external(
const_cast<real_t *
>(gf->
HostRead()),
1112 offset +=
sizeof(
real_t) * vdim_stride;
1123 const std::string &main_topology_name)
1133 std::ostringstream oss;
1134 oss <<
"QF_" << qf_order <<
"_" << qf_vdim;
1136 n_field[
"basis"] = oss.str();
1137 n_field[
"topology"] = main_topology_name;
1142 n_field[
"values"].set_external(
const_cast<real_t *
>(qf->
HostRead()),
1152 index_t stride =
sizeof(
real_t) * qf_vdim;
1154 for (
int d = 0; d < qf_vdim; d++)
1156 std::ostringstream oss;
1158 std::string comp_name = oss.str();
1159 n_field[
"values"][comp_name].set_external(
const_cast<real_t *
>(qf->
HostRead()),
1163 offset +=
sizeof(
real_t);
1196 const std::string &relay_protocol_)
1225 std::ostringstream oss;
1242 const std::string &relay_protocol_)
1245 std::string root_proto =
"json";
1247 if (relay_protocol_ ==
"hdf5")
1249 root_proto = relay_protocol_;
1254 Node &n_bp_idx = n_root[
"blueprint_index"];
1256 blueprint::mesh::generate_index(n_mesh,
1268 std::string gf_name = itr->first;
1271 Node &idx_gf_ncomps = n_bp_idx[
"mesh/fields"][gf_name][
"number_of_components"];
1274 if ( idx_gf_ncomps.to_int() != gf->
VectorDim() )
1280 n_root[
"protocol/name"] = relay_protocol_;
1281 n_root[
"protocol/version"] =
"0.3.1";
1285 n_root[
"number_of_files"] = num_domains;
1286 n_root[
"number_of_trees"] = num_domains;
1288 n_root[
"tree_pattern"] =
"";
1291 n_root[
"blueprint_index/mesh/state/time"] =
time;
1292 n_root[
"blueprint_index/mesh/state/time_step"] =
time_step;
1293 n_root[
"blueprint_index/mesh/state/cycle"] =
cycle;
1302 const std::string &relay_protocol_)
1304 relay::io::save(n_mesh,
MeshFileName(domain_id, relay_protocol_));
1314 std::string root_protocol =
"json";
1318 root_protocol =
"hdf5";
1322 relay::io::load(
RootFileName(), root_protocol, root_out);
1329 std::string root_json = root_out.to_json();
1331 int json_str_size = root_json.size() + 1;
1334 int mpi_status = MPI_Bcast((
void*)&json_str_size,
1340 if (mpi_status != MPI_SUCCESS)
1342 MFEM_ABORT(
"Broadcast of root file json string size failed");
1346 mpi_status = MPI_Bcast((
void*)root_json.c_str(),
1352 if (mpi_status != MPI_SUCCESS)
1354 MFEM_ABORT(
"Broadcast of root file json string failed");
1364 int json_str_size = -1;
1365 int mpi_status = MPI_Bcast(&json_str_size,
1371 if (mpi_status != MPI_SUCCESS)
1373 MFEM_ABORT(
"Broadcast of root file json string size failed");
1377 char *json_buff =
new char[json_str_size];
1378 mpi_status = MPI_Bcast(json_buff,
1384 if (mpi_status != MPI_SUCCESS)
1386 MFEM_ABORT(
"Broadcast of root file json string failed");
1390 Generator g(std::string(json_buff),
"json");
1393 delete [] json_buff;
1401 const std::string &relay_protocol_)
1407 relay::io::load(
MeshFileName(domain_id, relay_protocol_), n_mesh);
1411 if (!blueprint::mesh::verify(n_mesh,verify_info))
1413 MFEM_ABORT(
"Conduit Mesh Blueprint Verify Failed:\n"
1414 << verify_info.to_json());
1421 NodeConstIterator itr = n_mesh[
"fields"].children();
1423 std::string nodes_gf_name =
"";
1425 const Node &n_topo = n_mesh[
"topologies/main"];
1426 if (n_topo.has_child(
"grid_function"))
1428 nodes_gf_name = n_topo[
"grid_function"].as_string();
1431 while (itr.has_next())
1433 const Node &n_field = itr.next();
1434 std::string field_name = itr.name();
1438 if ( field_name != nodes_gf_name &&
1439 field_name.find(
"_attribute") == std::string::npos
1458ConduitDataCollection::ElementTypeToShapeName(
Element::Type element_type)
1467 switch (element_type)
1484ConduitDataCollection::ShapeNameToGeomType(
const std::string &shape_name)
1490 if (shape_name ==
"point")
1494 else if (shape_name ==
"line")
1498 else if (shape_name ==
"tri")
1502 else if (shape_name ==
"quad")
1506 else if (shape_name ==
"tet")
1510 else if (shape_name ==
"hex")
1516 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