]> https://gitweb.dealii.org/ - dealii.git/commitdiff
fix bug in find_active_cell_around_point_tolerance()
authorNiklas Fehn <fehn@lnm.mw.tum.de>
Thu, 4 Jun 2020 15:03:29 +0000 (17:03 +0200)
committerNiklas Fehn <fehn@lnm.mw.tum.de>
Thu, 4 Jun 2020 15:03:29 +0000 (17:03 +0200)
source/grid/grid_tools_dof_handlers.cc

index 059bf89b50c50a9cdacff79cec6de31804146cbf..5b0a44fceaf147a0e83a422d69e478e1f72a5e41 100644 (file)
@@ -465,45 +465,47 @@ namespace GridTools
             endc = adjacent_cells.end();
           for (; cell != endc; ++cell)
             {
-              try
+              if ((*cell)->is_locally_owned())
                 {
-                  const Point<dim> p_cell =
-                    mapping.transform_real_to_unit_cell(*cell, p);
-
-                  // calculate the infinity norm of
-                  // the distance vector to the unit cell.
-                  const double dist =
-                    GeometryInfo<dim>::distance_to_unit_cell(p_cell);
-
-                  // We compare if the point is inside the
-                  // unit cell (or at least not too far
-                  // outside). If it is, it is also checked
-                  // that the cell has a more refined state
-                  if ((dist < best_distance) ||
-                      ((dist == best_distance) &&
-                       ((*cell)->level() > best_level)))
+                  try
                     {
-                      found         = true;
-                      best_distance = dist;
-                      best_level    = (*cell)->level();
-                      best_cell     = std::make_pair(*cell, p_cell);
+                      const Point<dim> p_cell =
+                        mapping.transform_real_to_unit_cell(*cell, p);
+
+                      // calculate the infinity norm of
+                      // the distance vector to the unit cell.
+                      const double dist =
+                        GeometryInfo<dim>::distance_to_unit_cell(p_cell);
+
+                      // We compare if the point is inside the
+                      // unit cell (or at least not too far
+                      // outside). If it is, it is also checked
+                      // that the cell has a more refined state
+                      if ((dist < best_distance) ||
+                          ((dist == best_distance) &&
+                           ((*cell)->level() > best_level)))
+                        {
+                          found         = true;
+                          best_distance = dist;
+                          best_level    = (*cell)->level();
+                          best_cell     = std::make_pair(*cell, p_cell);
+                        }
+                    }
+                  catch (typename MappingQGeneric<dim, spacedim>::
+                           ExcTransformationFailed &)
+                    {
+                      // ok, the transformation
+                      // failed presumably
+                      // because the point we
+                      // are looking for lies
+                      // outside the current
+                      // cell. this means that
+                      // the current cell can't
+                      // be the cell around the
+                      // point, so just ignore
+                      // this cell and move on
+                      // to the next
                     }
-                }
-              catch (
-                typename MappingQGeneric<dim, spacedim>::ExcTransformationFailed
-                  &)
-                {
-                  // ok, the transformation
-                  // failed presumably
-                  // because the point we
-                  // are looking for lies
-                  // outside the current
-                  // cell. this means that
-                  // the current cell can't
-                  // be the cell around the
-                  // point, so just ignore
-                  // this cell and move on
-                  // to the next
                 }
             }
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.