29 #include "libmesh/bounding_box.h" 30 #include "libmesh/boundary_info.h" 31 #include "libmesh/mesh_tools.h" 32 #include "libmesh/parallel.h" 33 #include "libmesh/mesh_communication.h" 34 #include "libmesh/periodic_boundary_base.h" 35 #include "libmesh/fe_base.h" 36 #include "libmesh/fe_interface.h" 37 #include "libmesh/mesh_inserter_iterator.h" 38 #include "libmesh/mesh_communication.h" 39 #include "libmesh/mesh_inserter_iterator.h" 40 #include "libmesh/mesh_tools.h" 41 #include "libmesh/parallel.h" 42 #include "libmesh/parallel_elem.h" 43 #include "libmesh/parallel_node.h" 44 #include "libmesh/parallel_ghost_sync.h" 45 #include "libmesh/utility.h" 46 #include "libmesh/remote_elem.h" 47 #include "libmesh/linear_partitioner.h" 48 #include "libmesh/centroid_partitioner.h" 49 #include "libmesh/parmetis_partitioner.h" 50 #include "libmesh/hilbert_sfc_partitioner.h" 51 #include "libmesh/morton_sfc_partitioner.h" 52 #include "libmesh/edge_edge2.h" 53 #include "libmesh/mesh_refinement.h" 54 #include "libmesh/quadrature.h" 55 #include "libmesh/boundary_info.h" 56 #include "libmesh/periodic_boundaries.h" 57 #include "libmesh/quadrature_gauss.h" 58 #include "libmesh/point_locator_base.h" 59 #include "libmesh/default_coupling.h" 60 #include "libmesh/ghost_point_neighbors.h" 61 #include "libmesh/fe_type.h" 67 #if NANOFLANN_VERSION < 0x150 72 template <
typename T,
typename U>
82 MooseEnum parallel_type(
"DEFAULT REPLICATED DISTRIBUTED",
"DEFAULT");
85 "DEFAULT: Use libMesh::ReplicatedMesh unless --distributed-mesh is " 86 "specified on the command line " 87 "REPLICATED: Always use libMesh::ReplicatedMesh " 88 "DISTRIBUTED: Always use libMesh::DistributedMesh");
93 "If allow_renumbering=false, node and element numbers are kept fixed until deletion");
97 "If nemesis=true and file=foo.e, actually reads " 98 "foo.e.N.0, foo.e.N.1, ... foo.e.N.N-1, " 99 "where N = # CPUs, with NemesisIO.");
104 "This is only required for certain mesh formats where " 105 "the dimension of the mesh cannot be autodetected. " 106 "In particular you must supply this for GMSH meshes. " 107 "Note: This is completely ignored for ExodusII meshes!");
112 "Specifies a mesh partitioner to use when splitting the mesh for a parallel computation.");
116 "Specifies the sort direction if using the centroid partitioner. " 117 "Available options: x, y, z, radial");
119 MooseEnum patch_update_strategy(
"never always auto iteration",
"never");
121 "patch_update_strategy",
122 patch_update_strategy,
123 "How often to update the geometric search 'patch'. The default is to " 124 "never update it (which is the most efficient but could be a problem " 125 "with lots of relative motion). 'always' will update the patch for all " 126 "secondary nodes at the beginning of every timestep which might be time " 127 "consuming. 'auto' will attempt to determine at the start of which " 128 "timesteps the patch for all secondary nodes needs to be updated automatically." 129 "'iteration' updates the patch at every nonlinear iteration for a " 130 "subset of secondary nodes for which penetration is not detected. If there " 131 "can be substantial relative motion between the primary and secondary surfaces " 132 "during the nonlinear iterations within a timestep, it is advisable to use " 133 "'iteration' option to ensure accurate contact detection.");
137 "construct_node_list_from_side_list",
139 "Whether or not to generate nodesets from the sidesets (usually a good idea).");
141 "patch_size", 40,
"The number of nodes to consider in the NearestNode neighborhood.");
142 params.
addParam<
unsigned int>(
"ghosting_patch_size",
143 "The number of nearest neighbors considered " 144 "for ghosting purposes when 'iteration' " 145 "patch update strategy is used. Default is " 147 params.
addParam<
unsigned int>(
"max_leaf_size",
149 "The maximum number of points in each leaf of the KDTree used in " 150 "the nearest neighbor search. As the leaf size becomes larger," 151 "KDTree construction becomes faster but the nearest neighbor search" 154 params.
addParam<
bool>(
"build_all_side_lowerd_mesh",
156 "True to build the lower-dimensional mesh for all sides.");
158 params.
addParam<
bool>(
"skip_refine_when_use_split",
160 "True to skip uniform refinements when using a pre-split mesh.");
162 params.
addParam<std::vector<SubdomainID>>(
164 "The listed subdomains will be assumed valid for the mesh. This permits setting up subdomain " 165 "restrictions for subdomains initially containing no elements, which can occur, for example, " 166 "in additive manufacturing simulations which dynamically add and remove elements.");
172 params.addPrivateParam<
bool>(
"_mesh_generator_mesh",
false);
175 params.addPrivateParam<
bool>(
"_is_split",
false);
177 params.registerBase(
"MooseMesh");
180 params.addParamNamesToGroup(
181 "dim nemesis patch_update_strategy construct_node_list_from_side_list patch_size",
183 params.addParamNamesToGroup(
"partitioner centroid_partitioner_direction",
"Partitioning");
193 _use_distributed_mesh(false),
194 _distribution_overridden(false),
195 _parallel_type_overridden(false),
197 _partitioner_name(getParam<
MooseEnum>(
"partitioner")),
198 _partitioner_overridden(false),
199 _custom_partitioner_requested(false),
200 _uniform_refine_level(0),
201 _skip_refine_when_use_split(getParam<bool>(
"skip_refine_when_use_split")),
202 _skip_deletion_repartition_after_refine(false),
203 _is_nemesis(getParam<bool>(
"nemesis")),
204 _node_to_elem_map_built(false),
205 _node_to_active_semilocal_elem_map_built(false),
206 _patch_size(getParam<unsigned
int>(
"patch_size")),
207 _ghosting_patch_size(isParamValid(
"ghosting_patch_size")
208 ? getParam<unsigned
int>(
"ghosting_patch_size")
210 _max_leaf_size(getParam<unsigned
int>(
"max_leaf_size")),
211 _patch_update_strategy(
213 _regular_orthogonal_mesh(false),
214 _is_split(getParam<bool>(
"_is_split")),
216 _allow_recovery(true),
217 _construct_node_list_from_side_list(getParam<bool>(
"construct_node_list_from_side_list")),
219 _allow_remote_element_removal(true),
220 _need_ghost_ghosted_boundaries(true),
221 _is_displaced(false),
222 _rz_coord_axis(getParam<
MooseEnum>(
"rz_coord_axis")),
223 _coord_system_set(false),
224 _doing_p_refinement(false)
227 mooseError(
"Ghosting patch size parameter has to be set in the mesh block " 228 "only when 'iteration' patch update strategy is used.");
234 "You set both 'Mesh/block' and 'Mesh/coord_block'. The value of " 235 "'Mesh/coord_block' will be used.");
242 if (getParam<bool>(
"build_all_side_lowerd_mesh"))
253 _built_from_other_mesh(true),
254 _parallel_type(other_mesh._parallel_type),
255 _use_distributed_mesh(other_mesh._use_distributed_mesh),
256 _distribution_overridden(other_mesh._distribution_overridden),
257 _parallel_type_overridden(other_mesh._parallel_type_overridden),
258 _mesh(other_mesh.getMesh().clone()),
259 _partitioner_name(other_mesh._partitioner_name),
260 _partitioner_overridden(other_mesh._partitioner_overridden),
261 _custom_partitioner_requested(other_mesh._custom_partitioner_requested),
262 _uniform_refine_level(other_mesh.uniformRefineLevel()),
263 _skip_refine_when_use_split(other_mesh._skip_refine_when_use_split),
264 _skip_deletion_repartition_after_refine(other_mesh._skip_deletion_repartition_after_refine),
266 _node_to_elem_map_built(false),
267 _node_to_active_semilocal_elem_map_built(false),
268 _patch_size(other_mesh._patch_size),
269 _ghosting_patch_size(other_mesh._ghosting_patch_size),
270 _max_leaf_size(other_mesh._max_leaf_size),
271 _patch_update_strategy(other_mesh._patch_update_strategy),
272 _regular_orthogonal_mesh(false),
273 _is_split(other_mesh._is_split),
274 _has_lower_d(other_mesh._has_lower_d),
275 _allow_recovery(other_mesh._allow_recovery),
276 _construct_node_list_from_side_list(other_mesh._construct_node_list_from_side_list),
277 _need_delete(other_mesh._need_delete),
278 _allow_remote_element_removal(other_mesh._allow_remote_element_removal),
279 _need_ghost_ghosted_boundaries(other_mesh._need_ghost_ghosted_boundaries),
280 _coord_sys(other_mesh._coord_sys),
281 _rz_coord_axis(other_mesh._rz_coord_axis),
282 _subdomain_id_to_rz_coord_axis(other_mesh._subdomain_id_to_rz_coord_axis),
283 _coord_system_set(other_mesh._coord_system_set),
284 _provided_coord_blocks(other_mesh._provided_coord_blocks),
285 _doing_p_refinement(other_mesh._doing_p_refinement)
289 getMesh().get_boundary_info() = other_mesh.
getMesh().get_boundary_info();
291 const std::set<SubdomainID> & subdomains = other_mesh.
meshSubdomains();
292 for (
const auto & sbd_id : subdomains)
296 const BoundaryInfo & other_boundary_info = other_mesh.
getMesh().get_boundary_info();
297 BoundaryInfo & boundary_info =
getMesh().get_boundary_info();
300 std::vector<BoundaryID> side_boundaries;
301 other_boundary_info.build_side_boundary_ids(side_boundaries);
304 for (
const auto & side_bnd_id : side_boundaries)
305 boundary_info.sideset_name(side_bnd_id) = other_boundary_info.get_sideset_name(side_bnd_id);
308 std::vector<BoundaryID> node_boundaries;
309 other_boundary_info.build_node_boundary_ids(node_boundaries);
311 for (
const auto & node_bnd_id : node_boundaries)
312 boundary_info.nodeset_name(node_bnd_id) = other_boundary_info.get_nodeset_name(node_bnd_id);
315 for (std::size_t i = 0; i <
_bounds.size(); ++i)
318 for (std::size_t j = 0; j <
_bounds[i].size(); ++j)
366 TIME_SECTION(
"prepare", 2,
"Preparing Mesh",
true);
368 bool called_prepare_for_use =
false;
370 mooseAssert(
_mesh,
"The MeshBase has not been constructed");
374 getMesh().allow_renumbering(
false);
378 mooseAssert(mesh_to_clone->is_prepared(),
379 "The mesh we wish to clone from must already be prepared");
380 _mesh = mesh_to_clone->clone();
383 else if (!
_mesh->is_prepared())
385 _mesh->prepare_for_use();
387 called_prepare_for_use =
true;
391 return called_prepare_for_use;
395 for (
const auto &
elem :
getMesh().element_ptr_range())
401 const auto add_subdomain_id = getParam<std::vector<SubdomainID>>(
"add_subdomain_ids");
409 const std::set<BoundaryID> & local_bids =
getMesh().get_boundary_info().get_boundary_ids();
412 const std::set<BoundaryID> & local_node_bids =
413 getMesh().get_boundary_info().get_node_boundary_ids();
416 const std::set<BoundaryID> & local_side_bids =
417 getMesh().get_boundary_info().get_side_boundary_ids();
435 "Trying to set coordinate system type information based on the user input file, but " 436 "the coordinate system type information has already been set programmatically! " 437 "Either remove your coordinate system type information from the input file, or contact " 438 "your application developer");
445 const auto rz_coord_blocks = getParam<std::vector<SubdomainName>>(
"rz_coord_blocks");
446 const auto rz_coord_origins = getParam<std::vector<Point>>(
"rz_coord_origins");
447 const auto rz_coord_directions = getParam<std::vector<RealVectorValue>>(
"rz_coord_directions");
448 if (rz_coord_origins.size() == rz_coord_blocks.size() &&
449 rz_coord_directions.size() == rz_coord_blocks.size())
451 std::vector<std::pair<Point, RealVectorValue>> rz_coord_axes;
452 for (
unsigned int i = 0; i < rz_coord_origins.size(); ++i)
453 rz_coord_axes.push_back(std::make_pair(rz_coord_origins[i], rz_coord_directions[i]));
458 mooseError(
"The parameter 'rz_coord_axis' may not be provided if 'rz_coord_blocks', " 459 "'rz_coord_origins', and 'rz_coord_directions' are provided.");
462 mooseError(
"The parameters 'rz_coord_blocks', 'rz_coord_origins', and " 463 "'rz_coord_directions' must all have the same size.");
467 mooseError(
"If any of the parameters 'rz_coord_blocks', 'rz_coord_origins', and " 468 "'rz_coord_directions' are provided, then all must be provided.");
479 return called_prepare_for_use;
485 TIME_SECTION(
"update", 3,
"Updating Mesh",
true);
509 if (!
mesh.is_serial())
511 "Hybrid finite element method must use replicated mesh.\nCurrently lower-dimensional mesh " 512 "does not support mesh re-partitioning and a debug assertion being hit related with " 513 "neighbors of lower-dimensional element, with distributed mesh.");
516 if (!
mesh.is_prepared())
517 mesh.find_neighbors();
520 unsigned int max_n_sides = 0;
523 std::set<Elem *> deleteable_elems;
524 for (
auto &
elem :
mesh.element_ptr_range())
527 deleteable_elems.insert(
elem);
528 else if (
elem->n_sides() > max_n_sides)
529 max_n_sides =
elem->n_sides();
531 for (
auto &
elem : deleteable_elems)
534 mesh.comm().max(max_n_sides);
536 deleteable_elems.clear();
541 std::vector<Elem *> side_elems;
543 for (
const auto &
elem :
mesh.active_element_ptr_range())
546 if (
elem->interior_parent())
549 for (
const auto side :
elem->side_index_range())
551 Elem * neig =
elem->neighbor_ptr(side);
553 bool build_side =
false;
558 mooseAssert(!neig->is_remote(),
"We error if the mesh is not serial");
561 else if (neig->level() ==
elem->level() &&
elem->id() < neig->id())
567 std::unique_ptr<Elem> side_elem(
elem->build_side_ptr(side,
false));
570 side_elem->processor_id() =
elem->processor_id();
579 side_elem->set_id(max_elem_id +
elem->id() * max_n_sides + side);
580 side_elem->set_unique_id(max_unique_id +
elem->id() * max_n_sides + side);
585 side_elem->set_interior_parent(
elem);
587 side_elems.push_back(side_elem.release());
590 auto pair = std::make_pair(
elem, side);
591 auto link = std::make_pair(pair, side_elems.back());
592 auto ilink = std::make_pair(side_elems.back(), side);
603 for (
auto &
elem : side_elems)
613 const bool skip_partitioning_old =
mesh.skip_partitioning();
614 mesh.skip_partitioning(
true);
616 mesh.allow_find_neighbors(
false);
617 mesh.prepare_for_use();
618 mesh.skip_partitioning(skip_partitioning_old);
624 mooseDeprecated(
"MooseMesh::node() is deprecated, please use MooseMesh::nodeRef() instead");
631 mooseDeprecated(
"MooseMesh::node() is deprecated, please use MooseMesh::nodeRef() instead");
639 mooseAssert(node_ptr,
"Missing node");
664 if (i >
getMesh().max_node_id())
669 auto & node_ptr = it->second;
670 mooseAssert(node_ptr,
"Uninitialized quadrature node");
674 return getMesh().query_node_ptr(i);
686 TIME_SECTION(
"meshChanged", 3,
"Updating Because Mesh Changed");
717 TIME_SECTION(
"cacheChangedLists", 5,
"Caching Changed Lists");
721 Threads::parallel_reduce(elem_range, cclt);
744 const std::vector<const Elem *> &
749 return elem_to_child_pair->second;
755 TIME_SECTION(
"updateActiveSemiLocalNodeRange", 5,
"Updating ActiveSemiLocalNode Range");
761 for (
const auto &
elem : *active_local_elems)
763 for (
unsigned int n = 0; n <
elem->n_nodes(); ++n)
770 Node *
node =
const_cast<Node *
>(
elem->node_ptr(n));
777 for (
const auto & ghost_elem_id : ghosted_elems)
780 for (
unsigned int n = 0; n <
elem->n_nodes(); n++)
829 TIME_SECTION(
"buildNodeList", 5,
"Building Node List");
833 auto bc_tuples =
getMesh().get_boundary_info().build_node_list();
835 int n = bc_tuples.size();
838 for (
const auto & t : bc_tuples)
840 auto node_id = std::get<0>(t);
841 auto bc_id = std::get<1>(t);
863 unsigned int n =
getMesh().n_elem_integers() + 1;
874 for (
const auto &
elem :
getMesh().active_local_element_ptr_range())
875 for (
unsigned int i = 0; i < n; ++i)
877 auto id = (i == n - 1 ?
elem->subdomain_id() :
elem->get_extra_integer(i));
883 for (
unsigned int j = 0; j < n; ++j)
885 auto idj = (j == n - 1 ?
elem->subdomain_id() :
elem->get_extra_integer(j));
891 for (
unsigned int i = 0; i < n; ++i)
901 std::unordered_map<dof_id_type, std::set<dof_id_type>>
906 if (!mesh_base.has_elem_integer(from_id_name))
907 mooseError(
"Mesh does not have the element integer name '", from_id_name,
"'");
908 if (!mesh_base.has_elem_integer(to_id_name))
909 mooseError(
"Mesh does not have the element integer name '", to_id_name,
"'");
911 const auto id1 = mesh_base.get_elem_integer_index(from_id_name);
912 const auto id2 = mesh_base.get_elem_integer_index(to_id_name);
914 std::unordered_map<dof_id_type, std::set<dof_id_type>> id_map;
916 id_map[id] = std::set<dof_id_type>();
918 for (
const auto &
elem : mesh_base.active_local_element_ptr_range())
919 id_map[
elem->get_extra_integer(id1)].insert(
elem->get_extra_integer(id2));
921 for (
auto & [
id, ids] : id_map)
930 std::set<dof_id_type>
933 std::set<dof_id_type> unique_ids;
935 for (
auto &
id : pair.second)
936 unique_ids.insert(
id);
940 std::set<dof_id_type>
943 std::set<dof_id_type> unique_ids;
944 for (
auto & blk : blks)
948 mooseError(
"Block ", blk,
" is not available on the mesh");
950 for (
auto & mid : it->second)
951 unique_ids.insert(mid);
959 TIME_SECTION(
"buildBndElemList", 5,
"Building Boundary Elements List");
963 auto bc_tuples =
getMesh().get_boundary_info().build_active_side_list();
965 int n = bc_tuples.size();
968 for (
const auto & t : bc_tuples)
970 auto elem_id = std::get<0>(t);
972 auto bc_id = std::get<2>(t);
979 const std::map<dof_id_type, std::vector<dof_id_type>> &
984 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
993 Threads::in_threads =
false;
994 TIME_SECTION(
"nodeToElemMap", 5,
"Building Node To Elem Map");
997 for (
const auto &
elem :
getMesh().active_element_ptr_range())
998 for (
unsigned int n = 0; n <
elem->n_nodes(); n++)
1007 const std::map<dof_id_type, std::vector<dof_id_type>> &
1012 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
1019 Threads::in_threads =
false;
1020 TIME_SECTION(
"nodeToActiveSemilocalElemMap", 5,
"Building SemiLocalElemMap");
1025 for (
const auto &
elem :
1028 for (
unsigned int n = 0; n <
elem->n_nodes(); n++)
1044 TIME_SECTION(
"getActiveLocalElementRange", 5);
1058 TIME_SECTION(
"getActiveNodeRange", 5);
1071 "_active_semilocal_node_range has not been created yet!");
1081 TIME_SECTION(
"getLocalNodeRange", 5);
1095 TIME_SECTION(
"getBoundaryNodeRange", 5);
1109 TIME_SECTION(
"getBoundaryElementRange", 5);
1118 const std::unordered_map<boundary_id_type, std::unordered_set<dof_id_type>> &
1122 "use MooseMesh::getBoundariesToActiveSemiLocalElemIds");
1126 const std::unordered_map<boundary_id_type, std::unordered_set<dof_id_type>> &
1132 std::unordered_set<dof_id_type>
1139 return std::unordered_set<dof_id_type>{};
1143 std::unordered_set<dof_id_type>
1147 std::unordered_set<dof_id_type> neighbor_elems;
1150 const auto & [elem_ptr, elem_side, elem_bid] = *bnd_elem;
1151 if (elem_bid == bid)
1153 const auto * neighbor = elem_ptr->neighbor_ptr(elem_side);
1158 if (neighbor->active())
1159 neighbor_elems.insert(neighbor->id());
1162 std::vector<const Elem *> family;
1163 neighbor->active_family_tree_by_neighbor(family, elem_ptr);
1164 for (
const auto & child_neighbor : family)
1165 neighbor_elems.insert(child_neighbor->id());
1171 return neighbor_elems;
1176 const std::set<SubdomainID> & blk_group)
const 1178 mooseAssert(
_bnd_elem_range,
"Boundary element range is not initialized");
1183 const auto & [elem_ptr, elem_side, elem_bid] = *bnd_elem;
1184 if (elem_bid == bid)
1187 if (blk_group.find(elem_ptr->subdomain_id()) != blk_group.end())
1189 const auto *
const neighbor = elem_ptr->neighbor_ptr(elem_side);
1193 mooseError(
"Insufficient level of geometrical ghosting to determine " 1194 "if a boundary is internal to the mesh");
1200 if (blk_group.find(neighbor->subdomain_id()) != blk_group.end())
1211 TIME_SECTION(
"cacheInfo", 3);
1220 for (
const auto &
elem :
getMesh().element_ptr_range())
1222 const Elem * ip_elem =
elem->interior_parent();
1228 unsigned int ip_side = ip_elem->which_side_am_i(
elem);
1233 auto pair = std::make_pair(ip_elem, ip_side);
1235 std::pair<std::pair<const Elem *, unsigned short int>,
const Elem *>(pair,
elem));
1239 for (
unsigned int nd = 0; nd <
elem->n_nodes(); ++nd)
1246 for (
const auto &
elem :
getMesh().active_local_element_ptr_range())
1250 for (
unsigned int side = 0; side <
elem->n_sides(); side++)
1253 sub_data.boundary_ids.insert(boundary_ids.begin(), boundary_ids.end());
1255 Elem * neig =
elem->neighbor_ptr(side);
1259 boundary_ids.end());
1260 SubdomainID neighbor_subdomain_id = neig->subdomain_id();
1261 if (neighbor_subdomain_id != subdomain_id)
1262 sub_data.neighbor_subs.insert(neighbor_subdomain_id);
1273 if (sub_data.is_lower_d)
1279 const std::set<SubdomainID> &
1282 std::map<dof_id_type, std::set<SubdomainID>>::const_iterator it =
1286 mooseError(
"Unable to find node: ",
node.id(),
" in any block list.");
1314 Predicates::NotNull<std::vector<const ElemInfo *>::iterator>());
1322 Predicates::NotNull<std::vector<const ElemInfo *>::iterator>());
1329 Predicates::NotNull<bnd_node_iterator_imp> p;
1337 Predicates::NotNull<bnd_node_iterator_imp> p;
1345 Predicates::NotNull<bnd_elem_iterator_imp> p;
1353 Predicates::NotNull<bnd_elem_iterator_imp> p;
1368 for (
const auto &
node :
getMesh().node_ptr_range())
1372 Node *
node =
nullptr;
1373 for (
unsigned int i = 0; i <
_node_map.size(); ++i)
1375 if (p.relative_fuzzy_equals(*
_node_map[i], tol))
1381 if (
node ==
nullptr)
1387 mooseAssert(
node !=
nullptr,
"Node is NULL");
1393 const unsigned short int side,
1394 const unsigned int qp,
1396 const Point & point)
1413 if (new_id <=
getMesh().max_node_id())
1414 mooseError(
"Quadrature node id collides with existing node id!");
1416 qnode =
new Node(point, new_id);
1445 const unsigned short int side,
1446 const unsigned int qp)
1450 "Elem has no quadrature nodes!");
1453 "Side has no quadrature nodes!");
1456 "qp not found on side!");
1476 if (boundary_name ==
"ANY_BOUNDARY_ID")
1477 mooseError(
"Please use getBoundaryIDs() when passing \"ANY_BOUNDARY_ID\"");
1504 std::vector<BoundaryID>
1506 bool generate_unknown)
const 1518 std::vector<SubdomainID>
1533 mesh.subdomain_name(subdomain_id) =
name;
1539 return getMesh().subdomain_name(subdomain_id);
1542 std::vector<SubdomainName>
1545 std::vector<SubdomainName> names(subdomain_ids.size());
1547 for (
unsigned int i = 0; i < subdomain_ids.size(); i++)
1556 BoundaryInfo & boundary_info =
getMesh().get_boundary_info();
1559 if (boundary_info.get_side_boundary_ids().count(boundary_id))
1560 boundary_info.sideset_name(boundary_id) =
name;
1562 boundary_info.nodeset_name(boundary_id) =
name;
1568 BoundaryInfo & boundary_info =
getMesh().get_boundary_info();
1571 if (boundary_info.get_side_boundary_ids().count(boundary_id))
1572 return boundary_info.get_sideset_name(boundary_id);
1574 return boundary_info.get_nodeset_name(boundary_id);
1579 inline const Point &
1583 return *(item.first);
1588 unsigned int var_number,
1589 PeriodicBoundaries * pbs)
const 1591 TIME_SECTION(
"buildPeriodicNodeMap", 5);
1594 periodic_node_map.clear();
1597 std::vector<PeriodicNodeInfo> periodic_nodes;
1598 for (
const auto & t :
getMesh().get_boundary_info().build_node_list())
1601 auto node =
_mesh->node_ptr(std::get<0>(t));
1602 mooseAssert(
node !=
nullptr,
1603 "libMesh::BoundaryInfo::build_node_list() returned an ID for a non-existing node");
1604 auto bc_id = std::get<1>(t);
1605 periodic_nodes.emplace_back(
node, bc_id);
1609 std::sort(periodic_nodes.begin(),
1610 periodic_nodes.end(),
1612 {
return a.second > b.second; });
1615 using KDTreeType = nanoflann::KDTreeSingleIndexAdaptor<
1616 nanoflann::L2_Simple_Adaptor<Real, PointListAdaptor<PeriodicNodeInfo>,
Real, std::size_t>,
1620 const unsigned int max_leaf_size = 20;
1623 auto kd_tree = std::make_unique<KDTreeType>(
1624 LIBMESH_DIM, point_list, nanoflann::KDTreeSingleIndexAdaptorParams(max_leaf_size));
1625 mooseAssert(kd_tree !=
nullptr,
"KDTree was not properly initialized.");
1626 kd_tree->buildIndex();
1630 std::vector<nanoflann::ResultItem<std::size_t, Real>> ret_matches;
1633 PeriodicBoundaryBase * periodic =
nullptr;
1634 BoundaryID current_bc_id = BoundaryInfo::invalid_id;
1635 for (
auto & pair : periodic_nodes)
1638 if (pair.second != current_bc_id)
1640 current_bc_id = pair.second;
1641 periodic = pbs->boundary(current_bc_id);
1642 if (periodic && !periodic->is_my_variable(var_number))
1651 ret_matches.clear();
1654 const auto id = pair.first->id();
1657 Point search_point = periodic->get_corresponding_pos(*pair.first);
1660 kd_tree->radiusSearch(&(search_point)(0),
libMesh::TOLERANCE, ret_matches, search_params);
1661 for (
auto & match_pair : ret_matches)
1663 const auto & match = periodic_nodes[match_pair.first];
1665 if (match.second == periodic->pairedboundary)
1666 periodic_node_map.emplace(
id, match.first->id());
1673 unsigned int var_number,
1674 PeriodicBoundaries * pbs)
const 1676 TIME_SECTION(
"buildPeriodicNodeSets", 5);
1678 periodic_node_sets.clear();
1681 for (
const auto & t :
getMesh().get_boundary_info().build_node_list())
1683 auto node_id = std::get<0>(t);
1684 auto bc_id = std::get<1>(t);
1687 if (periodic_node_sets.find(bc_id) != periodic_node_sets.end())
1688 periodic_node_sets[bc_id].insert(node_id);
1691 const PeriodicBoundaryBase * periodic = pbs->boundary(bc_id);
1692 if (periodic && periodic->is_my_variable(var_number))
1693 periodic_node_sets[bc_id].insert(node_id);
1701 TIME_SECTION(
"detectOrthogonalDimRanges", 5);
1708 unsigned int dim =
getMesh().mesh_dimension();
1711 for (
const auto &
node :
getMesh().node_ptr_range())
1717 min[i] = (*node)(i);
1719 max[i] = (*node)(i);
1727 std::vector<bool> extreme_matches(8,
false);
1728 std::vector<unsigned int> comp_map(3);
1729 for (
const auto &
node :
getMesh().node_ptr_range())
1732 unsigned int coord_match = 0;
1748 if (coord_match == LIBMESH_DIM)
1751 extreme_matches[comp_map[
X] * 4 + comp_map[
Y] * 2 + comp_map[
Z]] =
true;
1756 this->
comm().
max(extreme_matches);
1757 if (std::count(extreme_matches.begin(), extreme_matches.end(),
true) == (1 <<
dim))
1775 TIME_SECTION(
"detectPairedSidesets", 5);
1787 const Point minus_x(-1, 0, 0), plus_x(1, 0, 0), minus_y(0, -1, 0), plus_y(0, 1, 0),
1788 minus_z(0, 0, -1), plus_z(0, 0, 1);
1791 const unsigned int dim =
getMesh().mesh_dimension();
1794 std::vector<std::set<BoundaryID>> minus_x_ids(
dim), plus_x_ids(
dim), minus_y_ids(
dim),
1795 plus_y_ids(
dim), minus_z_ids(
dim), plus_z_ids(
dim);
1797 std::vector<std::unique_ptr<FEBase>> fe_faces(
dim);
1798 std::vector<std::unique_ptr<QGauss>> qfaces(
dim);
1799 for (
unsigned side_dim = 0; side_dim <
dim; ++side_dim)
1803 qfaces[side_dim] = std::unique_ptr<QGauss>(
new QGauss(side_dim,
CONSTANT));
1806 fe_faces[side_dim] = FEBase::build(side_dim + 1, FEType(
FIRST,
LAGRANGE));
1807 fe_faces[side_dim]->attach_quadrature_rule(qfaces[side_dim].
get());
1811 BoundaryInfo & boundary_info =
getMesh().get_boundary_info();
1812 std::vector<boundary_id_type> face_ids;
1817 unsigned int side_dim =
elem->dim() - 1;
1818 const std::vector<Point> & normals = fe_faces[side_dim]->get_normals();
1821 for (
unsigned int s = 0; s <
elem->n_sides(); s++)
1824 if (
elem->neighbor_ptr(s) ==
nullptr)
1826 std::unique_ptr<Elem> side =
elem->build_side_ptr(s);
1828 fe_faces[side_dim]->reinit(
elem, s);
1834 boundary_info.boundary_ids(
elem, s, face_ids);
1837 if (normals[0].absolute_fuzzy_equals(minus_x))
1838 minus_x_ids[side_dim].insert(face_ids.begin(), face_ids.end());
1839 else if (normals[0].absolute_fuzzy_equals(plus_x))
1840 plus_x_ids[side_dim].insert(face_ids.begin(), face_ids.end());
1843 else if (normals[0].absolute_fuzzy_equals(minus_y))
1844 minus_y_ids[side_dim].insert(face_ids.begin(), face_ids.end());
1845 else if (normals[0].absolute_fuzzy_equals(plus_y))
1846 plus_y_ids[side_dim].insert(face_ids.begin(), face_ids.end());
1849 else if (normals[0].absolute_fuzzy_equals(minus_z))
1850 minus_z_ids[side_dim].insert(face_ids.begin(), face_ids.end());
1851 else if (normals[0].absolute_fuzzy_equals(plus_z))
1852 plus_z_ids[side_dim].insert(face_ids.begin(), face_ids.end());
1869 std::vector<std::pair<boundary_id_type, boundary_id_type>> vecdata;
1871 for (
unsigned side_dim = 0; side_dim <
dim; ++side_dim)
1875 for (
auto bd = minus_x_ids[side_dim].begin(); bd != minus_x_ids[side_dim].end(); bd++)
1876 vecdata.emplace_back(side_dim * 6 + 0, *bd);
1878 for (
auto bd = plus_x_ids[side_dim].begin(); bd != plus_x_ids[side_dim].end(); bd++)
1879 vecdata.emplace_back(side_dim * 6 + 1, *bd);
1881 for (
auto bd = minus_y_ids[side_dim].begin(); bd != minus_y_ids[side_dim].end(); bd++)
1882 vecdata.emplace_back(side_dim * 6 + 2, *bd);
1884 for (
auto bd = plus_y_ids[side_dim].begin(); bd != plus_y_ids[side_dim].end(); bd++)
1885 vecdata.emplace_back(side_dim * 6 + 3, *bd);
1887 for (
auto bd = minus_z_ids[side_dim].begin(); bd != minus_z_ids[side_dim].end(); bd++)
1888 vecdata.emplace_back(side_dim * 6 + 4, *bd);
1890 for (
auto bd = plus_z_ids[side_dim].begin(); bd != plus_z_ids[side_dim].end(); bd++)
1891 vecdata.emplace_back(side_dim * 6 + 5, *bd);
1897 for (
auto pair = vecdata.begin(); pair != vecdata.end(); pair++)
1900 auto side_dim = pair->first / 6;
1901 auto side = pair->first % 6;
1906 minus_x_ids[side_dim].insert(pair->second);
1909 plus_x_ids[side_dim].insert(pair->second);
1912 minus_y_ids[side_dim].insert(pair->second);
1915 plus_y_ids[side_dim].insert(pair->second);
1918 minus_z_ids[side_dim].insert(pair->second);
1921 plus_z_ids[side_dim].insert(pair->second);
1930 for (
unsigned side_dim = 0; side_dim <
dim; ++side_dim)
1934 if (minus_x_ids[side_dim].size() == 1 && plus_x_ids[side_dim].size() == 1)
1936 std::make_pair(*(minus_x_ids[side_dim].begin()), *(plus_x_ids[side_dim].begin())));
1938 if (minus_y_ids[side_dim].size() == 1 && plus_y_ids[side_dim].size() == 1)
1940 std::make_pair(*(minus_y_ids[side_dim].begin()), *(plus_y_ids[side_dim].begin())));
1942 if (minus_z_ids[side_dim].size() == 1 && plus_z_ids[side_dim].size() == 1)
1944 std::make_pair(*(minus_z_ids[side_dim].begin()), *(plus_z_ids[side_dim].begin())));
1957 mooseAssert(
_mesh,
"The MeshBase has not been constructed");
1958 mooseAssert(component <
_bounds.size(),
"Requested dimension out of bounds");
1966 mooseAssert(
_mesh,
"The MeshBase has not been constructed");
1967 mooseAssert(component <
_bounds.size(),
"Requested dimension out of bounds");
1982 for (
unsigned int component = 0; component <
dimension(); ++component)
1986 if (boundary_ids !=
nullptr &&
1987 ((boundary_ids->first == primary && boundary_ids->second == secondary) ||
1988 (boundary_ids->first == secondary && boundary_ids->second == primary)))
1996 mooseAssert(component <
dimension(),
"Requested dimension out of bounds");
2007 for (
unsigned int i = 0; i <
dimension(); ++i)
2035 const std::pair<BoundaryID, BoundaryID> *
2039 mooseError(
"Trying to retrieve automatic paired mapping for a mesh that is not regular and " 2042 mooseAssert(component <
dimension(),
"Requested dimension out of bounds");
2056 std::map<ElemType, Elem *> canonical_elems;
2060 for (
const auto &
elem :
getMesh().element_ptr_range())
2064 if (canonical_elems.find(
type) ==
2065 canonical_elems.end())
2069 Elem * stored = canonical_elems[
type];
2070 if (
elem->id() < stored->id())
2076 for (
const auto & can_it : canonical_elems)
2078 Elem *
elem = can_it.second;
2094 for (
unsigned int side = 0; side <
elem->n_sides(); side++)
2102 for (
unsigned int child = 0; child <
elem->n_children(); ++child)
2103 for (
unsigned int side = 0; side <
elem->n_sides();
2105 if (!
elem->is_child_on_side(child, side))
2118 std::map<ElemType, std::pair<Elem *, unsigned int>> elems_and_max_p_level;
2120 for (
const auto &
elem :
getMesh().active_element_ptr_range())
2123 auto & [picked_elem, max_p_level] = elems_and_max_p_level[
type];
2131 std::vector<Point> volume_ref_points_coarse, volume_ref_points_fine, face_ref_points_coarse,
2132 face_ref_points_fine;
2133 std::vector<unsigned int> p_levels;
2135 for (
auto & [elem_type, elem_p_level_pair] : elems_and_max_p_level)
2137 auto & [moose_elem, max_p_level] = elem_p_level_pair;
2138 const auto dim = moose_elem->dim();
2141 assembly->
reinit(moose_elem);
2142 assembly->
reinit(moose_elem, 0);
2147 ReplicatedMesh
mesh(self_comm);
2149 for (
const auto & nd : moose_elem->node_ref_range())
2152 Elem *
const elem =
mesh.add_elem(Elem::build(elem_type).release());
2153 for (
const auto i :
elem->node_index_range())
2154 elem->set_node(i) =
mesh.node_ptr(i);
2156 std::unique_ptr<FEBase> fe(FEBase::build(
dim, p_refinable_fe_type));
2157 std::unique_ptr<FEBase> fe_face(FEBase::build(
dim, p_refinable_fe_type));
2159 const auto & face_phys_points = fe_face->get_xyz();
2161 fe->attach_quadrature_rule(qrule);
2162 fe_face->attach_quadrature_rule(qrule_face);
2164 volume_ref_points_coarse = qrule->get_points();
2165 fe_face->reinit(
elem, (
unsigned int)0);
2166 FEInterface::inverse_map(
2167 dim, p_refinable_fe_type,
elem, face_phys_points, face_ref_points_coarse);
2169 p_levels.resize(max_p_level + 1);
2170 std::iota(p_levels.begin(), p_levels.end(), 0);
2171 MeshRefinement mesh_refinement(
mesh);
2173 for (
const auto p_level : p_levels)
2175 mesh_refinement.uniformly_p_refine(1);
2177 volume_ref_points_fine = qrule->get_points();
2178 fe_face->reinit(
elem, (
unsigned int)0);
2179 FEInterface::inverse_map(
2180 dim, p_refinable_fe_type,
elem, face_phys_points, face_ref_points_fine);
2182 const auto map_key = std::make_pair(elem_type, p_level);
2188 auto fill_maps = [
this](
const auto & coarse_ref_points,
2189 const auto & fine_ref_points,
2193 mapPoints(fine_ref_points, coarse_ref_points, refine_map);
2194 mapPoints(coarse_ref_points, fine_ref_points, coarsen_map);
2198 volume_ref_points_coarse, volume_ref_points_fine, volume_coarsen_map, volume_refine_map);
2199 fill_maps(face_ref_points_coarse, face_ref_points_fine, face_coarsen_map, face_refine_map);
2202 volume_ref_points_fine.swap(volume_ref_points_coarse);
2203 face_ref_points_fine.swap(face_ref_points_coarse);
2211 TIME_SECTION(
"buildRefinementAndCoarseningMaps", 5,
"Building Refinement And Coarsening Maps");
2226 TIME_SECTION(
"buildRefinementMap", 5,
"Building Refinement Map");
2230 mooseAssert(parent_side == child_side,
2231 "Parent side must match child_side if not passing a specific child!");
2233 std::pair<int, ElemType> the_pair(parent_side,
elem.type());
2236 mooseError(
"Already built a qp refinement map!");
2238 std::vector<std::pair<unsigned int, QpMap>> coarsen_map;
2241 &
elem, qrule, qrule_face, refinement_map, coarsen_map, parent_side, child, child_side);
2245 std::pair<int, int> child_pair(child, child_side);
2251 mooseError(
"Already built a qp refinement map!");
2253 std::vector<std::pair<unsigned int, QpMap>> coarsen_map;
2254 std::vector<std::vector<QpMap>> & refinement_map =
2257 &
elem, qrule, qrule_face, refinement_map, coarsen_map, parent_side, child, child_side);
2261 const std::vector<std::vector<QpMap>> &
2266 mooseAssert(parent_side == child_side,
2267 "Parent side must match child_side if not passing a specific child!");
2269 std::pair<int, ElemType> the_pair(parent_side,
elem.type());
2272 mooseError(
"Could not find a suitable qp refinement map!");
2278 std::pair<int, int> child_pair(child, child_side);
2284 mooseError(
"Could not find a suitable qp refinement map!");
2300 TIME_SECTION(
"buildCoarseningMap", 5,
"Building Coarsening Map");
2302 std::pair<int, ElemType> the_pair(input_side,
elem.type());
2305 mooseError(
"Already built a qp coarsening map!");
2307 std::vector<std::vector<QpMap>> refinement_map;
2308 std::vector<std::pair<unsigned int, QpMap>> & coarsen_map =
2315 &
elem, qrule, qrule_face, refinement_map, coarsen_map, input_side, -1, input_side);
2325 const std::vector<std::pair<unsigned int, QpMap>> &
2328 std::pair<int, ElemType> the_pair(input_side,
elem.type());
2331 mooseError(
"Could not find a suitable qp refinement map!");
2338 const std::vector<Point> & to,
2339 std::vector<QpMap> & qp_map)
2341 unsigned int n_from = from.size();
2342 unsigned int n_to = to.size();
2344 qp_map.resize(n_from);
2346 for (
unsigned int i = 0; i < n_from; ++i)
2348 const Point & from_point = from[i];
2350 QpMap & current_map = qp_map[i];
2352 for (
unsigned int j = 0; j < n_to; ++j)
2354 const Point & to_point = to[j];
2360 current_map.
_from = i;
2361 current_map.
_to = j;
2371 std::vector<std::vector<QpMap>> & refinement_map,
2372 std::vector<std::pair<unsigned int, QpMap>> & coarsen_map,
2377 TIME_SECTION(
"findAdaptivityQpMaps", 5);
2380 mesh.skip_partitioning(
true);
2382 unsigned int dim = template_elem->dim();
2385 for (
unsigned int i = 0; i < template_elem->n_nodes(); ++i)
2386 mesh.add_point(template_elem->point(i));
2388 Elem *
elem =
mesh.add_elem(Elem::build(template_elem->type()).release());
2390 for (
unsigned int i = 0; i < template_elem->n_nodes(); ++i)
2391 elem->set_node(i) =
mesh.node_ptr(i);
2393 std::unique_ptr<FEBase> fe(FEBase::build(
dim, FEType()));
2395 const std::vector<Point> & q_points_volume = fe->get_xyz();
2397 std::unique_ptr<FEBase> fe_face(FEBase::build(
dim, FEType()));
2399 const std::vector<Point> & q_points_face = fe_face->get_xyz();
2401 fe->attach_quadrature_rule(&qrule);
2402 fe_face->attach_quadrature_rule(&qrule_face);
2405 const std::vector<Point> * q_points;
2407 if (parent_side != -1)
2409 fe_face->reinit(
elem, parent_side);
2410 q_points = &q_points_face;
2415 q_points = &q_points_volume;
2418 std::vector<Point> parent_ref_points;
2420 FEInterface::inverse_map(
elem->dim(), FEType(),
elem, *q_points, parent_ref_points);
2421 MeshRefinement mesh_refinement(
mesh);
2422 mesh_refinement.uniformly_refine(1);
2427 std::map<unsigned int, std::vector<Point>> child_to_ref_points;
2429 unsigned int n_children =
elem->n_children();
2431 refinement_map.resize(n_children);
2433 std::vector<unsigned int> children;
2436 children.push_back(child);
2439 children.resize(n_children);
2440 for (
unsigned int child = 0; child < n_children; ++child)
2441 children[child] = child;
2444 for (
unsigned int i = 0; i < children.size(); ++i)
2446 unsigned int child = children[i];
2448 if ((parent_side != -1 && !
elem->is_child_on_side(child, parent_side)))
2451 const Elem * child_elem =
elem->child_ptr(child);
2453 if (child_side != -1)
2455 fe_face->reinit(child_elem, child_side);
2456 q_points = &q_points_face;
2460 fe->reinit(child_elem);
2461 q_points = &q_points_volume;
2464 std::vector<Point> child_ref_points;
2466 FEInterface::inverse_map(
elem->dim(), FEType(),
elem, *q_points, child_ref_points);
2467 child_to_ref_points[child] = child_ref_points;
2469 std::vector<QpMap> & qp_map = refinement_map[child];
2472 mapPoints(child_ref_points, parent_ref_points, qp_map);
2475 coarsen_map.resize(parent_ref_points.size());
2478 for (
unsigned int child = 0; child < n_children; child++)
2480 if (parent_side != -1 && !
elem->is_child_on_side(child, child_side))
2483 std::vector<Point> & child_ref_points = child_to_ref_points[child];
2485 std::vector<QpMap> qp_map;
2488 mapPoints(parent_ref_points, child_ref_points, qp_map);
2491 for (
unsigned int parent_qp = 0; parent_qp < parent_ref_points.size(); ++parent_qp)
2493 std::pair<unsigned int, QpMap> & child_and_map = coarsen_map[parent_qp];
2494 unsigned int & closest_child = child_and_map.first;
2495 QpMap & closest_map = child_and_map.second;
2497 QpMap & current_map = qp_map[parent_qp];
2501 closest_child = child;
2502 closest_map = current_map;
2513 TIME_SECTION(
"changeBoundaryId", 6);
2524 BoundaryInfo & boundary_info =
mesh.get_boundary_info();
2527 std::vector<boundary_id_type> old_ids;
2532 unsigned int n_sides =
elem->n_sides();
2533 for (
unsigned int s = 0; s != n_sides; ++s)
2535 boundary_info.boundary_ids(
elem, s, old_ids);
2536 if (std::find(old_ids.begin(), old_ids.end(), old_id) != old_ids.end())
2538 std::vector<boundary_id_type> new_ids(old_ids);
2539 std::replace(new_ids.begin(), new_ids.end(), old_id, new_id);
2542 boundary_info.remove_side(
elem, s);
2543 boundary_info.add_side(
elem, s, new_ids);
2546 boundary_info.add_side(
elem, s, new_ids);
2555 boundary_info.remove_id(old_id);
2571 mooseError(
"MooseMesh::clone() is no longer supported, use MooseMesh::safeClone() instead.");
2602 std::unique_ptr<MeshBase>
2606 dim = getParam<MooseEnum>(
"dim");
2608 std::unique_ptr<MeshBase>
mesh;
2610 mesh = buildTypedMesh<DistributedMesh>(
dim);
2612 mesh = buildTypedMesh<ReplicatedMesh>(
dim);
2620 _mesh = std::move(mesh_base);
2637 mooseError(
"You cannot use the mesh splitter capability with DistributedMesh!");
2639 TIME_SECTION(
"init", 2);
2646 const bool skip_partitioning_later =
getMesh().skip_partitioning();
2647 getMesh().skip_partitioning(
true);
2648 const bool allow_renumbering_later =
getMesh().allow_renumbering();
2649 getMesh().allow_renumbering(
false);
2654 TIME_SECTION(
"readRecoveredMesh", 2);
2658 getMesh().allow_renumbering(allow_renumbering_later);
2659 getMesh().skip_partitioning(skip_partitioning_later);
2665 getMesh().skip_partitioning(
true);
2670 getMesh().skip_partitioning(
false);
2672 if (getParam<bool>(
"build_all_side_lowerd_mesh"))
2680 return getMesh().mesh_dimension();
2686 const Real abs_zero = 1e-12;
2690 for (
unsigned int dim = LIBMESH_DIM;
dim >= 1; --
dim)
2704 if (
const auto & elem_dims =
mesh.elem_dimensions();
mesh.is_prepared() && elem_dims.size() == 1)
2705 return *elem_dims.begin();
2707 unsigned short dim = 0;
2709 const std::set<SubdomainID> subdomain_ids_set(subdomain_ids.begin(), subdomain_ids.end());
2710 for (
const auto &
elem :
mesh.active_subdomain_set_elements_ptr_range(subdomain_ids_set))
2718 std::vector<BoundaryID>
2721 std::vector<BoundaryID> ids;
2722 getMesh().get_boundary_info().boundary_ids(
elem, side, ids);
2726 const std::set<BoundaryID> &
2729 return getMesh().get_boundary_info().get_boundary_ids();
2736 getMesh().get_boundary_info().build_node_list_from_side_list();
2741 std::vector<unsigned short int> & sl,
2742 std::vector<boundary_id_type> & il)
2744 #ifdef LIBMESH_ENABLE_DEPRECATED 2745 mooseDeprecated(
"The version of MooseMesh::buildSideList() taking three arguments is " 2746 "deprecated, call the version that returns a vector of tuples instead.");
2747 getMesh().get_boundary_info().build_side_list(el, sl, il);
2752 mooseError(
"The version of MooseMesh::buildSideList() taking three " 2753 "arguments is not available in your version of libmesh, call the " 2754 "version that returns a vector of tuples instead.");
2758 std::vector<std::tuple<dof_id_type, unsigned short int, boundary_id_type>>
2761 return getMesh().get_boundary_info().build_side_list();
2764 std::vector<std::tuple<dof_id_type, unsigned short int, boundary_id_type>>
2767 return getMesh().get_boundary_info().build_active_side_list();
2773 return getMesh().get_boundary_info().side_with_boundary_id(
elem, boundary_id);
2776 MeshBase::node_iterator
2779 return getMesh().local_nodes_begin();
2782 MeshBase::node_iterator
2785 return getMesh().local_nodes_end();
2788 MeshBase::const_node_iterator
2791 return getMesh().local_nodes_begin();
2794 MeshBase::const_node_iterator
2797 return getMesh().local_nodes_end();
2800 MeshBase::element_iterator
2803 return getMesh().active_local_elements_begin();
2806 const MeshBase::element_iterator
2809 return getMesh().active_local_elements_end();
2812 MeshBase::const_element_iterator
2815 return getMesh().active_local_elements_begin();
2818 const MeshBase::const_element_iterator
2821 return getMesh().active_local_elements_end();
2839 return getMesh().max_node_id();
2845 return getMesh().max_elem_id();
2851 mooseDeprecated(
"MooseMesh::elem() is deprecated, please use MooseMesh::elemPtr() instead");
2858 mooseDeprecated(
"MooseMesh::elem() is deprecated, please use MooseMesh::elemPtr() instead");
2877 return getMesh().query_elem_ptr(i);
2883 return getMesh().query_elem_ptr(i);
2896 mooseError(
"We don't have any right to tell the libmesh mesh that it *is* prepared. Only a " 2897 "call to prepare_for_use should tell us that");
2902 _mesh->set_isnt_prepared();
2920 const std::set<SubdomainID> &
2926 const std::set<BoundaryID> &
2932 const std::set<BoundaryID> &
2938 const std::set<BoundaryID> &
2952 std::unique_ptr<std::map<BoundaryID, RealVectorValue>> boundary_map)
2960 mooseDeprecated(
"setBoundaryToNormalMap(std::map<BoundaryID, RealVectorValue> * boundary_map) is " 2961 "deprecated, use the unique_ptr version instead");
2990 const std::set<unsigned int> &
2996 const std::vector<Real> &
3010 template <
typename T>
3011 struct extra_ghost_elem_inserter
3013 using iterator_category = std::output_iterator_tag;
3014 using value_type = T;
3016 extra_ghost_elem_inserter(DistributedMesh & m) :
mesh(m) {}
3018 void operator=(
const Elem * e) {
mesh.add_extra_ghost_elem(const_cast<Elem *>(e)); }
3024 extra_ghost_elem_inserter &
operator++() {
return *
this; }
3026 extra_ghost_elem_inserter
operator++(
int) {
return extra_ghost_elem_inserter(*
this); }
3032 extra_ghost_elem_inserter &
operator*() {
return *
this; }
3035 DistributedMesh &
mesh;
3048 struct CompareElemsByLevel
3050 bool operator()(
const Elem * a,
const Elem * b)
const 3054 const unsigned int al = a->level(), bl = b->level();
3057 return (al == bl) ? aid < bid : al < bl;
3073 TIME_SECTION(
"GhostGhostedBoundaries", 3);
3075 parallel_object_only();
3077 DistributedMesh &
mesh =
dynamic_cast<DistributedMesh &
>(
getMesh());
3085 std::set<const Elem *, CompareElemsByLevel> boundary_elems_to_ghost;
3086 std::set<Node *> connected_nodes_to_ghost;
3090 for (
const auto & t :
mesh.get_boundary_info().build_side_list())
3092 auto elem_id = std::get<0>(t);
3093 auto bc_id = std::get<2>(t);
3097 Elem *
elem =
mesh.elem_ptr(elem_id);
3099 #ifdef LIBMESH_ENABLE_AMR 3101 Elem * parent =
elem->parent();
3105 parent = parent->parent();
3113 boundary_elems_to_ghost.insert(felem);
3121 for (
unsigned int n = 0; n < felem->n_nodes(); ++n)
3122 connected_nodes_to_ghost.insert(const_cast<Node *>(felem->node_ptr(n)));
3128 const auto prior_ghost_elems =
mesh.extra_ghost_elems();
3130 mesh.comm().allgather_packed_range(&
mesh,
3131 connected_nodes_to_ghost.begin(),
3132 connected_nodes_to_ghost.end(),
3133 extra_ghost_elem_inserter<Node>(
mesh));
3135 mesh.comm().allgather_packed_range(&
mesh,
3136 boundary_elems_to_ghost.begin(),
3137 boundary_elems_to_ghost.end(),
3138 extra_ghost_elem_inserter<Elem>(
mesh));
3140 const auto & current_ghost_elems =
mesh.extra_ghost_elems();
3142 std::set_difference(current_ghost_elems.begin(),
3143 current_ghost_elems.end(),
3144 prior_ghost_elems.begin(),
3145 prior_ghost_elems.end(),
3174 BoundingBox bbox = MeshTools::create_local_bounding_box(
getMesh());
3178 Real inflation_amount = inflation_multiplier * (bbox.max() - bbox.min()).
norm();
3179 Point inflation(inflation_amount, inflation_amount, inflation_amount);
3181 bbox.first -= inflation;
3182 bbox.second += inflation;
3200 mooseAssert(
_mesh,
"Mesh hasn't been created");
3207 mooseAssert(
_mesh,
"Mesh hasn't been created");
3219 const std::vector<dof_id_type> &
3222 std::map<boundary_id_type, std::vector<dof_id_type>>::const_iterator it =
3232 static const std::vector<dof_id_type> empty_vec;
3239 mooseError(
"Unable to nodeset ID: ", nodeset_id,
'.');
3246 const std::set<BoundaryID> &
3252 mooseError(
"Unable to find subdomain ID: ", subdomain_id,
'.');
3254 return it->second.boundary_ids;
3257 std::set<BoundaryID>
3261 std::set<BoundaryID> boundary_ids(bnd_ids.begin(), bnd_ids.end());
3262 std::unordered_map<SubdomainID, std::set<BoundaryID>>::const_iterator it =
3265 boundary_ids.insert(it->second.begin(), it->second.end());
3267 return boundary_ids;
3270 std::set<SubdomainID>
3273 std::set<SubdomainID> subdomain_ids;
3275 if (data.boundary_ids.find(bid) != data.boundary_ids.end())
3276 subdomain_ids.insert(sub_id);
3278 return subdomain_ids;
3281 std::set<SubdomainID>
3284 std::set<SubdomainID> subdomain_ids;
3286 if (it.second.find(bid) != it.second.end())
3287 subdomain_ids.insert(it.first);
3289 return subdomain_ids;
3292 std::set<SubdomainID>
3297 if (it.second.find(bid) != it.second.end())
3298 subdomain_ids.insert(it.first);
3300 return subdomain_ids;
3303 const std::set<SubdomainID> &
3309 mooseError(
"Unable to find subdomain ID: ", subdomain_id,
'.');
3311 return it->second.neighbor_subs;
3317 bool found_node =
false;
3320 if (it.second.find(node_id) != it.second.end())
3332 bool found_node =
false;
3333 std::map<boundary_id_type, std::set<dof_id_type>>::const_iterator it =
_bnd_node_ids.find(bnd_id);
3335 if (it->second.find(node_id) != it->second.end())
3343 bool found_elem =
false;
3346 if (it.second.find(elem_id) != it.second.end())
3358 bool found_elem =
false;
3361 if (it->second.find(elem_id) != it->second.end())
3372 " with DistributedMesh!\n",
3373 "Consider specifying parallel_type = 'replicated' in your input file\n",
3374 "to prevent it from being run with DistributedMesh.");
3392 bool use_distributed_mesh,
3397 switch (partitioner)
3401 if (use_distributed_mesh)
3402 partitioner =
"parmetis";
3404 partitioner =
"metis";
3414 mesh_base.partitioner().reset(
new LinearPartitioner);
3418 if (!params.
isParamValid(
"centroid_partitioner_direction"))
3420 "centroid_partitioner_direction",
3421 "If using the centroid partitioner you _must_ specify centroid_partitioner_direction!");
3425 if (direction ==
"x")
3426 mesh_base.partitioner().reset(
new CentroidPartitioner(CentroidPartitioner::X));
3427 else if (direction ==
"y")
3428 mesh_base.partitioner().reset(
new CentroidPartitioner(CentroidPartitioner::Y));
3429 else if (direction ==
"z")
3430 mesh_base.partitioner().reset(
new CentroidPartitioner(CentroidPartitioner::Z));
3431 else if (direction ==
"radial")
3432 mesh_base.partitioner().reset(
new CentroidPartitioner(CentroidPartitioner::RADIAL));
3436 mesh_base.partitioner().reset(
new HilbertSFCPartitioner);
3439 mesh_base.partitioner().reset(
new MortonSFCPartitioner);
3459 bool mesh_has_second_order_elements =
false;
3461 if ((*it)->default_order() ==
SECOND)
3463 mesh_has_second_order_elements =
true;
3468 comm().
max(mesh_has_second_order_elements);
3469 return mesh_has_second_order_elements;
3478 std::unique_ptr<PointLocatorBase>
3481 return getMesh().sub_point_locator();
3487 mooseAssert(!Threads::in_threads,
3488 "This routine has not been implemented for threads. Please query this routine before " 3489 "a threaded region or contact a MOOSE developer to discuss.");
3492 using Keytype = std::pair<const Elem *, unsigned short int>;
3495 std::vector<std::tuple<dof_id_type, unsigned short int, boundary_id_type>> side_list =
3497 std::map<Keytype, std::set<boundary_id_type>> side_map;
3498 for (
auto & [elem_id, side, bc_id] : side_list)
3500 const Elem *
elem =
_mesh->elem_ptr(elem_id);
3501 Keytype key(
elem, side);
3502 auto & bc_set = side_map[key];
3503 bc_set.insert(bc_id);
3517 auto begin =
getMesh().active_elements_begin();
3518 auto end =
getMesh().active_elements_end();
3530 for (
unsigned int side = 0; side <
elem->n_sides(); ++side)
3533 const Elem * neighbor =
elem->neighbor_ptr(side);
3540 mooseAssert(!neighbor || (neighbor->level() <
elem->level() ? neighbor->active() :
true),
3541 "If the neighbor is coarser than the element, we expect that the neighbor must " 3551 std::set<boundary_id_type> & boundary_ids = fi.boundaryIDs();
3552 boundary_ids.clear();
3558 fi.computeBoundaryCoefficients();
3562 auto lit = side_map.find(Keytype(&fi.elem(), fi.elemSideID()));
3563 if (lit != side_map.end())
3564 boundary_ids.insert(lit->second.begin(), lit->second.end());
3566 if (fi.neighborPtr())
3568 auto rit = side_map.find(Keytype(fi.neighborPtr(), fi.neighborSideID()));
3569 if (rit != side_map.end())
3570 boundary_ids.insert(rit->second.begin(), rit->second.end());
3581 const Elem *
const elem = &fi.elem();
3582 const auto side = fi.elemSideID();
3588 mooseAssert(pair_it.second,
"We should be adding unique FaceInfo objects.");
3592 if (fi.elem().processor_id() == this->
processor_id() ||
3593 (fi.neighborPtr() && (fi.neighborPtr()->processor_id() == this->
processor_id())))
3598 if (ei.second.elem()->processor_id() == this->
processor_id())
3611 mooseAssert(it->second,
3612 "For some reason, the FaceInfo object is NULL! Try calling " 3613 "`buildFiniteVolumeInfo()` before using this accessor!");
3628 mooseError(
"Trying to compute face- and elem-info coords when the information is dirty");
3633 const SubdomainID elem_subdomain_id = fi.elemSubdomainID();
3634 const SubdomainID neighbor_subdomain_id = fi.neighborSubdomainID();
3637 *
this, elem_subdomain_id, fi.faceCentroid(), fi.faceCoord(), neighbor_subdomain_id);
3642 *
this, ei.second.subdomain_id(), ei.second.centroid(), ei.second.coordFactor());
3657 "EDGE EDGE2 EDGE3 EDGE4 QUAD QUAD4 QUAD8 QUAD9 TRI3 TRI6 HEX HEX8 HEX20 HEX27 TET4 TET10 " 3658 "PRISM6 PRISM15 PRISM18 PYRAMID5 PYRAMID13 PYRAMID14");
3667 _mesh->allow_remote_element_removal(allow_remote_element_removal);
3669 if (!allow_remote_element_removal)
3681 mooseError(
"Cannot delete remote elements because we have not yet attached a MeshBase");
3683 _mesh->allow_remote_element_removal(
true);
3685 _mesh->delete_remote_elements();
3692 !Threads::in_threads,
3693 "Performing writes to faceInfo variable association maps. This must be done unthreaded!");
3695 std::vector<const MooseVariableFieldBase *> moose_vars;
3700 for (
const auto & var : nl_variables)
3701 if (var->fieldType() == 0)
3702 moose_vars.push_back(var);
3706 for (
const auto & var : aux_variables)
3707 if (var->fieldType() == 0)
3708 moose_vars.push_back(var);
3712 const SubdomainID elem_subdomain_id = face.elemSubdomainID();
3713 const SubdomainID neighbor_subdomain_id = face.neighborSubdomainID();
3716 for (
unsigned int j = 0; j < moose_vars.size(); ++j)
3720 const std::pair<unsigned int, unsigned int> var_sys =
3722 std::set<SubdomainID> var_subdomains = var->
blockIDs();
3733 bool var_defined_elem = var_subdomains.find(elem_subdomain_id) != var_subdomains.end();
3734 bool var_defined_neighbor =
3735 var_subdomains.find(neighbor_subdomain_id) != var_subdomains.end();
3736 if (var_defined_elem && var_defined_neighbor)
3738 else if (!var_defined_elem && !var_defined_neighbor)
3743 if (var_defined_elem)
3745 else if (var_defined_neighbor)
3757 mooseAssert(!Threads::in_threads,
3758 "Performing writes to elemInfo dof indices. This must be done unthreaded!");
3764 ElemInfo & elem_info = elem_info_pair.second;
3768 dof_vector.resize(num_eqs);
3776 for (
const auto & var : variables)
3778 const auto & var_subdomains = var->blockIDs();
3781 if (var->isFV() && var_subdomains.find(elem_info.
subdomain_id()) != var_subdomains.end())
3783 std::vector<dof_id_type> indices;
3784 var->dofMap().dof_indices(elem_info.
elem(), indices, var->number());
3785 mooseAssert(indices.size() == 1,
"We expect to have only one dof per element!");
3786 dof_vector[sys.number()][var->number()] = indices[0];
3796 for (
const auto & var : aux_variables)
3798 const auto & var_subdomains = var->blockIDs();
3801 if (var->isFV() && var_subdomains.find(elem_info.
subdomain_id()) != var_subdomains.end())
3803 std::vector<dof_id_type> indices;
3804 var->dofMap().dof_indices(elem_info.
elem(), indices, var->number());
3805 mooseAssert(indices.size() == 1,
"We expect to have only one dof per element!");
3806 dof_vector[sys.number()][var->number()] = indices[0];
3826 TIME_SECTION(
"setCoordSystem", 5,
"Setting Coordinate System");
3829 const std::string param_name =
isParamValid(
"coord_block") ?
"coord_block" :
"block";
3830 mooseWarning(
"Supplied blocks in the 'setCoordSystem' method do not match the value of the " 3833 "' parameter. Did you provide different parameter values for 'Mesh/",
3835 "' and 'Problem/block'?. We will honor the parameter value from 'Mesh/",
3839 "If we are arriving here due to a bad specification in the Problem block, then we " 3840 "should have already set our coordinate system subdomains from the Mesh block");
3844 mooseError(
"Supplied coordinate systems in the 'setCoordSystem' method do not match the value " 3845 "of the 'Mesh/coord_type' parameter. Did you provide different parameter values for " 3846 "'coord_type' to 'Mesh' and 'Problem'?");
3851 for (
const auto & sub_name : blocks)
3854 subdomains.insert(sub_id);
3857 if (coord_sys.
size() <= 1)
3860 const auto coord_type = coord_sys.
size() == 0
3862 : Moose::stringToEnum<Moose::CoordinateSystemType>(coord_sys[0]);
3863 for (
const auto sid : subdomains)
3868 if (blocks.size() != coord_sys.
size())
3869 mooseError(
"Number of blocks and coordinate systems does not match.");
3875 Moose::stringToEnum<Moose::CoordinateSystemType>(coord_sys[i]);
3879 for (
const auto & sid : subdomains)
3882 "' does not have a coordinate system specified.");
3895 return (*it).second;
3897 mooseError(
"Requested subdomain ", sid,
" does not exist.");
3905 bool result = std::all_of(
3909 typename std::unordered_map<SubdomainID, Moose::CoordinateSystemType>::const_reference
3910 item) {
return (item.second == unique_system); });
3912 mooseError(
"The unique coordinate system of the mesh was requested by the mesh contains " 3913 "multiple blocks with different coordinate systems");
3916 mooseError(
"General axisymmetric coordinate axes are being used, and it is currently " 3917 "conservatively assumed that in this case there is no unique coordinate system.");
3919 return unique_system;
3922 const std::map<SubdomainID, Moose::CoordinateSystemType> &
3938 const std::vector<SubdomainName> & blocks,
3939 const std::vector<std::pair<Point, RealVectorValue>> & axes)
3942 mooseAssert(blocks.size() == axes.size(),
"Blocks and axes vectors must be the same length.");
3946 const auto it =
_coord_sys.find(subdomain_id);
3950 "' has not set a coordinate system. Make sure to call setCoordSystem() before " 3951 "setGeneralAxisymmetricCoordAxes().");
3956 const auto direction = axes[i].second;
3957 if (direction.is_zero())
3958 mooseError(
"Only nonzero vectors may be supplied for RZ directions.");
3961 std::make_pair(axes[i].first, direction.unit());
3966 "' was provided in setGeneralAxisymmetricCoordAxes(), but the coordinate system " 3967 "for this block is not 'RZ'.");
3973 for (
const auto subdomain_id : all_subdomain_ids)
3978 "' was specified to use the 'RZ' coordinate system but was not given in " 3979 "setGeneralAxisymmetricCoordAxes().");
3984 const std::pair<Point, RealVectorValue> &
3989 return (*it).second;
3991 mooseError(
"Requested subdomain ", subdomain_id,
" does not exist.");
4013 mooseError(
"getAxisymmetricRadialCoord() should not be called if " 4014 "setGeneralAxisymmetricCoordAxes() has been called.");
4025 for (
const auto &
elem :
getMesh().element_ptr_range())
4030 " which contains 3D elements.");
4032 mooseError(
"An RSPHERICAL coordinate system was requested for subdomain " +
4055 std::map<SubdomainName, SubdomainID> subdomain;
4059 if (!sub_name.empty() && subdomain.count(sub_name) > 0)
4062 " is used for both subdomain with ID=",
4063 subdomain[sub_name],
4066 ", Please rename one of them!");
4068 subdomain[sub_name] = sbd_id;
4072 const std::vector<QpMap> &
4075 const std::map<std::pair<ElemType, unsigned int>, std::vector<QpMap>> & map)
const 4077 mooseAssert(
elem.active() &&
elem.p_refinement_flag() == Elem::JUST_REFINED,
4078 "These are the conditions that should be met for requesting a refinement map");
4081 return libmesh_map_find(map,
4082 std::make_pair(
elem.type(), cast_int<unsigned int>(
elem.p_level() - 1)));
4085 const std::vector<QpMap> &
4088 const std::map<std::pair<ElemType, unsigned int>, std::vector<QpMap>> & map)
const 4090 mooseAssert(
elem.active() &&
elem.p_refinement_flag() == Elem::JUST_COARSENED,
4091 "These are the conditions that should be met for requesting a coarsening map");
4092 return libmesh_map_find(map, std::make_pair(
elem.type(),
elem.p_level()));
4095 const std::vector<QpMap> &
4101 const std::vector<QpMap> &
4107 const std::vector<QpMap> &
4113 const std::vector<QpMap> &
ParallelType _parallel_type
Can be set to DISTRIBUTED, REPLICATED, or DEFAULT.
static InputParameters validParams()
Typical "Moose-style" constructor and copy constructor.
virtual bnd_node_iterator bndNodesEnd()
virtual bnd_elem_iterator bndElemsEnd()
std::vector< std::vector< Real > > _bounds
The bounds in each dimension of the mesh for regular orthogonal meshes.
std::set< Node * > _semilocal_node_list
Used for generating the semilocal node range.
std::map< dof_id_type, Node * > _quadrature_nodes
const std::vector< QpMap > & getPCoarseningSideMap(const Elem &elem) const
Get the map describing for each side quadrature point (qp) on the coarse level which qp on the previo...
virtual Real getMaxInDimension(unsigned int component) const
static const std::string & checkpointSuffix()
The file suffix for the checkpoint mesh.
bool _node_to_elem_map_built
std::vector< Node * > _extreme_nodes
A vector containing the nodes at the corners of a regular orthogonal mesh.
const std::vector< MooseVariableFieldBase * > & getVariables(THREAD_ID tid)
Node * addQuadratureNode(const Elem *elem, const unsigned short int side, const unsigned int qp, BoundaryID bid, const Point &point)
Adds a fictitious "QuadratureNode".
std::vector< std::tuple< dof_id_type, unsigned short int, boundary_id_type > > buildSideList()
As above, but uses the non-deprecated std::tuple interface.
const std::set< BoundaryID > & meshNodesetIds() const
Returns a read-only reference to the set of nodesets currently present in the Mesh.
void buildElemIDInfo()
Build extra data for faster access to the information of extra element integers.
std::vector< FaceInfo > _all_face_info
FaceInfo object storing information for face based loops.
void allgather(const T &send_data, std::vector< T, A > &recv_data) const
std::vector< const FaceInfo * > _face_info
Holds only those FaceInfo objects that have processor_id equal to this process's id, e.g.
bool allowRemoteElementRemoval() const
Whether we are allow remote element removal.
virtual Real getMinInDimension(unsigned int component) const
Returns the min or max of the requested dimension respectively.
bool elemHasFaceInfo(const Elem &elem, const Elem *const neighbor)
This function infers based on elements if the faceinfo between them belongs to the element or not...
ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems...
virtual void onMeshChanged()
Declares a callback function that is executed at the conclusion of meshChanged(). ...
bool prepared() const
Setter/getter for whether the mesh is prepared.
void needsPrepareForUse()
If this method is called, we will call libMesh's prepare_for_use method when we call Moose's prepare ...
const std::set< BoundaryID > & getBoundaryIDs() const
Returns a const reference to a set of all user-specified boundary IDs.
bool _is_nemesis
True if a Nemesis Mesh was read in.
std::vector< SubdomainName > _provided_coord_blocks
Set for holding user-provided coordinate system type block names.
virtual MooseMesh & clone() const
Clone method.
bool isCustomPartitionerRequested() const
Setter and getter for _custom_partitioner_requested.
bool _need_ghost_ghosted_boundaries
A parallel mesh generator such as DistributedRectilinearMeshGenerator already make everything ready...
A class for creating restricted objects.
bool isUltimateMaster() const
Whether or not this app is the ultimate master app.
unsigned int _uniform_refine_level
The level of uniform refinement requested (set to zero if AMR is disabled)
std::vector< dof_id_type > _min_ids
Minimum integer ID for each extra element integer.
Helper class for sorting Boundary Nodes so that we always get the same order of application for bound...
std::unordered_set< dof_id_type > getBoundaryActiveSemiLocalElemIds(BoundaryID bid) const
Return all ids of elements which have a side which is part of a sideset.
auto norm() const -> decltype(std::norm(Real()))
const MooseUnits & lengthUnit() const
void checkDuplicateSubdomainNames()
Loop through all subdomain IDs and check if there is name duplication used for the subdomains with sa...
const unsigned int invalid_uint
const std::set< BoundaryID > & getSubdomainBoundaryIds(const SubdomainID subdomain_id) const
Get the list of boundary ids associated with the given subdomain id.
void mooseDeprecated(Args &&... args) const
RealVectorValue _half_range
A convenience vector used to hold values in each dimension representing half of the range...
Keeps track of stuff related to assembling.
void setCoordData(const MooseMesh &other_mesh)
Set the coordinate system data to that of other_mesh.
std::map< std::pair< ElemType, unsigned int >, std::vector< QpMap > > _elem_type_to_p_refinement_map
virtual std::size_t numNonlinearSystems() const override
bool _finite_volume_info_dirty
virtual Elem * elemPtr(const dof_id_type i)
The definition of the bnd_elem_iterator struct.
bool isBoundaryNode(dof_id_type node_id) const
Returns true if the requested node is in the list of boundary nodes, false otherwise.
face_info_iterator ownedFaceInfoBegin()
Iterators to owned faceInfo objects.
const std::map< dof_id_type, std::vector< dof_id_type > > & nodeToActiveSemilocalElemMap()
If not already created, creates a map from every node to all active semilocal elements to which they ...
std::vector< std::tuple< dof_id_type, unsigned short int, boundary_id_type > > buildActiveSideList() const
Calls BoundaryInfo::build_active_side_list.
static void setPartitioner(MeshBase &mesh_base, MooseEnum &partitioner, bool use_distributed_mesh, const InputParameters ¶ms, MooseObject &context_obj)
Method for setting the partitioner on the passed in mesh_base object.
void buildLowerDMesh()
Build lower-d mesh for all sides.
const std::set< BoundaryID > & meshSidesetIds() const
Returns a read-only reference to the set of sidesets currently present in the Mesh.
unsigned int number() const
Get variable number coming from libMesh.
std::unordered_map< const Elem *, unsigned short int > _lower_d_elem_to_higher_d_elem_side
void cacheFVElementalDoFs() const
Cache the DoF indices for FV variables on each element.
static constexpr Real TOLERANCE
void cacheFaceInfoVariableOwnership() const
Cache if variables live on the elements connected by the FaceInfo objects.
bool _custom_partitioner_requested
const std::unordered_map< boundary_id_type, std::unordered_set< dof_id_type > > & getBoundariesToElems() const
Returns a map of boundaries to ids of elements on the boundary.
Moose::CoordinateSystemType getUniqueCoordSystem() const
Get the coordinate system from the mesh, it must be the same in all subdomains otherwise this will er...
std::map< dof_id_type, std::vector< dof_id_type > > _node_to_elem_map
A map of all of the current nodes to the elements that they are connected to.
bool isSemiLocal(Node *const node) const
Returns true if the node is semi-local.
const Elem * getLowerDElem(const Elem *, unsigned short int) const
Returns a const pointer to a lower dimensional element that corresponds to a side of a higher dimensi...
RealVectorValue minPeriodicVector(unsigned int nonlinear_var_num, Point p, Point q) const
This function returns the minimum vector between two points on the mesh taking into account periodici...
StoredRange< MooseMesh::const_bnd_elem_iterator, const BndElement * > ConstBndElemRange
const std::vector< std::pair< unsigned int, QpMap > > & getCoarseningMap(const Elem &elem, int input_side)
Get the coarsening map for a given element type.
std::unordered_map< boundary_id_type, std::unordered_set< dof_id_type > > _bnd_elem_ids
Map of set of elem IDs connected to each boundary.
const Elem * elem() const
void determineUseDistributedMesh()
Determine whether to use a distributed mesh.
const std::vector< std::vector< QpMap > > & getRefinementMap(const Elem &elem, int parent_side, int child, int child_side)
Get the refinement map for a given element type.
const boundary_id_type side_id
const std::string & getBoundaryName(BoundaryID boundary_id)
Return the name of the boundary given the id.
void cacheChangedLists()
Cache information about what elements were refined and coarsened in the previous step.
bool isTranslatedPeriodic(unsigned int nonlinear_var_num, unsigned int component) const
Returns whether this generated mesh is periodic in the given dimension for the given variable...
void coordTransformFactor(const SubProblem &s, SubdomainID sub_id, const P &point, C &factor, SubdomainID neighbor_sub_id=libMesh::Elem::invalid_subdomain_id)
Computes a conversion multiplier for use when computing integraals for the current coordinate system ...
const Point & getPoint(const PointObject &item) const
get a Point reference from the PointData object at index idx in the list
The definition of the bnd_node_iterator struct.
const SubdomainID BOUNDARY_SIDE_LOWERD_ID
std::vector< const ElemInfo * > _elem_info
Holds only those ElemInfo objects that have processor_id equal to this process's id, e.g.
void buildHRefinementAndCoarseningMaps(Assembly *assembly)
bool usingGeneralAxisymmetricCoordAxes() const
Returns true if general axisymmetric coordinate axes are being used.
const std::set< SubdomainID > & getBlockConnectedBlocks(const SubdomainID subdomain_id) const
Get the list of subdomains neighboring a given subdomain.
virtual const Node * queryNodePtr(const dof_id_type i) const
std::unordered_map< std::pair< const Elem *, unsigned short int >, const Elem * > _higher_d_elem_side_to_lower_d_elem
Holds a map from a high-order element side to its corresponding lower-d element.
Helper object for holding qp mapping info.
unsigned int size() const
Return the number of active items in the MultiMooseEnum.
bool _has_lower_d
Whether there are any lower-dimensional blocks that are manifolds of higher-dimensional block faces...
const std::vector< Real > & getGhostedBoundaryInflation() const
Return a writable reference to the _ghosted_boundaries_inflation vector.
std::unique_ptr< ConstElemPointerRange > _refined_elements
The elements that were just refined.
std::vector< std::vector< bool > > _id_identical_flag
Flags to indicate whether or not any two extra element integers are the same.
virtual dof_id_type maxElemId() const
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
const Parallel::Communicator & comm() const
virtual bnd_elem_iterator bndElemsBegin()
Return iterators to the beginning/end of the boundary elements list.
void setUniformRefineLevel(unsigned int, bool deletion=true)
Set uniform refinement level.
const std::vector< QpMap > & getPCoarseningMapHelper(const Elem &elem, const std::map< std::pair< ElemType, unsigned int >, std::vector< QpMap >> &) const
MooseEnum _partitioner_name
The partitioner used on this mesh.
std::map< dof_id_type, std::set< SubdomainID > > _block_node_list
list of nodes that belongs to a specified block (domain)
bool _node_to_active_semilocal_elem_map_built
std::map< boundary_id_type, std::set< dof_id_type > > _bnd_node_ids
Map of sets of node IDs in each boundary.
virtual void init()
Initialize the Mesh object.
ConstElemPointerRange * refinedElementRange() const
Return a range that is suitable for threaded execution over elements that were just refined...
unsigned int getHigherDSide(const Elem *elem) const
Returns the local side ID of the interior parent aligned with the lower dimensional element...
std::unordered_map< std::pair< const Elem *, unsigned int >, FaceInfo * > _elem_side_to_face_info
Map from elem-side pair to FaceInfo.
void detectPairedSidesets()
This routine detects paired sidesets of a regular orthogonal mesh (.i.e.
const std::set< SubdomainID > & getNodeBlockIds(const Node &node) const
Return list of blocks to which the given node belongs.
This class provides an interface for common operations on field variables of both FE and FV types wit...
const Parallel::Communicator & _communicator
virtual const std::set< SubdomainID > & blockIDs() const
Return the block subdomain ids for this object Note, if this is not block restricted, this function returns all mesh subdomain ids.
void setMeshBoundaryIDs(std::set< BoundaryID > boundary_IDs)
Sets the set of BoundaryIDs Is called by AddAllSideSetsByNormals.
std::map< boundary_id_type, std::vector< dof_id_type > > _node_set_nodes
list of nodes that belongs to a specified nodeset: indexing [nodeset_id] -> [array of node ids] ...
std::vector< subdomain_id_type > getSubdomainIDs(const libMesh::MeshBase &mesh, const std::vector< SubdomainName > &subdomain_name)
Get the associated subdomainIDs for the subdomain names that are passed in.
bool _linear_finite_volume_dofs_cached
std::basic_ostream< charT, traits > * os
void changeBoundaryId(const boundary_id_type old_id, const boundary_id_type new_id, bool delete_prev)
Change all the boundary IDs for a given side from old_id to new_id.
std::map< std::pair< ElemType, unsigned int >, std::vector< QpMap > > _elem_type_to_p_coarsening_side_map
std::set< Elem * > _ghost_elems_from_ghost_boundaries
Set of elements ghosted by ghostGhostedBoundaries.
std::map< std::pair< int, ElemType >, std::vector< std::pair< unsigned int, QpMap > > > _elem_type_to_coarsening_map
Holds mappings for volume to volume and parent side to child side Map key:
virtual void buildMesh()=0
Must be overridden by child classes.
void setPartitionerHelper(MeshBase *mesh=nullptr)
void deleteRemoteElements()
Delete remote elements.
bool isSplitMesh() const
Whether or not this is a split mesh operation.
unsigned int _to
The qp to map to.
BoundaryID _bnd_id
boundary id for the node
ConstNodeRange * getLocalNodeRange()
Node * _node
pointer to the node
Real distance(const Point &p)
virtual const Node & nodeRef(const dof_id_type i) const
bool _allow_recovery
Whether or not this Mesh is allowed to read a recovery file.
virtual const std::string & name() const
Get the name of the class.
bool operator()(const BndNode *const &lhs, const BndNode *const &rhs)
void buildNodeListFromSideList()
Calls BoundaryInfo::build_node_list_from_side_list().
void mooseWarning(Args &&... args) const
Emits a warning prefixed with object name and type.
FEProblemBase & feProblem() const
const std::string & getSubdomainName(SubdomainID subdomain_id) const
Return the name of a block given an id.
void setPatchUpdateStrategy(Moose::PatchUpdateType patch_update_strategy)
Set the patch size update strategy.
void buildFiniteVolumeInfo() const
Builds the face and elem info vectors that store meta-data needed for looping over and doing calculat...
std::unordered_map< SubdomainID, std::set< BoundaryID > > _neighbor_subdomain_boundary_ids
Holds a map from neighbor subomdain ids to the boundary ids that are attached to it.
const std::pair< Point, RealVectorValue > & getGeneralAxisymmetricCoordAxis(SubdomainID subdomain_id) const
Gets the general axisymmetric coordinate axis for a block.
void reinit(const Elem *elem)
Reinitialize objects (JxW, q_points, ...) for an elements.
SubdomainID getSubdomainID(const SubdomainName &subdomain_name, const MeshBase &mesh)
Gets the subdomain ID associated with the given SubdomainName.
StoredRange< MeshBase::const_element_iterator, const Elem *> ConstElemRange
std::unique_ptr< NodeRange > _active_node_range
auto max(const L &left, const R &right)
const std::set< BoundaryID > & meshBoundaryIds() const
Returns a read-only reference to the set of boundary IDs currently present in the Mesh...
virtual Elem * queryElemPtr(const dof_id_type i)
elem_info_iterator ownedElemInfoBegin()
Iterators to owned faceInfo objects.
void setIsCustomPartitionerRequested(bool cpr)
virtual EquationSystems & es() override
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
std::unique_ptr< StoredRange< MooseMesh::const_bnd_elem_iterator, const BndElement * > > _bnd_elem_range
virtual bnd_node_iterator bndNodesBegin()
Return iterators to the beginning/end of the boundary nodes list.
void mapPoints(const std::vector< Point > &from, const std::vector< Point > &to, std::vector< QpMap > &qp_map)
Find the closest points that map "from" to "to" and fill up "qp_map".
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
StoredRange< std::vector< const Elem * >::iterator, const Elem * > ConstElemPointerRange
BoundaryID getBoundaryID(const BoundaryName &boundary_name, const MeshBase &mesh)
Gets the boundary ID associated with the given BoundaryName.
QBase *const & writeableQRuleFace()
Returns the reference to the current quadrature being used on a current face.
void errorIfDistributedMesh(std::string name) const
Generate a unified error message if the underlying libMesh mesh is a DistributedMesh.
const MeshBase * getMeshPtr() const
bool getDistributedMeshOnCommandLine() const
Returns true if the user specified –distributed-mesh (or –parallel-mesh, for backwards compatibilit...
This data structure is used to store geometric and variable related metadata about each cell face in ...
const std::vector< const FaceInfo * > & faceInfo() const
Accessor for local FaceInfo objects.
std::map< ElemType, std::map< std::pair< int, int >, std::vector< std::vector< QpMap > > > > _elem_type_to_child_side_refinement_map
Holds mappings for "internal" child sides to parent volume. The second key is (child, child_side).
void updateCoordTransform()
Update the coordinate transformation object based on our coordinate system data.
std::map< SubdomainID, Moose::CoordinateSystemType > _coord_sys
Type of coordinate system per subdomain.
static const int GRAIN_SIZE
bool _use_distributed_mesh
False by default.
void libmesh_ignore(const Args &...)
std::unique_ptr< std::map< BoundaryID, RealVectorValue > > _boundary_to_normal_map
The boundary to normal map - valid only when AddAllSideSetsByNormals is active.
const dof_id_type n_nodes
bool _built_from_other_mesh
Whether or not this mesh was built from another mesh.
bool _allow_remote_element_removal
Whether to allow removal of remote elements.
SemiLocalNodeRange * getActiveSemiLocalNodeRange() const
std::unordered_set< dof_id_type > getBoundaryActiveNeighborElemIds(BoundaryID bid) const
Return all ids of neighbors of elements which have a side which is part of a sideset.
void setSubdomainName(SubdomainID subdomain_id, const SubdomainName &name)
This method sets the name for subdomain_id to name.
void clearQuadratureNodes()
Clear out any existing quadrature nodes.
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
void min(const T &r, T &o, Request &req) const
const std::map< SubdomainID, Moose::CoordinateSystemType > & getCoordSystem() const
Get the map from subdomain ID to coordinate system type, e.g.
std::vector< BndNode * > _bnd_nodes
array of boundary nodes
Every object that can be built by the factory should be derived from this class.
virtual unsigned int dimension() const
Returns MeshBase::mesh_dimension(), (not MeshBase::spatial_dimension()!) of the underlying libMesh me...
unsigned int _from
The qp to map from.
std::pair< const Node *, BoundaryID > PeriodicNodeInfo
Helper type for building periodic node maps.
QBase *const & writeableQRule()
Returns the reference to the current quadrature being used.
std::unique_ptr< MeshBase > buildMeshBaseObject(unsigned int dim=libMesh::invalid_uint)
Method to construct a libMesh::MeshBase object that is normally set and used by the MooseMesh object ...
unsigned int getAxisymmetricRadialCoord() const
Returns the desired radial direction for RZ coordinate transformation.
const std::set< unsigned int > & getGhostedBoundaries() const
Return a writable reference to the set of ghosted boundary IDs.
bool _construct_node_list_from_side_list
Whether or not to allow generation of nodesets from sidesets.
boundary_id_type BoundaryID
void buildCoarseningMap(const Elem &elem, QBase &qrule, QBase &qrule_face, int input_side)
Build the coarsening map for a given element type.
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
unsigned int sideWithBoundaryID(const Elem *const elem, const BoundaryID boundary_id) const
Calls BoundaryInfo::side_with_boundary_id().
const std::vector< dof_id_type > & getNodeList(boundary_id_type nodeset_id) const
Return a writable reference to a vector of node IDs that belong to nodeset_id.
virtual const Node * nodePtr(const dof_id_type i) const
std::vector< dof_id_type > _max_ids
Maximum integer ID for each extra element integer.
const std::vector< QpMap > & getPRefinementMapHelper(const Elem &elem, const std::map< std::pair< ElemType, unsigned int >, std::vector< QpMap >> &) const
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
void family_tree(T elem, std::vector< T > &family, bool reset=true)
void update()
Calls buildNodeListFromSideList(), buildNodeList(), and buildBndElemList().
static const dof_id_type invalid_id
const std::string & type() const
Get the type of this class.
const std::pair< BoundaryID, BoundaryID > * getPairedBoundaryMapping(unsigned int component)
This function attempts to return the paired boundary ids for the given component. ...
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
std::set< BoundaryID > _mesh_nodeset_ids
StoredRange< MeshBase::const_node_iterator, const Node *> ConstNodeRange
std::unique_ptr< MooseAppCoordTransform > _coord_transform
A coordinate transformation object that describes how to transform this problem's coordinate system i...
std::set< SubdomainID > getBoundaryConnectedBlocks(const BoundaryID bid) const
Get the list of subdomains associated with the given boundary.
void checkCoordinateSystems()
Performs a sanity check for every element in the mesh.
std::vector< BoundaryID > getBoundaryIDs(const libMesh::MeshBase &mesh, const std::vector< BoundaryName > &boundary_name, bool generate_unknown, const std::set< BoundaryID > &mesh_boundary_ids)
Gets the boundary IDs with their names.
NonlinearSystemBase & getNonlinearSystemBase(const unsigned int sys_num)
std::map< std::pair< ElemType, unsigned int >, std::vector< QpMap > > _elem_type_to_p_coarsening_map
const bool _is_split
Whether or not we are using a (pre-)split mesh (automatically DistributedMesh)
void setCoordSystem(const std::vector< SubdomainName > &blocks, const MultiMooseEnum &coord_sys)
Set the coordinate system for the provided blocks to coord_sys.
std::unique_ptr< ConstElemPointerRange > _coarsened_elements
The elements that were just coarsened.
std::set< dof_id_type > getAllElemIDs(unsigned int elem_id_index) const
Return all the unique element IDs for an extra element integer with its index.
subdomain_id_type SubdomainID
std::set< BoundaryID > _mesh_boundary_ids
A set of boundary IDs currently present in the mesh.
const Node * addUniqueNode(const Point &p, Real tol=1e-6)
Add a new node to the mesh.
std::vector< BndNode > _extra_bnd_nodes
MooseApp & _app
The MOOSE application this is associated with.
void paramError(const std::string ¶m, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
unsigned int number() const
Gets the number of this system.
bool _moose_mesh_prepared
True if prepare has been called on the mesh.
The definition of the face_info_iterator struct.
unsigned int uniformRefineLevel() const
Returns the level of uniform refinement requested (zero if AMR is disabled).
std::vector< BndElement * > _bnd_elems
array of boundary elems
std::string stringify(const T &t)
conversion to string
bool _coord_system_set
Whether the coordinate system has been set.
std::vector< SubdomainName > getSubdomainNames(const std::vector< SubdomainID > &subdomain_ids) const
Get the associated subdomainNames for the subdomain ids that are passed in.
const std::vector< QpMap > & getPRefinementMap(const Elem &elem) const
Get the map describing for each volumetric quadrature point (qp) on the refined level which qp on the...
AuxiliarySystem & getAuxiliarySystem()
Real minPeriodicDistance(unsigned int nonlinear_var_num, Point p, Point q) const
This function returns the distance between two points on the mesh taking into account periodicity for...
bool hasSecondOrderElements()
check if the mesh has SECOND order elements
unsigned int getPatchSize() const
Getter for the patch_size parameter.
void buildRefinementAndCoarseningMaps(Assembly *assembly)
Create the refinement and coarsening maps necessary for projection of stateful material properties wh...
void findAdaptivityQpMaps(const Elem *template_elem, QBase &qrule, QBase &qrule_face, std::vector< std::vector< QpMap >> &refinement_map, std::vector< std::pair< unsigned int, QpMap >> &coarsen_map, int parent_side, int child, int child_side)
Given an elem type, get maps that tell us what qp's are closest to each other between a parent and it...
bool _parallel_type_overridden
Interface for objects interacting with the PerfGraph.
MeshBase::element_iterator activeLocalElementsBegin()
Calls active_local_nodes_begin/end() on the underlying libMesh mesh object.
std::vector< Node * > _node_map
Vector of all the Nodes in the mesh for determining when to add a new point.
std::map< dof_id_type, std::map< unsigned int, std::map< dof_id_type, Node * > > > _elem_to_side_to_qp_to_quadrature_nodes
std::unique_ptr< StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode * > > _bnd_node_range
const std::vector< QpMap > & getPRefinementSideMap(const Elem &elem) const
Get the map describing for each side quadrature point (qp) on the refined level which qp on the previ...
std::unordered_map< dof_id_type, ElemInfo > _elem_to_elem_info
Map connecting elems with their corresponding ElemInfo, we use the element ID as the key...
Node * getQuadratureNode(const Elem *elem, const unsigned short int side, const unsigned int qp)
Get a specified quadrature node.
void printInfo(std::ostream &os=libMesh::out, const unsigned int verbosity=0) const
Calls print_info() on the underlying Mesh.
virtual dof_id_type nNodes() const
Calls n_nodes/elem() on the underlying libMesh mesh object.
std::pair< T, U > ResultItem
static MooseEnum partitioning()
returns MooseMesh partitioning options so other classes can use it
std::map< std::pair< ElemType, unsigned int >, std::vector< QpMap > > _elem_type_to_p_refinement_side_map
const std::vector< std::vector< dof_id_type > > & dofIndices() const
const std::vector< const Elem * > & coarsenedElementChildren(const Elem *elem) const
Get the newly removed children element ids for an element that was just coarsened.
std::unordered_map< dof_id_type, std::set< dof_id_type > > getElemIDMapping(const std::string &from_id_name, const std::string &to_id_name) const
void setBoundaryName(BoundaryID boundary_id, BoundaryName name)
This method sets the boundary name of the boundary based on the id parameter.
bool isParamSetByUser(const std::string &nm) const
Test if the supplied parameter is set by a user, as opposed to not set or set to default.
Moose::PatchUpdateType _patch_update_strategy
The patch update strategy.
infix_ostream_iterator< T, charT, traits > & operator=(T const &item)
Physical unit management class with runtime unit string parsing, unit checking, unit conversion...
void addPeriodicVariable(unsigned int var_num, BoundaryID primary, BoundaryID secondary)
For "regular orthogonal" meshes, determine if variable var_num is periodic with respect to the primar...
StoredRange< std::set< Node * >::iterator, Node * > SemiLocalNodeRange
void setCurrentSubdomainID(SubdomainID i)
set the current subdomain ID
std::set< BoundaryID > _mesh_sideset_ids
void setGeneralAxisymmetricCoordAxes(const std::vector< SubdomainName > &blocks, const std::vector< std::pair< Point, RealVectorValue >> &axes)
Sets the general coordinate axes for axisymmetric blocks.
void setBoundaryToNormalMap(std::unique_ptr< std::map< BoundaryID, RealVectorValue >> boundary_map)
Sets the mapping between BoundaryID and normal vector Is called by AddAllSideSetsByNormals.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
bool _partitioner_overridden
bool detectOrthogonalDimRanges(Real tol=1e-6)
This routine determines whether the Mesh is a regular orthogonal mesh (i.e.
void updateActiveSemiLocalNodeRange(std::set< dof_id_type > &ghosted_elems)
Clears the "semi-local" node list and rebuilds it.
std::map< const Elem *, std::vector< const Elem * > > _coarsened_element_children
Map of Parent elements to children elements for elements that were just coarsened.
std::set< dof_id_type > getElemIDsOnBlocks(unsigned int elem_id_index, const std::set< SubdomainID > &blks) const
Return all the unique element IDs for an extra element integer with its index on a set of subdomains...
unsigned int nFVVariables() const
Get the number of finite volume variables in this system.
unsigned int getBlocksMaxDimension(const std::vector< SubdomainName > &blocks) const
Returns the maximum element dimension on the given blocks.
std::unique_ptr< libMesh::MeshBase > _mesh
Pointer to underlying libMesh mesh object.
void max(const T &r, T &o, Request &req) const
NodeRange * getActiveNodeRange()
void buildPeriodicNodeSets(std::map< BoundaryID, std::set< dof_id_type >> &periodic_node_sets, unsigned int var_number, PeriodicBoundaries *pbs) const
This routine builds a datastructure of node ids organized by periodic boundary ids.
infix_ostream_iterator< T, charT, traits > & operator*()
void buildRefinementMap(const Elem &elem, QBase &qrule, QBase &qrule_face, int parent_side, int child, int child_side)
Build the refinement map for a given element type.
void setGhostedBoundaryInflation(const std::vector< Real > &inflation)
This sets the inflation amount for the bounding box for each partition for use in ghosting boundaries...
const SubdomainID INTERNAL_SIDE_LOWERD_ID
The definition of the elem_info_iterator struct.
Real dimensionWidth(unsigned int component) const
Returns the width of the requested dimension.
PatchUpdateType
Type of patch update strategy for modeling node-face constraints or contact.
bool _skip_deletion_repartition_after_refine
Whether or not skip remote deletion and repartition after uniform refinements.
std::set< SubdomainID > getBoundaryConnectedSecondaryBlocks(const BoundaryID bid) const
Get the list of subdomains associated with the given boundary of its secondary side.
bool _need_delete
Whether we need to delete remote elements after init'ing the EquationSystems.
void setAxisymmetricCoordAxis(const MooseEnum &rz_coord_axis)
For axisymmetric simulations, set the symmetry coordinate axis.
std::set< BoundaryID > getSubdomainInterfaceBoundaryIds(const SubdomainID subdomain_id) const
Get the list of boundaries that contact the given subdomain.
std::vector< const Elem * > _refined_elements
The elements that were just refined.
std::unique_ptr< ConstElemRange > _active_local_elem_range
A range for use with threading.
IntRange< T > make_range(T beg, T end)
virtual const Node & node(const dof_id_type i) const
Various accessors (pointers/references) for Node "i".
infix_ostream_iterator< T, charT, traits > & operator++()
BoundingBox getInflatedProcessorBoundingBox(Real inflation_multiplier=0.01) const
Get a (slightly inflated) processor bounding box.
std::map< unsigned int, std::vector< bool > > _periodic_dim
A map of vectors indicating which dimensions are periodic in a regular orthogonal mesh for the specif...
void setMeshBase(std::unique_ptr< MeshBase > mesh_base)
Method to set the mesh_base object.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
std::set< SubdomainID > getInterfaceConnectedBlocks(const BoundaryID bid) const
Get the list of subdomains contacting the given boundary.
const InputParameters & _pars
Parameters of this object, references the InputParameters stored in the InputParametersWarehouse.
std::vector< Real > _ghosted_boundaries_inflation
std::vector< std::unordered_map< SubdomainID, std::set< dof_id_type > > > _block_id_mapping
Unique element integer IDs for each subdomain and each extra element integers.
unsigned int _patch_size
The number of nodes to consider in the NearestNode neighborhood.
std::vector< SubdomainID > getSubdomainIDs(const std::vector< SubdomainName > &subdomain_name) const
Get the associated subdomainIDs for the subdomain names that are passed in.
elem_info_iterator ownedElemInfoEnd()
void addGhostedBoundary(BoundaryID boundary_id)
This will add the boundary ids to be ghosted to this processor.
virtual dof_id_type maxNodeId() const
Calls max_node/elem_id() on the underlying libMesh mesh object.
virtual Elem * elem(const dof_id_type i)
Various accessors (pointers/references) for Elem "i".
StoredRange< MooseMesh::const_bnd_elem_iterator, const BndElement * > * getBoundaryElementRange()
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
void paramWarning(const std::string ¶m, Args... args) const
Emits a warning prefixed with the file and line number of the given param (from the input file) along...
face_info_iterator ownedFaceInfoEnd()
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
std::unordered_map< SubdomainID, std::pair< Point, RealVectorValue > > _subdomain_id_to_rz_coord_axis
Map of subdomain ID to general axisymmetric axis.
Class used for caching additional information for elements such as the volume and centroid...
MeshBase::node_iterator localNodesEnd()
const RealVectorValue & getNormalByBoundaryID(BoundaryID id) const
Returns the normal vector associated with a given BoundaryID.
StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode * > ConstBndNodeRange
Some useful StoredRange typedefs.
std::set< SubdomainID > _mesh_subdomains
A set of subdomain IDs currently present in the mesh.
ConstElemPointerRange * coarsenedElementRange() const
Return a range that is suitable for threaded execution over elements that were just coarsened...
static InputParameters validParams()
const Moose::PatchUpdateType & getPatchUpdateStrategy() const
Get the current patch update strategy.
bool doingPRefinement() const
Query whether we have p-refinement.
std::vector< std::pair< BoundaryID, BoundaryID > > _paired_boundary
A vector holding the paired boundaries for a regular orthogonal mesh.
void ghostGhostedBoundaries()
Actually do the ghosting of boundaries that need to be ghosted to this processor. ...
std::set< unsigned int > _ghosted_boundaries
MeshBase::node_iterator localNodesBegin()
Calls local_nodes_begin/end() on the underlying libMesh mesh object.
unsigned int _rz_coord_axis
Storage for RZ axis selection.
void computeFiniteVolumeCoords() const
Compute the face coordinate value for all FaceInfo and ElemInfo objects.
void buildNodeList()
Calls BoundaryInfo::build_node_list()/build_side_list() and makes separate copies of Nodes/Elems in t...
std::unordered_map< SubdomainID, SubdomainData > _sub_to_data
Holds a map from subdomain ids to associated data.
bool isBoundaryElem(dof_id_type elem_id) const
Returns true if the requested element is in the list of boundary elements, false otherwise.
std::map< const Elem *, std::vector< const Elem * > > _coarsened_element_children
Map of Parent elements to child elements for elements that were just coarsened.
processor_id_type processor_id() const
StoredRange< MeshBase::node_iterator, Node *> NodeRange
const std::vector< QpMap > & getPCoarseningMap(const Elem &elem) const
Get the map describing for each volumetric quadrature point (qp) on the coarse level which qp on the ...
bool isRecovering() const
Whether or not this is a "recover" calculation.
SystemBase & sys()
Get the system this variable is part of.
auto min(const L &left, const R &right)
SearchParams SearchParameters
std::vector< const Elem * > _coarsened_elements
The elements that were just coarsened.
virtual std::unique_ptr< PointLocatorBase > getPointLocator() const
Proxy function to get a (sub)PointLocator from either the underlying libMesh mesh (default)...
std::string getRestartRecoverFileBase() const
The file_base for the recovery file.
const std::unordered_map< boundary_id_type, std::unordered_set< dof_id_type > > & getBoundariesToActiveSemiLocalElemIds() const
Returns a map of boundaries to ids of elements on the boundary.
const MeshBase::element_iterator activeLocalElementsEnd()
StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode * > * getBoundaryNodeRange()
void ErrorVector unsigned int
auto index_range(const T &sizable)
std::map< std::pair< int, ElemType >, std::vector< std::vector< QpMap > > > _elem_type_to_refinement_map
Holds mappings for volume to volume and parent side to child side Map key:
bool _regular_orthogonal_mesh
Boolean indicating whether this mesh was detected to be regular and orthogonal.
void buildPeriodicNodeMap(std::multimap< dof_id_type, dof_id_type > &periodic_node_map, unsigned int var_number, PeriodicBoundaries *pbs) const
This routine builds a multimap of boundary ids to matching boundary ids across all periodic boundarie...
std::map< dof_id_type, std::vector< dof_id_type > > _node_to_active_semilocal_elem_map
A map of all of the current nodes to the active elements that they are connected to.
bool prepare(const MeshBase *mesh_to_clone)
Calls prepare_for_use() if the underlying MeshBase object isn't prepared, then communicates various b...
const ElemInfo & elemInfo(const dof_id_type id) const
Accessor for the elemInfo object for a given element ID.
Real _distance
The distance between them.
void setCustomPartitioner(Partitioner *partitioner)
Setter for custom partitioner.
SubdomainID subdomain_id() const
We return the subdomain ID of the corresponding libmesh element.
static MooseEnum elemTypes()
returns MooseMesh element type options
std::unique_ptr< Partitioner > _custom_partitioner
The custom partitioner.
void meshChanged()
Declares that the MooseMesh has changed, invalidates cached data and rebuilds caches.
void buildPRefinementAndCoarseningMaps(Assembly *assembly)
BoundaryID getBoundaryID(const BoundaryName &boundary_name) const
Get the associated BoundaryID for the boundary name.
virtual dof_id_type nElem() const
const std::map< dof_id_type, std::vector< dof_id_type > > & nodeToElemMap()
If not already created, creates a map from every node to all elements to which they are connected...
bool isBoundaryFullyExternalToSubdomains(BoundaryID bid, const std::set< SubdomainID > &blk_group) const
Returns whether a boundary (given by its id) is not crossing through a group of blocks, by which we mean that elements on both sides of the boundary are in those blocks.
std::unique_ptr< SemiLocalNodeRange > _active_semilocal_node_range
const std::set< SubdomainID > & meshSubdomains() const
Returns a read-only reference to the set of subdomains currently present in the Mesh.
SubdomainID getSubdomainID(const SubdomainName &subdomain_name) const
Get the associated subdomain ID for the subdomain name.
std::unique_ptr< ConstNodeRange > _local_node_range
void setupFiniteVolumeMeshData() const
Sets up the additional data needed for finite volume computations.
void set_union(T &data, const unsigned int root_id) const
const RemoteElem * remote_elem
virtual unsigned int effectiveSpatialDimension() const
Returns the effective spatial dimension determined by the coordinates actually used by the mesh...