sofa::gpu::cuda::CudaVector< T > Class Template Reference

#include <CudaTypes.h>

Collaboration diagram for sofa::gpu::cuda::CudaVector< T >:

Collaboration graph
[legend]

Public Types

typedef T value_type
typedef size_t size_type

Public Member Functions

 CudaVector ()
 CudaVector (size_type n)
 CudaVector (const CudaVector< T > &v)
void clear ()
void operator= (const CudaVector< T > &v)
 ~CudaVector ()
size_type size () const
bool empty () const
void reserve (size_type s, size_type WARP_SIZE=BSIZE)
void fastResize (size_type s, size_type WARP_SIZE=BSIZE)
 resize the vector without calling constructors or destructors, and without synchronizing the device and host copy
void resize (size_type s, size_type WARP_SIZE=BSIZE)
void swap (CudaVector< T > &v)
const void * deviceRead (int i=0) const
void * deviceWrite (int i=0)
const T * hostRead (int i=0) const
T * hostWrite (int i=0)
bool isHostValid () const
bool isDeviceValid () const
GLuint bufferRead (bool create=false)
 Get the OpenGL Buffer Object ID for reading.
GLuint bufferWrite (bool create=false)
 Get the OpenGL Buffer Object ID for writing.
void push_back (const T &t)
void pop_back ()
const T & operator[] (size_type i) const
T & operator[] (size_type i)
const T & getCached (size_type i) const

Protected Member Functions

void copyToHost () const
void copyToDevice () const
void checkIndex (size_type i) const
void registerBuffer () const
void mapBuffer () const
void unmapBuffer () const
void unregisterBuffer () const
void createBuffer ()

Protected Attributes

size_type vectorSize
 Current size of the vector.
size_type allocSize
 Allocated size.
void * devicePointer
 Pointer to the data on the GPU side.
T * hostPointer
 Pointer to the data on the CPU side.
GLuint bufferObject
 Optionnal associated OpenGL buffer ID.
bool deviceIsValid
 True if the data on the GPU is currently valid.
bool hostIsValid
 True if the data on the CPU is currently valid.
bool bufferIsRegistered
 True if the OpenGL buffer is registered with CUDA.

Friends

std::ostream & operator<< (std::ostream &os, const CudaVector< T > &vec)
 Output stream.
std::istream & operator>> (std::istream &in, CudaVector< T > &vec)
 Input stream.

Detailed Description

template<class T>
class sofa::gpu::cuda::CudaVector< T >

Definition at line 51 of file CudaTypes.h.


Member Typedef Documentation

template<class T >
typedef size_t sofa::gpu::cuda::CudaVector< T >::size_type

Definition at line 55 of file CudaTypes.h.

template<class T >
typedef T sofa::gpu::cuda::CudaVector< T >::value_type

Definition at line 54 of file CudaTypes.h.


Constructor & Destructor Documentation

template<class T >
sofa::gpu::cuda::CudaVector< T >::CudaVector (  )  [inline]

Definition at line 69 of file CudaTypes.h.

template<class T >
sofa::gpu::cuda::CudaVector< T >::CudaVector ( size_type  n  )  [inline]

Definition at line 72 of file CudaTypes.h.

template<class T >
sofa::gpu::cuda::CudaVector< T >::CudaVector ( const CudaVector< T > &  v  )  [inline]

Definition at line 77 of file CudaTypes.h.

template<class T >
sofa::gpu::cuda::CudaVector< T >::~CudaVector (  )  [inline]

Definition at line 112 of file CudaTypes.h.


Member Function Documentation

template<class T >
GLuint sofa::gpu::cuda::CudaVector< T >::bufferRead ( bool  create = false  )  [inline]

Get the OpenGL Buffer Object ID for reading.

Definition at line 276 of file CudaTypes.h.

template<class T >
GLuint sofa::gpu::cuda::CudaVector< T >::bufferWrite ( bool  create = false  )  [inline]

Get the OpenGL Buffer Object ID for writing.

Definition at line 290 of file CudaTypes.h.

template<class T >
void sofa::gpu::cuda::CudaVector< T >::checkIndex ( size_type  i  )  const [inline, protected]

template<class T >
void sofa::gpu::cuda::CudaVector< T >::clear (  )  [inline]

template<class T >
void sofa::gpu::cuda::CudaVector< T >::copyToDevice (  )  const [inline, protected]

template<class T >
void sofa::gpu::cuda::CudaVector< T >::copyToHost (  )  const [inline, protected]

template<class T >
void sofa::gpu::cuda::CudaVector< T >::createBuffer (  )  [inline, protected]

template<class T >
const void* sofa::gpu::cuda::CudaVector< T >::deviceRead ( int  i = 0  )  const [inline]

template<class T >
void* sofa::gpu::cuda::CudaVector< T >::deviceWrite ( int  i = 0  )  [inline]

template<class T >
bool sofa::gpu::cuda::CudaVector< T >::empty (  )  const [inline]

template<class T >
void sofa::gpu::cuda::CudaVector< T >::fastResize ( size_type  s,
size_type  WARP_SIZE = BSIZE 
) [inline]

template<class T >
const T& sofa::gpu::cuda::CudaVector< T >::getCached ( size_type  i  )  const [inline]

Definition at line 329 of file CudaTypes.h.

template<class T >
const T* sofa::gpu::cuda::CudaVector< T >::hostRead ( int  i = 0  )  const [inline]

template<class T >
T* sofa::gpu::cuda::CudaVector< T >::hostWrite ( int  i = 0  )  [inline]

Definition at line 260 of file CudaTypes.h.

Referenced by sofa::gpu::cuda::CudaVector< TReal >::operator[]().

template<class T >
bool sofa::gpu::cuda::CudaVector< T >::isDeviceValid (  )  const [inline]

Definition at line 270 of file CudaTypes.h.

template<class T >
bool sofa::gpu::cuda::CudaVector< T >::isHostValid (  )  const [inline]

Definition at line 266 of file CudaTypes.h.

template<class T >
void sofa::gpu::cuda::CudaVector< T >::mapBuffer (  )  const [inline, protected]

template<class T >
void sofa::gpu::cuda::CudaVector< T >::operator= ( const CudaVector< T > &  v  )  [inline]

Definition at line 89 of file CudaTypes.h.

template<class T >
T& sofa::gpu::cuda::CudaVector< T >::operator[] ( size_type  i  )  [inline]

Definition at line 323 of file CudaTypes.h.

template<class T >
const T& sofa::gpu::cuda::CudaVector< T >::operator[] ( size_type  i  )  const [inline]

Definition at line 318 of file CudaTypes.h.

template<class T >
void sofa::gpu::cuda::CudaVector< T >::pop_back (  )  [inline]

Definition at line 313 of file CudaTypes.h.

template<class T >
void sofa::gpu::cuda::CudaVector< T >::push_back ( const T &  t  )  [inline]

template<class T >
void sofa::gpu::cuda::CudaVector< T >::registerBuffer (  )  const [inline, protected]

Definition at line 396 of file CudaTypes.h.

Referenced by sofa::gpu::cuda::CudaVector< TReal >::mapBuffer().

template<class T >
void sofa::gpu::cuda::CudaVector< T >::reserve ( size_type  s,
size_type  WARP_SIZE = BSIZE 
) [inline]

template<class T >
void sofa::gpu::cuda::CudaVector< T >::resize ( size_type  s,
size_type  WARP_SIZE = BSIZE 
) [inline]

template<class T >
size_type sofa::gpu::cuda::CudaVector< T >::size ( void   )  const [inline]

template<class T >
void sofa::gpu::cuda::CudaVector< T >::swap ( CudaVector< T > &  v  )  [inline]

Definition at line 231 of file CudaTypes.h.

template<class T >
void sofa::gpu::cuda::CudaVector< T >::unmapBuffer (  )  const [inline, protected]

template<class T >
void sofa::gpu::cuda::CudaVector< T >::unregisterBuffer (  )  const [inline, protected]


Friends And Related Function Documentation

template<class T >
std::ostream& operator<< ( std::ostream &  os,
const CudaVector< T > &  vec 
) [friend]

Output stream.

Definition at line 336 of file CudaTypes.h.

template<class T >
std::istream& operator>> ( std::istream &  in,
CudaVector< T > &  vec 
) [friend]

Input stream.

Definition at line 347 of file CudaTypes.h.


Field Documentation

template<class T >
size_type sofa::gpu::cuda::CudaVector< T >::allocSize [protected]

template<class T >
bool sofa::gpu::cuda::CudaVector< T >::bufferIsRegistered [mutable, protected]

template<class T >
GLuint sofa::gpu::cuda::CudaVector< T >::bufferObject [protected]

template<class T >
bool sofa::gpu::cuda::CudaVector< T >::deviceIsValid [mutable, protected]

template<class T >
void* sofa::gpu::cuda::CudaVector< T >::devicePointer [mutable, protected]

template<class T >
bool sofa::gpu::cuda::CudaVector< T >::hostIsValid [mutable, protected]

template<class T >
T* sofa::gpu::cuda::CudaVector< T >::hostPointer [protected]

template<class T >
size_type sofa::gpu::cuda::CudaVector< T >::vectorSize [protected]


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

Generated on Sun Nov 23 04:24:06 2008 for Sofa by  doxygen 1.5.7.1