Intrepid2
Public Types | Public Member Functions | Private Attributes | List of all members
Intrepid2::FunctorIterator< FunctorType, ScalarType, rank > Class Template Reference

essentially, a read-only variant of ViewIterator, for a general functor (extent_int() and rank() support required) More...

#include <Intrepid2_FunctorIterator.hpp>

Public Types

using return_type = typename std::conditional< functor_returns_ref< FunctorType, ScalarType, rank >::value, const ScalarType &, const ScalarType >::type
 
template<bool B, class T = return_type>
using enable_if_t = typename std::enable_if< B, T >::type
 

Public Member Functions

KOKKOS_INLINE_FUNCTION FunctorIterator (const FunctorType &functor)
 
template<int M = rank>
enable_if_t< M==0 >
KOKKOS_INLINE_FUNCTION 
get () const
 
template<int M = rank>
enable_if_t< M==1 >
KOKKOS_INLINE_FUNCTION 
get () const
 
template<int M = rank>
enable_if_t< M==2 >
KOKKOS_INLINE_FUNCTION 
get () const
 
template<int M = rank>
enable_if_t< M==3 >
KOKKOS_INLINE_FUNCTION 
get () const
 
template<int M = rank>
enable_if_t< M==4 >
KOKKOS_INLINE_FUNCTION 
get () const
 
template<int M = rank>
enable_if_t< M==5 >
KOKKOS_INLINE_FUNCTION 
get () const
 
template<int M = rank>
enable_if_t< M==6 >
KOKKOS_INLINE_FUNCTION 
get () const
 
template<int M = rank>
enable_if_t< M==7 >
KOKKOS_INLINE_FUNCTION 
get () const
 
KOKKOS_INLINE_FUNCTION int nextIncrementRank ()
 
KOKKOS_INLINE_FUNCTION int increment ()
 
KOKKOS_INLINE_FUNCTION bool decrement ()
 
KOKKOS_INLINE_FUNCTION int getEnumerationIndex ()
 
KOKKOS_INLINE_FUNCTION void setEnumerationIndex (const int &enumerationIndex)
 
KOKKOS_INLINE_FUNCTION int getIndex (int dimension)
 
KOKKOS_INLINE_FUNCTION int getExtent (int dimension)
 
KOKKOS_INLINE_FUNCTION void reset (unsigned from_rank_number=0)
 
KOKKOS_INLINE_FUNCTION void setLocation (const Kokkos::Array< int, 7 > &location)
 
KOKKOS_INLINE_FUNCTION void setLocationInDim (const int &dim, const int &i)
 
KOKKOS_INLINE_FUNCTION
Kokkos::Array< int, 7 > & 
getLocation ()
 

Private Attributes

const FunctorType & functor_
 
Kokkos::Array< int, 7 > dims_
 
Kokkos::Array< int, 7 > index_
 

Detailed Description

template<class FunctorType, typename ScalarType, int rank>
class Intrepid2::FunctorIterator< FunctorType, ScalarType, rank >

essentially, a read-only variant of ViewIterator, for a general functor (extent_int() and rank() support required)

Definition at line 107 of file Intrepid2_FunctorIterator.hpp.

Constructor & Destructor Documentation

template<class FunctorType, typename ScalarType, int rank>
KOKKOS_INLINE_FUNCTION Intrepid2::FunctorIterator< FunctorType, ScalarType, rank >::FunctorIterator ( const FunctorType &  functor)
inline

Constructor. A reference to the functor is stored. This means that FunctorIterators should be constructed where they will be used — on device, or on host, e.g., but not copied from host to device.

Parameters
[in]functor- the functor to iterate over

Definition at line 116 of file Intrepid2_FunctorIterator.hpp.

Member Function Documentation

template<class FunctorType, typename ScalarType, int rank>
KOKKOS_INLINE_FUNCTION bool Intrepid2::FunctorIterator< FunctorType, ScalarType, rank >::decrement ( )
inline

move to the previous location

Returns
the rank of the leftmost index that was changed

Definition at line 261 of file Intrepid2_FunctorIterator.hpp.

References Intrepid2::FunctorIterator< FunctorType, ScalarType, rank >::reset().

template<class FunctorType, typename ScalarType, int rank>
template<int M = rank>
enable_if_t<M==0> KOKKOS_INLINE_FUNCTION Intrepid2::FunctorIterator< FunctorType, ScalarType, rank >::get ( ) const
inline

Getter

Returns
the value at the current location

Definition at line 142 of file Intrepid2_FunctorIterator.hpp.

template<class FunctorType, typename ScalarType, int rank>
template<int M = rank>
enable_if_t<M==1> KOKKOS_INLINE_FUNCTION Intrepid2::FunctorIterator< FunctorType, ScalarType, rank >::get ( ) const
inline

Getter

Returns
the value at the current location

Definition at line 152 of file Intrepid2_FunctorIterator.hpp.

template<class FunctorType, typename ScalarType, int rank>
template<int M = rank>
enable_if_t<M==2> KOKKOS_INLINE_FUNCTION Intrepid2::FunctorIterator< FunctorType, ScalarType, rank >::get ( ) const
inline

Getter

Returns
the value at the current location

Definition at line 162 of file Intrepid2_FunctorIterator.hpp.

template<class FunctorType, typename ScalarType, int rank>
template<int M = rank>
enable_if_t<M==3> KOKKOS_INLINE_FUNCTION Intrepid2::FunctorIterator< FunctorType, ScalarType, rank >::get ( ) const
inline

Getter

Returns
the value at the current location

Definition at line 172 of file Intrepid2_FunctorIterator.hpp.

template<class FunctorType, typename ScalarType, int rank>
template<int M = rank>
enable_if_t<M==4> KOKKOS_INLINE_FUNCTION Intrepid2::FunctorIterator< FunctorType, ScalarType, rank >::get ( ) const
inline

Getter

Returns
the value at the current location

Definition at line 182 of file Intrepid2_FunctorIterator.hpp.

template<class FunctorType, typename ScalarType, int rank>
template<int M = rank>
enable_if_t<M==5> KOKKOS_INLINE_FUNCTION Intrepid2::FunctorIterator< FunctorType, ScalarType, rank >::get ( ) const
inline

Getter

Returns
the value at the current location

Definition at line 192 of file Intrepid2_FunctorIterator.hpp.

template<class FunctorType, typename ScalarType, int rank>
template<int M = rank>
enable_if_t<M==6> KOKKOS_INLINE_FUNCTION Intrepid2::FunctorIterator< FunctorType, ScalarType, rank >::get ( ) const
inline

Getter

Returns
the value at the current location

Definition at line 203 of file Intrepid2_FunctorIterator.hpp.

template<class FunctorType, typename ScalarType, int rank>
template<int M = rank>
enable_if_t<M==7> KOKKOS_INLINE_FUNCTION Intrepid2::FunctorIterator< FunctorType, ScalarType, rank >::get ( ) const
inline

Getter

Returns
the value at the current location

Definition at line 213 of file Intrepid2_FunctorIterator.hpp.

template<class FunctorType, typename ScalarType, int rank>
KOKKOS_INLINE_FUNCTION int Intrepid2::FunctorIterator< FunctorType, ScalarType, rank >::getEnumerationIndex ( )
inline

Enumeration index refers to a 1D enumeration of the entries in the View, with dimensions in order of their significance (dimension 0 is the slowest-moving).

Returns
the enumeration index at current location.

Definition at line 286 of file Intrepid2_FunctorIterator.hpp.

template<class FunctorType, typename ScalarType, int rank>
KOKKOS_INLINE_FUNCTION int Intrepid2::FunctorIterator< FunctorType, ScalarType, rank >::getExtent ( int  dimension)
inline

The extent of the View in the specified dimension. (Extents in dimensions beyond the rank of the View, but less than 7, are defined to be 1.)

Parameters
[in]dimension- the dimension for which the extent should be returned.
Returns
extent of the View in the specified dimension.

Definition at line 327 of file Intrepid2_FunctorIterator.hpp.

template<class FunctorType, typename ScalarType, int rank>
KOKKOS_INLINE_FUNCTION int Intrepid2::FunctorIterator< FunctorType, ScalarType, rank >::getIndex ( int  dimension)
inline

The index of the current location in the specified dimension. (Indices in dimensions beyond the rank of the View, but less than 7, are defined to be 0.)

Parameters
[in]dimension- the dimension for which the current index should be returned.
Returns
index in the specified dimension.

Definition at line 318 of file Intrepid2_FunctorIterator.hpp.

template<class FunctorType, typename ScalarType, int rank>
KOKKOS_INLINE_FUNCTION Kokkos::Array<int,7>& Intrepid2::FunctorIterator< FunctorType, ScalarType, rank >::getLocation ( )
inline

Sets the current location.

Parameters
[in]location- the location as a 7-element array value.

Definition at line 363 of file Intrepid2_FunctorIterator.hpp.

template<class FunctorType, typename ScalarType, int rank>
KOKKOS_INLINE_FUNCTION int Intrepid2::FunctorIterator< FunctorType, ScalarType, rank >::increment ( )
inline

move to the next location

Returns
the rank of the leftmost index that was changed; -1 if increment reached the end of the view

Definition at line 237 of file Intrepid2_FunctorIterator.hpp.

template<class FunctorType, typename ScalarType, int rank>
KOKKOS_INLINE_FUNCTION int Intrepid2::FunctorIterator< FunctorType, ScalarType, rank >::nextIncrementRank ( )
inline
Returns
the leftmost rank ordinal whose index will change on next increment (-1 if next increment will go out of bounds)

Definition at line 221 of file Intrepid2_FunctorIterator.hpp.

template<class FunctorType, typename ScalarType, int rank>
KOKKOS_INLINE_FUNCTION void Intrepid2::FunctorIterator< FunctorType, ScalarType, rank >::reset ( unsigned  from_rank_number = 0)
inline

Resets the location to index 0 in each dimension, starting from the specified dimension.

Parameters
[in]from_rank_number- the first dimension in which to set the index to 0.

Definition at line 335 of file Intrepid2_FunctorIterator.hpp.

Referenced by Intrepid2::FunctorIterator< FunctorType, ScalarType, rank >::decrement().

template<class FunctorType, typename ScalarType, int rank>
KOKKOS_INLINE_FUNCTION void Intrepid2::FunctorIterator< FunctorType, ScalarType, rank >::setEnumerationIndex ( const int &  enumerationIndex)
inline

The enumeration index refers to a 1D enumeration of the entries in the View, with dimensions in order of their significance (dimension 0 is the slowest-moving).

Parameters
[in]enumerationIndex- the index to which the location should be set

Definition at line 301 of file Intrepid2_FunctorIterator.hpp.

References Intrepid2::FunctorIterator< FunctorType, ScalarType, rank >::setLocation().

template<class FunctorType, typename ScalarType, int rank>
KOKKOS_INLINE_FUNCTION void Intrepid2::FunctorIterator< FunctorType, ScalarType, rank >::setLocation ( const Kokkos::Array< int, 7 > &  location)
inline

Sets the current location.

Parameters
[in]location- the location as a 7-element array value.

Definition at line 346 of file Intrepid2_FunctorIterator.hpp.

Referenced by Intrepid2::FunctorIterator< FunctorType, ScalarType, rank >::setEnumerationIndex().

template<class FunctorType, typename ScalarType, int rank>
KOKKOS_INLINE_FUNCTION void Intrepid2::FunctorIterator< FunctorType, ScalarType, rank >::setLocationInDim ( const int &  dim,
const int &  i 
)
inline

Sets the current location in the specified dimension.

Parameters
[in]dim- which dimension to set the location in
[in]i- the index to use in dimension dim

Definition at line 355 of file Intrepid2_FunctorIterator.hpp.


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