1#ifndef DUNE_FEM_L1NORM_HH 
    2#define DUNE_FEM_L1NORM_HH 
    4#include <dune/fem/quadrature/integrator.hh> 
    6#include <dune/fem/misc/domainintegral.hh> 
   17    template< 
class Gr
idPart >
 
   18    class L1Norm : 
public IntegralBase< GridPart, L1Norm< GridPart > >
 
   20      typedef IntegralBase< GridPart, L1Norm< GridPart > > BaseType ;
 
   21      typedef L1Norm< GridPart > ThisType;
 
   24      typedef GridPart GridPartType;
 
   26      using BaseType :: gridPart ;
 
   27      using BaseType :: comm ;
 
   30      template< 
class Function >
 
   33      template< 
class UFunction, 
class VFunction >
 
   34      struct FunctionDistance;
 
   36      typedef typename BaseType::EntityType EntityType;
 
   37      typedef CachingQuadrature< GridPartType, 0 > QuadratureType;
 
   39      const unsigned int order_;
 
   40      const bool communicate_;
 
   47      explicit L1Norm ( 
const GridPartType &gridPart,
 
   48                        const unsigned int order = 0,
 
   49                        const bool communicate = 
true );
 
   53      template< 
class DiscreteFunctionType, 
class PartitionSet >
 
   54      typename Dune::FieldTraits< typename DiscreteFunctionType::RangeFieldType >::real_type
 
   58      template< 
class DiscreteFunctionType >
 
   59      typename Dune::FieldTraits< typename DiscreteFunctionType::RangeFieldType >::real_type
 
   66      template< 
class UDiscreteFunctionType, 
class VDiscreteFunctionType, 
class PartitionSet >
 
   67      typename Dune::FieldTraits< typename UDiscreteFunctionType::RangeFieldType >::real_type
 
   68      distance ( 
const UDiscreteFunctionType &u, 
const VDiscreteFunctionType &v, 
const PartitionSet& partitionSet ) 
const;
 
   71      template< 
class UDiscreteFunctionType, 
class VDiscreteFunctionType >
 
   72      typename Dune::FieldTraits< typename UDiscreteFunctionType::RangeFieldType >::real_type
 
   73      distance ( 
const UDiscreteFunctionType &u, 
const VDiscreteFunctionType &v )
 const 
   78      template< 
class LocalFunctionType, 
class ReturnType >
 
   79      void normLocal ( 
const EntityType &entity, 
unsigned int order, 
const LocalFunctionType &uLocal, ReturnType &sum ) 
const;
 
   81      template< 
class ULocalFunctionType, 
class VLocalFunctionType, 
class ReturnType >
 
   82      void distanceLocal ( 
const EntityType &entity, 
unsigned int order, 
const ULocalFunctionType &uLocal, 
const VLocalFunctionType &vLocal, ReturnType &sum ) 
const;
 
   90    template< 
class Gr
idPart >
 
   91    inline L1Norm< GridPart >::L1Norm ( 
const GridPartType &gridPart, 
const unsigned int order, 
const bool communicate )
 
   92    : BaseType( gridPart ),
 
   94      communicate_( BaseType::checkCommunicateFlag( communicate ) )
 
   98    template< 
class Gr
idPart >
 
   99    template< 
class DiscreteFunctionType, 
class PartitionSet >
 
  100    inline typename Dune::FieldTraits< typename DiscreteFunctionType::RangeFieldType >::real_type
 
  104      typedef typename Dune::FieldTraits< RangeFieldType >::real_type RealType;
 
  105      typedef FieldVector< RealType, 1 > ReturnType ;
 
  113        sum[ 0 ] = comm().sum( sum[ 0 ] );
 
  120    template< 
class Gr
idPart >
 
  121    template< 
class UDiscreteFunctionType, 
class VDiscreteFunctionType, 
class PartitionSet >
 
  122    inline typename Dune::FieldTraits< typename UDiscreteFunctionType::RangeFieldType >::real_type
 
  124      ::distance ( 
const UDiscreteFunctionType &u, 
const VDiscreteFunctionType &v, 
const PartitionSet& 
partitionSet )
 const 
  126      typedef typename UDiscreteFunctionType::RangeFieldType RangeFieldType;
 
  127      typedef typename Dune::FieldTraits< RangeFieldType >::real_type RealType;
 
  128      typedef FieldVector< RealType, 1 > ReturnType ;
 
  136        sum[ 0 ] = comm().sum( sum[ 0 ] );
 
  142    template< 
class Gr
idPart >
 
  143    template< 
class LocalFunctionType, 
class ReturnType >
 
  145    L1Norm< GridPart >::normLocal ( 
const EntityType &entity, 
unsigned int order, 
const LocalFunctionType &uLocal, ReturnType &sum )
 const 
  147      Integrator< QuadratureType > integrator( order );
 
  149      FunctionAbs< LocalFunctionType > uLocalAbs( uLocal );
 
  151      integrator.integrateAdd( entity, uLocalAbs, sum );
 
  154    template< 
class Gr
idPart >
 
  155    template< 
class ULocalFunctionType, 
class VLocalFunctionType, 
class ReturnType >
 
  157    L1Norm< GridPart >::distanceLocal ( 
const EntityType &entity, 
unsigned int order, 
const ULocalFunctionType &uLocal, 
const VLocalFunctionType &vLocal, ReturnType &sum )
 const 
  159      Integrator< QuadratureType > integrator( order );
 
  161      typedef FunctionDistance< ULocalFunctionType, VLocalFunctionType > LocalDistanceType;
 
  163      LocalDistanceType dist( uLocal, vLocal );
 
  164      FunctionAbs< LocalDistanceType > distAbs( dist );
 
  166      integrator.integrateAdd( entity, distAbs, sum );
 
  170    template< 
class Gr
idPart >
 
  171    template< 
class Function >
 
  172    struct L1Norm< GridPart >::FunctionAbs
 
  174      typedef Function FunctionType;
 
  176      typedef typename FunctionType::RangeFieldType RangeFieldType;
 
  177      typedef typename Dune::FieldTraits< RangeFieldType >::real_type RealType;
 
  178      typedef FieldVector< RealType, 1 > RangeType;
 
  180      explicit FunctionAbs ( 
const FunctionType &function )
 
  181      : function_( function )
 
  184      template< 
class Po
int >
 
  185      void evaluate ( 
const Point &x, RangeType &ret )
 const 
  187        typename FunctionType::RangeType phi;
 
  188        function_.evaluate( x, phi );
 
  189        ret = phi.one_norm();
 
  193      const FunctionType &function_;
 
  197    template< 
class Gr
idPart >
 
  198    template< 
class UFunction, 
class VFunction >
 
  199    struct L1Norm< GridPart >::FunctionDistance
 
  201      typedef UFunction UFunctionType;
 
  202      typedef VFunction VFunctionType;
 
  204      typedef typename UFunctionType::RangeFieldType RangeFieldType;
 
  205      typedef typename UFunctionType::RangeType RangeType;
 
  206      typedef typename UFunctionType::JacobianRangeType JacobianRangeType;
 
  208      FunctionDistance ( 
const UFunctionType &u, 
const VFunctionType &v )
 
  212      template< 
class Po
int >
 
  213      void evaluate ( 
const Point &x, RangeType &ret )
 const 
  216        u_.evaluate( x, ret );
 
  217        v_.evaluate( x, phi );
 
  221      template< 
class Po
int >
 
  222      void jacobian ( 
const Point &x, JacobianRangeType &ret )
 const 
  224        JacobianRangeType phi;
 
  225        u_.jacobian( x, ret );
 
  226        v_.jacobian( x, phi );
 
  231      const UFunctionType &u_;
 
  232      const VFunctionType &v_;
 
DiscreteFunctionSpaceType::RangeFieldType RangeFieldType
type of range field (usually a float type)
Definition: discretefunction.hh:623
 
forward declaration
Definition: discretefunction.hh:51
 
constexpr void forEach(Range &&range, F &&f)
Range based for loop.
Definition: hybridutilities.hh:257
 
constexpr Interior interior
PartitionSet for the interior partition.
Definition: partitionset.hh:271
 
Dune namespace.
Definition: alignedallocator.hh:13