5#ifndef DUNE_LAGRANGEBASIS_INTERPOLATION_HH 
    6#define DUNE_LAGRANGEBASIS_INTERPOLATION_HH 
   14#include <dune/localfunctions/lagrange/lagrangecoefficients.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 >
 
   27  class LocalLagrangeInterpolation
 
   29    typedef LocalLagrangeInterpolation< LP,dim,F > This;
 
   32    typedef LP<F,dim> LagrangePointSet;
 
   33    typedef typename LagrangePointSet::Field Field;
 
   35    static const unsigned int dimension = LagrangePointSet::dimension;
 
   38    friend struct LagrangeInterpolationFactory<LP,dim,F>;
 
   39    const LagrangePointSet &lagrangePoints_;
 
   41    explicit LocalLagrangeInterpolation ( 
const LagrangePointSet &lagrangePoints )
 
   42      : lagrangePoints_( lagrangePoints )
 
   45    const LagrangePointSet *points ()
 const { 
return &lagrangePoints_; }
 
   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++] );
 
   79    const LagrangePointSet &lagrangePoints ()
 const { 
return lagrangePoints_; }
 
   86  template< 
template <
class,
unsigned int> 
class LP,
 
   87      unsigned int dim, 
class F >
 
   88  struct LagrangeInterpolationFactory
 
   90    typedef LagrangeCoefficientsFactory<LP,dim,F> LagrangePointSetFactory;
 
   91    typedef typename LagrangePointSetFactory::Object LagrangePointSet;
 
   93    typedef typename LagrangePointSetFactory::Key Key;
 
   94    typedef const LocalLagrangeInterpolation< LP,dim,F > Object;
 
   96    template< GeometryType::Id geometryId >
 
   97    static Object *create ( 
const Key &key )
 
   99      const LagrangePointSet *lagrangeCoeff
 
  100        = LagrangePointSetFactory::template create< geometryId >( key );
 
  101      if ( lagrangeCoeff == 0 )
 
  104        return new Object( *lagrangeCoeff );
 
  106    template< GeometryType::Id geometryId >
 
  107    static bool supports ( 
const Key &key )
 
  111    static void release( Object *
object)
 
  113      LagrangePointSetFactory::release( object->points() );
 
static void interpolate(const GridFunction &u, DiscreteFunction &v)
perform native interpolation of a discrete function space
Definition: interpolate.hh:55
 
Dune namespace.
Definition: alignedallocator.hh:13
 
void field_cast(const F1 &f1, F2 &f2)
a helper class to cast from one field to another
Definition: field.hh:160
 
Utilities for type computations, constraining overloads, ...