]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Compare pointers in find_vector_in_mf 12033/head
authorPeter Munch <peterrmuench@gmail.com>
Fri, 9 Apr 2021 19:45:51 +0000 (21:45 +0200)
committerPeter Munch <peterrmuench@gmail.com>
Fri, 9 Apr 2021 19:45:51 +0000 (21:45 +0200)
include/deal.II/matrix_free/matrix_free.h

index b1a8d27fe22c9789bf369cd0df4c63e20ec48347..ccfb460c30bd9193487bda47354bd3ff8ad16e36 100644 (file)
@@ -3279,16 +3279,19 @@ namespace internal
     find_vector_in_mf(const VectorType &vec,
                       const bool        check_global_compatibility = true) const
     {
-      (void)check_global_compatibility;
+      // case 1: vector was set up with MatrixFree::initialize_dof_vector()
       for (unsigned int c = 0; c < matrix_free.n_components(); ++c)
-        if (
-#  ifdef DEBUG
-          check_global_compatibility ?
-            vec.get_partitioner()->is_globally_compatible(
-              *matrix_free.get_dof_info(c).vector_partitioner) :
-#  endif
-            vec.get_partitioner()->is_compatible(
-              *matrix_free.get_dof_info(c).vector_partitioner))
+        if (vec.get_partitioner().get() ==
+            matrix_free.get_dof_info(c).vector_partitioner.get())
+          return c;
+
+      // case 2: user provided own partitioner (compatibility mode)
+      for (unsigned int c = 0; c < matrix_free.n_components(); ++c)
+        if (check_global_compatibility ?
+              vec.get_partitioner()->is_globally_compatible(
+                *matrix_free.get_dof_info(c).vector_partitioner) :
+              vec.get_partitioner()->is_compatible(
+                *matrix_free.get_dof_info(c).vector_partitioner))
           return c;
 
       Assert(false,

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.