Skip to content
Snippets Groups Projects
Commit b0d3cf31 authored by Peter Gottschling's avatar Peter Gottschling
Browse files

Matrixausschriften als Kommentare; Iterationszahlen und Fehlercode können abgefragt werden.

parent e4f84157
Branches
Tags
No related merge requests found
......@@ -74,7 +74,9 @@ namespace AMDiS {
if (one_norm(x) > 1e100)
x= 0.0;
#endif
return ITLSolver()(A, x, b, *this->leftPrecon, *this->rightPrecon, iter);
error= ITLSolver()(A, x, b, *this->leftPrecon, *this->rightPrecon, iter);
iterations= iter.iterations();
return error;
}
......@@ -124,7 +126,9 @@ namespace AMDiS {
{
itl::cyclic_iteration<value_type> iter(b, this->max_iter, this->relative,
this->tolerance, this->print_cycle);
return ITLSolver()(A, x, b, *this->leftPrecon, *this->rightPrecon, iter, ell);
error= ITLSolver()(A, x, b, *this->leftPrecon, *this->rightPrecon, iter, ell);
iterations= iter.iterations();
return error;
}
class Creator : public OEMSolverCreator
......
......@@ -64,6 +64,8 @@ namespace AMDiS {
info(0),
residual(0),
print_cycle(100),
iterations(-1),
error(-1),
leftPrecon(NULL),
rightPrecon(NULL)
{}
......@@ -132,6 +134,7 @@ namespace AMDiS {
counter++;
}
// std::cout << "Iterative Solver: A = \n" << A.getMatrix();
int r = solveSystem(A.getMatrix(), xx, bb);
// Copy solution vector to DOFVector
......@@ -164,6 +167,7 @@ namespace AMDiS {
}
// Solver on DOFVector for single system
std::cout << "Iterative Solver (System): A = \n" << A.getMatrix();
int r= solveSystem(A.getMatrix(), xx, bb);
for (int i = 0, counter = 0; i < ns; i++) {
......@@ -227,6 +231,18 @@ namespace AMDiS {
max_iter = i;
}
/// Returns number of iterations in last run of an iterative solver
inline int getIterations()
{
return iterations;
}
/// Returns error code in last run of an iterative solver
inline int getErrorCode()
{
return error;
}
/// Sets \ref info
inline void setInfo(int i)
{
......@@ -257,8 +273,16 @@ namespace AMDiS {
/// Print cycle, after how many iterations the residuum norm is logged.
int print_cycle;
/// How many iterations were performed in last solver (not set by UmfPack)
int iterations;
/// Error code in last solver (not set by UmfPack)
int error;
/// Left preconditioner (ignored by some iterative solvers and by UmfPack)
ITL_BasePreconditioner *leftPrecon;
/// Right preconditioner (ignored by some iterative solvers and by UmfPack)
ITL_BasePreconditioner *rightPrecon;
};
......
......@@ -87,6 +87,8 @@ namespace AMDiS {
solver->update_numeric();
else
solver->update();
// std::cout << "UmfPackSolver: A = \n" << A << "\n";
int code= (*solver)(x, b);
mtl::dense_vector<value_type> r= b - A * x;
std::cout << "UmfPackSolver: ||b-Ax|| = " << two_norm(r) << "\n";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment