VolumeViz uses the Open Inventor Computing Framework to abstract and manage blocks of memory. This topic is explained in detail in Chapter Open Inventor Computing framework. This section will briefly review the computing framework so we can use these classes in example code. There are three main parts of the computing framework: devices, buffers (blocks of data) and algorithms.
The subclasses of SoDevice( C++ | Java | .NET ) allow an application to discover, query and manage the available visualization and computation devices in the system. Open Inventor currently supports four different logical device types. However a single physical device may be accessible as more than one type of logical device. For example, a GPU (graphics board) may be accessible as an OpenGL device, a CUDA device and an OpenCL device.
Using the query methods, you can determine the number of each type of device and specific information about each device such as the total memory. For each device type Open Inventor also provides a class for managing “contexts”, for example SoGLContext( C++ | Java | .NET ). (See Chapter Open Inventor Computing framework for more information.) Note that the word "device" is also used in the Open Inventor API to refer to input devices, but those clases are platform and window system specific, for example SoWinMouse( C++ | .NET ) is derived from SoWinDevice( C++ | .NET ).
The subclasses of SoBufferObject( C++ | Java | .NET ) allow an application to allocate and manage memory on any of the available visualization and computation devices in the system.
Memory must be allocated on a specific device. However the abstract SoBufferObject( C++ | Java | .NET ) methods allow buffer objects to be used without (necessarily) knowing where the buffer physically exists. For example, the application can pass an SoCpuBufferObject( C++ | Java | .NET ) to a getData() method to fetch data into CPU memory. Any buffer object may be “mapped” to a buffer object on a different device. Open Inventor will automatically make the data available on the other device, either by direct association or, if necessary, by copying the data. For example, on the CPU, to access data in a non-CPU buffer, first map the buffer to an SoCpuBufferObject( C++ | Java | .NET ) then call the map(AccessMode) method, which returns a reference to the data in the buffer.
In addition to making it easier to integrate your own algorithms, Open Inventor includes optimized implementations of some commonly used algorithms. This means you can use the computing power of the GPU without writing any CUDA or OpenCL code. The CPU algorithm classes are:
SoArithmetic( C++ | Java | .NET ) : Add, multiply, combine, compute min/max, etc.
SoConversion( C++ | Java | .NET ) : Convert from one data type to another, e.g. unsigned char to float.
SoConvolution( C++ | Java | .NET ) : 1D and 2D separable convolution.
SoDataExtract( C++ | Java | .NET ) : Extract a slice of data from a tile.
SoSeismic( C++ | Java | .NET ) : Compute Hilbert transform and some basic seismic attributes.