]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add RPE::all_points_found() and ::valid_point_masks() 13547/head
authorPeter Munch <peterrmuench@gmail.com>
Wed, 16 Mar 2022 21:10:45 +0000 (22:10 +0100)
committerPeter Munch <peterrmuench@gmail.com>
Thu, 24 Mar 2022 16:54:17 +0000 (17:54 +0100)
include/deal.II/base/mpi_remote_point_evaluation.h
include/deal.II/numerics/vector_tools_evaluate.h
source/base/mpi_remote_point_evaluation.cc

index 87665dd88a16187acdc649f80956bb08649bbcf3..cf1429a536268db6baba284ba9dc821ded312ac4 100644 (file)
@@ -74,6 +74,9 @@ namespace Utilities
        *
        * @warning This is a collective call that needs to be executed by all
        *   processors in the communicator.
+       *
+       * @note If you want to be sure that all points have been found, call
+       *   all_points_found() after calling this function.
        */
       void
       reinit(const std::vector<Point<spacedim>> &points,
@@ -156,6 +159,18 @@ namespace Utilities
       bool
       is_map_unique() const;
 
+      /**
+       * Return if all points could be found in the domain.
+       */
+      bool
+      all_points_found() const;
+
+      /**
+       * Return if point @p i could be found in the domain.
+       */
+      bool
+      point_found(const unsigned int i) const;
+
       /**
        * Return the Triangulation object used during reinit().
        */
index 53148451b93f28bad2c6d2eacdbd320723992880..22bb95a6729f944ca65839c6fcb1066ca3ac8a33 100644 (file)
@@ -108,6 +108,11 @@ namespace VectorTools
    *   cache, dof_handler_2, vector_2);
    * @endcode
    *
+   * @note If a point cannot be found, the result for these points will
+   *   be undefined (most probably 0). If you want to be sure that all
+   *   points received a valid result, call `cache.all_points_found()`
+   *   after this function call.
+   *
    * @warning This is a collective call that needs to be executed by all
    *   processors in the communicator.
    */
index 404f15e6b062f26673e52aebebbd0997a9231272..2f059ffb6c643f6e909fdc439035616d7ac793a6 100644 (file)
@@ -185,6 +185,33 @@ namespace Utilities
 
 
 
+    template <int dim, int spacedim>
+    bool
+    RemotePointEvaluation<dim, spacedim>::all_points_found() const
+    {
+      if (is_map_unique())
+        return true;
+
+      for (unsigned int i = 1; i < point_ptrs.size(); ++i)
+        if (point_found(i) == false)
+          return false;
+
+      return true;
+    }
+
+
+
+    template <int dim, int spacedim>
+    bool
+    RemotePointEvaluation<dim, spacedim>::point_found(
+      const unsigned int i) const
+    {
+      AssertIndexRange(i, point_ptrs.size());
+      return (point_ptrs[i] - point_ptrs[i - 1]) > 0;
+    }
+
+
+
     template <int dim, int spacedim>
     const Triangulation<dim, spacedim> &
     RemotePointEvaluation<dim, spacedim>::get_triangulation() const

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.