21 #include "libmesh/default_coupling.h" 
   22 #include "libmesh/coupling_matrix.h" 
   23 #include "libmesh/elem.h" 
   24 #include "libmesh/periodic_boundaries.h" 
   25 #include "libmesh/remote_elem.h" 
   26 #include "libmesh/int_range.h" 
   27 #include "libmesh/libmesh_logging.h" 
   30 #include <unordered_set> 
   42   if (dof_coupling && dof_coupling->
empty())
 
   57 #ifdef LIBMESH_ENABLE_PERIODIC 
   73 void DefaultCoupling::operator()
 
   79   LOG_SCOPE(
"operator()", 
"DefaultCoupling");
 
   81 #ifdef LIBMESH_ENABLE_PERIODIC 
   82   bool check_periodic_bcs =
 
   83     (_periodic_bcs && !_periodic_bcs->empty());
 
   85   std::unique_ptr<PointLocatorBase> point_locator;
 
   86   if (check_periodic_bcs)
 
   89       point_locator = _mesh->sub_point_locator();
 
   95       for (
const auto & elem : 
as_range(range_begin, range_end))
 
   96         if (elem->processor_id() != p)
 
   97           coupled_elements.insert (std::make_pair(elem,_dof_coupling));
 
  101   typedef std::unordered_set<const Elem*> set_type;
 
  102   set_type next_elements_to_check(range_begin, range_end);
 
  103   set_type elements_to_check;
 
  104   set_type elements_checked;
 
  106   for (
unsigned int i=0; i != this->_n_levels; ++i)
 
  108       elements_to_check.swap(next_elements_to_check);
 
  109       next_elements_to_check.clear();
 
  110       elements_checked.insert(elements_to_check.begin(), elements_to_check.end());
 
  112       for (
const auto & elem : elements_to_check)
 
  114           std::vector<const Elem *> active_neighbors;
 
  116           if (elem->processor_id() != p)
 
  117             coupled_elements.insert (std::make_pair(elem,_dof_coupling));
 
  119           for (
auto s : elem->side_index_range())
 
  133 #ifdef LIBMESH_ENABLE_PERIODIC 
  135               else if (check_periodic_bcs)
 
  140                     (s, *_mesh, *point_locator, _periodic_bcs);
 
  151 #ifdef LIBMESH_ENABLE_AMR 
  154 #  ifdef LIBMESH_ENABLE_PERIODIC 
  157                   (active_neighbors,elem,*_mesh,*point_locator,_periodic_bcs);
 
  160               active_neighbors.clear();
 
  161               active_neighbors.push_back(neigh);
 
  164               for (
const auto & neighbor : active_neighbors)
 
  166                   if (!elements_checked.count(neighbor))
 
  167                     next_elements_to_check.insert(neighbor);
 
  169                   if (neighbor->processor_id() != p)
 
  170                     coupled_elements.insert
 
  171                       (std::make_pair(neighbor, _dof_coupling));