• loring's avatar
    libsim safe zero copy data transfer and numpy support : · 12614635
    loring authored
    if numpy is found during configure then libsim may be passed
    numpy arrays directly. zero-copy transfer are supported via
    numpy c-api. a new ownership type is introduced to support
    safe zero-copy transfer of data to vtk data arrays. when this
    ownership is requested a custom (potentially user provided)
    callback is invoked by an internally arranged observer of vtk
    data array delete event. the callback should free the memory.
    this mechanism can be used in any zero-copy transfer through
    libsim where c's free is not the correct function to free the
    transfered memory, in the case of python and numpy, we make
    use of python's ref counting to ensure the numpy object is not
    destroyed until the vtk array is deleted. the numpy object's
    ref count incremented (by libsim) as its passed in, libsim
    provides a callback which decrements the object's ref count
    when the vtk data array is deleted. aside from having to pass
    the new ownership flag, this all happens transparently to the
    user as it is implemented in libsim's python swig customizations.
    If this were to be used in other situations, eg FORTRAN, the user
    would be extected to provide the memory management callback.
    git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@22880 18c085ea-50e0-402c-830e-de6fd14e8384
CMakeLists.txt 114 KB