@@ -707,7 +707,7 @@ void Phase2::set_dependencies(const NrnThread& nt, const std::vector<Memb_func>&
707707 free (mech_deps);
708708}
709709
710- void Phase2::handle_weights (NrnThread& nt, int n_netcon) {
710+ void Phase2::handle_weights (NrnThread& nt, int n_netcon, NrnThreadChkpnt& ntc ) {
711711 nt.n_weight = weights.size ();
712712 // weights in netcons order in groups defined by Point_process target type.
713713 nt.weights = (double *) ecalloc_align (nt.n_weight , sizeof (double ));
@@ -731,21 +731,24 @@ void Phase2::handle_weights(NrnThread& nt, int n_netcon) {
731731
732732#if CHKPNTDEBUG
733733 ntc.delay = new double [n_netcon];
734- memcpy (ntc.delay , delay, n_netcon * sizeof (double ));
734+ memcpy (ntc.delay , delay. data () , n_netcon * sizeof (double ));
735735#endif
736736 for (int i = 0 ; i < n_netcon; ++i) {
737737 NetCon& nc = nt.netcons [i];
738738 nc.delay_ = delay[i];
739739 }
740740}
741741
742- void Phase2::get_info_from_bbcore (NrnThread& nt, const std::vector<Memb_func>& memb_func) {
742+ void Phase2::get_info_from_bbcore (NrnThread& nt,
743+ const std::vector<Memb_func>& memb_func,
744+ NrnThreadChkpnt& ntc) {
743745 // BBCOREPOINTER information
744746#if CHKPNTDEBUG
745747 ntc.nbcp = num_point_process;
746- ntc.bcpicnt = new int [num_point_process];
747- ntc.bcpdcnt = new int [num_point_process];
748- ntc.bcptype = new int [num_point_process];
748+ ntc.bcpicnt = new int [n_mech];
749+ ntc.bcpdcnt = new int [n_mech];
750+ ntc.bcptype = new int [n_mech];
751+ size_t point_proc_id = 0 ;
749752#endif
750753 for (size_t i = 0 ; i < n_mech; ++i) {
751754 int type = mech_types[i];
@@ -754,9 +757,10 @@ void Phase2::get_info_from_bbcore(NrnThread& nt, const std::vector<Memb_func>& m
754757 }
755758 type = tmls[i].type ; // This is not an error, but it has to be fixed I think
756759#if CHKPNTDEBUG
757- ntc.bcptype [i] = type;
758- ntc.bcpicnt [i] = icnt;
759- ntc.bcpdcnt [i] = dcnt;
760+ ntc.bcptype [point_proc_id] = type;
761+ ntc.bcpicnt [point_proc_id] = tmls[i].iArray .size ();
762+ ntc.bcpdcnt [point_proc_id] = tmls[i].dArray .size ();
763+ point_proc_id++;
760764#endif
761765 int ik = 0 ;
762766 int dk = 0 ;
@@ -792,7 +796,7 @@ void Phase2::get_info_from_bbcore(NrnThread& nt, const std::vector<Memb_func>& m
792796 }
793797}
794798
795- void Phase2::set_vec_play (NrnThread& nt) {
799+ void Phase2::set_vec_play (NrnThread& nt, NrnThreadChkpnt& ntc ) {
796800 // VecPlayContinuous instances
797801 // No attempt at memory efficiency
798802 nt.n_vecplay = vec_play_continuous.size ();
@@ -851,7 +855,7 @@ void Phase2::populate(NrnThread& nt, const UserParams& userParams) {
851855 auto & memb_func = corenrn.get_memb_funcs ();
852856#if CHKPNTDEBUG
853857 ntc.mlmap = new Memb_list_chkpnt*[memb_func.size ()];
854- for (int i = 0 ; i < _memb_func .size (); ++i) {
858+ for (int i = 0 ; i < memb_func .size (); ++i) {
855859 ntc.mlmap [i] = nullptr ;
856860 }
857861#endif
@@ -994,7 +998,7 @@ void Phase2::populate(NrnThread& nt, const UserParams& userParams) {
994998 mech_data_layout_transform<int >(ml->pdata , n, szdp, layout);
995999
9961000#if CHKPNTDEBUG // Not substantive. Only for debugging.
997- Memb_list_ckpnt * mlc = ntc.mlmap [type];
1001+ Memb_list_chkpnt * mlc = ntc.mlmap [type];
9981002 mlc->pdata_not_permuted = (int *) coreneuron::ecalloc_align (n * szdp, sizeof (int ));
9991003 if (layout == Layout::AoS) { // only copy
10001004 for (int i = 0 ; i < n; ++i) {
@@ -1064,7 +1068,7 @@ void Phase2::populate(NrnThread& nt, const UserParams& userParams) {
10641068 permute_ptr (nt._v_parent_index , nt.end , p);
10651069 node_permute (nt._v_parent_index , nt.end , p);
10661070
1067- #if DEBUG
1071+ #if CORENRN_DEBUG
10681072 for (int i = 0 ; i < nt.end ; ++i) {
10691073 printf (" parent[%d] = %d\n " , i, nt._v_parent_index [i]);
10701074 }
@@ -1129,15 +1133,15 @@ void Phase2::populate(NrnThread& nt, const UserParams& userParams) {
11291133 // nt.presyns order same as output_vindex order
11301134#if CHKPNTDEBUG
11311135 ntc.output_vindex = new int [nt.n_presyn ];
1132- memcpy (ntc.output_vindex , output_vindex, nt.n_presyn * sizeof (int ));
1136+ memcpy (ntc.output_vindex , output_vindex. data () , nt.n_presyn * sizeof (int ));
11331137#endif
11341138 if (nt._permute ) {
11351139 // only indices >= 0 (i.e. _actual_v indices) will be changed.
11361140 node_permute (output_vindex.data (), nt.n_presyn , nt._permute );
11371141 }
11381142#if CHKPNTDEBUG
11391143 ntc.output_threshold = new double [nt.ncell ];
1140- memcpy (ntc.output_threshold , output_threshold, nt.ncell * sizeof (double ));
1144+ memcpy (ntc.output_threshold , output_threshold. data () , nt.ncell * sizeof (double ));
11411145#endif
11421146 for (int i = 0 ; i < nt.n_presyn ; ++i) { // real cells
11431147 PreSyn* ps = nt.presyns + i;
@@ -1182,8 +1186,8 @@ void Phase2::populate(NrnThread& nt, const UserParams& userParams) {
11821186#if CHKPNTDEBUG
11831187 ntc.pnttype = new int [nnetcon];
11841188 ntc.pntindex = new int [nnetcon];
1185- memcpy (ntc.pnttype , pnttype, nnetcon * sizeof (int ));
1186- memcpy (ntc.pntindex , pntindex, nnetcon * sizeof (int ));
1189+ memcpy (ntc.pnttype , pnttype. data () , nnetcon * sizeof (int ));
1190+ memcpy (ntc.pntindex , pntindex. data () , nnetcon * sizeof (int ));
11871191#endif
11881192 for (int i = 0 ; i < nnetcon; ++i) {
11891193 int type = pnttype[i];
@@ -1196,11 +1200,11 @@ void Phase2::populate(NrnThread& nt, const UserParams& userParams) {
11961200 }
11971201 }
11981202
1199- handle_weights (nt, nnetcon);
1203+ handle_weights (nt, nnetcon, ntc );
12001204
1201- get_info_from_bbcore (nt, memb_func);
1205+ get_info_from_bbcore (nt, memb_func, ntc );
12021206
1203- set_vec_play (nt);
1207+ set_vec_play (nt, ntc );
12041208
12051209 if (!events.empty ()) {
12061210 userParams.checkPoints .restore_tqueue (nt, *this );
0 commit comments