45 #ifndef AMESOS2_MATRIXADAPTER_DECL_HPP 46 #define AMESOS2_MATRIXADAPTER_DECL_HPP 48 #include "Amesos2_config.h" 50 #include <Teuchos_Comm.hpp> 51 #include <Teuchos_ArrayView.hpp> 52 #include <Teuchos_VerbosityLevel.hpp> 53 #include <Teuchos_FancyOStream.hpp> 55 #include <Tpetra_ConfigDefs.hpp> 59 #include "Amesos2_MatrixTraits.hpp" 63 template <
class M>
class ConcreteMatrixAdapter;
75 template <
class Matrix >
80 typedef typename MatrixTraits<Matrix>::scalar_t scalar_t;
81 typedef typename MatrixTraits<Matrix>::local_ordinal_t local_ordinal_t;
82 typedef typename MatrixTraits<Matrix>::global_ordinal_t global_ordinal_t;
83 typedef typename MatrixTraits<Matrix>::node_t node_t;
84 typedef Tpetra::global_size_t global_size_t;
86 typedef Matrix matrix_t;
88 typedef ConcreteMatrixAdapter<Matrix> adapter_t;
90 #ifdef TPETRA_ENABLE_DEPRECATED_CODE 91 typedef typename MatrixTraits<Matrix>::local_matrix_t local_matrix_t;
92 typedef typename MatrixTraits<Matrix>::sparse_ptr_type spmtx_ptr_t;
93 typedef typename MatrixTraits<Matrix>::sparse_idx_type spmtx_idx_t;
94 typedef typename MatrixTraits<Matrix>::sparse_values_type spmtx_vals_t;
97 typedef typename MatrixTraits<Matrix>::global_host_idx_type global_host_idx_t;
98 typedef typename MatrixTraits<Matrix>::global_host_val_type global_host_val_t;
139 #ifdef TPETRA_ENABLE_DEPRECATED_CODE 140 void getCrs(
const Teuchos::ArrayView<scalar_t> nzval,
141 const Teuchos::ArrayView<global_ordinal_t> colind,
142 const Teuchos::ArrayView<global_size_t> rowptr,
144 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
149 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
154 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
164 #ifdef TPETRA_ENABLE_DEPRECATED_CODE 165 void getCrs(
const Teuchos::ArrayView<scalar_t> nzval,
166 const Teuchos::ArrayView<global_ordinal_t> colind,
167 const Teuchos::ArrayView<global_size_t> rowptr,
173 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
209 #ifdef TPETRA_ENABLE_DEPRECATED_CODE 210 void getCcs(
const Teuchos::ArrayView<scalar_t> nzval,
211 const Teuchos::ArrayView<global_ordinal_t> rowind,
212 const Teuchos::ArrayView<global_size_t> colptr,
214 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > colmap,
219 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
224 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > colmap,
233 #ifdef TPETRA_ENABLE_DEPRECATED_CODE 234 void getCcs(
const Teuchos::ArrayView<scalar_t> nzval,
235 const Teuchos::ArrayView<global_ordinal_t> rowind,
236 const Teuchos::ArrayView<global_size_t> colptr,
242 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
252 const Teuchos::RCP<const Teuchos::Comm<int> >
getComm()
const 281 Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> >
283 return static_cast<const adapter_t*
>(
this)->getMap_impl();
286 Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> >
291 Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> >
296 Teuchos::RCP<const type>
get(
const Teuchos::Ptr<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > map,
EDistribution distribution =
ROOTED)
const;
302 void describe(Teuchos::FancyOStream &out,
303 const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default)
const;
305 #ifdef TPETRA_ENABLE_DEPRECATED_CODE 306 spmtx_ptr_t returnRowPtr()
const;
310 spmtx_idx_t returnColInd()
const;
313 spmtx_vals_t returnValues()
const;
317 template<
typename KV>
321 template<
typename KV>
325 template<
typename KV>
331 #ifdef TPETRA_ENABLE_DEPRECATED_CODE 332 void help_getCrs(
const Teuchos::ArrayView<scalar_t> nzval,
333 const Teuchos::ArrayView<global_ordinal_t> colind,
334 const Teuchos::ArrayView<global_size_t> rowptr,
336 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
339 has_special_impl hsi)
const;
341 void help_getCrs(
const Teuchos::ArrayView<scalar_t> nzval,
342 const Teuchos::ArrayView<global_ordinal_t> colind,
343 const Teuchos::ArrayView<global_size_t> rowptr,
345 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
348 no_special_impl nsi)
const;
351 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
352 void help_getCrs_kokkos_view(KV_S & nzval,
356 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
359 no_special_impl nsi)
const;
361 #ifdef TPETRA_ENABLE_DEPRECATED_CODE 362 void do_getCrs(
const Teuchos::ArrayView<scalar_t> nzval,
363 const Teuchos::ArrayView<global_ordinal_t> colind,
364 const Teuchos::ArrayView<global_size_t> rowptr,
366 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
369 row_access ra)
const;
371 void do_getCrs(
const Teuchos::ArrayView<scalar_t> nzval,
372 const Teuchos::ArrayView<global_ordinal_t> colind,
373 const Teuchos::ArrayView<global_size_t> rowptr,
375 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
378 col_access ca)
const;
381 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
382 void do_getCrs_kokkos_view(KV_S & nzval,
386 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
389 row_access ra)
const;
391 #ifdef TPETRA_ENABLE_DEPRECATED_CODE 392 void help_getCcs(
const Teuchos::ArrayView<scalar_t> nzval,
393 const Teuchos::ArrayView<global_ordinal_t> rowind,
394 const Teuchos::ArrayView<global_size_t> colptr,
396 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > colmap,
399 has_special_impl hsi)
const;
401 void help_getCcs(
const Teuchos::ArrayView<scalar_t> nzval,
402 const Teuchos::ArrayView<global_ordinal_t> rowind,
403 const Teuchos::ArrayView<global_size_t> colptr,
405 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > colmap,
408 no_special_impl nsi)
const;
411 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
412 void help_getCcs_kokkos_view(KV_S & nzval,
416 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
419 no_special_impl nsi)
const;
421 #ifdef TPETRA_ENABLE_DEPRECATED_CODE 422 void do_getCcs(
const Teuchos::ArrayView<scalar_t> nzval,
423 const Teuchos::ArrayView<global_ordinal_t> rowind,
424 const Teuchos::ArrayView<global_size_t> colptr,
426 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > colmap,
429 row_access ra)
const;
431 void do_getCcs(
const Teuchos::ArrayView<scalar_t> nzval,
432 const Teuchos::ArrayView<global_ordinal_t> rowind,
433 const Teuchos::ArrayView<global_size_t> colptr,
435 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > colmap,
438 col_access ca)
const;
441 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
442 void do_getCcs_kokkos_view(KV_S & nzval,
446 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
449 row_access ra)
const;
461 template<
typename KV_GO,
typename KV_S>
467 #ifdef TPETRA_ENABLE_DEPRECATED_CODE 468 void getGlobalRowCopy(global_ordinal_t row,
469 const Teuchos::ArrayView<global_ordinal_t>& indices,
470 const Teuchos::ArrayView<scalar_t>& vals,
480 #ifdef TPETRA_ENABLE_DEPRECATED_CODE 481 void getGlobalColCopy(global_ordinal_t col,
482 const Teuchos::ArrayView<global_ordinal_t>& indices,
483 const Teuchos::ArrayView<scalar_t>& vals,
489 size_t getMaxColNNZ()
const;
491 size_t getGlobalRowNNZ(global_ordinal_t row)
const;
493 size_t getLocalRowNNZ(local_ordinal_t row)
const;
495 size_t getGlobalColNNZ(global_ordinal_t col)
const;
497 size_t getLocalColNNZ(local_ordinal_t col)
const;
499 bool isLocallyIndexed()
const;
501 bool isGloballyIndexed()
const;
504 const Teuchos::RCP<const Matrix> mat_;
506 mutable Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > row_map_;
508 mutable Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > col_map_;
510 mutable Teuchos::RCP<const Teuchos::Comm<int> > comm_;
515 template <
class Matrix>
516 Teuchos::RCP<MatrixAdapter<Matrix> >
517 createMatrixAdapter(Teuchos::RCP<Matrix> m);
519 template <
class Matrix>
520 Teuchos::RCP<const MatrixAdapter<Matrix> >
521 createConstMatrixAdapter(Teuchos::RCP<const Matrix> m);
525 #endif // AMESOS2_MATRIXADAPTER_DECL_HPP global_size_t getGlobalNNZ() const
Get the global number of non-zeros in this sparse matrix.
Definition: Amesos2_MatrixAdapter_def.hpp:240
Definition: Amesos2_TypeDecl.hpp:143
Utility functions for Amesos2.
EStorage_Ordering
Definition: Amesos2_TypeDecl.hpp:141
global_size_t getColumnIndexBase() const
Get the indexbase for the column map.
Definition: Amesos2_MatrixAdapter_def.hpp:231
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Describes of this matrix adapter with some level of verbosity.
Definition: Amesos2_MatrixAdapter_def.hpp:279
size_t getMaxRowNNZ() const
Definition: Amesos2_MatrixAdapter_def.hpp:860
Definition: Amesos2_AbstractConcreteMatrixAdapter.hpp:48
size_t getLocalNumCols() const
Get the number of columns local to the calling process.
Definition: Amesos2_MatrixAdapter_def.hpp:254
size_t getLocalNumRows() const
Get the number of rows local to the calling process.
Definition: Amesos2_MatrixAdapter_def.hpp:247
const Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Returns the Teuchos::Comm object associated with this matrix.
Definition: Amesos2_MatrixAdapter_decl.hpp:252
void getCrs_kokkos_view(KV_S &nzval, KV_GO &colind, KV_GS &rowptr, global_size_t &nnz, const Teuchos::Ptr< const Tpetra::Map< local_ordinal_t, global_ordinal_t, node_t > > rowmap, EStorage_Ordering ordering=ARBITRARY, EDistribution distribution=ROOTED) const
Gets a compressed-row storage summary of this.
A Matrix adapter interface for Amesos2.
Definition: Amesos2_MatrixAdapter_decl.hpp:76
size_t getLocalNNZ() const
Get the local number of non-zeros on this processor.
Definition: Amesos2_MatrixAdapter_def.hpp:261
void returnColInd_kokkos_view(KV &view) const
Return kokkos view of CRS column indices of matrixA_.
Definition: Amesos2_MatrixAdapter_def.hpp:315
std::string description() const
Returns a short description of this Solver.
Definition: Amesos2_MatrixAdapter_def.hpp:269
global_size_t getGlobalNumRows() const
Get the number of rows in this matrix.
Definition: Amesos2_MatrixAdapter_def.hpp:208
void returnRowPtr_kokkos_view(KV &view) const
Return kokkos view of CRS row pointer of matrixA_.
Definition: Amesos2_MatrixAdapter_def.hpp:308
global_size_t getGlobalNumCols() const
Get the number of columns in this matrix.
Definition: Amesos2_MatrixAdapter_def.hpp:215
Definition: Amesos2_TypeDecl.hpp:127
EDistribution
Definition: Amesos2_TypeDecl.hpp:123
void getCcs_kokkos_view(KV_S &nzval, KV_GO &rowind, KV_GS &colptr, global_size_t &nnz, const Teuchos::Ptr< const Tpetra::Map< local_ordinal_t, global_ordinal_t, node_t > > colmap, EStorage_Ordering ordering=ARBITRARY, EDistribution distribution=ROOTED) const
Gets a compressed-column storage summary of this.
global_size_t getRowIndexBase() const
Get the indexbase for the row map.
Definition: Amesos2_MatrixAdapter_def.hpp:222
void getGlobalRowCopy_kokkos_view(global_ordinal_t row, KV_GO &indices, KV_S &vals, size_t &nnz) const
Definition: Amesos2_MatrixAdapter_def.hpp:828
void returnValues_kokkos_view(KV &view) const
Return kokkos view of CRS values of matrixA_.
Definition: Amesos2_MatrixAdapter_def.hpp:322