1#ifndef DUNE_FEM_SPACE_BREZZIDOUGLASMARINI_HH
2#define DUNE_FEM_SPACE_BREZZIDOUGLASMARINI_HH
4#if HAVE_DUNE_LOCALFUNCTIONS
6#include <dune/localfunctions/brezzidouglasmarini/brezzidouglasmarini1cube2d.hh>
7#include <dune/localfunctions/brezzidouglasmarini/brezzidouglasmarini1cube3d.hh>
8#include <dune/localfunctions/brezzidouglasmarini/brezzidouglasmarini1simplex2d.hh>
9#include <dune/localfunctions/brezzidouglasmarini/brezzidouglasmarini2cube2d.hh>
10#include <dune/localfunctions/brezzidouglasmarini/brezzidouglasmarini2simplex2d.hh>
11#include <dune/localfunctions/common/virtualwrappers.hh>
13#include <dune/fem/space/common/uniquefacetorientation.hh>
14#include <dune/fem/space/basisfunctionset/piolatransformation.hh>
15#include <dune/fem/space/localfiniteelement/space.hh>
29 template<
unsigned int id,
class DomainField,
class RangeField,
int dimension,
int order >
30 struct BDMLocalFiniteElement
32 static const int numOrientations = 0;
41 :
public BDM1Cube2DLocalFiniteElement< D, D >
43 static const int numOrientations = 16;
44 template<
class ... Args >
45 BDMLocalFiniteElement ( Args && ... args )
46 : BDM1Cube2DLocalFiniteElement< D, D >(
std::forward< Args >( args ) ... ) {}
52 :
public BDM1Cube3DLocalFiniteElement< D, D >
54 static const int numOrientations = 64;
55 template<
class ... Args >
56 BDMLocalFiniteElement ( Args && ... args )
57 : BDM1Cube3DLocalFiniteElement< D, D >(
std::forward< Args >( args ) ... ) {}
63 :
public BDM2Cube2DLocalFiniteElement< D, D >
65 static const int numOrientations = 16;
66 template<
class ... Args >
67 BDMLocalFiniteElement ( Args && ... args )
68 : BDM2Cube2DLocalFiniteElement< D, D >(
std::forward< Args >( args ) ... ) {}
75 :
public BDM1Simplex2DLocalFiniteElement< D, D >
77 static const int numOrientations = 8;
78 template<
class ... Args >
79 BDMLocalFiniteElement ( Args && ... args )
80 : BDM1Simplex2DLocalFiniteElement< D, D >(
std::forward< Args >( args ) ... ) {}
86 :
public BDM2Simplex2DLocalFiniteElement< D, D >
88 static const int numOrientations = 8;
89 template<
class ... Args >
90 BDMLocalFiniteElement ( Args && ... args )
91 : BDM2Simplex2DLocalFiniteElement< D, D >(
std::forward< Args >( args ) ... ) {}
99 template<
class GridPart,
class FunctionSpace,
int polOrder = -1 >
100 class BrezziDouglasMariniLocalFiniteElementMap
102 typedef BrezziDouglasMariniLocalFiniteElementMap< GridPart, FunctionSpace, polOrder > ThisType;
104 "GridPart has more than one geometry type." );
109 typedef unsigned int KeyType;
111 typedef GridPart GridPartType;
116 typedef typename GridPartType::template Codim< 0 >::EntityType EntityType;
118 typedef PiolaTransformation< typename EntityType::Geometry, FunctionSpace::dimRange > TransformationType;
120 static const int dimLocal = GridPart::dimension;
130 static const bool dynamicOrder = polOrder < 0 ;
133 typedef typename std::conditional< dynamicOrder,
135 LocalFiniteElementVirtualInterface< LBT >,
137 Impl::BDMLocalFiniteElement< topologyId, DomainFieldType,
138 RangeFieldType, dimLocal, polOrder > > :: type LocalFiniteElementType;
141 typedef typename LocalFiniteElementType::Traits::LocalBasisType LocalBasisType;
142 typedef typename LocalFiniteElementType::Traits::LocalCoefficientsType LocalCoefficientsType;
143 typedef typename LocalFiniteElementType::Traits::LocalInterpolationType LocalInterpolationType;
145 BrezziDouglasMariniLocalFiniteElementMap (
const GridPart &gridPart,
const unsigned int ord )
146 : orientation_( gridPart ), order_( dynamicOrder ? ord : polOrder )
148 if constexpr ( dynamicOrder )
151 this->
template createLFE< 1 >();
152 else if ( order_ == 2 )
153 this->
template createLFE< 2 >();
155 DUNE_THROW(NotImplemented,
"RaviartThomasLocalFiniteElement not implemented for your choice." );
160 map_[ i ].reset(
new LocalFiniteElementType( i ) );
165 static constexpr std::size_t numOrientations = Impl::BDMLocalFiniteElement< topologyId, DomainFieldType,
166 RangeFieldType, dimLocal, 1 >::numOrientations;
168 static constexpr std::size_t
size () {
return numOrientations; }
170 int order ()
const {
return order_; }
172 template<
class Entity >
173 int order (
const Entity &entity )
const {
return order(); }
175 template<
class Entity >
176 auto operator() (
const Entity &e )
const
178 unsigned int orient = orientation_( e );
179 return std::tuple< std::size_t, const LocalBasisType&, const LocalInterpolationType& >
180 {
static_cast< std::size_t
>( orient ),
181 map( orient ).localBasis(),
182 map( orient ).localInterpolation() };
185 bool hasCoefficients (
const GeometryType &t )
const
187 Dune::GeometryType type( GridPartCapabilities::hasSingleGeometryType< GridPart >::topologyId, GridPart::dimension );
191 const LocalCoefficientsType &localCoefficients (
const GeometryType &type )
const
193 return map( 0 ).localCoefficients();
196 const GridPartType &gridPart ()
const {
return orientation_.gridPart(); }
202 using LFEImpl = Impl::BDMLocalFiniteElement< topologyId, DomainFieldType, RangeFieldType, dimLocal, p >;
203 if constexpr ( LFEImpl::numOrientations > 0 )
205 using LFEObject = LocalFiniteElementVirtualImp< LFEImpl >;
209 map_[ i ].reset(
new LFEObject( imp ) );
214 DUNE_THROW(NotImplemented,
"BDMLocalFiniteElement not implemented for your choice." );
218 const LocalFiniteElementType& map(
const std::size_t i )
const
224 UniqueFacetOrientation< GridPartType > orientation_;
225 std::array< std::unique_ptr< LocalFiniteElementType >, numOrientations > map_;
234 template<
class FunctionSpace,
class Gr
idPart,
int polOrder,
class Storage = CachingStorage >
235 using BrezziDouglasMariniSpace
236 = LocalFiniteElementSpace< BrezziDouglasMariniLocalFiniteElementMap< GridPart, FunctionSpace, polOrder >,
237 FunctionSpace, Storage >;
239 template<
class FunctionSpace,
class Gr
idPart,
class Storage = CachingStorage >
240 using DynamicBrezziDouglasMariniSpace
241 = LocalFiniteElementSpace< BrezziDouglasMariniLocalFiniteElementMap< GridPart, FunctionSpace >,
242 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
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:114
#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
specialize with 'true' for if the codimension 0 entity of the grid part has only one possible geometr...
Definition: capabilities.hh:29