From: guido Date: Wed, 21 Aug 2002 15:18:24 +0000 (+0000) Subject: file structure fixed X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80d1cd870648e32b5cc74455b18a51ea253169e8;p=dealii-svn.git file structure fixed git-svn-id: https://svn.dealii.org/trunk@6336 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/multigrid/mg_base.h b/deal.II/deal.II/include/multigrid/mg_base.h index cdd8886d03..c858ae747e 100644 --- a/deal.II/deal.II/include/multigrid/mg_base.h +++ b/deal.II/deal.II/include/multigrid/mg_base.h @@ -188,59 +188,6 @@ class MGCoarseGrid : public Subscriptor }; -/** - * Coarse grid solver using LAC iterative methods. - * This is a little wrapper, transforming a triplet of iterative - * solver, matrix and preconditioner into a coarse grid solver. - * - * The type of the matrix (i.e. the template parameter @p{MATRIX}) - * should be derived from @p{Subscriptor} to allow for the use of a - * smart pointer to it. - * - * @author Guido Kanschat, 1999 - */ -template > -class MGCoarseGridLACIteration : public MGCoarseGrid -{ - public: - /** - * Constructor. - * Store solver, matrix and - * preconditioning method for later - * use. - */ - MGCoarseGridLACIteration (SOLVER &, - const MATRIX &, - const PRECOND &); - - /** - * Implementation of the abstract - * function. - * Calls the solver method with - * matrix, vectors and - * preconditioner. - */ - void operator() (const unsigned int level, - VECTOR &dst, - const VECTOR &src) const; - private: - /** - * Reference to the solver. - */ - SOLVER& solver; - - /** - * Reference to the matrix. - */ - const SmartPointer matrix; - - /** - * Reference to the preconditioner. - */ - const PRECOND& precondition; -}; - - /** * Base class used to declare the operations needed by a concrete class * implementing prolongation and restriction of vectors in the multigrid @@ -308,6 +255,32 @@ class MGCoarseGridLACIteration : public MGCoarseGrid +/** + * Base class for multigrid smoothers. Does nothing but defining the + * interface used by multigrid methods. + * + * @author Guido Kanschat, 2002 + */ +template +class MGSmoother : public Subscriptor +{ + public: + /** + * Virtual destructor. + */ + virtual ~MGSmoother(); + + /** + * Smoothing function. This is the + * function used in multigrid + * methods. + */ + virtual void smooth (const unsigned int level, + VECTOR& u, + const VECTOR& rhs) const = 0; +}; + + /* ------------------------------------------------------------------- */ @@ -400,32 +373,6 @@ MGMatrix::vmult (unsigned int level, } -/* ------------------ Functions for MGCoarseGridLACIteration ------------ */ - - -template -MGCoarseGridLACIteration -::MGCoarseGridLACIteration(SOLVER& s, - const MATRIX &m, - const PRECOND &p) - : - solver(s), - matrix(&m), - precondition(p) -{}; - - -template -void -MGCoarseGridLACIteration -::operator() (const unsigned int /* level */, - VECTOR &dst, - const VECTOR &src) const -{ - solver.solve(*matrix, dst, src, precondition); -} - - /*---------------------------- mgbase.h ---------------------------*/ #endif diff --git a/deal.II/deal.II/include/multigrid/mg_coarse.h b/deal.II/deal.II/include/multigrid/mg_coarse.h new file mode 100644 index 0000000000..c922b1e229 --- /dev/null +++ b/deal.II/deal.II/include/multigrid/mg_coarse.h @@ -0,0 +1,100 @@ +//------------------------------------------------------------------------ +// $Id$ +// Version: $Name$ +// +// Copyright (C) 1998, 1999, 2000, 2001, 2002 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//------------------------------------------------------------------------ +#ifndef __deal2__mg_coarse_h +#define __deal2__mg_coarse_h + + +#include + + +/** + * Coarse grid solver using LAC iterative methods. + * This is a little wrapper, transforming a triplet of iterative + * solver, matrix and preconditioner into a coarse grid solver. + * + * The type of the matrix (i.e. the template parameter @p{MATRIX}) + * should be derived from @p{Subscriptor} to allow for the use of a + * smart pointer to it. + * + * @author Guido Kanschat, 1999 + */ +template > +class MGCoarseGridLACIteration : public MGCoarseGrid +{ + public: + /** + * Constructor. + * Store solver, matrix and + * preconditioning method for later + * use. + */ + MGCoarseGridLACIteration (SOLVER &, + const MATRIX &, + const PRECOND &); + + /** + * Implementation of the abstract + * function. + * Calls the solver method with + * matrix, vectors and + * preconditioner. + */ + void operator() (const unsigned int level, + VECTOR &dst, + const VECTOR &src) const; + private: + /** + * Reference to the solver. + */ + SOLVER& solver; + + /** + * Reference to the matrix. + */ + const SmartPointer matrix; + + /** + * Reference to the preconditioner. + */ + const PRECOND& precondition; +}; + + +/* ------------------ Functions for MGCoarseGridLACIteration ------------ */ + + +template +MGCoarseGridLACIteration +::MGCoarseGridLACIteration(SOLVER& s, + const MATRIX &m, + const PRECOND &p) + : + solver(s), + matrix(&m), + precondition(p) +{}; + + +template +void +MGCoarseGridLACIteration +::operator() (const unsigned int /* level */, + VECTOR &dst, + const VECTOR &src) const +{ + solver.solve(*matrix, dst, src, precondition); +} + + + +#endif diff --git a/deal.II/deal.II/include/multigrid/mg_smoother.h b/deal.II/deal.II/include/multigrid/mg_smoother.h index b01defeb2a..207900d974 100644 --- a/deal.II/deal.II/include/multigrid/mg_smoother.h +++ b/deal.II/deal.II/include/multigrid/mg_smoother.h @@ -22,32 +22,6 @@ template class MGDoFHandler; -/** - * Base class for multigrid smoothers. Does nothing but defining the - * interface used by multigrid methods. - * - * @author Guido KAnschat, 2002 - */ -template -class MGSmoother : public Subscriptor -{ - public: - /** - * Virtual destructor. - */ - virtual ~MGSmoother(); - - /** - * Smoothing function. This is the - * function used in multigrid - * methods. - */ - virtual void smooth (const unsigned int level, - VECTOR& u, - const VECTOR& rhs) const = 0; -}; - - /** * Smoother doing nothing. This class is not useful for many applications other * than for testing some multigrid procedures. Also some applications might diff --git a/deal.II/deal.II/include/multigrid/multigrid.h b/deal.II/deal.II/include/multigrid/multigrid.h index 301691ced1..7a787fbc9d 100644 --- a/deal.II/deal.II/include/multigrid/multigrid.h +++ b/deal.II/deal.II/include/multigrid/multigrid.h @@ -25,9 +25,7 @@ //TODO:[GK] Cleanup -// Move MGSmoother to mg_base.h // move definitions of virtual destructors to mg_base.templates.h -// move MGCoarseGridLACIteration to mg_coarse.h // /** @@ -124,15 +122,6 @@ class Multigrid : public Subscriptor */ void vcycle(); - /** - * Print a level vector using - * @ref{DoFHandler}. - */ -/* virtual void print_vector (const unsigned int level, */ -/* const VECTOR& v, */ -/* const char* name) const; */ - - private: /** diff --git a/deal.II/deal.II/include/multigrid/multigrid.templates.h b/deal.II/deal.II/include/multigrid/multigrid.templates.h index 383a54c3a9..c23bf90d5d 100644 --- a/deal.II/deal.II/include/multigrid/multigrid.templates.h +++ b/deal.II/deal.II/include/multigrid/multigrid.templates.h @@ -23,166 +23,6 @@ #include -//TODO:[?] This function needs to be specially implemented, since in 2d mode we use faces -#if deal_II_dimension == 1 - -template -template -void -Multigrid::copy_to_mg (const Vector&) -{ - Assert(false, ExcNotImplemented()); -} - -#else - -template -template -void -Multigrid::copy_to_mg (const Vector& osrc) -{ - // Make src a real finite element function - Vector src = osrc; -// constraints->distribute(src); - - const unsigned int dofs_per_cell = mg_dof_handler->get_fe().dofs_per_cell; - const unsigned int dofs_per_face = mg_dof_handler->get_fe().dofs_per_face; - - // set the elements of the vectors - // on all levels to zero - defect.clear(); - - std::vector global_dof_indices (dofs_per_cell); - std::vector level_dof_indices (dofs_per_cell); - std::vector level_face_indices (dofs_per_face); - - // initialize the objects with - // their correct size - for (unsigned int level=minlevel; level<=maxlevel ; ++level) - { - const unsigned int system_size = (*level_matrices)[level].m(); - - solution[level].reinit(system_size); - defect[level].reinit(system_size); - t[level].reinit(system_size); - }; - - // traverse the grid top-down - // (i.e. starting with the most - // refined grid). this way, we can - // always get that part of one - // level of the output vector which - // corresponds to a region which is - // more refined, by restriction of - // the respective vector on the - // next finer level, which we then - // already have built. - for (int level=maxlevel; level>=static_cast(minlevel); --level) - { - typename MGDoFHandler::active_cell_iterator - level_cell = mg_dof_handler->begin_active(level); - const typename MGDoFHandler::active_cell_iterator - level_end = mg_dof_handler->end_active(level); - -//TODO:[?] Treat hanging nodes properly -// The single-level vector is not an FE-function, because the values at -// hanging nodes are set to zero. This should be treated before the restriction. - - // Compute coarse level right hand side - // by restricting from fine level. - for (; level_cell!=level_end; ++level_cell) - { - DoFObjectAccessor& global_cell = *level_cell; - // get the dof numbers of - // this cell for the global - // and the level-wise - // numbering - global_cell.get_dof_indices(global_dof_indices); - level_cell->get_mg_dof_indices (level_dof_indices); - - // transfer the global - // defect in the vector - // into the level-wise one - for (unsigned int i=0; i::faces_per_cell; ++face_n) - { - const typename MGDoFHandler::face_iterator - face = level_cell->face(face_n); - if (face->has_children()) - { - face->get_mg_dof_indices(level_face_indices); - - - // Delete values on refinement edge, - // since restriction will add them again. - for (unsigned int i=0; i(level) < maxlevel) - { - transfer->restrict_and_add (level+1, defect[level], defect[level+1]); - } - }; -}; - -#endif - - -template -template -void -Multigrid::copy_from_mg(Vector &dst) const -{ - const unsigned int dofs_per_cell = mg_dof_handler->get_fe().dofs_per_cell; - - std::vector global_dof_indices (dofs_per_cell); - std::vector level_dof_indices (dofs_per_cell); - - typename MGDoFHandler::active_cell_iterator - level_cell = mg_dof_handler->begin_active(); - const typename MGDoFHandler::active_cell_iterator - endc = mg_dof_handler->end(); - - // traverse all cells and copy the - // data appropriately to the output - // vector - - // Is the level monotonuosly increasing? - - for (; level_cell != endc; ++level_cell) - { - DoFObjectAccessor& global_cell = *level_cell; - const unsigned int level = level_cell->level(); - - // get the dof numbers of - // this cell for the global - // and the level-wise - // numbering - global_cell.get_dof_indices (global_dof_indices); - level_cell->get_mg_dof_indices(level_dof_indices); - - // copy level-wise data to - // global vector - for (unsigned int i=0; iset_zero(dst); -} - - - template void Multigrid::print_vector (const unsigned int /*level*/,