18 #ifndef LIBMESH_ELEM_INTERNAL_H 19 #define LIBMESH_ELEM_INTERNAL_H 22 #include "libmesh/elem.h" 28 class PointLocatorBase;
29 class PeriodicBoundaries;
36 namespace ElemInternal
42 std::vector<T> & family,
53 family.push_back(elem);
58 for (
auto & c : elem->child_ref_range())
68 std::vector<T> & family,
76 family.push_back(elem);
80 if (elem->has_children())
81 for (
auto & c : elem->child_ref_range())
91 std::vector<T> & active_family,
99 active_family.clear();
103 active_family.push_back(elem);
108 for (
auto & c : elem->child_ref_range())
118 std::vector<T> & family,
129 libmesh_assert_less (s, elem->n_sides());
132 family.push_back(elem);
138 const unsigned int nc = elem->n_children();
139 for (
unsigned int c = 0; c != nc; c++)
140 if (!elem->child_ptr(c)->is_remote() && elem->is_child_on_side(c, s))
150 std::vector<T> & family,
162 libmesh_assert_less (side, elem->n_sides());
166 family.push_back(elem);
172 const unsigned int nc = elem->n_children();
173 for (
unsigned int c = 0; c != nc; c++)
174 if (!elem->child_ptr(c)->is_remote() && elem->is_child_on_side(c, side))
183 std::vector<T> & family,
198 family.push_back(elem);
203 for (
auto & c : elem->child_ref_range())
204 if (!c.is_remote() && c.has_neighbor(neighbor_in))
212 std::vector<T> & family,
224 family.push_back(elem);
228 if (elem->has_children())
229 for (
auto & c : elem->child_ref_range())
230 if (!c.is_remote() && c.has_neighbor(neighbor_in))
238 std::vector<T> & family,
261 if (neighbor_in == subneighbor)
262 family.push_back(elem);
267 for (
auto & c : elem->child_ref_range())
269 for (
auto child_neigh : c.neighbor_ptr_range())
271 (child_neigh == neighbor_in || (child_neigh->parent() == neighbor_in &&
272 child_neigh->is_ancestor_of(subneighbor))))
281 std::vector<T> & family,
301 if (neighbor_in == subneighbor)
302 family.push_back(elem);
306 if (elem->has_children())
307 for (
auto & c : elem->child_ref_range())
309 for (
auto child_neigh : c.neighbor_ptr_range())
311 (child_neigh == neighbor_in ||
312 (child_neigh->parent() == neighbor_in && child_neigh->is_ancestor_of(subneighbor))))
313 c.total_family_tree_by_subneighbor(family, child_neigh, subneighbor,
false);
321 std::vector<T> & family,
336 if (elem->level() >= neighbor_in->level())
342 family.push_back(elem);
346 else if (!elem->active())
347 for (
auto & c : elem->child_ref_range())
348 if (!c.is_remote() && c.has_neighbor(neighbor_in))
357 std::vector<T> & family,
375 if (elem->level() >= neighbor_in->level())
384 family.push_back(elem);
388 else if (!elem->active())
389 for (
auto & c : elem->child_ref_range())
390 if (!c.is_remote() &&
391 c.has_topological_neighbor(neighbor_in,
mesh, point_locator, pb))
392 c.active_family_tree_by_topological_neighbor
393 (family, neighbor_in,
mesh, point_locator, pb,
false);
401 std::set<T> & neighbor_set,
407 this_elem->contains_vertex_of(start_elem,
true));
409 neighbor_set.clear();
410 neighbor_set.insert(start_elem);
412 std::set<T> untested_set, next_untested_set;
413 untested_set.insert(start_elem);
415 while (!untested_set.empty())
419 for (
const auto & elem : untested_set)
420 for (
auto current_neighbor : elem->neighbor_ptr_range())
422 if (current_neighbor &&
423 !current_neighbor->is_remote())
425 if (current_neighbor->active())
427 if (this_elem->contains_vertex_of(current_neighbor,
true)
428 || current_neighbor->contains_vertex_of(this_elem,
true))
431 if (!neighbor_set.count(current_neighbor))
432 next_untested_set.insert (current_neighbor);
435 neighbor_set.insert (current_neighbor);
438 #ifdef LIBMESH_ENABLE_AMR 442 std::vector<T> active_neighbor_children;
444 current_neighbor->active_family_tree_by_neighbor
445 (active_neighbor_children, elem);
447 for (
const auto & current_child : active_neighbor_children)
449 if (this_elem->contains_vertex_of(current_child,
true) ||
450 current_child->contains_vertex_of(this_elem,
true))
453 if (!neighbor_set.count(current_child))
454 next_untested_set.insert (current_child);
456 neighbor_set.insert (current_child);
460 #endif // #ifdef LIBMESH_ENABLE_AMR 463 untested_set.swap(next_untested_set);
464 next_untested_set.clear();
473 std::set<T> & neighbor_set)
475 neighbor_set.clear();
477 if ((this_elem->dim() >= LIBMESH_DIM) ||
478 !this_elem->interior_parent())
481 T ip = this_elem->interior_parent();
483 this_elem->contains_vertex_of(ip,
true));
487 #ifdef LIBMESH_ENABLE_AMR 488 while (!ip->active())
490 for (
auto & child : ip->child_ref_range())
492 if (child.contains_vertex_of(this_elem,
true) ||
493 this_elem->contains_vertex_of(&child,
true))
513 auto it = neighbor_set.begin();
514 const auto end = neighbor_set.end();
519 T current_elem = *current;
523 if (current_elem->level() > this_elem->level())
525 unsigned int vertices_contained = 0;
526 for (
auto & n : current_elem->node_ref_range())
527 if (this_elem->contains_point(n))
528 vertices_contained++;
530 if (vertices_contained <= this_elem->
dim())
532 neighbor_set.erase(current);
538 for (
auto & n : this_elem->node_ref_range())
540 if (!current_elem->contains_point(n))
542 neighbor_set.erase(current);
void total_family_tree(T elem, std::vector< T > &family, bool reset)
void find_interior_neighbors(T this_elem, std::set< T > &neighbor_set)
void total_family_tree_by_neighbor(T elem, std::vector< T > &family, T neighbor_in, bool reset=true)
void active_family_tree_by_neighbor(T elem, std::vector< T > &family, T neighbor_in, bool reset=true)
void active_family_tree(T elem, std::vector< T > &active_family, bool reset=true)
We're using a class instead of a typedef to allow forward declarations and future flexibility...
void active_family_tree_by_side(T elem, std::vector< T > &family, unsigned int side, bool reset=true)
The libMesh namespace provides an interface to certain functionality in the library.
This is the MeshBase class.
void family_tree_by_neighbor(T elem, std::vector< T > &family, T neighbor_in, bool reset=true)
void family_tree(T elem, std::vector< T > &family, bool reset=true)
This is the base class for point locators.
void family_tree_by_subneighbor(T elem, std::vector< T > &family, T neighbor_in, T subneighbor, bool reset=true)
void find_point_neighbors(T this_elem, std::set< T > &neighbor_set, T start_elem)
void family_tree_by_side(T elem, std::vector< T > &family, unsigned int s, bool reset)
void total_family_tree_by_subneighbor(T elem, std::vector< T > &family, T neighbor_in, T subneighbor, bool reset=true)
void active_family_tree_by_topological_neighbor(T elem, std::vector< T > &family, T neighbor_in, const MeshBase &mesh, const PointLocatorBase &point_locator, const PeriodicBoundaries *pb, bool reset=true)