Hermes
hermes::Index2Range< T > Class Template Reference

Represents a closed-open range of indices [lower, upper) More...

Public Member Functions

HERMES_DEVICE_CALLABLE Index2Range (T upper_i, T upper_j)
 Constructs an index range [0, {upper_i,upper_j}) More...
 
HERMES_DEVICE_CALLABLE Index2Range (Index2< T > lower, Index2< T > upper)
 Constructs an index range [lower, upper) More...
 
HERMES_DEVICE_CALLABLE Index2Range (size2 upper)
 Constructs an index range [0, upper) More...
 
HERMES_DEVICE_CALLABLE bool contains (const Index2< T > &ij) const
 
HERMES_DEVICE_CALLABLE bool operator== (const Index2Range< T > &r) const
 
HERMES_DEVICE_CALLABLE Index2Iterator< T > begin () const
 
HERMES_DEVICE_CALLABLE Index2Iterator< T > end () const
 
HERMES_DEVICE_CALLABLE const Index2< T > & lower () const
 
HERMES_DEVICE_CALLABLE const Index2< T > & upper () const
 
HERMES_DEVICE_CALLABLEarea () const
 

Friends

HERMES_DEVICE_CALLABLE friend Index2Range< T > intersect (const Index2Range< T > &a, const Index2Range< T > &b)
 

Detailed Description

template<typename T>
class hermes::Index2Range< T >

Represents a closed-open range of indices [lower, upper)

Can be used in a for each loop that iterates over all indices in the range:

hermes::size2 size(10,10);
for(auto ij : hermes::Index2Range<int>(size)) {
*ij; // index coordinates
}
Represents a closed-open range of indices [lower, upper)
Definition: index.h:283
Holds 2-dimensional size.
Definition: size.h:47
Template Parameters
Tmust be an integer type

Constructor & Destructor Documentation

◆ Index2Range() [1/3]

template<typename T >
HERMES_DEVICE_CALLABLE hermes::Index2Range< T >::Index2Range ( upper_i,
upper_j 
)
inline

Constructs an index range [0, {upper_i,upper_j})

Parameters
upper_i- upper bound i
upper_j- upper bound j

◆ Index2Range() [2/3]

template<typename T >
HERMES_DEVICE_CALLABLE hermes::Index2Range< T >::Index2Range ( Index2< T >  lower,
Index2< T >  upper 
)
inline

Constructs an index range [lower, upper)

Parameters
lower- lower bound
upper[in | default = Index2<T>()] upper bound

◆ Index2Range() [3/3]

template<typename T >
HERMES_DEVICE_CALLABLE hermes::Index2Range< T >::Index2Range ( size2  upper)
inlineexplicit

Constructs an index range [0, upper)

Parameters
upper- upper bound

Member Function Documentation

◆ area()

template<typename T >
HERMES_DEVICE_CALLABLE T hermes::Index2Range< T >::area ( ) const
inline
Returns

◆ begin()

template<typename T >
HERMES_DEVICE_CALLABLE Index2Iterator<T> hermes::Index2Range< T >::begin ( ) const
inline
Returns

◆ contains()

template<typename T >
HERMES_DEVICE_CALLABLE bool hermes::Index2Range< T >::contains ( const Index2< T > &  ij) const
inline
Parameters
ij
Returns

◆ end()

template<typename T >
HERMES_DEVICE_CALLABLE Index2Iterator<T> hermes::Index2Range< T >::end ( ) const
inline
Returns

◆ lower()

template<typename T >
HERMES_DEVICE_CALLABLE const Index2<T>& hermes::Index2Range< T >::lower ( ) const
inline
Returns

◆ operator==()

template<typename T >
HERMES_DEVICE_CALLABLE bool hermes::Index2Range< T >::operator== ( const Index2Range< T > &  r) const
inline
Parameters
r
Returns

◆ upper()

template<typename T >
HERMES_DEVICE_CALLABLE const Index2<T>& hermes::Index2Range< T >::upper ( ) const
inline
Returns

Friends And Related Function Documentation

◆ intersect

template<typename T >
HERMES_DEVICE_CALLABLE friend Index2Range<T> intersect ( const Index2Range< T > &  a,
const Index2Range< T > &  b 
)
friend
Parameters
a
b
Returns

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