42 #ifndef TPETRA_ROWMATRIXTRANSPOSER_DEF_HPP
43 #define TPETRA_ROWMATRIXTRANSPOSER_DEF_HPP
45 #include "Tpetra_Export.hpp"
46 #include "Tpetra_Import.hpp"
47 #include "Tpetra_Map.hpp"
48 #include "Teuchos_DefaultSerialComm.hpp"
49 #ifdef DOXYGEN_USE_ONLY
55 template<
class Scalar,
62 : origMatrix_ (origMatrix) {}
64 template<
class Scalar,
72 : origMatrix_ (Teuchos::rcpFromRef (origMatrix)) {}
78 template<
class Scalar,
90 using Teuchos::parameterList;
95 typedef LocalOrdinal LO;
100 size_t numLocalCols = origMatrix_->getNodeNumCols();
101 size_t numLocalRows = origMatrix_->getNodeNumRows();
102 size_t numLocalNnz = origMatrix_->getNodeNumEntries();
117 for (
size_t i=0; i<numLocalRows; ++i) {
118 const size_t numEntriesInRow = origMatrix_->getNumEntriesInLocalRow(i);
119 origMatrix_->getLocalRowView(i, localIndices, localValues);
120 for (
size_t j=0; j<numEntriesInRow; ++j) {
121 ++CurrentStart[ localIndices[j] ];
129 for (
size_t i=1; i<numLocalCols+1; ++i) TransRowptr[i] = CurrentStart[i-1] + TransRowptr[i-1];
130 for (
size_t i=0; i<numLocalCols; ++i) CurrentStart[i] = TransRowptr[i];
133 for (
size_t i=0; i<numLocalRows; ++i) {
134 const size_t numEntriesInRow = origMatrix_->getNumEntriesInLocalRow(i);
135 origMatrix_->getLocalRowView(i, localIndices, localValues);
137 for (
size_t j=0; j<numEntriesInRow; ++j) {
138 size_t idx = CurrentStart[localIndices[j]];
139 TransColind[idx] = Teuchos::as<LO>(i);
140 TransValues[idx] = localValues[j];
141 ++CurrentStart[localIndices[j]];
148 transMatrixWithSharedRows->setAllValues(rowptr_rcp,colind_rcp,values_rcp);
155 if(!origMatrix_->getGraph()->getImporter().is_null())
157 if(!origMatrix_->getGraph()->getExporter().is_null())
161 transMatrixWithSharedRows->expertStaticFillComplete(origMatrix_->getRangeMap(),origMatrix_->getDomainMap(),myImport,myExport);
166 if(exporter == Teuchos::null) {
167 return transMatrixWithSharedRows;
171 return exportAndFillCompleteCrsMatrix<crs_matrix_type>(transMatrixWithSharedRows,*exporter);
180 #define TPETRA_ROWMATRIXTRANSPOSE_INSTANT(SCALAR,LO,GO,NODE) \
182 template class RowMatrixTransposer< SCALAR, LO , GO , NODE >;
Communication plan for data redistribution from a uniquely-owned to a (possibly) multiply-owned distr...
Teuchos::RCP< crs_matrix_type > createTranspose()
RowMatrixTransposer(const Teuchos::RCP< const crs_matrix_type > &origMatrix)
Constructor that takes the matrix to transpose.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Communication plan for data redistribution from a (possibly) multiply-owned to a uniquely-owned distr...