Amesos2 - Direct Sparse Solver Interfaces  Version of the Day
Amesos2_VectorTraits.hpp
1 // @HEADER
2 // *****************************************************************************
3 // Amesos2: Templated Direct Sparse Solver Package
4 //
5 // Copyright 2011 NTESS and the Amesos2 contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 
11 #ifndef AMESOS2_VECTORTRAITS_HPP
12 #define AMESOS2_VECTORTRAITS_HPP
13 
14 //#include "Amesos2_config.h"
15 
16 #include <Tpetra_MultiVector.hpp>
17 
18 
19 #ifdef HAVE_AMESOS2_EPETRA
20 # include <Epetra_MultiVector.h>
21 // and perhaps some others later...
22 #endif
23 
24 namespace Amesos2 {
25 
26  // The declaration
27  template <class Vector>
28  struct VectorTraits {};
29 
30  /*******************
31  * Specializations *
32  *******************/
33 
34  template < typename Scalar,
35  typename LocalOrdinal,
36  typename GlobalOrdinal,
37  typename Node >
38  struct VectorTraits<
39  Tpetra::MultiVector<Scalar,
40  LocalOrdinal,
41  GlobalOrdinal,
42  Node> > {
43  typedef Scalar scalar_t;
44  typedef LocalOrdinal local_ordinal_t;
45  typedef GlobalOrdinal global_ordinal_t;
46  typedef Node node_t;
47 
48  typedef Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> multivector_type;
49  typedef typename multivector_type::impl_scalar_type ptr_scalar_type; // TODO Make this a pointer
50  };
51 
52  template < typename Scalar,
53  typename ExecutionSpace >
54  struct VectorTraits<
55  Kokkos::View<Scalar**,Kokkos::LayoutLeft,ExecutionSpace> > {
56  typedef Scalar scalar_t;
57  typedef int local_ordinal_t;
58  typedef Tpetra::Map<>::global_ordinal_type global_ordinal_t;
59  typedef Tpetra::Map<>::node_type node_t;
60 
61  typedef Kokkos::View<Scalar**,Kokkos::LayoutLeft,ExecutionSpace> multivector_type;
62  typedef Scalar ptr_scalar_type; // TODO Make this a pointer
63  };
64 
65 
66 #ifdef HAVE_AMESOS2_EPETRA
67 
68  template <>
69  struct VectorTraits<Epetra_MultiVector> {
70  typedef double scalar_t;
71  typedef int local_ordinal_t;
72  typedef Tpetra::Map<>::global_ordinal_type global_ordinal_t;
73  typedef Tpetra::Map<>::node_type node_t;
74 
75  typedef Epetra_MultiVector multivector_type;
76  typedef double ptr_scalar_type; // TODO Make this a pointer
77  };
78 
79 #endif
80 
81 }
82 
83 #endif // AMESOS2_VECTORTRAITS_HPP