Public Types | Public Member Functions | Static Public Member Functions | Private Attributes

cmtk::DeviceMemory< T, DeviceMemoryGPU > Class Template Reference
[cmtkGPU library]

Resource managing class template for type-specific memory allocated on a GPU device through . More...

#include <cmtkDeviceMemory.h>

List of all members.

Public Types

typedef DeviceMemory< T,
DeviceMemoryGPU > 
Self
 This class.
typedef SmartConstPointer< SelfSmartConstPtr
 Smart pointer-to-const.
typedef SmartPointer< SelfSmartPtr
 Smart pointer.
typedef DeviceMemoryGPU Superclass
 Base class.

Public Member Functions

 DeviceMemory (const size_t n, const size_t padToMultiple=1)
 Constructor: allocate memory on device through base class.
const T * Ptr () const
 Get const pointer.
T * Ptr ()
 Get non-const pointer.
void CopyToDevice (const T *const srcPtrHost, const size_t count)
 Copy from host to device memory.
void CopyToHost (void *const dstPtrHost, const size_t count) const
 Copy from device to host memory.
void CopyOnDevice (const Self &srcPtrDevice, const size_t count)
 Copy between two device memory locations.
void SetToZero ()
 Clear device memory (set to all zeroes).
size_t GetNumberOfItems () const
 Get number of items.

Static Public Member Functions

static Self::SmartPtr Create (const size_t nItems, const size_t padToMultiple=1)
 Create new object and allocate memory.
static Self::SmartPtr Create (const size_t nItems, const T *initFrom, const size_t padToMultiple=1)
 Create new object, allocate, and initialize memory.

Private Attributes

size_t m_NumberOfItems
 Number of items allocated.

Detailed Description

template<typename T, class DeviceMemoryGPU = DeviceMemoryCL>
class cmtk::DeviceMemory< T, DeviceMemoryGPU >

Resource managing class template for type-specific memory allocated on a GPU device through .

Definition at line 55 of file cmtkDeviceMemory.h.


Member Typedef Documentation

template<typename T, class DeviceMemoryGPU = DeviceMemoryCL>
typedef DeviceMemory<T,DeviceMemoryGPU> cmtk::DeviceMemory< T, DeviceMemoryGPU >::Self

This class.

Definition at line 61 of file cmtkDeviceMemory.h.

template<typename T, class DeviceMemoryGPU = DeviceMemoryCL>
typedef SmartConstPointer<Self> cmtk::DeviceMemory< T, DeviceMemoryGPU >::SmartConstPtr

Smart pointer-to-const.

Definition at line 64 of file cmtkDeviceMemory.h.

template<typename T, class DeviceMemoryGPU = DeviceMemoryCL>
typedef SmartPointer<Self> cmtk::DeviceMemory< T, DeviceMemoryGPU >::SmartPtr

Smart pointer.

Definition at line 67 of file cmtkDeviceMemory.h.

template<typename T, class DeviceMemoryGPU = DeviceMemoryCL>
typedef DeviceMemoryGPU cmtk::DeviceMemory< T, DeviceMemoryGPU >::Superclass

Base class.

Definition at line 70 of file cmtkDeviceMemory.h.


Constructor & Destructor Documentation

template<typename T, class DeviceMemoryGPU = DeviceMemoryCL>
cmtk::DeviceMemory< T, DeviceMemoryGPU >::DeviceMemory ( const size_t  n,
const size_t  padToMultiple = 1 
) [inline]

Constructor: allocate memory on device through base class.

Parameters:
nNumber of items.

Definition at line 73 of file cmtkDeviceMemory.h.


Member Function Documentation

template<typename T, class DeviceMemoryGPU = DeviceMemoryCL>
void cmtk::DeviceMemory< T, DeviceMemoryGPU >::CopyOnDevice ( const Self srcPtrDevice,
const size_t  count 
) [inline]

Copy between two device memory locations.

Definition at line 120 of file cmtkDeviceMemory.h.

template<typename T, class DeviceMemoryGPU = DeviceMemoryCL>
void cmtk::DeviceMemory< T, DeviceMemoryGPU >::CopyToDevice ( const T *const   srcPtrHost,
const size_t  count 
) [inline]

Copy from host to device memory.

Definition at line 108 of file cmtkDeviceMemory.h.

template<typename T, class DeviceMemoryGPU = DeviceMemoryCL>
void cmtk::DeviceMemory< T, DeviceMemoryGPU >::CopyToHost ( void *const   dstPtrHost,
const size_t  count 
) const [inline]

Copy from device to host memory.

Definition at line 114 of file cmtkDeviceMemory.h.

Referenced by cmtk::SimpleLevelsetDevice::Evolve().

template<typename T, class DeviceMemoryGPU = DeviceMemoryCL>
static Self::SmartPtr cmtk::DeviceMemory< T, DeviceMemoryGPU >::Create ( const size_t  nItems,
const size_t  padToMultiple = 1 
) [inline, static]

Create new object and allocate memory.

Parameters:
nItemsAllocate (at least) this many items of type T.
padToMultiplePad number of allocated elements to next multiple of this number.

Definition at line 79 of file cmtkDeviceMemory.h.

template<typename T, class DeviceMemoryGPU = DeviceMemoryCL>
static Self::SmartPtr cmtk::DeviceMemory< T, DeviceMemoryGPU >::Create ( const size_t  nItems,
const T *  initFrom,
const size_t  padToMultiple = 1 
) [inline, static]

Create new object, allocate, and initialize memory.

Parameters:
nItemsAllocate (at least) this many items of type T.
initFromInitialize from this region in host memory.
padToMultiplePad number of allocated elements to next multiple of this number.

Definition at line 86 of file cmtkDeviceMemory.h.

template<typename T, class DeviceMemoryGPU = DeviceMemoryCL>
size_t cmtk::DeviceMemory< T, DeviceMemoryGPU >::GetNumberOfItems (  ) const [inline]

Get number of items.

Definition at line 132 of file cmtkDeviceMemory.h.

Referenced by cmtk::DeviceHistogram::Populate().

template<typename T, class DeviceMemoryGPU = DeviceMemoryCL>
T* cmtk::DeviceMemory< T, DeviceMemoryGPU >::Ptr (  ) [inline]

Get non-const pointer.

Definition at line 102 of file cmtkDeviceMemory.h.

template<typename T, class DeviceMemoryGPU = DeviceMemoryCL>
const T* cmtk::DeviceMemory< T, DeviceMemoryGPU >::Ptr (  ) const [inline]
template<typename T, class DeviceMemoryGPU = DeviceMemoryCL>
void cmtk::DeviceMemory< T, DeviceMemoryGPU >::SetToZero (  ) [inline]

Clear device memory (set to all zeroes).

Definition at line 126 of file cmtkDeviceMemory.h.


Member Data Documentation

template<typename T, class DeviceMemoryGPU = DeviceMemoryCL>
size_t cmtk::DeviceMemory< T, DeviceMemoryGPU >::m_NumberOfItems [private]

Number of items allocated.

Definition at line 139 of file cmtkDeviceMemory.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines