1#ifndef DUNE_FEM_OPERATOR_DGHELMHOLTZ_HH
2#define DUNE_FEM_OPERATOR_DGHELMHOLTZ_HH
4#include <dune/fem/operator/common/operator.hh>
5#include <dune/fem/operator/common/differentiableoperator.hh>
7#include <dune/fem/solver/parameter.hh>
19 template<
class JacobianOp >
20 class DGHelmholtzJacobianOperator
23 typedef JacobianOp BaseType;
26 typedef typename BaseType::DomainFunctionType DomainFunctionType;
27 typedef typename BaseType::RangeFunctionType RangeFunctionType;
29 typedef typename DomainFunctionType::DiscreteFunctionSpaceType DomainFunctionSpaceType;
30 typedef typename RangeFunctionType::DiscreteFunctionSpaceType RangeFunctionSpaceType;
32 DGHelmholtzJacobianOperator (
const std::string &name,
const DomainFunctionSpaceType &dSpace,
const RangeFunctionSpaceType &rSpace,
33 const SolverParameter& param = SolverParameter() )
34 : BaseType( name, dSpace, rSpace ),
36 wTmp_(
"DGHelmholtzJacobianOperator temporary", rSpace )
39 void operator() (
const DomainFunctionType &u, RangeFunctionType &w )
const
44 BaseType::operator()( u, wTmp_ );
45 w.axpy( -lambda(), wTmp_ );
49 const double &lambda ()
const {
return lambda_; }
50 void setLambda (
double lambda ) { lambda_ = lambda; }
54 mutable RangeFunctionType wTmp_;
62 template<
class SpaceOperator >
63 class DGHelmholtzOperator
64 :
public DifferentiableOperator< DGHelmholtzJacobianOperator< typename SpaceOperator::JacobianOperatorType > >
66 typedef DGHelmholtzOperator< SpaceOperator > ThisType;
67 typedef DifferentiableOperator< DGHelmholtzJacobianOperator< typename SpaceOperator::JacobianOperatorType > > BaseType;
70 typedef SpaceOperator SpaceOperatorType;
77 typedef typename DomainFunctionType::DiscreteFunctionSpaceType DiscreteFunctionSpaceType;
79 explicit DGHelmholtzOperator ( SpaceOperatorType &spaceOp )
80 : spaceOp_( spaceOp ),
82 wTmp_(
"DGHelmholtz::tmp", space() )
85 void operator() (
const DomainFunctionType &u, RangeFunctionType &w )
const
90 spaceOperator()( u, wTmp_ );
91 w.axpy( -lambda(), wTmp_ );
95 void jacobian (
const DomainFunctionType &u, JacobianOperatorType &jOp )
const
97 spaceOperator().jacobian( u, jOp );
98 jOp.setLambda( lambda() );
101 const double &lambda ()
const {
return lambda_; }
102 void setLambda (
double lambda ) { lambda_ = lambda; }
104 void setTime (
double time ) { spaceOperator().setTime( time ); }
106 const DiscreteFunctionSpaceType &space ()
const {
return spaceOperator().space(); }
108 void initializeTimeStepSize (
const DomainFunctionType &u )
const
110 spaceOperator()( u, wTmp_ );
113 double timeStepEstimate ()
const {
return spaceOperator().timeStepEstimate(); }
115 const SpaceOperatorType &spaceOperator ()
const {
return spaceOp_; }
116 SpaceOperatorType &spaceOperator () {
return spaceOp_; }
119 SpaceOperator &spaceOp_;
121 mutable RangeFunctionType wTmp_;
BaseType::RangeFunctionType RangeFunctionType
type of discrete function in the operator's range
Definition: differentiableoperator.hh:40
JacobianOperator JacobianOperatorType
type of linear operator modelling the operator's Jacobian
Definition: differentiableoperator.hh:35
BaseType::DomainFunctionType DomainFunctionType
type of discrete function in the operator's domain
Definition: differentiableoperator.hh:38
virtual void jacobian(const DomainFunctionType &u, JacobianOperatorType &jOp) const=0
obtain linearization
Dune namespace.
Definition: alignedallocator.hh:13