|
|
Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages |
#include <itkOpenCLVector.h>
The OpenCLVector class represents a templated OpenCL buffer object.
OpenCLVector is a convenience template class that wraps an OpenCL buffer object to make it appear as a host-accessible array of elements of type T.
Whenever the host CPU calls operator[](), the array's contents are copied into host-accessible memory for direct access. When the host sets the vector on a OpenCLKernel as an argument, the data is copied back to the OpenCL compute device (e.g., the GPU).
The type T is restricted to primitive and movable types that do not require explicit construction, destruction, or operator=(). T can have constructors, but they will not be called. This is because the data will be copied to the OpenCL device in a different address space, and the OpenCL device will not know how to construct, destruct, or copy the data in a C++-compatible manner.
Elements of a buffer object can be a scalar data type (such as an int, float), vector data type, or a user-defined structure, not std::string.
Definition at line 52 of file itkOpenCLVector.h.
Inheritance diagram for itk::OpenCLVector< T >:Public Types | |
| using | Self = OpenCLVector |
Public Member Functions | |
| OpenCLBuffer | GetBuffer () const |
| OpenCLContext * | GetContext () const |
| std::vcl_size_t | GetSize () const |
| bool | IsEmpty () const |
| bool | IsNull () const |
| OpenCLVector () | |
| OpenCLVector (const OpenCLVector< T > &other) | |
| OpenCLVector< T > & | operator= (const OpenCLVector< T > &other) |
| T & | operator[] (const std::vcl_size_t index) |
| const T & | operator[] (const std::vcl_size_t index) const |
| void | Read (T *data, const std::vcl_size_t count, const std::vcl_size_t offset=0) |
| void | Release () |
| void | Write (const T *data, const std::vcl_size_t count, const std::vcl_size_t offset=0) |
| void | Write (const Vector< T > &data, const std::vcl_size_t offset=0) |
| ~OpenCLVector () | |
Private Member Functions | |
| OpenCLVector (OpenCLContext *context, const OpenCLMemoryObject::Access access, const std::vcl_size_t size) | |
Friends | |
| class | OpenCLContext |
Additional Inherited Members | |
Protected Member Functions inherited from itk::OpenCLVectorBase | |
| void | Assign (const OpenCLVectorBase &other) |
| void | Create (OpenCLContext *context, const OpenCLMemoryObject::Access access, const std::vcl_size_t size) |
| OpenCLContext * | GetContext () const |
| cl_mem | GetKernelArgument () const |
| cl_mem | GetMemoryId () const |
| void | Map () |
| OpenCLVectorBase (const std::vcl_size_t elemSize) | |
| OpenCLVectorBase (const std::vcl_size_t elemSize, const OpenCLVectorBase &other) | |
| void | Read (void *data, const std::vcl_size_t size, const std::vcl_size_t offset=0) |
| void | Release () |
| void | Unmap () const |
| void | Write (const void *data, const std::vcl_size_t size, const std::vcl_size_t offset=0) |
| ~OpenCLVectorBase () | |
Protected Attributes inherited from itk::OpenCLVectorBase | |
| OpenCLVectorBasePimpl * | d_ptr |
| std::vcl_size_t | m_ElementSize |
| void * | m_Mapped |
| std::vcl_size_t | m_Size |
| using itk::OpenCLVector< T >::Self = OpenCLVector |
Standard class typedefs.
Definition at line 56 of file itkOpenCLVector.h.
| itk::OpenCLVector< T >::OpenCLVector | ( | ) |
Creates a null OpenCL vector.
| itk::OpenCLVector< T >::OpenCLVector | ( | const OpenCLVector< T > & | other | ) |
Creates a copy of the other vector reference. The vector's contents are not duplicated, modifications to this vector will also affect other.
| itk::OpenCLVector< T >::~OpenCLVector | ( | ) |
Destroys this vector reference. If this is the last reference to the underlying data, the vector will be unmapped and deallocated.
|
private |
Constructs an OpenCL vector object of size and associates it with context.
| OpenCLBuffer itk::OpenCLVector< T >::GetBuffer | ( | ) | const |
Returns the OpenCL buffer handle for this vector.
| OpenCLContext * itk::OpenCLVector< T >::GetContext | ( | ) | const |
Returns the OpenCL context that was used to create this vector.
|
inline |
Returns the number of elements of type T in this OpenCL vector.
Definition at line 97 of file itkOpenCLVector.h.
|
inline |
Returns true if this OpenCL vector is empty, false otherwise.
Definition at line 90 of file itkOpenCLVector.h.
| bool itk::OpenCLVector< T >::IsNull | ( | ) | const |
Returns true if this vector is null, false otherwise.
| OpenCLVector< T > & itk::OpenCLVector< T >::operator= | ( | const OpenCLVector< T > & | other | ) |
Assigns the other vector reference to this object. The vector's contents are not duplicated, modifications to this vector will also affect other.
| T & itk::OpenCLVector< T >::operator[] | ( | const std::vcl_size_t | index | ) |
Returns a reference to the element at index in this OpenCL vector. The vector will be copied to host memory if necessary.
| const T & itk::OpenCLVector< T >::operator[] | ( | const std::vcl_size_t | index | ) | const |
Returns a const reference to the element at index in this OpenCL vector. The vector will be copied to host memory if necessary.
| void itk::OpenCLVector< T >::Read | ( | T * | data, |
| const std::vcl_size_t | count, | ||
| const std::vcl_size_t | offset = 0 |
||
| ) |
Reads the count elements starting offset in this vector into data.
| void itk::OpenCLVector< T >::Release | ( | ) |
Releases the contents of this OpenCL vector. If not explicitly released, the contents will be implicitly released when the vector is destroyed.
| void itk::OpenCLVector< T >::Write | ( | const T * | data, |
| const std::vcl_size_t | count, | ||
| const std::vcl_size_t | offset = 0 |
||
| ) |
Writes the count elements from data to offset in this vector.
| void itk::OpenCLVector< T >::Write | ( | const Vector< T > & | data, |
| const std::vcl_size_t | offset = 0 |
||
| ) |
Writes the contents of data to offset in this vector.
|
friend |
friends from OpenCL core
Definition at line 140 of file itkOpenCLVector.h.
Generated on 1739326392 for elastix by 1.9.8 |