5#include <dune/geometry/referenceelements.hh>
6#include <dune/localfunctions/common/localkey.hh>
8#include <amdis/Output.hpp>
13 template <
class IdSet,
int dim>
16 using IdType =
typename IdSet::IdType;
18 using RefElements =
typename Dune::ReferenceElements<double,dim>;
19 using RefElement =
typename RefElements::ReferenceElement;
28 template <
class Element>
29 void bind(Element
const& element)
31 static_assert(dim == Element::mydimension,
"");
32 refElem_ = &RefElements::general(element.type());
34 ids_.resize(refElem_->size(dim));
35 for (
int i = 0; i < refElem_->size(dim); ++i)
36 ids_[i] = idSet_.subId(element, i, dim);
48 unsigned int get(Dune::LocalKey
const& localKey,
unsigned int size)
const
50 int subDim = dim - localKey.codim();
51 if (subDim == 1 && 1 < dim)
52 return id(localKey,0) < id(localKey,1) ? localKey.index() : size - localKey.index() - 1;
53 else if (subDim == 2 && 2 < dim) {
54 test_exit(size == 1,
"Bases with more then one DoF per subentity are not yet supported.");
55 return localKey.index();
58 return localKey.index();
62 IdType
const& id(Dune::LocalKey
const& localKey,
int ii)
const
64 return ids_[refElem_->subEntity(localKey.subEntity(), localKey.codim(), ii, dim)];
69 RefElement
const* refElem_ =
nullptr;
70 std::vector<IdType> ids_;
Permutate the dof indices w.r.t. a global entity orientation.
Definition: Twist.hpp:15
Twist(IdSet const &idSet)
Constructor. Stores a reference to the passed idSet.
Definition: Twist.hpp:23
void bind(Element const &element)
Bind the twist to a codim-0 element. Calculates the global ids of all the element vertices.
Definition: Twist.hpp:29
unsigned int get(Dune::LocalKey const &localKey, unsigned int size) const
Get the permutated local dof index, living on a subEntity of the bound element.
Definition: Twist.hpp:48