10#ifndef TPETRA_ROWMATRIXTRANSPOSER_DEF_HPP
11#define TPETRA_ROWMATRIXTRANSPOSER_DEF_HPP
13#include "Tpetra_CrsMatrix.hpp"
14#include "Tpetra_BlockCrsMatrix.hpp"
15#include "Tpetra_Export.hpp"
18#include "Teuchos_ParameterList.hpp"
19#include "Teuchos_TimeMonitor.hpp"
20#include "KokkosSparse_Utils.hpp"
21#include "KokkosSparse_SortCrs.hpp"
31 const std::string& label)
32 : origMatrix_ (origMatrix), label_ (label)
39Teuchos::RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
47#ifdef HAVE_TPETRA_MMM_TIMINGS
48 const std::string
prefix = std::string (
"Tpetra ") + label_ +
": ";
49 using Teuchos::TimeMonitor;
64#ifdef HAVE_TPETRA_MMM_TIMINGS
68 const char paramName[] =
"compute global constants";
76 Teuchos::null, Teuchos::rcpFromRef (
labelList));
89Teuchos::RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
94 using Teuchos::ArrayRCP;
95 using Teuchos::ArrayView;
98 using Teuchos::rcp_dynamic_cast;
104#ifdef HAVE_TPETRA_MMM_TIMINGS
105 std::string
prefix = std::string(
"Tpetra ") + label_ +
": ";
106 using Teuchos::TimeMonitor;
110 const bool sort = [&] () {
117 const LO
lclNumRows (origMatrix_->getLocalNumRows ());
122 auto rowMap = origMatrix_->getRowMap ();
123 if (
rowMap->isOneToOne ()) {
128 auto colMap = origMatrix_->getColMap ();
136 crsMatrix_nc->fillComplete (origMatrix_->getDomainMap (),
137 origMatrix_->getRangeMap ());
154 const auto origExport = origMatrix_->getGraph ()->getExporter ();
157 const auto origImport = origMatrix_->getGraph ()->getImporter ();
168 origMatrix_->getColMap (),
169 origMatrix_->getRowMap (),
170 origMatrix_->getRangeMap (),
171 origMatrix_->getDomainMap (),
183 const std::string& label)
184 : origMatrix_ (origMatrix), label_ (label)
191Teuchos::RCP<BlockCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
199#ifdef HAVE_TPETRA_MMM_TIMINGS
200 const std::string
prefix = std::string (
"Tpetra ") + label_ +
": ";
201 using Teuchos::TimeMonitor;
216#ifdef HAVE_TPETRA_MMM_TIMINGS
220 const char paramName[] =
"compute global constants";
240Teuchos::RCP<BlockCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
244 using Teuchos::Array;
245 using Teuchos::ArrayRCP;
246 using Teuchos::ArrayView;
249 using Teuchos::rcp_dynamic_cast;
256#ifdef HAVE_TPETRA_MMM_TIMINGS
257 std::string
prefix = std::string(
"Tpetra ") + label_ +
": ";
258 using Teuchos::TimeMonitor;
268 using local_matrix_device_type =
typename bcrs_matrix_type::local_matrix_device_type;
270 typename local_matrix_device_type::values_type
values ;
283 const auto origExport = origMatrix_->getGraph ()->getExporter ();
286 const auto origImport = origMatrix_->getGraph ()->getImporter ();
294 origMatrix_->getColMap (),
295 origMatrix_->getRowMap (),
296 origMatrix_->getGraph()->getRangeMap (),
297 origMatrix_->getGraph()->getDomainMap (),
305 origMatrix_->getBlockSize()));
316#define TPETRA_ROWMATRIXTRANSPOSER_INSTANT(SCALAR,LO,GO,NODE) \
317 template class RowMatrixTransposer< SCALAR, LO , GO , NODE >;\
318 template class BlockCrsMatrixTransposer< SCALAR, LO , GO , NODE >;
Declare and define the functions Tpetra::Details::computeOffsetsFromCounts and Tpetra::computeOffsets...
Declaration and definition of functions for sorting "short" arrays of keys and corresponding values.
Teuchos::RCP< bcrs_matrix_type > createTransposeLocal(const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
Compute and return the transpose of the matrix given to the constructor.
BlockCrsMatrixTransposer(const Teuchos::RCP< const bcrs_matrix_type > &origMatrix, const std::string &label=std::string())
Constructor that takes the matrix to transpose.
Teuchos::RCP< bcrs_matrix_type > createTranspose(const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
Compute and return the transpose of the matrix given to the constructor.
Sparse matrix whose entries are small dense square blocks, all of the same dimensions.
Struct that holds views of the contents of a CrsMatrix.
Teuchos::RCP< const map_type > colMap
Col map for the original version of the matrix.
Teuchos::RCP< const map_type > rowMap
Desired row map for "imported" version of the matrix.
Sparse matrix that presents a row-oriented interface that lets users read or modify entries.
KokkosSparse::CrsMatrix< impl_scalar_type, local_ordinal_type, device_type, void, typename local_graph_device_type::size_type > local_matrix_device_type
The specialization of Kokkos::CrsMatrix that represents the part of the sparse matrix on each MPI pro...
Teuchos::RCP< crs_matrix_type > createTranspose(const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
Compute and return the transpose of the matrix given to the constructor.
Teuchos::RCP< crs_matrix_type > createTransposeLocal(const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
Compute and return the transpose of the matrix given to the constructor.
RowMatrixTransposer(const Teuchos::RCP< const crs_matrix_type > &origMatrix, const std::string &label=std::string())
Constructor that takes the matrix to transpose.
Namespace Tpetra contains the class and methods constituting the Tpetra library.
void sort(View &view, const size_t &size)
Convenience wrapper for std::sort for host-accessible views.
@ REPLACE
Replace existing values with new values.