9#include <kernel/geometry/index_set.hpp>
10#include <kernel/geometry/target_set.hpp>
19 struct PatchIndexMappingHelper
21 template<
int num_indices_>
23 IndexSet<num_indices_>& iso,
24 const IndexSet<num_indices_>& isi,
28 const Index num_cells(tsc.get_num_entities());
29 for(Index i(0); i < num_cells; ++i)
31 const Index isx(tsc[i]);
32 for(
int j(0); j < num_indices_; ++j)
34 iso(i,j) = tsf[isi(isx, j)];
42 int face_dim_ = Shape_::dimension - 1>
43 struct PatchIndexMappingWrapper
46 IndexSetWrapper<Shape_, face_dim_>& iso,
47 const IndexSetWrapper<Shape_, face_dim_>& isi,
48 const TargetSetHolder<Shape_>& tsc,
52 PatchIndexMappingWrapper<Shape_, face_dim_ - 1>::apply(iso, isi, tsc, tsf);
55 PatchIndexMappingHelper::apply(
56 iso.template get_index_set<face_dim_>(),
57 isi.template get_index_set<face_dim_>(),
58 tsc.template get_target_set<Shape_::dimension>(),
63 template<
typename Shape_>
64 struct PatchIndexMappingWrapper<Shape_, 0>
67 IndexSetWrapper<Shape_, 0>& iso,
68 const IndexSetWrapper<Shape_, 0>& isi,
69 const TargetSetHolder<Shape_>& tsc,
73 PatchIndexMappingHelper::apply(
74 iso.template get_index_set<0>(),
75 isi.template get_index_set<0>(),
76 tsc.template get_target_set<Shape_::dimension>(),
81 template<
typename Shape_>
82 struct PatchIndexMapping
84 static constexpr int shape_dim = Shape_::dimension;
85 typedef typename Shape::FaceTraits<Shape_, shape_dim - 1>::ShapeType FaceType;
88 IndexSetHolder<Shape_>& iso,
89 const IndexSetHolder<Shape_>& isi,
90 const TargetSetHolder<Shape_>& tsc,
91 const Index num_entities[])
93 Index *tsf[shape_dim + 1];
94 _build_tsf(tsf, tsc, num_entities);
95 _apply(iso, isi, tsc, &tsf[0]);
96 for(
int i(0); i <= shape_dim; ++i)
103 static void _build_tsf(
105 const TargetSetHolder<Shape_>& tsh,
106 const Index num_entities[])
109 PatchIndexMapping<FaceType>::_build_tsf(tsf, tsh, num_entities);
111 tsf[shape_dim] =
new Index[num_entities[shape_dim]];
112 Index* tsi(tsf[shape_dim]);
113 const TargetSet& ts(tsh.template get_target_set<shape_dim>());
114 const Index ni(tsh.get_num_entities(shape_dim));
115 for(Index i(0); i < ni; ++i)
122 IndexSetHolder<Shape_>& iso,
123 const IndexSetHolder<Shape_>& isi,
124 const TargetSetHolder<Shape_>& tsc,
128 PatchIndexMapping<FaceType>::_apply(iso, isi, tsc, tsf);
131 PatchIndexMappingWrapper<Shape_>::apply(
132 iso.template get_index_set_wrapper<shape_dim>(),
133 isi.template get_index_set_wrapper<shape_dim>(), tsc, tsf);
138 struct PatchIndexMapping<Shape::Vertex>
141 static void _build_tsf(
143 const TargetSetHolder<Shape::Vertex>& tsh,
144 const Index num_entities[])
146 tsf[0] =
new Index[num_entities[0]];
148 const TargetSet& ts(tsh.get_target_set<0>());
149 const Index ni(tsh.get_num_entities(0));
150 for(Index i(0); i < ni; ++i)
156 template<
typename ISO_,
typename ISI_,
typename TSC_>
157 static void _apply(ISO_&,
const ISI_&,
const TSC_&, Index**)
std::uint64_t Index
Index data type.