28 #include <unordered_set> 37 #ifdef LIBMESH_ENABLE_PERIODIC 43 libmesh_assert(
_mesh);
53 void PointNeighborCoupling::operator()
59 LOG_SCOPE(
"operator()",
"PointNeighborCoupling");
61 #ifdef LIBMESH_ENABLE_PERIODIC 62 bool check_periodic_bcs =
63 (_periodic_bcs && !_periodic_bcs->empty());
64 std::unique_ptr<PointLocatorBase> point_locator;
65 if (check_periodic_bcs)
67 libmesh_assert(_mesh);
68 point_locator = _mesh->sub_point_locator();
74 for (
const auto & elem :
as_range(range_begin, range_end))
75 if (elem->processor_id() != p)
76 coupled_elements.insert (std::make_pair(elem,_dof_coupling));
81 typedef std::unordered_set<const Elem*> set_type;
82 set_type next_elements_to_check(range_begin, range_end);
83 set_type elements_to_check;
84 set_type elements_checked;
86 for (
unsigned int i=0; i != this->_n_levels; ++i)
88 elements_to_check.swap(next_elements_to_check);
89 next_elements_to_check.clear();
90 elements_checked.insert(elements_to_check.begin(), elements_to_check.end());
92 for (
const auto & elem : elements_to_check)
94 std::set<const Elem *> point_neighbors;
96 if (elem->processor_id() != p)
97 coupled_elements.insert (std::make_pair(elem,_dof_coupling));
99 #ifdef LIBMESH_ENABLE_PERIODIC 101 if (check_periodic_bcs)
103 libmesh_not_implemented();
108 elem->find_point_neighbors(point_neighbors);
111 for (
const auto & neighbor : point_neighbors)
113 if (!elements_checked.count(neighbor))
114 next_elements_to_check.insert(neighbor);
116 if (neighbor->processor_id() != p)
117 coupled_elements.insert
118 (std::make_pair(neighbor, _dof_coupling));
std::unique_ptr< PointLocatorBase > sub_point_locator() const
uint8_t processor_id_type
const PeriodicBoundaries * _periodic_bcs
SimpleRange< I > as_range(const std::pair< I, I > &p)
std::unordered_map< const Elem *, const CouplingMatrix * > map_type
virtual void mesh_reinit() override