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

Explain the purpose of some computations in CellIDTranslator. #14997

Merged
merged 2 commits into from
Mar 31, 2023
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
11 changes: 11 additions & 0 deletions include/deal.II/grid/cell_id_translator.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ namespace internal
: n_coarse_cells(n_coarse_cells)
, n_global_levels(n_global_levels)
{
// The class stores indices as types::global_cell_index variables,
// but when configuring deal.II with default flags, this is a 32-bit
// data type and it is possible with highly (locally) refined meshes
// that we exceed the maximal 32-bit numbers even with relatively
// modest numbers of cells. Check for this by first calculating
// the maximal index we will get in 64-bit arithmetic and testing
// that it is representable in 32-bit arithmetic:
#ifdef DEBUG
std::uint64_t max_cell_index = 0;

for (unsigned int i = 0; i < n_global_levels; ++i)
Expand All @@ -147,7 +155,10 @@ namespace internal
" indices. You may want to consider to build deal.II with 64bit "
"indices (-D DEAL_II_WITH_64BIT_INDICES=\"ON\") to increase the limit "
"of indices."));
#endif

// Now do the whole computation again, but for real:
tree_sizes.reserve(n_global_levels + 1);
tree_sizes.push_back(0);
for (unsigned int i = 0; i < n_global_levels; ++i)
tree_sizes.push_back(tree_sizes.back() +
Expand Down