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"
25template <
class Scalar,
31 const std::string& label)
32 : origMatrix_(origMatrix)
39Teuchos::RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
46#ifdef HAVE_TPETRA_MMM_TIMINGS
47 const std::string
prefix = std::string(
"Tpetra ") + label_ +
": ";
48 using Teuchos::TimeMonitor;
62#ifdef HAVE_TPETRA_MMM_TIMINGS
66 const char paramName[] =
"compute global constants";
73 Teuchos::null, Teuchos::rcpFromRef(
labelList));
85Teuchos::RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
89 using Teuchos::ArrayRCP;
90 using Teuchos::ArrayView;
93 using Teuchos::rcp_dynamic_cast;
99#ifdef HAVE_TPETRA_MMM_TIMINGS
100 std::string
prefix = std::string(
"Tpetra ") + label_ +
": ";
101 using Teuchos::TimeMonitor;
105 const bool sort = [&]() {
111 const LO
lclNumRows(origMatrix_->getLocalNumRows());
116 auto rowMap = origMatrix_->getRowMap();
117 if (
rowMap->isOneToOne()) {
122 auto colMap = origMatrix_->getColMap();
131 origMatrix_->getRangeMap());
147 const auto origExport = origMatrix_->getGraph()->getExporter();
149 const auto origImport = origMatrix_->getGraph()->getImporter();
159 origMatrix_->getColMap(),
160 origMatrix_->getRowMap(),
161 origMatrix_->getRangeMap(),
162 origMatrix_->getDomainMap(),
174 const std::string& label)
175 : origMatrix_(origMatrix)
182Teuchos::RCP<BlockCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
189#ifdef HAVE_TPETRA_MMM_TIMINGS
190 const std::string
prefix = std::string(
"Tpetra ") + label_ +
": ";
191 using Teuchos::TimeMonitor;
205#ifdef HAVE_TPETRA_MMM_TIMINGS
209 const char paramName[] =
"compute global constants";
227Teuchos::RCP<BlockCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
230 using Teuchos::Array;
231 using Teuchos::ArrayRCP;
232 using Teuchos::ArrayView;
235 using Teuchos::rcp_dynamic_cast;
242#ifdef HAVE_TPETRA_MMM_TIMINGS
243 std::string
prefix = std::string(
"Tpetra ") + label_ +
": ";
244 using Teuchos::TimeMonitor;
254 using local_matrix_device_type =
typename bcrs_matrix_type::local_matrix_device_type;
256 typename local_matrix_device_type::values_type
values;
269 const auto origExport = origMatrix_->getGraph()->getExporter();
271 const auto origImport = origMatrix_->getGraph()->getImporter();
278 origMatrix_->getColMap(),
279 origMatrix_->getRowMap(),
280 origMatrix_->getGraph()->getRangeMap(),
281 origMatrix_->getGraph()->getDomainMap(),
289 origMatrix_->getBlockSize()));
299#define TPETRA_ROWMATRIXTRANSPOSER_INSTANT(SCALAR, LO, GO, NODE) \
300 template class RowMatrixTransposer<SCALAR, LO, GO, NODE>; \
301 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.