21 #include "libmesh/libmesh_config.h" 24 #include "libmesh/boundary_info.h" 25 #include "libmesh/libmesh_logging.h" 26 #include "libmesh/elem.h" 27 #include "libmesh/ghost_point_neighbors.h" 28 #include "libmesh/mesh_base.h" 29 #include "libmesh/mesh_communication.h" 30 #include "libmesh/mesh_serializer.h" 31 #include "libmesh/mesh_tools.h" 32 #include "libmesh/parallel.h" 33 #include "libmesh/parallel_algebra.h" 34 #include "libmesh/parallel_fe_type.h" 35 #include "libmesh/partitioner.h" 36 #include "libmesh/point_locator_base.h" 37 #include "libmesh/sparse_matrix.h" 38 #include "libmesh/threads.h" 39 #include "libmesh/enum_elem_type.h" 40 #include "libmesh/enum_point_locator_type.h" 41 #include "libmesh/enum_to_string.h" 42 #include "libmesh/point_locator_nanoflann.h" 43 #include "libmesh/elem_side_builder.h" 44 #include "libmesh/elem_range.h" 45 #include "libmesh/node_range.h" 52 #include <unordered_map> 54 #include "libmesh/periodic_boundaries.h" 55 #include "libmesh/periodic_boundary.h" 70 _default_mapping_data(0),
72 _element_stored_range (),
73 _const_active_local_element_stored_range (),
75 _count_lower_dim_elems_in_point_locator(true),
77 #ifdef LIBMESH_ENABLE_UNIQUE_ID
78 _next_unique_id(
DofObject::invalid_unique_id),
81 _skip_noncritical_partitioning(false),
83 _skip_renumber_nodes_and_elements(false),
84 _skip_find_neighbors(false),
85 _skip_detect_interior_parents(false),
86 _allow_remote_element_removal(true),
87 _allow_node_and_elem_unique_id_overlap(false),
88 _spatial_dimension(d),
90 _point_locator_close_to_point_tol(0.)
94 libmesh_assert_less_equal (LIBMESH_DIM, 3);
95 libmesh_assert_greater_equal (LIBMESH_DIM, d);
104 _n_parts (other_mesh._n_parts),
105 _default_mapping_type(other_mesh._default_mapping_type),
106 _default_mapping_data(other_mesh._default_mapping_data),
107 _preparation (other_mesh._preparation),
108 _element_stored_range (),
109 _const_active_local_element_stored_range (),
111 _count_lower_dim_elems_in_point_locator(other_mesh._count_lower_dim_elems_in_point_locator),
113 #ifdef LIBMESH_ENABLE_UNIQUE_ID
114 _next_unique_id(other_mesh._next_unique_id),
118 _interior_mesh((other_mesh._interior_mesh == &other_mesh) ?
119 this : other_mesh._interior_mesh),
120 _skip_noncritical_partitioning(other_mesh._skip_noncritical_partitioning),
121 _skip_all_partitioning(other_mesh._skip_all_partitioning),
122 _skip_renumber_nodes_and_elements(other_mesh._skip_renumber_nodes_and_elements),
123 _skip_find_neighbors(other_mesh._skip_find_neighbors),
124 _skip_detect_interior_parents(other_mesh._skip_detect_interior_parents),
125 _allow_remote_element_removal(other_mesh._allow_remote_element_removal),
126 _allow_node_and_elem_unique_id_overlap(other_mesh._allow_node_and_elem_unique_id_overlap),
127 _elem_dims(other_mesh._elem_dims),
128 _elem_default_orders(other_mesh._elem_default_orders),
129 _supported_nodal_order(other_mesh._supported_nodal_order),
130 _mesh_subdomains(other_mesh._mesh_subdomains),
131 _elemset_codes_inverse_map(other_mesh._elemset_codes_inverse_map),
132 _all_elemset_ids(other_mesh._all_elemset_ids),
133 _spatial_dimension(other_mesh._spatial_dimension),
135 _point_locator_close_to_point_tol(other_mesh._point_locator_close_to_point_tol)
143 if (gf == other_default_ghosting)
149 std::shared_ptr<GhostingFunctor> clone_gf = gf->
clone();
158 clone_gf->set_mesh(
this);
163 libmesh_deprecated();
171 #ifdef LIBMESH_ENABLE_PERIODIC 179 (*_disjoint_neighbor_boundary_pairs)[id] = pb->clone();
191 LOG_SCOPE(
"operator=(&&)",
"MeshBase");
196 _n_parts = other_mesh.n_partitions();
204 #ifdef LIBMESH_ENABLE_UNIQUE_ID 219 _elem_dims = std::move(other_mesh.elem_dimensions());
233 #ifdef LIBMESH_ENABLE_PERIODIC 237 if (other_mesh._disjoint_neighbor_boundary_pairs)
241 for (
const auto & [
id, pb] : *other_mesh._disjoint_neighbor_boundary_pairs)
243 (*_disjoint_neighbor_boundary_pairs)[id] = pb->clone();
258 "Elemset code " << code <<
" not found in _elmset_codes container.");
259 libmesh_assert_equal_to(it->second, &
set);
273 LOG_SCOPE(
"operator==()",
"MeshBase");
376 auto it = other_rows.find(other_node);
377 if (it == other_rows.end())
380 const auto & other_row = it->second;
381 if (row.size() != other_row.size())
386 const auto & [elem_pair, coef] = row[i];
387 const auto & [other_elem_pair, other_coef] = other_row[i];
390 if (elem_pair.first->id() !=
391 other_elem_pair.first->id() ||
393 other_elem_pair.second ||
399 for (
const auto & [elemset_code, elemset_ptr] : this->
_elemset_codes)
401 it == other_mesh.
_elemset_codes.end() || *elemset_ptr != *it->second)
433 return cast_int<unsigned int>(*
_elem_dims.rbegin());
444 parallel_object_only();
448 "Specified element dimensions does not match true element dimensions!");
462 const auto & inserted_id_set = it1->first;
472 auto [it2, inserted2] =
_elemset_codes.emplace(code, &inserted_id_set);
476 libmesh_error_msg_if(!inserted2 && it2->second != &inserted_id_set,
477 "The elemset code " << code <<
" already exists with a different id_set.");
490 id_set_to_fill.clear();
494 id_set_to_fill.insert(it->second->begin(), it->second->end());
505 std::vector<dof_id_type> ret;
508 ret.push_back(pr.first);
531 "Expected _elemset_codes_inverse_map entry for elemset code " << old_code);
552 [elemset_index, old_code, new_code](
const ElemRange & range)
554 for (
Elem * elem : range)
557 elem->get_extra_integer(elemset_index);
559 if (elemset_code == old_code)
560 elem->set_extra_integer(elemset_index, new_code);
573 "Cannot change elemset id " << old_id <<
574 " to " << new_id <<
", " << new_id <<
" already exists.");
578 std::map<MeshBase::elemset_type, dof_id_type> new_elemset_codes_inverse_map;
581 auto id_set_copy = id_set;
582 if (id_set_copy.count(old_id))
585 id_set_copy.erase(old_id);
586 id_set_copy.insert(new_id);
590 new_elemset_codes_inverse_map.emplace(id_set_copy, elemset_code);
648 const std::vector<dof_id_type> * default_values)
650 libmesh_assert(!default_values || default_values->size() == names.size());
653 std::unordered_map<std::string, std::size_t> name_indices;
657 std::vector<unsigned int> returnval(names.size());
659 bool added_an_integer =
false;
662 const std::string &
name = names[i];
663 if (
const auto it = name_indices.find(
name);
664 it != name_indices.end())
666 returnval[i] = it->second;
673 name_indices[
name] = returnval[i];
677 added_an_integer =
true;
681 if (allocate_data && added_an_integer)
695 libmesh_error_msg(
"Unknown elem integer " <<
name);
737 const std::vector<dof_id_type> * default_values)
739 libmesh_assert(!default_values || default_values->size() == names.size());
742 std::unordered_map<std::string, std::size_t> name_indices;
746 std::vector<unsigned int> returnval(names.size());
748 bool added_an_integer =
false;
751 const std::string &
name = names[i];
752 if (
const auto it = name_indices.find(
name);
753 it != name_indices.end())
755 returnval[i] = it->second;
762 name_indices[
name] = returnval[i];
766 added_an_integer =
true;
770 if (allocate_data && added_an_integer)
784 libmesh_error_msg(
"Unknown node integer " <<
name);
803 LOG_SCOPE(
"remove_orphaned_nodes()",
"MeshBase");
806 std::unordered_set<Node *> connected_nodes;
810 for (
const auto & element : this->element_ptr_range())
811 for (
auto & n : element->node_ref_range())
812 connected_nodes.insert(&n);
814 for (
const auto & node : this->node_ptr_range())
815 if (!connected_nodes.count(node))
823 #ifdef LIBMESH_ENABLE_DEPRECATED 826 libmesh_deprecated();
831 if (skip_renumber_nodes_and_elements)
845 libmesh_deprecated();
850 if (skip_renumber_nodes_and_elements)
855 #endif // LIBMESH_ENABLE_DEPRECATED 876 LOG_SCOPE(
"complete_preparation()",
"MeshBase");
878 parallel_object_only();
961 #if defined(DEBUG) && defined(LIBMESH_ENABLE_UNIQUE_ID) 1011 #ifdef LIBMESH_ENABLE_UNIQUE_ID 1074 #ifdef LIBMESH_ENABLE_DEPRECATED 1085 &ghosting_functor) ==
1109 &ghosting_functor) ==
1123 parallel_object_only();
1125 struct SBDInserter {
1126 std::set<subdomain_id_type> my_ids;
1132 for (
const Elem * elem : range)
1133 my_ids.insert(elem->subdomain_id());
1136 void join(SBDInserter & other) {
1137 my_ids.merge(other.my_ids);
1141 SBDInserter inserter;
1144 ids.swap(inserter.my_ids);
1151 for (
const auto & elem : this->active_unpartitioned_element_ptr_range())
1152 ids.insert(elem->subdomain_id());
1186 parallel_object_only();
1188 std::set<subdomain_id_type> ids;
1192 return cast_int<subdomain_id_type>(ids.size());
1199 std::set<subdomain_id_type> ids;
1203 return cast_int<subdomain_id_type>(ids.size());
1217 this->pid_nodes_end (proc_id)));
1230 this->pid_elements_end (proc_id)));
1239 this->active_pid_elements_end (proc_id)));
1248 for (
const auto & elem : this->element_ptr_range())
1249 ne += elem->n_sub_elem();
1260 for (
const auto & elem : this->active_element_ptr_range())
1261 ne += elem->n_sub_elem();
1270 std::ostringstream oss;
1272 oss <<
" Mesh Information:" <<
'\n';
1276 oss <<
" elem_dimensions()={";
1279 std::ostream_iterator<unsigned int>(oss,
", "));
1280 oss << cast_int<unsigned int>(*
_elem_dims.rbegin());
1286 oss <<
" elem_default_orders()={";
1289 std::ostream_iterator<std::string>(oss,
", "),
1291 {
return Utility::enum_to_string<Order>(o); });
1298 <<
" n_nodes()=" << this->
n_nodes() <<
'\n' 1300 <<
" n_elem()=" << this->
n_elem() <<
'\n' 1302 #ifdef LIBMESH_ENABLE_AMR 1303 oss <<
" n_active_elem()=" << this->
n_active_elem() <<
'\n';
1306 oss <<
" n_subdomains()=" <<
static_cast<std::size_t
>(this->
n_subdomains()) <<
'\n';
1308 oss <<
" n_local_subdomains()= " <<
static_cast<std::size_t
>(this->
n_local_subdomains()) <<
'\n';
1309 oss <<
" n_elemsets()=" <<
static_cast<std::size_t
>(this->
n_elemsets()) <<
'\n';
1312 oss <<
" n_partitions()=" <<
static_cast<std::size_t
>(this->
n_partitions()) <<
'\n' 1313 <<
" n_processors()=" << static_cast<std::size_t>(this->
n_processors()) <<
'\n' 1315 <<
" processor_id()=" << static_cast<std::size_t>(this->
processor_id()) <<
'\n' 1316 <<
" is_prepared()=" << (this->
is_prepared() ?
"true" :
"false") <<
'\n' 1317 <<
" is_replicated()=" << (this->
is_replicated() ?
"true" :
"false") <<
'\n';
1323 libmesh_parallel_only(this->
comm());
1325 oss <<
"\n Detailed global get_info() (verbosity > 0) is reduced and output to only rank 0.";
1329 const auto elem_type_helper = [](
const std::set<int> &
elem_types) {
1330 std::stringstream ss;
1342 const auto include_object = [
this, &global](
const DofObject & dof_object) {
1343 return this->
processor_id() == dof_object.processor_id() ||
1354 oss <<
"\n " << (global ?
"" :
"Local ") <<
"Mesh Bounding Box:\n" 1355 <<
" Minimum: " << bbox.min() <<
"\n" 1356 <<
" Maximum: " << bbox.max() <<
"\n" 1357 <<
" Delta: " << (bbox.max() - bbox.min()) <<
"\n";
1361 for (
const Elem * elem : this->active_local_element_ptr_range())
1367 for (
const Elem * elem : this->active_unpartitioned_element_ptr_range())
1375 oss <<
"\n " << (global ?
"" :
"Local ") <<
"Mesh Element Type(s):\n " 1386 std::size_t num_nodes = 0;
1389 std::map<boundary_id_type, NodesetInfo> nodeset_info_map;
1392 if (!include_object(*node))
1395 NodesetInfo &
info = nodeset_info_map[id];
1406 oss <<
"\n " << (global ?
"" :
"Local ") <<
"Mesh Nodesets:\n";
1407 if (nodeset_ids.empty())
1412 for (
const auto id : nodeset_ids)
1414 NodesetInfo &
info = nodeset_info_map[id];
1419 this->
comm().
sum(info.num_nodes);
1422 this->
comm().
min(info.bbox.min());
1423 this->
comm().
max(info.bbox.max());
1427 const bool has_name = nodeset_name_map.count(
id) && nodeset_name_map.at(
id).size();
1428 const std::string
name = has_name ? nodeset_name_map.at(
id) :
"";
1432 if (global ? this->
processor_id() == 0 : info.num_nodes > 0)
1434 oss <<
" Nodeset " << id;
1436 oss <<
" (" <<
name <<
")";
1437 oss <<
", " <<
info.num_nodes <<
" " << (global ?
"" :
"local ") <<
"nodes\n";
1441 oss <<
" " << (global ?
"Bounding" :
"Local bounding") <<
" box minimum: " 1442 <<
info.bbox.min() <<
"\n" 1443 <<
" " << (global ?
"Bounding" :
"Local bounding") <<
" box maximum: " 1444 <<
info.bbox.max() <<
"\n" 1445 <<
" " << (global ?
"Bounding" :
"Local bounding") <<
" box delta: " 1446 << (
info.bbox.max() -
info.bbox.min()) <<
"\n";
1459 std::size_t num_sides = 0;
1461 std::set<int> side_elem_types;
1463 std::set<dof_id_type> elem_ids;
1464 std::set<dof_id_type> node_ids;
1468 std::map<boundary_id_type, SidesetInfo> sideset_info_map;
1471 const Elem * elem = pair.first;
1472 if (!include_object(*elem))
1475 const auto id = pair.second.second;
1476 SidesetInfo &
info = sideset_info_map[id];
1478 const auto s = pair.second.first;
1479 const Elem & side = side_builder(*elem, s);
1482 info.side_elem_types.insert(side.
type());
1483 info.elem_types.insert(elem->
type());
1484 info.elem_ids.insert(elem->
id());
1487 if (include_object(node))
1488 info.node_ids.insert(node.id());
1500 oss <<
"\n " << (global ?
"" :
"Local ") <<
"Mesh Sidesets:\n";
1501 if (sideset_ids.empty())
1505 for (
const auto id : sideset_ids)
1507 SidesetInfo &
info = sideset_info_map[id];
1509 auto num_elems =
info.elem_ids.size();
1510 auto num_nodes =
info.node_ids.size();
1515 this->
comm().
sum(info.num_sides);
1522 this->
comm().
sum(info.volume);
1523 this->
comm().
min(info.bbox.min());
1524 this->
comm().
max(info.bbox.max());
1528 const bool has_name = sideset_name_map.count(
id) && sideset_name_map.at(
id).size();
1529 const std::string
name = has_name ? sideset_name_map.at(
id) :
"";
1533 if (global ? this->
processor_id() == 0 : info.num_sides > 0)
1535 oss <<
" Sideset " << id;
1537 oss <<
" (" <<
name <<
")";
1538 oss <<
", " <<
info.num_sides <<
" sides (" << elem_type_helper(
info.side_elem_types) <<
")" 1539 <<
", " << num_elems <<
" " << (global ?
"" :
"local ") <<
"elems (" << elem_type_helper(
info.elem_types) <<
")" 1540 <<
", " << num_nodes <<
" " << (global ?
"" :
"local ") <<
"nodes\n";
1544 oss <<
" " << (global ?
"Side" :
"Local side") <<
" volume: " <<
info.volume <<
"\n" 1545 <<
" " << (global ?
"Bounding" :
"Local bounding") <<
" box minimum: " 1546 <<
info.bbox.min() <<
"\n" 1547 <<
" " << (global ?
"Bounding" :
"Local bounding") <<
" box maximum: " 1548 <<
info.bbox.max() <<
"\n" 1549 <<
" " << (global ?
"Bounding" :
"Local bounding") <<
" box delta: " 1550 << (
info.bbox.max() -
info.bbox.min()) <<
"\n";
1563 std::size_t num_edges = 0;
1564 std::set<int> edge_elem_types;
1567 std::map<boundary_id_type, EdgesetInfo> edgeset_info_map;
1568 std::unique_ptr<const Elem> edge;
1572 const Elem * elem = pair.first;
1573 if (!include_object(*elem))
1576 const auto id = pair.second.second;
1577 EdgesetInfo &
info = edgeset_info_map[id];
1582 info.edge_elem_types.insert(edge->type());
1585 info.bbox.union_with(edge->loose_bounding_box());
1591 oss <<
"\n " << (global ?
"" :
"Local ") <<
"Mesh Edgesets:\n";
1592 if (edgeset_ids.empty())
1597 for (
const auto id : edgeset_ids)
1599 EdgesetInfo &
info = edgeset_info_map[id];
1604 this->
comm().
sum(info.num_edges);
1608 this->
comm().
min(info.bbox.min());
1609 this->
comm().
min(info.bbox.max());
1613 const bool has_name = edgeset_name_map.count(
id) && edgeset_name_map.at(
id).size();
1614 const std::string
name = has_name ? edgeset_name_map.at(
id) :
"";
1618 if (global ? this->
processor_id() == 0 : info.num_edges > 0)
1620 oss <<
" Edgeset " << id;
1622 oss <<
" (" <<
name <<
")";
1623 oss <<
", " <<
info.num_edges <<
" " << (global ?
"" :
"local ") <<
"edges (" 1624 << elem_type_helper(
info.edge_elem_types) <<
")\n";
1628 oss <<
" " << (global ?
"Bounding" :
"Local bounding") <<
" box minimum: " 1629 <<
info.bbox.min() <<
"\n" 1630 <<
" " << (global ?
"Bounding" :
"Local bounding") <<
" box maximum: " 1631 <<
info.bbox.max() <<
"\n" 1632 <<
" " << (global ?
"Bounding" :
"Local bounding") <<
" box delta: " 1633 << (
info.bbox.max() -
info.bbox.min()) <<
"\n";
1639 std::set<subdomain_id_type> subdomains;
1640 for (
const Elem * elem : this->active_element_ptr_range())
1641 if (include_object(*elem))
1642 subdomains.insert(elem->subdomain_id());
1647 struct SubdomainInfo
1649 std::size_t num_elems = 0;
1652 std::set<dof_id_type> active_node_ids;
1653 #ifdef LIBMESH_ENABLE_AMR 1654 std::size_t num_active_elems = 0;
1658 std::map<subdomain_id_type, SubdomainInfo> subdomain_info_map;
1659 for (
const Elem * elem : this->element_ptr_range())
1660 if (include_object(*elem))
1662 SubdomainInfo &
info = subdomain_info_map[elem->subdomain_id()];
1665 info.elem_types.insert(elem->type());
1667 #ifdef LIBMESH_ENABLE_AMR 1669 ++
info.num_active_elems;
1672 for (
const Node & node : elem->node_ref_range())
1673 if (include_object(node) && node.active())
1674 info.active_node_ids.insert(node.id());
1676 if (verbosity > 1 && elem->active())
1678 info.volume += elem->volume();
1684 oss <<
"\n " << (global ?
"" :
"Local ") <<
"Mesh Subdomains:\n";
1686 for (
const auto id : subdomains)
1688 SubdomainInfo &
info = subdomain_info_map[id];
1690 auto num_active_nodes =
info.active_node_ids.size();
1695 this->
comm().
sum(info.num_elems);
1696 #ifdef LIBMESH_ENABLE_AMR 1697 this->
comm().
sum(info.num_active_elems);
1699 this->
comm().
sum(num_active_nodes);
1703 this->
comm().
min(info.bbox.min());
1704 this->
comm().
max(info.bbox.max());
1705 this->
comm().
sum(info.volume);
1711 const bool has_name = subdomain_name_map.count(
id);
1712 const std::string
name = has_name ? subdomain_name_map.at(
id) :
"";
1718 oss <<
" Subdomain " << id;
1720 oss <<
" (" <<
name <<
")";
1721 oss <<
": " <<
info.num_elems <<
" " << (global ?
"" :
"local ") <<
"elems " 1722 <<
"(" << elem_type_helper(
info.elem_types);
1723 #ifdef LIBMESH_ENABLE_AMR 1724 oss <<
", " <<
info.num_active_elems <<
" active";
1726 oss <<
"), " << num_active_nodes <<
" " << (global ?
"" :
"local ") <<
"active nodes\n";
1729 oss <<
" " << (global ?
"Volume" :
"Local volume") <<
": " <<
info.volume <<
"\n";
1730 oss <<
" " << (global ?
"Bounding" :
"Local bounding") <<
" box minimum: " 1731 <<
info.bbox.min() <<
"\n" 1732 <<
" " << (global ?
"Bounding" :
"Local bounding") <<
" box maximum: " 1733 <<
info.bbox.max() <<
"\n" 1734 <<
" " << (global ?
"Bounding" :
"Local bounding") <<
" box delta: " 1735 << (
info.bbox.max() -
info.bbox.min()) <<
"\n";
1740 oss <<
" " << (global ?
"Global" :
"Local") <<
" mesh volume = " <<
volume <<
"\n";
1750 os << this->
get_info(verbosity, global)
1809 parallel_object_only();
1811 unsigned int max_proc_id=0;
1813 for (
const auto & elem : this->active_local_element_ptr_range())
1814 max_proc_id = std::max(max_proc_id, static_cast<unsigned int>(elem->processor_id()));
1835 parallel_object_only();
1837 #ifdef LIBMESH_ENABLE_NANOFLANN_POINTLOCATOR 1850 #ifdef LIBMESH_ENABLE_NANOFLANN_POINTLOCATOR 1888 static const std::string empty;
1894 return iter->second;
1904 if (sbd_name ==
name)
1921 std::make_unique<ElemRange>(this->elements_begin(),
1922 this->elements_end());
1936 std::make_unique<ConstElemRange>(this->active_local_elements_begin(),
1937 this->active_local_elements_end());
1950 #ifdef LIBMESH_ENABLE_DEPRECATED 1953 libmesh_deprecated();
1957 #endif // LIBMESH_ENABLE_DEPRECATED 1962 parallel_object_only();
1971 for (
const auto & elem : this->active_element_ptr_range())
1973 _elem_dims.insert(cast_int<unsigned char>(elem->dim()));
1979 static_cast<int>(elem->supported_nodal_order())));
2006 for (
const auto & node : this->node_ptr_range())
2016 #if LIBMESH_DIM == 2 2025 if ((*node)(2) != 0.)
2043 parallel_object_only();
2051 LOG_SCOPE(
"detect_interior_parents()",
"MeshBase");
2054 parallel_object_only();
2076 std::vector<bool> skip_dimension_for_interior_parents(LIBMESH_DIM+1,
false);
2077 skip_dimension_for_interior_parents.back() =
true;
2084 std::vector<bool> skip_dimensions_for_node_to_el_map(LIBMESH_DIM+1,
false);
2085 skip_dimensions_for_node_to_el_map[*dim_start] =
true;
2089 bool skip_all_dimensions =
true;
2092 for (
auto [it,
next] = std::make_tuple(dim_start,
std::next(dim_start));
2095 if (*it + 1 != *
next)
2097 skip_dimension_for_interior_parents[*it] =
true;
2098 skip_dimensions_for_node_to_el_map[*
next] =
true;
2100 else if (!skip_dimension_for_interior_parents[*it])
2101 skip_all_dimensions =
false;
2108 if (skip_all_dimensions)
2117 const bool separate_interior_mesh = (&(this->
interior_mesh()) !=
this);
2120 std::unordered_map<dof_id_type, std::vector<dof_id_type>> node_to_elem;
2122 for (
const auto & elem : this->element_ptr_range())
2125 if (skip_dimensions_for_node_to_el_map[elem->dim()])
2129 for (
auto n :
make_range(elem->n_vertices()))
2131 libmesh_assert_less (elem->id(), this->
max_elem_id());
2133 node_to_elem[elem->node_id(n)].push_back(elem->id());
2138 for (
const auto & element : this->element_ptr_range())
2142 if (skip_dimension_for_interior_parents[element->dim()] || element->interior_parent())
2151 std::vector<std::set<dof_id_type>> neighbors( element->n_vertices() );
2153 bool found_interior_parents =
true;
2155 for (
auto n :
make_range(element->n_vertices()))
2157 auto it = node_to_elem.find(element->node_id(n));
2160 if (it == node_to_elem.end())
2162 found_interior_parents =
false;
2166 for (
const auto & vertex_neighbor_id : it->second)
2167 if (this->
elem_ref(vertex_neighbor_id).
dim() == element->dim()+1)
2168 neighbors[n].insert(vertex_neighbor_id);
2170 if (neighbors[n].empty())
2174 found_interior_parents =
false;
2184 if (found_interior_parents)
2186 std::set<dof_id_type> & neighbors_0 = neighbors[0];
2187 for (
const auto & interior_parent_id : neighbors_0)
2189 found_interior_parents =
false;
2190 for (
auto n :
make_range(1u, element->n_vertices()))
2192 if (neighbors[n].count(interior_parent_id))
2194 found_interior_parents =
true;
2198 found_interior_parents =
false;
2203 if (found_interior_parents)
2205 element->set_interior_parent(this->
elem_ptr(interior_parent_id));
2214 if (separate_interior_mesh)
2215 libmesh_not_implemented_msg
2216 (
"interior_parent() values in multiple meshes are unsupported.");
2228 #ifdef LIBMESH_ENABLE_PERIODIC 2252 db.emplace(b1, forward.
clone());
2253 db.emplace(b2, inverse.
clone());
2280 auto it = pb_map.find(key);
2281 if (it != pb_map.end())
2283 const auto & pb = *(it->second);
2285 if ((pb.myboundary == key && pb.pairedboundary == pair) ||
2286 (pb.pairedboundary == key && pb.myboundary == pair))
2291 erase_if_match(b1, b2, pairs);
2292 erase_if_match(b2, b1, pairs);
2327 [new_size,
this](
const ElemRange & range)
2329 for (
Elem * elem : range)
2330 elem->add_extra_integers(new_size, this->_elem_integer_default_values);
2339 for (
auto node : this->node_ptr_range())
2344 std::pair<std::vector<unsigned int>, std::vector<unsigned int>>
2347 std::pair<std::vector<unsigned int>, std::vector<unsigned int>> returnval;
2379 (sf.second)->set_mesh(
this);
2385 if (other_mesh.partitioner())
2403 for (
const auto & other_node : other_mesh.node_ptr_range())
2408 if (*other_node != *node)
2411 for (
const auto & node : this->node_ptr_range())
2415 for (
const auto & other_elem : other_mesh.element_ptr_range())
2420 if (!other_elem->topologically_equal(*elem))
2423 for (
const auto & elem : this->element_ptr_range())
2433 dof_id_type n_local_rows=0, n_unpartitioned_rows=0;
2438 n_unpartitioned_rows++;
2443 this->
comm().
sum(n_local_rows);
2445 return n_unpartitioned_rows + n_local_rows;
2452 LOG_SCOPE(
"copy_constraint_rows(mesh)",
"MeshBase");
2457 for (
const auto & [other_node, other_node_constraints] : other_constraint_rows)
2459 const Node *
const our_node = this->
node_ptr(other_node->id());
2461 for (
const auto & [other_inner_key_pair, constraint_value] : other_node_constraints)
2463 const auto & [other_elem, local_node_id] = other_inner_key_pair;
2464 const Elem *
const our_elem = this->
elem_ptr(other_elem->id());
2465 our_node_constraints.emplace_back(std::make_pair(our_elem, local_node_id), constraint_value);
2472 template <
typename T>
2475 bool precondition_constraint_operator)
2477 LOG_SCOPE(
"copy_constraint_rows(mat)",
"MeshBase");
2487 libmesh_error_msg_if(this->
n_nodes() != constraint_operator.
m(),
2488 "Constraint operator matrix with " <<
2489 constraint_operator.
m() <<
2490 "rows does not match this mesh with " <<
2500 std::map<dof_id_type, dof_id_type> existing_unconstrained_columns;
2501 std::set<dof_id_type> existing_unconstrained_nodes;
2507 std::vector<std::pair<dof_id_type, Real>>>
2509 columns_type columns(constraint_operator.
n());
2517 std::unordered_map<dof_id_type, Real> column_sums;
2523 std::vector<numeric_index_type> indices;
2524 std::vector<T> values;
2526 constraint_operator.
get_row(i, indices, values);
2527 libmesh_assert_equal_to(indices.size(), values.size());
2529 if (indices.size() == 1 &&
2535 if (existing_unconstrained_columns.find(indices[0]) !=
2536 existing_unconstrained_columns.end())
2538 const auto j = indices[0];
2539 columns[j].emplace_back(i, 1);
2543 existing_unconstrained_nodes.insert(i);
2544 existing_unconstrained_columns.emplace(indices[0],i);
2550 const auto j = indices[jj];
2552 libmesh_assert_equal_to(coef, values[jj]);
2553 columns[j].emplace_back(i, coef);
2561 std::vector<columns_type> all_columns;
2566 for (
auto & [j, subcol] : all_columns[p])
2567 for (
auto [i, v] : subcol)
2568 columns[j].emplace_back(i,v);
2573 std::unordered_map<const Node *, std::pair<dof_id_type, unsigned int>> node_to_elem_ptrs;
2580 for (
const Elem * elem : this->element_ptr_range())
2585 const Node * node = elem->node_ptr(n);
2586 if (existing_unconstrained_nodes.count(node->
id()))
2587 node_to_elem_ptrs.emplace(node, std::make_pair(elem->id(), n));
2593 for (
auto j :
make_range(constraint_operator.
n()))
2596 if (existing_unconstrained_columns.count(j))
2605 Real total_scaling = 0;
2606 unsigned int total_entries = 0;
2610 std::map<processor_id_type, int> pids;
2612 auto & column = columns[j];
2613 for (
auto [i, r] : column)
2616 const Point constrained_pt = constrained_node;
2617 newpt += r*constrained_pt;
2623 if (precondition_constraint_operator)
2624 column_sums[j] = total_scaling;
2626 libmesh_error_msg_if
2628 "Empty column " << j <<
2629 " found in constraint operator matrix");
2635 newpt /= total_scaling;
2637 newpt /= total_entries;
2641 elem->set_node(0, n);
2642 elem->subdomain_id() = new_sbd_id;
2652 node_to_elem_ptrs.emplace(n, std::make_pair(added_elem->
id(), 0));
2653 existing_unconstrained_columns.emplace(j,n->
id());
2659 for (
auto [pid, count] : pids)
2660 if (count >= n_pids)
2671 std::vector<std::pair<std::pair<dof_id_type, unsigned int>,
Real>>>
2672 indexed_constraint_rows;
2677 if (existing_unconstrained_nodes.count(i))
2680 std::vector<numeric_index_type> indices;
2681 std::vector<T> values;
2683 constraint_operator.
get_row(i, indices, values);
2685 std::vector<std::pair<std::pair<dof_id_type, unsigned int>,
Real>> constraint_row;
2690 existing_unconstrained_columns[indices[jj]];
2696 auto p = node_to_elem_ptrs[&constraining_node];
2699 libmesh_assert_equal_to(coef, values[jj]);
2705 if (precondition_constraint_operator)
2706 if (
auto sum_it = column_sums.find(indices[jj]);
2707 sum_it != column_sums.end())
2709 const Real scaling = sum_it->second;
2715 constraint_row.emplace_back(std::make_pair(p, coef));
2718 indexed_constraint_rows.emplace(i, std::move(constraint_row));
2724 for (
auto & [node_id, indexed_row] : indexed_constraint_rows)
2730 for (
auto [p, coef] : indexed_row)
2733 constraint_row.emplace_back
2734 (std::make_pair(std::make_pair(elem, p.second), coef));
2738 std::move(constraint_row));
2744 bool print_nonlocal)
const 2746 parallel_object_only();
2748 std::string local_constraints =
2753 this->
comm().
send(0, local_constraints);
2757 os <<
"Processor 0:\n";
2758 os << local_constraints;
2763 os <<
"Processor " << p <<
":\n";
2764 os << local_constraints;
2773 std::ostringstream os;
2780 os <<
"Mesh Constraint Rows:" 2785 const bool local = (node->processor_id() == this->
processor_id());
2788 if (!print_nonlocal && !local)
2791 os <<
"Constraints for " << (local ?
"Local" :
"Ghost") <<
" Node " << node->id()
2794 for (
const auto & [elem_and_node, coef] : row)
2795 os <<
" ((" << elem_and_node.first->id() <<
',' << elem_and_node.second <<
"), " << coef <<
")\t";
2804 is_partitioned(false),
2805 has_synched_id_counts(false),
2806 has_neighbor_ptrs(false),
2807 has_cached_elem_data(false),
2808 has_interior_parent_ptrs(false),
2809 has_removed_remote_elements(false),
2810 has_removed_orphaned_nodes(false),
2811 has_boundary_id_sets(false),
2812 has_reinit_ghosting_functors(false)
2815 MeshBase::Preparation::operator bool()
const 2817 return is_partitioned &&
2818 has_synched_id_counts &&
2819 has_neighbor_ptrs &&
2820 has_cached_elem_data &&
2821 has_interior_parent_ptrs &&
2822 has_removed_remote_elements &&
2823 has_removed_orphaned_nodes &&
2824 has_reinit_ghosting_functors &&
2825 has_boundary_id_sets;
2831 is_partitioned = set_all;
2832 has_synched_id_counts = set_all;
2833 has_neighbor_ptrs = set_all;
2834 has_cached_elem_data = set_all;
2835 has_interior_parent_ptrs = set_all;
2836 has_removed_remote_elements = set_all;
2837 has_removed_orphaned_nodes = set_all;
2838 has_reinit_ghosting_functors = set_all;
2839 has_boundary_id_sets = set_all;
2872 return !(*
this == other);
2877 template LIBMESH_EXPORT
void 2879 bool precondition_constraint_operator);
2881 #ifdef LIBMESH_USE_COMPLEX_NUMBERS 2882 template LIBMESH_EXPORT
void 2884 bool precondition_constraint_operator);
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
GhostingFunctorIterator ghosting_functors_begin() const
Beginning of range of ghosting functors.
bool operator==(const MeshBase &other_mesh) const
This tests for exactly-equal data in all the senses that a mathematician would care about (element co...
void parallel_for(const Range &range, const Body &body, unsigned int n_threads=libMesh::n_threads())
Execute the provided function object in parallel on the specified range.
std::set< subdomain_id_type > _mesh_subdomains
We cache the subdomain ids of the elements present in the mesh.
bool has_node_integer(std::string_view name) const
virtual void update_post_partitioning()
Recalculate any cached data (or invalidate any caches that are computed on the fly) after elements an...
std::vector< unsigned int > add_elem_integers(const std::vector< std::string > &names, bool allocate_data=true, const std::vector< dof_id_type > *default_values=nullptr)
Register integer data (of type dof_id_type) to be added to each element in the mesh, one string name for each new integer.
bool closed()
Checks that the library has been closed.
ElemType
Defines an enum for geometric element types.
void allgather(const T &send_data, std::vector< T, A > &recv_data) const
std::unique_ptr< ElemRange > _element_stored_range
A cached ElemRange for threaded mutation of all semilocal elements of this mesh.
const std::set< boundary_id_type > & get_side_boundary_ids() const
virtual bool subclass_locally_equals(const MeshBase &other_mesh) const =0
Shim to allow operator == (&) to behave like a virtual function without having to be one...
bool _allow_node_and_elem_unique_id_overlap
The Exodus reader (and potentially other readers in the future?) now supports setting Node and Elem u...
bool _skip_renumber_nodes_and_elements
If this is true then renumbering will be kept to a minimum.
Order
defines an enum for polynomial orders.
static constexpr processor_id_type invalid_processor_id
An invalid processor_id to distinguish DoFs that have not been assigned to a processor.
constraint_rows_type & get_constraint_rows()
Constraint rows accessors.
bool has_removed_remote_elements
virtual dof_id_type n_active_elem() const =0
A Node is like a Point, but with more information.
This abstract base class defines the interface by which library code and user code can report associa...
const MeshBase & interior_mesh() const
Real get_point_locator_close_to_point_tol() const
dof_id_type n_elem_on_proc(const processor_id_type proc) const
dof_id_type n_unpartitioned_nodes() const
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
std::vector< std::string > _elem_integer_names
The array of names for integer data associated with each element in the mesh.
std::unique_ptr< PointLocatorBase > sub_point_locator() const
void remove_orphaned_nodes()
Removes any orphaned nodes, nodes not connected to any elements.
std::vector< dof_id_type > get_elemset_codes() const
Return a vector of all elemset codes defined on the mesh.
virtual void all_second_order_range(const SimpleRange< element_iterator > &range, const bool full_ordered=true)=0
Converts a set of this Mesh's elements defined by range from FIRST order to SECOND order...
The IntRange templated class is intended to make it easy to loop over integers which are indices of a...
void detect_interior_parents()
Search the mesh for elements that have a neighboring element of dim+1 and set that element as the int...
Preparation()
Constructor.
dof_id_type n_active_elem_on_proc(const processor_id_type proc) const
static constexpr Real TOLERANCE
MeshBase * _interior_mesh
Defaulting to this, a pointer to the mesh used to generate boundary elements on this.
std::vector< std::pair< std::pair< const Elem *, unsigned int >, Real > > constraint_rows_mapped_type
We're using a class instead of a typedef to allow forward declarations and future flexibility...
subdomain_id_type n_local_subdomains() const
void copy_cached_data(const MeshBase &other_mesh)
Helper class to copy cached data, to synchronize with a possibly unprepared other_mesh.
virtual std::unique_ptr< GhostingFunctor > clone() const =0
A clone() is needed because GhostingFunctor can not be shared between different meshes.
Dummy "splitting object" used to distinguish splitting constructors from copy constructors.
void set_spatial_dimension(unsigned char d)
Sets the "spatial dimension" of the Mesh.
std::map< dof_id_type, const MeshBase::elemset_type * > _elemset_codes
Map from "element set code" to list of set ids to which that element belongs (and vice-versa)...
bool operator==(const Preparation &other) const
Two Preparation objects are equivalent iff all the flags match, regardless of the true/false status o...
Preparation & operator=(bool set_all)
Set all flags to the "set_all" value.
virtual void find_neighbors(const bool reset_remote_elements=false, const bool reset_current_list=true, const bool assert_valid=true)=0
Locate element face (edge in 2D) neighbors.
std::vector< GhostingFunctor * > _ghosting_functors
The list of all GhostingFunctor objects to be used when distributing a DistributedMesh.
bool skip_noncritical_partitioning() const
unsigned int add_elem_integer(std::string name, bool allocate_data=true, dof_id_type default_value=DofObject::invalid_id)
Register an integer datum (of type dof_id_type) to be added to each element in the mesh...
void add_elemset_code(dof_id_type code, MeshBase::elemset_type id_set)
Tabulate a user-defined "code" for elements which belong to the element sets specified in id_set...
const std::map< boundary_id_type, std::string > & get_sideset_name_map() const
bool has_elem_integer(std::string_view name) const
bool get_count_lower_dim_elems_in_point_locator() const
Get the current value of _count_lower_dim_elems_in_point_locator.
void remove_ghosting_functor(GhostingFunctor &ghosting_functor)
Removes a functor which was previously added to the set of ghosting functors.
This is the base class from which all geometric element types are derived.
boundary_id_type pairedboundary
virtual BoundingBox loose_bounding_box() const
dof_id_type n_local_nodes() const
virtual std::unique_ptr< Partitioner > & partitioner()
A partitioner to use at each partitioning.
constraint_rows_type _constraint_rows
std::ostream & operator<<(std::ostream &os, const OrderWrapper &order)
Overload stream operators.
void copy_constraint_rows(const MeshBase &other_mesh)
Copy the constraints from the other mesh to this mesh.
const Parallel::Communicator & comm() const
std::vector< unsigned int > add_node_integers(const std::vector< std::string > &names, bool allocate_data=true, const std::vector< dof_id_type > *default_values=nullptr)
Register integer data (of type dof_id_type) to be added to each node in the mesh. ...
bool _skip_noncritical_partitioning
If this is true then no partitioning should be done with the possible exception of orphaned nodes...
unsigned char _spatial_dimension
The "spatial dimension" of the Mesh.
std::unique_ptr< BoundaryInfo > boundary_info
This class holds the boundary information.
The StoredRange class defines a contiguous, divisible set of objects.
GhostingFunctorIterator ghosting_functors_end() const
End of range of ghosting functors.
bool _allow_remote_element_removal
If this is false then even on DistributedMesh remote elements will not be deleted during mesh prepara...
The libMesh namespace provides an interface to certain functionality in the library.
std::map< MeshBase::elemset_type, dof_id_type > _elemset_codes_inverse_map
dof_id_type get_elemset_code(const MeshBase::elemset_type &id_set) const
The definition of a periodic boundary.
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
dof_id_type n_unpartitioned_elem() const
std::vector< std::string > _node_integer_names
The array of names for integer data associated with each node in the mesh.
bool in_threads
A boolean which is true iff we are in a Threads:: function It may be useful to assert(!Threadsin_thre...
bool has_cached_elem_data
Real distance(const Point &p)
void clear_stored_ranges()
Clears stored ranges, to indicate that the mesh has changed and they should be regenerated when next ...
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
Add a new Node at Point p to the end of the vertex array, with processor_id procid.
dof_id_type n_local_elem() const
MeshBase::elemset_type _all_elemset_ids
dof_id_type n_constraint_rows() const
bool nodes_and_elements_equal(const MeshBase &other_mesh) const
Tests for equality of all elements and nodes in the mesh.
uint8_t processor_id_type
This is the MeshBase class.
virtual numeric_index_type row_stop() const =0
subdomain_id_type get_id_by_name(std::string_view name) const
void get_elemsets(dof_id_type elemset_code, MeshBase::elemset_type &id_set_to_fill) const
Look up the element sets for a given elemset code and vice-versa.
void change_elemset_code(dof_id_type old_code, dof_id_type new_code)
Replace elemset code "old_code" with "new_code".
virtual void all_complete_order_range(const SimpleRange< element_iterator > &range)=0
Converts a set of elements in this (conforming, non-refined) mesh into "complete" order elements...
const std::set< boundary_id_type > & get_node_boundary_ids() const
ParallelObject & operator=(const ParallelObject &libmesh_dbg_var(other))
"Assignment" operator.
Order supported_nodal_order() const
unique_id_type _next_unique_id
The next available unique id for assigning ids to DOF objects.
unsigned int _n_parts
The number of partitions the mesh has.
unsigned int get_elem_integer_index(std::string_view name) const
processor_id_type n_processors() const
virtual bool is_serial() const
boundary_id_type myboundary
The boundary ID of this boundary and its counterpart.
void add_disjoint_neighbor_boundary_pairs(const boundary_id_type b1, const boundary_id_type b2, const RealVectorValue &translation)
Register a pair of boundaries as disjoint neighbor boundary pairs.
Status receive(const unsigned int dest_processor_id, T &buf, const MessageTag &tag=any_tag) const
const std::map< boundary_id_type, std::string > & get_nodeset_name_map() const
unsigned char _default_mapping_data
The default mapping data (unused with Lagrange, used for nodal weight lookup index with rational base...
virtual Order supported_nodal_order() const
void min(const T &r, T &o, Request &req) const
const std::map< subdomain_id_type, std::string > & get_subdomain_name_map() const
static constexpr dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
bool has_removed_orphaned_nodes
const ElemRange & element_stored_range()
dof_id_type n_sub_elem() const
virtual Elem * add_elem(Elem *e)=0
Add elem e to the end of the element array.
static std::unique_ptr< Elem > build(const ElemType type, Elem *p=nullptr)
ElemMappingType _default_mapping_type
The default mapping type (typically Lagrange) between master and physical space to assign to newly ad...
virtual void update_parallel_id_counts()=0
Updates parallel caches so that methods like n_elem() accurately reflect changes on other processors...
PeriodicBoundaries * get_disjoint_neighbor_boundary_pairs()
void print_info(std::ostream &os=libMesh::out, const unsigned int verbosity=0, const bool global=true) const
Prints relevant information about the mesh.
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
Helper function that allows us to treat a homogenous pair as a range.
virtual numeric_index_type m() const =0
std::unique_ptr< Partitioner > _partitioner
A partitioner to use at each prepare_for_use().
virtual const Node * query_node_ptr(const dof_id_type i) const =0
const std::map< boundary_id_type, std::string > & get_edgeset_name_map() const
virtual dof_id_type max_elem_id() const =0
void clear_point_locator()
Releases the current PointLocator object.
void subdomain_ids(std::set< subdomain_id_type > &ids, const bool global=true) const
Constructs a list of all subdomain identifiers in the local mesh if global == false, and in the global mesh if global == true (default).
std::set< Order > _elem_default_orders
We cache the (default) order of the geometric elements present in the mesh.
bool allow_find_neighbors() const
The BoundaryInfo class contains information relevant to boundary conditions including storing faces...
bool _skip_find_neighbors
If this is true then we will skip find_neighbors in prepare_for_use.
virtual void delete_node(Node *n)=0
Removes the Node n from the mesh.
std::pair< std::vector< unsigned int >, std::vector< unsigned int > > merge_extra_integer_names(const MeshBase &other)
Merge extra-integer arrays from an other mesh.
const ConstElemRange & active_local_element_stored_range() const
unsigned int n_elemsets() const
Returns the number of unique elemset ids which have been added via add_elemset_code(), which is the size of the _all_elemset_ids set.
Order _supported_nodal_order
We cache the maximum nodal order supported by all the mesh's elements (the minimum supported_nodal_or...
std::set< unsigned char > _elem_dims
We cache the dimension of the elements present in the mesh.
unsigned int get_node_integer_index(std::string_view name) const
std::string & subdomain_name(subdomain_id_type id)
const std::set< unsigned char > & elem_dimensions() const
Helper for building element sides that minimizes the construction of new elements.
dof_id_type n_nodes_on_proc(const processor_id_type proc) const
std::string get_local_constraints(bool print_nonlocal=false) const
Gets a string reporting all mesh constraint rows local to this processor.
void size_node_extra_integers()
Size extra-integer arrays of all nodes in the mesh.
An object whose state is distributed along a set of processors.
void regenerate_id_sets()
Clears and regenerates the cached sets of ids.
virtual void clear()
Deletes all the element and node data that is currently stored.
Flags indicating in what ways a mesh has been prepared for use.
std::unique_ptr< PeriodicBoundaries > _disjoint_neighbor_boundary_pairs
The disjoint neighbor boundary id pairs.
void parallel_reduce(const Range &range, Body &body, unsigned int n_threads=libMesh::n_threads())
Execute the provided reduction operation in parallel on the specified range.
std::string enum_to_string(const T e)
bool skip_partitioning() const
std::map< GhostingFunctor *, std::shared_ptr< GhostingFunctor > > _shared_functors
Hang on to references to any GhostingFunctor objects we were passed in shared_ptr form...
bool has_interior_parent_ptrs
SimpleRange< NodeRefIter > node_ref_range()
Returns a range with all nodes of an element, usable in range-based for loops.
void complete_preparation()
unsigned int n_partitions() const
Defines a Cartesian bounding box by the two corner extremum.
virtual const Elem * elem_ptr(const dof_id_type i) const =0
std::vector< dof_id_type > _node_integer_default_values
The array of default initialization values for integer data associated with each node in the mesh...
Preparation _preparation
Flags indicating in what ways this mesh has been prepared.
unsigned int recalculate_n_partitions()
In a few (very rare) cases, the user may have manually tagged the elements with specific processor ID...
virtual void get_row(numeric_index_type i, std::vector< numeric_index_type > &indices, std::vector< T > &values) const =0
Get a row from the matrix.
std::set< elemset_id_type > elemset_type
Typedef for the "set" container used to store elemset ids.
std::vector< dof_id_type > _elem_integer_default_values
The array of default initialization values for integer data associated with each element in the mesh...
subdomain_id_type n_subdomains() const
std::string get_info(const unsigned int verbosity=0, const bool global=true) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual const Elem * query_elem_ptr(const dof_id_type i) const =0
bool _skip_detect_interior_parents
If this is true then we will skip detect_interior_parents in prepare_for_use.
void max(const T &r, T &o, Request &req) const
virtual unsigned short dim() const =0
void post_dofobject_moves(MeshBase &&other_mesh)
Moves any superclass data (e.g.
Temporarily serialize a DistributedMesh for non-distributed-mesh capable code paths.
virtual void all_complete_order()
Calls the range-based version of this function with a range consisting of all elements in the mesh...
virtual numeric_index_type row_start() const =0
unsigned int spatial_dimension() const
virtual std::unique_ptr< PeriodicBoundaryBase > clone(TransformationType t=FORWARD) const override
If we want the DofMap to be able to make copies of references and store them in the underlying map...
void send(const unsigned int dest_processor_id, const T &buf, const MessageTag &tag=no_tag) const
std::map< const Node *, constraint_rows_mapped_type > constraint_rows_type
void print_constraint_rows(std::ostream &os=libMesh::out, bool print_nonlocal=false) const
Prints (from processor 0) all mesh constraint rows.
const std::set< boundary_id_type > & get_edge_boundary_ids() const
virtual bool is_replicated() const
virtual const Elem & elem_ref(const dof_id_type i) const
void set_count_lower_dim_elems_in_point_locator(bool count_lower_dim_elems)
In the point locator, do we count lower dimensional elements when we refine point locator regions...
virtual Real volume() const
MeshBase(const Parallel::Communicator &comm_in, unsigned char dim=1)
Constructor.
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
void all_second_order(const bool full_ordered=true)
Calls the range-based version of this function with a range consisting of all elements in the mesh...
dof_id_type n_active_sub_elem() const
Same as n_sub_elem(), but only counts active elements.
The DofObject defines an abstract base class for objects that have degrees of freedom associated with...
virtual ~MeshBase()
Destructor.
void set_elem_dimensions(std::set< unsigned char > elem_dims)
Most of the time you should not need to call this, as the element dimensions will be set automaticall...
unsigned int mesh_dimension() const
std::unique_ptr< GhostingFunctor > _default_ghosting
The default geometric GhostingFunctor, used to implement standard libMesh element ghosting behavior...
void change_elemset_id(elemset_id_type old_id, elemset_id_type new_id)
Replace elemset id "old_id" with "new_id".
bool initialized()
Checks that library initialization has been done.
unsigned int add_node_integer(std::string name, bool allocate_data=true, dof_id_type default_value=DofObject::invalid_id)
Register an integer datum (of type dof_id_type) to be added to each node in the mesh.
bool has_boundary_id_sets
void sync_subdomain_name_map()
libMesh often expects all processors to know about names of all subdomain ids, but distributed mesh g...
std::unique_ptr< ConstElemRange > _const_active_local_element_stored_range
A cached ConstElemRange for threaded calculation on all local elements of this mesh.
virtual const Node & node_ref(const dof_id_type i) const
bool has_synched_id_counts
bool _skip_all_partitioning
If this is true then no partitioning should be done.
bool on_command_line(std::string arg)
bool allow_renumbering() const
virtual void delete_remote_elements()
When supported, deletes all nonlocal elements of the mesh except for "ghosts" which touch a local ele...
void union_with(const Point &p)
Enlarges this bounding box to include the given point.
void remove_disjoint_boundary_pair(const boundary_id_type b1, const boundary_id_type b2)
void reinit_ghosting_functors()
Loops over ghosting functors and calls mesh_reinit()
virtual dof_id_type n_elem() const =0
virtual std::unique_ptr< Elem > build_edge_ptr(const unsigned int i)=0
virtual const Node * node_ptr(const dof_id_type i) const =0
processor_id_type processor_id() const
static constexpr subdomain_id_type invalid_subdomain_id
A static integral constant representing an invalid subdomain id.
virtual Order default_order() const =0
std::unique_ptr< PointLocatorBase > _point_locator
A PointLocator class for this mesh.
bool operator!=(const Preparation &other) const
virtual void redistribute()
Redistribute elements between processors.
processor_id_type processor_id() const
Real _point_locator_close_to_point_tol
If nonzero, we will call PointLocatorBase::set_close_to_point_tol() on any PointLocators that we crea...
virtual ElemType type() const =0
static std::unique_ptr< PointLocatorBase > build(PointLocatorType t, const MeshBase &mesh, const PointLocatorBase *master=nullptr)
Builds an PointLocator for the mesh mesh.
bool _count_lower_dim_elems_in_point_locator
Do we count lower dimensional elements in point locator refinement? This is relevant in tree-based po...
A Point defines a location in LIBMESH_DIM dimensional Real space.
bool has_reinit_ghosting_functors
bool locally_equals(const MeshBase &other_mesh) const
This behaves the same as operator==, but only for the local and ghosted aspects of the mesh; i...
std::map< subdomain_id_type, std::string > _block_id_to_name
This structure maintains the mapping of named blocks for file formats that support named blocks...
void unset_is_prepared()
Tells this we have done some operation where we should no longer consider ourself prepared...
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
virtual dof_id_type n_nodes() const =0
virtual void renumber_nodes_and_elements()=0
After partitioning a mesh it is useful to renumber the nodes and elements so that they lie in contigu...
This class implements the original default geometry ghosting requirements in libMesh: point neighbors...
void size_elem_extra_integers()
Size extra-integer arrays of all elements in the mesh.
virtual numeric_index_type n() const =0
void add_ghosting_functor(GhostingFunctor &ghosting_functor)
Adds a functor which can specify ghosting requirements for use on distributed meshes.
MeshBase & operator=(const MeshBase &)=delete
Copy and move assignment are not allowed because MeshBase subclasses manually manage memory (Elems an...
void set_point_locator_close_to_point_tol(Real val)
Set value used by PointLocatorBase::close_to_point_tol().
void set_union(T &data, const unsigned int root_id) const