dune-fem  2.8-git
numpyoperator.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEMPY_NUMPYOPERATOR_HH
2 #define DUNE_FEMPY_NUMPYOPERATOR_HH
3 
4 // dune-fem includes
6 
7 // local includes
8 #include <dune/fempy/pybind11/pybind11.hh>
9 
10 namespace Dune
11 {
12 
13  namespace Fem
14  {
15 
17  template< class DomainFunction, class RangeFunction >
19  : public SparseRowMatrixObject< typename DomainFunction::DiscreteFunctionSpaceType,
20  typename RangeFunction::DiscreteFunctionSpaceType,
21  SparseRowMatrix< double, size_t,
22  pybind11::array_t< double >,
23  pybind11::array_t<size_t> > >,
24  public Fem::AssembledOperator< DomainFunction, RangeFunction >
25  {
26  typedef typename DomainFunction::DiscreteFunctionSpaceType DomainSpaceType;
27  typedef typename RangeFunction::DiscreteFunctionSpaceType RangeSpaceType;
29  // for numpy backend we need to use different storage classes
32 
33  static constexpr bool assembled = true;
34 
35  using BaseType::apply;
36 
37  NumpyLinearOperator( const std::string & ,
40  const SolverParameter& param = SolverParameter() ) :
42  {}
43 
44  virtual void operator()( const DomainFunction &arg, RangeFunction &dest ) const
45  {
46  apply( arg, dest );
47  }
48 
49  const BaseType &systemMatrix() const
50  {
51  return *this;
52  }
53 
55  {
56  return *this;
57  }
58  };
59 
60  } // namespace Fem
61 
62 } // namespace Dune
63 
64 #endif // #ifndef DUNE_FEM_SPOPERATOR_HH
Definition: bindguard.hh:11
abstract matrix operator
Definition: operator.hh:124
NumpyLinearOperator.
Definition: numpyoperator.hh:25
static constexpr bool assembled
Definition: numpyoperator.hh:33
SparseRowMatrixObject< DomainSpaceType, RangeSpaceType, Matrix > BaseType
Definition: numpyoperator.hh:31
RangeFunction::DiscreteFunctionSpaceType RangeSpaceType
Definition: numpyoperator.hh:27
DomainFunction::DiscreteFunctionSpaceType DomainSpaceType
Definition: numpyoperator.hh:26
void apply(const DomainFunction &arg, RangeFunction &dest) const
apply matrix to discrete function
Definition: spmatrix.hh:658
SparseRowMatrix< double, size_t, pybind11::array_t< double >, pybind11::array_t< size_t > > Matrix
Definition: numpyoperator.hh:30
BaseType & systemMatrix()
Definition: numpyoperator.hh:54
NumpyLinearOperator< DomainFunction, RangeFunction > ThisType
Definition: numpyoperator.hh:28
const BaseType & systemMatrix() const
Definition: numpyoperator.hh:49
NumpyLinearOperator(const std::string &, const DomainSpaceType &domainSpace, const RangeSpaceType &rangeSpace, const SolverParameter &param=SolverParameter())
Definition: numpyoperator.hh:37
virtual void operator()(const DomainFunction &arg, RangeFunction &dest) const
Definition: numpyoperator.hh:44
SparseRowMatrix.
Definition: spmatrix.hh:40
SparseRowMatrixObject.
Definition: spmatrix.hh:405
void apply(const DomainFunction &arg, RangeFunction &dest) const
apply matrix to discrete function
Definition: spmatrix.hh:658
Definition: solver/parameter.hh:15