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 // ***********************************************************************
4 //
5 // MueLu: A package for multigrid based preconditioning
6 // Copyright 2012 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact
39 // Jonathan Hu (jhu@sandia.gov)
40 // Andrey Prokopenko (aprokop@sandia.gov)
41 // Ray Tuminaro (rstumin@sandia.gov)
42 // Tobias Wiesner (tawiesn@sandia.gov)
43 //
44 // ***********************************************************************
45 //
46 // @HEADER
47 #ifndef THYRA_XPETRA_LINEAR_OP_DECL_HPP
48 #define THYRA_XPETRA_LINEAR_OP_DECL_HPP
49 
50 #include "Thyra_LinearOpDefaultBase.hpp"
51 #include "Xpetra_Operator.hpp"
52 #include "Teuchos_ConstNonconstObjectContainer.hpp"
53 
54 
55 namespace Thyra {
56 
57 
64 template <class Scalar, class LocalOrdinal, class GlobalOrdinal=LocalOrdinal,
65  class Node=KokkosClassic::DefaultNode::DefaultNodeType>
67  : virtual public Thyra::LinearOpDefaultBase<Scalar>
68 {
69 public:
70 
73 
76 
78  void initialize(
79  const RCP<const VectorSpaceBase<Scalar> > &rangeSpace,
80  const RCP<const VectorSpaceBase<Scalar> > &domainSpace,
81  const RCP<Xpetra::Operator<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &xpetraOperator
82  );
83 
85  void constInitialize(
86  const RCP<const VectorSpaceBase<Scalar> > &rangeSpace,
87  const RCP<const VectorSpaceBase<Scalar> > &domainSpace,
88  const RCP<const Xpetra::Operator<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &xpetraOperator
89  );
90 
94 
97  getConstXpetraOperator() const;
98 
100 
103 
106 
109 
111 
112 protected:
113 
116 
118  bool opSupportedImpl(Thyra::EOpTransp M_trans) const;
119 
121  void applyImpl(
122  const Thyra::EOpTransp M_trans,
123  const Thyra::MultiVectorBase<Scalar> &X_in,
124  const Teuchos::Ptr<Thyra::MultiVectorBase<Scalar> > &Y_inout,
125  const Scalar alpha,
126  const Scalar beta
127  ) const;
128 
130 
131 private:
132 
135 
138 
141 
142  template<class XpetraOperator_t>
143  void initializeImpl(
144  const RCP<const VectorSpaceBase<Scalar> > &rangeSpace,
145  const RCP<const VectorSpaceBase<Scalar> > &domainSpace,
146  const RCP<XpetraOperator_t> &xpetraOperator
147  );
148 
149 };
150 
151 
156 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
159  const RCP<const VectorSpaceBase<Scalar> > &rangeSpace,
160  const RCP<const VectorSpaceBase<Scalar> > &domainSpace,
161  const RCP<Xpetra::Operator<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &xpetraOperator
162  )
163 {
166  op->initialize(rangeSpace, domainSpace, xpetraOperator);
167  return op;
168 }
169 
170 
175 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
178  const RCP<const VectorSpaceBase<Scalar> > &rangeSpace,
179  const RCP<const VectorSpaceBase<Scalar> > &domainSpace,
180  const RCP<const Xpetra::Operator<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &xpetraOperator
181  )
182 {
185  op->constInitialize(rangeSpace, domainSpace, xpetraOperator);
186  return op;
187 }
188 
189 } // namespace Thyra
190 
191 #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_
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.
Teuchos::ConstNonconstObjectContainer< Xpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node > > xpetraOperator_
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.