Stratimikos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Stratimikos_BelosTpetraPrecHelpers.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Stratimikos: Thyra-based strategies for linear solvers
4 //
5 // Copyright 2006 NTESS and the Stratimikos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef STRATIMIKOS_BELOS_PREC_TPETRA_HELPERS_HPP
11 #define STRATIMIKOS_BELOS_PREC_TPETRA_HELPERS_HPP
12 
13 #include "Stratimikos_LinearSolverBuilder.hpp"
16 
17 #include "Teuchos_RCP.hpp"
21 
22 #include <string>
23 
24 namespace Stratimikos {
25 
26  template <typename MatrixType>
27  void enableBelosPrecTpetra(LinearSolverBuilder<typename MatrixType::scalar_type>& builder, const std::string& stratName = "BelosPrecTpetra")
28  {
29  const Teuchos::RCP<const Teuchos::ParameterList> precValidParams = Teuchos::sublist(builder.getValidParameters(), "Preconditioner Types");
30 
31  TEUCHOS_TEST_FOR_EXCEPTION(precValidParams->isParameter(stratName), std::logic_error,
32  "Stratimikos::enableBelosPrecTpetra cannot add \"" + stratName +"\" because it is already included in builder!");
33 
34  typedef typename MatrixType::scalar_type scalar_type;
35  typedef Thyra::PreconditionerFactoryBase<scalar_type> Base;
37 
38  builder.setPreconditioningStrategyFactory(Teuchos::abstractFactoryStd<Base, Impl>(), stratName);
39  }
40 
41 } // namespace Stratimikos
42 
43 #endif
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
bool isParameter(const std::string &name) const
void setPreconditioningStrategyFactory(const RCP< const AbstractFactory< Thyra::PreconditionerFactoryBase< Scalar > > > &precStrategyFactory, const std::string &precStrategyName, const bool makeDefault=false)
Set a new preconditioner strategy factory object.
Concrete preconditioner factory subclass based on Belos. (Yes, Belos solvers can also be used as prec...
void enableBelosPrecTpetra(LinearSolverBuilder< typename MatrixType::scalar_type > &builder, const std::string &stratName="BelosPrecTpetra")
Concrete subclass of Thyra::LinearSolverBuilderBase for creating Thyra::LinearOpWithSolveFactoryBase ...
RCP< const ParameterList > getValidParameters() const