it = periodicity_vector.begin();
periodic_end = periodicity_vector.end();
+ const auto begin_cell = this->begin();
+
for (; it < periodic_end; ++it)
{
const cell_iterator first_cell = it->cell[0];
// respective cells of the matching faces in p4est
const unsigned int tree_left =
- coarse_cell_to_p4est_tree_permutation[std::distance(this->begin(),
- first_cell)];
+ coarse_cell_to_p4est_tree_permutation[first_cell->index() -
+ begin_cell->index()];
const unsigned int tree_right =
- coarse_cell_to_p4est_tree_permutation[std::distance(this->begin(),
- second_cell)];
+ coarse_cell_to_p4est_tree_permutation[second_cell->index() -
+ begin_cell->index()];
// p4est wants to know which corner the first corner on
// the face with the lower id is mapped to on the face with
Assert(first_dealii_idx_on_face != numbers::invalid_unsigned_int,
ExcInternalError());
// Now map dealii_idx_on_face according to the orientation
- const unsigned int left_to_right[8][4] = {{0, 2, 1, 3},
- {0, 1, 2, 3},
- {3, 1, 2, 0},
- {3, 2, 1, 0},
- {2, 3, 0, 1},
- {1, 3, 0, 2},
- {1, 0, 3, 2},
- {2, 0, 3, 1}};
- const unsigned int right_to_left[8][4] = {{0, 2, 1, 3},
- {0, 1, 2, 3},
- {3, 1, 2, 0},
- {3, 2, 1, 0},
- {2, 3, 0, 1},
- {2, 0, 3, 1},
- {1, 0, 3, 2},
- {1, 3, 0, 2}};
- const unsigned int second_dealii_idx_on_face =
+ constexpr unsigned int left_to_right[8][4] = {{0, 2, 1, 3},
+ {0, 1, 2, 3},
+ {3, 1, 2, 0},
+ {3, 2, 1, 0},
+ {2, 3, 0, 1},
+ {1, 3, 0, 2},
+ {1, 0, 3, 2},
+ {2, 0, 3, 1}};
+ constexpr unsigned int right_to_left[8][4] = {{0, 2, 1, 3},
+ {0, 1, 2, 3},
+ {3, 1, 2, 0},
+ {3, 2, 1, 0},
+ {2, 3, 0, 1},
+ {2, 0, 3, 1},
+ {1, 0, 3, 2},
+ {1, 3, 0, 2}};
+ const unsigned int second_dealii_idx_on_face =
lower_idx == 0 ? left_to_right[it->orientation.to_ulong()]
[first_dealii_idx_on_face] :
right_to_left[it->orientation.to_ulong()]