From: wolf Date: Sat, 17 May 2003 01:03:00 +0000 (+0000) Subject: Move a local structure into namespace 'internal', to hide it from the documentation... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b7172898a170347dec7c928341a5407b9d2ef11;p=dealii-svn.git Move a local structure into namespace 'internal', to hide it from the documentation system. git-svn-id: https://svn.dealii.org/trunk@7656 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 91e55568c2..12f6be15c4 100644 --- a/deal.II/lac/include/lac/solver_gmres.h +++ b/deal.II/lac/include/lac/solver_gmres.h @@ -28,6 +28,89 @@ #include +namespace internal +{ + /** + * A namespace for a helper class + * to the GMRES solver. + */ + namespace SolverGMRES + { + /** + * Class to hold temporary + * vectors. This class + * automatically allocates a new + * vector, once it is needed. + * + * A future version should also + * be able to shift through + * vectors automatically, + * avoiding restart. + */ + + template + class TmpVectors + { + public: + /** + * Constructor. Prepares an + * array of @p{VECTOR} of + * length @p{max_size}. + */ + TmpVectors(const unsigned int max_size, + VectorMemory &vmem); + + /** + * Delete all allocated vectors. + */ + ~TmpVectors(); + + /** + * Get vector number + * @p{i}. If this vector was + * unused before, an error + * occurs. + */ + VECTOR& operator[] (const unsigned int i) const; + + /** + * Get vector number + * @p{i}. Allocate it if + * necessary. + * + * If a vector must be + * allocated, @p{temp} is + * used to reinit it to the + * proper dimensions. + */ + VECTOR& operator() (const unsigned int i, + const VECTOR &temp); + + private: + /** + * Pool were vectors are + * obtained from. + */ + VectorMemory &mem; + + /** + * Field for storing the + * vectors. + */ + std::vector data; + + /** + * Offset of the first + * vector. This is for later + * when vector rotation will + * be implemented. + */ + unsigned int offset; + }; + } +} + + /** * Implementation of the Restarted Preconditioned Direct Generalized * Minimal Residual Method. The stopping criterion is the norm of the @@ -199,77 +282,6 @@ class SolverGMRES : public Solver FullMatrix H1; private: - /** - * Class to hold temporary - * vectors. This class - * automatically allocates a new - * vector, once it is needed. - * - * A future version should also - * be able to shift through - * vectors automatically, - * avoiding restart. - */ - - class TmpVectors - { - public: - /** - * Constructor. Prepares an - * array of @p{VECTOR} of - * length @p{max_size}. - */ - TmpVectors(const unsigned int max_size, - VectorMemory &vmem); - - /** - * Delete all allocated vectors. - */ - ~TmpVectors(); - - /** - * Get vector number - * @p{i}. If this vector was - * unused before, an error - * occurs. - */ - VECTOR& operator[] (const unsigned int i) const; - - /** - * Get vector number - * @p{i}. Allocate it if - * necessary. - * - * If a vector must be - * allocated, @p{temp} is - * used to reinit it to the - * proper dimensions. - */ - VECTOR& operator() (const unsigned int i, - const VECTOR &temp); - - private: - /** - * Pool were vectors are - * obtained from. - */ - VectorMemory &mem; - - /** - * Field for storing the - * vectors. - */ - std::vector data; - - /** - * Offset of the first - * vector. This is for later - * when vector rotation will - * be implemented. - */ - unsigned int offset; - }; - /** * No copy constructor. */ @@ -279,54 +291,61 @@ class SolverGMRES : public Solver /* --------------------- Inline and template functions ------------------- */ -template -inline -SolverGMRES::TmpVectors:: -TmpVectors (const unsigned int max_size, - VectorMemory &vmem) - : - mem(vmem), - data (max_size, 0), - offset(0) -{} - -template -inline -SolverGMRES::TmpVectors::~TmpVectors () +namespace internal { - for (typename std::vector::iterator v = data.begin(); - v != data.end(); ++v) - if (*v != 0) - mem.free(*v); -} + namespace SolverGMRES + { + template + inline + TmpVectors:: + TmpVectors (const unsigned int max_size, + VectorMemory &vmem) + : + mem(vmem), + data (max_size, 0), + offset(0) + {} + + + template + inline + TmpVectors::~TmpVectors () + { + for (typename std::vector::iterator v = data.begin(); + v != data.end(); ++v) + if (*v != 0) + mem.free(*v); + } -template -inline VECTOR& -SolverGMRES::TmpVectors::operator[] (const unsigned int i) const -{ - Assert (i+offset + inline VECTOR& + TmpVectors::operator[] (const unsigned int i) const + { + Assert (i+offset -inline VECTOR& -SolverGMRES::TmpVectors::operator() (const unsigned int i, - const VECTOR &temp) -{ - Assert (i+offset + inline VECTOR& + TmpVectors::operator() (const unsigned int i, + const VECTOR &temp) { - data[i-offset] = mem.alloc(); - data[i-offset]->reinit(temp); + Assert (i+offsetreinit(temp); + } + return *data[i-offset]; } - return *data[i-offset]; + } } @@ -389,7 +408,7 @@ SolverGMRES::solve (const MATRIX &A, // Generate an object where basis // vectors are stored. - TmpVectors tmp_vectors (n_tmp_vectors, this->memory); + internals::SolverGMRES::TmpVectors tmp_vectors (n_tmp_vectors, this->memory); // number of the present iteration; this // number is not reset to zero upon a