11 #ifndef AMESOS2_TPETRAROWMATRIX_ABSTRACTMATRIXADAPTER_DEF_HPP
12 #define AMESOS2_TPETRAROWMATRIX_ABSTRACTMATRIXADAPTER_DEF_HPP
14 #include "Amesos2_ConcreteMatrixAdapter_decl.hpp"
15 #include "Amesos2_TpetraRowMatrix_AbstractMatrixAdapter_decl.hpp"
21 template <
typename Scalar,
22 typename LocalOrdinal,
23 typename GlobalOrdinal,
26 AbstractConcreteMatrixAdapter<
27 Tpetra::RowMatrix<Scalar,
31 DerivedMat>::AbstractConcreteMatrixAdapter(RCP<Tpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> > m)
32 : MatrixAdapter<DerivedMat>(Teuchos::rcp_static_cast<DerivedMat>(m))
38 template <
typename Scalar,
39 typename LocalOrdinal,
40 typename GlobalOrdinal,
43 template <
typename KV_GO,
typename KV_S>
45 AbstractConcreteMatrixAdapter<
46 Tpetra::RowMatrix<Scalar,
50 DerivedMat>::getGlobalRowCopy_kokkos_view_impl(global_ordinal_t row,
55 this->mat_->getGlobalRowCopy(row, indices, vals, nnz);
58 template <
typename Scalar,
59 typename LocalOrdinal,
60 typename GlobalOrdinal,
63 typename AbstractConcreteMatrixAdapter<
64 Tpetra::RowMatrix<Scalar,
68 DerivedMat>::global_size_t
69 AbstractConcreteMatrixAdapter<
70 Tpetra::RowMatrix<Scalar,
74 DerivedMat>::getGlobalNNZ_impl()
const
76 return this->mat_->getGlobalNumEntries();
79 template <
typename Scalar,
typename LocalOrdinal,
typename GlobalOrdinal,
typename Node,
class DerivedMat>
81 AbstractConcreteMatrixAdapter<
82 Tpetra::RowMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>,
83 DerivedMat>::getLocalNNZ_impl()
const
85 return this->mat_->getLocalNumEntries();
88 template <
typename Scalar,
typename LocalOrdinal,
typename GlobalOrdinal,
typename Node,
class DerivedMat>
89 typename AbstractConcreteMatrixAdapter<
90 Tpetra::RowMatrix<Scalar,
94 DerivedMat>::global_size_t
95 AbstractConcreteMatrixAdapter<
96 Tpetra::RowMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>,
97 DerivedMat>::getGlobalNumRows_impl()
const
99 return this->mat_->getGlobalNumRows();
102 template <
typename Scalar,
typename LocalOrdinal,
typename GlobalOrdinal,
typename Node,
class DerivedMat>
103 typename AbstractConcreteMatrixAdapter<
104 Tpetra::RowMatrix<Scalar,
108 DerivedMat>::global_size_t
109 AbstractConcreteMatrixAdapter<
110 Tpetra::RowMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>,
111 DerivedMat>::getGlobalNumCols_impl()
const
113 return this->mat_->getGlobalNumCols();
116 template <
typename Scalar,
117 typename LocalOrdinal,
118 typename GlobalOrdinal,
122 AbstractConcreteMatrixAdapter<
123 Tpetra::RowMatrix<Scalar,
127 DerivedMat>::getMaxRowNNZ_impl()
const
129 return this->mat_->getGlobalMaxNumRowEntries();
132 template <
typename Scalar,
133 typename LocalOrdinal,
134 typename GlobalOrdinal,
138 AbstractConcreteMatrixAdapter<
139 Tpetra::RowMatrix<Scalar,
143 DerivedMat>::getMaxColNNZ_impl()
const
145 TEUCHOS_TEST_FOR_EXCEPTION(
true,
147 "Column access to row-based object not yet supported. "
148 "Please contact the Amesos2 developers." );
151 template <
typename Scalar,
152 typename LocalOrdinal,
153 typename GlobalOrdinal,
157 AbstractConcreteMatrixAdapter<
158 Tpetra::RowMatrix<Scalar,
162 DerivedMat>::getGlobalRowNNZ_impl(global_ordinal_t row)
const
164 return this->mat_->getNumEntriesInGlobalRow(row);
167 template <
typename Scalar,
168 typename LocalOrdinal,
169 typename GlobalOrdinal,
173 AbstractConcreteMatrixAdapter<
174 Tpetra::RowMatrix<Scalar,
178 DerivedMat>::getLocalRowNNZ_impl(local_ordinal_t row)
const
180 return this->mat_->getNumEntriesInLocalRow(row);
183 template <
typename Scalar,
184 typename LocalOrdinal,
185 typename GlobalOrdinal,
189 AbstractConcreteMatrixAdapter<
190 Tpetra::RowMatrix<Scalar,
194 DerivedMat>::getGlobalColNNZ_impl(global_ordinal_t col)
const
196 TEUCHOS_TEST_FOR_EXCEPTION(
true,
198 "Column access to row-based object not yet supported. "
199 "Please contact the Amesos2 developers." );
202 template <
typename Scalar,
203 typename LocalOrdinal,
204 typename GlobalOrdinal,
208 AbstractConcreteMatrixAdapter<
209 Tpetra::RowMatrix<Scalar,
213 DerivedMat>::getLocalColNNZ_impl(local_ordinal_t col)
const
215 TEUCHOS_TEST_FOR_EXCEPTION(
true,
217 "Column access to row-based object not yet supported. "
218 "Please contact the Amesos2 developers." );
221 template <
typename Scalar,
222 typename LocalOrdinal,
223 typename GlobalOrdinal,
226 const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >
227 AbstractConcreteMatrixAdapter<
228 Tpetra::RowMatrix<Scalar,
232 DerivedMat>:: getMap_impl()
const
234 return this->mat_->getMap();
237 template <
typename Scalar,
238 typename LocalOrdinal,
239 typename GlobalOrdinal,
242 const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >
243 AbstractConcreteMatrixAdapter<
244 Tpetra::RowMatrix<Scalar,
248 DerivedMat>:: getRowMap_impl()
const
250 return this->mat_->getRowMap();
253 template <
typename Scalar,
254 typename LocalOrdinal,
255 typename GlobalOrdinal,
258 const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >
259 AbstractConcreteMatrixAdapter<
260 Tpetra::RowMatrix<Scalar,
264 DerivedMat>::getColMap_impl()
const
266 return this->mat_->getColMap();
269 template <
typename Scalar,
270 typename LocalOrdinal,
271 typename GlobalOrdinal,
274 const RCP<const Teuchos::Comm<int> >
275 AbstractConcreteMatrixAdapter<
276 Tpetra::RowMatrix<Scalar,
280 DerivedMat>::getComm_impl()
const
282 return this->mat_->getComm();
285 template <
typename Scalar,
286 typename LocalOrdinal,
287 typename GlobalOrdinal,
291 AbstractConcreteMatrixAdapter<
292 Tpetra::RowMatrix<Scalar,
296 DerivedMat>::isLocallyIndexed_impl()
const
298 return this->mat_->isLocallyIndexed();
301 template <
typename Scalar,
302 typename LocalOrdinal,
303 typename GlobalOrdinal,
307 AbstractConcreteMatrixAdapter<
308 Tpetra::RowMatrix<Scalar,
312 DerivedMat>::isGloballyIndexed_impl()
const
314 return this->mat_->isGloballyIndexed();
318 template <
typename Scalar,
typename LocalOrdinal,
typename GlobalOrdinal,
typename Node,
class DerivedMat>
319 RCP<const MatrixAdapter<DerivedMat> >
320 AbstractConcreteMatrixAdapter<
321 Tpetra::RowMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>, DerivedMat
322 >::get_impl(
const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > map,
EDistribution distribution)
const
326 return dynamic_cast<ConcreteMatrixAdapter<DerivedMat>*
>(
this)->get_impl(map, distribution);
328 return static_cast<ConcreteMatrixAdapter<DerivedMat>*
>(
this)->get_impl(map, distribution);
334 #endif // AMESOS2_TPETRAROWMATRIX_ABSTRACTMATRIXADAPTER_DEF_HPP
EDistribution
Definition: Amesos2_TypeDecl.hpp:89