Xpetra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Xpetra_Operator.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Xpetra: A linear algebra interface package
4 //
5 // Copyright 2012 NTESS and the Xpetra contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef XPETRA_OPERATOR_HPP
11 #define XPETRA_OPERATOR_HPP
12 
13 #include "Xpetra_ConfigDefs.hpp"
14 
15 #include <Teuchos_Describable.hpp>
16 #include <Teuchos_BLAS_types.hpp>
17 #include <Teuchos_ScalarTraits.hpp>
18 
19 #include "Xpetra_Map.hpp"
20 #include "Xpetra_MultiVector.hpp"
21 
22 namespace Xpetra {
23 
24 template <class Scalar,
25  class LocalOrdinal,
26  class GlobalOrdinal,
27  class Node = Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>
28 class Operator : virtual public Teuchos::Describable {
31 
32  public:
33  virtual ~Operator() {}
36 
38  typedef Scalar scalar_type;
39 
41  typedef LocalOrdinal local_ordinal_type;
42 
44  typedef GlobalOrdinal global_ordinal_type;
45 
47  typedef Node node_type;
48 
50 
52 
54  virtual const Teuchos::RCP<const map_type> getDomainMap() const = 0;
55 
57  virtual const Teuchos::RCP<const map_type> getRangeMap() const = 0;
58 
60 
65  virtual void
66  apply(const mv_type& X, mv_type& Y,
67  Teuchos::ETransp mode = Teuchos::NO_TRANS,
68  Scalar alpha = Teuchos::ScalarTraits<Scalar>::one(),
69  Scalar beta = Teuchos::ScalarTraits<Scalar>::zero()) const = 0;
70 
77  virtual bool hasTransposeApply() const { return false; }
78 
80 
81  virtual void removeEmptyProcessesInPlace(const RCP<const map_type>& /* newMap */) {}
82 
84  virtual void residual(const mv_type& X,
85  const mv_type& B,
86  mv_type& R) const = 0;
87 };
88 
89 } // namespace Xpetra
90 
91 #define XPETRA_OPERATOR_SHORT
92 #endif // XPETRA_OPERATOR_HPP
Scalar scalar_type
The type of the entries of the input and output multivectors.
virtual void apply(const mv_type &X, mv_type &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=Teuchos::ScalarTraits< Scalar >::one(), Scalar beta=Teuchos::ScalarTraits< Scalar >::zero()) const =0
Computes the operator-multivector application.
Node node_type
The Kokkos Node type.
GlobalOrdinal global_ordinal_type
The global index type.
LocalOrdinal local_ordinal_type
The local index type.
Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > map_type
virtual const Teuchos::RCP< const map_type > getRangeMap() const =0
The Map associated with the range of this operator, which must be compatible with Y...
virtual void residual(const mv_type &X, const mv_type &B, mv_type &R) const =0
Compute a residual R = B - (*this) * X.
virtual const Teuchos::RCP< const map_type > getDomainMap() const =0
The Map associated with the domain of this operator, which must be compatible with X...
Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > mv_type
virtual void removeEmptyProcessesInPlace(const RCP< const map_type > &)
virtual bool hasTransposeApply() const
Whether this operator supports applying the transpose or conjugate transpose.