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"
19#include "Teuchos_ParameterList.hpp"
20#include "Teuchos_TimeMonitor.hpp"
21#include "KokkosSparse_Utils.hpp"
25template <
class Scalar,
31 const std::string& label)
32 : origMatrix_(origMatrix) {}
38Teuchos::RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
58 const char paramName[] =
"compute global constants";
65 Teuchos::null, Teuchos::rcpFromRef(
labelList));
77Teuchos::RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
81 using Teuchos::ArrayRCP;
82 using Teuchos::ArrayView;
85 using Teuchos::rcp_dynamic_cast;
93 const bool sort = [&]() {
99 const LO
lclNumRows(origMatrix_->getLocalNumRows());
104 auto rowMap = origMatrix_->getRowMap();
105 if (
rowMap->isOneToOne()) {
110 auto colMap = origMatrix_->getColMap();
119 origMatrix_->getRangeMap());
128#if KOKKOSKERNELS_VERSION >= 50199
139#if KOKKOSKERNELS_VERSION >= 50199
150 const auto origExport = origMatrix_->getGraph()->getExporter();
152 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) {}
190Teuchos::RCP<BlockCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
210 const char paramName[] =
"compute global constants";
228Teuchos::RCP<BlockCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
231 using Teuchos::Array;
232 using Teuchos::ArrayRCP;
233 using Teuchos::ArrayView;
236 using Teuchos::rcp_dynamic_cast;
251 using local_matrix_device_type =
typename bcrs_matrix_type::local_matrix_device_type;
253 typename local_matrix_device_type::values_type
values;
266 const auto origExport = origMatrix_->getGraph()->getExporter();
268 const auto origImport = origMatrix_->getGraph()->getImporter();
275 origMatrix_->getColMap(),
276 origMatrix_->getRowMap(),
277 origMatrix_->getGraph()->getRangeMap(),
278 origMatrix_->getGraph()->getDomainMap(),
286 origMatrix_->getBlockSize()));
296#define TPETRA_ROWMATRIXTRANSPOSER_INSTANT(SCALAR, LO, GO, NODE) \
297 template class RowMatrixTransposer<SCALAR, LO, GO, NODE>; \
298 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.
Utility functions for packing and unpacking sparse matrix entries.
Sparse matrix whose entries are small dense square blocks, all of the same dimensions.
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 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...
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.
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.