7#ifndef DUNE_FUNCTIONS_FUNCTIONSPACEBASES_SUBENTITYDOFS_HH
8#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_SUBENTITYDOFS_HH
12#include <dune/geometry/referenceelements.hh>
13#include <dune/typetree/traversal.hh>
44template<
class Gr
idView>
47 static const int dim = GridView::dimension;
67 template<
class LocalView>
68 SubEntityDOFs&
bind(
const LocalView& localView, std::size_t subEntityIndex, std::size_t subEntityCodim)
71 containedDOFs_.clear();
72 dofIsContained_.assign(localView.size(),
false);
74 auto re = Dune::referenceElement<double,dim>(localView.element().type());
76 Dune::TypeTree::forEachLeafNode(localView.tree(), [&](
auto&& node,
auto&& ) {
77 const auto& localCoefficients = node.finiteElement().localCoefficients();
78 std::size_t localSize = localCoefficients.size();
79 for(std::size_t i=0; i<localSize; ++i)
81 auto localKey = localCoefficients.localKey(i);
82 if (re.subEntities(subEntityIndex, subEntityCodim, localKey.codim()).contains(localKey.subEntity()))
84 containedDOFs_.push_back(node.localIndex(i));
85 dofIsContained_[node.localIndex(i)] = true;
107 template<
class LocalView,
class Intersection>
110 return bind(localView, intersection.indexInInside(), 1);
116 return containedDOFs_.cbegin();
122 return containedDOFs_.cend();
128 return containedDOFs_.size();
132 decltype(
auto)
operator[](std::size_t i)
const
134 return containedDOFs_[i];
140 return dofIsContained_[localIndex];
145 std::vector<std::size_t> containedDOFs_;
146 std::vector<bool> dofIsContained_;
190template<
class LocalView>
191auto subEntityDOFs(
const LocalView& localView, std::size_t subEntityIndex, std::size_t subEntityCodim)
193 using GridView =
typename LocalView::GridView;
195 subEntityDOFs.bind(localView, subEntityIndex, subEntityCodim);
219template<
class LocalView,
class Intersection>
220auto subEntityDOFs(
const LocalView& localView,
const Intersection& intersection)
222 using GridView =
typename LocalView::GridView;
auto subEntityDOFs(const T &)
Create SubEntityDOFs object.
Definition subentitydofs.hh:164
Definition polynomial.hh:17
Range of DOFs associated to sub-entity.
Definition subentitydofs.hh:46
auto begin() const
Create begin iterator for access to range of contained local indices.
Definition subentitydofs.hh:114
auto size() const
Return number of contained DOFs.
Definition subentitydofs.hh:126
SubEntityDOFs & bind(const LocalView &localView, const Intersection &intersection)
Bind SubEntityDOFs object to LocalView and sub-entity.
Definition subentitydofs.hh:108
bool contains(std::size_t localIndex) const
Check if given local index is contained in this range of DOFs.
Definition subentitydofs.hh:138
auto end() const
Create end iterator for access to range of contained local indices.
Definition subentitydofs.hh:120
SubEntityDOFs & bind(const LocalView &localView, std::size_t subEntityIndex, std::size_t subEntityCodim)
Bind SubEntityDOFs object to LocalView and sub-entity.
Definition subentitydofs.hh:68