From 9ceab744df77791925d6e822e298479c6b5ad679 Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Sat, 8 Apr 2023 18:32:05 +0200 Subject: [PATCH] Add assert --- include/deal.II/matrix_free/matrix_free.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/include/deal.II/matrix_free/matrix_free.h b/include/deal.II/matrix_free/matrix_free.h index d969089157..78fb2426bb 100644 --- a/include/deal.II/matrix_free/matrix_free.h +++ b/include/deal.II/matrix_free/matrix_free.h @@ -3401,7 +3401,7 @@ namespace internal const VectorType & vec) { (void)component_in_block_vector; - bool ghosts_set = vec.has_ghost_elements(); + const bool ghosts_set = vec.has_ghost_elements(); Assert(matrix_free.get_task_info().allow_ghosted_vectors_in_loops || ghosts_set == false, @@ -3429,7 +3429,7 @@ namespace internal const VectorType & vec) { (void)component_in_block_vector; - bool ghosts_set = vec.has_ghost_elements(); + const bool ghosts_set = vec.has_ghost_elements(); Assert(matrix_free.get_task_info().allow_ghosted_vectors_in_loops || ghosts_set == false, @@ -3461,7 +3461,7 @@ namespace internal std::is_same::value, "Type mismatch between VectorType and VectorDataExchange"); (void)component_in_block_vector; - bool ghosts_set = vec.has_ghost_elements(); + const bool ghosts_set = vec.has_ghost_elements(); Assert(matrix_free.get_task_info().allow_ghosted_vectors_in_loops || ghosts_set == false, @@ -4078,9 +4078,16 @@ namespace internal { if (get_communication_block_size(vec) < vec.n_blocks()) { - // don't forget to set ghosts_were_set, that otherwise happens - // inside VectorDataExchange::update_ghost_values_start() - exchanger.ghosts_were_set = vec.has_ghost_elements(); + const bool ghosts_set = vec.has_ghost_elements(); + + Assert(exchanger.matrix_free.get_task_info() + .allow_ghosted_vectors_in_loops || + ghosts_set == false, + ExcNotImplemented()); + + if (ghosts_set) + exchanger.ghosts_were_set = true; + vec.update_ghost_values(); } else -- 2.39.5