1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
//@code
// specify an example model
load_file("nrngui.hoc")
create a, b
access a
forall insert hh
objref fih[3]
fih[0] = new FInitializeHandler(0, "fi0()")
fih[1] = new FInitializeHandler(1, "fi1()")
fih[2] = new FInitializeHandler(2, "fi2()")
proc fi0() {
print "fi0() called after v set but before INITIAL blocks"
printf(" a.v=%g a.m_hh=%g\n", a.v, a.m_hh)
a.v = 10
}
proc fi1() {
print "fi1() called after INITIAL blocks but before BREAKPOINT blocks"
print " or variable step initialization."
print " Good place to change any states."
printf(" a.v=%g a.m_hh=%g\n", a.v, a.m_hh)
printf(" b.v=%g b.m_hh=%g\n", b.v, b.m_hh)
b.v = 10
}
proc fi2() {
print "fi2() called after everything initialized. Just before return"
print " from finitialize."
print " Good place to record or plot initial values"
printf(" a.v=%g a.m_hh=%g\n", a.v, a.m_hh)
printf(" b.v=%g b.m_hh=%g\n", b.v, b.m_hh)
}
begintemplate Test
objref fih, this
proc init() {
fih = new FInitializeHandler("p()", this)
}
proc p() {
printf("inside %s.p()\n", this)
}
endtemplate Test
objref test
test = new Test()
stdinit()
fih[0].allprint()
|