From: Johannes Heinz Date: Fri, 29 Dec 2023 09:47:44 +0000 (+0100) Subject: Hand back used quadratures during conversion of intersections to points X-Git-Tag: relicensing~189^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F16391%2Fhead;p=dealii.git Hand back used quadratures during conversion of intersections to points --- diff --git a/doc/news/changes/minor/20231229Heinz b/doc/news/changes/minor/20231229Heinz new file mode 100644 index 0000000000..5ad8dfe1e5 --- /dev/null +++ b/doc/news/changes/minor/20231229Heinz @@ -0,0 +1,6 @@ +Improved: convert_to_distributed_compute_point_locations_internal() takes a pointer to a vector +of quadratures as an additional argument. In case this pointer is not a null pointer, the vector is +populated by the mapped quadratures that are internally used during the conversion. +
+(Johannes Heinz, 2023/12/29) + diff --git a/include/deal.II/grid/grid_tools.h b/include/deal.II/grid/grid_tools.h index 80e6c4104e..81d806d994 100644 --- a/include/deal.II/grid/grid_tools.h +++ b/include/deal.II/grid/grid_tools.h @@ -877,6 +877,11 @@ namespace GridTools * from class members. This can be done without searching for points again * since all information is locally known. * + * @p mapped_quadratures_recv_comp is a pointer to an empty vector of + * mapped quadratures. By default it is a `nullptr` and the parameter is + * ignored. Otherwise, the vector is filled with the mapped quadrature + * rules (in real coordinates) corresponding to recv_components. + * * The parameter @p consistent_numbering_of_sender_and_receiver can be used to ensure * points on sender and receiver side are numbered consistently. * This parameter is optional if DistributedComputePointLocationsInternal @@ -892,6 +897,8 @@ namespace GridTools const unsigned int n_points_1D, const Triangulation &tria, const Mapping &mapping, + std::vector> *mapped_quadratures_recv_comp = + nullptr, const bool consistent_numbering_of_sender_and_receiver = false) const; private: diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index 43b778a793..40da559d17 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -4105,11 +4105,18 @@ namespace GridTools const unsigned int n_points_1D, const Triangulation &tria, const Mapping &mapping, + std::vector> *mapped_quadratures_recv_comp, const bool consistent_numbering_of_sender_and_receiver) const { using CellIterator = typename Triangulation::active_cell_iterator; + if (mapped_quadratures_recv_comp != nullptr) + { + AssertDimension(mapped_quadratures_recv_comp->size(), 0); + mapped_quadratures_recv_comp->reserve(recv_components.size()); + } + GridTools::internal::DistributedComputePointLocationsInternal result; @@ -4141,6 +4148,10 @@ namespace GridTools result.recv_components.size(), // number of point numbers::invalid_unsigned_int); } + + // append quadrature + if (mapped_quadratures_recv_comp != nullptr) + mapped_quadratures_recv_comp->push_back(quad); } // since empty quadratures might be present we have to set the number diff --git a/source/grid/grid_tools.inst.in b/source/grid/grid_tools.inst.in index ea2f87577a..23c56beef6 100644 --- a/source/grid/grid_tools.inst.in +++ b/source/grid/grid_tools.inst.in @@ -193,6 +193,7 @@ for (deal_II_struct_dimension : DIMENSIONS; deal_II_dimension : DIMENSIONS; const unsigned int, const Triangulation &, const Mapping &, + std::vector> *, const bool) const; template internal::DistributedComputeIntersectionLocationsInternal< diff --git a/tests/remote_point_evaluation/convert_intersections_to_rpe_data_01.cc b/tests/remote_point_evaluation/convert_intersections_to_rpe_data_01.cc index c1e31e45e6..13cb52cf8d 100644 --- a/tests/remote_point_evaluation/convert_intersections_to_rpe_data_01.cc +++ b/tests/remote_point_evaluation/convert_intersections_to_rpe_data_01.cc @@ -99,7 +99,7 @@ do_test(const unsigned int n_quad_points) auto rpe_data = intersection_location .convert_to_distributed_compute_point_locations_internal( - n_quad_points, tria, mapping, true); + n_quad_points, tria, mapping, nullptr, true); deallog << "Recv Components " << std::endl; for (const auto &rc : rpe_data.recv_components) diff --git a/tests/remote_point_evaluation/convert_intersections_to_rpe_data_02.cc b/tests/remote_point_evaluation/convert_intersections_to_rpe_data_02.cc index 88993c0971..518beb66ca 100644 --- a/tests/remote_point_evaluation/convert_intersections_to_rpe_data_02.cc +++ b/tests/remote_point_evaluation/convert_intersections_to_rpe_data_02.cc @@ -99,7 +99,7 @@ do_test(const unsigned int n_quad_points) auto rpe_data = intersection_location .convert_to_distributed_compute_point_locations_internal( - n_quad_points, tria, mapping, true); + n_quad_points, tria, mapping, nullptr, true); deallog << "Recv Components " << std::endl; for (const auto &rc : rpe_data.recv_components) diff --git a/tests/remote_point_evaluation/convert_intersections_to_rpe_data_03.cc b/tests/remote_point_evaluation/convert_intersections_to_rpe_data_03.cc index d55e666cd3..c070dc142b 100644 --- a/tests/remote_point_evaluation/convert_intersections_to_rpe_data_03.cc +++ b/tests/remote_point_evaluation/convert_intersections_to_rpe_data_03.cc @@ -96,7 +96,7 @@ do_test(const unsigned int n_quad_points) auto rpe_data = intersection_location .convert_to_distributed_compute_point_locations_internal( - n_quad_points, tria, mapping, true); + n_quad_points, tria, mapping, nullptr, true); deallog << "Recv Components " << std::endl; for (const auto &rc : rpe_data.recv_components) diff --git a/tests/remote_point_evaluation/convert_intersections_to_rpe_data_04.cc b/tests/remote_point_evaluation/convert_intersections_to_rpe_data_04.cc index 6bd08f880d..f210ebf5cd 100644 --- a/tests/remote_point_evaluation/convert_intersections_to_rpe_data_04.cc +++ b/tests/remote_point_evaluation/convert_intersections_to_rpe_data_04.cc @@ -96,7 +96,7 @@ do_test(const unsigned int n_quad_points) auto rpe_data = intersection_location .convert_to_distributed_compute_point_locations_internal( - n_quad_points, tria, mapping, true); + n_quad_points, tria, mapping, nullptr, true); deallog << "Recv Components " << std::endl; for (const auto &rc : rpe_data.recv_components) diff --git a/tests/remote_point_evaluation/setup_rpe_with_intersections_02.cc b/tests/remote_point_evaluation/setup_rpe_with_intersections_02.cc index 2abfb15fb8..02caa53cd5 100644 --- a/tests/remote_point_evaluation/setup_rpe_with_intersections_02.cc +++ b/tests/remote_point_evaluation/setup_rpe_with_intersections_02.cc @@ -91,7 +91,7 @@ do_test(const unsigned int n_quad_points) intersection_requests.emplace_back(vertices); } } - std::cout << "CALLING FUNCTION" << std::endl; + auto intersection_location = GridTools::internal::distributed_compute_intersection_locations( cache, @@ -100,15 +100,11 @@ do_test(const unsigned int n_quad_points) std::vector(), 1.0e-9); - std::cout << "FINISHED" << std::endl; - auto rpe_intersection_data = intersection_location .convert_to_distributed_compute_point_locations_internal(n_quad_points, tria, mapping); - std::cout << "WTF" << std::endl; - // setup rpe without additional search dealii::Utilities::MPI::RemotePointEvaluation rpe_intersections; rpe_intersections.reinit(rpe_intersection_data, tria, mapping);