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 _n_constraint_rows(0),
91 _point_locator_close_to_point_tol(0.)
95 libmesh_assert_less_equal (LIBMESH_DIM, 3);
96 libmesh_assert_greater_equal (LIBMESH_DIM, d);
105 _n_parts (other_mesh._n_parts),
106 _default_mapping_type(other_mesh._default_mapping_type),
107 _default_mapping_data(other_mesh._default_mapping_data),
108 _preparation (other_mesh._preparation),
109 _element_stored_range (),
110 _const_active_local_element_stored_range (),
112 _count_lower_dim_elems_in_point_locator(other_mesh._count_lower_dim_elems_in_point_locator),
114#ifdef LIBMESH_ENABLE_UNIQUE_ID
115 _next_unique_id(other_mesh._next_unique_id),
119 _interior_mesh((other_mesh._interior_mesh == &other_mesh) ?
120 this : other_mesh._interior_mesh),
121 _skip_noncritical_partitioning(other_mesh._skip_noncritical_partitioning),
122 _skip_all_partitioning(other_mesh._skip_all_partitioning),
123 _skip_renumber_nodes_and_elements(other_mesh._skip_renumber_nodes_and_elements),
124 _skip_find_neighbors(other_mesh._skip_find_neighbors),
125 _skip_detect_interior_parents(other_mesh._skip_detect_interior_parents),
126 _allow_remote_element_removal(other_mesh._allow_remote_element_removal),
127 _allow_node_and_elem_unique_id_overlap(other_mesh._allow_node_and_elem_unique_id_overlap),
128 _elem_dims(other_mesh._elem_dims),
129 _elem_default_orders(other_mesh._elem_default_orders),
130 _supported_nodal_order(other_mesh._supported_nodal_order),
131 _mesh_subdomains(other_mesh._mesh_subdomains),
132 _elemset_codes_inverse_map(other_mesh._elemset_codes_inverse_map),
133 _all_elemset_ids(other_mesh._all_elemset_ids),
134 _spatial_dimension(other_mesh._spatial_dimension),
136 _n_constraint_rows(0),
137 _point_locator_close_to_point_tol(other_mesh._point_locator_close_to_point_tol)
145 if (gf == other_default_ghosting)
151 std::shared_ptr<GhostingFunctor> clone_gf = gf->clone();
160 clone_gf->set_mesh(
this);
165 libmesh_deprecated();
173#ifdef LIBMESH_ENABLE_PERIODIC
181 (*_disjoint_neighbor_boundary_pairs)[id] = pb->clone();
193 LOG_SCOPE(
"operator=(&&)",
"MeshBase");
198 _n_parts = other_mesh.n_partitions();
206#ifdef LIBMESH_ENABLE_UNIQUE_ID
212 this : other_mesh._interior_mesh;
221 _elem_dims = std::move(other_mesh.elem_dimensions());
236#ifdef LIBMESH_ENABLE_PERIODIC
240 if (other_mesh._disjoint_neighbor_boundary_pairs)
244 for (
const auto & [
id, pb] : *other_mesh._disjoint_neighbor_boundary_pairs)
246 (*_disjoint_neighbor_boundary_pairs)[id] = pb->clone();
261 "Elemset code " << code <<
" not found in _elmset_codes container.");
262 libmesh_assert_equal_to(it->second, &set);
276 LOG_SCOPE(
"operator==()",
"MeshBase");
381 auto it = other_rows.find(other_node);
382 if (it == other_rows.end())
385 const auto & other_row = it->second;
386 if (row.size() != other_row.size())
391 const auto & [elem_pair, coef] = row[i];
392 const auto & [other_elem_pair, other_coef] = other_row[i];
395 if (elem_pair.first->id() !=
396 other_elem_pair.first->id() ||
398 other_elem_pair.second ||
404 for (
const auto & [elemset_code, elemset_ptr] : this->
_elemset_codes)
406 it == other_mesh.
_elemset_codes.end() || *elemset_ptr != *it->second)
438 return cast_int<unsigned int>(*
_elem_dims.rbegin());
449 parallel_object_only();
453 "Specified element dimensions does not match true element dimensions!");
467 const auto & inserted_id_set = it1->first;
477 auto [it2, inserted2] =
_elemset_codes.emplace(code, &inserted_id_set);
481 libmesh_error_msg_if(!inserted2 && it2->second != &inserted_id_set,
482 "The elemset code " << code <<
" already exists with a different id_set.");
495 id_set_to_fill.clear();
499 id_set_to_fill.insert(it->second->begin(), it->second->end());
510 std::vector<dof_id_type> ret;
513 ret.push_back(pr.first);
536 "Expected _elemset_codes_inverse_map entry for elemset code " << old_code);
557 [elemset_index, old_code, new_code](
const ElemRange & range)
559 for (
Elem * elem : range)
562 elem->get_extra_integer(elemset_index);
564 if (elemset_code == old_code)
565 elem->set_extra_integer(elemset_index, new_code);
578 "Cannot change elemset id " << old_id <<
579 " to " << new_id <<
", " << new_id <<
" already exists.");
583 std::map<MeshBase::elemset_type, dof_id_type> new_elemset_codes_inverse_map;
586 auto id_set_copy = id_set;
587 if (id_set_copy.count(old_id))
590 id_set_copy.erase(old_id);
591 id_set_copy.insert(new_id);
595 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)
876 LOG_SCOPE(
"complete_preparation()",
"MeshBase");
878 parallel_object_only();
968#if defined(DEBUG) && defined(LIBMESH_ENABLE_UNIQUE_ID)
1018#ifdef LIBMESH_ENABLE_UNIQUE_ID
1082#ifdef LIBMESH_ENABLE_DEPRECATED
1093 &ghosting_functor) ==
1117 &ghosting_functor) ==
1131 parallel_object_only();
1133 struct SBDInserter {
1134 std::set<subdomain_id_type> my_ids;
1140 for (
const Elem * elem : range)
1141 my_ids.insert(elem->subdomain_id());
1144 void join(SBDInserter & other) {
1145 my_ids.merge(other.my_ids);
1149 SBDInserter inserter;
1152 ids.swap(inserter.my_ids);
1159 for (
const auto & elem : this->active_unpartitioned_element_ptr_range())
1160 ids.insert(elem->subdomain_id());
1194 parallel_object_only();
1196 std::set<subdomain_id_type> ids;
1200 return cast_int<subdomain_id_type>(ids.size());
1207 std::set<subdomain_id_type> ids;
1211 return cast_int<subdomain_id_type>(ids.size());
1224 return static_cast<dof_id_type>(std::distance (this->pid_nodes_begin(proc_id),
1225 this->pid_nodes_end (proc_id)));
1237 return static_cast<dof_id_type>(std::distance (this->pid_elements_begin(proc_id),
1238 this->pid_elements_end (proc_id)));
1246 return static_cast<dof_id_type>(std::distance (this->active_pid_elements_begin(proc_id),
1247 this->active_pid_elements_end (proc_id)));
1256 for (
const auto & elem : this->element_ptr_range())
1257 ne += elem->n_sub_elem();
1268 for (
const auto & elem : this->active_element_ptr_range())
1269 ne += elem->n_sub_elem();
1278 std::ostringstream oss;
1280 oss <<
" Mesh Information:" <<
'\n';
1284 oss <<
" elem_dimensions()={";
1287 std::ostream_iterator<unsigned int>(oss,
", "));
1288 oss << cast_int<unsigned int>(*
_elem_dims.rbegin());
1291 oss <<
" (may be out of date)";
1297 oss <<
" elem_default_orders()={";
1300 std::ostream_iterator<std::string>(oss,
", "),
1302 { return Utility::enum_to_string<Order>(o); });
1306 oss <<
" (may be out of date)";
1312 oss <<
" (may be out of date)";
1317 oss <<
" (may be out of date)";
1320 oss <<
" n_nodes()=" << this->
n_nodes() <<
'\n'
1322 <<
" n_elem()=" << this->
n_elem() <<
'\n'
1324#ifdef LIBMESH_ENABLE_AMR
1325 oss <<
" n_active_elem()=" << this->
n_active_elem() <<
'\n';
1328 oss <<
" n_subdomains()=" <<
static_cast<std::size_t
>(this->
n_subdomains()) <<
'\n';
1330 oss <<
" n_local_subdomains()= " <<
static_cast<std::size_t
>(this->
n_local_subdomains()) <<
'\n';
1331 oss <<
" n_elemsets()=" <<
static_cast<std::size_t
>(this->
n_elemsets()) <<
'\n';
1334 oss <<
" n_partitions()=" <<
static_cast<std::size_t
>(this->
n_partitions()) <<
'\n'
1335 <<
" n_processors()=" <<
static_cast<std::size_t
>(this->
n_processors()) <<
'\n'
1337 <<
" processor_id()=" <<
static_cast<std::size_t
>(this->
processor_id()) <<
'\n'
1338 <<
" is_prepared()=" << (this->
is_prepared() ?
"true" :
"false") <<
'\n'
1339 <<
" is_replicated()=" << (this->
is_replicated() ?
"true" :
"false") <<
'\n';
1345 libmesh_parallel_only(this->
comm());
1347 oss <<
"\n Detailed global get_info() (verbosity > 0) is reduced and output to only rank 0.";
1351 const auto elem_type_helper = [](
const std::set<int> & elem_types) {
1352 std::stringstream ss;
1353 for (
auto it = elem_types.begin(); it != elem_types.end();)
1356 if (++it != elem_types.end())
1364 const auto include_object = [
this, &global](
const DofObject & dof_object) {
1365 return this->
processor_id() == dof_object.processor_id() ||
1376 oss <<
"\n " << (global ?
"" :
"Local ") <<
"Mesh Bounding Box:\n"
1377 <<
" Minimum: " << bbox.min() <<
"\n"
1378 <<
" Maximum: " << bbox.max() <<
"\n"
1379 <<
" Delta: " << (bbox.max() - bbox.min()) <<
"\n";
1382 std::set<int> elem_types;
1383 for (
const Elem * elem : this->active_local_element_ptr_range())
1384 elem_types.insert(elem->type());
1389 for (
const Elem * elem : this->active_unpartitioned_element_ptr_range())
1390 elem_types.insert(elem->type());
1397 oss <<
"\n " << (global ?
"" :
"Local ") <<
"Mesh Element Type(s):\n "
1398 << elem_type_helper(elem_types) <<
"\n";
1408 std::size_t num_nodes = 0;
1411 std::map<boundary_id_type, NodesetInfo> nodeset_info_map;
1414 if (!include_object(*node))
1417 NodesetInfo & info = nodeset_info_map[id];
1422 info.bbox.union_with(*node);
1428 oss <<
"\n " << (global ?
"" :
"Local ") <<
"Mesh Nodesets:\n";
1429 if (nodeset_ids.empty())
1434 for (
const auto id : nodeset_ids)
1436 NodesetInfo & info = nodeset_info_map[id];
1441 this->
comm().
sum(info.num_nodes);
1444 this->
comm().
min(info.bbox.min());
1445 this->
comm().
max(info.bbox.max());
1449 const bool has_name = nodeset_name_map.count(
id) && nodeset_name_map.at(
id).size();
1450 const std::string name = has_name ? nodeset_name_map.at(
id) :
"";
1454 if (global ? this->
processor_id() == 0 : info.num_nodes > 0)
1456 oss <<
" Nodeset " << id;
1458 oss <<
" (" << name <<
")";
1459 oss <<
", " << info.num_nodes <<
" " << (global ?
"" :
"local ") <<
"nodes\n";
1463 oss <<
" " << (global ?
"Bounding" :
"Local bounding") <<
" box minimum: "
1464 << info.bbox.min() <<
"\n"
1465 <<
" " << (global ?
"Bounding" :
"Local bounding") <<
" box maximum: "
1466 << info.bbox.max() <<
"\n"
1467 <<
" " << (global ?
"Bounding" :
"Local bounding") <<
" box delta: "
1468 << (info.bbox.max() - info.bbox.min()) <<
"\n";
1481 std::size_t num_sides = 0;
1483 std::set<int> side_elem_types;
1484 std::set<int> elem_types;
1485 std::set<dof_id_type> elem_ids;
1486 std::set<dof_id_type> node_ids;
1490 std::map<boundary_id_type, SidesetInfo> sideset_info_map;
1493 const Elem * elem = pair.first;
1494 if (!include_object(*elem))
1497 const auto id = pair.second.second;
1498 SidesetInfo & info = sideset_info_map[id];
1500 const auto s = pair.second.first;
1501 const Elem & side = side_builder(*elem, s);
1504 info.side_elem_types.insert(side.
type());
1505 info.elem_types.insert(elem->
type());
1506 info.elem_ids.insert(elem->
id());
1509 if (include_object(node))
1510 info.node_ids.insert(node.id());
1514 info.volume += side.
volume();
1522 oss <<
"\n " << (global ?
"" :
"Local ") <<
"Mesh Sidesets:\n";
1523 if (sideset_ids.empty())
1527 for (
const auto id : sideset_ids)
1529 SidesetInfo & info = sideset_info_map[id];
1531 auto num_elems = info.elem_ids.size();
1532 auto num_nodes = info.node_ids.size();
1537 this->
comm().
sum(info.num_sides);
1544 this->
comm().
sum(info.volume);
1545 this->
comm().
min(info.bbox.min());
1546 this->
comm().
max(info.bbox.max());
1550 const bool has_name = sideset_name_map.count(
id) && sideset_name_map.at(
id).size();
1551 const std::string name = has_name ? sideset_name_map.at(
id) :
"";
1555 if (global ? this->
processor_id() == 0 : info.num_sides > 0)
1557 oss <<
" Sideset " << id;
1559 oss <<
" (" << name <<
")";
1560 oss <<
", " << info.num_sides <<
" sides (" << elem_type_helper(info.side_elem_types) <<
")"
1561 <<
", " << num_elems <<
" " << (global ?
"" :
"local ") <<
"elems (" << elem_type_helper(info.elem_types) <<
")"
1562 <<
", " << num_nodes <<
" " << (global ?
"" :
"local ") <<
"nodes\n";
1566 oss <<
" " << (global ?
"Side" :
"Local side") <<
" volume: " << info.volume <<
"\n"
1567 <<
" " << (global ?
"Bounding" :
"Local bounding") <<
" box minimum: "
1568 << info.bbox.min() <<
"\n"
1569 <<
" " << (global ?
"Bounding" :
"Local bounding") <<
" box maximum: "
1570 << info.bbox.max() <<
"\n"
1571 <<
" " << (global ?
"Bounding" :
"Local bounding") <<
" box delta: "
1572 << (info.bbox.max() - info.bbox.min()) <<
"\n";
1585 std::size_t num_edges = 0;
1586 std::set<int> edge_elem_types;
1589 std::map<boundary_id_type, EdgesetInfo> edgeset_info_map;
1590 std::unique_ptr<const Elem> edge;
1594 const Elem * elem = pair.first;
1595 if (!include_object(*elem))
1598 const auto id = pair.second.second;
1599 EdgesetInfo & info = edgeset_info_map[id];
1604 info.edge_elem_types.insert(edge->type());
1607 info.bbox.union_with(edge->loose_bounding_box());
1613 oss <<
"\n " << (global ?
"" :
"Local ") <<
"Mesh Edgesets:\n";
1614 if (edgeset_ids.empty())
1619 for (
const auto id : edgeset_ids)
1621 EdgesetInfo & info = edgeset_info_map[id];
1626 this->
comm().
sum(info.num_edges);
1630 this->
comm().
min(info.bbox.min());
1631 this->
comm().
min(info.bbox.max());
1635 const bool has_name = edgeset_name_map.count(
id) && edgeset_name_map.at(
id).size();
1636 const std::string name = has_name ? edgeset_name_map.at(
id) :
"";
1640 if (global ? this->
processor_id() == 0 : info.num_edges > 0)
1642 oss <<
" Edgeset " << id;
1644 oss <<
" (" << name <<
")";
1645 oss <<
", " << info.num_edges <<
" " << (global ?
"" :
"local ") <<
"edges ("
1646 << elem_type_helper(info.edge_elem_types) <<
")\n";
1650 oss <<
" " << (global ?
"Bounding" :
"Local bounding") <<
" box minimum: "
1651 << info.bbox.min() <<
"\n"
1652 <<
" " << (global ?
"Bounding" :
"Local bounding") <<
" box maximum: "
1653 << info.bbox.max() <<
"\n"
1654 <<
" " << (global ?
"Bounding" :
"Local bounding") <<
" box delta: "
1655 << (info.bbox.max() - info.bbox.min()) <<
"\n";
1661 std::set<subdomain_id_type> subdomains;
1662 for (
const Elem * elem : this->active_element_ptr_range())
1663 if (include_object(*elem))
1664 subdomains.insert(elem->subdomain_id());
1669 struct SubdomainInfo
1671 std::size_t num_elems = 0;
1673 std::set<int> elem_types;
1674 std::set<dof_id_type> active_node_ids;
1675#ifdef LIBMESH_ENABLE_AMR
1676 std::size_t num_active_elems = 0;
1680 std::map<subdomain_id_type, SubdomainInfo> subdomain_info_map;
1681 for (
const Elem * elem : this->element_ptr_range())
1682 if (include_object(*elem))
1684 SubdomainInfo & info = subdomain_info_map[elem->subdomain_id()];
1687 info.elem_types.insert(elem->type());
1689#ifdef LIBMESH_ENABLE_AMR
1691 ++info.num_active_elems;
1694 for (
const Node & node : elem->node_ref_range())
1695 if (include_object(node) && node.active())
1696 info.active_node_ids.insert(node.id());
1698 if (verbosity > 1 && elem->active())
1700 info.volume += elem->volume();
1701 info.bbox.union_with(elem->loose_bounding_box());
1706 oss <<
"\n " << (global ?
"" :
"Local ") <<
"Mesh Subdomains:\n";
1708 for (
const auto id : subdomains)
1710 SubdomainInfo & info = subdomain_info_map[id];
1712 auto num_active_nodes = info.active_node_ids.size();
1717 this->
comm().
sum(info.num_elems);
1718#ifdef LIBMESH_ENABLE_AMR
1719 this->
comm().
sum(info.num_active_elems);
1721 this->
comm().
sum(num_active_nodes);
1725 this->
comm().
min(info.bbox.min());
1726 this->
comm().
max(info.bbox.max());
1727 this->
comm().
sum(info.volume);
1731 volume += info.volume;
1733 const bool has_name = subdomain_name_map.count(
id);
1734 const std::string name = has_name ? subdomain_name_map.at(
id) :
"";
1740 oss <<
" Subdomain " << id;
1742 oss <<
" (" << name <<
")";
1743 oss <<
": " << info.num_elems <<
" " << (global ?
"" :
"local ") <<
"elems "
1744 <<
"(" << elem_type_helper(info.elem_types);
1745#ifdef LIBMESH_ENABLE_AMR
1746 oss <<
", " << info.num_active_elems <<
" active";
1748 oss <<
"), " << num_active_nodes <<
" " << (global ?
"" :
"local ") <<
"active nodes\n";
1751 oss <<
" " << (global ?
"Volume" :
"Local volume") <<
": " << info.volume <<
"\n";
1752 oss <<
" " << (global ?
"Bounding" :
"Local bounding") <<
" box minimum: "
1753 << info.bbox.min() <<
"\n"
1754 <<
" " << (global ?
"Bounding" :
"Local bounding") <<
" box maximum: "
1755 << info.bbox.max() <<
"\n"
1756 <<
" " << (global ?
"Bounding" :
"Local bounding") <<
" box delta: "
1757 << (info.bbox.max() - info.bbox.min()) <<
"\n";
1762 oss <<
" " << (global ?
"Global" :
"Local") <<
" mesh volume = " << volume <<
"\n";
1772 os << this->
get_info(verbosity, global)
1831 parallel_object_only();
1833 unsigned int max_proc_id=0;
1835 for (
const auto & elem : this->active_local_element_ptr_range())
1836 max_proc_id = std::max(max_proc_id,
static_cast<unsigned int>(elem->processor_id()));
1857 parallel_object_only();
1859#ifdef LIBMESH_ENABLE_NANOFLANN_POINTLOCATOR
1872#ifdef LIBMESH_ENABLE_NANOFLANN_POINTLOCATOR
1901#ifdef LIBMESH_ENABLE_DEPRECATED
1905 libmesh_deprecated();
1920 static const std::string empty;
1926 return iter->second;
1930 const std::string & name,
1931 const bool synchronous)
1934 parallel_object_only();
1945 if (sbd_name == name)
1962 std::make_unique<ElemRange>(this->elements_begin(),
1963 this->elements_end());
1977 std::make_unique<ConstElemRange>(this->active_local_elements_begin(),
1978 this->active_local_elements_end());
1991#ifdef LIBMESH_ENABLE_DEPRECATED
1994 libmesh_deprecated();
2003 parallel_object_only();
2012 for (
const auto & elem : this->active_element_ptr_range())
2014 _elem_dims.insert(cast_int<unsigned char>(elem->dim()));
2020 static_cast<int>(elem->supported_nodal_order())));
2047 for (
const auto & node : this->node_ptr_range())
2066 if ((*node)(2) != 0.)
2084 parallel_object_only();
2094 LOG_SCOPE(
"detect_interior_parents()",
"MeshBase");
2097 parallel_object_only();
2103 std::set<unsigned char> elem_dims_copy;
2108 for (
const auto & elem : this->active_element_ptr_range())
2109 elem_dims_copy.insert(cast_int<unsigned char>(elem->dim()));
2115 if (elem_dims_copy.size() <= 1)
2122 const auto dim_start = elem_dims_copy.begin();
2123 const auto dim_end = elem_dims_copy.end();
2131 std::vector<bool> skip_dimension_for_interior_parents(LIBMESH_DIM+1,
false);
2132 skip_dimension_for_interior_parents.back() =
true;
2139 std::vector<bool> skip_dimensions_for_node_to_el_map(LIBMESH_DIM+1,
false);
2140 skip_dimensions_for_node_to_el_map[*dim_start] =
true;
2144 bool skip_all_dimensions =
true;
2147 for (
auto [it, next] = std::make_tuple(dim_start, std::next(dim_start));
2148 next != dim_end; ++it, ++next)
2150 if (*it + 1 != *next)
2152 skip_dimension_for_interior_parents[*it] =
true;
2153 skip_dimensions_for_node_to_el_map[*next] =
true;
2155 else if (!skip_dimension_for_interior_parents[*it])
2156 skip_all_dimensions =
false;
2163 if (skip_all_dimensions)
2172 const bool separate_interior_mesh = (&(this->
interior_mesh()) !=
this);
2175 std::unordered_map<dof_id_type, std::vector<dof_id_type>> node_to_elem;
2177 for (
const auto & elem : this->element_ptr_range())
2180 if (skip_dimensions_for_node_to_el_map[elem->dim()])
2184 for (
auto n :
make_range(elem->n_vertices()))
2186 libmesh_assert_less (elem->id(), this->max_elem_id());
2188 node_to_elem[elem->node_id(n)].push_back(elem->id());
2193 for (
const auto & element : this->element_ptr_range())
2197 if (skip_dimension_for_interior_parents[element->dim()] || element->interior_parent())
2206 std::vector<std::set<dof_id_type>> neighbors( element->n_vertices() );
2208 bool found_interior_parents =
true;
2210 for (
auto n :
make_range(element->n_vertices()))
2212 auto it = node_to_elem.find(element->node_id(n));
2215 if (it == node_to_elem.end())
2217 found_interior_parents =
false;
2221 for (
const auto & vertex_neighbor_id : it->second)
2222 if (this->
elem_ref(vertex_neighbor_id).
dim() == element->dim()+1)
2223 neighbors[n].insert(vertex_neighbor_id);
2225 if (neighbors[n].empty())
2229 found_interior_parents =
false;
2239 if (found_interior_parents)
2241 std::set<dof_id_type> & neighbors_0 = neighbors[0];
2242 for (
const auto & interior_parent_id : neighbors_0)
2244 found_interior_parents =
false;
2245 for (
auto n :
make_range(1u, element->n_vertices()))
2247 if (neighbors[n].count(interior_parent_id))
2249 found_interior_parents =
true;
2253 found_interior_parents =
false;
2258 if (found_interior_parents)
2260 element->set_interior_parent(this->
elem_ptr(interior_parent_id));
2269 if (separate_interior_mesh)
2270 libmesh_not_implemented_msg
2271 (
"interior_parent() values in multiple meshes are unsupported.");
2283#ifdef LIBMESH_ENABLE_PERIODIC
2303 inverse.myboundary = b2;
2304 inverse.pairedboundary = b1;
2307 db.emplace(b1, forward.
clone());
2308 db.emplace(b2, inverse.clone());
2335 auto it = pb_map.find(key);
2336 if (it != pb_map.end())
2338 const auto & pb = *(it->second);
2340 if ((pb.myboundary == key && pb.pairedboundary == pair) ||
2341 (pb.pairedboundary == key && pb.myboundary == pair))
2346 erase_if_match(b1, b2, pairs);
2347 erase_if_match(b2, b1, pairs);
2382 [new_size,
this](
const ElemRange & range)
2384 for (
Elem * elem : range)
2385 elem->add_extra_integers(new_size, this->_elem_integer_default_values);
2394 for (
auto node : this->node_ptr_range())
2399std::pair<std::vector<unsigned int>, std::vector<unsigned int>>
2402 std::pair<std::vector<unsigned int>, std::vector<unsigned int>> returnval;
2434 (sf.second)->set_mesh(
this);
2441 if (other_mesh.partitioner())
2459 for (
const auto & other_node : other_mesh.node_ptr_range())
2464 if (*other_node != *node)
2467 for (
const auto & node : this->node_ptr_range())
2471 for (
const auto & other_elem : other_mesh.element_ptr_range())
2476 if (!other_elem->topologically_equal(*elem))
2479 for (
const auto & elem : this->element_ptr_range())
2489 dof_id_type n_local_rows=0, n_unpartitioned_rows=0;
2494 n_unpartitioned_rows++;
2499 this->
comm().
sum(n_local_rows);
2501 return n_unpartitioned_rows + n_local_rows;
2508 LOG_SCOPE(
"copy_constraint_rows(mesh)",
"MeshBase");
2515 for (
const auto & [other_node, other_node_constraints] : other_constraint_rows)
2517 const Node *
const our_node = this->
node_ptr(other_node->id());
2519 for (
const auto & [other_inner_key_pair, constraint_value] : other_node_constraints)
2521 const auto & [other_elem, local_node_id] = other_inner_key_pair;
2522 const Elem *
const our_elem = this->
elem_ptr(other_elem->id());
2523 our_node_constraints.emplace_back(std::make_pair(our_elem, local_node_id), constraint_value);
2530template <
typename T>
2533 bool precondition_constraint_operator)
2535 LOG_SCOPE(
"copy_constraint_rows(mat)",
"MeshBase");
2545 libmesh_error_msg_if(this->
n_nodes() != constraint_operator.
m(),
2546 "Constraint operator matrix with " <<
2547 constraint_operator.
m() <<
2548 "rows does not match this mesh with " <<
2549 this->n_nodes() <<
" nodes");
2558 std::map<dof_id_type, dof_id_type> existing_unconstrained_columns;
2559 std::set<dof_id_type> existing_unconstrained_nodes;
2565 std::vector<std::pair<dof_id_type, Real>>>
2567 columns_type columns(constraint_operator.
n());
2575 std::unordered_map<dof_id_type, Real> column_sums;
2581 std::vector<numeric_index_type> indices;
2582 std::vector<T> values;
2584 constraint_operator.
get_row(i, indices, values);
2585 libmesh_assert_equal_to(indices.size(), values.size());
2587 if (indices.size() == 1 &&
2593 if (existing_unconstrained_columns.find(indices[0]) !=
2594 existing_unconstrained_columns.end())
2596 const auto j = indices[0];
2597 columns[j].emplace_back(i, 1);
2601 existing_unconstrained_nodes.insert(i);
2602 existing_unconstrained_columns.emplace(indices[0],i);
2608 const auto j = indices[jj];
2610 libmesh_assert_equal_to(coef, values[jj]);
2611 columns[j].emplace_back(i, coef);
2619 std::vector<columns_type> all_columns;
2624 for (
auto & [j, subcol] : all_columns[p])
2625 for (
auto [i, v] : subcol)
2626 columns[j].emplace_back(i,v);
2631 std::unordered_map<const Node *, std::pair<dof_id_type, unsigned int>> node_to_elem_ptrs;
2638 for (
const Elem * elem : this->element_ptr_range())
2643 const Node * node = elem->node_ptr(n);
2644 if (existing_unconstrained_nodes.count(node->
id()))
2645 node_to_elem_ptrs.emplace(node, std::make_pair(elem->id(), n));
2651 for (
auto j :
make_range(constraint_operator.
n()))
2654 if (existing_unconstrained_columns.count(j))
2663 Real total_scaling = 0;
2664 unsigned int total_entries = 0;
2668 std::map<processor_id_type, int> pids;
2670 auto & column = columns[j];
2671 for (
auto [i, r] : column)
2674 const Point constrained_pt = constrained_node;
2675 newpt += r*constrained_pt;
2681 if (precondition_constraint_operator)
2682 column_sums[j] = total_scaling;
2684 libmesh_error_msg_if
2686 "Empty column " << j <<
2687 " found in constraint operator matrix");
2693 newpt /= total_scaling;
2695 newpt /= total_entries;
2699 elem->set_node(0, n);
2700 elem->subdomain_id() = new_sbd_id;
2710 node_to_elem_ptrs.emplace(n, std::make_pair(added_elem->
id(), 0));
2711 existing_unconstrained_columns.emplace(j,n->
id());
2717 for (
auto [pid, count] : pids)
2718 if (count >= n_pids)
2729 std::vector<std::pair<std::pair<dof_id_type, unsigned int>,
Real>>>
2730 indexed_constraint_rows;
2735 if (existing_unconstrained_nodes.count(i))
2738 std::vector<numeric_index_type> indices;
2739 std::vector<T> values;
2741 constraint_operator.
get_row(i, indices, values);
2743 std::vector<std::pair<std::pair<dof_id_type, unsigned int>,
Real>> constraint_row;
2748 existing_unconstrained_columns[indices[jj]];
2754 auto p = node_to_elem_ptrs[&constraining_node];
2757 libmesh_assert_equal_to(coef, values[jj]);
2763 if (precondition_constraint_operator)
2764 if (
auto sum_it = column_sums.find(indices[jj]);
2765 sum_it != column_sums.end())
2767 const Real scaling = sum_it->second;
2773 constraint_row.emplace_back(std::make_pair(p, coef));
2776 indexed_constraint_rows.emplace(i, std::move(constraint_row));
2782 for (
auto & [node_id, indexed_row] : indexed_constraint_rows)
2788 for (
auto [p, coef] : indexed_row)
2791 constraint_row.emplace_back
2792 (std::make_pair(std::make_pair(elem, p.second), coef));
2796 std::move(constraint_row));
2804 bool print_nonlocal)
const
2806 parallel_object_only();
2808 std::string local_constraints =
2813 this->
comm().
send(0, local_constraints);
2817 os <<
"Processor 0:\n";
2818 os << local_constraints;
2823 os <<
"Processor " << p <<
":\n";
2824 os << local_constraints;
2833 std::ostringstream os;
2840 os <<
"Mesh Constraint Rows:"
2845 const bool local = (node->processor_id() == this->
processor_id());
2848 if (!print_nonlocal && !local)
2851 os <<
"Constraints for " << (local ?
"Local" :
"Ghost") <<
" Node " << node->id()
2854 for (
const auto & [elem_and_node, coef] : row)
2855 os <<
" ((" << elem_and_node.first->id() <<
',' << elem_and_node.second <<
"), " << coef <<
")\t";
2864 is_partitioned(false),
2865 has_synched_id_counts(false),
2866 has_neighbor_ptrs(false),
2867 has_cached_elem_data(false),
2868 has_interior_parent_ptrs(false),
2869 has_removed_remote_elements(false),
2870 has_removed_orphaned_nodes(false),
2871 has_boundary_id_sets(false),
2872 has_reinit_ghosting_functors(false),
2873 has_synched_subdomain_name_map(false)
2876MeshBase::Preparation::operator bool()
const
2878 return is_partitioned &&
2879 has_synched_id_counts &&
2880 has_neighbor_ptrs &&
2881 has_cached_elem_data &&
2882 has_interior_parent_ptrs &&
2883 has_removed_remote_elements &&
2884 has_removed_orphaned_nodes &&
2885 has_reinit_ghosting_functors &&
2886 has_boundary_id_sets &&
2887 has_synched_subdomain_name_map;
2893 is_partitioned = set_all;
2894 has_synched_id_counts = set_all;
2895 has_neighbor_ptrs = set_all;
2896 has_cached_elem_data = set_all;
2897 has_interior_parent_ptrs = set_all;
2898 has_removed_remote_elements = set_all;
2899 has_removed_orphaned_nodes = set_all;
2900 has_reinit_ghosting_functors = set_all;
2901 has_boundary_id_sets = set_all;
2902 has_synched_subdomain_name_map = set_all;
2937 return !(*
this == other);
2942template LIBMESH_EXPORT
void
2944 bool precondition_constraint_operator);
2946#ifdef LIBMESH_USE_COMPLEX_NUMBERS
2947template LIBMESH_EXPORT
void
2949 bool precondition_constraint_operator);
void ErrorVector unsigned int
void max(const T &r, T &o, Request &req) const
Status receive(const unsigned int dest_processor_id, T &buf, const MessageTag &tag=any_tag) const
void min(const T &r, T &o, Request &req) const
void set_union(T &data, const unsigned int root_id) const
void allgather(const T &send_data, std::vector< T, A > &recv_data) const
void send(const unsigned int dest_processor_id, const T &buf, const MessageTag &tag=no_tag) const
The BoundaryInfo class contains information relevant to boundary conditions including storing faces,...
const std::set< boundary_id_type > & get_edge_boundary_ids() const
const std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > & get_edgeset_map() const
const std::multimap< const Node *, boundary_id_type > & get_nodeset_map() const
const std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > & get_sideset_map() const
const std::set< boundary_id_type > & get_node_boundary_ids() const
const std::set< boundary_id_type > & get_side_boundary_ids() const
void regenerate_id_sets()
Clears and regenerates the cached sets of ids.
const std::map< boundary_id_type, std::string > & get_edgeset_name_map() const
const std::map< boundary_id_type, std::string > & get_nodeset_name_map() const
const std::map< boundary_id_type, std::string > & get_sideset_name_map() const
Defines a Cartesian bounding box by the two corner extremum.
The DofObject defines an abstract base class for objects that have degrees of freedom associated with...
processor_id_type processor_id() const
static constexpr dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
static constexpr processor_id_type invalid_processor_id
An invalid processor_id to distinguish DoFs that have not been assigned to a processor.
Helper for building element sides that minimizes the construction of new elements.
This is the base class from which all geometric element types are derived.
virtual BoundingBox loose_bounding_box() const
SimpleRange< NodeRefIter > node_ref_range()
Returns a range with all nodes of an element, usable in range-based for loops.
virtual Order default_order() const =0
static std::unique_ptr< Elem > build(const ElemType type, Elem *p=nullptr)
virtual Order supported_nodal_order() const
static constexpr subdomain_id_type invalid_subdomain_id
A static integral constant representing an invalid subdomain id.
virtual unsigned short dim() const =0
virtual std::unique_ptr< Elem > build_edge_ptr(const unsigned int i)=0
virtual Real volume() const
virtual ElemType type() const =0
This class implements the original default geometry ghosting requirements in libMesh: point neighbors...
This abstract base class defines the interface by which library code and user code can report associa...
The IntRange templated class is intended to make it easy to loop over integers which are indices of a...
This is the MeshBase class.
void set_subdomain_name(subdomain_id_type id, const std::string &name, bool synchronous=false)
Sets the name for the provided id.
virtual const Node & node_ref(const dof_id_type i) const
virtual bool is_serial() const
void size_elem_extra_integers()
Size extra-integer arrays of all elements in the mesh.
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
void set_spatial_dimension(unsigned char d)
Sets the "spatial dimension" of the Mesh.
Preparation preparation() const
virtual std::unique_ptr< Partitioner > & partitioner()
A partitioner to use at each partitioning.
bool allow_renumbering() const
virtual const Node * node_ptr(const dof_id_type i) const =0
MeshBase::elemset_type _all_elemset_ids
MeshBase(const Parallel::Communicator &comm_in, unsigned char dim=1)
Constructor.
unsigned int mesh_dimension() const
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...
virtual dof_id_type n_elem() const =0
virtual bool is_replicated() const
void complete_preparation()
bool _skip_detect_interior_parents
If this is true then we will skip detect_interior_parents in prepare_for_use.
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 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...
const std::set< unsigned char > & elem_dimensions() const
void print_constraint_rows(std::ostream &os=libMesh::out, bool print_nonlocal=false) const
Prints (from processor 0) all mesh constraint rows.
bool skip_partitioning() const
Order _supported_nodal_order
We cache the maximum nodal order supported by all the mesh's elements (the minimum supported_nodal_or...
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,...
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 renumber_nodes_and_elements()=0
After partitioning a mesh it is useful to renumber the nodes and elements so that they lie in contigu...
void set_point_locator_close_to_point_tol(Real val)
Set value used by PointLocatorBase::close_to_point_tol().
dof_id_type n_active_elem_on_proc(const processor_id_type proc) const
bool has_node_integer(std::string_view name) const
PeriodicBoundaries * get_disjoint_neighbor_boundary_pairs()
void change_elemset_id(elemset_id_type old_id, elemset_id_type new_id)
Replace elemset id "old_id" with "new_id".
unsigned int get_elem_integer_index(std::string_view name) const
const std::map< subdomain_id_type, std::string > & get_subdomain_name_map() const
subdomain_id_type n_local_subdomains() const
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.
virtual void delete_node(Node *n)=0
Removes the Node n from the mesh.
unsigned int get_node_integer_index(std::string_view name) const
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).
dof_id_type get_elemset_code(const MeshBase::elemset_type &id_set) const
dof_id_type n_sub_elem() const
const ConstElemRange & active_local_element_stored_range() const
virtual void redistribute()
Redistribute elements between processors.
const ElemRange & element_stored_range()
std::unique_ptr< PeriodicBoundaries > _disjoint_neighbor_boundary_pairs
The disjoint neighbor boundary id pairs.
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.
unsigned char _spatial_dimension
The "spatial dimension" of the Mesh.
virtual ~MeshBase()
Destructor.
std::map< MeshBase::elemset_type, dof_id_type > _elemset_codes_inverse_map
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...
dof_id_type n_active_sub_elem() const
Same as n_sub_elem(), but only counts active elements.
bool _allow_remote_element_removal
If this is false then even on DistributedMesh remote elements will not be deleted during mesh prepara...
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.
void change_elemset_code(dof_id_type old_code, dof_id_type new_code)
Replace elemset code "old_code" with "new_code".
std::vector< dof_id_type > get_elemset_codes() const
Return a vector of all elemset codes defined on the mesh.
virtual dof_id_type n_nodes() 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.
unique_id_type _next_unique_id
The next available unique id for assigning ids to DOF objects.
bool _skip_renumber_nodes_and_elements
If this is true then renumbering will be kept to a minimum.
void remove_ghosting_functor(GhostingFunctor &ghosting_functor)
Removes a functor which was previously added to the set of ghosting functors.
virtual const Node * query_node_ptr(const dof_id_type i) const =0
std::vector< std::pair< std::pair< const Elem *, unsigned int >, Real > > constraint_rows_mapped_type
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.
GhostingFunctorIterator ghosting_functors_begin() const
Beginning of range of ghosting functors.
void unset_has_synched_subdomain_name_map()
Tells this we have done some operation which may have left the subdomain id to name map inconsistent ...
std::map< GhostingFunctor *, std::shared_ptr< GhostingFunctor > > _shared_functors
Hang on to references to any GhostingFunctor objects we were passed in shared_ptr form.
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.
std::set< subdomain_id_type > _mesh_subdomains
We cache the subdomain ids of the elements present in the mesh.
dof_id_type n_unpartitioned_elem() const
virtual void update_post_partitioning()
Recalculate any cached data (or invalidate any caches that are computed on the fly) after elements an...
bool get_count_lower_dim_elems_in_point_locator() const
Get the current value of _count_lower_dim_elems_in_point_locator.
std::unique_ptr< PointLocatorBase > _point_locator
A PointLocator class for this mesh.
virtual const Elem * elem_ptr(const dof_id_type i) const =0
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.
bool _skip_all_partitioning
If this is true then no partitioning should be done.
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,...
std::vector< std::string > _elem_integer_names
The array of names for integer data associated with each element in the mesh.
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.
void remove_orphaned_nodes()
Removes any orphaned nodes, nodes not connected to any elements.
Real get_point_locator_close_to_point_tol() const
unsigned int n_partitions() const
bool has_elem_integer(std::string_view name) const
dof_id_type n_local_elem() const
dof_id_type n_unpartitioned_nodes() const
bool _skip_noncritical_partitioning
If this is true then no partitioning should be done with the possible exception of orphaned nodes.
bool _skip_find_neighbors
If this is true then we will skip find_neighbors in prepare_for_use.
dof_id_type n_elem_on_proc(const processor_id_type proc) const
virtual void delete_remote_elements()
When supported, deletes all nonlocal elements of the mesh except for "ghosts" which touch a local ele...
MeshBase & operator=(const MeshBase &)=delete
Copy and move assignment are not allowed because MeshBase subclasses manually manage memory (Elems an...
ElemMappingType _default_mapping_type
The default mapping type (typically Lagrange) between master and physical space to assign to newly ad...
std::unique_ptr< BoundaryInfo > boundary_info
This class holds the boundary information.
std::set< Order > _elem_default_orders
We cache the (default) order of the geometric elements present in the mesh.
bool skip_noncritical_partitioning() const
MeshBase * _interior_mesh
Defaulting to this, a pointer to the mesh used to generate boundary elements on this.
std::vector< GhostingFunctor * > _ghosting_functors
The list of all GhostingFunctor objects to be used when distributing a DistributedMesh.
virtual void clear()
Deletes all the element and node data that is currently stored.
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.
dof_id_type n_local_nodes() const
std::unique_ptr< ConstElemRange > _const_active_local_element_stored_range
A cached ConstElemRange for threaded calculation on all local elements of this mesh.
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.
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.
constraint_rows_type _constraint_rows
std::unique_ptr< Partitioner > _partitioner
A partitioner to use at each prepare_for_use().
unsigned int n_elemsets() const
Returns the number of unique elemset ids which have been added via add_elemset_code(),...
constraint_rows_type & get_constraint_rows()
Constraint rows accessors.
const MeshBase & interior_mesh() const
std::unique_ptr< GhostingFunctor > _default_ghosting
The default geometric GhostingFunctor, used to implement standard libMesh element ghosting behavior.
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.
unsigned char _default_mapping_data
The default mapping data (unused with Lagrange, used for nodal weight lookup index with rational base...
virtual const Elem * query_elem_ptr(const dof_id_type i) const =0
virtual void all_complete_order()
Calls the range-based version of this function with a range consisting of all elements in the mesh.
virtual Elem * add_elem(Elem *e)=0
Add elem e to the end of the element array.
Real _point_locator_close_to_point_tol
If nonzero, we will call PointLocatorBase::set_close_to_point_tol() on any PointLocators that we crea...
dof_id_type n_nodes_on_proc(const processor_id_type proc) const
virtual void find_neighbors(const bool reset_remote_elements=false, const bool reset_current_list=true, const bool assert_valid=true, const bool check_non_remote=true)=0
Locate element face (edge in 2D) neighbors.
std::string & subdomain_name(subdomain_id_type id)
bool allow_find_neighbors() const
void sync_subdomain_name_map()
libMesh often expects all processors to know about names of all subdomain ids, but distributed mesh g...
virtual const Elem & elem_ref(const dof_id_type i) const
dof_id_type _n_constraint_rows
void size_node_extra_integers()
Size extra-integer arrays of all nodes in the mesh.
unsigned int _n_parts
The number of partitions the mesh has.
std::map< const Node *, constraint_rows_mapped_type > constraint_rows_type
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 remove_disjoint_boundary_pair(const boundary_id_type b1, const boundary_id_type b2)
void clear_point_locator()
Releases the current PointLocator object.
GhostingFunctorIterator ghosting_functors_end() const
End of range of ghosting functors.
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?...
void add_ghosting_functor(GhostingFunctor &ghosting_functor)
Adds a functor which can specify ghosting requirements for use on distributed meshes.
void copy_constraint_rows(const MeshBase &other_mesh)
Copy the constraints from the other mesh to this mesh.
std::set< elemset_id_type > elemset_type
Typedef for the "set" container used to store elemset ids.
std::set< unsigned char > _elem_dims
We cache the dimension of the elements present in the mesh.
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,...
std::vector< std::string > _node_integer_names
The array of names for integer data associated with each node in the mesh.
std::unique_ptr< PointLocatorBase > sub_point_locator() const
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.
subdomain_id_type get_id_by_name(std::string_view name) const
void print_info(std::ostream &os=libMesh::out, const unsigned int verbosity=0, const bool global=true) const
Prints relevant information about the mesh.
virtual void update_parallel_id_counts()=0
Updates parallel caches so that methods like n_elem() accurately reflect changes on other processors.
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....
dof_id_type count_constraint_rows()
Helper function for subclasses to use to set _n_constraint_rows.
virtual dof_id_type n_active_elem() const =0
void reinit_ghosting_functors()
Loops over ghosting functors and calls mesh_reinit()
Preparation _preparation
Flags indicating in what ways this mesh has been prepared.
subdomain_id_type n_subdomains() const
std::string get_info(const unsigned int verbosity=0, const bool global=true) const
std::string get_local_constraints(bool print_nonlocal=false) const
Gets a string reporting all mesh constraint rows local to this processor.
bool nodes_and_elements_equal(const MeshBase &other_mesh) const
Tests for equality of all elements and nodes in the mesh.
void copy_cached_data(const MeshBase &other_mesh)
Helper class to copy cached data, to synchronize with a possibly unprepared other_mesh.
void unset_is_prepared()
Tells this we have done some operation where we should no longer consider ourself prepared.
void post_dofobject_moves(MeshBase &&other_mesh)
Moves any superclass data (e.g.
void detect_interior_parents()
Search the mesh for elements that have a neighboring element of dim+1 and set that element as the int...
void clear_stored_ranges()
Clears stored ranges, to indicate that the mesh has changed and they should be regenerated when next ...
std::unique_ptr< ElemRange > _element_stored_range
A cached ElemRange for threaded mutation of all semilocal elements of this mesh.
Temporarily serialize a DistributedMesh for non-distributed-mesh capable code paths.
A Node is like a Point, but with more information.
An object whose state is distributed along a set of processors.
processor_id_type processor_id() const
ParallelObject & operator=(const ParallelObject &libmesh_dbg_var(other))
"Assignment" operator.
const Parallel::Communicator & comm() const
processor_id_type n_processors() const
We're using a class instead of a typedef to allow forward declarations and future flexibility.
boundary_id_type myboundary
The boundary ID of this boundary and its counterpart.
boundary_id_type pairedboundary
The definition of a periodic boundary.
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,...
static std::unique_ptr< PointLocatorBase > build(PointLocatorType t, const MeshBase &mesh, const PointLocatorBase *master=nullptr)
Builds an PointLocator for the mesh mesh.
A Point defines a location in LIBMESH_DIM dimensional Real space.
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.
virtual numeric_index_type n() const =0
virtual numeric_index_type row_stop() const =0
virtual numeric_index_type m() const =0
virtual numeric_index_type row_start() const =0
The StoredRange class defines a contiguous, divisible set of objects.
Dummy "splitting object" used to distinguish splitting constructors from copy constructors.
bool in_threads
A boolean which is true iff we are in a Threads:: function It may be useful to assert(!...
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.
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::string enum_to_string(const T e)
The libMesh namespace provides an interface to certain functionality in the library.
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
Helper function that allows us to treat a homogenous pair as a range.
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
bool closed()
Checks that the library has been closed.
ElemType
Defines an enum for geometric element types.
std::ostream & operator<<(std::ostream &os, const OrderWrapper &order)
Overload stream operators.
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
LIBMESH_DEVICE_INLINE T libmesh_real(T a)
bool initialized()
Checks that library initialization has been done.
static constexpr Real TOLERANCE
bool on_command_line(std::string arg)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
uint8_t processor_id_type
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...
Flags indicating in what ways a mesh has been prepared for use.
bool has_reinit_ghosting_functors
bool has_cached_elem_data
bool operator!=(const Preparation &other) const
bool has_removed_orphaned_nodes
Preparation & operator=(bool set_all)
Set all flags to the "set_all" value.
Preparation()
Constructor.
bool operator==(const Preparation &other) const
Two Preparation objects are equivalent iff all the flags match, regardless of the true/false status o...
bool has_interior_parent_ptrs
bool has_removed_remote_elements
bool has_synched_id_counts
bool has_synched_subdomain_name_map
bool has_boundary_id_sets