Gyselalib++
 
Loading...
Searching...
No Matches
IdxRangeSlice< Dims > Class Template Reference

A class which describes a collection of equally spaced Idxs which form a index range. More...

Public Member Functions

 IdxRangeSlice ()=default
 Default constructor for IdxRangeSlice creating an empty index range.
 
KOKKOS_FUNCTION IdxRangeSlice (Idx< Dims... > front, IdxStep< Dims... > size, IdxStep< Dims... > stride)
 Build a IdxRangeSlice from vectors of valid Idxs in each dimension.
 
template<class... DDoms, class = std::enable_if_t<(is_subidx_range_collection_v<DDoms> && ...)>>
KOKKOS_FUNCTION IdxRangeSlice (DDoms const &... valid_indices)
 Build a IdxRangeSlice from a set of 1D IdxRangeSlices.
 
template<class... DDims>
KOKKOS_FUNCTION bool contains (Idx< DDims... > elem) const
 Check if the specified Idx is found in this index range slice.
 
template<class... DDims>
KOKKOS_FUNCTION bool contains (IdxRange< DDims... > idx_range) const
 Check if all elements of the specified IdxRange are found in this index range slice.
 
template<class Dim , class = std::enable_if_t<ddc::in_tags_v<Dim, tags_seq>>>
KOKKOS_FUNCTION std::size_t get_index (Idx< Dim > elem) const
 Get the index of the Idx within the index range slice.
 
KOKKOS_FUNCTION constexpr IdxStep< Dims... > extents () const noexcept
 Get the size of the index range slice in each dimension.
 
template<class QueryDDim >
KOKKOS_FUNCTION constexpr IdxStep< QueryDDim > extent () const noexcept
 Get the size of the index range slice in the specified dimension.
 
KOKKOS_FUNCTION constexpr std::size_t size () const
 Get the total number of elements in the index range slice.
 
KOKKOS_FUNCTION constexpr Idx< Dims... > front () const noexcept
 Get the first element in the index range slice.
 
KOKKOS_FUNCTION constexpr Idx< Dims... > back () const noexcept
 Get the last element in the index range slice.
 
template<class QueryDim >
KOKKOS_FUNCTION constexpr IdxStep< QueryDim > stride () const noexcept
 Get the stride from one element of the index range slice to another.
 
KOKKOS_FUNCTION constexpr IdxStep< Dims... > strides () const noexcept
 Get the strides from one element of the index range slice to another.
 
KOKKOS_FUNCTION auto begin () const
 Get the iterator to the first element of the IdxRangeSlice.
 
KOKKOS_FUNCTION auto end () const
 Get the iterator to the end of the IdxRangeSlice.
 

Detailed Description

template<class... Dims>
class IdxRangeSlice< Dims >

A class which describes a collection of equally spaced Idxs which form a index range.

This class should eventually be replaced by a DDC functionality when this becomes available.

Constructor & Destructor Documentation

◆ IdxRangeSlice() [1/2]

template<class... Dims>
KOKKOS_FUNCTION IdxRangeSlice< Dims >::IdxRangeSlice ( Idx< Dims... >  front,
IdxStep< Dims... >  size,
IdxStep< Dims... >  stride 
)
inline

Build a IdxRangeSlice from vectors of valid Idxs in each dimension.

Parameters
frontThe Idx describing the first point in the index range.
sizeThe number of elements along each direction.
strideThe IdxStep distance between subsequent elements of the index range.

◆ IdxRangeSlice() [2/2]

template<class... Dims>
template<class... DDoms, class = std::enable_if_t<(is_subidx_range_collection_v<DDoms> && ...)>>
KOKKOS_FUNCTION IdxRangeSlice< Dims >::IdxRangeSlice ( DDoms const &...  valid_indices)
inline

Build a IdxRangeSlice from a set of 1D IdxRangeSlices.

Parameters
valid_indicesThe IdxRangeSlices which comprise this IdxRangeSlice.

Member Function Documentation

◆ contains() [1/2]

template<class... Dims>
template<class... DDims>
KOKKOS_FUNCTION bool IdxRangeSlice< Dims >::contains ( Idx< DDims... >  elem) const
inline

Check if the specified Idx is found in this index range slice.

Parameters
elemThe element which may or may not be in this index range slice.
Returns
bool True if the element is found in this index range slice, False otherwise.

◆ contains() [2/2]

template<class... Dims>
template<class... DDims>
KOKKOS_FUNCTION bool IdxRangeSlice< Dims >::contains ( IdxRange< DDims... >  idx_range) const
inline

Check if all elements of the specified IdxRange are found in this index range slice.

Parameters
idx_rangeThe index range which may or may not be in this index range slice.
Returns
bool True if the all elements of the specified IdxRange are found in this index range slice. False otherwise.

◆ get_index()

template<class... Dims>
template<class Dim , class = std::enable_if_t<ddc::in_tags_v<Dim, tags_seq>>>
KOKKOS_FUNCTION std::size_t IdxRangeSlice< Dims >::get_index ( Idx< Dim >  elem) const
inline

Get the index of the Idx within the index range slice.

This function is particularly useful to index an mdspan over the index range slice.

Parameters
elemA 1D Idx which is inside the index range slice.
Returns
The index of the element.

◆ extents()

template<class... Dims>
KOKKOS_FUNCTION constexpr IdxStep< Dims... > IdxRangeSlice< Dims >::extents ( ) const
inlineconstexprnoexcept

Get the size of the index range slice in each dimension.

Returns
A IdxStep describing the size of the index range slice in each dimension.

◆ extent()

template<class... Dims>
template<class QueryDDim >
KOKKOS_FUNCTION constexpr IdxStep< QueryDDim > IdxRangeSlice< Dims >::extent ( ) const
inlineconstexprnoexcept

Get the size of the index range slice in the specified dimension.

Template Parameters
QueryDDimThe dimension in which the size is requested.
Returns
A IdxStep describing the size of the index range slice in the specified dimension.

◆ size()

template<class... Dims>
KOKKOS_FUNCTION constexpr std::size_t IdxRangeSlice< Dims >::size ( ) const
inlineconstexpr

Get the total number of elements in the index range slice.

Returns
The total number of elements in the index range slice.

◆ front()

template<class... Dims>
KOKKOS_FUNCTION constexpr Idx< Dims... > IdxRangeSlice< Dims >::front ( ) const
inlineconstexprnoexcept

Get the first element in the index range slice.

Returns
The first element in the index range slice.

◆ back()

template<class... Dims>
KOKKOS_FUNCTION constexpr Idx< Dims... > IdxRangeSlice< Dims >::back ( ) const
inlineconstexprnoexcept

Get the last element in the index range slice.

Returns
The last element in the index range slice.

◆ stride()

template<class... Dims>
template<class QueryDim >
KOKKOS_FUNCTION constexpr IdxStep< QueryDim > IdxRangeSlice< Dims >::stride ( ) const
inlineconstexprnoexcept

Get the stride from one element of the index range slice to another.

Template Parameters
QueryDimThe dimension being queried
Returns
A 1D IdxStep describing a stride from one element to another.

◆ strides()

template<class... Dims>
KOKKOS_FUNCTION constexpr IdxStep< Dims... > IdxRangeSlice< Dims >::strides ( ) const
inlineconstexprnoexcept

Get the strides from one element of the index range slice to another.

Returns
A IdxStep describing the strides from one element to another.

◆ begin()

template<class... Dims>
KOKKOS_FUNCTION auto IdxRangeSlice< Dims >::begin ( ) const
inline

Get the iterator to the first element of the IdxRangeSlice.

The elements are pairs of Idxs and indices.

Returns
The iterator to the first element of the IdxRangeSlice.

◆ end()

template<class... Dims>
KOKKOS_FUNCTION auto IdxRangeSlice< Dims >::end ( ) const
inline

Get the iterator to the end of the IdxRangeSlice.

The elements are pairs of Idxs and indices.

Returns
The iterator to the end of the IdxRangeSlice.

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