
Public Member Functions | |
| DeviceArrayWrapper (DeviceInterface *deviceInterface, int size, int dimension=1, bool useDoubleBufferingOnDevice=true, bool useVbo=false) | |
| ~DeviceArrayWrapper () | |
| Deallocate host and device memory. | |
| Type * | getReadDeviceArray () |
| Returns the array on current read position. | |
| Type * | getWriteDeviceArray () |
| Returns the array on current write position. | |
| bool | useVbo () |
| Returns true if VBO is enabled. | |
| int | getReadVbo () |
| Returns the VBO index on current read position. | |
| int | getWriteVbo () |
| Returns the VBO index on current write position. | |
| int | getElementBytesCount () |
| Returns the size of one element: sizeof(Type) * dimension. | |
| int | getBytesCount () |
| Returns the size of the whole array: sizeof(Type) * dimension * size. | |
| Type * | getHostArray () |
| Returns the host "image" of the array. | |
| int | getSize () |
| Returns the size of the array. | |
| const type_info * | getType () |
| Returns type information: a reference to typeid(Type). | |
| void | swapPosReadWrite () |
| If double-buffering is enabled, swaps the current read position with the current write position. | |
| void | copyArrayToDevice () |
| Copies the whole array from host to device. | |
| void | copyArrayToDevice (int offsetElements) |
| Copies one element of the array from host to device. | |
| void | copyArrayToDevice (int offsetElements, int numElements) |
| Copies a window of the array from host to device. | |
| void | copyArrayFromDevice () |
| Copies the whole array from device to host. | |
| void | copyArrayFromDevice (int offsetElements) |
| Copies one element of the array from device to host. | |
| void | copyArrayFromDevice (int offsetElements, int numElements) |
| Copies a window of array from device to host. | |
| Type | getHostArrayElement (int index, bool copyFromDevice=false) |
| void | setHostArrayElement (int index, Type *element, bool copyToDevice=false) |
| void | bindToField (int &field) |
| void | reset (char val) |
| Set all the element of the host array to val. | |
Helps the interaction between the device "image" and the host "image" of an array.
Objects of this class are feature of the simulation engine.
Similar to GPUArray entity included in the CUDA SDK 2.1.
| BehaveRT::DeviceArrayWrapper< Type >::DeviceArrayWrapper | ( | DeviceInterface * | deviceInterface, | |
| int | size, | |||
| int | dimension = 1, |
|||
| bool | useDoubleBufferingOnDevice = true, |
|||
| bool | useVbo = false | |||
| ) | [inline] |
Allocate and initialize arrays. Allocate on host and device size * dimension * sizeof(Type) bytes. Register the feature on the DeviceDataRepository.
| deviceInterface | reference to DeviceInterface | |
| size | number of elements | |
| dimension | number of dimensions (1D, 2D, 3D, ...) | |
| useDoubleBufferingOnDevice | double image on device, for doublebuffering | |
| useVbo | OpenGL Vertex Buffer Object assotiation |
| void BehaveRT::DeviceArrayWrapper< Type >::bindToField | ( | int & | field | ) | [inline] |
Create a link between the feature represented by the DeviceArrayWrapper and an element of the DeviceDataRepository.
| Type BehaveRT::DeviceArrayWrapper< Type >::getHostArrayElement | ( | int | index, | |
| bool | copyFromDevice = false | |||
| ) | [inline] |
| index | of the element | |
| copyFromDevice | if true, copies the element from device |
| void BehaveRT::DeviceArrayWrapper< Type >::setHostArrayElement | ( | int | index, | |
| Type * | element, | |||
| bool | copyToDevice = false | |||
| ) | [inline] |
Set an elemento of the host array
| index | index of the element | |
| element | data to write on the array element | |
| copyToDevice | if true, copies the element to device |
1.5.7.1