Loading...
Searching...
No Matches
pcl::gpu::DeviceArray< T > Class Template Reference

DeviceArray class More...

`#include </build/pcl-k79KrG/pcl-1.15.1+dfsg/gpu/containers/include/pcl/gpu/containers/device_array.h>`

Inheritance diagram for pcl::gpu::DeviceArray< T >:

## Public Types

enum | { elem_size = sizeof(T) }
| Element size. More...
using | type = T
| Element type.

## Public Member Functions

| DeviceArray ()
| Empty constructor.
| DeviceArray (std::size_t size)
| Allocates internal buffer in GPU memory.
| DeviceArray (T *ptr, std::size_t size)
| Initializes with user allocated buffer.
| DeviceArray (const DeviceArray &other)
| Copy constructor.
DeviceArray & | operator= (const DeviceArray &other)
| Assignment operator.
void | create (std::size_t size)
| Allocates internal buffer in GPU memory.
void | release ()
| Decrements reference counter and releases internal buffer if needed.
void | copyTo (DeviceArray &other) const
| Performs data copying.
void | upload (const T *host_ptr, std::size_t size)
| Uploads data to internal buffer in GPU memory.
bool | upload (const T *host_ptr, std::size_t device_begin_offset, std::size_t num_elements)
| Uploads data from CPU memory to internal buffer.
void | download (T *host_ptr) const
| Downloads data from internal buffer to CPU memory.
bool | download (T *host_ptr, std::size_t device_begin_offset, std::size_t num_elements) const
| Downloads data from internal buffer to CPU memory.
template<class A>
void | upload (const std::vector< T, A > &data)
| Uploads data to internal buffer in GPU memory.
template<typename A>
void | download (std::vector< T, A > &data) const
| Downloads data from internal buffer to CPU memory.
void | swap (DeviceArray &other_arg)
| Performs swap of data pointed with another device array.
T * | ptr ()
| Returns pointer for internal buffer in GPU memory.
const T * | ptr () const
| Returns const pointer for internal buffer in GPU memory.
| operator T* ()
| Returns pointer for internal buffer in GPU memory.
| operator const T * () const
| Returns const pointer for internal buffer in GPU memory.
std::size_t | size () const
| Returns size in elements.
Public Member Functions inherited from pcl::gpu::DeviceMemory
| DeviceMemory ()
| Empty constructor.
| ~DeviceMemory ()
| Destructor.
| DeviceMemory (std::size_t sizeBytes_arg)
| Allocates internal buffer in GPU memory.
| DeviceMemory (void *ptr_arg, std::size_t sizeBytes_arg)
| Initializes with user allocated buffer.
| DeviceMemory (const DeviceMemory &other_arg)
| Copy constructor.
DeviceMemory & | operator= (const DeviceMemory &other_arg)
| Assignment operator.
void | create (std::size_t sizeBytes_arg)
| Allocates internal buffer in GPU memory.
void | release ()
| Decrements reference counter and releases internal buffer if needed.
void | copyTo (DeviceMemory &other) const
| Performs data copying.
void | upload (const void *host_ptr_arg, std::size_t sizeBytes_arg)
| Uploads data to internal buffer in GPU memory.
bool | upload (const void *host_ptr_arg, std::size_t device_begin_byte_offset, std::size_t num_bytes)
| Uploads data from CPU memory to device array.
void | download (void *host_ptr_arg) const
| Downloads data from internal buffer to CPU memory.
bool | download (void *host_ptr_arg, std::size_t device_begin_byte_offset, std::size_t num_bytes) const
| Downloads data from internal buffer to CPU memory.
void | swap (DeviceMemory &other_arg)
| Performs swap of data pointed with another device memory.
template<class T>
T * | ptr ()
| Returns pointer for internal buffer in GPU memory.
template<class T>
const T * | ptr () const
| Returns constant pointer for internal buffer in GPU memory.
template<class U>
| operator PtrSz< U > () const
| Conversion to PtrSz for passing to kernel functions.
bool | empty () const
| Returns true if unallocated otherwise false.
std::size_t | sizeBytes () const

## Detailed Description

template<class T>
class pcl::gpu::DeviceArray< T >

DeviceArray class

Note
  Typed container for GPU memory with reference counting.

Author
  Anatoly Baksheev

Definition at line 54 of file device_array.h.

## Member Typedef Documentation

## type

template<class T>

using pcl::gpu::DeviceArray< T >::type = T

Element type.

Definition at line 57 of file device_array.h.

## Member Enumeration Documentation

## anonymous enum

template<class T>

anonymous enum

Element size.

Enumerator
elem_size |

Definition at line 60 of file device_array.h.

## Constructor & Destructor Documentation

## DeviceArray() [1/4]

template<class T>

pcl::gpu::DeviceArray< T >::DeviceArray | ( |  | ) |

inline

Empty constructor.

Definition at line 47 of file device_array.hpp.

Referenced by copyTo(), DeviceArray(), operator const T *(), operator T*(), operator=(), and swap().

## DeviceArray() [2/4]

template<class T>

pcl::gpu::DeviceArray< T >::DeviceArray | ( | std::size_t | size | ) |

inline

Allocates internal buffer in GPU memory.

Parameters

  size | number of elements to allocate

Definition at line 51 of file device_array.hpp.

References pcl::gpu::DeviceMemory::DeviceMemory(), elem_size, and size().

## DeviceArray() [3/4]

template<class T>

pcl::gpu::DeviceArray< T >::DeviceArray | ( | T * | ptr,
|  | std::size_t | size )

inline

Initializes with user allocated buffer.

Reference counting is disabled in this case.

Parameters

  ptr | pointer to buffer
  size | elements number

Definition at line 55 of file device_array.hpp.

References pcl::gpu::DeviceMemory::DeviceMemory(), elem_size, ptr(), and size().

## DeviceArray() [4/4]

template<class T>

pcl::gpu::DeviceArray< T >::DeviceArray | ( | const DeviceArray< T > & | other | ) |

inline

Copy constructor.

Just increments reference counter.

Definition at line 60 of file device_array.hpp.

References DeviceArray(), and pcl::gpu::DeviceMemory::DeviceMemory().

## Member Function Documentation

## copyTo()

template<class T>

void pcl::gpu::DeviceArray< T >::copyTo | ( | DeviceArray< T > & | other | ) | const

inline

Performs data copying.

If destination size differs it will be reallocated.

Parameters

  other | destination container

Definition at line 87 of file device_array.hpp.

References pcl::gpu::DeviceMemory::copyTo(), and DeviceArray().

## create()

template<class T>

void pcl::gpu::DeviceArray< T >::create | ( | std::size_t | size | ) |

inline

Allocates internal buffer in GPU memory.

If internal buffer was created before the function recreates it with new size. If new and old sizes are equal it does nothing.

Parameters

  size | elements number

Definition at line 73 of file device_array.hpp.

References size().

Referenced by pcl::gpu::copyFieldsEx(), and pcl::gpu::extractEuclideanClusters().

## download() [1/3]

template<class T>
template<class A>

void pcl::gpu::DeviceArray< T >::download | ( | std::vector< T, A > & | data | ) | const

inline

Downloads data from internal buffer to CPU memory.

Parameters

  data | host vector to download to

Definition at line 179 of file device_array.hpp.

References download(), and size().

## download() [2/3]

template<class T>

void pcl::gpu::DeviceArray< T >::download | ( | T * | host_ptr | ) | const

inline

Downloads data from internal buffer to CPU memory.

Parameters

  host_ptr | pointer to buffer to download

Definition at line 112 of file device_array.hpp.

References pcl::gpu::DeviceMemory::download().

Referenced by pcl::gpu::kinfuLS::StandaloneMarchingCubes< PointT >::convertTrianglesToMesh(), download(), pcl::gpu::extractEuclideanClusters(), and pcl::gpu::extractLabeledEuclideanClusters().

## download() [3/3]

template<class T>

bool pcl::gpu::DeviceArray< T >::download | ( | T * | host_ptr,
|  | std::size_t | device_begin_offset,
|  | std::size_t | num_elements ) const

inline

Downloads data from internal buffer to CPU memory.

Returns
  true if download successful

Parameters

  host_ptr | pointer to buffer to download
  device_begin_offset | begin download location
  num_elements | number of elements from device_begin_offset

Definition at line 119 of file device_array.hpp.

## operator const T *()

template<class T>

pcl::gpu::DeviceArray< T >::operator const T * | ( |  | ) | const

inline

Returns const pointer for internal buffer in GPU memory.

Definition at line 142 of file device_array.hpp.

References DeviceArray().

## operator T*()

template<class T>

pcl::gpu::DeviceArray< T >::operator T* | ( |  | ) |

inline

Returns pointer for internal buffer in GPU memory.

Definition at line 136 of file device_array.hpp.

References DeviceArray(), and ptr().

## operator=()

template<class T>

DeviceArray< T > & pcl::gpu::DeviceArray< T >::operator= | ( | const DeviceArray< T > & | other | ) |

inline

Assignment operator.

Just increments reference counter.

Definition at line 65 of file device_array.hpp.

References DeviceArray(), and pcl::gpu::DeviceMemory::operator=().

## ptr() [1/2]

template<class T>

T * pcl::gpu::DeviceArray< T >::ptr | ( |  | ) |

inline

Returns pointer for internal buffer in GPU memory.

Definition at line 156 of file device_array.hpp.

Referenced by pcl::gpu::copyFieldsEx(), DeviceArray(), pcl::gpu::AsyncCopy< T >::download(), pcl::gpu::extractEuclideanClusters(), operator T*(), pcl::gpu::TextureBinder::TextureBinder(), and pcl::gpu::AsyncCopy< T >::upload().

## ptr() [2/2]

template<class T>

const T * pcl::gpu::DeviceArray< T >::ptr | ( |  | ) | const

inline

Returns const pointer for internal buffer in GPU memory.

Definition at line 163 of file device_array.hpp.

## release()

template<class T>

void pcl::gpu::DeviceArray< T >::release | ( |  | ) |

inline

Decrements reference counter and releases internal buffer if needed.

Definition at line 80 of file device_array.hpp.

## size()

template<class T>

std::size_t pcl::gpu::DeviceArray< T >::size | ( |  | ) | const

inline

Returns size in elements.

Definition at line 149 of file device_array.hpp.

Referenced by pcl::gpu::kinfuLS::StandaloneMarchingCubes< PointT >::convertTrianglesToMesh(), pcl::gpu::copyFieldsEx(), create(), DeviceArray(), DeviceArray(), download(), and pcl::gpu::AsyncCopy< T >::upload().

## swap()

template<class T>

void pcl::gpu::DeviceArray< T >::swap | ( | DeviceArray< T > & | other_arg | ) |

Performs swap of data pointed with another device array.

Parameters

  other_arg | device array to swap with

Definition at line 130 of file device_array.hpp.

References DeviceArray(), and pcl::gpu::DeviceMemory::swap().

## upload() [1/3]

template<class T>
template<class A>

void pcl::gpu::DeviceArray< T >::upload | ( | const std::vector< T, A > & | data | ) |

inline

Uploads data to internal buffer in GPU memory.

It calls create() inside to ensure that internal buffer size is enough.

Parameters

  data | host vector to upload from

Definition at line 171 of file device_array.hpp.

## upload() [2/3]

template<class T>

bool pcl::gpu::DeviceArray< T >::upload | ( | const T * | host_ptr,
|  | std::size_t | device_begin_offset,
|  | std::size_t | num_elements )

inline

Uploads data from CPU memory to internal buffer.

Returns
  true if upload successful

Note
  In contrast to the other upload function, this function never allocates memory.

Parameters

  host_ptr | pointer to buffer to upload
  device_begin_offset | begin upload
  num_elements | number of elements from device_bein_offset

Definition at line 101 of file device_array.hpp.

References pcl::gpu::DeviceMemory::upload().

## upload() [3/3]

template<class T>

void pcl::gpu::DeviceArray< T >::upload | ( | const T * | host_ptr,
|  | std::size_t | size )

inline

Uploads data to internal buffer in GPU memory.

It calls create() inside to ensure that internal buffer size is enough.

Parameters

  host_ptr | pointer to buffer to upload
  size | elements number

Definition at line 94 of file device_array.hpp.

Referenced by pcl::gpu::extractEuclideanClusters(), and pcl::gpu::extractLabeledEuclideanClusters().

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

- /build/pcl-k79KrG/pcl-1.15.1+dfsg/gpu/containers/include/pcl/gpu/containers/device_array.h
- /build/pcl-k79KrG/pcl-1.15.1+dfsg/gpu/containers/include/pcl/gpu/containers/impl/device_array.hpp