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 bool check_periodic_bcs =
47 (_periodic_bcs && !_periodic_bcs->empty());
49 std::unique_ptr<PointLocatorBase> point_locator;
50 if (check_periodic_bcs)
51 point_locator = _mesh->sub_point_locator();
53 std::set<const Elem *> periodic_elems_examined;
55 std::vector<boundary_id_type> appn_bcids;
56 std::vector<const Elem *> active_periodic_neighbors;
73 std::unordered_set<const Elem *> interior_parents;
89 for (
const auto & elem :
as_range(range_begin, range_end))
93 if (elem->processor_id() != p)
94 coupled_elements.emplace(elem, nullcm);
96 std::set<const Elem *> elem_point_neighbors;
97 elem->find_point_neighbors(elem_point_neighbors);
99 for (
const auto & neigh : elem_point_neighbors)
100 if (neigh->processor_id() != p)
101 coupled_elements.emplace(neigh, nullcm);
112 _mesh->query_elem_ptr(ip->
id()) == ip)
113 coupled_elements.emplace(ip, nullcm);
115 #ifdef LIBMESH_ENABLE_PERIODIC 116 if (check_periodic_bcs)
118 for (
const auto s : elem->side_index_range())
120 if (elem->neighbor_ptr(s))
124 (s, *_mesh, *point_locator, _periodic_bcs);
126 if (!equal_level_periodic_neigh || equal_level_periodic_neigh ==
remote_elem)
129 #ifdef LIBMESH_ENABLE_AMR 131 active_periodic_neighbors,
138 active_periodic_neighbors = { equal_level_periodic_neigh };
141 for (
const Elem *
const active_periodic_neigh : active_periodic_neighbors)
143 std::set <const Elem *> active_periodic_point_neighbors;
150 for (
const Elem *
const appn : active_periodic_point_neighbors)
155 periodic_elems_examined.count(appn))
159 bool on_periodic_boundary =
false;
160 for (
const auto appn_s : appn->side_index_range())
163 for (
const auto appn_bcid : appn_bcids)
164 if (_periodic_bcs->find(appn_bcid) != _periodic_bcs->end())
166 on_periodic_boundary =
true;
171 if (on_periodic_boundary)
172 coupled_elements.emplace(appn, nullcm);
174 periodic_elems_examined.insert(appn);
179 #endif // LIBMESH_ENABLE_PERIODIC 187 #ifdef LIBMESH_ENABLE_PERIODIC 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.
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
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