DUNE PDELab (git)
Pattern builder for generic BCRS-like sparse matrices. More...
#include <dune/pdelab/backend/istl/bcrspattern.hh>
Classes | |
struct | iterator |
Iterator over all column indices for a given row, unique but in arbitrary order. More... | |
Public Types | |
typedef RowOrdering::Traits::size_type | size_type |
size type used by BCRSPattern. | |
typedef void | SubPattern |
BCRSPattern cannot contain nested subpatterns. This entry is only required for TMP purposes. | |
Public Member Functions | |
template<typename RI , typename CI > | |
void | add_link (const RI &ri, const CI &ci) |
Add a link between the row indicated by ri and the column indicated by ci. | |
template<typename I > | |
void | sizes (I rit) const |
Stream the sizes of all rows into the output iterator rit. | |
std::vector< size_type > | sizes () const |
Returns a vector with the size of all rows in the pattern. | |
iterator | begin (size_type i) const |
Returns an iterator to the first column index of row i. | |
iterator | end (size_type i) const |
Returns an iterator past the last column index of row i. | |
BCRSPattern (const RowOrdering &row_ordering, const ColOrdering &col_ordering, size_type entries_per_row) | |
Constructs a BCRSPattern for the given pair of orderings and reserves space for the provided average number of entries per row. More... | |
void | clear () |
Discard all internal data. More... | |
Detailed Description
class Dune::PDELab::ISTL::BCRSPattern< RowOrdering, ColOrdering >
Pattern builder for generic BCRS-like sparse matrices.
BCRSPattern is a pattern builder for unstructured sparse matrices for operators mapping from a vector that conforms to RowOrdering to a vector that conforms to ColOrdering.
BCRSPattern has much better runtime performance and requires far less memory than the older pattern constructon method in PDELab. By letting the user specify the average number of nonzeroes per row, it is possible to use a more efficient array-based storage scheme for the majority of the pattern entries, only using expensive map-like lookups for those entries that exceed that average.
BCRSPattern requires a recent version of the BCRSMatrix with support for row-wise setting of column indices and split allocation of column index and data arrays.
Note that unlike the implicit construction mode of the BCRSMatrix itself, this pattern builder will neither throw an exception if the number of nonzeroes was set too low nor retain excess memory if it was set too high after the pattern construction is complete. Performance will degrade if the user-provided estimate is too far away from the real value.
Constructor & Destructor Documentation
◆ BCRSPattern()
|
inline |
Constructs a BCRSPattern for the given pair of orderings and reserves space for the provided average number of entries per row.
- Parameters
-
row_ordering Ordering describing the row structure col_ordering Ordering describing the column structure entries_per_row An estimate of the average number of entries per row.
References Dune::empty().
Member Function Documentation
◆ clear()
|
inline |
Discard all internal data.
The purpose of this method is to release all internal memory before calling BCRSMatrix::endindices(). That way, the matrix creation process never consumes substantially more memory as required by the matrix after construction, as the second copy of the column indices is about as large as the data array.
The documentation for this class was generated from the following file:
- dune/pdelab/backend/istl/bcrspattern.hh