| 1 |
// @HEADER |
| 2 |
// ***************************************************************************** |
| 3 |
// MueLu: A package for multigrid based preconditioning |
| 4 |
// |
| 5 |
// Copyright 2012 NTESS and the MueLu contributors. |
| 6 |
// SPDX-License-Identifier: BSD-3-Clause |
| 7 |
// ***************************************************************************** |
| 8 |
// @HEADER |
| 9 |
|
| 10 |
#include <Teuchos_UnitTestHarness.hpp> |
| 11 |
#include <MueLu_TestHelpers.hpp> |
| 12 |
#include "MueLu_TestHelpersSmoothers.hpp" |
| 13 |
|
| 14 |
#include <MueLu_StratimikosSmoother.hpp> |
| 15 |
#include <MueLu_Utilities.hpp> |
| 16 |
|
| 17 |
namespace MueLuTests { |
| 18 |
|
| 19 |
// this namespace already has: #include "MueLu_UseShortNames.hpp" |
| 20 |
using namespace TestHelpers::Smoothers; |
| 21 |
|
| 22 |
TEUCHOS_UNIT_TEST_TEMPLATE_4_DECL(StratimikosSmoother, NotSetup, Scalar, LocalOrdinal, GlobalOrdinal, Node) { |
| 23 |
#include <MueLu_UseShortNames.hpp> |
| 24 |
MUELU_TESTING_SET_OSTREAM; |
| 25 |
MUELU_TESTING_LIMIT_SCOPE(Scalar, GlobalOrdinal, Node); |
| 26 |
if (!TYPE_EQUAL(Scalar, double)) { |
| 27 |
out << "Skipping for SC != double" << std::endl; |
| 28 |
return; |
| 29 |
} |
| 30 |
|
| 31 |
StratimikosSmoother smoother("STRATIMIKOS", Teuchos::ParameterList()); |
| 32 |
testApplyNoSetup(smoother, out, success); |
| 33 |
} |
| 34 |
|
| 35 |
// Tests interface to Stratimikos's Gauss-Seidel preconditioner. |
| 36 |
TEUCHOS_UNIT_TEST_TEMPLATE_4_DECL(StratimikosSmoother, HardCodedResult_BlockCG, Scalar, LocalOrdinal, GlobalOrdinal, Node) { |
| 37 |
#include <MueLu_UseShortNames.hpp> |
| 38 |
MUELU_TESTING_SET_OSTREAM; |
| 39 |
MUELU_TESTING_LIMIT_SCOPE(Scalar, GlobalOrdinal, Node); |
| 40 |
if (!TYPE_EQUAL(Scalar, double)) { |
| 41 |
out << "Skipping for SC != double" << std::endl; |
| 42 |
return; |
| 43 |
} |
| 44 |
|
| 45 |
Teuchos::ParameterList paramList; |
| 46 |
paramList.set("Linear Solver Type", "Belos"); |
| 47 |
paramList.sublist("Linear Solver Types").sublist("Belos").set("Solver Type", "Block CG"); |
| 48 |
paramList.sublist("Linear Solver Types").sublist("Belos").sublist("Solver Types").sublist("Block CG").set("Convergence Tolerance", 1e-2); |
| 49 |
paramList.sublist("Linear Solver Types").sublist("Belos").sublist("Solver Types").sublist("Block CG").set("Maximum Iterations", 100); |
| 50 |
paramList.set("Preconditioner Type", "None"); |
| 51 |
StratimikosSmoother smoother("STRATIMIKOS", paramList); |
| 52 |
|
| 53 |
typename Teuchos::ScalarTraits<SC>::magnitudeType residualNorms = testApply_A125_X0_RandomRHS(smoother, out, success); |
| 54 |
|
| 55 |
RCP<const Teuchos::Comm<int> > comm = TestHelpers::Parameters::getDefaultComm(); |
| 56 |
const typename Teuchos::ScalarTraits<SC>::magnitudeType expectedNorm = 0.02118661536508828144; |
| 57 |
TEST_FLOATING_EQUALITY(residualNorms, expectedNorm, 0.1); |
| 58 |
|
| 59 |
} // Block CG |
| 60 |
|
| 61 |
#define MUELU_ETI_GROUP(SC, LO, GO, NO) \ |
| 62 |
TEUCHOS_UNIT_TEST_TEMPLATE_4_INSTANT(StratimikosSmoother, NotSetup, SC, LO, GO, NO) \ |
| 63 |
TEUCHOS_UNIT_TEST_TEMPLATE_4_INSTANT(StratimikosSmoother, HardCodedResult_BlockCG, SC, LO, GO, NO) |
| 64 |
|
| 65 |
#include <MueLu_ETI_4arg.hpp> |
| 66 |
|
| 67 |
} // namespace MueLuTests |