if (cell->level() != 0)
set_user_flag_and_of_its_parents(cell->parent());
}
-
-
- /**
- * Convert the binary representation of a CellId to coarse-cell id as
- * if the finest level were the coarsest level ("level coarse-grid id").
- */
- template <int dim>
- types::coarse_cell_id
- convert_cell_id_binary_type_to_level_coarse_cell_id(
- const typename CellId::binary_type &binary_representation)
- {
- // exploiting the structure of CellId::binary_type
- // see also the documentation of CellId
-
- // actual coarse-grid id
- const unsigned int coarse_cell_id = binary_representation[0];
- const unsigned int n_child_indices = binary_representation[1] >> 2;
-
- const unsigned int children_per_value =
- sizeof(CellId::binary_type::value_type) * 8 / dim;
- unsigned int child_level = 0;
- unsigned int binary_entry = 2;
-
- // path to the get to the cell
- std::vector<unsigned int> cell_indices;
- while (child_level < n_child_indices)
- {
- Assert(binary_entry < binary_representation.size(),
- ExcInternalError());
-
- for (unsigned int j = 0; j < children_per_value; ++j)
- {
- unsigned int cell_index =
- (((binary_representation[binary_entry] >> (j * dim))) &
- (GeometryInfo<dim>::max_children_per_cell - 1));
- cell_indices.push_back(cell_index);
- ++child_level;
- if (child_level == n_child_indices)
- break;
- }
- ++binary_entry;
- }
-
- // compute new coarse-grid id: c_{i+1} = c_{i}*2^dim + q;
- types::coarse_cell_id level_coarse_cell_id = coarse_cell_id;
- for (auto i : cell_indices)
- level_coarse_cell_id =
- level_coarse_cell_id * GeometryInfo<dim>::max_children_per_cell + i;
-
- return level_coarse_cell_id;
- }
} // namespace