165 std::set<boundary_id_type> request_boundary_ids(
_boundary_ids);
170 this->
sync(request_boundary_ids,
180 std::set<subdomain_id_type> subdomains_relative_to;
183 this->
sync(requested_boundary_ids,
185 subdomains_relative_to);
192 const std::set<subdomain_id_type> & subdomains_relative_to)
194 LOG_SCOPE(
"sync()",
"BoundaryInfo");
196 boundary_mesh.
clear();
221 std::map<dof_id_type, dof_id_type> node_id_map;
222 std::map<std::pair<dof_id_type, unsigned char>,
dof_id_type> side_id_map;
224 this->
_find_id_maps(requested_boundary_ids, 0, &node_id_map, 0, &side_id_map, subdomains_relative_to);
230 if (node_id_map.count(node_id))
232 boundary_mesh.
add_point(*node, node_id_map[node_id], node->processor_id());
235 std::vector<boundary_id_type> node_boundary_ids;
237 for (
const auto & node_bid : node_boundary_ids)
243 this->
add_elements (requested_boundary_ids, boundary_mesh, subdomains_relative_to);
253 for (
auto nn : new_elem->node_index_range())
257 boundary_mesh.
node_ptr(node_id_map[new_elem->node_id(nn)]);
261 libmesh_assert (new_node);
262 libmesh_assert_equal_to (new_node->
id(),
263 node_id_map[new_elem->node_id(nn)]);
266 new_elem->set_node(nn) = new_node;
283 std::map<dof_id_type, dof_id_type> & node_id_map,
284 std::map<dof_id_type, unsigned char> & side_id_map,
287 LOG_SCOPE(
"get_side_and_node_maps()",
"BoundaryInfo");
293 std::unique_ptr<const Elem> interior_parent_side;
301 unsigned char interior_parent_side_index = 0;
302 bool found_matching_sides =
false;
306 Real centroid_distance = (boundary_elem->centroid() - interior_parent_side->centroid()).norm();
308 if (centroid_distance < (tolerance * boundary_elem->hmin()))
310 interior_parent_side_index = cast_int<unsigned char>(
side);
311 found_matching_sides =
true;
316 if (!found_matching_sides)
317 libmesh_error_msg(
"No matching side found within the specified tolerance");
319 side_id_map[boundary_elem->id()] = interior_parent_side_index;
321 for (
auto local_node_index : boundary_elem->node_index_range())
323 dof_id_type boundary_node_id = boundary_elem->node_id(local_node_index);
324 dof_id_type interior_node_id = interior_parent_side->node_id(local_node_index);
326 node_id_map[interior_node_id] = boundary_node_id;
337 std::set<subdomain_id_type> subdomains_relative_to;
342 subdomains_relative_to);
349 const std::set<subdomain_id_type> & subdomains_relative_to)
351 LOG_SCOPE(
"add_elements()",
"BoundaryInfo");
358 std::map<std::pair<dof_id_type, unsigned char>,
dof_id_type> side_id_map;
364 subdomains_relative_to);
370 typedef std::vector<std::pair<dof_id_type, unsigned char>>
372 side_container sides_to_add;
383 !subdomains_relative_to.count(elem->subdomain_id()))
392 for (
auto s : elem->side_index_range())
394 bool add_this_side =
false;
397 for (
const auto & pr :
as_range(bounds))
399 this_bcid = pr.second.second;
403 if ((pr.second.first == s) &&
404 (requested_boundary_ids.count(this_bcid)))
406 add_this_side =
true;
417 if (bounds.first == bounds.second &&
419 elem->neighbor_ptr(s) ==
nullptr)
420 add_this_side =
true;
423 sides_to_add.push_back(std::make_pair(elem->id(), s));
427 #ifdef LIBMESH_ENABLE_UNIQUE_ID 431 for (
const auto & pr : sides_to_add)
434 const unsigned char s = pr.second;
444 const std::pair<dof_id_type, unsigned char> side_pair(elem_id, s);
446 libmesh_assert(side_id_map.count(side_pair));
448 const dof_id_type new_side_id = side_id_map[side_pair];
450 side->set_id(new_side_id);
452 #ifdef LIBMESH_ENABLE_UNIQUE_ID 453 side->set_unique_id() = old_max_unique_id + new_side_id;
459 #ifdef LIBMESH_ENABLE_AMR 463 const std::pair<dof_id_type, unsigned char> parent_side_pair(elem->
parent()->
id(), s);
465 libmesh_assert(side_id_map.count(parent_side_pair));
467 Elem * side_parent = boundary_mesh.
elem_ptr(side_id_map[parent_side_pair]);
469 libmesh_assert(side_parent);
480 bool found_child =
false;
481 for (
unsigned int v=0; v != new_elem->
n_vertices(); ++v)
482 if (new_elem->
node_ptr(v) == side_parent->node_ptr(v))
484 side_parent->add_child(new_elem, v);
493 libmesh_assert_equal_to (new_elem->
n_vertices(), 3);
494 side_parent->add_child(new_elem, 3);
508 const unsigned short bdy_n_sides = new_elem->
n_sides();
509 const unsigned short bdy_n_nodes = new_elem->
n_nodes();
520 for (
unsigned short boundary_side = 0;
521 boundary_side != bdy_n_sides; ++boundary_side)
525 bool found_all_nodes =
true;
526 for (
unsigned short boundary_node = 0;
527 boundary_node != bdy_n_nodes; ++boundary_node)
533 bool found_this_node =
false;
534 for (
unsigned short interior_node = 0;
535 interior_node !=
n_nodes; ++interior_node)
541 if (new_elem->
point(boundary_node) ==
542 elem->
point(interior_node))
544 found_this_node =
true;
548 if (!found_this_node)
550 found_all_nodes =
false;
574 # ifdef LIBMESH_HAVE_RTTI 592 libmesh_error_msg(
"BoundaryInfo::add_node(): Could not retrieve pointer for node " << node_id <<
", no boundary id was added.");
603 libmesh_error_msg(
"ERROR: You may not set a boundary ID of " \
605 <<
"\n That is reserved for internal use.");
620 const std::vector<boundary_id_type> & ids)
625 libmesh_assert(node);
635 std::vector<boundary_id_type> unique_ids(ids.begin(), ids.end());
636 std::sort(unique_ids.begin(), unique_ids.end());
637 std::vector<boundary_id_type>::iterator new_end =
638 std::unique(unique_ids.begin(), unique_ids.end());
640 for (
auto &
id :
as_range(unique_ids.begin(), new_end))
643 libmesh_error_msg(
"ERROR: You may not set a boundary ID of " \
645 <<
"\n That is reserved for internal use.");
647 bool already_inserted =
false;
648 for (
const auto & pr :
as_range(bounds))
651 already_inserted =
true;
654 if (already_inserted)
671 const unsigned short int edge,
680 const unsigned short int edge,
683 libmesh_assert(elem);
686 libmesh_assert_equal_to (elem->
level(), 0);
689 libmesh_error_msg(
"ERROR: You may not set a boundary ID of " \
691 <<
"\n That is reserved for internal use.");
695 if (pr.second.first == edge &&
696 pr.second.second ==
id)
707 const unsigned short int edge,
708 const std::vector<boundary_id_type> & ids)
713 libmesh_assert(elem);
716 libmesh_assert_equal_to (elem->
level(), 0);
726 std::vector<boundary_id_type> unique_ids(ids.begin(), ids.end());
727 std::sort(unique_ids.begin(), unique_ids.end());
728 std::vector<boundary_id_type>::iterator new_end =
729 std::unique(unique_ids.begin(), unique_ids.end());
731 for (
auto &
id :
as_range(unique_ids.begin(), new_end))
734 libmesh_error_msg(
"ERROR: You may not set a boundary ID of " \
736 <<
"\n That is reserved for internal use.");
738 bool already_inserted =
false;
739 for (
const auto & pr :
as_range(bounds))
740 if (pr.second.first == edge &&
741 pr.second.second ==
id)
743 already_inserted =
true;
746 if (already_inserted)
758 const unsigned short int shellface,
767 const unsigned short int shellface,
770 libmesh_assert(elem);
773 libmesh_assert_equal_to (elem->
level(), 0);
776 libmesh_assert_less(shellface, 2);
779 libmesh_error_msg(
"ERROR: You may not set a boundary ID of " \
781 <<
"\n That is reserved for internal use.");
785 if (pr.second.first == shellface &&
786 pr.second.second ==
id)
797 const unsigned short int shellface,
798 const std::vector<boundary_id_type> & ids)
803 libmesh_assert(elem);
806 libmesh_assert_equal_to (elem->
level(), 0);
809 libmesh_assert_less(shellface, 2);
819 std::vector<boundary_id_type> unique_ids(ids.begin(), ids.end());
820 std::sort(unique_ids.begin(), unique_ids.end());
821 std::vector<boundary_id_type>::iterator new_end =
822 std::unique(unique_ids.begin(), unique_ids.end());
824 for (
auto &
id :
as_range(unique_ids.begin(), new_end))
827 libmesh_error_msg(
"ERROR: You may not set a boundary ID of " \
829 <<
"\n That is reserved for internal use.");
831 bool already_inserted =
false;
832 for (
const auto & pr :
as_range(bounds))
833 if (pr.second.first == shellface &&
834 pr.second.second ==
id)
836 already_inserted =
true;
839 if (already_inserted)
850 const unsigned short int side,
859 const unsigned short int side,
862 libmesh_assert(elem);
865 libmesh_assert_equal_to (elem->
level(), 0);
868 libmesh_error_msg(
"ERROR: You may not set a boundary ID of " \
870 <<
"\n That is reserved for internal use.");
874 if (pr.second.first ==
side &&
875 pr.second.second ==
id)
886 const unsigned short int side,
887 const std::vector<boundary_id_type> & ids)
892 libmesh_assert(elem);
895 libmesh_assert_equal_to (elem->
level(), 0);
905 std::vector<boundary_id_type> unique_ids(ids.begin(), ids.end());
906 std::sort(unique_ids.begin(), unique_ids.end());
907 std::vector<boundary_id_type>::iterator new_end =
908 std::unique(unique_ids.begin(), unique_ids.end());
910 for (
auto &
id :
as_range(unique_ids.begin(), new_end))
913 libmesh_error_msg(
"ERROR: You may not set a boundary ID of " \
915 <<
"\n That is reserved for internal use.");
917 bool already_inserted =
false;
918 for (
const auto & pr :
as_range(bounds))
919 if (pr.second.first ==
side && pr.second.second ==
id)
921 already_inserted =
true;
924 if (already_inserted)
947 #ifdef LIBMESH_ENABLE_DEPRECATED 950 libmesh_deprecated();
952 std::vector<boundary_id_type> ids;
961 std::vector<boundary_id_type> & vec_to_fill)
const 967 vec_to_fill.push_back(pr.second);
975 return cast_int<unsigned int>(std::distance(pos.first, pos.second));
980 #ifdef LIBMESH_ENABLE_DEPRECATED 982 const unsigned short int edge)
const 984 libmesh_deprecated();
986 std::vector<boundary_id_type> ids;
995 const unsigned short int edge,
996 std::vector<boundary_id_type> & vec_to_fill)
const 998 libmesh_assert(elem);
1001 vec_to_fill.clear();
1005 const Elem * searched_elem = elem;
1006 #ifdef LIBMESH_ENABLE_AMR 1007 if (elem->
level() != 0)
1012 bool found_boundary_edge =
false;
1020 found_boundary_edge =
true;
1026 if (!found_boundary_edge)
1032 while (searched_elem->
parent() !=
nullptr)
1034 const Elem * parent = searched_elem->
parent();
1037 searched_elem = parent;
1045 if (pr.second.first == edge)
1046 vec_to_fill.push_back(pr.second.second);
1052 const unsigned short int edge)
const 1054 std::vector<boundary_id_type> ids;
1056 return cast_int<unsigned int>(ids.size());
1061 #ifdef LIBMESH_ENABLE_DEPRECATED 1063 const unsigned short int edge)
const 1065 libmesh_deprecated();
1067 std::vector<boundary_id_type> ids;
1076 const unsigned short int edge,
1077 std::vector<boundary_id_type> & vec_to_fill)
const 1079 libmesh_assert(elem);
1082 vec_to_fill.clear();
1090 if (pr.second.first == edge)
1091 vec_to_fill.push_back(pr.second.second);
1097 const unsigned short int shellface,
1098 std::vector<boundary_id_type> & vec_to_fill)
const 1100 libmesh_assert(elem);
1103 libmesh_assert_less(shellface, 2);
1106 vec_to_fill.clear();
1110 const Elem * searched_elem = elem;
1111 #ifdef LIBMESH_ENABLE_AMR 1112 if (elem->
level() != 0)
1114 while (searched_elem->
parent() !=
nullptr)
1116 const Elem * parent = searched_elem->
parent();
1117 searched_elem = parent;
1124 if (pr.second.first == shellface)
1125 vec_to_fill.push_back(pr.second.second);
1131 const unsigned short int shellface)
const 1133 std::vector<boundary_id_type> ids;
1135 return cast_int<unsigned int>(ids.size());
1141 const unsigned short int shellface,
1142 std::vector<boundary_id_type> & vec_to_fill)
const 1144 libmesh_assert(elem);
1147 libmesh_assert_less(shellface, 2);
1150 vec_to_fill.clear();
1158 if (pr.second.first == shellface)
1159 vec_to_fill.push_back(pr.second.second);
1163 #ifdef LIBMESH_ENABLE_DEPRECATED 1165 const unsigned short int side)
const 1167 libmesh_deprecated();
1169 std::vector<boundary_id_type> ids;
1178 return *(ids.begin());
1185 const unsigned short int side,
1188 std::vector<boundary_id_type> ids;
1190 return (std::find(ids.begin(), ids.end(), id) != ids.end());
1195 #ifdef LIBMESH_ENABLE_DEPRECATED 1197 const unsigned short int side)
const 1199 libmesh_deprecated();
1201 std::vector<boundary_id_type> ids;
1210 const unsigned short int side,
1211 std::vector<boundary_id_type> & vec_to_fill)
const 1213 libmesh_assert(elem);
1216 vec_to_fill.clear();
1220 const Elem * searched_elem = elem;
1221 if (elem->
level() != 0)
1225 #ifdef LIBMESH_ENABLE_AMR 1227 while (searched_elem->
parent() !=
nullptr)
1229 const Elem * parent = searched_elem->
parent();
1232 searched_elem = parent;
1239 if (pr.second.first ==
side)
1240 vec_to_fill.push_back(pr.second.second);
1247 const unsigned short int side)
const 1249 std::vector<boundary_id_type> ids;
1251 return cast_int<unsigned int>(ids.size());
1256 #ifdef LIBMESH_ENABLE_DEPRECATED 1258 const unsigned short int side)
const 1260 libmesh_deprecated();
1262 std::vector<boundary_id_type> ids;
1271 const unsigned short int side,
1272 std::vector<boundary_id_type> & vec_to_fill)
const 1274 libmesh_assert(elem);
1277 vec_to_fill.clear();
1285 if (pr.second.first ==
side)
1286 vec_to_fill.push_back(pr.second.second);
1292 const Elem *
const old_elem,
1293 const Elem *
const new_elem)
1295 libmesh_assert_equal_to (old_elem->
n_sides(), new_elem->
n_sides());
1296 libmesh_assert_equal_to (old_elem->
n_edges(), new_elem->
n_edges());
1298 std::vector<boundary_id_type> bndry_ids;
1303 this->
add_side (new_elem, s, bndry_ids);
1309 this->
add_edge (new_elem, e, bndry_ids);
1312 for (
unsigned short sf=0; sf != 2; sf++)
1323 libmesh_assert(node);
1333 libmesh_assert(elem);
1344 const unsigned short int edge)
1346 libmesh_assert(elem);
1350 libmesh_assert_equal_to (elem->
level(), 0);
1357 while (e.first != e.second)
1361 if (e.first->second.first == edge)
1371 const unsigned short int edge,
1374 libmesh_assert(elem);
1378 libmesh_assert_equal_to (elem->
level(), 0);
1385 while (e.first != e.second)
1389 if (e.first->second.first == edge && e.first->second.second ==
id)
1398 const unsigned short int shellface)
1400 libmesh_assert(elem);
1404 libmesh_assert_equal_to (elem->
level(), 0);
1407 libmesh_assert_less(shellface, 2);
1414 while (e.first != e.second)
1418 if (e.first->second.first == shellface)
1428 const unsigned short int shellface,
1431 libmesh_assert(elem);
1435 libmesh_assert_equal_to (elem->
level(), 0);
1438 libmesh_assert_less(shellface, 2);
1445 while (e.first != e.second)
1449 if (e.first->second.first == shellface &&
1450 e.first->second.second ==
id)
1461 const unsigned short int side)
1463 libmesh_assert(elem);
1467 libmesh_assert_equal_to (elem->
level(), 0);
1474 while (e.first != e.second)
1478 if (e.first->second.first ==
side)
1488 const unsigned short int side,
1491 libmesh_assert(elem);
1498 while (e.first != e.second)
1502 if (e.first->second.first ==
side && e.first->second.second ==
id)
1525 if (it->second ==
id)
1533 if (it->second.second ==
id)
1541 if (it->second.second ==
id)
1549 if (it->second.second ==
id)
1561 const Elem * searched_elem = elem;
1562 if (elem->
level() != 0)
1570 if (pr.second.second == boundary_id_in)
1572 unsigned int side = pr.second.first;
1581 const Elem * p = elem;
1583 #ifdef LIBMESH_ENABLE_AMR 1585 while (p !=
nullptr)
1613 if (std::find(b_ids.begin(),b_ids.end(),id) == b_ids.end())
1614 b_ids.push_back(
id);
1627 if (std::find(b_ids.begin(),b_ids.end(),id) == b_ids.end())
1628 b_ids.push_back(
id);
1641 if (std::find(b_ids.begin(),b_ids.end(),id) == b_ids.end())
1642 b_ids.push_back(
id);
1654 parallel_object_only();
1675 parallel_object_only();
1677 std::size_t n_edge_bcs=0;
1683 this->
comm().
sum (n_edge_bcs);
1697 parallel_object_only();
1699 std::size_t n_shellface_bcs=0;
1705 this->
comm().
sum (n_shellface_bcs);
1707 return n_shellface_bcs;
1719 parallel_object_only();
1721 std::size_t n_nodesets=0;
1727 this->
comm().
sum (n_nodesets);
1734 #ifdef LIBMESH_ENABLE_DEPRECATED 1736 std::vector<boundary_id_type> & il)
const 1738 libmesh_deprecated();
1749 nl.reserve (bc_tuples.size());
1750 il.reserve (bc_tuples.size());
1752 for (
const auto & t : bc_tuples)
1754 nl.push_back(std::get<0>(t));
1755 il.push_back(std::get<1>(t));
1761 std::vector<std::tuple<dof_id_type, boundary_id_type>>
1764 std::vector<std::tuple<dof_id_type, boundary_id_type>> bc_tuples;
1768 bc_tuples.emplace_back(pr.first->id(), pr.second);
1772 std::sort(bc_tuples.begin(), bc_tuples.end());
1787 typedef std::set<std::pair<dof_id_type, boundary_id_type>> set_type;
1791 std::vector<set_type> nodes_to_push(n_proc);
1794 std::unique_ptr<const Elem>
side;
1800 if (pr.first->is_remote())
1804 std::vector<const Elem *> family;
1805 #ifdef LIBMESH_ENABLE_AMR 1806 pr.first->active_family_tree_by_side (family, pr.second.first);
1808 family.push_back(pr.first);
1811 for (
const auto & cur_elem : family)
1813 cur_elem->build_side_ptr(
side, pr.second.first);
1816 for (
auto i :
side->node_index_range())
1819 this->
add_node(side->node_ptr(i), bcid);
1820 if (!mesh_is_serial)
1823 side->node_ptr(i)->processor_id();
1824 if (proc_id != my_proc_id)
1825 nodes_to_push[proc_id].insert
1826 (std::make_pair(
side->node_id(i), bcid));
1843 std::vector<Parallel::Request> node_push_requests(n_proc-1);
1847 if (p == my_proc_id)
1851 node_push_requests[p - (p > my_proc_id)];
1854 (p, nodes_to_push[p],
request, node_pushes_tag);
1859 set_type received_nodes;
1864 for (
const auto & pr : received_nodes)
1873 std::vector<std::vector<dof_id_type>> node_ids_requested(n_proc);
1879 if (pid != my_proc_id)
1880 node_ids_requested[pid].push_back(node->id());
1883 typedef std::vector<std::pair<dof_id_type, boundary_id_type>> vec_type;
1885 std::vector<Parallel::Request>
1886 node_pull_requests(n_proc-1),
1887 node_response_requests(n_proc-1);
1892 if (p == my_proc_id)
1896 node_pull_requests[p - (p > my_proc_id)];
1899 (p, node_ids_requested[p],
request, node_pulls_tag);
1903 std::vector<vec_type> responses(n_proc-1);
1907 std::vector<dof_id_type> requested_nodes;
1912 source_pid = cast_int<processor_id_type>(
status.source());
1915 (source_pid, requested_nodes, node_pulls_tag);
1918 node_response_requests[p-1];
1920 std::vector<boundary_id_type> bcids;
1922 for (
const auto &
id : requested_nodes)
1926 for (
const auto & b : bcids)
1927 responses[p-1].push_back(std::make_pair(
id, b));
1931 (source_pid, responses[p-1],
request, node_responses_tag);
1940 source_pid = cast_int<processor_id_type>(
status.source());
1945 (source_pid, response, node_responses_tag);
1947 for (
const auto & pr : response)
1964 libMesh::out <<
"No boundary node IDs have been added: cannot build side list!" << std::endl;
1969 std::unique_ptr<const Elem> side_elem;
1972 for (
auto side : elem->side_index_range())
1974 elem->build_side_ptr(side_elem,
side);
1977 std::map<boundary_id_type, unsigned> nodesets_node_count;
1981 for (
const auto & node : side_elem->node_ref_range())
1983 nodesets_node_count[pr.second]++;
1989 for (
const auto & pr : nodesets_node_count)
1990 if (pr.second == side_elem->n_nodes())
1997 if (nset_name !=
"")
2006 #ifdef LIBMESH_ENABLE_DEPRECATED 2008 std::vector<unsigned short int> & sl,
2009 std::vector<boundary_id_type> & il)
const 2011 libmesh_deprecated();
2023 el.reserve (bc_tuples.size());
2024 sl.reserve (bc_tuples.size());
2025 il.reserve (bc_tuples.size());
2027 for (
const auto & t : bc_tuples)
2029 el.push_back(std::get<0>(t));
2030 sl.push_back(std::get<1>(t));
2031 il.push_back(std::get<2>(t));
2037 std::vector<std::tuple<dof_id_type, unsigned short int, boundary_id_type>>
2040 std::vector<std::tuple<dof_id_type, unsigned short int, boundary_id_type>> bc_triples;
2044 bc_triples.emplace_back(pr.first->id(), pr.second.first, pr.second.second);
2050 std::sort(bc_triples.begin(), bc_triples.end());
2057 #ifdef LIBMESH_ENABLE_DEPRECATED 2059 std::vector<unsigned short int> & sl,
2060 std::vector<boundary_id_type> & il)
const 2062 libmesh_deprecated();
2074 el.reserve (bc_tuples.size());
2075 sl.reserve (bc_tuples.size());
2076 il.reserve (bc_tuples.size());
2078 for (
const auto & t : bc_tuples)
2080 el.push_back(std::get<0>(t));
2081 sl.push_back(std::get<1>(t));
2082 il.push_back(std::get<2>(t));
2088 std::vector<std::tuple<dof_id_type, unsigned short int, boundary_id_type>>
2091 std::vector<std::tuple<dof_id_type, unsigned short int, boundary_id_type>> bc_triples;
2097 if (pr.first->is_remote())
2101 std::vector<const Elem *> family;
2102 #ifdef LIBMESH_ENABLE_AMR 2103 pr.first->active_family_tree_by_side(family, pr.second.first);
2105 family.push_back(pr.first);
2109 for (
const auto & elem : family)
2110 bc_triples.emplace_back(elem->id(), pr.second.first, pr.second.second);
2115 std::sort(bc_triples.begin(), bc_triples.end());
2121 #ifdef LIBMESH_ENABLE_DEPRECATED 2123 std::vector<unsigned short int> & sl,
2124 std::vector<boundary_id_type> & il)
const 2126 libmesh_deprecated();
2138 el.reserve (bc_tuples.size());
2139 sl.reserve (bc_tuples.size());
2140 il.reserve (bc_tuples.size());
2142 for (
const auto & t : bc_tuples)
2144 el.push_back(std::get<0>(t));
2145 sl.push_back(std::get<1>(t));
2146 il.push_back(std::get<2>(t));
2152 std::vector<std::tuple<dof_id_type, unsigned short int, boundary_id_type>>
2155 std::vector<std::tuple<dof_id_type, unsigned short int, boundary_id_type>> bc_triples;
2159 bc_triples.emplace_back(pr.first->id(), pr.second.first, pr.second.second);
2163 std::sort(bc_triples.begin(), bc_triples.end());
2169 #ifdef LIBMESH_ENABLE_DEPRECATED 2171 std::vector<unsigned short int> & sl,
2172 std::vector<boundary_id_type> & il)
const 2174 libmesh_deprecated();
2186 el.reserve (bc_tuples.size());
2187 sl.reserve (bc_tuples.size());
2188 il.reserve (bc_tuples.size());
2190 for (
const auto & t : bc_tuples)
2192 el.push_back(std::get<0>(t));
2193 sl.push_back(std::get<1>(t));
2194 il.push_back(std::get<2>(t));
2200 std::vector<std::tuple<dof_id_type, unsigned short int, boundary_id_type>>
2203 std::vector<std::tuple<dof_id_type, unsigned short int, boundary_id_type>> bc_triples;
2207 bc_triples.emplace_back(pr.first->id(), pr.second.first, pr.second.second);
2211 std::sort(bc_triples.begin(), bc_triples.end());
2222 out_stream <<
"Nodal Boundary conditions:" << std::endl
2223 <<
"--------------------------" << std::endl
2224 <<
" (Node No., ID) " << std::endl;
2227 out_stream <<
" (" << pr.first->id()
2228 <<
", " << pr.second
2229 <<
")" << std::endl;
2235 out_stream << std::endl
2236 <<
"Edge Boundary conditions:" << std::endl
2237 <<
"-------------------------" << std::endl
2238 <<
" (Elem No., Edge No., ID) " << std::endl;
2241 out_stream <<
" (" << pr.first->id()
2242 <<
", " << pr.second.first
2243 <<
", " << pr.second.second
2244 <<
")" << std::endl;
2250 out_stream << std::endl
2251 <<
"Shell-face Boundary conditions:" << std::endl
2252 <<
"-------------------------" << std::endl
2253 <<
" (Elem No., Shell-face No., ID) " << std::endl;
2256 out_stream <<
" (" << pr.first->id()
2257 <<
", " << pr.second.first
2258 <<
", " << pr.second.second
2259 <<
")" << std::endl;
2265 out_stream << std::endl
2266 <<
"Side Boundary conditions:" << std::endl
2267 <<
"-------------------------" << std::endl
2268 <<
" (Elem No., Side No., ID) " << std::endl;
2271 out_stream <<
" (" << pr.first->id()
2272 <<
", " << pr.second.first
2273 <<
", " << pr.second.second
2274 <<
")" << std::endl;
2285 out_stream <<
"Nodal Boundary conditions:" << std::endl
2286 <<
"--------------------------" << std::endl
2287 <<
" (ID, number of nodes) " << std::endl;
2289 std::map<boundary_id_type, std::size_t> ID_counts;
2292 ID_counts[pr.second]++;
2294 for (
const auto & pr : ID_counts)
2295 out_stream <<
" (" << pr.first
2296 <<
", " << pr.second
2297 <<
")" << std::endl;
2303 out_stream << std::endl
2304 <<
"Edge Boundary conditions:" << std::endl
2305 <<
"-------------------------" << std::endl
2306 <<
" (ID, number of edges) " << std::endl;
2308 std::map<boundary_id_type, std::size_t> ID_counts;
2311 ID_counts[pr.second.second]++;
2313 for (
const auto & pr : ID_counts)
2314 out_stream <<
" (" << pr.first
2315 <<
", " << pr.second
2316 <<
")" << std::endl;
2323 out_stream << std::endl
2324 <<
"Shell-face Boundary conditions:" << std::endl
2325 <<
"-------------------------" << std::endl
2326 <<
" (ID, number of shellfaces) " << std::endl;
2328 std::map<boundary_id_type, std::size_t> ID_counts;
2331 ID_counts[pr.second.second]++;
2333 for (
const auto & pr : ID_counts)
2334 out_stream <<
" (" << pr.first
2335 <<
", " << pr.second
2336 <<
")" << std::endl;
2342 out_stream << std::endl
2343 <<
"Side Boundary conditions:" << std::endl
2344 <<
"-------------------------" << std::endl
2345 <<
" (ID, number of sides) " << std::endl;
2347 std::map<boundary_id_type, std::size_t> ID_counts;
2350 ID_counts[pr.second.second]++;
2352 for (
const auto & pr : ID_counts)
2353 out_stream <<
" (" << pr.first
2354 <<
", " << pr.second
2355 <<
")" << std::endl;
2362 static const std::string empty_string;
2363 std::map<boundary_id_type, std::string>::const_iterator it =
2366 return empty_string;
2379 static const std::string empty_string;
2380 std::map<boundary_id_type, std::string>::const_iterator it =
2383 return empty_string;
2397 if (pr.second ==
name)
2402 if (pr.second ==
name)
2414 std::map<dof_id_type, dof_id_type> * node_id_map,
2416 std::map<std::pair<dof_id_type, unsigned char>,
dof_id_type> * side_id_map,
2417 const std::set<subdomain_id_type> & subdomains_relative_to)
2422 next_node_id = first_free_node_id + this->
processor_id(),
2423 next_elem_id = first_free_elem_id + this->
processor_id();
2426 std::unique_ptr<const Elem>
side;
2439 bool hit_end_el =
false;
2444 !hit_end_el || (el != end_unpartitioned_el); ++el)
2446 if ((el == end_el) && !hit_end_el)
2460 next_node_id = first_free_node_id + this->
n_processors();
2461 next_elem_id = first_free_elem_id + this->
n_processors();
2464 if (el == end_unpartitioned_el)
2468 const Elem * elem = *el;
2489 bool add_this_side =
false;
2492 for (
const auto & pr :
as_range(bounds))
2494 this_bcid = pr.second.second;
2498 if ((pr.second.first == s) &&
2499 (requested_boundary_ids.count(this_bcid)))
2501 add_this_side =
true;
2512 if (bounds.first == bounds.second &&
2515 add_this_side =
true;
2526 std::pair<dof_id_type, unsigned char> side_pair(elem->
id(), s);
2527 libmesh_assert (!side_id_map->count(side_pair));
2528 (*side_id_map)[side_pair] = next_elem_id;
2533 for (
auto n :
side->node_index_range())
2535 const Node & node =
side->node_ref(n);
2544 if (node_id_map && !node_id_map->count(node_id))
2546 (*node_id_map)[node_id] = next_node_id;
std::string name(const ElemQuality q)
void set_union(T &data, const unsigned int root_id) const
void add_elements(const std::set< boundary_id_type > &requested_boundary_ids, UnstructuredMesh &boundary_mesh)
std::size_t n_boundary_conds() const
void send(const unsigned int dest_processor_id, const T &buf, const MessageTag &tag=no_tag) const
std::map< boundary_id_type, std::string > _ns_id_to_name
void wait(std::vector< Request > &r)
std::set< boundary_id_type > _node_boundary_ids
const Elem * parent() const
void make_node_unique_ids_parallel_consistent(MeshBase &)
void remove_edge(const Elem *elem, const unsigned short int edge)
A geometric point in (x,y,z) space associated with a DOF.
virtual unique_id_type parallel_max_unique_id() const =0
std::string & nodeset_name(boundary_id_type id)
bool has_boundary_id(const Node *const node, const boundary_id_type id) const
const unsigned int invalid_uint
std::set< boundary_id_type > _edge_boundary_ids
virtual void libmesh_assert_valid_parallel_ids() const override
void sync(UnstructuredMesh &boundary_mesh)
void build_node_list_from_side_list()
const Elem * interior_parent() const
const unsigned int any_source
std::size_t n_edge_conds() const
IntRange< unsigned short > side_index_range() const
std::vector< std::tuple< dof_id_type, unsigned short int, boundary_id_type > > build_edge_list() const
void remove_id(boundary_id_type id)
BoundaryInfo(MeshBase &m)
const Elem * top_parent() const
virtual bool is_edge_on_side(const unsigned int e, const unsigned int s) const =0
void remove_shellface(const Elem *elem, const unsigned short int shellface)
static void set_node_processor_ids(MeshBase &mesh)
std::size_t n_shellface_conds() const
virtual bool is_child_on_side(const unsigned int c, const unsigned int s) const =0
unsigned int n_shellface_boundary_ids(const Elem *const elem, const unsigned short int shellface) const
std::set< boundary_id_type > _boundary_ids
void remove(const Node *node)
unsigned int side_with_boundary_id(const Elem *const elem, const boundary_id_type boundary_id) const
The base class for all geometric element types.
void print_info(std::ostream &out=libMesh::out) const
uint8_t processor_id_type
virtual std::unique_ptr< Partitioner > & partitioner()
virtual bool is_node_on_side(const unsigned int n, const unsigned int s) const =0
const Parallel::Communicator & comm() const
std::set< boundary_id_type > _side_boundary_ids
void build_side_boundary_ids(std::vector< boundary_id_type > &b_ids) const
void shellface_boundary_ids(const Elem *const elem, const unsigned short int shellface, std::vector< boundary_id_type > &vec_to_fill) const
virtual SimpleRange< element_iterator > active_element_ptr_range()=0
MessageTag get_unique_tag(int tagvalue) const
std::vector< boundary_id_type > raw_edge_boundary_ids(const Elem *const elem, const unsigned short int edge) const
const BoundaryInfo & get_boundary_info() const
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
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
void set_interior_parent(Elem *p)
std::size_t n_boundary_ids() const
std::vector< std::tuple< dof_id_type, unsigned short int, boundary_id_type > > build_active_side_list() const
std::vector< std::tuple< dof_id_type, unsigned short int, boundary_id_type > > build_shellface_list() const
IntRange< unsigned short > edge_index_range() const
std::map< boundary_id_type, std::string > _ss_id_to_name
std::vector< boundary_id_type > boundary_ids(const Node *node) const
virtual std::unique_ptr< Elem > build_side_ptr(const unsigned int i, bool proxy=true)=0
virtual element_iterator elements_begin()=0
void clear_boundary_node_ids()
boundary_id_type get_id_by_name(const std::string &name) const
processor_id_type n_processors() const
virtual bool is_serial() const
static const subdomain_id_type invalid_subdomain_id
void add_node(const Node *node, const boundary_id_type id)
const dof_id_type n_nodes
static const boundary_id_type invalid_id
virtual SimpleRange< element_iterator > element_ptr_range()=0
virtual unsigned int n_nodes() const =0
static const processor_id_type invalid_processor_id
std::multimap< const Node *, boundary_id_type > _boundary_node_id
Base class for Replicated and Distributed meshes.
void build_side_list_from_node_list()
virtual Elem * add_elem(Elem *e)=0
void raw_shellface_boundary_ids(const Elem *const elem, const unsigned short int shellface, std::vector< boundary_id_type > &vec_to_fill) const
virtual element_iterator elements_end()=0
virtual const Node * query_node_ptr(const dof_id_type i) const =0
virtual SimpleRange< node_iterator > node_ptr_range()=0
virtual dof_id_type max_elem_id() const =0
Used by the Mesh to keep track of boundary nodes and elements.
SimpleRange< I > as_range(const std::pair< I, I > &p)
void prepare_for_use(const bool skip_renumber_nodes_and_elements=false, const bool skip_find_neighbors=false)
virtual unsigned int n_edges() const =0
boundary_id_type boundary_id(const Elem *const elem, const unsigned short int side) const
void set_neighbor(const unsigned int i, Elem *n)
Mesh data structure which is distributed across all processors.
An object whose state is distributed along a set of processors.
void regenerate_id_sets()
const std::string & get_nodeset_name(boundary_id_type id) const
unsigned int which_child_am_i(const Elem *e) const
std::string & sideset_name(boundary_id_type id)
BoundaryInfo & operator=(const BoundaryInfo &other_boundary_info)
unsigned int n_partitions() const
virtual element_iterator pid_elements_begin(processor_id_type proc_id)=0
virtual const Elem * elem_ptr(const dof_id_type i) const =0
std::vector< boundary_id_type > raw_boundary_ids(const Elem *const elem, const unsigned short int side) const
void build_node_boundary_ids(std::vector< boundary_id_type > &b_ids) const
virtual unsigned int n_sides() const =0
void print_summary(std::ostream &out=libMesh::out) const
const Elem * neighbor_ptr(unsigned int i) const
void remove_side(const Elem *elem, const unsigned short int side)
std::vector< std::tuple< dof_id_type, unsigned short int, boundary_id_type > > build_side_list() const
unsigned int level() const
virtual unsigned int n_vertices() const =0
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
unsigned int n_edge_boundary_ids(const Elem *const elem, const unsigned short int edge) const
subdomain_id_type subdomain_id() const
void copy_boundary_ids(const BoundaryInfo &old_boundary_info, const Elem *const old_elem, const Elem *const new_elem)
Temporarily serializes a DistributedMesh for output.
const Node * node_ptr(const unsigned int i) const
void add_side(const dof_id_type elem, const unsigned short int side, const boundary_id_type id)
const std::string & get_sideset_name(boundary_id_type id) const
void add_shellface(const dof_id_type elem, const unsigned short int shellface, const boundary_id_type id)
std::vector< std::tuple< dof_id_type, boundary_id_type > > build_node_list() const
Status receive(const unsigned int dest_processor_id, T &buf, const MessageTag &tag=any_tag) const
std::size_t n_nodeset_conds() const
std::set< boundary_id_type > _shellface_boundary_ids
void _find_id_maps(const std::set< boundary_id_type > &requested_boundary_ids, dof_id_type first_free_node_id, std::map< dof_id_type, dof_id_type > *node_id_map, dof_id_type first_free_elem_id, std::map< std::pair< dof_id_type, unsigned char >, dof_id_type > *side_id_map, const std::set< subdomain_id_type > &subdomains_relative_to)
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
virtual void delete_remote_elements()
virtual const Node * node_ptr(const dof_id_type i) const =0
processor_id_type processor_id() const
OStreamProxy out(std::cout)
processor_id_type processor_id() const
const Point & point(const unsigned int i) const
unsigned int & set_n_partitions()
void build_shellface_boundary_ids(std::vector< boundary_id_type > &b_ids) const
virtual bool is_child_on_edge(const unsigned int c, const unsigned int e) const
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
void get_side_and_node_maps(UnstructuredMesh &boundary_mesh, std::map< dof_id_type, dof_id_type > &node_id_map, std::map< dof_id_type, unsigned char > &side_id_map, Real tolerance=1.e-6)
void add_edge(const dof_id_type elem, const unsigned short int edge, const boundary_id_type id)
std::vector< boundary_id_type > edge_boundary_ids(const Elem *const elem, const unsigned short int edge) const
const RemoteElem * remote_elem
virtual element_iterator pid_elements_end(processor_id_type proc_id)=0