DUNE-FUNCTIONS (unstable)

leafprebasismixin.hh
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3
4// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file AUTHORS.md
5// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception OR LGPL-3.0-or-later
6
7#ifndef DUNE_FUNCTIONS_FUNCTIONSPACEBASES_LEAFPREBASISMIXIN_HH
8#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_LEAFPREBASISMIXIN_HH
9
10#include <cassert>
11#include <cstddef>
12#include <type_traits>
13
14#include <dune/functions/functionspacebases/containerdescriptors.hh>
15
16namespace Dune::Functions {
17
34template<class Derived>
36{
37public:
39 using size_type = std::size_t;
40
42 static constexpr size_type maxMultiIndexSize = 1;
43
45 static constexpr size_type minMultiIndexSize = 1;
46
48 static constexpr size_type multiIndexBufferSize = 1;
49
51 template<class SizePrefix,
52 decltype(std::declval<SizePrefix>().size(), bool{}) = true>
53 size_type size(const SizePrefix& prefix) const
54 {
55 assert(prefix.size() == 0 || prefix.size() == 1);
56 return (prefix.size() == 0) ? derived().dimension() : 0;
57 }
58
61 {
62 return derived().dimension();
63 }
64
67 {
69 }
70
71private:
72 const Derived& derived() const
73 {
74 return static_cast<const Derived&>(*this);
75 }
76};
77
78
79} // end namespace Dune::Functions
80
81
82#endif // DUNE_FUNCTIONS_FUNCTIONSPACEBASES_LEAFPREBASISMIXIN_HH
A generic MixIn class for PreBasis.
Definition: leafprebasismixin.hh:36
size_type size(const SizePrefix &prefix) const
Return number of possible values for next position in multi index.
Definition: leafprebasismixin.hh:53
static constexpr size_type minMultiIndexSize
Minimal length of global multi-indices.
Definition: leafprebasismixin.hh:45
auto containerDescriptor() const
Return a flat container-descriptor.
Definition: leafprebasismixin.hh:66
static constexpr size_type maxMultiIndexSize
Maximal length of global multi-indices.
Definition: leafprebasismixin.hh:42
size_type size() const
Get the total dimension of the space spanned by this basis.
Definition: leafprebasismixin.hh:60
std::size_t size_type
Type used for indices and size information.
Definition: leafprebasismixin.hh:39
static constexpr size_type multiIndexBufferSize
Size required temporarily when constructing global multi-indices.
Definition: leafprebasismixin.hh:48
Uniform descriptor with dynamic size.
Definition: containerdescriptors.hh:168
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Aug 14, 22:29, 2024)