9#include <kernel/geometry/index_set.hpp>
10#include <kernel/geometry/target_set.hpp>
11#include <kernel/geometry/intern/face_index_mapping.hpp>
22 int face_dim_ = Shape_::dimension>
23 struct DynamicNumFaces
25 static int value(
int dim)
27 ASSERT((dim <= face_dim_) && (dim >= 0));
29 return Shape::FaceTraits<Shape_, face_dim_>::count;
31 return DynamicNumFaces<Shape_, face_dim_ - 1>::value(dim);
35 template<
typename Shape_>
36 struct DynamicNumFaces<Shape_, 0>
38 static int value(
int )
40 return Shape::FaceTraits<Shape_, 0>::count;
48 int shape_dim_ = Shape_::dimension>
49 struct MacroIndexBuilder
51 typedef typename Shape::FaceTraits<Shape_, cell_dim_>::ShapeType CellType;
52 static constexpr int num_cells = Shape::FaceTraits<Shape_, cell_dim_>::count;
53 static constexpr int num_indices = Shape::FaceTraits<CellType, face_dim_>::count;
55 static void build(IndexSet<num_indices>& idx)
57 typedef FaceIndexMapping<Shape_, cell_dim_, face_dim_> FimType;
58 for(Index i(0); i <
Index(num_cells); ++i)
60 for(
int j(0); j < num_indices; ++j)
62 idx(i, j) =
Index(FimType::map(
int(i), j));
72 struct MacroIndexBuilder<Shape_, cell_dim_, face_dim_, cell_dim_>
74 static constexpr int num_indices = Shape::FaceTraits<Shape_, face_dim_>::count;
76 static void build(IndexSet<num_indices>& idx)
78 for(
int j(0); j < num_indices; ++j)
88 int face_dim_ = cell_dim_ - 1>
89 struct MacroIndexHelper
91 typedef typename Shape::FaceTraits<Shape_, cell_dim_>::ShapeType CellType;
92 static void build(IndexSetWrapper<CellType, face_dim_>& idx)
95 MacroIndexHelper<Shape_, cell_dim_, face_dim_ - 1>::build(idx);
98 MacroIndexBuilder<Shape_, cell_dim_, face_dim_>::build(idx.template get_index_set<face_dim_>());
105 struct MacroIndexHelper<Shape_, cell_dim_, 0>
107 typedef typename Shape::FaceTraits<Shape_, cell_dim_>::ShapeType CellType;
108 static void build(IndexSetWrapper<CellType, 0>& idx)
111 MacroIndexBuilder<Shape_, cell_dim_, 0>::build(idx.template get_index_set<0>());
117 int cell_dim_ = Shape_::dimension>
118 struct MacroIndexWrapper
120 typedef typename Shape::FaceTraits<Shape_, cell_dim_>::ShapeType CellType;
121 static void build(IndexSetHolder<CellType>& idx)
124 MacroIndexWrapper<Shape_, cell_dim_ - 1>::build(idx);
127 MacroIndexHelper<Shape_, cell_dim_>::build(idx.template get_index_set_wrapper<cell_dim_>());
131 template<
typename Shape_>
132 struct MacroIndexWrapper<Shape_, 0>
134 static void build(IndexSetHolder<Shape::Vertex>&)
140 template<
typename Shape_,
int face_dim_ = Shape_::dimension-1>
141 struct MacroTargetWrapper
143 static void build(TargetSetHolder<Shape_>& trg,
const IndexSetHolder<Shape_>& ish,
const Index cell_idx)
146 TargetSet& target = trg.template get_target_set<face_dim_>();
149 static constexpr int num_faces = Shape::FaceTraits<Shape_, face_dim_>::count;
152 XASSERTM(target.get_num_entities() ==
Index(num_faces),
"invalid target set size");
155 const IndexSet<num_faces>& idx = ish.template get_index_set<Shape_::dimension, face_dim_>();
158 for(
int i(0); i < num_faces; ++i)
160 target[
Index(i)] = idx(cell_idx, i);
164 MacroTargetWrapper<Shape_, face_dim_-1>::build(trg, ish, cell_idx);
168 template<
typename Shape_>
169 struct MacroTargetWrapper<Shape_, 0>
171 static void build(TargetSetHolder<Shape_>& trg,
const IndexSetHolder<Shape_>& ish,
const Index cell_idx)
174 TargetSet& target = trg.template get_target_set<0>();
177 static constexpr int num_faces = Shape::FaceTraits<Shape_,0>::count;
180 XASSERTM(target.get_num_entities() ==
Index(num_faces),
"invalid target set size");
183 const IndexSet<num_faces>& idx = ish.template get_index_set<Shape_::dimension, 0>();
186 for(
int i(0); i < num_faces; ++i)
188 target[
Index(i)] = idx(cell_idx, i);
#define ASSERT(expr)
Debug-Assertion macro definition.
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
@ value
specifies whether the space should supply basis function values
std::uint64_t Index
Index data type.