dune-istl 2.12-git
Loading...
Searching...
No Matches
Dune::Experimental::SparseIndexRanges< I, A >::IndexRangeView Class Reference

Read-only view of a single index set inside a SparseIndexRanges. More...

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

Inheritance diagram for Dune::Experimental::SparseIndexRanges< I, A >::IndexRangeView:
Inheritance graph

Public Types

using index_type = typename SparseIndexRanges< I, A >::index_type
 Type of the indices.
 
using size_type = typename SparseIndexRanges< I, A >::size_type
 

Public Member Functions

 IndexRangeView ()=default
 
 IndexRangeView (const IndexRangeView &)=default
 
IndexRangeView & operator= (const IndexRangeView &)=default
 
 IndexRangeView (IndexRangeView &&)=default
 
IndexRangeView & operator= (IndexRangeView &&)=default
 
constexpr IndexIterator begin () const
 Returns an iterator to the first index in this index set.
 
constexpr IndexIterator end () const
 Returns an iterator past the last index in this index set.
 
constexpr size_type size () const
 Returns the number of indices in this index set.
 
constexpr bool empty () const
 Returns true if this index set is empty (i.e., contains no indices).
 
constexpr index_type front () const
 Returns the first index in this index set. Precondition: the set is not empty.
 
constexpr index_type back () const
 Returns the last index in this index set. Precondition: the set is not empty.
 
constexpr index_type operator[] (size_type i) const
 Returns the index at local position i in this index set. Precondition: i < size().
 
constexpr IntegralRange< index_type > range () const
 Returns an integer range [0, n) usable as a local index range over this set.
 
constexpr bool contains (index_type j) const
 Returns true if index j is contained in this index set. Complexity: O(size()) for small sets, O(log(size())) for large sets.
 
constexpr IndexIterator lower_bound (index_type i) const
 Returns an iterator to the first index >= i in this index set, or end() if none exists.
 
constexpr IndexIterator upper_bound (index_type i) const
 
constexpr IndexIterator find (index_type i) const
 
template<std::invocable< index_type > F>
constexpr void for_each (F &&f) const
 Calls f(j) for every index j in this index set, in ascending order.
 

Friends

class SparseIndexRanges< I, A >
 

Detailed Description

template<class I = std::uint_least32_t, class A = std::allocator<I>>
class Dune::Experimental::SparseIndexRanges< I, A >::IndexRangeView

Read-only view of a single index set inside a SparseIndexRanges.

Provides a std::ranges::view over the sorted indices of one index set. Obtained via SparseIndexRanges::operator[] or by dereferencing a SparseIndexRanges::Iterator.

IndexRangeView is a lightweight proxy (pointer + index offset) that is cheap to copy. It becomes invalid if the underlying SparseIndexRanges is destroyed or moved.

Member Typedef Documentation

◆ index_type

template<class I = std::uint_least32_t, class A = std::allocator<I>>
using Dune::Experimental::SparseIndexRanges< I, A >::IndexRangeView::index_type = typename SparseIndexRanges<I,A>::index_type

Type of the indices.

◆ size_type

template<class I = std::uint_least32_t, class A = std::allocator<I>>
using Dune::Experimental::SparseIndexRanges< I, A >::IndexRangeView::size_type = typename SparseIndexRanges<I,A>::size_type

Constructor & Destructor Documentation

◆ IndexRangeView() [1/3]

template<class I = std::uint_least32_t, class A = std::allocator<I>>
Dune::Experimental::SparseIndexRanges< I, A >::IndexRangeView::IndexRangeView ( )
default

◆ IndexRangeView() [2/3]

template<class I = std::uint_least32_t, class A = std::allocator<I>>
Dune::Experimental::SparseIndexRanges< I, A >::IndexRangeView::IndexRangeView ( const IndexRangeView &  )
default

◆ IndexRangeView() [3/3]

template<class I = std::uint_least32_t, class A = std::allocator<I>>
Dune::Experimental::SparseIndexRanges< I, A >::IndexRangeView::IndexRangeView ( IndexRangeView &&  )
default

Member Function Documentation

◆ back()

template<class I = std::uint_least32_t, class A = std::allocator<I>>
constexpr index_type Dune::Experimental::SparseIndexRanges< I, A >::IndexRangeView::back ( ) const
inlineconstexpr

Returns the last index in this index set. Precondition: the set is not empty.

◆ begin()

template<class I , class A >
constexpr auto Dune::Experimental::SparseIndexRanges< I, A >::IndexRangeView::begin ( ) const
constexpr

Returns an iterator to the first index in this index set.

◆ contains()

template<class I , class A >
constexpr auto Dune::Experimental::SparseIndexRanges< I, A >::IndexRangeView::contains ( index_type  j) const
constexpr

Returns true if index j is contained in this index set. Complexity: O(size()) for small sets, O(log(size())) for large sets.

◆ empty()

template<class I = std::uint_least32_t, class A = std::allocator<I>>
constexpr bool Dune::Experimental::SparseIndexRanges< I, A >::IndexRangeView::empty ( ) const
inlineconstexpr

Returns true if this index set is empty (i.e., contains no indices).

◆ end()

template<class I , class A >
constexpr auto Dune::Experimental::SparseIndexRanges< I, A >::IndexRangeView::end ( ) const
constexpr

Returns an iterator past the last index in this index set.

◆ find()

template<class I , class A >
constexpr auto Dune::Experimental::SparseIndexRanges< I, A >::IndexRangeView::find ( index_type  i) const
constexpr

◆ for_each()

template<class I = std::uint_least32_t, class A = std::allocator<I>>
template<std::invocable< index_type > F>
constexpr void Dune::Experimental::SparseIndexRanges< I, A >::IndexRangeView::for_each ( F &&  f) const
inlineconstexpr

Calls f(j) for every index j in this index set, in ascending order.

◆ front()

template<class I = std::uint_least32_t, class A = std::allocator<I>>
constexpr index_type Dune::Experimental::SparseIndexRanges< I, A >::IndexRangeView::front ( ) const
inlineconstexpr

Returns the first index in this index set. Precondition: the set is not empty.

◆ lower_bound()

template<class I , class A >
constexpr auto Dune::Experimental::SparseIndexRanges< I, A >::IndexRangeView::lower_bound ( index_type  i) const
constexpr

Returns an iterator to the first index >= i in this index set, or end() if none exists.

◆ operator=() [1/2]

template<class I = std::uint_least32_t, class A = std::allocator<I>>
IndexRangeView & Dune::Experimental::SparseIndexRanges< I, A >::IndexRangeView::operator= ( const IndexRangeView &  )
default

◆ operator=() [2/2]

template<class I = std::uint_least32_t, class A = std::allocator<I>>
IndexRangeView & Dune::Experimental::SparseIndexRanges< I, A >::IndexRangeView::operator= ( IndexRangeView &&  )
default

◆ operator[]()

template<class I = std::uint_least32_t, class A = std::allocator<I>>
constexpr index_type Dune::Experimental::SparseIndexRanges< I, A >::IndexRangeView::operator[] ( size_type  i) const
inlineconstexpr

Returns the index at local position i in this index set. Precondition: i < size().

◆ range()

template<class I , class A >
constexpr auto Dune::Experimental::SparseIndexRanges< I, A >::IndexRangeView::range ( ) const
constexpr

Returns an integer range [0, n) usable as a local index range over this set.

◆ size()

template<class I , class A >
constexpr auto Dune::Experimental::SparseIndexRanges< I, A >::IndexRangeView::size ( ) const
constexpr

Returns the number of indices in this index set.

◆ upper_bound()

template<class I , class A >
constexpr auto Dune::Experimental::SparseIndexRanges< I, A >::IndexRangeView::upper_bound ( index_type  i) const
constexpr

Friends And Related Symbol Documentation

◆ SparseIndexRanges< I, A >

template<class I = std::uint_least32_t, class A = std::allocator<I>>
friend class SparseIndexRanges< I, A >
friend

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