sg-s / xolotl

A MATLAB neuron simulator. Very fast (written in C++). Flexible (fully object oriented). Immediate (live manipulation in MATLAB). Comes with a powerful parameter optimizer. Get started ➡️
https://go.brandeis.edu/xolotl
GNU General Public License v3.0
45 stars 8 forks source link

Need a generalized scratch-in/out system to hndle synchronous computation of differnet mechanisms #551

Closed sg-s closed 3 years ago

sg-s commented 3 years ago

The Problem:

compartment can have the following mechanisms:

c1
c2
x1
c3
c4

and they are ordered this way due to alphabetical reasons.

All the c# mechanims read out some value that is computed by x1. The problem now is that c1 and c2 use the old value of x1, and c3 and c4 use the new value of x1, because of the alphabetical listing that determines the order of integration. This is bad. (Realistically, for small dt, this is a non-problem)

The solution

  1. On mechanism addition, the compartment queries the full state size of that mechanism
  2. On initialization, (when all mechs have been added) the compartment creates an array that can store all states from all mechs. Let's call this array mech_states.
  3. After calling integrateMechanisms, read out all mechanism states into mech_states
  4. mechanisms will offer some syntactic sugar (like a getPrevState method) that will read out the correct parts of mech_states
sg-s commented 3 years ago

this also involves removing all getFullState methods, because that should simply call getState