TEUCHOS_UNIT_TEST(BelosAdapters, BelosMultiVec_BelosMatrix) { Xpetra::UnderlyingLib lib = TestHelpers::Parameters::getLib(); if (lib == Xpetra::UseEpetra) { // Epetra specific test: run only once. RCP<TestProblem<SC,LO,GO,NO> > p = TestHelpers::getTestProblem<SC,LO,GO,NO>(lib); typedef Belos::MultiVec<double> MV; typedef Belos::Operator<double> OP; // Construct a Belos LinearProblem object RCP<Epetra_CrsMatrix> A = Utils::Op2NonConstEpetraCrs(p->GetA()); RCP<OP> belosOp = rcp(new Belos::EpetraOp(A)); RCP<OP> belosPrec = rcp(new Belos::MueLuOp<SC, LO, GO, NO>(p->GetH())); // X, B RCP<Epetra_MultiVector> eX = Utils::MV2NonConstEpetraMV(p->GetNewX0()); RCP<Epetra_MultiVector> eB = Utils::MV2NonConstEpetraMV(p->GetRHS()); RCP<MV> X = rcp(new Belos::EpetraMultiVec(*eX)); RCP<MV> B = rcp(new Belos::EpetraMultiVec(*eB)); // Run Belos int numIters = MueLuTests::BelosAdaptersTest<SC, MV, OP>(belosOp, belosPrec, X, B, out, success); // Tests TEST_EQUALITY(MueLuTests::BelosAdaptersTestResults<Scalar>(numIters, X, out, success), true); // TODO: this do not work. Is it a bug? // double norm; // eX->Norm2(&norm); } }
TEUCHOS_UNIT_TEST(BelosAdapters, XpetraOp_TpetraMV) { Xpetra::UnderlyingLib lib = TestHelpers::Parameters::getLib(); if (lib == Xpetra::UseTpetra) { // Tpetra specific test: run only once. RCP<TestProblem<SC,LO,GO,NO> > p = TestHelpers::getTestProblem<SC,LO,GO,NO>(lib); typedef Tpetra::MultiVector<SC> MV; typedef Belos::OperatorT<MV> OP; // Construct a Belos LinearProblem object RCP<OP> belosOp = rcp(new Belos::XpetraOp<SC, LO, GO, NO>(p->GetA())); RCP<OP> belosPrec = rcp(new Belos::MueLuOp<SC, LO, GO, NO>(p->GetH())); //X, B RCP<MV> X = Utils::MV2NonConstTpetraMV(p->GetNewX0()); RCP<MV> B = Utils::MV2NonConstTpetraMV(p->GetRHS()); // Run Belos int numIters = MueLuTests::BelosAdaptersTest<SC, MV, OP>(belosOp, belosPrec, X, B, out, success); // Tests TEST_EQUALITY(MueLuTests::BelosAdaptersTestResults<Scalar>(numIters, X, out, success), true); } }
// TEST: // - OP: Xpetra::Matrix // - MV: Xpetra::MultiVector TEUCHOS_UNIT_TEST(BelosAdapters, XpetraOp_XpetraMV) { Xpetra::UnderlyingLib lib = TestHelpers::Parameters::getLib(); #if !defined(HAVE_MUELU_EPETRA) or !defined(HAVE_MUELU_IFPACK) or !defined(HAVE_MUELU_AMESOS) if (lib == Xpetra::UseEpetra) { out << "Test skipped (dependencies not available)" << std::endl; return; } #endif #if !defined(HAVE_MUELU_TPETRA) or !defined(HAVE_MUELU_IFPACK2) or !defined(HAVE_MUELU_AMESOS2) if (lib == Xpetra::UseTpetra) { out << "Test skipped (dependencies not available)" << std::endl; return; } #endif RCP<TestProblem<SC,LO,GO,NO> > p = TestHelpers::getTestProblem<SC,LO,GO,NO>(lib); typedef Xpetra::MultiVector<SC> MV; typedef Belos::OperatorT<MV> OP; // Construct a Belos LinearProblem object RCP<OP> belosOp = rcp(new Belos::XpetraOp<SC, LO, GO, NO>(p->GetA())); RCP<OP> belosPrec = rcp(new Belos::MueLuOp<SC, LO, GO, NO>(p->GetH())); // Run Belos RCP<MultiVector> X = p->GetNewX0(); int numIters = MueLuTests::BelosAdaptersTest<SC, MV, OP>(belosOp, belosPrec, X, p->GetRHS(), out, success); // Tests TEST_EQUALITY(MueLuTests::BelosAdaptersTestResults<Scalar>(numIters, X, out, success), true); }