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,
147 void getCrs(
const Teuchos::ArrayView<scalar_t> nzval,
148 const Teuchos::ArrayView<global_ordinal_t> colind,
149 const Teuchos::ArrayView<global_size_t> rowptr,
182 void getCcs(
const Teuchos::ArrayView<scalar_t> nzval,
183 const Teuchos::ArrayView<global_ordinal_t> rowind,
184 const Teuchos::ArrayView<global_size_t> colptr,
186 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > colmap,
195 void getCcs(
const Teuchos::ArrayView<scalar_t> nzval,
196 const Teuchos::ArrayView<global_ordinal_t> rowind,
197 const Teuchos::ArrayView<global_size_t> colptr,
204 const Teuchos::RCP<const Teuchos::Comm<int> >
getComm()
const
233 Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> >
235 return static_cast<const adapter_t*
>(
this)->getMap_impl();
238 Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> >
243 Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> >
248 Teuchos::RCP<const type>
get(
const Teuchos::Ptr<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > map,
EDistribution distribution = ROOTED)
const;
254 void describe(Teuchos::FancyOStream &out,
255 const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default)
const;
268 void help_getCrs(
const Teuchos::ArrayView<scalar_t> nzval,
269 const Teuchos::ArrayView<global_ordinal_t> colind,
270 const Teuchos::ArrayView<global_size_t> rowptr,
272 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
275 has_special_impl hsi)
const;
277 void help_getCrs(
const Teuchos::ArrayView<scalar_t> nzval,
278 const Teuchos::ArrayView<global_ordinal_t> colind,
279 const Teuchos::ArrayView<global_size_t> rowptr,
281 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
284 no_special_impl nsi)
const;
286 void do_getCrs(
const Teuchos::ArrayView<scalar_t> nzval,
287 const Teuchos::ArrayView<global_ordinal_t> colind,
288 const Teuchos::ArrayView<global_size_t> rowptr,
290 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
293 row_access ra)
const;
295 void do_getCrs(
const Teuchos::ArrayView<scalar_t> nzval,
296 const Teuchos::ArrayView<global_ordinal_t> colind,
297 const Teuchos::ArrayView<global_size_t> rowptr,
299 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
302 col_access ca)
const;
304 void help_getCcs(
const Teuchos::ArrayView<scalar_t> nzval,
305 const Teuchos::ArrayView<global_ordinal_t> rowind,
306 const Teuchos::ArrayView<global_size_t> colptr,
308 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > colmap,
311 has_special_impl hsi)
const;
313 void help_getCcs(
const Teuchos::ArrayView<scalar_t> nzval,
314 const Teuchos::ArrayView<global_ordinal_t> rowind,
315 const Teuchos::ArrayView<global_size_t> colptr,
317 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > colmap,
320 no_special_impl nsi)
const;
322 void do_getCcs(
const Teuchos::ArrayView<scalar_t> nzval,
323 const Teuchos::ArrayView<global_ordinal_t> rowind,
324 const Teuchos::ArrayView<global_size_t> colptr,
326 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > colmap,
329 row_access ra)
const;
331 void do_getCcs(
const Teuchos::ArrayView<scalar_t> nzval,
332 const Teuchos::ArrayView<global_ordinal_t> rowind,
333 const Teuchos::ArrayView<global_size_t> colptr,
335 const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > colmap,
338 col_access ca)
const;
351 const Teuchos::ArrayView<global_ordinal_t>& indices,
352 const Teuchos::ArrayView<scalar_t>& vals,
362 const Teuchos::ArrayView<global_ordinal_t>& indices,
363 const Teuchos::ArrayView<scalar_t>& vals,
366 size_t getMaxRowNNZ()
const;
368 size_t getMaxColNNZ()
const;
370 size_t getGlobalRowNNZ(global_ordinal_t row)
const;
372 size_t getLocalRowNNZ(local_ordinal_t row)
const;
374 size_t getGlobalColNNZ(global_ordinal_t col)
const;
376 size_t getLocalColNNZ(local_ordinal_t col)
const;
378 bool isLocallyIndexed()
const;
380 bool isGloballyIndexed()
const;
383 const Teuchos::RCP<const Matrix> mat_;
385 mutable Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > row_map_;
387 mutable Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > col_map_;
389 mutable Teuchos::RCP<const Teuchos::Comm<int> > comm_;
394 template <
class Matrix>
395 Teuchos::RCP<MatrixAdapter<Matrix> >
396 createMatrixAdapter(Teuchos::RCP<Matrix> m);
398 template <
class Matrix>
399 Teuchos::RCP<const MatrixAdapter<Matrix> >
400 createConstMatrixAdapter(Teuchos::RCP<const Matrix> m);
404 #endif // AMESOS2_MATRIXADAPTER_DECL_HPP
spmtx_vals_t returnValues() const
Return raw pointer from CRS values of matrixA_.
Definition: Amesos2_MatrixAdapter_def.hpp:216
global_size_t getGlobalNumRows() const
Get the number of rows in this matrix.
Definition: Amesos2_MatrixAdapter_def.hpp:129
const Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Returns the Teuchos::Comm object associated with this matrix.
Definition: Amesos2_MatrixAdapter_decl.hpp:204
spmtx_ptr_t returnRowPtr() const
Return raw pointer from CRS row pointer of matrixA_.
Definition: Amesos2_MatrixAdapter_def.hpp:202
global_size_t getGlobalNNZ() const
Get the global number of non-zeros in this sparse matrix.
Definition: Amesos2_MatrixAdapter_def.hpp:157
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:196
size_t getLocalNumRows() const
Get the number of rows local to the calling process.
Definition: Amesos2_MatrixAdapter_def.hpp:164
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:488
size_t getLocalNumCols() const
Get the number of columns local to the calling process.
Definition: Amesos2_MatrixAdapter_def.hpp:171
spmtx_idx_t returnColInd() const
Return raw pointer from CRS column indices of matrixA_.
Definition: Amesos2_MatrixAdapter_def.hpp:209
size_t getLocalNNZ() const
Get the local number of non-zeros on this processor.
Definition: Amesos2_MatrixAdapter_def.hpp:178
std::string description() const
Returns a short description of this Solver.
Definition: Amesos2_MatrixAdapter_def.hpp:186
global_size_t getColumnIndexBase() const
Get the indexbase for the column map.
Definition: Amesos2_MatrixAdapter_def.hpp:150
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:136
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:478
global_size_t getRowIndexBase() const
Get the indexbase for the row map.
Definition: Amesos2_MatrixAdapter_def.hpp:143
EDistribution
Definition: Amesos2_TypeDecl.hpp:123