Example #1
0
    // test if a smoother created by Build() is correct (check if it corresponds to the prototype)
    void testBuildCheckOutput(RCP<SmootherFactory> smooFact, Level& level, RCP<SmootherPrototype> smooProto, const std::string& tag, Teuchos::FancyOStream & out, bool & success) {
      if (smooProto == Teuchos::null) {
        TEST_EQUALITY(level.IsAvailable(tag, smooFact.get()), false);
      } else {
        RCP<SmootherBase> smoother;
        TEST_NOTHROW(smoother = level.Get< RCP<SmootherBase> >(tag, smooFact.get()));

        TEST_INEQUALITY(smoother, Teuchos::null);
        TEST_INEQUALITY(smoother, smooProto);

        if (smooProto != Teuchos::null) {
          RCP<FakeSmootherPrototype> smootherF;

          // ouput test: smoothers same derived class as prototypes
          TEST_NOTHROW(smootherF = rcp_dynamic_cast<FakeSmootherPrototype>(smoother,true));

          if (smootherF != Teuchos::null) {
            // output test: smoother parameters == prototype parameters
            RCP<FakeSmootherPrototype> smooProtoF = rcp_dynamic_cast<FakeSmootherPrototype>(smooProto,true);
            TEST_EQUALITY(smootherF->GetParam(), smooProtoF->GetParam());

            // output test: smoothers are ready to be apply
            TEST_EQUALITY(smootherF->IsSetup(), true);

            // setup done only once.
            TEST_EQUALITY(smootherF->GetNumOfSetupCall(), 1);
            TEST_EQUALITY(smootherF->GetNumOfSetup(), 1);
          }
        }
      }
    }