dune-functions 2.10
Loading...
Searching...
No Matches
lfeprebasismixin.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
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_LFEPREBASISMIXIN_HH
8#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_LFEPREBASISMIXIN_HH
9
10#include <cassert>
11#include <type_traits>
12
13#include <dune/common/exceptions.hh>
14
17
18#include <dune/grid/common/mcmgmapper.hh>
19
20namespace Dune::Functions {
21
54template <class GV, class LFE>
56 public LeafPreBasisMapperMixin< GV >
57{
59
60public:
61
63 using GridView = GV;
64
66 class Node;
67
73 template <class LFE_ = LFE,
74 std::enable_if_t<std::is_default_constructible_v<LFE_>, int> = 0>
75 LFEPreBasisMixin (const GridView& gv, MCMGLayout layout)
76 : Base(gv, layout)
77 , lfe_{}
78 {}
79
85 template <class LFE_>
86 LFEPreBasisMixin (const GridView& gv, LFE_&& lfe, MCMGLayout layout)
87 : Base(gv, layout)
88 , lfe_(std::forward<LFE_>(lfe))
89 {}
90
92 Node makeNode () const
93 {
94 return Node(lfe_);
95 }
96
97private:
98 LFE lfe_;
99};
100
101// deduction guide
102template <class GV, class LFE>
103LFEPreBasisMixin(const GV&, const LFE&, MCMGLayout)
105
106
107
117template <class GV, class LFE>
118class LFEPreBasisMixin<GV,LFE>::Node
119 : public LeafBasisNode
120{
121 static constexpr int dim = GV::dimension;
122
123public:
124 using size_type = std::size_t;
125 using Element = typename GV::template Codim<0>::Entity;
126 using FiniteElement = LFE;
127
129 explicit Node (const LFE& lfe)
130 : lfe_{&lfe}
131 , element_{nullptr}
132 {}
133
135 const Element& element () const
136 {
137 assert(!!element_);
138 return *element_;
139 }
140
147 {
148 assert(!!lfe_);
149 return *lfe_;
150 }
151
153 void bind (const Element& e)
154 {
155 element_ = &e;
156 this->setSize(lfe_->size());
157 }
158
159protected:
162};
163
164
165} // end namespace Dune::Functions
166
167
168#endif // DUNE_FUNCTIONS_FUNCTIONSPACEBASES_LFEPREBASISMIXIN_HH
Definition polynomial.hh:18
A generic MixIn class for PreBasis with flat indices computed from a mapper.
Definition leafprebasismappermixin.hh:62
A pre-basis mixin class parametrized with a local finite-element and a DOF layout.
Definition lfeprebasismixin.hh:57
LFEPreBasisMixin(const GridView &gv, LFE_ &&lfe, MCMGLayout layout)
Constructor for a given grid view object, local finite-element and layout.
Definition lfeprebasismixin.hh:86
LFEPreBasisMixin(const GridView &gv, MCMGLayout layout)
Constructor for a given grid view object and layout.
Definition lfeprebasismixin.hh:75
Node makeNode() const
Create tree node.
Definition lfeprebasismixin.hh:92
GV GridView
The grid view that the FE basis is defined on.
Definition lfeprebasismixin.hh:63
Leaf basis node that encapsulates a local finite-element given from the LFEPreBasisMixin of type LFE.
Definition lfeprebasismixin.hh:120
LFE FiniteElement
Definition lfeprebasismixin.hh:126
std::size_t size_type
Definition lfeprebasismixin.hh:124
const FiniteElement & finiteElement() const
Return the LocalFiniteElement for the element we are bound to; might raise an error if unbound.
Definition lfeprebasismixin.hh:146
const Element & element() const
Return current element; might raise an error if unbound.
Definition lfeprebasismixin.hh:135
const FiniteElement * lfe_
Definition lfeprebasismixin.hh:160
void bind(const Element &e)
Bind to element. Stores a pointer to the passed element reference.
Definition lfeprebasismixin.hh:153
Node(const LFE &lfe)
Constructor; stores a pointer to the passed local finite-element lfe.
Definition lfeprebasismixin.hh:129
typename GV::template Codim< 0 >::Entity Element
Definition lfeprebasismixin.hh:125
const Element * element_
Definition lfeprebasismixin.hh:161
Definition nodes.hh:191