From 886935df02c30e52a9c2a62e03f0bc5e351ecd9c Mon Sep 17 00:00:00 2001 From: Johannes Heinz Date: Fri, 14 Apr 2023 12:50:29 +0200 Subject: [PATCH] specify maked verts and unique mapping in distributed_compute_point_locations Co-authored-by: Martin Kronbichler --- include/deal.II/grid/grid_tools.h | 14 +++++++++++++- source/grid/grid_tools.cc | 16 ++++++++++++---- source/grid/grid_tools.inst.in | 4 +++- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/include/deal.II/grid/grid_tools.h b/include/deal.II/grid/grid_tools.h index f78f1e2c22..adff6853e9 100644 --- a/include/deal.II/grid/grid_tools.h +++ b/include/deal.II/grid/grid_tools.h @@ -1108,6 +1108,16 @@ namespace GridTools * of the cells adjacent to a vertex or an edge/face this function returns. * Consequently, algorithms that call this function need to take into * account that the returned cell will only contain the point approximately. + * @param[in] enforce_unique_mapping Enforce a one to one mapping between + points + * in real and reference space. + * @param[in] marked_vertices An array of bools indicating which + * vertices of @p mesh will be considered within the search + * as the potentially closest vertex. On receiving a non-empty + * @p marked_vertices, the function will + * only search among @p marked_vertices for the closest vertex, + * otherwise on all vertices in the mesh. + * @return A tuple containing the quadrature information * * The elements of the output tuple are: @@ -1164,7 +1174,9 @@ namespace GridTools const GridTools::Cache & cache, const std::vector> & local_points, const std::vector>> &global_bboxes, - const double tolerance = 1e-10); + const double tolerance = 1e-10, + const std::vector & marked_vertices = {}, + const bool enforce_unique_mapping = true); namespace internal { diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index c6854b732d..4196e29fa8 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -5924,12 +5924,20 @@ namespace GridTools const GridTools::Cache & cache, const std::vector> & points, const std::vector>> &global_bboxes, - const double tolerance) + const double tolerance, + const std::vector & marked_vertices, + const bool enforce_unique_mapping) { // run internal function ... - const auto all = internal::distributed_compute_point_locations( - cache, points, global_bboxes, {}, tolerance, false, true) - .send_components; + const auto all = + internal::distributed_compute_point_locations(cache, + points, + global_bboxes, + marked_vertices, + tolerance, + false, + enforce_unique_mapping) + .send_components; // ... and reshuffle the data std::tuple< diff --git a/source/grid/grid_tools.inst.in b/source/grid/grid_tools.inst.in index 4d22dc0060..ec06814639 100644 --- a/source/grid/grid_tools.inst.in +++ b/source/grid/grid_tools.inst.in @@ -137,7 +137,9 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) const Cache &, const std::vector> &, const std::vector>> &, - const double tolerance); + const double tolerance, + const std::vector &marked_vertices, + const bool enforce_unique_mapping); template internal::DistributedComputePointLocationsInternal< deal_II_dimension, -- 2.39.5