Description:
Fast scatter and gather from a Vector to a list of pointers (must have same length). The size of the pointer vector is fixed at creation and must be an integer greater than 0. Pointers to variables are specified with the pset method. At creation, all pointers point to an internal dummy variable. So it is possible to scatter from a larger Vector into a smaller Vector.
If CVode.cache_efficient() is used, a callback should be registered with the PtrVector.ptr_update_callback() method in order to prevent memory segfaults when internal memory is reallocated.
Example:
from neuron import h a = h.Vector(5).indgen() b = h.Vector(5).fill(0) pv = h.PtrVector(5) for i in range(len(a)): pv.pset(i, b._ref_x[i]) pv.scatter(a) b.printf() b.mul(10) pv.gather(a) a.printf()
pv.ptr_update_callback(pythoncallback)
pv.ptr_update_callback("hoc_statement", [object])