3#ifndef DUNE_FUNCTIONS_FUNCTIONSPACEBASES_SUBENTITYDOFS_HH
4#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_SUBENTITYDOFS_HH
8#include <dune/geometry/referenceelements.hh>
9#include <dune/typetree/traversal.hh>
40template<
class Gr
idView>
43 static const int dim = GridView::dimension;
63 template<
class LocalView>
64 SubEntityDOFs&
bind(
const LocalView& localView, std::size_t subEntityIndex, std::size_t subEntityCodim)
67 containedDOFs_.clear();
68 dofIsContained_.assign(localView.size(),
false);
70 auto re = Dune::referenceElement<double,dim>(localView.element().type());
72 Dune::TypeTree::forEachLeafNode(localView.tree(), [&](
auto&& node,
auto&& ) {
73 const auto& localCoefficients = node.finiteElement().localCoefficients();
74 std::size_t localSize = localCoefficients.size();
75 for(std::size_t i=0; i<localSize; ++i)
77 auto localKey = localCoefficients.localKey(i);
78 if (re.subEntities(subEntityIndex, subEntityCodim, localKey.codim()).contains(localKey.subEntity()))
80 containedDOFs_.push_back(node.localIndex(i));
81 dofIsContained_[node.localIndex(i)] = true;
103 template<
class LocalView,
class Intersection>
106 return bind(localView, intersection.indexInInside(), 1);
112 return containedDOFs_.cbegin();
118 return containedDOFs_.cend();
124 return containedDOFs_.size();
128 decltype(
auto)
operator[](std::size_t i)
const
130 return containedDOFs_[i];
136 return dofIsContained_[localIndex];
141 std::vector<std::size_t> containedDOFs_;
142 std::vector<bool> dofIsContained_;
186template<
class LocalView>
187auto subEntityDOFs(
const LocalView& localView, std::size_t subEntityIndex, std::size_t subEntityCodim)
189 using GridView =
typename LocalView::GridView;
191 subEntityDOFs.bind(localView, subEntityIndex, subEntityCodim);
215template<
class LocalView,
class Intersection>
216auto subEntityDOFs(
const LocalView& localView,
const Intersection& intersection)
218 using GridView =
typename LocalView::GridView;
auto subEntityDOFs(const LocalView &localView, const Intersection &intersection)
Create bound SubEntityDOFs object.
Definition: subentitydofs.hh:216
Definition: polynomial.hh:10
Range of DOFs associated to sub-entity.
Definition: subentitydofs.hh:42
auto begin() const
Create begin iterator for access to range of contained local indices.
Definition: subentitydofs.hh:110
auto size() const
Return number of contained DOFs.
Definition: subentitydofs.hh:122
SubEntityDOFs & bind(const LocalView &localView, const Intersection &intersection)
Bind SubEntityDOFs object to LocalView and sub-entity.
Definition: subentitydofs.hh:104
bool contains(std::size_t localIndex) const
Check if given local index is contained in this range of DOFs.
Definition: subentitydofs.hh:134
auto end() const
Create end iterator for access to range of contained local indices.
Definition: subentitydofs.hh:116
SubEntityDOFs & bind(const LocalView &localView, std::size_t subEntityIndex, std::size_t subEntityCodim)
Bind SubEntityDOFs object to LocalView and sub-entity.
Definition: subentitydofs.hh:64