1#ifndef DUNE_FEM_MARKING_LOCALERROR_HH
2#define DUNE_FEM_MARKING_LOCALERROR_HH
6#include <dune/fem/function/localfunction/const.hh>
7#include <dune/fem/space/common/functionspace.hh>
18 template<
class ErrorFunctional >
19 class LocalFunctionalError
21 typedef LocalFunctionalError< ErrorFunctional > ThisType;
23 static_assert( ErrorFunctional::dimRange == 1,
"Error functionals must have dimRange == 1." );
26 typedef ErrorFunctional ErrorFunctionalType;
28 typedef typename ErrorFunctionalType::DiscreteFunctionSpaceType DiscreteFunctionSpaceType;
29 typedef typename ErrorFunctionalType::GridPartType GridPartType;
31 typedef typename DiscreteFunctionSpaceType::DomainType DomainType;
32 typedef typename DiscreteFunctionSpaceType::RangeType RangeType;
33 typedef typename DiscreteFunctionSpaceType::RangeFieldType RangeFieldType;
35 typedef typename GridPartType::template Codim< 0 >::EntityType ElementType;
37 typedef ConstLocalFunction< ErrorFunctionalType > LocalErrorFunctionalType;
42 typedef typename GridPartType::template Codim< 0 >::EntityType EntityType;
53 LocalOne (
const EntityType &entity,
int order ) : entity_( entity ), order_( order ) {}
55 template<
class Po
int >
56 void evaluate (
const Point &x, RangeType &value )
const
61 template<
class Quadrature,
class Values >
62 void evaluateQuadrature (
const Quadrature &quadrature, Values &values )
const
64 for(
const auto qp : quadrature )
65 evaluate( qp, values[ qp.index() ] );
68 int order ()
const {
return order_; }
70 const EntityType &entity ()
const {
return entity_; }
73 const EntityType &entity_;
78 explicit LocalFunctionalError (
const ErrorFunctionalType &errorFunctional )
79 : localErrorFunctional_( errorFunctional )
81 localIndicator_.reserve( space().blockMapper().maxNumDofs() * DiscreteFunctionSpaceType::localBlockSize );
84 RangeFieldType operator() (
const ElementType &element )
const
86 localErrorFunctional_.init( element );
87 localIndicator_.resize( localErrorFunctional_.basisFunctionSet().size() );
89 const auto &interpolation = space().interpolation( element );
90 interpolation( LocalOne( element, localErrorFunctional_.order() ), localIndicator_ );
92 return localErrorFunctional_.localDofVector() * localIndicator_;
95 const DiscreteFunctionSpaceType &space ()
const {
return localErrorFunctional_.discreteFunction().space(); }
98 LocalErrorFunctionalType localErrorFunctional_;
Traits::FunctionSpaceType FunctionSpaceType
type of function space
Definition: discretefunctionspace.hh:194
FunctionSpaceTraits::RangeType RangeType
Type of range vector (using type of range field) has a Dune::FieldVector type interface.
Definition: functionspaceinterface.hh:71
@ dimDomain
dimension of domain vector space
Definition: functionspaceinterface.hh:46
@ dimRange
dimension of range vector space
Definition: functionspaceinterface.hh:48
FunctionSpaceTraits::DomainType DomainType
Type of domain vector (using type of domain field) has a Dune::FieldVector type interface.
Definition: functionspaceinterface.hh:67
FunctionSpaceTraits::RangeFieldType RangeFieldType
Intrinsic type used for values in the range field (usually a double)
Definition: functionspaceinterface.hh:63
A vector valued function space.
Definition: functionspace.hh:60
actual interface class for quadratures
This file implements a dense vector with a dynamic size.
Dune namespace.
Definition: alignedallocator.hh:13