@@ -364,52 +364,53 @@ const char* nrn_version(int) {
364
364
// bsize = 0 then per step transfer
365
365
// bsize > 1 then full trajectory save into arrays.
366
366
void get_nrn_trajectory_requests (int bsize) {
367
- if (nrn2core_get_trajectory_requests_) {
368
- for (int tid=0 ; tid < nrn_nthread; ++tid) {
369
- NrnThread& nt = nrn_threads[tid];
370
- int n_pr;
371
- int n_trajec;
372
- int * types;
373
- int * indices;
374
- void ** vpr;
375
- double ** varrays;
376
- double ** pvars;
377
-
378
- // bsize is passed by reference, the return value will determine if
379
- // per step return or entire trajectory return.
380
- (*nrn2core_get_trajectory_requests_)(tid, bsize, n_pr, vpr, n_trajec, types, indices, pvars, varrays);
381
- delete_trajectory_requests (nt);
382
- if (n_trajec) {
383
- TrajectoryRequests* tr = new TrajectoryRequests;
384
- nt.trajec_requests = tr;
385
- tr->bsize = bsize;
386
- tr->n_pr = n_pr;
387
- tr->n_trajec = n_trajec;
388
- tr->vsize = 0 ;
389
- tr->vpr = vpr;
390
- tr->gather = new double *[n_trajec];
391
- tr->varrays = varrays;
392
- tr->scatter = pvars;
393
- for (int i=0 ; i < n_trajec; ++i) {
394
- tr->gather [i] = stdindex2ptr (types[i], indices[i], nt);
367
+ if (nrn2core_get_trajectory_requests_) {
368
+ for (int tid = 0 ; tid < nrn_nthread; ++tid) {
369
+ NrnThread& nt = nrn_threads[tid];
370
+ int n_pr;
371
+ int n_trajec;
372
+ int * types;
373
+ int * indices;
374
+ void ** vpr;
375
+ double ** varrays;
376
+ double ** pvars;
377
+
378
+ // bsize is passed by reference, the return value will determine if
379
+ // per step return or entire trajectory return.
380
+ (*nrn2core_get_trajectory_requests_)(tid, bsize, n_pr, vpr, n_trajec, types, indices,
381
+ pvars, varrays);
382
+ delete_trajectory_requests (nt);
383
+ if (n_trajec) {
384
+ TrajectoryRequests* tr = new TrajectoryRequests;
385
+ nt.trajec_requests = tr;
386
+ tr->bsize = bsize;
387
+ tr->n_pr = n_pr;
388
+ tr->n_trajec = n_trajec;
389
+ tr->vsize = 0 ;
390
+ tr->vpr = vpr;
391
+ tr->gather = new double *[n_trajec];
392
+ tr->varrays = varrays;
393
+ tr->scatter = pvars;
394
+ for (int i = 0 ; i < n_trajec; ++i) {
395
+ tr->gather [i] = stdindex2ptr (types[i], indices[i], nt);
396
+ }
397
+ delete[] types;
398
+ delete[] indices;
399
+ }
395
400
}
396
- delete [] types;
397
- delete [] indices;
398
- }
399
401
}
400
- }
401
402
}
402
403
403
404
static void trajectory_return () {
404
- if (nrn2core_trajectory_return_) {
405
- for (int tid=0 ; tid < nrn_nthread; ++tid) {
406
- NrnThread& nt = nrn_threads[tid];
407
- TrajectoryRequests* tr = nt.trajec_requests ;
408
- if (tr && tr->varrays ) {
409
- (*nrn2core_trajectory_return_)(tid, tr->n_pr , tr->vsize , tr->vpr , nt._t );
410
- }
405
+ if (nrn2core_trajectory_return_) {
406
+ for (int tid = 0 ; tid < nrn_nthread; ++tid) {
407
+ NrnThread& nt = nrn_threads[tid];
408
+ TrajectoryRequests* tr = nt.trajec_requests ;
409
+ if (tr && tr->varrays ) {
410
+ (*nrn2core_trajectory_return_)(tid, tr->n_pr , tr->vsize , tr->vpr , nt._t );
411
+ }
412
+ }
411
413
}
412
- }
413
414
}
414
415
415
416
} // namespace coreneuron
@@ -493,7 +494,7 @@ extern "C" int run_solve_core(int argc, char** argv) {
493
494
if (corenrn_embedded) {
494
495
// arg is vector size required but NEURON can instead
495
496
// specify that returns will be on a per time step basis.
496
- get_nrn_trajectory_requests (int (tstop/ dt) + 2 );
497
+ get_nrn_trajectory_requests (int (tstop / dt) + 2 );
497
498
(*nrn2core_part2_clean_)();
498
499
}
499
500
0 commit comments