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
Classes | Public Types | Public Member Functions | List of all members
DynamicSparsityPattern Class Reference

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

Inheritance diagram for DynamicSparsityPattern:
[legend]

Classes

struct  Line
 

Public Types

using size_type = types::global_dof_index
 
using iterator = DynamicSparsityPatternIterators::Iterator
 
using const_iterator = DynamicSparsityPatternIterators::Iterator
 

Public Member Functions

 DynamicSparsityPattern ()
 
 DynamicSparsityPattern (const DynamicSparsityPattern &)
 
 DynamicSparsityPattern (const size_type m, const size_type n, const IndexSet &rowset=IndexSet())
 
 DynamicSparsityPattern (const IndexSet &indexset)
 
 DynamicSparsityPattern (const size_type n)
 
DynamicSparsityPatternoperator= (const DynamicSparsityPattern &)
 
void reinit (const size_type m, const size_type n, const IndexSet &rowset=IndexSet())
 
void compress ()
 
bool empty () const
 
size_type max_entries_per_row () const
 
void add (const size_type i, const size_type j)
 
template<typename ForwardIterator >
void add_entries (const size_type row, ForwardIterator begin, ForwardIterator end, const bool indices_are_unique_and_sorted=false)
 
bool exists (const size_type i, const size_type j) const
 
DynamicSparsityPattern get_view (const IndexSet &rows) const
 
void symmetrize ()
 
template<typename SparsityPatternTypeLeft , typename SparsityPatternTypeRight >
void compute_mmult_pattern (const SparsityPatternTypeLeft &left, const SparsityPatternTypeRight &right)
 
template<typename SparsityPatternTypeLeft , typename SparsityPatternTypeRight >
void compute_Tmmult_pattern (const SparsityPatternTypeLeft &left, const SparsityPatternTypeRight &right)
 
void print (std::ostream &out) const
 
void print_gnuplot (std::ostream &out) const
 
size_type n_rows () const
 
size_type n_cols () const
 
size_type row_length (const size_type row) const
 
void clear_row (const size_type row)
 
size_type column_number (const size_type row, const size_type index) const
 
size_type column_index (const size_type row, const size_type col) const
 

Iterators

bool have_entries
 
size_type rows
 
size_type cols
 
IndexSet rowset
 
std::vector< Linelines
 
class DynamicSparsityPatternIterators::Accessor
 
iterator begin () const
 
iterator end () const
 
iterator begin (const size_type r) const
 
iterator end (const size_type r) const
 
size_type bandwidth () const
 
size_type n_nonzero_elements () const
 
const IndexSetrow_index_set () const
 
IndexSet nonempty_cols () const
 
IndexSet nonempty_rows () const
 
size_type memory_consumption () const
 
static bool stores_only_added_elements ()
 

Subscriptor functionality

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

std::atomic< unsigned intcounter
 
std::map< std::string, unsigned intcounter_map
 
std::vector< std::atomic< bool > * > validity_pointers
 
const std::type_info * object_info
 
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)
 
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 acts as an intermediate form of the SparsityPattern class. From the interface it mostly represents a SparsityPattern object that is kept compressed at all times. However, since the final sparsity pattern is not known while constructing it, keeping the pattern compressed at all times can only be achieved at the expense of either increased memory or run time consumption upon use. The main purpose of this class is to avoid some memory bottlenecks, so we chose to implement it memory conservative. The chosen data format is too unsuited to be used for actual matrices, though. It is therefore necessary to first copy the data of this object over to an object of type SparsityPattern before using it in actual matrices.

Another viewpoint is that this class does not need up front allocation of a certain amount of memory, but grows as necessary. An extensive description of sparsity patterns can be found in the documentation of the Sparsity module.

This class is an example of the "dynamic" type of Sparsity. It is used in most tutorial programs in one way or another.

Interface

Since this class is intended as an intermediate replacement of the SparsityPattern class, it has mostly the same interface, with small changes where necessary. In particular, the add() function, and the functions inquiring properties of the sparsity pattern are the same.

Usage

Usage of this class is explained in step-2 (without constraints) and step-6 (with AffineConstraints) and typically looks as follows:

DynamicSparsityPattern dynamic_pattern (dof_handler.n_dofs());
dynamic_pattern,
constraints);
sp.copy_from (dynamic_pattern);
void copy_from(const size_type n_rows, const size_type n_cols, const ForwardIterator begin, const ForwardIterator end)
void make_sparsity_pattern(const DoFHandler< dim, spacedim > &dof_handler, SparsityPatternType &sparsity_pattern, const AffineConstraints< number > &constraints=AffineConstraints< number >(), const bool keep_constrained_dofs=true, const types::subdomain_id subdomain_id=numbers::invalid_subdomain_id)

Definition at line 320 of file dynamic_sparsity_pattern.h.


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