20 #include "libmesh/ghost_point_neighbors.h" 22 #include "libmesh/elem.h" 23 #include "libmesh/remote_elem.h" 24 #ifdef LIBMESH_ENABLE_PERIODIC 25 #include "libmesh/periodic_boundaries.h" 26 #include "libmesh/boundary_info.h" 30 #include <unordered_set> 37 void GhostPointNeighbors::operator()
45 #ifdef LIBMESH_ENABLE_PERIODIC 46 const bool check_periodic_bcs =
47 (_periodic_bcs && !_periodic_bcs->empty());
49 auto * db = _mesh->get_disjoint_neighbor_boundary_pairs();
50 const bool check_disjoint_bcs = (db && !db->empty());
52 std::unique_ptr<PointLocatorBase> point_locator;
53 if (check_periodic_bcs || check_disjoint_bcs)
54 point_locator = _mesh->sub_point_locator();
56 std::set<const Elem *> periodic_elems_examined;
58 std::vector<boundary_id_type> appn_bcids;
59 std::vector<const Elem *> active_periodic_neighbors;
76 std::unordered_set<const Elem *> interior_parents;
92 for (
const auto & elem :
as_range(range_begin, range_end))
96 if (elem->processor_id() != p)
97 coupled_elements.emplace(elem, nullcm);
99 std::set<const Elem *> elem_point_neighbors;
100 elem->find_point_neighbors(elem_point_neighbors);
102 for (
const auto & neigh : elem_point_neighbors)
103 if (neigh->processor_id() != p)
104 coupled_elements.emplace(neigh, nullcm);
115 _mesh->query_elem_ptr(ip->
id()) == ip)
116 coupled_elements.emplace(ip, nullcm);
118 #ifdef LIBMESH_ENABLE_PERIODIC 119 if (check_periodic_bcs)
121 for (
const auto s : elem->side_index_range())
123 if (elem->neighbor_ptr(s))
127 (s, *_mesh, *point_locator, _periodic_bcs);
129 if (!equal_level_periodic_neigh || equal_level_periodic_neigh ==
remote_elem)
132 #ifdef LIBMESH_ENABLE_AMR 134 active_periodic_neighbors,
141 active_periodic_neighbors = { equal_level_periodic_neigh };
144 for (
const Elem *
const active_periodic_neigh : active_periodic_neighbors)
146 std::set <const Elem *> active_periodic_point_neighbors;
153 for (
const Elem *
const appn : active_periodic_point_neighbors)
158 periodic_elems_examined.count(appn))
162 bool on_periodic_boundary =
false;
163 for (
const auto appn_s : appn->side_index_range())
166 for (
const auto appn_bcid : appn_bcids)
167 if (_periodic_bcs->find(appn_bcid) != _periodic_bcs->end())
169 on_periodic_boundary =
true;
174 if (on_periodic_boundary)
175 coupled_elements.emplace(appn, nullcm);
177 periodic_elems_examined.insert(appn);
183 if (check_disjoint_bcs)
186 for (
auto s : elem->side_index_range())
188 for (
const auto & [
id, boundary_ptr] : *db)
190 if (!_mesh->get_boundary_info().has_boundary_id(elem, s,
id))
195 db->neighbor(
id, *point_locator, elem, s, &neigh_side);
201 coupled_elements.emplace(neigh, nullcm);
206 #endif // LIBMESH_ENABLE_PERIODIC 214 #ifdef LIBMESH_ENABLE_PERIODIC 215 const bool check_periodic_bcs =
219 const bool check_disjoint_bcs = (db && !db->empty());
221 if (!check_periodic_bcs && !check_disjoint_bcs)
void active_family_tree_by_topological_neighbor(std::vector< const Elem *> &family, const Elem *neighbor, const MeshBase &mesh, const PointLocatorBase &point_locator, const PeriodicBoundaries *pb, bool reset=true) const
Same as the active_family_tree_by_neighbor() member, but the neighbor here may be a topological (e...
virtual void mesh_reinit()
GhostingFunctor subclasses which cache data will need to initialize that cache.
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
std::unique_ptr< PointLocatorBase > sub_point_locator() const
const Elem * interior_parent() const
const Elem * topological_neighbor(const unsigned int i, const MeshBase &mesh, const PointLocatorBase &point_locator, const PeriodicBoundaries *pb) const
The definition of the const_element_iterator struct.
This is the base class from which all geometric element types are derived.
const PeriodicBoundaries * _periodic_bcs
void boundary_ids(const Node *node, std::vector< boundary_id_type > &vec_to_fill) const
Fills a user-provided std::vector with the boundary ids associated with Node node.
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
PeriodicBoundaries * get_disjoint_neighbor_boundary_pairs()
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
Helper function that allows us to treat a homogenous pair as a range.
void find_point_neighbors(const Point &p, std::set< const Elem *> &neighbor_set) const
This function finds all active elements (including this one) which are in the same manifold as this e...
The BoundaryInfo class contains information relevant to boundary conditions including storing faces...
processor_id_type processor_id() const
This class defines a coupling matrix.
const RemoteElem * remote_elem