Commit 20e1adb5 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Small changes in solver interface the get the residual.

parent 74c16356
......@@ -197,9 +197,9 @@ namespace AMDiS {
if (condition->applyBoundaryCondition()) {
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
if (rankDofs[rowIndices[i]])
applyDBCs.insert(static_cast<int>(rowIndices[i]));
applyDBCs.insert(static_cast<int>(row));
#else
applyDBCs.insert(static_cast<int>(rowIndices[i]));
applyDBCs.insert(static_cast<int>(row));
#endif
}
} else {
......
......@@ -64,18 +64,10 @@ namespace AMDiS {
{
itl::cyclic_iteration<value_type> iter(b, this->max_iter, this->relative,
this->tolerance, this->print_cycle);
#if 0
std::cout << "A is " << num_rows(A) << " x " << num_cols(A)
<< ", one_norm(A) = " << one_norm(A)
<< ", b is " << num_rows(b)
<< ", one_norm(b) = " << one_norm(b)
<< ", x is " << num_rows(x)
<< ", one_norm(x) = " << one_norm(x) << "\n";
if (one_norm(x) > 1e100)
x= 0.0;
#endif
error= ITLSolver()(A, x, b, *this->leftPrecon, *this->rightPrecon, iter);
iterations= iter.iterations();
error = ITLSolver()(A, x, b, *this->leftPrecon, *this->rightPrecon, iter);
iterations = iter.iterations();
residual = iter.resid();
return error;
}
......@@ -127,8 +119,9 @@ namespace AMDiS {
{
itl::cyclic_iteration<value_type> iter(b, this->max_iter, this->relative,
this->tolerance, this->print_cycle);
error= ITLSolver()(A, x, b, *this->leftPrecon, *this->rightPrecon, iter, ell);
iterations= iter.iterations();
error = ITLSolver()(A, x, b, *this->leftPrecon, *this->rightPrecon, iter, ell);
iterations = iter.iterations();
residual = iter.resid();
return error;
}
......
......@@ -142,7 +142,7 @@ namespace AMDiS {
: public ITL_Preconditioner<itl::pc::identity<DOFMatrix::base_matrix_type> >
{
typedef ITL_Preconditioner<itl::pc::identity<DOFMatrix::base_matrix_type> > base;
public:
IdentityPreconditioner(const DOFMatrix::base_matrix_type& A) : base(A) {}
};
......
......@@ -474,7 +474,7 @@ namespace AMDiS {
traverse(-1, fill_flag, newDOFFct2);
newDOF.resize(0);
}
}
}
......
......@@ -182,25 +182,25 @@ namespace AMDiS {
*/
/// Returns solvers \ref name.
inline std::string getName()
inline std::string getName() const
{
return name;
}
/// Returns \ref tolerance
inline double getTolerance()
inline double getTolerance() const
{
return tolerance;
}
/// Returns \ref max_iter
inline int getMaxIterations()
inline int getMaxIterations() const
{
return max_iter;
}
/// Returns \ref residual
inline double getResidual()
inline double getResidual() const
{
return residual;
}
......
......@@ -587,9 +587,8 @@ namespace AMDiS {
}
systemMatrix->removeRowsWithDBC(systemMatrix->getApplyDBCs());
systemMatrix->finishInsertion();
// TODO: ExitMatrix should be called after finishInsertion!
if (systemMatrix->getBoundaryManager())
systemMatrix->getBoundaryManager()->exitMatrix(systemMatrix);
......@@ -599,14 +598,7 @@ namespace AMDiS {
solution->getBoundaryManager()->exitVector(solution);
INFO(info, 8)("buildAfterCoarsen needed %.5f seconds\n", TIME_USED(first,clock()));
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
// PetscErrorCode ierr;
// Mat A;
// ierr = MatCreate(PETSC_COMM_WORLD, &A); CHKERRQ(ierr);
#endif
createPrecon();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment