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>::global_host_idx_type global_host_idx_t;
91 typedef typename MatrixTraits<Matrix>::global_host_val_type global_host_val_t;
132 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
137 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
147 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
183 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
188 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > colmap,
197 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
207 const Teuchos::RCP<const Teuchos::Comm<int> >
getComm()
const
236 Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> >
238 return static_cast<const adapter_t*
>(
this)->getMap_impl();
241 Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> >
246 Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> >
251 Teuchos::RCP<const type>
get(
const Teuchos::Ptr<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > map,
EDistribution distribution = ROOTED)
const;
257 void describe(Teuchos::FancyOStream &out,
258 const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default)
const;
261 template<
typename KV>
265 template<
typename KV>
269 template<
typename KV>
274 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
275 void help_getCrs_kokkos_view(KV_S & nzval,
279 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
282 no_special_impl nsi)
const;
284 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
285 void do_getCrs_kokkos_view(KV_S & nzval,
289 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
292 row_access ra)
const;
294 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
295 void help_getCcs_kokkos_view(KV_S & nzval,
299 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
302 no_special_impl nsi)
const;
304 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
305 void do_getCcs_kokkos_view(KV_S & nzval,
309 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
312 row_access ra)
const;
324 template<
typename KV_GO,
typename KV_S>
330 size_t getMaxRowNNZ()
const;
332 size_t getMaxColNNZ()
const;
334 size_t getGlobalRowNNZ(global_ordinal_t row)
const;
336 size_t getLocalRowNNZ(local_ordinal_t row)
const;
338 size_t getGlobalColNNZ(global_ordinal_t col)
const;
340 size_t getLocalColNNZ(local_ordinal_t col)
const;
342 bool isLocallyIndexed()
const;
344 bool isGloballyIndexed()
const;
347 const Teuchos::RCP<const Matrix> mat_;
349 mutable Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > row_map_;
351 mutable Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > col_map_;
353 mutable Teuchos::RCP<const Teuchos::Comm<int> > comm_;
358 template <
class Matrix>
359 Teuchos::RCP<MatrixAdapter<Matrix> >
360 createMatrixAdapter(Teuchos::RCP<Matrix> m);
362 template <
class Matrix>
363 Teuchos::RCP<const MatrixAdapter<Matrix> >
364 createConstMatrixAdapter(Teuchos::RCP<const Matrix> m);
368 #endif // AMESOS2_MATRIXADAPTER_DECL_HPP
global_size_t getGlobalNumRows() const
Get the number of rows in this matrix.
Definition: Amesos2_MatrixAdapter_def.hpp:140
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.
const Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Returns the Teuchos::Comm object associated with this matrix.
Definition: Amesos2_MatrixAdapter_decl.hpp:207
void returnRowPtr_kokkos_view(KV &view) const
Return kokkos view of CRS row pointer of matrixA_.
Definition: Amesos2_MatrixAdapter_def.hpp:217
global_size_t getGlobalNNZ() const
Get the global number of non-zeros in this sparse matrix.
Definition: Amesos2_MatrixAdapter_def.hpp:172
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:211
size_t getLocalNumRows() const
Get the number of rows local to the calling process.
Definition: Amesos2_MatrixAdapter_def.hpp:179
void getGlobalRowCopy_kokkos_view(global_ordinal_t row, KV_GO &indices, KV_S &vals, size_t &nnz) const
Definition: Amesos2_MatrixAdapter_def.hpp:475
Utility functions for Amesos2.
EStorage_Ordering
Definition: Amesos2_TypeDecl.hpp:141
size_t getLocalNumCols() const
Get the number of columns local to the calling process.
Definition: Amesos2_MatrixAdapter_def.hpp:186
size_t getLocalNNZ() const
Get the local number of non-zeros on this processor.
Definition: Amesos2_MatrixAdapter_def.hpp:193
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.
std::string description() const
Returns a short description of this Solver.
Definition: Amesos2_MatrixAdapter_def.hpp:201
global_size_t getColumnIndexBase() const
Get the indexbase for the column map.
Definition: Amesos2_MatrixAdapter_def.hpp:163
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:147
void returnColInd_kokkos_view(KV &view) const
Return kokkos view of CRS column indices of matrixA_.
Definition: Amesos2_MatrixAdapter_def.hpp:224
global_size_t getRowIndexBase() const
Get the indexbase for the row map.
Definition: Amesos2_MatrixAdapter_def.hpp:154
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:231