Teko Version of the Day
Loading...
Searching...
No Matches
Teko_StratimikosFactory.hpp
1// @HEADER
2// *****************************************************************************
3// Teko: A package for block and physics based preconditioning
4//
5// Copyright 2010 NTESS and the Teko contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef __Teko_StratimikosFactory_hpp__
11#define __Teko_StratimikosFactory_hpp__
12
13#include <vector>
14
15#include "Thyra_PreconditionerFactoryBase.hpp"
16#include "Teuchos_StandardCompositionMacros.hpp"
17
18#include "Teko_RequestHandler.hpp"
19#include "Teko_InverseLibrary.hpp"
20#include "Teko_InverseFactory.hpp"
21
22namespace Teko {
23
38class StratimikosFactory : public Thyra::PreconditionerFactoryBase<double> {
39 public:
42
45
46 StratimikosFactory(const Teuchos::RCP<Teko::RequestHandler> &rh);
47 StratimikosFactory(const Teuchos::RCP<Stratimikos::DefaultLinearSolverBuilder> &builder,
48 const Teuchos::RCP<Teko::RequestHandler> &rh);
49
51
54
56 bool isCompatible(const Thyra::LinearOpSourceBase<double> &fwdOp) const;
58 bool applySupportsConj(Thyra::EConj conj) const;
60 bool applyTransposeSupportsConj(Thyra::EConj conj) const;
62 Teuchos::RCP<Thyra::PreconditionerBase<double> > createPrec() const;
64 void initializePrec(const Teuchos::RCP<const Thyra::LinearOpSourceBase<double> > &fwdOp,
65 Thyra::PreconditionerBase<double> *prec,
66 const Thyra::ESupportSolveUse supportSolveUse) const;
68 void uninitializePrec(Thyra::PreconditionerBase<double> *prec,
69 Teuchos::RCP<const Thyra::LinearOpSourceBase<double> > *fwdOp,
70 Thyra::ESupportSolveUse *supportSolveUse) const;
71
73
76
78 void setParameterList(Teuchos::RCP<Teuchos::ParameterList> const &paramList);
80 Teuchos::RCP<Teuchos::ParameterList> getNonconstParameterList();
82 Teuchos::RCP<Teuchos::ParameterList> unsetParameterList();
84 Teuchos::RCP<const Teuchos::ParameterList> getParameterList() const;
86 Teuchos::RCP<const Teuchos::ParameterList> getValidParameters() const;
88
91
93 std::string description() const;
94
95 // ToDo: Add an override of describe(...) to give more detail!
96
98
101 void initializePrec_Thyra(const Teuchos::RCP<const Thyra::LinearOpSourceBase<double> > &fwdOp,
102 Thyra::PreconditionerBase<double> *prec,
103 const Thyra::ESupportSolveUse supportSolveUse) const;
104
107 void setRequestHandler(const Teuchos::RCP<Teko::RequestHandler> &rh) { reqHandler_ = rh; }
108
111 Teuchos::RCP<Teko::RequestHandler> getRequestHandler() const { return reqHandler_; }
112
114 const std::vector<int> &getDecomposition() const { return decomp_; }
115
116 private:
117 Teuchos::RCP<Teuchos::ParameterList> paramList_;
118
119 mutable Teuchos::RCP<Teko::InverseLibrary> invLib_;
120 mutable Teuchos::RCP<Teko::InverseFactory> invFactory_;
121 Teuchos::RCP<Teko::RequestHandler> reqHandler_;
122 mutable std::vector<int> decomp_;
123 Teuchos::RCP<Stratimikos::DefaultLinearSolverBuilder>
124 builder_; // builder to use for default solvers
125};
126
134void addTekoToStratimikosBuilder(Stratimikos::DefaultLinearSolverBuilder &builder,
135 const std::string &stratName = "Teko");
136
144void addTekoToStratimikosBuilder(Stratimikos::DefaultLinearSolverBuilder &builder,
145 const Teuchos::RCP<Teko::RequestHandler> &rh,
146 const std::string &stratName = "Teko");
147
148} // namespace Teko
149
150#endif
Adapts Teko block preconditioners to the Stratimikos framework.
void initializePrec(const Teuchos::RCP< const Thyra::LinearOpSourceBase< double > > &fwdOp, Thyra::PreconditionerBase< double > *prec, const Thyra::ESupportSolveUse supportSolveUse) const
Teuchos::RCP< const Teuchos::ParameterList > getParameterList() const
Teuchos::RCP< Thyra::PreconditionerBase< double > > createPrec() const
bool isCompatible(const Thyra::LinearOpSourceBase< double > &fwdOp) const
bool applyTransposeSupportsConj(Thyra::EConj conj) const
bool applySupportsConj(Thyra::EConj conj) const
void setParameterList(Teuchos::RCP< Teuchos::ParameterList > const &paramList)
Teuchos::RCP< Teko::RequestHandler > getRequestHandler() const
void uninitializePrec(Thyra::PreconditionerBase< double > *prec, Teuchos::RCP< const Thyra::LinearOpSourceBase< double > > *fwdOp, Thyra::ESupportSolveUse *supportSolveUse) const
Teuchos::RCP< Teuchos::ParameterList > getNonconstParameterList()
void setRequestHandler(const Teuchos::RCP< Teko::RequestHandler > &rh)
Teuchos::RCP< Teuchos::ParameterList > unsetParameterList()
void initializePrec_Thyra(const Teuchos::RCP< const Thyra::LinearOpSourceBase< double > > &fwdOp, Thyra::PreconditionerBase< double > *prec, const Thyra::ESupportSolveUse supportSolveUse) const
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
const std::vector< int > & getDecomposition() const
Get the decomposition vector in use by this factory.