3#ifndef DUNE_FUNCTIONS_FUNCTIONSPACEBASES_CONCEPTS_HH
4#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_CONCEPTS_HH
9#include <dune/functions/common/utility.hh>
11#include <dune/functions/functionspacebases/nodes.hh>
24 auto require(C&& c) ->
decltype(
34 auto require(C&& c) ->
decltype(
43 template<
class C,
class I>
44 auto require(C&& c, I&& i) ->
decltype(
54 auto require(
const N& node) ->
decltype(
55 requireType<typename N::size_type>(),
56 requireConvertible<typename N::size_type>(node.size()),
57 requireConvertible<typename N::size_type>(node.localIndex(std::declval<typename N::size_type>())),
58 requireConvertible<typename N::size_type>(node.treeIndex()),
59 requireBaseOf<BasisNodeMixin, N>()
66template<
class Gr
idView>
67struct LeafBasisNode :
Refines<BasisNode>
70 auto require(
const N& node) ->
decltype(
71 requireType<typename N::Element>(),
72 requireType<typename N::FiniteElement>(),
73 requireConvertible<typename N::Element>(node.element()),
74 requireConvertible<const typename N::FiniteElement&>(node.finiteElement()),
75 requireSameType<typename N::Element, typename GridView::template Codim<0>::Entity>(),
76 requireBaseOf<Dune::Functions::LeafBasisNode, N>()
81template<
class Gr
idView>
85template<
class Gr
idView>
86struct PowerBasisNode :
Refines<BasisNode>
89 auto require(
const N& node) ->
decltype(
90 requireBaseOf<Dune::Functions::PowerBasisNode<typename N::ChildType, N::CHILDREN>, N>(),
91 requireConcept<BasisTree<GridView>,
typename N::ChildType>()
97template<
class Gr
idView>
98struct CompositeBasisNode :
Refines<BasisNode>
101 auto require(
const N& node) ->
decltype(
102 requireBaseOf<ExpandTuple<Dune::Functions::template CompositeBasisNode, typename N::ChildTypes>, N>(),
103 requireConceptForTupleEntries<BasisTree<GridView>,
typename N::ChildTypes>()
109template<
class Gr
idView>
110struct BasisTree :
Refines<BasisNode>
113 auto require(
const N& node) ->
decltype(
114 requireConcept<typename std::conditional< N::isLeaf, LeafBasisNode<GridView>, BasisNode>::type, N>(),
115 requireConcept<
typename std::conditional< N::isPower, PowerBasisNode<GridView>, BasisNode>::type, N>(),
116 requireConcept<typename std::conditional< N::isComposite, CompositeBasisNode<GridView>, BasisNode>::type, N>()
123template<
class PreBasis>
127 auto require(
const I& indexSet) ->
decltype(
128 requireType<typename I::size_type>(),
129 requireType<typename I::MultiIndex>(),
130 requireType<typename I::PreBasis>(),
131 requireType<typename I::Node>(),
132 requireSameType<typename I::PreBasis, PreBasis>(),
133 const_cast<I&
>(indexSet).bind(std::declval<typename I::Node>()),
134 const_cast<I&
>(indexSet).unbind(),
135 requireConvertible<typename I::size_type>(indexSet.size()),
136 requireConvertible<typename std::vector<typename I::MultiIndex>::iterator>(
137 indexSet.indices(std::declval<
typename std::vector<typename I::MultiIndex>::iterator>()))
142#if defined(__GNUC__) || defined(__clang__)
143#pragma GCC diagnostic push
144#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
149template<
class Gr
idView>
150struct PreBasisWithNodeIndexSet
153 auto require(
const PB& preBasis) ->
decltype(
154 requireType<typename PB::IndexSet>(),
155 requireConvertible<typename PB::IndexSet>(preBasis.makeIndexSet()),
156 requireConcept<NodeIndexSet<PB>>(preBasis.makeIndexSet())
160#if defined(__GNUC__) || defined(__clang__)
161#pragma GCC diagnostic pop
167template<
class Gr
idView>
168struct PreBasisWithIndices
171 auto require(
const PB& preBasis) ->
decltype(
172 requireConvertible<typename std::vector<typename PB::MultiIndex>::iterator>(
175 std::declval<
typename std::vector<typename PB::MultiIndex>::iterator>()))
180template<
class Gr
idView>
184 auto require(
const PB& preBasis) ->
decltype(
185 requireType<typename PB::GridView>(),
186 requireType<typename PB::size_type>(),
187 requireType<typename PB::MultiIndex>(),
188 requireType<typename PB::SizePrefix>(),
189 requireType<typename PB::Node>(),
190 requireSameType<typename PB::GridView, GridView>(),
191 const_cast<PB&
>(preBasis).initializeIndices(),
192 requireConvertible<typename PB::GridView>(preBasis.gridView()),
193 requireConvertible<typename PB::Node>(preBasis.makeNode()),
194 requireConvertible<typename PB::size_type>(preBasis.size()),
195 requireConvertible<typename PB::size_type>(preBasis.size(std::declval<typename PB::SizePrefix>())),
196 requireConvertible<typename PB::size_type>(preBasis.dimension()),
197 requireConvertible<typename PB::size_type>(preBasis.maxNodeSize()),
198 requireSameType<decltype(const_cast<PB&>(preBasis).update(preBasis.gridView())),
void>(),
199 requireConcept<BasisTree<typename PB::GridView>>(preBasis.makeNode()),
200 requireTrue<
models<PreBasisWithNodeIndexSet<GridView>, PB>() or
models<PreBasisWithIndices<
GridView>, PB>()>()
213template<class GlobalBasis>
217 auto require(
const V& localView) ->
decltype(
218 requireType<typename V::size_type>(),
219 requireType<typename V::MultiIndex>(),
220 requireType<typename V::GlobalBasis>(),
221 requireType<typename V::Tree>(),
222 requireType<typename V::GridView>(),
223 requireType<typename V::Element>(),
224 requireSameType<typename V::GlobalBasis, GlobalBasis>(),
225 requireSameType<typename V::GridView, typename GlobalBasis::GridView>(),
226 requireSameType<typename V::size_type, typename GlobalBasis::size_type>(),
227 requireSameType<typename V::Element, typename GlobalBasis::GridView::template Codim<0>::Entity>(),
228 const_cast<V&
>(localView).bind(std::declval<typename V::Element>()),
229 const_cast<V&
>(localView).unbind(),
230 requireConvertible<typename V::Tree>(localView.tree()),
231 requireConvertible<typename V::size_type>(localView.size()),
232 requireConvertible<typename V::MultiIndex>(localView.index(std::declval<typename V::size_type>())),
233 requireConvertible<typename V::size_type>(localView.maxSize()),
234 requireConvertible<typename V::GlobalBasis>(localView.globalBasis()),
235 requireConcept<BasisTree<typename V::GridView>>(localView.tree()),
243template<
class Gr
idView>
247 auto require(
const B& basis) ->
decltype(
248 requireType<typename B::GridView>(),
249 requireType<typename B::size_type>(),
250 requireType<typename B::MultiIndex>(),
251 requireType<typename B::SizePrefix>(),
252 requireType<typename B::LocalView>(),
253 requireSameType<typename B::GridView, GridView>(),
254 requireConvertible<typename B::GridView>(basis.gridView()),
255 requireConvertible<typename B::LocalView>(basis.localView()),
256 requireConvertible<typename B::size_type>(basis.size()),
257 requireConvertible<typename B::size_type>(basis.size(std::declval<typename B::SizePrefix>())),
258 requireConvertible<typename B::size_type>(basis.dimension()),
259 requireSameType<decltype(const_cast<B&>(basis).update(basis.gridView())),
void>(),
260 requireConcept<LocalView<B>>(basis.localView())
Grid view abstract base class.
Definition: gridview.hh:63
Infrastructure for concepts.
constexpr auto models()
Check if concept is modeled by given types.
Definition: concept.hh:182
Namespace for concepts.
Definition: concept.hh:32
Dune namespace.
Definition: alignedallocator.hh:11
Base class for refined concepts.
Definition: concept.hh:52