Dune Core Modules (2.6.0)

dualpq1factory.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_DUAL_P1_Q1_FACTORY_HH
4#define DUNE_LOCALFUNCTIONS_DUAL_P1_Q1_FACTORY_HH
5
6#include <map>
7
8#include <dune/localfunctions/common/virtualinterface.hh>
9#include <dune/localfunctions/common/virtualwrappers.hh>
10
11#include <dune/localfunctions/dualmortarbasis.hh>
12
13namespace Dune {
14
15template<class D, class R, int dim, bool faceDual=false>
16class DualPQ1LocalFiniteElementCache
17{
18protected:
21 typedef typename DualP1::Traits::LocalBasisType::Traits T;
23 typedef std::map<Dune::GeometryType,FE*> FEMap;
24
25public:
27 typedef FE FiniteElementType;
28
29 ~DualPQ1LocalFiniteElementCache()
30 {
31 typename FEMap::iterator it = cache_.begin();
32 typename FEMap::iterator end = cache_.end();
33 for(; it!=end; ++it)
34 delete it->second;
35 }
36
38 static FE* create(const Dune::GeometryType& gt)
39 {
40 if (gt.isSimplex())
42 if (gt.isCube())
44 return 0;
45 }
46
48 const FiniteElementType& get(const Dune::GeometryType& gt) const
49 {
50 typename FEMap::const_iterator it = cache_.find(gt);
51 if (it==cache_.end())
52 {
53 FiniteElementType* fe = create(gt);
54
55 if (fe==0)
56 DUNE_THROW(Dune::NotImplemented,"No Dual P/Q1 like local finite element available for geometry type " << gt);
57
58 cache_[gt] = fe;
59 return *fe;
60 }
61 return *(it->second);
62 }
63
64protected:
65 mutable FEMap cache_;
66};
67
68} // namespace Dune
69
70#endif // DUNE_LOCALFUNCTIONS_DUAL_P1_Q1_FACTORY_HH
The local dual p1 finite element on simplices.
Definition: dualp1.hh:33
The local dual Q1 finite element on cubes.
Definition: dualq1.hh:40
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:277
class for wrapping a finite element using the virtual interface
Definition: virtualwrappers.hh:240
virtual base class for local finite elements with functions
Definition: virtualinterface.hh:266
Default exception for dummy implementations.
Definition: exceptions.hh:261
#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:147
Dune namespace.
Definition: alignedallocator.hh:10
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 24, 23:30, 2024)