HCC
HCC is a single-source, C/C++ compiler for heterogeneous computing. It's optimized with HSA (http://www.hsafoundation.com/).
Public Types | Public Member Functions | Static Public Attributes | Friends | List of all members
hc::extent< N > Class Template Reference

Represents a unique position in N-dimensional space. More...

#include <hc.hpp>

Inheritance diagram for hc::extent< N >:
Inheritance graph
Collaboration diagram for hc::extent< N >:
Collaboration graph

Public Types

typedef int value_type
 The element type of extent<N>.
 

Public Member Functions

 extent () __CPU__ __HC__
 Default constructor. More...
 
 extent (const extent &other) __CPU__ __HC__
 Copy constructor. More...
 
 extent (const int components[]) __CPU__ __HC__
 Constructs an extent<N> with the coordinate values provided the array of int component values. More...
 
 extent (int components[]) __CPU__ __HC__
 Constructs an extent<N> with the coordinate values provided the array of int component values. More...
 
extentoperator= (const extent &other) __CPU__ __HC__
 Assigns the component values of "other" to this extent<N> object. More...
 
bool contains (const index< N > &idx) const __CPU__ __HC__
 Tests whether the index "idx" is properly contained within this extent (with an assumed origin of zero). More...
 
unsigned int size () const __CPU__ __HC__
 This member function returns the total linear size of this extent<N> (in units of elements), which is computed as: extent[0] * extent[1] ... More...
 
 extent (int e0) __CPU__ __HC__
 Constructs an extent<N> with the coordinate values provided by $e_{0..2}$. More...
 
template<typename... _Tp>
 extent (_Tp...__t) __CPU__ __HC__
 Constructs an extent<N> with the coordinate values provided by $e_{0..2}$. More...
 
int operator[] (unsigned int c) const __CPU__ __HC__
 Returns the extent component value at position c. More...
 
int & operator[] (unsigned int c) __CPU__ __HC__
 Returns the extent component value at position c. More...
 
tiled_extent< 1 > tile (int t0) const
 Produces a tiled_extent object with the tile extents given by t0, t1, and t2. More...
 
tiled_extent< 2 > tile (int t0, int t1) const
 Produces a tiled_extent object with the tile extents given by t0, t1, and t2. More...
 
tiled_extent< 3 > tile (int t0, int t1, int t2) const
 Produces a tiled_extent object with the tile extents given by t0, t1, and t2. More...
 
tiled_extent< 1 > tile_with_dynamic (int t0, int dynamic_size) const
 Produces a tiled_extent object with the tile extents given by t0, t1, and t2, plus a certain amount of dynamic group segment.
 
tiled_extent< 2 > tile_with_dynamic (int t0, int t1, int dynamic_size) const
 Produces a tiled_extent object with the tile extents given by t0, t1, and t2, plus a certain amount of dynamic group segment.
 
tiled_extent< 3 > tile_with_dynamic (int t0, int t1, int t2, int dynamic_size) const
 Produces a tiled_extent object with the tile extents given by t0, t1, and t2, plus a certain amount of dynamic group segment.
 
bool operator== (const extent &other) const __CPU__ __HC__
 Compares two objects of extent<N>. More...
 
bool operator!= (const extent &other) const __CPU__ __HC__
 Compares two objects of extent<N>. More...
 
extentoperator+= (const extent &__r) __CPU__ __HC__
 Adds (or subtracts) an object of type extent<N> from this extent to form a new extent. More...
 
extentoperator-= (const extent &__r) __CPU__ __HC__
 Adds (or subtracts) an object of type extent<N> from this extent to form a new extent. More...
 
extentoperator*= (const extent &__r) __CPU__ __HC__
 Adds (or subtracts) an object of type extent<N> from this extent to form a new extent. More...
 
extentoperator/= (const extent &__r) __CPU__ __HC__
 Adds (or subtracts) an object of type extent<N> from this extent to form a new extent. More...
 
extentoperator%= (const extent &__r) __CPU__ __HC__
 Adds (or subtracts) an object of type extent<N> from this extent to form a new extent. More...
 
extent operator+ (const index< N > &idx) __CPU__ __HC__
 Adds (or subtracts) an object of type index<N> from this extent to form a new extent. More...
 
extent operator- (const index< N > &idx) __CPU__ __HC__
 Adds (or subtracts) an object of type index<N> from this extent to form a new extent. More...
 
extentoperator+= (const index< N > &idx) __CPU__ __HC__
 Adds (or subtracts) an object of type index<N> from this extent to form a new extent. More...
 
extentoperator-= (const index< N > &idx) __CPU__ __HC__
 Adds (or subtracts) an object of type index<N> from this extent to form a new extent. More...
 
extentoperator+= (int value) __CPU__ __HC__
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value. More...
 
extentoperator-= (int value) __CPU__ __HC__
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value. More...
 
extentoperator*= (int value) __CPU__ __HC__
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value. More...
 
extentoperator/= (int value) __CPU__ __HC__
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value. More...
 
extentoperator%= (int value) __CPU__ __HC__
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value. More...
 
extentoperator++ () __CPU__ __HC__
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ 1. More...
 
extent operator++ (int) __CPU__ __HC__
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ 1. More...
 
extentoperator-- () __CPU__ __HC__
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ 1. More...
 
extent operator-- (int) __CPU__ __HC__
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ 1. More...
 

Static Public Attributes

static const int rank = N
 A static member of extent<N> that contains the rank of this extent.
 

Friends

template<int K, typename Q >
struct Kalmar::index_helper
 
template<int K, typename Q1 , typename Q2 >
struct Kalmar::amp_helper
 

Detailed Description

template<int N>
class hc::extent< N >

Represents a unique position in N-dimensional space.

Template Parameters
NThe dimension to this extent applies. Special constructors are supplied for the cases where $N \in \{ 1,2,3 \}$, but N can be any integer greater than or equal to 1.

Constructor & Destructor Documentation

template<int N>
hc::extent< N >::extent ( )
inline

Default constructor.

The value at each dimension is initialized to zero. Thus, "extent<3> ix;" initializes the variable to the position (0,0,0).

Referenced by hc::array< T, N >::operator=(), hc::array_view< T, N >::operator=(), and hc::array_view< const T, N >::operator=().

template<int N>
hc::extent< N >::extent ( const extent< N > &  other)
inline

Copy constructor.

Constructs a new extent<N> from the supplied argument.

Parameters
otherAn object of type extent<N> from which to initialize this new extent.
template<int N>
hc::extent< N >::extent ( int  e0)
inlineexplicit

Constructs an extent<N> with the coordinate values provided by $e_{0..2}$.

These are specialized constructors that are only valid when the rank of the extent $N \in \{1,2,3\}$. Invoking a specialized constructor whose argument $count \ne N$ will result in a compilation error.

Parameters
[in]e0The component values of the extent vector.
template<int N>
template<typename... _Tp>
hc::extent< N >::extent ( _Tp...  __t)
inlineexplicit

Constructs an extent<N> with the coordinate values provided by $e_{0..2}$.

These are specialized constructors that are only valid when the rank of the extent $N \in \{1,2,3\}$. Invoking a specialized constructor whose argument $count \ne N$ will result in a compilation error.

Parameters
[in]e0The component values of the extent vector.
template<int N>
hc::extent< N >::extent ( const int  components[])
inlineexplicit

Constructs an extent<N> with the coordinate values provided the array of int component values.

If the coordinate array length $\ne$ N, the behavior is undefined. If the array value is NULL or not a valid pointer, the behavior is undefined.

Parameters
[in]componentsAn array of N int values.
template<int N>
hc::extent< N >::extent ( int  components[])
inlineexplicit

Constructs an extent<N> with the coordinate values provided the array of int component values.

If the coordinate array length $\ne$ N, the behavior is undefined. If the array value is NULL or not a valid pointer, the behavior is undefined.

Parameters
[in]componentsAn array of N int values.

Member Function Documentation

template<int N>
bool hc::extent< N >::contains ( const index< N > &  idx) const
inline

Tests whether the index "idx" is properly contained within this extent (with an assumed origin of zero).

Parameters
[in]idxAn object of type index<N>
Returns
Returns true if the "idx" is contained within the space defined by this extent (with an assumed origin of zero).
template<int N>
bool hc::extent< N >::operator!= ( const extent< N > &  other) const
inline

Compares two objects of extent<N>.

The expression leftExt $\oplus$ rightExt is true if leftExt[i] $\oplus$ rightExt[i] for every i from 0 to N-1.

Parameters
[in]otherThe right-hand extent<N> to be compared.
template<int N>
extent& hc::extent< N >::operator%= ( const extent< N > &  __r)
inline

Adds (or subtracts) an object of type extent<N> from this extent to form a new extent.

The result extent<N> is such that for a given operator $\oplus$, result[i] = this[i] $\oplus$ ext[i]

Parameters
[in]extThe right-hand extent<N> to be added or subtracted.
template<int N>
extent& hc::extent< N >::operator%= ( int  value)
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value.

The return value is "*this".

Parameters
[in]valueThe right-hand int of the arithmetic operation.
template<int N>
extent& hc::extent< N >::operator*= ( const extent< N > &  __r)
inline

Adds (or subtracts) an object of type extent<N> from this extent to form a new extent.

The result extent<N> is such that for a given operator $\oplus$, result[i] = this[i] $\oplus$ ext[i]

Parameters
[in]extThe right-hand extent<N> to be added or subtracted.
template<int N>
extent& hc::extent< N >::operator*= ( int  value)
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value.

The return value is "*this".

Parameters
[in]valueThe right-hand int of the arithmetic operation.
template<int N>
extent hc::extent< N >::operator+ ( const index< N > &  idx)
inline

Adds (or subtracts) an object of type index<N> from this extent to form a new extent.

The result extent<N> is such that for a given operator $\oplus$, result[i] = this[i] $\oplus$ idx[i]

Parameters
[in]idxThe right-hand index<N> to be added or subtracted.
template<int N>
extent& hc::extent< N >::operator++ ( )
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ 1.

For prefix increment and decrement, the return value is "*this". Otherwise a new extent<N> is returned.

template<int N>
extent hc::extent< N >::operator++ ( int  )
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ 1.

For prefix increment and decrement, the return value is "*this". Otherwise a new extent<N> is returned.

template<int N>
extent& hc::extent< N >::operator+= ( const extent< N > &  __r)
inline

Adds (or subtracts) an object of type extent<N> from this extent to form a new extent.

The result extent<N> is such that for a given operator $\oplus$, result[i] = this[i] $\oplus$ ext[i]

Parameters
[in]extThe right-hand extent<N> to be added or subtracted.
template<int N>
extent& hc::extent< N >::operator+= ( const index< N > &  idx)
inline

Adds (or subtracts) an object of type index<N> from this extent to form a new extent.

The result extent<N> is such that for a given operator $\oplus$, result[i] = this[i] $\oplus$ idx[i]

Parameters
[in]idxThe right-hand index<N> to be added or subtracted.
template<int N>
extent& hc::extent< N >::operator+= ( int  value)
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value.

The return value is "*this".

Parameters
[in]valueThe right-hand int of the arithmetic operation.
template<int N>
extent hc::extent< N >::operator- ( const index< N > &  idx)
inline

Adds (or subtracts) an object of type index<N> from this extent to form a new extent.

The result extent<N> is such that for a given operator $\oplus$, result[i] = this[i] $\oplus$ idx[i]

Parameters
[in]idxThe right-hand index<N> to be added or subtracted.
template<int N>
extent& hc::extent< N >::operator-- ( )
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ 1.

For prefix increment and decrement, the return value is "*this". Otherwise a new extent<N> is returned.

template<int N>
extent hc::extent< N >::operator-- ( int  )
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ 1.

For prefix increment and decrement, the return value is "*this". Otherwise a new extent<N> is returned.

template<int N>
extent& hc::extent< N >::operator-= ( const extent< N > &  __r)
inline

Adds (or subtracts) an object of type extent<N> from this extent to form a new extent.

The result extent<N> is such that for a given operator $\oplus$, result[i] = this[i] $\oplus$ ext[i]

Parameters
[in]extThe right-hand extent<N> to be added or subtracted.
template<int N>
extent& hc::extent< N >::operator-= ( const index< N > &  idx)
inline

Adds (or subtracts) an object of type index<N> from this extent to form a new extent.

The result extent<N> is such that for a given operator $\oplus$, result[i] = this[i] $\oplus$ idx[i]

Parameters
[in]idxThe right-hand index<N> to be added or subtracted.
template<int N>
extent& hc::extent< N >::operator-= ( int  value)
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value.

The return value is "*this".

Parameters
[in]valueThe right-hand int of the arithmetic operation.
template<int N>
extent& hc::extent< N >::operator/= ( const extent< N > &  __r)
inline

Adds (or subtracts) an object of type extent<N> from this extent to form a new extent.

The result extent<N> is such that for a given operator $\oplus$, result[i] = this[i] $\oplus$ ext[i]

Parameters
[in]extThe right-hand extent<N> to be added or subtracted.
template<int N>
extent& hc::extent< N >::operator/= ( int  value)
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value.

The return value is "*this".

Parameters
[in]valueThe right-hand int of the arithmetic operation.
template<int N>
extent& hc::extent< N >::operator= ( const extent< N > &  other)
inline

Assigns the component values of "other" to this extent<N> object.

Parameters
[in]otherAn object of type extent<N> from which to copy into this extent.
Returns
Returns *this.
template<int N>
bool hc::extent< N >::operator== ( const extent< N > &  other) const
inline

Compares two objects of extent<N>.

The expression leftExt $\oplus$ rightExt is true if leftExt[i] $\oplus$ rightExt[i] for every i from 0 to N-1.

Parameters
[in]otherThe right-hand extent<N> to be compared.
template<int N>
int hc::extent< N >::operator[] ( unsigned int  c) const
inline

Returns the extent component value at position c.

Parameters
[in]cThe dimension axis whose coordinate is to be accessed.
Returns
A the component value at position c.
template<int N>
int& hc::extent< N >::operator[] ( unsigned int  c)
inline

Returns the extent component value at position c.

Parameters
[in]cThe dimension axis whose coordinate is to be accessed.
Returns
A the component value at position c.
template<int N>
unsigned int hc::extent< N >::size ( ) const
inline
template<int N>
tiled_extent< 1 > hc::extent< N >::tile ( int  t0) const
inline

Produces a tiled_extent object with the tile extents given by t0, t1, and t2.

tile(t0, t1, t2) is only supported on extent<1>. It will produce a compile-time error if used on an extent where N $\ne$ 3. tile(t0, t1) is only supported on extent<2>. It will produce a compile-time error if used on an extent where N $\ne$ 2. tile(t0) is only supported on extent<1>. It will produce a compile-time error if used on an extent where N $\ne$ 1.

template<int N>
tiled_extent< 2 > hc::extent< N >::tile ( int  t0,
int  t1 
) const
inline

Produces a tiled_extent object with the tile extents given by t0, t1, and t2.

tile(t0, t1, t2) is only supported on extent<1>. It will produce a compile-time error if used on an extent where N $\ne$ 3. tile(t0, t1) is only supported on extent<2>. It will produce a compile-time error if used on an extent where N $\ne$ 2. tile(t0) is only supported on extent<1>. It will produce a compile-time error if used on an extent where N $\ne$ 1.

template<int N>
tiled_extent< 3 > hc::extent< N >::tile ( int  t0,
int  t1,
int  t2 
) const
inline

Produces a tiled_extent object with the tile extents given by t0, t1, and t2.

tile(t0, t1, t2) is only supported on extent<1>. It will produce a compile-time error if used on an extent where N $\ne$ 3. tile(t0, t1) is only supported on extent<2>. It will produce a compile-time error if used on an extent where N $\ne$ 2. tile(t0) is only supported on extent<1>. It will produce a compile-time error if used on an extent where N $\ne$ 1.


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