static bool test_all(void){ int id = batch_open( 3 ); test( 0 != id ); int* const n0 = qmalloc( sizeof( int ) ); test( NULL != n0 ); *n0 = 0; test( batch_append( id, callback_0, n0 ) ); int* const n1 = qmalloc( sizeof( int ) ); test( NULL != n1 ); *n1 = 1; test( batch_append( id, callback_1, n1 ) ); test( batch_append( id, batch_callback_nothing, NULL ) ); // full // can success because list auto increase. test( batch_append( id, batch_callback_nothing, NULL ) ); m_cnt = 0; test( batch_exec_close( id ) ); id = 0; test( 2 == m_cnt ); return true; }
batch_run() /* avoid interpreter overhead */ { double tstop, tstep, tnext; char* filename; char* comment; tstopunset; tstop = chkarg(1,0.,1e20); tstep = chkarg(2, 0., 1e20); if (ifarg(3)) { filename = gargstr(3); }else{ filename = 0; } if (ifarg(4)) { comment = gargstr(4); }else{ comment = ""; } if (tree_changed) { setup_topology(); } #if VECTORIZE if (v_structure_change) { v_setup_vectors(); } #endif batch_open(filename, tstop, tstep, comment); batch_out(); if (cvode_active_) { while (t < tstop) { cvode_fadvance(t+tstep); batch_out(); } }else{ tstep -= dt/4.; tstop -= dt/4.; tnext = t + tstep; while (t < tstop) { nrn_fixed_step(); if (t > tnext) { batch_out(); tnext = t + tstep; } if (stoprun) { tstopunset; break; } } } batch_close(); ret(1.); }