Tpetra parallel linear algebra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Tpetra_ApplyOp.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Tpetra: Templated Linear Algebra Services Package
4 //
5 // Copyright 2008 NTESS and the Tpetra contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef TPETRA_APPLYOP_HPP
11 #define TPETRA_APPLYOP_HPP
12 
13 #include "Tpetra_ConfigDefs.hpp"
14 #include "Tpetra_Operator.hpp"
15 #include "Tpetra_MultiVector.hpp"
16 
19 
20 namespace Tpetra {
21  namespace details {
22 
45  template <class Scalar, class OperatorType>
46  class ApplyOp :
47  public Tpetra::Operator<Scalar,
48  typename OperatorType::local_ordinal_type,
49  typename OperatorType::global_ordinal_type,
50  typename OperatorType::node_type> {
51  public:
52  // \name Typedefs
54 
56  typedef typename OperatorType::scalar_type scalar_type;
57 
59  typedef typename OperatorType::local_ordinal_type local_ordinal_type;
60 
62  typedef typename OperatorType::global_ordinal_type global_ordinal_type;
63 
65  typedef typename OperatorType::node_type node_type;
66 
68 
70 
74  ApplyOp (const Teuchos::RCP<const OperatorType> &op) : operator_(op)
75  {}
76 
78  virtual ~ApplyOp () {}
79 
81 
83 
89  void
92  Teuchos::ETransp mode = Teuchos::NO_TRANS,
93  Scalar alpha = Teuchos::ScalarTraits<Scalar>::one(),
94  Scalar beta = Teuchos::ScalarTraits<Scalar>::zero()) const
95  {
96  operator_->template applyTempl<Scalar,Scalar> (X, Y, mode, alpha, beta);
97  }
98 
99 
105  bool hasTransposeApply() const {
106  return operator_->hasTransposeApply ();
107  }
108 
110  Teuchos::RCP<const Tpetra::Map<local_ordinal_type,global_ordinal_type,node_type> >
111  getDomainMap () const {
112  return operator_->getDomainMap ();
113  }
114 
116  Teuchos::RCP<const Tpetra::Map<local_ordinal_type,global_ordinal_type,node_type> >
117  getRangeMap () const {
118  return operator_->getRangeMap ();
119  }
121 
122  protected:
124  Teuchos::RCP<const OperatorType> operator_;
125  };
126 
127  } // end of namespace details
128 } // end of namespace Tpetra
129 
130 #endif // TPETRA_APPLYOP_HPP
One or more distributed dense vectors.
Teuchos::RCP< const Tpetra::Map< local_ordinal_type, global_ordinal_type, node_type > > getRangeMap() const
The range Map of this Operator.
OperatorType::local_ordinal_type local_ordinal_type
The type of local indices in the input OperatorType.
A class for wrapping an Operator apply in a Operator.
OperatorType::scalar_type scalar_type
The type of the entries of the input OperatorType.
virtual ~ApplyOp()
Destructor.
Abstract interface for operators (e.g., matrices and preconditioners).
void apply(const Tpetra::MultiVector< Scalar, local_ordinal_type, global_ordinal_type, node_type > &X, Tpetra::MultiVector< Scalar, local_ordinal_type, global_ordinal_type, node_type > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=Teuchos::ScalarTraits< Scalar >::one(), Scalar beta=Teuchos::ScalarTraits< Scalar >::zero()) const
Compute Y = beta*Y + alpha*Op(A)*X, where Op(A) is either A, , or .
OperatorType::global_ordinal_type global_ordinal_type
The type of global indices in the input OperatorType.
bool hasTransposeApply() const
Whether this Operator&#39;s apply() method can apply the transpose or conjugate transpose.
OperatorType::node_type node_type
The type of the Kokkos Node used by the input OperatorType.
Teuchos::RCP< const OperatorType > operator_
The underlying Operator object.
Teuchos::RCP< const Tpetra::Map< local_ordinal_type, global_ordinal_type, node_type > > getDomainMap() const
The domain Map of this Operator.
ApplyOp(const Teuchos::RCP< const OperatorType > &op)
Constructor.