9#include <kernel/shape.hpp>
10#include <kernel/geometry/index_set.hpp>
11#include <kernel/geometry/intern/struct_num_entities.hpp>
12#include <kernel/geometry/intern/struct_index_mapping.hpp>
31 static_assert(shape_dim_ >= cell_dim_,
"invalid shape dimension");
32 static_assert(cell_dim_ > face_dim_,
"invalid cell dimension");
33 static_assert(face_dim_ >= 0,
"invalid face dimension");
76 return Intern::StructIndexMapping<shape_dim_, cell_dim_, face_dim_>::compute(
_i,
_j,
_num_slices);
126 return Intern::StructIndexMapping<shape_dim_, cell_dim_, face_dim_>::compute(
_i,
Index(j),
_num_slices);
146 _num_entities(Intern::StructNumEntities<shape_dim_, cell_dim_>::compute(num_slices)),
147 _index_bound(Intern::StructNumEntities<shape_dim_, face_dim_>::compute(num_slices))
149 for(
int i(0); i < shape_dim_; ++i)
160 for(
int i(0); i < shape_dim_; ++i)
175 for(
int i(0); i < shape_dim_; ++i)
185 return std::size_t(0);
249 return Intern::StructIndexMapping<shape_dim_, cell_dim_, face_dim_>::compute(i,
Index(j),
_num_slices);
266 idx_set(i, j) = Intern::StructIndexMapping<shape_dim_, cell_dim_, face_dim_>::compute(i,
Index(j),
_num_slices);
309 int cell_dim_ = shape_dim_,
310 int face_dim_ = cell_dim_ - 1>
311 class StructIndexSetWrapper :
312 public StructIndexSetWrapper<shape_dim_, cell_dim_, face_dim_ - 1>
315 typedef StructIndexSetWrapper<shape_dim_, cell_dim_, face_dim_ - 1> BaseClass;
317 StructIndexSet<shape_dim_, cell_dim_, face_dim_> _index_set;
320 explicit StructIndexSetWrapper(
const Index num_slices[]) :
321 BaseClass(num_slices),
322 _index_set(num_slices)
326 StructIndexSetWrapper(StructIndexSetWrapper&& other) :
327 BaseClass(std::forward<BaseClass>(other)),
328 _index_set(std::forward<StructIndexSet<shape_dim_, cell_dim_, face_dim_>>(other._index_set))
332 StructIndexSetWrapper& operator=(StructIndexSetWrapper&& other)
337 BaseClass::operator=(std::forward<BaseClass>(other));
338 _index_set = std::forward<StructIndexSet<shape_dim_, cell_dim_, face_dim_>>(
other._index_set);
343 template<
int face_dim__>
344 const StructIndexSet<shape_dim_, cell_dim_, face_dim__>& get_index_set()
const
346 static_assert((face_dim__ >= 0) && (face_dim__ <= face_dim_),
"invalid face dimension");
347 return StructIndexSetWrapper<shape_dim_, cell_dim_, face_dim__>::_index_set;
350 std::size_t bytes()
const
352 return BaseClass::bytes() + _index_set.bytes();
355 void copy_to(IndexSetWrapper<Shape::Hypercube<cell_dim_>, face_dim_>& idx_set_wrp)
const
357 BaseClass::copy_to(idx_set_wrp);
358 _index_set.copy_to(idx_set_wrp.template get_index_set<face_dim_>());
365 class StructIndexSetWrapper<shape_dim_, cell_dim_, 0>
368 StructIndexSet<shape_dim_, cell_dim_, 0> _index_set;
371 explicit StructIndexSetWrapper(
const Index num_slices[]) :
372 _index_set(num_slices)
376 StructIndexSetWrapper(StructIndexSetWrapper&& other) :
377 _index_set(std::forward<StructIndexSet<shape_dim_, cell_dim_, 0>>(
other._index_set))
381 StructIndexSetWrapper& operator=(StructIndexSetWrapper&& other)
386 _index_set = std::forward<StructIndexSet<shape_dim_, cell_dim_, 0>>(
other._index_set);
391 template<
int face_dim__>
392 const StructIndexSet<shape_dim_, cell_dim_, face_dim__>& get_index_set()
const
394 static_assert(face_dim__ == 0,
"invalid face dimension");
398 std::size_t bytes()
const
400 return _index_set.bytes();
403 void copy_to(IndexSetWrapper<Shape::Hypercube<cell_dim_>, 0>& idx_set_wrp)
const
405 _index_set.copy_to(idx_set_wrp.template get_index_set<0>());
411 int cell_dim_ = shape_dim_>
412 class StructIndexSetHolder :
413 public StructIndexSetHolder<shape_dim_, cell_dim_ - 1>
416 typedef StructIndexSetHolder<shape_dim_, cell_dim_ - 1> BaseClass;
418 StructIndexSetWrapper<shape_dim_, cell_dim_> _index_set_wrapper;
421 explicit StructIndexSetHolder(
const Index num_slices[]) :
422 BaseClass(num_slices),
423 _index_set_wrapper(num_slices)
427 StructIndexSetHolder(StructIndexSetHolder&& other) :
428 BaseClass(std::forward<BaseClass>(
other)),
429 _index_set_wrapper(std::forward<StructIndexSetWrapper<shape_dim_, cell_dim_>>(
other._index_set_wrapper))
433 StructIndexSetHolder& operator=(StructIndexSetHolder&& other)
438 BaseClass::operator=(std::forward<BaseClass>(other));
439 _index_set_wrapper = std::forward<StructIndexSetWrapper<shape_dim_, cell_dim_>>(
other._index_set_wrapper);
444 template<
int cell_dim__>
445 const StructIndexSetWrapper<shape_dim_, cell_dim__>& get_index_set_wrapper()
const
447 return StructIndexSetHolder<shape_dim_, cell_dim__>::_index_set_wrapper;
450 template<
int cell_dim__,
int face_dim__>
451 const StructIndexSet<shape_dim_, cell_dim__, face_dim__>& get_index_set()
const
453 return get_index_set_wrapper<cell_dim__>().template get_index_set<face_dim__>();
456 std::size_t bytes()
const
458 return BaseClass::bytes() + _index_set_wrapper.bytes();
461 void copy_to(IndexSetHolder<Shape::Hypercube<cell_dim_>>& idx_set_hld)
const
463 BaseClass::copy_to(idx_set_hld);
464 _index_set_wrapper.copy_to(idx_set_hld.template get_index_set_wrapper<cell_dim_>());
468 template<
int shape_dim_>
469 class StructIndexSetHolder<shape_dim_, 0>
472 explicit StructIndexSetHolder(
const Index [])
476 StructIndexSetHolder(StructIndexSetHolder&&)
480 StructIndexSetHolder& operator=(StructIndexSetHolder&&)
485 std::size_t bytes()
const
487 return std::size_t(0);
490 void copy_to(IndexSetHolder<Shape::Vertex>&)
const
#define ASSERT(expr)
Debug-Assertion macro definition.
#define XASSERT(expr)
Assertion macro definition.
Conformal Index-Set class template.
Index get_index_bound() const
Returns the index bound.
Index get_num_entities() const
Returns the number of entities.
ImageIterator implementation for Adjactor interface.
ImageIterator & operator++()
Pre-increment operator.
ImageIterator()
default constructor
bool operator!=(const ImageIterator &other) const
Checks two iterators for inequality.
ImageIterator(const Index *num_slices, Index i, Index j)
constructor
const Index * _num_slices
pointer to num_slices array of the index-set
Index operator*() const
Dereferentiation operator.
Index tuple class for structured meshes.
const Index * _num_slices
pointer to num_slices array of the index-set
Index operator[](int j) const
access operator
IndexTupleType()
default constructor
IndexTupleType(const Index *num_slices, Index i)
constructor
static constexpr int num_indices
number of indices per tuple
Structured Index-Set class template.
Shape::Hypercube< shape_dim_ > ShapeType
shape type
StructIndexSet(StructIndexSet &&other)
move constructor
Index get_num_nodes_domain() const
Returns the number of domain nodes.
void copy_to(IndexSet< num_indices > &idx_set) const
Copies this index set into a (conformal) index set.
Shape::FaceTraits< ShapeType, cell_dim_ >::ShapeType CellType
cell type
ImageIterator image_end(Index domain_node) const
Returns an iterator for the first position past the last adjacent image node.
Index get_index_bound() const
Returns the index bound.
ImageIterator image_begin(Index domain_node) const
Returns an iterator for the first adjacent image node.
static constexpr int num_indices
number of indices
Index _num_slices[shape_dim_]
number of slices
int get_num_indices() const
Returns the number of indices per entity.
IndexTupleType operator[](Index i) const
Returns an index tuple.
StructIndexSet & operator=(StructIndexSet &&other)
move-assignment operator
StructIndexSet(const Index num_slices[])
Constructor.
std::size_t bytes() const
Index get_num_entities() const
Returns the number of entities.
Index _index_bound
index bound
Index _num_entities
number of entities
Index get_num_nodes_image() const
Returns the number of image nodes.
Index operator()(Index i, int j) const
Maps a face index.
@ other
generic/other permutation strategy
std::uint64_t Index
Index data type.
Face traits tag struct template.
Hypercube shape tag struct template.