9#include <kernel/shape.hpp>
10#include <kernel/adjacency/permutation.hpp>
135 if(!inv_perm.
empty())
137 for(std::size_t i(0); i <
_indices.size(); ++i)
154 template<
typename Shape_>
155 class TargetSetHolder :
156 public TargetSetHolder<typename Shape::FaceTraits<Shape_, Shape_::dimension - 1>::ShapeType>
159 typedef Shape_ ShapeType;
160 static constexpr int shape_dim = ShapeType::dimension;
163 typedef TargetSetHolder<
typename Shape::FaceTraits<ShapeType, shape_dim - 1>::ShapeType> BaseClass;
165 TargetSet _target_set;
174 explicit TargetSetHolder(
const Index num_entities[]) :
175 BaseClass(num_entities),
176 _target_set(num_entities[shape_dim])
180 TargetSetHolder(TargetSetHolder&& other) :
181 BaseClass(std::forward<BaseClass>(
other)),
182 _target_set(std::forward<TargetSet>(
other._target_set))
186 TargetSetHolder& operator=(TargetSetHolder&& other)
190 BaseClass::operator=(std::forward<BaseClass>(other));
191 _target_set = std::forward<TargetSet>(
other._target_set);
195 void clone(
const TargetSetHolder& other)
197 BaseClass::clone(other);
198 this->_target_set =
other._target_set.clone();
201 TargetSetHolder clone()
const
208 virtual ~TargetSetHolder()
212 std::size_t bytes()
const
214 return BaseClass::bytes() + _target_set.bytes();
218 TargetSet& get_target_set()
220 static_assert(dim_ >= 0,
"invalid dimension");
221 static_assert(dim_ <= shape_dim,
"invalid dimension");
222 typedef typename Shape::FaceTraits<Shape_, dim_>::ShapeType CellType;
223 return TargetSetHolder<CellType>::_target_set;
227 const TargetSet& get_target_set()
const
229 static_assert(dim_ >= 0,
"invalid dimension");
230 static_assert(dim_ <= shape_dim,
"invalid dimension");
231 typedef typename Shape::FaceTraits<Shape_, dim_>::ShapeType CellType;
232 return TargetSetHolder<CellType>::_target_set;
235 Index get_num_entities(
int dim)
const
237 XASSERTM(dim <= shape_dim,
"invalid dimension parameter");
240 return _target_set.get_num_entities();
242 return BaseClass::get_num_entities(dim);
245 template<std::
size_t np_>
246 void permute_map(
const std::array<Adjacency::Permutation, np_>& inv_perms)
248 BaseClass::permute_map(inv_perms);
249 _target_set.permute_map(inv_perms.at(shape_dim));
254 return "TargetSetHolder<" + Shape_::name() +
">";
262 class TargetSetHolder<Shape::Vertex>
265 typedef Shape::Vertex ShapeType;
266 static constexpr int shape_dim = ShapeType::dimension;
269 TargetSet _target_set;
277 explicit TargetSetHolder(
const Index num_entities[]) :
278 _target_set(num_entities[0])
282 TargetSetHolder(TargetSetHolder&& other) :
283 _target_set(std::forward<TargetSet>(
other._target_set))
287 TargetSetHolder& operator=(TargetSetHolder&& other)
291 _target_set = std::forward<TargetSet>(
other._target_set);
295 virtual ~TargetSetHolder()
299 void clone(
const TargetSetHolder& other)
301 this->_target_set =
other._target_set.clone();
304 TargetSetHolder clone()
const
311 std::size_t bytes()
const
313 return _target_set.bytes();
317 TargetSet& get_target_set()
319 static_assert(dim_ == 0,
"invalid dimension");
324 const TargetSet& get_target_set()
const
326 static_assert(dim_ == 0,
"invalid dimension");
330 Index get_num_entities(
int dim)
const
332 XASSERTM(dim == 0,
"invalid dimension parameter");
333 return _target_set.get_num_entities();
336 template<std::
size_t np_>
337 void permute_map(
const std::array<Adjacency::Permutation, np_>& inv_perms)
339 _target_set.permute_map(inv_perms.at(0));
344 return "TargetSetHolder<Vertex>";
#define ASSERT(expr)
Debug-Assertion macro definition.
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
bool empty() const
Checks whether the permutation is empty.
TargetSet(const std::vector< Index > &idx)
internal clone constructor
TargetSet & operator=(TargetSet &&other)
move-assignment operator
std::vector< Index > _indices
Index vector. _indices[i] = j means that entity i represents entity j in the parent.
const Index * get_indices() const
Index & operator[](Index i)
Returns a target index.
TargetSet()
standard constructor
const Index & operator[](Index i) const
Returns a target index.
virtual ~TargetSet()
virtual destructor
TargetSet(TargetSet &&other)
move constructor
std::size_t bytes() const
TargetSet(Index num_entities)
Constructor.
Index get_num_entities() const
Returns the number of entities.
@ other
generic/other permutation strategy
std::uint64_t Index
Index data type.