Skip to content

Commit

Permalink
MueLu Hierarchy: Only warn during setup about lack of smoother/coarse…
Browse files Browse the repository at this point in the history
… solver

A warning in every single iteration is a bit much.
  • Loading branch information
cgcgcg committed Apr 4, 2024
1 parent c29ace0 commit 5bb8be6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/muelu/src/Interface/MueLu_HierarchyManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ class HierarchyManager : public HierarchyFactory<Scalar, LocalOrdinal, GlobalOrd
// This is cached, but involves and MPI_Allreduce.
H.description();
H.describe(H.GetOStream(Runtime0), verbosity_);
H.CheckForEmptySmoothersAndCoarseSolve();

// When we reuse hierarchy, it is necessary that we don't
// change the number of levels. We also cannot make requests
Expand Down
2 changes: 2 additions & 0 deletions packages/muelu/src/MueCentral/MueLu_Hierarchy_decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ class Hierarchy : public BaseClass {

void SetupRe();

void CheckForEmptySmoothersAndCoarseSolve();

//! Clear impermanent data from previous setup
void Clear(int startLevel = 0);
void ExpertClear();
Expand Down
16 changes: 13 additions & 3 deletions packages/muelu/src/MueCentral/MueLu_Hierarchy_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,8 @@ void Hierarchy<Scalar, LocalOrdinal, GlobalOrdinal, Node>::SetupRe() {
ResetDescription();

describe(GetOStream(Statistics0), GetVerbLevel());

CheckForEmptySmoothersAndCoarseSolve();
}

template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
Expand Down Expand Up @@ -673,6 +675,17 @@ void Hierarchy<Scalar, LocalOrdinal, GlobalOrdinal, Node>::Setup(const FactoryMa
manager.Clean();

describe(GetOStream(Statistics0), GetVerbLevel());

CheckForEmptySmoothersAndCoarseSolve();
}

template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
void Hierarchy<Scalar, LocalOrdinal, GlobalOrdinal, Node>::CheckForEmptySmoothersAndCoarseSolve() {
for (LO levelNo = 0; levelNo < as<LO>(Levels_.size()); ++levelNo) {
auto level = Levels_[levelNo];
if ((!level->IsAvailable("PreSmoother")) && (!level->IsAvailable("PostSmoother")))
GetOStream(Warnings1) << "No " << (levelNo == as<LO>(Levels_.size()) - 1 ? "coarse grid solver" : "smoother") << " on level " << level->GetLevelID() << std::endl;
}
}

template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
Expand Down Expand Up @@ -834,7 +847,6 @@ ConvergenceStatus Hierarchy<Scalar, LocalOrdinal, GlobalOrdinal, Node>::Iterate(
emptyFineSolve = false;
}
if (emptyFineSolve == true) {
GetOStream(Warnings1) << "No fine grid smoother" << std::endl;
// Fine grid smoother is identity
fineX->update(one, B, zero);
}
Expand All @@ -854,7 +866,6 @@ ConvergenceStatus Hierarchy<Scalar, LocalOrdinal, GlobalOrdinal, Node>::Iterate(
emptyCoarseSolve = false;
}
if (emptyCoarseSolve == true) {
GetOStream(Warnings1) << "No coarse grid solver" << std::endl;
// Coarse operator is identity
coarseX->update(one, *coarseRhs, zero);
}
Expand Down Expand Up @@ -1003,7 +1014,6 @@ ConvergenceStatus Hierarchy<Scalar, LocalOrdinal, GlobalOrdinal, Node>::Iterate(
zeroGuess = false;
}
if (emptySolve == true) {
GetOStream(Warnings1) << "No coarse grid solver" << std::endl;
// Coarse operator is identity
X.update(one, B, zero);
}
Expand Down

0 comments on commit 5bb8be6

Please sign in to comment.