9#include <kernel/shape.hpp>
27 template<
typename,
int>
class RefineTraits_,
30 int cell_dim_ = Shape_::dimension>
33 static_assert(face_dim_ >= 0,
"invalid face dimension");
34 static_assert(face_dim_ < cell_dim_,
"invalid cell/face dimension");
35 static_assert(cell_dim_ <= Shape_::dimension,
"invalid cell dimension");
39 return "EntityCounter<" + Shape_::name() +
"," +
stringify(face_dim_) +
"," +
stringify(cell_dim_) +
">";
42 static Index count(
const Index num_entities[])
44 typedef typename Shape::FaceTraits<Shape_, cell_dim_>::ShapeType CellType;
45 return EntityCounter<RefineTraits_, Shape_, face_dim_, cell_dim_-1>::count(num_entities) +
46 RefineTraits_<CellType, face_dim_>::count * num_entities[cell_dim_];
49 static void offset(Index offsets[],
const Index num_entities[])
51 EntityCounter<RefineTraits_, Shape_, face_dim_, cell_dim_-1>::offset(offsets, num_entities);
52 offsets[cell_dim_] = EntityCounter<RefineTraits_, Shape_, face_dim_, cell_dim_-1>::count(num_entities);
57 template<
typename,
int>
class RefineTraits_,
60 struct EntityCounter<RefineTraits_, Shape_, cell_dim_, cell_dim_>
62 static_assert(cell_dim_ >= 0,
"invalid cell/face dimension");
63 static_assert(cell_dim_ <= Shape_::dimension,
"invalid cell dimension");
67 return "EntityCounter<" + Shape_::name() +
"," +
stringify(cell_dim_) +
">";
70 static Index count(
const Index num_entities[])
72 typedef typename Shape::FaceTraits<Shape_, cell_dim_>::ShapeType CellType;
73 return RefineTraits_<CellType, cell_dim_>::count * num_entities[cell_dim_];
76 static void offset(Index offsets[],
const Index* )
78 offsets[cell_dim_] = 0;
91 template<
typename,
int>
class RefineTraits_,
93 int face_dim_ = Shape_::dimension>
94 struct EntityCountWrapper
96 static_assert(face_dim_ > 0,
"invalid face dimension");
97 static_assert(face_dim_ <= Shape_::dimension,
"invalid face dimension");
106 return "EntityCounterWrapper<" + Shape_::name() +
"," +
stringify(face_dim_) +
">";
117 static void query(Index num_entities[])
119 EntityCountWrapper<RefineTraits_, Shape_, face_dim_-1>::query(num_entities);
120 num_entities[face_dim_] = EntityCounter<RefineTraits_, Shape_, face_dim_>::count(num_entities);
125 template<
typename,
int>
class RefineTraits_,
127 struct EntityCountWrapper<RefineTraits_, Shape_, 0>
131 return "EntityCounterWrapper<" + Shape_::name() +
",0>";
134 static void query(Index num_entities[])
136 num_entities[0] = EntityCounter<RefineTraits_, Shape_, 0>::count(num_entities);
String stringify(const T_ &item)
Converts an item into a String.
std::uint64_t Index
Index data type.