1 #ifndef DUNE_LAGRANGEBASIS_INTERPOLATION_HH
2 #define DUNE_LAGRANGEBASIS_INTERPOLATION_HH
5 #include <dune/geometry/topologyfactory.hh>
11 template<
template <
class,
unsigned int>
class LP,
12 unsigned int dim,
class F >
18 template<
template <
class,
unsigned int>
class LP,
19 unsigned int dim,
class F >
26 typedef typename LagrangePointSet::Field
Field;
28 static const unsigned int dimension = LagrangePointSet::dimension;
35 : lagrangePoints_( lagrangePoints )
39 return &lagrangePoints_;
43 template<
class Function,
class Fy >
44 void interpolate (
const Function &
function, std::vector< Fy > &coefficients )
const
46 typedef typename LagrangePointSet::iterator Iterator;
48 coefficients.resize( lagrangePoints_.size() );
50 unsigned int index = 0;
51 const Iterator end = lagrangePoints_.end();
52 for( Iterator it = lagrangePoints_.begin(); it != end; ++it )
54 typename Function::RangeType val;
55 function.evaluate( field_cast<typename Function::DomainType::field_type>(it->point()), val );
60 template<
class Matrix,
class Basis >
61 void interpolate (
const Basis &basis, Matrix &coefficients )
const
63 typedef typename LagrangePointSet::iterator Iterator;
65 coefficients.resize( lagrangePoints_.size(), basis.size( ) );
67 unsigned int index = 0;
68 const Iterator end = lagrangePoints_.end();
69 for( Iterator it = lagrangePoints_.begin(); it != end; ++it )
70 basis.template evaluate<0>( it->point(), coefficients.rowPtr( index++ ) );
75 return lagrangePoints_;
83 template<
template <
class,
unsigned int>
class LP,
84 unsigned int dim,
class F >
97 template<
template <
class,
unsigned int>
class LP,
98 unsigned int dim,
class F >
100 public TopologyFactory< LagrangeInterpolationFactoryTraits< LP,dim,F > >
106 template<
class Topology >
110 = Traits::LagrangePointSetFactory::template create< Topology >( key );
111 if ( lagrangeCoeff == 0 )
114 return new Object( *lagrangeCoeff );
116 template<
class Topology >
123 Traits::LagrangePointSetFactory::release( object->points() );
130 #endif // #ifndef DUNE_LAGRANGEBASIS_INTERPOLATION_HH