DUNE PDELab (git)

lfeprebasismixin.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_LFEPREBASISMIXIN_HH
8#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_LFEPREBASISMIXIN_HH
9
10#include <cassert>
11#include <type_traits>
12
14
15#include <dune/functions/functionspacebases/leafprebasismappermixin.hh>
16#include <dune/functions/functionspacebases/nodes.hh>
17
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>
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)
104 -> LFEPreBasisMixin<GV,LFE>;
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
146 const FiniteElement& finiteElement () const
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:
160 const FiniteElement* lfe_;
161 const Element* element_;
162};
163
164
165} // end namespace Dune::Functions
166
167
168#endif // DUNE_FUNCTIONS_FUNCTIONSPACEBASES_LFEPREBASISMIXIN_HH
Leaf basis node that encapsulates a local finite-element given from the LFEPreBasisMixin of type LFE.
Definition: lfeprebasismixin.hh:120
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
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
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
A generic MixIn class for PreBasis with flat indices computed from a mapper.
Definition: leafprebasismappermixin.hh:62
GV GridView
Type of the associated GridView.
Definition: leafprebasismappermixin.hh:68
A few common exception classes.
std::function< size_t(GeometryType, int)> MCMGLayout
layout function for MultipleCodimMultipleGeomTypeMapper
Definition: mcmgmapper.hh:64
Mapper for multiple codim and multiple geometry types.
STL namespace.
Static tag representing a codimension.
Definition: dimension.hh:24
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 23, 23:29, 2024)