![]() |
Reference documentation for deal.II version 8.1.0
|
#include <precondition_block.h>
Classes | |
class | AdditionalData |
Public Types | |
typedef types::global_dof_index | size_type |
Public Member Functions | |
PreconditionBlock (bool store_diagonals=false) | |
~PreconditionBlock () | |
void | initialize (const MATRIX &A, const AdditionalData parameters) |
void | clear () |
bool | empty () const |
value_type | el (size_type i, size_type j) const |
void | invert_diagblocks () |
template<typename number2 > | |
void | forward_step (Vector< number2 > &dst, const Vector< number2 > &prev, const Vector< number2 > &src, const bool transpose_diagonal) const |
template<typename number2 > | |
void | backward_step (Vector< number2 > &dst, const Vector< number2 > &prev, const Vector< number2 > &src, const bool transpose_diagonal) const |
size_type | block_size () const |
unsigned int | n_blocks () const DEAL_II_DEPRECATED |
std::size_t | memory_consumption () const |
DeclException2 (ExcWrongBlockSize, int, int,<< "The blocksize "<< arg1<< " and the size of the matrix "<< arg2<< " do not match.") | |
DeclException0 (ExcInverseMatricesAlreadyExist) | |
![]() | |
Subscriptor () | |
Subscriptor (const Subscriptor &) | |
virtual | ~Subscriptor () |
Subscriptor & | operator= (const Subscriptor &) |
void | subscribe (const char *identifier=0) const |
void | unsubscribe (const char *identifier=0) const |
unsigned int | n_subscriptions () const |
void | list_subscribers () const |
DeclException3 (ExcInUse, int, char *, std::string &,<< "Object of class "<< arg2<< " is still used by "<< arg1<< " other objects.\n"<< "(Additional information: "<< arg3<< ")\n"<< "Note the entry in the Frequently Asked Questions of "<< "deal.II (linked to from http://www.dealii.org/) for "<< "more information on what this error means.") | |
DeclException2 (ExcNoSubscriber, char *, char *,<< "No subscriber with identifier \""<< arg2<< "\" did subscribe to this object of class "<< arg1) | |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
Protected Attributes | |
size_type | blocksize |
SmartPointer< const MATRIX, PreconditionBlock< MATRIX, inverse_type > > | A |
double | relaxation |
std::vector< size_type > | permutation |
std::vector< size_type > | inverse_permutation |
![]() | |
Inversion | inversion |
Private Types | |
typedef MATRIX::value_type | number |
typedef inverse_type | value_type |
Additional Inherited Members | |
![]() | |
enum | Inversion |
typedef types::global_dof_index | size_type |
Base class for actual block preconditioners. 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. It is not necessary for this class that the matrix be block diagonal; rather, it applies to 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 and similar classes are not a possible matrix class template arguments.
The block matrix structure used by this class 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.
Definition at line 87 of file precondition_block.h.
|
private |
Define number type of matrix.
Definition at line 95 of file precondition_block.h.
|
private |
Value type for inverse matrices.
Definition at line 100 of file precondition_block.h.
typedef types::global_dof_index PreconditionBlock< MATRIX, inverse_type >::size_type |
Declare type for container size.
Definition at line 106 of file precondition_block.h.
PreconditionBlock< MATRIX, inverse_type >::PreconditionBlock | ( | bool | store_diagonals = false | ) |
Constructor.
Definition at line 55 of file precondition_block.templates.h.
PreconditionBlock< MATRIX, inverse_type >::~PreconditionBlock | ( | ) |
Destructor.
Definition at line 63 of file precondition_block.templates.h.
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.
Definition at line 77 of file precondition_block.templates.h.
|
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.
Definition at line 105 of file precondition_block.templates.h.
|
protected |
Set either the permutation of rows or the permutation of blocks, depending on the size of the vector.
If the size of the permutation vectors is equal to the dimension of the linear system, it is assumed that rows are permuted individually. In this case, set_permutation() must be called before initialize(), since the diagonal blocks are built from the permuted entries of the matrix.
If the size of the permutation vector is not equal to the dimension of the system, the diagonal blocks are computed from the unpermuted entries. Instead, the relaxation methods step() and Tstep() are executed applying the blocks in the order given by the permutation vector. They will throw an exception if length of this vector is not equal to the number of blocks.
Definition at line 527 of file precondition_block.templates.h.
|
protected |
Replacement of invert_diagblocks() for permuted preconditioning.
Definition at line 116 of file precondition_block.templates.h.
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.
Definition at line 68 of file precondition_block.templates.h.
bool PreconditionBlock< MATRIX, inverse_type >::empty | ( | ) | const |
Checks whether the object is empty.
value_type PreconditionBlock< MATRIX, inverse_type >::el | ( | size_type | i, |
size_type | j | ||
) | const |
Read-only access to entries. This function is only possible if the inverse diagonal blocks are stored.
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.
Definition at line 435 of file precondition_block.templates.h.
void PreconditionBlock< MATRIX, inverse_type >::forward_step | ( | Vector< number2 > & | dst, |
const Vector< number2 > & | prev, | ||
const Vector< number2 > & | src, | ||
const bool | transpose_diagonal | ||
) | const |
Perform one block relaxation step in forward numbering.
Depending on the arguments dst
and pref
, this performs an SOR step (both reference the same vector) of a Jacobi step (botha different vectors). For the Jacobi step, the calling function must copy dst
to pref
after this.
Definition at line 227 of file precondition_block.templates.h.
void PreconditionBlock< MATRIX, inverse_type >::backward_step | ( | Vector< number2 > & | dst, |
const Vector< number2 > & | prev, | ||
const Vector< number2 > & | src, | ||
const bool | transpose_diagonal | ||
) | const |
Perform one block relaxation step in backward numbering.
Depending on the arguments dst
and pref
, this performs an SOR step (both reference the same vector) of a Jacobi step (botha different vectors). For the Jacobi step, the calling function must copy dst
to pref
after this.
Definition at line 330 of file precondition_block.templates.h.
PreconditionBlock< MATRIX, inverse_type >::size_type PreconditionBlock< MATRIX, inverse_type >::block_size | ( | ) | const |
Return the size of the blocks.
Definition at line 428 of file precondition_block.templates.h.
unsigned int PreconditionBlock< MATRIX, inverse_type >::n_blocks | ( | ) | const |
The number of blocks of the matrix.
std::size_t PreconditionBlock< MATRIX, inverse_type >::memory_consumption | ( | ) | const |
Determine an estimate for the memory consumption (in bytes) of this object.
Definition at line 550 of file precondition_block.templates.h.
|
protected |
Size of the blocks. Each diagonal block is assumed to be of the same size.
Definition at line 427 of file precondition_block.h.
|
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.
Definition at line 441 of file precondition_block.h.
|
protected |
Relaxation parameter to be used by derived classes.
Definition at line 446 of file precondition_block.h.
|
protected |
The permutation vector
Definition at line 451 of file precondition_block.h.
|
protected |
The inverse permutation vector
Definition at line 456 of file precondition_block.h.