dune-localfunctions  2.7.0
pqkfactory.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 #ifndef DUNE_LOCALFUNCTIONS_LAGRANGE_PQKFACTORY_HH
4 #define DUNE_LOCALFUNCTIONS_LAGRANGE_PQKFACTORY_HH
5 
6 #include <map>
7 
8 #include <dune/geometry/type.hh>
9 
12 
21 
22 namespace Dune
23 {
24 
29  template<class D, class R, int d, int k>
31  {
33 
35  static LocalFiniteElementVirtualInterface<T>* create(const GeometryType& gt)
36  {
37  return nullptr;
38  }
39  };
40 
45  template<class D, class R, int k>
47  {
53 
55  static LocalFiniteElementVirtualInterface<T>* create(const GeometryType& gt)
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 
84  static FiniteElementType* create(const GeometryType& gt)
85  {
86  if (k==0)
87  return new LocalFiniteElementVirtualImp<P0>(P0(gt));
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 
144  const FiniteElementType& get(const GeometryType& gt) const
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
Dune::DimSpecificPQkLocalFiniteElementFactory< D, R, 3, k >::PyramidP1
PyramidP1LocalFiniteElement< D, R > PyramidP1
Definition: pqkfactory.hh:51
Dune::LocalFiniteElementVirtualInterface
virtual base class for local finite elements with functions
Definition: virtualinterface.hh:259
Dune::PQkLocalFiniteElementFactory::P0
P0LocalFiniteElement< D, R, dim > P0
Definition: pqkfactory.hh:78
Dune::PQkLocalFiniteElementCache::FiniteElementType
FE FiniteElementType
Type of the finite elements stored in this cache.
Definition: pqkfactory.hh:121
pyramidp2.hh
virtualinterface.hh
Dune::DimSpecificPQkLocalFiniteElementFactory< D, R, 3, k >::T
P0LocalFiniteElement< D, R, 3 >::Traits::LocalBasisType::Traits T
Definition: pqkfactory.hh:48
Dune
Definition: bdfmcube.hh:15
Dune::PQkLocalFiniteElementFactory::create
static FiniteElementType * create(const GeometryType &gt)
create finite element for given GeometryType
Definition: pqkfactory.hh:84
prismp1.hh
Dune::PQkLocalFiniteElementCache
A cache that stores all available Pk/Qk like local finite elements for the given dimension and order.
Definition: pqkfactory.hh:112
virtualwrappers.hh
Dune::LagrangePrismLocalFiniteElement
Lagrange finite element for 3d prisms with arbitrary compile-time polynomial order.
Definition: lagrangeprism.hh:649
Dune::PQkLocalFiniteElementCache::FEMap
std::map< GeometryType, FE * > FEMap
Definition: pqkfactory.hh:117
Dune::PQkLocalFiniteElementFactory
Factory to create any kind of Pk/Qk like element wrapped for the virtual interface.
Definition: pqkfactory.hh:74
Dune::LagrangeCubeLocalFiniteElement
Lagrange finite element for cubes with arbitrary compile-time dimension and polynomial order.
Definition: lagrangecube.hh:708
Dune::DimSpecificPQkLocalFiniteElementFactory< D, R, 3, k >::PrismP2
PrismP2LocalFiniteElement< D, R > PrismP2
Definition: pqkfactory.hh:50
Dune::PQkLocalFiniteElementCache::FE
LocalFiniteElementVirtualInterface< T > FE
Definition: pqkfactory.hh:116
Dune::LocalFiniteElementVirtualImp
class for wrapping a finite element using the virtual interface
Definition: virtualwrappers.hh:19
Dune::DimSpecificPQkLocalFiniteElementFactory
Factory that only creates dimension specific local finite elements.
Definition: pqkfactory.hh:30
Dune::DimSpecificPQkLocalFiniteElementFactory< D, R, 3, k >::create
static LocalFiniteElementVirtualInterface< T > * create(const GeometryType &gt)
create finite element for given GeometryType
Definition: pqkfactory.hh:55
Dune::PQkLocalFiniteElementFactory::Qk
QkLocalFiniteElement< D, R, dim, k > Qk
Definition: pqkfactory.hh:80
Dune::PQkLocalFiniteElementCache::T
P0LocalFiniteElement< D, R, dim >::Traits::LocalBasisType::Traits T
Definition: pqkfactory.hh:115
Dune::PQkLocalFiniteElementCache::PQkLocalFiniteElementCache
PQkLocalFiniteElementCache()
Default constructor.
Definition: pqkfactory.hh:124
Dune::PQkLocalFiniteElementFactory::Pk
PkLocalFiniteElement< D, R, dim, k > Pk
Definition: pqkfactory.hh:79
Dune::PQkLocalFiniteElementCache::get
const FiniteElementType & get(const GeometryType &gt) const
Get local finite element for given GeometryType.
Definition: pqkfactory.hh:144
Dune::LagrangePyramidLocalFiniteElement
Lagrange finite element for 3d pyramids with arbitrary compile-time polynomial order.
Definition: lagrangepyramid.hh:788
Dune::DimSpecificPQkLocalFiniteElementFactory< D, R, 3, k >::PrismP1
PrismP1LocalFiniteElement< D, R > PrismP1
Definition: pqkfactory.hh:49
Dune::PQkLocalFiniteElementCache::cache_
FEMap cache_
Definition: pqkfactory.hh:160
qk.hh
pk.hh
Dune::DimSpecificPQkLocalFiniteElementFactory::T
P0LocalFiniteElement< D, R, d >::Traits::LocalBasisType::Traits T
Definition: pqkfactory.hh:32
p0.hh
q1.hh
Dune::PQkLocalFiniteElementFactory::T
P0LocalFiniteElement< D, R, dim >::Traits::LocalBasisType::Traits T
Definition: pqkfactory.hh:76
Dune::PQkLocalFiniteElementCache::PQkLocalFiniteElementCache
PQkLocalFiniteElementCache(const PQkLocalFiniteElementCache &other)
Copy constructor.
Definition: pqkfactory.hh:127
Dune::PQkLocalFiniteElementFactory::FiniteElementType
LocalFiniteElementVirtualInterface< T > FiniteElementType
Definition: pqkfactory.hh:77
Dune::LagrangeSimplexLocalFiniteElement
Lagrange finite element for simplices with arbitrary compile-time dimension and polynomial order.
Definition: lagrangesimplex.hh:835
Dune::P0LocalFiniteElement
The local p0 finite element on all types of reference elements.
Definition: p0.hh:22
prismp2.hh
Dune::DimSpecificPQkLocalFiniteElementFactory< D, R, 3, k >::PyramidP2
PyramidP2LocalFiniteElement< D, R > PyramidP2
Definition: pqkfactory.hh:52
pyramidp1.hh
Dune::PQkLocalFiniteElementCache::~PQkLocalFiniteElementCache
~PQkLocalFiniteElementCache()
Definition: pqkfactory.hh:135
Dune::DimSpecificPQkLocalFiniteElementFactory::create
static LocalFiniteElementVirtualInterface< T > * create(const GeometryType &gt)
create finite element for given GeometryType
Definition: pqkfactory.hh:35