DUNE PDELab (2.8)

pqkfactory.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_LOCALFUNCTIONS_LAGRANGE_PQKFACTORY_HH
4#define DUNE_LOCALFUNCTIONS_LAGRANGE_PQKFACTORY_HH
5
6#include <map>
7
9
10#include <dune/localfunctions/common/virtualinterface.hh>
11#include <dune/localfunctions/common/virtualwrappers.hh>
12
13#include <dune/localfunctions/lagrange/p0.hh>
14#include <dune/localfunctions/lagrange/pk.hh>
15#include <dune/localfunctions/lagrange/q1.hh>
16#include <dune/localfunctions/lagrange/qk.hh>
17#include <dune/localfunctions/lagrange/prismp1.hh>
18#include <dune/localfunctions/lagrange/prismp2.hh>
19#include <dune/localfunctions/lagrange/pyramidp1.hh>
20#include <dune/localfunctions/lagrange/pyramidp2.hh>
21
22namespace Dune
23{
24
29 template<class D, class R, int d, int k>
31 {
33
36 {
37 return nullptr;
38 }
39 };
40
45 template<class D, class R, int k>
47 {
53
56 {
57 if ((gt.isPrism())and (k==1))
59 if ((gt.isPrism())and (k==2))
61 if ((gt.isPyramid())and (k==1))
63 if ((gt.isPyramid())and (k==2))
65 return nullptr;
66 }
67 };
68
69
73 template<class D, class R, int dim, int k>
75 {
81
82
85 {
86 if (k==0)
88
89 if (gt.isSimplex())
91
92 if (gt.isCube())
94
96 }
97 };
98
99
100
111 template<class D, class R, int dim, int k>
113 {
114 protected:
117 typedef typename std::map<GeometryType,FE*> FEMap;
118
119 public:
122
125
128 {
129 typename FEMap::iterator it = other.cache_.begin();
130 typename FEMap::iterator end = other.cache_.end();
131 for(; it!=end; ++it)
132 cache_[it->first] = (it->second)->clone();
133 }
134
136 {
137 typename FEMap::iterator it = cache_.begin();
138 typename FEMap::iterator end = cache_.end();
139 for(; it!=end; ++it)
140 delete it->second;
141 }
142
145 {
146 typename FEMap::const_iterator it = cache_.find(gt);
147 if (it==cache_.end())
148 {
150 if (fe==0)
151 DUNE_THROW(Dune::NotImplemented,"No Pk/Qk like local finite element available for geometry type " << gt << " and order " << k);
152
153 cache_[gt] = fe;
154 return *fe;
155 }
156 return *(it->second);
157 }
158
159 protected:
160 mutable FEMap cache_;
161
162 };
163
164}
165
166#endif
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:123
Lagrange finite element for cubes with arbitrary compile-time dimension and polynomial order.
Definition: lagrangecube.hh:709
Lagrange finite element for 3d prisms with arbitrary compile-time polynomial order.
Definition: lagrangeprism.hh:650
Lagrange finite element for 3d pyramids with compile-time polynomial order.
Definition: lagrangepyramid.hh:810
Lagrange finite element for simplices with arbitrary compile-time dimension and polynomial order.
Definition: lagrangesimplex.hh:836
class for wrapping a finite element using the virtual interface
Definition: virtualwrappers.hh:238
virtual base class for local finite elements with functions
Definition: virtualinterface.hh:284
Default exception for dummy implementations.
Definition: exceptions.hh:261
The local p0 finite element on all types of reference elements.
Definition: p0.hh:23
A cache that stores all available Pk/Qk like local finite elements for the given dimension and order.
Definition: pqkfactory.hh:113
PQkLocalFiniteElementCache()
Default constructor.
Definition: pqkfactory.hh:124
FE FiniteElementType
Type of the finite elements stored in this cache.
Definition: pqkfactory.hh:121
const FiniteElementType & get(const GeometryType &gt) const
Get local finite element for given GeometryType.
Definition: pqkfactory.hh:144
PQkLocalFiniteElementCache(const PQkLocalFiniteElementCache &other)
Copy constructor.
Definition: pqkfactory.hh:127
#define DUNE_THROW(E, m)
Definition: exceptions.hh:216
bool gt(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
test if first greater than second
Definition: float_cmp.cc:156
Dune namespace.
Definition: alignedallocator.hh:11
static LocalFiniteElementVirtualInterface< T > * create(const GeometryType &gt)
create finite element for given GeometryType
Definition: pqkfactory.hh:55
Factory that only creates dimension specific local finite elements.
Definition: pqkfactory.hh:31
static LocalFiniteElementVirtualInterface< T > * create(const GeometryType &)
create finite element for given GeometryType
Definition: pqkfactory.hh:35
Factory to create any kind of Pk/Qk like element wrapped for the virtual interface.
Definition: pqkfactory.hh:75
static FiniteElementType * create(const GeometryType &gt)
create finite element for given GeometryType
Definition: pqkfactory.hh:84
A unique label for each type of element that can occur in a grid.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 21, 23:30, 2024)