dune-localfunctions
2.3beta2
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
dune
localfunctions
dualmortarbasis
dualpq1factory.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_DUAL_P1_Q1_FACTORY_HH
4
#define DUNE_LOCALFUNCTIONS_DUAL_P1_Q1_FACTORY_HH
5
6
#include <
dune/localfunctions/common/virtualinterface.hh
>
7
#include <
dune/localfunctions/common/virtualwrappers.hh
>
8
9
#include <
dune/localfunctions/dualmortarbasis.hh
>
10
11
namespace
Dune {
12
13
template
<
class
D,
class
R,
int
dim>
14
class
DualPQ1LocalFiniteElementCache
15
{
16
protected
:
17
typedef
Dune::DualP1LocalFiniteElement<D,R,dim>
DualP1
;
18
typedef
Dune::DualQ1LocalFiniteElement<D,R,dim>
DualQ1
;
19
typedef
typename
Dune::FixedOrderLocalBasisTraits<typename DualP1::Traits::LocalBasisType::Traits,0>::Traits
T
;
20
typedef
Dune::LocalFiniteElementVirtualInterface<T>
FE
;
21
typedef
std::map<Dune::GeometryType,FE*>
FEMap
;
22
23
public
:
25
typedef
FE
FiniteElementType
;
26
27
~DualPQ1LocalFiniteElementCache
()
28
{
29
typename
FEMap::iterator it =
cache_
.begin();
30
typename
FEMap::iterator end =
cache_
.end();
31
for
(; it!=end; ++it)
32
delete
it->second;
33
}
34
36
static
FE
*
create
(
const
Dune::GeometryType& gt)
37
{
38
if
(gt.isSimplex())
39
return
new
Dune::LocalFiniteElementVirtualImp<DualP1>
(
DualP1
());
40
if
(gt.isCube())
41
return
new
Dune::LocalFiniteElementVirtualImp<DualQ1>
(
DualQ1
());
42
return
0;
43
}
44
46
const
FiniteElementType
&
get
(
const
Dune::GeometryType& gt)
const
47
{
48
typename
FEMap::const_iterator it =
cache_
.find(gt);
49
if
(it==
cache_
.end())
50
{
51
FiniteElementType
* fe =
create
(gt);
52
53
if
(fe==0)
54
DUNE_THROW(Dune::NotImplemented,
"No Dual P/Q1 like local finite element available for geometry type "
<< gt);
55
56
cache_
[gt] = fe;
57
return
*fe;
58
}
59
return
*(it->second);
60
}
61
62
protected
:
63
mutable
FEMap
cache_
;
64
};
65
66
}
// namespace Dune
67
68
#endif // DUNE_LOCALFUNCTIONS_DUAL_P1_Q1_FACTORY_HH
Generated on Mon Feb 10 2014 21:19:24 for dune-localfunctions by
1.8.1.2