]> https://gitweb.dealii.org/ - dealii.git/commitdiff
add alternative interfaces for RemotePointEvaluation::evaluate_and_process and :... 15996/head
authorMagdalena Schreter <magdalena.schreter@tum.de>
Sun, 17 Sep 2023 20:31:53 +0000 (22:31 +0200)
committerPeter Munch <peterrmuench@gmail.com>
Mon, 18 Sep 2023 09:41:56 +0000 (11:41 +0200)
doc/news/changes/minor/20230917SchreterMunch_2 [new file with mode: 0644]
include/deal.II/base/mpi_remote_point_evaluation.h

diff --git a/doc/news/changes/minor/20230917SchreterMunch_2 b/doc/news/changes/minor/20230917SchreterMunch_2
new file mode 100644 (file)
index 0000000..e8c180d
--- /dev/null
@@ -0,0 +1,4 @@
+New: Add alternative interfaces to RemotePointEvaluation::evaluate_and_proecss and 
+RemotePointEvaluation::process_and_evaluate.
+<br>
+(Magdalena Schreter, Peter Munch, 2023/09/17)
index 24f7d837a6695ffa3ecc735117dddca8d8cf2a6e..af7de524372016392f49bbbe54d9e0f28ced6c36 100644 (file)
@@ -161,6 +161,16 @@ namespace Utilities
         const std::function<void(const ArrayView<T> &, 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 <typename T>
+      std::vector<T>
+      evaluate_and_process(
+        const std::function<void(const ArrayView<T> &, 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<void(const ArrayView<const T> &, const CellData &)>
           &evaluation_function) const;
 
+      /**
+       * Same as above but without external allocation of a user-provided
+       * buffer.
+       */
+      template <typename T>
+      void
+      process_and_evaluate(
+        const std::vector<T> &input,
+        const std::function<void(const ArrayView<const T> &, 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 <int dim, int spacedim>
+    template <typename T>
+    std::vector<T>
+    RemotePointEvaluation<dim, spacedim>::evaluate_and_process(
+      const std::function<void(const ArrayView<T> &, const CellData &)>
+        &evaluation_function) const
+    {
+      std::vector<T> output;
+      std::vector<T> buffer;
+
+      this->evaluate_and_process(output, buffer, evaluation_function);
+
+      return output;
+    }
+
+
+
     template <int dim, int spacedim>
     template <typename T>
     void
@@ -660,6 +698,20 @@ namespace Utilities
 #endif
     }
 
+
+
+    template <int dim, int spacedim>
+    template <typename T>
+    void
+    RemotePointEvaluation<dim, spacedim>::process_and_evaluate(
+      const std::vector<T> &input,
+      const std::function<void(const ArrayView<const T> &, const CellData &)>
+        &evaluation_function) const
+    {
+      std::vector<T> buffer;
+      this->process_and_evaluate(input, buffer, evaluation_function);
+    }
+
   } // end of namespace MPI
 } // end of namespace Utilities
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.