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;
55 typedef Tpetra::Map<local_ordinal_t, global_ordinal_t, node_t> map_t;
57 typedef typename MatrixTraits<Matrix>::global_host_idx_type global_host_idx_t;
58 typedef typename MatrixTraits<Matrix>::global_host_val_type global_host_val_t;
99 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
104 const Teuchos::Ptr<const map_t> rowmap,
114 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
150 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
155 const Teuchos::Ptr<const map_t> colmap,
164 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
174 const Teuchos::RCP<const Teuchos::Comm<int> >
getComm()
const
203 Teuchos::RCP<const map_t>
205 return static_cast<const adapter_t*
>(
this)->getMap_impl();
208 Teuchos::RCP<const map_t>
213 Teuchos::RCP<const map_t>
218 Teuchos::RCP<const type>
get(
const Teuchos::Ptr<const map_t> map,
EDistribution distribution = ROOTED)
const;
222 Teuchos::RCP<const type>
reindex(Teuchos::RCP<const map_t> &contigRowMap, Teuchos::RCP<const map_t> &contigColMap,
const EPhase current_phase)
const;
225 template<
typename KV_S,
typename KV_GO,
typename KV_GS,
typename host_ordinal_type_array,
typename host_scalar_type_array>
226 local_ordinal_t
gather(KV_S& nzvals, KV_GO& indices, KV_GS& pointers,
227 host_ordinal_type_array &recvCounts, host_ordinal_type_array &recvDispls,
228 host_ordinal_type_array &transpose_map, host_scalar_type_array &nzvals_t,
229 bool column_major,
EPhase current_phase)
const;
235 void describe(Teuchos::FancyOStream &out,
236 const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default)
const;
239 template<
typename KV>
243 template<
typename KV>
247 template<
typename KV>
252 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
253 void help_getCrs_kokkos_view(KV_S & nzval,
257 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
260 no_special_impl nsi)
const;
262 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
263 void do_getCrs_kokkos_view(KV_S & nzval,
267 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
270 row_access ra)
const;
272 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
273 void help_getCcs_kokkos_view(KV_S & nzval,
277 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
280 no_special_impl nsi)
const;
282 template<
typename KV_S,
typename KV_GO,
typename KV_GS>
283 void do_getCcs_kokkos_view(KV_S & nzval,
287 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
290 row_access ra)
const;
302 template<
typename KV_GO,
typename KV_S>
308 size_t getMaxRowNNZ()
const;
310 size_t getMaxColNNZ()
const;
312 size_t getGlobalRowNNZ(global_ordinal_t row)
const;
314 size_t getLocalRowNNZ(local_ordinal_t row)
const;
316 size_t getGlobalColNNZ(global_ordinal_t col)
const;
318 size_t getLocalColNNZ(local_ordinal_t col)
const;
320 bool isLocallyIndexed()
const;
322 bool isGloballyIndexed()
const;
325 const Teuchos::RCP<const Matrix> mat_;
327 mutable Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > row_map_;
329 mutable Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > col_map_;
331 mutable Teuchos::RCP<const Teuchos::Comm<int> > comm_;
336 template <
class Matrix>
337 Teuchos::RCP<MatrixAdapter<Matrix> >
338 createMatrixAdapter(Teuchos::RCP<Matrix> m);
340 template <
class Matrix>
341 Teuchos::RCP<const MatrixAdapter<Matrix> >
342 createConstMatrixAdapter(Teuchos::RCP<const Matrix> m);
346 #endif // AMESOS2_MATRIXADAPTER_DECL_HPP
global_size_t getGlobalNumRows() const
Get the number of rows in this matrix.
Definition: Amesos2_MatrixAdapter_def.hpp:106
const Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Returns the Teuchos::Comm object associated with this matrix.
Definition: Amesos2_MatrixAdapter_decl.hpp:174
void returnRowPtr_kokkos_view(KV &view) const
Return kokkos view of CRS row pointer of matrixA_.
Definition: Amesos2_MatrixAdapter_def.hpp:186
EPhase
Used to indicate a phase in the direct solution.
Definition: Amesos2_TypeDecl.hpp:31
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:444
local_ordinal_t gather(KV_S &nzvals, KV_GO &indices, KV_GS &pointers, host_ordinal_type_array &recvCounts, host_ordinal_type_array &recvDispls, host_ordinal_type_array &transpose_map, host_scalar_type_array &nzvals_t, bool column_major, EPhase current_phase) const
Gather matrix to MPI-0.
void getCcs_kokkos_view(KV_S &nzval, KV_GO &rowind, KV_GS &colptr, global_size_t &nnz, const Teuchos::Ptr< const map_t > colmap, EStorage_Ordering ordering=ARBITRARY, EDistribution distribution=ROOTED) const
Gets a compressed-column storage summary of this.
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
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:193
global_size_t getRowIndexBase() const
Get the indexbase for the row map.
Definition: Amesos2_MatrixAdapter_def.hpp:120
void getCrs_kokkos_view(KV_S &nzval, KV_GO &colind, KV_GS &rowptr, global_size_t &nnz, const Teuchos::Ptr< const map_t > rowmap, EStorage_Ordering ordering=ARBITRARY, EDistribution distribution=ROOTED) const
Gets a compressed-row storage summary of this.
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:200
Teuchos::RCP< const type > reindex(Teuchos::RCP< const map_t > &contigRowMap, Teuchos::RCP< const map_t > &contigColMap, const EPhase current_phase) const
Definition: Amesos2_MatrixAdapter_def.hpp:519