![]() |
Reference documentation for deal.II version 9.1.1
|
#include <deal.II/lac/block_matrix_array.h>
Classes | |
| class | Entry |
Public Types | |
| using | size_type = types::global_dof_index |
Public Member Functions | |
| BlockMatrixArray () | |
| BlockMatrixArray (const unsigned int n_block_rows, const unsigned int n_block_cols) | |
| void | initialize (const unsigned int n_block_rows, const unsigned int n_block_cols) |
| void | reinit (const unsigned int n_block_rows, const unsigned int n_block_cols) |
| template<typename MatrixType > | |
| void | enter (const MatrixType &matrix, const unsigned int row, const unsigned int col, const number prefix=1., const bool transpose=false) |
| void | clear () |
| unsigned int | n_block_rows () const |
| unsigned int | n_block_cols () const |
| void | vmult (BlockVectorType &dst, const BlockVectorType &src) const |
| void | vmult_add (BlockVectorType &dst, const BlockVectorType &src) const |
| void | Tvmult (BlockVectorType &dst, const BlockVectorType &src) const |
| void | Tvmult_add (BlockVectorType &dst, const BlockVectorType &src) const |
| number | matrix_scalar_product (const BlockVectorType &u, const BlockVectorType &v) const |
| number | matrix_norm_square (const BlockVectorType &u) const |
| template<class StreamType > | |
| void | print_latex (StreamType &out) const |
Public Member Functions inherited from Subscriptor | |
| Subscriptor () | |
| Subscriptor (const Subscriptor &) | |
| Subscriptor (Subscriptor &&) noexcept | |
| virtual | ~Subscriptor () |
| Subscriptor & | operator= (const Subscriptor &) |
| Subscriptor & | operator= (Subscriptor &&) noexcept |
| void | subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
| void | unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
| unsigned int | n_subscriptions () const |
| template<typename StreamType > | |
| void | list_subscribers (StreamType &stream) const |
| void | list_subscribers () const |
| template<class Archive > | |
| void | serialize (Archive &ar, const unsigned int version) |
Protected Attributes | |
| std::vector< Entry > | entries |
Private Attributes | |
| unsigned int | block_rows |
| unsigned int | block_cols |
Additional Inherited Members | |
Static Public Member Functions inherited from Subscriptor | |
| static ::ExceptionBase & | ExcInUse (int arg1, std::string arg2, std::string arg3) |
| static ::ExceptionBase & | ExcNoSubscriber (std::string arg1, std::string arg2) |
Block matrix composed of different single matrices; these matrices may even be of different types.
Given a set of arbitrary matrices Ai, this class implements a block matrix with block entries of the form Mjk = sjkAi. Each Ai may be used several times with different prefix. The matrices are not copied into the BlockMatrixArray object, but rather a PointerMatrix referencing each of them will be stored along with factors and transposition flags.
Non-zero entries are registered by the function enter(), zero entries are not stored at all. Using enter() with the same location (i,j) several times will add the corresponding matrices in matrix-vector multiplications. These matrices will not be actually added, but the multiplications with them will be summed up.
The template argument MatrixType is a class providing the matrix- vector multiplication functions vmult(), Tvmult(), vmult_add() and Tvmult_add() used in this class, but with arguments of type Vector<number> instead of BlockVector<number>. Every matrix which can be used by PointerMatrix is allowed, in particular SparseMatrix is a possible entry type.
We document the relevant parts of examples/doxygen/block_matrix_array.cc.
Obviously, we have to include the header file containing the definition of BlockMatrixArray:
First, we set up some matrices to be entered into the blocks.
Now, we are ready to build a 2x2 BlockMatrixArray.
First, we enter the matrix A multiplied by 2 in the upper left block
Now -1 times B1 in the upper right block.
We add the transpose of B2 to the upper right block and continue in a similar fashion. In the end, the block matrix structure is printed into an LaTeX table.
Now, we set up vectors to be multiplied with this matrix and do a multiplication.
Finally, we solve a linear system with BlockMatrixArray, using no preconditioning and the conjugate gradient method.
The remaining code of this sample program concerns preconditioning and is described in the documentation of BlockTrianglePrecondition.
Definition at line 118 of file block_matrix_array.h.
1.8.16