From: cvs Date: Mon, 18 Oct 1999 22:13:42 +0000 (+0000) Subject: made conforming to the matrix and vector interface X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1d01fb8adc5510b526900b47475db975b037732;p=dealii-svn.git made conforming to the matrix and vector interface git-svn-id: https://svn.dealii.org/trunk@1779 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/solver_gmres.h b/deal.II/lac/include/lac/solver_gmres.h index fe4947f98e..c192016029 100644 --- a/deal.II/lac/include/lac/solver_gmres.h +++ b/deal.II/lac/include/lac/solver_gmres.h @@ -60,8 +60,8 @@ * * @author Wolfgang Bangerth */ -template -class SolverGMRES : public Solver +template +class SolverGMRES : public Solver { public: /** @@ -91,16 +91,16 @@ class SolverGMRES : public Solver * Constructor. */ SolverGMRES (SolverControl &cn, - VectorMemory &mem, + VectorMemory &mem, const AdditionalData &data=AdditionalData()); /** * Solver method. */ template - typename Solver::ReturnState solve (const Matrix &A, - Vector &x, - const Vector &b, + typename Solver::ReturnState solve (const Matrix &A, + VECTOR &x, + const VECTOR &b, const Preconditioner& precondition); DeclException1 (ExcTooFewTmpVectors, @@ -128,8 +128,8 @@ class SolverGMRES : public Solver * tridiagonal structure by givens * rotation of the last column */ - void givens_rotation (Vector &h, Vector &b, - Vector &ci, Vector &si, + void givens_rotation (Vector &h, Vector &b, + Vector &ci, Vector &si, int col) const; }; @@ -139,11 +139,11 @@ class SolverGMRES : public Solver /* --------------------- Inline and template functions ------------------- */ -template -SolverGMRES::SolverGMRES (SolverControl &cn, - VectorMemory &mem, +template +SolverGMRES::SolverGMRES (SolverControl &cn, + VectorMemory &mem, const AdditionalData &data) : - Solver (cn,mem), + Solver (cn,mem), additional_data(data) { Assert (additional_data.max_n_tmp_vectors >= 10, @@ -152,13 +152,13 @@ SolverGMRES::SolverGMRES (SolverControl &cn, -template +template inline void -SolverGMRES::givens_rotation (Vector &h, - Vector &b, - Vector &ci, - Vector &si, +SolverGMRES::givens_rotation (Vector &h, + Vector &b, + Vector &ci, + Vector &si, int col) const { for (int i=0 ; i::givens_rotation (Vector &h, -template +template template -typename Solver::ReturnState -SolverGMRES::solve (const Matrix& A, - Vector & x, - const Vector& b, +typename Solver::ReturnState +SolverGMRES::solve (const Matrix& A, + VECTOR & x, + const VECTOR& b, const Preconditioner& precondition) { // this code was written by the fathers of @@ -199,24 +199,23 @@ SolverGMRES::solve (const Matrix& A, deallog.push("GMRES"); - // determine how many vectors to allocate. - // if the size of the matrix is very small, - // then only allocate a number of vectors - // which is needed - const unsigned int n_tmp_vectors = (A.m()+3 > additional_data.max_n_tmp_vectors ? - additional_data.max_n_tmp_vectors : - A.m()+3); + // Originally, here was a strange computation of + // the number of auxiliary vectors, using + // non-standardized members of the matrix. + // Since it is up to the user to decide on the + // number of auxiliary vectors, this was removed. GK + const unsigned int n_tmp_vectors = (additional_data.max_n_tmp_vectors); // allocate an array of n_tmp_vectors // temporary vectors from the VectorMemory // object; resize them but do not set their // values since they will be overwritten soon // anyway. - vector tmp_vectors (n_tmp_vectors, 0); + vector tmp_vectors (n_tmp_vectors, 0); for (unsigned int tmp=0; tmpreinit (x.size(), true); + tmp_vectors[tmp]->reinit (x, true); }; // number of the present iteration; this @@ -247,8 +246,8 @@ SolverGMRES::solve (const Matrix& A, const bool left_precondition = true; // define two aliases - Vector &v = *tmp_vectors[0]; - Vector &p = *tmp_vectors[n_tmp_vectors-1]; + VECTOR &v = *tmp_vectors[0]; + VECTOR &p = *tmp_vectors[n_tmp_vectors-1]; /////////////////////////////////// @@ -301,7 +300,7 @@ SolverGMRES::solve (const Matrix& A, ++inner_iteration, ++accumulated_iterations) { // yet another alias - Vector& vv = *tmp_vectors[inner_iteration+1]; + VECTOR& vv = *tmp_vectors[inner_iteration+1]; if (left_precondition) { @@ -397,9 +396,9 @@ SolverGMRES::solve (const Matrix& A, -template +template double -SolverGMRES::criterion () +SolverGMRES::criterion () { // dummy implementation. this function is // not needed for the present implementation