1#ifndef DUNE_FEM_SPACE_RAVIARTTHOMAS_SPACE_HH
2#define DUNE_FEM_SPACE_RAVIARTTHOMAS_SPACE_HH
4#if HAVE_DUNE_LOCALFUNCTIONS
17#include <dune/localfunctions/raviartthomas/raviartthomas02d.hh>
18#include <dune/localfunctions/raviartthomas/raviartthomas03d.hh>
19#include <dune/localfunctions/raviartthomas/raviartthomas0cube2d.hh>
20#include <dune/localfunctions/raviartthomas/raviartthomas0cube3d.hh>
21#include <dune/localfunctions/raviartthomas/raviartthomas12d.hh>
22#include <dune/localfunctions/raviartthomas/raviartthomas1cube2d.hh>
23#include <dune/localfunctions/raviartthomas/raviartthomas1cube3d.hh>
24#include <dune/localfunctions/raviartthomas/raviartthomas2cube2d.hh>
25#include <dune/localfunctions/raviartthomas/raviartthomas3cube2d.hh>
26#include <dune/localfunctions/raviartthomas/raviartthomas4cube2d.hh>
27#include <dune/localfunctions/common/virtualwrappers.hh>
30#include <dune/fem/space/common/uniquefacetorientation.hh>
31#include <dune/fem/space/basisfunctionset/piolatransformation.hh>
32#include <dune/fem/space/localfiniteelement/space.hh>
46 template<
unsigned int id,
class DomainField,
class RangeField,
int dimension,
int order >
47 struct RaviartThomasLocalFiniteElement
50 static constexpr std::size_t numOrientations = 0;
52 RaviartThomasLocalFiniteElement()
54 DUNE_THROW(NotImplemented,
"RaviartThomasLocalFiniteElement not implemented for your choice." );
59 template<
class D,
class R >
61 :
public RT02DLocalFiniteElement< D, R >
63 static constexpr std::size_t numOrientations = 8;
64 using RT02DLocalFiniteElement< D, R >::RT02DLocalFiniteElement;
68 template<
class D,
class R >
70 :
public RT12DLocalFiniteElement< D, R >
72 static constexpr std::size_t numOrientations = 8;
73 using RT12DLocalFiniteElement< D, R >::RT12DLocalFiniteElement;
77 template<
class D,
class R >
79 :
public RT03DLocalFiniteElement< D, R >
81 static constexpr std::size_t numOrientations = 16;
82 using RT03DLocalFiniteElement< D, R >::RT03DLocalFiniteElement;
86 template<
class D,
class R >
88 :
public RT0Cube2DLocalFiniteElement< D, R >
90 static constexpr std::size_t numOrientations = 16;
91 using RT0Cube2DLocalFiniteElement< D, R >::RT0Cube2DLocalFiniteElement;
95 template<
class D,
class R >
97 :
public RT1Cube2DLocalFiniteElement< D, R >
99 static constexpr std::size_t numOrientations = 16;
100 using RT1Cube2DLocalFiniteElement< D, R >::RT1Cube2DLocalFiniteElement;
104 template<
class D,
class R >
106 :
public RT2Cube2DLocalFiniteElement< D, R >
108 static constexpr std::size_t numOrientations = 16;
109 using RT2Cube2DLocalFiniteElement< D, R >::RT2Cube2DLocalFiniteElement;
113 template<
class D,
class R >
115 :
public RT3Cube2DLocalFiniteElement< D, R >
117 static constexpr std::size_t numOrientations = 16;
118 using RT3Cube2DLocalFiniteElement< D, R >::RT3Cube2DLocalFiniteElement;
122 template<
class D,
class R >
124 :
public RT4Cube2DLocalFiniteElement< D, R >
126 static constexpr std::size_t numOrientations = 16;
127 using RT4Cube2DLocalFiniteElement< D, R >::RT4Cube2DLocalFiniteElement;
131 template<
class D,
class R >
133 :
public RT0Cube3DLocalFiniteElement< D, R >
135 static constexpr std::size_t numOrientations = 64;
136 using RT0Cube3DLocalFiniteElement< D, R >::RT0Cube3DLocalFiniteElement;
140 template<
class D,
class R >
142 :
public RT1Cube3DLocalFiniteElement< D, R >
144 static constexpr std::size_t numOrientations = 64;
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;
165 using Geometry =
typename GridPart::template Codim< 0 >::EntityType::Geometry;
168 using GridPartType = GridPart;
173 typedef unsigned int KeyType;
175 using TransformationType = PiolaTransformation< Geometry, FunctionSpace::dimRange >;
179 static constexpr bool dynamicOrder = polOrder < 0;
188 static constexpr std::size_t numOrientations =
189 Impl::RaviartThomasLocalFiniteElement< topologyId, DomainFieldType, RangeFieldType, dimLocal, 0 >::numOrientations;
193 typedef typename std::conditional< dynamicOrder,
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 > ();
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 >
235 auto operator() (
const Entity& entity )
const
236 -> std::tuple< std::size_t, const LocalBasisType&, const LocalInterpolationType& >
238 auto o = orientation_( entity );
239 return std::tuple< std::size_t, const LocalBasisType&, const LocalInterpolationType& >(
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 >;
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_;
278 std::array< std::unique_ptr< LocalFiniteElementType >, numOrientations > map_;
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 >;
FunctionSpaceTraits::DomainFieldType DomainFieldType
Intrinsic type used for values in the domain field (usually a double)
Definition: functionspaceinterface.hh:60
FunctionSpaceTraits::RangeType RangeType
Type of range vector (using type of range field) has a Dune::FieldVector type interface.
Definition: functionspaceinterface.hh:71
@ dimDomain
dimension of domain vector space
Definition: functionspaceinterface.hh:46
@ dimRange
dimension of range vector space
Definition: functionspaceinterface.hh:48
FunctionSpaceTraits::LinearMappingType JacobianRangeType
Intrinsic type used for the jacobian values has a Dune::FieldMatrix type interface.
Definition: functionspaceinterface.hh:75
FunctionSpaceTraits::DomainType DomainType
Type of domain vector (using type of domain field) has a Dune::FieldVector type interface.
Definition: functionspaceinterface.hh:67
FunctionSpaceTraits::RangeFieldType RangeFieldType
Intrinsic type used for values in the range field (usually a double)
Definition: functionspaceinterface.hh:63
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
#define DUNE_THROW(E,...)
Definition: exceptions.hh:314
constexpr GeometryType cube(unsigned int dim)
Returns a GeometryType representing a hypercube of dimension dim.
Definition: type.hh:462
constexpr GeometryType simplex(unsigned int dim)
Returns a GeometryType representing a simplex of dimension dim.
Definition: type.hh:453
static constexpr IntegralRange< std::decay_t< T > > range(T &&from, U &&to) noexcept
free standing function for setting up a range based for loop over an integer range for (auto i: range...
Definition: rangeutilities.hh:288
Dune namespace
Definition: alignedallocator.hh:13
constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std::integer_sequence< T, II... >)
Return the size of the sequence.
Definition: integersequence.hh:75
A unique label for each type of element that can occur in a grid.
Traits for type conversions and type information.