gpufilter
GPU-Efficient Recursive Filtering and Summed-Area Tables
gpufilter::dvector< T > Class Template Reference

Device Vector class. More...

#include <dvector.h>

List of all members.

Public Member Functions

 dvector (const std::vector< T > &that)
 dvector (const T *data, const size_t &size)
 dvector (const T *data, const size_t &w_data, const size_t &h_data, const size_t &w, const size_t &h)
 dvector (const dvector< T > &that)
 dvector (const size_t &size=0)
 ~dvector ()
void resize (const size_t &size)
 Resize this vector.
void clear ()
 Clear this vector.
operator[] (const int &idx) const
 Read/write operator.
dvectoroperator= (const dvector< T > &that)
 Assign operator.
dvectoroperator= (const std::vector< T > &that)
 Assign operator.
void copy_to (T *data, const size_t &s) const
 Copy values from this vector to a host (CPU) vector.
void copy_to (T *data, const size_t &w, const size_t &h, const size_t &w_data, const size_t &h_data) const
 Copy values from this vector in 2D to a host (CPU) vector.
void copy_from (const T *data, const size_t &size)
 Copy values from a host (CPU) vector to this vector.
void copy_from (const T *data, const size_t &w_data, const size_t &h_data, const size_t &w, const size_t &h)
 Copy values from a 2D host (CPU) vector to this vector.
void fill_zero ()
 Fill this vector with zeroes.
bool empty () const
 Check if this vector is empty.
size_t size () const
 Size of this vector.
T * data ()
 Data in this vector.
const T * data () const
back () const
 Get last element of the vector.
 operator T * ()
 Address access operator.
 operator const T * () const
 Address access operator.

Private Attributes

T * m_data
 Vector data.
size_t m_size
 Vector size.
size_t m_capacity
 Vector capacity.

Friends

void swap (dvector< T > &a, dvector< T > &b)
 Swap vector values.

Related Functions

(Note that these are not member functions.)

template<class T >
std::vector< T > to_cpu (const T *d_vec, unsigned len)
 Copy to the CPU a vector in the GPU.
template<class T >
std::vector< T > to_cpu (const dvector< T > &v)

Detailed Description

template<class T>
class gpufilter::dvector< T >

Device Vector class.

Device vector is a STL-based vector in the GPU memory.

Template Parameters:
TDevice vector values type
Examples:

example_r3.cc, example_r5.cc, and example_sat3.cc.


Constructor & Destructor Documentation

template<class T>
gpufilter::dvector< T >::dvector ( const std::vector< T > &  that) [inline, explicit]

Constructor

Parameters:
[in]thatHost (STL) Vector data (non-converted) to be copied into this object
template<class T>
gpufilter::dvector< T >::dvector ( const T *  data,
const size_t &  size 
) [inline]

Constructor

Parameters:
[in]dataVector data to be copied into this object
[in]sizeVector data size
template<class T>
gpufilter::dvector< T >::dvector ( const T *  data,
const size_t &  w_data,
const size_t &  h_data,
const size_t &  w,
const size_t &  h 
) [inline]

Constructor

Parameters:
[in]dataVector data in 2D to be copied into this object
[in]w_dataWidth of the vector data
[in]h_dataHeight of the vector data
[in]wWidth of the vector data in device memory
[in]hHeight of the vector data in device memory
template<class T>
gpufilter::dvector< T >::dvector ( const dvector< T > &  that) [inline]

Copy Constructor

Parameters:
[in]thatCopy that object to this object
template<class T>
gpufilter::dvector< T >::dvector ( const size_t &  size = 0) [inline]

Default Constructor

Parameters:
[in]sizeVector data size
template<class T>
gpufilter::dvector< T >::~dvector ( ) [inline]

Destructor


Member Function Documentation

template<class T>
T gpufilter::dvector< T >::back ( ) const [inline]

Get last element of the vector.

Returns:
Last element of this vector
template<class T>
void gpufilter::dvector< T >::copy_from ( const T *  data,
const size_t &  size 
) [inline]

Copy values from a host (CPU) vector to this vector.

Parameters:
[in]dataVector data to be copied into this object
[in]sizeVector data size
template<class T>
void gpufilter::dvector< T >::copy_from ( const T *  data,
const size_t &  w_data,
const size_t &  h_data,
const size_t &  w,
const size_t &  h 
) [inline]

Copy values from a 2D host (CPU) vector to this vector.

Parameters:
[in]dataVector data in 2D to be copied into this object
[in]w_dataWidth of the vector data
[in]h_dataHeight of the vector data
[in]wWidth of the vector data in device memory
[in]hHeight of the vector data in device memory
template<class T>
void gpufilter::dvector< T >::copy_to ( T *  data,
const size_t &  s 
) const [inline]

Copy values from this vector to a host (CPU) vector.

Parameters:
[out]dataHost Vector to copy values to
[in]sMaximum number of elements to copy
template<class T>
void gpufilter::dvector< T >::copy_to ( T *  data,
const size_t &  w,
const size_t &  h,
const size_t &  w_data,
const size_t &  h_data 
) const [inline]

Copy values from this vector in 2D to a host (CPU) vector.

Parameters:
[out]dataHost Vector to copy values to
[in]wWidth of the vector data in device memory
[in]hHeight of the vector data in device memory
[in]w_dataWidth of the vector data to copy values to
[in]h_dataHeight of the vector data to copy values to
template<class T>
T* gpufilter::dvector< T >::data ( ) [inline]

Data in this vector.

Returns:
Vector data
template<class T>
const T* gpufilter::dvector< T >::data ( ) const [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns:
Constant vector data
template<class T>
bool gpufilter::dvector< T >::empty ( ) const [inline]

Check if this vector is empty.

Returns:
True if this vector is empty
template<class T>
gpufilter::dvector< T >::operator const T * ( ) const [inline]

Address access operator.

Returns:
Constant pointer to vector data
template<class T>
gpufilter::dvector< T >::operator T * ( ) [inline]

Address access operator.

Returns:
Pointer to vector data
template<class T>
dvector& gpufilter::dvector< T >::operator= ( const dvector< T > &  that) [inline]

Assign operator.

Parameters:
[in]thatDevice vector to copy from
Returns:
This device vector with assigned values
template<class T>
dvector& gpufilter::dvector< T >::operator= ( const std::vector< T > &  that) [inline]

Assign operator.

Parameters:
[in]thatHost (STL) Vector to copy from
Returns:
This device vector with assigned values
template<class T>
T gpufilter::dvector< T >::operator[] ( const int &  idx) const [inline]

Read/write operator.

Parameters:
[in]idxIndex of vector value
Returns:
Vector value at index
template<class T>
void gpufilter::dvector< T >::resize ( const size_t &  size) [inline]

Resize this vector.

Parameters:
[in]sizeThe new vector size
template<class T>
size_t gpufilter::dvector< T >::size ( ) const [inline]

Size of this vector.

Returns:
Vector size

Friends And Related Function Documentation

template<class T>
void swap ( dvector< T > &  a,
dvector< T > &  b 
) [friend]

Swap vector values.

Parameters:
[in,out]aVector to be swapped
[in,out]bVector to be swapped
template<class T >
std::vector< T > to_cpu ( const T *  d_vec,
unsigned  len 
) [related]

Copy to the CPU a vector in the GPU.

This function copies a device vector (GPU) to a host vector (CPU).

Parameters:
[in]d_vecPointer to the device vector (in the GPU memory)
[in]lenLength of the device vector
Returns:
Host vector (in the CPU memory) as a STL vector
Template Parameters:
TVector values type
template<class T >
std::vector< T > to_cpu ( const dvector< T > &  v) [related]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
[in]vDevice vector (in the GPU memory)
Returns:
Host vector (in the CPU memory) as a STL vector
Template Parameters:
TVector values type

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