43 #ifndef IFPACK2_OVERLAPPINGROWMATRIX_DEF_HPP 44 #define IFPACK2_OVERLAPPINGROWMATRIX_DEF_HPP 48 #include <Ifpack2_OverlappingRowMatrix_decl.hpp> 49 #include <Ifpack2_Details_OverlappingRowGraph.hpp> 50 #include <Tpetra_CrsMatrix.hpp> 51 #include <Teuchos_CommHelpers.hpp> 55 template<
class MatrixType>
58 const int overlapLevel) :
60 OverlapLevel_ (overlapLevel)
65 using Teuchos::outArg;
66 using Teuchos::rcp_const_cast;
67 using Teuchos::rcp_dynamic_cast;
68 using Teuchos::rcp_implicit_cast;
69 using Teuchos::REDUCE_SUM;
70 using Teuchos::reduceAll;
71 typedef Tpetra::global_size_t GST;
72 typedef Tpetra::CrsGraph<local_ordinal_type,
73 global_ordinal_type, node_type> crs_graph_type;
74 TEUCHOS_TEST_FOR_EXCEPTION(
75 OverlapLevel_ <= 0, std::runtime_error,
76 "Ifpack2::OverlappingRowMatrix: OverlapLevel must be > 0.");
77 TEUCHOS_TEST_FOR_EXCEPTION(
78 A_->getComm()->getSize() == 1, std::runtime_error,
79 "Ifpack2::OverlappingRowMatrix: Matrix must be " 80 "distributed over more than one MPI process.");
82 RCP<const crs_matrix_type> ACRS =
83 rcp_dynamic_cast<
const crs_matrix_type,
const row_matrix_type> (A_);
84 TEUCHOS_TEST_FOR_EXCEPTION(
85 ACRS.is_null (), std::runtime_error,
86 "Ifpack2::OverlappingRowMatrix: The input matrix must be a Tpetra::" 87 "CrsMatrix with matching template parameters. This class currently " 88 "requires that CrsMatrix's fifth template parameter be the default.");
89 RCP<const crs_graph_type> A_crsGraph = ACRS->getCrsGraph ();
91 const size_t numMyRowsA = A_->getNodeNumRows ();
92 const global_ordinal_type global_invalid =
93 Teuchos::OrdinalTraits<global_ordinal_type>::invalid ();
96 Array<global_ordinal_type> ExtElements;
98 RCP<crs_graph_type> TmpGraph;
99 RCP<import_type> TmpImporter;
100 RCP<const map_type> RowMap, ColMap;
103 for (
int overlap = 0 ; overlap < OverlapLevel_ ; ++overlap) {
106 RowMap = A_->getRowMap ();
107 ColMap = A_->getColMap ();
110 RowMap = TmpGraph->getRowMap ();
111 ColMap = TmpGraph->getColMap ();
114 const size_t size = ColMap->getNodeNumElements () - RowMap->getNodeNumElements ();
115 Array<global_ordinal_type> mylist (size);
119 for (local_ordinal_type i = 0 ; (size_t) i < ColMap->getNodeNumElements() ; ++i) {
120 const global_ordinal_type GID = ColMap->getGlobalElement (i);
121 if (A_->getRowMap ()->getLocalElement (GID) == global_invalid) {
122 typedef typename Array<global_ordinal_type>::iterator iter_type;
123 const iter_type end = ExtElements.end ();
124 const iter_type pos = std::find (ExtElements.begin (), end, GID);
126 ExtElements.push_back (GID);
136 if (overlap + 1 < OverlapLevel_) {
143 TmpMap = rcp (
new map_type (global_invalid, mylist (0, count),
144 Teuchos::OrdinalTraits<global_ordinal_type>::zero (),
145 A_->getComm (), A_->getNode ()));
146 TmpGraph = rcp (
new crs_graph_type (TmpMap, 0));
147 TmpImporter = rcp (
new import_type (A_->getRowMap (), TmpMap));
149 TmpGraph->doImport (*A_crsGraph, *TmpImporter, Tpetra::INSERT);
150 TmpGraph->fillComplete (A_->getDomainMap (), TmpMap);
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 (),
166 A_->getComm (), A_->getNode ()));
171 ExtMap_ = rcp (
new map_type (global_invalid, ExtElements (),
172 Teuchos::OrdinalTraits<global_ordinal_type>::zero (),
173 A_->getComm (), A_->getNode ()));
174 ExtMatrix_ = rcp (
new crs_matrix_type (ExtMap_, ColMap_, 0));
175 ExtImporter_ = rcp (
new import_type (A_->getRowMap (), ExtMap_));
177 RCP<crs_matrix_type> ExtMatrixCRS =
178 rcp_dynamic_cast<crs_matrix_type, row_matrix_type> (ExtMatrix_);
179 ExtMatrixCRS->doImport (*ACRS, *ExtImporter_, Tpetra::INSERT);
180 ExtMatrixCRS->fillComplete (A_->getDomainMap (), RowMap_);
182 Importer_ = rcp (
new import_type (A_->getRowMap (), RowMap_));
185 const size_t numMyRowsB = ExtMatrix_->getNodeNumRows ();
187 GST NumMyNonzeros_tmp = A_->getNodeNumEntries () + ExtMatrix_->getNodeNumEntries ();
188 GST NumMyRows_tmp = numMyRowsA + numMyRowsB;
190 GST inArray[2], outArray[2];
191 inArray[0] = NumMyNonzeros_tmp;
192 inArray[1] = NumMyRows_tmp;
195 reduceAll<int, GST> (* (A_->getComm ()), REDUCE_SUM, 2, inArray, outArray);
196 NumGlobalNonzeros_ = outArray[0];
197 NumGlobalRows_ = outArray[1];
204 MaxNumEntries_ = A_->getNodeMaxNumRowEntries ();
206 MaxNumEntries_ = ExtMatrix_->getNodeMaxNumRowEntries ();
211 RCP<row_graph_impl_type> graph =
212 rcp (
new row_graph_impl_type (A_->getGraph (),
213 ExtMatrix_->getGraph (),
220 rcp_const_cast<
const import_type> (Importer_),
221 rcp_const_cast<const import_type> (ExtImporter_)));
222 graph_ = rcp_const_cast<
const row_graph_type> (rcp_implicit_cast<row_graph_type> (graph));
224 Indices_.resize (MaxNumEntries_);
225 Values_.resize (MaxNumEntries_);
229 template<
class MatrixType>
233 template<
class MatrixType>
234 Teuchos::RCP<const Teuchos::Comm<int> >
237 return A_->getComm ();
241 template<
class MatrixType>
242 Teuchos::RCP<typename MatrixType::node_type>
245 return A_->getNode();
249 template<
class MatrixType>
250 Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type> >
258 template<
class MatrixType>
259 Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type> >
267 template<
class MatrixType>
268 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::Map<typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type> >
291 template<
class MatrixType>
292 Teuchos::RCP<const Tpetra::RowGraph<typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type> >
299 template<
class MatrixType>
302 return NumGlobalRows_;
306 template<
class MatrixType>
309 return NumGlobalRows_;
313 template<
class MatrixType>
316 return A_->getNodeNumRows () + ExtMatrix_->getNodeNumRows ();
320 template<
class MatrixType>
323 return this->getNodeNumRows ();
327 template<
class MatrixType>
328 typename MatrixType::global_ordinal_type
331 return A_->getIndexBase();
335 template<
class MatrixType>
338 return NumGlobalNonzeros_;
342 template<
class MatrixType>
345 return A_->getNodeNumEntries () + ExtMatrix_->getNodeNumEntries ();
349 template<
class MatrixType>
354 const local_ordinal_type localRow = RowMap_->getLocalElement (globalRow);
355 if (localRow == Teuchos::OrdinalTraits<local_ordinal_type>::invalid ()) {
356 return Teuchos::OrdinalTraits<size_t>::invalid();
358 return getNumEntriesInLocalRow (localRow);
363 template<
class MatrixType>
369 const size_t numMyRowsA = A_->getNodeNumRows ();
370 if (as<size_t> (localRow) < numMyRowsA) {
371 return A_->getNumEntriesInLocalRow (localRow);
373 return ExtMatrix_->getNumEntriesInLocalRow (as<local_ordinal_type> (localRow - numMyRowsA));
378 template<
class MatrixType>
381 throw std::runtime_error(
"Ifpack2::OverlappingRowMatrix::getGlobalMaxNumRowEntries() not supported.");
385 template<
class MatrixType>
388 return MaxNumEntries_;
392 template<
class MatrixType>
399 template<
class MatrixType>
406 template<
class MatrixType>
413 template<
class MatrixType>
420 template<
class MatrixType>
424 const Teuchos::ArrayView<global_ordinal_type> &Indices,
425 const Teuchos::ArrayView<scalar_type>& Values,
426 size_t& NumEntries)
const 428 const local_ordinal_type LocalRow = RowMap_->getLocalElement (GlobalRow);
429 if (LocalRow == Teuchos::OrdinalTraits<local_ordinal_type>::invalid ()) {
430 NumEntries = Teuchos::OrdinalTraits<size_t>::invalid ();
432 if (Teuchos::as<size_t> (LocalRow) < A_->getNodeNumRows ()) {
433 A_->getGlobalRowCopy (GlobalRow, Indices, Values, NumEntries);
435 ExtMatrix_->getGlobalRowCopy (GlobalRow, Indices, Values, NumEntries);
441 template<
class MatrixType>
445 const Teuchos::ArrayView<local_ordinal_type> &Indices,
446 const Teuchos::ArrayView<scalar_type> &Values,
447 size_t &NumEntries)
const 450 const size_t numMyRowsA = A_->getNodeNumRows ();
451 if (as<size_t> (LocalRow) < numMyRowsA) {
452 A_->getLocalRowCopy (LocalRow, Indices, Values, NumEntries);
454 ExtMatrix_->getLocalRowCopy (LocalRow - as<local_ordinal_type> (numMyRowsA),
455 Indices, Values, NumEntries);
460 template<
class MatrixType>
464 Teuchos::ArrayView<const global_ordinal_type>& indices,
465 Teuchos::ArrayView<const scalar_type>& values)
const 467 const local_ordinal_type LocalRow = RowMap_->getLocalElement (GlobalRow);
468 if (LocalRow == Teuchos::OrdinalTraits<local_ordinal_type>::invalid()) {
469 indices = Teuchos::null;
470 values = Teuchos::null;
472 if (Teuchos::as<size_t> (LocalRow) < A_->getNodeNumRows ()) {
473 A_->getGlobalRowView (GlobalRow, indices, values);
475 ExtMatrix_->getGlobalRowView (GlobalRow, indices, values);
481 template<
class MatrixType>
485 Teuchos::ArrayView<const local_ordinal_type>& indices,
486 Teuchos::ArrayView<const scalar_type>& values)
const 489 const size_t numMyRowsA = A_->getNodeNumRows ();
490 if (as<size_t> (LocalRow) < numMyRowsA) {
491 A_->getLocalRowView (LocalRow, indices, values);
493 ExtMatrix_->getLocalRowView (LocalRow - as<local_ordinal_type> (numMyRowsA),
499 template<
class MatrixType>
502 getLocalDiagCopy (Tpetra::Vector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& diag)
const 504 using Teuchos::Array;
507 vector_type baseDiag(A_->getRowMap());
508 A_->getLocalDiagCopy(baseDiag);
509 Array<scalar_type> baseDiagVals(baseDiag.getLocalLength());
510 baseDiag.get1dCopy(baseDiagVals());
512 vector_type extDiag(ExtMatrix_->getRowMap());
513 ExtMatrix_->getLocalDiagCopy(extDiag);
514 Array<scalar_type> extDiagVals(extDiag.getLocalLength());
515 extDiag.get1dCopy(extDiagVals());
517 Teuchos::ArrayRCP<scalar_type> allDiagVals = diag.getDataNonConst();
518 if (allDiagVals.size() != baseDiagVals.size() + extDiagVals.size()) {
519 std::ostringstream errStr;
520 errStr <<
"Ifpack2::OverlappingRowMatrix::getLocalDiagCopy : Mismatch in diagonal lengths, " 521 << allDiagVals.size() <<
" != " << baseDiagVals.size() <<
"+" << extDiagVals.size();
522 throw std::runtime_error(errStr.str());
524 for (Teuchos::Ordinal i=0; i<baseDiagVals.size(); ++i)
525 allDiagVals[i] = baseDiagVals[i];
526 Teuchos_Ordinal offset=baseDiagVals.size();
527 for (Teuchos::Ordinal i=0; i<extDiagVals.size(); ++i)
528 allDiagVals[i+offset] = extDiagVals[i];
532 template<
class MatrixType>
535 leftScale (
const Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& )
537 throw std::runtime_error(
"Ifpack2::OverlappingRowMatrix does not support leftScale.");
541 template<
class MatrixType>
544 rightScale (
const Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& )
546 throw std::runtime_error(
"Ifpack2::OverlappingRowMatrix does not support leftScale.");
550 template<
class MatrixType>
551 typename OverlappingRowMatrix<MatrixType>::mag_type
554 throw std::runtime_error(
"Ifpack2::OverlappingRowMatrix does not support getFrobeniusNorm.");
558 template<
class MatrixType>
561 apply (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &X,
562 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &Y,
563 Teuchos::ETransp mode,
565 scalar_type beta)
const 567 using Teuchos::ArrayRCP;
569 typedef scalar_type RangeScalar;
570 typedef scalar_type DomainScalar;
571 typedef Teuchos::ScalarTraits<RangeScalar> STRS;
573 TEUCHOS_TEST_FOR_EXCEPTION(
574 alpha != Teuchos::ScalarTraits<scalar_type>::one () ||
575 beta != Teuchos::ScalarTraits<scalar_type>::zero (), std::logic_error,
576 "Ifpack2::ReorderFilter::apply is only implemented for alpha = 1 and " 577 "beta = 0. You set alpha = " << alpha <<
" and beta = " << beta <<
".");
578 TEUCHOS_TEST_FOR_EXCEPTION(
579 X.getNumVectors() != Y.getNumVectors(), std::runtime_error,
580 "Ifpack2::OverlappingRowMatrix::apply: The input X and the output Y must " 581 "have the same number of columns. X.getNumVectors() = " 582 << X.getNumVectors() <<
" != Y.getNumVectors() = " << Y.getNumVectors()
590 const RangeScalar zero = STRS::zero ();
591 ArrayRCP<ArrayRCP<const DomainScalar> > x_ptr = X.get2dView();
592 ArrayRCP<ArrayRCP<RangeScalar> > y_ptr = Y.get2dViewNonConst();
594 size_t NumVectors = Y.getNumVectors();
596 const size_t numMyRowsA = A_->getNodeNumRows ();
597 for (
size_t i = 0; i < numMyRowsA; ++i) {
600 A_->getLocalRowCopy (i, Indices_ (),Values_ (), Nnz);
601 if (mode == Teuchos::NO_TRANS) {
602 for (
size_t j = 0; j < Nnz; ++j)
603 for (
size_t k = 0; k < NumVectors; ++k)
604 y_ptr[k][i] += as<RangeScalar> (Values_[j]) *
605 as<RangeScalar> (x_ptr[k][Indices_[j]]);
607 else if (mode == Teuchos::TRANS){
608 for (
size_t j = 0; j < Nnz; ++j)
609 for (
size_t k = 0; k < NumVectors; ++k)
610 y_ptr[k][Indices_[j]] += as<RangeScalar> (Values_[j]) *
611 as<RangeScalar> (x_ptr[k][i]);
614 for (
size_t j = 0; j < Nnz; ++j)
615 for (
size_t k = 0; k < NumVectors; ++k)
616 y_ptr[k][Indices_[j]] +=
617 STRS::conjugate (as<RangeScalar> (Values_[j])) *
618 as<RangeScalar> (x_ptr[k][i]);
622 const size_t numMyRowsB = ExtMatrix_->getNodeNumRows ();
623 for (
size_t i = 0 ; i < numMyRowsB ; ++i) {
626 ExtMatrix_->getLocalRowCopy (i, Indices_ (), Values_ (), Nnz);
627 if (mode == Teuchos::NO_TRANS) {
628 for (
size_t j = 0; j < Nnz; ++j)
629 for (
size_t k = 0; k < NumVectors; ++k)
630 y_ptr[k][numMyRowsA+i] += as<RangeScalar> (Values_[j]) *
631 as<RangeScalar> (x_ptr[k][Indices_[j]]);
633 else if (mode == Teuchos::TRANS) {
634 for (
size_t j = 0; j < Nnz; ++j)
635 for (
size_t k = 0; k < NumVectors; ++k)
636 y_ptr[k][numMyRowsA+Indices_[j]] += as<RangeScalar> (Values_[j]) *
637 as<RangeScalar> (x_ptr[k][i]);
640 for (
size_t j = 0; j < Nnz; ++j)
641 for (
size_t k = 0; k < NumVectors; ++k)
642 y_ptr[k][numMyRowsA+Indices_[j]] +=
643 STRS::conjugate (as<RangeScalar> (Values_[j])) *
644 as<RangeScalar> (x_ptr[k][i]);
650 template<
class MatrixType>
653 importMultiVector (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &X,
654 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &OvX,
655 Tpetra::CombineMode CM)
657 OvX.doImport (X, *Importer_, CM);
661 template<
class MatrixType>
663 OverlappingRowMatrix<MatrixType>::
664 exportMultiVector (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &OvX,
665 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &X,
666 Tpetra::CombineMode CM)
668 X.doExport (OvX, *Importer_, CM);
672 template<
class MatrixType>
679 template<
class MatrixType>
685 template<
class MatrixType>
688 std::ostringstream oss;
689 if (isFillComplete()) {
690 oss <<
"{ isFillComplete: true" 691 <<
", global rows: " << getGlobalNumRows()
692 <<
", global columns: " << getGlobalNumCols()
693 <<
", global entries: " << getGlobalNumEntries()
697 oss <<
"{ isFillComplete: false" 698 <<
", global rows: " << getGlobalNumRows()
704 template<
class MatrixType>
705 void OverlappingRowMatrix<MatrixType>::describe(Teuchos::FancyOStream &out,
706 const Teuchos::EVerbosityLevel verbLevel)
const 711 using Teuchos::VERB_DEFAULT;
712 using Teuchos::VERB_NONE;
713 using Teuchos::VERB_LOW;
714 using Teuchos::VERB_MEDIUM;
715 using Teuchos::VERB_HIGH;
716 using Teuchos::VERB_EXTREME;
719 using Teuchos::ArrayView;
721 Teuchos::EVerbosityLevel vl = verbLevel;
722 if (vl == VERB_DEFAULT) {
725 RCP<const Teuchos::Comm<int> > comm = this->getComm();
726 const int myRank = comm->getRank();
727 const int numProcs = comm->getSize();
729 for (
size_t dec=10; dec<getGlobalNumRows(); dec *= 10) {
732 width = std::max<size_t> (width, as<size_t> (11)) + 2;
733 Teuchos::OSTab tab(out);
741 if (vl != VERB_NONE) {
743 out << this->description() << std::endl;
750 if (vl == VERB_MEDIUM || vl == VERB_HIGH || vl == VERB_EXTREME) {
752 out << endl <<
"Row map:" << endl;
754 getRowMap()->describe(out,vl);
756 if (getColMap() != null) {
757 if (getColMap() == getRowMap()) {
759 out << endl <<
"Column map is row map.";
764 out << endl <<
"Column map:" << endl;
766 getColMap()->describe(out,vl);
769 if (getDomainMap() != null) {
770 if (getDomainMap() == getRowMap()) {
772 out << endl <<
"Domain map is row map.";
775 else if (getDomainMap() == getColMap()) {
777 out << endl <<
"Domain map is column map.";
782 out << endl <<
"Domain map:" << endl;
784 getDomainMap()->describe(out,vl);
787 if (getRangeMap() != null) {
788 if (getRangeMap() == getDomainMap()) {
790 out << endl <<
"Range map is domain map." << endl;
793 else if (getRangeMap() == getRowMap()) {
795 out << endl <<
"Range map is row map." << endl;
800 out << endl <<
"Range map: " << endl;
802 getRangeMap()->describe(out,vl);
810 if (vl == VERB_MEDIUM || vl == VERB_HIGH || vl == VERB_EXTREME) {
811 for (
int curRank = 0; curRank < numProcs; ++curRank) {
812 if (myRank == curRank) {
813 out <<
"Process rank: " << curRank << std::endl;
814 out <<
" Number of entries: " << getNodeNumEntries() << std::endl;
815 out <<
" Max number of entries per row: " << getNodeMaxNumRowEntries() << std::endl;
823 if (vl == VERB_HIGH || vl == VERB_EXTREME) {
824 for (
int curRank = 0; curRank < numProcs; ++curRank) {
825 if (myRank == curRank) {
826 out << std::setw(width) <<
"Proc Rank" 827 << std::setw(width) <<
"Global Row" 828 << std::setw(width) <<
"Num Entries";
829 if (vl == VERB_EXTREME) {
830 out << std::setw(width) <<
"(Index,Value)";
833 for (
size_t r = 0; r < getNodeNumRows (); ++r) {
834 const size_t nE = getNumEntriesInLocalRow(r);
835 typename MatrixType::global_ordinal_type gid = getRowMap()->getGlobalElement(r);
836 out << std::setw(width) << myRank
837 << std::setw(width) << gid
838 << std::setw(width) << nE;
839 if (vl == VERB_EXTREME) {
840 if (isGloballyIndexed()) {
841 ArrayView<const typename MatrixType::global_ordinal_type> rowinds;
842 ArrayView<const typename MatrixType::scalar_type> rowvals;
843 getGlobalRowView (gid, rowinds, rowvals);
844 for (
size_t j = 0; j < nE; ++j) {
845 out <<
" (" << rowinds[j]
846 <<
", " << rowvals[j]
850 else if (isLocallyIndexed()) {
851 ArrayView<const typename MatrixType::local_ordinal_type> rowinds;
852 ArrayView<const typename MatrixType::scalar_type> rowvals;
853 getLocalRowView (r, rowinds, rowvals);
854 for (
size_t j=0; j < nE; ++j) {
855 out <<
" (" << getColMap()->getGlobalElement(rowinds[j])
856 <<
", " << rowvals[j]
870 out.setOutputToRootOnly(0);
871 out <<
"===========\nlocal matrix\n=================" << std::endl;
872 out.setOutputToRootOnly(-1);
873 A_->describe(out,Teuchos::VERB_EXTREME);
874 out.setOutputToRootOnly(0);
875 out <<
"===========\nend of local matrix\n=================" << std::endl;
877 out.setOutputToRootOnly(0);
878 out <<
"=================\nghost matrix\n=================" << std::endl;
879 out.setOutputToRootOnly(-1);
880 ExtMatrix_->describe(out,Teuchos::VERB_EXTREME);
881 out.setOutputToRootOnly(0);
882 out <<
"===========\nend of ghost matrix\n=================" << std::endl;
887 template<
class MatrixType>
888 Teuchos::RCP<const Tpetra::RowMatrix<typename MatrixType::scalar_type, typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type> >
889 OverlappingRowMatrix<MatrixType>::getUnderlyingMatrix()
const 897 #define IFPACK2_OVERLAPPINGROWMATRIX_INSTANT(S,LO,GO,N) \ 898 template class Ifpack2::OverlappingRowMatrix< Tpetra::RowMatrix<S, LO, GO, N> >; 900 #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:269
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:285
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:293
virtual void getGlobalRowView(global_ordinal_type GlobalRow, Teuchos::ArrayView< const global_ordinal_type > &indices, Teuchos::ArrayView< const scalar_type > &values) const
Extract a const, non-persisting view of global indices in a specified row of the matrix.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:463
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:260
virtual bool hasTransposeApply() const
Whether this operator's apply() method can apply the adjoint (transpose).
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:673
virtual mag_type getFrobeniusNorm() const
Returns the Frobenius norm of the matrix.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:552
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:352
virtual Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
The communicator over which the matrix is distributed.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:235
virtual bool isLocallyIndexed() const
Whether this matrix is locally indexed.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:400
virtual global_size_t getGlobalNumCols() const
The global number of columns in this matrix.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:307
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:535
virtual bool isFillComplete() const
true if fillComplete() has been called, else false.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:414
virtual bool isGloballyIndexed() const
Whether this matrix is globally indexed.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:407
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:251
virtual bool hasColMap() const
Whether this matrix has a column Map.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:393
virtual Teuchos::RCP< node_type > getNode() const
The matrix's Node instance.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:243
virtual size_t getNodeNumEntries() const
The number of entries in this matrix owned by the calling process.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:343
virtual void getLocalRowView(local_ordinal_type LocalRow, Teuchos::ArrayView< const local_ordinal_type > &indices, Teuchos::ArrayView< const scalar_type > &values) const
Extract a const, non-persisting view of local indices in a specified row of the matrix.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:484
virtual void getLocalRowCopy(local_ordinal_type LocalRow, const Teuchos::ArrayView< local_ordinal_type > &Indices, const Teuchos::ArrayView< scalar_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:444
virtual bool supportsRowViews() const
true if row views are supported, else false.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:680
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:321
virtual size_t getGlobalMaxNumRowEntries() const
The maximum number of entries in any row on any process.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:379
~OverlappingRowMatrix()
Destructor.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:230
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:544
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:386
OverlappingRowMatrix(const Teuchos::RCP< const row_matrix_type > &A, const int overlapLevel)
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:57
virtual size_t getNodeNumRows() const
The number of rows owned by the calling process.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:314
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:561
Preconditioners and smoothers for Tpetra sparse matrices.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:72
virtual global_size_t getGlobalNumEntries() const
The global number of entries in this matrix.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:336
virtual void getGlobalRowCopy(global_ordinal_type GlobalRow, const Teuchos::ArrayView< global_ordinal_type > &Indices, const Teuchos::ArrayView< scalar_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:423
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:366
virtual global_ordinal_type getIndexBase() const
The index base for global indices for this matrix.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:329
virtual global_size_t getGlobalNumRows() const
The global number of rows in this matrix.
Definition: Ifpack2_OverlappingRowMatrix_def.hpp:300
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:502