Multigrid< VECTOR > Class Template Reference
[Multilevel support]

Inheritance diagram for Multigrid< VECTOR >:

Inheritance graph
[legend]

List of all members.

Public Types

enum  Cycle { v_cycle, w_cycle, f_cycle }
typedef VECTOR vector_type
typedef const VECTOR const_vector_type

Public Member Functions

template<int dim>
 Multigrid (const MGDoFHandler< dim > &mg_dof_handler, const MGMatrixBase< VECTOR > &matrix, const MGCoarseGridBase< VECTOR > &coarse, const MGTransferBase< VECTOR > &transfer, const MGSmootherBase< VECTOR > &pre_smooth, const MGSmootherBase< VECTOR > &post_smooth, Cycle cycle=v_cycle)
 Multigrid (const unsigned int minlevel, const unsigned int maxlevel, const MGMatrixBase< VECTOR > &matrix, const MGCoarseGridBase< VECTOR > &coarse, const MGTransferBase< VECTOR > &transfer, const MGSmootherBase< VECTOR > &pre_smooth, const MGSmootherBase< VECTOR > &post_smooth, Cycle cycle=v_cycle)
void reinit (const unsigned int minlevel, const unsigned int maxlevel)
void cycle ()
void vcycle ()
void vmult (VECTOR &dst, const VECTOR &src) const
void vmult_add (VECTOR &dst, const VECTOR &src) const
void Tvmult (VECTOR &dst, const VECTOR &src) const
void Tvmult_add (VECTOR &dst, const VECTOR &src) const
void set_edge_matrices (const MGMatrixBase< VECTOR > &edge_down, const MGMatrixBase< VECTOR > &edge_up)
unsigned int get_maxlevel () const
unsigned int get_minlevel () const
void set_maxlevel (const unsigned int)
void set_minlevel (const unsigned int level, bool relative=false)
void set_cycle (Cycle)
void set_debug (const unsigned int)

Public Attributes

MGLevelObject< VECTOR > defect
MGLevelObject< VECTOR > solution

Private Member Functions

void level_v_step (const unsigned int level)
void level_step (const unsigned int level, Cycle cycle)

Private Attributes

Cycle cycle_type
unsigned int minlevel
unsigned int maxlevel
MGLevelObject< VECTOR > t
MGLevelObject< VECTOR > defect2
SmartPointer< const
MGMatrixBase< VECTOR > > 
matrix
SmartPointer< const
MGCoarseGridBase< VECTOR > > 
coarse
SmartPointer< const
MGTransferBase< VECTOR > > 
transfer
SmartPointer< const
MGSmootherBase< VECTOR > > 
pre_smooth
SmartPointer< const
MGSmootherBase< VECTOR > > 
post_smooth
SmartPointer< const
MGMatrixBase< VECTOR > > 
edge_down
SmartPointer< const
MGMatrixBase< VECTOR > > 
edge_up
unsigned int debug

Friends

class PreconditionMG


Detailed Description

template<class VECTOR>
class Multigrid< VECTOR >

Implementation of the multigrid method.

Warning:
multigrid on locally refined meshes only works with discontinuous finite elements right now. It is not clear, whether the paradigm of local smoothing we use is applicable to continuous elements with hanging nodes; in fact, most people you meet on conferences seem to deny this.
The function which starts a multigrid cycle on the finest level is cycle(). Depending on the cycle type chosen with the constructor (see enum Cycle), this function triggers one of the cycles level_v_step() or level_step(), where the latter one can do different types of cycles.

Using this class, it is expected that the right hand side has been converted from a vector living on the locally finest level to a multilevel vector. This is a nontrivial operation, usually initiated automatically by the class PreconditionMG and performed by the classes derived from MGTransferBase.

Note:
The interface of this class is still very clumsy. In particular, you will have to set up quite a few auxiliary objects before you can use it. Unfortunately, it seems that this can be avoided only be restricting the flexibility of this class in an unacceptable way.
Author:
Guido Kanschat, 1999 - 2005

Member Typedef Documentation

template<class VECTOR>
typedef VECTOR Multigrid< VECTOR >::vector_type

template<class VECTOR>
typedef const VECTOR Multigrid< VECTOR >::const_vector_type


Member Enumeration Documentation

template<class VECTOR>
enum Multigrid::Cycle

List of implemented cycle types.

Enumerator:
v_cycle  The V-cycle.
w_cycle  The W-cycle.
f_cycle  The F-cycle.


Constructor & Destructor Documentation

template<class VECTOR>
template<int dim>
Multigrid< VECTOR >::Multigrid ( const MGDoFHandler< dim > &  mg_dof_handler,
const MGMatrixBase< VECTOR > &  matrix,
const MGCoarseGridBase< VECTOR > &  coarse,
const MGTransferBase< VECTOR > &  transfer,
const MGSmootherBase< VECTOR > &  pre_smooth,
const MGSmootherBase< VECTOR > &  post_smooth,
Cycle  cycle = v_cycle 
) [inline]

Constructor. The MGDoFHandler is used to determine the highest possible level. transfer is an object performing prolongation and restriction.

This function already initializes the vectors which will be used later in the course of the computations. You should therefore create objects of this type as late as possible.

template<class VECTOR>
Multigrid< VECTOR >::Multigrid ( const unsigned int  minlevel,
const unsigned int  maxlevel,
const MGMatrixBase< VECTOR > &  matrix,
const MGCoarseGridBase< VECTOR > &  coarse,
const MGTransferBase< VECTOR > &  transfer,
const MGSmootherBase< VECTOR > &  pre_smooth,
const MGSmootherBase< VECTOR > &  post_smooth,
Cycle  cycle = v_cycle 
)

Experimental constructor for cases in which no MGDoFHandler is available.

Warning:
Not intended for general use.


Member Function Documentation

template<class VECTOR>
void Multigrid< VECTOR >::reinit ( const unsigned int  minlevel,
const unsigned int  maxlevel 
)

Reinit this class according to minlevel and maxlevel.

template<class VECTOR>
void Multigrid< VECTOR >::cycle (  ) 

Execute one multigrid cycle. The type of cycle is selected by the constructor argument cycle. See the enum Cycle for available types.

template<class VECTOR>
void Multigrid< VECTOR >::vcycle (  ) 

Execute one step of the V-cycle algorithm. This function assumes, that the multilevel vector defect is filled with the residual of an outer defect correction scheme. This is usually taken care of by PreconditionMG). After vcycle(), the result is in the multilevel vector solution. See copy_*_mg in class MGTools if you want to use these vectors yourself.

The actual work for this function is done in level_v_step().

template<class VECTOR>
void Multigrid< VECTOR >::vmult ( VECTOR &  dst,
const VECTOR &  src 
) const

Deprecated:
This function is purely experimental and will probably never be implemented in a way that it can be released.
Perform a multigrid cycle with a vector which is already a level vector. Use of this function assumes that there is NO local refinement and that both vectors are on the finest level of this Multigrid object.

template<class VECTOR>
void Multigrid< VECTOR >::vmult_add ( VECTOR &  dst,
const VECTOR &  src 
) const

Deprecated:
This function is purely experimental and will probably never be implemented in a way that it can be released.
Perform a multigrid cycle with a vector which is already a level vector. Use of this function assumes that there is NO local refinement and that both vectors are on the finest level of this Multigrid object.

template<class VECTOR>
void Multigrid< VECTOR >::Tvmult ( VECTOR &  dst,
const VECTOR &  src 
) const

Deprecated:
Even worse than vmult(), this function is not even implemented, but just declared such that certain objects relying on it can be constructed.

template<class VECTOR>
void Multigrid< VECTOR >::Tvmult_add ( VECTOR &  dst,
const VECTOR &  src 
) const

Deprecated:
Even worse than vmult(), this function is not even implemented, but just declared such that certain objects relying on it can be constructed.

template<class VECTOR>
void Multigrid< VECTOR >::set_edge_matrices ( const MGMatrixBase< VECTOR > &  edge_down,
const MGMatrixBase< VECTOR > &  edge_up 
)

Set additional matrices to correct residual computation at refinement edges. These matrices originate from discontinuous Galerkin methods (see FE_DGQ etc.), where they correspond tu the edge fluxes at the refinement edge between two levels.

template<class VECTOR>
unsigned int Multigrid< VECTOR >::get_maxlevel (  )  const

Return the finest level for multigrid.

template<class VECTOR>
unsigned int Multigrid< VECTOR >::get_minlevel (  )  const

Return the coarsest level for multigrid.

template<class VECTOR>
void Multigrid< VECTOR >::set_maxlevel ( const unsigned  int  ) 

Set the highest level for which the multilevel method is performed. By default, this is the finest level of the Triangulation; therefore, this function will only accept arguments smaller than the current maxlevel and not smaller than the current minlevel.

template<class VECTOR>
void Multigrid< VECTOR >::set_minlevel ( const unsigned int  level,
bool  relative = false 
)

Set the coarse level for which the multilevel method is performed. By default, this is zero. Accepted are non-negative values not larger than than the current maxlevel.

If relative ist true, then this function determins the number of levels used, that is, it sets minlevel to maxlevel-level.

Note:
The mesh on the coarsest level must cover the whole domain. There may not be hanging nodes on minlevel.

If minlevel is set to a nonzero value, do not forget to adjust your coarse grid solver!

template<class VECTOR>
void Multigrid< VECTOR >::set_cycle ( Cycle   ) 

Chance cycle_type used in cycle().

template<class VECTOR>
void Multigrid< VECTOR >::set_debug ( const unsigned  int  ) 

Set the debug level. Higher values will create more debugging output during the multigrid cycles.

template<class VECTOR>
void Multigrid< VECTOR >::level_v_step ( const unsigned int  level  )  [private]

The V-cycle multigrid method. level is the level the function starts on. It will usually be called for the highest level from outside, but will then call itself recursively for level-1, unless we are on minlevel where the coarse grid solver solves the problem exactly.

template<class VECTOR>
void Multigrid< VECTOR >::level_step ( const unsigned int  level,
Cycle  cycle 
) [private]

The actual W-cycle or F-cycle multigrid method. level is the level the function starts on. It will usually be called for the highest level from outside, but will then call itself recursively for level-1, unless we are on minlevel where the coarse grid solver solves the problem exactly.


Friends And Related Function Documentation

template<class VECTOR>
friend class PreconditionMG [friend]


Member Data Documentation

template<class VECTOR>
Cycle Multigrid< VECTOR >::cycle_type [private]

Cycle type performed by the method cycle().

template<class VECTOR>
unsigned int Multigrid< VECTOR >::minlevel [private]

Level for coarse grid solution.

template<class VECTOR>
unsigned int Multigrid< VECTOR >::maxlevel [private]

Highest level of cells.

template<class VECTOR>
MGLevelObject<VECTOR> Multigrid< VECTOR >::defect

Input vector for the cycle. Contains the defect of the outer method projected to the multilevel vectors.

template<class VECTOR>
MGLevelObject<VECTOR> Multigrid< VECTOR >::solution

The solution update after the multigrid step.

template<class VECTOR>
MGLevelObject<VECTOR> Multigrid< VECTOR >::t [private]

Auxiliary vector.

template<class VECTOR>
MGLevelObject<VECTOR> Multigrid< VECTOR >::defect2 [private]

Auxiliary vector for W- and F-cycles. Left uninitialized in V-cycle.

template<class VECTOR>
SmartPointer<const MGMatrixBase<VECTOR> > Multigrid< VECTOR >::matrix [private]

The matrix for each level.

template<class VECTOR>
SmartPointer<const MGCoarseGridBase<VECTOR> > Multigrid< VECTOR >::coarse [private]

The matrix for each level.

template<class VECTOR>
SmartPointer<const MGTransferBase<VECTOR> > Multigrid< VECTOR >::transfer [private]

Object for grid tranfer.

template<class VECTOR>
SmartPointer<const MGSmootherBase<VECTOR> > Multigrid< VECTOR >::pre_smooth [private]

The pre-smoothing object.

template<class VECTOR>
SmartPointer<const MGSmootherBase<VECTOR> > Multigrid< VECTOR >::post_smooth [private]

The post-smoothing object.

template<class VECTOR>
SmartPointer<const MGMatrixBase<VECTOR> > Multigrid< VECTOR >::edge_down [private]

Edge matrix from fine to coarse.

template<class VECTOR>
SmartPointer<const MGMatrixBase<VECTOR> > Multigrid< VECTOR >::edge_up [private]

Transpose edge matrix from coarse to fine.

template<class VECTOR>
unsigned int Multigrid< VECTOR >::debug [private]

Level for debug output. Defaults to zero and can be set by set_debug().


The documentation for this class was generated from the following file:

deal.II documentation generated on Sat Aug 15 16:52:10 2009 by doxygen 1.5.9