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 "Zoltan2_TpetraRowGraphAdapter.hpp" 66 #include "Zoltan2_OrderingProblem.hpp" 67 #include "Zoltan2_OrderingSolution.hpp" 71 #include "Ifpack2_LocalFilter.hpp" 72 #include "Ifpack2_OverlappingRowMatrix.hpp" 73 #include "Ifpack2_Parameters.hpp" 74 #include "Ifpack2_ReorderFilter.hpp" 75 #include "Ifpack2_SingletonFilter.hpp" 78 #include "Teuchos_DefaultMpiComm.hpp" 81 #include "Teuchos_StandardParameterEntryValidators.hpp" 98 template<
class MatrixType,
class LocalInverseType>
100 AdditiveSchwarz<MatrixType, LocalInverseType>::hasInnerPrecName ()
const 102 const char* options[4] = {
103 "inner preconditioner name",
104 "subdomain solver name",
105 "schwarz: inner preconditioner name",
106 "schwarz: subdomain solver name" 108 const int numOptions = 4;
110 for (
int k = 0; k < numOptions && ! match; ++k) {
111 if (List_.isParameter (options[k])) {
119 template<
class MatrixType,
class LocalInverseType>
121 AdditiveSchwarz<MatrixType, LocalInverseType>::removeInnerPrecName ()
123 const char* options[4] = {
124 "inner preconditioner name",
125 "subdomain solver name",
126 "schwarz: inner preconditioner name",
127 "schwarz: subdomain solver name" 129 const int numOptions = 4;
130 for (
int k = 0; k < numOptions; ++k) {
131 List_.remove (options[k],
false);
136 template<
class MatrixType,
class LocalInverseType>
138 AdditiveSchwarz<MatrixType, LocalInverseType>::innerPrecName ()
const 140 const char* options[4] = {
141 "inner preconditioner name",
142 "subdomain solver name",
143 "schwarz: inner preconditioner name",
144 "schwarz: subdomain solver name" 146 const int numOptions = 4;
151 for (
int k = 0; k < numOptions && ! match; ++k) {
152 if (List_.isParameter (options[k])) {
158 newName = List_.get<std::string> (options[k]);
163 return match ? newName : defaultInnerPrecName ();
167 template<
class MatrixType,
class LocalInverseType>
169 AdditiveSchwarz<MatrixType, LocalInverseType>::removeInnerPrecParams ()
171 const char* options[4] = {
172 "inner preconditioner parameters",
173 "subdomain solver parameters",
174 "schwarz: inner preconditioner parameters",
175 "schwarz: subdomain solver parameters" 177 const int numOptions = 4;
180 for (
int k = 0; k < numOptions; ++k) {
181 List_.remove (options[k],
false);
186 template<
class MatrixType,
class LocalInverseType>
187 std::pair<Teuchos::ParameterList, bool>
188 AdditiveSchwarz<MatrixType, LocalInverseType>::innerPrecParams ()
const 190 const char* options[4] = {
191 "inner preconditioner parameters",
192 "subdomain solver parameters",
193 "schwarz: inner preconditioner parameters",
194 "schwarz: subdomain solver parameters" 196 const int numOptions = 4;
197 Teuchos::ParameterList params;
201 for (
int k = 0; k < numOptions && ! match; ++k) {
202 if (List_.isSublist (options[k])) {
203 params = List_.sublist (options[k]);
208 return std::make_pair (params, match);
212 template<
class MatrixType,
class LocalInverseType>
214 AdditiveSchwarz<MatrixType, LocalInverseType>::defaultInnerPrecName ()
222 template<
class MatrixType,
class LocalInverseType>
226 IsInitialized_ (false),
228 IsOverlapping_ (false),
230 CombineMode_ (Tpetra::ZERO),
231 UseReordering_ (false),
232 ReorderingAlgorithm_ (
"none"),
233 FilterSingletons_ (false),
235 ZeroStartingSolution_(true),
239 InitializeTime_ (0.0),
243 Teuchos::ParameterList plist;
247 template<
class MatrixType,
class LocalInverseType>
250 const int overlapLevel) :
252 IsInitialized_ (false),
254 IsOverlapping_ (false),
255 OverlapLevel_ (overlapLevel),
256 CombineMode_ (Tpetra::ZERO),
257 UseReordering_ (false),
258 ReorderingAlgorithm_ (
"none"),
259 FilterSingletons_ (false),
261 ZeroStartingSolution_(true),
265 InitializeTime_ (0.0),
269 Teuchos::ParameterList plist;
274 template<
class MatrixType,
class LocalInverseType>
278 template<
class MatrixType,
class LocalInverseType>
279 Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type > >
282 TEUCHOS_TEST_FOR_EXCEPTION(
283 Matrix_.is_null (), std::runtime_error,
"Ifpack2::AdditiveSchwarz::" 284 "getDomainMap: The matrix to precondition is null. You must either pass " 285 "a nonnull matrix to the constructor, or call setMatrix() with a nonnull " 286 "input, before you may call this method.");
287 return Matrix_->getDomainMap ();
291 template<
class MatrixType,
class LocalInverseType>
292 Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type> >
295 TEUCHOS_TEST_FOR_EXCEPTION(
296 Matrix_.is_null (), std::runtime_error,
"Ifpack2::AdditiveSchwarz::" 297 "getRangeMap: The matrix to precondition is null. You must either pass " 298 "a nonnull matrix to the constructor, or call setMatrix() with a nonnull " 299 "input, before you may call this method.");
300 return Matrix_->getRangeMap ();
304 template<
class MatrixType,
class LocalInverseType>
311 template<
class MatrixType,
class LocalInverseType>
314 apply (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &B,
315 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &Y,
316 Teuchos::ETransp mode,
321 using Teuchos::TimeMonitor;
324 using Teuchos::rcp_dynamic_cast;
325 typedef Teuchos::ScalarTraits<scalar_type> STS;
326 const char prefix[] =
"Ifpack2::AdditiveSchwarz::apply: ";
328 TEUCHOS_TEST_FOR_EXCEPTION
329 (! IsComputed_, std::runtime_error,
330 prefix <<
"isComputed() must be true before you may call apply().");
331 TEUCHOS_TEST_FOR_EXCEPTION
332 (Matrix_.is_null (), std::logic_error, prefix <<
333 "The input matrix A is null, but the preconditioner says that it has " 334 "been computed (isComputed() is true). This should never happen, since " 335 "setMatrix() should always mark the preconditioner as not computed if " 336 "its argument is null. " 337 "Please report this bug to the Ifpack2 developers.");
338 TEUCHOS_TEST_FOR_EXCEPTION
339 (Inverse_.is_null (), std::runtime_error,
340 prefix <<
"The subdomain solver is null. " 341 "This can only happen if you called setInnerPreconditioner() with a null " 342 "input, after calling initialize() or compute(). If you choose to call " 343 "setInnerPreconditioner() with a null input, you must then call it with " 344 "a nonnull input before you may call initialize() or compute().");
345 TEUCHOS_TEST_FOR_EXCEPTION
346 (B.getNumVectors() != Y.getNumVectors(), std::invalid_argument,
347 prefix <<
"B and Y must have the same number of columns. B has " <<
348 B.getNumVectors () <<
" columns, but Y has " << Y.getNumVectors() <<
".");
349 TEUCHOS_TEST_FOR_EXCEPTION
350 (IsOverlapping_ && OverlappingMatrix_.is_null (), std::logic_error,
351 prefix <<
"The overlapping matrix is null. " 352 "This should never happen if IsOverlapping_ is true. " 353 "Please report this bug to the Ifpack2 developers.");
354 TEUCHOS_TEST_FOR_EXCEPTION
355 (! IsOverlapping_ && localMap_.is_null (), std::logic_error,
356 prefix <<
"localMap_ is null. " 357 "This should never happen if IsOverlapping_ is false. " 358 "Please report this bug to the Ifpack2 developers.");
359 TEUCHOS_TEST_FOR_EXCEPTION
360 (alpha != STS::one (), std::logic_error,
361 prefix <<
"Not implemented for alpha != 1.");
362 TEUCHOS_TEST_FOR_EXCEPTION
363 (beta != STS::zero (), std::logic_error,
364 prefix <<
"Not implemented for beta != 0.");
366 #ifdef HAVE_IFPACK2_DEBUG 369 typedef Teuchos::ScalarTraits<magnitude_type> STM;
370 Teuchos::Array<magnitude_type> norms (B.getNumVectors ());
373 for (
size_t j = 0; j < B.getNumVectors (); ++j) {
374 if (STM::isnaninf (norms[j])) {
379 TEUCHOS_TEST_FOR_EXCEPTION
380 (! good, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 381 "The 2-norm of the input B is NaN or Inf.");
383 #endif // HAVE_IFPACK2_DEBUG 385 #ifdef HAVE_IFPACK2_DEBUG 386 if (! ZeroStartingSolution_) {
388 typedef Teuchos::ScalarTraits<magnitude_type> STM;
389 Teuchos::Array<magnitude_type> norms (Y.getNumVectors ());
392 for (
size_t j = 0; j < Y.getNumVectors (); ++j) {
393 if (STM::isnaninf (norms[j])) {
398 TEUCHOS_TEST_FOR_EXCEPTION
399 (! good, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 400 "On input, the initial guess Y has 2-norm NaN or Inf " 401 "(ZeroStartingSolution_ is false).");
403 #endif // HAVE_IFPACK2_DEBUG 405 const std::string timerName (
"Ifpack2::AdditiveSchwarz::apply");
406 RCP<Time> timer = TimeMonitor::lookupCounter (timerName);
407 if (timer.is_null ()) {
408 timer = TimeMonitor::getNewCounter (timerName);
412 TimeMonitor timeMon (*timer);
414 const scalar_type ZERO = Teuchos::ScalarTraits<scalar_type>::zero ();
416 const size_t numVectors = B.getNumVectors ();
420 if (ZeroStartingSolution_) {
425 RCP<MV> OverlappingB,OverlappingY;
426 RCP<MV> globalOverlappingB;
427 if (IsOverlapping_) {
429 OverlappingB = rcp (
new MV (OverlappingMatrix_->getRowMap (), numVectors));
430 OverlappingY = rcp (
new MV (OverlappingMatrix_->getRowMap (), numVectors));
439 OverlappingB = rcp (
new MV (localMap_, numVectors));
440 OverlappingY = rcp (
new MV (localMap_, numVectors));
443 OverlappingB->offsetViewNonConst (Matrix_->getRowMap (), 0);
446 if (DistributedImporter_.is_null ()) {
450 DistributedImporter_ =
451 rcp (
new import_type (Matrix_->getRowMap (),
452 Matrix_->getDomainMap ()));
456 RCP<MV> R = rcp(
new MV(B.getMap(),numVectors));
457 RCP<MV> C = rcp(
new MV(Y.getMap(),numVectors));
459 for (
int ni=0; ni<NumIterations_; ++ni)
461 #ifdef HAVE_IFPACK2_DEBUG 464 typedef Teuchos::ScalarTraits<magnitude_type> STM;
465 Teuchos::Array<magnitude_type> norms (Y.getNumVectors ());
469 j < Y.getNumVectors (); ++j) {
470 if (STM::isnaninf (norms[j])) {
475 TEUCHOS_TEST_FOR_EXCEPTION
476 (! good, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 477 "At top of iteration " << ni <<
", the 2-norm of Y is NaN or Inf.");
479 #endif // HAVE_IFPACK2_DEBUG 481 Tpetra::deep_copy(*R, B);
486 if (!ZeroStartingSolution_ || ni > 0) {
488 Matrix_->apply (Y, *R, mode, -STS::one(), STS::one());
490 #ifdef HAVE_IFPACK2_DEBUG 493 typedef Teuchos::ScalarTraits<magnitude_type> STM;
494 Teuchos::Array<magnitude_type> norms (R->getNumVectors ());
497 for (
size_t j = 0; j < R->getNumVectors (); ++j) {
498 if (STM::isnaninf (norms[j])) {
503 TEUCHOS_TEST_FOR_EXCEPTION
504 (! good, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 505 "At iteration " << ni <<
", the 2-norm of R (result of computing " 506 "residual with Y) is NaN or Inf.");
508 #endif // HAVE_IFPACK2_DEBUG 512 RCP<overlap_mat_type> overlapMatrix;
513 if (IsOverlapping_) {
514 overlapMatrix = rcp_dynamic_cast<overlap_mat_type> (OverlappingMatrix_);
515 TEUCHOS_TEST_FOR_EXCEPTION
516 (overlapMatrix.is_null (), std::logic_error, prefix <<
517 "IsOverlapping_ is true, but OverlappingMatrix_, while nonnull, is " 518 "not an OverlappingRowMatrix<row_matrix_type>. Please report this " 519 "bug to the Ifpack2 developers.");
523 if (IsOverlapping_) {
524 TEUCHOS_TEST_FOR_EXCEPTION
525 (overlapMatrix.is_null (), std::logic_error, prefix
526 <<
"overlapMatrix is null when it shouldn't be. " 527 "Please report this bug to the Ifpack2 developers.");
528 overlapMatrix->importMultiVector (*R, *OverlappingB, Tpetra::INSERT);
545 #ifdef HAVE_IFPACK2_DEBUG 548 typedef Teuchos::ScalarTraits<magnitude_type> STM;
549 Teuchos::Array<magnitude_type> norms (OverlappingB->getNumVectors ());
550 OverlappingB->norm2 (norms ());
553 j < OverlappingB->getNumVectors (); ++j) {
554 if (STM::isnaninf (norms[j])) {
559 TEUCHOS_TEST_FOR_EXCEPTION
560 (! good, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 561 "At iteration " << ni <<
", result of importMultiVector from R " 562 "to OverlappingB, has 2-norm NaN or Inf.");
564 #endif // HAVE_IFPACK2_DEBUG 566 globalOverlappingB->doImport (*R, *DistributedImporter_, Tpetra::INSERT);
568 #ifdef HAVE_IFPACK2_DEBUG 571 typedef Teuchos::ScalarTraits<magnitude_type> STM;
572 Teuchos::Array<magnitude_type> norms (globalOverlappingB->getNumVectors ());
573 globalOverlappingB->norm2 (norms ());
576 j < globalOverlappingB->getNumVectors (); ++j) {
577 if (STM::isnaninf (norms[j])) {
582 TEUCHOS_TEST_FOR_EXCEPTION
583 (! good, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 584 "At iteration " << ni <<
", result of doImport from R, has 2-norm " 587 #endif // HAVE_IFPACK2_DEBUG 590 #ifdef HAVE_IFPACK2_DEBUG 593 typedef Teuchos::ScalarTraits<magnitude_type> STM;
594 Teuchos::Array<magnitude_type> norms (OverlappingB->getNumVectors ());
595 OverlappingB->norm2 (norms ());
598 j < OverlappingB->getNumVectors (); ++j) {
599 if (STM::isnaninf (norms[j])) {
604 TEUCHOS_TEST_FOR_EXCEPTION
605 (! good, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 606 "At iteration " << ni <<
", right before localApply, the 2-norm of " 607 "OverlappingB is NaN or Inf.");
609 #endif // HAVE_IFPACK2_DEBUG 612 localApply(*OverlappingB, *OverlappingY);
614 #ifdef HAVE_IFPACK2_DEBUG 617 typedef Teuchos::ScalarTraits<magnitude_type> STM;
618 Teuchos::Array<magnitude_type> norms (OverlappingY->getNumVectors ());
619 OverlappingY->norm2 (norms ());
622 j < OverlappingY->getNumVectors (); ++j) {
623 if (STM::isnaninf (norms[j])) {
628 TEUCHOS_TEST_FOR_EXCEPTION
629 (! good, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 630 "At iteration " << ni <<
", after localApply and before export / " 631 "copy, the 2-norm of OverlappingY is NaN or Inf.");
633 #endif // HAVE_IFPACK2_DEBUG 635 #ifdef HAVE_IFPACK2_DEBUG 638 typedef Teuchos::ScalarTraits<magnitude_type> STM;
639 Teuchos::Array<magnitude_type> norms (C->getNumVectors ());
643 j < C->getNumVectors (); ++j) {
644 if (STM::isnaninf (norms[j])) {
649 TEUCHOS_TEST_FOR_EXCEPTION
650 (! good, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 651 "At iteration " << ni <<
", before export / copy, the 2-norm of C " 654 #endif // HAVE_IFPACK2_DEBUG 657 if (IsOverlapping_) {
658 TEUCHOS_TEST_FOR_EXCEPTION
659 (overlapMatrix.is_null (), std::logic_error, prefix
660 <<
"overlapMatrix is null when it shouldn't be. " 661 "Please report this bug to the Ifpack2 developers.");
662 overlapMatrix->exportMultiVector (*OverlappingY, *C, CombineMode_);
671 RCP<MV> C_view = C->offsetViewNonConst (OverlappingY->getMap (), 0);
672 Tpetra::deep_copy (*C_view, *OverlappingY);
675 #ifdef HAVE_IFPACK2_DEBUG 678 typedef Teuchos::ScalarTraits<magnitude_type> STM;
679 Teuchos::Array<magnitude_type> norms (C->getNumVectors ());
683 j < C->getNumVectors (); ++j) {
684 if (STM::isnaninf (norms[j])) {
689 TEUCHOS_TEST_FOR_EXCEPTION
690 (! good, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 691 "At iteration " << ni <<
", before Y := C + Y, the 2-norm of C " 694 #endif // HAVE_IFPACK2_DEBUG 696 #ifdef HAVE_IFPACK2_DEBUG 699 typedef Teuchos::ScalarTraits<magnitude_type> STM;
700 Teuchos::Array<magnitude_type> norms (Y.getNumVectors ());
704 j < Y.getNumVectors (); ++j) {
705 if (STM::isnaninf (norms[j])) {
710 TEUCHOS_TEST_FOR_EXCEPTION
711 (! good, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 712 "Before Y := C + Y, at iteration " << ni <<
", the 2-norm of Y " 715 #endif // HAVE_IFPACK2_DEBUG 717 Y.update(STS::one(), *C, STS::one());
719 #ifdef HAVE_IFPACK2_DEBUG 722 typedef Teuchos::ScalarTraits<magnitude_type> STM;
723 Teuchos::Array<magnitude_type> norms (Y.getNumVectors ());
726 for (
size_t j = 0; j < Y.getNumVectors (); ++j) {
727 if (STM::isnaninf (norms[j])) {
732 TEUCHOS_TEST_FOR_EXCEPTION
733 ( ! good, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 734 "At iteration " << ni <<
", after Y := C + Y, the 2-norm of Y " 737 #endif // HAVE_IFPACK2_DEBUG 742 #ifdef HAVE_IFPACK2_DEBUG 745 typedef Teuchos::ScalarTraits<magnitude_type> STM;
746 Teuchos::Array<magnitude_type> norms (Y.getNumVectors ());
749 for (
size_t j = 0; j < Y.getNumVectors (); ++j) {
750 if (STM::isnaninf (norms[j])) {
755 TEUCHOS_TEST_FOR_EXCEPTION
756 ( ! good, std::runtime_error,
"Ifpack2::AdditiveSchwarz::apply: " 757 "The 2-norm of the output Y is NaN or Inf.");
759 #endif // HAVE_IFPACK2_DEBUG 765 ApplyTime_ = timer->totalElapsedTime ();
768 template<
class MatrixType,
class LocalInverseType>
771 localApply(MV &OverlappingB, MV &OverlappingY)
const 774 using Teuchos::rcp_dynamic_cast;
776 const size_t numVectors = OverlappingB.getNumVectors ();
777 if (FilterSingletons_) {
779 MV ReducedB (SingletonMatrix_->getRowMap (), numVectors);
780 MV ReducedY (SingletonMatrix_->getRowMap (), numVectors);
782 RCP<SingletonFilter<row_matrix_type> > singletonFilter =
784 TEUCHOS_TEST_FOR_EXCEPTION
785 (! SingletonMatrix_.is_null () && singletonFilter.is_null (),
786 std::logic_error,
"Ifpack2::AdditiveSchwarz::localApply: " 787 "SingletonFilter_ is nonnull but is not a SingletonFilter" 788 "<row_matrix_type>. This should never happen. Please report this bug " 789 "to the Ifpack2 developers.");
791 singletonFilter->CreateReducedRHS (OverlappingY, OverlappingB, ReducedB);
794 if (! UseReordering_) {
795 Inverse_->solve (ReducedY, ReducedB);
798 RCP<ReorderFilter<row_matrix_type> > rf =
799 rcp_dynamic_cast<ReorderFilter<row_matrix_type> > (ReorderedLocalizedMatrix_);
800 TEUCHOS_TEST_FOR_EXCEPTION
801 (! ReorderedLocalizedMatrix_.is_null () && rf.is_null (), std::logic_error,
802 "Ifpack2::AdditiveSchwarz::localApply: ReorderedLocalizedMatrix_ is " 803 "nonnull but is not a ReorderFilter<row_matrix_type>. This should " 804 "never happen. Please report this bug to the Ifpack2 developers.");
805 MV ReorderedB (ReducedB, Teuchos::Copy);
806 MV ReorderedY (ReducedY, Teuchos::Copy);
807 rf->permuteOriginalToReordered (ReducedB, ReorderedB);
808 Inverse_->solve (ReorderedY, ReorderedB);
809 rf->permuteReorderedToOriginal (ReorderedY, ReducedY);
813 singletonFilter->UpdateLHS (ReducedY, OverlappingY);
818 if (! UseReordering_) {
819 Inverse_->solve (OverlappingY, OverlappingB);
822 MV ReorderedB (OverlappingB, Teuchos::Copy);
823 MV ReorderedY (OverlappingY, Teuchos::Copy);
825 RCP<ReorderFilter<row_matrix_type> > rf =
826 rcp_dynamic_cast<ReorderFilter<row_matrix_type> > (ReorderedLocalizedMatrix_);
827 TEUCHOS_TEST_FOR_EXCEPTION
828 (! ReorderedLocalizedMatrix_.is_null () && rf.is_null (), std::logic_error,
829 "Ifpack2::AdditiveSchwarz::localApply: ReorderedLocalizedMatrix_ is " 830 "nonnull but is not a ReorderFilter<row_matrix_type>. This should " 831 "never happen. Please report this bug to the Ifpack2 developers.");
832 rf->permuteOriginalToReordered (OverlappingB, ReorderedB);
833 Inverse_->solve (ReorderedY, ReorderedB);
834 rf->permuteReorderedToOriginal (ReorderedY, OverlappingY);
840 template<
class MatrixType,
class LocalInverseType>
848 this->setParameterList (Teuchos::rcpFromRef (List_));
853 template<
class MatrixType,
class LocalInverseType>
857 using Tpetra::CombineMode;
858 using Teuchos::getIntegralValue;
859 using Teuchos::ParameterEntry;
860 using Teuchos::ParameterEntryValidator;
861 using Teuchos::ParameterList;
864 using Teuchos::rcp_dynamic_cast;
865 using Teuchos::StringToIntegralParameterEntryValidator;
867 if (plist.is_null ()) {
870 this->setParameterList (rcp (
new ParameterList ()));
876 TEUCHOS_TEST_FOR_EXCEPTION(
877 plist.is_null (), std::logic_error,
"Ifpack2::AdditiveSchwarz::" 878 "setParameterList: plist is null. This should never happen, since the " 879 "method should have replaced a null input list with a nonnull empty list " 880 "by this point. Please report this bug to the Ifpack2 developers.");
901 bool gotCombineMode =
false;
903 CombineMode_ = getIntegralValue<Tpetra::CombineMode> (List_,
"schwarz: combine mode");
904 gotCombineMode =
true;
906 catch (Teuchos::Exceptions::InvalidParameterName&) {
909 gotCombineMode =
true;
911 catch (Teuchos::Exceptions::InvalidParameterType&) {
918 if (! gotCombineMode) {
920 CombineMode_ = plist->get (
"schwarz: combine mode", CombineMode_);
921 gotCombineMode =
true;
923 catch (Teuchos::Exceptions::InvalidParameterType&) {}
929 if (! gotCombineMode) {
930 const ParameterEntry& validEntry =
932 RCP<const ParameterEntryValidator> v = validEntry.validator ();
933 typedef StringToIntegralParameterEntryValidator<CombineMode> vs2e_type;
934 RCP<const vs2e_type> vs2e = rcp_dynamic_cast<
const vs2e_type> (v,
true);
936 const ParameterEntry& inputEntry = plist->getEntry (
"schwarz: combine mode");
937 CombineMode_ = vs2e->getIntegralValue (inputEntry,
"schwarz: combine mode");
938 gotCombineMode =
true;
940 (void) gotCombineMode;
942 OverlapLevel_ = plist->get (
"schwarz: overlap level", OverlapLevel_);
948 UseReordering_ = plist->get (
"schwarz: use reordering", UseReordering_);
950 #if !defined(HAVE_IFPACK2_XPETRA) || !defined(HAVE_IFPACK2_ZOLTAN2) 951 TEUCHOS_TEST_FOR_EXCEPTION(
952 UseReordering_, std::invalid_argument,
"Ifpack2::AdditiveSchwarz::" 953 "setParameters: You specified \"schwarz: use reordering\" = true. " 954 "This is only valid when Trilinos was built with Ifpack2, Xpetra, and " 955 "Zoltan2 enabled. Either Xpetra or Zoltan2 was not enabled in your build " 967 FilterSingletons_ = plist->get (
"schwarz: filter singletons", FilterSingletons_);
1002 if (! Inverse_.is_null ()) {
1005 if (hasInnerPrecName () && innerPrecName () !=
"CUSTOM") {
1008 Inverse_ = Teuchos::null;
1013 std::pair<Teuchos::ParameterList, bool> result = innerPrecParams ();
1014 if (result.second) {
1017 Inverse_->setParameters (rcp (
new ParameterList (result.first)));
1022 NumIterations_ = plist->get<
int>(
"schwarz: num iterations", NumIterations_);
1023 ZeroStartingSolution_ = plist->get<
bool>(
"schwarz: zero starting solution", ZeroStartingSolution_);
1028 template<
class MatrixType,
class LocalInverseType>
1029 Teuchos::RCP<const Teuchos::ParameterList>
1033 using Teuchos::ParameterList;
1034 using Teuchos::parameterList;
1036 using Teuchos::rcp_const_cast;
1038 if (validParams_.is_null ()) {
1039 const int overlapLevel = 0;
1040 const bool useReordering =
false;
1041 const bool filterSingletons =
false;
1042 const int numIterations = 1;
1043 const bool zeroStartingSolution =
true;
1044 ParameterList reorderingSublist;
1045 reorderingSublist.set (
"order_method", std::string (
"rcm"));
1047 RCP<ParameterList> plist = parameterList (
"Ifpack2::AdditiveSchwarz");
1049 Tpetra::setCombineModeParameter (*plist,
"schwarz: combine mode");
1050 plist->set (
"schwarz: overlap level", overlapLevel);
1051 plist->set (
"schwarz: use reordering", useReordering);
1052 plist->set (
"schwarz: reordering list", reorderingSublist);
1055 plist->set (
"schwarz: compute condest",
false);
1056 plist->set (
"schwarz: filter singletons", filterSingletons);
1057 plist->set (
"schwarz: num iterations", numIterations);
1058 plist->set (
"schwarz: zero starting solution", zeroStartingSolution);
1068 validParams_ = rcp_const_cast<
const ParameterList> (plist);
1070 return validParams_;
1074 template<
class MatrixType,
class LocalInverseType>
1077 using Tpetra::global_size_t;
1080 using Teuchos::SerialComm;
1081 using Teuchos::Time;
1082 using Teuchos::TimeMonitor;
1084 const std::string timerName (
"Ifpack2::AdditiveSchwarz::initialize");
1085 RCP<Time> timer = TimeMonitor::lookupCounter (timerName);
1086 if (timer.is_null ()) {
1087 timer = TimeMonitor::getNewCounter (timerName);
1091 TimeMonitor timeMon (*timer);
1093 TEUCHOS_TEST_FOR_EXCEPTION(
1094 Matrix_.is_null (), std::runtime_error,
"Ifpack2::AdditiveSchwarz::" 1095 "initialize: The matrix to precondition is null. You must either pass " 1096 "a nonnull matrix to the constructor, or call setMatrix() with a nonnull " 1097 "input, before you may call this method.");
1099 IsInitialized_ =
false;
1100 IsComputed_ =
false;
1102 RCP<const Teuchos::Comm<int> > comm = Matrix_->getComm ();
1103 RCP<const map_type> rowMap = Matrix_->getRowMap ();
1104 RCP<node_type> node = Matrix_->getNode ();
1105 const global_size_t INVALID =
1106 Teuchos::OrdinalTraits<global_size_t>::invalid ();
1110 if (comm->getSize () == 1) {
1112 IsOverlapping_ =
false;
1113 }
else if (OverlapLevel_ != 0) {
1114 IsOverlapping_ =
true;
1117 if (OverlapLevel_ == 0) {
1119 RCP<const SerialComm<int> > localComm (
new SerialComm<int> ());
1123 rcp (
new map_type (INVALID, rowMap->getNodeNumElements (),
1124 indexBase, localComm, node));
1128 if (IsOverlapping_) {
1134 if (! Inverse_.is_null ()) {
1135 Inverse_->symbolic ();
1140 IsInitialized_ =
true;
1145 InitializeTime_ = timer->totalElapsedTime ();
1149 template<
class MatrixType,
class LocalInverseType>
1152 return IsInitialized_;
1156 template<
class MatrixType,
class LocalInverseType>
1160 using Teuchos::Time;
1161 using Teuchos::TimeMonitor;
1163 if (! IsInitialized_) {
1167 TEUCHOS_TEST_FOR_EXCEPTION(
1168 ! isInitialized (), std::logic_error,
"Ifpack2::AdditiveSchwarz::compute: " 1169 "The preconditioner is not yet initialized, " 1170 "even though initialize() supposedly has been called. " 1171 "This should never happen. " 1172 "Please report this bug to the Ifpack2 developers.");
1174 TEUCHOS_TEST_FOR_EXCEPTION(
1175 Inverse_.is_null (), std::runtime_error,
1176 "Ifpack2::AdditiveSchwarz::compute: The subdomain solver is null. " 1177 "This can only happen if you called setInnerPreconditioner() with a null " 1178 "input, after calling initialize() or compute(). If you choose to call " 1179 "setInnerPreconditioner() with a null input, you must then call it with a " 1180 "nonnull input before you may call initialize() or compute().");
1182 const std::string timerName (
"Ifpack2::AdditiveSchwarz::compute");
1183 RCP<Time> timer = TimeMonitor::lookupCounter (timerName);
1184 if (timer.is_null ()) {
1185 timer = TimeMonitor::getNewCounter (timerName);
1189 TimeMonitor timeMon (*timer);
1191 IsComputed_ =
false;
1192 Inverse_->numeric ();
1200 ComputeTime_ = timer->totalElapsedTime ();
1205 template<
class MatrixType,
class LocalInverseType>
1212 template<
class MatrixType,
class LocalInverseType>
1215 return NumInitialize_;
1219 template<
class MatrixType,
class LocalInverseType>
1226 template<
class MatrixType,
class LocalInverseType>
1233 template<
class MatrixType,
class LocalInverseType>
1236 return InitializeTime_;
1240 template<
class MatrixType,
class LocalInverseType>
1243 return ComputeTime_;
1247 template<
class MatrixType,
class LocalInverseType>
1254 template<
class MatrixType,
class LocalInverseType>
1257 std::ostringstream out;
1259 out <<
"\"Ifpack2::AdditiveSchwarz\": {";
1260 if (this->getObjectLabel () !=
"") {
1261 out <<
"Label: \"" << this->getObjectLabel () <<
"\", ";
1263 out <<
"Initialized: " << (isInitialized () ?
"true" :
"false")
1264 <<
", Computed: " << (isComputed () ?
"true" :
"false")
1265 <<
", Iterations: " << NumIterations_
1266 <<
", Overlap level: " << OverlapLevel_
1267 <<
", Subdomain reordering: \"" << ReorderingAlgorithm_ <<
"\"";
1268 out <<
", Combine mode: \"";
1269 if (CombineMode_ == Tpetra::INSERT) {
1271 }
else if (CombineMode_ == Tpetra::ADD) {
1273 }
else if (CombineMode_ == Tpetra::REPLACE) {
1275 }
else if (CombineMode_ == Tpetra::ABSMAX) {
1277 }
else if (CombineMode_ == Tpetra::ZERO) {
1281 if (Matrix_.is_null ()) {
1282 out <<
", Matrix: null";
1285 out <<
", Global matrix dimensions: [" 1286 << Matrix_->getGlobalNumRows () <<
", " 1287 << Matrix_->getGlobalNumCols () <<
"]";
1289 out <<
", Inner solver: ";
1290 if (! Inverse_.is_null ()) {
1291 Teuchos::RCP<Teuchos::Describable> inv =
1292 Teuchos::rcp_dynamic_cast<Teuchos::Describable> (Inverse_);
1293 if (! inv.is_null ()) {
1294 out <<
"{" << inv->description () <<
"}";
1296 out <<
"{" <<
"Some inner solver" <<
"}";
1307 template<
class MatrixType,
class LocalInverseType>
1311 const Teuchos::EVerbosityLevel verbLevel)
const 1313 using Teuchos::OSTab;
1314 using Teuchos::TypeNameTraits;
1317 const int myRank = Matrix_->getComm ()->getRank ();
1318 const int numProcs = Matrix_->getComm ()->getSize ();
1319 const Teuchos::EVerbosityLevel vl =
1320 (verbLevel == Teuchos::VERB_DEFAULT) ? Teuchos::VERB_LOW : verbLevel;
1322 if (vl > Teuchos::VERB_NONE) {
1326 out <<
"\"Ifpack2::AdditiveSchwarz\":";
1330 out <<
"MatrixType: " << TypeNameTraits<MatrixType>::name () << endl;
1331 out <<
"LocalInverseType: " << TypeNameTraits<LocalInverseType>::name () << endl;
1332 if (this->getObjectLabel () !=
"") {
1333 out <<
"Label: \"" << this->getObjectLabel () <<
"\"" << endl;
1336 out <<
"Overlap level: " << OverlapLevel_ << endl
1337 <<
"Combine mode: \"";
1338 if (CombineMode_ == Tpetra::INSERT) {
1340 }
else if (CombineMode_ == Tpetra::ADD) {
1342 }
else if (CombineMode_ == Tpetra::REPLACE) {
1344 }
else if (CombineMode_ == Tpetra::ABSMAX) {
1346 }
else if (CombineMode_ == Tpetra::ZERO) {
1350 <<
"Subdomain reordering: \"" << ReorderingAlgorithm_ <<
"\"" << endl;
1353 if (Matrix_.is_null ()) {
1355 out <<
"Matrix: null" << endl;
1360 out <<
"Matrix:" << endl;
1363 Matrix_->getComm ()->barrier ();
1364 Matrix_->describe (out, Teuchos::VERB_LOW);
1368 out <<
"Number of initialize calls: " << getNumInitialize () << endl
1369 <<
"Number of compute calls: " << getNumCompute () << endl
1370 <<
"Number of apply calls: " << getNumApply () << endl
1371 <<
"Total time in seconds for initialize: " << getInitializeTime () << endl
1372 <<
"Total time in seconds for compute: " << getComputeTime () << endl
1373 <<
"Total time in seconds for apply: " << getApplyTime () << endl;
1376 if (Inverse_.is_null ()) {
1378 out <<
"Subdomain solver: null" << endl;
1382 if (vl < Teuchos::VERB_EXTREME) {
1384 out <<
"Subdomain solver: not null" << endl;
1388 for (
int p = 0; p < numProcs; ++p) {
1390 out <<
"Subdomain solver on Process " << myRank <<
":";
1391 if (Inverse_.is_null ()) {
1392 out <<
"null" << endl;
1394 Teuchos::RCP<Teuchos::Describable> inv =
1395 Teuchos::rcp_dynamic_cast<Teuchos::Describable> (Inverse_);
1396 if (! inv.is_null ()) {
1398 inv->describe (out, vl);
1400 out <<
"null" << endl;
1404 Matrix_->getComm ()->barrier ();
1405 Matrix_->getComm ()->barrier ();
1406 Matrix_->getComm ()->barrier ();
1411 Matrix_->getComm ()->barrier ();
1416 template<
class MatrixType,
class LocalInverseType>
1419 Teuchos::FancyOStream fos(Teuchos::rcp(&os,
false));
1420 fos.setOutputToRootOnly(0);
1426 template<
class MatrixType,
class LocalInverseType>
1429 return OverlapLevel_;
1433 template<
class MatrixType,
class LocalInverseType>
1437 using Teuchos::MpiComm;
1439 using Teuchos::ArrayRCP;
1440 using Teuchos::ParameterList;
1443 using Teuchos::rcp_dynamic_cast;
1444 using Teuchos::rcpFromRef;
1446 TEUCHOS_TEST_FOR_EXCEPTION(
1447 Matrix_.is_null (), std::runtime_error,
"Ifpack2::AdditiveSchwarz::" 1448 "initialize: The matrix to precondition is null. You must either pass " 1449 "a nonnull matrix to the constructor, or call setMatrix() with a nonnull " 1450 "input, before you may call this method.");
1453 RCP<row_matrix_type> LocalizedMatrix;
1457 RCP<row_matrix_type> ActiveMatrix;
1460 if (! OverlappingMatrix_.is_null ()) {
1464 LocalizedMatrix = rcp (
new LocalFilter<row_matrix_type> (Matrix_));
1468 TEUCHOS_TEST_FOR_EXCEPTION(
1469 LocalizedMatrix.is_null (), std::logic_error,
1470 "Ifpack2::AdditiveSchwarz::setup: LocalizedMatrix is null, after the code " 1471 "that claimed to have created it. This should never be the case. Please " 1472 "report this bug to the Ifpack2 developers.");
1475 ActiveMatrix = LocalizedMatrix;
1478 if (FilterSingletons_) {
1479 SingletonMatrix_ = rcp (
new SingletonFilter<row_matrix_type> (LocalizedMatrix));
1480 ActiveMatrix = SingletonMatrix_;
1484 if (UseReordering_) {
1485 #if defined(HAVE_IFPACK2_XPETRA) && defined(HAVE_IFPACK2_ZOLTAN2) 1487 Teuchos::ParameterList zlist = List_.sublist (
"schwarz: reordering list");
1490 ReorderingAlgorithm_ = List_.get<std::string> (
"order_method",
"rcm");
1492 typedef Tpetra::RowGraph
1493 <local_ordinal_type, global_ordinal_type, node_type> row_graph_type;
1494 typedef Zoltan2::TpetraRowGraphAdapter<row_graph_type> z2_adapter_type;
1495 RCP<const row_graph_type> constActiveGraph =
1496 Teuchos::rcp_const_cast<
const row_graph_type>(ActiveMatrix->getGraph());
1497 z2_adapter_type Zoltan2Graph (constActiveGraph);
1499 typedef Zoltan2::OrderingProblem<z2_adapter_type> ordering_problem_type;
1504 RCP<const MpiComm<int> > mpicomm =
1505 rcp_dynamic_cast<
const MpiComm<int> > (ActiveMatrix->getComm ());
1506 if (mpicomm == Teuchos::null) {
1507 myRawComm = MPI_COMM_SELF;
1509 myRawComm = * (mpicomm->getRawMpiComm ());
1511 ordering_problem_type MyOrderingProblem (&Zoltan2Graph, &zlist, myRawComm);
1513 ordering_problem_type MyOrderingProblem (&Zoltan2Graph, &zlist);
1515 MyOrderingProblem.solve ();
1519 typedef ReorderFilter<row_matrix_type> reorder_filter_type;
1520 typedef Zoltan2::OrderingSolution<local_ordinal_type,
1521 global_ordinal_type> ordering_solution_type;
1523 ordering_solution_type sol (*MyOrderingProblem.getSolution ());
1529 ArrayRCP<local_ordinal_type> perm = sol.getPermutationRCPConst (
true);
1530 ArrayRCP<local_ordinal_type> revperm = sol.getPermutationRCPConst ();
1532 ReorderedLocalizedMatrix_ =
1533 rcp (
new reorder_filter_type (ActiveMatrix, perm, revperm));
1535 ActiveMatrix = ReorderedLocalizedMatrix_;
1540 TEUCHOS_TEST_FOR_EXCEPTION(
1541 true, std::logic_error,
"Ifpack2::AdditiveSchwarz::setup: " 1542 "The Zoltan2 and Xpetra packages must be enabled in order " 1543 "to support reordering.");
1547 innerMatrix_ = ActiveMatrix;
1549 TEUCHOS_TEST_FOR_EXCEPTION(
1550 innerMatrix_.is_null (), std::logic_error,
"Ifpack2::AdditiveSchwarz::" 1551 "setup: Inner matrix is null right before constructing inner solver. " 1552 "Please report this bug to the Ifpack2 developers.");
1555 if (Inverse_.is_null ()) {
1556 const std::string innerName = innerPrecName ();
1557 TEUCHOS_TEST_FOR_EXCEPTION(
1558 innerName ==
"INVALID", std::logic_error,
1559 "Ifpack2::AdditiveSchwarz::initialize: AdditiveSchwarz doesn't " 1560 "know how to create an instance of your LocalInverseType \"" 1561 << Teuchos::TypeNameTraits<LocalInverseType>::name () <<
"\". " 1562 "Please talk to the Ifpack2 developers for details.");
1564 TEUCHOS_TEST_FOR_EXCEPTION(
1565 innerName ==
"CUSTOM", std::runtime_error,
"Ifpack2::AdditiveSchwarz::" 1566 "initialize: If the \"inner preconditioner name\" parameter (or any " 1567 "alias thereof) has the value \"CUSTOM\", then you must first call " 1568 "setInnerPreconditioner with a nonnull inner preconditioner input before " 1569 "you may call initialize().");
1573 if (! Trilinos::Details::Impl::registeredSomeLinearSolverFactory (
"Ifpack2")) {
1579 typedef typename MV::mag_type MT;
1580 RCP<inner_solver_type> innerPrec =
1581 Trilinos::Details::getLinearSolver<MV, OP, MT> (
"Ifpack2", innerName);
1582 TEUCHOS_TEST_FOR_EXCEPTION(
1583 innerPrec.is_null (), std::logic_error,
1584 "Ifpack2::AdditiveSchwarz::setup: Failed to create inner preconditioner " 1585 "with name \"" << innerName <<
"\".");
1586 innerPrec->setMatrix (innerMatrix_);
1590 std::pair<Teuchos::ParameterList, bool> result = innerPrecParams ();
1591 if (result.second) {
1594 innerPrec->setParameters (rcp (
new ParameterList (result.first)));
1596 Inverse_ = innerPrec;
1598 else if (Inverse_->getMatrix ().getRawPtr () != innerMatrix_.getRawPtr ()) {
1602 Inverse_->setMatrix (innerMatrix_);
1604 TEUCHOS_TEST_FOR_EXCEPTION(
1605 Inverse_.is_null (), std::logic_error,
"Ifpack2::AdditiveSchwarz::" 1606 "setup: Inverse_ is null right after we were supposed to have created it." 1607 " Please report this bug to the Ifpack2 developers.");
1617 template<
class MatrixType,
class LocalInverseType>
1624 if (! innerPrec.is_null ()) {
1627 can_change_type* innerSolver =
dynamic_cast<can_change_type*
> (&*innerPrec);
1628 TEUCHOS_TEST_FOR_EXCEPTION(
1629 innerSolver == NULL, std::invalid_argument,
"Ifpack2::AdditiveSchwarz::" 1630 "setInnerPreconditioner: The input preconditioner does not implement the " 1631 "setMatrix() feature. Only input preconditioners that inherit from " 1632 "Ifpack2::Details::CanChangeMatrix implement this feature.");
1649 innerSolver->setMatrix (innerMatrix_);
1659 removeInnerPrecName ();
1660 removeInnerPrecParams ();
1661 List_.set (
"inner preconditioner name",
"CUSTOM");
1665 if (isInitialized ()) {
1666 innerPrec->initialize ();
1668 if (isComputed ()) {
1669 innerPrec->compute ();
1682 Inverse_ = Teuchos::rcp (
new inner_solver_impl_type (innerPrec,
"CUSTOM"));
1685 template<
class MatrixType,
class LocalInverseType>
1690 if (A.getRawPtr () != Matrix_.getRawPtr ()) {
1691 IsInitialized_ =
false;
1692 IsComputed_ =
false;
1695 OverlappingMatrix_ = Teuchos::null;
1696 ReorderedLocalizedMatrix_ = Teuchos::null;
1697 innerMatrix_ = Teuchos::null;
1698 SingletonMatrix_ = Teuchos::null;
1699 localMap_ = Teuchos::null;
1700 DistributedImporter_ = Teuchos::null;
1711 #define IFPACK2_ADDITIVESCHWARZ_INSTANT(S,LO,GO,N) \ 1712 template class Ifpack2::AdditiveSchwarz< Tpetra::RowMatrix<S, LO, GO, N> >; 1714 #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:280
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:855
virtual void compute()
Computes all (coefficient) data necessary to apply the preconditioner.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1157
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:1234
virtual double getComputeTime() const
Returns the time spent in compute().
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1241
MatrixType::node_type node_type
The Node type used by the input MatrixType.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:321
virtual Teuchos::RCP< const row_matrix_type > getMatrix() const
The input matrix.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:305
virtual double getApplyTime() const
Returns the time spent in apply().
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1248
virtual ~AdditiveSchwarz()
Destructor.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:275
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:1255
AdditiveSchwarz(const Teuchos::RCP< const row_matrix_type > &A)
Constructor that takes a matrix.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:224
virtual void initialize()
Computes all (graph-related) data necessary to initialize the preconditioner.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1075
Ifpack2 implementation details.
virtual bool isInitialized() const
Returns true if the preconditioner has been successfully initialized, false otherwise.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1150
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 int getOverlapLevel() const
Returns the level of overlap.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1427
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:1619
virtual int getNumCompute() const
Returns the number of calls to compute().
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1220
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
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:293
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Get a list of the preconditioner's default parameters.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1031
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:1310
virtual std::ostream & print(std::ostream &os) const
Prints basic information on iostream. This function is used by operator<<.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1417
virtual void setParameters(const Teuchos::ParameterList &plist)
Set the preconditioner's parameters.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:842
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:1206
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()
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:1687
void getValidParameters(Teuchos::ParameterList ¶ms)
Fills a list which contains all the parameters possibly used by Ifpack2.
Definition: Ifpack2_Parameters.cpp:50
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:1213
virtual int getNumApply() const
Returns the number of calls to apply().
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1227
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:314