7#ifndef DUNE_FUNCTIONS_FUNCTIONSPACEBASES_CONCEPTS_HH
8#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_CONCEPTS_HH
14#include <dune/functions/common/utility.hh>
16#include <dune/functions/functionspacebases/nodes.hh>
29 auto require(C&& c) ->
decltype(
39 auto require(C&& c) ->
decltype(
48 template<
class C,
class I>
49 auto require(C&& c, I&& i) ->
decltype(
59 auto require(
const N& node) ->
decltype(
60 requireType<typename N::size_type>(),
61 requireConvertible<typename N::size_type>(node.size()),
62 requireConvertible<typename N::size_type>(node.localIndex(std::declval<typename N::size_type>())),
63 requireConvertible<typename N::size_type>(node.treeIndex()),
64 requireBaseOf<BasisNodeMixin, N>()
71template<
class Gr
idView>
72struct LeafBasisNode :
Refines<BasisNode>
75 auto require(
const N& node) ->
decltype(
76 requireType<typename N::Element>(),
77 requireType<typename N::FiniteElement>(),
78 requireConvertible<typename N::Element>(node.element()),
79 requireConvertible<const typename N::FiniteElement&>(node.finiteElement()),
80 requireSameType<typename N::Element, typename GridView::template Codim<0>::Entity>(),
81 requireBaseOf<Dune::Functions::LeafBasisNode, N>()
86template<
class Gr
idView>
90template<
class Gr
idView>
91struct PowerBasisNode :
Refines<BasisNode>
94 auto require(
const N& node) ->
decltype(
95 requireBaseOf<Dune::Functions::PowerBasisNode<
typename N::ChildType,
N::degree()>, N>(),
96 requireConcept<BasisTree<GridView>,
typename N::ChildType>()
101template<
class Gr
idView>
102struct DynamicPowerBasisNode :
Refines<BasisNode>
105 auto require(
const N& node) ->
decltype(
106 requireBaseOf<Dune::Functions::DynamicPowerBasisNode<typename N::ChildType>, N>(),
107 requireConcept<BasisTree<GridView>,
typename N::ChildType>()
112template<
class Gr
idView>
113struct CompositeBasisNode :
Refines<BasisNode>
116 auto require(
const N& node) ->
decltype(
117 requireBaseOf<ExpandTuple<Dune::Functions::template CompositeBasisNode, typename N::ChildTypes>, N>(),
118 requireConceptForTupleEntries<BasisTree<GridView>,
typename N::ChildTypes>()
124template<
class Gr
idView>
125struct BasisTree :
Refines<BasisNode>
128 static constexpr bool hasStaticDegree() {
133 auto require(
const N& node) ->
decltype(
134 requireConcept<std::conditional_t<N::isLeaf, LeafBasisNode<GridView>, BasisNode>, N>(),
135 requireConcept<std::conditional_t<N::isPower and hasStaticDegree<N>(), PowerBasisNode<GridView>, BasisNode>, N>(),
136 requireConcept<std::conditional_t<N::isPower and not hasStaticDegree<N>(), DynamicPowerBasisNode<GridView>, BasisNode>, N>(),
137 requireConcept<std::conditional_t<N::isComposite, CompositeBasisNode<GridView>, BasisNode>, N>()
143template<
class Gr
idView>
152 auto require(
const PB& preBasis) ->
decltype(
153 requireType<typename PB::GridView>(),
154 requireType<typename PB::size_type>(),
155 requireType<typename PB::Node>(),
156 requireConvertible<decltype(PB::maxMultiIndexSize), typename PB::size_type>(),
157 requireConvertible<decltype(PB::maxMultiIndexSize), typename PB::size_type>(),
158 requireConvertible<decltype(PB::multiIndexBufferSize), typename PB::size_type>(),
159 requireTrue<PB::minMultiIndexSize <= PB::maxMultiIndexSize>(),
160 requireTrue<PB::maxMultiIndexSize <= PB::multiIndexBufferSize>(),
161 requireSameType<typename PB::GridView, GridView>(),
162 const_cast<PB&
>(preBasis).initializeIndices(),
163 requireConvertible<typename PB::GridView>(preBasis.gridView()),
164 requireConvertible<typename PB::Node>(preBasis.makeNode()),
165 requireConvertible<typename PB::size_type>(preBasis.size()),
166 requireConvertible<typename PB::size_type>(preBasis.size(std::declval<MultiIndex<PB>>())),
167 requireConvertible<typename PB::size_type>(preBasis.dimension()),
168 requireConvertible<typename PB::size_type>(preBasis.maxNodeSize()),
169 requireSameType<decltype(const_cast<PB&>(preBasis).update(preBasis.gridView())),
void>(),
170 requireConcept<BasisTree<typename PB::GridView>>(preBasis.makeNode()),
171 requireConvertible<
typename std::vector<MultiIndex<PB>>::iterator>(
174 std::declval<typename std::vector<MultiIndex<PB>>::iterator>()))
181template<
class GlobalBasis>
185 auto require(
const V& localView) ->
decltype(
186 requireType<typename V::size_type>(),
187 requireType<typename V::MultiIndex>(),
188 requireType<typename V::GlobalBasis>(),
189 requireType<typename V::Tree>(),
190 requireType<typename V::GridView>(),
191 requireType<typename V::Element>(),
192 requireSameType<typename V::GlobalBasis, GlobalBasis>(),
193 requireSameType<typename V::GridView, typename GlobalBasis::GridView>(),
194 requireSameType<typename V::size_type, typename GlobalBasis::size_type>(),
195 requireSameType<typename V::Element, typename GlobalBasis::GridView::template Codim<0>::Entity>(),
196 const_cast<V&
>(localView).bind(std::declval<typename V::Element>()),
197 const_cast<V&
>(localView).unbind(),
198 requireConvertible<bool>(localView.bound()),
199 requireConvertible<typename V::Tree>(localView.tree()),
200 requireConvertible<typename V::size_type>(localView.size()),
201 requireConvertible<typename V::MultiIndex>(localView.index(std::declval<typename V::size_type>())),
202 requireConvertible<typename V::size_type>(localView.maxSize()),
203 requireConvertible<typename V::GlobalBasis>(localView.globalBasis()),
204 requireConcept<BasisTree<typename V::GridView>>(localView.tree()),
212template<
class Gr
idView>
216 auto require(
const B& basis) ->
decltype(
217 requireType<typename B::GridView>(),
218 requireType<typename B::size_type>(),
219 requireType<typename B::MultiIndex>(),
220 requireType<typename B::SizePrefix>(),
221 requireType<typename B::LocalView>(),
222 requireSameType<typename B::GridView, GridView>(),
223 requireConvertible<typename B::GridView>(basis.gridView()),
224 requireConvertible<typename B::LocalView>(basis.localView()),
225 requireConvertible<typename B::size_type>(basis.size()),
226 requireConvertible<typename B::size_type>(basis.size(std::declval<typename B::SizePrefix>())),
227 requireConvertible<typename B::size_type>(basis.dimension()),
228 requireSameType<decltype(const_cast<B&>(basis).update(basis.gridView())),
void>(),
229 requireConcept<LocalView<B>>(basis.localView())
A Vector class with statically reserved memory.
Definition: reservedvector.hh:47
Infrastructure for concepts.
std::size_t degree(const Node &node)
Returns the degree of node as run time information.
Definition: nodeinterface.hh:79
Namespace for concepts.
Definition: concept.hh:34
Dune namespace.
Definition: alignedallocator.hh:13
An stl-compliant random-access container which stores everything on the stack.
Base class for refined concepts.
Definition: concept.hh:54