dune-functions 2.9.0
sizeinfo.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_FUNCTIONS_FUNCTIONSPACEBASES_SIZEINFO_HH
4#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_SIZEINFO_HH
5
6#include <array>
7
8namespace Dune {
9namespace Functions {
10
11
12
23template<class B>
25{
26public:
27 using Basis = B;
28 using size_type = typename Basis::size_type;
29 using SizePrefix = typename Basis::SizePrefix;
30
34 SizeInfo(const Basis& basis) :
35 basis_(&basis)
36 {}
37
41 size_type operator()(const SizePrefix& prefix) const
42 {
43 return basis_->size(prefix);
44 }
45
52 size_type size(const SizePrefix& prefix) const
53 {
54 return basis_->size(prefix);
55 }
56
57 operator size_type () const
58 {
59 return basis_->dimension();
60 }
61
62protected:
63
64 const Basis* basis_;
65};
66
67
68template<class Basis>
69SizeInfo<Basis> sizeInfo(const Basis& basis)
70{
71 return SizeInfo<Basis>(basis);
72}
73
74
75
76} // end namespace Functions
77} // end namespace Dune
78
79#endif // DUNE_FUNCTIONS_FUNCTIONSPACEBASES_SIZEINFO_HH
Definition: polynomial.hh:10
SizeInfo< Basis > sizeInfo(const Basis &basis)
Definition: sizeinfo.hh:69
A class encapsulating size information.
Definition: sizeinfo.hh:25
typename Basis::SizePrefix SizePrefix
Definition: sizeinfo.hh:29
size_type size(const SizePrefix &prefix) const
Return number possible values for next position in multi index.
Definition: sizeinfo.hh:52
size_type operator()(const SizePrefix &prefix) const
Return number possible values for next position in multi index.
Definition: sizeinfo.hh:41
typename Basis::size_type size_type
Definition: sizeinfo.hh:28
B Basis
Definition: sizeinfo.hh:27
SizeInfo(const Basis &basis)
Construct from basis.
Definition: sizeinfo.hh:34
const Basis * basis_
Definition: sizeinfo.hh:64