21 #include "libmesh/point_neighbor_coupling.h"
23 #include "libmesh/elem.h"
24 #include "libmesh/periodic_boundaries.h"
25 #include "libmesh/remote_elem.h"
26 #include "libmesh/libmesh_logging.h"
29 #include <unordered_set>
38 #ifdef LIBMESH_ENABLE_PERIODIC
54 void PointNeighborCoupling::operator()
60 LOG_SCOPE(
"operator()",
"PointNeighborCoupling");
62 #ifdef LIBMESH_ENABLE_PERIODIC
63 bool check_periodic_bcs =
64 (_periodic_bcs && !_periodic_bcs->empty());
65 std::unique_ptr<PointLocatorBase> point_locator;
66 if (check_periodic_bcs)
69 point_locator = _mesh->sub_point_locator();
75 for (
const auto & elem :
as_range(range_begin, range_end))
76 if (elem->processor_id() != p)
77 coupled_elements.insert (std::make_pair(elem,_dof_coupling));
82 typedef std::unordered_set<const Elem*> set_type;
83 set_type next_elements_to_check(range_begin, range_end);
84 set_type elements_to_check;
85 set_type elements_checked;
87 for (
unsigned int i=0; i != this->_n_levels; ++i)
89 elements_to_check.swap(next_elements_to_check);
90 next_elements_to_check.clear();
91 elements_checked.insert(elements_to_check.begin(), elements_to_check.end());
93 for (
const auto & elem : elements_to_check)
95 std::set<const Elem *> point_neighbors;
97 if (elem->processor_id() != p)
98 coupled_elements.insert (std::make_pair(elem,_dof_coupling));
100 #ifdef LIBMESH_ENABLE_PERIODIC
102 if (check_periodic_bcs)
104 libmesh_not_implemented();
109 elem->find_point_neighbors(point_neighbors);
112 for (
const auto & neighbor : point_neighbors)
114 if (!elements_checked.count(neighbor))
115 next_elements_to_check.insert(neighbor);
117 if (neighbor->processor_id() != p)
118 coupled_elements.insert
119 (std::make_pair(neighbor, _dof_coupling));