Skip to content

Commit

Permalink
Merge pull request #15055 from peterrum/assert_ghosts_set
Browse files Browse the repository at this point in the history
Add assert
  • Loading branch information
kronbichler committed Apr 9, 2023
2 parents 6288d4d + 9ceab74 commit 1817937
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions include/deal.II/matrix_free/matrix_free.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -3461,7 +3461,7 @@ namespace internal
std::is_same<Number, typename VectorType::value_type>::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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1817937

Please sign in to comment.