45 #ifndef AMESOS2_TPETRAROWMATRIX_ABSTRACTMATRIXADAPTER_DEF_HPP
46 #define AMESOS2_TPETRAROWMATRIX_ABSTRACTMATRIXADAPTER_DEF_HPP
48 #include "Amesos2_ConcreteMatrixAdapter_decl.hpp"
49 #include "Amesos2_TpetraRowMatrix_AbstractMatrixAdapter_decl.hpp"
54 using Teuchos::ArrayView;
56 template <
typename Scalar,
57 typename LocalOrdinal,
58 typename GlobalOrdinal,
61 AbstractConcreteMatrixAdapter<
62 Tpetra::RowMatrix<Scalar,
66 DerivedMat>::AbstractConcreteMatrixAdapter(RCP<Tpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> > m)
67 : MatrixAdapter<DerivedMat>(Teuchos::rcp_static_cast<DerivedMat>(m))
73 template <
typename Scalar,
74 typename LocalOrdinal,
75 typename GlobalOrdinal,
79 AbstractConcreteMatrixAdapter<
80 Tpetra::RowMatrix<Scalar,
84 DerivedMat>::getGlobalRowCopy_impl(global_ordinal_t row,
85 const ArrayView<global_ordinal_t>& indices,
86 const ArrayView<scalar_t>& vals,
89 this->mat_->getGlobalRowCopy(row, indices, vals, nnz);
92 template <
typename Scalar,
93 typename LocalOrdinal,
94 typename GlobalOrdinal,
98 AbstractConcreteMatrixAdapter<
99 Tpetra::RowMatrix<Scalar,
103 DerivedMat>::getGlobalColCopy_impl(global_ordinal_t col,
104 const ArrayView<global_ordinal_t>& indices,
105 const ArrayView<scalar_t>& vals,
108 TEUCHOS_TEST_FOR_EXCEPTION(
true,
110 "Column access to row-based object not yet supported. "
111 "Please contact the Amesos2 developers." );
115 template <
typename Scalar,
116 typename LocalOrdinal,
117 typename GlobalOrdinal,
120 typename AbstractConcreteMatrixAdapter<
121 Tpetra::RowMatrix<Scalar,
125 DerivedMat>::global_size_t
126 AbstractConcreteMatrixAdapter<
127 Tpetra::RowMatrix<Scalar,
131 DerivedMat>::getGlobalNNZ_impl()
const
133 return this->mat_->getGlobalNumEntries();
136 template <
typename Scalar,
typename LocalOrdinal,
typename GlobalOrdinal,
typename Node,
class DerivedMat>
138 AbstractConcreteMatrixAdapter<
139 Tpetra::RowMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>,
140 DerivedMat>::getLocalNNZ_impl()
const
142 return this->mat_->getNodeNumEntries();
145 template <
typename Scalar,
typename LocalOrdinal,
typename GlobalOrdinal,
typename Node,
class DerivedMat>
146 typename AbstractConcreteMatrixAdapter<
147 Tpetra::RowMatrix<Scalar,
151 DerivedMat>::global_size_t
152 AbstractConcreteMatrixAdapter<
153 Tpetra::RowMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>,
154 DerivedMat>::getGlobalNumRows_impl()
const
156 return this->mat_->getGlobalNumRows();
159 template <
typename Scalar,
typename LocalOrdinal,
typename GlobalOrdinal,
typename Node,
class DerivedMat>
160 typename AbstractConcreteMatrixAdapter<
161 Tpetra::RowMatrix<Scalar,
165 DerivedMat>::global_size_t
166 AbstractConcreteMatrixAdapter<
167 Tpetra::RowMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>,
168 DerivedMat>::getGlobalNumCols_impl()
const
170 return this->mat_->getGlobalNumCols();
173 template <
typename Scalar,
174 typename LocalOrdinal,
175 typename GlobalOrdinal,
179 AbstractConcreteMatrixAdapter<
180 Tpetra::RowMatrix<Scalar,
184 DerivedMat>::getMaxRowNNZ_impl()
const
186 return this->mat_->getGlobalMaxNumRowEntries();
189 template <
typename Scalar,
190 typename LocalOrdinal,
191 typename GlobalOrdinal,
195 AbstractConcreteMatrixAdapter<
196 Tpetra::RowMatrix<Scalar,
200 DerivedMat>::getMaxColNNZ_impl()
const
202 TEUCHOS_TEST_FOR_EXCEPTION(
true,
204 "Column access to row-based object not yet supported. "
205 "Please contact the Amesos2 developers." );
208 template <
typename Scalar,
209 typename LocalOrdinal,
210 typename GlobalOrdinal,
214 AbstractConcreteMatrixAdapter<
215 Tpetra::RowMatrix<Scalar,
219 DerivedMat>::getGlobalRowNNZ_impl(global_ordinal_t row)
const
221 return this->mat_->getNumEntriesInGlobalRow(row);
225 template <
typename Scalar,
226 typename LocalOrdinal,
227 typename GlobalOrdinal,
231 AbstractConcreteMatrixAdapter<
232 Tpetra::RowMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>, DerivedMat>
233 ::super_t::spmtx_ptr_t
234 AbstractConcreteMatrixAdapter<
235 Tpetra::RowMatrix<Scalar,
239 DerivedMat>::getSparseRowPtr()
const
241 typename super_t::local_matrix_t lm = this->mat_->getLocalMatrix();
242 return lm.graph.row_map.data();
245 template <
typename Scalar,
246 typename LocalOrdinal,
247 typename GlobalOrdinal,
251 AbstractConcreteMatrixAdapter<
252 Tpetra::RowMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>, DerivedMat>
253 ::super_t::spmtx_idx_t
254 AbstractConcreteMatrixAdapter<
255 Tpetra::RowMatrix<Scalar,
259 DerivedMat>::getSparseColInd()
const
261 typename super_t::local_matrix_t lm = this->mat_->getLocalMatrix();
262 return lm.graph.entries.data();
265 template <
typename Scalar,
266 typename LocalOrdinal,
267 typename GlobalOrdinal,
271 AbstractConcreteMatrixAdapter<
272 Tpetra::RowMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>, DerivedMat>
273 ::super_t::spmtx_vals_t
274 AbstractConcreteMatrixAdapter<
275 Tpetra::RowMatrix<Scalar,
279 DerivedMat>::getSparseValues()
const
281 typename super_t::local_matrix_t lm = this->mat_->getLocalMatrix();
282 return lm.values.data();
286 template <
typename Scalar,
287 typename LocalOrdinal,
288 typename GlobalOrdinal,
292 AbstractConcreteMatrixAdapter<
293 Tpetra::RowMatrix<Scalar,
297 DerivedMat>::getLocalRowNNZ_impl(local_ordinal_t row)
const
299 return this->mat_->getNumEntriesInLocalRow(row);
302 template <
typename Scalar,
303 typename LocalOrdinal,
304 typename GlobalOrdinal,
308 AbstractConcreteMatrixAdapter<
309 Tpetra::RowMatrix<Scalar,
313 DerivedMat>::getGlobalColNNZ_impl(global_ordinal_t col)
const
315 TEUCHOS_TEST_FOR_EXCEPTION(
true,
317 "Column access to row-based object not yet supported. "
318 "Please contact the Amesos2 developers." );
321 template <
typename Scalar,
322 typename LocalOrdinal,
323 typename GlobalOrdinal,
327 AbstractConcreteMatrixAdapter<
328 Tpetra::RowMatrix<Scalar,
332 DerivedMat>::getLocalColNNZ_impl(local_ordinal_t col)
const
334 TEUCHOS_TEST_FOR_EXCEPTION(
true,
336 "Column access to row-based object not yet supported. "
337 "Please contact the Amesos2 developers." );
340 template <
typename Scalar,
341 typename LocalOrdinal,
342 typename GlobalOrdinal,
345 const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >
346 AbstractConcreteMatrixAdapter<
347 Tpetra::RowMatrix<Scalar,
351 DerivedMat>:: getMap_impl()
const
353 return this->mat_->getMap();
356 template <
typename Scalar,
357 typename LocalOrdinal,
358 typename GlobalOrdinal,
361 const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >
362 AbstractConcreteMatrixAdapter<
363 Tpetra::RowMatrix<Scalar,
367 DerivedMat>:: getRowMap_impl()
const
369 return this->mat_->getRowMap();
372 template <
typename Scalar,
373 typename LocalOrdinal,
374 typename GlobalOrdinal,
377 const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >
378 AbstractConcreteMatrixAdapter<
379 Tpetra::RowMatrix<Scalar,
383 DerivedMat>::getColMap_impl()
const
385 return this->mat_->getColMap();
388 template <
typename Scalar,
389 typename LocalOrdinal,
390 typename GlobalOrdinal,
393 const RCP<const Teuchos::Comm<int> >
394 AbstractConcreteMatrixAdapter<
395 Tpetra::RowMatrix<Scalar,
399 DerivedMat>::getComm_impl()
const
401 return this->mat_->getComm();
404 template <
typename Scalar,
405 typename LocalOrdinal,
406 typename GlobalOrdinal,
410 AbstractConcreteMatrixAdapter<
411 Tpetra::RowMatrix<Scalar,
415 DerivedMat>::isLocallyIndexed_impl()
const
417 return this->mat_->isLocallyIndexed();
420 template <
typename Scalar,
421 typename LocalOrdinal,
422 typename GlobalOrdinal,
426 AbstractConcreteMatrixAdapter<
427 Tpetra::RowMatrix<Scalar,
431 DerivedMat>::isGloballyIndexed_impl()
const
433 return this->mat_->isGloballyIndexed();
437 template <
typename Scalar,
typename LocalOrdinal,
typename GlobalOrdinal,
typename Node,
class DerivedMat>
438 RCP<const MatrixAdapter<DerivedMat> >
439 AbstractConcreteMatrixAdapter<
440 Tpetra::RowMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>, DerivedMat
441 >::get_impl(
const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > map,
EDistribution distribution)
const
445 return dynamic_cast<ConcreteMatrixAdapter<DerivedMat>*
>(
this)->get_impl(map, distribution);
447 return static_cast<ConcreteMatrixAdapter<DerivedMat>*
>(
this)->get_impl(map, distribution);
453 #endif // AMESOS2_TPETRAROWMATRIX_ABSTRACTMATRIXADAPTER_DEF_HPP
EDistribution
Definition: Amesos2_TypeDecl.hpp:123