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 { ...@@ -197,9 +197,9 @@ namespace AMDiS {
if (condition->applyBoundaryCondition()) { if (condition->applyBoundaryCondition()) {
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS #ifdef HAVE_PARALLEL_DOMAIN_AMDIS
if (rankDofs[rowIndices[i]]) if (rankDofs[rowIndices[i]])
applyDBCs.insert(static_cast<int>(rowIndices[i])); applyDBCs.insert(static_cast<int>(row));
#else #else
applyDBCs.insert(static_cast<int>(rowIndices[i])); applyDBCs.insert(static_cast<int>(row));
#endif #endif
} }
} else { } else {
......
...@@ -64,18 +64,10 @@ namespace AMDiS { ...@@ -64,18 +64,10 @@ namespace AMDiS {
{ {
itl::cyclic_iteration<value_type> iter(b, this->max_iter, this->relative, itl::cyclic_iteration<value_type> iter(b, this->max_iter, this->relative,
this->tolerance, this->print_cycle); this->tolerance, this->print_cycle);
#if 0
std::cout << "A is " << num_rows(A) << " x " << num_cols(A) error = ITLSolver()(A, x, b, *this->leftPrecon, *this->rightPrecon, iter);
<< ", one_norm(A) = " << one_norm(A) iterations = iter.iterations();
<< ", b is " << num_rows(b) residual = iter.resid();
<< ", 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();
return error; return error;
} }
...@@ -127,8 +119,9 @@ namespace AMDiS { ...@@ -127,8 +119,9 @@ namespace AMDiS {
{ {
itl::cyclic_iteration<value_type> iter(b, this->max_iter, this->relative, itl::cyclic_iteration<value_type> iter(b, this->max_iter, this->relative,
this->tolerance, this->print_cycle); this->tolerance, this->print_cycle);
error= ITLSolver()(A, x, b, *this->leftPrecon, *this->rightPrecon, iter, ell); error = ITLSolver()(A, x, b, *this->leftPrecon, *this->rightPrecon, iter, ell);
iterations= iter.iterations(); iterations = iter.iterations();
residual = iter.resid();
return error; return error;
} }
......
...@@ -142,7 +142,7 @@ namespace AMDiS { ...@@ -142,7 +142,7 @@ namespace AMDiS {
: public ITL_Preconditioner<itl::pc::identity<DOFMatrix::base_matrix_type> > : public ITL_Preconditioner<itl::pc::identity<DOFMatrix::base_matrix_type> >
{ {
typedef ITL_Preconditioner<itl::pc::identity<DOFMatrix::base_matrix_type> > base; typedef ITL_Preconditioner<itl::pc::identity<DOFMatrix::base_matrix_type> > base;
public:
IdentityPreconditioner(const DOFMatrix::base_matrix_type& A) : base(A) {} IdentityPreconditioner(const DOFMatrix::base_matrix_type& A) : base(A) {}
}; };
......
...@@ -474,7 +474,7 @@ namespace AMDiS { ...@@ -474,7 +474,7 @@ namespace AMDiS {
traverse(-1, fill_flag, newDOFFct2); traverse(-1, fill_flag, newDOFFct2);
newDOF.resize(0); newDOF.resize(0);
} }
} }
......
...@@ -182,25 +182,25 @@ namespace AMDiS { ...@@ -182,25 +182,25 @@ namespace AMDiS {
*/ */
/// Returns solvers \ref name. /// Returns solvers \ref name.
inline std::string getName() inline std::string getName() const
{ {
return name; return name;
} }
/// Returns \ref tolerance /// Returns \ref tolerance
inline double getTolerance() inline double getTolerance() const
{ {
return tolerance; return tolerance;
} }
/// Returns \ref max_iter /// Returns \ref max_iter
inline int getMaxIterations() inline int getMaxIterations() const
{ {
return max_iter; return max_iter;
} }
/// Returns \ref residual /// Returns \ref residual
inline double getResidual() inline double getResidual() const
{ {
return residual; return residual;
} }
......
...@@ -587,9 +587,8 @@ namespace AMDiS { ...@@ -587,9 +587,8 @@ namespace AMDiS {
} }
systemMatrix->removeRowsWithDBC(systemMatrix->getApplyDBCs()); systemMatrix->removeRowsWithDBC(systemMatrix->getApplyDBCs());
systemMatrix->finishInsertion(); systemMatrix->finishInsertion();
// TODO: ExitMatrix should be called after finishInsertion! // TODO: ExitMatrix should be called after finishInsertion!
if (systemMatrix->getBoundaryManager()) if (systemMatrix->getBoundaryManager())
systemMatrix->getBoundaryManager()->exitMatrix(systemMatrix); systemMatrix->getBoundaryManager()->exitMatrix(systemMatrix);
...@@ -599,14 +598,7 @@ namespace AMDiS { ...@@ -599,14 +598,7 @@ namespace AMDiS {
solution->getBoundaryManager()->exitVector(solution); solution->getBoundaryManager()->exitVector(solution);
INFO(info, 8)("buildAfterCoarsen needed %.5f seconds\n", TIME_USED(first,clock())); 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(); 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