1#ifndef DUNE_FEM_H1NORM_HH
2#define DUNE_FEM_H1NORM_HH
12 template<
class Gr
idPart >
22 template<
class Function >
42 const unsigned int order = 0,
43 const bool communicate =
true );
46 template<
class DiscreteFunctionType,
class PartitionSet >
47 typename Dune::FieldTraits< typename DiscreteFunctionType::RangeFieldType >::real_type
48 norm (
const DiscreteFunctionType &u,
const PartitionSet& partitionSet )
const;
51 template<
class DiscreteFunctionType >
52 typename Dune::FieldTraits< typename DiscreteFunctionType::RangeFieldType >::real_type
53 norm (
const DiscreteFunctionType &u )
const
55 return norm( u, Partitions::interior );
59 template<
class UDiscreteFunctionType,
class VDiscreteFunctionType,
class PartitionSet >
60 typename Dune::FieldTraits< typename UDiscreteFunctionType::RangeFieldType >::real_type
61 distance (
const UDiscreteFunctionType &u,
const VDiscreteFunctionType &v,
const PartitionSet& partitionSet )
const;
64 template<
class UDiscreteFunctionType,
class VDiscreteFunctionType >
65 typename Dune::FieldTraits< typename UDiscreteFunctionType::RangeFieldType >::real_type
66 distance (
const UDiscreteFunctionType &u,
const VDiscreteFunctionType &v )
const
68 return distance( u, v, Partitions::interior );
71 template<
class LocalFunctionType,
class ReturnType >
72 void normLocal (
const EntityType &entity,
unsigned int order,
const LocalFunctionType &uLocal, ReturnType &sum )
const;
74 template<
class ULocalFunctionType,
class VLocalFunctionType,
class ReturnType >
75 void distanceLocal (
const EntityType &entity,
unsigned int order,
const ULocalFunctionType &uLocal,
const VLocalFunctionType &vLocal, ReturnType &sum )
const;
89 template<
class Gr
idPart >
90 template<
class Function >
96 typedef typename Dune::FieldTraits< typename FunctionType::RangeFieldType >::real_type
RealType;
101 : function_( function )
104 template<
class Po
int >
107 const int dimRange = FunctionType::RangeType::dimension;
110 function_.evaluate( x, phi );
111 ret[ 0 ] = phi.two_norm2();
114 function_.jacobian( x, grad );
115 for(
int i = 0; i < dimRange; ++i )
116 ret[ 0 ] += grad[ i ].two_norm2();
120 const FunctionType &function_;
128 template<
class Gr
idPart >
132 communicate_( communicate )
136 template<
class Gr
idPart >
137 template<
class DiscreteFunctionType,
class PartitionSet >
138 inline typename Dune::FieldTraits< typename DiscreteFunctionType::RangeFieldType >::real_type
141 typedef typename DiscreteFunctionType::RangeFieldType RangeFieldType;
142 typedef typename Dune::FieldTraits< RangeFieldType >::real_type RealType;
143 typedef FieldVector< RealType, 1 > ReturnType ;
145 ReturnType sum = BaseType :: forEach( u, ReturnType( 0 ), partitionSet, order_ );
150 sum = comm().sum( sum[ 0 ] );
154 return sqrt( sum[ 0 ] );
157 template<
class Gr
idPart >
158 template<
class UDiscreteFunctionType,
class VDiscreteFunctionType,
class PartitionSet >
159 inline typename Dune::FieldTraits< typename UDiscreteFunctionType::RangeFieldType >::real_type
161 const VDiscreteFunctionType &v,
162 const PartitionSet& partitionSet )
const
164 typedef typename UDiscreteFunctionType::RangeFieldType RangeFieldType;
165 typedef typename Dune::FieldTraits< RangeFieldType >::real_type RealType;
166 typedef FieldVector< RealType, 1 > ReturnType ;
168 ReturnType sum = BaseType :: forEach( u, v, ReturnType( 0 ), partitionSet, order_ );
173 sum = comm().sum( sum[ 0 ] );
177 return sqrt( sum[ 0 ] );
180 template<
class Gr
idPart >
181 template<
class ULocalFunctionType,
class VLocalFunctionType,
class ReturnType >
189 LocalDistanceType dist( uLocal, vLocal );
196 template<
class Gr
idPart >
197 template<
class LocalFunctionType,
class ReturnType >
Definition: bindguard.hh:11
static double sqrt(const Double &v)
Definition: double.hh:886
Abstract class representing a function.
Definition: common/function.hh:50
FunctionSpaceType::RangeType RangeType
range type
Definition: common/function.hh:68
FunctionSpaceType::RangeFieldType RangeFieldType
field type of range
Definition: common/function.hh:64
FunctionSpaceType::JacobianRangeType JacobianRangeType
jacobian type
Definition: common/function.hh:70
Definition: domainintegral.hh:33
GridPartType::template Codim< 0 >::EntityType EntityType
Definition: domainintegral.hh:44
const GridPartType::CollectiveCommunicationType & comm() const
Definition: domainintegral.hh:244
const GridPartType & gridPart() const
Definition: domainintegral.hh:242
Dune::FieldTraits< typenameDiscreteFunctionType::RangeFieldType >::real_type norm(const DiscreteFunctionType &u, const PartitionSet &partitionSet) const
|| u ||_H1 on given set of entities (partition set)
Definition: h1norm.hh:139
H1Norm(const GridPartType &gridPart, const unsigned int order=0, const bool communicate=true)
constructor
Definition: h1norm.hh:129
void distanceLocal(const EntityType &entity, unsigned int order, const ULocalFunctionType &uLocal, const VLocalFunctionType &vLocal, ReturnType &sum) const
Definition: h1norm.hh:183
Dune::FieldTraits< typenameDiscreteFunctionType::RangeFieldType >::real_type norm(const DiscreteFunctionType &u) const
|| u ||_H1 on interior partition entities
Definition: h1norm.hh:53
BaseType::EntityType EntityType
Definition: h1norm.hh:26
Dune::FieldTraits< typenameUDiscreteFunctionType::RangeFieldType >::real_type distance(const UDiscreteFunctionType &u, const VDiscreteFunctionType &v, const PartitionSet &partitionSet) const
|| u - v ||_H1 on given set of entities (partition set)
Definition: h1norm.hh:160
Integrator< QuadratureType > IntegratorType
Definition: h1norm.hh:30
Dune::FieldTraits< typenameUDiscreteFunctionType::RangeFieldType >::real_type distance(const UDiscreteFunctionType &u, const VDiscreteFunctionType &v) const
|| u - v ||_H1 on interior partition entities
Definition: h1norm.hh:66
void normLocal(const EntityType &entity, unsigned int order, const LocalFunctionType &uLocal, ReturnType &sum) const
Definition: h1norm.hh:199
const bool communicate_
Definition: h1norm.hh:81
const unsigned int order_
Definition: h1norm.hh:80
GridPart GridPartType
Definition: h1norm.hh:20
ThisType operator=(const ThisType &)=delete
CachingQuadrature< GridPartType, 0 > QuadratureType
Definition: h1norm.hh:28
void evaluate(const Point &x, RangeType &ret) const
Definition: h1norm.hh:105
Dune::FieldTraits< typenameFunctionType::RangeFieldType >::real_type RealType
Definition: h1norm.hh:96
FunctionJacobianSquare(const FunctionType &function)
Definition: h1norm.hh:100
FunctionType::RangeFieldType RangeFieldType
Definition: h1norm.hh:95
FieldVector< RealType, 1 > RangeType
Definition: h1norm.hh:97
Function FunctionType
Definition: h1norm.hh:93
integrator for arbitrary functions providing evaluate
Definition: integrator.hh:28
void integrateAdd(const EntityType &entity, const Function &function, typename Function ::RangeType &ret) const
add the integral over an entity to a variable
Definition: integrator.hh:67