|
dune-istl 2.12-git
|
Compact storage of multiple sorted sparse index sets sharing a single allocation. More...
#include <dune/istl/experimental/sparseindexranges.hh>

Classes | |
| class | IndexIterator |
| class | IndexRangeView |
Read-only view of a single index set inside a SparseIndexRanges. More... | |
| class | Iterator |
Random-access iterator over the index sets of a SparseIndexRanges. More... | |
Public Types | |
| using | size_type = typename alloc_traits::size_type |
| Type to access the index sets. | |
| using | index_type = I |
| Type of the indices. | |
| using | allocator_type = A |
| Allocator type used for memory management. | |
Public Member Functions | |
| template<class OtherAlloc > requires std::constructible_from<A, OtherAlloc> | |
| constexpr | SparseIndexRanges (SequencedSparseIndexRangeBuilder< OtherAlloc > &&builder) |
Construct from a finished SequencedSparseIndexRangeBuilder, taking ownership of its storage and compressing it. | |
| template<class OtherAlloc > requires std::constructible_from<A, OtherAlloc> | |
| constexpr | SparseIndexRanges (UnsequencedSparseIndexRangeBuilder< OtherAlloc > &&builder) |
Construct from a finished UnsequencedSparseIndexRangeBuilder, taking ownership of its storage and compressing it. | |
| constexpr | SparseIndexRanges (SparseIndexRanges &&other) |
Move-construct, transferring ownership of storage from other. other is left in a valid but empty state. | |
| constexpr SparseIndexRanges & | operator= (SparseIndexRanges &&other) |
Move-assign, releasing current storage and transferring ownership from other. other is left in a valid but empty state. | |
| constexpr void | swap (SparseIndexRanges &other) |
Swap contents with other honoring allocator swap propagation traits. | |
| constexpr | ~SparseIndexRanges () |
| Destroy the index sets and release all allocated memory. | |
| constexpr size_type | size () const noexcept |
| Returns the number of index sets (e.g., the number of rows in a sparse matrix). | |
| constexpr size_type | count () const |
| Returns the total number of indices stored across all index sets (sum of all individual set sizes). | |
| constexpr IntegralRange< index_type > | range () const noexcept |
| Returns the integer range [0, n) that every stored index belongs to. | |
| constexpr size_type | offset (size_type i) const |
| constexpr IndexRangeView | operator[] (size_type i) const |
| constexpr Iterator | begin () const |
| Returns an iterator to the first index set (index set 0). | |
| constexpr Iterator | end () const |
| Returns an iterator past the last index set. | |
| std::ostream & | print (std::ostream &os) const |
Writes all index sets to os, one per line in the form "[i]: j0 j1 ...". Returns os. | |
Friends | |
| constexpr void | swap (SparseIndexRanges &lhs, SparseIndexRanges &rhs) |
Swap contents of lhs and rhs, honoring allocator swap propagation traits. | |
| constexpr friend bool | operator== (const SparseIndexRanges &p1, const SparseIndexRanges &p2) |
Returns true if p1 and p2 contain identical index sets with identical values. | |
Detailed Description
class Dune::Experimental::SparseIndexRanges< I, A >
Compact storage of multiple sorted sparse index sets sharing a single allocation.
A SparseIndexRanges<A> stores size() sorted sparse index sets. Each index set is a subset of the integer range given by range().
- Construction
- Objects are built via one of two builder types and cannot be default-constructed:
SequencedSparseIndexRangeBuilder: fill index sets sequentially, one at a time from first to last.UnsequencedSparseIndexRangeBuilder: insert indices across all sets in any order, optionally, declaring sizes first.
After construction the storage is compressed: unused capacity is discarded and indices are stored contiguously.
- Access
- Iterate over all index sets with
begin()/end(), or access individual sets withoperator[]. Each element is anIndexRangeView, a lightweight read-only range over the sorted indices of a single index set.
- Ownership
- The object is move-only; copy construction and copy assignment are disabled.
- Template Parameters
-
A Allocator type (default: std::allocator<I>).
Member Typedef Documentation
◆ allocator_type
| using Dune::Experimental::SparseIndexRanges< I, A >::allocator_type = A |
Allocator type used for memory management.
◆ index_type
| using Dune::Experimental::SparseIndexRanges< I, A >::index_type = I |
Type of the indices.
◆ size_type
| using Dune::Experimental::SparseIndexRanges< I, A >::size_type = typename alloc_traits::size_type |
Type to access the index sets.
Constructor & Destructor Documentation
◆ SparseIndexRanges() [1/3]
requires std::constructible_from<A, OtherAlloc>
requires std::constructible_from<A, OtherAlloc>
|
constexpr |
Construct from a finished SequencedSparseIndexRangeBuilder, taking ownership of its storage and compressing it.
◆ SparseIndexRanges() [2/3]
requires std::constructible_from<A, OtherAlloc>
requires std::constructible_from<A, OtherAlloc>
|
constexpr |
Construct from a finished UnsequencedSparseIndexRangeBuilder, taking ownership of its storage and compressing it.
◆ SparseIndexRanges() [3/3]
|
constexpr |
Move-construct, transferring ownership of storage from other. other is left in a valid but empty state.
◆ ~SparseIndexRanges()
|
constexpr |
Destroy the index sets and release all allocated memory.
Member Function Documentation
◆ begin()
|
inlineconstexpr |
Returns an iterator to the first index set (index set 0).
◆ count()
|
constexpr |
Returns the total number of indices stored across all index sets (sum of all individual set sizes).
◆ end()
|
inlineconstexpr |
Returns an iterator past the last index set.
◆ offset()
|
constexpr |
◆ operator=()
|
constexpr |
Move-assign, releasing current storage and transferring ownership from other. other is left in a valid but empty state.
◆ operator[]()
|
inlineconstexpr |
Returns a read-only view of the i-th index set.
- Parameters
-
i Index-set number; must satisfy 0 <= i < size().
◆ print()
| std::ostream & Dune::Experimental::SparseIndexRanges< I, A >::print | ( | std::ostream & | os | ) | const |
Writes all index sets to os, one per line in the form "[i]: j0 j1 ...". Returns os.
◆ range()
|
constexprnoexcept |
Returns the integer range [0, n) that every stored index belongs to.
◆ size()
|
constexprnoexcept |
Returns the number of index sets (e.g., the number of rows in a sparse matrix).
◆ swap()
|
constexpr |
Swap contents with other honoring allocator swap propagation traits.
Friends And Related Symbol Documentation
◆ operator==
|
friend |
Returns true if p1 and p2 contain identical index sets with identical values.
◆ swap
|
friend |
Swap contents of lhs and rhs, honoring allocator swap propagation traits.
The documentation for this class was generated from the following file:
Legal Statements / Impressum | Hosted by TU Dresden & Uni Heidelberg | Generated by
1.9.8