16 #include <deal.II/grid/cell_id.h> 18 #include <deal.II/grid/tria.h> 22 DEAL_II_NAMESPACE_OPEN
27 coarse_cell_id(
numbers::invalid_unsigned_int),
28 n_child_indices(
numbers::invalid_unsigned_int)
41 const std::vector<std::uint8_t> &
id)
43 coarse_cell_id(coarse_cell_id),
44 n_child_indices(id.size())
54 const unsigned int n_child_indices,
55 const std::uint8_t *
id)
57 coarse_cell_id(coarse_cell_id),
58 n_child_indices(n_child_indices)
74 const unsigned int two_bit_mask = (1<<2)-1;
75 const unsigned int dim = binary_representation[1] & two_bit_mask;
82 const unsigned int children_per_value =
sizeof(binary_type::value_type) * 8 / dim;
83 const unsigned int child_mask = (1<<dim) - 1;
86 unsigned int child_level=0;
87 unsigned int binary_entry = 2;
90 for (
unsigned int j=0; j<children_per_value; ++j)
94 child_indices[child_level] = (binary_representation[binary_entry] >> (dim*j)) & child_mask;
110 binary_representation.fill(0);
121 binary_representation[1] |= dim;
124 const unsigned int children_per_value =
sizeof(binary_type::value_type) * 8 / dim;
125 unsigned int child_level=0;
126 unsigned int binary_entry = 2;
131 Assert(binary_entry < binary_representation.size(),
134 for (
unsigned int j=0; j<children_per_value; ++j)
136 const unsigned int child_index =
static_cast<unsigned int>(
child_indices[child_level]);
138 binary_representation[binary_entry] |= (child_index << (j*dim));
146 return binary_representation;
154 std::ostringstream ss;
161 template <
int dim,
int spacedim>
168 cell = cell->child(static_cast<unsigned int> (
child_indices[i]));
174 #include "cell_id.inst" 176 DEAL_II_NAMESPACE_CLOSE
std::array< std::uint8_t, internal::p4est::functions< 2 >::max_level > child_indices
Triangulation< dim, spacedim >::cell_iterator to_cell(const Triangulation< dim, spacedim > &tria) const
binary_type to_binary() const
unsigned int coarse_cell_id
#define Assert(cond, exc)
std::string to_string() const
unsigned int n_child_indices
std::array< unsigned int, 4 > binary_type
static ::ExceptionBase & ExcInternalError()