Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve assert message in DictionaryPayLoad #12937

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 16 additions & 10 deletions include/deal.II/base/mpi_compute_index_owner_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ namespace Utilities
, actually_owning_ranks(actually_owning_ranks)
, local_range(local_range)
, actually_owning_rank_list(actually_owning_rank_list)
{}
{
Assert(local_range.first < local_range.second, ExcInternalError());
}

/**
* Implementation of
Expand Down Expand Up @@ -114,15 +116,19 @@ namespace Utilities
for (types::global_dof_index i = interval.first;
i < interval.second;
i++)
Assert(actually_owning_ranks[i - local_range.first] ==
numbers::invalid_unsigned_int,
ExcInternalError());
Assert(interval.first >= local_range.first &&
interval.first < local_range.second,
ExcInternalError());
Assert(interval.second > local_range.first &&
interval.second <= local_range.second,
ExcInternalError());
Assert(
actually_owning_ranks[i - local_range.first] ==
numbers::invalid_unsigned_int,
ExcMessage(
"Multiple processes seem to own the same global index. "
"A possible reason is that the sets of locally owned "
"indices are not distinct."));
Assert(interval.first < interval.second, ExcInternalError());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should move this assertion outside of the loop - it can never trigger in it since this is also the loop bounds.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, nevermind - there are no brackets around the first assert so this is outside the loop!

Assert(
local_range.first <= interval.first &&
interval.second <= local_range.second,
ExcMessage(
"The specified interval is not handled by the current process."));
#endif
std::fill(actually_owning_ranks.data() + interval.first -
local_range.first,
Expand Down