
Public Member Functions | |
| MatrixBlock () | |
| MatrixBlock (const MatrixBlock< MATRIX > &M) | |
| MatrixBlock (unsigned int i, unsigned int j) | |
| void | reinit (const BlockSparsityPattern &sparsity) |
| operator MATRIX & () | |
| operator const MATRIX & () const | |
| void | add (const unsigned int i, const unsigned int j, const typename MATRIX::value_type value) |
| template<typename number > | |
| void | add (const std::vector< unsigned int > &indices, const FullMatrix< number > &full_matrix, const bool elide_zero_values=true) |
| template<typename number > | |
| void | add (const std::vector< unsigned int > &row_indices, const std::vector< unsigned int > &col_indices, const FullMatrix< number > &full_matrix, const bool elide_zero_values=true) |
| template<typename number > | |
| void | add (const unsigned int row_index, const std::vector< unsigned int > &col_indices, const std::vector< number > &values, const bool elide_zero_values=true) |
| template<typename number > | |
| void | add (const unsigned int row, const unsigned int n_cols, const unsigned int *col_indices, const number *values, const bool elide_zero_values=true, const bool col_indices_are_sorted=false) |
| template<class VECTOR > | |
| void | vmult (VECTOR &w, const VECTOR &v) const |
| template<class VECTOR > | |
| void | vmult_add (VECTOR &w, const VECTOR &v) const |
| template<class VECTOR > | |
| void | Tvmult (VECTOR &w, const VECTOR &v) const |
| template<class VECTOR > | |
| void | Tvmult_add (VECTOR &w, const VECTOR &v) const |
| std::size_t | memory_consumption () const |
Static Public Member Functions | |
| ::ExceptionBase & | ExcBlockIndexMismatch (unsigned int arg1, unsigned int arg2) throw (errortext << "Block index " << arg1 << " does not match " << arg2 ) |
Public Attributes | |
| unsigned int | row |
| unsigned int | column |
| MATRIX | matrix |
Private Attributes | |
| BlockIndices | row_indices |
| BlockIndices | column_indices |
Friends | |
| void | internal::reinit (MatrixBlock< MATRIX > &, const BlockSparsityPattern &) |
A wrapper around a matrix object, storing the coordinates in a block matrix as well.
This class is an alternative to BlockMatrixBase, if you only want to generate a single block of the system, not the whole system. Using the add() functions of this class, it is possible to use the standard assembling functions used for block matrices, but only enter in one of the blocks and still avoiding the index computations innvolved.
The reason for this class is, that we may need a different number of matrices for different blocks in a block system. For example, a preconditioner for the Oseen system can be built as a block system, where the pressure block is of the form M-1FA-1 with M the pressure mass matrix, A the pressure Laplacian and F the advection diffusion operator applied to the pressure space. Since only a single matrix is needed for the other blocks, using BlockSparseMatrix or similar would be a waste of memory.
While the add() functions make a MatrixBlock appear like a block matrix for assembling, the functions vmult(), Tvmult(), vmult_add(), and Tvmult_add() make it behave like a MATRIX, when it comes to applying it to a vector. This behavior allows us to store MatrixBlock objects in vectors, for instance in MGLevelObject without extracting the matrix first.
MatrixBlock comes handy when using BlockMatrixArray. Once the MatrixBlock has been properly initalized and filled, it can be used in the simplest case as:
MatrixBlockVector<SparseMatrix<double> > > blocks; ... BlockMatrixArray matrix (n_blocks, n_blocks); for (unsigned int i=0;i<blocks.size;++i) matrix.enter(blocks.block(i).row, blocks.block(i).column, blocks.matrix(i));
Here, we have not gained very much, except that we do not need to set up empty blocks in the block system.
Definition at line 100 of file matrix_block.h.
| MatrixBlock< MATRIX >::MatrixBlock | ( | ) | [inline] |
Constructor rendering an uninitialized object.
Definition at line 694 of file matrix_block.h.
| MatrixBlock< MATRIX >::MatrixBlock | ( | const MatrixBlock< MATRIX > & | M ) | [inline] |
Copy constructor.
Definition at line 703 of file matrix_block.h.
| MatrixBlock< MATRIX >::MatrixBlock | ( | unsigned int | i, |
| unsigned int | j | ||
| ) | [inline] |
Constructor setting block coordinates, but not initializing the matrix.
Definition at line 716 of file matrix_block.h.
| void MatrixBlock< MATRIX >::reinit | ( | const BlockSparsityPattern & | sparsity ) | [inline] |
Reinitialize the matrix for a new BlockSparsityPattern. This adujusts the matrix as well as the row_indices and column_indices.
Definition at line 725 of file matrix_block.h.
References internal::reinit().
| MatrixBlock< MATRIX >::operator MATRIX & | ( | ) | [inline] |
Definition at line 733 of file matrix_block.h.
References LAPACKSupport::matrix.
| MatrixBlock< MATRIX >::operator const MATRIX & | ( | ) | const [inline] |
Definition at line 741 of file matrix_block.h.
References LAPACKSupport::matrix.
| void MatrixBlock< MATRIX >::add | ( | const unsigned int | i, |
| const unsigned int | j, | ||
| const typename MATRIX::value_type | value | ||
| ) | [inline] |
Add value to the element (i,j). Throws an error if the entry does not exist or if it is in a different block.
Definition at line 749 of file matrix_block.h.
References Assert, StandardExceptions::ExcNotInitialized(), and LAPACKSupport::matrix.
Referenced by MeshWorker::Assembler::MatrixLocalBlocksToGlobalBlocks< MATRIX, number >::assemble().
| void MatrixBlock< MATRIX >::add | ( | const std::vector< unsigned int > & | indices, |
| const FullMatrix< number > & | full_matrix, | ||
| const bool | elide_zero_values = true |
||
| ) | [inline] |
Add all elements in a FullMatrix into sparse matrix locations given by indices. This function assumes a quadratic sparse matrix and a quadratic full_matrix. The global locations are translated into locations in this block and ExcBlockIndexMismatch is thrown, if the global index does not point into the block refered to by row and column.
elide_zero_values is currently ignored.The optional parameter elide_zero_values can be used to specify whether zero values should be added anyway or these should be filtered away and only non-zero data is added. The default value is true, i.e., zero values won't be added into the matrix.
Definition at line 834 of file matrix_block.h.
References Assert, AssertDimension, StandardExceptions::ExcNotInitialized(), LACExceptions::ExcNotQuadratic(), FullMatrix< number >::m(), and FullMatrix< number >::n().
| void MatrixBlock< MATRIX >::add | ( | const std::vector< unsigned int > & | row_indices, |
| const std::vector< unsigned int > & | col_indices, | ||
| const FullMatrix< number > & | full_matrix, | ||
| const bool | elide_zero_values = true |
||
| ) | [inline] |
Add all elements in a FullMatrix into global locations given by row_indices and col_indices, respectively. The global locations are translated into locations in this block and ExcBlockIndexMismatch is thrown, if the global index does not point into the block refered to by row and column.
elide_zero_values is currently ignored.The optional parameter elide_zero_values can be used to specify whether zero values should be added anyway or these should be filtered away and only non-zero data is added. The default value is true, i.e., zero values won't be added into the matrix.
Definition at line 773 of file matrix_block.h.
References Assert, AssertDimension, StandardExceptions::ExcNotInitialized(), FullMatrix< number >::m(), and FullMatrix< number >::n().
| void MatrixBlock< MATRIX >::add | ( | const unsigned int | row_index, |
| const std::vector< unsigned int > & | col_indices, | ||
| const std::vector< number > & | values, | ||
| const bool | elide_zero_values = true |
||
| ) | [inline] |
Set several elements in the specified row of the matrix with column indices as given by col_indices to the respective value. This is the function doing thye actual work for the ones adding full matrices. The global locations row_index and col_indices are translated into locations in this block and ExcBlockIndexMismatch is thrown, if the global index does not point into the block refered to by row and column.
elide_zero_values is currently ignored.The optional parameter elide_zero_values can be used to specify whether zero values should be added anyway or these should be filtered away and only non-zero data is added. The default value is true, i.e., zero values won't be added into the matrix.
Definition at line 855 of file matrix_block.h.
References Assert, AssertDimension, and StandardExceptions::ExcNotInitialized().
| void MatrixBlock< MATRIX >::add | ( | const unsigned int | row, |
| const unsigned int | n_cols, | ||
| const unsigned int * | col_indices, | ||
| const number * | values, | ||
| const bool | elide_zero_values = true, |
||
| const bool | col_indices_are_sorted = false |
||
| ) | [inline] |
Add an array of values given by values in the given global matrix row at columns specified by col_indices in the sparse matrix.
The optional parameter elide_zero_values can be used to specify whether zero values should be added anyway or these should be filtered away and only non-zero data is added. The default value is true, i.e., zero values won't be added into the matrix.
Definition at line 794 of file matrix_block.h.
References Assert, StandardExceptions::ExcNotInitialized(), and LAPACKSupport::matrix.
| void MatrixBlock< MATRIX >::vmult | ( | VECTOR & | w, |
| const VECTOR & | v | ||
| ) | const [inline] |
Matrix-vector-multiplication, forwarding to the same function in MATRIX. No index computations are done, thus, the vectors need to have sizes matching matrix.
Definition at line 873 of file matrix_block.h.
References LAPACKSupport::matrix.
| void MatrixBlock< MATRIX >::vmult_add | ( | VECTOR & | w, |
| const VECTOR & | v | ||
| ) | const [inline] |
Matrix-vector-multiplication, forwarding to the same function in MATRIX. No index computations are done, thus, the vectors need to have sizes matching matrix.
Definition at line 883 of file matrix_block.h.
References LAPACKSupport::matrix.
| void MatrixBlock< MATRIX >::Tvmult | ( | VECTOR & | w, |
| const VECTOR & | v | ||
| ) | const [inline] |
Matrix-vector-multiplication, forwarding to the same function in MATRIX. No index computations are done, thus, the vectors need to have sizes matching matrix.
Definition at line 893 of file matrix_block.h.
References LAPACKSupport::matrix.
| void MatrixBlock< MATRIX >::Tvmult_add | ( | VECTOR & | w, |
| const VECTOR & | v | ||
| ) | const [inline] |
Matrix-vector-multiplication, forwarding to the same function in MATRIX. No index computations are done, thus, the vectors need to have sizes matching matrix.
Definition at line 903 of file matrix_block.h.
References LAPACKSupport::matrix.
| std::size_t MatrixBlock< MATRIX >::memory_consumption | ( | ) | const [inline] |
The memory used by this object.
Definition at line 912 of file matrix_block.h.
References LAPACKSupport::matrix, and MemoryConsumption::memory_consumption().
| ::ExceptionBase& MatrixBlock< MATRIX >::ExcBlockIndexMismatch | ( | unsigned int | arg1, |
| unsigned int | arg2 | ||
| ) | throw (errortext << "Block index " << arg1 << " does not match " << arg2 ) [static] |
The block number computed from an index by using BlockIndices does not match the block coordinates stored in this object.
| void internal::reinit | ( | MatrixBlock< MATRIX > & | , |
| const BlockSparsityPattern & | |||
| ) | [friend] |
| unsigned int MatrixBlock< MATRIX >::row |
Row coordinate. This is the position of the data member matrix on the global matrix.
Definition at line 349 of file matrix_block.h.
| unsigned int MatrixBlock< MATRIX >::column |
Column coordinate. This is the position of the data member matrix on the global matrix.
Definition at line 356 of file matrix_block.h.
| MATRIX MatrixBlock< MATRIX >::matrix |
The matrix itself
Definition at line 361 of file matrix_block.h.
BlockIndices MatrixBlock< MATRIX >::row_indices [private] |
The rwo BlockIndices of the whole system. Using row(), this allows us to find the index of the first row degree of freedom for this block.
Definition at line 370 of file matrix_block.h.
Referenced by internal::reinit().
BlockIndices MatrixBlock< MATRIX >::column_indices [private] |
The column BlockIndices of the whole system. Using column(), this allows us to find the index of the first column degree of freedom for this block.
Definition at line 379 of file matrix_block.h.
Referenced by internal::reinit().
documentation generated on Fri Feb 3 2012 06:04:09 by
doxygen
1.7.2