1#ifndef DUNE_FEM_SPACE_RAVIARTTHOMAS_SPACE_HH
2#define DUNE_FEM_SPACE_RAVIARTTHOMAS_SPACE_HH
4#if HAVE_DUNE_LOCALFUNCTIONS
46 template<
unsigned int id,
class DomainField,
class RangeField,
int dimension,
int order >
47 struct RaviartThomasLocalFiniteElement
52 RaviartThomasLocalFiniteElement()
54 DUNE_THROW(NotImplemented,
"RaviartThomasLocalFiniteElement not implemented for your choice." );
59 template<
class D,
class R >
60 struct RaviartThomasLocalFiniteElement<
Dune::GeometryTypes::simplex( 2 ).
id(), D, R, 2, 0 >
61 :
public RT02DLocalFiniteElement< D, R >
64 using RT02DLocalFiniteElement< D, R >::RT02DLocalFiniteElement;
68 template<
class D,
class R >
69 struct RaviartThomasLocalFiniteElement<
Dune::GeometryTypes::simplex( 2 ).
id(), D, R, 2, 1 >
70 :
public RT12DLocalFiniteElement< D, R >
73 using RT12DLocalFiniteElement< D, R >::RT12DLocalFiniteElement;
77 template<
class D,
class R >
78 struct RaviartThomasLocalFiniteElement<
Dune::GeometryTypes::simplex( 3 ).
id(), D, R, 3, 0 >
79 :
public RT03DLocalFiniteElement< D, R >
82 using RT03DLocalFiniteElement< D, R >::RT03DLocalFiniteElement;
86 template<
class D,
class R >
87 struct RaviartThomasLocalFiniteElement<
Dune::GeometryTypes::cube( 2 ).
id(), D, R, 2, 0 >
88 :
public RT0Cube2DLocalFiniteElement< D, R >
91 using RT0Cube2DLocalFiniteElement< D, R >::RT0Cube2DLocalFiniteElement;
95 template<
class D,
class R >
96 struct RaviartThomasLocalFiniteElement<
Dune::GeometryTypes::cube( 2 ).
id(), D, R, 2, 1 >
97 :
public RT1Cube2DLocalFiniteElement< D, R >
100 using RT1Cube2DLocalFiniteElement< D, R >::RT1Cube2DLocalFiniteElement;
104 template<
class D,
class R >
105 struct RaviartThomasLocalFiniteElement<
Dune::GeometryTypes::cube( 2 ).
id(), D, R, 2, 2 >
106 :
public RT2Cube2DLocalFiniteElement< D, R >
109 using RT2Cube2DLocalFiniteElement< D, R >::RT2Cube2DLocalFiniteElement;
113 template<
class D,
class R >
114 struct RaviartThomasLocalFiniteElement<
Dune::GeometryTypes::cube( 2 ).
id(), D, R, 2, 3 >
115 :
public RT3Cube2DLocalFiniteElement< D, R >
118 using RT3Cube2DLocalFiniteElement< D, R >::RT3Cube2DLocalFiniteElement;
122 template<
class D,
class R >
123 struct RaviartThomasLocalFiniteElement<
Dune::GeometryTypes::cube( 2 ).
id(), D, R, 2, 4 >
124 :
public RT4Cube2DLocalFiniteElement< D, R >
127 using RT4Cube2DLocalFiniteElement< D, R >::RT4Cube2DLocalFiniteElement;
131 template<
class D,
class R >
132 struct RaviartThomasLocalFiniteElement<
Dune::GeometryTypes::cube( 3 ).
id(), D, R, 3, 0 >
133 :
public RT0Cube3DLocalFiniteElement< D, R >
136 using RT0Cube3DLocalFiniteElement< D, R >::RT0Cube3DLocalFiniteElement;
140 template<
class D,
class R >
141 struct RaviartThomasLocalFiniteElement<
Dune::GeometryTypes::cube( 3 ).
id(), D, R, 3, 1 >
142 :
public RT1Cube3DLocalFiniteElement< D, R >
145 using RT1Cube3DLocalFiniteElement< D, R >::RT1Cube3DLocalFiniteElement;
153 template<
class GridPart,
class FunctionSpace,
int polOrder = -1 >
154 class RaviartThomasLocalFiniteElementMap
156 using hasSingleGeometryType = GridPartCapabilities::hasSingleGeometryType< GridPart >;
158 static_assert( hasSingleGeometryType::v,
"`GridPart` has more the one geometry type." );
160 static constexpr int dimLocal = GridPart::dimension;
161 static constexpr unsigned int topologyId = hasSingleGeometryType::topologyId;
163 static_assert( dimLocal == FunctionSpace::dimRange,
"`dimRange` has to be equal to `GridPart::dimension`" );
165 using Geometry =
typename GridPart::template Codim< 0 >::EntityType::Geometry;
168 using GridPartType = GridPart;
170 using DomainFieldType =
typename FunctionSpace::DomainFieldType;
171 using RangeFieldType =
typename FunctionSpace::RangeFieldType;
173 typedef unsigned int KeyType;
175 using TransformationType = PiolaTransformation< Geometry, FunctionSpace::dimRange >;
179 static constexpr bool dynamicOrder = polOrder < 0;
181 using DomainType =
typename FunctionSpace::DomainType;
182 using RangeType =
typename FunctionSpace::RangeType;
183 typedef LocalBasisTraits<DomainFieldType, FunctionSpace::dimDomain, DomainType,
184 RangeFieldType, FunctionSpace::dimRange, RangeType,
185 typename FunctionSpace::JacobianRangeType > LBT;
189 Impl::RaviartThomasLocalFiniteElement< topologyId, DomainFieldType, RangeFieldType, dimLocal, 0 >::numOrientations;
195 LocalFiniteElementVirtualInterface< LBT >,
197 Impl::RaviartThomasLocalFiniteElement< topologyId, DomainFieldType,
198 RangeFieldType, dimLocal, polOrder > > :: type LocalFiniteElementType;
200 using LocalBasisType =
typename LocalFiniteElementType::Traits::LocalBasisType;
201 using LocalCoefficientsType =
typename LocalFiniteElementType::Traits::LocalCoefficientsType;
202 using LocalInterpolationType =
typename LocalFiniteElementType::Traits::LocalInterpolationType;
204 static constexpr auto size () ->
std::size_t {
return numOrientations; }
206 RaviartThomasLocalFiniteElementMap (
const GridPartType& gridPart,
const unsigned int ord )
207 : orientation_( gridPart ), order_( dynamicOrder ? ord : polOrder )
209 if constexpr ( dynamicOrder )
212 this->
template createLFE< 0 > ();
213 else if ( order_ == 1 )
214 this->
template createLFE< 1 > ();
215 else if ( order_ == 2 )
216 this->
template createLFE< 2 > ();
217 else if ( order_ == 3 )
218 this->
template createLFE< 3 > ();
219 else if ( order_ == 4 )
220 this->
template createLFE< 4 > ();
224 for (
auto i : range(
size() ) )
225 map_[ i ].
reset( new LocalFiniteElementType( i ) );
229 int order ()
const {
return order_; }
231 template<
class Entity >
232 int order (
const Entity& entity )
const {
return order(); }
234 template<
class Entity >
238 auto o = orientation_( entity );
240 static_cast< std::size_t >( o ), map( o ).localBasis(), map( o ).localInterpolation() );
243 auto localCoefficients (
const GeometryType& type )
const ->
const LocalCoefficientsType&
245 return map( 0 ).localCoefficients();
248 bool hasCoefficients (
const GeometryType& type )
const {
return type ==
GeometryType( topologyId, dimLocal ); }
249 auto gridPart () const -> const GridPartType& {
return orientation_.gridPart(); }
255 using LFEImpl = Impl::RaviartThomasLocalFiniteElement< topologyId, DomainFieldType, RangeFieldType, dimLocal, p >;
256 if constexpr ( LFEImpl::numOrientations > 0 )
258 using LFEObject = LocalFiniteElementVirtualImp< LFEImpl >;
259 for (
auto i : range(
size() ) )
262 map_[ i ].reset(
new LFEObject( imp ) );
267 DUNE_THROW(NotImplemented,
"RaviartThomasLocalFiniteElement not implemented for your choice." );
271 const LocalFiniteElementType& map(
const size_t i )
const
277 UniqueFacetOrientation< GridPartType > orientation_;
287 template<
class FunctionSpace,
class Gr
idPart,
int polOrder,
class Storage = CachingStorage >
288 using RaviartThomasSpace
289 = LocalFiniteElementSpace< RaviartThomasLocalFiniteElementMap< GridPart, FunctionSpace, polOrder >, FunctionSpace, Storage >;
292 template<
class FunctionSpace,
class Gr
idPart,
class Storage = CachingStorage >
293 using DynamicRaviartThomasSpace
294 = LocalFiniteElementSpace< RaviartThomasLocalFiniteElementMap< GridPart, FunctionSpace >, FunctionSpace, Storage >;
virtual void operator()()=0
#define DUNE_THROW(E,...)
GridImp::template Codim< cd >::Entity Entity