45 #ifndef AMESOS2_MATRIXTRAITS_HPP
46 #define AMESOS2_MATRIXTRAITS_HPP
48 #include "Amesos2_config.h"
50 #include <Tpetra_CrsMatrix.hpp>
53 #ifdef HAVE_AMESOS2_EPETRA
54 # include <Epetra_RowMatrix.h>
55 # include <Epetra_CrsMatrix.h>
57 # include <Epetra_VbrMatrix.h>
66 template <
class Matrix>
67 struct MatrixTraits {};
73 template <
typename Scalar,
74 typename LocalOrdinal,
75 typename GlobalOrdinal,
78 Tpetra::RowMatrix<Scalar,
82 typedef Scalar scalar_t;
83 typedef LocalOrdinal local_ordinal_t;
84 typedef GlobalOrdinal global_ordinal_t;
87 typedef Tpetra::RowMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> matrix_type;
88 typedef typename matrix_type::local_matrix_type local_matrix_t;
89 typedef typename matrix_type::local_matrix_type::row_map_type::pointer_type sparse_ptr_type;
90 typedef typename matrix_type::local_matrix_type::index_type::pointer_type sparse_idx_type;
91 typedef typename matrix_type::local_matrix_type::values_type::pointer_type sparse_values_type;
93 typedef row_access major_access;
96 template <
typename Scalar,
97 typename LocalOrdinal,
98 typename GlobalOrdinal,
101 Tpetra::CrsMatrix<Scalar,
105 typedef Scalar scalar_t;
106 typedef LocalOrdinal local_ordinal_t;
107 typedef GlobalOrdinal global_ordinal_t;
110 typedef Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> matrix_type;
111 typedef typename matrix_type::local_matrix_type local_matrix_t;
112 typedef typename matrix_type::local_matrix_type::row_map_type::pointer_type sparse_ptr_type;
113 typedef typename matrix_type::local_matrix_type::index_type::pointer_type sparse_idx_type;
114 typedef typename matrix_type::local_matrix_type::values_type::pointer_type sparse_values_type;
116 typedef row_access major_access;
119 template <
typename Scalar,
120 typename LocalOrdinal,
121 typename DeviceType >
123 KokkosSparse::CrsMatrix<Scalar,
126 typedef Scalar scalar_t;
127 typedef LocalOrdinal local_ordinal_t;
128 typedef Tpetra::Map<>::global_ordinal_type global_ordinal_t;
129 typedef LocalOrdinal global_size_t;
131 typedef KokkosSparse::CrsMatrix<Scalar, LocalOrdinal, DeviceType> matrix_type;
132 typedef Tpetra::Map<>::node_type node_t;
134 typedef matrix_type local_matrix_t;
135 typedef typename matrix_type::row_map_type::value_type * sparse_ptr_type;
136 typedef typename matrix_type::ordinal_type * sparse_idx_type;
137 typedef typename matrix_type::value_type * sparse_values_type;
139 typedef row_access major_access;
142 #ifdef HAVE_AMESOS2_EPETRA
145 struct MatrixTraits<Epetra_RowMatrix> {
146 typedef double scalar_t;
147 typedef int local_ordinal_t;
148 typedef Tpetra::Map<>::global_ordinal_type global_ordinal_t;
149 typedef Tpetra::Map<>::node_type node_t;
151 typedef Epetra_RowMatrix matrix_type;
152 typedef matrix_type local_matrix_t;
153 typedef int* sparse_ptr_type;
154 typedef int* sparse_idx_type;
155 typedef double* sparse_values_type;
157 typedef row_access major_access;
161 struct MatrixTraits<Epetra_CrsMatrix> {
162 typedef double scalar_t;
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_CrsMatrix 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;
187 struct MatrixTraits<Epetra_VbrMatrix> {
188 typedef double scalar_t;
189 typedef int local_ordinal_t;
190 typedef Tpetra::Map<>::global_ordinal_type global_ordinal_t;
191 typedef Tpetra::Map<>::node_type node_t;
193 typedef Epetra_VbrMatrix matrix_type;
194 typedef matrix_type local_matrix_t;
195 typedef int* sparse_ptr_type;
196 typedef int* sparse_idx_type;
197 typedef double* sparse_values_type;
199 typedef row_access major_access;
206 #endif // AMESOS2_MATRIXTRAITS_HPP
Utility functions for Amesos2.