I am trying to pass a Vector to a NMODL object.
I can do the following in hoc:
Code: Select all
objref vec
vec=new Vector(490776) // Too big?
mynmodlobj.setVec(vec)
in my NMODL file I have:
Code: Select all
NEURON {
POINTER vecP
}
PARAMETER {
vecP=0
}
PROCEDURE setVec() {
VERBATIM
if (ifarg(1)) {
Object *o = *hoc_objgetarg(1);
check_obj_type(o, "Vector");
printf("setVec.size=%d\n",vector_capacity(o->u.this_pointer));
_p_vecP=vector_vec(o->u.this_pointer);
printf("_p_vecP=%f\n",*_p_vecP);
}
ENDVERBATIM
}
Now, setVec() works just fine except for when I have a lot of other processing/memory being used. In this case, I will get the first printf statement and then a either a segmentation violation before the second printf, or the values will be null. I have also attempted to assign the vector_vec to a local double pointer and get the same result. Am I doing something wrong, is my vector too big, or is the memory moving out from underneath me, in which case, how do I handle handles in NMODL?
Thanks,
Tom