Reference documentation for deal.II version 9.1.0-pre
Public Member Functions | List of all members
BlockDynamicSparsityPattern Class Reference

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

Inheritance diagram for BlockDynamicSparsityPattern:
[legend]

Public Member Functions

 BlockDynamicSparsityPattern ()=default
 
 BlockDynamicSparsityPattern (const size_type n_rows, const size_type n_columns)
 
 BlockDynamicSparsityPattern (const std::vector< size_type > &row_block_sizes, const std::vector< size_type > &col_block_sizes)
 
 BlockDynamicSparsityPattern (const std::vector< IndexSet > &partitioning)
 
 BlockDynamicSparsityPattern (const BlockIndices &row_indices, const BlockIndices &col_indices)
 
void reinit (const std::vector< size_type > &row_block_sizes, const std::vector< size_type > &col_block_sizes)
 
void reinit (const std::vector< IndexSet > &partitioning)
 
void reinit (const BlockIndices &row_indices, const BlockIndices &col_indices)
 
size_type column_number (const size_type row, const unsigned int index) const
 
- Public Member Functions inherited from BlockSparsityPatternBase< DynamicSparsityPattern >
 BlockSparsityPatternBase ()
 
 BlockSparsityPatternBase (const size_type n_block_rows, const size_type n_block_columns)
 
 BlockSparsityPatternBase (const BlockSparsityPatternBase &bsp)
 
 ~BlockSparsityPatternBase () override
 
void reinit (const size_type n_block_rows, const size_type n_block_columns)
 
BlockSparsityPatternBaseoperator= (const BlockSparsityPatternBase &)
 
void collect_sizes ()
 
DynamicSparsityPatternblock (const size_type row, const size_type column)
 
const DynamicSparsityPatternblock (const size_type row, const size_type column) const
 
const BlockIndicesget_row_indices () const
 
const BlockIndicesget_column_indices () const
 
void compress ()
 
size_type n_block_rows () const
 
size_type n_block_cols () const
 
bool empty () const
 
size_type max_entries_per_row () const
 
void add (const size_type i, const size_type j)
 
void add_entries (const size_type row, ForwardIterator begin, ForwardIterator end, const bool indices_are_sorted=false)
 
size_type n_rows () const
 
size_type n_cols () const
 
bool exists (const size_type i, const size_type j) const
 
unsigned int row_length (const size_type row) const
 
size_type n_nonzero_elements () const
 
void print (std::ostream &out) const
 
void print_gnuplot (std::ostream &out) const
 
- Public Member Functions inherited from Subscriptor
 Subscriptor ()
 
 Subscriptor (const Subscriptor &)
 
 Subscriptor (Subscriptor &&) noexcept
 
virtual ~Subscriptor ()
 
Subscriptoroperator= (const Subscriptor &)
 
Subscriptoroperator= (Subscriptor &&) noexcept
 
void subscribe (const char *identifier=nullptr) const
 
void unsubscribe (const char *identifier=nullptr) 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)
 

Additional Inherited Members

- Public Types inherited from BlockSparsityPatternBase< DynamicSparsityPattern >
using size_type = types::global_dof_index
 
- Static Public Member Functions inherited from BlockSparsityPatternBase< DynamicSparsityPattern >
static::ExceptionBase & ExcIncompatibleRowNumbers (int arg1, int arg2, int arg3, int arg4)
 
static::ExceptionBase & ExcIncompatibleColNumbers (int arg1, int arg2, int arg3, int arg4)
 
- 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)
 
- Static Public Attributes inherited from BlockSparsityPatternBase< DynamicSparsityPattern >
static const size_type invalid_entry
 
- Protected Attributes inherited from BlockSparsityPatternBase< DynamicSparsityPattern >
size_type rows
 
size_type columns
 
Table< 2, SmartPointer< DynamicSparsityPattern, BlockSparsityPatternBase< DynamicSparsityPattern > > > sub_objects
 
BlockIndices row_indices
 
BlockIndices column_indices
 

Detailed Description

This class extends the base class to implement an array of compressed sparsity patterns that can be used to initialize objects of type BlockSparsityPattern. It does not add additional member functions, but rather acts as an alias 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 DynamicSparsityPattern class.

This class is an example of the "dynamic" type of Sparsity patterns.

Example

Usage of this class is very similar to DynamicSparsityPattern, but since the use of block indices causes some additional complications, we give a short example.

After the DoFHandler dof and the AffineConstraints 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 BlockDynamicSparsityPattern.

BlockDynamicSparsityPattern dsp(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)
dsp.block(i, j).reinit(dofs_per_block[i], dofs_per_block[j]);
dsp.collect_sizes();

It is filled as if it were a normal pattern

constraints.condense(dsp);

In the end, it is copied to a normal BlockSparsityPattern for later use.

sparsity.copy_from(dsp);

Author
Wolfgang Bangerth, 2000, 2001, Guido Kanschat, 2006, 2007

Definition at line 509 of file block_sparsity_pattern.h.

Constructor & Destructor Documentation

BlockDynamicSparsityPattern::BlockDynamicSparsityPattern ( )
default

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.

BlockDynamicSparsityPattern::BlockDynamicSparsityPattern ( const size_type  n_rows,
const size_type  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.

Definition at line 420 of file block_sparsity_pattern.cc.

BlockDynamicSparsityPattern::BlockDynamicSparsityPattern ( const std::vector< size_type > &  row_block_sizes,
const std::vector< size_type > &  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.

Definition at line 428 of file block_sparsity_pattern.cc.

BlockDynamicSparsityPattern::BlockDynamicSparsityPattern ( const std::vector< IndexSet > &  partitioning)

Initialize the pattern with symmetric blocks. The number of IndexSets in the vector determine the number of rows and columns of blocks. The size of each block is determined by the size() of the respective IndexSet. Each block only stores the rows given by the values in the IndexSet, which is useful for distributed memory parallel computations and usually corresponds to the locally owned DoFs.

Definition at line 441 of file block_sparsity_pattern.cc.

BlockDynamicSparsityPattern::BlockDynamicSparsityPattern ( const BlockIndices row_indices,
const BlockIndices col_indices 
)

Initialize the pattern with two BlockIndices for the block structures of matrix rows and columns.

Definition at line 455 of file block_sparsity_pattern.cc.

Member Function Documentation

void BlockDynamicSparsityPattern::reinit ( const std::vector< size_type > &  row_block_sizes,
const std::vector< size_type > &  col_block_sizes 
)

Resize the pattern 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].

Definition at line 464 of file block_sparsity_pattern.cc.

void BlockDynamicSparsityPattern::reinit ( const std::vector< IndexSet > &  partitioning)

Resize the pattern with symmetric blocks determined by the size() of each IndexSet. See the constructor taking a vector of IndexSets for details.

Definition at line 477 of file block_sparsity_pattern.cc.

void BlockDynamicSparsityPattern::reinit ( const BlockIndices row_indices,
const BlockIndices col_indices 
)

Resize the matrix to a tensor product of matrices with dimensions defined by the arguments. The two BlockIndices objects must be initialized and the sparsity pattern will have the same block structure afterwards.

Definition at line 490 of file block_sparsity_pattern.cc.

BlockDynamicSparsityPattern::size_type BlockDynamicSparsityPattern::column_number ( const size_type  row,
const unsigned int  index 
) const
inline

Access to column number field. Return the column number of the index th entry in row row.

Definition at line 969 of file block_sparsity_pattern.h.


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