55 #ifndef IFPACK2_ADDITIVESCHWARZ_DEF_HPP 56 #define IFPACK2_ADDITIVESCHWARZ_DEF_HPP 58 #include "Trilinos_Details_LinearSolverFactory.hpp" 62 #include "Ifpack2_Details_LinearSolver.hpp" 64 #if defined(HAVE_IFPACK2_XPETRA) && defined(HAVE_IFPACK2_ZOLTAN2) 65 #include "Xpetra_RowMatrix.hpp" 66 #include "Xpetra_TpetraRowMatrix.hpp" 67 #include "Zoltan2_XpetraRowMatrixAdapter.hpp" 68 #include "Zoltan2_OrderingProblem.hpp" 69 #include "Zoltan2_OrderingSolution.hpp" 73 #include "Ifpack2_LocalFilter.hpp" 74 #include "Ifpack2_OverlappingRowMatrix.hpp" 75 #include "Ifpack2_Parameters.hpp" 76 #include "Ifpack2_ReorderFilter.hpp" 77 #include "Ifpack2_SingletonFilter.hpp" 80 #include "Teuchos_DefaultMpiComm.hpp" 83 #include "Teuchos_StandardParameterEntryValidators.hpp" 100 template<
class MatrixType,
class LocalInverseType>
102 AdditiveSchwarz<MatrixType, LocalInverseType>::hasInnerPrecName ()
const 104 const char* options[4] = {
105 "inner preconditioner name",
106 "subdomain solver name",
107 "schwarz: inner preconditioner name",
108 "schwarz: subdomain solver name" 110 const int numOptions = 4;
112 for (
int k = 0; k < numOptions && ! match; ++k) {
113 if (List_.isParameter (options[k])) {
121 template<
class MatrixType,
class LocalInverseType>
123 AdditiveSchwarz<MatrixType, LocalInverseType>::removeInnerPrecName ()
125 const char* options[4] = {
126 "inner preconditioner name",
127 "subdomain solver name",
128 "schwarz: inner preconditioner name",
129 "schwarz: subdomain solver name" 131 const int numOptions = 4;
132 for (
int k = 0; k < numOptions; ++k) {
133 List_.remove (options[k],
false);
138 template<
class MatrixType,
class LocalInverseType>
140 AdditiveSchwarz<MatrixType, LocalInverseType>::innerPrecName ()
const 142 const char* options[4] = {
143 "inner preconditioner name",
144 "subdomain solver name",
145 "schwarz: inner preconditioner name",
146 "schwarz: subdomain solver name" 148 const int numOptions = 4;
153 for (
int k = 0; k < numOptions && ! match; ++k) {
154 if (List_.isParameter (options[k])) {
160 newName = List_.get<std::string> (options[k]);
165 return match ? newName : defaultInnerPrecName ();
169 template<
class MatrixType,
class LocalInverseType>
171 AdditiveSchwarz<MatrixType, LocalInverseType>::removeInnerPrecParams ()
173 const char* options[4] = {
174 "inner preconditioner parameters",
175 "subdomain solver parameters",
176 "schwarz: inner preconditioner parameters",
177 "schwarz: subdomain solver parameters" 179 const int numOptions = 4;
182 for (
int k = 0; k < numOptions; ++k) {
183 List_.remove (options[k],
false);
188 template<
class MatrixType,
class LocalInverseType>
189 std::pair<Teuchos::ParameterList, bool>
190 AdditiveSchwarz<MatrixType, LocalInverseType>::innerPrecParams ()
const 192 const char* options[4] = {
193 "inner preconditioner parameters",
194 "subdomain solver parameters",
195 "schwarz: inner preconditioner parameters",
196 "schwarz: subdomain solver parameters" 198 const int numOptions = 4;
199 Teuchos::ParameterList params;
203 for (
int k = 0; k < numOptions && ! match; ++k) {
204 if (List_.isSublist (options[k])) {
205 params = List_.sublist (options[k]);
210 return std::make_pair (params, match);
214 template<
class MatrixType,
class LocalInverseType>
216 AdditiveSchwarz<MatrixType, LocalInverseType>::defaultInnerPrecName ()
224 template<
class MatrixType,
class LocalInverseType>
228 IsInitialized_ (false),
230 IsOverlapping_ (false),
232 CombineMode_ (Tpetra::ZERO),
233 UseReordering_ (false),
234 ReorderingAlgorithm_ (
"none"),
235 FilterSingletons_ (false),
237 ZeroStartingSolution_(true),
241 InitializeTime_ (0.0),
245 Teuchos::ParameterList plist;
249 template<
class MatrixType,
class LocalInverseType>
252 const int overlapLevel) :
254 IsInitialized_ (false),
256 IsOverlapping_ (false),
257 OverlapLevel_ (overlapLevel),
258 CombineMode_ (Tpetra::ZERO),
259 UseReordering_ (false),
260 ReorderingAlgorithm_ (
"none"),
261 FilterSingletons_ (false),
263 ZeroStartingSolution_(true),
267 InitializeTime_ (0.0),
271 Teuchos::ParameterList plist;
276 template<
class MatrixType,
class LocalInverseType>
280 template<
class MatrixType,
class LocalInverseType>
281 Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type > >
284 TEUCHOS_TEST_FOR_EXCEPTION(
285 Matrix_.is_null (), std::runtime_error,
"Ifpack2::AdditiveSchwarz::" 286 "getDomainMap: The matrix to precondition is null. You must either pass " 287 "a nonnull matrix to the constructor, or call setMatrix() with a nonnull " 288 "input, before you may call this method.");
289 return Matrix_->getDomainMap ();
293 template<
class MatrixType,
class LocalInverseType>
294 Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type> >
297 TEUCHOS_TEST_FOR_EXCEPTION(
298 Matrix_.is_null (), std::runtime_error,
"Ifpack2::AdditiveSchwarz::" 299 "getRangeMap: The matrix to precondition is null. You must either pass " 300 "a nonnull matrix to the constructor, or call setMatrix() with a nonnull " 301 "input, before you may call this method.");
302 return Matrix_->getRangeMap ();
306 template<
class MatrixType,
class LocalInverseType>
313 template<
class MatrixType,
class LocalInverseType>
316 apply (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &B,
317 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &Y,
318 Teuchos::ETransp mode,
323 using Teuchos::TimeMonitor;
326 using Teuchos::rcp_dynamic_cast;
327 typedef Teuchos::ScalarTraits<scalar_type> STS;
328 const char prefix[] =
"Ifpack2::AdditiveSchwarz::apply: ";
330 TEUCHOS_TEST_FOR_EXCEPTION
331 (! IsComputed_, std::runtime_error,
332 prefix <<
"isComputed() must be true before you may call apply().");
333 TEUCHOS_TEST_FOR_EXCEPTION
334 (Matrix_.is_null (), std::logic_error, prefix <<
335 "The input matrix A is null, but the preconditioner says that it has " 336 "been computed (isComputed() is true). This should never happen, since " 337 "setMatrix() should always mark the preconditioner as not computed if " 338 "its argument is null. " 339 "Please report this bug to the Ifpack2 developers.");
340 TEUCHOS_TEST_FOR_EXCEPTION
341 (Inverse_.is_null (), std::runtime_error,
342 prefix <<
"The subdomain solver is null. " 343 "This can only happen if you called setInnerPreconditioner() with a null " 344 "input, after calling initialize() or compute(). If you choose to call " 345 "setInnerPreconditioner() with a null input, you must then call it with " 346 "a nonnull input before you may call initialize() or compute().");
347 TEUCHOS_TEST_FOR_EXCEPTION
348 (B.getNumVectors() != Y.getNumVectors(), std::invalid_argument,
349 prefix <<
"B and Y must have the same number of columns. B has " <<
350 B.getNumVectors () <<
" columns, but Y has " << Y.getNumVectors() <<
".");
351 TEUCHOS_TEST_FOR_EXCEPTION
352 (IsOverlapping_ && OverlappingMatrix_.is_null (), std::logic_error,
353 prefix <<
"The overlapping matrix is null. " 354 "This should never happen if IsOverlapping_ is true. " 355 "Please report this bug to the Ifpack2 developers.");
356 TEUCHOS_TEST_FOR_EXCEPTION
357 (! IsOverlapping_ && localMap_.is_null (), std::logic_error,
358 prefix <<
"localMap_ is null. " 359 "This should never happen if IsOverlapping_ is false. " 360 "Please report this bug to the Ifpack2 developers.");
361 TEUCHOS_TEST_FOR_EXCEPTION
362 (alpha != STS::one (), std::logic_error,
363 prefix <<
"Not implemented for alpha != 1.");
364 TEUCHOS_TEST_FOR_EXCEPTION
365 (beta != STS::zero (), std::logic_error,
366 prefix <<
"Not implemented for beta != 0.");
368 #ifdef HAVE_IFPACK2_DEBUG 371 typedef Teuchos::ScalarTraits<magnitude_type> STM;
372 Teuchos::Array<magnitude_type> norms (B.getNumVectors ());
375 for (
size_t j = 0; j < B.getNumVectors (); ++j) {
376 if (STM::isnaninf (norms[j])) {
381 TEUCHOS_TEST_FOR_EXCEPTION
382 (! good, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 383 "The 2-norm of the input B is NaN or Inf.");
385 #endif // HAVE_IFPACK2_DEBUG 387 #ifdef HAVE_IFPACK2_DEBUG 388 if (! ZeroStartingSolution_) {
390 typedef Teuchos::ScalarTraits<magnitude_type> STM;
391 Teuchos::Array<magnitude_type> norms (Y.getNumVectors ());
394 for (
size_t j = 0; j < Y.getNumVectors (); ++j) {
395 if (STM::isnaninf (norms[j])) {
400 TEUCHOS_TEST_FOR_EXCEPTION
401 (! good, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 402 "On input, the initial guess Y has 2-norm NaN or Inf " 403 "(ZeroStartingSolution_ is false).");
405 #endif // HAVE_IFPACK2_DEBUG 407 const std::string timerName (
"Ifpack2::AdditiveSchwarz::apply");
408 RCP<Time> timer = TimeMonitor::lookupCounter (timerName);
409 if (timer.is_null ()) {
410 timer = TimeMonitor::getNewCounter (timerName);
414 TimeMonitor timeMon (*timer);
416 const scalar_type ZERO = Teuchos::ScalarTraits<scalar_type>::zero ();
418 const size_t numVectors = B.getNumVectors ();
422 if (ZeroStartingSolution_) {
427 RCP<MV> OverlappingB,OverlappingY;
428 RCP<MV> globalOverlappingB;
429 if (IsOverlapping_) {
431 OverlappingB = rcp (
new MV (OverlappingMatrix_->getRowMap (), numVectors));
432 OverlappingY = rcp (
new MV (OverlappingMatrix_->getRowMap (), numVectors));
441 OverlappingB = rcp (
new MV (localMap_, numVectors));
442 OverlappingY = rcp (
new MV (localMap_, numVectors));
445 OverlappingB->offsetViewNonConst (Matrix_->getRowMap (), 0);
448 if (DistributedImporter_.is_null ()) {
452 DistributedImporter_ =
453 rcp (
new import_type (Matrix_->getRowMap (),
454 Matrix_->getDomainMap ()));
458 RCP<MV> R = rcp(
new MV(B.getMap(),numVectors));
459 RCP<MV> C = rcp(
new MV(Y.getMap(),numVectors));
461 for (
int ni=0; ni<NumIterations_; ++ni)
463 #ifdef HAVE_IFPACK2_DEBUG 466 typedef Teuchos::ScalarTraits<magnitude_type> STM;
467 Teuchos::Array<magnitude_type> norms (Y.getNumVectors ());
471 j < Y.getNumVectors (); ++j) {
472 if (STM::isnaninf (norms[j])) {
477 TEUCHOS_TEST_FOR_EXCEPTION
478 (! good, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 479 "At top of iteration " << ni <<
", the 2-norm of Y is NaN or Inf.");
481 #endif // HAVE_IFPACK2_DEBUG 483 Tpetra::deep_copy(*R, B);
488 if (!ZeroStartingSolution_ || ni > 0) {
490 Matrix_->apply (Y, *R, mode, -STS::one(), STS::one());
492 #ifdef HAVE_IFPACK2_DEBUG 495 typedef Teuchos::ScalarTraits<magnitude_type> STM;
496 Teuchos::Array<magnitude_type> norms (R->getNumVectors ());
499 for (
size_t j = 0; j < R->getNumVectors (); ++j) {
500 if (STM::isnaninf (norms[j])) {
505 TEUCHOS_TEST_FOR_EXCEPTION
506 (! good, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 507 "At iteration " << ni <<
", the 2-norm of R (result of computing " 508 "residual with Y) is NaN or Inf.");
510 #endif // HAVE_IFPACK2_DEBUG 514 RCP<overlap_mat_type> overlapMatrix;
515 if (IsOverlapping_) {
516 overlapMatrix = rcp_dynamic_cast<overlap_mat_type> (OverlappingMatrix_);
517 TEUCHOS_TEST_FOR_EXCEPTION
518 (overlapMatrix.is_null (), std::logic_error, prefix <<
519 "IsOverlapping_ is true, but OverlappingMatrix_, while nonnull, is " 520 "not an OverlappingRowMatrix<row_matrix_type>. Please report this " 521 "bug to the Ifpack2 developers.");
525 if (IsOverlapping_) {
526 TEUCHOS_TEST_FOR_EXCEPTION
527 (overlapMatrix.is_null (), std::logic_error, prefix
528 <<
"overlapMatrix is null when it shouldn't be. " 529 "Please report this bug to the Ifpack2 developers.");
530 overlapMatrix->importMultiVector (*R, *OverlappingB, Tpetra::INSERT);
547 #ifdef HAVE_IFPACK2_DEBUG 550 typedef Teuchos::ScalarTraits<magnitude_type> STM;
551 Teuchos::Array<magnitude_type> norms (OverlappingB->getNumVectors ());
552 OverlappingB->norm2 (norms ());
555 j < OverlappingB->getNumVectors (); ++j) {
556 if (STM::isnaninf (norms[j])) {
561 TEUCHOS_TEST_FOR_EXCEPTION
562 (! good, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 563 "At iteration " << ni <<
", result of importMultiVector from R " 564 "to OverlappingB, has 2-norm NaN or Inf.");
566 #endif // HAVE_IFPACK2_DEBUG 568 globalOverlappingB->doImport (*R, *DistributedImporter_, Tpetra::INSERT);
570 #ifdef HAVE_IFPACK2_DEBUG 573 typedef Teuchos::ScalarTraits<magnitude_type> STM;
574 Teuchos::Array<magnitude_type> norms (globalOverlappingB->getNumVectors ());
575 globalOverlappingB->norm2 (norms ());
578 j < globalOverlappingB->getNumVectors (); ++j) {
579 if (STM::isnaninf (norms[j])) {
584 TEUCHOS_TEST_FOR_EXCEPTION
585 (! good, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 586 "At iteration " << ni <<
", result of doImport from R, has 2-norm " 589 #endif // HAVE_IFPACK2_DEBUG 592 #ifdef HAVE_IFPACK2_DEBUG 595 typedef Teuchos::ScalarTraits<magnitude_type> STM;
596 Teuchos::Array<magnitude_type> norms (OverlappingB->getNumVectors ());
597 OverlappingB->norm2 (norms ());
600 j < OverlappingB->getNumVectors (); ++j) {
601 if (STM::isnaninf (norms[j])) {
606 TEUCHOS_TEST_FOR_EXCEPTION
607 (! good, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 608 "At iteration " << ni <<
", right before localApply, the 2-norm of " 609 "OverlappingB is NaN or Inf.");
611 #endif // HAVE_IFPACK2_DEBUG 614 localApply(*OverlappingB, *OverlappingY);
616 #ifdef HAVE_IFPACK2_DEBUG 619 typedef Teuchos::ScalarTraits<magnitude_type> STM;
620 Teuchos::Array<magnitude_type> norms (OverlappingY->getNumVectors ());
621 OverlappingY->norm2 (norms ());
624 j < OverlappingY->getNumVectors (); ++j) {
625 if (STM::isnaninf (norms[j])) {
630 TEUCHOS_TEST_FOR_EXCEPTION
631 (! good, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 632 "At iteration " << ni <<
", after localApply and before export / " 633 "copy, the 2-norm of OverlappingY is NaN or Inf.");
635 #endif // HAVE_IFPACK2_DEBUG 637 #ifdef HAVE_IFPACK2_DEBUG 640 typedef Teuchos::ScalarTraits<magnitude_type> STM;
641 Teuchos::Array<magnitude_type> norms (C->getNumVectors ());
645 j < C->getNumVectors (); ++j) {
646 if (STM::isnaninf (norms[j])) {
651 TEUCHOS_TEST_FOR_EXCEPTION
652 (! good, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 653 "At iteration " << ni <<
", before export / copy, the 2-norm of C " 656 #endif // HAVE_IFPACK2_DEBUG 659 if (IsOverlapping_) {
660 TEUCHOS_TEST_FOR_EXCEPTION
661 (overlapMatrix.is_null (), std::logic_error, prefix
662 <<
"overlapMatrix is null when it shouldn't be. " 663 "Please report this bug to the Ifpack2 developers.");
664 overlapMatrix->exportMultiVector (*OverlappingY, *C, CombineMode_);
673 RCP<MV> C_view = C->offsetViewNonConst (OverlappingY->getMap (), 0);
674 Tpetra::deep_copy (*C_view, *OverlappingY);
677 #ifdef HAVE_IFPACK2_DEBUG 680 typedef Teuchos::ScalarTraits<magnitude_type> STM;
681 Teuchos::Array<magnitude_type> norms (C->getNumVectors ());
685 j < C->getNumVectors (); ++j) {
686 if (STM::isnaninf (norms[j])) {
691 TEUCHOS_TEST_FOR_EXCEPTION
692 (! good, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 693 "At iteration " << ni <<
", before Y := C + Y, the 2-norm of C " 696 #endif // HAVE_IFPACK2_DEBUG 698 #ifdef HAVE_IFPACK2_DEBUG 701 typedef Teuchos::ScalarTraits<magnitude_type> STM;
702 Teuchos::Array<magnitude_type> norms (Y.getNumVectors ());
706 j < Y.getNumVectors (); ++j) {
707 if (STM::isnaninf (norms[j])) {
712 TEUCHOS_TEST_FOR_EXCEPTION
713 (! good, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 714 "Before Y := C + Y, at iteration " << ni <<
", the 2-norm of Y " 717 #endif // HAVE_IFPACK2_DEBUG 719 Y.update(STS::one(), *C, STS::one());
721 #ifdef HAVE_IFPACK2_DEBUG 724 typedef Teuchos::ScalarTraits<magnitude_type> STM;
725 Teuchos::Array<magnitude_type> norms (Y.getNumVectors ());
728 for (
size_t j = 0; j < Y.getNumVectors (); ++j) {
729 if (STM::isnaninf (norms[j])) {
734 TEUCHOS_TEST_FOR_EXCEPTION
735 ( ! good, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 736 "At iteration " << ni <<
", after Y := C + Y, the 2-norm of Y " 739 #endif // HAVE_IFPACK2_DEBUG 744 #ifdef HAVE_IFPACK2_DEBUG 747 typedef Teuchos::ScalarTraits<magnitude_type> STM;
748 Teuchos::Array<magnitude_type> norms (Y.getNumVectors ());
751 for (
size_t j = 0; j < Y.getNumVectors (); ++j) {
752 if (STM::isnaninf (norms[j])) {
757 TEUCHOS_TEST_FOR_EXCEPTION
758 ( ! good, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 759 "The 2-norm of the output Y is NaN or Inf.");
761 #endif // HAVE_IFPACK2_DEBUG 767 ApplyTime_ = timer->totalElapsedTime ();
770 template<
class MatrixType,
class LocalInverseType>
773 localApply(MV &OverlappingB, MV &OverlappingY)
const 776 using Teuchos::rcp_dynamic_cast;
778 const size_t numVectors = OverlappingB.getNumVectors ();
779 if (FilterSingletons_) {
781 MV ReducedB (SingletonMatrix_->getRowMap (), numVectors);
782 MV ReducedY (SingletonMatrix_->getRowMap (), numVectors);
784 RCP<SingletonFilter<row_matrix_type> > singletonFilter =
786 TEUCHOS_TEST_FOR_EXCEPTION
787 (! SingletonMatrix_.is_null () && singletonFilter.is_null (),
788 std::logic_error,
"Ifpack2::AdditiveSchwarz::localApply: " 789 "SingletonFilter_ is nonnull but is not a SingletonFilter" 790 "<row_matrix_type>. This should never happen. Please report this bug " 791 "to the Ifpack2 developers.");
793 singletonFilter->CreateReducedRHS (OverlappingY, OverlappingB, ReducedB);
796 if (! UseReordering_) {
797 Inverse_->solve (ReducedY, ReducedB);
800 RCP<ReorderFilter<row_matrix_type> > rf =
802 TEUCHOS_TEST_FOR_EXCEPTION
803 (! ReorderedLocalizedMatrix_.is_null () && rf.is_null (), std::logic_error,
804 "Ifpack2::AdditiveSchwarz::localApply: ReorderedLocalizedMatrix_ is " 805 "nonnull but is not a ReorderFilter<row_matrix_type>. This should " 806 "never happen. Please report this bug to the Ifpack2 developers.");
807 MV ReorderedB (ReducedB, Teuchos::Copy);
808 MV ReorderedY (ReducedY, Teuchos::Copy);
809 rf->permuteOriginalToReordered (ReducedB, ReorderedB);
810 Inverse_->solve (ReorderedY, ReorderedB);
811 rf->permuteReorderedToOriginal (ReorderedY, ReducedY);
815 singletonFilter->UpdateLHS (ReducedY, OverlappingY);
820 if (! UseReordering_) {
821 Inverse_->solve (OverlappingY, OverlappingB);
824 MV ReorderedB (OverlappingB, Teuchos::Copy);
825 MV ReorderedY (OverlappingY, Teuchos::Copy);
827 RCP<ReorderFilter<row_matrix_type> > rf =
829 TEUCHOS_TEST_FOR_EXCEPTION
830 (! ReorderedLocalizedMatrix_.is_null () && rf.is_null (), std::logic_error,
831 "Ifpack2::AdditiveSchwarz::localApply: ReorderedLocalizedMatrix_ is " 832 "nonnull but is not a ReorderFilter<row_matrix_type>. This should " 833 "never happen. Please report this bug to the Ifpack2 developers.");
835 Inverse_->solve (ReorderedY, ReorderedB);
836 rf->permuteReorderedToOriginal (ReorderedY, OverlappingY);
842 template<
class MatrixType,
class LocalInverseType>
855 template<
class MatrixType,
class LocalInverseType>
859 using Tpetra::CombineMode;
860 using Teuchos::getIntegralValue;
861 using Teuchos::ParameterEntry;
862 using Teuchos::ParameterEntryValidator;
863 using Teuchos::ParameterList;
866 using Teuchos::rcp_dynamic_cast;
867 using Teuchos::StringToIntegralParameterEntryValidator;
869 if (plist.is_null ()) {
878 TEUCHOS_TEST_FOR_EXCEPTION(
879 plist.is_null (), std::logic_error,
"Ifpack2::AdditiveSchwarz::" 880 "setParameterList: plist is null. This should never happen, since the " 881 "method should have replaced a null input list with a nonnull empty list " 882 "by this point. Please report this bug to the Ifpack2 developers.");
903 bool gotCombineMode =
false;
905 CombineMode_ = getIntegralValue<Tpetra::CombineMode> (List_,
"schwarz: combine mode");
906 gotCombineMode =
true;
908 catch (Teuchos::Exceptions::InvalidParameterName&) {
911 gotCombineMode =
true;
913 catch (Teuchos::Exceptions::InvalidParameterType&) {
920 if (! gotCombineMode) {
922 CombineMode_ = plist->get (
"schwarz: combine mode", CombineMode_);
923 gotCombineMode =
true;
925 catch (Teuchos::Exceptions::InvalidParameterType&) {}
931 if (! gotCombineMode) {
932 const ParameterEntry& validEntry =
934 RCP<const ParameterEntryValidator> v = validEntry.validator ();
935 typedef StringToIntegralParameterEntryValidator<CombineMode> vs2e_type;
936 RCP<const vs2e_type> vs2e = rcp_dynamic_cast<
const vs2e_type> (v,
true);
938 const ParameterEntry& inputEntry = plist->getEntry (
"schwarz: combine mode");
939 CombineMode_ = vs2e->getIntegralValue (inputEntry,
"schwarz: combine mode");
940 gotCombineMode =
true;
942 (void) gotCombineMode;
944 OverlapLevel_ = plist->get (
"schwarz: overlap level", OverlapLevel_);
950 UseReordering_ = plist->get (
"schwarz: use reordering", UseReordering_);
952 #if !defined(HAVE_IFPACK2_XPETRA) || !defined(HAVE_IFPACK2_ZOLTAN2) 953 TEUCHOS_TEST_FOR_EXCEPTION(
954 UseReordering_, std::invalid_argument,
"Ifpack2::AdditiveSchwarz::" 955 "setParameters: You specified \"schwarz: use reordering\" = true. " 956 "This is only valid when Trilinos was built with Ifpack2, Xpetra, and " 957 "Zoltan2 enabled. Either Xpetra or Zoltan2 was not enabled in your build " 969 FilterSingletons_ = plist->get (
"schwarz: filter singletons", FilterSingletons_);
1004 if (! Inverse_.is_null ()) {
1007 if (hasInnerPrecName () && innerPrecName () !=
"CUSTOM") {
1010 Inverse_ = Teuchos::null;
1015 std::pair<Teuchos::ParameterList, bool> result = innerPrecParams ();
1016 if (result.second) {
1019 Inverse_->setParameters (rcp (
new ParameterList (result.first)));
1024 NumIterations_ = plist->get<
int>(
"schwarz: num iterations", NumIterations_);
1025 ZeroStartingSolution_ = plist->get<
bool>(
"schwarz: zero starting solution", ZeroStartingSolution_);
1030 template<
class MatrixType,
class LocalInverseType>
1031 Teuchos::RCP<const Teuchos::ParameterList>
1035 using Teuchos::ParameterList;
1036 using Teuchos::parameterList;
1038 using Teuchos::rcp_const_cast;
1040 if (validParams_.is_null ()) {
1041 const int overlapLevel = 0;
1042 const bool useReordering =
false;
1043 const bool filterSingletons =
false;
1044 const int numIterations = 1;
1045 const bool zeroStartingSolution =
true;
1046 ParameterList reorderingSublist;
1047 reorderingSublist.set (
"order_method", std::string (
"rcm"));
1049 RCP<ParameterList> plist = parameterList (
"Ifpack2::AdditiveSchwarz");
1051 Tpetra::setCombineModeParameter (*plist,
"schwarz: combine mode");
1052 plist->set (
"schwarz: overlap level", overlapLevel);
1053 plist->set (
"schwarz: use reordering", useReordering);
1054 plist->set (
"schwarz: reordering list", reorderingSublist);
1057 plist->set (
"schwarz: compute condest",
false);
1058 plist->set (
"schwarz: filter singletons", filterSingletons);
1059 plist->set (
"schwarz: num iterations", numIterations);
1060 plist->set (
"schwarz: zero starting solution", zeroStartingSolution);
1070 validParams_ = rcp_const_cast<
const ParameterList> (plist);
1072 return validParams_;
1076 template<
class MatrixType,
class LocalInverseType>
1079 using Tpetra::global_size_t;
1082 using Teuchos::SerialComm;
1083 using Teuchos::Time;
1084 using Teuchos::TimeMonitor;
1086 const std::string timerName (
"Ifpack2::AdditiveSchwarz::initialize");
1087 RCP<Time> timer = TimeMonitor::lookupCounter (timerName);
1088 if (timer.is_null ()) {
1089 timer = TimeMonitor::getNewCounter (timerName);
1093 TimeMonitor timeMon (*timer);
1095 TEUCHOS_TEST_FOR_EXCEPTION(
1096 Matrix_.is_null (), std::runtime_error,
"Ifpack2::AdditiveSchwarz::" 1097 "initialize: The matrix to precondition is null. You must either pass " 1098 "a nonnull matrix to the constructor, or call setMatrix() with a nonnull " 1099 "input, before you may call this method.");
1101 IsInitialized_ =
false;
1102 IsComputed_ =
false;
1104 RCP<const Teuchos::Comm<int> > comm = Matrix_->getComm ();
1105 RCP<const map_type> rowMap = Matrix_->getRowMap ();
1106 RCP<node_type> node = Matrix_->getNode ();
1107 const global_size_t INVALID =
1108 Teuchos::OrdinalTraits<global_size_t>::invalid ();
1112 if (comm->getSize () == 1) {
1114 IsOverlapping_ =
false;
1115 }
else if (OverlapLevel_ != 0) {
1116 IsOverlapping_ =
true;
1119 if (OverlapLevel_ == 0) {
1121 RCP<const SerialComm<int> > localComm (
new SerialComm<int> ());
1125 rcp (
new map_type (INVALID, rowMap->getNodeNumElements (),
1126 indexBase, localComm, node));
1130 if (IsOverlapping_) {
1136 if (! Inverse_.is_null ()) {
1137 Inverse_->symbolic ();
1142 IsInitialized_ =
true;
1147 InitializeTime_ = timer->totalElapsedTime ();
1151 template<
class MatrixType,
class LocalInverseType>
1154 return IsInitialized_;
1158 template<
class MatrixType,
class LocalInverseType>
1162 using Teuchos::Time;
1163 using Teuchos::TimeMonitor;
1165 if (! IsInitialized_) {
1169 TEUCHOS_TEST_FOR_EXCEPTION(
1170 !
isInitialized (), std::logic_error,
"Ifpack2::AdditiveSchwarz::compute: " 1171 "The preconditioner is not yet initialized, " 1172 "even though initialize() supposedly has been called. " 1173 "This should never happen. " 1174 "Please report this bug to the Ifpack2 developers.");
1176 TEUCHOS_TEST_FOR_EXCEPTION(
1177 Inverse_.is_null (), std::runtime_error,
1178 "Ifpack2::AdditiveSchwarz::compute: The subdomain solver is null. " 1179 "This can only happen if you called setInnerPreconditioner() with a null " 1180 "input, after calling initialize() or compute(). If you choose to call " 1181 "setInnerPreconditioner() with a null input, you must then call it with a " 1182 "nonnull input before you may call initialize() or compute().");
1184 const std::string timerName (
"Ifpack2::AdditiveSchwarz::compute");
1185 RCP<Time> timer = TimeMonitor::lookupCounter (timerName);
1186 if (timer.is_null ()) {
1187 timer = TimeMonitor::getNewCounter (timerName);
1191 TimeMonitor timeMon (*timer);
1193 IsComputed_ =
false;
1194 Inverse_->numeric ();
1202 ComputeTime_ = timer->totalElapsedTime ();
1207 template<
class MatrixType,
class LocalInverseType>
1214 template<
class MatrixType,
class LocalInverseType>
1217 return NumInitialize_;
1221 template<
class MatrixType,
class LocalInverseType>
1228 template<
class MatrixType,
class LocalInverseType>
1235 template<
class MatrixType,
class LocalInverseType>
1238 return InitializeTime_;
1242 template<
class MatrixType,
class LocalInverseType>
1245 return ComputeTime_;
1249 template<
class MatrixType,
class LocalInverseType>
1256 template<
class MatrixType,
class LocalInverseType>
1259 std::ostringstream out;
1261 out <<
"\"Ifpack2::AdditiveSchwarz\": {";
1262 if (this->getObjectLabel () !=
"") {
1263 out <<
"Label: \"" << this->getObjectLabel () <<
"\", ";
1265 out <<
"Initialized: " << (
isInitialized () ?
"true" :
"false")
1266 <<
", Computed: " << (
isComputed () ?
"true" :
"false")
1267 <<
", Iterations: " << NumIterations_
1268 <<
", Overlap level: " << OverlapLevel_
1269 <<
", Subdomain reordering: \"" << ReorderingAlgorithm_ <<
"\"";
1270 out <<
", Combine mode: \"";
1271 if (CombineMode_ == Tpetra::INSERT) {
1273 }
else if (CombineMode_ == Tpetra::ADD) {
1275 }
else if (CombineMode_ == Tpetra::REPLACE) {
1277 }
else if (CombineMode_ == Tpetra::ABSMAX) {
1279 }
else if (CombineMode_ == Tpetra::ZERO) {
1283 if (Matrix_.is_null ()) {
1284 out <<
", Matrix: null";
1287 out <<
", Global matrix dimensions: [" 1288 << Matrix_->getGlobalNumRows () <<
", " 1289 << Matrix_->getGlobalNumCols () <<
"]";
1291 out <<
", Inner solver: ";
1292 if (! Inverse_.is_null ()) {
1293 Teuchos::RCP<Teuchos::Describable> inv =
1294 Teuchos::rcp_dynamic_cast<Teuchos::Describable> (Inverse_);
1295 if (! inv.is_null ()) {
1296 out <<
"{" << inv->description () <<
"}";
1298 out <<
"{" <<
"Some inner solver" <<
"}";
1309 template<
class MatrixType,
class LocalInverseType>
1313 const Teuchos::EVerbosityLevel verbLevel)
const 1315 using Teuchos::OSTab;
1316 using Teuchos::TypeNameTraits;
1319 const int myRank = Matrix_->getComm ()->getRank ();
1320 const int numProcs = Matrix_->getComm ()->getSize ();
1321 const Teuchos::EVerbosityLevel vl =
1322 (verbLevel == Teuchos::VERB_DEFAULT) ? Teuchos::VERB_LOW : verbLevel;
1324 if (vl > Teuchos::VERB_NONE) {
1328 out <<
"\"Ifpack2::AdditiveSchwarz\":";
1332 out <<
"MatrixType: " << TypeNameTraits<MatrixType>::name () << endl;
1333 out <<
"LocalInverseType: " << TypeNameTraits<LocalInverseType>::name () << endl;
1334 if (this->getObjectLabel () !=
"") {
1335 out <<
"Label: \"" << this->getObjectLabel () <<
"\"" << endl;
1338 out <<
"Overlap level: " << OverlapLevel_ << endl
1339 <<
"Combine mode: \"";
1340 if (CombineMode_ == Tpetra::INSERT) {
1342 }
else if (CombineMode_ == Tpetra::ADD) {
1344 }
else if (CombineMode_ == Tpetra::REPLACE) {
1346 }
else if (CombineMode_ == Tpetra::ABSMAX) {
1348 }
else if (CombineMode_ == Tpetra::ZERO) {
1352 <<
"Subdomain reordering: \"" << ReorderingAlgorithm_ <<
"\"" << endl;
1355 if (Matrix_.is_null ()) {
1357 out <<
"Matrix: null" << endl;
1362 out <<
"Matrix:" << endl;
1365 Matrix_->getComm ()->barrier ();
1366 Matrix_->describe (out, Teuchos::VERB_LOW);
1372 <<
"Number of apply calls: " <<
getNumApply () << endl
1374 <<
"Total time in seconds for compute: " <<
getComputeTime () << endl
1375 <<
"Total time in seconds for apply: " <<
getApplyTime () << endl;
1378 if (Inverse_.is_null ()) {
1380 out <<
"Subdomain solver: null" << endl;
1384 if (vl < Teuchos::VERB_EXTREME) {
1386 out <<
"Subdomain solver: not null" << endl;
1390 for (
int p = 0; p < numProcs; ++p) {
1392 out <<
"Subdomain solver on Process " << myRank <<
":";
1393 if (Inverse_.is_null ()) {
1394 out <<
"null" << endl;
1396 Teuchos::RCP<Teuchos::Describable> inv =
1397 Teuchos::rcp_dynamic_cast<Teuchos::Describable> (Inverse_);
1398 if (! inv.is_null ()) {
1400 inv->describe (out, vl);
1402 out <<
"null" << endl;
1406 Matrix_->getComm ()->barrier ();
1407 Matrix_->getComm ()->barrier ();
1408 Matrix_->getComm ()->barrier ();
1413 Matrix_->getComm ()->barrier ();
1418 template<
class MatrixType,
class LocalInverseType>
1421 Teuchos::FancyOStream fos(Teuchos::rcp(&os,
false));
1422 fos.setOutputToRootOnly(0);
1428 template<
class MatrixType,
class LocalInverseType>
1431 return OverlapLevel_;
1435 template<
class MatrixType,
class LocalInverseType>
1439 using Teuchos::MpiComm;
1441 using Teuchos::ArrayRCP;
1442 using Teuchos::ParameterList;
1445 using Teuchos::rcp_dynamic_cast;
1446 using Teuchos::rcpFromRef;
1448 #if defined(HAVE_IFPACK2_XPETRA) && defined(HAVE_IFPACK2_ZOLTAN2) 1449 typedef Xpetra::RowMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type> XpetraMatrixType;
1450 typedef Xpetra::TpetraRowMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type> XpetraTpetraMatrixType;
1453 TEUCHOS_TEST_FOR_EXCEPTION(
1454 Matrix_.is_null (), std::runtime_error,
"Ifpack2::AdditiveSchwarz::" 1455 "initialize: The matrix to precondition is null. You must either pass " 1456 "a nonnull matrix to the constructor, or call setMatrix() with a nonnull " 1457 "input, before you may call this method.");
1460 RCP<row_matrix_type> LocalizedMatrix;
1464 RCP<row_matrix_type> ActiveMatrix;
1467 if (! OverlappingMatrix_.is_null ()) {
1475 TEUCHOS_TEST_FOR_EXCEPTION(
1476 LocalizedMatrix.is_null (), std::logic_error,
1477 "Ifpack2::AdditiveSchwarz::setup: LocalizedMatrix is null, after the code " 1478 "that claimed to have created it. This should never be the case. Please " 1479 "report this bug to the Ifpack2 developers.");
1482 ActiveMatrix = LocalizedMatrix;
1485 if (FilterSingletons_) {
1487 ActiveMatrix = SingletonMatrix_;
1491 if (UseReordering_) {
1492 #if defined(HAVE_IFPACK2_XPETRA) && defined(HAVE_IFPACK2_ZOLTAN2) 1494 Teuchos::ParameterList zlist = List_.sublist (
"schwarz: reordering list");
1497 ReorderingAlgorithm_ = List_.get<std::string> (
"order_method",
"rcm");
1498 XpetraTpetraMatrixType XpetraMatrix (ActiveMatrix);
1499 typedef Zoltan2::XpetraRowMatrixAdapter<XpetraMatrixType> z2_adapter_type;
1500 z2_adapter_type Zoltan2Matrix (rcpFromRef (XpetraMatrix));
1501 typedef Zoltan2::OrderingProblem<z2_adapter_type> ordering_problem_type;
1506 RCP<const MpiComm<int> > mpicomm =
1507 rcp_dynamic_cast<
const MpiComm<int> > (ActiveMatrix->getComm ());
1508 if (mpicomm == Teuchos::null) {
1509 myRawComm = MPI_COMM_SELF;
1511 myRawComm = * (mpicomm->getRawMpiComm ());
1513 ordering_problem_type MyOrderingProblem (&Zoltan2Matrix, &zlist, myRawComm);
1515 ordering_problem_type MyOrderingProblem (&Zoltan2Matrix, &zlist);
1517 MyOrderingProblem.solve ();
1525 ordering_solution_type sol (*MyOrderingProblem.getSolution ());
1531 ArrayRCP<local_ordinal_type> perm = sol.getPermutationRCPConst (
true);
1532 ArrayRCP<local_ordinal_type> revperm = sol.getPermutationRCPConst ();
1534 ReorderedLocalizedMatrix_ =
1535 rcp (
new reorder_filter_type (ActiveMatrix, perm, revperm));
1537 ActiveMatrix = ReorderedLocalizedMatrix_;
1542 TEUCHOS_TEST_FOR_EXCEPTION(
1543 true, std::logic_error,
"Ifpack2::AdditiveSchwarz::setup: " 1544 "The Zoltan2 and Xpetra packages must be enabled in order " 1545 "to support reordering.");
1549 innerMatrix_ = ActiveMatrix;
1551 TEUCHOS_TEST_FOR_EXCEPTION(
1552 innerMatrix_.is_null (), std::logic_error,
"Ifpack2::AdditiveSchwarz::" 1553 "setup: Inner matrix is null right before constructing inner solver. " 1554 "Please report this bug to the Ifpack2 developers.");
1557 if (Inverse_.is_null ()) {
1558 const std::string innerName = innerPrecName ();
1559 TEUCHOS_TEST_FOR_EXCEPTION(
1560 innerName ==
"INVALID", std::logic_error,
1561 "Ifpack2::AdditiveSchwarz::initialize: AdditiveSchwarz doesn't " 1562 "know how to create an instance of your LocalInverseType \"" 1563 << Teuchos::TypeNameTraits<LocalInverseType>::name () <<
"\". " 1564 "Please talk to the Ifpack2 developers for details.");
1566 TEUCHOS_TEST_FOR_EXCEPTION(
1567 innerName ==
"CUSTOM", std::runtime_error,
"Ifpack2::AdditiveSchwarz::" 1568 "initialize: If the \"inner preconditioner name\" parameter (or any " 1569 "alias thereof) has the value \"CUSTOM\", then you must first call " 1570 "setInnerPreconditioner with a nonnull inner preconditioner input before " 1571 "you may call initialize().");
1575 if (! Trilinos::Details::Impl::registeredSomeLinearSolverFactory (
"Ifpack2")) {
1576 Ifpack2::Details::registerLinearSolverFactory ();
1581 typedef typename MV::mag_type MT;
1582 RCP<inner_solver_type> innerPrec =
1583 Trilinos::Details::getLinearSolver<MV, OP, MT> (
"Ifpack2", innerName);
1584 TEUCHOS_TEST_FOR_EXCEPTION(
1585 innerPrec.is_null (), std::logic_error,
1586 "Ifpack2::AdditiveSchwarz::setup: Failed to create inner preconditioner " 1587 "with name \"" << innerName <<
"\".");
1588 innerPrec->setMatrix (innerMatrix_);
1592 std::pair<Teuchos::ParameterList, bool> result = innerPrecParams ();
1593 if (result.second) {
1596 innerPrec->setParameters (rcp (
new ParameterList (result.first)));
1598 Inverse_ = innerPrec;
1600 else if (Inverse_->getMatrix ().getRawPtr () != innerMatrix_.getRawPtr ()) {
1604 Inverse_->setMatrix (innerMatrix_);
1606 TEUCHOS_TEST_FOR_EXCEPTION(
1607 Inverse_.is_null (), std::logic_error,
"Ifpack2::AdditiveSchwarz::" 1608 "setup: Inverse_ is null right after we were supposed to have created it." 1609 " Please report this bug to the Ifpack2 developers.");
1619 template<
class MatrixType,
class LocalInverseType>
1626 if (! innerPrec.is_null ()) {
1629 can_change_type* innerSolver =
dynamic_cast<can_change_type*
> (&*innerPrec);
1630 TEUCHOS_TEST_FOR_EXCEPTION(
1631 innerSolver == NULL, std::invalid_argument,
"Ifpack2::AdditiveSchwarz::" 1632 "setInnerPreconditioner: The input preconditioner does not implement the " 1633 "setMatrix() feature. Only input preconditioners that inherit from " 1634 "Ifpack2::Details::CanChangeMatrix implement this feature.");
1651 innerSolver->setMatrix (innerMatrix_);
1661 removeInnerPrecName ();
1662 removeInnerPrecParams ();
1663 List_.set (
"inner preconditioner name",
"CUSTOM");
1668 innerPrec->initialize ();
1671 innerPrec->compute ();
1684 Inverse_ = Teuchos::rcp (
new inner_solver_impl_type (innerPrec,
"CUSTOM"));
1687 template<
class MatrixType,
class LocalInverseType>
1692 if (A.getRawPtr () != Matrix_.getRawPtr ()) {
1693 IsInitialized_ =
false;
1694 IsComputed_ =
false;
1697 OverlappingMatrix_ = Teuchos::null;
1698 ReorderedLocalizedMatrix_ = Teuchos::null;
1699 innerMatrix_ = Teuchos::null;
1700 SingletonMatrix_ = Teuchos::null;
1701 localMap_ = Teuchos::null;
1702 DistributedImporter_ = Teuchos::null;
1713 #define IFPACK2_ADDITIVESCHWARZ_INSTANT(S,LO,GO,N) \ 1714 template class Ifpack2::AdditiveSchwarz< Tpetra::RowMatrix<S, LO, GO, N> >; 1716 #endif // IFPACK2_ADDITIVESCHWARZ_DECL_HPP Mix-in interface for preconditioners that can change their matrix after construction.
Definition: Ifpack2_Details_CanChangeMatrix.hpp:93
Wraps a Tpetra::RowMatrix in a filter that reorders local rows and columns.
Definition: Ifpack2_ReorderFilter_decl.hpp:69
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > &plist)
Set the preconditioner's parameters.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:857
virtual void compute()
Computes all (coefficient) data necessary to apply the preconditioner.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1159
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
Apply the preconditioner to X, putting the result in Y.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:316
virtual int getNumApply() const
Returns the number of calls to apply().
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1229
virtual bool isInitialized() const
Returns true if the preconditioner has been successfully initialized, false otherwise.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1152
virtual double getInitializeTime() const
Returns the time spent in initialize().
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1236
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1312
virtual Teuchos::RCP< const Tpetra::Map< local_ordinal_type, global_ordinal_type, node_type > > getDomainMap() const
The domain Map of this operator.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:282
MatrixType::node_type node_type
The Node type used by the input MatrixType.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:321
virtual double getComputeTime() const
Returns the time spent in compute().
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1243
virtual ~AdditiveSchwarz()
Destructor.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:277
Teuchos::ScalarTraits< scalar_type >::magnitudeType magnitude_type
The type of the magnitude (absolute value) of a matrix entry.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:324
std::string description() const
Return a simple one-line description of this object.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1257
virtual std::ostream & print(std::ostream &os) const
Prints basic information on iostream. This function is used by operator<<.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1419
AdditiveSchwarz(const Teuchos::RCP< const row_matrix_type > &A)
Constructor that takes a matrix.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:226
virtual double getApplyTime() const
Returns the time spent in apply().
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1250
virtual void initialize()
Computes all (graph-related) data necessary to initialize the preconditioner.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1077
Ifpack2 implementation details.
MatrixType::global_ordinal_type global_ordinal_type
The type of global indices in the input MatrixType.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:318
MatrixType::scalar_type scalar_type
The type of the entries of the input MatrixType.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:312
virtual void setInnerPreconditioner(const Teuchos::RCP< Preconditioner< scalar_type, local_ordinal_type, global_ordinal_type, node_type > > &innerPrec)
Set the inner preconditioner.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1621
Ifpack2's implementation of Trilinos::Details::LinearSolver interface.
Definition: Ifpack2_Details_LinearSolver_decl.hpp:105
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Get a list of the preconditioner's default parameters.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1033
Interface for all Ifpack2 preconditioners.
Definition: Ifpack2_Preconditioner.hpp:107
virtual Teuchos::RCP< const row_matrix_type > getMatrix() const
The input matrix.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:307
Declaration of interface for preconditioners that can change their matrix after construction.
virtual Teuchos::RCP< const Tpetra::Map< local_ordinal_type, global_ordinal_type, node_type > > getRangeMap() const
The range Map of this operator.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:295
virtual void setParameters(const Teuchos::ParameterList &plist)
Set the preconditioner's parameters.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:844
virtual int getNumCompute() const
Returns the number of calls to compute().
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1222
Sparse matrix (Tpetra::RowMatrix subclass) with ghost rows.
Definition: Ifpack2_OverlappingRowMatrix_decl.hpp:59
Additive Schwarz domain decomposition for Tpetra sparse matrices.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:281
virtual bool isComputed() const
Returns true if the preconditioner has been successfully computed, false otherwise.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1208
Access only local rows and columns of a sparse matrix.
Definition: Ifpack2_LocalFilter_decl.hpp:160
virtual void SolveSingletons(const Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &RHS, Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &LHS)
Solve the singleton components of the linear system.
Definition: Ifpack2_SingletonFilter_def.hpp:486
Preconditioners and smoothers for Tpetra sparse matrices.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:72
void registerLinearSolverFactory()
virtual void permuteOriginalToReordered(const Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &originalX, Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &reorderedY) const
Permute multivector: original-to-reordered.
Definition: Ifpack2_ReorderFilter_def.hpp:532
Filter based on matrix entries.
Definition: Ifpack2_SingletonFilter_decl.hpp:64
virtual void setMatrix(const Teuchos::RCP< const row_matrix_type > &A)
Change the matrix to be preconditioned.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1689
virtual int getOverlapLevel() const
Returns the level of overlap.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1429
MatrixType::local_ordinal_type local_ordinal_type
The type of local indices in the input MatrixType.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:315
virtual int getNumInitialize() const
Returns the number of calls to initialize().
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1215