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#ifndef DUNE_FUNCTIONS_FUNCTIONSPACEBASES_LFEPREBASISMIXIN_HH
4#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_LFEPREBASISMIXIN_HH
5
6#include <cassert>
7#include <type_traits>
8
10
11#include <dune/functions/functionspacebases/leafprebasismappermixin.hh>
12#include <dune/functions/functionspacebases/nodes.hh>
13
15
16namespace Dune::Functions {
17
50template <class GV, class LFE>
52 public LeafPreBasisMapperMixin< GV >
53{
55
56public:
57
59 using GridView = GV;
60
62 class Node;
63
69 template <class LFE_ = LFE,
70 std::enable_if_t<std::is_default_constructible_v<LFE_>, int> = 0>
72 : Base(gv, layout)
73 , lfe_{}
74 {}
75
81 template <class LFE_>
82 LFEPreBasisMixin (const GridView& gv, LFE_&& lfe, MCMGLayout layout)
83 : Base(gv, layout)
84 , lfe_(std::forward<LFE_>(lfe))
85 {}
86
88 Node makeNode () const
89 {
90 return Node(lfe_);
91 }
92
93private:
94 LFE lfe_;
95};
96
97// deduction guide
98template <class GV, class LFE>
99LFEPreBasisMixin(const GV&, const LFE&, MCMGLayout)
100 -> LFEPreBasisMixin<GV,LFE>;
101
102
103
113template <class GV, class LFE>
114class LFEPreBasisMixin<GV,LFE>::Node
115 : public LeafBasisNode
116{
117 static constexpr int dim = GV::dimension;
118
119public:
120 using size_type = std::size_t;
121 using Element = typename GV::template Codim<0>::Entity;
122 using FiniteElement = LFE;
123
125 explicit Node (const LFE& lfe)
126 : lfe_{&lfe}
127 , element_{nullptr}
128 {}
129
131 const Element& element () const
132 {
133 assert(!!element_);
134 return *element_;
135 }
136
142 const FiniteElement& finiteElement () const
143 {
144 assert(!!lfe_);
145 return *lfe_;
146 }
147
149 void bind (const Element& e)
150 {
151 element_ = &e;
152 this->setSize(lfe_->size());
153 }
154
155protected:
156 const FiniteElement* lfe_;
157 const Element* element_;
158};
159
160
161} // end namespace Dune::Functions
162
163
164#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:116
const FiniteElement & finiteElement() const
Return the LocalFiniteElement for the element we are bound to; might raise an error if unbound.
Definition: lfeprebasismixin.hh:142
const Element & element() const
Return current element; might raise an error if unbound.
Definition: lfeprebasismixin.hh:131
void bind(const Element &e)
Bind to element. Stores a pointer to the passed element reference.
Definition: lfeprebasismixin.hh:149
Node(const LFE &lfe)
Constructor; stores a pointer to the passed local finite-element lfe.
Definition: lfeprebasismixin.hh:125
A pre-basis mixin class parametrized with a local finite-element and a DOF layout.
Definition: lfeprebasismixin.hh:53
LFEPreBasisMixin(const GridView &gv, LFE_ &&lfe, MCMGLayout layout)
Constructor for a given grid view object, local finite-element and layout.
Definition: lfeprebasismixin.hh:82
LFEPreBasisMixin(const GridView &gv, MCMGLayout layout)
Constructor for a given grid view object and layout.
Definition: lfeprebasismixin.hh:71
Node makeNode() const
Create tree node.
Definition: lfeprebasismixin.hh:88
A generic MixIn class for PreBasis with flat indices computed from a mapper.
Definition: leafprebasismappermixin.hh:58
GV GridView
Type of the associated GridView.
Definition: leafprebasismappermixin.hh:64
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 (Jul 15, 22:36, 2024)