9#include <kernel/geometry/index_set.hpp>
10#include <kernel/geometry/target_set.hpp>
34 template<
int end_dim_,
int current_dim_>
35 struct TargetSetComputer
49 template<
typename TargetSetHolderType,
typename IndexSetHolderType>
50 static void bottom_to_top(TargetSetHolderType& _target_set_holder,
const IndexSetHolderType& parent_ish)
53 TargetSetComputer<end_dim_, current_dim_-1>::bottom_to_top(_target_set_holder, parent_ish);
55 typedef typename IndexSetHolderType::template IndexSet<current_dim_, current_dim_-1>::Type ParentIndexSetType;
58 TargetSet& my_target_set(_target_set_holder.template get_target_set<current_dim_>());
61 if(my_target_set.get_num_entities() == 0)
64 TargetSet& ts_below(_target_set_holder.template get_target_set<current_dim_-1>());
67 const ParentIndexSetType& is_parent_below(parent_ish.template get_index_set<current_dim_, current_dim_-1>());
69 ParentIndexSetType lower_parent_to_mesh_part(
Index(is_parent_below.get_num_indices()));
72 TargetSet lower_origin_set(is_parent_below.get_index_bound());
74 Index marker(is_parent_below.get_index_bound());
75 for(Index i(0); i < lower_origin_set.get_num_entities(); ++i)
76 lower_origin_set[i] = 0;
78 for(Index i(0); i < ts_below.get_num_entities(); ++i)
79 lower_origin_set[ts_below[i]] = marker;
82 Index num_entities_current_dim(0);
86 TargetSet tmp_target_set(is_parent_below.get_num_entities());
89 for(Index i(0); i < is_parent_below.get_num_entities(); ++i)
91 bool is_in_mesh_part(
true);
94 for(
int j(0); j < ParentIndexSetType::num_indices; ++j)
97 Index parent_index(is_parent_below[i][j]);
98 if(lower_origin_set[parent_index] != marker)
99 is_in_mesh_part =
false;
105 tmp_target_set[num_entities_current_dim] = i;
106 num_entities_current_dim++;
111 TargetSet new_target_set(num_entities_current_dim);
112 for(Index i(0); i < new_target_set.get_num_entities(); ++i)
113 new_target_set[i] = tmp_target_set[i];
116 my_target_set = std::move(new_target_set);
132 template<
typename TargetSetHolderType,
typename IndexSetHolderType>
133 static void top_to_bottom(TargetSetHolderType& _target_set_holder,
const IndexSetHolderType& parent_ish)
136 TargetSetComputer<end_dim_, current_dim_+1>::top_to_bottom(_target_set_holder, parent_ish);
138 typedef typename IndexSetHolderType::template IndexSet<current_dim_+1, current_dim_>::Type ParentIndexSetType;
141 TargetSet& my_target_set(_target_set_holder.template get_target_set<current_dim_>());
144 if(my_target_set.get_num_entities() == 0)
147 TargetSet& ts_above(_target_set_holder.template get_target_set<current_dim_+1>());
150 const ParentIndexSetType& is_parent_above(parent_ish.template get_index_set<current_dim_+1, current_dim_>());
152 ParentIndexSetType upper_parent_to_mesh_part(
Index(is_parent_above.get_num_indices()));
156 TargetSet upper_origin_set(is_parent_above.get_index_bound());
158 Index marker(is_parent_above.get_index_bound());
159 for(Index i(0); i < upper_origin_set.get_num_entities(); ++i)
160 upper_origin_set[i] = 0;
162 for(Index i(0); i < ts_above.get_num_entities(); ++i)
165 Index parent_index(ts_above[i]);
166 for(
int j(0); j < is_parent_above.get_num_indices(); ++j)
169 Index parent_sub_entity_index(is_parent_above(parent_index, j));
170 upper_origin_set[parent_sub_entity_index] = marker;
176 TargetSet tmp_target_set(is_parent_above.get_index_bound());
178 Index num_entities_current_dim(0);
179 for(Index i(0); i < upper_origin_set.get_num_entities(); ++i)
181 if(upper_origin_set[i] == marker)
183 tmp_target_set[num_entities_current_dim] = i;
184 num_entities_current_dim++;
189 TargetSet new_target_set(num_entities_current_dim);
190 for(Index i(0); i < new_target_set.get_num_entities(); ++i)
191 new_target_set[i] = tmp_target_set[i];
194 my_target_set = std::move(new_target_set);
202 template<
int end_dim_>
203 struct TargetSetComputer<end_dim_, end_dim_>
206 template<
typename TargetSetHolderType,
typename IndexSetHolderType>
207 static void bottom_to_top(TargetSetHolderType& ,
const IndexSetHolderType&)
212 template<
typename TargetSetHolderType,
typename IndexSetHolderType>
213 static void top_to_bottom(TargetSetHolderType& ,
const IndexSetHolderType&)
std::uint64_t Index
Index data type.