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");
65 #ifdef LIBMESH_ENABLE_PERIODIC 66 bool check_periodic_bcs =
67 (_periodic_bcs && !_periodic_bcs->empty());
68 std::unique_ptr<PointLocatorBase> point_locator;
69 if (check_periodic_bcs)
72 point_locator = _mesh->sub_point_locator();
78 for (
const auto & elem :
as_range(range_begin, range_end))
81 if (elem->processor_id() != p)
82 coupled_elements.emplace(elem, _dof_coupling);
88 typedef std::unordered_set<const Elem*> set_type;
89 set_type next_elements_to_check(range_begin, range_end);
90 set_type elements_to_check;
91 set_type elements_checked;
93 for (
unsigned int i=0; i != this->_n_levels; ++i)
95 elements_to_check.swap(next_elements_to_check);
96 next_elements_to_check.clear();
97 elements_checked.insert(elements_to_check.begin(), elements_to_check.end());
99 for (
const auto & elem : elements_to_check)
101 std::set<const Elem *> point_neighbors;
104 if (elem->processor_id() != p)
105 coupled_elements.emplace(elem, _dof_coupling);
107 #ifdef LIBMESH_ENABLE_PERIODIC 109 if (check_periodic_bcs)
111 libmesh_not_implemented();
116 elem->find_point_neighbors(point_neighbors);
119 for (
const auto & neighbor : point_neighbors)
121 if (!elements_checked.count(neighbor))
122 next_elements_to_check.insert(neighbor);
124 if (neighbor->processor_id() != p)
125 coupled_elements.emplace(neighbor, _dof_coupling);
std::unique_ptr< PointLocatorBase > sub_point_locator() const
The definition of the const_element_iterator struct.
std::map< const Elem *, const CouplingMatrix *, CompareDofObjectsByPIDAndThenID > map_type
What elements do we care about and what variables do we care about on each element?
The libMesh namespace provides an interface to certain functionality in the library.
uint8_t processor_id_type
const PeriodicBoundaries * _periodic_bcs
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
Helper function that allows us to treat a homogenous pair as a range.
virtual void mesh_reinit() override
If we have periodic boundaries, then we'll need the mesh to have an updated point locator whenever we...