PreconditionBlock< MATRIX, inverse_type > Class Template Reference
[Preconditioners]

Inheritance diagram for PreconditionBlock< MATRIX, inverse_type >:
Inheritance graph
[legend]

List of all members.

Classes

class  AdditionalData
class  ExcDiagonalsNotStored
class  ExcInverseMatricesAlreadyExist
class  ExcWrongBlockSize
class  ExcWrongNumberOfInverses

Public Member Functions

 PreconditionBlock ()
 ~PreconditionBlock ()
void initialize (const MATRIX &A, const AdditionalData parameters)
void clear ()
bool empty () const
value_type el (unsigned int i, unsigned int j) const
void set_same_diagonal ()
bool same_diagonal () const
void invert_diagblocks ()
unsigned int block_size () const
unsigned int n_blocks () const
unsigned int memory_consumption () const
bool inverses_ready () const
const FullMatrix< inverse_type > & inverse (unsigned int i) const
const FullMatrix< inverse_type > & diagonal (unsigned int i) const

Protected Member Functions

void initialize (const MATRIX &A, const std::vector< unsigned int > &permutation, const std::vector< unsigned int > &inverse_permutation, const AdditionalData parameters)
void invert_permuted_diagblocks (const std::vector< unsigned int > &permutation, const std::vector< unsigned int > &inverse_permutation)

Protected Attributes

unsigned int blocksize
SmartPointer< const MATRIX > A
double relaxation
bool store_diagonals
unsigned int nblocks

Private Types

typedef MATRIX::value_type number
typedef inverse_type value_type

Private Attributes

std::vector< FullMatrix
< inverse_type > > 
var_inverse
std::vector< FullMatrix
< inverse_type > > 
var_diagonal
bool var_same_diagonal

Detailed Description

template<class MATRIX, typename inverse_type = typename MATRIX::value_type>
class PreconditionBlock< MATRIX, inverse_type >

Base class for PreconditionBlockJacobi, PreconditionBlockSOR, ... This class assumes the MATRIX consisting of invertible blocks of blocksize on the diagonal and provides the inversion of the diagonal blocks of the matrix. NOT only block diagonal matrices are allowed but all matrices of arbitrary structure with the minimal property of having invertible blocks on the diagonal! Still the matrix must have access to single matrix entries. therefore, BlockMatrixArray is not a possible matrix class.

This block matrix structure is given e.g. for the DG method for the transport equation. For a downstream numbering the matrices even have got a block lower left matrix structure, i.e. the matrices are empty above the diagonal blocks.

For all matrices that are empty above and below the diagonal blocks (i.e. for all block diagonal matrices) the BlockJacobi preconditioner is a direct solver. For all matrices that are empty only above the diagonal blocks (e.g. the matrices one gets by the DG method with downstream numbering) BlockSOR is a direct solver.

This first implementation of the PreconditionBlock assumes the matrix has blocks each of the same block size. Varying block sizes within the matrix must still be implemented if needed.

The first template parameter denotes the type of number representation in the sparse matrix, the second denotes the type of number representation in which the inverted diagonal block matrices are stored within this class by invert_diagblocks(). If you don't want to use the block inversion as an exact solver, but rather as a preconditioner, you may probably want to store the inverted blocks with less accuracy than the original matrix; for example, number==double, inverse_type=float might be a viable choice.

Author:
Ralf Hartmann, Guido Kanschat, 1999, 2000

Member Typedef Documentation

template<class MATRIX , typename inverse_type = typename MATRIX::value_type>
typedef MATRIX::value_type PreconditionBlock< MATRIX, inverse_type >::number [private]
template<class MATRIX , typename inverse_type = typename MATRIX::value_type>
typedef inverse_type PreconditionBlock< MATRIX, inverse_type >::value_type [private]

Value type for inverse matrices.


Constructor & Destructor Documentation

template<class MATRIX , typename inverse_type = typename MATRIX::value_type>
PreconditionBlock< MATRIX, inverse_type >::PreconditionBlock (  ) 

Constructor.

template<class MATRIX , typename inverse_type = typename MATRIX::value_type>
PreconditionBlock< MATRIX, inverse_type >::~PreconditionBlock (  ) 

Destructor.


Member Function Documentation

template<class MATRIX , typename inverse_type = typename MATRIX::value_type>
void PreconditionBlock< MATRIX, inverse_type >::initialize ( const MATRIX &  A,
const AdditionalData  parameters 
)

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.

template<class MATRIX , typename inverse_type = typename MATRIX::value_type>
void PreconditionBlock< MATRIX, inverse_type >::initialize ( const MATRIX &  A,
const std::vector< unsigned int > &  permutation,
const std::vector< unsigned int > &  inverse_permutation,
const AdditionalData  parameters 
) [protected]

Initialize matrix and block size for permuted preconditioning. Additionally to the parameters of the other initalize() function, we hand over two index vectors with the permutation and its inverse. For the meaning of these vectors see PreconditionBlockSOR.

In a second step, the inverses of the diagonal blocks may be computed. Make sure you use invert_permuted_diagblocks() to yield consistent data.

Additionally, a relaxation parameter for derived classes may be provided.

template<class MATRIX , typename inverse_type = typename MATRIX::value_type>
void PreconditionBlock< MATRIX, inverse_type >::invert_permuted_diagblocks ( const std::vector< unsigned int > &  permutation,
const std::vector< unsigned int > &  inverse_permutation 
) [protected]

Replacement of invert_diagblocks() for permuted preconditioning.

template<class MATRIX , typename inverse_type = typename MATRIX::value_type>
void PreconditionBlock< MATRIX, inverse_type >::clear (  ) 

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.

template<class MATRIX , typename inverse_type = typename MATRIX::value_type>
bool PreconditionBlock< MATRIX, inverse_type >::empty (  )  const

Checks whether the object is empty.

template<class MATRIX , typename inverse_type = typename MATRIX::value_type>
value_type PreconditionBlock< MATRIX, inverse_type >::el ( unsigned int  i,
unsigned int  j 
) const

Read-only access to entries. This function is only possible if the inverse diagonal blocks are stored.

template<class MATRIX , typename inverse_type = typename MATRIX::value_type>
void PreconditionBlock< MATRIX, inverse_type >::set_same_diagonal (  ) 

Use only the inverse of the first diagonal block to save memory and computation time.

Possible applications: computing on a cartesian grid, all diagonal blocks are the same or all diagonal blocks are at least similar and inversion of one of them still yields a preconditioner.

template<class MATRIX , typename inverse_type = typename MATRIX::value_type>
bool PreconditionBlock< MATRIX, inverse_type >::same_diagonal (  )  const

Does the matrix use only one diagonal block?

template<class MATRIX , typename inverse_type = typename MATRIX::value_type>
void PreconditionBlock< MATRIX, inverse_type >::invert_diagblocks (  ) 

Stores the inverse of the diagonal blocks in 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.

After this function is called, the lock on the matrix given through the 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.

template<class MATRIX , typename inverse_type = typename MATRIX::value_type>
unsigned int PreconditionBlock< MATRIX, inverse_type >::block_size (  )  const

Return the size of the blocks.

template<class MATRIX , typename inverse_type = typename MATRIX::value_type>
unsigned int PreconditionBlock< MATRIX, inverse_type >::n_blocks (  )  const

The number of blocks of the matrix.

template<class MATRIX , typename inverse_type = typename MATRIX::value_type>
unsigned int PreconditionBlock< MATRIX, inverse_type >::memory_consumption (  )  const

Determine an estimate for the memory consumption (in bytes) of this object.

template<class MATRIX , typename inverse_type = typename MATRIX::value_type>
bool PreconditionBlock< MATRIX, inverse_type >::inverses_ready (  )  const

Determine, whether inverses have been computed.

template<class MATRIX , typename inverse_type = typename MATRIX::value_type>
const FullMatrix<inverse_type>& PreconditionBlock< MATRIX, inverse_type >::inverse ( unsigned int  i  )  const

Access to the inverse diagonal blocks.

template<class MATRIX , typename inverse_type = typename MATRIX::value_type>
const FullMatrix<inverse_type>& PreconditionBlock< MATRIX, inverse_type >::diagonal ( unsigned int  i  )  const

Access to the diagonal blocks.


Member Data Documentation

template<class MATRIX , typename inverse_type = typename MATRIX::value_type>
unsigned int PreconditionBlock< MATRIX, inverse_type >::blocksize [protected]

Size of the blocks. Each diagonal block is assumed to be of the same size.

template<class MATRIX , typename inverse_type = typename MATRIX::value_type>
SmartPointer<const MATRIX> PreconditionBlock< MATRIX, inverse_type >::A [protected]

Pointer to the matrix. Make sure that the matrix exists as long as this class needs it, i.e. until calling invert_diagblocks, or (if the inverse matrices should not be stored) until the last call of the preconditoining vmult function of the derived classes.

template<class MATRIX , typename inverse_type = typename MATRIX::value_type>
double PreconditionBlock< MATRIX, inverse_type >::relaxation [protected]

Relaxation parameter to be used by derived classes.

template<class MATRIX , typename inverse_type = typename MATRIX::value_type>
bool PreconditionBlock< MATRIX, inverse_type >::store_diagonals [protected]

Flag for storing the diagonal blocks of the matrix.

template<class MATRIX , typename inverse_type = typename MATRIX::value_type>
unsigned int PreconditionBlock< MATRIX, inverse_type >::nblocks [protected]

Number of blocks.

template<class MATRIX , typename inverse_type = typename MATRIX::value_type>
std::vector<FullMatrix<inverse_type> > PreconditionBlock< MATRIX, inverse_type >::var_inverse [private]

Storage of the inverse matrices of the diagonal blocks matrices as FullMatrix<inverse_type> matrices. Using inverse_type=float saves memory in comparison with inverse_type=double.

template<class MATRIX , typename inverse_type = typename MATRIX::value_type>
std::vector<FullMatrix<inverse_type> > PreconditionBlock< MATRIX, inverse_type >::var_diagonal [private]

Storage of the original diagonal blocks. These are only filled if store_diagonals is true.

Used by the blocked SSOR method.

template<class MATRIX , typename inverse_type = typename MATRIX::value_type>
bool PreconditionBlock< MATRIX, inverse_type >::var_same_diagonal [private]

Flag for diagonal compression. set_same_diagonal()


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

deal.II documentation generated on Mon Nov 23 22:57:59 2009 by doxygen 1.6.1