MueLu  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_XpetraLinearOp_decl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // MueLu: A package for multigrid based preconditioning
4 //
5 // Copyright 2012 NTESS and the MueLu contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef THYRA_XPETRA_LINEAR_OP_DECL_HPP
11 #define THYRA_XPETRA_LINEAR_OP_DECL_HPP
12 
13 #include "Thyra_LinearOpDefaultBase.hpp"
14 #include "Xpetra_Operator.hpp"
15 #include "Teuchos_ConstNonconstObjectContainer.hpp"
16 
17 namespace Thyra {
18 
25 template <class Scalar, class LocalOrdinal, class GlobalOrdinal = LocalOrdinal,
26  class Node = Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>
28  : virtual public Thyra::LinearOpDefaultBase<Scalar> {
29  public:
32 
35 
37 
39  void initialize(
40  const RCP<const VectorSpaceBase<Scalar> > &rangeSpace,
41  const RCP<const VectorSpaceBase<Scalar> > &domainSpace,
43 
45  void constInitialize(
46  const RCP<const VectorSpaceBase<Scalar> > &rangeSpace,
47  const RCP<const VectorSpaceBase<Scalar> > &domainSpace,
49 
53 
56  getConstXpetraOperator() const;
57 
59 
62 
65 
68 
70 
71  protected:
74 
76  bool opSupportedImpl(Thyra::EOpTransp M_trans) const;
77 
79  void applyImpl(
80  const Thyra::EOpTransp M_trans,
81  const Thyra::MultiVectorBase<Scalar> &X_in,
82  const Teuchos::Ptr<Thyra::MultiVectorBase<Scalar> > &Y_inout,
83  const Scalar alpha,
84  const Scalar beta) const;
85 
87 
88  private:
91 
94 
97 
98  template <class XpetraOperator_t>
99  void initializeImpl(
100  const RCP<const VectorSpaceBase<Scalar> > &rangeSpace,
101  const RCP<const VectorSpaceBase<Scalar> > &domainSpace,
102  const RCP<XpetraOperator_t> &xpetraOperator);
103 };
104 
109 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
112  const RCP<const VectorSpaceBase<Scalar> > &rangeSpace,
113  const RCP<const VectorSpaceBase<Scalar> > &domainSpace,
117  op->initialize(rangeSpace, domainSpace, xpetraOperator);
118  return op;
119 }
120 
125 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
128  const RCP<const VectorSpaceBase<Scalar> > &rangeSpace,
129  const RCP<const VectorSpaceBase<Scalar> > &domainSpace,
133  op->constInitialize(rangeSpace, domainSpace, xpetraOperator);
134  return op;
135 }
136 
137 } // namespace Thyra
138 
139 #endif // THYRA_XPETRA_LINEAR_OP_DECL_HPP
RCP< const VectorSpaceBase< Scalar > > domainSpace_
MueLu::DefaultLocalOrdinal LocalOrdinal
RCP< const Thyra::VectorSpaceBase< Scalar > > range() const
RCP< const Xpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getConstXpetraOperator() const
Get embedded const Xpetra::Operator.
RCP< const XpetraLinearOp< Scalar, LocalOrdinal, GlobalOrdinal, Node > > constXpetraLinearOp(const RCP< const VectorSpaceBase< Scalar > > &rangeSpace, const RCP< const VectorSpaceBase< Scalar > > &domainSpace, const RCP< const Xpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &xpetraOperator)
Nonmmeber constructor for XpetraLinearOp.
bool opSupportedImpl(Thyra::EOpTransp M_trans) const
MueLu::DefaultNode Node
RCP< const Thyra::VectorSpaceBase< Scalar > > domain() const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
MueLu::DefaultScalar Scalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
void initializeImpl(const RCP< const VectorSpaceBase< Scalar > > &rangeSpace, const RCP< const VectorSpaceBase< Scalar > > &domainSpace, const RCP< XpetraOperator_t > &xpetraOperator)
XpetraLinearOp()
Construct to uninitialized.
void applyImpl(const Thyra::EOpTransp M_trans, const Thyra::MultiVectorBase< Scalar > &X_in, const Teuchos::Ptr< Thyra::MultiVectorBase< Scalar > > &Y_inout, const Scalar alpha, const Scalar beta) const
RCP< Xpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getXpetraOperator()
Get embedded non-const Xpetra::Operator.
Concrete Thyra::LinearOpBase subclass for Xpetra::Operator.
void initialize(const RCP< const VectorSpaceBase< Scalar > > &rangeSpace, const RCP< const VectorSpaceBase< Scalar > > &domainSpace, const RCP< Xpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &xpetraOperator)
Initialize.
RCP< const VectorSpaceBase< Scalar > > rangeSpace_
Teuchos::ConstNonconstObjectContainer< Xpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node > > xpetraOperator_
RCP< XpetraLinearOp< Scalar, LocalOrdinal, GlobalOrdinal, Node > > xpetraLinearOp(const RCP< const VectorSpaceBase< Scalar > > &rangeSpace, const RCP< const VectorSpaceBase< Scalar > > &domainSpace, const RCP< Xpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &xpetraOperator)
Nonmmeber constructor for XpetraLinearOp.
void constInitialize(const RCP< const VectorSpaceBase< Scalar > > &rangeSpace, const RCP< const VectorSpaceBase< Scalar > > &domainSpace, const RCP< const Xpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &xpetraOperator)
Initialize.