Skip to content

Commit

Permalink
MueLu: get rid of a CreateHierarchy wrapper in a test
Browse files Browse the repository at this point in the history
Similar to 5c8af2c.

Fix #625.
  • Loading branch information
aprokop committed May 14, 2017
1 parent 7889e08 commit 07fc9b7
Showing 1 changed file with 2 additions and 72 deletions.
74 changes: 2 additions & 72 deletions packages/muelu/test/scaling/ImportPerformance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,12 @@
#include <MueLu_ParameterListInterpreter.hpp>
#include <MueLu_Utilities.hpp>

#ifdef HAVE_MUELU_TPETRA
#include <MueLu_CreateTpetraPreconditioner.hpp>
#endif
#ifdef HAVE_MUELU_EPETRA
#include <MueLu_CreateEpetraPreconditioner.hpp>
#include <EpetraExt_MMHelpers.h>
#include <EpetraExt_RowMatrixOut.h>
#endif

#include <MueLu_CreateXpetraPreconditioner.hpp>

using Teuchos::RCP;
using Teuchos::rcp;
Expand All @@ -100,73 +97,6 @@ inline void resize_doubles(int nold,int nnew,double*& d){
d=tmp;
}
}
// =========================================================================
// =========================================================================
// =========================================================================
template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
Teuchos::RCP<MueLu::Hierarchy<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
CreateHierarchy(Teuchos::RCP<Xpetra::Matrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> > A, Teuchos::ParameterList& paramList, Teuchos::RCP<Xpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > coords = Teuchos::null) {
#include <MueLu_UseShortNames.hpp>
using Teuchos::RCP;

Xpetra::UnderlyingLib lib = A->getRowMap()->lib();

if (lib == Xpetra::UseTpetra) {
#ifdef HAVE_MUELU_TPETRA
RCP<Tpetra::CrsMatrix<SC, LO, GO, NO> > tA = Utilities::Op2NonConstTpetraCrs(A);
RCP<MueLu::TpetraOperator<SC, LO, GO, NO> > tH = MueLu::CreateTpetraPreconditioner(tA, paramList, Utilities::MV2NonConstTpetraMV(coords));

return tH->GetHierarchy();
#else
throw MueLu::Exceptions::RuntimeError("Tpetra is not available");
#endif // HAVE_MUELU_TPETRA
}

XPETRA_FACTORY_ERROR_IF_EPETRA(lib);
XPETRA_FACTORY_END;
}

// =========================================================================
// =========================================================================
// =========================================================================
#ifdef HAVE_MUELU_EPETRA
template<>
Teuchos::RCP<MueLu::Hierarchy<double,int,int,Xpetra::EpetraNode> >
CreateHierarchy(Teuchos::RCP<Xpetra::Matrix<double,int,int,Xpetra::EpetraNode> > A, Teuchos::ParameterList& paramList, Teuchos::RCP<Xpetra::MultiVector<double,int,int,Xpetra::EpetraNode> > coords) {
typedef double Scalar;
typedef int LocalOrdinal;
typedef int GlobalOrdinal;
typedef Xpetra::EpetraNode Node;
#include <MueLu_UseShortNames.hpp>
using Teuchos::RCP;

Xpetra::UnderlyingLib lib = A->getRowMap()->lib();

if (lib == Xpetra::UseTpetra) {
#ifdef HAVE_MUELU_TPETRA
RCP<Tpetra::CrsMatrix<SC, LO, GO, NO> > tA = Utilities::Op2NonConstTpetraCrs(A);
RCP<Tpetra::Operator<Scalar,LocalOrdinal,GlobalOrdinal,Node> > opMat(tA);
RCP<MueLu::TpetraOperator<SC, LO, GO, NO> > tH = MueLu::CreateTpetraPreconditioner(opMat, paramList, Utilities::MV2NonConstTpetraMV(coords));

return tH->GetHierarchy();
#else
throw MueLu::Exceptions::RuntimeError("Tpetra is not available");
#endif
}

if (lib == Xpetra::UseEpetra) {
#if defined(HAVE_MUELU_EPETRA)
RCP<Epetra_CrsMatrix> eA = Utilities::Op2NonConstEpetraCrs(A);
RCP<MueLu::EpetraOperator> eH = MueLu::CreateEpetraPreconditioner(eA, paramList, Utilities::MV2NonConstEpetraMV(coords));
return eH->GetHierarchy();
#else
throw MueLu::Exceptions::RuntimeError("Epetra is not available");
#endif
}

XPETRA_FACTORY_END;
}
#endif // HAVE_MUELU_EPETRA

// =========================================================================
// =========================================================================
Expand Down Expand Up @@ -714,7 +644,7 @@ int main_(Teuchos::CommandLineProcessor &clp, int argc, char *argv[]) {
aH = Teuchos::rcp_dynamic_cast<MueLu::AMGXOperator<SC, LO, GO, NO> >(tH);
#endif
} else {
H = CreateHierarchy(A, mueluList, coordinates);
H = MueLu::CreateXpetraPreconditioner(A, mueluList, coordinates);
}
comm->barrier();
tm = Teuchos::null;
Expand Down

0 comments on commit 07fc9b7

Please sign in to comment.