42#ifndef TPETRA_ROWMATRIXTRANSPOSER_DEF_HPP
43#define TPETRA_ROWMATRIXTRANSPOSER_DEF_HPP
45#include "Tpetra_CrsMatrix.hpp"
46#include "Tpetra_BlockCrsMatrix.hpp"
47#include "Tpetra_Export.hpp"
50#include "Teuchos_ParameterList.hpp"
51#include "Teuchos_TimeMonitor.hpp"
52#include "KokkosSparse_Utils.hpp"
53#include "KokkosSparse_SortCrs.hpp"
63 const std::string& label)
64 : origMatrix_ (origMatrix), label_ (label)
71Teuchos::RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
79#ifdef HAVE_TPETRA_MMM_TIMINGS
80 const std::string
prefix = std::string (
"Tpetra ") + label_ +
": ";
81 using Teuchos::TimeMonitor;
96#ifdef HAVE_TPETRA_MMM_TIMINGS
100 const char paramName[] =
"compute global constants";
108 Teuchos::null, Teuchos::rcpFromRef (
labelList));
121Teuchos::RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
125 using Teuchos::Array;
126 using Teuchos::ArrayRCP;
127 using Teuchos::ArrayView;
130 using Teuchos::rcp_dynamic_cast;
136#ifdef HAVE_TPETRA_MMM_TIMINGS
137 std::string
prefix = std::string(
"Tpetra ") + label_ +
": ";
138 using Teuchos::TimeMonitor;
142 const bool sort = [&] () {
149 const LO
lclNumRows (origMatrix_->getLocalNumRows ());
154 auto rowMap = origMatrix_->getRowMap ();
155 if (
rowMap->isOneToOne ()) {
160 auto colMap = origMatrix_->getColMap ();
168 crsMatrix_nc->fillComplete (origMatrix_->getDomainMap (),
169 origMatrix_->getRangeMap ());
186 const auto origExport = origMatrix_->getGraph ()->getExporter ();
189 const auto origImport = origMatrix_->getGraph ()->getImporter ();
200 origMatrix_->getColMap (),
201 origMatrix_->getRowMap (),
202 origMatrix_->getRangeMap (),
203 origMatrix_->getDomainMap (),
215 const std::string& label)
216 : origMatrix_ (origMatrix), label_ (label)
223Teuchos::RCP<BlockCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
231#ifdef HAVE_TPETRA_MMM_TIMINGS
232 const std::string
prefix = std::string (
"Tpetra ") + label_ +
": ";
233 using Teuchos::TimeMonitor;
248#ifdef HAVE_TPETRA_MMM_TIMINGS
252 const char paramName[] =
"compute global constants";
272Teuchos::RCP<BlockCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
276 using Teuchos::Array;
277 using Teuchos::ArrayRCP;
278 using Teuchos::ArrayView;
281 using Teuchos::rcp_dynamic_cast;
288#ifdef HAVE_TPETRA_MMM_TIMINGS
289 std::string
prefix = std::string(
"Tpetra ") + label_ +
": ";
290 using Teuchos::TimeMonitor;
300 using local_matrix_device_type =
typename bcrs_matrix_type::local_matrix_device_type;
302 typename local_matrix_device_type::values_type
values ;
315 const auto origExport = origMatrix_->getGraph ()->getExporter ();
318 const auto origImport = origMatrix_->getGraph ()->getImporter ();
326 origMatrix_->getColMap (),
327 origMatrix_->getRowMap (),
328 origMatrix_->getGraph()->getRangeMap (),
329 origMatrix_->getGraph()->getDomainMap (),
337 origMatrix_->getBlockSize()));
348#define TPETRA_ROWMATRIXTRANSPOSER_INSTANT(SCALAR,LO,GO,NODE) \
349 template class RowMatrixTransposer< SCALAR, LO , GO , NODE >;\
350 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.