37 template <
typename ReturnType_,
typename... Arguments>
51 template <
class ParentFunctor,
typename Fun,
typename... Arguments>
72 template <
typename ReturnType_,
typename... Arguments>
83 Functor(
const std::unique_ptr<Impl>& impl_) : impl(impl_->clone()){}
95 std::unique_ptr<Impl> impl;
103 template <
class Scalar,
typename Domain,
typename Range,
class Assembler>
107 ApplyOperatorImpl(Assembler
const& assembler_,
bool onlyLowerTriangle_,
int rbegin_,
int rend_,
int cbegin_,
int cend_)
108 : assembler(assembler_), onlyLowerTriangle(onlyLowerTriangle_), rbegin(rbegin_), rend(rend_), cbegin(cbegin_), cend(cend_)
113 virtual void apply(Domain
const&, Range&)
const = 0;
119 template <
class Matrix>
120 Matrix
get()
const {
return assembler.template get<Matrix>(onlyLowerTriangle,rbegin,rend,cbegin,cend); }
122 template <
class Matrix>
123 std::unique_ptr<Matrix>
getPointer()
const {
return assembler.template get<Matrix>(onlyLowerTriangle,rbegin,rend,cbegin,cend); }
126 Assembler
const& assembler;
127 bool onlyLowerTriangle;
128 int rbegin, rend, cbegin, cend;
132 template <
class ParentApplyOperator,
typename Operator>
133 class ApplyOperatorHandler :
public ApplyOperatorImpl<typename ParentApplyOperator::Scalar, typename ParentApplyOperator::Domain, typename ParentApplyOperator::Range, typename Operator::Assembler>
136 typedef typename ParentApplyOperator::Scalar
Scalar;
137 typedef typename ParentApplyOperator::Domain
Domain;
138 typedef typename ParentApplyOperator::Range
Range;
143 :
Base(op_.getAssembler(), op_.getOnlyLowerTriangle(), Operator::BlockInfo::firstRow, Operator::BlockInfo::lastRow, Operator::BlockInfo::firstCol, Operator::BlockInfo::lastCol),
158 template <
typename Scalar_,
typename Domain_,
typename Range_,
typename Assembler_>
177 template <
class Operator>
186 template <
class Matrix>
187 Matrix
get()
const {
return impl->template get<Matrix>(); }
189 template <
class Matrix>
190 std::unique_ptr<Matrix>
getPointer()
const {
return impl->template getPointer<Matrix>(); }
193 std::unique_ptr<Impl> impl;
Implementation of FunctorImpl. Allows the use of function pointers as well as functors.
ParentApplyOperator::Range Range
ParentApplyOperator::Domain Domain
void applyscaleadd(Scalar alpha, Domain const &x, Range &y) const
void apply(Domain const &x, Range &y) const
ApplyOperatorImpl< Scalar, Domain, Range, Assembler > Base
ApplyOperatorHandler(const Operator &op_)
ParentApplyOperator::Scalar Scalar
Operator::Assembler Assembler
ApplyOperatorHandler * clone() const
ApplyOperator(const Operator &op)
std::unique_ptr< Matrix > getPointer() const
ApplyOperator(ApplyOperator const &other)
void apply(Domain const &x, Range &y) const
ApplyOperator(const std::unique_ptr< Impl > &impl_)
ApplyOperator & operator=(const ApplyOperator &other)
void applyscaleadd(Scalar alpha, Domain const &x, Range &y) const
Store operator, independent of operator type.
std::unique_ptr< Matrix > getPointer() const
virtual void applyscaleadd(Scalar, Domain const &, Range &) const =0
ApplyOperatorImpl(Assembler const &assembler_, bool onlyLowerTriangle_, int rbegin_, int rend_, int cbegin_, int cend_)
virtual ApplyOperatorImpl * clone() const =0
virtual ~ApplyOperatorImpl()
virtual void apply(Domain const &, Range &) const =0
Implementation of FunctorImpl. Allows the use of function pointers as well as functors.
ReturnType operator()(Arguments... args)
ParentFunctor::ReturnType ReturnType
FunctorHandler * clone() const
FunctorHandler(const Fun &fun_)
Functor with first class semantics.
ReturnType operator()(Arguments... args) const
ReturnType operator()(Arguments... args)
Functor(const std::unique_ptr< Impl > &impl_)
Functor & operator=(const Functor &functor)
Functor(Functor const &functor)
Abstract functor implementation base class.
virtual ReturnType operator()(Arguments...)=0
virtual FunctorImpl * clone() const =0