Dune Core Modules (2.8.0)

sizeinfo.hh
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
A class encapsulating size information.
Definition: sizeinfo.hh:25
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
SizeInfo(const Basis &basis)
Construct from basis.
Definition: sizeinfo.hh:34
Dune namespace.
Definition: alignedallocator.hh:11
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 22, 23:30, 2024)