Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start documenting pointers. #1151

Merged
merged 2 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions docs/contents/pointers.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
NMODL "pointers"
================

Mechanisms can refer to values in other mechanisms, e.g. the sodium current
``ina``. Therefore, it supports a notion of "pointer", called ``Datum``. A datum
can store a pointer to a double, a stable pointer to a double, integers, or
pointers to anything else.

Integer Variables
-----------------
One important subset of Datum are pointers to RANGE variables. Meaning they are
pointers to parameters in other mechanisms or pointers to the parameters
associated with each node, e.g. the voltage. Since the storage of RANGE
variable is controlled by NEURON/CoreNEURON, these pointers have stronger
semantics than a ``double*``.

These make up the majority of usecases for Datum; and are considered the
well-mannered subset.

In CoreNEURON this subset of Datums are treated differently for other Datums.
Because CoreNEURON stores the values these Datums can point to in a single
contiguous array of doubles, the "pointers" can be expressed as indices into
this array.

Therefore, this subset of Datums is referred to as "integer variables".

In NEURON these pointers are a ``data_handle`` to the value they point to.
Before the simulation phase they are "resolved" and a cache stores a list of
``double*`` to the appropriate values.

1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ About NMODL
:caption: Contents:

contents/visitors
contents/pointers

.. toctree::
:maxdepth: 3
Expand Down
Loading