10#ifndef STRATIMIKOS_MUELU_TPETRA_HELPERS_HPP
11#define STRATIMIKOS_MUELU_TPETRA_HELPERS_HPP
14#include "Stratimikos_LinearSolverBuilder.hpp"
20#if defined(HAVE_MUELU_EXPERIMENTAL) && defined(HAVE_MUELU_TEKO)
24#include "Teuchos_RCP.hpp"
25#include "Teuchos_ParameterList.hpp"
26#include "Teuchos_TestForException.hpp"
27#include "Teuchos_AbstractFactoryStd.hpp"
33template <
typename Scalar = MueLu::DefaultScalar,
typename LocalOrdinal = MueLu::DefaultLocalOrdinal,
typename GlobalOrdinal = MueLu::DefaultGlobalOrdinal,
typename Node = MueLu::DefaultNode>
34void enableMueLu(LinearSolverBuilder<Scalar>& builder,
const std::string& stratName =
"MueLu") {
35#if defined(HAVE_MUELU_STRATIMIKOS) && defined(HAVE_MUELU_THYRA)
36 const Teuchos::RCP<const Teuchos::ParameterList> precValidParams = Teuchos::sublist(builder.getValidParameters(),
"Preconditioner Types");
38 TEUCHOS_TEST_FOR_EXCEPTION(precValidParams->isParameter(stratName), std::logic_error,
39 "Stratimikos::enableMueLu cannot add \"" + stratName +
"\" because it is already included in builder!");
41 typedef Thyra::PreconditionerFactoryBase<Scalar> Base;
42 typedef Thyra::MueLuPreconditionerFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node> Impl;
44 builder.setPreconditioningStrategyFactory(Teuchos::abstractFactoryStd<Base, Impl>(), stratName);
48template <
typename Scalar = MueLu::DefaultScalar,
typename LocalOrdinal = MueLu::DefaultLocalOrdinal,
typename GlobalOrdinal = MueLu::DefaultGlobalOrdinal,
typename Node = MueLu::DefaultNode>
49void enableMueLuRefMaxwell(LinearSolverBuilder<Scalar>& builder,
const std::string& stratName =
"MueLuRefMaxwell") {
50#if defined(HAVE_MUELU_STRATIMIKOS) && defined(HAVE_MUELU_THYRA)
51 const Teuchos::RCP<const Teuchos::ParameterList> precValidParams = Teuchos::sublist(builder.getValidParameters(),
"Preconditioner Types");
53 TEUCHOS_TEST_FOR_EXCEPTION(precValidParams->isParameter(stratName), std::logic_error,
54 "Stratimikos::enableMueLuRefMaxwell cannot add \"" + stratName +
"\" because it is already included in builder!");
56 typedef Thyra::PreconditionerFactoryBase<Scalar> Base;
57 typedef Thyra::MueLuRefMaxwellPreconditionerFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node> Impl;
59 builder.setPreconditioningStrategyFactory(Teuchos::abstractFactoryStd<Base, Impl>(), stratName);
63template <
typename Scalar = MueLu::DefaultScalar,
typename LocalOrdinal = MueLu::DefaultLocalOrdinal,
typename GlobalOrdinal = MueLu::DefaultGlobalOrdinal,
typename Node = MueLu::DefaultNode>
64void enableMueLuMaxwell1(LinearSolverBuilder<Scalar>& builder,
const std::string& stratName =
"MueLuMaxwell1") {
65#if defined(HAVE_MUELU_STRATIMIKOS) && defined(HAVE_MUELU_THYRA)
66 const Teuchos::RCP<const Teuchos::ParameterList> precValidParams = Teuchos::sublist(builder.getValidParameters(),
"Preconditioner Types");
68 TEUCHOS_TEST_FOR_EXCEPTION(precValidParams->isParameter(stratName), std::logic_error,
69 "Stratimikos::enableMueLuRefMaxwell cannot add \"" + stratName +
"\" because it is already included in builder!");
71 typedef Thyra::PreconditionerFactoryBase<Scalar> Base;
72 typedef Thyra::MueLuMaxwell1PreconditionerFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node> Impl;
74 builder.setPreconditioningStrategyFactory(Teuchos::abstractFactoryStd<Base, Impl>(), stratName);
78#if defined(HAVE_MUELU_EXPERIMENTAL) && defined(HAVE_MUELU_TEKO)
81 void enableMueLuTpetraQ2Q1(DefaultLinearSolverBuilder &builder,
const std::string &stratName =
"MueLu");
84template <
typename Scalar = MueLu::DefaultScalar,
typename LocalOrdinal = MueLu::DefaultLocalOrdinal,
typename GlobalOrdinal = MueLu::DefaultGlobalOrdinal,
typename Node = MueLu::DefaultNode>
86 const Teuchos::RCP<const Teuchos::ParameterList> precValidParams = Teuchos::sublist(builder.getValidParameters(),
"Preconditioner Types");
88 TEUCHOS_TEST_FOR_EXCEPTION(precValidParams->isParameter(stratName), std::logic_error,
89 "Stratimikos::enableMueLuTpetraQ2Q1 cannot add \"" + stratName +
"\" because it is already included in builder!");
91 typedef Thyra::PreconditionerFactoryBase<Scalar> Base;
94 builder.setPreconditioningStrategyFactory(Teuchos::abstractFactoryStd<Base, Impl>(), stratName);
97template <
typename LocalOrdinal,
typename GlobalOrdinal,
typename Node>
98MUELU_DEPRECATED
void enableMueLuTpetraQ2Q1(LinearSolverBuilder<double>& builder,
const std::string& stratName =
"MueLu") {
99 enableMueLuTpetraQ2Q1<double, LocalOrdinal, GlobalOrdinal, Node>(builder, stratName);
Concrete preconditioner factory subclass based on MueLu.
void enableMueLuTpetraQ2Q1(LinearSolverBuilder< Scalar > &builder, const std::string &stratName="MueLu")
void enableMueLu(LinearSolverBuilder< Scalar > &builder, const std::string &stratName="MueLu")
void enableMueLuMaxwell1(LinearSolverBuilder< Scalar > &builder, const std::string &stratName="MueLuMaxwell1")
void enableMueLuRefMaxwell(LinearSolverBuilder< Scalar > &builder, const std::string &stratName="MueLuRefMaxwell")