26 #include "libmesh/libmesh_common.h"
27 #include "libmesh/patch.h"
28 #include "libmesh/elem.h"
40 for (
const auto & elem : *
this)
41 for (
auto neighbor : elem->neighbor_ptr_range())
42 if (neighbor !=
nullptr)
44 #ifdef LIBMESH_ENABLE_AMR
45 if (!neighbor->active())
48 std::vector<const Elem *> active_neighbor_children;
50 neighbor->active_family_tree_by_neighbor
51 (active_neighbor_children, elem);
53 for (
const auto & child : active_neighbor_children)
54 new_neighbors.insert(child);
57 #endif // #ifdef LIBMESH_ENABLE_AMR
58 new_neighbors.insert (neighbor);
66 std::set<const Elem *> new_neighbors;
70 this->insert(new_neighbors.begin(), new_neighbors.end());
77 std::set<const Elem *> new_neighbors;
82 for (
const auto & neighbor : new_neighbors)
84 this->insert (neighbor);
91 std::set<const Elem *> new_neighbors;
95 for (
const auto & neighbor : new_neighbors)
97 this->insert (neighbor);
105 for (
const auto & elem : *
this)
107 std::set<const Elem *> elem_point_neighbors;
109 elem->find_point_neighbors(elem_point_neighbors);
111 new_neighbors.insert(elem_point_neighbors.begin(),
112 elem_point_neighbors.end());
120 std::set<const Elem *> new_neighbors;
124 this->insert(new_neighbors.begin(), new_neighbors.end());
131 std::set<const Elem *> new_neighbors;
136 for (
const auto & neighbor : new_neighbors)
138 this->insert (neighbor);
145 std::set<const Elem *> new_neighbors;
149 for (
const auto & neighbor : new_neighbors)
151 this->insert (neighbor);
157 const unsigned int target_patch_size,
176 while (this->size() < target_patch_size)
183 const std::size_t old_patch_size = this->size();
186 (this->*patchtype)();
189 if (this->size() == old_patch_size)
192 "WARNING: stagnant patch of " << this->size() <<
" elements."
194 "Does the target patch size exceed the number of local elements?"
205 for (
const auto & elem : *
this)
210 libmesh_assert_equal_to (elem->processor_id(),
_my_procid);