1#ifndef SPACE_P1BUBBLE_HH
2#define SPACE_P1BUBBLE_HH
5#include <dune/common/exceptions.hh>
6#include <dune/geometry/referenceelements.hh>
7#include <dune/grid/common/gridenums.hh>
29 template<
class FunctionSpace >
41 points_[ i + 1 ][ i ] = 1.0;
50 template<
class LocalFunction,
class LocalDofVector >
58 lf.evaluate( x, phi );
60 ldv[ k++ ] = phi[ i ];
64 template <
class Entity>
65 void bind(
const Entity & ) {}
69 std::vector< DomainType > points_;
79 for(
int i = 0; i < vertices; ++i )
80 map_.emplace_back( i, dim, 0 );
81 map_.emplace_back( 0, 0, 0 );
85 std::size_t
size()
const {
return map_.size(); }
91 std::vector< LocalKey > map_;
98 template<
class RefElement,
99 std::enable_if_t< std::is_same< std::decay_t< decltype( std::declval< const RefElement & >().size( 0 ) ) >,
int >::value,
int > = 0,
100 std::enable_if_t< std::is_same< std::decay_t<
decltype( std::declval< const RefElement & >().type( 0, 0 ) ) >, GeometryType >::value,
int > = 0 >
103 static const int dim = RefElement::dimension;
104 if( refElement.type().isSimplex() )
106 if( refElement.type().isCube() && refElement.type().dim() == 2)
116 template<
class FunctionSpace >
121 static const int dimDomain = FunctionSpace :: dimDomain;
122 static const int polynomialOrder = dimDomain + 1;
123 static const int numShapeFunctions = dimDomain + 2;
128 static_assert( RangeType::dimension == 1,
"This is a scalar shapefunction set" );
134 template<
class GeometryType >
137 if( !gt.isSimplex() )
138 DUNE_THROW( NotImplemented,
"Wrong geometry type for Cube2DBubblelementShapeFunctionSet." );
141 template<
class Po
int,
class Functor >
146 for(
int i=0; i< dimDomain; ++i )
149 phi0[ 0 ] -= xRef[ i ];
150 phi[ 0 ] *= xRef[ i ] ;
153 phi[ 0 ] *= phi0[ 0 ] /
std::pow( ( dimDomain + 1.0 ), dimDomain + 1.0 );
155 functor( dimDomain +1, phi );
158 template<
class Po
int,
class Functor >
168 for(
int i=0; i< dimDomain; ++i )
170 phi0[ 0 ] -= xRef[ i ];
172 for(
int j=1; j < dimDomain; ++j )
173 jac0[ 0 ][ (i+j)%dimDomain ] *= xRef[ i ];
180 for(
int i=0; i< dimDomain; ++i )
181 jac0[ 0 ][ i ] *= -(phi0[ 0 ] - xRef[ i ]);
182 jac0[ 0 ] *= 1.0 /
std::pow( dimDomain + 1.0, dimDomain + 1.0 );
183 functor( dimDomain +1, jac0 );
186 template<
class Po
int,
class Functor >
189 DUNE_THROW( NotImplemented,
"NotImplemented" );
198 int order ()
const {
return dimDomain + 1; }
200 std::size_t
size ()
const {
return dimDomain +2; }
205 template<
class FunctionSpace >
210 static const int dimDomain = FunctionSpace :: dimDomain;
211 static const int polynomialOrder = dimDomain + 1;
212 static const int numShapeFunctions = dimDomain + 2;
217 static_assert( RangeType::dimension == 1,
"This is a scalar shapefunction set" );
224 template<
class GeometryType >
228 DUNE_THROW( NotImplemented,
"Wrong geometry type for Cube2DBubblelementShapeFunctionSet." );
230 DUNE_THROW( NotImplemented,
"2DCubeBubbleElementShapeFunctionSet only implemented for dimension = 2." );
233 template<
class Po
int,
class Functor >
240 phi0[0] = (1.-xRef[0])*(1.-xRef[1]);
243 phi[0] = xRef[0]*(1.-xRef[1]);
246 phi[0] = (1.-xRef[0])*xRef[1];
249 phi[0] = xRef[0]*xRef[1];
253 phi[0] = 64.*phi0[0]*phi0[0]*xRef[0]*xRef[1];
257 template<
class Po
int,
class Functor >
264 phi0[0] = (1.-xRef[0])*(1.-xRef[1]);
265 jac0[0] = {xRef[1]-1,xRef[0]-1};
268 jac[0] = {1-xRef[1],xRef[0]};
270 jac[0] = {xRef[1],1-xRef[0]};
272 jac[0] = {xRef[1],xRef[0]};
276 jac0[0] *= 128.*phi0*xRef[0]*xRef[1];
277 jac[0] = {xRef[1],xRef[0]};
278 jac[0] *= 64.*phi0*phi0;
283 template<
class Po
int,
class Functor >
286 DUNE_THROW( NotImplemented,
"NotImplemented" );
297 std::size_t
size ()
const {
return 5; }
300 template<
class FunctionSpace,
class Gr
idPart,
class Storage >
301 class BubbleElementSpace;
306 template<
class FunctionSpace,
class Gr
idPart,
class Storage >
314 static const int codimension = 0;
317 typedef typename GridPartType::template Codim< codimension >::EntityType EntityType;
326 static_assert( Dune::Capabilities::hasSingleGeometryType<typename GridPartType::GridType>::v,
327 "bubble elements only implemented for grids with a single geometry type" );
328 static const unsigned int topologyId =
329 Dune::Capabilities::hasSingleGeometryType<typename GridPartType::GridType>::topologyId;
334 typedef typename std::conditional< topologyId == 0,
343 static const int localBlockSize = FunctionSpaceType::dimRange;
344 static const int polynomialOrder = ScalarShapeFunctionSetType::polynomialOrder;
349 template <
class DiscreteFunction,
class Operation = DFCommunicationOperation::Add >
361 template<
class FunctionSpace,
class Gr
idPart,
class Storage = CachingStorage >
423 template<
class Entity>
424 int order (
const Entity &entity )
const
430 template<
class EntityType >
468 class NewFunctionSpace >
474 template<
class FunctionSpace,
class Gr
idPart,
class Storage >
Dune::Fem::Double pow(const Dune::Fem::Double &a, const Dune::Fem::Double &b)
Definition: double.hh:947
Definition: bindguard.hh:11
double pow(const Double &a, const double b)
Definition: double.hh:881
DofMapperCode compile(const RefElement &refElement, const LocalCoefficients &localCoefficients)
Definition: compile.hh:50
static const Point & coordinate(const Point &x)
Definition: coordinate.hh:14
Definition: explicitfieldvector.hh:75
interface for local functions
Definition: localfunction.hh:77
Definition: space/basisfunctionset/default.hh:52
Default communication handler for discrete functions.
Definition: defaultcommhandler.hh:29
Definition: discretefunctionspace.hh:133
Traits::BasisFunctionSetType BasisFunctionSetType
type of basis function set of this space
Definition: discretefunctionspace.hh:200
GridPartType::IntersectionType IntersectionType
type of the intersections
Definition: discretefunctionspace.hh:225
This is the class with default implementations for discrete function. The methods not marked with hav...
Definition: discretefunctionspace.hh:628
BaseType::EntityType EntityType
Definition: discretefunctionspace.hh:644
BaseType::BlockMapperType BlockMapperType
Definition: discretefunctionspace.hh:660
BaseType::GridPartType GridPartType
Definition: discretefunctionspace.hh:640
GridPartType & gridPart() const
Definition: discretefunctionspace.hh:745
A vector valued function space.
Definition: functionspace.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::DomainType DomainType
Type of domain vector (using type of domain field) has a Dune::FieldVector type interface.
Definition: functionspaceinterface.hh:67
Definition: common/localrestrictprolong.hh:16
Definition: common/localrestrictprolong.hh:107
Definition: indexsetdofmapper.hh:719
Definition: localkey.hh:21
Definition: p1bubble.hh:31
FunctionSpace::RangeType RangeType
Definition: p1bubble.hh:33
LocalBubbleElementInterpolation()
Definition: p1bubble.hh:37
LocalBubbleElementInterpolation(LocalBubbleElementInterpolation &&)=default
void operator()(const LocalFunction &lf, LocalDofVector &ldv) const
[Evaluation of local interpolations]
Definition: p1bubble.hh:51
void unbind()
Definition: p1bubble.hh:66
static const int dimRange
Definition: p1bubble.hh:35
void bind(const Entity &)
Definition: p1bubble.hh:65
LocalBubbleElementInterpolation(const LocalBubbleElementInterpolation &)=default
static const int dimDomain
Definition: p1bubble.hh:34
FunctionSpace::DomainType DomainType
Definition: p1bubble.hh:32
Definition: p1bubble.hh:75
std::size_t size() const
[Constructor of LocalKey tripple]
Definition: p1bubble.hh:85
BubbleElementLocalKeyMap(int vertices)
[Constructor of LocalKey tripple]
Definition: p1bubble.hh:77
LocalKey & localKey(std::size_t i)
Definition: p1bubble.hh:87
const LocalKey & localKey(std::size_t i) const
Definition: p1bubble.hh:88
Definition: p1bubble.hh:95
Definition: p1bubble.hh:118
FunctionSpace::DomainType DomainType
Definition: p1bubble.hh:126
void hessianEach(const Point &x, Functor functor) const
Definition: p1bubble.hh:187
SimplexBubbleElementShapeFunctionSet()
Definition: p1bubble.hh:132
FunctionSpace FunctionSpaceType
Definition: p1bubble.hh:125
std::size_t size() const
Definition: p1bubble.hh:200
int order() const
Definition: p1bubble.hh:198
FunctionSpace::JacobianRangeType JacobianRangeType
Definition: p1bubble.hh:129
FunctionSpace::HessianRangeType HessianRangeType
Definition: p1bubble.hh:130
void jacobianEach(const Point &x, Functor functor) const
Definition: p1bubble.hh:159
FunctionSpace::RangeType RangeType
Definition: p1bubble.hh:127
void evaluateEach(const Point &x, Functor functor) const
Definition: p1bubble.hh:142
SimplexBubbleElementShapeFunctionSet(const GeometryType >)
Definition: p1bubble.hh:135
Definition: p1bubble.hh:207
void evaluateEach(const Point &x, Functor functor) const
[Main methods for shape functions]
Definition: p1bubble.hh:234
FunctionSpace::HessianRangeType HessianRangeType
Definition: p1bubble.hh:219
Cube2DBubbleElementShapeFunctionSet()
[Main methods for shape functions]
Definition: p1bubble.hh:222
FunctionSpace::RangeType RangeType
Definition: p1bubble.hh:216
int order() const
Definition: p1bubble.hh:295
FunctionSpace::JacobianRangeType JacobianRangeType
Definition: p1bubble.hh:218
void jacobianEach(const Point &x, Functor functor) const
Definition: p1bubble.hh:258
std::size_t size() const
Definition: p1bubble.hh:297
FunctionSpace FunctionSpaceType
Definition: p1bubble.hh:214
FunctionSpace::DomainType DomainType
Definition: p1bubble.hh:215
Cube2DBubbleElementShapeFunctionSet(const GeometryType >)
Definition: p1bubble.hh:225
void hessianEach(const Point &x, Functor functor) const
Definition: p1bubble.hh:284
[Class definition for new space]
Definition: p1bubble.hh:365
BaseType::IntersectionType IntersectionType
Definition: p1bubble.hh:377
InterpolationType interpolation() const
return local interpolation object for LocalInterpolation
Definition: p1bubble.hh:445
BlockMapperType & blockMapper() const
obtain the DoF block mapper of this space
Definition: p1bubble.hh:439
BubbleElementSpaceTraits< FunctionSpace, GridPart, Storage > Traits
Definition: p1bubble.hh:370
bool continuous(const IntersectionType &intersection) const
returns true if the space contains only globally continuous functions
Definition: p1bubble.hh:410
int order() const
get global order of space
Definition: p1bubble.hh:417
BubbleElementSpace(GridPartType &gridPart, const InterfaceType commInterface=defaultInterface, const CommunicationDirection commDirection=defaultDirection)
Definition: p1bubble.hh:389
BasisFunctionSetType basisFunctionSet(const EntityType &entity) const
Definition: p1bubble.hh:431
BaseType::BasisFunctionSetType BasisFunctionSetType
Definition: p1bubble.hh:376
static const int polynomialOrder
Definition: p1bubble.hh:372
LocalBubbleElementInterpolation< FunctionSpace > InterpolationType
Definition: p1bubble.hh:383
Traits::ShapeFunctionSetType ShapeFunctionSetType
Definition: p1bubble.hh:371
~BubbleElementSpace()
Definition: p1bubble.hh:397
static const CommunicationDirection defaultDirection
Definition: p1bubble.hh:387
BlockMapperType blockMapper_
Definition: p1bubble.hh:462
bool continuous() const
Definition: p1bubble.hh:407
BaseType::EntityType EntityType
Definition: p1bubble.hh:378
int order(const Entity &entity) const
get global order of space
Definition: p1bubble.hh:424
BaseType::GridPartType GridPartType
Definition: p1bubble.hh:374
InterpolationType interpolation(const EntityType &entity) const
return local interpolation for given entity
Definition: p1bubble.hh:456
BaseType::BlockMapperType BlockMapperType
Definition: p1bubble.hh:380
bool contains(const int codim) const
Definition: p1bubble.hh:401
static const InterfaceType defaultInterface
Definition: p1bubble.hh:386
Definition: p1bubble.hh:308
DefaultBasisFunctionSet< EntityType, ShapeFunctionSetType > BasisFunctionSetType
Definition: p1bubble.hh:340
BubbleElementSpace< FunctionSpace, GridPart, Storage > DiscreteFunctionSpaceType
Definition: p1bubble.hh:309
std::conditional< topologyId==0, ScalarSimplexShapeFunctionSetType, ScalarCubeShapeFunctionSetType >::type ScalarShapeFunctionSetType
Definition: p1bubble.hh:336
FunctionSpace FunctionSpaceType
Definition: p1bubble.hh:311
SimplexBubbleElementShapeFunctionSet< ScalarFunctionSpaceType > ScalarSimplexShapeFunctionSetType
Definition: p1bubble.hh:332
static const int polynomialOrder
Definition: p1bubble.hh:344
FunctionSpaceType::ScalarFunctionSpaceType ScalarFunctionSpaceType
Definition: p1bubble.hh:319
GridPart GridPartType
Definition: p1bubble.hh:312
VectorialShapeFunctionSet< ScalarShapeFunctionSetType, typename FunctionSpaceType::RangeType > ShapeFunctionSetType
Definition: p1bubble.hh:338
IndexSetDofMapper< GridPartType > BlockMapperType
Definition: p1bubble.hh:346
Hybrid::IndexRange< int, FunctionSpaceType::dimRange > LocalBlockIndices
Definition: p1bubble.hh:347
Cube2DBubbleElementShapeFunctionSet< ScalarFunctionSpaceType > ScalarCubeShapeFunctionSetType
Definition: p1bubble.hh:333
Definition: p1bubble.hh:351
Operation OperationType
Definition: p1bubble.hh:352
DefaultCommunicationHandler< DiscreteFunction, Operation > Type
Definition: p1bubble.hh:353
BubbleElementSpace< NewFunctionSpace, GridPart, Storage > Type
Definition: p1bubble.hh:471
DefaultLocalRestrictProlong(const BubbleElementSpace< FunctionSpace, GridPart, Storage > &space)
Definition: p1bubble.hh:480
Definition: shapefunctionset/vectorial.hh:447