dune-istl 2.12-git
Loading...
Searching...
No Matches
Dune::Experimental::SequencedSparseIndexRangeBuilder< A >::IndexRangeBuilder Class Reference

Handle for inserting indices into the current index set of a SequencedSparseIndexRangeBuilder. More...

#include <dune/istl/experimental/sparseindexranges.hh>

Inheritance diagram for Dune::Experimental::SequencedSparseIndexRangeBuilder< A >::IndexRangeBuilder:
Inheritance graph

Public Member Functions

constexpr IndexRangeBuilder (const IndexRangeBuilder &)=delete
 
constexpr IndexRangeBuilder & operator= (const IndexRangeBuilder &)=delete
 
constexpr IndexRangeBuilder (IndexRangeBuilder &&other)
 
constexpr IndexRangeBuilder & operator= (IndexRangeBuilder &&other)
 
constexpr ~IndexRangeBuilder ()=default
 
constexpr void insert (index_type j)
 Insert index j into the current index set. Duplicate insertions are silently ignored.
 
constexpr bool contains (index_type j) const
 Returns true if index j has already been inserted into the current index set.
 
template<std::forward_iterator It, std::sentinel_for< It > End>
constexpr void overrideIndices (It begin, End end, bool do_sort=true, bool do_unique=true)
 Replace the current index set with the indices in [begin, end).
 
constexpr size_type index () const
 Returns the zero-based number of the index set currently being filled.
 
constexpr IndexRangeBuilder & operator++ ()
 
constexpr size_type size () const
 Returns the number of distinct indices inserted into the current index set so far.
 
constexpr IndexRangeBuilder & operator* ()
 Dereference — returns a reference to this IndexRangeBuilder itself (enables range-for).
 

Friends

class SequencedSparseIndexRangeBuilder
 
constexpr friend bool operator== (const IndexRangeBuilder &is_builder, EndSentinel)
 Returns true when all index sets have been filled (used to detect the end sentinel).
 

Detailed Description

template<class A = std::allocator<void>>
class Dune::Experimental::SequencedSparseIndexRangeBuilder< A >::IndexRangeBuilder

Handle for inserting indices into the current index set of a SequencedSparseIndexRangeBuilder.

Obtained from SequencedSparseIndexRangeBuilder::begin(). Use operator++() to commit the current index set and advance to the next one. The iterator pattern enables driving the builder via a range-based for loop.

Advancing past the last index set marks the builder as finished, enabling detection via comparison with EndSentinel{}. After finishing, construct a SparseIndexRanges or CompressedSparseIndexRanges using their constructors. The IndexRangeBuilder must not be used after the enclosing SequencedSparseIndexRangeBuilder is destroyed.

Constructor & Destructor Documentation

◆ IndexRangeBuilder() [1/2]

template<class A = std::allocator<void>>
constexpr Dune::Experimental::SequencedSparseIndexRangeBuilder< A >::IndexRangeBuilder::IndexRangeBuilder ( const IndexRangeBuilder &  )
constexprdelete

◆ IndexRangeBuilder() [2/2]

template<class A >
constexpr Dune::Experimental::SequencedSparseIndexRangeBuilder< A >::IndexRangeBuilder::IndexRangeBuilder ( IndexRangeBuilder &&  other)
constexpr

◆ ~IndexRangeBuilder()

template<class A = std::allocator<void>>
constexpr Dune::Experimental::SequencedSparseIndexRangeBuilder< A >::IndexRangeBuilder::~IndexRangeBuilder ( )
constexprdefault

Member Function Documentation

◆ contains()

template<class A >
constexpr bool Dune::Experimental::SequencedSparseIndexRangeBuilder< A >::IndexRangeBuilder::contains ( index_type  j) const
constexpr

Returns true if index j has already been inserted into the current index set.

◆ index()

template<class A >
constexpr auto Dune::Experimental::SequencedSparseIndexRangeBuilder< A >::IndexRangeBuilder::index ( ) const
constexpr

Returns the zero-based number of the index set currently being filled.

◆ insert()

template<class A >
constexpr void Dune::Experimental::SequencedSparseIndexRangeBuilder< A >::IndexRangeBuilder::insert ( index_type  j)
constexpr

Insert index j into the current index set. Duplicate insertions are silently ignored.

◆ operator*()

template<class A >
constexpr auto Dune::Experimental::SequencedSparseIndexRangeBuilder< A >::IndexRangeBuilder::operator* ( )
constexpr

Dereference — returns a reference to this IndexRangeBuilder itself (enables range-for).

◆ operator++()

template<class A >
constexpr auto Dune::Experimental::SequencedSparseIndexRangeBuilder< A >::IndexRangeBuilder::operator++ ( )
constexpr

Commit the current index set and advance to the next one. After advancing past the last set, comparing with EndSentinel{} returns true.

◆ operator=() [1/2]

template<class A = std::allocator<void>>
constexpr IndexRangeBuilder & Dune::Experimental::SequencedSparseIndexRangeBuilder< A >::IndexRangeBuilder::operator= ( const IndexRangeBuilder &  )
constexprdelete

◆ operator=() [2/2]

template<class A >
constexpr auto Dune::Experimental::SequencedSparseIndexRangeBuilder< A >::IndexRangeBuilder::operator= ( IndexRangeBuilder &&  other)
constexpr

◆ overrideIndices()

template<class A >
template<std::forward_iterator It, std::sentinel_for< It > End>
constexpr void Dune::Experimental::SequencedSparseIndexRangeBuilder< A >::IndexRangeBuilder::overrideIndices ( It  begin,
End  end,
bool  do_sort = true,
bool  do_unique = true 
)
constexpr

Replace the current index set with the indices in [begin, end).

This overwrites any indices previously inserted into the current index set. The provided range is copied into the active storage of the current row and the remainder of that row buffer is reset to the invalid sentinel value, so old entries do not remain observable through contains(), lower_bound(), or later compression.

If the current row buffer is too small, it is grown before the new indices are copied. When do_sort is true, the copied prefix is sorted in ascending order. When do_unique is true, duplicate values are removed from that sorted prefix. The final logical size of the current row is the size after optional sorting and deduplication.

Parameters
beginIterator to the first replacement index.
endSentinel one past the last replacement index.
do_sortWhether to sort the copied indices before storing them.
do_uniqueWhether to remove duplicate indices after the optional sort. This assumes equal elements become adjacent.

◆ size()

template<class A >
constexpr auto Dune::Experimental::SequencedSparseIndexRangeBuilder< A >::IndexRangeBuilder::size ( ) const
constexpr

Returns the number of distinct indices inserted into the current index set so far.

Friends And Related Symbol Documentation

◆ operator==

template<class A = std::allocator<void>>
constexpr friend bool operator== ( const IndexRangeBuilder &  is_builder,
EndSentinel   
)
friend

Returns true when all index sets have been filled (used to detect the end sentinel).

◆ SequencedSparseIndexRangeBuilder

template<class A = std::allocator<void>>
friend class SequencedSparseIndexRangeBuilder
friend

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