38 #include <lifev/core/algorithm/SolverAmesos.hpp> 39 #include <lifev/core/util/LifeDebug.hpp> 40 #include <lifev/core/util/LifeChrono.hpp> 41 #include <lifev/core/filter/GetPot.hpp> 67 res.epetraVector().Update (1, Ax.epetraVector(), -1);
81 bool verbose = M_trilinosParameterList.get (
"Verbose",
true );
84 M_displayer.leaderPrint (
"SLV- Amesos solving system ... " );
90 M_problem.SetLHS ( &solution.epetraVector() );
91 M_problem.SetRHS ( &rhsFull.epetraVector() );
93 AMESOS_CHK_ERR ( M_solver->Solve() );
99 M_displayer.leaderPrintMax (
"done in " , chrono.diff() );
131 if ( M_trilinosParameterList.get (
"PrintTiming",
false ) )
133 M_solver->PrintTiming();
136 if ( M_trilinosParameterList.get (
"PrintStatus",
false ) )
138 M_solver->PrintStatus();
164 M_trilinosParameterList.print ( output );
172 M_matrix = matrix.matrixPtr();
173 M_problem.SetOperator ( M_matrix.get() );
176 AMESOS_CHK_ERR ( M_solver->SymbolicFactorization() );
177 AMESOS_CHK_ERR ( M_solver->NumericFactorization() );
184 ASSERT (
false,
"SolverAmesos::setOperator: not coded" );
190 M_trilinosParameterList.set (
"OutputLevel", dataFile ( ( section +
"/amesos/outputlevel").data(), 0 ) );
191 M_trilinosParameterList.set (
"PrintStatus", dataFile ( ( section +
"/amesos/print_status").data(),
false ) );
192 M_trilinosParameterList.set (
"PrintTiming", dataFile ( ( section +
"/amesos/print_timing").data(),
false ) );
193 M_trilinosParameterList.set (
"ComputeVectorNorms", dataFile ( ( section +
"/amesos/computevectornorms").data(),
false ) );
194 M_trilinosParameterList.set (
"ComputeTrueResidual", dataFile ( ( section +
"/amesos/computeresidual").data(),
false ) );
197 M_trilinosParameterList.set (
"AddZeroToDiag", dataFile ( ( section +
"/amesos/addzerotodiag").data(),
false ) );
198 M_trilinosParameterList.set (
"Refactorize", dataFile ( ( section +
"/amesos/refactorize").data(),
false ) );
199 M_trilinosParameterList.set (
"RcondThreshold", dataFile ( ( section +
"/amesos/rcondthreshold").data(), 1.e-2) );
200 M_trilinosParameterList.set (
"Redistribute", dataFile ( ( section +
"/amesos/redistribute").data(),
true ) );
201 M_trilinosParameterList.set (
"MaxProcs", dataFile ( ( section +
"/amesos/maxprocs").data(), -1) );
202 M_trilinosParameterList.set (
"ScaleMethod", dataFile ( ( section +
"/amesos/scalemethod").data(), 1) );
205 M_trilinosParameterList.set (
"MatrixProperty", dataFile ( ( section +
"/amesos/matrixproperty").data(),
"general" ) );
208 M_trilinosParameterList.set (
"SolverType", dataFile ( ( section +
"/amesos/solvertype" ).data(),
"Klu" ) );
214 if ( M_solver == NULL )
216 createSolver ( M_trilinosParameterList.get (
"SolverType",
"Klu" ) );
220 M_solver->SetParameters ( M_trilinosParameterList );
244 M_solver = factory.Create ( solverType, M_problem );
250 std::cerr << std::endl << std::endl;
251 std::cerr <<
"SolverAmesos: Selected solver << " << solverType <<
" is not available. Bailing out." << std::endl;
258 exit ( EXIT_SUCCESS );
void start()
Start the timer.
void printStatus()
Display status of the solver.
Displayer(const commPtr_Type &comm)
std::shared_ptr< matrix_type > matrix_ptrtype
MatrixEpetra< Real > matrix_type
int32_type Int
Generic integer data.
Real trueResidual()
Return the true residual.
VectorEpetra(const MapEpetra &map, const MapEpetraType &mapType=Unique, const combineMode_Type combineMode=Add)
Constructor - Using Maps.
void updateInverseJacobian(const UInt &iQuadPt)
Real computeResidual(const vector_type &solution, const vector_type &rhs)
Compute the residual.
void setOperator(const Epetra_Operator &oper)
Method to set a general linear operator (of class derived from Epetra_Operator) defining the linear s...
const bool & isLeader() const
Determine if it is the leader.
Int setMatrix(const matrix_type &matrix)
Set matrix from MatrixEpetra.
void norm2(Real *result) const
Compute and store the norm 2 in the given pointed variable.
Int solveSystem(vector_type &rhsFull, vector_type &solution, const matrix_ptrtype &)
Solves the system and returns the number of iterations.
void setReusePreconditioner(const bool &)
Specify if the preconditioner should be reuse or not.
const MapEpetra & map() const
Return the MapEpetra of the vector.
void setDataFromGetPot(const GetPot &dataFile, const std::string §ion)
Method to setup the solver using GetPot.
SolverAmesos - Class to wrap linear solver.
void showMe(std::ostream &output=std::cout) const
Print informations about the solver.
double Real
Generic real data.
SolverAmesos(const commPtr_Type &comm)
Default constructor.
Int numIterations()
Return the total number of iterations.
void resetPreconditioner()
Delete the stored preconditioner.
void stop()
Stop the timer.
bool isPreconditionerSet() const
Return true if the preconditioner is set.
VectorEpetra(const VectorEpetra &vector)
Copy constructor.
void createSolver(const std::string &solverType)
Create a solver using a factory.
void setParameters()
Set the current parameters with the internal parameters list.
void setupPreconditioner(const GetPot &dataFile, const std::string §ion)
Setup the preconditioner.