10#include <kernel/geometry/index_set.hpp>
11#include <kernel/shape.hpp>
29 static_assert(size_ > 0,
"invalid number of indices");
32 static constexpr int size = size_;
35 std::array<std::uint64_t, size_>
levels;
59 for(
int i = 0; i <
size; i++)
101 _levels(std::forward<std::vector<std::uint64_t>>(
other._levels))
114 _levels = std::forward<std::vector<std::uint64_t>>(
other._levels);
146 std::uint64_t result = 0;
149 result = std::max(result, level);
154 std::size_t size()
const
172 template<
typename MeshType>
175 constexpr int cell_dim = MeshType::shape_dim;
177 Index num_verts = mesh.get_num_entities(0);
178 Index num_cells = mesh.get_num_entities(cell_dim);
181 _levels = std::vector<std::uint64_t>(num_verts, 0);
183 for(
Index cell(0); cell < num_cells; ++cell)
185 std::uint64_t cell_level = f(cell);
199 template<
typename MeshType>
202 constexpr int cell_dim = MeshType::shape_dim;
205 auto& v_at_c = mesh.template get_index_set<cell_dim, 0>();
206 for(
Index vert(0); vert < verts_per_cell; ++vert)
208 Index vert_idx = v_at_c(element, vert);
219 for(
Index i(0); i < len; ++i)
236 result[i] =
_levels[indices[i]];
249 os <<
"SDLs {" <<
"\n";
252 os <<
"\t" << sdl <<
",\n";
#define ASSERT(expr)
Debug-Assertion macro definition.
Subdivision level markings for meshes.
SubdivisionLevels(Index num_vertices, std::uint64_t default_level)
Constructor.
std::vector< std::uint64_t > _levels
Level markings.
const std::uint64_t & operator[](Index idx) const
access operator
void set_level_for_element(const MeshType &mesh, Index element, std::uint64_t element_level)
Set subdivision level for a mesh element.
SubdivisionLevels(const SubdivisionLevels &other)=delete
deleted copy-constructor
SubdivisionLevels & operator=(const SubdivisionLevels &other)=delete
deleted copy-assign operator
SubdivisionLevels & operator=(SubdivisionLevels &&other) noexcept
move-assign operator
~SubdivisionLevels()=default
destructor
SubdivisionLevels(Index num_vertices)
Constructor.
SubdivisionLevelTuple< n > get_levels(const IndexTuple< n > &indices) const
Retrieve SubdivisionLevelTuple.
void merge(const SubdivisionLevels &other)
Adds up two SubdivisionLevels.
friend std::ostream & operator<<(std::ostream &, const SubdivisionLevels &)
Debug output operator.
std::uint64_t & operator[](Index idx)
access operator
SubdivisionLevels(SubdivisionLevels &&other) noexcept
move-constructor
void set_per_element(const MeshType &mesh, std::function< std::uint64_t(Index)> f)
Sets subdivision levels for each cell of the given mesh.
std::uint64_t maximum_level()
Returns the maximum refinement level assigned to any vertex.
@ other
generic/other permutation strategy
std::uint64_t Index
Index data type.
Index Tuple class template.
static constexpr int num_indices
number of indices per tuple
Tuple-type for SubdivisionLevels.
const Index & operator[](Index idx) const
access operator
SubdivisionLevelTuple< size > decrement() const
Decrement levels.
static constexpr int size
Tuple size.
std::array< std::uint64_t, size_ > levels
Tuple values.
Index & operator[](Index idx)
access operator
Face traits tag struct template.