13#include <BelosSolverManager.hpp>
14#include <BelosTpetraAdapter.hpp>
15#include <Ifpack2_Preconditioner.hpp>
16#include <Tpetra_DefaultPlatform.hpp>
17#include <Tpetra_MultiVector.hpp>
18#include <Teuchos_RCP.hpp>
19#include <Tpetra_CrsMatrix.hpp>
36 typedef Tpetra::MultiVector<T, int> MV;
37 typedef Tpetra::Operator<T> OP;
38 typedef Tpetra::CrsMatrix<T, int, int> CRSmat;
40 typedef Belos::SolverManager<T, MV, OP> solverManager;
44 Teuchos::RCP<
const Teuchos::Comm<int> > comm);
47 BelosSolver(Teuchos::RCP<
const Teuchos::Comm<int> > comm);
82 int verbosity = Belos::Warnings + Belos::Errors + Belos::FinalSummary;
83 solverParam_ = Teuchos::RCP<Teuchos::ParameterList>(
84 new Teuchos::ParameterList());
85 solverParam_->set(
"Verbosity",
verbosity);
86 solverParam_->set(
"Block Size",
blockSize);
87 solverParam_->set(
"Maximum Iterations",
maxIter);
90 solverParam_->set(
"Convergence Tolerance",
tol);
91 solverParam_->set(
"Output Frequency",
outFreq);
92 solverParam_->set(
"Output Stream",
93 Teuchos::rcpFromRef<std::ostream>(std::cout));
118 precParam_ = Teuchos::RCP<Teuchos::ParameterList>(
119 new Teuchos::ParameterList(
"IFPACK2"));
120 precParam_->set(
"fact: level-of-fill",
fill);
121 precParam_->set(
"fact: ilut level-of-fill",
fill);
122 precParam_->set(
"fact: riluk level-of-fill",
fill);
123 precParam_->set(
"fact: absolute threshold",
absTresh);
124 precParam_->set(
"fact: relative threshold",
relTresh);
125 precParam_->set(
"fact: relax value",
relax);
126 precParam_->set(
"fact: drop tolerance",
tol);
149 return solverManager_;
153 inline Teuchos::RCP<LP> getLinearProblem() {
188 inline std::string getPrecType() {
203 phasePrecInit_((Comm_->getRank() == 0));
209 virtual std::ostream&
info(std::ostream&
os)
const;
216 virtual void apply_();
219 bool createSolver_();
225 bool phasePrecInit_(
bool verbose =
true);
228 bool phaseSolve_(
bool verbose =
true);
231 Teuchos::RCP<const Teuchos::Comm<int> > Comm_;
234 Teuchos::RCP<LP> lp_;
237 Teuchos::RCP<Teuchos::ParameterList> solverParam_;
238 Teuchos::RCP<Teuchos::ParameterList> precParam_;
241 Teuchos::RCP<solverManager> solverManager_;
244 Teuchos::RCP<Ifpack2::Preconditioner<T, int> > prec_;
247 std::string solverType_;
248 std::string precType_;
258 Teuchos::RCP<
const Teuchos::Comm<int> >
Comm) :
271 lp_ = Teuchos::RCP<LP>(
new LP(
Comm));
Teuchos::RCP< Teuchos::ParameterList > getSolverParam()
Get solver parameter list.
void setPrecParam(double fill, double tol=1e-5, int absTresh=0, int relTresh=1, double relax=0)
void prepare()
Builds the Preconditioner and the solver (sets prepare to true)
Teuchos::RCP< Teuchos::ParameterList > getPrecParam()
Gets the parameter list for the preconditioner.
virtual void operator()()
Solving operator for other the non-root threads.
std::string getSolverType()
Getter for the solver type.
void setSolverParam(int maxIter, int maxRestarts, double tol=1e-10, int blockSize=1, int outFreq=1)
virtual void operator()(const Vector< T > &fncY, Vector< T > &fncX)
Teuchos::RCP< solverManager > getSolverManager()
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
void setSolverParam(Teuchos::RCP< Teuchos::ParameterList > param)
void setPrecType(std::string type)
void setPrecParam(Teuchos::RCP< Teuchos::ParameterList > param)
BelosSolver(concepts::SparseMatrix< T > &sparse, Teuchos::RCP< const Teuchos::Comm< int > > comm)
Constructor for the root thread.
void setSolverManager(Teuchos::RCP< solverManager > manager)
void setSolverType(std::string type)
F type
Type of data, e.g. matrix entries.
Set< F > makeSet(uint n, const F &first,...)