16#ifndef dealii_cell_id_translator_h
17#define dealii_cell_id_translator_h
76 template <
typename Accessor>
83 template <
typename Accessor>
124 : n_coarse_cells(n_coarse_cells)
125 , n_global_levels(n_global_levels)
146 max_cell_index <= std::numeric_limits<types::global_cell_index>::max(),
148 "You have exceeded the maximal number of possible indices this function "
149 "can handle. The current setup (n_coarse_cells=" +
151 ", n_global_levels=" + std::to_string(
n_global_levels) +
") requires " +
153 " indices but the current deal.II configuration only supports " +
154 std::to_string(std::numeric_limits<types::global_cell_index>::max()) +
155 " indices. You may want to consider to build deal.II with 64bit "
156 "indices (-D DEAL_II_WITH_64BIT_INDICES=\"ON\") to increase the limit "
165 Utilities::pow<types::global_cell_index>(
176 return n_coarse_cells *
177 (Utilities::pow<types::global_cell_index>(
185 template <
typename Accessor>
189 static_assert(dim == Accessor::dimension &&
190 dim == Accessor::structure_dimension,
191 "The information can only be queried for cells.");
195 id += convert_cell_id_binary_type_to_level_coarse_cell_id(
200 id += tree_sizes[cell->level()];
208 template <
typename Accessor>
213 static_assert(dim == Accessor::dimension &&
214 dim == Accessor::structure_dimension,
215 "The information can only be queried for cells.");
217 return (translate(cell) - tree_sizes[cell->level()]) *
219 i + tree_sizes[cell->level() + 1];
228 std::vector<std::uint8_t> child_indices;
235 if (
id < tree_sizes[
level])
243 child_indices.push_back(
id_temp %
248 std::reverse(child_indices.begin(), child_indices.end());
250 return {
id_temp, child_indices};
268 sizeof(CellId::binary_type::value_type) * 8 / dim;
std::array< unsigned int, 4 > binary_type
const types::global_cell_index n_global_levels
types::global_cell_index translate(const TriaIterator< Accessor > &cell) const
static types::global_cell_index convert_cell_id_binary_type_to_level_coarse_cell_id(const typename CellId::binary_type &binary_representation)
CellIDTranslator(const types::global_cell_index n_coarse_cells, const types::global_cell_index n_global_levels)
std::vector< types::global_cell_index > tree_sizes
CellId to_cell_id(const types::global_cell_index id) const
const types::global_cell_index n_coarse_cells
types::global_cell_index size() const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcMessage(std::string arg1)