
Public Member Functions | |
| BlockCompressedSparsityPattern () | |
| BlockCompressedSparsityPattern (const unsigned int n_rows, const unsigned int n_columns) | |
| BlockCompressedSparsityPattern (const std::vector< unsigned int > &row_block_sizes, const std::vector< unsigned int > &col_block_sizes) | |
| void | reinit (const std::vector< unsigned int > &row_block_sizes, const std::vector< unsigned int > &col_block_sizes) |
typedef to introduce the name of this class, without requiring the user to specify the templated name of the base class. For information on the interface of this class refer to the base class. The individual blocks are based on the CompressedSparistyPattern class.This class is an example of the "dynamic" type of Sparsity patterns.
Note: This class inherits the same tradeoffs regarding its efficiency as CompressedSparsityPattern and as opposed to CompressedSetSparsity. Since the two classes (and consequently BlockCompressedSparsityPattern and BlockCompressedSetSparsityPattern) are interface-compatible it is frequently worth checking which version is more efficient.
Note: This class used to be called CompressedBlockSparsityPattern. However, since it's a block wrapper around the CompressedSparsityPattern class, this is a misnomer and the class has been renamed.
Usage of this class is very similar to CompressedSparsityPattern, but since the use of block indices causes some additional complications, we give a short example.
After the the DoFHandler dof and the ConstraintMatrix constraints have been set up with a system element, we must count the degrees of freedom in each matrix block:
std::vector<unsigned int> dofs_per_block(fe.n_blocks()); DoFTools::count_dofs_per_block(dof, dofs_per_block);
Now, we are ready to set up the BlockCompressedSparsityPattern.
BlockCompressedSparsityPattern c_sparsity(fe.n_blocks(), fe.n_blocks()); for (unsigned int i=0;i<fe.n_blocks();++i) for (unsigned int j=0;j<fe.n_blocks();++j) c_sparsity.block(i,j).reinit(dofs_per_block[i],dofs_per_block[j]); c_sparsity.collect_sizes();
It is filled as if it were a normal pattern
DoFTools::make_sparsity_pattern(dof, c_sparsity); constraints.condense(c_sparsity);
In the end, it is copied to a normal BlockSparsityPattern for later use.
BlockSparsityPattern sparsity; sparsity.copy_from(c_sparsity);
| BlockCompressedSparsityPattern::BlockCompressedSparsityPattern | ( | ) |
Initialize the matrix empty, that is with no memory allocated. This is useful if you want such objects as member variables in other classes. You can make the structure usable by calling the reinit() function.
| BlockCompressedSparsityPattern::BlockCompressedSparsityPattern | ( | const unsigned int | n_rows, | |
| const unsigned int | n_columns | |||
| ) |
Initialize the matrix with the given number of block rows and columns. The blocks themselves are still empty, and you have to call collect_sizes() after you assign them sizes.
| BlockCompressedSparsityPattern::BlockCompressedSparsityPattern | ( | const std::vector< unsigned int > & | row_block_sizes, | |
| const std::vector< unsigned int > & | col_block_sizes | |||
| ) |
Initialize the pattern with two BlockIndices for the block structures of matrix rows and columns. This function is equivalent to calling the previous constructor with the length of the two index vector and then entering the index values.
| void BlockCompressedSparsityPattern::reinit | ( | const std::vector< unsigned int > & | row_block_sizes, | |
| const std::vector< unsigned int > & | col_block_sizes | |||
| ) |
Resize the matrix to a tensor product of matrices with dimensions defined by the arguments.
The matrix will have as many block rows and columns as there are entries in the two arguments. The block at position (i,j) will have the dimensions row_block_sizes[i] times col_block_sizes[j].
documentation generated on Wed Aug 27 19:11:07 2008 by
doxygen
1.5.6