![]() |
Reference documentation for deal.II version 8.5.1
|
#include <deal.II/lac/sparsity_pattern.h>
Public Member Functions | |
| Iterator (const SparsityPattern *sp, const std::size_t index_within_sparsity) | |
| Iterator & | operator++ () |
| Iterator | operator++ (int) |
| const Accessor & | operator* () const |
| const Accessor * | operator-> () const |
| bool | operator== (const Iterator &) const |
| bool | operator!= (const Iterator &) const |
| bool | operator< (const Iterator &) const |
| int | operator- (const Iterator &p) const |
Private Attributes | |
| Accessor | accessor |
An iterator class for walking over the elements of a sparsity pattern.
The typical use for these iterators is to iterate over the elements of a sparsity pattern (or, since they also serve as the basis for iterating over the elements of an associated matrix, over the elements of a sparse matrix), or over the elements of individual rows. There is no guarantee that the elements of a row are actually traversed in an order in which column numbers monotonically increase. See the documentation of the SparsityPattern class for more information.
operations for a matrix with
row). As a consequence, when you design algorithms that use these iterators, it is common practice to not loop over all elements of a sparsity pattern at once, but to have an outer loop over all rows and within this loop iterate over the elements of this row. This way, you only ever need to dereference the iterator to obtain the column indices whereas the (expensive) lookup of the row index can be avoided by using the loop index instead. Definition at line 238 of file sparsity_pattern.h.
| SparsityPatternIterators::Iterator::Iterator | ( | const SparsityPattern * | sp, |
| const std::size_t | index_within_sparsity | ||
| ) |
Constructor. Create an iterator into the sparsity pattern sp for the given global index (i.e., the index of the given element counting from the zeroth row).
| Iterator& SparsityPatternIterators::Iterator::operator++ | ( | ) |
Prefix increment.
| Iterator SparsityPatternIterators::Iterator::operator++ | ( | int | ) |
Postfix increment.
| const Accessor& SparsityPatternIterators::Iterator::operator* | ( | ) | const |
Dereferencing operator.
| const Accessor* SparsityPatternIterators::Iterator::operator-> | ( | ) | const |
Dereferencing operator.
| bool SparsityPatternIterators::Iterator::operator== | ( | const Iterator & | ) | const |
Comparison. True, if both iterators point to the same matrix position.
| bool SparsityPatternIterators::Iterator::operator!= | ( | const Iterator & | ) | const |
Inverse of ==.
| bool SparsityPatternIterators::Iterator::operator< | ( | const Iterator & | ) | const |
Comparison operator. Result is true if either the first row number is smaller or if the row numbers are equal and the first index is smaller.
This function is only valid if both iterators point into the same matrix.
| int SparsityPatternIterators::Iterator::operator- | ( | const Iterator & | p | ) | const |
Return the distance between the current iterator and the argument. The distance is given by how many times one has to apply operator++ to the current iterator to get the argument (for a positive return value), or operator-- (for a negative return value).
|
private |
Store an object of the accessor class.
Definition at line 300 of file sparsity_pattern.h.
1.8.13