55 #ifndef IFPACK2_ADDITIVESCHWARZ_DEF_HPP 56 #define IFPACK2_ADDITIVESCHWARZ_DEF_HPP 58 #include "Trilinos_Details_LinearSolverFactory.hpp" 62 #include "Ifpack2_Details_LinearSolver.hpp" 63 #include "Ifpack2_Details_getParamTryingTypes.hpp" 65 #if defined(HAVE_IFPACK2_XPETRA) && defined(HAVE_IFPACK2_ZOLTAN2) 66 #include "Zoltan2_TpetraRowGraphAdapter.hpp" 67 #include "Zoltan2_OrderingProblem.hpp" 68 #include "Zoltan2_OrderingSolution.hpp" 72 #include "Ifpack2_LocalFilter.hpp" 73 #include "Ifpack2_OverlappingRowMatrix.hpp" 74 #include "Ifpack2_Parameters.hpp" 75 #include "Ifpack2_ReorderFilter.hpp" 76 #include "Ifpack2_SingletonFilter.hpp" 79 #include "Teuchos_DefaultMpiComm.hpp" 82 #include "Teuchos_StandardParameterEntryValidators.hpp" 95 #ifdef HAVE_IFPACK2_DEBUG 103 using STS = Teuchos::ScalarTraits<typename MV::scalar_type>;
104 using magnitude_type =
typename STS::magnitudeType;
105 using STM = Teuchos::ScalarTraits<magnitude_type>;
107 Teuchos::Array<magnitude_type> norms (X.getNumVectors ());
110 for (
size_t j = 0; j < X.getNumVectors (); ++j) {
111 if (STM::isnaninf (norms[j])) {
121 #endif // HAVE_IFPACK2_DEBUG 125 template<
class MatrixType,
class LocalInverseType>
127 AdditiveSchwarz<MatrixType, LocalInverseType>::hasInnerPrecName ()
const 129 const char* options[4] = {
130 "inner preconditioner name",
131 "subdomain solver name",
132 "schwarz: inner preconditioner name",
133 "schwarz: subdomain solver name" 135 const int numOptions = 4;
137 for (
int k = 0; k < numOptions && ! match; ++k) {
138 if (List_.isParameter (options[k])) {
146 template<
class MatrixType,
class LocalInverseType>
148 AdditiveSchwarz<MatrixType, LocalInverseType>::removeInnerPrecName ()
150 const char* options[4] = {
151 "inner preconditioner name",
152 "subdomain solver name",
153 "schwarz: inner preconditioner name",
154 "schwarz: subdomain solver name" 156 const int numOptions = 4;
157 for (
int k = 0; k < numOptions; ++k) {
158 List_.remove (options[k],
false);
163 template<
class MatrixType,
class LocalInverseType>
165 AdditiveSchwarz<MatrixType, LocalInverseType>::innerPrecName ()
const 167 const char* options[4] = {
168 "inner preconditioner name",
169 "subdomain solver name",
170 "schwarz: inner preconditioner name",
171 "schwarz: subdomain solver name" 173 const int numOptions = 4;
178 for (
int k = 0; k < numOptions && ! match; ++k) {
179 const Teuchos::ParameterEntry* paramEnt =
180 List_.getEntryPtr (options[k]);
181 if (paramEnt !=
nullptr && paramEnt->isType<std::string> ()) {
182 newName = Teuchos::getValue<std::string> (*paramEnt);
186 return match ? newName : defaultInnerPrecName ();
190 template<
class MatrixType,
class LocalInverseType>
192 AdditiveSchwarz<MatrixType, LocalInverseType>::removeInnerPrecParams ()
194 const char* options[4] = {
195 "inner preconditioner parameters",
196 "subdomain solver parameters",
197 "schwarz: inner preconditioner parameters",
198 "schwarz: subdomain solver parameters" 200 const int numOptions = 4;
203 for (
int k = 0; k < numOptions; ++k) {
204 List_.remove (options[k],
false);
209 template<
class MatrixType,
class LocalInverseType>
210 std::pair<Teuchos::ParameterList, bool>
211 AdditiveSchwarz<MatrixType, LocalInverseType>::innerPrecParams ()
const 213 const char* options[4] = {
214 "inner preconditioner parameters",
215 "subdomain solver parameters",
216 "schwarz: inner preconditioner parameters",
217 "schwarz: subdomain solver parameters" 219 const int numOptions = 4;
220 Teuchos::ParameterList params;
224 for (
int k = 0; k < numOptions && ! match; ++k) {
225 if (List_.isSublist (options[k])) {
226 params = List_.sublist (options[k]);
231 return std::make_pair (params, match);
234 template<
class MatrixType,
class LocalInverseType>
236 AdditiveSchwarz<MatrixType, LocalInverseType>::defaultInnerPrecName ()
243 template<
class MatrixType,
class LocalInverseType>
249 template<
class MatrixType,
class LocalInverseType>
252 const int overlapLevel) :
254 OverlapLevel_ (overlapLevel)
257 template<
class MatrixType,
class LocalInverseType>
258 Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type > >
262 TEUCHOS_TEST_FOR_EXCEPTION(
263 Matrix_.is_null (), std::runtime_error,
"Ifpack2::AdditiveSchwarz::" 264 "getDomainMap: The matrix to precondition is null. You must either pass " 265 "a nonnull matrix to the constructor, or call setMatrix() with a nonnull " 266 "input, before you may call this method.");
267 return Matrix_->getDomainMap ();
271 template<
class MatrixType,
class LocalInverseType>
272 Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type> >
275 TEUCHOS_TEST_FOR_EXCEPTION(
276 Matrix_.is_null (), std::runtime_error,
"Ifpack2::AdditiveSchwarz::" 277 "getRangeMap: The matrix to precondition is null. You must either pass " 278 "a nonnull matrix to the constructor, or call setMatrix() with a nonnull " 279 "input, before you may call this method.");
280 return Matrix_->getRangeMap ();
284 template<
class MatrixType,
class LocalInverseType>
291 template<
class MatrixType,
class LocalInverseType>
294 apply (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &B,
295 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &Y,
296 Teuchos::ETransp mode,
301 using Teuchos::TimeMonitor;
304 using Teuchos::rcp_dynamic_cast;
305 typedef Teuchos::ScalarTraits<scalar_type> STS;
306 const char prefix[] =
"Ifpack2::AdditiveSchwarz::apply: ";
308 TEUCHOS_TEST_FOR_EXCEPTION
309 (! IsComputed_, std::runtime_error,
310 prefix <<
"isComputed() must be true before you may call apply().");
311 TEUCHOS_TEST_FOR_EXCEPTION
312 (Matrix_.is_null (), std::logic_error, prefix <<
313 "The input matrix A is null, but the preconditioner says that it has " 314 "been computed (isComputed() is true). This should never happen, since " 315 "setMatrix() should always mark the preconditioner as not computed if " 316 "its argument is null. " 317 "Please report this bug to the Ifpack2 developers.");
318 TEUCHOS_TEST_FOR_EXCEPTION
319 (Inverse_.is_null (), std::runtime_error,
320 prefix <<
"The subdomain solver is null. " 321 "This can only happen if you called setInnerPreconditioner() with a null " 322 "input, after calling initialize() or compute(). If you choose to call " 323 "setInnerPreconditioner() with a null input, you must then call it with " 324 "a nonnull input before you may call initialize() or compute().");
325 TEUCHOS_TEST_FOR_EXCEPTION
326 (B.getNumVectors() != Y.getNumVectors(), std::invalid_argument,
327 prefix <<
"B and Y must have the same number of columns. B has " <<
328 B.getNumVectors () <<
" columns, but Y has " << Y.getNumVectors() <<
".");
329 TEUCHOS_TEST_FOR_EXCEPTION
330 (IsOverlapping_ && OverlappingMatrix_.is_null (), std::logic_error,
331 prefix <<
"The overlapping matrix is null. " 332 "This should never happen if IsOverlapping_ is true. " 333 "Please report this bug to the Ifpack2 developers.");
334 TEUCHOS_TEST_FOR_EXCEPTION
335 (! IsOverlapping_ && localMap_.is_null (), std::logic_error,
336 prefix <<
"localMap_ is null. " 337 "This should never happen if IsOverlapping_ is false. " 338 "Please report this bug to the Ifpack2 developers.");
339 TEUCHOS_TEST_FOR_EXCEPTION
340 (alpha != STS::one (), std::logic_error,
341 prefix <<
"Not implemented for alpha != 1.");
342 TEUCHOS_TEST_FOR_EXCEPTION
343 (beta != STS::zero (), std::logic_error,
344 prefix <<
"Not implemented for beta != 0.");
346 #ifdef HAVE_IFPACK2_DEBUG 348 const bool bad = anyBad (B);
349 TEUCHOS_TEST_FOR_EXCEPTION
350 (bad, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 351 "The 2-norm of the input B is NaN or Inf.");
353 #endif // HAVE_IFPACK2_DEBUG 355 #ifdef HAVE_IFPACK2_DEBUG 356 if (! ZeroStartingSolution_) {
357 const bool bad = anyBad (Y);
358 TEUCHOS_TEST_FOR_EXCEPTION
359 (bad, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 360 "On input, the initial guess Y has 2-norm NaN or Inf " 361 "(ZeroStartingSolution_ is false).");
363 #endif // HAVE_IFPACK2_DEBUG 365 const std::string timerName (
"Ifpack2::AdditiveSchwarz::apply");
366 RCP<Time> timer = TimeMonitor::lookupCounter (timerName);
367 if (timer.is_null ()) {
368 timer = TimeMonitor::getNewCounter (timerName);
370 double startTime = timer->wallTime();
373 TimeMonitor timeMon (*timer);
375 const scalar_type ZERO = Teuchos::ScalarTraits<scalar_type>::zero ();
376 const size_t numVectors = B.getNumVectors ();
380 if (ZeroStartingSolution_) {
385 MV* OverlappingB =
nullptr;
386 MV* OverlappingY =
nullptr;
388 RCP<const map_type> B_and_Y_map = IsOverlapping_ ?
389 OverlappingMatrix_->getRowMap () : localMap_;
390 if (overlapping_B_.get () ==
nullptr ||
391 overlapping_B_->getNumVectors () != numVectors) {
392 overlapping_B_.reset (
new MV (B_and_Y_map, numVectors,
false));
394 if (overlapping_Y_.get () ==
nullptr ||
395 overlapping_Y_->getNumVectors () != numVectors) {
396 overlapping_Y_.reset (
new MV (B_and_Y_map, numVectors,
false));
398 OverlappingB = overlapping_B_.get ();
399 OverlappingY = overlapping_Y_.get ();
402 OverlappingB->putScalar (ZERO);
403 OverlappingY->putScalar (ZERO);
406 RCP<MV> globalOverlappingB;
407 if (! IsOverlapping_) {
409 OverlappingB->offsetViewNonConst (Matrix_->getRowMap (), 0);
412 if (DistributedImporter_.is_null ()) {
416 DistributedImporter_ =
417 rcp (
new import_type (Matrix_->getRowMap (),
418 Matrix_->getDomainMap ()));
422 if (R_.get () ==
nullptr || R_->getNumVectors () != numVectors) {
423 R_.reset (
new MV (B.getMap (), numVectors,
false));
425 if (C_.get () ==
nullptr || C_->getNumVectors () != numVectors) {
426 C_.reset (
new MV (Y.getMap (), numVectors,
false));
435 for (
int ni=0; ni<NumIterations_; ++ni)
437 #ifdef HAVE_IFPACK2_DEBUG 439 const bool bad = anyBad (Y);
440 TEUCHOS_TEST_FOR_EXCEPTION
441 (bad, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 442 "At top of iteration " << ni <<
", the 2-norm of Y is NaN or Inf.");
444 #endif // HAVE_IFPACK2_DEBUG 446 Tpetra::deep_copy(*R, B);
451 if (!ZeroStartingSolution_ || ni > 0) {
453 Matrix_->apply (Y, *R, mode, -STS::one(), STS::one());
455 #ifdef HAVE_IFPACK2_DEBUG 457 const bool bad = anyBad (*R);
458 TEUCHOS_TEST_FOR_EXCEPTION
459 (bad, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 460 "At iteration " << ni <<
", the 2-norm of R (result of computing " 461 "residual with Y) is NaN or Inf.");
463 #endif // HAVE_IFPACK2_DEBUG 467 RCP<overlap_mat_type> overlapMatrix;
468 if (IsOverlapping_) {
469 overlapMatrix = rcp_dynamic_cast<overlap_mat_type> (OverlappingMatrix_);
470 TEUCHOS_TEST_FOR_EXCEPTION
471 (overlapMatrix.is_null (), std::logic_error, prefix <<
472 "IsOverlapping_ is true, but OverlappingMatrix_, while nonnull, is " 473 "not an OverlappingRowMatrix<row_matrix_type>. Please report this " 474 "bug to the Ifpack2 developers.");
478 if (IsOverlapping_) {
479 TEUCHOS_TEST_FOR_EXCEPTION
480 (overlapMatrix.is_null (), std::logic_error, prefix
481 <<
"overlapMatrix is null when it shouldn't be. " 482 "Please report this bug to the Ifpack2 developers.");
483 overlapMatrix->importMultiVector (*R, *OverlappingB, Tpetra::INSERT);
500 #ifdef HAVE_IFPACK2_DEBUG 502 const bool bad = anyBad (*OverlappingB);
503 TEUCHOS_TEST_FOR_EXCEPTION
504 (bad, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 505 "At iteration " << ni <<
", result of importMultiVector from R " 506 "to OverlappingB, has 2-norm NaN or Inf.");
508 #endif // HAVE_IFPACK2_DEBUG 510 globalOverlappingB->doImport (*R, *DistributedImporter_, Tpetra::INSERT);
512 #ifdef HAVE_IFPACK2_DEBUG 514 const bool bad = anyBad (*globalOverlappingB);
515 TEUCHOS_TEST_FOR_EXCEPTION
516 (bad, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 517 "At iteration " << ni <<
", result of doImport from R, has 2-norm " 520 #endif // HAVE_IFPACK2_DEBUG 523 #ifdef HAVE_IFPACK2_DEBUG 525 const bool bad = anyBad (*OverlappingB);
526 TEUCHOS_TEST_FOR_EXCEPTION
527 (bad, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 528 "At iteration " << ni <<
", right before localApply, the 2-norm of " 529 "OverlappingB is NaN or Inf.");
531 #endif // HAVE_IFPACK2_DEBUG 534 localApply(*OverlappingB, *OverlappingY);
536 #ifdef HAVE_IFPACK2_DEBUG 538 const bool bad = anyBad (*OverlappingY);
539 TEUCHOS_TEST_FOR_EXCEPTION
540 (bad, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 541 "At iteration " << ni <<
", after localApply and before export / " 542 "copy, the 2-norm of OverlappingY is NaN or Inf.");
544 #endif // HAVE_IFPACK2_DEBUG 546 #ifdef HAVE_IFPACK2_DEBUG 548 const bool bad = anyBad (*C);
549 TEUCHOS_TEST_FOR_EXCEPTION
550 (bad, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 551 "At iteration " << ni <<
", before export / copy, the 2-norm of C " 554 #endif // HAVE_IFPACK2_DEBUG 557 if (IsOverlapping_) {
558 TEUCHOS_TEST_FOR_EXCEPTION
559 (overlapMatrix.is_null (), std::logic_error, prefix
560 <<
"overlapMatrix is null when it shouldn't be. " 561 "Please report this bug to the Ifpack2 developers.");
562 overlapMatrix->exportMultiVector (*OverlappingY, *C, CombineMode_);
571 RCP<MV> C_view = C->offsetViewNonConst (OverlappingY->getMap (), 0);
572 Tpetra::deep_copy (*C_view, *OverlappingY);
575 #ifdef HAVE_IFPACK2_DEBUG 577 const bool bad = anyBad (*C);
578 TEUCHOS_TEST_FOR_EXCEPTION
579 (bad, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 580 "At iteration " << ni <<
", before Y := C + Y, the 2-norm of C " 583 #endif // HAVE_IFPACK2_DEBUG 585 #ifdef HAVE_IFPACK2_DEBUG 587 const bool bad = anyBad (Y);
588 TEUCHOS_TEST_FOR_EXCEPTION
589 (bad, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 590 "Before Y := C + Y, at iteration " << ni <<
", the 2-norm of Y " 593 #endif // HAVE_IFPACK2_DEBUG 595 Y.update(UpdateDamping_, *C, STS::one());
597 #ifdef HAVE_IFPACK2_DEBUG 599 const bool bad = anyBad (Y);
600 TEUCHOS_TEST_FOR_EXCEPTION
601 (bad, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 602 "At iteration " << ni <<
", after Y := C + Y, the 2-norm of Y " 605 #endif // HAVE_IFPACK2_DEBUG 610 #ifdef HAVE_IFPACK2_DEBUG 612 const bool bad = anyBad (Y);
613 TEUCHOS_TEST_FOR_EXCEPTION
614 (bad, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 615 "The 2-norm of the output Y is NaN or Inf.");
617 #endif // HAVE_IFPACK2_DEBUG 621 ApplyTime_ += (timer->wallTime() - startTime);
624 template<
class MatrixType,
class LocalInverseType>
627 localApply (MV& OverlappingB, MV& OverlappingY)
const 630 using Teuchos::rcp_dynamic_cast;
632 const size_t numVectors = OverlappingB.getNumVectors ();
633 if (FilterSingletons_) {
635 MV ReducedB (SingletonMatrix_->getRowMap (), numVectors);
636 MV ReducedY (SingletonMatrix_->getRowMap (), numVectors);
638 RCP<SingletonFilter<row_matrix_type> > singletonFilter =
640 TEUCHOS_TEST_FOR_EXCEPTION
641 (! SingletonMatrix_.is_null () && singletonFilter.is_null (),
642 std::logic_error,
"Ifpack2::AdditiveSchwarz::localApply: " 643 "SingletonFilter_ is nonnull but is not a SingletonFilter" 644 "<row_matrix_type>. This should never happen. Please report this bug " 645 "to the Ifpack2 developers.");
647 singletonFilter->CreateReducedRHS (OverlappingY, OverlappingB, ReducedB);
650 if (! UseReordering_) {
651 Inverse_->solve (ReducedY, ReducedB);
654 RCP<ReorderFilter<row_matrix_type> > rf =
655 rcp_dynamic_cast<ReorderFilter<row_matrix_type> > (ReorderedLocalizedMatrix_);
656 TEUCHOS_TEST_FOR_EXCEPTION
657 (! ReorderedLocalizedMatrix_.is_null () && rf.is_null (), std::logic_error,
658 "Ifpack2::AdditiveSchwarz::localApply: ReorderedLocalizedMatrix_ is " 659 "nonnull but is not a ReorderFilter<row_matrix_type>. This should " 660 "never happen. Please report this bug to the Ifpack2 developers.");
661 MV ReorderedB (ReducedB, Teuchos::Copy);
662 MV ReorderedY (ReducedY, Teuchos::Copy);
663 rf->permuteOriginalToReordered (ReducedB, ReorderedB);
664 Inverse_->solve (ReorderedY, ReorderedB);
665 rf->permuteReorderedToOriginal (ReorderedY, ReducedY);
669 singletonFilter->UpdateLHS (ReducedY, OverlappingY);
673 if (! UseReordering_) {
674 Inverse_->solve (OverlappingY, OverlappingB);
677 MV ReorderedB (OverlappingB, Teuchos::Copy);
678 MV ReorderedY (OverlappingY, Teuchos::Copy);
680 RCP<ReorderFilter<row_matrix_type> > rf =
681 rcp_dynamic_cast<ReorderFilter<row_matrix_type> > (ReorderedLocalizedMatrix_);
682 TEUCHOS_TEST_FOR_EXCEPTION
683 (! ReorderedLocalizedMatrix_.is_null () && rf.is_null (), std::logic_error,
684 "Ifpack2::AdditiveSchwarz::localApply: ReorderedLocalizedMatrix_ is " 685 "nonnull but is not a ReorderFilter<row_matrix_type>. This should " 686 "never happen. Please report this bug to the Ifpack2 developers.");
687 rf->permuteOriginalToReordered (OverlappingB, ReorderedB);
688 Inverse_->solve (ReorderedY, ReorderedB);
689 rf->permuteReorderedToOriginal (ReorderedY, OverlappingY);
695 template<
class MatrixType,
class LocalInverseType>
703 this->setParameterList (Teuchos::rcpFromRef (List_));
708 template<
class MatrixType,
class LocalInverseType>
712 using Tpetra::CombineMode;
713 using Teuchos::ParameterEntry;
714 using Teuchos::ParameterEntryValidator;
715 using Teuchos::ParameterList;
718 using Teuchos::rcp_dynamic_cast;
719 using Teuchos::StringToIntegralParameterEntryValidator;
720 using Details::getParamTryingTypes;
721 const char prefix[] =
"Ifpack2::AdditiveSchwarz: ";
723 if (plist.is_null ()) {
726 this->setParameterList (rcp (
new ParameterList ()));
732 TEUCHOS_TEST_FOR_EXCEPTION(
733 plist.is_null (), std::logic_error,
"Ifpack2::AdditiveSchwarz::" 734 "setParameterList: plist is null. This should never happen, since the " 735 "method should have replaced a null input list with a nonnull empty list " 736 "by this point. Please report this bug to the Ifpack2 developers.");
757 const std::string cmParamName (
"schwarz: combine mode");
758 const ParameterEntry* cmEnt = plist->getEntryPtr (cmParamName);
759 if (cmEnt !=
nullptr) {
760 if (cmEnt->isType<CombineMode> ()) {
761 CombineMode_ = Teuchos::getValue<CombineMode> (*cmEnt);
763 else if (cmEnt->isType<
int> ()) {
764 const int cm = Teuchos::getValue<int> (*cmEnt);
765 CombineMode_ =
static_cast<CombineMode
> (cm);
767 else if (cmEnt->isType<std::string> ()) {
772 const ParameterEntry& validEntry =
774 RCP<const ParameterEntryValidator> v = validEntry.validator ();
775 using vs2e_type = StringToIntegralParameterEntryValidator<CombineMode>;
776 RCP<const vs2e_type> vs2e = rcp_dynamic_cast<
const vs2e_type> (v,
true);
778 const ParameterEntry& inputEntry = plist->getEntry (cmParamName);
779 CombineMode_ = vs2e->getIntegralValue (inputEntry, cmParamName);
783 OverlapLevel_ = plist->get (
"schwarz: overlap level", OverlapLevel_);
789 UseReordering_ = plist->get (
"schwarz: use reordering", UseReordering_);
791 #if !defined(HAVE_IFPACK2_XPETRA) || !defined(HAVE_IFPACK2_ZOLTAN2) 792 TEUCHOS_TEST_FOR_EXCEPTION(
793 UseReordering_, std::invalid_argument,
"Ifpack2::AdditiveSchwarz::" 794 "setParameters: You specified \"schwarz: use reordering\" = true. " 795 "This is only valid when Trilinos was built with Ifpack2, Xpetra, and " 796 "Zoltan2 enabled. Either Xpetra or Zoltan2 was not enabled in your build " 808 FilterSingletons_ = plist->get (
"schwarz: filter singletons", FilterSingletons_);
811 getParamTryingTypes<scalar_type, scalar_type, double>
812 (UpdateDamping_, *plist,
"schwarz: update damping", prefix);
847 if (! Inverse_.is_null ()) {
850 if (hasInnerPrecName () && innerPrecName () !=
"CUSTOM") {
853 Inverse_ = Teuchos::null;
858 std::pair<ParameterList, bool> result = innerPrecParams ();
862 Inverse_->setParameters (rcp (
new ParameterList (result.first)));
867 NumIterations_ = plist->get (
"schwarz: num iterations", NumIterations_);
868 ZeroStartingSolution_ =
869 plist->get (
"schwarz: zero starting solution", ZeroStartingSolution_);
874 template<
class MatrixType,
class LocalInverseType>
875 Teuchos::RCP<const Teuchos::ParameterList>
879 using Teuchos::ParameterList;
880 using Teuchos::parameterList;
882 using Teuchos::rcp_const_cast;
884 if (validParams_.is_null ()) {
885 const int overlapLevel = 0;
886 const bool useReordering =
false;
887 const bool filterSingletons =
false;
888 const int numIterations = 1;
889 const bool zeroStartingSolution =
true;
890 const scalar_type updateDamping = Teuchos::ScalarTraits<scalar_type>::one ();
891 ParameterList reorderingSublist;
892 reorderingSublist.set (
"order_method", std::string (
"rcm"));
894 RCP<ParameterList> plist = parameterList (
"Ifpack2::AdditiveSchwarz");
896 Tpetra::setCombineModeParameter (*plist,
"schwarz: combine mode");
897 plist->set (
"schwarz: overlap level", overlapLevel);
898 plist->set (
"schwarz: use reordering", useReordering);
899 plist->set (
"schwarz: reordering list", reorderingSublist);
902 plist->set (
"schwarz: compute condest",
false);
903 plist->set (
"schwarz: filter singletons", filterSingletons);
904 plist->set (
"schwarz: num iterations", numIterations);
905 plist->set (
"schwarz: zero starting solution", zeroStartingSolution);
906 plist->set (
"schwarz: update damping", updateDamping);
916 validParams_ = rcp_const_cast<
const ParameterList> (plist);
922 template<
class MatrixType,
class LocalInverseType>
925 using Tpetra::global_size_t;
928 using Teuchos::SerialComm;
930 using Teuchos::TimeMonitor;
932 const std::string timerName (
"Ifpack2::AdditiveSchwarz::initialize");
933 RCP<Time> timer = TimeMonitor::lookupCounter (timerName);
934 if (timer.is_null ()) {
935 timer = TimeMonitor::getNewCounter (timerName);
937 double startTime = timer->wallTime();
940 TimeMonitor timeMon (*timer);
942 TEUCHOS_TEST_FOR_EXCEPTION(
943 Matrix_.is_null (), std::runtime_error,
"Ifpack2::AdditiveSchwarz::" 944 "initialize: The matrix to precondition is null. You must either pass " 945 "a nonnull matrix to the constructor, or call setMatrix() with a nonnull " 946 "input, before you may call this method.");
948 IsInitialized_ =
false;
950 overlapping_B_.reset (
nullptr);
951 overlapping_Y_.reset (
nullptr);
955 RCP<const Teuchos::Comm<int> > comm = Matrix_->getComm ();
956 RCP<const map_type> rowMap = Matrix_->getRowMap ();
957 const global_size_t INVALID =
958 Teuchos::OrdinalTraits<global_size_t>::invalid ();
962 if (comm->getSize () == 1) {
964 IsOverlapping_ =
false;
965 }
else if (OverlapLevel_ != 0) {
966 IsOverlapping_ =
true;
969 if (OverlapLevel_ == 0) {
971 RCP<const SerialComm<int> > localComm (
new SerialComm<int> ());
975 rcp (
new map_type (INVALID, rowMap->getNodeNumElements (),
976 indexBase, localComm));
980 if (IsOverlapping_) {
986 if (! Inverse_.is_null ()) {
987 Inverse_->symbolic ();
992 IsInitialized_ =
true;
995 InitializeTime_ += (timer->wallTime() - startTime);
999 template<
class MatrixType,
class LocalInverseType>
1002 return IsInitialized_;
1006 template<
class MatrixType,
class LocalInverseType>
1010 using Teuchos::Time;
1011 using Teuchos::TimeMonitor;
1013 if (! IsInitialized_) {
1017 TEUCHOS_TEST_FOR_EXCEPTION(
1018 ! isInitialized (), std::logic_error,
"Ifpack2::AdditiveSchwarz::compute: " 1019 "The preconditioner is not yet initialized, " 1020 "even though initialize() supposedly has been called. " 1021 "This should never happen. " 1022 "Please report this bug to the Ifpack2 developers.");
1024 TEUCHOS_TEST_FOR_EXCEPTION(
1025 Inverse_.is_null (), std::runtime_error,
1026 "Ifpack2::AdditiveSchwarz::compute: The subdomain solver is null. " 1027 "This can only happen if you called setInnerPreconditioner() with a null " 1028 "input, after calling initialize() or compute(). If you choose to call " 1029 "setInnerPreconditioner() with a null input, you must then call it with a " 1030 "nonnull input before you may call initialize() or compute().");
1032 const std::string timerName (
"Ifpack2::AdditiveSchwarz::compute");
1033 RCP<Time> timer = TimeMonitor::lookupCounter (timerName);
1034 if (timer.is_null ()) {
1035 timer = TimeMonitor::getNewCounter (timerName);
1037 double startTime = timer->wallTime();
1040 TimeMonitor timeMon (*timer);
1042 IsComputed_ =
false;
1043 Inverse_->numeric ();
1049 ComputeTime_ += (timer->wallTime() - startTime);
1054 template<
class MatrixType,
class LocalInverseType>
1061 template<
class MatrixType,
class LocalInverseType>
1064 return NumInitialize_;
1068 template<
class MatrixType,
class LocalInverseType>
1075 template<
class MatrixType,
class LocalInverseType>
1082 template<
class MatrixType,
class LocalInverseType>
1085 return InitializeTime_;
1089 template<
class MatrixType,
class LocalInverseType>
1092 return ComputeTime_;
1096 template<
class MatrixType,
class LocalInverseType>
1103 template<
class MatrixType,
class LocalInverseType>
1106 std::ostringstream out;
1108 out <<
"\"Ifpack2::AdditiveSchwarz\": {";
1109 if (this->getObjectLabel () !=
"") {
1110 out <<
"Label: \"" << this->getObjectLabel () <<
"\", ";
1112 out <<
"Initialized: " << (isInitialized () ?
"true" :
"false")
1113 <<
", Computed: " << (isComputed () ?
"true" :
"false")
1114 <<
", Iterations: " << NumIterations_
1115 <<
", Overlap level: " << OverlapLevel_
1116 <<
", Subdomain reordering: \"" << ReorderingAlgorithm_ <<
"\"";
1117 out <<
", Combine mode: \"";
1118 if (CombineMode_ == Tpetra::INSERT) {
1120 }
else if (CombineMode_ == Tpetra::ADD) {
1122 }
else if (CombineMode_ == Tpetra::REPLACE) {
1124 }
else if (CombineMode_ == Tpetra::ABSMAX) {
1126 }
else if (CombineMode_ == Tpetra::ZERO) {
1130 if (Matrix_.is_null ()) {
1131 out <<
", Matrix: null";
1134 out <<
", Global matrix dimensions: [" 1135 << Matrix_->getGlobalNumRows () <<
", " 1136 << Matrix_->getGlobalNumCols () <<
"]";
1138 out <<
", Inner solver: ";
1139 if (! Inverse_.is_null ()) {
1140 Teuchos::RCP<Teuchos::Describable> inv =
1141 Teuchos::rcp_dynamic_cast<Teuchos::Describable> (Inverse_);
1142 if (! inv.is_null ()) {
1143 out <<
"{" << inv->description () <<
"}";
1145 out <<
"{" <<
"Some inner solver" <<
"}";
1156 template<
class MatrixType,
class LocalInverseType>
1160 const Teuchos::EVerbosityLevel verbLevel)
const 1162 using Teuchos::OSTab;
1163 using Teuchos::TypeNameTraits;
1166 const int myRank = Matrix_->getComm ()->getRank ();
1167 const int numProcs = Matrix_->getComm ()->getSize ();
1168 const Teuchos::EVerbosityLevel vl =
1169 (verbLevel == Teuchos::VERB_DEFAULT) ? Teuchos::VERB_LOW : verbLevel;
1171 if (vl > Teuchos::VERB_NONE) {
1175 out <<
"\"Ifpack2::AdditiveSchwarz\":";
1179 out <<
"MatrixType: " << TypeNameTraits<MatrixType>::name () << endl;
1180 out <<
"LocalInverseType: " << TypeNameTraits<LocalInverseType>::name () << endl;
1181 if (this->getObjectLabel () !=
"") {
1182 out <<
"Label: \"" << this->getObjectLabel () <<
"\"" << endl;
1185 out <<
"Overlap level: " << OverlapLevel_ << endl
1186 <<
"Combine mode: \"";
1187 if (CombineMode_ == Tpetra::INSERT) {
1189 }
else if (CombineMode_ == Tpetra::ADD) {
1191 }
else if (CombineMode_ == Tpetra::REPLACE) {
1193 }
else if (CombineMode_ == Tpetra::ABSMAX) {
1195 }
else if (CombineMode_ == Tpetra::ZERO) {
1199 <<
"Subdomain reordering: \"" << ReorderingAlgorithm_ <<
"\"" << endl;
1202 if (Matrix_.is_null ()) {
1204 out <<
"Matrix: null" << endl;
1209 out <<
"Matrix:" << endl;
1212 Matrix_->getComm ()->barrier ();
1213 Matrix_->describe (out, Teuchos::VERB_LOW);
1217 out <<
"Number of initialize calls: " << getNumInitialize () << endl
1218 <<
"Number of compute calls: " << getNumCompute () << endl
1219 <<
"Number of apply calls: " << getNumApply () << endl
1220 <<
"Total time in seconds for initialize: " << getInitializeTime () << endl
1221 <<
"Total time in seconds for compute: " << getComputeTime () << endl
1222 <<
"Total time in seconds for apply: " << getApplyTime () << endl;
1225 if (Inverse_.is_null ()) {
1227 out <<
"Subdomain solver: null" << endl;
1231 if (vl < Teuchos::VERB_EXTREME) {
1233 out <<
"Subdomain solver: not null" << endl;
1237 for (
int p = 0; p < numProcs; ++p) {
1239 out <<
"Subdomain solver on Process " << myRank <<
":";
1240 if (Inverse_.is_null ()) {
1241 out <<
"null" << endl;
1243 Teuchos::RCP<Teuchos::Describable> inv =
1244 Teuchos::rcp_dynamic_cast<Teuchos::Describable> (Inverse_);
1245 if (! inv.is_null ()) {
1247 inv->describe (out, vl);
1249 out <<
"null" << endl;
1253 Matrix_->getComm ()->barrier ();
1254 Matrix_->getComm ()->barrier ();
1255 Matrix_->getComm ()->barrier ();
1260 Matrix_->getComm ()->barrier ();
1265 template<
class MatrixType,
class LocalInverseType>
1268 Teuchos::FancyOStream fos(Teuchos::rcp(&os,
false));
1269 fos.setOutputToRootOnly(0);
1275 template<
class MatrixType,
class LocalInverseType>
1278 return OverlapLevel_;
1282 template<
class MatrixType,
class LocalInverseType>
1286 using Teuchos::MpiComm;
1288 using Teuchos::ArrayRCP;
1289 using Teuchos::ParameterList;
1292 using Teuchos::rcp_dynamic_cast;
1293 using Teuchos::rcpFromRef;
1295 TEUCHOS_TEST_FOR_EXCEPTION(
1296 Matrix_.is_null (), std::runtime_error,
"Ifpack2::AdditiveSchwarz::" 1297 "initialize: The matrix to precondition is null. You must either pass " 1298 "a nonnull matrix to the constructor, or call setMatrix() with a nonnull " 1299 "input, before you may call this method.");
1302 RCP<row_matrix_type> LocalizedMatrix;
1306 RCP<row_matrix_type> ActiveMatrix;
1309 if (! OverlappingMatrix_.is_null ()) {
1313 LocalizedMatrix = rcp (
new LocalFilter<row_matrix_type> (Matrix_));
1317 TEUCHOS_TEST_FOR_EXCEPTION(
1318 LocalizedMatrix.is_null (), std::logic_error,
1319 "Ifpack2::AdditiveSchwarz::setup: LocalizedMatrix is null, after the code " 1320 "that claimed to have created it. This should never be the case. Please " 1321 "report this bug to the Ifpack2 developers.");
1324 ActiveMatrix = LocalizedMatrix;
1327 if (FilterSingletons_) {
1328 SingletonMatrix_ = rcp (
new SingletonFilter<row_matrix_type> (LocalizedMatrix));
1329 ActiveMatrix = SingletonMatrix_;
1333 if (UseReordering_) {
1334 #if defined(HAVE_IFPACK2_XPETRA) && defined(HAVE_IFPACK2_ZOLTAN2) 1336 typedef ReorderFilter<row_matrix_type> reorder_filter_type;
1337 Teuchos::ParameterList zlist = List_.sublist (
"schwarz: reordering list");
1338 ReorderingAlgorithm_ = zlist.get<std::string> (
"order_method",
"rcm");
1340 ArrayRCP<local_ordinal_type> perm;
1341 ArrayRCP<local_ordinal_type> revperm;
1343 if(ReorderingAlgorithm_ ==
"user") {
1345 perm = zlist.get<Teuchos::ArrayRCP<local_ordinal_type> >(
"user ordering");
1346 revperm = zlist.get<Teuchos::ArrayRCP<local_ordinal_type> >(
"user reverse ordering");
1350 typedef Tpetra::RowGraph
1351 <local_ordinal_type, global_ordinal_type, node_type> row_graph_type;
1352 typedef Zoltan2::TpetraRowGraphAdapter<row_graph_type> z2_adapter_type;
1353 RCP<const row_graph_type> constActiveGraph =
1354 Teuchos::rcp_const_cast<
const row_graph_type>(ActiveMatrix->getGraph());
1355 z2_adapter_type Zoltan2Graph (constActiveGraph);
1357 typedef Zoltan2::OrderingProblem<z2_adapter_type> ordering_problem_type;
1362 RCP<const MpiComm<int> > mpicomm =
1363 rcp_dynamic_cast<
const MpiComm<int> > (ActiveMatrix->getComm ());
1364 if (mpicomm == Teuchos::null) {
1365 myRawComm = MPI_COMM_SELF;
1367 myRawComm = * (mpicomm->getRawMpiComm ());
1369 ordering_problem_type MyOrderingProblem (&Zoltan2Graph, &zlist, myRawComm);
1371 ordering_problem_type MyOrderingProblem (&Zoltan2Graph, &zlist);
1373 MyOrderingProblem.solve ();
1376 typedef Zoltan2::LocalOrderingSolution<local_ordinal_type>
1377 ordering_solution_type;
1379 ordering_solution_type sol (*MyOrderingProblem.getLocalOrderingSolution());
1385 perm = sol.getPermutationRCPConst (
true);
1386 revperm = sol.getPermutationRCPConst ();
1390 ReorderedLocalizedMatrix_ = rcp (
new reorder_filter_type (ActiveMatrix, perm, revperm));
1393 ActiveMatrix = ReorderedLocalizedMatrix_;
1397 TEUCHOS_TEST_FOR_EXCEPTION(
1398 true, std::logic_error,
"Ifpack2::AdditiveSchwarz::setup: " 1399 "The Zoltan2 and Xpetra packages must be enabled in order " 1400 "to support reordering.");
1404 innerMatrix_ = ActiveMatrix;
1406 TEUCHOS_TEST_FOR_EXCEPTION(
1407 innerMatrix_.is_null (), std::logic_error,
"Ifpack2::AdditiveSchwarz::" 1408 "setup: Inner matrix is null right before constructing inner solver. " 1409 "Please report this bug to the Ifpack2 developers.");
1412 if (Inverse_.is_null ()) {
1413 const std::string innerName = innerPrecName ();
1414 TEUCHOS_TEST_FOR_EXCEPTION(
1415 innerName ==
"INVALID", std::logic_error,
1416 "Ifpack2::AdditiveSchwarz::initialize: AdditiveSchwarz doesn't " 1417 "know how to create an instance of your LocalInverseType \"" 1418 << Teuchos::TypeNameTraits<LocalInverseType>::name () <<
"\". " 1419 "Please talk to the Ifpack2 developers for details.");
1421 TEUCHOS_TEST_FOR_EXCEPTION(
1422 innerName ==
"CUSTOM", std::runtime_error,
"Ifpack2::AdditiveSchwarz::" 1423 "initialize: If the \"inner preconditioner name\" parameter (or any " 1424 "alias thereof) has the value \"CUSTOM\", then you must first call " 1425 "setInnerPreconditioner with a nonnull inner preconditioner input before " 1426 "you may call initialize().");
1430 if (! Trilinos::Details::Impl::registeredSomeLinearSolverFactory (
"Ifpack2")) {
1436 typedef typename MV::mag_type MT;
1437 RCP<inner_solver_type> innerPrec =
1438 Trilinos::Details::getLinearSolver<MV, OP, MT> (
"Ifpack2", innerName);
1439 TEUCHOS_TEST_FOR_EXCEPTION(
1440 innerPrec.is_null (), std::logic_error,
1441 "Ifpack2::AdditiveSchwarz::setup: Failed to create inner preconditioner " 1442 "with name \"" << innerName <<
"\".");
1443 innerPrec->setMatrix (innerMatrix_);
1447 std::pair<Teuchos::ParameterList, bool> result = innerPrecParams ();
1448 if (result.second) {
1451 innerPrec->setParameters (rcp (
new ParameterList (result.first)));
1453 Inverse_ = innerPrec;
1455 else if (Inverse_->getMatrix ().getRawPtr () != innerMatrix_.getRawPtr ()) {
1459 Inverse_->setMatrix (innerMatrix_);
1461 TEUCHOS_TEST_FOR_EXCEPTION(
1462 Inverse_.is_null (), std::logic_error,
"Ifpack2::AdditiveSchwarz::" 1463 "setup: Inverse_ is null right after we were supposed to have created it." 1464 " Please report this bug to the Ifpack2 developers.");
1474 template<
class MatrixType,
class LocalInverseType>
1481 if (! innerPrec.is_null ()) {
1484 can_change_type* innerSolver =
dynamic_cast<can_change_type*
> (&*innerPrec);
1485 TEUCHOS_TEST_FOR_EXCEPTION(
1486 innerSolver == NULL, std::invalid_argument,
"Ifpack2::AdditiveSchwarz::" 1487 "setInnerPreconditioner: The input preconditioner does not implement the " 1488 "setMatrix() feature. Only input preconditioners that inherit from " 1489 "Ifpack2::Details::CanChangeMatrix implement this feature.");
1506 innerSolver->setMatrix (innerMatrix_);
1516 removeInnerPrecName ();
1517 removeInnerPrecParams ();
1518 List_.set (
"inner preconditioner name",
"CUSTOM");
1522 if (isInitialized ()) {
1523 innerPrec->initialize ();
1525 if (isComputed ()) {
1526 innerPrec->compute ();
1539 Inverse_ = Teuchos::rcp (
new inner_solver_impl_type (innerPrec,
"CUSTOM"));
1542 template<
class MatrixType,
class LocalInverseType>
1547 if (A.getRawPtr () != Matrix_.getRawPtr ()) {
1548 IsInitialized_ =
false;
1549 IsComputed_ =
false;
1552 OverlappingMatrix_ = Teuchos::null;
1553 ReorderedLocalizedMatrix_ = Teuchos::null;
1554 innerMatrix_ = Teuchos::null;
1555 SingletonMatrix_ = Teuchos::null;
1556 localMap_ = Teuchos::null;
1557 overlapping_B_.reset (
nullptr);
1558 overlapping_Y_.reset (
nullptr);
1561 DistributedImporter_ = Teuchos::null;
1572 #define IFPACK2_ADDITIVESCHWARZ_INSTANT(S,LO,GO,N) \ 1573 template class Ifpack2::AdditiveSchwarz< Tpetra::RowMatrix<S, LO, GO, N> >; 1575 #endif // IFPACK2_ADDITIVESCHWARZ_DECL_HPP 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:260
Mix-in interface for preconditioners that can change their matrix after construction.
Definition: Ifpack2_Details_CanChangeMatrix.hpp:93
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > &plist)
Set the preconditioner's parameters.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:710
virtual void compute()
Computes all (coefficient) data necessary to apply the preconditioner.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1007
void registerLinearSolverFactory()
Register Ifpack2's LinearSolverFactory with the central repository, for all enabled combinations of t...
Definition: Ifpack2_Details_registerLinearSolverFactory.cpp:68
virtual double getInitializeTime() const
Returns the time spent in initialize().
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1083
virtual double getComputeTime() const
Returns the time spent in compute().
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1090
virtual Teuchos::RCP< const row_matrix_type > getMatrix() const
The input matrix.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:285
virtual double getApplyTime() const
Returns the time spent in apply().
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1097
std::string description() const
Return a simple one-line description of this object.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1104
AdditiveSchwarz(const Teuchos::RCP< const row_matrix_type > &A)
Constructor that takes a matrix.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:245
typename MatrixType::node_type node_type
The Node type used by the input MatrixType.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:322
virtual void initialize()
Computes all (graph-related) data necessary to initialize the preconditioner.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:923
Ifpack2 implementation details.
virtual bool isInitialized() const
Returns true if the preconditioner has been successfully initialized, false otherwise.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1000
typename MatrixType::global_ordinal_type global_ordinal_type
The type of global indices in the input MatrixType.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:319
virtual int getOverlapLevel() const
Returns the level of overlap.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1276
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:1476
virtual int getNumCompute() const
Returns the number of calls to compute().
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1069
Ifpack2's implementation of Trilinos::Details::LinearSolver interface.
Definition: Ifpack2_Details_LinearSolver_decl.hpp:105
Interface for all Ifpack2 preconditioners.
Definition: Ifpack2_Preconditioner.hpp:107
typename MatrixType::local_ordinal_type local_ordinal_type
The type of local indices in the input MatrixType.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:316
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:273
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Get a list of the preconditioner's default parameters.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:877
Declaration of interface for preconditioners that can change their matrix after construction.
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:1159
virtual std::ostream & print(std::ostream &os) const
Prints basic information on iostream. This function is used by operator<<.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1266
virtual void setParameters(const Teuchos::ParameterList &plist)
Set the preconditioner's parameters.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:697
Sparse matrix (Tpetra::RowMatrix subclass) with ghost rows.
Definition: Ifpack2_OverlappingRowMatrix_decl.hpp:58
Additive Schwarz domain decomposition for Tpetra sparse matrices.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:282
virtual bool isComputed() const
Returns true if the preconditioner has been successfully computed, false otherwise.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1055
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:462
Preconditioners and smoothers for Tpetra sparse matrices.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:73
void registerLinearSolverFactory()
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:1544
void getValidParameters(Teuchos::ParameterList ¶ms)
Fills a list which contains all the parameters possibly used by Ifpack2.
Definition: Ifpack2_Parameters.cpp:51
typename MatrixType::scalar_type scalar_type
The type of the entries of the input MatrixType.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:313
virtual int getNumInitialize() const
Returns the number of calls to initialize().
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1062
virtual int getNumApply() const
Returns the number of calls to apply().
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1076
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:294