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

DeviceArray2D class More...

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

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

## Public Types

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

## Public Member Functions

| DeviceArray2D ()
| Empty constructor.
| DeviceArray2D (int rows, int cols)
| Allocates internal buffer in GPU memory.
| DeviceArray2D (int rows, int cols, void *data, std::size_t stepBytes)
| Initializes with user allocated buffer.
| DeviceArray2D (const DeviceArray2D &other)
| Copy constructor.
DeviceArray2D & | operator= (const DeviceArray2D &other)
| Assignment operator.
void | create (int rows, int cols)
| Allocates internal buffer in GPU memory.
void | release ()
| Decrements reference counter and releases internal buffer if needed.
void | copyTo (DeviceArray2D &other) const
| Performs data copying.
void | upload (const void *host_ptr, std::size_t host_step, int rows, int cols)
| Uploads data to internal buffer in GPU memory.
void | download (void *host_ptr, std::size_t host_step) const
| Downloads data from internal buffer to CPU memory.
void | swap (DeviceArray2D &other_arg)
| Performs swap of data pointed with another device array.
template<class A >
void | upload (const std::vector< T, A > &data, int cols)
| Uploads data to internal buffer in GPU memory.
template<class A >
void | download (std::vector< T, A > &data, int &cols) const
| Downloads data from internal buffer to CPU memory.
T * | ptr (int y=0)
| Returns pointer to given row in internal buffer.
const T * | ptr (int y=0) const
| Returns const pointer to given row in internal buffer.
| operator T* ()
| Returns pointer for internal buffer in GPU memory.
| operator const T * () const
| Returns const pointer for internal buffer in GPU memory.
int | cols () const
| Returns number of elements in each row.
int | rows () const
| Returns number of rows.
std::size_t | elem_step () const
| Returns step in elements.
Public Member Functions inherited from pcl::gpu::DeviceMemory2D
| DeviceMemory2D ()
| Empty constructor.
| ~DeviceMemory2D ()
| Destructor.
| DeviceMemory2D (int rows_arg, int colsBytes_arg)
| Allocates internal buffer in GPU memory.
| DeviceMemory2D (int rows_arg, int colsBytes_arg, void *data_arg, std::size_t step_arg)
| Initializes with user allocated buffer.
| DeviceMemory2D (const DeviceMemory2D &other_arg)
| Copy constructor.
DeviceMemory2D & | operator= (const DeviceMemory2D &other_arg)
| Assignment operator.
void | create (int rows_arg, int colsBytes_arg)
| Allocates internal buffer in GPU memory.
void | release ()
| Decrements reference counter and releases internal buffer if needed.
void | copyTo (DeviceMemory2D &other) const
| Performs data copying.
void | upload (const void *host_ptr_arg, std::size_t host_step_arg, int rows_arg, int colsBytes_arg)
| Uploads data to internal buffer in GPU memory.
void | download (void *host_ptr_arg, std::size_t host_step_arg) const
| Downloads data from internal buffer to CPU memory.
void | swap (DeviceMemory2D &other_arg)
| Performs swap of data pointed with another device memory.
template<class T >
T * | ptr (int y_arg=0)
| Returns pointer to given row in internal buffer.
template<class T >
const T * | ptr (int y_arg=0) const
| Returns constant pointer to given row in internal buffer.
template<class U >
| operator PtrStep< U > () const
| Conversion to PtrStep for passing to kernel functions.
template<class U >
| operator PtrStepSz< U > () const
| Conversion to PtrStepSz for passing to kernel functions.
bool | empty () const
| Returns true if unallocated otherwise false.
int | colsBytes () const
| Returns number of bytes in each row.
int | rows () const
| Returns number of rows.
std::size_t | step () const
| Returns stride between two consecutive rows in bytes for internal buffer.

## Detailed Description

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

DeviceArray2D class

Note
  Typed container for pitched GPU memory with reference counting.

Author
  Anatoly Baksheev

Definition at line 188 of file device_array.h.

## Member Typedef Documentation

## type

template<class T >

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

Element type.

Definition at line 191 of file device_array.h.

## Member Enumeration Documentation

## anonymous enum

template<class T >

anonymous enum

Element size.

Enumerator
elem_size |

Definition at line 194 of file device_array.h.

## Constructor & Destructor Documentation

## DeviceArray2D() [1/4]

template<class T >

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

inline

Empty constructor.

Definition at line 189 of file device_array.hpp.

## DeviceArray2D() [2/4]

template<class T >

pcl::gpu::DeviceArray2D< T >::DeviceArray2D | ( | int | rows,
|  | int | cols
| ) |  |

inline

Allocates internal buffer in GPU memory.

Parameters

  rows | number of rows to allocate
  cols | number of elements in each row

Definition at line 193 of file device_array.hpp.

## DeviceArray2D() [3/4]

template<class T >

pcl::gpu::DeviceArray2D< T >::DeviceArray2D | ( | int | rows,
|  | int | cols,
|  | void * | data,
|  | std::size_t | stepBytes
| ) |  |

inline

Initializes with user allocated buffer.

Reference counting is disabled in this case.

Parameters

  rows | number of rows
  cols | number of elements in each row
  data | pointer to buffer
  stepBytes | stride between two consecutive rows in bytes

Definition at line 198 of file device_array.hpp.

## DeviceArray2D() [4/4]

template<class T >

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

inline

Copy constructor.

Just increments reference counter.

Definition at line 206 of file device_array.hpp.

## Member Function Documentation

## cols()

template<class T >

int pcl::gpu::DeviceArray2D< T >::cols | ( |  | ) | const

inline

Returns number of elements in each row.

Definition at line 310 of file device_array.hpp.

Referenced by pcl::gpu::AsyncCopy< T >::download(), pcl::gpu::TextureBinder::TextureBinder(), and pcl::gpu::AsyncCopy< T >::upload().

## copyTo()

template<class T >

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

inline

Performs data copying.

If destination size differs it will be reallocated.

Parameters

  other | destination container

Definition at line 234 of file device_array.hpp.

References pcl::gpu::DeviceMemory2D::copyTo().

## create()

template<class T >

void pcl::gpu::DeviceArray2D< T >::create | ( | int | rows,
|  | int | cols
| ) |  |

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

  rows | number of rows to allocate
  cols | number of elements in each row

Definition at line 220 of file device_array.hpp.

References pcl::gpu::DeviceMemory2D::create().

## download() [1/2]

template<class T >
template<class A >

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

inline

Downloads data from internal buffer to CPU memory.

Parameters

  data | host vector to download to
  cols | Output stride in elements between two consecutive rows for host vector.

Definition at line 267 of file device_array.hpp.

## download() [2/2]

template<class T >

void pcl::gpu::DeviceArray2D< T >::download | ( | void * | host_ptr,
|  | std::size_t | host_step
| ) |  | const

inline

Downloads data from internal buffer to CPU memory.

User is responsible for correct host buffer size.

Parameters

  host_ptr | pointer to host buffer to download
  host_step | stride between two consecutive rows in bytes for host buffer

Definition at line 251 of file device_array.hpp.

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

## elem_step()

template<class T >

std::size_t pcl::gpu::DeviceArray2D< T >::elem_step | ( |  | ) | const

inline

Returns step in elements.

Definition at line 324 of file device_array.hpp.

References pcl::gpu::DeviceMemory2D::step().

## operator const T *()

template<class T >

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

inline

Returns const pointer for internal buffer in GPU memory.

Definition at line 303 of file device_array.hpp.

## operator T*()

template<class T >

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

inline

Returns pointer for internal buffer in GPU memory.

Definition at line 297 of file device_array.hpp.

## operator=()

template<class T >

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

inline

Assignment operator.

Just increments reference counter.

Definition at line 212 of file device_array.hpp.

## ptr() [1/2]

template<class T >

T * pcl::gpu::DeviceArray2D< T >::ptr | ( | int | y = `0` | ) |

inline

Returns pointer to given row in internal buffer.

Parameters

  y | row index

Definition at line 284 of file device_array.hpp.

Referenced by pcl::gpu::AsyncCopy< T >::download(), pcl::gpu::TextureBinder::TextureBinder(), and pcl::gpu::AsyncCopy< T >::upload().

## ptr() [2/2]

template<class T >

const T * pcl::gpu::DeviceArray2D< T >::ptr | ( | int | y = `0` | ) | const

inline

Returns const pointer to given row in internal buffer.

Parameters

  y | row index

Definition at line 291 of file device_array.hpp.

## release()

template<class T >

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

inline

Decrements reference counter and releases internal buffer if needed.

Definition at line 227 of file device_array.hpp.

## rows()

template<class T >

int pcl::gpu::DeviceArray2D< T >::rows | ( |  | ) | const

inline

Returns number of rows.

Definition at line 317 of file device_array.hpp.

References pcl::gpu::DeviceMemory2D::rows().

Referenced by pcl::gpu::AsyncCopy< T >::download(), pcl::gpu::TextureBinder::TextureBinder(), and pcl::gpu::AsyncCopy< T >::upload().

## swap()

template<class T >

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

Performs swap of data pointed with another device array.

Parameters

  other_arg | device array to swap with

Definition at line 277 of file device_array.hpp.

## upload() [1/2]

template<class T >
template<class A >

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

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
  cols | stride in elements between two consecutive rows for host buffer

Definition at line 259 of file device_array.hpp.

## upload() [2/2]

template<class T >

void pcl::gpu::DeviceArray2D< T >::upload | ( | const void * | host_ptr,
|  | std::size_t | host_step,
|  | int | rows,
|  | int | cols
| ) |  |

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 host buffer to upload
  host_step | stride between two consecutive rows in bytes for host buffer
  rows | number of rows to upload
  cols | number of elements in each row

Definition at line 241 of file device_array.hpp.

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

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

- /build/pcl-KfHoN9/pcl-1.15.0+dfsg/gpu/containers/include/pcl/gpu/containers/device_array.h
- /build/pcl-KfHoN9/pcl-1.15.0+dfsg/gpu/containers/include/pcl/gpu/containers/impl/device_array.hpp