1 #ifndef DUNE_FEM_LAGRANGEINTERPOLATION_HH 2 #define DUNE_FEM_LAGRANGEINTERPOLATION_HH 6 #include <dune/common/typetraits.hh> 20 template<
class Function,
class DiscreteFunction >
30 typedef typename DiscreteFunctionType::DiscreteFunctionSpaceType
33 typedef typename DiscreteFunctionType::LocalFunctionType
37 typedef typename DiscreteFunctionSpaceType::GridPartType
GridPartType;
40 typedef typename DiscreteFunctionSpaceType::LagrangePointSetType
43 typedef typename DiscreteFunctionSpaceType::DomainType
DomainType;
45 typedef typename DiscreteFunctionSpaceType::RangeType
RangeType;
66 DiscreteFunctionType &discreteFunction )
const 84 const bool hasLocalFunction = Conversion< Function, HasLocalFunction >::exists;
85 interpolateFunction(
function, discreteFunction, std::integral_constant< bool, hasLocalFunction >() );
90 static void apply (
const Function &
function, DiscreteFunctionType &discreteFunction )
96 static void interpolateFunction (
const Function &
function, DiscreteFunctionType &discreteFunction, std::integral_constant< bool, true > )
98 interpolateDiscreteFunction(
function, discreteFunction );
101 static void interpolateFunction (
const Function &
function, DiscreteFunctionType &discreteFunction, std::integral_constant< bool, false > )
106 GridFunctionType dfAdapter(
"function",
function, dfSpace.gridPart() );
107 interpolateDiscreteFunction( dfAdapter, discreteFunction );
110 template<
class Gr
idFunction >
111 static void interpolateDiscreteFunction (
const GridFunction &
function, DiscreteFunctionType &discreteFunction );
116 template<
class Function,
class DiscreteFunction >
117 template<
class Gr
idFunction >
122 typedef typename DiscreteFunctionType::DofType DofType;
123 typedef typename DiscreteFunctionType::DofIteratorType DofIteratorType;
124 static const int dimRange = DiscreteFunctionSpaceType::dimRange;
126 typedef typename GridFunction::LocalFunctionType FunctionLocalFunctionType;
129 const DofIteratorType dend = discreteFunction.dend();
130 for( DofIteratorType dit = discreteFunction.dbegin(); dit != dend; ++dit )
131 *dit = std::numeric_limits< DofType >::infinity();
134 for(
const typename DiscreteFunctionSpaceType::EntityType &entity : dfSpace )
137 = dfSpace.lagrangePointSet( entity );
139 FunctionLocalFunctionType f_local =
function.localFunction( entity );
143 const int nop = lagrangePointSet.nop();
145 for(
int qp = 0; qp < nop; ++qp )
148 if( df_local[ k ] == std::numeric_limits< DofType >::infinity() )
152 f_local.evaluate( lagrangePointSet[ qp ], phi );
155 for(
int i = 0; i < dimRange; ++i, ++k )
156 df_local[ k ] = phi[ i ];
168 #endif // #ifndef DUNE_FEM_LAGRANGEINTERPOLATION_HH DiscreteFunctionType::DiscreteFunctionSpaceType DiscreteFunctionSpaceType
type of discrete function space
Definition: lagrangeinterpolation.hh:31
LagrangeInterpolation()
empty contructor
Definition: lagrangeinterpolation.hh:49
void operator()(const Function &function, DiscreteFunctionType &discreteFunction) const
Definition: lagrangeinterpolation.hh:65
const DiscreteFunctionSpaceType & space() const
obtain a reference to the corresponding DiscreteFunctionSpace
Definition: gridfunctionadapter.hh:171
DiscreteFunction DiscreteFunctionType
type of discrete functions
Definition: lagrangeinterpolation.hh:27
DiscreteFunctionSpaceType::DomainType DomainType
type of vectors in function's domain
Definition: lagrangeinterpolation.hh:43
virtual ~LagrangeInterpolation()
virtual destructor because of inheritance from Operator
Definition: lagrangeinterpolation.hh:52
abstract operator
Definition: operator.hh:25
DiscreteFunctionSpaceType::RangeType RangeType
type of vectors in function's range
Definition: lagrangeinterpolation.hh:45
Definition: coordinate.hh:4
DiscreteFunctionType::LocalFunctionType LocalFunctionType
type of local functions
Definition: lagrangeinterpolation.hh:34
DiscreteFunctionSpaceType::LagrangePointSetType LagrangePointSetType
type of Lagrange point set
Definition: lagrangeinterpolation.hh:41
GridFunctionAdapter provides local functions for a Function.
Definition: gridfunctionadapter.hh:36
Abstract class representing a function.
Definition: function.hh:43
static void interpolateFunction(const Function &function, DiscreteFunctionType &discreteFunction)
Definition: lagrangeinterpolation.hh:82
Generates the Lagrange Interpolation of an analytic function.
Definition: lagrangeinterpolation.hh:21
static void apply(const Function &function, DiscreteFunctionType &discreteFunction)
Definition: lagrangeinterpolation.hh:90
DiscreteFunctionSpaceType::GridPartType GridPartType
type of grid partition
Definition: lagrangeinterpolation.hh:37