You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
962 B
72 lines
962 B
: Vector stream of events |
|
: From NEURON source: nrn/examples/nrniv/netcon/vecevent.mod |
|
|
|
NEURON { |
|
ARTIFICIAL_CELL VecStim |
|
} |
|
|
|
ASSIGNED { |
|
index |
|
etime (ms) |
|
space |
|
} |
|
|
|
INITIAL { |
|
index = 0 |
|
element() |
|
if (index > 0) { |
|
net_send(etime - t, 1) |
|
} |
|
} |
|
|
|
NET_RECEIVE (w) { |
|
if (flag == 1) { |
|
net_event(t) |
|
element() |
|
if (index > 0) { |
|
net_send(etime - t, 1) |
|
} |
|
} |
|
} |
|
|
|
VERBATIM |
|
extern double* vector_vec(); |
|
extern int vector_capacity(); |
|
extern void* vector_arg(); |
|
ENDVERBATIM |
|
|
|
PROCEDURE element() { |
|
VERBATIM |
|
{ void* vv; int i, size; double* px; |
|
i = (int)index; |
|
if (i >= 0) { |
|
vv = *((void**)(&space)); |
|
if (vv) { |
|
size = vector_capacity(vv); |
|
px = vector_vec(vv); |
|
if (i < size) { |
|
etime = px[i]; |
|
index += 1.; |
|
}else{ |
|
index = -1.; |
|
} |
|
}else{ |
|
index = -1.; |
|
} |
|
} |
|
} |
|
ENDVERBATIM |
|
} |
|
|
|
PROCEDURE play() { |
|
VERBATIM |
|
void** vv; |
|
vv = (void**)(&space); |
|
*vv = (void*)0; |
|
if (ifarg(1)) { |
|
*vv = vector_arg(1); |
|
} |
|
ENDVERBATIM |
|
} |
|
|
|
|
|
|