From: janssen Date: Tue, 5 Jan 2010 13:50:48 +0000 (+0000) Subject: some initialize functions added to handle different smoothers on each level X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae74f47ca9e097004b1f608e106d64d207914d4a;p=dealii-svn.git some initialize functions added to handle different smoothers on each level git-svn-id: https://svn.dealii.org/trunk@20288 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/multigrid/mg_smoother.h b/deal.II/deal.II/include/multigrid/mg_smoother.h index ef498eed7a..fdcb4b729f 100644 --- a/deal.II/deal.II/include/multigrid/mg_smoother.h +++ b/deal.II/deal.II/include/multigrid/mg_smoother.h @@ -222,17 +222,12 @@ class MGSmootherRelaxation : public MGSmoother const bool transpose = false); /** - * Initialize for matrices. The - * parameter @p matrices can be - * any object having functions - * get_minlevel() and - * get_maxlevel() as well as - * an operator[] returning a - * reference to @p MATRIX. This + * Initialize for matrices. This * function stores pointers to * the level matrices and * initializes the smoothing - * operator for each level. + * operator with the same smoother + * for each level. * * @p additional_data is an * object of type @@ -241,28 +236,40 @@ class MGSmootherRelaxation : public MGSmoother * initialization function of the * relaxation method. */ - template - void initialize (const MGMATRIXOBJECT& matrices, + template + void initialize (const MGLevelObject& matrices, const DATA& additional_data); + /** + * Initialize for matrices. This + * function stores pointers to + * the level matrices and + * initializes the smoothing + * operator with the according + * smoother for each level. + * + * @p additional_data is an + * object of type + * @p RELAX::AdditionalData and + * is handed to the + * initialization function of the + * relaxation method. + */ + template + void initialize (const MGLevelObject& matrices, + const MGLevelObject& additional_data); + /** * Initialize for single blocks - * of matrices. The parameter - * @p matrices can be any object - * having functions - * get_minlevel() and - * get_maxlevel() as well as - * an operator[] returning a - * reference to a block matrix - * where each block is of type - * @p MATRIX. Of this block + * of matrices. Of this block * matrix, the block indicated by * @p block_row and * @p block_col is selected on * each level. This function * stores pointers to the level * matrices and initializes the - * smoothing operator for each + * smoothing operator with the + * same smoother for each * level. * * @p additional_data is an @@ -272,10 +279,36 @@ class MGSmootherRelaxation : public MGSmoother * initialization function of the * relaxation method. */ - template - void initialize (const MGMATRIXOBJECT& matrices, + template + void initialize (const MGLevelObject& matrices, const DATA& additional_data, const unsigned int block_row, + const unsigned int block_col); + + /** + * Initialize for single blocks + * of matrices. Of this block + * matrix, the block indicated by + * @p block_row and + * @p block_col is selected on + * each level. This function + * stores pointers to the level + * matrices and initializes the + * smoothing operator with the + * according smoother for each + * level. + * + * @p additional_data is an + * object of type + * @p RELAX::AdditionalData and + * is handed to the + * initialization function of the + * relaxation method. + */ + template + void initialize (const MGLevelObject& matrices, + const MGLevelObject& additional_data, + const unsigned int block_row, const unsigned int block_col); /** @@ -358,17 +391,12 @@ class MGSmootherPrecondition : public MGSmoother const bool transpose = false); /** - * Initialize for matrices. The - * parameter @p matrices can be - * any object having functions - * get_minlevel() and - * get_maxlevel() as well as - * an operator[] returning a - * reference to @p MATRIX. This + * Initialize for matrices. This * function stores pointers to * the level matrices and * initializes the smoothing - * operator for each level. + * operator with the same smoother + * for each level. * * @p additional_data is an * object of type @@ -377,28 +405,40 @@ class MGSmootherPrecondition : public MGSmoother * initialization function of the * relaxation method. */ - template - void initialize (const MGMATRIXOBJECT& matrices, + template + void initialize (const MGLevelObject& matrices, const DATA& additional_data); + /** + * Initialize for matrices. This + * function stores pointers to + * the level matrices and + * initializes the smoothing + * operator with the according + * smoother for each level. + * + * @p additional_data is an + * object of type + * @p RELAX::AdditionalData and + * is handed to the + * initialization function of the + * relaxation method. + */ + template + void initialize (const MGLevelObject& matrices, + const MGLevelObject& additional_data); + /** * Initialize for single blocks - * of matrices. The parameter - * @p matrices can be any object - * having functions - * get_minlevel() and - * get_maxlevel() as well as - * an operator[] returning a - * reference to a block matrix - * where each block is of type - * @p MATRIX. Of this block + * of matrices. Of this block * matrix, the block indicated by * @p block_row and * @p block_col is selected on * each level. This function * stores pointers to the level * matrices and initializes the - * smoothing operator for each + * smoothing operator with the + * same smoother for each * level. * * @p additional_data is an @@ -408,10 +448,36 @@ class MGSmootherPrecondition : public MGSmoother * initialization function of the * relaxation method. */ - template - void initialize (const MGMATRIXOBJECT& matrices, + template + void initialize (const MGLevelObject& matrices, const DATA& additional_data, const unsigned int block_row, + const unsigned int block_col); + + /** + * Initialize for single blocks + * of matrices. Of this block + * matrix, the block indicated by + * @p block_row and + * @p block_col is selected on + * each level. This function + * stores pointers to the level + * matrices and initializes the + * smoothing operator with the + * according smoother for each + * level. + * + * @p additional_data is an + * object of type + * @p RELAX::AdditionalData and + * is handed to the + * initialization function of the + * relaxation method. + */ + template + void initialize (const MGLevelObject& matrices, + const MGLevelObject& additional_data, + const unsigned int block_row, const unsigned int block_col); /** @@ -547,10 +613,10 @@ MGSmootherRelaxation::clear () template -template +template inline void MGSmootherRelaxation::initialize ( - const MGMATRIXOBJECT& m, + const MGLevelObject& m, const DATA& data) { const unsigned int min = m.get_minlevel(); @@ -566,12 +632,31 @@ MGSmootherRelaxation::initialize ( } } +template +template +inline void +MGSmootherRelaxation::initialize ( + const MGLevelObject& m, + const MGLevelObject& data) +{ + const unsigned int min = m.get_minlevel(); + const unsigned int max = m.get_maxlevel(); + + matrices.resize(min, max); + smoothers.resize(min, max); + + for (unsigned int i=min;i<=max;++i) + { + matrices[i] = &m[i]; + smoothers[i].initialize(m[i], data[i]); + } +} template -template +template inline void MGSmootherRelaxation::initialize ( - const MGMATRIXOBJECT& m, + const MGLevelObject& m, const DATA& data, const unsigned int row, const unsigned int col) @@ -589,6 +674,27 @@ MGSmootherRelaxation::initialize ( } } +template +template +inline void +MGSmootherRelaxation::initialize ( + const MGLevelObject& m, + const MGLevelObject& data, + const unsigned int row, + const unsigned int col) +{ + const unsigned int min = m.get_minlevel(); + const unsigned int max = m.get_maxlevel(); + + matrices.resize(min, max); + smoothers.resize(min, max); + + for (unsigned int i=min;i<=max;++i) + { + matrices[i] = &(m[i].block(row, col)); + smoothers[i].initialize(m[i].block(row, col), data[i]); + } +} #ifdef DEAL_II_MULTIGRID_COMPATIBILITY @@ -727,10 +833,10 @@ MGSmootherPrecondition::clear () template -template +template inline void MGSmootherPrecondition::initialize ( - const MGMATRIXOBJECT& m, + const MGLevelObject& m, const DATA& data) { const unsigned int min = m.get_minlevel(); @@ -746,12 +852,31 @@ MGSmootherPrecondition::initialize ( } } +template +template +inline void +MGSmootherPrecondition::initialize ( + const MGLevelObject& m, + const MGLevelObject& data) +{ + const unsigned int min = m.get_minlevel(); + const unsigned int max = m.get_maxlevel(); + + matrices.resize(min, max); + smoothers.resize(min, max); + + for (unsigned int i=min;i<=max;++i) + { + matrices[i] = &m[i]; + smoothers[i].initialize(m[i], data[i]); + } +} template -template +template inline void MGSmootherPrecondition::initialize ( - const MGMATRIXOBJECT& m, + const MGLevelObject& m, const DATA& data, const unsigned int row, const unsigned int col) @@ -769,6 +894,27 @@ MGSmootherPrecondition::initialize ( } } +template +template +inline void +MGSmootherPrecondition::initialize ( + const MGLevelObject& m, + const MGLevelObject& data, + const unsigned int row, + const unsigned int col) +{ + const unsigned int min = m.get_minlevel(); + const unsigned int max = m.get_maxlevel(); + + matrices.resize(min, max); + smoothers.resize(min, max); + + for (unsigned int i=min;i<=max;++i) + { + matrices[i] = &(m[i].block(row, col)); + smoothers[i].initialize(m[i].block(row, col), data[i]); + } +} template inline void