dune-fem  2.8-git
rannacherturek.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_SPACE_RANNACHERTUREK_HH
2 #define DUNE_FEM_SPACE_RANNACHERTUREK_HH
3 
4 #if HAVE_DUNE_LOCALFUNCTIONS
5 // dune-localfunctions includes
6 
7 #include <dune/localfunctions/rannacherturek.hh>
9 
11 
12 namespace Dune
13 {
14  namespace Fem
15  {
16 
17  template< class FunctionSpace, class GridPart >
18  class RannacherTurekLocalFiniteElementMap
19  {
20  static const int dimLocal = GridPart::dimension;
21 
22  typedef RannacherTurekLocalFiniteElementMap< FunctionSpace, GridPart > ThisType;
24  "GridPart has more than one geometry type." );
26  ^ ((1 << dimLocal)-1)) >> 1 == 0),
27  "Space only defined on cube grids." );
28  public:
29  typedef GridPart GridPartType;
30 
31  typedef std::tuple< > KeyType;
32 
33  typedef typename FunctionSpace::DomainFieldType DomainFieldType;
34  typedef typename FunctionSpace::RangeFieldType RangeFieldType;
35 
36  typedef RannacherTurekLocalFiniteElement< DomainFieldType, RangeFieldType, dimLocal > LocalFiniteElementType;
37  typedef typename LocalFiniteElementType::Traits::LocalBasisType LocalBasisType;
38  typedef typename LocalFiniteElementType::Traits::LocalCoefficientsType LocalCoefficientsType;
39  typedef typename LocalFiniteElementType::Traits::LocalInterpolationType LocalInterpolationType;
40 
41  template< class ... Args >
42  RannacherTurekLocalFiniteElementMap ( const GridPart &gridPart, Args ... args )
43  : gridPart_( gridPart ) {}
44 
45  static std::size_t size () { return 1; }
46 
47  int order () const { return localFe_.localBasis().order(); }
48 
49  template< class Entity >
50  int order ( const Entity &entity ) const { return order(); }
51 
52  template< class Entity >
53  auto operator() ( const Entity &e ) const
54  {
55  return std::tuple< std::size_t, const LocalBasisType &, const LocalInterpolationType & >
56  { static_cast< std::size_t >( 0 ),
57  localFe_.localBasis(),
58  localFe_.localInterpolation() };
59  }
60 
61  bool hasCoefficients ( const GeometryType &type ) const { return type.isCube(); }
62 
63  const LocalCoefficientsType& localCoefficients ( const GeometryType &type ) const
64  {
65  return localFe_.localCoefficients();
66  }
67 
68  const GridPartType &gridPart () const { return gridPart_; }
69 
70  private:
71  LocalFiniteElementType localFe_;
72  const GridPartType &gridPart_;
73  };
74 
75  template< class FunctionSpace, class GridPart, class Storage = CachingStorage >
76  using RannacherTurekSpace
77  = LocalFiniteElementSpace< RannacherTurekLocalFiniteElementMap< FunctionSpace, GridPart >, FunctionSpace, Storage >;
78 
79  // deprecated old name
80  template< class FunctionSpace, class GridPart, class Storage = CachingStorage >
81  using RannacherTurekDiscreteFunctionSpace
82  = LocalFiniteElementSpace< RannacherTurekLocalFiniteElementMap< FunctionSpace, GridPart >, FunctionSpace, Storage >;
83 
84 
85  namespace Capabilities
86  {
87 
88  template< class FunctionSpace, class GridPart, class Storage >
89  struct hasFixedPolynomialOrder< LocalFiniteElementSpace< RannacherTurekLocalFiniteElementMap< FunctionSpace, GridPart >, FunctionSpace, Storage > >
90  {
91  static const bool v = true;
92  };
93 
94 
95  template< class FunctionSpace, class GridPart, class Storage >
96  struct hasStaticPolynomialOrder< LocalFiniteElementSpace< RannacherTurekLocalFiniteElementMap< FunctionSpace, GridPart >, FunctionSpace, Storage > >
97  {
98  static const bool v = true;
99  static const int order = 1;
100  };
101 
102 
103  template< class FunctionSpace, class GridPart, class Storage >
104  struct isContinuous< LocalFiniteElementSpace< RannacherTurekLocalFiniteElementMap< FunctionSpace, GridPart >, FunctionSpace, Storage > >
105  {
106  static const bool v = false;
107  };
108 
109 
110  template< class FunctionSpace, class GridPart, class Storage >
111  struct isLocalized< LocalFiniteElementSpace< RannacherTurekLocalFiniteElementMap< FunctionSpace, GridPart >, FunctionSpace, Storage > >
112  {
113  static const bool v = true;
114  };
115 
116 
117  template< class FunctionSpace, class GridPart, class Storage >
118  struct isAdaptive< LocalFiniteElementSpace< RannacherTurekLocalFiniteElementMap< FunctionSpace, GridPart >, FunctionSpace, Storage > >
119  {
120  static const bool v = true;
121  };
122 
123 
124  template< class FunctionSpace, class GridPart, class Storage >
125  struct threadSafe< LocalFiniteElementSpace< RannacherTurekLocalFiniteElementMap< FunctionSpace, GridPart >, FunctionSpace, Storage > >
126  {
127  static const bool v = false;
128  };
129 
130 
131  template< class FunctionSpace, class GridPart, class Storage >
132  struct viewThreadSafe< LocalFiniteElementSpace< RannacherTurekLocalFiniteElementMap< FunctionSpace, GridPart >, FunctionSpace, Storage > >
133  {
134  static const bool v = true;
135  };
136 
137  } // namespace Capabilities
138 
139 
140  } // end namespace Fem
141 } // end namespace Dune
142 
143 #endif // HAVE_DUNE_LOCALFUNCTIONS
144 #endif // #ifndef DUNE_FEM_SPACE_RANNACHERTUREK_HH
Definition: bindguard.hh:11
specialize with 'true' for if the codimension 0 entity of the grid part has only one possible geometr...
Definition: gridpart/common/capabilities.hh:29
static const bool v
Definition: space/common/capabilities.hh:25
static const bool v
Definition: space/common/capabilities.hh:38
static const int order
Definition: space/common/capabilities.hh:39
static const bool v
Definition: space/common/capabilities.hh:51
static const bool v
Definition: space/common/capabilities.hh:69
static const bool v
Definition: space/common/capabilities.hh:82
static const bool v
Definition: space/common/capabilities.hh:95
static const bool v
Definition: space/common/capabilities.hh:109
FunctionSpaceTraits::DomainFieldType DomainFieldType
Intrinsic type used for values in the domain field (usually a double)
Definition: functionspaceinterface.hh:60
FunctionSpaceTraits::RangeFieldType RangeFieldType
Intrinsic type used for values in the range field (usually a double)
Definition: functionspaceinterface.hh:63