1#ifndef DUNE_FEM_SPACE_RAVIARTTHOMAS_SPACE_HH
2#define DUNE_FEM_SPACE_RAVIARTTHOMAS_SPACE_HH
4#if HAVE_DUNE_LOCALFUNCTIONS
11#include <dune/common/typetraits.hh>
14#include <dune/geometry/type.hh>
17#include <dune/localfunctions/raviartthomas/raviartthomas02d.hh>
18#include <dune/localfunctions/raviartthomas/raviartthomas0cube2d.hh>
19#include <dune/localfunctions/raviartthomas/raviartthomas0cube3d.hh>
20#include <dune/localfunctions/raviartthomas/raviartthomas12d.hh>
21#include <dune/localfunctions/raviartthomas/raviartthomas1cube2d.hh>
22#include <dune/localfunctions/raviartthomas/raviartthomas1cube3d.hh>
23#include <dune/localfunctions/raviartthomas/raviartthomas2cube2d.hh>
24#include <dune/localfunctions/raviartthomas/raviartthomas3cube2d.hh>
25#include <dune/localfunctions/raviartthomas/raviartthomas4cube2d.hh>
45 template<
unsigned int id,
class DomainField,
class RangeField,
int dimension,
int order >
46 struct RaviartThomasLocalFiniteElement
48 static_assert( AlwaysFalse< DomainField >::value,
"RaviartThomasLocalFiniteElement not implemented for your choice." );
52 template<
class D,
class R >
53 struct RaviartThomasLocalFiniteElement<
Dune::GeometryTypes::simplex( 2 ).id(), D, R, 2, 0 >
54 :
public RT02DLocalFiniteElement< D, R >
56 static constexpr std::size_t numOrientations = 8;
57 using RT02DLocalFiniteElement< D, R >::RT02DLocalFiniteElement;
61 template<
class D,
class R >
62 struct RaviartThomasLocalFiniteElement<
Dune::GeometryTypes::simplex( 2 ).id(), D, R, 2, 1 >
63 :
public RT12DLocalFiniteElement< D, R >
65 static constexpr std::size_t numOrientations = 8;
66 using RT12DLocalFiniteElement< D, R >::RT12DLocalFiniteElement;
70 template<
class D,
class R >
71 struct RaviartThomasLocalFiniteElement<
Dune::GeometryTypes::cube( 2 ).id(), D, R, 2, 0 >
72 :
public RT0Cube2DLocalFiniteElement< D, R >
74 static constexpr std::size_t numOrientations = 16;
75 using RT0Cube2DLocalFiniteElement< D, R >::RT0Cube2DLocalFiniteElement;
79 template<
class D,
class R >
80 struct RaviartThomasLocalFiniteElement<
Dune::GeometryTypes::cube( 2 ).id(), D, R, 2, 1 >
81 :
public RT1Cube2DLocalFiniteElement< D, R >
83 static constexpr std::size_t numOrientations = 16;
84 using RT1Cube2DLocalFiniteElement< D, R >::RT1Cube2DLocalFiniteElement;
88 template<
class D,
class R >
89 struct RaviartThomasLocalFiniteElement<
Dune::GeometryTypes::cube( 2 ).id(), D, R, 2, 2 >
90 :
public RT2Cube2DLocalFiniteElement< D, R >
92 static constexpr std::size_t numOrientations = 16;
93 using RT2Cube2DLocalFiniteElement< D, R >::RT2Cube2DLocalFiniteElement;
97 template<
class D,
class R >
98 struct RaviartThomasLocalFiniteElement<
Dune::GeometryTypes::cube( 2 ).id(), D, R, 2, 3 >
99 :
public RT3Cube2DLocalFiniteElement< D, R >
101 static constexpr std::size_t numOrientations = 16;
102 using RT3Cube2DLocalFiniteElement< D, R >::RT3Cube2DLocalFiniteElement;
106 template<
class D,
class R >
107 struct RaviartThomasLocalFiniteElement<
Dune::GeometryTypes::cube( 2 ).id(), D, R, 2, 4 >
108 :
public RT4Cube2DLocalFiniteElement< D, R >
110 static constexpr std::size_t numOrientations = 16;
111 using RT4Cube2DLocalFiniteElement< D, R >::RT4Cube2DLocalFiniteElement;
115 template<
class D,
class R >
116 struct RaviartThomasLocalFiniteElement<
Dune::GeometryTypes::cube( 3 ).id(), D, R, 3, 0 >
117 :
public RT0Cube3DLocalFiniteElement< D, R >
119 static constexpr std::size_t numOrientations = 64;
120 using RT0Cube3DLocalFiniteElement< D, R >::RT0Cube3DLocalFiniteElement;
124 template<
class D,
class R >
125 struct RaviartThomasLocalFiniteElement<
Dune::GeometryTypes::cube( 3 ).id(), D, R, 3, 1 >
126 :
public RT1Cube3DLocalFiniteElement< D, R >
128 static constexpr std::size_t numOrientations = 64;
129 using RT1Cube3DLocalFiniteElement< D, R >::RT1Cube3DLocalFiniteElement;
138 template<
class Gr
idPart,
class FunctionSpace,
int polOrder >
139 class RaviartThomasLocalFiniteElementMap
141 using hasSingleGeometryType = GridPartCapabilities::hasSingleGeometryType< GridPart >;
143 static_assert( hasSingleGeometryType::v,
"`GridPart` has more the one geometry type." );
145 static constexpr int dimLocal = GridPart::dimension;
146 static constexpr unsigned int topologyId = hasSingleGeometryType::topologyId;
148 static_assert( dimLocal == FunctionSpace::dimRange,
"`dimRange` has to be equal to `GridPart::dimension`" );
150 using Geometry =
typename GridPart::template Codim< 0 >::EntityType::Geometry;
153 using GridPartType = GridPart;
155 using DomainFieldType =
typename FunctionSpace::DomainFieldType;
156 using RangeFieldType =
typename FunctionSpace::RangeFieldType;
158 using KeyType = std::tuple<>;
160 using TransformationType = PiolaTransformation< Geometry, FunctionSpace::dimRange >;
162 using LocalFiniteElementType =
163 Impl::RaviartThomasLocalFiniteElement< topologyId, DomainFieldType, RangeFieldType, dimLocal, polOrder >;
165 using LocalBasisType =
typename LocalFiniteElementType::Traits::LocalBasisType;
166 using LocalCoefficientsType =
typename LocalFiniteElementType::Traits::LocalCoefficientsType;
167 using LocalInterpolationType =
typename LocalFiniteElementType::Traits::LocalInterpolationType;
169 static constexpr auto size () -> std::size_t {
return LocalFiniteElementType::numOrientations; }
171 template<
class ... Args >
172 RaviartThomasLocalFiniteElementMap (
const GridPartType& gridPart, Args&& ... )
173 : orientation_( gridPart )
175 for (
auto i : range( size() ) )
176 map_[ i ] = LocalFiniteElementType( i );
179 int order ()
const {
return polOrder; }
181 template<
class Entity >
182 int order (
const Entity& entity )
const {
return order; }
184 template<
class Entity >
185 auto operator() (
const Entity& entity )
const
186 -> std::tuple< std::size_t, const LocalBasisType&, const LocalInterpolationType& >
188 auto o = orientation_( entity );
189 return std::tuple< std::size_t, const LocalBasisType&, const LocalInterpolationType& >(
190 static_cast< std::size_t
>( o ), map_[ o ].localBasis(), map_[ o ].localInterpolation() );
193 auto localCoefficients (
const GeometryType& type )
const
194 ->
const LocalCoefficientsType&
196 return map_[ 0 ].localCoefficients();
199 bool hasCoefficients (
const GeometryType& type )
const {
return type == GeometryType( topologyId, dimLocal ); }
200 auto gridPart () const -> const GridPartType& {
return orientation_.gridPart(); }
203 UniqueFacetOrientation< GridPartType > orientation_;
204 std::array< LocalFiniteElementType, LocalFiniteElementType::numOrientations > map_;
211 template<
class FunctionSpace,
class Gr
idPart,
int polOrder,
class Storage = CachingStorage >
212 using RaviartThomasSpace
213 = LocalFiniteElementSpace< RaviartThomasLocalFiniteElementMap< GridPart, FunctionSpace, polOrder >, FunctionSpace, Storage >;
Definition: bindguard.hh:11