Debian Codegraph @

packages/muelu/test/unit_tests/Smoothers/BelosSmoother.cpp

raw
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_BelosSmoother.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(BelosSmoother, NotSetup, Scalar, LocalOrdinal, GlobalOrdinal, Node) {
23 #include <MueLu_UseShortNames.hpp>
24 MUELU_TESTING_SET_OSTREAM;
25 MUELU_TESTING_LIMIT_SCOPE(Scalar, GlobalOrdinal, Node);
26 MUELU_TEST_ONLY_FOR(Xpetra::UseTpetra) {
27 BelosSmoother smoother("Block CG", Teuchos::ParameterList());
28 testApplyNoSetup(smoother, out, success);
29 }
30 }
31
32 // Tests interface to Belos's Gauss-Seidel preconditioner.
33 TEUCHOS_UNIT_TEST_TEMPLATE_4_DECL(BelosSmoother, HardCodedResult_BlockCG, Scalar, LocalOrdinal, GlobalOrdinal, Node) {
34 #include <MueLu_UseShortNames.hpp>
35 MUELU_TESTING_SET_OSTREAM;
36 MUELU_TESTING_LIMIT_SCOPE(Scalar, GlobalOrdinal, Node);
37 MUELU_TEST_ONLY_FOR(Xpetra::UseTpetra) {
38 Teuchos::ParameterList paramList;
39 paramList.set("Maximum Iterations", 10);
40 BelosSmoother smoother("Block CG", paramList);
41
42 typename Teuchos::ScalarTraits<SC>::magnitudeType residualNorms = testApply_A125_X1_RHS0(smoother, out, success);
43
44 RCP<const Teuchos::Comm<int> > comm = TestHelpers::Parameters::getDefaultComm();
45 const typename Teuchos::ScalarTraits<SC>::magnitudeType expectedNorm = 1.2856486930664495771e-01;
46 TEST_FLOATING_EQUALITY(residualNorms, expectedNorm, 1e4 * Teuchos::ScalarTraits<typename Teuchos::ScalarTraits<SC>::magnitudeType>::eps());
47 }
48
49 } // Block CG
50
51 #define MUELU_ETI_GROUP(SC, LO, GO, NO) \
52 TEUCHOS_UNIT_TEST_TEMPLATE_4_INSTANT(BelosSmoother, NotSetup, SC, LO, GO, NO) \
53 TEUCHOS_UNIT_TEST_TEMPLATE_4_INSTANT(BelosSmoother, HardCodedResult_BlockCG, SC, LO, GO, NO)
54
55 #include <MueLu_ETI_4arg.hpp>
56
57 } // namespace MueLuTests