Extended CUDA Library (ecuda)  2.0
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
Public Types | Public Member Functions | Friends | List of all members
ecuda::cube< T, Alloc, P > Class Template Reference

A resizable cube stored in device memory. More...

#include <cube.hpp>

Inheritance diagram for ecuda::cube< T, Alloc, P >:

Public Types

typedef base_type::value_type value_type
 cell data type More...
 
typedef Alloc allocator_type
 allocator type More...
 
typedef base_type::size_type size_type
 unsigned integral type More...
 
typedef base_type::difference_type difference_type
 signed integral type More...
 
typedef base_type::reference reference
 cell reference type More...
 
typedef base_type::const_reference const_reference
 cell const reference type More...
 
typedef base_type::pointer pointer
 cell pointer type More...
 
typedef make_const< pointer >::type const_pointer
 cell const pointer type More...
 
typedef model::device_sequence
< value_type,
striding_padded_ptr
< value_type, typename
ecuda::add_pointer< value_type >
::type > > 
row_type
 cube row container type More...
 
typedef model::device_sequence
< value_type,
striding_padded_ptr
< value_type, typename
ecuda::add_pointer< value_type >
::type > > 
column_type
 cube column container type More...
 
typedef
model::device_contiguous_sequence
< value_type
depth_type
 cube depth container type More...
 
typedef model::device_sequence
< const value_type,
striding_padded_ptr< const
value_type, typename
ecuda::add_pointer< const
value_type >::type > > 
const_row_type
 cube const row container type More...
 
typedef model::device_sequence
< const value_type,
striding_padded_ptr< const
value_type, typename
ecuda::add_pointer< const
value_type >::type > > 
const_column_type
 cube const column container type More...
 
typedef
model::device_contiguous_sequence
< const value_type
const_depth_type
 cube const depth container type More...
 
typedef base_type::iterator iterator
 iterator type More...
 
typedef base_type::const_iterator const_iterator
 const iterator type More...
 
typedef base_type::reverse_iterator reverse_iterator
 reverse iterator type More...
 
typedef
base_type::const_reverse_iterator 
const_reverse_iterator
 const reverse iterator type More...
 
typedef model::device_matrix
< value_type,
striding_padded_ptr
< value_type, typename
ecuda::add_pointer< value_type >
::type > > 
slice_xy_type
 xy section of a cube at a fixed depth More...
 
typedef
model::device_contiguous_row_matrix
< value_type, typename
ecuda::add_pointer< value_type >
::type > 
slice_xz_type
 xz section of a cube at a fixed column More...
 
typedef
model::device_contiguous_row_matrix
< value_type, typename
ecuda::add_pointer< value_type >
::type > 
slice_yz_type
 yz section of a cube at a fixed row More...
 
typedef model::device_matrix
< const value_type,
striding_padded_ptr< const
value_type, typename
ecuda::add_pointer< const
value_type >::type > > 
const_slice_xy_type
 xy section of a cube at a fixed depth More...
 
typedef
model::device_contiguous_row_matrix
< const value_type, typename
ecuda::add_pointer< const
value_type >::type > 
const_slice_xz_type
 const xz section of a cube at a fixed row More...
 
typedef
model::device_contiguous_row_matrix
< const value_type, typename
ecuda::add_pointer< const
value_type >::type > 
const_slice_yz_type
 const yz section of a cube at a fixed row More...
 
typedef
impl::cube_kernel_argument< T,
Alloc > 
kernel_argument
 kernel argument type More...
 
typedef const
impl::cube_kernel_argument< T,
Alloc > 
const_kernel_argument
 const kernel argument type More...
 

Public Member Functions

__HOST__ cube (const size_type numberRows=0, const size_type numberColumns=0, const size_type numberDepths=0, const value_type &value=value_type(), const Alloc &allocator=Alloc())
 Constructs a cube with dimensions numberRows x numberColumns x numberDepths filled with copies of elements with value value. More...
 
__HOST__ cube (const cube &src)
 Copy constructor. More...
 
__HOST__ cube (const cube &src, const allocator_type &alloc)
 Copy constructor. More...
 
__HOST__ cubeoperator= (const cube &src)
 
__HOST__ allocator_type get_allocator () const
 Returns the allocator associated with the container. More...
 
__HOST__ __DEVICE__ size_type number_rows () const __NOEXCEPT__
 Returns the number of rows in the container. More...
 
__HOST__ __DEVICE__ size_type number_columns () const __NOEXCEPT__
 Returns the number of columns in the container. More...
 
__HOST__ __DEVICE__ size_type number_depths () const __NOEXCEPT__
 Returns the number of depths in the container. More...
 
__HOST__ __DEVICE__ size_type size () const __NOEXCEPT__
 Returns the number of elements in the container. More...
 
__HOST__ __DEVICE__ bool empty () const __NOEXCEPT__
 Checks if the container has no elements. More...
 
__HOST__ __DEVICE__ pointer data () __NOEXCEPT__
 Returns pointer to the underlying 2D memory serving as element storage. More...
 
__HOST__ __DEVICE__ const_pointer data () const __NOEXCEPT__
 Returns pointer to the underlying 2D memory serving as element storage. More...
 
__HOST__ __DEVICE__ iterator begin () __NOEXCEPT__
 Returns an iterator to the first element of the container. More...
 
__HOST__ __DEVICE__ iterator end () __NOEXCEPT__
 Returns an iterator to the element following the last element of the container. More...
 
__HOST__ __DEVICE__ const_iterator begin () const __NOEXCEPT__
 Returns an iterator to the first element of the container. More...
 
__HOST__ __DEVICE__ const_iterator end () const __NOEXCEPT__
 Returns an iterator to the element following the last element of the container. More...
 
__HOST__ __DEVICE__
reverse_iterator 
rbegin () __NOEXCEPT__
 Returns a reverse iterator to the first element of the reversed container. More...
 
__HOST__ __DEVICE__
reverse_iterator 
rend () __NOEXCEPT__
 Returns a reverse iterator to the element following the last element of the reversed container. More...
 
__HOST__ __DEVICE__
const_reverse_iterator 
rbegin () const __NOEXCEPT__
 Returns a reverse iterator to the first element of the reversed container. More...
 
__HOST__ __DEVICE__
const_reverse_iterator 
rend () const __NOEXCEPT__
 Returns a reverse iterator to the element following the last element of the reversed container. More...
 
__HOST__ __DEVICE__ row_type get_row (const size_type columnIndex, const size_type depthIndex)
 Gets a view of the sequence of elements forming a single row. More...
 
__HOST__ __DEVICE__ column_type get_column (const size_type rowIndex, const size_type depthIndex)
 Gets a view of the sequence of elements forming a single column. More...
 
__HOST__ __DEVICE__ depth_type get_depth (const size_type rowIndex, const size_type columnIndex)
 Gets a view of the sequence of elements forming a single depth. More...
 
__HOST__ __DEVICE__ const_row_type get_row (const size_type columnIndex, const size_type depthIndex) const
 Gets a view of the sequence of elements forming a single row. More...
 
__HOST__ __DEVICE__
const_column_type 
get_column (const size_type rowIndex, const size_type depthIndex) const
 Gets a view of the sequence of elements forming a single column. More...
 
__HOST__ __DEVICE__
const_depth_type 
get_depth (const size_type rowIndex, const size_type columnIndex) const
 Gets a view of the sequence of elements forming a single depth. More...
 
__HOST__ __DEVICE__ slice_yz_type get_yz (const size_type rowIndex)
 Gets a view of the matrix of elements at a single row. More...
 
__HOST__ __DEVICE__ slice_xy_type get_xy (const size_type depthIndex)
 Gets a view of the matrix of elements at a single depth. More...
 
__HOST__ __DEVICE__ slice_xz_type get_xz (const size_type columnIndex)
 Gets a view of the matrix of elements at a single column. More...
 
__HOST__ __DEVICE__
const_slice_yz_type 
get_yz (const size_type rowIndex) const
 Gets a view of the matrix of elements at a single row. More...
 
__HOST__ __DEVICE__
const_slice_xy_type 
get_xy (const size_type depthIndex) const
 Gets a view of the matrix of elements at a single depth. More...
 
__HOST__ __DEVICE__
const_slice_xz_type 
get_xz (const size_type columnIndex) const
 Gets a view of the matrix of elements at a single column. More...
 
__DEVICE__ reference at (size_type rowIndex, size_type columnIndex, size_type depthIndex)
 Returns a reference to the element at specified row, column, and depth index, with bounds checking. More...
 
__DEVICE__ const_reference at (size_type rowIndex, size_type columnIndex, size_type depthIndex) const
 Returns a constant reference to the element at specified row, column, and depth index, with bounds checking. More...
 
__DEVICE__ reference operator() (const size_type rowIndex, const size_type columnIndex, const size_type depthIndex)
 Returns a reference to the element at specified location index. No bounds checking is performed. More...
 
__DEVICE__ const_reference operator() (const size_type rowIndex, const size_type columnIndex, const size_type depthIndex) const
 Returns a reference to the element at specified location index. No bounds checking is performed. More...
 
__HOST__ __DEVICE__ slice_yz_type operator[] (const size_type rowIndex)
 operator[](rowIndex) alias for get_yz(rowIndex) More...
 
__HOST__ __DEVICE__
const_slice_yz_type 
operator[] (const size_type rowIndex) const
 operator[](rowIndex) alias for get_yz(rowIndex) More...
 
__HOST__ void resize (const size_type newNumberRows, const size_type newNumberColumns, const size_type newNumberDepths, const value_type &value=value_type())
 Resizes the container to have dimensions newNumberRows x newNumberColumns x newNumberDepths. More...
 
__HOST__ __DEVICE__ void fill (const value_type &value)
 Assigns a given value to all elements in the container. More...
 

Friends

template<typename U , class Alloc2 , class Q >
class cube
 

Detailed Description

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
class ecuda::cube< T, Alloc, P >

A resizable cube stored in device memory.

A cube is defined as a 3D structure of dimensions rows*columns*depths. The default implementation uses pitched memory where a 2D block of video memory is allocated with width=depths and height=rows*columns. Pitched memory is aligned in a device-dependent manner so that calls to individual elements can be threaded more efficiently (i.e. minimizing the number of read operations required to supply data to multiple threads). Consult the CUDA API documentation for a more verbose explanation.

Methods are prefaced with appropriate keywords to declare them as host and/or device capable. In general: operations requiring memory allocation/deallocation are host only, operations to access the values of specific elements are device only, and copy operations on ranges of data and accessors of general information can be performed on both the host and device.

Memory use can be conceptualized as:

|- depths -|
|---- pitch ----|
_ _ +----------+----+
| | | |xxxx|
| columns | |xxxx| x = allocated but not used, just padding to
| |_ | |xxxx| enforce an efficient memory alignment
rows | |xxxx|
| | |xxxx|
| | |xxxx|
|_ +----------+----+

As a result, it is highly desirable for threading to utilize a depth-wise orientation. For example, a good kernel to perform an operation on the elements of a cube might be:

template<typename T> __global__ void doCubeOperation( typename ecuda::cube<T>::kernel_argument cube )
{
const int dep = blockDim.x*gridDim.x; // each thread gets a different depth value
const int row = blockIdx.y;
const int col = blockIdx.z;
if( row < cube.number_rows() && col < cube.number_columns() && dep < cube.number_depths() ) {
T& value = cube(row,col,dep);
// ... do work on value
}
}

This could be called from host code like:

ecuda::cube<double> cube( 10, 20, 1000 );
// ... fill cube with data
dim3 grid( 1, 10, 20 ), block( 1000, 1, 1 );
doCubeOperation<<<grid,block>>>( cube );

Unfortunately, CUDA solutions are very problem specific, so there is no generally applicable example for specifying how thread blocks should be defined. The size of the cube, hardware limitations, CUDA API limitations, etc. all play a part. For example, the above implementation won't work in earlier versions of CUDA when blockDim.x was limited to 512 (at the time of this writing it was 1024 in the newer versions of CUDA).

Just keep in mind that the depth dimension lies in contiguous memory, the column dimension is contiguous blocks of depth blocks, and the row dimension is contiguous blocks of column blocks; thus, an implementation that aims to have concurrently running threads accessing depth >>> column > row will run much more efficiently.

Definition at line 129 of file cube.hpp.

Member Typedef Documentation

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
typedef Alloc ecuda::cube< T, Alloc, P >::allocator_type

allocator type

Definition at line 136 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
typedef model::device_sequence< value_type, striding_padded_ptr<value_type,typename ecuda::add_pointer<value_type>::type> > ecuda::cube< T, Alloc, P >::column_type

cube column container type

Definition at line 145 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
typedef model::device_sequence< const value_type, striding_padded_ptr<const value_type,typename ecuda::add_pointer<const value_type>::type> > ecuda::cube< T, Alloc, P >::const_column_type

cube const column container type

Definition at line 148 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
typedef model::device_contiguous_sequence<const value_type > ecuda::cube< T, Alloc, P >::const_depth_type

cube const depth container type

Definition at line 149 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
typedef base_type::const_iterator ecuda::cube< T, Alloc, P >::const_iterator

const iterator type

Definition at line 152 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
typedef const impl::cube_kernel_argument<T,Alloc> ecuda::cube< T, Alloc, P >::const_kernel_argument

const kernel argument type

Definition at line 164 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
typedef make_const<pointer>::type ecuda::cube< T, Alloc, P >::const_pointer

cell const pointer type

Definition at line 142 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
typedef base_type::const_reference ecuda::cube< T, Alloc, P >::const_reference

cell const reference type

Definition at line 140 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
typedef base_type::const_reverse_iterator ecuda::cube< T, Alloc, P >::const_reverse_iterator

const reverse iterator type

Definition at line 154 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
typedef model::device_sequence< const value_type, striding_padded_ptr<const value_type,typename ecuda::add_pointer<const value_type>::type> > ecuda::cube< T, Alloc, P >::const_row_type

cube const row container type

Definition at line 147 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
typedef model::device_matrix< const value_type, striding_padded_ptr<const value_type,typename ecuda::add_pointer<const value_type>::type> > ecuda::cube< T, Alloc, P >::const_slice_xy_type

xy section of a cube at a fixed depth

Definition at line 159 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
typedef model::device_contiguous_row_matrix< const value_type, typename ecuda::add_pointer<const value_type>::type > ecuda::cube< T, Alloc, P >::const_slice_xz_type

const xz section of a cube at a fixed row

Definition at line 160 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
typedef model::device_contiguous_row_matrix< const value_type, typename ecuda::add_pointer<const value_type>::type > ecuda::cube< T, Alloc, P >::const_slice_yz_type

const yz section of a cube at a fixed row

Definition at line 161 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
typedef model::device_contiguous_sequence<value_type > ecuda::cube< T, Alloc, P >::depth_type

cube depth container type

Definition at line 146 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
typedef base_type::difference_type ecuda::cube< T, Alloc, P >::difference_type

signed integral type

Definition at line 138 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
typedef base_type::iterator ecuda::cube< T, Alloc, P >::iterator

iterator type

Definition at line 151 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
typedef impl::cube_kernel_argument<T,Alloc> ecuda::cube< T, Alloc, P >::kernel_argument

kernel argument type

Definition at line 163 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
typedef base_type::pointer ecuda::cube< T, Alloc, P >::pointer

cell pointer type

Definition at line 141 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
typedef base_type::reference ecuda::cube< T, Alloc, P >::reference

cell reference type

Definition at line 139 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
typedef base_type::reverse_iterator ecuda::cube< T, Alloc, P >::reverse_iterator

reverse iterator type

Definition at line 153 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
typedef model::device_sequence< value_type, striding_padded_ptr<value_type,typename ecuda::add_pointer<value_type>::type> > ecuda::cube< T, Alloc, P >::row_type

cube row container type

Definition at line 144 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
typedef base_type::size_type ecuda::cube< T, Alloc, P >::size_type

unsigned integral type

Definition at line 137 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
typedef model::device_matrix< value_type, striding_padded_ptr<value_type,typename ecuda::add_pointer<value_type>::type> > ecuda::cube< T, Alloc, P >::slice_xy_type

xy section of a cube at a fixed depth

Definition at line 156 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
typedef model::device_contiguous_row_matrix< value_type, typename ecuda::add_pointer<value_type>::type > ecuda::cube< T, Alloc, P >::slice_xz_type

xz section of a cube at a fixed column

Definition at line 157 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
typedef model::device_contiguous_row_matrix< value_type, typename ecuda::add_pointer<value_type>::type > ecuda::cube< T, Alloc, P >::slice_yz_type

yz section of a cube at a fixed row

Definition at line 158 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
typedef base_type::value_type ecuda::cube< T, Alloc, P >::value_type

cell data type

Definition at line 135 of file cube.hpp.

Constructor & Destructor Documentation

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ ecuda::cube< T, Alloc, P >::cube ( const size_type  numberRows = 0,
const size_type  numberColumns = 0,
const size_type  numberDepths = 0,
const value_type value = value_type(),
const Alloc &  allocator = Alloc() 
)
inline

Constructs a cube with dimensions numberRows x numberColumns x numberDepths filled with copies of elements with value value.

Parameters
numberRowsnumber of rows (default=0)
numberColumnsnumber of columns (default=0)
numberDepthsnumber of depths (default=0)
valuevalue that cube elements should initially be set to (default=value_type())
allocatorallocator to use for all memory allocations of this container (does not normally need to be specified, by default the internal ecuda pitched memory allocator)

Definition at line 213 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ ecuda::cube< T, Alloc, P >::cube ( const cube< T, Alloc, P > &  src)
inline

Copy constructor.

Constructs a cube with a copy of the contents of src.

Parameters
srcAnother cube object of the same type and dimensions, whose contents are copied.

Definition at line 230 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ ecuda::cube< T, Alloc, P >::cube ( const cube< T, Alloc, P > &  src,
const allocator_type alloc 
)
inline

Copy constructor.

Constructs a cube with a copy of the contents of src.

Parameters
srcAnother cube object of the same type and dimensions, whose contents are copied.
allocAllocator to use for all memory allocations of this container.

Definition at line 248 of file cube.hpp.

Member Function Documentation

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__DEVICE__ reference ecuda::cube< T, Alloc, P >::at ( size_type  rowIndex,
size_type  columnIndex,
size_type  depthIndex 
)
inline

Returns a reference to the element at specified row, column, and depth index, with bounds checking.

If the row, column, and depth are not within the range of the container, the current kernel will exit and cudaGetLastError will return cudaErrorUnknown.

Parameters
rowIndexposition of the row to return
columnIndexposition of the column to return
depthIndexposition of the depth to return
Returns
Reference to the requested element.

Definition at line 618 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__DEVICE__ const_reference ecuda::cube< T, Alloc, P >::at ( size_type  rowIndex,
size_type  columnIndex,
size_type  depthIndex 
) const
inline

Returns a constant reference to the element at specified row, column, and depth index, with bounds checking.

If the row, column, and depth are not within the range of the container, the current kernel will exit and cudaGetLastError will return cudaErrorUnknown.

Parameters
rowIndexposition of the row to return
columnIndexposition of the column to return
depthIndexposition of the depth to return
Returns
Reference to the requested element.

Definition at line 645 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ iterator ecuda::cube< T, Alloc, P >::begin ( )
inline

Returns an iterator to the first element of the container.

If the container is empty, the returned iterator will be equal to end().

Returns
Iterator to the first element.

Definition at line 347 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ const_iterator ecuda::cube< T, Alloc, P >::begin ( ) const
inline

Returns an iterator to the first element of the container.

If the container is empty, the returned iterator will be equal to end().

Returns
Iterator to the first element.

Definition at line 365 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ pointer ecuda::cube< T, Alloc, P >::data ( )
inline

Returns pointer to the underlying 2D memory serving as element storage.

Returns
Pointer to the underlying element storage.

Definition at line 331 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ const_pointer ecuda::cube< T, Alloc, P >::data ( ) const
inline

Returns pointer to the underlying 2D memory serving as element storage.

Returns
Pointer to the underlying element storage.

Definition at line 338 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ bool ecuda::cube< T, Alloc, P >::empty ( ) const
inline

Checks if the container has no elements.

Returns
true if the container is empty, false otherwise.

Definition at line 324 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ iterator ecuda::cube< T, Alloc, P >::end ( )
inline

Returns an iterator to the element following the last element of the container.

The element acts as a placeholder; attempting to access it results in undefined behaviour.

Returns
Iterator to the element following the last element.

Definition at line 356 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ const_iterator ecuda::cube< T, Alloc, P >::end ( ) const
inline

Returns an iterator to the element following the last element of the container.

The element acts as a placeholder; attempting to access it results in undefined behaviour.

Returns
Iterator to the element following the last element.

Definition at line 374 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ void ecuda::cube< T, Alloc, P >::fill ( const value_type value)
inline

Assigns a given value to all elements in the container.

Parameters
valuethe value to assign to the elements

Definition at line 729 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ allocator_type ecuda::cube< T, Alloc, P >::get_allocator ( ) const
inline

Returns the allocator associated with the container.

Returns
The associated allocator.

Definition at line 288 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ column_type ecuda::cube< T, Alloc, P >::get_column ( const size_type  rowIndex,
const size_type  depthIndex 
)
inline

Gets a view of the sequence of elements forming a single column.

Parameters
rowIndexthe row to fix the view on
depthIndexthe depth to fix the view on
Returns
A view of the elements with the specified row and depth indices.

Definition at line 445 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ const_column_type ecuda::cube< T, Alloc, P >::get_column ( const size_type  rowIndex,
const size_type  depthIndex 
) const
inline

Gets a view of the sequence of elements forming a single column.

Parameters
rowIndexthe row to fix the view on
depthIndexthe depth to fix the view on
Returns
A view of the elements with the specified row and depth indices.

Definition at line 494 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ depth_type ecuda::cube< T, Alloc, P >::get_depth ( const size_type  rowIndex,
const size_type  columnIndex 
)
inline

Gets a view of the sequence of elements forming a single depth.

Parameters
rowIndexthe row to fix the view on
columnIndexthe column to fix the view on
Returns
A view of the elements with the specified row and column indices.

Definition at line 462 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ const_depth_type ecuda::cube< T, Alloc, P >::get_depth ( const size_type  rowIndex,
const size_type  columnIndex 
) const
inline

Gets a view of the sequence of elements forming a single depth.

Parameters
rowIndexthe row to fix the view on
columnIndexthe column to fix the view on
Returns
A view of the elements with the specified row and column indices.

Definition at line 511 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ row_type ecuda::cube< T, Alloc, P >::get_row ( const size_type  columnIndex,
const size_type  depthIndex 
)
inline

Gets a view of the sequence of elements forming a single row.

Parameters
columnIndexthe column to fix the view on
depthIndexthe depth to fix the view on
Returns
A view of the elements with the specified column and depth indices.

Definition at line 428 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ const_row_type ecuda::cube< T, Alloc, P >::get_row ( const size_type  columnIndex,
const size_type  depthIndex 
) const
inline

Gets a view of the sequence of elements forming a single row.

Parameters
columnIndexthe column to fix the view on
depthIndexthe depth to fix the view on
Returns
A view of the elements with the specified column and depth indices.

Definition at line 477 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ slice_xy_type ecuda::cube< T, Alloc, P >::get_xy ( const size_type  depthIndex)
inline

Gets a view of the matrix of elements at a single depth.

Parameters
depthIndexthe depth to fix the view on
Returns
A view of the elements at the specified depth.

Definition at line 539 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ const_slice_xy_type ecuda::cube< T, Alloc, P >::get_xy ( const size_type  depthIndex) const
inline

Gets a view of the matrix of elements at a single depth.

Parameters
depthIndexthe depth to fix the view on
Returns
A view of the elements at the specified depth.

Definition at line 583 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ slice_xz_type ecuda::cube< T, Alloc, P >::get_xz ( const size_type  columnIndex)
inline

Gets a view of the matrix of elements at a single column.

Parameters
columnIndexthe column to fix the view on
Returns
A view of the elements at the specified column.

Definition at line 554 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ const_slice_xz_type ecuda::cube< T, Alloc, P >::get_xz ( const size_type  columnIndex) const
inline

Gets a view of the matrix of elements at a single column.

Parameters
columnIndexthe column to fix the view on
Returns
A view of the elements at the specified column.

Definition at line 598 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ slice_yz_type ecuda::cube< T, Alloc, P >::get_yz ( const size_type  rowIndex)
inline

Gets a view of the matrix of elements at a single row.

Parameters
rowIndexthe row to fix the view on
Returns
A view of the elements at the specified row.

Definition at line 525 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ const_slice_yz_type ecuda::cube< T, Alloc, P >::get_yz ( const size_type  rowIndex) const
inline

Gets a view of the matrix of elements at a single row.

Parameters
rowIndexthe row to fix the view on
Returns
A view of the elements at the specified row.

Definition at line 569 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ size_type ecuda::cube< T, Alloc, P >::number_columns ( ) const
inline

Returns the number of columns in the container.

Returns
The number of columns in the container.

Definition at line 302 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ size_type ecuda::cube< T, Alloc, P >::number_depths ( ) const
inline

Returns the number of depths in the container.

Returns
The number of depths in the container.

Definition at line 309 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ size_type ecuda::cube< T, Alloc, P >::number_rows ( ) const
inline

Returns the number of rows in the container.

Returns
The number of rows in the container.

Definition at line 295 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__DEVICE__ reference ecuda::cube< T, Alloc, P >::operator() ( const size_type  rowIndex,
const size_type  columnIndex,
const size_type  depthIndex 
)
inline

Returns a reference to the element at specified location index. No bounds checking is performed.

This is identical to at() but no bounds checking is performed.

Parameters
rowIndexrow of the element to return
columnIndexcolumn of the element to return
depthIndexdepth of the element to return
Returns
Reference to the requested element.

Definition at line 671 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__DEVICE__ const_reference ecuda::cube< T, Alloc, P >::operator() ( const size_type  rowIndex,
const size_type  columnIndex,
const size_type  depthIndex 
) const
inline

Returns a reference to the element at specified location index. No bounds checking is performed.

This is identical to at() but no bounds checking is performed.

Parameters
rowIndexrow of the element to return
columnIndexcolumn of the element to return
depthIndexdepth of the element to return
Returns
Reference to the requested element.

Definition at line 683 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ cube& ecuda::cube< T, Alloc, P >::operator= ( const cube< T, Alloc, P > &  src)
inline

Definition at line 257 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ slice_yz_type ecuda::cube< T, Alloc, P >::operator[] ( const size_type  rowIndex)
inline

operator[](rowIndex) alias for get_yz(rowIndex)

Parameters
rowIndexindex of the YZ-slice to isolate
Returns
view object for the specified row

Definition at line 690 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ const_slice_yz_type ecuda::cube< T, Alloc, P >::operator[] ( const size_type  rowIndex) const
inline

operator[](rowIndex) alias for get_yz(rowIndex)

Parameters
rowIndexindex of the YZ-slice to isolate
Returns
view object for the specified row

Definition at line 697 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ reverse_iterator ecuda::cube< T, Alloc, P >::rbegin ( )
inline

Returns a reverse iterator to the first element of the reversed container.

It corresponds to the last element of the non-reversed container.

Returns
Reverse iterator to the first element.

Definition at line 383 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ const_reverse_iterator ecuda::cube< T, Alloc, P >::rbegin ( ) const
inline

Returns a reverse iterator to the first element of the reversed container.

It corresponds to the last element of the non-reversed container.

Returns
Reverse iterator to the first element.

Definition at line 402 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ reverse_iterator ecuda::cube< T, Alloc, P >::rend ( )
inline

Returns a reverse iterator to the element following the last element of the reversed container.

It corresponds to the element preceding the first element of the non-reversed container. This element acts as a placeholder, attempting to access it results in undefined behaviour.

Returns
Reverse iterator to the element following the last element.

Definition at line 393 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ const_reverse_iterator ecuda::cube< T, Alloc, P >::rend ( ) const
inline

Returns a reverse iterator to the element following the last element of the reversed container.

It corresponds to the element preceding the first element of the non-reversed container. This element acts as a placeholder, attempting to access it results in undefined behaviour.

Returns
Reverse iterator to the element following the last element.

Definition at line 412 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ void ecuda::cube< T, Alloc, P >::resize ( const size_type  newNumberRows,
const size_type  newNumberColumns,
const size_type  newNumberDepths,
const value_type value = value_type() 
)
inline

Resizes the container to have dimensions newNumberRows x newNumberColumns x newNumberDepths.

If the current size is greater in any dimension, the existing elements are truncated.

Parameters
newNumberRowsnew number of rows
newNumberColumnsnew number of columns
newNumberDepthsnew number of depths
valuethe value to initialize the new elements with (default constructed if not specified)

Definition at line 709 of file cube.hpp.

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
__HOST__ __DEVICE__ size_type ecuda::cube< T, Alloc, P >::size ( ) const
inline

Returns the number of elements in the container.

This is the rows x columns x depths.

Returns
The number of elements in the container.

Definition at line 318 of file cube.hpp.

Friends And Related Function Documentation

template<typename T, class Alloc = device_pitch_allocator<T>, class P = shared_ptr<T>>
template<typename U , class Alloc2 , class Q >
friend class cube
friend

Definition at line 170 of file cube.hpp.


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