10 #ifndef MUELU_CREATE_TPETRA_PRECONDITIONER_HPP
11 #define MUELU_CREATE_TPETRA_PRECONDITIONER_HPP
17 #include <Tpetra_Operator.hpp>
18 #include <Tpetra_RowMatrix.hpp>
19 #include <Xpetra_TpetraBlockCrsMatrix.hpp>
20 #include <Tpetra_BlockCrsMatrix.hpp>
23 #include <Xpetra_MultiVectorFactory.hpp>
28 #include <MueLu_Hierarchy.hpp>
30 #include <MueLu_ParameterListInterpreter.hpp>
31 #include <MueLu_TpetraOperator.hpp>
33 #include <MueLu_Utilities.hpp>
34 #include <MueLu_HierarchyUtils.hpp>
36 #if defined(HAVE_MUELU_AMGX)
39 #include "cuda_runtime.h"
51 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
68 #if defined(HAVE_MUELU_AMGX)
69 std::string externalMG =
"use external multigrid package";
70 if (inParamList.
isParameter(externalMG) && inParamList.
get<std::string>(externalMG) ==
"amgx") {
81 if (crsA != Teuchos::null)
82 A = TpetraCrs_To_XpetraMatrix<SC, LO, GO, NO>(crsA);
83 else if (bcrsA != Teuchos::null) {
112 RCP<Hierarchy> H = MueLu::CreateXpetraPreconditioner<SC, LO, GO, NO>(A, inParamList);
125 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
128 const std::string& xmlFileName) {
131 return CreateTpetraPreconditioner<Scalar, LocalOrdinal, GlobalOrdinal, Node>(inA, paramList);
142 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
146 return CreateTpetraPreconditioner<Scalar, LocalOrdinal, GlobalOrdinal, Node>(inA, paramList);
156 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
168 RCP<Matrix> A = TpetraCrs_To_XpetraMatrix<SC, LO, GO, NO>(inA);
170 MueLu::ReuseXpetraPreconditioner<SC, LO, GO, NO>(A, H);
173 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
189 MueLu::ReuseXpetraPreconditioner<SC, LO, GO, NO>(A, H);
194 #endif // ifndef MUELU_CREATE_TPETRA_PRECONDITIONER_HPP
Teuchos::RCP< MueLu::TpetraOperator< Scalar, LocalOrdinal, GlobalOrdinal, Node > > CreateTpetraPreconditioner(const Teuchos::RCP< Tpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &inA, Teuchos::ParameterList &inParamList)
Helper function to create a MueLu or AMGX preconditioner that can be used by Tpetra.Given a Tpetra::Operator, this function returns a constructed MueLu preconditioner.
Various adapters that will create a MueLu preconditioner that is an Xpetra::Matrix.
MueLu::DefaultLocalOrdinal LocalOrdinal
T & get(const std::string &name, T def_value)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
bool isParameter(const std::string &name) const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
MueLu::DefaultScalar Scalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
RCP< MueLu::Hierarchy< Scalar, LocalOrdinal, GlobalOrdinal, Node > > GetHierarchy() const
Direct access to the underlying MueLu::Hierarchy.
Wraps an existing MueLu::Hierarchy as a Tpetra::Operator.
ParameterList & sublist(const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
Exception throws to report errors in the internal logical of the program.
void ReuseTpetraPreconditioner(const Teuchos::RCP< Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &inA, MueLu::TpetraOperator< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Op)
Helper function to reuse an existing MueLu preconditioner.
Provides methods to build a multigrid hierarchy and apply multigrid cycles.
Adapter for AmgX library from Nvidia.