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 // ***********************************************************************
4 //
5 // Xpetra: A linear algebra interface package
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 //
43 // ***********************************************************************
44 //
45 // @HEADER
46 #ifndef XPETRA_OPERATOR_HPP
47 #define XPETRA_OPERATOR_HPP
48 
49 #include "Xpetra_ConfigDefs.hpp"
50 
51 #include <Teuchos_Describable.hpp>
52 #include <Teuchos_BLAS_types.hpp>
53 #include <Teuchos_ScalarTraits.hpp>
54 
55 #include "Xpetra_Map.hpp"
56 #include "Xpetra_MultiVector.hpp"
57 
58 namespace Xpetra {
59 
60 template <class Scalar,
61  class LocalOrdinal,
62  class GlobalOrdinal,
63  class Node = Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>
64 class Operator : virtual public Teuchos::Describable {
67 
68  public:
69  virtual ~Operator() {}
72 
74  typedef Scalar scalar_type;
75 
77  typedef LocalOrdinal local_ordinal_type;
78 
80  typedef GlobalOrdinal global_ordinal_type;
81 
83  typedef Node node_type;
84 
86 
88 
90  virtual const Teuchos::RCP<const map_type> getDomainMap() const = 0;
91 
93  virtual const Teuchos::RCP<const map_type> getRangeMap() const = 0;
94 
96 
101  virtual void
102  apply(const mv_type& X, mv_type& Y,
103  Teuchos::ETransp mode = Teuchos::NO_TRANS,
104  Scalar alpha = Teuchos::ScalarTraits<Scalar>::one(),
105  Scalar beta = Teuchos::ScalarTraits<Scalar>::zero()) const = 0;
106 
113  virtual bool hasTransposeApply() const { return false; }
114 
116 
117  virtual void removeEmptyProcessesInPlace(const RCP<const map_type>& /* newMap */) {}
118 
120  virtual void residual(const mv_type& X,
121  const mv_type& B,
122  mv_type& R) const = 0;
123 };
124 
125 } // namespace Xpetra
126 
127 #define XPETRA_OPERATOR_SHORT
128 #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.