Resource managing class template for type-specific memory allocated on a GPU device through . More...
#include <cmtkDeviceMemory.h>
Public Types | |
typedef DeviceMemory< T, DeviceMemoryGPU > | Self |
This class. | |
typedef SmartConstPointer< Self > | SmartConstPtr |
Smart pointer-to-const. | |
typedef SmartPointer< Self > | SmartPtr |
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. |
Resource managing class template for type-specific memory allocated on a GPU device through .
Definition at line 55 of file cmtkDeviceMemory.h.
typedef DeviceMemory<T,DeviceMemoryGPU> cmtk::DeviceMemory< T, DeviceMemoryGPU >::Self |
This class.
Definition at line 61 of file cmtkDeviceMemory.h.
typedef SmartConstPointer<Self> cmtk::DeviceMemory< T, DeviceMemoryGPU >::SmartConstPtr |
Smart pointer-to-const.
Definition at line 64 of file cmtkDeviceMemory.h.
typedef SmartPointer<Self> cmtk::DeviceMemory< T, DeviceMemoryGPU >::SmartPtr |
Smart pointer.
Definition at line 67 of file cmtkDeviceMemory.h.
typedef DeviceMemoryGPU cmtk::DeviceMemory< T, DeviceMemoryGPU >::Superclass |
Base class.
Definition at line 70 of file cmtkDeviceMemory.h.
cmtk::DeviceMemory< T, DeviceMemoryGPU >::DeviceMemory | ( | const size_t | n, |
const size_t | padToMultiple = 1 |
||
) | [inline] |
Constructor: allocate memory on device through base class.
n | Number of items. |
Definition at line 73 of file cmtkDeviceMemory.h.
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.
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.
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().
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.
nItems | Allocate (at least) this many items of type T. |
padToMultiple | Pad number of allocated elements to next multiple of this number. |
Definition at line 79 of file cmtkDeviceMemory.h.
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.
nItems | Allocate (at least) this many items of type T. |
initFrom | Initialize from this region in host memory. |
padToMultiple | Pad number of allocated elements to next multiple of this number. |
Definition at line 86 of file cmtkDeviceMemory.h.
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().
T* cmtk::DeviceMemory< T, DeviceMemoryGPU >::Ptr | ( | ) | [inline] |
Get non-const pointer.
Definition at line 102 of file cmtkDeviceMemory.h.
const T* cmtk::DeviceMemory< T, DeviceMemoryGPU >::Ptr | ( | ) | const [inline] |
Get const pointer.
Definition at line 96 of file cmtkDeviceMemory.h.
Referenced by cmtk::DeviceUniformVolume::DeviceUniformVolume(), cmtk::SimpleLevelsetDevice::Evolve(), and cmtk::DeviceHistogram::Populate().
void cmtk::DeviceMemory< T, DeviceMemoryGPU >::SetToZero | ( | ) | [inline] |
Clear device memory (set to all zeroes).
Definition at line 126 of file cmtkDeviceMemory.h.
size_t cmtk::DeviceMemory< T, DeviceMemoryGPU >::m_NumberOfItems [private] |
Number of items allocated.
Definition at line 139 of file cmtkDeviceMemory.h.