Reference documentation for deal.II version 9.4.1
\(\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\}}\)
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | Private Attributes | List of all members

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

Inheritance diagram for TrilinosWrappers::BlockSparsityPattern:
[legend]

Public Types

using size_type = types::global_dof_index
 

Public Member Functions

 BlockSparsityPattern ()=default
 
 BlockSparsityPattern (const size_type n_rows, const size_type n_columns)
 
 BlockSparsityPattern (const std::vector< size_type > &row_block_sizes, const std::vector< size_type > &col_block_sizes)
 
 BlockSparsityPattern (const std::vector< IndexSet > &parallel_partitioning, const MPI_Comm &communicator=MPI_COMM_WORLD)
 
 BlockSparsityPattern (const std::vector< IndexSet > &row_parallel_partitioning, const std::vector< IndexSet > &column_parallel_partitioning, const std::vector< IndexSet > &writeable_rows, const MPI_Comm &communicator=MPI_COMM_WORLD)
 
void reinit (const std::vector< size_type > &row_block_sizes, const std::vector< size_type > &col_block_sizes)
 
void reinit (const std::vector< IndexSet > &parallel_partitioning, const MPI_Comm &communicator=MPI_COMM_WORLD)
 
void reinit (const std::vector< IndexSet > &row_parallel_partitioning, const std::vector< IndexSet > &column_parallel_partitioning, const MPI_Comm &communicator=MPI_COMM_WORLD)
 
void reinit (const std::vector< IndexSet > &row_parallel_partitioning, const std::vector< IndexSet > &column_parallel_partitioning, const std::vector< IndexSet > &writeable_rows, const MPI_Comm &communicator=MPI_COMM_WORLD)
 
void reinit (const size_type n_block_rows, const size_type n_block_columns)
 
void collect_sizes ()
 
SparsityPatternblock (const size_type row, const size_type column)
 
const SparsityPatternblock (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
 
void print_svg (std::ostream &out) const
 

Static Public Member Functions

static ::ExceptionBaseExcIncompatibleRowNumbers (int arg1, int arg2, int arg3, int arg4)
 
static ::ExceptionBaseExcIncompatibleColNumbers (int arg1, int arg2, int arg3, int arg4)
 

Static Public Attributes

static const size_type invalid_entry
 

Protected Attributes

size_type rows
 
size_type columns
 
Table< 2, SmartPointer< SparsityPattern, BlockSparsityPatternBase< SparsityPattern > > > sub_objects
 
BlockIndices row_indices
 
BlockIndices column_indices
 

Private Attributes

std::vector< size_typecounter_within_block
 
std::vector< std::vector< size_type > > block_column_indices
 

Subscriptor functionality

Classes derived from Subscriptor provide a facility to subscribe to this object. This is mostly used by the SmartPointer class.

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)
 
std::atomic< unsigned intcounter
 
std::map< std::string, unsigned intcounter_map
 
std::vector< std::atomic< bool > * > validity_pointers
 
const std::type_info * object_info
 
static ::ExceptionBaseExcInUse (int arg1, std::string arg2, std::string arg3)
 
static ::ExceptionBaseExcNoSubscriber (std::string arg1, std::string arg2)
 
using map_value_type = decltype(counter_map)::value_type
 
using map_iterator = decltype(counter_map)::iterator
 
static std::mutex mutex
 
void check_no_subscribers () const noexcept
 

Detailed Description

This class extends the base class to implement an array of Trilinos sparsity patterns that can be used to initialize Trilinos block sparse matrices that can be distributed among different processors. It is used in the same way as the BlockSparsityPattern except that it builds upon the TrilinosWrappers::SparsityPattern instead of the SparsityPattern.

This class is has properties of the "dynamic" type of Sparsity (in the sense that it can extend the memory if too little elements were allocated), but otherwise is more like the basic deal.II SparsityPattern (in the sense that the method compress() needs to be called before the pattern can be used).

This class is used in step-32.

Definition at line 639 of file block_sparsity_pattern.h.

Member Typedef Documentation

◆ size_type

Declare type for container size.

Definition at line 84 of file block_sparsity_pattern.h.

Member Function Documentation

◆ reinit()

void BlockSparsityPatternBase< SparsityPatternBase >::reinit ( const size_type  n_block_rows,
const size_type  n_block_columns 
)
inherited

Resize the matrix, by setting the number of block rows and columns. This deletes all blocks and replaces them with uninitialized ones, i.e. ones for which also the sizes are not yet set. You have to do that by calling the reinit() functions of the blocks themselves. Do not forget to call collect_sizes() after that on this object.

The reason that you have to set sizes of the blocks yourself is that the sizes may be varying, the maximum number of elements per row may be varying, etc. It is simpler not to reproduce the interface of the SparsityPattern class here but rather let the user call whatever function they desire.

Definition at line 138 of file block_sparsity_pattern.cc.

◆ collect_sizes()

void BlockSparsityPatternBase< SparsityPatternBase >::collect_sizes
inherited

This function collects the sizes of the sub-objects and stores them in internal arrays, in order to be able to relay global indices into the matrix to indices into the subobjects. You must call this function each time after you have changed the size of the sub-objects.

Definition at line 155 of file block_sparsity_pattern.cc.

◆ block() [1/2]

SparsityPattern & BlockSparsityPatternBase< SparsityPattern >::block ( const size_type  row,
const size_type  column 
)
inlineinherited

Access the block with the given coordinates.

Definition at line 161 of file block_sparsity_pattern.h.

◆ block() [2/2]

const SparsityPattern & BlockSparsityPatternBase< SparsityPattern >::block ( const size_type  row,
const size_type  column 
) const
inlineinherited

Access the block with the given coordinates. Version for constant objects.

Definition at line 169 of file block_sparsity_pattern.h.

◆ get_row_indices()

const BlockIndices & BlockSparsityPatternBase< SparsityPattern >::get_row_indices
inlineinherited

Grant access to the object describing the distribution of row indices to the individual blocks.

Definition at line 176 of file block_sparsity_pattern.h.

◆ get_column_indices()

const BlockIndices & BlockSparsityPatternBase< SparsityPattern >::get_column_indices
inlineinherited

Grant access to the object describing the distribution of column indices to the individual blocks.

Definition at line 183 of file block_sparsity_pattern.h.

◆ compress()

void BlockSparsityPatternBase< SparsityPatternBase >::compress
inherited

This function compresses the sparsity structures that this object represents. It simply calls compress for all sub-objects.

Definition at line 190 of file block_sparsity_pattern.cc.

◆ n_block_rows()

Return the number of blocks in a column.

Definition at line 196 of file block_sparsity_pattern.h.

◆ n_block_cols()

Return the number of blocks in a row.

Definition at line 202 of file block_sparsity_pattern.h.

◆ empty()

Return whether the object is empty. It is empty if no memory is allocated, which is the same as that both dimensions are zero. This function is just the concatenation of the respective call to all sub- matrices.

Definition at line 211 of file block_sparsity_pattern.cc.

◆ max_entries_per_row()

Return the maximum number of entries per row. It returns the maximal number of entries per row accumulated over all blocks in a row, and the maximum over all rows.

Definition at line 219 of file block_sparsity_pattern.cc.

◆ add()

void BlockSparsityPatternBase< SparsityPattern >::add ( const size_type  i,
const size_type  j 
)
inlineinherited

Add a nonzero entry to the matrix. This function may only be called for non-compressed sparsity patterns.

If the entry already exists, nothing bad happens.

This function simply finds out to which block (i,j) belongs and then relays to that block.

Definition at line 231 of file block_sparsity_pattern.h.

◆ add_entries()

void BlockSparsityPatternBase< SparsityPattern >::add_entries ( const size_type  row,
ForwardIterator  begin,
ForwardIterator  end,
const bool  indices_are_sorted = false 
)
inherited

Add several nonzero entries to the specified matrix row. This function may only be called for non-compressed sparsity patterns.

If some of the entries already exist, nothing bad happens.

This function simply finds out to which blocks (row,col) for col in the iterator range belong and then relays to those blocks.

Definition at line 245 of file block_sparsity_pattern.h.

◆ n_rows()

Return number of rows of this matrix, which equals the dimension of the image space. It is the sum of rows of the (block-)rows of sub-matrices.

Definition at line 255 of file block_sparsity_pattern.cc.

◆ n_cols()

Return number of columns of this matrix, which equals the dimension of the range space. It is the sum of columns of the (block-)columns of sub- matrices.

Definition at line 263 of file block_sparsity_pattern.cc.

◆ exists()

bool BlockSparsityPatternBase< SparsityPattern >::exists ( const size_type  i,
const size_type  j 
) const
inlineinherited

Check if a value at a certain position may be non-zero.

Definition at line 269 of file block_sparsity_pattern.h.

◆ row_length()

unsigned int BlockSparsityPatternBase< SparsityPattern >::row_length ( const size_type  row) const
inlineinherited

Number of entries in a specific row, added up over all the blocks that form this row.

Definition at line 276 of file block_sparsity_pattern.h.

◆ n_nonzero_elements()

Return the number of nonzero elements of this matrix. Actually, it returns the number of entries in the sparsity pattern; if any of the entries should happen to be zero, it is counted anyway.

This function may only be called if the matrix struct is compressed. It does not make too much sense otherwise anyway.

In the present context, it is the sum of the values as returned by the sub-objects.

Definition at line 290 of file block_sparsity_pattern.cc.

◆ print()

void BlockSparsityPatternBase< SparsityPatternBase >::print ( std::ostream &  out) const
inherited

Print the sparsity of the matrix. The output consists of one line per row of the format [i,j1,j2,j3,...]. i is the row number and jn are the allocated columns in this row.

Definition at line 298 of file block_sparsity_pattern.cc.

◆ print_gnuplot()

void BlockSparsityPatternBase< SparsityPatternBase >::print_gnuplot ( std::ostream &  out) const
inherited

Print the sparsity of the matrix in a format that gnuplot understands and which can be used to plot the sparsity pattern in a graphical way. This is the same functionality implemented for usual sparsity patterns, see SparsityPatternBase::print_gnuplot().

Definition at line 308 of file block_sparsity_pattern.cc.

◆ print_svg()

void BlockSparsityPatternBase< SparsityPatternBase >::print_svg ( std::ostream &  out) const
inherited

Print the sparsity of the matrix in svg format. This is the same functionality implemented for usual sparsity patterns, see SparsityPatternBase::print_svg().

Definition at line 316 of file block_sparsity_pattern.cc.

◆ ExcIncompatibleRowNumbers()

static ::ExceptionBase & BlockSparsityPatternBase< SparsityPattern >::ExcIncompatibleRowNumbers ( int  arg1,
int  arg2,
int  arg3,
int  arg4 
)
staticinherited

Exception

Note
The message that will be printed by this exception reads:
<< "The blocks [" << arg1 << ',' << arg2 << "] and [" << arg3 << ',' << arg4 << "] have differing row numbers."

◆ ExcIncompatibleColNumbers()

static ::ExceptionBase & BlockSparsityPatternBase< SparsityPattern >::ExcIncompatibleColNumbers ( int  arg1,
int  arg2,
int  arg3,
int  arg4 
)
staticinherited

Exception

Note
The message that will be printed by this exception reads:
<< "The blocks [" << arg1 << ',' << arg2 << "] and [" << arg3 << ',' << arg4 << "] have differing column numbers."

Member Data Documentation

◆ invalid_entry

const size_type BlockSparsityPatternBase< SparsityPattern >::invalid_entry
staticinherited

Define a value which is used to indicate that a certain value in the colnums array is unused, i.e. does not represent a certain column number index.

This value is only an alias to the respective value of the SparsityPattern class.

Definition at line 94 of file block_sparsity_pattern.h.

◆ rows

size_type BlockSparsityPatternBase< SparsityPattern >::rows
protectedinherited

Number of block rows.

Definition at line 349 of file block_sparsity_pattern.h.

◆ columns

size_type BlockSparsityPatternBase< SparsityPattern >::columns
protectedinherited

Number of block columns.

Definition at line 354 of file block_sparsity_pattern.h.

◆ sub_objects

Array of sparsity patterns.

Definition at line 362 of file block_sparsity_pattern.h.

◆ row_indices

BlockIndices BlockSparsityPatternBase< SparsityPattern >::row_indices
protectedinherited

Object storing and managing the transformation of row indices to indices of the sub-objects.

Definition at line 368 of file block_sparsity_pattern.h.

◆ column_indices

BlockIndices BlockSparsityPatternBase< SparsityPattern >::column_indices
protectedinherited

Object storing and managing the transformation of column indices to indices of the sub-objects.

Definition at line 374 of file block_sparsity_pattern.h.

◆ counter_within_block

std::vector<size_type> BlockSparsityPatternBase< SparsityPattern >::counter_within_block
privateinherited

Temporary vector for counting the elements written into the individual blocks when doing a collective add or set.

Definition at line 381 of file block_sparsity_pattern.h.

◆ block_column_indices

std::vector<std::vector<size_type> > BlockSparsityPatternBase< SparsityPattern >::block_column_indices
privateinherited

Temporary vector for column indices on each block when writing local to global data on each sparse matrix.

Definition at line 387 of file block_sparsity_pattern.h.


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