Replies: 6 comments
-
@nrnhines your input would be much appreciated when you have some time! |
Beta Was this translation helpful? Give feedback.
-
I don't think anything is missing from the above list. I know of only 3 kinds of pointers.
There are no non-verbatim patterns that update a pointer value except that one may reset a pointer to point to another scalar from the interpreter in the same way one originally set the pointer. No mod files set pointers into NEURON data structures. |
Beta Was this translation helpful? Give feedback.
-
One and a half other patterns that may be outside of the scope of this question, but shouldn't break:
|
Beta Was this translation helpful? Give feedback.
-
I also came across this example, which has only recently been added to the CTest suite: |
Beta Was this translation helpful? Give feedback.
-
Line 16, POINTER in mod file instance that points to an element of a hoc double array, is formally correct. It is mostly to exhibit the syntax of
|
Beta Was this translation helpful? Give feedback.
-
I suppose the HOC Pointer and PtrVector classes should be added to the variants. In particular, PtrVector.ptr_update_callback is presently used to redo the pointers when internal memory is reallocated. An example of the latter is nrn/test/coreneuron/test_pointer.py which ironically only uses an empty PtrVector so that the callback can set up the nmodl POINTER variables. |
Beta Was this translation helpful? Give feedback.
-
Context
In the context of #1929 some changes are required to the handling of POINTER variables. This issue is supposed to collect the different usage patterns that need to be accounted for.
test_pointer.py example
In this case we have:
nrn/test/coreneuron/test_pointer.py
Lines 78 to 80 in b226aab
where the values referred to by some POINTER variables:
nrn/test/coreneuron/mod files/axial.inc
Line 7 in b226aab
are set from Python / the interpreter.
The first RHS,
seg._ref_v
, is a voltage. In #1929 this lives in a "modern" data structure and hence a "smart" data handle must be used to keep track of it.In this case the generated .cpp code from the MOD file reads and writes the pointed-to values, but never attempts to modify which variable is pointed-to (i.e. the pointer value itself).
invlfire.mod example
In this case we have
POINTER r, vecs
(link)and the actual pointer value is read inside a VERBATIM section of a NET_RECEIVE block: (link)
and modified inside a VERBATIM section of a PROCEDURE block: (link)
which is called from HOC (link).
In this case, the variable is not set up to point at any NEURON data structure, but it is assumed that the value can be written to (in the PROCEDURE) and that that value will be saved.
watchrange.mod example
This is similar to invlfire.mod, but uses
BBCOREPOINTER
instead of POINTER:nrn/test/coreneuron/mod files/watchrange.mod
Line 10 in b226aab
As above, the pointer value is updated in a PROCEDURE block:
nrn/test/coreneuron/mod files/watchrange.mod
Lines 92 to 103 in b226aab
and it is used in the INITIAL block:
nrn/test/coreneuron/mod files/watchrange.mod
Lines 39 to 44 in b226aab
and a FUNCTION block:
nrn/test/coreneuron/mod files/watchrange.mod
Lines 83 to 87 in b226aab
again, the pointer is not set to point to any internal NEURON data structure. There are many other examples using this pattern.
Other patterns
Beta Was this translation helpful? Give feedback.
All reactions