From 086cc908f1a9e5897ab4d593ccb5f813c9b337e5 Mon Sep 17 00:00:00 2001 From: Magdalena Schreter Date: Sun, 17 Sep 2023 22:31:53 +0200 Subject: [PATCH] add alternative interfaces for RemotePointEvaluation::evaluate_and_process and ::process_and_evaluate --- .../changes/minor/20230917SchreterMunch_2 | 4 ++ .../base/mpi_remote_point_evaluation.h | 52 +++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 doc/news/changes/minor/20230917SchreterMunch_2 diff --git a/doc/news/changes/minor/20230917SchreterMunch_2 b/doc/news/changes/minor/20230917SchreterMunch_2 new file mode 100644 index 0000000000..e8c180d843 --- /dev/null +++ b/doc/news/changes/minor/20230917SchreterMunch_2 @@ -0,0 +1,4 @@ +New: Add alternative interfaces to RemotePointEvaluation::evaluate_and_proecss and +RemotePointEvaluation::process_and_evaluate. +
+(Magdalena Schreter, Peter Munch, 2023/09/17) diff --git a/include/deal.II/base/mpi_remote_point_evaluation.h b/include/deal.II/base/mpi_remote_point_evaluation.h index 24f7d837a6..af7de52437 100644 --- a/include/deal.II/base/mpi_remote_point_evaluation.h +++ b/include/deal.II/base/mpi_remote_point_evaluation.h @@ -161,6 +161,16 @@ namespace Utilities const std::function &, const CellData &)> &evaluation_function) const; + /** + * Same as above but with the result provided as return value and + * without external allocation of a user-provided buffer. + */ + template + std::vector + evaluate_and_process( + const std::function &, const CellData &)> + &evaluation_function) const; + /** * This method is the inverse of the method evaluate_and_process(). It * makes the data at the points, provided by @p input, available in the @@ -177,6 +187,17 @@ namespace Utilities const std::function &, const CellData &)> &evaluation_function) const; + /** + * Same as above but without external allocation of a user-provided + * buffer. + */ + template + void + process_and_evaluate( + const std::vector &input, + const std::function &, const CellData &)> + &evaluation_function) const; + /** * Return a CRS-like data structure to determine the position of the * result corresponding a point and the amount. @@ -487,6 +508,23 @@ namespace Utilities } + template + template + std::vector + RemotePointEvaluation::evaluate_and_process( + const std::function &, const CellData &)> + &evaluation_function) const + { + std::vector output; + std::vector buffer; + + this->evaluate_and_process(output, buffer, evaluation_function); + + return output; + } + + + template template void @@ -660,6 +698,20 @@ namespace Utilities #endif } + + + template + template + void + RemotePointEvaluation::process_and_evaluate( + const std::vector &input, + const std::function &, const CellData &)> + &evaluation_function) const + { + std::vector buffer; + this->process_and_evaluate(input, buffer, evaluation_function); + } + } // end of namespace MPI } // end of namespace Utilities -- 2.39.5