1#ifndef DUNE_FEM_SPACE_LAGRANGE_GENERICBASEFUNCTIONS_HH
2#define DUNE_FEM_SPACE_LAGRANGE_GENERICBASEFUNCTIONS_HH
4#include <dune/common/fvector.hh>
14 template<
class FunctionSpace,
class GeometryType,
unsigned int order >
18 template<
class FunctionSpace,
unsigned int order >
30 static constexpr unsigned int polynomialOrder = order;
34 static const unsigned int numBaseFunctions = LagrangePointType :: numLagrangePoints;
36 typedef typename FunctionSpaceType :: DomainType
DomainType;
37 typedef typename FunctionSpaceType :: RangeType
RangeType;
41 typedef typename Dune::FieldTraits< RangeFieldType >::real_type
RealType;
48 : lagrangePoint_( baseNum )
51 template<
class LocalDofCoordinateType,
class LocalCoordinateType >
52 inline static void evaluate ( LocalDofCoordinateType &dofCoordinate,
53 const FieldVector< int, 0 > &diffVariable,
55 const LocalCoordinateType &x,
61 template<
class LocalDofCoordinateType,
class LocalCoordinateType >
62 inline static void evaluate ( LocalDofCoordinateType &dofCoordinate,
63 const FieldVector< int, 1 > &diffVariable,
65 const LocalCoordinateType &x,
71 template<
class LocalDofCoordinateType,
class LocalCoordinateType >
72 inline static void evaluate ( LocalDofCoordinateType &dofCoordinate,
73 const FieldVector< int, 2 > &diffVariable,
75 const LocalCoordinateType &x,
81 template<
int diffOrder >
83 evaluate (
const FieldVector< int, diffOrder > &diffVariable,
89 evaluate( point.dofCoordinate_, diffVariable, 1, xlocal, phi );
94 template<
class FunctionSpace,
class BaseGeometryType >
106 enum { polynomialOrder = 0 };
109 static const unsigned int numBaseFunctions = LagrangePointType :: numLagrangePoints;
113 typedef typename FunctionSpaceType :: RangeType
RangeType;
117 typedef typename Dune::FieldTraits< RangeFieldType >::real_type
RealType;
124 : lagrangePoint_( baseNum )
127 template<
unsigned int porder,
class LocalDofCoordinateType,
class LocalCoordinateType >
128 static void evaluate ( LocalDofCoordinateType &dofCoordinate,
129 const FieldVector< int, 0 > &diffVariable,
131 const LocalCoordinateType &x,
137 template<
class LocalDofCoordinateType,
class LocalCoordinateType >
138 static void evaluate ( LocalDofCoordinateType &dofCoordinate,
139 const FieldVector< int, 0 > &diffVariable,
141 const LocalCoordinateType &x,
144 return evaluate< polynomialOrder >( dofCoordinate, diffVariable, factor, x, phi );
147 template<
unsigned int porder,
class LocalDofCoordinateType,
class LocalCoordinateType >
148 static void evaluate ( LocalDofCoordinateType &dofCoordinate,
149 const FieldVector< int, 1 > &diffVariable,
151 const LocalCoordinateType &x,
157 template<
class LocalDofCoordinateType,
class LocalCoordinateType >
158 static void evaluate ( LocalDofCoordinateType &dofCoordinate,
159 const FieldVector< int, 1 > &diffVariable,
161 const LocalCoordinateType &x,
164 return evaluate< polynomialOrder >( dofCoordinate, diffVariable, factor, x, phi );
167 template<
unsigned int porder,
class LocalDofCoordinateType,
class LocalCoordinateType >
168 static void evaluate ( LocalDofCoordinateType &dofCoordinate,
169 const FieldVector< int, 2 > &diffVariable,
171 const LocalCoordinateType &x,
177 template<
class LocalDofCoordinateType,
class LocalCoordinateType >
178 static void evaluate ( LocalDofCoordinateType &dofCoordinate,
179 const FieldVector< int, 2 > &diffVariable,
181 const LocalCoordinateType &x,
184 return evaluate< polynomialOrder >( dofCoordinate, diffVariable, factor, x, phi );
187 template<
int diffOrder >
188 void evaluate (
const FieldVector< int, diffOrder > &diffVariable,
194 evaluate( point.dofCoordinate_, diffVariable, 1, xlocal, phi );
199 template<
class FunctionSpace,
class BaseGeometryType,
unsigned int order >
211 static constexpr unsigned int polynomialOrder = order;
215 static const unsigned int numBaseFunctions = LagrangePointType :: numLagrangePoints;
219 typedef typename FunctionSpaceType :: RangeType
RangeType;
223 typedef typename Dune::FieldTraits< RangeFieldType >::real_type
RealType;
238 : lagrangePoint_( baseNum )
241 template<
unsigned int porder,
class LocalDofCoordinateType,
class LocalCoordinateType >
242 static void evaluate ( LocalDofCoordinateType &dofCoordinate,
243 const FieldVector< int, 0 > &diffVariable,
245 const LocalCoordinateType &x,
250 const RealType myshift = (porder - polynomialOrder) * divisor;
252 if( LagrangePointType :: useDimReduction( dofCoordinate ) )
254 DimensionReductionType::evaluate( dofCoordinate.base(), diffVariable, myfactor * factor, x.base(), phi );
256 const unsigned int height
257 = LagrangePointType :: height( dofCoordinate );
258 for(
unsigned int i = 0; i < height; ++i )
262 evaluate< porder >( dofCoordinate, diffVariable, factor, x, psi );
265 (*dofCoordinate) -= height;
270 OrderReductionType::template evaluate< porder >( dofCoordinate, diffVariable, factor, x, phi );
272 phi[ 0 ] *= (polynomialOrder / ((
RealType)(*dofCoordinate)))
273 * (myfactor * factor * (*x) - myshift);
277 template<
class LocalDofCoordinateType,
class LocalCoordinateType >
278 static void evaluate ( LocalDofCoordinateType &dofCoordinate,
279 const FieldVector< int, 0 > &diffVariable,
281 const LocalCoordinateType &x,
284 return evaluate< polynomialOrder >( dofCoordinate, diffVariable, factor, x, phi );
287 template<
unsigned int porder,
class LocalDofCoordinateType,
class LocalCoordinateType >
288 static void evaluate ( LocalDofCoordinateType &dofCoordinate,
289 const FieldVector< int, 1 > &diffVariable,
291 const LocalCoordinateType &x,
296 const RealType myshift = (porder - polynomialOrder) / divisor;
298 FieldVector< int, 0 > dv;
300 if( LagrangePointType :: useDimReduction( dofCoordinate ) )
302 if( (
unsigned int)diffVariable[ 0 ] != LocalDofCoordinateType::index )
303 DimensionReductionType::evaluate( dofCoordinate.base(), diffVariable, myfactor * factor, x.base(), phi );
307 const unsigned int height
308 = LagrangePointType :: height( dofCoordinate );
309 for(
unsigned int i = 0; i < height; ++i )
313 evaluate< porder >( dofCoordinate, diffVariable, factor, x, psi );
316 (*dofCoordinate) -= height;
321 OrderReductionType::template evaluate< porder >( dofCoordinate, diffVariable, factor, x, phi );
322 phi *= (myfactor * factor * (*x) - myshift);
324 if( (
unsigned int)diffVariable[ 0 ] == LocalDofCoordinateType::index )
327 OrderReductionType::template evaluate< porder >( dofCoordinate, dv, factor, x, psi );
328 phi.axpy( myfactor * factor, psi );
331 phi *= (polynomialOrder) / ((
RealType)(*dofCoordinate));
335 template<
class LocalDofCoordinateType,
class LocalCoordinateType >
336 static void evaluate ( LocalDofCoordinateType &dofCoordinate,
337 const FieldVector< int, 1 > &diffVariable,
339 const LocalCoordinateType &x,
342 return evaluate< polynomialOrder >( dofCoordinate, diffVariable, factor, x, phi );
345 template<
unsigned int porder,
class LocalDofCoordinateType,
class LocalCoordinateType >
346 static void evaluate ( LocalDofCoordinateType &dofCoordinate,
347 const FieldVector< int, 2 > &diffVariable,
349 const LocalCoordinateType &x,
354 const RealType myshift = (porder - polynomialOrder) / divisor;
356 FieldVector< int, 1 > dv0( diffVariable[ 0 ] );
357 FieldVector< int, 1 > dv1( diffVariable[ 1 ] );
359 if( LagrangePointType :: useDimReduction( dofCoordinate ) )
361 if( ((
unsigned int)diffVariable[ 0 ] != LocalDofCoordinateType::index)
362 && ((
unsigned int)diffVariable[ 1 ] != LocalDofCoordinateType::index) )
363 DimensionReductionType::evaluate( dofCoordinate.base(), diffVariable, myfactor * factor, x.base(), phi );
367 const unsigned int height = LagrangePointType::height( dofCoordinate );
368 for(
unsigned int i = 0; i < height; ++i )
372 evaluate< porder >( dofCoordinate, diffVariable, factor, x, psi );
375 (*dofCoordinate) -= height;
381 OrderReductionType::template evaluate< porder >( dofCoordinate, diffVariable, factor, x, phi );
382 phi *= (myfactor * factor * (*x) - myshift);
384 if( (
unsigned int)diffVariable[ 0 ] == LocalDofCoordinateType::index )
386 OrderReductionType::template evaluate< porder >( dofCoordinate, dv1, factor, x, psi );
387 phi.axpy( myfactor * factor, psi );
390 if( (
unsigned int)diffVariable[ 1 ] == LocalDofCoordinateType::index )
392 OrderReductionType::template evaluate< porder >( dofCoordinate, dv0, factor, x, psi );
393 phi.axpy( myfactor * factor, psi );
397 phi *= (polynomialOrder) / ((
RealType)(*dofCoordinate));
401 template<
class LocalDofCoordinateType,
class LocalCoordinateType >
402 static void evaluate ( LocalDofCoordinateType &dofCoordinate,
403 const FieldVector< int, 2 > &diffVariable,
405 const LocalCoordinateType &x,
408 return evaluate< polynomialOrder >( dofCoordinate, diffVariable, factor, x, phi );
411 template<
int diffOrder >
412 void evaluate (
const FieldVector< int, diffOrder > &diffVariable,
418 evaluate( point.dofCoordinate_, diffVariable, 1, xlocal, phi );
423 template<
class FunctionSpace,
class FirstGeometryType,
class SecondGeometryType,
unsigned int order >
435 static constexpr unsigned int polynomialOrder = order;
438 static const unsigned int numBaseFunctions = LagrangePointType :: numLagrangePoints;
441 typedef typename FunctionSpaceType :: RangeType
RangeType;
445 typedef typename Dune::FieldTraits< RangeFieldType >::real_type
RealType;
460 : lagrangePoint_( baseNum )
463 template<
class LocalDofCoordinateType,
class LocalCoordinateType >
464 static void evaluate ( LocalDofCoordinateType &dofCoordinate,
465 const FieldVector< int, 0 > &diffVariable,
467 const LocalCoordinateType &x,
471 FirstReductionType::evaluate( dofCoordinate.first(), diffVariable, factor, x.first(), phi );
472 SecondReductionType::evaluate( dofCoordinate.second(), diffVariable, factor, x.second(), psi );
473 phi[ 0 ] *= psi[ 0 ];
476 template<
class LocalDofCoordinateType,
class LocalCoordinateType >
477 static void evaluate ( LocalDofCoordinateType &dofCoordinate,
478 const FieldVector< int, 1 > &diffVariable,
480 const LocalCoordinateType &x,
483 FieldVector< int, 0 > dv;
486 FirstReductionType::evaluate( dofCoordinate.first(), diffVariable, factor, x.first(), psi1 );
487 SecondReductionType::evaluate( dofCoordinate.second(), dv, factor, x.second(), psi2 );
488 phi[ 0 ] = psi1[ 0 ] * psi2[ 0 ];
490 FirstReductionType::evaluate( dofCoordinate.first(), dv, factor, x.first(), psi1 );
491 SecondReductionType::evaluate( dofCoordinate.second(), diffVariable, factor, x.second(), psi2 );
492 phi[ 0 ] += psi1[ 0 ] * psi2[ 0 ];
495 template<
class LocalDofCoordinateType,
class LocalCoordinateType >
496 static void evaluate ( LocalDofCoordinateType &dofCoordinate,
497 const FieldVector< int, 2 > &diffVariable,
499 const LocalCoordinateType &x,
502 FieldVector< int, 0 > dv;
503 FieldVector< int, 1 > dv0( diffVariable[ 0 ] );
504 FieldVector< int, 1 > dv1( diffVariable[ 1 ] );
507 FirstReductionType::evaluate( dofCoordinate.first(), diffVariable, factor, x.first(), psi1 );
508 SecondReductionType::evaluate( dofCoordinate.second(), dv, factor, x.second(), psi2 );
509 phi[ 0 ] = psi1[ 0 ] * psi2[ 0 ];
511 FirstReductionType::evaluate( dofCoordinate.first(), dv0, factor, x.first(), psi1 );
512 SecondReductionType::evaluate( dofCoordinate.second(), dv1, factor, x.second(), psi2 );
513 phi[ 0 ] += psi1[ 0 ] * psi2[ 0 ];
515 FirstReductionType::evaluate( dofCoordinate.first(), dv1, factor, x.first(), psi1 );
516 SecondReductionType::evaluate( dofCoordinate.second(), dv0, factor, x.second(), psi2 );
517 phi[ 0 ] += psi1[ 0 ] * psi2[ 0 ];
519 FirstReductionType::evaluate( dofCoordinate.first(), dv, factor, x.first(), psi1 );
520 SecondReductionType::evaluate( dofCoordinate.second(), diffVariable, factor, x.second(), psi2 );
521 phi[ 0 ] += psi1[ 0 ] * psi2[ 0 ];
524 template<
int diffOrder >
525 void evaluate (
const FieldVector< int, diffOrder > &diffVariable,
531 evaluate( point.dofCoordinate_, diffVariable, 1, xlocal, phi );
Definition: bindguard.hh:11
A vector valued function space.
Definition: functionspace.hh:60
@ dimRange
dimension of range vector space
Definition: functionspaceinterface.hh:48
Definition: genericbasefunctions.hh:15
Definition: genericbasefunctions.hh:20
static void evaluate(LocalDofCoordinateType &dofCoordinate, const FieldVector< int, 0 > &diffVariable, DomainFieldType factor, const LocalCoordinateType &x, RangeType &phi)
Definition: genericbasefunctions.hh:52
FunctionSpaceType::DomainFieldType DomainFieldType
Definition: genericbasefunctions.hh:39
PointGeometry GeometryType
Definition: genericbasefunctions.hh:28
Dune::FieldTraits< RangeFieldType >::real_type RealType
Definition: genericbasefunctions.hh:41
static void evaluate(LocalDofCoordinateType &dofCoordinate, const FieldVector< int, 1 > &diffVariable, DomainFieldType factor, const LocalCoordinateType &x, RangeType &phi)
Definition: genericbasefunctions.hh:62
FunctionSpaceType::RangeType RangeType
Definition: genericbasefunctions.hh:37
GenericLagrangePoint< GeometryType, polynomialOrder > LagrangePointType
Definition: genericbasefunctions.hh:33
FunctionSpace FunctionSpaceType
Definition: genericbasefunctions.hh:26
FunctionSpaceType::RangeFieldType RangeFieldType
Definition: genericbasefunctions.hh:40
void evaluate(const FieldVector< int, diffOrder > &diffVariable, const DomainType &x, RangeType &phi) const
Definition: genericbasefunctions.hh:83
GenericLagrangeBaseFunction(unsigned int baseNum)
Definition: genericbasefunctions.hh:47
FunctionSpaceType::DomainType DomainType
Definition: genericbasefunctions.hh:36
static void evaluate(LocalDofCoordinateType &dofCoordinate, const FieldVector< int, 2 > &diffVariable, DomainFieldType factor, const LocalCoordinateType &x, RangeType &phi)
Definition: genericbasefunctions.hh:72
Definition: genericbasefunctions.hh:96
static void evaluate(LocalDofCoordinateType &dofCoordinate, const FieldVector< int, 2 > &diffVariable, DomainFieldType factor, const LocalCoordinateType &x, RangeType &phi)
Definition: genericbasefunctions.hh:178
PyramidGeometry< BaseGeometryType > GeometryType
Definition: genericbasefunctions.hh:104
static void evaluate(LocalDofCoordinateType &dofCoordinate, const FieldVector< int, 0 > &diffVariable, DomainFieldType factor, const LocalCoordinateType &x, RangeType &phi)
Definition: genericbasefunctions.hh:138
GenericLagrangePoint< GeometryType, polynomialOrder > LagrangePointType
Definition: genericbasefunctions.hh:108
FunctionSpaceType::DomainFieldType DomainFieldType
Definition: genericbasefunctions.hh:115
FunctionSpace FunctionSpaceType
Definition: genericbasefunctions.hh:102
Dune::FieldTraits< RangeFieldType >::real_type RealType
Definition: genericbasefunctions.hh:117
FunctionSpaceType::RangeFieldType RangeFieldType
Definition: genericbasefunctions.hh:116
GenericLagrangeBaseFunction(unsigned int baseNum)
Definition: genericbasefunctions.hh:123
FunctionSpaceType::RangeType RangeType
Definition: genericbasefunctions.hh:113
FunctionSpaceType::DomainType DomainType
Definition: genericbasefunctions.hh:112
static void evaluate(LocalDofCoordinateType &dofCoordinate, const FieldVector< int, 0 > &diffVariable, DomainFieldType factor, const LocalCoordinateType &x, RangeType &phi)
Definition: genericbasefunctions.hh:128
static void evaluate(LocalDofCoordinateType &dofCoordinate, const FieldVector< int, 1 > &diffVariable, DomainFieldType factor, const LocalCoordinateType &x, RangeType &phi)
Definition: genericbasefunctions.hh:148
static void evaluate(LocalDofCoordinateType &dofCoordinate, const FieldVector< int, 2 > &diffVariable, DomainFieldType factor, const LocalCoordinateType &x, RangeType &phi)
Definition: genericbasefunctions.hh:168
void evaluate(const FieldVector< int, diffOrder > &diffVariable, const DomainType &x, RangeType &phi) const
Definition: genericbasefunctions.hh:188
static void evaluate(LocalDofCoordinateType &dofCoordinate, const FieldVector< int, 1 > &diffVariable, DomainFieldType factor, const LocalCoordinateType &x, RangeType &phi)
Definition: genericbasefunctions.hh:158
Definition: genericbasefunctions.hh:201
static void evaluate(LocalDofCoordinateType &dofCoordinate, const FieldVector< int, 2 > &diffVariable, DomainFieldType factor, const LocalCoordinateType &x, RangeType &phi)
Definition: genericbasefunctions.hh:346
static void evaluate(LocalDofCoordinateType &dofCoordinate, const FieldVector< int, 1 > &diffVariable, DomainFieldType factor, const LocalCoordinateType &x, RangeType &phi)
Definition: genericbasefunctions.hh:336
FunctionSpace FunctionSpaceType
Definition: genericbasefunctions.hh:207
FunctionSpaceType::DomainFieldType DomainFieldType
Definition: genericbasefunctions.hh:221
FunctionSpaceType::RangeType RangeType
Definition: genericbasefunctions.hh:219
static void evaluate(LocalDofCoordinateType &dofCoordinate, const FieldVector< int, 2 > &diffVariable, DomainFieldType factor, const LocalCoordinateType &x, RangeType &phi)
Definition: genericbasefunctions.hh:402
FunctionSpaceType::DomainType DomainType
Definition: genericbasefunctions.hh:218
PyramidGeometry< BaseGeometryType > GeometryType
Definition: genericbasefunctions.hh:209
static void evaluate(LocalDofCoordinateType &dofCoordinate, const FieldVector< int, 1 > &diffVariable, DomainFieldType factor, const LocalCoordinateType &x, RangeType &phi)
Definition: genericbasefunctions.hh:288
Dune::FieldTraits< RangeFieldType >::real_type RealType
Definition: genericbasefunctions.hh:223
GenericLagrangeBaseFunction(unsigned int baseNum)
Definition: genericbasefunctions.hh:237
static void evaluate(LocalDofCoordinateType &dofCoordinate, const FieldVector< int, 0 > &diffVariable, DomainFieldType factor, const LocalCoordinateType &x, RangeType &phi)
Definition: genericbasefunctions.hh:242
void evaluate(const FieldVector< int, diffOrder > &diffVariable, const DomainType &x, RangeType &phi) const
Definition: genericbasefunctions.hh:412
FunctionSpaceType::RangeFieldType RangeFieldType
Definition: genericbasefunctions.hh:222
static void evaluate(LocalDofCoordinateType &dofCoordinate, const FieldVector< int, 0 > &diffVariable, DomainFieldType factor, const LocalCoordinateType &x, RangeType &phi)
Definition: genericbasefunctions.hh:278
GenericLagrangePoint< GeometryType, polynomialOrder > LagrangePointType
Definition: genericbasefunctions.hh:214
Definition: genericbasefunctions.hh:425
FunctionSpaceType::RangeFieldType RangeFieldType
Definition: genericbasefunctions.hh:444
FunctionSpaceType::DomainFieldType DomainFieldType
Definition: genericbasefunctions.hh:443
static void evaluate(LocalDofCoordinateType &dofCoordinate, const FieldVector< int, 0 > &diffVariable, DomainFieldType factor, const LocalCoordinateType &x, RangeType &phi)
Definition: genericbasefunctions.hh:464
Dune::FieldTraits< RangeFieldType >::real_type RealType
Definition: genericbasefunctions.hh:445
GenericLagrangePoint< GeometryType, polynomialOrder > LagrangePointType
Definition: genericbasefunctions.hh:437
static void evaluate(LocalDofCoordinateType &dofCoordinate, const FieldVector< int, 2 > &diffVariable, DomainFieldType factor, const LocalCoordinateType &x, RangeType &phi)
Definition: genericbasefunctions.hh:496
GenericLagrangeBaseFunction(unsigned int baseNum)
Definition: genericbasefunctions.hh:459
FunctionSpaceType::RangeType RangeType
Definition: genericbasefunctions.hh:441
ProductGeometry< FirstGeometryType, SecondGeometryType > GeometryType
Definition: genericbasefunctions.hh:433
static void evaluate(LocalDofCoordinateType &dofCoordinate, const FieldVector< int, 1 > &diffVariable, DomainFieldType factor, const LocalCoordinateType &x, RangeType &phi)
Definition: genericbasefunctions.hh:477
FunctionSpaceType::DomainType DomainType
Definition: genericbasefunctions.hh:440
void evaluate(const FieldVector< int, diffOrder > &diffVariable, const DomainType &x, RangeType &phi) const
Definition: genericbasefunctions.hh:525
FunctionSpace FunctionSpaceType
Definition: genericbasefunctions.hh:431
generic geometry modelling a single point
Definition: genericgeometry.hh:63
generic geometry modelling a pyramid over a base geometry
Definition: genericgeometry.hh:92
generic geometry modelling the product of two base geometries
Definition: genericgeometry.hh:137
Definition: genericgeometry.hh:232
Definition: genericlagrangepoints.hh:21