22 #ifndef IFPACK2_ADDITIVESCHWARZ_DEF_HPP
23 #define IFPACK2_ADDITIVESCHWARZ_DEF_HPP
30 #include "Ifpack2_Details_LinearSolver.hpp"
31 #include "Ifpack2_Details_getParamTryingTypes.hpp"
33 #if defined(HAVE_IFPACK2_XPETRA) && defined(HAVE_IFPACK2_ZOLTAN2)
34 #include "Zoltan2_TpetraRowGraphAdapter.hpp"
35 #include "Zoltan2_OrderingProblem.hpp"
36 #include "Zoltan2_OrderingSolution.hpp"
40 #include "Ifpack2_Parameters.hpp"
41 #include "Ifpack2_LocalFilter.hpp"
42 #include "Ifpack2_ReorderFilter.hpp"
43 #include "Ifpack2_SingletonFilter.hpp"
44 #include "Ifpack2_Details_AdditiveSchwarzFilter.hpp"
50 #include "Teuchos_StandardParameterEntryValidators.hpp"
53 #include <Tpetra_BlockMultiVector.hpp>
64 #ifdef HAVE_IFPACK2_DEBUG
69 bool anyBad(
const MV& X) {
71 using magnitude_type =
typename STS::magnitudeType;
77 for (
size_t j = 0; j < X.getNumVectors(); ++j) {
78 if (STM::isnaninf(norms[j])) {
88 #endif // HAVE_IFPACK2_DEBUG
92 template <
class MatrixType,
class LocalInverseType>
93 bool AdditiveSchwarz<MatrixType, LocalInverseType>::hasInnerPrecName()
const {
94 const char* options[4] = {
95 "inner preconditioner name",
96 "subdomain solver name",
97 "schwarz: inner preconditioner name",
98 "schwarz: subdomain solver name"};
99 const int numOptions = 4;
101 for (
int k = 0; k < numOptions && !match; ++k) {
102 if (List_.isParameter(options[k])) {
109 template <
class MatrixType,
class LocalInverseType>
110 void AdditiveSchwarz<MatrixType, LocalInverseType>::removeInnerPrecName() {
111 const char* options[4] = {
112 "inner preconditioner name",
113 "subdomain solver name",
114 "schwarz: inner preconditioner name",
115 "schwarz: subdomain solver name"};
116 const int numOptions = 4;
117 for (
int k = 0; k < numOptions; ++k) {
118 List_.
remove(options[k],
false);
122 template <
class MatrixType,
class LocalInverseType>
124 AdditiveSchwarz<MatrixType, LocalInverseType>::innerPrecName()
const {
125 const char* options[4] = {
126 "inner preconditioner name",
127 "subdomain solver name",
128 "schwarz: inner preconditioner name",
129 "schwarz: subdomain solver name"};
130 const int numOptions = 4;
135 for (
int k = 0; k < numOptions && !match; ++k) {
137 List_.getEntryPtr(options[k]);
138 if (paramEnt !=
nullptr && paramEnt->
isType<std::string>()) {
139 newName = Teuchos::getValue<std::string>(*paramEnt);
143 return match ? newName : defaultInnerPrecName();
146 template <
class MatrixType,
class LocalInverseType>
147 void AdditiveSchwarz<MatrixType, LocalInverseType>::removeInnerPrecParams() {
148 const char* options[4] = {
149 "inner preconditioner parameters",
150 "subdomain solver parameters",
151 "schwarz: inner preconditioner parameters",
152 "schwarz: subdomain solver parameters"};
153 const int numOptions = 4;
156 for (
int k = 0; k < numOptions; ++k) {
157 List_.remove(options[k],
false);
161 template <
class MatrixType,
class LocalInverseType>
162 std::pair<Teuchos::ParameterList, bool>
163 AdditiveSchwarz<MatrixType, LocalInverseType>::innerPrecParams()
const {
164 const char* options[4] = {
165 "inner preconditioner parameters",
166 "subdomain solver parameters",
167 "schwarz: inner preconditioner parameters",
168 "schwarz: subdomain solver parameters"};
169 const int numOptions = 4;
174 for (
int k = 0; k < numOptions && !match; ++k) {
175 if (List_.isSublist(options[k])) {
176 params = List_.
sublist(options[k]);
181 return std::make_pair(params, match);
184 template <
class MatrixType,
class LocalInverseType>
186 AdditiveSchwarz<MatrixType, LocalInverseType>::defaultInnerPrecName() {
192 template <
class MatrixType,
class LocalInverseType>
197 template <
class MatrixType,
class LocalInverseType>
200 const int overlapLevel)
202 , OverlapLevel_(overlapLevel) {}
204 template <
class MatrixType,
class LocalInverseType>
209 Matrix_.is_null(), std::runtime_error,
210 "Ifpack2::AdditiveSchwarz::"
211 "getDomainMap: The matrix to precondition is null. You must either pass "
212 "a nonnull matrix to the constructor, or call setMatrix() with a nonnull "
213 "input, before you may call this method.");
214 return Matrix_->getDomainMap();
217 template <
class MatrixType,
class LocalInverseType>
221 Matrix_.is_null(), std::runtime_error,
222 "Ifpack2::AdditiveSchwarz::"
223 "getRangeMap: The matrix to precondition is null. You must either pass "
224 "a nonnull matrix to the constructor, or call setMatrix() with a nonnull "
225 "input, before you may call this method.");
226 return Matrix_->getRangeMap();
229 template <
class MatrixType,
class LocalInverseType>
236 template <
class MatrixType,
class map_type>
239 using BMV = Tpetra::BlockMultiVector<
240 typename MatrixType::scalar_type,
241 typename MatrixType::local_ordinal_type,
242 typename MatrixType::global_ordinal_type,
243 typename MatrixType::node_type>;
245 if (blockSize == 1)
return meshMap;
250 template <
typename MV,
typename Map>
251 void resetMultiVecIfNeeded(std::unique_ptr<MV>& mv_ptr,
const Map& map,
const size_t numVectors,
bool initialize) {
252 if (!mv_ptr || mv_ptr->getNumVectors() != numVectors) {
253 mv_ptr.reset(
new MV(map, numVectors, initialize));
259 template <
class MatrixType,
class LocalInverseType>
261 apply(
const Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& B,
262 Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& Y,
268 using Teuchos::rcp_dynamic_cast;
272 const char prefix[] =
"Ifpack2::AdditiveSchwarz::apply: ";
275 prefix <<
"isComputed() must be true before you may call apply().");
276 TEUCHOS_TEST_FOR_EXCEPTION(Matrix_.is_null(), std::logic_error, prefix <<
"The input matrix A is null, but the preconditioner says that it has "
277 "been computed (isComputed() is true). This should never happen, since "
278 "setMatrix() should always mark the preconditioner as not computed if "
279 "its argument is null. "
280 "Please report this bug to the Ifpack2 developers.");
282 prefix <<
"The subdomain solver is null. "
283 "This can only happen if you called setInnerPreconditioner() with a null "
284 "input, after calling initialize() or compute(). If you choose to call "
285 "setInnerPreconditioner() with a null input, you must then call it with "
286 "a nonnull input before you may call initialize() or compute().");
288 prefix <<
"B and Y must have the same number of columns. B has " << B.getNumVectors() <<
" columns, but Y has " << Y.getNumVectors() <<
".");
290 prefix <<
"The overlapping matrix is null. "
291 "This should never happen if IsOverlapping_ is true. "
292 "Please report this bug to the Ifpack2 developers.");
294 prefix <<
"localMap_ is null. "
295 "This should never happen if IsOverlapping_ is false. "
296 "Please report this bug to the Ifpack2 developers.");
298 prefix <<
"Not implemented for alpha != 1.");
299 TEUCHOS_TEST_FOR_EXCEPTION(beta != STS::zero(), std::logic_error,
300 prefix <<
"Not implemented for beta != 0.");
302 #ifdef HAVE_IFPACK2_DEBUG
304 const bool bad = anyBad(B);
305 TEUCHOS_TEST_FOR_EXCEPTION(bad, std::runtime_error,
306 "Ifpack2::AdditiveSchwarz::apply: "
307 "The 2-norm of the input B is NaN or Inf.");
309 #endif // HAVE_IFPACK2_DEBUG
311 #ifdef HAVE_IFPACK2_DEBUG
312 if (!ZeroStartingSolution_) {
313 const bool bad = anyBad(Y);
314 TEUCHOS_TEST_FOR_EXCEPTION(bad, std::runtime_error,
315 "Ifpack2::AdditiveSchwarz::apply: "
316 "On input, the initial guess Y has 2-norm NaN or Inf "
317 "(ZeroStartingSolution_ is false).");
319 #endif // HAVE_IFPACK2_DEBUG
321 const std::string timerName(
"Ifpack2::AdditiveSchwarz::apply");
322 RCP<Time> timer = TimeMonitor::lookupCounter(timerName);
323 if (timer.is_null()) {
324 timer = TimeMonitor::getNewCounter(timerName);
326 double startTime = timer->wallTime();
329 TimeMonitor timeMon(*timer);
332 const size_t numVectors = B.getNumVectors();
336 if (ZeroStartingSolution_) {
341 MV* OverlappingB =
nullptr;
342 MV* OverlappingY =
nullptr;
344 RCP<const map_type> B_and_Y_map = pointMapFromMeshMap<MatrixType>(IsOverlapping_ ? OverlappingMatrix_->getRowMap() : localMap_, Matrix_->getBlockSize());
345 resetMultiVecIfNeeded(overlapping_B_, B_and_Y_map, numVectors,
false);
346 resetMultiVecIfNeeded(overlapping_Y_, B_and_Y_map, numVectors,
false);
347 OverlappingB = overlapping_B_.get();
348 OverlappingY = overlapping_Y_.get();
351 OverlappingB->putScalar(ZERO);
352 OverlappingY->putScalar(ZERO);
355 RCP<MV> globalOverlappingB;
356 if (!IsOverlapping_) {
357 auto matrixPointRowMap = pointMapFromMeshMap<MatrixType>(Matrix_->getRowMap(), Matrix_->getBlockSize());
360 OverlappingB->offsetViewNonConst(matrixPointRowMap, 0);
363 if (DistributedImporter_.is_null()) {
367 DistributedImporter_ =
368 rcp(
new import_type(matrixPointRowMap,
369 Matrix_->getDomainMap()));
373 resetMultiVecIfNeeded(R_, B.getMap(), numVectors,
false);
374 resetMultiVecIfNeeded(C_, Y.getMap(), numVectors,
false);
378 if (IsOverlapping_ && AvgOverlap_) {
379 if (num_overlap_copies_.get() ==
nullptr) {
380 num_overlap_copies_.reset(
new MV(Y.getMap(), 1,
false));
381 RCP<MV> onesVec(
new MV(OverlappingMatrix_->getRowMap(), 1,
false));
385 dataNumOverlapCopies = num_overlap_copies_.get()->getDataNonConst(0);
395 for (
int ni = 0; ni < NumIterations_; ++ni) {
396 #ifdef HAVE_IFPACK2_DEBUG
398 const bool bad = anyBad(Y);
399 TEUCHOS_TEST_FOR_EXCEPTION(bad, std::runtime_error,
400 "Ifpack2::AdditiveSchwarz::apply: "
401 "At top of iteration "
402 << ni <<
", the 2-norm of Y is NaN or Inf.");
404 #endif // HAVE_IFPACK2_DEBUG
406 Tpetra::deep_copy(*R, B);
411 if (!ZeroStartingSolution_ || ni > 0) {
413 Matrix_->apply(Y, *R, mode, -STS::one(), STS::one());
415 #ifdef HAVE_IFPACK2_DEBUG
417 const bool bad = anyBad(*R);
418 TEUCHOS_TEST_FOR_EXCEPTION(bad, std::runtime_error,
419 "Ifpack2::AdditiveSchwarz::apply: "
421 << ni <<
", the 2-norm of R (result of computing "
422 "residual with Y) is NaN or Inf.");
424 #endif // HAVE_IFPACK2_DEBUG
428 if (IsOverlapping_) {
429 TEUCHOS_TEST_FOR_EXCEPTION(OverlappingMatrix_.is_null(), std::logic_error, prefix <<
"IsOverlapping_ is true, but OverlappingMatrix_, while nonnull, is "
430 "not an OverlappingRowMatrix<row_matrix_type>. Please report this "
431 "bug to the Ifpack2 developers.");
432 OverlappingMatrix_->importMultiVector(*R, *OverlappingB, Tpetra::INSERT);
449 #ifdef HAVE_IFPACK2_DEBUG
451 const bool bad = anyBad(*OverlappingB);
452 TEUCHOS_TEST_FOR_EXCEPTION(bad, std::runtime_error,
453 "Ifpack2::AdditiveSchwarz::apply: "
455 << ni <<
", result of importMultiVector from R "
456 "to OverlappingB, has 2-norm NaN or Inf.");
458 #endif // HAVE_IFPACK2_DEBUG
460 globalOverlappingB->doImport(*R, *DistributedImporter_, Tpetra::INSERT);
462 #ifdef HAVE_IFPACK2_DEBUG
464 const bool bad = anyBad(*globalOverlappingB);
465 TEUCHOS_TEST_FOR_EXCEPTION(bad, std::runtime_error,
466 "Ifpack2::AdditiveSchwarz::apply: "
468 << ni <<
", result of doImport from R, has 2-norm "
471 #endif // HAVE_IFPACK2_DEBUG
474 #ifdef HAVE_IFPACK2_DEBUG
476 const bool bad = anyBad(*OverlappingB);
477 TEUCHOS_TEST_FOR_EXCEPTION(bad, std::runtime_error,
478 "Ifpack2::AdditiveSchwarz::apply: "
480 << ni <<
", right before localApply, the 2-norm of "
481 "OverlappingB is NaN or Inf.");
483 #endif // HAVE_IFPACK2_DEBUG
486 localApply(*OverlappingB, *OverlappingY);
488 #ifdef HAVE_IFPACK2_DEBUG
490 const bool bad = anyBad(*OverlappingY);
491 TEUCHOS_TEST_FOR_EXCEPTION(bad, std::runtime_error,
492 "Ifpack2::AdditiveSchwarz::apply: "
494 << ni <<
", after localApply and before export / "
495 "copy, the 2-norm of OverlappingY is NaN or Inf.");
497 #endif // HAVE_IFPACK2_DEBUG
499 #ifdef HAVE_IFPACK2_DEBUG
501 const bool bad = anyBad(*C);
502 TEUCHOS_TEST_FOR_EXCEPTION(bad, std::runtime_error,
503 "Ifpack2::AdditiveSchwarz::apply: "
505 << ni <<
", before export / copy, the 2-norm of C "
508 #endif // HAVE_IFPACK2_DEBUG
511 if (IsOverlapping_) {
512 TEUCHOS_TEST_FOR_EXCEPTION(OverlappingMatrix_.is_null(), std::logic_error, prefix <<
"OverlappingMatrix_ is null when it shouldn't be. "
513 "Please report this bug to the Ifpack2 developers.");
514 OverlappingMatrix_->exportMultiVector(*OverlappingY, *C, CombineMode_);
519 for (
int i = 0; i < (int)C->getMap()->getLocalNumElements(); i++) {
520 dataC[i] = dataC[i] / dataNumOverlapCopies[i];
530 RCP<MV> C_view = C->offsetViewNonConst(OverlappingY->getMap(), 0);
531 Tpetra::deep_copy(*C_view, *OverlappingY);
534 #ifdef HAVE_IFPACK2_DEBUG
536 const bool bad = anyBad(*C);
537 TEUCHOS_TEST_FOR_EXCEPTION(bad, std::runtime_error,
538 "Ifpack2::AdditiveSchwarz::apply: "
540 << ni <<
", before Y := C + Y, the 2-norm of C "
543 #endif // HAVE_IFPACK2_DEBUG
545 #ifdef HAVE_IFPACK2_DEBUG
547 const bool bad = anyBad(Y);
548 TEUCHOS_TEST_FOR_EXCEPTION(bad, std::runtime_error,
549 "Ifpack2::AdditiveSchwarz::apply: "
550 "Before Y := C + Y, at iteration "
551 << ni <<
", the 2-norm of Y "
554 #endif // HAVE_IFPACK2_DEBUG
556 Y.update(UpdateDamping_, *C, STS::one());
558 #ifdef HAVE_IFPACK2_DEBUG
560 const bool bad = anyBad(Y);
561 TEUCHOS_TEST_FOR_EXCEPTION(bad, std::runtime_error,
562 "Ifpack2::AdditiveSchwarz::apply: "
564 << ni <<
", after Y := C + Y, the 2-norm of Y "
567 #endif // HAVE_IFPACK2_DEBUG
572 #ifdef HAVE_IFPACK2_DEBUG
574 const bool bad = anyBad(Y);
575 TEUCHOS_TEST_FOR_EXCEPTION(bad, std::runtime_error,
576 "Ifpack2::AdditiveSchwarz::apply: "
577 "The 2-norm of the output Y is NaN or Inf.");
579 #endif // HAVE_IFPACK2_DEBUG
583 ApplyTime_ += (timer->wallTime() - startTime);
586 template <
class MatrixType,
class LocalInverseType>
588 localApply(MV& OverlappingB, MV& OverlappingY)
const {
590 using Teuchos::rcp_dynamic_cast;
592 const size_t numVectors = OverlappingB.getNumVectors();
594 auto additiveSchwarzFilter = rcp_dynamic_cast<Details::AdditiveSchwarzFilter<MatrixType>>(innerMatrix_);
595 if (additiveSchwarzFilter) {
601 resetMultiVecIfNeeded(reduced_reordered_B_, additiveSchwarzFilter->getRowMap(), numVectors,
true);
602 resetMultiVecIfNeeded(reduced_reordered_Y_, additiveSchwarzFilter->getRowMap(), numVectors,
true);
603 additiveSchwarzFilter->CreateReducedProblem(OverlappingB, OverlappingY, *reduced_reordered_B_);
605 Inverse_->solve(*reduced_reordered_Y_, *reduced_reordered_B_);
607 additiveSchwarzFilter->UpdateLHS(*reduced_reordered_Y_, OverlappingY);
609 if (FilterSingletons_) {
611 resetMultiVecIfNeeded(reduced_B_, SingletonMatrix_->getRowMap(), numVectors,
true);
612 resetMultiVecIfNeeded(reduced_Y_, SingletonMatrix_->getRowMap(), numVectors,
true);
614 RCP<SingletonFilter<row_matrix_type>> singletonFilter =
615 rcp_dynamic_cast<SingletonFilter<row_matrix_type>>(SingletonMatrix_);
618 "Ifpack2::AdditiveSchwarz::localApply: "
619 "SingletonFilter_ is nonnull but is not a SingletonFilter"
620 "<row_matrix_type>. This should never happen. Please report this bug "
621 "to the Ifpack2 developers.");
622 singletonFilter->SolveSingletons(OverlappingB, OverlappingY);
623 singletonFilter->CreateReducedRHS(OverlappingY, OverlappingB, *reduced_B_);
626 if (!UseReordering_) {
627 Inverse_->solve(*reduced_Y_, *reduced_B_);
629 RCP<ReorderFilter<row_matrix_type>> rf =
630 rcp_dynamic_cast<ReorderFilter<row_matrix_type>>(ReorderedLocalizedMatrix_);
632 "Ifpack2::AdditiveSchwarz::localApply: ReorderedLocalizedMatrix_ is "
633 "nonnull but is not a ReorderFilter<row_matrix_type>. This should "
634 "never happen. Please report this bug to the Ifpack2 developers.");
635 resetMultiVecIfNeeded(reordered_B_, reduced_B_->getMap(), numVectors,
false);
636 resetMultiVecIfNeeded(reordered_Y_, reduced_Y_->getMap(), numVectors,
false);
637 rf->permuteOriginalToReordered(*reduced_B_, *reordered_B_);
638 Inverse_->solve(*reordered_Y_, *reordered_B_);
639 rf->permuteReorderedToOriginal(*reordered_Y_, *reduced_Y_);
643 singletonFilter->UpdateLHS(*reduced_Y_, OverlappingY);
646 if (!UseReordering_) {
647 Inverse_->solve(OverlappingY, OverlappingB);
649 resetMultiVecIfNeeded(reordered_B_, OverlappingB.getMap(), numVectors,
false);
650 resetMultiVecIfNeeded(reordered_Y_, OverlappingY.getMap(), numVectors,
false);
652 RCP<ReorderFilter<row_matrix_type>> rf =
653 rcp_dynamic_cast<ReorderFilter<row_matrix_type>>(ReorderedLocalizedMatrix_);
655 "Ifpack2::AdditiveSchwarz::localApply: ReorderedLocalizedMatrix_ is "
656 "nonnull but is not a ReorderFilter<row_matrix_type>. This should "
657 "never happen. Please report this bug to the Ifpack2 developers.");
658 rf->permuteOriginalToReordered(OverlappingB, *reordered_B_);
659 Inverse_->solve(*reordered_Y_, *reordered_B_);
660 rf->permuteReorderedToOriginal(*reordered_Y_, OverlappingY);
666 template <
class MatrixType,
class LocalInverseType>
673 this->setParameterList(Teuchos::rcpFromRef(List_));
676 template <
class MatrixType,
class LocalInverseType>
679 using Details::getParamTryingTypes;
685 using Teuchos::rcp_dynamic_cast;
687 using Tpetra::CombineMode;
688 const char prefix[] =
"Ifpack2::AdditiveSchwarz: ";
693 this->setParameterList(
rcp(
new ParameterList()));
700 plist.
is_null(), std::logic_error,
701 "Ifpack2::AdditiveSchwarz::"
702 "setParameterList: plist is null. This should never happen, since the "
703 "method should have replaced a null input list with a nonnull empty list "
704 "by this point. Please report this bug to the Ifpack2 developers.");
725 const std::string cmParamName(
"schwarz: combine mode");
726 const ParameterEntry* cmEnt = plist->
getEntryPtr(cmParamName);
727 if (cmEnt !=
nullptr) {
728 if (cmEnt->isType<CombineMode>()) {
729 CombineMode_ = Teuchos::getValue<CombineMode>(*cmEnt);
730 }
else if (cmEnt->isType<
int>()) {
731 const int cm = Teuchos::getValue<int>(*cmEnt);
732 CombineMode_ =
static_cast<CombineMode
>(cm);
733 }
else if (cmEnt->isType<std::string>()) {
738 const ParameterEntry& validEntry =
740 RCP<const ParameterEntryValidator> v = validEntry.validator();
741 using vs2e_type = StringToIntegralParameterEntryValidator<CombineMode>;
742 RCP<const vs2e_type> vs2e = rcp_dynamic_cast<
const vs2e_type>(v,
true);
744 ParameterEntry& inputEntry = plist->
getEntry(cmParamName);
749 if (strncmp(Teuchos::getValue<std::string>(inputEntry).c_str(),
"AVG", 3) == 0) {
750 inputEntry.template setValue<std::string>(
"ADD");
753 CombineMode_ = vs2e->getIntegralValue(inputEntry, cmParamName);
761 if (plist->
get<std::string>(
"subdomain solver name") ==
"BLOCK_RELAXATION") {
762 if (plist->
isSublist(
"subdomain solver parameters")) {
764 if (plist->
sublist(
"subdomain solver parameters").
get<std::string>(
"relaxation: type") ==
"Jacobi") {
766 if (plist->
sublist(
"subdomain solver parameters").
get<std::string>(
"partitioner: type") ==
"user") {
767 if (CombineMode_ == Tpetra::ADD) plist->
sublist(
"subdomain solver parameters").
set(
"partitioner: combine mode",
"ADD");
768 if (CombineMode_ == Tpetra::ZERO) plist->
sublist(
"subdomain solver parameters").
set(
"partitioner: combine mode",
"ZERO");
778 OverlapLevel_ = plist->
get(
"schwarz: overlap level", OverlapLevel_);
784 UseReordering_ = plist->
get(
"schwarz: use reordering", UseReordering_);
786 #if !defined(HAVE_IFPACK2_XPETRA) || !defined(HAVE_IFPACK2_ZOLTAN2)
788 UseReordering_, std::invalid_argument,
789 "Ifpack2::AdditiveSchwarz::"
790 "setParameters: You specified \"schwarz: use reordering\" = true. "
791 "This is only valid when Trilinos was built with Ifpack2, Xpetra, and "
792 "Zoltan2 enabled. Either Xpetra or Zoltan2 was not enabled in your build "
804 FilterSingletons_ = plist->
get(
"schwarz: filter singletons", FilterSingletons_);
807 getParamTryingTypes<scalar_type, scalar_type, double>(UpdateDamping_, *plist,
"schwarz: update damping", prefix);
842 if (!Inverse_.is_null()) {
845 if (hasInnerPrecName() && innerPrecName() !=
"CUSTOM") {
848 Inverse_ = Teuchos::null;
852 std::pair<ParameterList, bool> result = innerPrecParams();
856 Inverse_->setParameters(
rcp(
new ParameterList(result.first)));
861 NumIterations_ = plist->get(
"schwarz: num iterations", NumIterations_);
862 ZeroStartingSolution_ =
863 plist->get(
"schwarz: zero starting solution", ZeroStartingSolution_);
866 template <
class MatrixType,
class LocalInverseType>
871 using Teuchos::parameterList;
873 using Teuchos::rcp_const_cast;
875 if (validParams_.is_null()) {
876 const int overlapLevel = 0;
877 const bool useReordering =
false;
878 const bool filterSingletons =
false;
879 const int numIterations = 1;
880 const bool zeroStartingSolution =
true;
882 ParameterList reorderingSublist;
883 reorderingSublist.set(
"order_method", std::string(
"rcm"));
885 RCP<ParameterList> plist = parameterList(
"Ifpack2::AdditiveSchwarz");
887 Tpetra::setCombineModeParameter(*plist,
"schwarz: combine mode");
888 plist->set(
"schwarz: overlap level", overlapLevel);
889 plist->set(
"schwarz: use reordering", useReordering);
890 plist->set(
"schwarz: reordering list", reorderingSublist);
893 plist->set(
"schwarz: compute condest",
false);
894 plist->set(
"schwarz: filter singletons", filterSingletons);
895 plist->set(
"schwarz: num iterations", numIterations);
896 plist->set(
"schwarz: zero starting solution", zeroStartingSolution);
897 plist->set(
"schwarz: update damping", updateDamping);
907 validParams_ = rcp_const_cast<
const ParameterList>(plist);
912 template <
class MatrixType,
class LocalInverseType>
919 using Tpetra::global_size_t;
921 const std::string timerName(
"Ifpack2::AdditiveSchwarz::initialize");
922 RCP<Time> timer = TimeMonitor::lookupCounter(timerName);
923 if (timer.is_null()) {
924 timer = TimeMonitor::getNewCounter(timerName);
926 double startTime = timer->wallTime();
929 TimeMonitor timeMon(*timer);
932 Matrix_.is_null(), std::runtime_error,
933 "Ifpack2::AdditiveSchwarz::"
934 "initialize: The matrix to precondition is null. You must either pass "
935 "a nonnull matrix to the constructor, or call setMatrix() with a nonnull "
936 "input, before you may call this method.");
938 IsInitialized_ =
false;
940 overlapping_B_.reset(
nullptr);
941 overlapping_Y_.reset(
nullptr);
944 reduced_reordered_B_.reset(
nullptr);
945 reduced_reordered_Y_.reset(
nullptr);
946 reduced_B_.reset(
nullptr);
947 reduced_Y_.reset(
nullptr);
948 reordered_B_.reset(
nullptr);
949 reordered_Y_.reset(
nullptr);
951 RCP<const Teuchos::Comm<int>> comm = Matrix_->getComm();
952 RCP<const map_type> rowMap = Matrix_->getRowMap();
953 const global_size_t INVALID =
958 if (comm->getSize() == 1) {
960 IsOverlapping_ =
false;
961 }
else if (OverlapLevel_ != 0) {
962 IsOverlapping_ =
true;
965 if (OverlapLevel_ == 0) {
967 RCP<const SerialComm<int>> localComm(
new SerialComm<int>());
971 rcp(
new map_type(INVALID, rowMap->getLocalNumElements(),
972 indexBase, localComm));
976 if (IsOverlapping_) {
983 if (!Inverse_.is_null()) {
984 Inverse_->symbolic();
989 IsInitialized_ =
true;
992 InitializeTime_ += (timer->wallTime() - startTime);
995 template <
class MatrixType,
class LocalInverseType>
997 return IsInitialized_;
1000 template <
class MatrixType,
class LocalInverseType>
1006 if (!IsInitialized_) {
1011 !isInitialized(), std::logic_error,
1012 "Ifpack2::AdditiveSchwarz::compute: "
1013 "The preconditioner is not yet initialized, "
1014 "even though initialize() supposedly has been called. "
1015 "This should never happen. "
1016 "Please report this bug to the Ifpack2 developers.");
1019 Inverse_.is_null(), std::runtime_error,
1020 "Ifpack2::AdditiveSchwarz::compute: The subdomain solver is null. "
1021 "This can only happen if you called setInnerPreconditioner() with a null "
1022 "input, after calling initialize() or compute(). If you choose to call "
1023 "setInnerPreconditioner() with a null input, you must then call it with a "
1024 "nonnull input before you may call initialize() or compute().");
1026 const std::string timerName(
"Ifpack2::AdditiveSchwarz::compute");
1027 RCP<Time> timer = TimeMonitor::lookupCounter(timerName);
1028 if (timer.is_null()) {
1029 timer = TimeMonitor::getNewCounter(timerName);
1031 TimeMonitor timeMon(*timer);
1032 double startTime = timer->wallTime();
1036 if (IsOverlapping_) {
1038 OverlappingMatrix_->doExtImport();
1043 if (
auto asf = Teuchos::rcp_dynamic_cast<Details::AdditiveSchwarzFilter<MatrixType>>(innerMatrix_)) {
1047 asf->updateMatrixValues();
1054 IsComputed_ =
false;
1055 Inverse_->numeric();
1061 ComputeTime_ += (timer->wallTime() - startTime);
1066 template <
class MatrixType,
class LocalInverseType>
1071 template <
class MatrixType,
class LocalInverseType>
1073 return NumInitialize_;
1076 template <
class MatrixType,
class LocalInverseType>
1081 template <
class MatrixType,
class LocalInverseType>
1086 template <
class MatrixType,
class LocalInverseType>
1088 return InitializeTime_;
1091 template <
class MatrixType,
class LocalInverseType>
1093 return ComputeTime_;
1096 template <
class MatrixType,
class LocalInverseType>
1101 template <
class MatrixType,
class LocalInverseType>
1103 std::ostringstream out;
1105 out <<
"\"Ifpack2::AdditiveSchwarz\": {";
1106 if (this->getObjectLabel() !=
"") {
1107 out <<
"Label: \"" << this->getObjectLabel() <<
"\", ";
1109 out <<
"Initialized: " << (isInitialized() ?
"true" :
"false")
1110 <<
", Computed: " << (isComputed() ?
"true" :
"false")
1111 <<
", Iterations: " << NumIterations_
1112 <<
", Overlap level: " << OverlapLevel_
1113 <<
", Subdomain reordering: \"" << ReorderingAlgorithm_ <<
"\"";
1114 out <<
", Combine mode: \"";
1115 if (CombineMode_ == Tpetra::INSERT) {
1117 }
else if (CombineMode_ == Tpetra::ADD) {
1119 }
else if (CombineMode_ == Tpetra::REPLACE) {
1121 }
else if (CombineMode_ == Tpetra::ABSMAX) {
1123 }
else if (CombineMode_ == Tpetra::ZERO) {
1127 if (Matrix_.is_null()) {
1128 out <<
", Matrix: null";
1130 out <<
", Global matrix dimensions: ["
1131 << Matrix_->getGlobalNumRows() <<
", "
1132 << Matrix_->getGlobalNumCols() <<
"]";
1134 out <<
", Inner solver: ";
1135 if (!Inverse_.is_null()) {
1142 <<
"Some inner solver"
1153 template <
class MatrixType,
class LocalInverseType>
1161 const int myRank = Matrix_->getComm()->getRank();
1162 const int numProcs = Matrix_->getComm()->getSize();
1170 out <<
"\"Ifpack2::AdditiveSchwarz\":";
1174 out <<
"MatrixType: " << TypeNameTraits<MatrixType>::name() << endl;
1175 out <<
"LocalInverseType: " << TypeNameTraits<LocalInverseType>::name() << endl;
1176 if (this->getObjectLabel() !=
"") {
1177 out <<
"Label: \"" << this->getObjectLabel() <<
"\"" << endl;
1180 out <<
"Overlap level: " << OverlapLevel_ << endl
1181 <<
"Combine mode: \"";
1182 if (CombineMode_ == Tpetra::INSERT) {
1184 }
else if (CombineMode_ == Tpetra::ADD) {
1186 }
else if (CombineMode_ == Tpetra::REPLACE) {
1188 }
else if (CombineMode_ == Tpetra::ABSMAX) {
1190 }
else if (CombineMode_ == Tpetra::ZERO) {
1194 <<
"Subdomain reordering: \"" << ReorderingAlgorithm_ <<
"\"" << endl;
1197 if (Matrix_.is_null()) {
1199 out <<
"Matrix: null" << endl;
1203 out <<
"Matrix:" << endl;
1206 Matrix_->getComm()->barrier();
1211 out <<
"Number of initialize calls: " << getNumInitialize() << endl
1212 <<
"Number of compute calls: " << getNumCompute() << endl
1213 <<
"Number of apply calls: " << getNumApply() << endl
1214 <<
"Total time in seconds for initialize: " << getInitializeTime() << endl
1215 <<
"Total time in seconds for compute: " << getComputeTime() << endl
1216 <<
"Total time in seconds for apply: " << getApplyTime() << endl;
1219 if (Inverse_.is_null()) {
1221 out <<
"Subdomain solver: null" << endl;
1227 if (ifpack2_inverse.is_null())
1228 out <<
"Subdomain solver: not null" << endl;
1230 out <<
"Subdomain solver: ";
1235 for (
int p = 0; p < numProcs; ++p) {
1237 out <<
"Subdomain solver on Process " << myRank <<
":";
1238 if (Inverse_.is_null()) {
1239 out <<
"null" << endl;
1247 out <<
"null" << endl;
1251 Matrix_->getComm()->barrier();
1252 Matrix_->getComm()->barrier();
1253 Matrix_->getComm()->barrier();
1258 Matrix_->getComm()->barrier();
1262 template <
class MatrixType,
class LocalInverseType>
1270 template <
class MatrixType,
class LocalInverseType>
1272 return OverlapLevel_;
1275 template <
class MatrixType,
class LocalInverseType>
1278 using Teuchos::MpiComm;
1284 using Teuchos::rcp_dynamic_cast;
1285 using Teuchos::rcpFromRef;
1288 Matrix_.is_null(), std::runtime_error,
1289 "Ifpack2::AdditiveSchwarz::"
1290 "initialize: The matrix to precondition is null. You must either pass "
1291 "a nonnull matrix to the constructor, or call setMatrix() with a nonnull "
1292 "input, before you may call this method.");
1296 auto matrixCrs = rcp_dynamic_cast<
const crs_matrix_type>(Matrix_);
1297 if (!OverlappingMatrix_.is_null() || !matrixCrs.is_null()) {
1298 ArrayRCP<local_ordinal_type> perm;
1299 ArrayRCP<local_ordinal_type> revperm;
1300 if (UseReordering_) {
1302 #if defined(HAVE_IFPACK2_XPETRA) && defined(HAVE_IFPACK2_ZOLTAN2)
1305 ReorderingAlgorithm_ = zlist.
get<std::string>(
"order_method",
"rcm");
1307 if (ReorderingAlgorithm_ ==
"user") {
1313 typedef Tpetra::RowGraph<local_ordinal_type, global_ordinal_type, node_type> row_graph_type;
1314 typedef Zoltan2::TpetraRowGraphAdapter<row_graph_type> z2_adapter_type;
1315 auto constActiveGraph = Teuchos::rcp_const_cast<
const row_graph_type>(
1316 IsOverlapping_ ? OverlappingMatrix_->getGraph() : Matrix_->getGraph());
1317 z2_adapter_type Zoltan2Graph(constActiveGraph);
1319 typedef Zoltan2::OrderingProblem<z2_adapter_type> ordering_problem_type;
1324 RCP<const MpiComm<int>> mpicomm =
1325 rcp_dynamic_cast<
const MpiComm<int>>(Matrix_->getComm());
1326 if (mpicomm == Teuchos::null) {
1327 myRawComm = MPI_COMM_SELF;
1329 myRawComm = *(mpicomm->getRawMpiComm());
1331 ordering_problem_type MyOrderingProblem(&Zoltan2Graph, &zlist, myRawComm);
1333 ordering_problem_type MyOrderingProblem(&Zoltan2Graph, &zlist);
1335 MyOrderingProblem.solve();
1338 typedef Zoltan2::LocalOrderingSolution<local_ordinal_type>
1339 ordering_solution_type;
1341 ordering_solution_type sol(*MyOrderingProblem.getLocalOrderingSolution());
1347 perm = sol.getPermutationRCPConst(
true);
1348 revperm = sol.getPermutationRCPConst();
1355 true, std::logic_error,
1356 "Ifpack2::AdditiveSchwarz::setup: "
1357 "The Zoltan2 and Xpetra packages must be enabled in order "
1358 "to support reordering.");
1361 local_ordinal_type numLocalRows = OverlappingMatrix_.is_null() ? matrixCrs->getLocalNumRows() : OverlappingMatrix_->getLocalNumRows();
1365 perm = ArrayRCP<local_ordinal_type>(numLocalRows);
1366 revperm = ArrayRCP<local_ordinal_type>(numLocalRows);
1367 for (local_ordinal_type i = 0; i < numLocalRows; i++) {
1375 RCP<Details::AdditiveSchwarzFilter<MatrixType>> asf;
1376 if (OverlappingMatrix_.is_null())
1377 asf =
rcp(
new Details::AdditiveSchwarzFilter<MatrixType>(matrixCrs, perm, revperm, FilterSingletons_));
1379 asf =
rcp(
new Details::AdditiveSchwarzFilter<MatrixType>(OverlappingMatrix_, perm, revperm, FilterSingletons_));
1384 RCP<row_matrix_type> LocalizedMatrix;
1388 RCP<row_matrix_type> ActiveMatrix;
1391 if (!OverlappingMatrix_.is_null()) {
1392 LocalizedMatrix =
rcp(
new LocalFilter<row_matrix_type>(OverlappingMatrix_));
1394 LocalizedMatrix =
rcp(
new LocalFilter<row_matrix_type>(Matrix_));
1399 LocalizedMatrix.is_null(), std::logic_error,
1400 "Ifpack2::AdditiveSchwarz::setup: LocalizedMatrix is null, after the code "
1401 "that claimed to have created it. This should never be the case. Please "
1402 "report this bug to the Ifpack2 developers.");
1405 ActiveMatrix = LocalizedMatrix;
1408 if (FilterSingletons_) {
1409 SingletonMatrix_ =
rcp(
new SingletonFilter<row_matrix_type>(LocalizedMatrix));
1410 ActiveMatrix = SingletonMatrix_;
1414 if (UseReordering_) {
1415 #if defined(HAVE_IFPACK2_XPETRA) && defined(HAVE_IFPACK2_ZOLTAN2)
1417 typedef ReorderFilter<row_matrix_type> reorder_filter_type;
1419 ReorderingAlgorithm_ = zlist.
get<std::string>(
"order_method",
"rcm");
1421 ArrayRCP<local_ordinal_type> perm;
1422 ArrayRCP<local_ordinal_type> revperm;
1424 if (ReorderingAlgorithm_ ==
"user") {
1430 typedef Tpetra::RowGraph<local_ordinal_type, global_ordinal_type, node_type> row_graph_type;
1431 typedef Zoltan2::TpetraRowGraphAdapter<row_graph_type> z2_adapter_type;
1432 RCP<const row_graph_type> constActiveGraph =
1433 Teuchos::rcp_const_cast<
const row_graph_type>(ActiveMatrix->getGraph());
1434 z2_adapter_type Zoltan2Graph(constActiveGraph);
1436 typedef Zoltan2::OrderingProblem<z2_adapter_type> ordering_problem_type;
1441 RCP<const MpiComm<int>> mpicomm =
1442 rcp_dynamic_cast<
const MpiComm<int>>(ActiveMatrix->getComm());
1443 if (mpicomm == Teuchos::null) {
1444 myRawComm = MPI_COMM_SELF;
1446 myRawComm = *(mpicomm->getRawMpiComm());
1448 ordering_problem_type MyOrderingProblem(&Zoltan2Graph, &zlist, myRawComm);
1450 ordering_problem_type MyOrderingProblem(&Zoltan2Graph, &zlist);
1452 MyOrderingProblem.solve();
1455 typedef Zoltan2::LocalOrderingSolution<local_ordinal_type>
1456 ordering_solution_type;
1458 ordering_solution_type sol(*MyOrderingProblem.getLocalOrderingSolution());
1464 perm = sol.getPermutationRCPConst(
true);
1465 revperm = sol.getPermutationRCPConst();
1469 ReorderedLocalizedMatrix_ =
rcp(
new reorder_filter_type(ActiveMatrix, perm, revperm));
1471 ActiveMatrix = ReorderedLocalizedMatrix_;
1476 true, std::logic_error,
1477 "Ifpack2::AdditiveSchwarz::setup: "
1478 "The Zoltan2 and Xpetra packages must be enabled in order "
1479 "to support reordering.");
1482 innerMatrix_ = ActiveMatrix;
1486 innerMatrix_.is_null(), std::logic_error,
1487 "Ifpack2::AdditiveSchwarz::"
1488 "setup: Inner matrix is null right before constructing inner solver. "
1489 "Please report this bug to the Ifpack2 developers.");
1492 if (Inverse_.is_null()) {
1493 const std::string innerName = innerPrecName();
1495 innerName ==
"INVALID", std::logic_error,
1496 "Ifpack2::AdditiveSchwarz::initialize: AdditiveSchwarz doesn't "
1497 "know how to create an instance of your LocalInverseType \""
1499 "Please talk to the Ifpack2 developers for details.");
1502 innerName ==
"CUSTOM", std::runtime_error,
1503 "Ifpack2::AdditiveSchwarz::"
1504 "initialize: If the \"inner preconditioner name\" parameter (or any "
1505 "alias thereof) has the value \"CUSTOM\", then you must first call "
1506 "setInnerPreconditioner with a nonnull inner preconditioner input before "
1507 "you may call initialize().");
1512 Ifpack2::Details::registerLinearSolverFactory();
1517 typedef typename MV::mag_type MT;
1518 RCP<inner_solver_type> innerPrec =
1519 Trilinos::Details::getLinearSolver<MV, OP, MT>(
"Ifpack2", innerName);
1521 innerPrec.is_null(), std::logic_error,
1522 "Ifpack2::AdditiveSchwarz::setup: Failed to create inner preconditioner "
1524 << innerName <<
"\".");
1525 innerPrec->setMatrix(innerMatrix_);
1529 std::pair<Teuchos::ParameterList, bool> result = innerPrecParams();
1530 if (result.second) {
1533 innerPrec->setParameters(
rcp(
new ParameterList(result.first)));
1535 Inverse_ = innerPrec;
1536 }
else if (Inverse_->getMatrix().getRawPtr() != innerMatrix_.getRawPtr()) {
1540 Inverse_->setMatrix(innerMatrix_);
1543 Inverse_.is_null(), std::logic_error,
1544 "Ifpack2::AdditiveSchwarz::"
1545 "setup: Inverse_ is null right after we were supposed to have created it."
1546 " Please report this bug to the Ifpack2 developers.");
1555 template <
class MatrixType,
class LocalInverseType>
1561 if (!innerPrec.is_null()) {
1564 can_change_type* innerSolver =
dynamic_cast<can_change_type*
>(&*innerPrec);
1566 innerSolver == NULL, std::invalid_argument,
1567 "Ifpack2::AdditiveSchwarz::"
1568 "setInnerPreconditioner: The input preconditioner does not implement the "
1569 "setMatrix() feature. Only input preconditioners that inherit from "
1570 "Ifpack2::Details::CanChangeMatrix implement this feature.");
1587 if (
auto asf = Teuchos::rcp_dynamic_cast<Details::AdditiveSchwarzFilter<MatrixType>>(innerMatrix_))
1588 innerSolver->setMatrix(asf->getFilteredMatrix());
1590 innerSolver->setMatrix(innerMatrix_);
1600 removeInnerPrecName();
1601 removeInnerPrecParams();
1602 List_.set(
"inner preconditioner name",
"CUSTOM");
1606 if (isInitialized()) {
1607 innerPrec->initialize();
1610 innerPrec->compute();
1623 inner_solver_impl_type;
1624 Inverse_ =
Teuchos::rcp(
new inner_solver_impl_type(innerPrec,
"CUSTOM"));
1627 template <
class MatrixType,
class LocalInverseType>
1631 if (A.
getRawPtr() != Matrix_.getRawPtr()) {
1632 IsInitialized_ =
false;
1633 IsComputed_ =
false;
1636 OverlappingMatrix_ = Teuchos::null;
1637 ReorderedLocalizedMatrix_ = Teuchos::null;
1638 innerMatrix_ = Teuchos::null;
1639 SingletonMatrix_ = Teuchos::null;
1640 localMap_ = Teuchos::null;
1641 overlapping_B_.reset(
nullptr);
1642 overlapping_Y_.reset(
nullptr);
1645 DistributedImporter_ = Teuchos::null;
1656 #define IFPACK2_ADDITIVESCHWARZ_INSTANT(S, LO, GO, N) \
1657 template class Ifpack2::AdditiveSchwarz<Tpetra::RowMatrix<S, LO, GO, N>>;
1659 #endif // IFPACK2_ADDITIVESCHWARZ_DECL_HPP
Mix-in interface for preconditioners that can change their matrix after construction.
Definition: Ifpack2_Details_CanChangeMatrix.hpp:60
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > &plist)
Set the preconditioner's parameters.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:678
virtual void compute()
Computes all (coefficient) data necessary to apply the preconditioner.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1001
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:261
basic_OSTab< char > OSTab
virtual int getNumApply() const
Returns the number of calls to apply().
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1082
T & get(const std::string &name, T def_value)
virtual bool isInitialized() const
Returns true if the preconditioner has been successfully initialized, false otherwise.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:996
virtual double getInitializeTime() const
Returns the time spent in initialize().
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1087
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
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:1155
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:207
virtual double getComputeTime() const
Returns the time spent in compute().
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1092
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
std::string description() const
Return a simple one-line description of this object.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1102
virtual std::ostream & print(std::ostream &os) const
Prints basic information on iostream. This function is used by operator<<.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1263
AdditiveSchwarz(const Teuchos::RCP< const row_matrix_type > &A)
Constructor that takes a matrix.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:194
virtual double getApplyTime() const
Returns the time spent in apply().
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1097
typename MatrixType::node_type node_type
The Node type used by the input MatrixType.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:289
virtual void initialize()
Computes all (graph-related) data necessary to initialize the preconditioner.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:913
static RCP< Time > getNewTimer(const std::string &name)
ParameterEntry * getEntryPtr(const std::string &name)
bool registeredSomeLinearSolverFactory(const std::string &packageName)
bool isParameter(const std::string &name) const
typename MatrixType::global_ordinal_type global_ordinal_type
The type of global indices in the input MatrixType.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:286
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
bool isSublist(const std::string &name) const
Ifpack2's implementation of Trilinos::Details::LinearSolver interface.
Definition: Ifpack2_Details_LinearSolver_decl.hpp:72
virtual std::string description() const
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Get a list of the preconditioner's default parameters.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:869
Interface for all Ifpack2 preconditioners.
Definition: Ifpack2_Preconditioner.hpp:74
virtual Teuchos::RCP< const row_matrix_type > getMatrix() const
The input matrix.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:230
typename MatrixType::local_ordinal_type local_ordinal_type
The type of local indices in the input MatrixType.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:283
basic_FancyOStream & setOutputToRootOnly(const int rootRank)
Declaration of interface for preconditioners that can change their matrix after construction.
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:1557
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:219
virtual void setParameters(const Teuchos::ParameterList &plist)
Set the preconditioner's parameters.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:668
virtual int getNumCompute() const
Returns the number of calls to compute().
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1077
Sparse matrix (Tpetra::RowMatrix subclass) with ghost rows.
Definition: Ifpack2_OverlappingRowMatrix_decl.hpp:25
Additive Schwarz domain decomposition for Tpetra sparse matrices.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:249
ParameterList & sublist(const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
virtual bool isComputed() const
Returns true if the preconditioner has been successfully computed, false otherwise.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1067
Declaration of Ifpack2::AdditiveSchwarz, which implements additive Schwarz preconditioning with an ar...
ParameterEntry & getEntry(const std::string &name)
void registerLinearSolverFactory()
virtual void setMatrix(const Teuchos::RCP< const row_matrix_type > &A)
Change the matrix to be preconditioned.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1629
void getValidParameters(Teuchos::ParameterList ¶ms)
Fills a list which contains all the parameters possibly used by Ifpack2.
Definition: Ifpack2_Parameters.cpp:18
virtual int getOverlapLevel() const
Returns the level of overlap.
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1271
typename MatrixType::scalar_type scalar_type
The type of the entries of the input MatrixType.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:280
virtual void describe(FancyOStream &out, const EVerbosityLevel verbLevel=verbLevel_default) const
virtual int getNumInitialize() const
Returns the number of calls to initialize().
Definition: Ifpack2_AdditiveSchwarz_def.hpp:1072