44 #ifndef _build_solver_hpp_ 45 #define _build_solver_hpp_ 47 #include "Teuchos_RefCountPtr.hpp" 48 #include "Teuchos_ParameterList.hpp" 49 #include "Teuchos_Time.hpp" 50 #include "Epetra_LinearProblem.h" 51 #include "Epetra_Map.h" 52 #include "Epetra_Comm.h" 60 Teuchos::RCP<Epetra_LinearProblem> problem)
62 Teuchos::ParameterList azparams;
63 if (test_params.isSublist(
"AztecOO")) {
64 azparams = test_params.sublist(
"AztecOO");
67 Teuchos::RCP<AztecOO> solver = Teuchos::rcp(
new AztecOO);
69 solver->SetProblem(*problem);
71 solver->SetParameters(azparams);
73 std::string ifpack_precond(
"not specified");
75 if (ifpack_precond !=
"not specified") {
79 if (test_params.isSublist(
"Ifpack")) {
80 Teuchos::ParameterList& ifparams = test_params.sublist(
"Ifpack");
83 Teuchos::Time prec_time(
"precond");
88 int my_proc = problem->GetMatrix()->RowMatrixRowMap().Comm().MyPID();
90 std::cout <<
"Time to initialize/compute preconditioner: " << prec_time.totalElapsedTime() <<
"s" << std::endl;
93 solver->SetPrecOperator(precond);
virtual int Initialize()=0
Computes all it is necessary to initialize the preconditioner.
virtual int SetParameters(Teuchos::ParameterList &List)=0
Sets all parameters for the preconditioner.
Ifpack_Preconditioner: basic class for preconditioning in Ifpack.
Teuchos::RCP< AztecOO > build_solver(Teuchos::ParameterList &test_params, Teuchos::RCP< Epetra_LinearProblem > problem)
void GetParameter(const Teuchos::ParameterList ¶ms, const std::string &name, T &value)
Set a value from a ParameterList if a parameter with the specified name exists.
static Ifpack_Preconditioner * Create(EPrecType PrecType, Epetra_RowMatrix *Matrix, const int overlap=0, bool overrideSerialDefault=false)
Creates an instance of Ifpack_Preconditioner given the enum value of the preconditioner type (can not...
virtual int Compute()=0
Computes all it is necessary to apply the preconditioner.