3 #ifndef DUNE_PDELAB_GRIDFUNCTIONSPACE_DUNEFUNCTIONSLOCALFUNCTIONSPACE_HH
4 #define DUNE_PDELAB_GRIDFUNCTIONSPACE_DUNEFUNCTIONSLOCALFUNCTIONSPACE_HH
8 #include <dune/common/stdstreams.hh>
9 #include <dune/common/shared_ptr.hh>
11 #include <dune/geometry/referenceelements.hh>
13 #include <dune/localfunctions/common/interfaceswitch.hh>
14 #include <dune/localfunctions/common/localkey.hh>
16 #include <dune/typetree/typetree.hh>
28 namespace Experimental {
30 template<
typename LFS>
32 :
public TypeTree::LeafNode
37 return static_cast<const LFS*
>(
this)->tree().finiteElement();
40 template<
typename Tree>
48 template<
typename GFS,
typename TreePath = TypeTree::Hybr
idTreePath<>>
55 using Basis =
typename GFS::Basis;
57 using Tree = TypeTree::ChildForTreePath<typename LocalView::Tree,TreePath>;
58 using DOFIndex =
typename GFS::Ordering::Traits::DOFIndex;
60 template<
typename LFS,
typename C,
typename Tag,
bool fast>
68 using GridView =
typename GFS::Traits::GridView;
70 using DOFIndex =
typename GFS::Ordering::Traits::DOFIndex;
79 , _local_view(gfs->basis().localView())
80 , _tree_path(tree_path)
81 , _tree(TypeTree::child(_local_view.
tree(),tree_path))
92 return _local_view.size();
98 return _local_view.maxSize();
104 return _tree.localIndex(
index);
110 auto refElement = Dune::ReferenceElements<double,Basis::GridView::dimension>::general(_local_view.element().type());
112 auto localKey = _local_view.tree().finiteElement().localCoefficients().localKey(
index);
114 const auto& indexSet = _gfs->basis().gridView().indexSet();
117 auto gt = refElement.type(localKey.subEntity(), localKey.codim());
120 auto indexOnEntity = indexSet.subIndex(_local_view.element(),
121 localKey.subEntity(),
126 GFS::Ordering::Traits::DOFIndexAccessor::store(result,gt,indexOnEntity,localKey.index());
134 result.
set({_local_view.index(_tree.localIndex(
index))});
144 void bind(
const typename GFS::Traits::EntitySet::template Codim<0>::Entity&
e)
151 return _gfs->constraints();
163 return _gfs->ordering().containerIndex(i);
166 std::shared_ptr<const GFS> _gfs;
174 template<
typename DFBasis,
typename V,
typename CE=NoConstra
ints>
175 class GridFunctionSpace;
181 template<
typename DFBasis,
typename V,
typename CE,
typename TAG>
200 template<
typename DFBasis,
typename V,
typename CE>
std::size_t index
Definition: interpolate.hh:97
const Entity & e
Definition: localfunctionspace.hh:121
const std::size_t offset
Definition: localfunctionspace.hh:75
For backward compatibility – Do not use this!
Definition: adaptivity.hh:28
A multi-index representing a degree of freedom in a GridFunctionSpace.
Definition: dofindex.hh:148
A class for representing multi-indices.
Definition: multiindex.hh:29
void set(typename ReservedVector< T, n >::value_type index)
Definition: multiindex.hh:152
A pdelab grid function space implemented by a dune-functions function space basis.
Definition: dunefunctionsgridfunctionspace.hh:61
Definition: dunefunctionslocalfunctionspace.hh:33
const auto & finiteElement() const
Definition: dunefunctionslocalfunctionspace.hh:35
Definition: dunefunctionslocalfunctionspace.hh:42
typename Tree::FiniteElement FiniteElement
Definition: dunefunctionslocalfunctionspace.hh:43
FiniteElement FiniteElementType
Definition: dunefunctionslocalfunctionspace.hh:44
Definition: dunefunctionslocalfunctionspace.hh:51
const GFS & gridFunctionSpace() const
Returns the GridFunctionSpace underlying this LocalFunctionSpace.
Definition: dunefunctionslocalfunctionspace.hh:139
auto containerIndex(size_type index) const
Definition: dunefunctionslocalfunctionspace.hh:131
typename Basis::LocalView LocalView
Definition: dunefunctionslocalfunctionspace.hh:56
typename GFS::Basis Basis
Definition: dunefunctionslocalfunctionspace.hh:55
DOFIndex dofIndex(size_type index) const
Definition: dunefunctionslocalfunctionspace.hh:108
const Traits::ConstraintsType & constraints() const
Definition: dunefunctionslocalfunctionspace.hh:149
LocalFunctionSpace(std::shared_ptr< const GFS > gfs, TreePath tree_path=TreePath(), size_type offset=0)
Definition: dunefunctionslocalfunctionspace.hh:77
size_type size() const
get current size
Definition: dunefunctionslocalfunctionspace.hh:90
size_type localIndex(size_type index) const
map index in this local function space to root local function space
Definition: dunefunctionslocalfunctionspace.hh:102
void bind(const typename GFS::Traits::EntitySet::template Codim< 0 >::Entity &e)
Definition: dunefunctionslocalfunctionspace.hh:144
typename GFS::Ordering::Traits::DOFIndex DOFIndex
Definition: dunefunctionslocalfunctionspace.hh:58
size_type maxSize() const
Definition: dunefunctionslocalfunctionspace.hh:95
size_type subSpaceDepth() const
Definition: dunefunctionslocalfunctionspace.hh:84
const Tree & tree() const
Definition: dunefunctionslocalfunctionspace.hh:154
std::size_t size_type
Definition: dunefunctionslocalfunctionspace.hh:75
TypeTree::ChildForTreePath< typename LocalView::Tree, TreePath > Tree
Definition: dunefunctionslocalfunctionspace.hh:57
Definition: dunefunctionslocalfunctionspace.hh:65
GFS GridFunctionSpace
Definition: dunefunctionslocalfunctionspace.hh:67
typename GFS::Ordering::Traits::DOFIndex DOFIndex
Definition: dunefunctionslocalfunctionspace.hh:70
typename GFS::Traits::GridView GridView
Definition: dunefunctionslocalfunctionspace.hh:68
typename GFS::Traits::ConstraintsType ConstraintsType
Definition: dunefunctionslocalfunctionspace.hh:71
std::size_t SizeType
Definition: dunefunctionslocalfunctionspace.hh:69
LocalFunctionSpace(std::shared_ptr< const GFS > gfs)
Definition: dunefunctionslocalfunctionspace.hh:190
LocalFunctionSpace(const GFS &gfs)
Definition: dunefunctionslocalfunctionspace.hh:194
LocalFunctionSpace(std::shared_ptr< const GFS > gfs)
Definition: dunefunctionslocalfunctionspace.hh:209
LocalFunctionSpace(const GFS &gfs)
Definition: dunefunctionslocalfunctionspace.hh:213
A grid function space.
Definition: gridfunctionspace.hh:186
Definition: lfsindexcache.hh:245
Create a local function space from a global function space.
Definition: localfunctionspace.hh:717
Definition: localfunctionspacetags.hh:40