From: Peter Munch Date: Sat, 8 Apr 2023 16:32:05 +0000 (+0200) Subject: Add assert X-Git-Tag: v9.5.0-rc1~354^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F15055%2Fhead;p=dealii.git Add assert --- 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