From: kanschat Date: Mon, 3 Dec 2012 14:21:08 +0000 (+0000) Subject: reformat documentation and add memory consumption X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f32ec0f7c5b177ee8d789906259af94a76b63cbe;p=dealii-svn.git reformat documentation and add memory consumption git-svn-id: https://svn.dealii.org/trunk@27728 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/lac/relaxation_block.h b/deal.II/include/deal.II/lac/relaxation_block.h index dba6d906b6..54e57fe500 100644 --- a/deal.II/include/deal.II/lac/relaxation_block.h +++ b/deal.II/include/deal.II/lac/relaxation_block.h @@ -64,8 +64,7 @@ private: public: /** - * Parameters for block - * relaxation methods. + * Parameters for block relaxation methods. */ class AdditionalData : public Subscriptor { @@ -78,11 +77,9 @@ public: const bool same_diagonal = false); /** - * @deprecated Since the - * BlockList is now a data - * member of this class, it - * is not recommended anymore - * to generate it independently. + * @deprecated Since the BlockList is now a data member of this + * class, it is not recommended anymore to generate it + * independently. * * Constructor. */ @@ -93,8 +90,7 @@ public: /** - * The mapping from indices - * to blocks. + * The mapping from indices to blocks. */ SparsityPattern block_list; @@ -109,86 +105,65 @@ public: bool invert_diagonal; /** - * Assume all diagonal blocks - * are equal to save memory. + * Assume all diagonal blocks are equal to save memory. */ bool same_diagonal; /** - * Choose the inversion - * method for the blocks. + * Choose the inversion method for the blocks. */ typename PreconditionBlockBase::Inversion inversion; /** - * The if #inversion is SVD, - * the threshold below which - * a singular value will be - * considered zero and thus - * not inverted. This - * parameter is used in the - * call to LAPACKFullMatrix::compute_inverse_svd(). + * The if #inversion is SVD, the threshold below which a singular + * value will be considered zero and thus not inverted. This + * parameter is used in the call to + * LAPACKFullMatrix::compute_inverse_svd(). */ double threshold; /** - * The order in which blocks - * should be traversed. This - * vector can initiate - * several modes of - * execution: + * The order in which blocks should be traversed. This vector can + * initiate several modes of execution: * *
    - *
  1. If the length of the - * vector is zero, then the - * relaxation method will be - * executed from first to - * last block. - *
  2. If the length is one, - * then the inner vector must - * have the same size as - * the number of blocks. The - * relaxation method is - * applied in the order given - * in this vector. - *
  3. If the outer vector - * has length greater one, - * then the relaxation method - * is applied several times, - * each time in the order - * given by the inner vector - * of the corresponding - * index. This mode can for - * instance be used for ADI - * methods and similar - * direction sweeps. + * + *
  4. If the length of the vector is zero, then the relaxation + * method will be executed from first to last block.
  5. + * + *
  6. If the length is one, then the inner vector must have the + * same size as the number of blocks. The relaxation method is + * applied in the order given in this vector.
  7. + * + *
  8. If the outer vector has length greater one, then the + * relaxation method is applied several times, each time in the + * order given by the inner vector of the corresponding + * index. This mode can for instance be used for ADI methods and + * similar direction sweeps.
  9. + * *
*/ std::vector > order; + /** + * Return the memory allocated in this object. + */ + std::size_t memory_consumption() const; }; /** - * Initialize matrix and block - * size. We store the matrix and - * the block size in the - * preconditioner object. In a - * second step, the inverses of - * the diagonal blocks may be - * computed. + * Initialize matrix and block size. We store the matrix and the + * block size in the preconditioner object. In a second step, the + * inverses of the diagonal blocks may be computed. * - * Additionally, a relaxation - * parameter for derived classes - * may be provided. + * Additionally, a relaxation parameter for derived classes may be + * provided. */ void initialize (const MATRIX &A, const AdditionalData ¶meters); /** - * Deletes the inverse diagonal - * block matrices if existent, - * sets the blocksize to 0, hence - * leaves the class in the state - * that it had directly after - * calling the constructor. + * Deletes the inverse diagonal block matrices if existent, sets the + * blocksize to 0, hence leaves the class in the state that it had + * directly after calling the constructor. */ void clear(); @@ -198,56 +173,37 @@ public: bool empty () const; /** - * Read-only access to entries. - * This function is only possible - * if the inverse diagonal blocks - * are stored. + * Read-only access to entries. This function is only possible if + * the inverse diagonal blocks are stored. */ value_type el(unsigned int i, unsigned int j) const; /** - * Stores the inverse of the - * diagonal blocks in - * @p inverse. This costs some - * additional memory - for DG - * methods about 1/3 (for double - * inverses) or 1/6 (for float - * inverses) of that used for the - * matrix - but it makes the - * preconditioning much faster. + * Stores the inverse of the diagonal blocks in @p inverse. This + * costs some additional memory - for DG methods about 1/3 (for + * double inverses) or 1/6 (for float inverses) of that used for the + * matrix - but it makes the preconditioning much faster. * - * It is not allowed to call this - * function twice (will produce - * an error) before a call of - * clear(...) because at the - * second time there already - * exist the inverse matrices. + * It is not allowed to call this function twice (will produce an + * error) before a call of clear(...) because at the second + * time there already exist the inverse matrices. * - * After this function is called, - * the lock on the matrix given - * through the @p use_matrix - * function is released, i.e. you - * may overwrite of delete it. - * You may want to do this in - * case you use this matrix to - * precondition another matrix. + * After this function is called, the lock on the matrix given + * through the @p use_matrix function is released, i.e. you may + * overwrite of delete it. You may want to do this in case you use + * this matrix to precondition another matrix. */ void invert_diagblocks(); protected: /** - * Perform one block relaxation - * step. + * Perform one block relaxation step. * - * Depending on the arguments @p - * dst and @p pref, this performs - * an SOR step (both reference - * the same vector) of a Jacobi - * step (both are different - * vectors). For the Jacobi step, - * the calling function must copy - * @p dst to @p pref after this. + * Depending on the arguments @p dst and @p pref, this performs an + * SOR step (both reference the same vector) of a Jacobi step (both + * are different vectors). For the Jacobi step, the calling function + * must copy @p dst to @p pref after this. */ template void do_step ( @@ -256,16 +212,11 @@ protected: const Vector &src, const bool backward) const; /** - * Pointer to the matrix. Make - * sure that the matrix exists as - * long as this class needs it, - * i.e. until calling - * @p invert_diagblocks, or (if - * the inverse matrices should - * not be stored) until the last - * call of the preconditoining - * @p vmult function of the - * derived classes. + * Pointer to the matrix. Make sure that the matrix exists as long + * as this class needs it, i.e. until calling @p invert_diagblocks, + * or (if the inverse matrices should not be stored) until the last + * call of the preconditoining @p vmult function of the derived + * classes. */ SmartPointer > A; @@ -277,15 +228,16 @@ protected: /** - * Block Jacobi (additive Schwarz) method with possibly overlapping blocks. + * Block Jacobi (additive Schwarz) method with possibly overlapping + * blocks. * * This class implements the step() and Tstep() functions expected by - * SolverRelaxation and MGSmootherRelaxation. They perform an - * additive Schwarz method on the blocks provided in the - * BlockList of AdditionalData. Differing from PreconditionBlockJacobi, - * these blocks may be of varying size, non-contiguous, and - * overlapping. On the other hand, this class does not implement the - * preconditioner interface expected by Solver objects. + * SolverRelaxation and MGSmootherRelaxation. They perform an additive + * Schwarz method on the blocks provided in the BlockList of + * AdditionalData. Differing from PreconditionBlockJacobi, these + * blocks may be of varying size, non-contiguous, and overlapping. On + * the other hand, this class does not implement the preconditioner + * interface expected by Solver objects. * * @ingroup Preconditioners * @author Guido Kanschat @@ -344,18 +296,21 @@ public: using RelaxationBlock::inverse_svd; using PreconditionBlockBase::log_statistics; /** - * Perform one step of the Jacobi - * iteration. + * Perform one step of the Jacobi iteration. */ template void step (Vector &dst, const Vector &rhs) const; /** - * Perform one step of the - * Jacobi iteration. + * Perform one step of the Jacobi iteration. */ template void Tstep (Vector &dst, const Vector &rhs) const; + + /** + * Return the memory allocated in this object. + */ + std::size_t memory_consumption() const; }; @@ -427,15 +382,13 @@ public: using RelaxationBlock::inverse_svd; using PreconditionBlockBase::log_statistics; /** - * Perform one step of the SOR - * iteration. + * Perform one step of the SOR iteration. */ template void step (Vector &dst, const Vector &rhs) const; /** - * Perform one step of the - * transposed SOR iteration. + * Perform one step of the transposed SOR iteration. */ template void Tstep (Vector &dst, const Vector &rhs) const; @@ -474,8 +427,7 @@ public: using typename RelaxationBlock::AdditionalData; /** - * Make initialization function - * publicly available. + * Make initialization function publicly available. */ using RelaxationBlock::initialize; @@ -507,15 +459,13 @@ public: using RelaxationBlock::inverse_svd; using PreconditionBlockBase::log_statistics; /** - * Perform one step of the SOR - * iteration. + * Perform one step of the SOR iteration. */ template void step (Vector &dst, const Vector &rhs) const; /** - * Perform one step of the - * transposed SOR iteration. + * Perform one step of the transposed SOR iteration. */ template void Tstep (Vector &dst, const Vector &rhs) const; diff --git a/deal.II/include/deal.II/lac/relaxation_block.templates.h b/deal.II/include/deal.II/lac/relaxation_block.templates.h index a55c4b2b15..d4ae73c14d 100644 --- a/deal.II/include/deal.II/lac/relaxation_block.templates.h +++ b/deal.II/include/deal.II/lac/relaxation_block.templates.h @@ -33,6 +33,19 @@ RelaxationBlock::AdditionalData::AdditionalData ( {} +template +inline +std::size_t +RelaxationBlock::AdditionalData::memory_consumption() const +{ + std::size_t result = sizeof(*this) + + - sizeof(block_list) + block_list.memory_consumption(); + for (unsigned int i=0;i inline RelaxationBlock::AdditionalData::AdditionalData (