Reference documentation for deal.II version Git f0d9923401 2020-09-28 19:47:38 -0600
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | List of all members
RelaxationBlock< MatrixType, InverseNumberType, VectorType > Class Template Reference

#include <deal.II/lac/relaxation_block.h>

Inheritance diagram for RelaxationBlock< MatrixType, InverseNumberType, VectorType >:
[legend]

Classes

class  AdditionalData
 

Public Types

using size_type = types::global_dof_index
 

Public Member Functions

void initialize (const MatrixType &A, const AdditionalData &parameters)
 
void clear ()
 
void invert_diagblocks ()
 

Protected Types

enum  Inversion
 

Protected Member Functions

void do_step (VectorType &dst, const VectorType &prev, const VectorType &src, const bool backward) const
 
void reinit (unsigned int nblocks, size_type blocksize, bool compress, Inversion method=gauss_jordan)
 
void inverses_computed (bool are_they)
 
bool same_diagonal () const
 
bool store_diagonals () const
 
bool inverses_ready () const
 
unsigned int size () const
 
void inverse_vmult (size_type i, Vector< number2 > &dst, const Vector< number2 > &src) const
 
void inverse_Tvmult (size_type i, Vector< number2 > &dst, const Vector< number2 > &src) const
 
FullMatrix< InverseNumberType > & inverse (size_type i)
 
const FullMatrix< InverseNumberType > & inverse (size_type i) const
 
Householder< InverseNumberType > & inverse_householder (size_type i)
 
const Householder< InverseNumberType > & inverse_householder (size_type i) const
 
LAPACKFullMatrix< InverseNumberType > & inverse_svd (size_type i)
 
const LAPACKFullMatrix< InverseNumberType > & inverse_svd (size_type i) const
 
FullMatrix< InverseNumberType > & diagonal (size_type i)
 
const FullMatrix< InverseNumberType > & diagonal (size_type i) const
 
void log_statistics () const
 
std::size_t memory_consumption () const
 

Static Protected Member Functions

static ::ExceptionBaseExcDiagonalsNotStored ()
 
static ::ExceptionBaseExcInverseNotAvailable ()
 

Protected Attributes

SmartPointer< const MatrixType, RelaxationBlock< MatrixType, InverseNumberType, VectorType > > A
 
SmartPointer< const AdditionalData, RelaxationBlock< MatrixType, InverseNumberType, VectorType > > additional_data
 
Inversion inversion
 

Private Types

using number = typename MatrixType::value_type
 
using value_type = InverseNumberType
 

Private Member Functions

void block_kernel (const size_type block_begin, const size_type block_end)
 

Detailed Description

template<typename MatrixType, typename InverseNumberType = typename MatrixType::value_type, typename VectorType = Vector<double>>
class RelaxationBlock< MatrixType, InverseNumberType, VectorType >

Base class for the implementation of overlapping, multiplicative Schwarz relaxation methods and smoothers.

This class uses the infrastructure provided by PreconditionBlockBase. It adds functions to initialize with a block list and to do the relaxation step. The actual relaxation method with the interface expected by SolverRelaxation and MGSmootherRelaxation is in the derived classes.

This class allows for more general relaxation methods than PreconditionBlock, since the index sets may be arbitrary and overlapping, while there only contiguous, disjoint sets of equal size are allowed. As a drawback, this class cannot be used as a preconditioner, since its implementation relies on a straight forward implementation of the Gauss- Seidel process.

Parallel computations require you to specify an initialized ghost vector in AdditionalData::temp_ghost_vector.

Definition at line 57 of file relaxation_block.h.

Member Typedef Documentation

◆ number

template<typename MatrixType, typename InverseNumberType = typename MatrixType::value_type, typename VectorType = Vector<double>>
using RelaxationBlock< MatrixType, InverseNumberType, VectorType >::number = typename MatrixType::value_type
private

Define number type of matrix.

Definition at line 63 of file relaxation_block.h.

◆ value_type

template<typename MatrixType, typename InverseNumberType = typename MatrixType::value_type, typename VectorType = Vector<double>>
using RelaxationBlock< MatrixType, InverseNumberType, VectorType >::value_type = InverseNumberType
private

Value type for inverse matrices.

Definition at line 68 of file relaxation_block.h.

◆ size_type

template<typename MatrixType, typename InverseNumberType = typename MatrixType::value_type, typename VectorType = Vector<double>>
using RelaxationBlock< MatrixType, InverseNumberType, VectorType >::size_type = types::global_dof_index

Declare type for container size.

Definition at line 74 of file relaxation_block.h.

Member Enumeration Documentation

◆ Inversion

Choose a method for inverting the blocks, and thus the data type for the inverses.

Definition at line 70 of file precondition_block_base.h.

Member Function Documentation

◆ initialize()

template<typename MatrixType, typename InverseNumberType = typename MatrixType::value_type, typename VectorType = Vector<double>>
void RelaxationBlock< MatrixType, InverseNumberType, VectorType >::initialize ( const MatrixType &  A,
const AdditionalData parameters 
)

Initialize matrix and additional information. In a second step, the inverses of the diagonal blocks may be computed.

Note that AdditionalData, different from other preconditioners, defines quite large objects, and that therefore the object is not copied, but rather a pointer is stored. Thus, the lifetime of additional_data hast to exceed the lifetime of this object.

◆ clear()

template<typename MatrixType, typename InverseNumberType = typename MatrixType::value_type, typename VectorType = Vector<double>>
void RelaxationBlock< MatrixType, InverseNumberType, VectorType >::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.

◆ invert_diagblocks()

template<typename MatrixType, typename InverseNumberType = typename MatrixType::value_type, typename VectorType = Vector<double>>
void RelaxationBlock< MatrixType, InverseNumberType, VectorType >::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.

◆ do_step()

template<typename MatrixType, typename InverseNumberType = typename MatrixType::value_type, typename VectorType = Vector<double>>
void RelaxationBlock< MatrixType, InverseNumberType, VectorType >::do_step ( VectorType dst,
const VectorType prev,
const VectorType src,
const bool  backward 
) const
protected

Perform one block relaxation step.

Depending on the arguments dst and pref, this performs an SOR step (both reference the same vector) or a Jacobi step (both are different vectors). For the Jacobi step, the calling function must copy dst to prev after this.

◆ block_kernel()

template<typename MatrixType, typename InverseNumberType = typename MatrixType::value_type, typename VectorType = Vector<double>>
void RelaxationBlock< MatrixType, InverseNumberType, VectorType >::block_kernel ( const size_type  block_begin,
const size_type  block_end 
)
private

Computes (the inverse of) a range of blocks.

◆ reinit()

void PreconditionBlockBase< InverseNumberType >::reinit ( unsigned int  nblocks,
size_type  blocksize,
bool  compress,
Inversion  method = gauss_jordan 
)
inlineinherited

Resize to this number of diagonal blocks with the given block size. If compress is true, then only one block will be stored.

Definition at line 333 of file precondition_block_base.h.

◆ inverses_computed()

void PreconditionBlockBase< InverseNumberType >::inverses_computed ( bool  are_they)
inlineinherited

Tell the class that inverses are computed.

Definition at line 598 of file precondition_block_base.h.

◆ same_diagonal()

bool PreconditionBlockBase< InverseNumberType >::same_diagonal ( ) const
inlineinherited

Does the matrix use only one diagonal block?

Definition at line 582 of file precondition_block_base.h.

◆ store_diagonals()

bool PreconditionBlockBase< InverseNumberType >::store_diagonals ( ) const
inlineinherited

Check, whether diagonal blocks (not their inverses) should be stored.

Definition at line 590 of file precondition_block_base.h.

◆ inverses_ready()

bool PreconditionBlockBase< InverseNumberType >::inverses_ready ( ) const
inlineinherited

Return true, if inverses are ready for use.

Definition at line 606 of file precondition_block_base.h.

◆ size()

unsigned int PreconditionBlockBase< InverseNumberType >::size ( ) const
inlineinherited

The number of blocks.

Definition at line 411 of file precondition_block_base.h.

◆ inverse_vmult()

void PreconditionBlockBase< InverseNumberType >::inverse_vmult ( size_type  i,
Vector< number2 > &  dst,
const Vector< number2 > &  src 
) const
inlineinherited

Multiply with the inverse block at position i.

Definition at line 419 of file precondition_block_base.h.

◆ inverse_Tvmult()

void PreconditionBlockBase< InverseNumberType >::inverse_Tvmult ( size_type  i,
Vector< number2 > &  dst,
const Vector< number2 > &  src 
) const
inlineinherited

Multiply with the transposed inverse block at position i.

Definition at line 448 of file precondition_block_base.h.

◆ inverse() [1/2]

Access to the inverse diagonal blocks if Inversion is gauss_jordan.

Definition at line 526 of file precondition_block_base.h.

◆ inverse() [2/2]

const FullMatrix< InverseNumberType > & PreconditionBlockBase< InverseNumberType >::inverse ( size_type  i) const
inlineinherited

Access to the inverse diagonal blocks.

Definition at line 476 of file precondition_block_base.h.

◆ inverse_householder() [1/2]

Householder< InverseNumberType > & PreconditionBlockBase< InverseNumberType >::inverse_householder ( size_type  i)
inlineinherited

Access to the inverse diagonal blocks if Inversion is householder.

Definition at line 540 of file precondition_block_base.h.

◆ inverse_householder() [2/2]

const Householder< InverseNumberType > & PreconditionBlockBase< InverseNumberType >::inverse_householder ( size_type  i) const
inlineinherited

Access to the inverse diagonal blocks if Inversion is householder.

Definition at line 488 of file precondition_block_base.h.

◆ inverse_svd() [1/2]

Access to the inverse diagonal blocks if Inversion is householder.

Definition at line 554 of file precondition_block_base.h.

◆ inverse_svd() [2/2]

const LAPACKFullMatrix< InverseNumberType > & PreconditionBlockBase< InverseNumberType >::inverse_svd ( size_type  i) const
inlineinherited

Access to the inverse diagonal blocks if Inversion is householder.

Definition at line 500 of file precondition_block_base.h.

◆ diagonal() [1/2]

Access to the diagonal blocks.

Definition at line 568 of file precondition_block_base.h.

◆ diagonal() [2/2]

const FullMatrix< InverseNumberType > & PreconditionBlockBase< InverseNumberType >::diagonal ( size_type  i) const
inlineinherited

Access to the diagonal blocks.

Definition at line 512 of file precondition_block_base.h.

◆ log_statistics()

void PreconditionBlockBase< InverseNumberType >::log_statistics ( ) const
inlineinherited

Print some statistics about the inverses to deallog. Output depends on Inversion. It is richest for svd, where we obtain statistics on extremal singular values and condition numbers.

Definition at line 614 of file precondition_block_base.h.

◆ memory_consumption()

std::size_t PreconditionBlockBase< InverseNumberType >::memory_consumption ( ) const
inlineinherited

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

Definition at line 665 of file precondition_block_base.h.

◆ ExcDiagonalsNotStored()

static ::ExceptionBase& PreconditionBlockBase< InverseNumberType >::ExcDiagonalsNotStored ( )
staticinherited

You are trying to access a diagonal block (not its inverse), but you decided not to store the diagonal blocks.

◆ ExcInverseNotAvailable()

static ::ExceptionBase& PreconditionBlockBase< InverseNumberType >::ExcInverseNotAvailable ( )
staticinherited

You are accessing a diagonal block, assuming that it has a certain type. But, the method used for inverting the diagonal blocks does not use this type

Member Data Documentation

◆ A

template<typename MatrixType, typename InverseNumberType = typename MatrixType::value_type, typename VectorType = Vector<double>>
SmartPointer<const MatrixType, RelaxationBlock<MatrixType, InverseNumberType, VectorType> > RelaxationBlock< MatrixType, InverseNumberType, VectorType >::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 preconditioning vmult function of the derived classes.

Definition at line 253 of file relaxation_block.h.

◆ additional_data

template<typename MatrixType, typename InverseNumberType = typename MatrixType::value_type, typename VectorType = Vector<double>>
SmartPointer<const AdditionalData, RelaxationBlock<MatrixType, InverseNumberType, VectorType> > RelaxationBlock< MatrixType, InverseNumberType, VectorType >::additional_data
protected

Control information.

Definition at line 260 of file relaxation_block.h.

◆ inversion

Inversion PreconditionBlockBase< InverseNumberType >::inversion
protectedinherited

The method used for inverting blocks.

Definition at line 243 of file precondition_block_base.h.


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