1#ifndef DUNE_FEM_SPACE_BREZZIDOUGLASFORTINMARINI_HH
2#define DUNE_FEM_SPACE_BREZZIDOUGLASFORTINMARINI_HH
4#if HAVE_DUNE_LOCALFUNCTIONS
36 template<
class GridPart,
class FunctionSpace,
int polOrder = -1 >
37 class BrezziDouglasFortinMariniLocalFiniteElementMap
39 using hasSingleGeometryType = GridPartCapabilities::hasSingleGeometryType< GridPart >;
41 static_assert( hasSingleGeometryType::v,
"`GridPart` has more the one geometry type." );
42 static_assert( GridPart::dimension == 2,
"`BDFM` basis only defined for quadrilaterals." );
44 static constexpr int dimLocal = GridPart::dimension;
45 static constexpr unsigned int topologyId = hasSingleGeometryType::topologyId;
46 static_assert( topologyId == Dune::GeometryTypes::cube(dimLocal).id(),
47 "Only defined for cube grids." );
49 static_assert( dimLocal == FunctionSpace::dimRange,
"`dimRange` has to be equal to `GridPart::dimension`" );
51 using Geometry =
typename GridPart::template Codim< 0 >::EntityType::Geometry;
54 static const bool dynamicOrder = polOrder < 0 ;
56 using GridPartType = GridPart;
58 using DomainFieldType =
typename FunctionSpace::DomainFieldType;
59 using RangeFieldType =
typename FunctionSpace::RangeFieldType;
62 using DomainType =
typename FunctionSpace::DomainType;
63 using RangeType =
typename FunctionSpace::RangeType;
64 typedef LocalBasisTraits<DomainFieldType, FunctionSpace::dimDomain, DomainType,
65 RangeFieldType, FunctionSpace::dimRange, RangeType,
66 typename FunctionSpace::JacobianRangeType > LBT;
72 LocalFiniteElementVirtualInterface< LBT >,
74 BDFMCubeLocalFiniteElement< DomainFieldType, RangeFieldType, dimLocal, polOrder > > :: type LocalFiniteElementType;
76 typedef unsigned int KeyType;
78 using TransformationType = PiolaTransformation< Geometry, FunctionSpace::dimRange >;
80 using LocalBasisType =
typename LocalFiniteElementType::Traits::LocalBasisType;
81 using LocalCoefficientsType =
typename LocalFiniteElementType::Traits::LocalCoefficientsType;
82 using LocalInterpolationType =
typename LocalFiniteElementType::Traits::LocalInterpolationType;
86 BrezziDouglasFortinMariniLocalFiniteElementMap (
const GridPartType& gridPart,
const unsigned int ord )
87 : orientation_( gridPart ), order_( dynamicOrder ? ord : polOrder )
89 if constexpr ( dynamicOrder )
92 this->
template createLFE< 1 >();
93 else if ( order_ == 2 )
94 this->
template createLFE< 2 >();
95 else if ( order_ == 3 )
96 this->
template createLFE< 3 >();
98 DUNE_THROW(NotImplemented,
"BDFMLocalFiniteElement not implemented for your choice." );
102 for (
auto i : range(
size() ) )
103 map_[ i ].
reset( new LocalFiniteElementType( i ) );
107 int order ()
const {
return order_; }
109 template<
class Entity >
110 int order (
const Entity& entity )
const {
return order(); }
112 template<
class Entity >
116 auto o = orientation_( entity );
118 static_cast< std::size_t >( o ), map( o ).localBasis(), map( o ).localInterpolation() );
121 auto localCoefficients (
const GeometryType& type )
const
122 ->
const LocalCoefficientsType&
124 return map( 0 ).localCoefficients();
127 bool hasCoefficients (
const GeometryType& type )
const {
return type ==
GeometryType( topologyId, dimLocal ); }
128 auto gridPart () const -> const GridPartType& {
return orientation_.gridPart(); }
134 using LFEImpl = BDFMCubeLocalFiniteElement< DomainFieldType, RangeFieldType, dimLocal, p >;
137 using LFEObject = LocalFiniteElementVirtualImp< LFEImpl >;
138 for (
auto i : range(
size() ) )
141 map_[ i ].reset(
new LFEObject( imp ) );
152 const LocalFiniteElementType& map(
const std::size_t i )
const
159 UniqueFacetOrientation< GridPartType > orientation_;
169 template<
class FunctionSpace,
class Gr
idPart,
int polOrder,
class Storage = CachingStorage >
170 using BrezziDouglasFortinMariniSpace
171 = LocalFiniteElementSpace< BrezziDouglasFortinMariniLocalFiniteElementMap< GridPart, FunctionSpace, polOrder >, FunctionSpace, Storage >;
173 template<
class FunctionSpace,
class Gr
idPart,
class Storage = CachingStorage >
174 using DynamicBrezziDouglasFortinMariniSpace
175 = LocalFiniteElementSpace< BrezziDouglasFortinMariniLocalFiniteElementMap< GridPart, FunctionSpace >, FunctionSpace, Storage >;
virtual void operator()()=0
#define DUNE_THROW(E,...)
constexpr Base power(Base m, Exponent p)
GridImp::template Codim< cd >::Entity Entity