1#ifndef DUNE_FEM_ERRORDISPLAY_HH 
    2#define DUNE_FEM_ERRORDISPLAY_HH 
    6#include <dune/fem/common/coordinate.hh> 
    7#include <dune/fem/function/common/gridfunctionadapter.hh> 
   12  template< 
class DiscreteFunction, 
class SolutionType, 
bool withTime = true >
 
   13  class DisplayErrorFunction;
 
   16  template< 
class DiscreteFunction, 
class SolutionType >
 
   17  class DisplayErrorFunction< DiscreteFunction, SolutionType, true >
 
   19    typedef DisplayErrorFunction< DiscreteFunction, SolutionType > ThisType;
 
   27      DiscreteFunctionSpaceType;
 
   29    typedef typename DiscreteFunctionSpaceType :: GridPartType GridPartType;
 
   34    typedef Fem::LocalFunctionAdapter< Error > ErrorFunctionType;
 
   37    template< 
class GrapeDispType >
 
   38    DisplayErrorFunction ( GrapeDispType &disp,
 
   40                           const SolutionType &solution,
 
   41                           const double time = 0 )
 
   42    : gridPart_( Uh.space().gridPart() ),
 
   43      error_( Uh, solution, time ),
 
   44      errorFunction_( 
"error", error_, gridPart_ )
 
   46      disp.addData( errorFunction_, 
"error", time );
 
   50    DisplayErrorFunction ( 
const ThisType & );
 
   51    ThisType &operator= ( 
const ThisType & );
 
   54    const GridPartType &gridPart_;
 
   56    ErrorFunctionType errorFunction_;
 
   61  template< 
class DiscreteFunction, 
class SolutionType >
 
   62  struct DisplayErrorFunction< DiscreteFunction, SolutionType, true >::Error
 
   64    typedef typename DiscreteFunctionSpaceType :: GridPartType GridPartType;
 
   66    typedef typename DiscreteFunctionSpaceType :: FunctionSpaceType
 
   72    static const int dimDomain = DiscreteFunctionSpaceType :: dimDomain;
 
   73    static const int dimRange = DiscreteFunctionSpaceType :: dimRange;
 
   76    typedef typename GridPartType::template Codim< 0 >::EntityType EntityType;
 
   77    typedef typename GridPartType::template Codim< 0 >::GeometryType 
GeometryType;
 
   81            const SolutionType &solution,
 
   89    template< 
class Po
intType >
 
   90    void evaluate ( 
const PointType &x, RangeType& ret)
 const 
   92      assert( initialized() );
 
   93      lUh_.evaluate( x, ret );
 
   94      DomainType global = entity().geometry().global( coordinate( x ) );
 
   96      initU0_.evaluate( time_, global, phi );
 
  100    template< 
class Po
intType >
 
  101    void jacobian ( 
const PointType &x, JacobianRangeType &ret )
 const 
  103      DUNE_THROW( NotImplemented, 
"DisplayErrorFunction::jacobian is not implemented." );
 
  106    void init ( 
const EntityType &entity )
 
  113    const EntityType &entity ()
 const 
  119    bool initialized ()
 const { 
return entity_; }
 
  121    LocalFunctionType lUh_;
 
  122    const SolutionType &initU0_;
 
  123    const EntityType *entity_;
 
  130  template< 
class DiscreteFunction, 
class SolutionType >
 
  131  class DisplayErrorFunction< DiscreteFunction, SolutionType, false >
 
  133    typedef DisplayErrorFunction< DiscreteFunction, SolutionType > ThisType;
 
  141      DiscreteFunctionSpaceType;
 
  143    typedef typename DiscreteFunctionSpaceType :: GridPartType GridPartType;
 
  149      typedef typename DiscreteFunctionSpaceType :: GridPartType GridPartType;
 
  151      typedef typename DiscreteFunctionSpaceType :: FunctionSpaceType
 
  157      static const int dimDomain = DiscreteFunctionSpaceType :: dimDomain;
 
  158      static const int dimRange = DiscreteFunctionSpaceType :: dimRange;
 
  161      typedef typename GridPartType::template Codim< 0 >::EntityType EntityType;
 
  162      typedef typename GridPartType::template Codim< 0 >::GeometryType 
GeometryType;
 
  166              const SolutionType &solution )
 
  172      template< 
class Po
intType >
 
  173      void evaluate ( 
const PointType &x, RangeType& ret)
 const 
  175        assert( initialized() );
 
  176        lUh_.evaluate( x, ret );
 
  177        DomainType global = entity().geometry().global( coordinate( x ) );
 
  179        initU0_.evaluate( global, phi );
 
  183      template< 
class Po
intType >
 
  184      void jacobian ( 
const PointType &x, JacobianRangeType &ret )
 const 
  186        DUNE_THROW( NotImplemented, 
"DisplayErrorFunction::jacobian is not implemented." );
 
  189      void init ( 
const EntityType &entity )
 
  196      const EntityType &entity ()
 const 
  202      bool initialized ()
 const { 
return entity_; }
 
  204      LocalFunctionType lUh_;
 
  205      const SolutionType &initU0_;
 
  206      const EntityType *entity_;
 
  210    typedef Fem::LocalFunctionAdapter< Error > ErrorFunctionType;
 
  211    typedef Fem::GridFunctionAdapter< SolutionType, GridPartType >
 
  215    const GridPartType &gridPart_;
 
  216    GridSolutionType gridSolution_;
 
  218    ErrorFunctionType errorFunction_;
 
  221    template< 
class GrapeDispType >
 
  222    DisplayErrorFunction ( GrapeDispType &disp,
 
  224                           const SolutionType &solution )
 
  225    : gridPart_( Uh.space().gridPart() ),
 
  226      gridSolution_( 
"exact solution", solution, gridPart_ ),
 
  227      error_( Uh, solution ),
 
  228      errorFunction_( 
"error", error_, gridPart_ )
 
  230      disp.addData( errorFunction_ );
 
  231      disp.addData( gridSolution_ );
 
  235    DisplayErrorFunction ( 
const ThisType & );
 
  236    ThisType &operator= ( 
const ThisType & );
 
BaseType::LocalFunctionType LocalFunctionType
type of local functions
Definition: discretefunction.hh:639
 
FunctionSpaceTraits::RangeType RangeType
Type of range vector (using type of range field) has a Dune::FieldVector type interface.
Definition: functionspaceinterface.hh:71
 
FunctionSpaceTraits::LinearMappingType JacobianRangeType
Intrinsic type used for the jacobian values has a Dune::FieldMatrix type interface.
Definition: functionspaceinterface.hh:75
 
FunctionSpaceTraits::DomainType DomainType
Type of domain vector (using type of domain field) has a Dune::FieldVector type interface.
Definition: functionspaceinterface.hh:67
 
A vector valued function space.
Definition: functionspace.hh:60
 
forward declaration
Definition: discretefunction.hh:51
 
TupleDiscreteFunctionSpace< typename DiscreteFunctions::DiscreteFunctionSpaceType ... > DiscreteFunctionSpaceType
type for the discrete function space this function lives in
Definition: discretefunction.hh:69
 
A few common exception classes.
 
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
 
#define DUNE_THROW(E,...)
Definition: exceptions.hh:314
 
Dune namespace.
Definition: alignedallocator.hh:13