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);
void add_local_point_neighbors()
This function finds all elements on the current processor which touch the current patch at any point...
This is the base class from which all geometric element types are derived.
The libMesh namespace provides an interface to certain functionality in the library.
void build_around_element(const Elem *elem, const unsigned int target_patch_size=10, PMF patchtype=&Patch::add_local_face_neighbors)
Erases any elements in the current patch, then builds a new patch containing element elem by repeated...
void find_face_neighbors(std::set< const Elem *> &neighbor_set)
This function finds all elements which touch the current patch at a face.
void add_point_neighbors()
This function finds all elements which touch the current patch at any point, and adds them to the pat...
void add_semilocal_point_neighbors()
This function finds all elements which touch the current patch at any point and which touch one of ou...
void add_local_face_neighbors()
This function finds all elements on the current processor which touch the current patch at a face...
void find_point_neighbors(std::set< const Elem *> &neighbor_set)
This function finds all elements which touch the current patch at any point.
void add_face_neighbors()
This function finds all elements which touch the current patch at a face, and adds them to the patch...
void add_semilocal_face_neighbors()
This function finds all elements which touch the current patch at a face and which touch one of our p...
const processor_id_type _my_procid
processor_id_type processor_id() const