Hex  1.0
Hydrogen-electron collision solver
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Data Fields
CLArray< T, Alloc > Class Template Reference

OpenCL array wrapper. More...

#include <opencl.h>

Inheritance diagram for CLArray< T, Alloc >:
Inheritance graph
[legend]
Collaboration diagram for CLArray< T, Alloc >:
Collaboration graph
[legend]

Public Types

typedef T DataType
 
typedef T * iterator
 
typedef T const * const_iterator
 
- Public Types inherited from CLArrayView< T >
typedef T DataType
 
typedef T * iterator
 
typedef T const * const_iterator
 
- Public Types inherited from ArrayView< T >
typedef T DataType
 
typedef T * iterator
 
typedef T const * const_iterator
 

Public Member Functions

 CLArray ()
 
 Alloc::alloc (n))
 
 CLArray (ArrayView< T > v, size_t i=0, size_t n=0)
 
 CLArray (std::initializer_list< T > list)
 
 CLArray (CLArray< T, Alloc > &&rvrf)
 
virtual ~CLArray ()
 
size_t size () const
 
T const & operator[] (size_t i) const
 
T & operator[] (size_t i)
 
T const * data () const
 
T * data ()
 Pointer to the data. More...
 
const_iterator begin () const
 
iterator begin ()
 
const_iterator end () const
 
iterator end ()
 
T const & front (size_t i=0) const
 
T & front (size_t i=0)
 
T const & back (size_t i=0) const
 
T & back (size_t i=0)
 
bool is_connected () const
 
void connect (cl_context context, cl_mem_flags flags=CL_MEM_COPY_HOST_PTR|CL_MEM_READ_WRITE)
 
void disconnect ()
 
cl_int EnqueueDownload (cl_command_queue queue)
 
cl_int EnqueueUpload (cl_command_queue queue)
 
cl_mem const & handle () const
 
- Public Member Functions inherited from CLArrayView< T >
 CLArrayView ()
 
 CLArrayView (size_t n, T const *ptr)
 
 CLArrayView (ArrayView< T > v, size_t i=0, size_t n=0)
 
 CLArrayView (CLArrayView< T > const &v)
 
 CLArrayView (CLArrayView< T > &&v)
 
virtual ~CLArrayView ()
 
size_t size () const
 
T const & operator[] (size_t i) const
 
T & operator[] (size_t i)
 
const_iterator begin () const
 
iterator begin ()
 
const_iterator end () const
 
iterator end ()
 
T const & front (size_t i=0) const
 
T & front (size_t i=0)
 
T const & back (size_t i=0) const
 
T & back (size_t i=0)
 
bool is_connected () const
 
void connect (cl_context context, cl_mem_flags flags)
 
void disconnect ()
 
cl_int EnqueueUpload (cl_command_queue queue)
 
cl_int EnqueueDownload (cl_command_queue queue)
 
cl_mem const & handle () const
 
- Public Member Functions inherited from ArrayView< T >
 ArrayView ()
 
 ArrayView (size_t n, T *ptr)
 
 ArrayView (ArrayView< T > const &a, size_t i=0, size_t n=0)
 
 ArrayView (Array< T > const &a, size_t i=0, size_t n=0)
 
 ArrayView (NumberArray< T > const &a, size_t i=0, size_t n=0)
 
 ArrayView (const_iterator i, const_iterator j)
 
 ArrayView (ArrayView< T > &&r)
 
virtual ~ArrayView ()
 
ArrayView< T > & operator= (const ArrayView< T > v)
 Assignment operator. More...
 
T & operator[] (size_t i)
 Element-wise access (non-const). More...
 
T const & operator[] (size_t i) const
 Element-wise access (const). More...
 
size_t size () const
 Length of the array (number of elements). More...
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
T & front (int i=0)
 
T const & front (int i=0) const
 
T & back (int i=0)
 
T const & back (int i=0) const
 
void fill (T x)
 Fill the array with a value. More...
 
bool empty () const
 Check whether the size is equal to zero. More...
 
template<class = typename std::enable_if<is_scalar<T>::value>>
double norm () const
 Two-norm (defined only for scalar data type). More...
 

Data Fields

 __pad0__: CLArrayView<T>(n
 

Additional Inherited Members

- Protected Attributes inherited from CLArrayView< T >
cl_mem cl_handle_
 Memory handle to the data copy on the GPU. More...
 
- Protected Attributes inherited from ArrayView< T >
size_t N_
 Number of elements in the array. More...
 
T * array_
 Pointer to the array. More...
 

Detailed Description

template<class T, class Alloc = PlainAllocator<T>>
class CLArray< T, Alloc >

This class combines NumberArray<T> and CLArrayView<T>. It is a self-standing array of memory-aligned elements. The alignment is large by default so that the class can be used as the host-type memory within OpenCL. However, the aimed usage is this:

Member Typedef Documentation

template<class T , class Alloc = PlainAllocator<T>>
typedef T const* CLArray< T, Alloc >::const_iterator
template<class T , class Alloc = PlainAllocator<T>>
typedef T CLArray< T, Alloc >::DataType
template<class T , class Alloc = PlainAllocator<T>>
typedef T* CLArray< T, Alloc >::iterator

Constructor & Destructor Documentation

template<class T , class Alloc = PlainAllocator<T>>
CLArray< T, Alloc >::CLArray ( )
inline
template<class T , class Alloc = PlainAllocator<T>>
CLArray< T, Alloc >::CLArray ( ArrayView< T >  v,
size_t  i = 0,
size_t  n = 0 
)
inline
template<class T , class Alloc = PlainAllocator<T>>
CLArray< T, Alloc >::CLArray ( std::initializer_list< T >  list)
inline
template<class T , class Alloc = PlainAllocator<T>>
CLArray< T, Alloc >::CLArray ( CLArray< T, Alloc > &&  rvrf)
inline
template<class T , class Alloc = PlainAllocator<T>>
virtual CLArray< T, Alloc >::~CLArray ( )
inlinevirtual

Member Function Documentation

template<class T , class Alloc = PlainAllocator<T>>
CLArray< T, Alloc >::Alloc::alloc ( )
inline
template<class T , class Alloc = PlainAllocator<T>>
T const& CLArray< T, Alloc >::back ( size_t  i = 0) const
inline
template<class T , class Alloc = PlainAllocator<T>>
T& CLArray< T, Alloc >::back ( size_t  i = 0)
inline
template<class T , class Alloc = PlainAllocator<T>>
const_iterator CLArray< T, Alloc >::begin ( ) const
inline
template<class T , class Alloc = PlainAllocator<T>>
iterator CLArray< T, Alloc >::begin ( )
inline
template<class T , class Alloc = PlainAllocator<T>>
void CLArray< T, Alloc >::connect ( cl_context  context,
cl_mem_flags  flags = CL_MEM_COPY_HOST_PTR | CL_MEM_READ_WRITE 
)
inline
template<class T , class Alloc = PlainAllocator<T>>
T const* CLArray< T, Alloc >::data ( ) const
inlinevirtual

Reimplemented from CLArrayView< T >.

template<class T , class Alloc = PlainAllocator<T>>
T* CLArray< T, Alloc >::data ( )
inlinevirtual

Reimplemented from CLArrayView< T >.

template<class T , class Alloc = PlainAllocator<T>>
void CLArray< T, Alloc >::disconnect ( )
inline
template<class T , class Alloc = PlainAllocator<T>>
const_iterator CLArray< T, Alloc >::end ( ) const
inline
template<class T , class Alloc = PlainAllocator<T>>
iterator CLArray< T, Alloc >::end ( )
inline
template<class T , class Alloc = PlainAllocator<T>>
cl_int CLArray< T, Alloc >::EnqueueDownload ( cl_command_queue  queue)
inline
template<class T , class Alloc = PlainAllocator<T>>
cl_int CLArray< T, Alloc >::EnqueueUpload ( cl_command_queue  queue)
inline
template<class T , class Alloc = PlainAllocator<T>>
T const& CLArray< T, Alloc >::front ( size_t  i = 0) const
inline
template<class T , class Alloc = PlainAllocator<T>>
T& CLArray< T, Alloc >::front ( size_t  i = 0)
inline
template<class T , class Alloc = PlainAllocator<T>>
cl_mem const& CLArray< T, Alloc >::handle ( ) const
inline
template<class T , class Alloc = PlainAllocator<T>>
bool CLArray< T, Alloc >::is_connected ( ) const
inline
template<class T , class Alloc = PlainAllocator<T>>
T const& CLArray< T, Alloc >::operator[] ( size_t  i) const
inline
template<class T , class Alloc = PlainAllocator<T>>
T& CLArray< T, Alloc >::operator[] ( size_t  i)
inline
template<class T , class Alloc = PlainAllocator<T>>
size_t CLArray< T, Alloc >::size ( ) const
inline

Field Documentation

template<class T , class Alloc = PlainAllocator<T>>
CLArray< T, Alloc >::__pad0__

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