43 #ifndef IFPACK2_OVERLAPPINGROWMATRIX_DEF_HPP 44 #define IFPACK2_OVERLAPPINGROWMATRIX_DEF_HPP 48 #include <Ifpack2_Details_OverlappingRowGraph.hpp> 49 #include <Tpetra_CrsMatrix.hpp> 50 #include <Tpetra_Import.hpp> 51 #include "Tpetra_Map.hpp" 52 #include <Teuchos_CommHelpers.hpp> 56 template<
class MatrixType>
59 const int overlapLevel) :
60 A_ (
Teuchos::rcp_dynamic_cast<const crs_matrix_type> (A, true)),
61 OverlapLevel_ (overlapLevel)
66 using Teuchos::outArg;
67 using Teuchos::REDUCE_SUM;
68 using Teuchos::reduceAll;
69 typedef Tpetra::global_size_t GST;
70 typedef Tpetra::CrsGraph<local_ordinal_type,
71 global_ordinal_type, node_type> crs_graph_type;
72 TEUCHOS_TEST_FOR_EXCEPTION(
73 OverlapLevel_ <= 0, std::runtime_error,
74 "Ifpack2::OverlappingRowMatrix: OverlapLevel must be > 0.");
75 TEUCHOS_TEST_FOR_EXCEPTION
76 (A_.is_null (), std::runtime_error,
77 "Ifpack2::OverlappingRowMatrix: The input matrix must be a " 78 "Tpetra::CrsMatrix with the same scalar_type, local_ordinal_type, " 79 "global_ordinal_type, and device_type typedefs as MatrixType.");
80 TEUCHOS_TEST_FOR_EXCEPTION(
81 A_->getComm()->getSize() == 1, std::runtime_error,
82 "Ifpack2::OverlappingRowMatrix: Matrix must be " 83 "distributed over more than one MPI process.");
85 RCP<const crs_graph_type> A_crsGraph = A_->getCrsGraph ();
86 const size_t numMyRowsA = A_->getNodeNumRows ();
87 const global_ordinal_type global_invalid =
88 Teuchos::OrdinalTraits<global_ordinal_type>::invalid ();
91 Array<global_ordinal_type> ExtElements;
93 RCP<crs_graph_type> TmpGraph;
94 RCP<import_type> TmpImporter;
95 RCP<const map_type> RowMap, ColMap;
96 ExtHaloStarts_.resize(OverlapLevel_+1);
99 for (
int overlap = 0 ; overlap < OverlapLevel_ ; ++overlap) {
100 ExtHaloStarts_[overlap] = (size_t) ExtElements.size();
104 RowMap = A_->getRowMap ();
105 ColMap = A_->getColMap ();
108 RowMap = TmpGraph->getRowMap ();
109 ColMap = TmpGraph->getColMap ();
112 const size_t size = ColMap->getNodeNumElements () - RowMap->getNodeNumElements ();
113 Array<global_ordinal_type> mylist (size);
117 for (local_ordinal_type i = 0 ; (size_t) i < ColMap->getNodeNumElements() ; ++i) {
118 const global_ordinal_type GID = ColMap->getGlobalElement (i);
119 if (A_->getRowMap ()->getLocalElement (GID) == global_invalid) {
120 typedef typename Array<global_ordinal_type>::iterator iter_type;
121 const iter_type end = ExtElements.end ();
122 const iter_type pos = std::find (ExtElements.begin (), end, GID);
124 ExtElements.push_back (GID);
134 if (overlap + 1 < OverlapLevel_) {
141 TmpMap = rcp (
new map_type (global_invalid, mylist (0, count),
142 Teuchos::OrdinalTraits<global_ordinal_type>::zero (),
144 TmpGraph = rcp (
new crs_graph_type (TmpMap, 0));
145 TmpImporter = rcp (
new import_type (A_->getRowMap (), TmpMap));
147 TmpGraph->doImport (*A_crsGraph, *TmpImporter, Tpetra::INSERT);
148 TmpGraph->fillComplete (A_->getDomainMap (), TmpMap);
151 ExtHaloStarts_[OverlapLevel_] = (size_t) ExtElements.size();
156 Array<global_ordinal_type> mylist (numMyRowsA + ExtElements.size ());
157 for (local_ordinal_type i = 0; (size_t)i < numMyRowsA; ++i) {
158 mylist[i] = A_->getRowMap ()->getGlobalElement (i);
160 for (local_ordinal_type i = 0; i < ExtElements.size (); ++i) {
161 mylist[i + numMyRowsA] = ExtElements[i];
164 RowMap_ = rcp (
new map_type (global_invalid, mylist (),
165 Teuchos::OrdinalTraits<global_ordinal_type>::zero (),
167 Importer_ = rcp (
new import_type (A_->getRowMap (), RowMap_));
172 ExtMap_ = rcp (
new map_type (global_invalid, ExtElements (),
173 Teuchos::OrdinalTraits<global_ordinal_type>::zero (),
175 ExtImporter_ = rcp (
new import_type (A_->getRowMap (), ExtMap_));
178 RCP<crs_matrix_type> ExtMatrix_nc =
179 rcp (
new crs_matrix_type (ExtMap_, ColMap_, 0));
180 ExtMatrix_nc->doImport (*A_, *ExtImporter_, Tpetra::INSERT);
181 ExtMatrix_nc->fillComplete (A_->getDomainMap (), RowMap_);
182 ExtMatrix_ = ExtMatrix_nc;
186 const size_t numMyRowsB = ExtMatrix_->getNodeNumRows ();
188 GST NumMyNonzeros_tmp = A_->getNodeNumEntries () + ExtMatrix_->getNodeNumEntries ();
189 GST NumMyRows_tmp = numMyRowsA + numMyRowsB;
191 GST inArray[2], outArray[2];
192 inArray[0] = NumMyNonzeros_tmp;
193 inArray[1] = NumMyRows_tmp;
196 reduceAll<int, GST> (* (A_->getComm ()), REDUCE_SUM, 2, inArray, outArray);
197 NumGlobalNonzeros_ = outArray[0];
198 NumGlobalRows_ = outArray[1];
205 MaxNumEntries_ = A_->getNodeMaxNumRowEntries ();
207 MaxNumEntries_ = ExtMatrix_->getNodeMaxNumRowEntries ();
212 RCP<row_graph_impl_type> graph =
213 rcp (
new row_graph_impl_type (A_->getGraph (),
214 ExtMatrix_->getGraph (),
223 graph_ = Teuchos::rcp_const_cast<
const row_graph_type>
224 (Teuchos::rcp_implicit_cast<row_graph_type> (graph));
226 Kokkos::resize(Indices_,MaxNumEntries_);
227 Kokkos::resize(Values_,MaxNumEntries_);
231 template<
class MatrixType>
232 Teuchos::RCP<const Teuchos::Comm<int> >
235 return A_->getComm ();
241 template<
class MatrixType>
242 Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type> >
250 template<
class MatrixType>
251 Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type> >
259 template<
class MatrixType>
260 Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type> >
275 template<
class MatrixType>
276 Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type> >
283 template<
class MatrixType>
284 Teuchos::RCP<const Tpetra::RowGraph<typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type> >
291 template<
class MatrixType>
294 return NumGlobalRows_;
298 template<
class MatrixType>
301 return NumGlobalRows_;
305 template<
class MatrixType>
308 return A_->getNodeNumRows () + ExtMatrix_->getNodeNumRows ();
312 template<
class MatrixType>
315 return this->getNodeNumRows ();
319 template<
class MatrixType>
320 typename MatrixType::global_ordinal_type
323 return A_->getIndexBase();
327 template<
class MatrixType>
330 return NumGlobalNonzeros_;
334 template<
class MatrixType>
337 return A_->getNodeNumEntries () + ExtMatrix_->getNodeNumEntries ();
341 template<
class MatrixType>
346 const local_ordinal_type localRow = RowMap_->getLocalElement (globalRow);
347 if (localRow == Teuchos::OrdinalTraits<local_ordinal_type>::invalid ()) {
348 return Teuchos::OrdinalTraits<size_t>::invalid();
350 return getNumEntriesInLocalRow (localRow);
355 template<
class MatrixType>
361 const size_t numMyRowsA = A_->getNodeNumRows ();
362 if (as<size_t> (localRow) < numMyRowsA) {
363 return A_->getNumEntriesInLocalRow (localRow);
365 return ExtMatrix_->getNumEntriesInLocalRow (as<local_ordinal_type> (localRow - numMyRowsA));
370 template<
class MatrixType>
373 throw std::runtime_error(
"Ifpack2::OverlappingRowMatrix::getGlobalMaxNumRowEntries() not supported.");
377 template<
class MatrixType>
380 return MaxNumEntries_;
384 template<
class MatrixType>
391 template<
class MatrixType>
398 template<
class MatrixType>
405 template<
class MatrixType>
412 template<
class MatrixType>
416 nonconst_global_inds_host_view_type &Indices,
417 nonconst_values_host_view_type &Values,
418 size_t& NumEntries)
const 420 const local_ordinal_type LocalRow = RowMap_->getLocalElement (GlobalRow);
421 if (LocalRow == Teuchos::OrdinalTraits<local_ordinal_type>::invalid ()) {
422 NumEntries = Teuchos::OrdinalTraits<size_t>::invalid ();
424 if (Teuchos::as<size_t> (LocalRow) < A_->getNodeNumRows ()) {
425 A_->getGlobalRowCopy (GlobalRow, Indices, Values, NumEntries);
427 ExtMatrix_->getGlobalRowCopy (GlobalRow, Indices, Values, NumEntries);
432 #ifdef TPETRA_ENABLE_DEPRECATED_CODE 433 template<
class MatrixType>
436 const Teuchos::ArrayView<global_ordinal_type> &Indices,
437 const Teuchos::ArrayView<scalar_type> &Values,
438 size_t &NumEntries)
const {
439 using IST =
typename row_matrix_type::impl_scalar_type;
440 nonconst_global_inds_host_view_type ind_in(Indices.data(),Indices.size());
441 nonconst_values_host_view_type val_in(reinterpret_cast<IST*>(Values.data()),Values.size());
442 getGlobalRowCopy(GlobalRow,ind_in,val_in,NumEntries);
446 template<
class MatrixType>
450 nonconst_local_inds_host_view_type &Indices,
451 nonconst_values_host_view_type &Values,
452 size_t& NumEntries)
const 455 const size_t numMyRowsA = A_->getNodeNumRows ();
456 if (as<size_t> (LocalRow) < numMyRowsA) {
457 A_->getLocalRowCopy (LocalRow, Indices, Values, NumEntries);
459 ExtMatrix_->getLocalRowCopy (LocalRow - as<local_ordinal_type> (numMyRowsA),
460 Indices, Values, NumEntries);
464 #ifdef TPETRA_ENABLE_DEPRECATED_CODE 465 template<
class MatrixType>
469 const Teuchos::ArrayView<local_ordinal_type> &Indices,
470 const Teuchos::ArrayView<scalar_type> &Values,
471 size_t &NumEntries)
const 473 using IST =
typename row_matrix_type::impl_scalar_type;
474 nonconst_local_inds_host_view_type ind_in(Indices.data(),Indices.size());
475 nonconst_values_host_view_type val_in(reinterpret_cast<IST*>(Values.data()),Values.size());
476 getLocalRowCopy(LocalRow,ind_in,val_in,NumEntries);
480 template<
class MatrixType>
484 global_inds_host_view_type &indices,
485 values_host_view_type &values)
const {
486 const local_ordinal_type LocalRow = RowMap_->getLocalElement (GlobalRow);
487 if (LocalRow == Teuchos::OrdinalTraits<local_ordinal_type>::invalid()) {
488 indices = global_inds_host_view_type();
489 values = values_host_view_type();
491 if (Teuchos::as<size_t> (LocalRow) < A_->getNodeNumRows ()) {
492 A_->getGlobalRowView (GlobalRow, indices, values);
494 ExtMatrix_->getGlobalRowView (GlobalRow, indices, values);
499 #ifdef TPETRA_ENABLE_DEPRECATED_CODE 500 template<
class MatrixType>
504 Teuchos::ArrayView<const global_ordinal_type>& indices,
505 Teuchos::ArrayView<const scalar_type>& values)
const 507 const local_ordinal_type LocalRow = RowMap_->getLocalElement (GlobalRow);
508 if (LocalRow == Teuchos::OrdinalTraits<local_ordinal_type>::invalid()) {
509 indices = Teuchos::null;
510 values = Teuchos::null;
512 if (Teuchos::as<size_t> (LocalRow) < A_->getNodeNumRows ()) {
513 A_->getGlobalRowView (GlobalRow, indices, values);
515 ExtMatrix_->getGlobalRowView (GlobalRow, indices, values);
521 template<
class MatrixType>
525 local_inds_host_view_type & indices,
526 values_host_view_type & values)
const {
528 const size_t numMyRowsA = A_->getNodeNumRows ();
529 if (as<size_t> (LocalRow) < numMyRowsA) {
530 A_->getLocalRowView (LocalRow, indices, values);
532 ExtMatrix_->getLocalRowView (LocalRow - as<local_ordinal_type> (numMyRowsA),
538 #ifdef TPETRA_ENABLE_DEPRECATED_CODE 539 template<
class MatrixType>
543 Teuchos::ArrayView<const local_ordinal_type>& indices,
544 Teuchos::ArrayView<const scalar_type>& values)
const 547 const size_t numMyRowsA = A_->getNodeNumRows ();
548 if (as<size_t> (LocalRow) < numMyRowsA) {
549 A_->getLocalRowView (LocalRow, indices, values);
551 ExtMatrix_->getLocalRowView (LocalRow - as<local_ordinal_type> (numMyRowsA),
558 template<
class MatrixType>
561 getLocalDiagCopy (Tpetra::Vector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& diag)
const 563 using Teuchos::Array;
566 vector_type baseDiag(A_->getRowMap());
567 A_->getLocalDiagCopy(baseDiag);
568 Array<scalar_type> baseDiagVals(baseDiag.getLocalLength());
569 baseDiag.get1dCopy(baseDiagVals());
571 vector_type extDiag(ExtMatrix_->getRowMap());
572 ExtMatrix_->getLocalDiagCopy(extDiag);
573 Array<scalar_type> extDiagVals(extDiag.getLocalLength());
574 extDiag.get1dCopy(extDiagVals());
576 Teuchos::ArrayRCP<scalar_type> allDiagVals = diag.getDataNonConst();
577 if (allDiagVals.size() != baseDiagVals.size() + extDiagVals.size()) {
578 std::ostringstream errStr;
579 errStr <<
"Ifpack2::OverlappingRowMatrix::getLocalDiagCopy : Mismatch in diagonal lengths, " 580 << allDiagVals.size() <<
" != " << baseDiagVals.size() <<
"+" << extDiagVals.size();
581 throw std::runtime_error(errStr.str());
583 for (Teuchos::Ordinal i=0; i<baseDiagVals.size(); ++i)
584 allDiagVals[i] = baseDiagVals[i];
585 Teuchos_Ordinal offset=baseDiagVals.size();
586 for (Teuchos::Ordinal i=0; i<extDiagVals.size(); ++i)
587 allDiagVals[i+offset] = extDiagVals[i];
591 template<
class MatrixType>
594 leftScale (
const Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& )
596 throw std::runtime_error(
"Ifpack2::OverlappingRowMatrix does not support leftScale.");
600 template<
class MatrixType>
603 rightScale (
const Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& )
605 throw std::runtime_error(
"Ifpack2::OverlappingRowMatrix does not support leftScale.");
609 template<
class MatrixType>
610 typename OverlappingRowMatrix<MatrixType>::mag_type
613 throw std::runtime_error(
"Ifpack2::OverlappingRowMatrix does not support getFrobeniusNorm.");
617 template<
class MatrixType>
620 apply (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &X,
621 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &Y,
622 Teuchos::ETransp mode,
624 scalar_type beta)
const 626 using MV = Tpetra::MultiVector<scalar_type, local_ordinal_type,
627 global_ordinal_type, node_type>;
628 TEUCHOS_TEST_FOR_EXCEPTION
629 (X.getNumVectors() != Y.getNumVectors(), std::runtime_error,
630 "Ifpack2::OverlappingRowMatrix::apply: X.getNumVectors() = " 631 << X.getNumVectors() <<
" != Y.getNumVectors() = " << Y.getNumVectors()
634 bool aliases = X.aliases(Y);
636 MV X_copy (X, Teuchos::Copy);
637 this->apply (X_copy, Y, mode, alpha, beta);
641 const auto& rowMap0 = * (A_->getRowMap ());
642 const auto& colMap0 = * (A_->getColMap ());
643 MV X_0 (X, mode == Teuchos::NO_TRANS ? colMap0 : rowMap0, 0);
644 MV Y_0 (Y, mode == Teuchos::NO_TRANS ? rowMap0 : colMap0, 0);
645 A_->localApply (X_0, Y_0, mode, alpha, beta);
647 const auto& rowMap1 = * (ExtMatrix_->getRowMap ());
648 const auto& colMap1 = * (ExtMatrix_->getColMap ());
649 MV X_1 (X, mode == Teuchos::NO_TRANS ? colMap1 : rowMap1, 0);
650 MV Y_1 (Y, mode == Teuchos::NO_TRANS ? rowMap1 : colMap1, A_->getNodeNumRows ());
651 ExtMatrix_->localApply (X_1, Y_1, mode, alpha, beta);
655 template<
class MatrixType>
658 importMultiVector (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &X,
659 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &OvX,
660 Tpetra::CombineMode CM)
662 OvX.doImport (X, *Importer_, CM);
666 template<
class MatrixType>
668 OverlappingRowMatrix<MatrixType>::
669 exportMultiVector (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &OvX,
670 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &X,
671 Tpetra::CombineMode CM)
673 X.doExport (OvX, *Importer_, CM);
677 template<
class MatrixType>
684 template<
class MatrixType>
690 template<
class MatrixType>
693 std::ostringstream oss;
694 if (isFillComplete()) {
695 oss <<
"{ isFillComplete: true" 696 <<
", global rows: " << getGlobalNumRows()
697 <<
", global columns: " << getGlobalNumCols()
698 <<
", global entries: " << getGlobalNumEntries()
702 oss <<
"{ isFillComplete: false" 703 <<
", global rows: " << getGlobalNumRows()
709 template<
class MatrixType>
710 void OverlappingRowMatrix<MatrixType>::describe(Teuchos::FancyOStream &out,
711 const Teuchos::EVerbosityLevel verbLevel)
const 716 using Teuchos::VERB_DEFAULT;
717 using Teuchos::VERB_NONE;
718 using Teuchos::VERB_LOW;
719 using Teuchos::VERB_MEDIUM;
720 using Teuchos::VERB_HIGH;
721 using Teuchos::VERB_EXTREME;
724 using Teuchos::ArrayView;
726 Teuchos::EVerbosityLevel vl = verbLevel;
727 if (vl == VERB_DEFAULT) {
730 RCP<const Teuchos::Comm<int> > comm = this->getComm();
731 const int myRank = comm->getRank();
732 const int numProcs = comm->getSize();
734 for (
size_t dec=10; dec<getGlobalNumRows(); dec *= 10) {
737 width = std::max<size_t> (width, as<size_t> (11)) + 2;
738 Teuchos::OSTab tab(out);
746 if (vl != VERB_NONE) {
748 out << this->description() << std::endl;
755 if (vl == VERB_MEDIUM || vl == VERB_HIGH || vl == VERB_EXTREME) {
757 out << endl <<
"Row map:" << endl;
759 getRowMap()->describe(out,vl);
761 if (getColMap() != null) {
762 if (getColMap() == getRowMap()) {
764 out << endl <<
"Column map is row map.";
769 out << endl <<
"Column map:" << endl;
771 getColMap()->describe(out,vl);
774 if (getDomainMap() != null) {
775 if (getDomainMap() == getRowMap()) {
777 out << endl <<
"Domain map is row map.";
780 else if (getDomainMap() == getColMap()) {
782 out << endl <<
"Domain map is column map.";
787 out << endl <<
"Domain map:" << endl;
789 getDomainMap()->describe(out,vl);
792 if (getRangeMap() != null) {
793 if (getRangeMap() == getDomainMap()) {
795 out << endl <<
"Range map is domain map." << endl;
798 else if (getRangeMap() == getRowMap()) {
800 out << endl <<
"Range map is row map." << endl;
805 out << endl <<
"Range map: " << endl;
807 getRangeMap()->describe(out,vl);
815 if (vl == VERB_MEDIUM || vl == VERB_HIGH || vl == VERB_EXTREME) {
816 for (
int curRank = 0; curRank < numProcs; ++curRank) {
817 if (myRank == curRank) {
818 out <<
"Process rank: " << curRank << std::endl;
819 out <<
" Number of entries: " << getNodeNumEntries() << std::endl;
820 out <<
" Max number of entries per row: " << getNodeMaxNumRowEntries() << std::endl;
828 if (vl == VERB_HIGH || vl == VERB_EXTREME) {
829 for (
int curRank = 0; curRank < numProcs; ++curRank) {
830 if (myRank == curRank) {
831 out << std::setw(width) <<
"Proc Rank" 832 << std::setw(width) <<
"Global Row" 833 << std::setw(width) <<
"Num Entries";
834 if (vl == VERB_EXTREME) {
835 out << std::setw(width) <<
"(Index,Value)";
838 for (
size_t r = 0; r < getNodeNumRows (); ++r) {
839 const size_t nE = getNumEntriesInLocalRow(r);
840 typename MatrixType::global_ordinal_type gid = getRowMap()->getGlobalElement(r);
841 out << std::setw(width) << myRank
842 << std::setw(width) << gid
843 << std::setw(width) << nE;
844 if (vl == VERB_EXTREME) {
845 if (isGloballyIndexed()) {
846 global_inds_host_view_type rowinds;
847 values_host_view_type rowvals;
848 getGlobalRowView (gid, rowinds, rowvals);
849 for (
size_t j = 0; j < nE; ++j) {
850 out <<
" (" << rowinds[j]
851 <<
", " << rowvals[j]
855 else if (isLocallyIndexed()) {
856 local_inds_host_view_type rowinds;
857 values_host_view_type rowvals;
858 getLocalRowView (r, rowinds, rowvals);
859 for (
size_t j=0; j < nE; ++j) {
860 out <<
" (" << getColMap()->getGlobalElement(rowinds[j])
861 <<
", " << rowvals[j]
875 out.setOutputToRootOnly(0);
876 out <<
"===========\nlocal matrix\n=================" << std::endl;
877 out.setOutputToRootOnly(-1);
878 A_->describe(out,Teuchos::VERB_EXTREME);
879 out.setOutputToRootOnly(0);
880 out <<
"===========\nend of local matrix\n=================" << std::endl;
882 out.setOutputToRootOnly(0);
883 out <<
"=================\nghost matrix\n=================" << std::endl;
884 out.setOutputToRootOnly(-1);
885 ExtMatrix_->describe(out,Teuchos::VERB_EXTREME);
886 out.setOutputToRootOnly(0);
887 out <<
"===========\nend of ghost matrix\n=================" << std::endl;
892 template<
class MatrixType>
893 Teuchos::RCP<const Tpetra::RowMatrix<typename MatrixType::scalar_type, typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type> >
894 OverlappingRowMatrix<MatrixType>::getUnderlyingMatrix()
const 899 template<
class MatrixType>
900 Teuchos::RCP<const Tpetra::RowMatrix<typename MatrixType::scalar_type, typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type> >
901 OverlappingRowMatrix<MatrixType>::getExtMatrix()
const 906 template<
class MatrixType>
907 Teuchos::ArrayView<const size_t> OverlappingRowMatrix<MatrixType>::getExtHaloStarts()
const 909 return ExtHaloStarts_();
915 #define IFPACK2_OVERLAPPINGROWMATRIX_INSTANT(S,LO,GO,N) \ 916 template class Ifpack2::OverlappingRowMatrix< Tpetra::RowMatrix<S, LO, GO, N> >; 918 #endif // IFPACK2_OVERLAPPINGROWMATRIX_DEF_HPP virtual Teuchos::RCP< const Tpetra::Map< local_ordinal_type, global_ordinal_type, node_type > > getDomainMap() const
The Map that describes the domain of this matrix.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:261
virtual Teuchos::RCP< const Tpetra::Map< local_ordinal_type, global_ordinal_type, node_type > > getRangeMap() const
The Map that describes the range of this matrix.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:277
virtual Teuchos::RCP< const Tpetra::RowGraph< local_ordinal_type, global_ordinal_type, node_type > > getGraph() const
This matrix's graph.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:285
virtual Teuchos::RCP< const Tpetra::Map< local_ordinal_type, global_ordinal_type, node_type > > getColMap() const
The Map that describes the distribution of columns over processes.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:252
virtual bool hasTransposeApply() const
Whether this operator's apply() method can apply the adjoint (transpose).
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:678
virtual mag_type getFrobeniusNorm() const
Returns the Frobenius norm of the matrix.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:611
virtual size_t getNumEntriesInGlobalRow(global_ordinal_type globalRow) const
The number of entries in the given global row that are owned by the calling process.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:344
virtual Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
The communicator over which the matrix is distributed.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:233
virtual bool isLocallyIndexed() const
Whether this matrix is locally indexed.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:392
virtual void getGlobalRowView(global_ordinal_type GlobalRow, global_inds_host_view_type &indices, values_host_view_type &values) const
Extract a const, non-persisting view of global indices in a specified row of the matrix.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:483
virtual global_size_t getGlobalNumCols() const
The global number of columns in this matrix.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:299
virtual void leftScale(const Tpetra::Vector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &x)
Scales the RowMatrix on the left with the Vector x.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:594
virtual bool isFillComplete() const
true if fillComplete() has been called, else false.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:406
virtual void getLocalRowCopy(local_ordinal_type LocalRow, nonconst_local_inds_host_view_type &Indices, nonconst_values_host_view_type &Values, size_t &NumEntries) const
Extract a list of entries in a specified local row of the graph. Put into storage allocated by callin...
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:449
virtual bool isGloballyIndexed() const
Whether this matrix is globally indexed.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:399
virtual Teuchos::RCP< const Tpetra::Map< local_ordinal_type, global_ordinal_type, node_type > > getRowMap() const
The Map that describes the distribution of rows over processes.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:243
virtual bool hasColMap() const
Whether this matrix has a column Map.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:385
virtual size_t getNodeNumEntries() const
The number of entries in this matrix owned by the calling process.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:335
virtual void getLocalRowView(local_ordinal_type LocalRow, local_inds_host_view_type &indices, values_host_view_type &values) const
Extract a const, non-persisting view of local indices in a specified row of the matrix.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:524
virtual void getGlobalRowCopy(global_ordinal_type GlobalRow, nonconst_global_inds_host_view_type &Indices, nonconst_values_host_view_type &Values, size_t &NumEntries) const
Extract a list of entries in a specified global row of this matrix. Put into pre-allocated storage...
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:415
virtual bool supportsRowViews() const
true if row views are supported, else false.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:685
Sparse graph (Tpetra::RowGraph subclass) with ghost rows.
Definition: Ifpack2_Details_OverlappingRowGraph_decl.hpp:65
virtual size_t getNodeNumCols() const
The number of columns owned by the calling process.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:313
virtual size_t getGlobalMaxNumRowEntries() const
The maximum number of entries in any row on any process.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:371
virtual void rightScale(const Tpetra::Vector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &x)
Scales the RowMatrix on the right with the Vector x.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:603
Definition: Ifpack2_Container_decl.hpp:576
Sparse matrix (Tpetra::RowMatrix subclass) with ghost rows.
Definition: Ifpack2_OverlappingRowMatrix_decl.hpp:58
virtual size_t getNodeMaxNumRowEntries() const
The maximum number of entries in any row on the calling process.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:378
OverlappingRowMatrix(const Teuchos::RCP< const row_matrix_type > &A, const int overlapLevel)
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:58
virtual size_t getNodeNumRows() const
The number of rows owned by the calling process.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:306
virtual void apply(const Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &X, Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, scalar_type alpha=Teuchos::ScalarTraits< scalar_type >::one(), scalar_type beta=Teuchos::ScalarTraits< scalar_type >::zero()) const
Computes the operator-multivector application.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:620
Preconditioners and smoothers for Tpetra sparse matrices.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:73
virtual global_size_t getGlobalNumEntries() const
The global number of entries in this matrix.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:328
virtual size_t getNumEntriesInLocalRow(local_ordinal_type localRow) const
The number of entries in the given local row that are owned by the calling process.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:358
virtual global_ordinal_type getIndexBase() const
The index base for global indices for this matrix.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:321
virtual global_size_t getGlobalNumRows() const
The global number of rows in this matrix.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:292
virtual void getLocalDiagCopy(Tpetra::Vector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &diag) const
Get a copy of the diagonal entries owned by this node, with local row indices.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:561