Debian Codegraph @

examples/bio_nsg/bio_450cells/vecevent.mod

raw
1 : Vector stream of events
2
3 NEURON {
4 ARTIFICIAL_CELL VecStim
5 }
6
7 ASSIGNED {
8 index
9 etime (ms)
10 space
11 }
12
13 INITIAL {
14 index = 0
15 element()
16 if (index > 0) {
17 net_send(etime - t, 1)
18 }
19 }
20
21 NET_RECEIVE (w) {
22 if (flag == 1) {
23 net_event(t)
24 element()
25 if (index > 0) {
26 net_send(etime - t, 1)
27 }
28 }
29 }
30
31 VERBATIM
32 extern double* vector_vec();
33 extern int vector_capacity();
34 extern void* vector_arg();
35 ENDVERBATIM
36
37 PROCEDURE element() {
38 VERBATIM
39 { void* vv; int i, size; double* px;
40 i = (int)index;
41 if (i >= 0) {
42 vv = *((void**)(&space));
43 if (vv) {
44 size = vector_capacity(vv);
45 px = vector_vec(vv);
46 if (i < size) {
47 etime = px[i];
48 index += 1.;
49 }else{
50 index = -1.;
51 }
52 }else{
53 index = -1.;
54 }
55 }
56 }
57 ENDVERBATIM
58 }
59
60 PROCEDURE play() {
61 VERBATIM
62 void** vv;
63 vv = (void**)(&space);
64 *vv = (void*)0;
65 if (ifarg(1)) {
66 *vv = vector_arg(1);
67 }
68 ENDVERBATIM
69 }
70
71