1#ifndef DUNE_FEM_DIRICHLETWRAPPER_HH
2#define DUNE_FEM_DIRICHLETWRAPPER_HH
8#include <dune/fem/quadrature/cachingquadrature.hh>
9#include <dune/fem/operator/common/operator.hh>
10#include <dune/fem/operator/common/stencil.hh>
12#include <dune/fem/common/bindguard.hh>
13#include <dune/fem/function/common/localcontribution.hh>
14#include <dune/fem/function/localfunction/const.hh>
16#include <dune/fem/operator/common/differentiableoperator.hh>
18#include <dune/fem/schemes/dirichletconstraints.hh>
19#include <dune/fem/io/parameter.hh>
22template<
class Operator,
23 class Constraints = Dune::DirichletConstraints< typename Operator::ModelType, typename Operator::RangeDiscreteFunctionSpaceType >
25struct DirichletWrapperOperator
30 typedef typename Operator::ModelType ModelType;
31 typedef typename Operator::DirichletModelType DirichletModelType;
32 typedef typename DomainFunctionType::DiscreteFunctionSpaceType DomainDiscreteFunctionSpaceType;
33 typedef typename RangeFunctionType::DiscreteFunctionSpaceType RangeDiscreteFunctionSpaceType;
35 typedef typename RangeDiscreteFunctionSpaceType::RangeType DomainRangeType;
36 typedef Constraints ConstraintsType;
37 typedef typename ConstraintsType::DirichletBlockVector DirichletBlockVector;
39 template <
class... Args>
40 DirichletWrapperOperator ( Args&... args )
41 : op_(
std::forward<Args&>(args)... ) , constraints_( op_.model(), op_.rangeSpace() )
44 void setConstraints( DomainFunctionType &u )
const
49 void setConstraints(
const DomainRangeType &value, DomainFunctionType &u )
const
52 constraints()( value, u );
55 void setConstraints(
const GF &u, RangeFunctionType &w )
const
58 constraints()( u, w, ConstraintsType::Operation::set );
61 void subConstraints(
const GF &u, RangeFunctionType &w )
const
64 constraints()( u, w, ConstraintsType::Operation::sub );
66 void subConstraints( RangeFunctionType &w )
const
69 constraints()( w, ConstraintsType::Operation::sub );
72 void addConstraints(
const GF &u, RangeFunctionType &w )
const
75 constraints()( u, w, ConstraintsType::Operation::add );
77 void addConstraints( RangeFunctionType &w )
const
80 constraints()( w, ConstraintsType::Operation::add );
82 const auto &dirichletBlocks()
const
84 return constraints().dirichletBlocks();
88 virtual bool nonlinear ()
const {
return op_.nonlinear(); }
91 virtual void operator() (
const DomainFunctionType &u, RangeFunctionType &w )
const
94 subConstraints( u, w );
97 auto operator()(
const GF &u, RangeFunctionType &w )
const
101 subConstraints( u, w );
104 void jacobian (
const DomainFunctionType &u, JacobianOperatorType &jOp )
const
107 constraints().applyToOperator( jOp );
110 template <
class Gr
idFunctionType>
111 auto jacobian (
const GridFunctionType &u, JacobianOperatorType &jOp )
const
115 constraints().applyToOperator( jOp );
119 const DomainDiscreteFunctionSpaceType& domainSpace()
const
121 return op_.domainSpace();
123 const RangeDiscreteFunctionSpaceType& rangeSpace()
const
125 return op_.rangeSpace();
128 std::size_t gridSizeInterior ()
const
130 return op_.gridSizeInterior();
133 template <
typename O = Operator>
134 auto setCommunicate (
const bool commuicate )
137 op_.setCommunicate(commuicate);
140 template <
typename O = Operator>
141 auto setQuadratureOrders(
unsigned int interior,
unsigned int surface)
144 return op_.setQuadratureOrders(interior,surface);
147 ModelType &model ()
const {
return op_.model(); }
148 const ConstraintsType &constraints ()
const {
return constraints_; }
149 const auto& impl()
const {
return op_.impl(); }
154 ConstraintsType constraints_;
abstract differentiable operator
Definition: differentiableoperator.hh:29
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
Implements a matrix constructed from a given type representing a field and compile-time given number ...
typename Impl::voider< Types... >::type void_t
Is void for all valid input types. The workhorse for C++11 SFINAE-techniques.
Definition: typetraits.hh:40
virtual bool nonlinear() const
Definition: operator.hh:64
virtual void operator()(const DomainFunctionType &u, RangeFunctionType &w) const=0
application operator