All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 = MultiVector<>::scalar_type,
61  class LocalOrdinal = typename MultiVector<Scalar>::local_ordinal_type,
62  class GlobalOrdinal = typename MultiVector<Scalar, LocalOrdinal>::global_ordinal_type,
63  class Node = typename MultiVector<Scalar, LocalOrdinal, GlobalOrdinal>::node_type>
64  class Operator : virtual public Teuchos::Describable {
67  public:
68  virtual ~Operator() { }
71 
73  typedef Scalar scalar_type;
74 
76  typedef LocalOrdinal local_ordinal_type;
77 
79  typedef GlobalOrdinal global_ordinal_type;
80 
82  typedef Node node_type;
83 
85 
87 
89  virtual Teuchos::RCP<const Map> getDomainMap() const = 0;
90 
92  virtual Teuchos::RCP<const Map> getRangeMap() const = 0;
93 
95 
100  virtual void
101  apply (const MultiVector& X, MultiVector& Y,
103  Scalar alpha = Teuchos::ScalarTraits<Scalar>::one(),
104  Scalar beta = Teuchos::ScalarTraits<Scalar>::zero()) const = 0;
105 
112  virtual bool hasTransposeApply() const { return false; }
113 
115 
116  virtual void removeEmptyProcessesInPlace(const RCP<const Map>& /* newMap */) { }
117  };
118 
119 } // Xpetra namespace
120 
121 #define XPETRA_OPERATOR_SHORT
122 #endif // XPETRA_OPERATOR_HPP
virtual void apply(const MultiVector &X, MultiVector &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.
Scalar scalar_type
The type of the entries of the input and output multivectors.
Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > MultiVector
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
virtual void removeEmptyProcessesInPlace(const RCP< const Map > &)
virtual Teuchos::RCP< const Map > getRangeMap() const =0
The Map associated with the range of this operator, which must be compatible with Y...
virtual bool hasTransposeApply() const
Whether this operator supports applying the transpose or conjugate transpose.
virtual Teuchos::RCP< const Map > getDomainMap() const =0
The Map associated with the domain of this operator, which must be compatible with X...