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 typedef typename MatrixTraits<Matrix>::local_matrix_t local_matrix_t;
91 typedef typename MatrixTraits<Matrix>::sparse_ptr_type spmtx_ptr_t;
92 typedef typename MatrixTraits<Matrix>::sparse_idx_type spmtx_idx_t;
93 typedef typename MatrixTraits<Matrix>::sparse_values_type spmtx_vals_t;
134 void getCrs(
const Teuchos::ArrayView<scalar_t> nzval,
135 const Teuchos::ArrayView<global_ordinal_t> colind,
136 const Teuchos::ArrayView<global_size_t> rowptr,
138 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
142 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
143 void getCrs_kokkos_view(KV_S & nzval,
147 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
157 void getCrs(
const Teuchos::ArrayView<scalar_t> nzval,
158 const Teuchos::ArrayView<global_ordinal_t> colind,
159 const Teuchos::ArrayView<global_size_t> rowptr,
192 void getCcs(
const Teuchos::ArrayView<scalar_t> nzval,
193 const Teuchos::ArrayView<global_ordinal_t> rowind,
194 const Teuchos::ArrayView<global_size_t> colptr,
196 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > colmap,
200 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
201 void getCcs_kokkos_view(KV_S & nzval,
205 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > colmap,
214 void getCcs(
const Teuchos::ArrayView<scalar_t> nzval,
215 const Teuchos::ArrayView<global_ordinal_t> rowind,
216 const Teuchos::ArrayView<global_size_t> colptr,
223 const Teuchos::RCP<const Teuchos::Comm<int> >
getComm()
const
252 Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> >
254 return static_cast<const adapter_t*
>(
this)->getMap_impl();
257 Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> >
262 Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> >
267 Teuchos::RCP<const type>
get(
const Teuchos::Ptr<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > map,
EDistribution distribution = ROOTED)
const;
273 void describe(Teuchos::FancyOStream &out,
274 const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default)
const;
286 template<
typename KV>
290 template<
typename KV>
294 template<
typename KV>
300 void help_getCrs(
const Teuchos::ArrayView<scalar_t> nzval,
301 const Teuchos::ArrayView<global_ordinal_t> colind,
302 const Teuchos::ArrayView<global_size_t> rowptr,
304 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
307 has_special_impl hsi)
const;
309 void help_getCrs(
const Teuchos::ArrayView<scalar_t> nzval,
310 const Teuchos::ArrayView<global_ordinal_t> colind,
311 const Teuchos::ArrayView<global_size_t> rowptr,
313 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
316 no_special_impl nsi)
const;
318 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
319 void help_getCrs_kokkos_view(KV_S & nzval,
323 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
326 no_special_impl nsi)
const;
328 void do_getCrs(
const Teuchos::ArrayView<scalar_t> nzval,
329 const Teuchos::ArrayView<global_ordinal_t> colind,
330 const Teuchos::ArrayView<global_size_t> rowptr,
332 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
335 row_access ra)
const;
337 void do_getCrs(
const Teuchos::ArrayView<scalar_t> nzval,
338 const Teuchos::ArrayView<global_ordinal_t> colind,
339 const Teuchos::ArrayView<global_size_t> rowptr,
341 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
344 col_access ca)
const;
346 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
347 void do_getCrs_kokkos_view(KV_S & nzval,
351 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
354 row_access ra)
const;
356 void help_getCcs(
const Teuchos::ArrayView<scalar_t> nzval,
357 const Teuchos::ArrayView<global_ordinal_t> rowind,
358 const Teuchos::ArrayView<global_size_t> colptr,
360 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > colmap,
363 has_special_impl hsi)
const;
365 void help_getCcs(
const Teuchos::ArrayView<scalar_t> nzval,
366 const Teuchos::ArrayView<global_ordinal_t> rowind,
367 const Teuchos::ArrayView<global_size_t> colptr,
369 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > colmap,
372 no_special_impl nsi)
const;
374 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
375 void help_getCcs_kokkos_view(KV_S & nzval,
379 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
382 no_special_impl nsi)
const;
384 void do_getCcs(
const Teuchos::ArrayView<scalar_t> nzval,
385 const Teuchos::ArrayView<global_ordinal_t> rowind,
386 const Teuchos::ArrayView<global_size_t> colptr,
388 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > colmap,
391 row_access ra)
const;
393 void do_getCcs(
const Teuchos::ArrayView<scalar_t> nzval,
394 const Teuchos::ArrayView<global_ordinal_t> rowind,
395 const Teuchos::ArrayView<global_size_t> colptr,
397 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > colmap,
400 col_access ca)
const;
402 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
403 void do_getCcs_kokkos_view(KV_S & nzval,
407 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
410 row_access ra)
const;
423 const Teuchos::ArrayView<global_ordinal_t>& indices,
424 const Teuchos::ArrayView<scalar_t>& vals,
434 const Teuchos::ArrayView<global_ordinal_t>& indices,
435 const Teuchos::ArrayView<scalar_t>& vals,
438 size_t getMaxRowNNZ()
const;
440 size_t getMaxColNNZ()
const;
442 size_t getGlobalRowNNZ(global_ordinal_t row)
const;
444 size_t getLocalRowNNZ(local_ordinal_t row)
const;
446 size_t getGlobalColNNZ(global_ordinal_t col)
const;
448 size_t getLocalColNNZ(local_ordinal_t col)
const;
450 bool isLocallyIndexed()
const;
452 bool isGloballyIndexed()
const;
455 const Teuchos::RCP<const Matrix> mat_;
457 mutable Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > row_map_;
459 mutable Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > col_map_;
461 mutable Teuchos::RCP<const Teuchos::Comm<int> > comm_;
466 template <
class Matrix>
467 Teuchos::RCP<MatrixAdapter<Matrix> >
468 createMatrixAdapter(Teuchos::RCP<Matrix> m);
470 template <
class Matrix>
471 Teuchos::RCP<const MatrixAdapter<Matrix> >
472 createConstMatrixAdapter(Teuchos::RCP<const Matrix> m);
476 #endif // AMESOS2_MATRIXADAPTER_DECL_HPP
spmtx_vals_t returnValues() const
Return raw pointer from CRS values of matrixA_.
Definition: Amesos2_MatrixAdapter_def.hpp:252
global_size_t getGlobalNumRows() const
Get the number of rows in this matrix.
Definition: Amesos2_MatrixAdapter_def.hpp:161
const Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Returns the Teuchos::Comm object associated with this matrix.
Definition: Amesos2_MatrixAdapter_decl.hpp:223
void returnRowPtr_kokkos_view(KV &view) const
Return kokkos view of CRS row pointer of matrixA_.
Definition: Amesos2_MatrixAdapter_def.hpp:259
spmtx_ptr_t returnRowPtr() const
Return raw pointer from CRS row pointer of matrixA_.
Definition: Amesos2_MatrixAdapter_def.hpp:238
global_size_t getGlobalNNZ() const
Get the global number of non-zeros in this sparse matrix.
Definition: Amesos2_MatrixAdapter_def.hpp:193
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:232
size_t getLocalNumRows() const
Get the number of rows local to the calling process.
Definition: Amesos2_MatrixAdapter_def.hpp:200
void getCcs(const Teuchos::ArrayView< scalar_t > nzval, const Teuchos::ArrayView< global_ordinal_t > rowind, const Teuchos::ArrayView< global_size_t > 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.
void getCrs(const Teuchos::ArrayView< scalar_t > nzval, const Teuchos::ArrayView< global_ordinal_t > colind, const Teuchos::ArrayView< global_size_t > 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.
Utility functions for Amesos2.
EStorage_Ordering
Definition: Amesos2_TypeDecl.hpp:141
void getGlobalColCopy(global_ordinal_t col, const Teuchos::ArrayView< global_ordinal_t > &indices, const Teuchos::ArrayView< scalar_t > &vals, size_t &nnz) const
Definition: Amesos2_MatrixAdapter_def.hpp:725
size_t getLocalNumCols() const
Get the number of columns local to the calling process.
Definition: Amesos2_MatrixAdapter_def.hpp:207
spmtx_idx_t returnColInd() const
Return raw pointer from CRS column indices of matrixA_.
Definition: Amesos2_MatrixAdapter_def.hpp:245
size_t getLocalNNZ() const
Get the local number of non-zeros on this processor.
Definition: Amesos2_MatrixAdapter_def.hpp:214
std::string description() const
Returns a short description of this Solver.
Definition: Amesos2_MatrixAdapter_def.hpp:222
global_size_t getColumnIndexBase() const
Get the indexbase for the column map.
Definition: Amesos2_MatrixAdapter_def.hpp:184
A Matrix adapter interface for Amesos2.
Definition: Amesos2_MatrixAdapter_decl.hpp:76
global_size_t getGlobalNumCols() const
Get the number of columns in this matrix.
Definition: Amesos2_MatrixAdapter_def.hpp:168
void returnColInd_kokkos_view(KV &view) const
Return kokkos view of CRS column indices of matrixA_.
Definition: Amesos2_MatrixAdapter_def.hpp:266
void getGlobalRowCopy(global_ordinal_t row, const Teuchos::ArrayView< global_ordinal_t > &indices, const Teuchos::ArrayView< scalar_t > &vals, size_t &nnz) const
Definition: Amesos2_MatrixAdapter_def.hpp:715
global_size_t getRowIndexBase() const
Get the indexbase for the row map.
Definition: Amesos2_MatrixAdapter_def.hpp:175
EDistribution
Definition: Amesos2_TypeDecl.hpp:123
void returnValues_kokkos_view(KV &view) const
Return kokkos view of CRS values of matrixA_.
Definition: Amesos2_MatrixAdapter_def.hpp:273