dune-fem 2.12-git
Loading...
Searching...
No Matches
preconditionfunctionwrapper.hh
Go to the documentation of this file.
1#ifndef DUNE_FEM_SOLVER_PRECONDITIONFUNCTIONWRAPPER_HH
2#define DUNE_FEM_SOLVER_PRECONDITIONFUNCTIONWRAPPER_HH
3
4#include <functional>
5
7
8namespace Dune
9{
10 namespace Fem
11 {
20 template <class DomainFunction, class RangeFunction = DomainFunction>
22 : public virtual Operator< DomainFunction, RangeFunction >
23 {
24 public:
25 typedef DomainFunction DomainFunctionType;
26 typedef RangeFunction RangeFunctionType;
27
31
32 protected:
33 const PreconditionerFunctionType& preconditioner_; // function given from Python side
34 public:
37
38 virtual void operator() ( const DomainFunctionType &u, RangeFunctionType &v ) const final override
39 {
40 // convert to reference_wrapper to avoid copying
41 ConstDomainDFType uR( u );
42 RangeDFType vR( v );
43
44 // callback to python applying preconditioner
45 preconditioner_( uR, vR );
46 }
47 };
48
49 } // end namespace Fem
50
51} // end namespace Dune
52#endif
void pre(Domain &x, Range &b)
virtual void operator()()=0
abstract operator
Definition operator.hh:34
Wrapper for functions passed from Python side that implements a preconditioner.
Definition preconditionfunctionwrapper.hh:23
std::reference_wrapper< const DomainFunctionType > ConstDomainDFType
Definition preconditionfunctionwrapper.hh:28
RangeFunction RangeFunctionType
Definition preconditionfunctionwrapper.hh:26
PreconditionerFunctionWrapper(const PreconditionerFunctionType &pre)
Definition preconditionfunctionwrapper.hh:35
std::function< void(ConstDomainDFType &, RangeDFType &) > PreconditionerFunctionType
Definition preconditionfunctionwrapper.hh:30
std::reference_wrapper< RangeFunctionType > RangeDFType
Definition preconditionfunctionwrapper.hh:29
DomainFunction DomainFunctionType
Definition preconditionfunctionwrapper.hh:25
const PreconditionerFunctionType & preconditioner_
Definition preconditionfunctionwrapper.hh:33