Tpetra parallel linear algebra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Tpetra_LocalOperator.hpp
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_LOCALOPERATOR_HPP
11 #define TPETRA_LOCALOPERATOR_HPP
12 
14 #include "Teuchos_BLAS_types.hpp"
15 #include "Kokkos_ArithTraits.hpp"
16 #include <type_traits>
17 
18 namespace Tpetra {
19 
28  template<class Scalar, class Device>
29  class LocalOperator {
30  public:
31  using scalar_type = typename Kokkos::ArithTraits<Scalar>::val_type;
32  using array_layout = Kokkos::LayoutLeft;
33  using device_type =
34  Kokkos::Device<typename Device::execution_space,
35  typename Device::memory_space>;
36 
37  virtual ~LocalOperator () = default;
38 
39  virtual void
40  apply (Kokkos::View<const scalar_type**, array_layout,
41  device_type, Kokkos::MemoryTraits<Kokkos::Unmanaged> > X,
42  Kokkos::View<scalar_type**, array_layout,
43  device_type, Kokkos::MemoryTraits<Kokkos::Unmanaged> > Y,
44  const Teuchos::ETransp mode,
45  const scalar_type alpha,
46  const scalar_type beta) const = 0;
47 
48  virtual bool hasTransposeApply () const { return false; }
49  };
50 
51 } // namespace Tpetra
52 
53 #endif // TPETRA_LOCALOPERATOR_HPP
Abstract interface for local operators (e.g., matrices and preconditioners).
Forward declaration of Tpetra::LocalCrsMatrixOperator.