From 35bcab8a519beef3d76d2856d861c69d57f41ff6 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Fri, 28 Dec 2018 21:34:04 +0100 Subject: [PATCH] Fix grid/distributed_compute_point_locations_02 --- .../distributed_compute_point_locations_02.cc | 56 +++++++++++-------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/tests/grid/distributed_compute_point_locations_02.cc b/tests/grid/distributed_compute_point_locations_02.cc index 14a406ee2a..13a7377b3c 100644 --- a/tests/grid/distributed_compute_point_locations_02.cc +++ b/tests/grid/distributed_compute_point_locations_02.cc @@ -93,34 +93,42 @@ test_compute_pt_loc(unsigned int ref_cube, unsigned int ref_sphere) // Store the point only if it is inside a locally owned sphere cell if (cell->subdomain_id() == my_rank) loc_owned_points.emplace_back(center_pt); - // Find the cube cell where center pt lies - auto my_pair = GridTools::find_active_cell_around_point(cache, center_pt); - // If it is inside a locally owned cell it shall be returned - // from distributed compute point locations - if (my_pair.first->is_locally_owned()) + try { - computed_pts++; - auto cells_it = std::find(computed_cells.begin(), - computed_cells.end(), - my_pair.first); - - if (cells_it == computed_cells.end()) + // Find the cube cell where center pt lies + auto my_pair = + GridTools::find_active_cell_around_point(cache, center_pt); + // If it is inside a locally owned cell it shall be returned + // from distributed compute point locations + if (my_pair.first->is_locally_owned()) { - // Cell not found: adding a new cell - computed_cells.emplace_back(my_pair.first); - computed_qpoints.emplace_back(1, my_pair.second); - computed_points.emplace_back(1, center_pt); - computed_ranks.emplace_back(1, cell->subdomain_id()); - } - else - { - // Cell found: just adding the point index and qpoint to the list - unsigned int current_cell = cells_it - computed_cells.begin(); - computed_qpoints[current_cell].emplace_back(my_pair.second); - computed_points[current_cell].emplace_back(center_pt); - computed_ranks[current_cell].emplace_back(cell->subdomain_id()); + computed_pts++; + auto cells_it = std::find(computed_cells.begin(), + computed_cells.end(), + my_pair.first); + + if (cells_it == computed_cells.end()) + { + // Cell not found: adding a new cell + computed_cells.emplace_back(my_pair.first); + computed_qpoints.emplace_back(1, my_pair.second); + computed_points.emplace_back(1, center_pt); + computed_ranks.emplace_back(1, cell->subdomain_id()); + } + else + { + // Cell found: just adding the point index and qpoint to the + // list + unsigned int current_cell = cells_it - computed_cells.begin(); + computed_qpoints[current_cell].emplace_back(my_pair.second); + computed_points[current_cell].emplace_back(center_pt); + computed_ranks[current_cell].emplace_back( + cell->subdomain_id()); + } } } + catch (const GridTools::ExcPointNotFound &) + {} } // Computing bounding boxes describing the locally owned part of the mesh -- 2.39.5