11 #ifndef AMESOS2_MATRIXADAPTER_DECL_HPP
12 #define AMESOS2_MATRIXADAPTER_DECL_HPP
14 #include "Amesos2_config.h"
16 #include <Teuchos_Comm.hpp>
17 #include <Teuchos_ArrayView.hpp>
18 #include <Teuchos_VerbosityLevel.hpp>
19 #include <Teuchos_FancyOStream.hpp>
21 #include <Tpetra_ConfigDefs.hpp>
25 #include "Amesos2_MatrixTraits.hpp"
29 template <
class M>
class ConcreteMatrixAdapter;
41 template <
class Matrix >
46 typedef typename MatrixTraits<Matrix>::scalar_t scalar_t;
47 typedef typename MatrixTraits<Matrix>::local_ordinal_t local_ordinal_t;
48 typedef typename MatrixTraits<Matrix>::global_ordinal_t global_ordinal_t;
49 typedef typename MatrixTraits<Matrix>::node_t node_t;
50 typedef Tpetra::global_size_t global_size_t;
52 typedef Matrix matrix_t;
54 typedef ConcreteMatrixAdapter<Matrix> adapter_t;
56 typedef typename MatrixTraits<Matrix>::global_host_idx_type global_host_idx_t;
57 typedef typename MatrixTraits<Matrix>::global_host_val_type global_host_val_t;
98 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
103 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
113 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
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> > colmap,
163 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
173 const Teuchos::RCP<const Teuchos::Comm<int> >
getComm()
const
202 Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> >
204 return static_cast<const adapter_t*
>(
this)->getMap_impl();
207 Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> >
212 Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> >
217 Teuchos::RCP<const type>
get(
const Teuchos::Ptr<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > map,
EDistribution distribution = ROOTED)
const;
223 void describe(Teuchos::FancyOStream &out,
224 const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default)
const;
227 template<
typename KV>
231 template<
typename KV>
235 template<
typename KV>
240 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
241 void help_getCrs_kokkos_view(KV_S & nzval,
245 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
248 no_special_impl nsi)
const;
250 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
251 void do_getCrs_kokkos_view(KV_S & nzval,
255 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
258 row_access ra)
const;
260 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
261 void help_getCcs_kokkos_view(KV_S & nzval,
265 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
268 no_special_impl nsi)
const;
270 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
271 void do_getCcs_kokkos_view(KV_S & nzval,
275 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
278 row_access ra)
const;
290 template<
typename KV_GO,
typename KV_S>
296 size_t getMaxRowNNZ()
const;
298 size_t getMaxColNNZ()
const;
300 size_t getGlobalRowNNZ(global_ordinal_t row)
const;
302 size_t getLocalRowNNZ(local_ordinal_t row)
const;
304 size_t getGlobalColNNZ(global_ordinal_t col)
const;
306 size_t getLocalColNNZ(local_ordinal_t col)
const;
308 bool isLocallyIndexed()
const;
310 bool isGloballyIndexed()
const;
313 const Teuchos::RCP<const Matrix> mat_;
315 mutable Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > row_map_;
317 mutable Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > col_map_;
319 mutable Teuchos::RCP<const Teuchos::Comm<int> > comm_;
324 template <
class Matrix>
325 Teuchos::RCP<MatrixAdapter<Matrix> >
326 createMatrixAdapter(Teuchos::RCP<Matrix> m);
328 template <
class Matrix>
329 Teuchos::RCP<const MatrixAdapter<Matrix> >
330 createConstMatrixAdapter(Teuchos::RCP<const Matrix> m);
334 #endif // AMESOS2_MATRIXADAPTER_DECL_HPP
global_size_t getGlobalNumRows() const
Get the number of rows in this matrix.
Definition: Amesos2_MatrixAdapter_def.hpp:106
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:173
void returnRowPtr_kokkos_view(KV &view) const
Return kokkos view of CRS row pointer of matrixA_.
Definition: Amesos2_MatrixAdapter_def.hpp:183
global_size_t getGlobalNNZ() const
Get the global number of non-zeros in this sparse matrix.
Definition: Amesos2_MatrixAdapter_def.hpp:138
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:177
size_t getLocalNumRows() const
Get the number of rows local to the calling process.
Definition: Amesos2_MatrixAdapter_def.hpp:145
void getGlobalRowCopy_kokkos_view(global_ordinal_t row, KV_GO &indices, KV_S &vals, size_t &nnz) const
Definition: Amesos2_MatrixAdapter_def.hpp:441
Utility functions for Amesos2.
EStorage_Ordering
Definition: Amesos2_TypeDecl.hpp:107
size_t getLocalNumCols() const
Get the number of columns local to the calling process.
Definition: Amesos2_MatrixAdapter_def.hpp:152
size_t getLocalNNZ() const
Get the local number of non-zeros on this processor.
Definition: Amesos2_MatrixAdapter_def.hpp:159
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:167
global_size_t getColumnIndexBase() const
Get the indexbase for the column map.
Definition: Amesos2_MatrixAdapter_def.hpp:129
A Matrix adapter interface for Amesos2.
Definition: Amesos2_MatrixAdapter_decl.hpp:42
global_size_t getGlobalNumCols() const
Get the number of columns in this matrix.
Definition: Amesos2_MatrixAdapter_def.hpp:113
void returnColInd_kokkos_view(KV &view) const
Return kokkos view of CRS column indices of matrixA_.
Definition: Amesos2_MatrixAdapter_def.hpp:190
global_size_t getRowIndexBase() const
Get the indexbase for the row map.
Definition: Amesos2_MatrixAdapter_def.hpp:120
EDistribution
Definition: Amesos2_TypeDecl.hpp:89
void returnValues_kokkos_view(KV &view) const
Return kokkos view of CRS values of matrixA_.
Definition: Amesos2_MatrixAdapter_def.hpp:197