dune-istl 2.12-git
Loading...
Searching...
No Matches
Dune::Experimental::IndexedArrayView< T, R > Class Template Reference

Non-owning indexed view over random-access data. More...

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

Inheritance diagram for Dune::Experimental::IndexedArrayView< T, R >:
Inheritance graph

Public Types

using index_range_type = R
 The type used for the index set.
 
using member_type = std::iter_value_t< T >
 The type of components in the array.
 
using index_type = typename OrderedIndexRangeTraits< index_range_type >::index_type
 The type used for the index access.
 
using size_type = typename OrderedIndexRangeTraits< index_range_type >::size_type
 The type used to count elements in the index set.
 
using reference = std::iter_reference_t< T >
 The type used for references to the components.
 
using const_reference = std::common_reference_t< const std::iter_value_t< T > &&, std::iter_reference_t< T > >
 The type used for const references to the components.
 
using iterator = Iterator
 Iterator type with mutable access to the underlying data.
 
using const_iterator = ConstIterator
 Iterator type with const access to the underlying data.
 

Public Member Functions

reference operator[] (index_type i)
 Access element by an index from the index set.
 
const_reference operator[] (index_type i) const
 Const access element by an index from the index set.
 
constexpr iterator begin () noexcept(noexcept(iterator(data_, index_set_, size_type{})))
 Iterator to the first element in the view.
 
constexpr iterator end () noexcept(noexcept(iterator(data_, index_set_, size_type{})))
 Iterator to one past the last element in the view.
 
iterator find (size_type i)
 Find element with index i in the index set.
 
bool contains (index_type i) const
 
constexpr const_iterator begin () const noexcept(noexcept(iterator(data_, index_set_, size_type{})))
 Const iterator to the first element in the view.
 
constexpr const_iterator end () const noexcept(noexcept(iterator(data_, index_set_, size_type{})))
 Const iterator to one past the last element in the view.
 
const_iterator find (size_type i) const
 Find element with index i in the index set.
 
constexpr size_type size () const noexcept(noexcept(std::ranges::size(index_set_)))
 The number of elements in the view, i.e. the size of the index set.
 
constexpr index_range_type indexSet () const
 The logical index range covered by the view, as determined by the index set.
 
 IndexedArrayView (T data, index_range_type index_set) noexcept(std::is_nothrow_copy_constructible_v< T > &&std::is_nothrow_copy_constructible_v< index_range_type >)
 Construct a view from data iterator and index set.
 

Detailed Description

template<std::random_access_iterator T, Concepts::BorrowedOrderedIndexRange R>
class Dune::Experimental::IndexedArrayView< T, R >

Non-owning indexed view over random-access data.

Maps indices from an index set R to contiguous values in the data T. The view stores both data iterator and index set by value. The data and the index sets are not owned by the view, and must outlive it.

Member Typedef Documentation

◆ const_iterator

template<std::random_access_iterator T, Concepts::BorrowedOrderedIndexRange R>
using Dune::Experimental::IndexedArrayView< T, R >::const_iterator = ConstIterator

Iterator type with const access to the underlying data.

◆ const_reference

template<std::random_access_iterator T, Concepts::BorrowedOrderedIndexRange R>
using Dune::Experimental::IndexedArrayView< T, R >::const_reference = std::common_reference_t<const std::iter_value_t<T>&&, std::iter_reference_t<T> >

The type used for const references to the components.

◆ index_range_type

template<std::random_access_iterator T, Concepts::BorrowedOrderedIndexRange R>
using Dune::Experimental::IndexedArrayView< T, R >::index_range_type = R

The type used for the index set.

◆ index_type

template<std::random_access_iterator T, Concepts::BorrowedOrderedIndexRange R>
using Dune::Experimental::IndexedArrayView< T, R >::index_type = typename OrderedIndexRangeTraits<index_range_type>::index_type

The type used for the index access.

◆ iterator

template<std::random_access_iterator T, Concepts::BorrowedOrderedIndexRange R>
using Dune::Experimental::IndexedArrayView< T, R >::iterator = Iterator

Iterator type with mutable access to the underlying data.

◆ member_type

template<std::random_access_iterator T, Concepts::BorrowedOrderedIndexRange R>
using Dune::Experimental::IndexedArrayView< T, R >::member_type = std::iter_value_t<T>

The type of components in the array.

◆ reference

template<std::random_access_iterator T, Concepts::BorrowedOrderedIndexRange R>
using Dune::Experimental::IndexedArrayView< T, R >::reference = std::iter_reference_t<T>

The type used for references to the components.

◆ size_type

template<std::random_access_iterator T, Concepts::BorrowedOrderedIndexRange R>
using Dune::Experimental::IndexedArrayView< T, R >::size_type = typename OrderedIndexRangeTraits<index_range_type>::size_type

The type used to count elements in the index set.

Constructor & Destructor Documentation

◆ IndexedArrayView()

template<std::random_access_iterator T, Concepts::BorrowedOrderedIndexRange R>
Dune::Experimental::IndexedArrayView< T, R >::IndexedArrayView ( T  data,
index_range_type  index_set 
)
inlinenoexcept

Construct a view from data iterator and index set.

Parameters
dataIterator to first element of the underlying contiguous data.
index_setSet or view of valid external indices.

Member Function Documentation

◆ begin() [1/2]

template<std::random_access_iterator T, Concepts::BorrowedOrderedIndexRange R>
constexpr const_iterator Dune::Experimental::IndexedArrayView< T, R >::begin ( ) const
inlineconstexprnoexcept

Const iterator to the first element in the view.

◆ begin() [2/2]

template<std::random_access_iterator T, Concepts::BorrowedOrderedIndexRange R>
constexpr iterator Dune::Experimental::IndexedArrayView< T, R >::begin ( )
inlineconstexprnoexcept

Iterator to the first element in the view.

◆ contains()

template<std::random_access_iterator T, Concepts::BorrowedOrderedIndexRange R>
bool Dune::Experimental::IndexedArrayView< T, R >::contains ( index_type  i) const
inline

◆ end() [1/2]

template<std::random_access_iterator T, Concepts::BorrowedOrderedIndexRange R>
constexpr const_iterator Dune::Experimental::IndexedArrayView< T, R >::end ( ) const
inlineconstexprnoexcept

Const iterator to one past the last element in the view.

◆ end() [2/2]

template<std::random_access_iterator T, Concepts::BorrowedOrderedIndexRange R>
constexpr iterator Dune::Experimental::IndexedArrayView< T, R >::end ( )
inlineconstexprnoexcept

Iterator to one past the last element in the view.

◆ find() [1/2]

template<std::random_access_iterator T, Concepts::BorrowedOrderedIndexRange R>
iterator Dune::Experimental::IndexedArrayView< T, R >::find ( size_type  i)
inline

Find element with index i in the index set.

Returns
Iterator to the element with index i, or end() if i is not present.

◆ find() [2/2]

template<std::random_access_iterator T, Concepts::BorrowedOrderedIndexRange R>
const_iterator Dune::Experimental::IndexedArrayView< T, R >::find ( size_type  i) const
inline

Find element with index i in the index set.

Returns
Const iterator to the element with index i, or end() if i is not present.

◆ indexSet()

template<std::random_access_iterator T, Concepts::BorrowedOrderedIndexRange R>
constexpr index_range_type Dune::Experimental::IndexedArrayView< T, R >::indexSet ( ) const
inlineconstexpr

The logical index range covered by the view, as determined by the index set.

◆ operator[]() [1/2]

template<std::random_access_iterator T, Concepts::BorrowedOrderedIndexRange R>
reference Dune::Experimental::IndexedArrayView< T, R >::operator[] ( index_type  i)
inline

Access element by an index from the index set.

Parameters
iIndex from the index set.
Exceptions
ISTLErrorif bounds checking is enabled and i is not present.

◆ operator[]() [2/2]

template<std::random_access_iterator T, Concepts::BorrowedOrderedIndexRange R>
const_reference Dune::Experimental::IndexedArrayView< T, R >::operator[] ( index_type  i) const
inline

Const access element by an index from the index set.

Parameters
iIndex from the index set.
Exceptions
ISTLErrorif bounds checking is enabled and i is not present.

◆ size()

template<std::random_access_iterator T, Concepts::BorrowedOrderedIndexRange R>
constexpr size_type Dune::Experimental::IndexedArrayView< T, R >::size ( ) const
inlineconstexprnoexcept

The number of elements in the view, i.e. the size of the index set.


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