From: Peter Munch Date: Fri, 9 Apr 2021 19:45:51 +0000 (+0200) Subject: Compare pointers in find_vector_in_mf X-Git-Tag: v9.3.0-rc1~232^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=994f6a18054f8bc915a213f6faa2eebdd8db693a;p=dealii.git Compare pointers in find_vector_in_mf --- diff --git a/include/deal.II/matrix_free/matrix_free.h b/include/deal.II/matrix_free/matrix_free.h index b1a8d27fe2..ccfb460c30 100644 --- a/include/deal.II/matrix_free/matrix_free.h +++ b/include/deal.II/matrix_free/matrix_free.h @@ -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,