11 #ifndef AMESOS2_MATRIXTRAITS_HPP
12 #define AMESOS2_MATRIXTRAITS_HPP
14 #include "Amesos2_config.h"
16 #include <Tpetra_CrsMatrix.hpp>
19 #ifdef HAVE_AMESOS2_EPETRA
20 # include <Epetra_RowMatrix.h>
21 # include <Epetra_CrsMatrix.h>
23 # include <Epetra_VbrMatrix.h>
32 template <
class Matrix>
33 struct MatrixTraits {};
39 template <
typename Scalar,
40 typename LocalOrdinal,
41 typename GlobalOrdinal,
44 Tpetra::RowMatrix<Scalar,
48 typedef Scalar scalar_t;
49 typedef LocalOrdinal local_ordinal_t;
50 typedef GlobalOrdinal global_ordinal_t;
53 typedef Tpetra::RowMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> matrix_type;
54 typedef typename matrix_type::impl_scalar_type impl_scalar_type;
56 typedef typename matrix_type::nonconst_global_inds_host_view_type global_host_idx_type;
57 typedef typename matrix_type::nonconst_values_host_view_type global_host_val_type;
59 typedef row_access major_access;
62 template <
typename Scalar,
63 typename LocalOrdinal,
64 typename GlobalOrdinal,
67 Tpetra::CrsMatrix<Scalar,
71 typedef Scalar scalar_t;
72 typedef LocalOrdinal local_ordinal_t;
73 typedef GlobalOrdinal global_ordinal_t;
76 typedef Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> matrix_type;
77 typedef typename matrix_type::impl_scalar_type impl_scalar_type;
79 typedef typename matrix_type::nonconst_global_inds_host_view_type global_host_idx_type;
80 typedef typename matrix_type::nonconst_values_host_view_type global_host_val_type;
82 typedef row_access major_access;
85 template <
typename Scalar,
86 typename LocalOrdinal,
89 KokkosSparse::CrsMatrix<Scalar,
92 typedef Scalar scalar_t;
93 typedef LocalOrdinal local_ordinal_t;
94 typedef Tpetra::Map<>::global_ordinal_type global_ordinal_t;
95 typedef LocalOrdinal global_size_t;
97 typedef KokkosSparse::CrsMatrix<Scalar, LocalOrdinal, DeviceType> matrix_type;
98 typedef Scalar impl_scalar_type;
99 typedef Tpetra::Map<>::node_type node_t;
101 typedef typename matrix_type::HostMirror::index_type global_host_idx_type;
102 typedef typename matrix_type::HostMirror::values_type global_host_val_type;
104 typedef row_access major_access;
107 #ifdef HAVE_AMESOS2_EPETRA
110 struct MatrixTraits<Epetra_RowMatrix> {
111 typedef double scalar_t;
112 typedef double impl_scalar_type;
113 typedef int local_ordinal_t;
114 typedef Tpetra::Map<>::global_ordinal_type global_ordinal_t;
115 typedef Tpetra::Map<>::node_type node_t;
117 typedef Epetra_RowMatrix matrix_type;
118 typedef matrix_type local_matrix_t;
119 typedef int* sparse_ptr_type;
120 typedef int* sparse_idx_type;
121 typedef double* sparse_values_type;
123 typedef Kokkos::View<global_ordinal_t*, Kokkos::HostSpace> global_host_idx_type;
124 typedef Kokkos::View<scalar_t*, Kokkos::HostSpace> global_host_val_type;
126 typedef row_access major_access;
130 struct MatrixTraits<Epetra_CrsMatrix> {
131 typedef double scalar_t;
132 typedef double impl_scalar_type;
133 typedef int local_ordinal_t;
134 typedef Tpetra::Map<>::global_ordinal_type global_ordinal_t;
135 typedef Tpetra::Map<>::node_type node_t;
137 typedef Epetra_CrsMatrix matrix_type;
138 typedef matrix_type local_matrix_t;
139 typedef int* sparse_ptr_type;
140 typedef int* sparse_idx_type;
141 typedef double* sparse_values_type;
143 typedef Kokkos::View<global_ordinal_t*, Kokkos::HostSpace> global_host_idx_type;
144 typedef Kokkos::View<scalar_t*, Kokkos::HostSpace> global_host_val_type;
146 typedef row_access major_access;
160 struct MatrixTraits<Epetra_VbrMatrix> {
161 typedef double scalar_t;
162 typedef double impl_scalar_type;
163 typedef int local_ordinal_t;
164 typedef Tpetra::Map<>::global_ordinal_type global_ordinal_t;
165 typedef Tpetra::Map<>::node_type node_t;
167 typedef Epetra_VbrMatrix matrix_type;
168 typedef matrix_type local_matrix_t;
169 typedef int* sparse_ptr_type;
170 typedef int* sparse_idx_type;
171 typedef double* sparse_values_type;
173 typedef row_access major_access;
180 #endif // AMESOS2_MATRIXTRAITS_HPP
Utility functions for Amesos2.