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) {}
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());
135 const auto origExport = origMatrix_->getGraph()->getExporter();
137 const auto origImport = origMatrix_->getGraph()->getImporter();
153 origMatrix_->getColMap(),
154 origMatrix_->getRowMap(),
155 origMatrix_->getRangeMap(),
156 origMatrix_->getDomainMap(),
168 const std::string& label)
169 : origMatrix_(origMatrix) {}
175Teuchos::RCP<BlockCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
195 const char paramName[] =
"compute global constants";
213Teuchos::RCP<BlockCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
216 using Teuchos::Array;
217 using Teuchos::ArrayRCP;
218 using Teuchos::ArrayView;
221 using Teuchos::rcp_dynamic_cast;
236 using local_matrix_device_type =
typename bcrs_matrix_type::local_matrix_device_type;
238 typename local_matrix_device_type::values_type
values;
251 const auto origExport = origMatrix_->getGraph()->getExporter();
253 const auto origImport = origMatrix_->getGraph()->getImporter();
260 origMatrix_->getColMap(),
261 origMatrix_->getRowMap(),
262 origMatrix_->getGraph()->getRangeMap(),
263 origMatrix_->getGraph()->getDomainMap(),
271 origMatrix_->getBlockSize()));
281#define TPETRA_ROWMATRIXTRANSPOSER_INSTANT(SCALAR, LO, GO, NODE) \
282 template class RowMatrixTransposer<SCALAR, LO, GO, NODE>; \
283 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.
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.