32 #include "libmesh/bounding_box.h" 33 #include "libmesh/boundary_info.h" 34 #include "libmesh/mesh_tools.h" 35 #include "libmesh/parallel.h" 36 #include "libmesh/mesh_communication.h" 37 #include "libmesh/periodic_boundary_base.h" 38 #include "libmesh/fe_base.h" 39 #include "libmesh/fe_interface.h" 40 #include "libmesh/mesh_inserter_iterator.h" 41 #include "libmesh/mesh_communication.h" 42 #include "libmesh/mesh_inserter_iterator.h" 43 #include "libmesh/mesh_tools.h" 44 #include "libmesh/parallel.h" 45 #include "libmesh/parallel_elem.h" 46 #include "libmesh/parallel_node.h" 47 #include "libmesh/parallel_ghost_sync.h" 48 #include "libmesh/utility.h" 49 #include "libmesh/remote_elem.h" 50 #include "libmesh/linear_partitioner.h" 51 #include "libmesh/centroid_partitioner.h" 52 #include "libmesh/parmetis_partitioner.h" 53 #include "libmesh/hilbert_sfc_partitioner.h" 54 #include "libmesh/morton_sfc_partitioner.h" 55 #include "libmesh/edge_edge2.h" 56 #include "libmesh/mesh_refinement.h" 57 #include "libmesh/quadrature.h" 58 #include "libmesh/boundary_info.h" 59 #include "libmesh/periodic_boundaries.h" 60 #include "libmesh/quadrature_gauss.h" 61 #include "libmesh/point_locator_base.h" 62 #include "libmesh/default_coupling.h" 63 #include "libmesh/ghost_point_neighbors.h" 64 #include "libmesh/fe_type.h" 65 #include "libmesh/enum_to_string.h" 73 #if NANOFLANN_VERSION < 0x150 78 template <
typename T,
typename U>
88 MooseEnum parallel_type(
"DEFAULT REPLICATED DISTRIBUTED",
"DEFAULT");
91 "DEFAULT: Use libMesh::ReplicatedMesh unless --distributed-mesh is " 92 "specified on the command line " 93 "REPLICATED: Always use libMesh::ReplicatedMesh " 94 "DISTRIBUTED: Always use libMesh::DistributedMesh");
99 "If allow_renumbering=false, node and element numbers are kept fixed until deletion");
104 "If nemesis=true and file=foo.e, actually reads " 105 "foo.e.N.0, foo.e.N.1, ... foo.e.N.N-1, " 106 "where N = # CPUs, with NemesisIO.");
111 "Specifies a mesh partitioner to use when splitting the mesh for a parallel computation.");
115 "Specifies the sort direction if using the centroid partitioner. " 116 "Available options: x, y, z, radial");
118 MooseEnum patch_update_strategy(
"never always auto iteration",
"never");
120 "patch_update_strategy",
121 patch_update_strategy,
122 "How often to update the geometric search 'patch'. The default is to " 123 "never update it (which is the most efficient but could be a problem " 124 "with lots of relative motion). 'always' will update the patch for all " 125 "secondary nodes at the beginning of every timestep which might be time " 126 "consuming. 'auto' will attempt to determine at the start of which " 127 "timesteps the patch for all secondary nodes needs to be updated automatically." 128 "'iteration' updates the patch at every nonlinear iteration for a " 129 "subset of secondary nodes for which penetration is not detected. If there " 130 "can be substantial relative motion between the primary and secondary surfaces " 131 "during the nonlinear iterations within a timestep, it is advisable to use " 132 "'iteration' option to ensure accurate contact detection.");
136 "construct_node_list_from_side_list",
138 "Whether or not to generate nodesets from the sidesets (usually a good idea).");
140 "patch_size", 40,
"The number of nodes to consider in the NearestNode neighborhood.");
141 params.
addParam<
unsigned int>(
"ghosting_patch_size",
142 "The number of nearest neighbors considered " 143 "for ghosting purposes when 'iteration' " 144 "patch update strategy is used. Default is " 146 params.
addParam<
unsigned int>(
"max_leaf_size",
148 "The maximum number of points in each leaf of the KDTree used in " 149 "the nearest neighbor search. As the leaf size becomes larger," 150 "KDTree construction becomes faster but the nearest neighbor search" 153 params.
addParam<
bool>(
"build_all_side_lowerd_mesh",
155 "True to build the lower-dimensional mesh for all sides.");
157 params.
addParam<
bool>(
"skip_refine_when_use_split",
159 "True to skip uniform refinements when using a pre-split mesh.");
161 params.
addParam<std::vector<SubdomainID>>(
163 "The listed subdomain ids will be assumed valid for the mesh. This permits setting up " 164 "subdomain restrictions for subdomains initially containing no elements, which can occur, " 165 "for example, in additive manufacturing simulations which dynamically add and remove " 166 "elements. Names for this subdomains may be provided using add_subdomain_names. In this case " 167 "this list and add_subdomain_names must contain the same number of items.");
168 params.
addParam<std::vector<SubdomainName>>(
169 "add_subdomain_names",
170 "The listed subdomain names will be assumed valid for the mesh. This permits setting up " 171 "subdomain restrictions for subdomains initially containing no elements, which can occur, " 172 "for example, in additive manufacturing simulations which dynamically add and remove " 173 "elements. IDs for this subdomains may be provided using add_subdomain_ids. Otherwise IDs " 174 "are automatically assigned. In case add_subdomain_ids is set too, both lists must contain " 175 "the same number of items.");
177 params.
addParam<std::vector<BoundaryID>>(
179 "The listed sideset ids will be assumed valid for the mesh. This permits setting up boundary " 180 "restrictions for sidesets initially containing no sides. Names for this sidesets may be " 181 "provided using add_sideset_names. In this case this list and add_sideset_names must contain " 182 "the same number of items.");
183 params.
addParam<std::vector<BoundaryName>>(
185 "The listed sideset names will be assumed valid for the mesh. This permits setting up " 186 "boundary restrictions for sidesets initially containing no sides. Ids for this sidesets may " 187 "be provided using add_sideset_ids. In this case this list and add_sideset_ids must contain " 188 "the same number of items.");
190 params.
addParam<std::vector<BoundaryID>>(
192 "The listed nodeset ids will be assumed valid for the mesh. This permits setting up boundary " 193 "restrictions for node initially containing no sides. Names for this nodesets may be " 194 "provided using add_nodeset_names. In this case this list and add_nodeset_names must contain " 195 "the same number of items.");
196 params.
addParam<std::vector<BoundaryName>>(
198 "The listed nodeset names will be assumed valid for the mesh. This permits setting up " 199 "boundary restrictions for nodesets initially containing no sides. Ids for this nodesets may " 200 "be provided using add_nodesets_ids. In this case this list and add_nodesets_ids must " 201 "contain the same number of items.");
207 params.addPrivateParam<
bool>(
"_mesh_generator_mesh",
false);
210 params.addPrivateParam<
bool>(
"_is_split",
false);
212 params.registerBase(
"MooseMesh");
215 params.addParamNamesToGroup(
"patch_update_strategy patch_size max_leaf_size",
"Geometric search");
216 params.addParamNamesToGroup(
"nemesis",
"Advanced");
217 params.addParamNamesToGroup(
"add_subdomain_ids add_subdomain_names add_sideset_ids " 218 "add_sideset_names add_nodeset_ids add_nodeset_names",
219 "Pre-declaration of future mesh sub-entities");
220 params.addParamNamesToGroup(
"construct_node_list_from_side_list build_all_side_lowerd_mesh",
221 "Automatic definition of mesh element sides entities");
222 params.addParamNamesToGroup(
"partitioner centroid_partitioner_direction",
"Partitioning");
232 _use_distributed_mesh(false),
233 _distribution_overridden(false),
234 _parallel_type_overridden(false),
236 _partitioner_name(getParam<
MooseEnum>(
"partitioner")),
237 _partitioner_overridden(false),
238 _custom_partitioner_requested(false),
239 _uniform_refine_level(0),
240 _skip_refine_when_use_split(getParam<bool>(
"skip_refine_when_use_split")),
241 _skip_deletion_repartition_after_refine(false),
242 _is_nemesis(getParam<bool>(
"nemesis")),
243 _node_to_elem_map_built(false),
244 _node_to_active_semilocal_elem_map_built(false),
245 _patch_size(getParam<unsigned
int>(
"patch_size")),
246 _ghosting_patch_size(isParamValid(
"ghosting_patch_size")
247 ? getParam<unsigned
int>(
"ghosting_patch_size")
249 _max_leaf_size(getParam<unsigned
int>(
"max_leaf_size")),
250 _patch_update_strategy(
252 _regular_orthogonal_mesh(false),
253 _is_split(getParam<bool>(
"_is_split")),
255 _allow_recovery(true),
256 _construct_node_list_from_side_list(getParam<bool>(
"construct_node_list_from_side_list")),
258 _allow_remote_element_removal(true),
259 _need_ghost_ghosted_boundaries(true),
260 _is_displaced(false),
263 _rz_coord_axis(getParam<
MooseEnum>(
"rz_coord_axis")),
264 _coord_system_set(false),
265 _doing_p_refinement(false)
268 mooseError(
"Ghosting patch size parameter has to be set in the mesh block " 269 "only when 'iteration' patch update strategy is used.");
275 "You set both 'Mesh/block' and 'Mesh/coord_block'. The value of " 276 "'Mesh/coord_block' will be used.");
283 if (getParam<bool>(
"build_all_side_lowerd_mesh"))
289 #ifdef MOOSE_KOKKOS_ENABLED 291 _kokkos_mesh = std::make_unique<Moose::Kokkos::Mesh>(*
this);
299 _built_from_other_mesh(true),
300 _parallel_type(other_mesh._parallel_type),
301 _use_distributed_mesh(other_mesh._use_distributed_mesh),
302 _distribution_overridden(other_mesh._distribution_overridden),
303 _parallel_type_overridden(other_mesh._parallel_type_overridden),
304 _mesh(other_mesh.getMesh().clone()),
305 _partitioner_name(other_mesh._partitioner_name),
306 _partitioner_overridden(other_mesh._partitioner_overridden),
307 _custom_partitioner_requested(other_mesh._custom_partitioner_requested),
308 _uniform_refine_level(other_mesh.uniformRefineLevel()),
309 _skip_refine_when_use_split(other_mesh._skip_refine_when_use_split),
310 _skip_deletion_repartition_after_refine(other_mesh._skip_deletion_repartition_after_refine),
312 _node_to_elem_map_built(false),
313 _node_to_active_semilocal_elem_map_built(false),
314 _patch_size(other_mesh._patch_size),
315 _ghosting_patch_size(other_mesh._ghosting_patch_size),
316 _max_leaf_size(other_mesh._max_leaf_size),
317 _patch_update_strategy(other_mesh._patch_update_strategy),
318 _regular_orthogonal_mesh(false),
319 _is_split(other_mesh._is_split),
320 _lower_d_interior_blocks(other_mesh._lower_d_interior_blocks),
321 _lower_d_boundary_blocks(other_mesh._lower_d_boundary_blocks),
322 _has_lower_d(other_mesh._has_lower_d),
323 _allow_recovery(other_mesh._allow_recovery),
324 _construct_node_list_from_side_list(other_mesh._construct_node_list_from_side_list),
325 _need_delete(other_mesh._need_delete),
326 _allow_remote_element_removal(other_mesh._allow_remote_element_removal),
327 _need_ghost_ghosted_boundaries(other_mesh._need_ghost_ghosted_boundaries),
328 _coord_sys(other_mesh._coord_sys),
329 _rz_coord_axis(other_mesh._rz_coord_axis),
330 _subdomain_id_to_rz_coord_axis(other_mesh._subdomain_id_to_rz_coord_axis),
331 _coord_system_set(other_mesh._coord_system_set),
332 _provided_coord_blocks(other_mesh._provided_coord_blocks),
333 _doing_p_refinement(other_mesh._doing_p_refinement)
339 const std::set<SubdomainID> & subdomains = other_mesh.
meshSubdomains();
340 for (
const auto & sbd_id : subdomains)
348 std::vector<BoundaryID> side_boundaries;
352 for (
const auto & side_bnd_id : side_boundaries)
353 boundary_info.
sideset_name(side_bnd_id) = other_boundary_info.get_sideset_name(side_bnd_id);
356 std::vector<BoundaryID> node_boundaries;
357 other_boundary_info.build_node_boundary_ids(node_boundaries);
359 for (
const auto & node_bnd_id : node_boundaries)
360 boundary_info.
nodeset_name(node_bnd_id) = other_boundary_info.get_nodeset_name(node_bnd_id);
363 for (std::size_t i = 0; i <
_bounds.size(); ++i)
366 for (std::size_t j = 0; j <
_bounds[i].size(); ++j)
372 #ifdef MOOSE_KOKKOS_ENABLED 374 _kokkos_mesh = std::make_unique<Moose::Kokkos::Mesh>(*
this);
421 TIME_SECTION(
"prepare", 2,
"Preparing Mesh",
true);
423 bool called_prepare_for_use =
false;
425 mooseAssert(
_mesh,
"The MeshBase has not been constructed");
434 "The mesh we wish to clone from must already be prepared");
438 else if (!
_mesh->is_prepared())
440 _mesh->prepare_for_use();
442 called_prepare_for_use =
true;
446 return called_prepare_for_use;
450 for (
const auto &
elem :
getMesh().element_ptr_range())
457 const auto & add_subdomain_id = getParam<std::vector<SubdomainID>>(
"add_subdomain_ids");
462 const auto add_subdomain =
463 getParam<SubdomainID, SubdomainName>(
"add_subdomain_ids",
"add_subdomain_names");
464 for (
const auto & [sub_id, sub_name] : add_subdomain)
475 const auto & add_subdomain_names = getParam<std::vector<SubdomainName>>(
"add_subdomain_names");
483 for (
const SubdomainName & sub_name : add_subdomain_names)
488 const auto sub_id = ++offset;
503 const std::set<BoundaryID> & local_node_bids =
507 const std::set<BoundaryID> & local_side_bids =
513 auto add_sets = [
this](
const bool sidesets,
auto & set_ids)
515 const std::string
type = sidesets ?
"sideset" :
"nodeset";
516 const std::string id_param =
"add_" +
type +
"_ids";
521 const auto & add_ids = getParam<std::vector<BoundaryID>>(id_param);
523 set_ids.insert(add_ids.begin(), add_ids.end());
526 const auto & add_names = getParam<std::vector<BoundaryName>>(
name_param);
527 mooseAssert(add_names.size() == add_ids.size(),
528 "Id and name sets must be the same size when adding.");
536 const auto & add_names = getParam<std::vector<BoundaryName>>(
name_param);
542 if (!mesh_ids.empty())
543 offset = *mesh_ids.rbegin();
548 for (
const auto &
name : add_names)
553 const auto id = ++offset;
581 "Trying to set coordinate system type information based on the user input file, but " 582 "the coordinate system type information has already been set programmatically! " 583 "Either remove your coordinate system type information from the input file, or contact " 584 "your application developer");
591 const auto rz_coord_blocks = getParam<std::vector<SubdomainName>>(
"rz_coord_blocks");
592 const auto rz_coord_origins = getParam<std::vector<Point>>(
"rz_coord_origins");
593 const auto rz_coord_directions = getParam<std::vector<RealVectorValue>>(
"rz_coord_directions");
594 if (rz_coord_origins.size() == rz_coord_blocks.size() &&
595 rz_coord_directions.size() == rz_coord_blocks.size())
597 std::vector<std::pair<Point, RealVectorValue>> rz_coord_axes;
598 for (
unsigned int i = 0; i < rz_coord_origins.size(); ++i)
599 rz_coord_axes.push_back(std::make_pair(rz_coord_origins[i], rz_coord_directions[i]));
604 mooseError(
"The parameter 'rz_coord_axis' may not be provided if 'rz_coord_blocks', " 605 "'rz_coord_origins', and 'rz_coord_directions' are provided.");
608 mooseError(
"The parameters 'rz_coord_blocks', 'rz_coord_origins', and " 609 "'rz_coord_directions' must all have the same size.");
613 mooseError(
"If any of the parameters 'rz_coord_blocks', 'rz_coord_origins', and " 614 "'rz_coord_directions' are provided, then all must be provided.");
625 return called_prepare_for_use;
631 TIME_SECTION(
"update", 3,
"Updating Mesh",
true);
651 for (
const auto &
elem :
getMesh().active_local_element_ptr_range())
664 #ifdef MOOSE_KOKKOS_ENABLED 679 "Hybrid finite element method must use replicated mesh.\nCurrently lower-dimensional mesh " 680 "does not support mesh re-partitioning and a debug assertion being hit related with " 681 "neighbors of lower-dimensional element, with distributed mesh.");
688 unsigned int max_n_sides = 0;
691 std::set<Elem *> deleteable_elems;
692 for (
auto &
elem :
mesh.element_ptr_range())
695 deleteable_elems.insert(
elem);
699 for (
auto &
elem : deleteable_elems)
710 deleteable_elems.clear();
713 std::set<int> interior_side_types;
714 std::set<int> boundary_side_types;
715 for (
const auto &
elem :
mesh.active_element_ptr_range())
721 interior_side_types.insert(side_elem->type());
723 boundary_side_types.insert(side_elem->type());
729 std::map<ElemType, SubdomainID> interior_block_ids;
730 std::map<ElemType, SubdomainID> boundary_block_ids;
733 for (
const auto & tpid : interior_side_types)
737 interior_block_ids[
type] = id;
740 mooseError(
"Trying to add a mesh block with id ",
id,
" that has existed in the mesh");
744 for (
const auto & tpid : boundary_side_types)
748 boundary_block_ids[
type] = id;
751 mooseError(
"Trying to add a mesh block with id ",
id,
" that has existed in the mesh");
759 std::vector<Elem *> side_elems;
761 for (
const auto &
elem :
mesh.active_element_ptr_range())
771 bool build_side =
false;
776 mooseAssert(!neig->
is_remote(),
"We error if the mesh is not serial");
792 side_elem->subdomain_id() = interior_block_ids.at(side_elem->type());
794 side_elem->subdomain_id() = boundary_block_ids.at(side_elem->type());
797 side_elem->set_id(max_elem_id +
elem->
id() * max_n_sides + side);
798 side_elem->set_unique_id(max_unique_id +
elem->
id() * max_n_sides + side);
803 side_elem->set_interior_parent(
elem);
805 side_elems.push_back(side_elem.release());
808 auto pair = std::make_pair(
elem, side);
809 auto link = std::make_pair(pair, side_elems.back());
810 auto ilink = std::make_pair(side_elems.back(), side);
821 for (
auto &
elem : side_elems)
837 mooseDeprecated(
"MooseMesh::node() is deprecated, please use MooseMesh::nodeRef() instead");
844 mooseDeprecated(
"MooseMesh::node() is deprecated, please use MooseMesh::nodeRef() instead");
852 mooseAssert(node_ptr,
"Missing node");
877 if (i >
getMesh().max_node_id())
882 auto & node_ptr = it->second;
883 mooseAssert(node_ptr,
"Uninitialized quadrature node");
899 TIME_SECTION(
"meshChanged", 3,
"Updating Because Mesh Changed");
930 TIME_SECTION(
"cacheChangedLists", 5,
"Caching Changed Lists");
934 Threads::parallel_reduce(elem_range, cclt);
957 const std::vector<const Elem *> &
962 return elem_to_child_pair->second;
968 TIME_SECTION(
"updateActiveSemiLocalNodeRange", 5,
"Updating ActiveSemiLocalNode Range");
974 for (
const auto &
elem : *active_local_elems)
990 for (
const auto & ghost_elem_id : ghosted_elems)
1042 TIME_SECTION(
"buildNodeList", 5,
"Building Node List");
1048 int n = bc_tuples.size();
1051 for (
const auto & t : bc_tuples)
1053 auto node_id = std::get<0>(t);
1054 auto bc_id = std::get<1>(t);
1087 for (
unsigned int side = 0; side <
elem->
n_sides(); ++side)
1110 for (
const auto &
elem :
getMesh().active_local_element_ptr_range())
1111 for (
unsigned int i = 0; i < n; ++i)
1119 for (
unsigned int j = 0; j < n; ++j)
1127 for (
unsigned int i = 0; i < n; ++i)
1137 std::unordered_map<dof_id_type, std::set<dof_id_type>>
1142 if (!mesh_base.has_elem_integer(from_id_name))
1143 mooseError(
"Mesh does not have the element integer name '", from_id_name,
"'");
1144 if (!mesh_base.has_elem_integer(to_id_name))
1145 mooseError(
"Mesh does not have the element integer name '", to_id_name,
"'");
1147 const auto id1 = mesh_base.get_elem_integer_index(from_id_name);
1148 const auto id2 = mesh_base.get_elem_integer_index(to_id_name);
1150 std::unordered_map<dof_id_type, std::set<dof_id_type>> id_map;
1152 id_map[id] = std::set<dof_id_type>();
1154 for (
const auto &
elem : mesh_base.active_local_element_ptr_range())
1157 for (
auto & [
id, ids] : id_map)
1166 std::set<dof_id_type>
1169 std::set<dof_id_type> unique_ids;
1171 for (
auto &
id : pair.second)
1172 unique_ids.insert(
id);
1176 std::set<dof_id_type>
1179 std::set<dof_id_type> unique_ids;
1180 for (
auto & blk : blks)
1184 mooseError(
"Block ", blk,
" is not available on the mesh");
1186 for (
auto & mid : it->second)
1187 unique_ids.insert(mid);
1195 TIME_SECTION(
"buildBndElemList", 5,
"Building Boundary Elements List");
1201 int n = bc_tuples.size();
1204 for (
const auto & t : bc_tuples)
1206 auto elem_id = std::get<0>(t);
1207 auto side_id = std::get<1>(t);
1208 auto bc_id = std::get<2>(t);
1215 const std::map<dof_id_type, std::vector<dof_id_type>> &
1220 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
1229 Threads::in_threads =
false;
1230 TIME_SECTION(
"nodeToElemMap", 5,
"Building Node To Elem Map");
1233 for (
const auto &
elem :
getMesh().active_element_ptr_range())
1234 for (
unsigned int n = 0; n <
elem->
n_nodes(); n++)
1243 const std::map<dof_id_type, std::vector<dof_id_type>> &
1248 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
1255 Threads::in_threads =
false;
1256 TIME_SECTION(
"nodeToActiveSemilocalElemMap", 5,
"Building SemiLocalElemMap");
1261 for (
const auto &
elem :
1264 for (
unsigned int n = 0; n <
elem->
n_nodes(); n++)
1280 TIME_SECTION(
"getActiveLocalElementRange", 5);
1294 TIME_SECTION(
"getActiveNodeRange", 5);
1307 "_active_semilocal_node_range has not been created yet!");
1317 TIME_SECTION(
"getLocalNodeRange", 5);
1331 TIME_SECTION(
"getBoundaryNodeRange", 5);
1345 TIME_SECTION(
"getBoundaryElementRange", 5);
1354 const std::unordered_map<boundary_id_type, std::unordered_set<dof_id_type>> &
1358 "use MooseMesh::getBoundariesToActiveSemiLocalElemIds");
1362 const std::unordered_map<boundary_id_type, std::unordered_set<dof_id_type>> &
1368 std::unordered_set<dof_id_type>
1375 return std::unordered_set<dof_id_type>{};
1379 std::unordered_set<dof_id_type>
1383 std::unordered_set<dof_id_type> neighbor_elems;
1386 const auto & [elem_ptr, elem_side, elem_bid] = *bnd_elem;
1387 if (elem_bid == bid)
1389 const auto * neighbor = elem_ptr->neighbor_ptr(elem_side);
1394 if (neighbor->active())
1395 neighbor_elems.insert(neighbor->id());
1398 std::vector<const Elem *> family;
1399 neighbor->active_family_tree_by_neighbor(family, elem_ptr);
1400 for (
const auto & child_neighbor : family)
1401 neighbor_elems.insert(child_neighbor->id());
1407 return neighbor_elems;
1412 const std::set<SubdomainID> & blk_group)
const 1414 mooseAssert(
_bnd_elem_range,
"Boundary element range is not initialized");
1419 const auto & [elem_ptr, elem_side, elem_bid] = *bnd_elem;
1420 if (elem_bid == bid)
1423 if (blk_group.find(elem_ptr->subdomain_id()) != blk_group.end())
1425 const auto *
const neighbor = elem_ptr->neighbor_ptr(elem_side);
1429 mooseError(
"Insufficient level of geometrical ghosting to determine " 1430 "if a boundary is internal to the mesh");
1436 if (blk_group.find(neighbor->subdomain_id()) != blk_group.end())
1447 TIME_SECTION(
"cacheInfo", 3);
1461 for (
const auto &
elem :
mesh.element_ptr_range())
1474 auto pair = std::make_pair(ip_elem, ip_side);
1476 std::pair<std::pair<const Elem *, unsigned short int>,
const Elem *>(pair,
elem));
1478 std::pair<const Elem *, unsigned short int>(
elem, ip_side));
1483 if (
mesh.
subdomain_name(
id).find(
"INTERNAL_SIDE_LOWERD_SUBDOMAIN_") != std::string::npos)
1488 if (
mesh.
subdomain_name(
id).find(
"BOUNDARY_SIDE_LOWERD_SUBDOMAIN_") != std::string::npos)
1494 for (
unsigned int nd = 0; nd <
elem->
n_nodes(); ++nd)
1503 for (
const auto &
elem :
mesh.active_local_element_ptr_range())
1507 for (
unsigned int side = 0; side <
elem->
n_sides(); side++)
1510 sub_data.boundary_ids.insert(boundary_ids.begin(), boundary_ids.end());
1516 boundary_ids.end());
1518 if (neighbor_subdomain_id != subdomain_id)
1519 sub_data.neighbor_subs.insert(neighbor_subdomain_id);
1530 if (sub_data.is_lower_d)
1536 const std::set<SubdomainID> &
1624 for (
const auto &
node :
getMesh().node_ptr_range())
1629 for (
unsigned int i = 0; i <
_node_map.size(); ++i)
1637 if (
node ==
nullptr)
1643 mooseAssert(
node !=
nullptr,
"Node is NULL");
1649 const unsigned short int side,
1650 const unsigned int qp,
1669 if (new_id <=
getMesh().max_node_id())
1670 mooseError(
"Quadrature node id collides with existing node id!");
1701 const unsigned short int side,
1702 const unsigned int qp)
1706 "Elem has no quadrature nodes!");
1709 "Side has no quadrature nodes!");
1712 "qp not found on side!");
1732 if (boundary_name ==
"ANY_BOUNDARY_ID")
1733 mooseError(
"Please use getBoundaryIDs() when passing \"ANY_BOUNDARY_ID\"");
1760 std::vector<BoundaryID>
1762 bool generate_unknown)
const 1774 std::vector<SubdomainID>
1780 std::set<SubdomainID>
1789 mooseAssert(
name !=
"ANY_BLOCK_ID",
"Cannot set subdomain name to 'ANY_BLOCK_ID'");
1796 mooseAssert(
name !=
"ANY_BLOCK_ID",
"Cannot set subdomain name to 'ANY_BLOCK_ID'");
1806 std::vector<SubdomainName>
1809 std::vector<SubdomainName> names(subdomain_ids.size());
1811 for (
unsigned int i = 0; i < subdomain_ids.size(); i++)
1843 inline const Point &
1847 return *(item.first);
1852 unsigned int var_number,
1855 TIME_SECTION(
"buildPeriodicNodeMap", 5);
1858 periodic_node_map.clear();
1861 std::vector<PeriodicNodeInfo> periodic_nodes;
1862 for (
const auto & t :
getMesh().get_boundary_info().build_node_list())
1865 auto node =
_mesh->node_ptr(std::get<0>(t));
1866 mooseAssert(
node !=
nullptr,
1867 "libMesh::BoundaryInfo::build_node_list() returned an ID for a non-existing node");
1868 auto bc_id = std::get<1>(t);
1869 periodic_nodes.emplace_back(
node, bc_id);
1873 std::sort(periodic_nodes.begin(),
1874 periodic_nodes.end(),
1876 {
return a.second > b.second; });
1879 using KDTreeType = nanoflann::KDTreeSingleIndexAdaptor<
1880 nanoflann::L2_Simple_Adaptor<Real, PointListAdaptor<PeriodicNodeInfo>,
Real, std::size_t>,
1884 const unsigned int max_leaf_size = 20;
1887 auto kd_tree = std::make_unique<KDTreeType>(
1888 LIBMESH_DIM, point_list, nanoflann::KDTreeSingleIndexAdaptorParams(max_leaf_size));
1889 mooseAssert(kd_tree !=
nullptr,
"KDTree was not properly initialized.");
1890 kd_tree->buildIndex();
1894 std::vector<nanoflann::ResultItem<std::size_t, Real>> ret_matches;
1898 BoundaryID current_bc_id = BoundaryInfo::invalid_id;
1899 for (
auto & pair : periodic_nodes)
1902 if (pair.second != current_bc_id)
1904 current_bc_id = pair.second;
1905 periodic = pbs->
boundary(current_bc_id);
1915 ret_matches.clear();
1918 const auto id = pair.first->id();
1924 kd_tree->radiusSearch(&(search_point)(0),
libMesh::TOLERANCE, ret_matches, search_params);
1925 for (
auto & match_pair : ret_matches)
1927 const auto & match = periodic_nodes[match_pair.first];
1930 periodic_node_map.emplace(
id, match.first->id());
1937 unsigned int var_number,
1940 TIME_SECTION(
"buildPeriodicNodeSets", 5);
1942 periodic_node_sets.clear();
1945 for (
const auto & t :
getMesh().get_boundary_info().build_node_list())
1947 auto node_id = std::get<0>(t);
1948 auto bc_id = std::get<1>(t);
1951 if (periodic_node_sets.find(bc_id) != periodic_node_sets.end())
1952 periodic_node_sets[bc_id].insert(node_id);
1957 periodic_node_sets[bc_id].insert(node_id);
1965 TIME_SECTION(
"detectOrthogonalDimRanges", 5);
1975 for (
const auto &
node :
getMesh().node_ptr_range())
1981 min[i] = (*node)(i);
1983 max[i] = (*node)(i);
1991 std::vector<bool> extreme_matches(8,
false);
1992 std::vector<unsigned int> comp_map(3);
1993 for (
const auto &
node :
getMesh().node_ptr_range())
1996 unsigned int coord_match = 0;
2012 if (coord_match == LIBMESH_DIM)
2015 extreme_matches[comp_map[
X] * 4 + comp_map[
Y] * 2 + comp_map[
Z]] =
true;
2020 this->
comm().
max(extreme_matches);
2021 if (std::count(extreme_matches.begin(), extreme_matches.end(),
true) == (1 <<
dim))
2039 TIME_SECTION(
"detectPairedSidesets", 5);
2051 const Point minus_x(-1, 0, 0), plus_x(1, 0, 0), minus_y(0, -1, 0), plus_y(0, 1, 0),
2052 minus_z(0, 0, -1), plus_z(0, 0, 1);
2058 std::vector<std::set<BoundaryID>> minus_x_ids(
dim), plus_x_ids(
dim), minus_y_ids(
dim),
2059 plus_y_ids(
dim), minus_z_ids(
dim), plus_z_ids(
dim);
2061 std::vector<std::unique_ptr<FEBase>> fe_faces(
dim);
2062 std::vector<std::unique_ptr<libMesh::QGauss>> qfaces(
dim);
2063 for (
unsigned side_dim = 0; side_dim <
dim; ++side_dim)
2071 fe_faces[side_dim]->attach_quadrature_rule(qfaces[side_dim].
get());
2076 std::vector<boundary_id_type> face_ids;
2081 unsigned int side_dim =
elem->
dim() - 1;
2082 const std::vector<Point> & normals = fe_faces[side_dim]->get_normals();
2085 for (
unsigned int s = 0; s <
elem->
n_sides(); s++)
2092 fe_faces[side_dim]->reinit(
elem, s);
2102 minus_x_ids[side_dim].insert(face_ids.begin(), face_ids.end());
2104 plus_x_ids[side_dim].insert(face_ids.begin(), face_ids.end());
2108 minus_y_ids[side_dim].insert(face_ids.begin(), face_ids.end());
2110 plus_y_ids[side_dim].insert(face_ids.begin(), face_ids.end());
2114 minus_z_ids[side_dim].insert(face_ids.begin(), face_ids.end());
2116 plus_z_ids[side_dim].insert(face_ids.begin(), face_ids.end());
2133 std::vector<std::pair<boundary_id_type, boundary_id_type>> vecdata;
2135 for (
unsigned side_dim = 0; side_dim <
dim; ++side_dim)
2139 for (
auto bd = minus_x_ids[side_dim].begin(); bd != minus_x_ids[side_dim].end(); bd++)
2140 vecdata.emplace_back(side_dim * 6 + 0, *bd);
2142 for (
auto bd = plus_x_ids[side_dim].begin(); bd != plus_x_ids[side_dim].end(); bd++)
2143 vecdata.emplace_back(side_dim * 6 + 1, *bd);
2145 for (
auto bd = minus_y_ids[side_dim].begin(); bd != minus_y_ids[side_dim].end(); bd++)
2146 vecdata.emplace_back(side_dim * 6 + 2, *bd);
2148 for (
auto bd = plus_y_ids[side_dim].begin(); bd != plus_y_ids[side_dim].end(); bd++)
2149 vecdata.emplace_back(side_dim * 6 + 3, *bd);
2151 for (
auto bd = minus_z_ids[side_dim].begin(); bd != minus_z_ids[side_dim].end(); bd++)
2152 vecdata.emplace_back(side_dim * 6 + 4, *bd);
2154 for (
auto bd = plus_z_ids[side_dim].begin(); bd != plus_z_ids[side_dim].end(); bd++)
2155 vecdata.emplace_back(side_dim * 6 + 5, *bd);
2161 for (
auto pair = vecdata.begin(); pair != vecdata.end(); pair++)
2164 auto side_dim = pair->first / 6;
2165 auto side = pair->first % 6;
2170 minus_x_ids[side_dim].insert(pair->second);
2173 plus_x_ids[side_dim].insert(pair->second);
2176 minus_y_ids[side_dim].insert(pair->second);
2179 plus_y_ids[side_dim].insert(pair->second);
2182 minus_z_ids[side_dim].insert(pair->second);
2185 plus_z_ids[side_dim].insert(pair->second);
2194 for (
unsigned side_dim = 0; side_dim <
dim; ++side_dim)
2198 if (minus_x_ids[side_dim].size() == 1 && plus_x_ids[side_dim].size() == 1)
2200 std::make_pair(*(minus_x_ids[side_dim].begin()), *(plus_x_ids[side_dim].begin())));
2203 "For side dimension " + std::to_string(side_dim) +
2204 " we did not find paired boundaries (sidesets) in X due to the presence of " +
2205 std::to_string(minus_x_ids[side_dim].size()) +
" -X normal and " +
2206 std::to_string(plus_x_ids[side_dim].size()) +
" +X normal boundaries.");
2208 if (minus_y_ids[side_dim].size() == 1 && plus_y_ids[side_dim].size() == 1)
2210 std::make_pair(*(minus_y_ids[side_dim].begin()), *(plus_y_ids[side_dim].begin())));
2213 "For side dimension " + std::to_string(side_dim) +
2214 " we did not find paired boundaries (sidesets) in Y due to the presence of " +
2215 std::to_string(minus_y_ids[side_dim].size()) +
" -Y normal and " +
2216 std::to_string(plus_y_ids[side_dim].size()) +
" +Y normal boundaries.");
2218 if (minus_z_ids[side_dim].size() == 1 && plus_z_ids[side_dim].size() == 1)
2220 std::make_pair(*(minus_z_ids[side_dim].begin()), *(plus_z_ids[side_dim].begin())));
2223 "For side dimension " + std::to_string(side_dim) +
2224 " we did not find paired boundaries (sidesets) in Z due to the presence of " +
2225 std::to_string(minus_z_ids[side_dim].size()) +
" -Z normal and " +
2226 std::to_string(plus_z_ids[side_dim].size()) +
" +Z normal boundaries.");
2239 mooseAssert(
_mesh,
"The MeshBase has not been constructed");
2240 mooseAssert(component <
_bounds.size(),
"Requested dimension out of bounds");
2248 mooseAssert(
_mesh,
"The MeshBase has not been constructed");
2249 mooseAssert(component <
_bounds.size(),
"Requested dimension out of bounds");
2264 bool component_found =
false;
2265 for (
unsigned int component = 0; component <
dimension(); ++component)
2269 if (boundary_ids !=
nullptr &&
2270 ((boundary_ids->first == primary && boundary_ids->second == secondary) ||
2271 (boundary_ids->first == secondary && boundary_ids->second == primary)))
2274 component_found =
true;
2277 if (!component_found)
2278 mooseWarning(
"Could not find a match between boundary '",
2282 "' to set periodic boundary conditions for variable (index:",
2284 ") in either the X, Y or Z direction. The periodic dimension of the mesh for this " 2285 "variable will not be stored.");
2291 mooseAssert(component <
dimension(),
"Requested dimension out of bounds");
2302 for (
unsigned int i = 0; i <
dimension(); ++i)
2330 const std::pair<BoundaryID, BoundaryID> *
2334 mooseError(
"Trying to retrieve automatic paired mapping for a mesh that is not regular and " 2337 mooseAssert(component <
dimension(),
"Requested dimension out of bounds");
2351 std::map<ElemType, Elem *> canonical_elems;
2355 for (
const auto &
elem :
getMesh().element_ptr_range())
2359 if (canonical_elems.find(
type) ==
2360 canonical_elems.end())
2364 Elem * stored = canonical_elems[
type];
2371 for (
const auto & can_it : canonical_elems)
2389 for (
unsigned int side = 0; side <
elem->
n_sides(); side++)
2397 for (
unsigned int child = 0; child <
elem->
n_children(); ++child)
2398 for (
unsigned int side = 0; side <
elem->
n_sides();
2413 std::map<ElemType, std::pair<Elem *, unsigned int>> elems_and_max_p_level;
2415 for (
const auto &
elem :
getMesh().active_element_ptr_range())
2418 auto & [picked_elem, max_p_level] = elems_and_max_p_level[
type];
2426 std::vector<Point> volume_ref_points_coarse, volume_ref_points_fine, face_ref_points_coarse,
2427 face_ref_points_fine;
2428 std::vector<unsigned int> p_levels;
2430 for (
auto & [elem_type, elem_p_level_pair] : elems_and_max_p_level)
2432 auto & [moose_elem, max_p_level] = elem_p_level_pair;
2433 const auto dim = moose_elem->dim();
2436 assembly->
reinit(moose_elem);
2437 assembly->
reinit(moose_elem, 0);
2444 for (
const auto & nd : moose_elem->node_ref_range())
2453 const auto & face_phys_points = fe_face->get_xyz();
2454 fe_face->attach_quadrature_rule(qrule_face);
2457 volume_ref_points_coarse = qrule->get_points();
2458 fe_face->reinit(
elem, (
unsigned int)0);
2461 p_levels.resize(max_p_level + 1);
2462 std::iota(p_levels.begin(), p_levels.end(), 0);
2465 for (
const auto p_level : p_levels)
2467 mesh_refinement.uniformly_p_refine(1);
2469 volume_ref_points_fine = qrule->get_points();
2470 fe_face->reinit(
elem, (
unsigned int)0);
2473 const auto map_key = std::make_pair(elem_type, p_level);
2479 auto fill_maps = [
this](
const auto & coarse_ref_points,
2480 const auto & fine_ref_points,
2484 mapPoints(fine_ref_points, coarse_ref_points, refine_map);
2485 mapPoints(coarse_ref_points, fine_ref_points, coarsen_map);
2489 volume_ref_points_coarse, volume_ref_points_fine, volume_coarsen_map, volume_refine_map);
2490 fill_maps(face_ref_points_coarse, face_ref_points_fine, face_coarsen_map, face_refine_map);
2493 volume_ref_points_fine.swap(volume_ref_points_coarse);
2494 face_ref_points_fine.swap(face_ref_points_coarse);
2502 TIME_SECTION(
"buildRefinementAndCoarseningMaps", 5,
"Building Refinement And Coarsening Maps");
2517 TIME_SECTION(
"buildRefinementMap", 5,
"Building Refinement Map");
2521 mooseAssert(parent_side == child_side,
2522 "Parent side must match child_side if not passing a specific child!");
2524 std::pair<int, ElemType> the_pair(parent_side,
elem.
type());
2527 mooseError(
"Already built a qp refinement map!");
2529 std::vector<std::pair<unsigned int, QpMap>> coarsen_map;
2532 &
elem, qrule, qrule_face, refinement_map, coarsen_map, parent_side, child, child_side);
2536 std::pair<int, int> child_pair(child, child_side);
2542 mooseError(
"Already built a qp refinement map!");
2544 std::vector<std::pair<unsigned int, QpMap>> coarsen_map;
2545 std::vector<std::vector<QpMap>> & refinement_map =
2548 &
elem, qrule, qrule_face, refinement_map, coarsen_map, parent_side, child, child_side);
2552 const std::vector<std::vector<QpMap>> &
2557 mooseAssert(parent_side == child_side,
2558 "Parent side must match child_side if not passing a specific child!");
2560 std::pair<int, ElemType> the_pair(parent_side,
elem.
type());
2563 mooseError(
"Could not find a suitable qp refinement map!");
2569 std::pair<int, int> child_pair(child, child_side);
2575 mooseError(
"Could not find a suitable qp refinement map!");
2591 TIME_SECTION(
"buildCoarseningMap", 5,
"Building Coarsening Map");
2593 std::pair<int, ElemType> the_pair(input_side,
elem.
type());
2596 mooseError(
"Already built a qp coarsening map!");
2598 std::vector<std::vector<QpMap>> refinement_map;
2599 std::vector<std::pair<unsigned int, QpMap>> & coarsen_map =
2606 &
elem, qrule, qrule_face, refinement_map, coarsen_map, input_side, -1, input_side);
2616 const std::vector<std::pair<unsigned int, QpMap>> &
2619 std::pair<int, ElemType> the_pair(input_side,
elem.
type());
2622 mooseError(
"Could not find a suitable qp refinement map!");
2629 const std::vector<Point> & to,
2630 std::vector<QpMap> & qp_map)
2632 unsigned int n_from = from.size();
2633 unsigned int n_to = to.size();
2635 qp_map.resize(n_from);
2637 for (
unsigned int i = 0; i < n_from; ++i)
2639 const Point & from_point = from[i];
2641 QpMap & current_map = qp_map[i];
2643 for (
unsigned int j = 0; j < n_to; ++j)
2645 const Point & to_point = to[j];
2651 current_map.
_from = i;
2652 current_map.
_to = j;
2662 std::vector<std::vector<QpMap>> & refinement_map,
2663 std::vector<std::pair<unsigned int, QpMap>> & coarsen_map,
2668 TIME_SECTION(
"findAdaptivityQpMaps", 5);
2673 unsigned int dim = template_elem->
dim();
2676 for (
unsigned int i = 0; i < template_elem->
n_nodes(); ++i)
2681 for (
unsigned int i = 0; i < template_elem->
n_nodes(); ++i)
2686 const std::vector<Point> & q_points_volume = fe->get_xyz();
2690 const std::vector<Point> & q_points_face = fe_face->get_xyz();
2692 fe->attach_quadrature_rule(&qrule);
2693 fe_face->attach_quadrature_rule(&qrule_face);
2696 const std::vector<Point> * q_points;
2698 if (parent_side != -1)
2700 fe_face->reinit(
elem, parent_side);
2701 q_points = &q_points_face;
2706 q_points = &q_points_volume;
2709 std::vector<Point> parent_ref_points;
2713 mesh_refinement.uniformly_refine(1);
2718 std::map<unsigned int, std::vector<Point>> child_to_ref_points;
2722 refinement_map.resize(n_children);
2724 std::vector<unsigned int> children;
2727 children.push_back(child);
2730 children.resize(n_children);
2731 for (
unsigned int child = 0; child < n_children; ++child)
2732 children[child] = child;
2735 for (
unsigned int i = 0; i < children.size(); ++i)
2737 unsigned int child = children[i];
2744 if (child_side != -1)
2746 fe_face->reinit(child_elem, child_side);
2747 q_points = &q_points_face;
2751 fe->reinit(child_elem);
2752 q_points = &q_points_volume;
2755 std::vector<Point> child_ref_points;
2758 child_to_ref_points[child] = child_ref_points;
2760 std::vector<QpMap> & qp_map = refinement_map[child];
2763 mapPoints(child_ref_points, parent_ref_points, qp_map);
2766 coarsen_map.resize(parent_ref_points.size());
2769 for (
unsigned int child = 0; child < n_children; child++)
2774 std::vector<Point> & child_ref_points = child_to_ref_points[child];
2776 std::vector<QpMap> qp_map;
2779 mapPoints(parent_ref_points, child_ref_points, qp_map);
2782 for (
unsigned int parent_qp = 0; parent_qp < parent_ref_points.size(); ++parent_qp)
2784 std::pair<unsigned int, QpMap> & child_and_map = coarsen_map[parent_qp];
2785 unsigned int & closest_child = child_and_map.first;
2786 QpMap & closest_map = child_and_map.second;
2788 QpMap & current_map = qp_map[parent_qp];
2792 closest_child = child;
2793 closest_map = current_map;
2804 TIME_SECTION(
"changeBoundaryId", 6);
2818 std::vector<boundary_id_type> old_ids;
2824 for (
unsigned int s = 0; s != n_sides; ++s)
2827 if (
std::find(old_ids.begin(), old_ids.end(), old_id) != old_ids.end())
2829 std::vector<boundary_id_type> new_ids(old_ids);
2830 std::replace(new_ids.begin(), new_ids.end(), old_id, new_id);
2862 mooseError(
"MooseMesh::clone() is no longer supported, use MooseMesh::safeClone() instead.");
2893 std::unique_ptr<MeshBase>
2896 std::unique_ptr<MeshBase>
mesh;
2898 mesh = buildTypedMesh<DistributedMesh>(
dim);
2900 mesh = buildTypedMesh<ReplicatedMesh>(
dim);
2908 _mesh = std::move(mesh_base);
2925 mooseError(
"You cannot use the mesh splitter capability with DistributedMesh!");
2927 TIME_SECTION(
"init", 2);
2942 TIME_SECTION(
"readRecoveredMesh", 2);
2960 if (getParam<bool>(
"build_all_side_lowerd_mesh"))
2976 const Real abs_zero = 1e-12;
2980 for (
unsigned int dim = LIBMESH_DIM;
dim >= 1; --
dim)
2995 return *elem_dims.begin();
2997 unsigned short dim = 0;
2999 const std::set<SubdomainID> subdomain_ids_set(subdomain_ids.begin(), subdomain_ids.end());
3008 std::vector<BoundaryID>
3011 std::vector<BoundaryID> ids;
3016 const std::set<BoundaryID> &
3031 std::vector<unsigned short int> & sl,
3032 std::vector<boundary_id_type> & il)
3034 #ifdef LIBMESH_ENABLE_DEPRECATED 3035 mooseDeprecated(
"The version of MooseMesh::buildSideList() taking three arguments is " 3036 "deprecated, call the version that returns a vector of tuples instead.");
3042 mooseError(
"The version of MooseMesh::buildSideList() taking three " 3043 "arguments is not available in your version of libmesh, call the " 3044 "version that returns a vector of tuples instead.");
3048 std::vector<std::tuple<dof_id_type, unsigned short int, boundary_id_type>>
3054 std::vector<std::tuple<dof_id_type, unsigned short int, boundary_id_type>>
3069 return getMesh().local_nodes_begin();
3075 return getMesh().local_nodes_end();
3078 MeshBase::const_node_iterator
3081 return getMesh().local_nodes_begin();
3084 MeshBase::const_node_iterator
3087 return getMesh().local_nodes_end();
3090 MeshBase::element_iterator
3093 return getMesh().active_local_elements_begin();
3096 const MeshBase::element_iterator
3099 return getMesh().active_local_elements_end();
3102 MeshBase::const_element_iterator
3105 return getMesh().active_local_elements_begin();
3108 const MeshBase::const_element_iterator
3111 return getMesh().active_local_elements_end();
3141 mooseDeprecated(
"MooseMesh::elem() is deprecated, please use MooseMesh::elemPtr() instead");
3148 mooseDeprecated(
"MooseMesh::elem() is deprecated, please use MooseMesh::elemPtr() instead");
3186 mooseError(
"We don't have any right to tell the libmesh mesh that it *is* prepared. Only a " 3187 "call to prepare_for_use should tell us that");
3192 _mesh->set_isnt_prepared();
3210 const std::set<SubdomainID> &
3216 const std::set<BoundaryID> &
3222 const std::set<BoundaryID> &
3228 const std::set<BoundaryID> &
3242 std::unique_ptr<std::map<BoundaryID, RealVectorValue>> boundary_map)
3250 mooseDeprecated(
"setBoundaryToNormalMap(std::map<BoundaryID, RealVectorValue> * boundary_map) is " 3251 "deprecated, use the unique_ptr version instead");
3280 const std::set<unsigned int> &
3286 const std::vector<Real> &
3300 template <
typename T>
3301 struct extra_ghost_elem_inserter
3303 using iterator_category = std::output_iterator_tag;
3304 using value_type = T;
3308 void operator=(
const Elem * e) {
mesh.add_extra_ghost_elem(const_cast<Elem *>(e)); }
3314 extra_ghost_elem_inserter &
operator++() {
return *
this; }
3316 extra_ghost_elem_inserter
operator++(
int) {
return extra_ghost_elem_inserter(*
this); }
3322 extra_ghost_elem_inserter &
operator*() {
return *
this; }
3338 struct CompareElemsByLevel
3340 bool operator()(
const Elem * a,
const Elem * b)
const 3344 const unsigned int al = a->
level(), bl = b->
level();
3347 return (al == bl) ? aid < bid : al < bl;
3363 TIME_SECTION(
"GhostGhostedBoundaries", 3);
3365 parallel_object_only();
3375 std::set<const Elem *, CompareElemsByLevel> boundary_elems_to_ghost;
3376 std::set<Node *> connected_nodes_to_ghost;
3382 auto elem_id = std::get<0>(t);
3383 auto bc_id = std::get<2>(t);
3389 #ifdef LIBMESH_ENABLE_AMR 3395 parent = parent->
parent();
3403 boundary_elems_to_ghost.insert(felem);
3411 for (
unsigned int n = 0; n < felem->n_nodes(); ++n)
3412 connected_nodes_to_ghost.insert(const_cast<Node *>(felem->node_ptr(n)));
3418 const auto prior_ghost_elems =
mesh.extra_ghost_elems();
3421 connected_nodes_to_ghost.begin(),
3422 connected_nodes_to_ghost.end(),
3423 extra_ghost_elem_inserter<Node>(
mesh));
3426 boundary_elems_to_ghost.begin(),
3427 boundary_elems_to_ghost.end(),
3428 extra_ghost_elem_inserter<Elem>(
mesh));
3430 const auto & current_ghost_elems =
mesh.extra_ghost_elems();
3432 std::set_difference(current_ghost_elems.begin(),
3433 current_ghost_elems.end(),
3434 prior_ghost_elems.begin(),
3435 prior_ghost_elems.end(),
3468 Real inflation_amount = inflation_multiplier * (bbox.
max() - bbox.
min()).
norm();
3469 Point inflation(inflation_amount, inflation_amount, inflation_amount);
3471 bbox.first -= inflation;
3472 bbox.second += inflation;
3490 mooseAssert(
_mesh,
"Mesh hasn't been created");
3497 mooseAssert(
_mesh,
"Mesh hasn't been created");
3509 const std::vector<dof_id_type> &
3512 std::map<boundary_id_type, std::vector<dof_id_type>>::const_iterator it =
3522 static const std::vector<dof_id_type> empty_vec;
3529 mooseError(
"Unable to nodeset ID: ", nodeset_id,
'.');
3536 const std::set<BoundaryID> &
3542 mooseError(
"Unable to find subdomain ID: ", subdomain_id,
'.');
3544 return it->second.boundary_ids;
3547 std::set<BoundaryID>
3551 std::set<BoundaryID> boundary_ids(bnd_ids.begin(), bnd_ids.end());
3552 std::unordered_map<SubdomainID, std::set<BoundaryID>>::const_iterator it =
3555 boundary_ids.insert(it->second.begin(), it->second.end());
3557 return boundary_ids;
3560 std::set<SubdomainID>
3563 std::set<SubdomainID> subdomain_ids;
3565 if (data.boundary_ids.find(bid) != data.boundary_ids.end())
3566 subdomain_ids.insert(sub_id);
3568 return subdomain_ids;
3571 std::set<SubdomainID>
3574 std::set<SubdomainID> subdomain_ids;
3576 if (it.second.find(bid) != it.second.end())
3577 subdomain_ids.insert(it.first);
3579 return subdomain_ids;
3582 std::set<SubdomainID>
3587 if (it.second.find(bid) != it.second.end())
3588 subdomain_ids.insert(it.first);
3590 return subdomain_ids;
3593 const std::set<SubdomainID> &
3599 mooseError(
"Unable to find subdomain ID: ", subdomain_id,
'.');
3601 return it->second.neighbor_subs;
3607 bool found_node =
false;
3610 if (it.second.find(node_id) != it.second.end())
3622 bool found_node =
false;
3623 std::map<boundary_id_type, std::set<dof_id_type>>::const_iterator it =
_bnd_node_ids.find(bnd_id);
3625 if (it->second.find(node_id) != it->second.end())
3633 bool found_elem =
false;
3636 if (it.second.find(elem_id) != it.second.end())
3648 bool found_elem =
false;
3651 if (it->second.find(elem_id) != it->second.end())
3662 " with DistributedMesh!\n",
3663 "Consider specifying parallel_type = 'replicated' in your input file\n",
3664 "to prevent it from being run with DistributedMesh.");
3682 bool use_distributed_mesh,
3687 switch (partitioner)
3691 if (use_distributed_mesh)
3692 partitioner =
"parmetis";
3694 partitioner =
"metis";
3708 if (!params.
isParamValid(
"centroid_partitioner_direction"))
3710 "centroid_partitioner_direction",
3711 "If using the centroid partitioner you _must_ specify centroid_partitioner_direction!");
3715 if (direction ==
"x")
3718 else if (direction ==
"y")
3721 else if (direction ==
"z")
3724 else if (direction ==
"radial")
3753 bool mesh_has_second_order_elements =
false;
3755 if ((*it)->default_order() ==
SECOND)
3757 mesh_has_second_order_elements =
true;
3762 comm().
max(mesh_has_second_order_elements);
3763 return mesh_has_second_order_elements;
3772 std::unique_ptr<libMesh::PointLocatorBase>
3781 mooseAssert(!Threads::in_threads,
3782 "This routine has not been implemented for threads. Please query this routine before " 3783 "a threaded region or contact a MOOSE developer to discuss.");
3786 using Keytype = std::pair<const Elem *, unsigned short int>;
3789 std::vector<std::tuple<dof_id_type, unsigned short int, boundary_id_type>> side_list =
3791 std::map<Keytype, std::set<boundary_id_type>> side_map;
3792 for (
auto & [elem_id, side, bc_id] : side_list)
3795 Keytype key(
elem, side);
3796 auto & bc_set = side_map[key];
3797 bc_set.insert(bc_id);
3811 auto begin =
getMesh().active_elements_begin();
3812 auto end =
getMesh().active_elements_end();
3822 for (
unsigned int side = 0; side <
elem->
n_sides(); ++side)
3833 "If the neighbor is coarser than the element, we expect that the neighbor must " 3843 std::set<boundary_id_type> & boundary_ids = fi.boundaryIDs();
3844 boundary_ids.clear();
3850 fi.computeBoundaryCoefficients();
3854 auto lit = side_map.find(Keytype(&fi.elem(), fi.elemSideID()));
3855 if (lit != side_map.end())
3856 boundary_ids.insert(lit->second.begin(), lit->second.end());
3858 if (fi.neighborPtr())
3860 auto rit = side_map.find(Keytype(fi.neighborPtr(), fi.neighborSideID()));
3861 if (rit != side_map.end())
3862 boundary_ids.insert(rit->second.begin(), rit->second.end());
3873 const Elem *
const elem = &fi.elem();
3874 const auto side = fi.elemSideID();
3880 mooseAssert(pair_it.second,
"We should be adding unique FaceInfo objects.");
3884 if (fi.elem().processor_id() == this->
processor_id() ||
3885 (fi.neighborPtr() && (fi.neighborPtr()->processor_id() == this->
processor_id())))
3890 if (ei.second.elem()->processor_id() == this->
processor_id())
3903 mooseAssert(it->second,
3904 "For some reason, the FaceInfo object is NULL! Try calling " 3905 "`buildFiniteVolumeInfo()` before using this accessor!");
3920 mooseError(
"Trying to compute face- and elem-info coords when the information is dirty");
3925 const SubdomainID elem_subdomain_id = fi.elemSubdomainID();
3926 const SubdomainID neighbor_subdomain_id = fi.neighborSubdomainID();
3929 *
this, elem_subdomain_id, fi.faceCentroid(), fi.faceCoord(), neighbor_subdomain_id);
3934 *
this, ei.second.subdomain_id(), ei.second.centroid(), ei.second.coordFactor());
3949 "EDGE EDGE2 EDGE3 EDGE4 QUAD QUAD4 QUAD8 QUAD9 TRI3 TRI6 HEX HEX8 HEX20 HEX27 TET4 TET10 " 3950 "PRISM6 PRISM15 PRISM18 PYRAMID5 PYRAMID13 PYRAMID14");
3959 _mesh->allow_remote_element_removal(allow_remote_element_removal);
3961 if (!allow_remote_element_removal)
3973 mooseError(
"Cannot delete remote elements because we have not yet attached a MeshBase");
3975 _mesh->allow_remote_element_removal(
true);
3977 _mesh->delete_remote_elements();
3984 !Threads::in_threads,
3985 "Performing writes to faceInfo variable association maps. This must be done unthreaded!");
3989 auto face_lambda = [
this](
const SubdomainID elem_subdomain_id,
3992 std::vector<std::vector<FaceInfo::VarFaceNeighbors>> & face_type_vector)
3995 const auto & variables = sys.getVariables(0);
3997 for (
const auto & var : variables)
3999 const unsigned int var_num = var->number();
4000 const unsigned int sys_num = var->sys().number();
4001 std::set<SubdomainID> var_subdomains = var->blockIDs();
4011 bool var_defined_elem = var_subdomains.find(elem_subdomain_id) != var_subdomains.end();
4012 bool var_defined_neighbor =
4013 var_subdomains.find(neighbor_subdomain_id) != var_subdomains.end();
4014 if (var_defined_elem && var_defined_neighbor)
4016 else if (!var_defined_elem && !var_defined_neighbor)
4021 if (var_defined_elem)
4023 else if (var_defined_neighbor)
4035 const SubdomainID elem_subdomain_id = face.elemSubdomainID();
4036 const SubdomainID neighbor_subdomain_id = face.neighborSubdomainID();
4038 auto & face_type_vector = face.faceType();
4040 face_type_vector.clear();
4041 face_type_vector.resize(num_eqs);
4045 face_lambda(elem_subdomain_id,
4046 neighbor_subdomain_id,
4051 face_lambda(elem_subdomain_id,
4052 neighbor_subdomain_id,
4061 mooseAssert(!Threads::in_threads,
4062 "Performing writes to elemInfo dof indices. This must be done unthreaded!");
4064 auto elem_lambda = [](
const ElemInfo & elem_info,
4066 std::vector<std::vector<dof_id_type>> & dof_vector)
4068 if (sys.nFVVariables())
4071 const auto & variables = sys.getVariables(0);
4073 for (
const auto & var : variables)
4076 const auto & var_subdomains = var->blockIDs();
4079 if (var_subdomains.find(elem_info.
subdomain_id()) != var_subdomains.end())
4081 std::vector<dof_id_type> indices;
4082 var->dofMap().dof_indices(elem_info.
elem(), indices, var->number());
4083 mooseAssert(indices.size() == 1,
"We expect to have only one dof per element!");
4084 dof_vector[sys.number()][var->number()] = indices[0];
4096 auto & elem_info = ei_pair.second;
4100 dof_vector.resize(num_eqs);
4124 TIME_SECTION(
"setCoordSystem", 5,
"Setting Coordinate System");
4127 const std::string param_name =
isParamValid(
"coord_block") ?
"coord_block" :
"block";
4128 mooseWarning(
"Supplied blocks in the 'setCoordSystem' method do not match the value of the " 4131 "' parameter. Did you provide different parameter values for 'Mesh/",
4133 "' and 'Problem/block'?. We will honor the parameter value from 'Mesh/",
4137 "If we are arriving here due to a bad specification in the Problem block, then we " 4138 "should have already set our coordinate system subdomains from the Mesh block");
4142 mooseError(
"Supplied coordinate systems in the 'setCoordSystem' method do not match the value " 4143 "of the 'Mesh/coord_type' parameter. Did you provide different parameter values for " 4144 "'coord_type' to 'Mesh' and 'Problem'?");
4151 if (coord_sys.
size() > 1)
4152 mooseError(
"If you specify ANY_BLOCK_ID as the only block, you must also specify a single " 4153 "coordinate system for it.");
4154 if (!
_mesh->is_prepared())
4156 "You cannot set the coordinate system for ANY_BLOCK_ID before the mesh is prepared. " 4157 "Please call this method after the mesh is prepared.");
4158 const auto coord_type = coord_sys.
size() == 0
4160 : Moose::stringToEnum<Moose::CoordinateSystemType>(coord_sys[0]);
4168 mooseError(
"You cannot specify ANY_BLOCK_ID together with other blocks in the " 4169 "setCoordSystem() method. If you want to set the same coordinate system for all " 4170 "blocks, use ANY_BLOCK_ID as the only block.");
4175 for (
const auto & sub_name :
blocks)
4178 subdomains.insert(sub_id);
4181 if (coord_sys.
size() <= 1)
4184 const auto coord_type = coord_sys.
size() == 0
4186 : Moose::stringToEnum<Moose::CoordinateSystemType>(coord_sys[0]);
4187 for (
const auto sid : subdomains)
4193 mooseError(
"Number of blocks and coordinate systems does not match.");
4199 Moose::stringToEnum<Moose::CoordinateSystemType>(coord_sys[i]);
4203 for (
const auto & sid : subdomains)
4206 "' does not have a coordinate system specified.");
4219 return (*it).second;
4221 mooseError(
"Requested subdomain ", sid,
" does not exist.");
4229 bool result = std::all_of(
4233 typename std::unordered_map<SubdomainID, Moose::CoordinateSystemType>::const_reference
4234 item) {
return (item.second == unique_system); });
4236 mooseError(
"The unique coordinate system of the mesh was requested by the mesh contains " 4237 "multiple blocks with different coordinate systems");
4240 mooseError(
"General axisymmetric coordinate axes are being used, and it is currently " 4241 "conservatively assumed that in this case there is no unique coordinate system.");
4243 return unique_system;
4246 const std::map<SubdomainID, Moose::CoordinateSystemType> &
4262 const std::vector<SubdomainName> &
blocks,
4263 const std::vector<std::pair<Point, RealVectorValue>> & axes)
4266 mooseAssert(
blocks.size() == axes.size(),
"Blocks and axes vectors must be the same length.");
4270 const auto it =
_coord_sys.find(subdomain_id);
4274 "' has not set a coordinate system. Make sure to call setCoordSystem() before " 4275 "setGeneralAxisymmetricCoordAxes().");
4280 const auto direction = axes[i].second;
4281 if (direction.is_zero())
4282 mooseError(
"Only nonzero vectors may be supplied for RZ directions.");
4285 std::make_pair(axes[i].first, direction.unit());
4290 "' was provided in setGeneralAxisymmetricCoordAxes(), but the coordinate system " 4291 "for this block is not 'RZ'.");
4297 for (
const auto subdomain_id : all_subdomain_ids)
4302 "' was specified to use the 'RZ' coordinate system but was not given in " 4303 "setGeneralAxisymmetricCoordAxes().");
4308 const std::pair<Point, RealVectorValue> &
4313 return (*it).second;
4315 mooseError(
"Requested subdomain ", subdomain_id,
" does not exist.");
4337 mooseError(
"getAxisymmetricRadialCoord() should not be called if " 4338 "setGeneralAxisymmetricCoordAxes() has been called.");
4349 for (
const auto &
elem :
getMesh().element_ptr_range())
4354 " which contains 3D elements.");
4356 mooseError(
"An RSPHERICAL coordinate system was requested for subdomain " +
4379 std::map<SubdomainName, SubdomainID> subdomain;
4383 if (!sub_name.empty() && subdomain.count(sub_name) > 0)
4386 " is used for both subdomain with ID=",
4387 subdomain[sub_name],
4390 ", Please rename one of them!");
4392 subdomain[sub_name] = sbd_id;
4396 const std::vector<QpMap> &
4399 const std::map<std::pair<ElemType, unsigned int>, std::vector<QpMap>> & map)
const 4403 return libmesh_map_find(map,
4407 const std::vector<QpMap> &
4410 const std::map<std::pair<ElemType, unsigned int>, std::vector<QpMap>> & map)
const 4413 "These are the conditions that should be met for requesting a coarsening map");
4417 const std::vector<QpMap> &
4423 const std::vector<QpMap> &
4429 const std::vector<QpMap> &
4435 const std::vector<QpMap> &
4444 return _mesh->skip_noncritical_partitioning();
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.
void remove_id(boundary_id_type id, bool global=false)
KOKKOS_INLINE_FUNCTION Real3 operator*(const Real left, const Real3 right)
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::unique_ptr< libMesh::NodeRange > _active_node_range
MetaPhysicL::DualNumber< V, D, asd > abs(const MetaPhysicL::DualNumber< V, D, asd > &a)
std::vector< Node * > _extreme_nodes
A vector containing the nodes at the corners of a regular orthogonal mesh.
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.
void computeMaxPerElemAndSide()
Compute the maximum numbers per element and side.
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.
std::unique_ptr< FEGenericBase< Real > > build(const unsigned int dim, const FEType &fet)
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...
libMesh::ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems...
virtual void read(const std::string &name, void *mesh_data=nullptr, bool skip_renumber_nodes_and_elements=false, bool skip_find_neighbors=false)=0
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< boundary_id_type > & get_side_boundary_ids() const
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.
static const std::string name_param
The name of the parameter that contains the object name.
std::vector< SubdomainName > _provided_coord_blocks
Set for holding user-provided coordinate system type block names.
virtual MooseMesh & clone() const
Clone method.
KOKKOS_INLINE_FUNCTION const T * find(const T &target, const T *const begin, const T *const end)
Find a value in an array.
const Elem * parent() const
const std::vector< QpMap > & getPCoarseningMapHelper(const Elem &elem, const std::map< std::pair< libMesh::ElemType, unsigned int >, std::vector< QpMap >> &) const
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)
virtual Node *& set_node(const unsigned int i)
const std::vector< QpMap > & getPRefinementMapHelper(const Elem &elem, const std::map< std::pair< libMesh::ElemType, unsigned int >, std::vector< QpMap >> &) const
unsigned int n_systems() const
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...
const InputParameters & _pars
The object's parameters.
libMesh::QBase *const & writeableQRule()
Returns the reference to the current quadrature being used.
virtual unique_id_type parallel_max_unique_id() const=0
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()))
std::string & nodeset_name(boundary_id_type id)
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.
std::unique_ptr< PointLocatorBase > sub_point_locator() const
void build_node_list_from_side_list()
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.
std::map< libMesh::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 setCoordData(const MooseMesh &other_mesh)
Set the coordinate system data to that of other_mesh.
const Elem * interior_parent() const
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 ...
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
bool _finite_volume_info_dirty
virtual Elem * elemPtr(const dof_id_type i)
void allow_renumbering(bool allow)
The definition of the bnd_elem_iterator struct.
std::map< SubdomainID, Moose::CoordinateSystemType > & _coord_sys
Type of coordinate system per subdomain.
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.
IntRange< unsigned short > side_index_range() const
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 skip_partitioning(bool skip)
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.
virtual std::unique_ptr< Elem > build_side_ptr(const unsigned int i)=0
std::unordered_map< const Elem *, unsigned short int > _lower_d_elem_to_higher_d_elem_side
const BoundaryID INVALID_BOUNDARY_ID
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
unsigned int _max_nodes_per_side
The maximum number of nodes per side.
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...
static Point inverse_map(const unsigned int dim, const Elem *elem, const Point &p, const Real tolerance=TOLERANCE, const bool secure=true, const bool extra_checks=true)
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.
unsigned int _max_sides_per_elem
The maximum number of sides per element.
bool isSemiLocal(Node *const node) const
Returns true if the node is semi-local.
unsigned int which_side_am_i(const Elem *e) const
virtual bool is_child_on_side(const unsigned int c, const unsigned int s) const=0
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...
std::unique_ptr< libMesh::StoredRange< MooseMesh::const_bnd_elem_iterator, const BndElement * > > _bnd_elem_range
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...
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.
void prepare_for_use(const bool skip_renumber_nodes_and_elements, const bool skip_find_neighbors)
RefinementState p_refinement_flag() const
bool _doing_p_refinement
Whether we have p-refinement (as opposed to h-refinement)
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
void family_tree(std::vector< const Elem * > &family, bool reset=true) const
unsigned int side_with_boundary_id(const Elem *const elem, const boundary_id_type boundary_id) const
The definition of the bnd_node_iterator struct.
unsigned int n_elem_integers() const
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)
boundary_id_type pairedboundary
PeriodicBoundaryBase * boundary(boundary_id_type id)
bool usingGeneralAxisymmetricCoordAxes() const
Returns true if general axisymmetric coordinate axes are being used.
std::map< std::pair< int, libMesh::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:
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
virtual std::unique_ptr< Partitioner > & partitioner()
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.
void mooseInfoRepeated(Args &&... args)
Emit an informational message with the given stringified, concatenated args.
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.
virtual unsigned int n_children() const=0
unsigned int p_level() const
void allgather_packed_range(Context *context, Iter range_begin, const Iter range_end, OutputIter out, std::size_t approx_buffer_size=1000000) const
MooseEnum _partitioner_name
The partitioner used on this mesh.
std::unique_ptr< libMesh::ConstElemRange > _active_local_elem_range
A range for use with threading.
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
void build_side_boundary_ids(std::vector< boundary_id_type > &b_ids) const
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...
void boundary_ids(const Node *node, std::vector< boundary_id_type > &vec_to_fill) const
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.
virtual std::unique_ptr< Partitioner > clone() const=0
const Parallel::Communicator & _communicator
std::map< std::pair< libMesh::ElemType, unsigned int >, std::vector< QpMap > > _elem_type_to_p_coarsening_side_map
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.
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
std::set< SubdomainID > _lower_d_boundary_blocks
Mesh blocks for boundary lower-d elements in different types.
std::basic_ostream< charT, traits > * os
void build_active_side_list(std::vector< dof_id_type > &element_id_list, std::vector< unsigned short int > &side_list, std::vector< boundary_id_type > &bc_id_list) const
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.
Base class for a system (of equations)
const BoundaryInfo & get_boundary_info() const
std::set< Elem * > _ghost_elems_from_ghost_boundaries
Set of elements ghosted by ghostGhostedBoundaries.
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
libMesh::ConstNodeRange * getLocalNodeRange()
virtual std::unique_ptr< MeshBase > clone() const=0
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 Node * add_point(const Point &p, const dof_id_type id=DofObject::invalid_id, const processor_id_type proc_id=DofObject::invalid_processor_id)=0
std::vector< SubdomainID > getSubdomainIDs(const std::vector< SubdomainName > &subdomain_names) const
Get the associated subdomainIDs for the subdomain names that are passed in.
bool operator()(const BndNode *const &lhs, const BndNode *const &rhs)
void buildNodeListFromSideList()
Calls BoundaryInfo::build_node_list_from_side_list().
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.
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...
std::set< SubdomainID > _lower_d_interior_blocks
Mesh blocks for interior lower-d elements in different types.
virtual Elem * queryElemPtr(const dof_id_type i)
elem_info_iterator ownedElemInfoBegin()
Iterators to owned faceInfo objects.
void build_side_list(std::vector< dof_id_type > &element_id_list, std::vector< unsigned short int > &side_list, std::vector< boundary_id_type > &bc_id_list) const
void setIsCustomPartitionerRequested(bool cpr)
const std::set< boundary_id_type > & get_node_boundary_ids() const
unsigned int _max_h_level
Maximum h-refinement level of all elements.
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".
BoundaryID getBoundaryID(const BoundaryName &boundary_name, const MeshBase &mesh)
Gets the boundary ID associated with the given BoundaryName.
virtual Point get_corresponding_pos(const Point &pt) const=0
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.
void updateCoordTransform()
Update the coordinate transformation object based on our coordinate system data.
static const int GRAIN_SIZE
bool _use_distributed_mesh
False by default.
virtual bool is_serial() const
void libmesh_ignore(const Args &...)
void build_node_list(std::vector< dof_id_type > &node_id_list, std::vector< boundary_id_type > &bc_id_list) const
static const subdomain_id_type invalid_subdomain_id
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
const std::string & name() const
Get the name of the class.
virtual void find_neighbors(const bool reset_remote_elements=false, const bool reset_current_list=true)=0
bool _built_from_other_mesh
Whether or not this mesh was built from another mesh.
bool hasKokkosObjects() const
Get whether there is any Kokkos object added by actions.
bool _allow_remote_element_removal
Whether to allow removal of remote elements.
std::unique_ptr< Moose::Kokkos::Mesh > _kokkos_mesh
Pointer to Kokkos mesh object.
virtual bool skipNoncriticalPartitioning() const
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.
virtual void delete_elem(Elem *e)=0
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
virtual unsigned int n_nodes() const=0
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...
void mooseDeprecated(Args &&... args) const
unsigned int _from
The qp to map from.
std::pair< const Node *, BoundaryID > PeriodicNodeInfo
Helper type for building periodic node maps.
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 Point & min() const
virtual Elem * add_elem(Elem *e)=0
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 print_info(std::ostream &os=libMesh::out, const unsigned int verbosity=0, const bool global=true) const
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
virtual const Node * query_node_ptr(const dof_id_type i) const=0
virtual libMesh::EquationSystems & es() override
std::vector< dof_id_type > _max_ids
Maximum integer ID for each extra element integer.
virtual dof_id_type max_elem_id() const=0
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. ...
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
bool isKokkosAvailable() const
Get whether Kokkos is available.
std::set< BoundaryID > _mesh_nodeset_ids
virtual bool is_remote() const
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.
std::string & subdomain_name(subdomain_id_type id)
std::map< std::pair< libMesh::ElemType, unsigned int >, std::vector< QpMap > > _elem_type_to_p_refinement_side_map
const std::set< unsigned char > & elem_dimensions() const
std::map< std::pair< libMesh::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.
void allow_find_neighbors(bool allow)
void set_mesh_dimension(unsigned char d)
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.
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.
bool _moose_mesh_prepared
True if prepare has been called on the mesh.
void buildRefinementMap(const Elem &elem, libMesh::QBase &qrule, libMesh::QBase &qrule_face, int parent_side, int child, int child_side)
Build the refinement map for a given element type.
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...
bool _parallel_type_overridden
const std::string & get_nodeset_name(boundary_id_type id) const
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
Executioner * getExecutioner() const
Retrieve the Executioner for this App.
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...
libMesh::Node * _node
pointer to the node
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.
std::string & sideset_name(boundary_id_type id)
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
const std::set< boundary_id_type > & get_boundary_ids() const
const std::vector< std::vector< dof_id_type > > & dofIndices() const
virtual Node * add_node(Node *n)=0
virtual const Elem * elem_ptr(const dof_id_type i) const=0
void buildCoarseningMap(const Elem &elem, libMesh::QBase &qrule, libMesh::QBase &qrule_face, int input_side)
Build the coarsening map for a given element type.
virtual unsigned int n_sides() const=0
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
std::map< std::pair< int, libMesh::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:
void setBoundaryName(BoundaryID boundary_id, BoundaryName name)
This method sets the boundary name of the boundary based on the id parameter.
const Elem * neighbor_ptr(unsigned int i) const
void remove_side(const Elem *elem, const unsigned short int side)
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...
bool absolute_fuzzy_equals(const T &var1, const T2 &var2, const Real tol=TOLERANCE *TOLERANCE)
unsigned int level() const
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.
virtual std::unique_ptr< Elem > side_ptr(unsigned int i)=0
virtual const Elem * query_elem_ptr(const dof_id_type i) const=0
void updateActiveSemiLocalNodeRange(std::set< dof_id_type > &ghosted_elems)
Clears the "semi-local" node list and rebuilds it.
subdomain_id_type subdomain_id() const
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 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
libMesh::NodeRange * getActiveNodeRange()
virtual unsigned short dim() const=0
const Node * node_ptr(const unsigned int i) const
void setGhostedBoundaryInflation(const std::vector< Real > &inflation)
This sets the inflation amount for the bounding box for each partition for use in ghosting boundaries...
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 is_my_variable(unsigned int var_num) const
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.
void add_side(const dof_id_type elem, const unsigned short int side, const boundary_id_type id)
unsigned int _max_nodes_per_elem
The maximum number of nodes per element.
bool _need_delete
Whether we need to delete remote elements after init'ing the EquationSystems.
const std::string & get_sideset_name(boundary_id_type id) const
std::map< std::pair< libMesh::ElemType, unsigned int >, std::vector< QpMap > > _elem_type_to_p_refinement_map
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.
void mooseWarning(Args &&... args) const
Emits a warning prefixed with object name and type.
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++()
libMesh::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 mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
unsigned int mesh_dimension() const
void setMeshBase(std::unique_ptr< MeshBase > mesh_base)
Method to set the mesh_base object.
std::set< SubdomainID > getInterfaceConnectedBlocks(const BoundaryID bid) const
Get the list of subdomains contacting the given boundary.
SolverSystem & getSolverSystem(unsigned int sys_num)
Get non-constant reference to a solver system.
std::vector< Real > _ghosted_boundaries_inflation
virtual SimpleRange< element_iterator > active_subdomain_set_elements_ptr_range(std::set< subdomain_id_type > ss)=0
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.
IntRange< unsigned short > node_index_range() const
void findAdaptivityQpMaps(const Elem *template_elem, libMesh::QBase &qrule, libMesh::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...
unsigned int _patch_size
The number of nodes to consider in the NearestNode neighborhood.
elem_info_iterator ownedElemInfoEnd()
void buildPeriodicNodeSets(std::map< BoundaryID, std::set< dof_id_type >> &periodic_node_sets, unsigned int var_number, libMesh::PeriodicBoundaries *pbs) const
This routine builds a datastructure of node ids organized by periodic boundary ids.
virtual std::unique_ptr< libMesh::PointLocatorBase > getPointLocator() const
Proxy function to get a (sub)PointLocator from either the underlying libMesh mesh (default)...
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".
libMesh::StoredRange< MooseMesh::const_bnd_elem_iterator, const BndElement * > * getBoundaryElementRange()
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
bool hasKokkosObjects() const
face_info_iterator ownedFaceInfoEnd()
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type...
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...
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...
MeshBase::node_iterator localNodesEnd()
const RealVectorValue & getNormalByBoundaryID(BoundaryID id) const
Returns the normal vector associated with a given BoundaryID.
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.
const Point & max() const
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...
virtual dof_id_type max_node_id() const=0
std::unordered_map< SubdomainID, SubdomainData > _sub_to_data
Holds a map from subdomain ids to associated data.
std::unique_ptr< libMesh::Partitioner > _custom_partitioner
The custom partitioner.
bool isBoundaryElem(dof_id_type elem_id) const
Returns true if the requested element is in the list of boundary elements, false otherwise.
virtual dof_id_type n_elem() const=0
virtual const Node * node_ptr(const dof_id_type i) const=0
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
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.
auto min(const L &left, const R &right)
virtual std::size_t numSolverSystems() const override
SearchParams SearchParameters
std::vector< const Elem * > _coarsened_elements
The elements that were just coarsened.
void buildPeriodicNodeMap(std::multimap< dof_id_type, dof_id_type > &periodic_node_map, unsigned int var_number, libMesh::PeriodicBoundaries *pbs) const
This routine builds a multimap of boundary ids to matching boundary ids across all periodic boundarie...
processor_id_type processor_id() const
std::string getRestartRecoverFileBase() const
The file_base for the recovery file.
virtual ElemType type() const=0
bool isParamSetByUser(const std::string &name) const
Test if the supplied parameter is set by a user, as opposed to not set or set to default.
dof_id_type node_id(const unsigned int i) const
const Point & point(const unsigned int i) const
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()
bool relative_fuzzy_equals(const TypeVector< Real > &rhs, Real tol=TOLERANCE) const
std::unique_ptr< libMesh::ConstNodeRange > _local_node_range
libMesh::StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode * > * getBoundaryNodeRange()
void ErrorVector unsigned int
auto index_range(const T &sizable)
bool _regular_orthogonal_mesh
Boolean indicating whether this mesh was detected to be regular and orthogonal.
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.
virtual dof_id_type n_nodes() const=0
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.
void setCustomPartitioner(libMesh::Partitioner *partitioner)
Setter for custom partitioner.
Real _distance
The distance between them.
SubdomainID subdomain_id() const
We return the subdomain ID of the corresponding libmesh element.
dof_id_type get_extra_integer(const unsigned int index) const
const Elem * child_ptr(unsigned int i) const
static MooseEnum elemTypes()
returns MooseMesh element type options
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.
std::unique_ptr< libMesh::StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode * > > _bnd_node_range
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...
libMesh::QBase *const & writeableQRuleFace()
Returns the reference to the current quadrature being used on a current face.
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.
unsigned int _max_p_level
Maximum p-refinement level of all elements.
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...