1#ifndef __DUNE_ACFEM_L2PROJECTION_HH__
2#define __DUNE_ACFEM_L2PROJECTION_HH__
4#include "functionals/linearfunctional.hh"
5#include "../models/basicmodels.hh"
6#include "../models/modelexpression.hh"
7#include "../algorithms/ellipticfemscheme.hh"
51 template<
class DiscreteFunction,
class Functional>
55 typedef Functional FunctionalType;
56 typedef typename FunctionalType::TraitsType TraitsType;
57 typedef typename FunctionalType::DiscreteFunctionSpaceType DiscreteFunctionSpaceType;
58 typedef DiscreteFunction DiscreteFunctionType;
62 typedef typename DiscreteFunctionSpaceType::GridPartType GridPartType;
66 DiscreteFunctionType& result)
70 auto dend(result.dend());
71 for (
auto it = result.dbegin(); it != dend; ++it) {
72 if (!std::isfinite(*it)) {
91 SolverSchemeType solverScheme(result, model);
100 template<
class FunctionSpace,
class Gr
idFunction,
class DiscreteFunction>
102 void L2Projection(
const Fem::Function<FunctionSpace, GridFunction>& fct,
103 DiscreteFunction& result)
105 typedef DiscreteFunction DiscreteFunctionType;
106 typedef typename DiscreteFunction::DiscreteFunctionSpaceType DiscreteFunctionSpaceType;
107 typedef L2InnerProductFunctional<DiscreteFunctionSpaceType, GridFunction> FunctionalType;
110 FunctionalType functional(result.space(), fct);
111 L2ProjectionType projection;
113 projection(functional, result);
117 template<
class Traits,
class DiscreteFunction>
120 DiscreteFunction& result)
122 typedef typename Traits::GlobalFunctionalType FunctionalType;
123 typedef DiscreteFunction DiscreteFunctionType;
126 const FunctionalType& functional(
static_cast<const FunctionalType&
>(phi));
127 L2ProjectionType projection;
129 projection(functional, result);
Interface class for a discrete linear functional.
Definition: linearfunctional.hh:52
Constructor for the elliptic fem-scheme.
Definition: ellipticfemscheme.hh:570
Compute the L2-projection of the given functional to a discrete space.
Definition: l2projection.hh:53
static OperatorPartsAdapterModel< MassOperatorParts< typename Object::FunctionSpaceType >, typename Object::GridPartType > massModel(const Object &object, const std::string &name="")
Generate a mass model fitting the specified object.
Definition: massmodel.hh:149
static void L2Projection(const Fem::Function< FunctionSpace, GridFunction > &fct, DiscreteFunction &result)
Perform an L2-projection for any GridFunction.
Definition: l2projection.hh:102