5#ifndef DUNE_LAGRANGEBASIS_INTERPOLATION_HH
6#define DUNE_LAGRANGEBASIS_INTERPOLATION_HH
12#include <dune/common/typeutilities.hh>
19 template<
template <
class,
unsigned int>
class LP,
20 unsigned int dim,
class F >
21 struct LagrangeInterpolationFactory;
26 template<
template <
class,
unsigned int>
class LP,
unsigned int dim,
class F >
33 typedef typename LagrangePointSet::Field
Field;
35 static const unsigned int dimension = LagrangePointSet::dimension;
47 template<
class Fn,
class Vector >
48 auto interpolate (
const Fn &fn, Vector &coefficients, PriorityTag< 1 > )
const
49 -> std::enable_if_t< std::is_invocable_v<
const Fn &,
decltype( this->lagrangePoints_.begin()->point() ) > >
51 unsigned int index = 0;
52 for(
const auto &lp : lagrangePoints_ )
53 field_cast( fn( lp.point() ), coefficients[ index++ ] );
57 template<
class Fn,
class Vector,
58 decltype(std::declval<Vector>().size(),
bool{}) =
true,
59 decltype(std::declval<Vector>().resize(0u),
bool{}) =
true>
60 void interpolate (
const Fn &fn, Vector &coefficients )
const
62 coefficients.resize( lagrangePoints_.size() );
63 interpolate( fn, coefficients, PriorityTag< 42 >() );
66 template<
class Basis,
class Matrix,
67 decltype(std::declval<Matrix>().rows(),
bool{}) =
true,
68 decltype(std::declval<Matrix>().cols(),
bool{}) =
true,
69 decltype(std::declval<Matrix>().resize(0u,0u),
bool{}) =
true>
70 void interpolate (
const Basis &basis, Matrix &coefficients )
const
72 coefficients.resize( lagrangePoints_.size(), basis.size( ) );
74 unsigned int index = 0;
75 for(
const auto &lp : lagrangePoints_ )
76 basis.template evaluate< 0 >( lp.point(), coefficients[index++] );
86 template<
template <
class,
unsigned int>
class LP,
87 unsigned int dim,
class F >
96 template< GeometryType::Id geometryId >
100 = LagrangePointSetFactory::template create< geometryId >( key );
101 if ( lagrangeCoeff == 0 )
104 return new Object( *lagrangeCoeff );
106 template< GeometryType::Id geometryId >
Definition bdfmcube.hh:18
void field_cast(const F1 &f1, F2 &f2)
a helper class to cast from one field to another
Definition field.hh:159
Definition lagrange/interpolation.hh:89
LagrangeCoefficientsFactory< LP, dim, F > LagrangePointSetFactory
Definition lagrange/interpolation.hh:90
LagrangePointSetFactory::Object LagrangePointSet
Definition lagrange/interpolation.hh:91
static bool supports(const Key &key)
Definition lagrange/interpolation.hh:107
LagrangePointSetFactory::Key Key
Definition lagrange/interpolation.hh:93
static Object * create(const Key &key)
Definition lagrange/interpolation.hh:97
static void release(Object *object)
Definition lagrange/interpolation.hh:111
const LocalLagrangeInterpolation< LP, dim, F > Object
Definition lagrange/interpolation.hh:94
Definition lagrange/interpolation.hh:28
LagrangePointSet::Field Field
Definition lagrange/interpolation.hh:33
const LagrangePointSet & lagrangePoints() const
Definition lagrange/interpolation.hh:79
static const unsigned int dimension
Definition lagrange/interpolation.hh:35
LP< F, dim > LagrangePointSet
Definition lagrange/interpolation.hh:32
Definition lagrangecoefficients.hh:23
static void release(Object *object)
Definition lagrangecoefficients.hh:42
const typedef LP< F, dim > Object
Definition lagrangecoefficients.hh:25
std::size_t Key
Definition lagrangecoefficients.hh:26