dune-localfunctions 2.10
Loading...
Searching...
No Matches
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// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
5#ifndef DUNE_LOCALFUNCTIONS_DUAL_P1_Q1_FACTORY_HH
6#define DUNE_LOCALFUNCTIONS_DUAL_P1_Q1_FACTORY_HH
7
8#include <map>
9
12
14
15namespace Dune {
16
17template<class D, class R, int dim, bool faceDual=false>
19{
20protected:
25 typedef std::map<Dune::GeometryType,FE*> FEMap;
26
27public:
30
32 {
33 typename FEMap::iterator it = cache_.begin();
34 typename FEMap::iterator end = cache_.end();
35 for(; it!=end; ++it)
36 delete it->second;
37 }
38
40 static FE* create(const Dune::GeometryType& gt)
41 {
42 if (gt.isSimplex())
44 if (gt.isCube())
46 return 0;
47 }
48
50 const FiniteElementType& get(const Dune::GeometryType& gt) const
51 {
52 typename FEMap::const_iterator it = cache_.find(gt);
53 if (it==cache_.end())
54 {
55 FiniteElementType* fe = create(gt);
56
57 if (fe==0)
58 DUNE_THROW(Dune::NotImplemented,"No Dual P/Q1 like local finite element available for geometry type " << gt);
59
60 cache_[gt] = fe;
61 return *fe;
62 }
63 return *(it->second);
64 }
65
66protected:
67 mutable FEMap cache_;
68};
69
70} // namespace Dune
71
72#endif // DUNE_LOCALFUNCTIONS_DUAL_P1_Q1_FACTORY_HH
Definition bdfmcube.hh:18
traits helper struct
Definition localfiniteelementtraits.hh:13
virtual base class for local finite elements with functions
Definition virtualinterface.hh:225
class for wrapping a finite element using the virtual interface
Definition virtualwrappers.hh:240
The local dual p1 finite element on simplices.
Definition dualp1.hh:35
Definition dualpq1factory.hh:19
Dune::DualP1LocalFiniteElement< D, R, dim, faceDual > DualP1
Definition dualpq1factory.hh:21
~DualPQ1LocalFiniteElementCache()
Definition dualpq1factory.hh:31
FEMap cache_
Definition dualpq1factory.hh:67
DualP1::Traits::LocalBasisType::Traits T
Definition dualpq1factory.hh:23
static FE * create(const Dune::GeometryType &gt)
create finite element for given GeometryType
Definition dualpq1factory.hh:40
FE FiniteElementType
Type of the finite elements stored in this cache.
Definition dualpq1factory.hh:29
const FiniteElementType & get(const Dune::GeometryType &gt) const
Get local finite element for given GeometryType.
Definition dualpq1factory.hh:50
Dune::LocalFiniteElementVirtualInterface< T > FE
Definition dualpq1factory.hh:24
std::map< Dune::GeometryType, FE * > FEMap
Definition dualpq1factory.hh:25
Dune::DualQ1LocalFiniteElement< D, R, dim, faceDual > DualQ1
Definition dualpq1factory.hh:22
The local dual Q1 finite element on cubes.
Definition dualq1.hh:42