41#ifndef STRATIMIKOS_BELOS_PREC_TPETRA_HELPERS_HPP
42#define STRATIMIKOS_BELOS_PREC_TPETRA_HELPERS_HPP
44#include "Stratimikos_LinearSolverBuilder.hpp"
45#include "Thyra_BelosTpetraPreconditionerFactory_decl.hpp"
46#include "Thyra_BelosTpetraPreconditionerFactory_def.hpp"
48#include "Teuchos_RCP.hpp"
49#include "Teuchos_ParameterList.hpp"
50#include "Teuchos_TestForException.hpp"
51#include "Teuchos_AbstractFactoryStd.hpp"
55namespace Stratimikos {
57 template <
typename MatrixType>
58 void enableBelosPrecTpetra(LinearSolverBuilder<typename MatrixType::scalar_type>& builder,
const std::string& stratName =
"BelosPrecTpetra")
60 const Teuchos::RCP<const Teuchos::ParameterList> precValidParams = Teuchos::sublist(builder.getValidParameters(),
"Preconditioner Types");
62 TEUCHOS_TEST_FOR_EXCEPTION(precValidParams->isParameter(stratName), std::logic_error,
63 "Stratimikos::enableBelosPrecTpetra cannot add \"" + stratName +
"\" because it is already included in builder!");
65 typedef typename MatrixType::scalar_type scalar_type;
66 typedef Thyra::PreconditionerFactoryBase<scalar_type> Base;
67 typedef Thyra::BelosTpetraPreconditionerFactory<MatrixType> Impl;
69 builder.setPreconditioningStrategyFactory(Teuchos::abstractFactoryStd<Base, Impl>(), stratName);