From 08fdd82f0f34ed3126f9e8d7ded7b9566d7f10b3 Mon Sep 17 00:00:00 2001 From: Niklas Fehn Date: Thu, 4 Jun 2020 17:03:29 +0200 Subject: [PATCH] fix bug in find_active_cell_around_point_tolerance() --- source/grid/grid_tools_dof_handlers.cc | 74 +++++++++++++------------- 1 file changed, 38 insertions(+), 36 deletions(-) diff --git a/source/grid/grid_tools_dof_handlers.cc b/source/grid/grid_tools_dof_handlers.cc index 059bf89b50..5b0a44fcea 100644 --- a/source/grid/grid_tools_dof_handlers.cc +++ b/source/grid/grid_tools_dof_handlers.cc @@ -465,45 +465,47 @@ namespace GridTools endc = adjacent_cells.end(); for (; cell != endc; ++cell) { - try + if ((*cell)->is_locally_owned()) { - const Point 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::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 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::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:: + 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::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 } } -- 2.39.5