NEURON
nrncore_io.cpp
Go to the documentation of this file.
1 #include "nrncore_io.h"
4 
5 #include <cstdlib>
6 #include "nrnmpi.h"
7 #include "section.h"
8 #include "hocdec.h"
9 #include "ocfile.h" // for idDirExist and makePath
10 #include "nrnran123.h" // globalindex written to globals.dat
11 #include "cvodeobj.h"
12 #include "netcvode.h" // for nrnbbcore_vecplay_write
13 #include "vrecitem.h" // for nrnbbcore_vecplay_write
14 #include <fstream>
15 #include <sstream>
16 #include "nrnsection_mapping.h"
17 
18 extern short* nrn_is_artificial_;
19 extern int* bbcore_dparam_size;
23 
24 int chkpnt;
25 const char* bbcore_write_version = "1.5"; // Generalize POINTER to allow pointing to any RANGE
26  // variable
27 
28 /// create directory with given path
29 void create_dir_path(const std::string& path) {
30  // only one rank needs to create directory
31  if (nrnmpi_myid == 0) {
32  if (!isDirExist(path)) {
33  if (!makePath(path)) {
34  hoc_execerror(path.c_str(), "directory did not exist and makePath for it failed");
35  }
36  }
37  }
38  // rest of the ranks should wait before continue simulation
39 #ifdef NRNMPI
41 #endif
42 }
43 
44 std::string get_write_path() {
45  std::string path("."); // default path
46  if (ifarg(1)) {
47  path = hoc_gargstr(1);
48  }
49  return path;
50 }
51 
52 std::string get_filename(const std::string& path, std::string file_name) {
53  std::string fname(path + '/' + file_name);
54  nrn_assert(fname.size() < 1024);
55  return fname;
56 }
57 
58 
59 void write_memb_mech_types(const char* fname) {
60  if (nrnmpi_myid > 0) {
61  return;
62  } // only rank 0 writes this file
63  std::ofstream fs(fname);
64  if (!fs.good()) {
65  hoc_execerror("nrncore_write write_mem_mech_types could not open for writing: %s\n", fname);
66  }
68 }
69 
70 
71 // format is name value
72 // with last line of 0 0
73 // In case of an array, the line is name[num] with num lines following with
74 // one value per line. Values are %.20g format.
75 void write_globals(const char* fname) {
76  if (nrnmpi_myid > 0) {
77  return;
78  } // only rank 0 writes this file
79 
80  FILE* f = fopen(fname, "w");
81  if (!f) {
82  hoc_execerror("nrncore_write write_globals could not open for writing: %s\n", fname);
83  }
84 
85  fprintf(f, "%s\n", bbcore_write_version);
86  const char* name;
87  int size; // 0 means scalar, is 0 will still allocated one element for val.
88  double* val = NULL; // Allocated by new in get_global_item, must be delete [] here.
89  // Note that it is possible for get_global_dbl_item to return NULL but
90  // name, size, and val must still be handled if val != NULL
91  for (void* sp = NULL;;) {
92  sp = get_global_dbl_item(sp, name, size, val);
93  if (val) {
94  if (size) {
95  fprintf(f, "%s[%d]\n", name, size);
96  for (int i = 0; i < size; ++i) {
97  fprintf(f, "%.20g\n", val[i]);
98  }
99  } else {
100  fprintf(f, "%s %.20g\n", name, val[0]);
101  }
102  delete[] val;
103  val = NULL;
104  }
105  if (!sp) {
106  break;
107  }
108  }
109  fprintf(f, "0 0\n");
110  fprintf(f, "secondorder %d\n", secondorder);
111  fprintf(f, "Random123_globalindex %d\n", nrnran123_get_globalindex());
112  fprintf(f, "_nrnunit_use_legacy_ %d\n", _nrnunit_use_legacy_);
113 
114  fclose(f);
115 }
116 
117 
118 void write_nrnthread(const char* path, NrnThread& nt, CellGroup& cg) {
119  char fname[1000];
120  if (cg.n_output <= 0) {
121  return;
122  }
123  assert(cg.group_id >= 0);
124  nrn_assert(snprintf(fname, 1000, "%s/%d_1.dat", path, cg.group_id) < 1000);
125  FILE* f = fopen(fname, "wb");
126  if (!f) {
127  hoc_execerror("nrncore_write write_nrnthread could not open for writing:", fname);
128  }
129  fprintf(f, "%s\n", bbcore_write_version);
130 
131  // nrnthread_dat1(int tid, int& n_presyn, int& n_netcon, int*& output_gid, int*& netcon_srcgid);
132  fprintf(f, "%d npresyn\n", cg.n_presyn);
133  fprintf(f, "%d nnetcon\n", cg.n_netcon);
134  writeint(cg.output_gid, cg.n_presyn);
136 
137  if (cg.output_gid) {
138  delete[] cg.output_gid;
139  cg.output_gid = NULL;
140  }
141  if (cg.netcon_srcgid) {
142  delete[] cg.netcon_srcgid;
143  cg.netcon_srcgid = NULL;
144  }
145  fclose(f);
146 
147  nrn_assert(snprintf(fname, 1000, "%s/%d_2.dat", path, cg.group_id) < 1000);
148  f = fopen(fname, "w");
149  if (!f) {
150  hoc_execerror("nrncore_write write_nrnthread could not open for writing:", fname);
151  }
152 
153  fprintf(f, "%s\n", bbcore_write_version);
154 
155  // sizes and total data count
156  int ngid, n_real_gid, nnode, ndiam, nmech, *tml_index, *ml_nodecount, nidata, nvdata, nweight;
157  nrnthread_dat2_1(nt.id,
158  ngid,
159  n_real_gid,
160  nnode,
161  ndiam,
162  nmech,
163  tml_index,
164  ml_nodecount,
165  nidata,
166  nvdata,
167  nweight);
168 
169  fprintf(f, "%d ngid\n", ngid);
170  fprintf(f, "%d n_real_gid\n", n_real_gid);
171  fprintf(f, "%d nnode\n", nnode);
172  fprintf(f, "%d ndiam\n", ndiam);
173  fprintf(f, "%d nmech\n", nmech);
174 
175  for (int i = 0; i < nmech; ++i) {
176  fprintf(f, "%d\n", tml_index[i]);
177  fprintf(f, "%d\n", ml_nodecount[i]);
178  }
179  delete[] tml_index;
180  delete[] ml_nodecount;
181 
182  fprintf(f, "%d nidata\n", 0);
183  fprintf(f, "%d nvdata\n", nvdata);
184  fprintf(f, "%d nweight\n", nweight);
185 
186  // data
187  int* v_parent_index = NULL;
188  double *a = NULL, *b = NULL, *area = NULL, *v = NULL, *diamvec = NULL;
189  nrnthread_dat2_2(nt.id, v_parent_index, a, b, area, v, diamvec);
190  assert(cg.n_real_output == nt.ncell);
191  writeint(nt._v_parent_index, nt.end);
192  writedbl(nt._actual_a, nt.end);
193  writedbl(nt._actual_b, nt.end);
194  writedbl(nt._actual_area, nt.end);
195  writedbl(nt._actual_v, nt.end);
196  if (cg.ndiam) {
197  writedbl(diamvec, nt.end);
198  delete[] diamvec;
199  }
200 
201  // mechanism data
202  int dsz_inst = 0;
203  MlWithArt& mla = cg.mlwithart;
204  for (size_t i = 0; i < mla.size(); ++i) {
205  int type = mla[i].first;
206  int *nodeindices = NULL, *pdata = NULL;
207  double* data = NULL;
208  std::vector<int> pointer2type;
209  nrnthread_dat2_mech(nt.id, i, dsz_inst, nodeindices, data, pdata, pointer2type);
210  Memb_list* ml = mla[i].second;
211  int n = ml->nodecount;
212  int sz = nrn_prop_param_size_[type];
213  if (nodeindices) {
215  }
216  writedbl(data, n * sz);
217  if (nrn_is_artificial_[type]) {
218  delete[] data;
219  }
220  sz = bbcore_dparam_size[type];
221  if (pdata) {
222  ++dsz_inst;
223  writeint(pdata, n * sz);
224  delete[] pdata;
225  sz = pointer2type.size();
226  fprintf(f, "%d npointer\n", int(sz));
227  if (sz > 0) {
228  writeint(pointer2type.data(), sz);
229  }
230  }
231  }
232 
233  int *output_vindex, *netcon_pnttype, *netcon_pntindex;
234  double *output_threshold, *weights, *delays;
235  nrnthread_dat2_3(nt.id,
236  nweight,
237  output_vindex,
238  output_threshold,
239  netcon_pnttype,
240  netcon_pntindex,
241  weights,
242  delays);
243  writeint(output_vindex, cg.n_presyn);
244  delete[] output_vindex;
245  writedbl(output_threshold, cg.n_real_output);
246  delete[] output_threshold;
247 
248  // connections
249  int n = cg.n_netcon;
250  // printf("n_netcon=%d nweight=%d\n", n, nweight);
251  writeint(netcon_pnttype, n);
252  delete[] netcon_pnttype;
253  writeint(netcon_pntindex, n);
254  delete[] netcon_pntindex;
255  writedbl(weights, nweight);
256  delete[] weights;
257  writedbl(delays, n);
258  delete[] delays;
259 
260  // special handling for BBCOREPOINTER
261  // how many mechanisms require it
263  fprintf(f, "%d bbcorepointer\n", n);
264  // for each of those, what is the mech type and data size
265  // and what is the data
266  for (size_t i = 0; i < mla.size(); ++i) {
267  int type = mla[i].first;
268  if (nrn_bbcore_write_[type]) {
269  int icnt, dcnt, *iArray;
270  double* dArray;
271  nrnthread_dat2_corepointer_mech(nt.id, type, icnt, dcnt, iArray, dArray);
272  fprintf(f, "%d\n", type);
273  fprintf(f, "%d\n%d\n", icnt, dcnt);
274  if (icnt) {
275  writeint(iArray, icnt);
276  delete[] iArray;
277  }
278  if (dcnt) {
279  writedbl(dArray, dcnt);
280  delete[] dArray;
281  }
282  }
283  }
284 
286 
287  fclose(f);
288 }
289 
290 
291 void writeint_(int* p, size_t size, FILE* f) {
292  fprintf(f, "chkpnt %d\n", chkpnt++);
293  size_t n = fwrite(p, sizeof(int), size, f);
294  assert(n == size);
295 }
296 
297 void writedbl_(double* p, size_t size, FILE* f) {
298  fprintf(f, "chkpnt %d\n", chkpnt++);
299  size_t n = fwrite(p, sizeof(double), size, f);
300  assert(n == size);
301 }
302 
303 #define writeint(p, size) writeint_(p, size, f)
304 #define writedbl(p, size) writedbl_(p, size, f)
305 
306 void write_contiguous_art_data(double** data, int nitem, int szitem, FILE* f) {
307  fprintf(f, "chkpnt %d\n", chkpnt++);
308  // the assumption is that an fwrite of nitem groups of szitem doubles can be
309  // fread as a single group of nitem*szitem doubles.
310  for (int i = 0; i < nitem; ++i) {
311  size_t n = fwrite(data[i], sizeof(double), szitem, f);
312  assert(n == szitem);
313  }
314 }
315 
316 double* contiguous_art_data(double** data, int nitem, int szitem) {
317  double* d1 = new double[nitem * szitem];
318  int k = 0;
319  for (int i = 0; i < nitem; ++i) {
320  for (int j = 0; j < szitem; ++j) {
321  d1[k++] = data[i][j];
322  }
323  }
324  return d1;
325 }
326 
327 
328 void nrnbbcore_vecplay_write(FILE* f, NrnThread& nt) {
329  // Get the indices in NetCvode.fixed_play_ for this thread
330  // error if not a VecPlayContinuous with no discon vector
331  std::vector<int> indices;
332  nrnthread_dat2_vecplay(nt.id, indices);
333  fprintf(f, "%d VecPlay instances\n", int(indices.size()));
334  for (auto i: indices) {
335  int vptype, mtype, ix, sz;
336  double *yvec, *tvec;
337  // the 'if' is not necessary as item i is certainly in this thread
338  int unused = 0;
340  nt.id, i, vptype, mtype, ix, sz, yvec, tvec, unused, unused, unused)) {
341  fprintf(f, "%d\n", vptype);
342  fprintf(f, "%d\n", mtype);
343  fprintf(f, "%d\n", ix);
344  fprintf(f, "%d\n", sz);
345  writedbl(yvec, sz);
346  writedbl(tvec, sz);
347  }
348  }
349 }
350 
351 
352 static void fgets_no_newline(char* s, int size, FILE* f) {
353  if (fgets(s, size, f) == NULL) {
354  fclose(f);
355  hoc_execerror("Error reading line in files.dat", strerror(errno));
356  }
357  int n = strlen(s);
358  if (n && s[n - 1] == '\n') {
359  s[n - 1] = '\0';
360  }
361 }
362 
363 /** Write all dataset ids to files.dat.
364  *
365  * Format of the files.dat file is:
366  *
367  * version string
368  * -1 (if model uses gap junction)
369  * n (number of datasets) in format %10d
370  * id1
371  * id2
372  * ...
373  * idN
374  */
375 void write_nrnthread_task(const char* path, CellGroup* cgs, bool append) {
376  // ids of datasets that will be created
377  std::vector<int> iSend;
378 
379  // ignore empty nrnthread (has -1 id)
380  for (int iInt = 0; iInt < nrn_nthread; ++iInt) {
381  if (cgs[iInt].group_id >= 0) {
382  iSend.push_back(cgs[iInt].group_id);
383  }
384  }
385 
386  // receive and displacement buffers for mpi
387  std::vector<int> iRecv, iDispl;
388 
389  if (nrnmpi_myid == 0) {
390  iRecv.resize(nrnmpi_numprocs);
391  iDispl.resize(nrnmpi_numprocs);
392  }
393 
394  // number of datasets on the current rank
395  int num_datasets = iSend.size();
396 
397 #ifdef NRNMPI
398  // gather number of datasets from each task
399  if (nrnmpi_numprocs > 1) {
400  nrnmpi_int_gather(&num_datasets, begin_ptr(iRecv), 1, 0);
401  } else {
402  iRecv[0] = num_datasets;
403  }
404 #else
405  iRecv[0] = num_datasets;
406 #endif
407 
408  // total number of datasets across all ranks
409  int iSumThread = 0;
410 
411  // calculate mpi displacements
412  if (nrnmpi_myid == 0) {
413  for (int iInt = 0; iInt < nrnmpi_numprocs; ++iInt) {
414  iDispl[iInt] = iSumThread;
415  iSumThread += iRecv[iInt];
416  }
417  }
418 
419  // buffer for receiving all dataset ids
420  std::vector<int> iRecvVec(iSumThread);
421 
422 #ifdef NRNMPI
423  // gather ids into the array with correspondent offsets
424  if (nrnmpi_numprocs > 1) {
425  nrnmpi_int_gatherv(begin_ptr(iSend),
426  num_datasets,
427  begin_ptr(iRecvVec),
428  begin_ptr(iRecv),
429  begin_ptr(iDispl),
430  0);
431  } else {
432  for (int iInt = 0; iInt < num_datasets; ++iInt) {
433  iRecvVec[iInt] = iSend[iInt];
434  }
435  }
436 #else
437  for (int iInt = 0; iInt < num_datasets; ++iInt) {
438  iRecvVec[iInt] = iSend[iInt];
439  }
440 #endif
441 
442  /// Writing the file with task, correspondent number of threads and list of correspondent first
443  /// gids
444  if (nrnmpi_myid == 0) {
445  // If append is false, begin a new files.dat (overwrite old if exists).
446  // If append is true, append groupids to existing files.dat.
447  // Note: The number of groupids (2nd or 3rd line) has to be
448  // overwritten wih the total number so far. To avoid copying
449  // old to new, we allocate 10 chars for that number.
450 
451  std::stringstream ss;
452  ss << path << "/files.dat";
453 
454  std::string filename = ss.str();
455 
456  FILE* fp = NULL;
457  if (append == false) { // start a new file
458  fp = fopen(filename.c_str(), "w");
459  if (!fp) {
460  hoc_execerror("nrncore_write: could not open for writing:", filename.c_str());
461  }
462  } else { // modify groupid number and append to existing file
463  fp = fopen(filename.c_str(), "r+");
464  if (!fp) {
465  hoc_execerror("nrncore_write append: could not open for modifying:",
466  filename.c_str());
467  }
468  }
469 
470  constexpr int max_line_len = 20;
471  char line[max_line_len]; // All lines are actually no larger than %10d.
472 
473  if (append) {
474  // verify same version
475  fgets_no_newline(line, max_line_len, fp);
476  // unfortunately line has the newline
477  size_t n = strlen(bbcore_write_version);
478  if ((strlen(line) != n) || strncmp(line, bbcore_write_version, n) != 0) {
479  fclose(fp);
480  hoc_execerror("nrncore_write append: existing files.dat has inconsisten version:",
481  line);
482  }
483  } else {
484  fprintf(fp, "%s\n", bbcore_write_version);
485  }
486 
487  // notify coreneuron that this model involves gap junctions
488  if (nrnthread_v_transfer_) {
489  if (append) {
490  fgets_no_newline(line, max_line_len, fp);
491  if (strcmp(line, "-1") != 0) {
492  fclose(fp);
494  "nrncore_write append: existing files.dat does not have a gap junction "
495  "indicator\n",
496  NULL);
497  }
498  } else {
499  fprintf(fp, "-1\n");
500  }
501  }
502 
503  // total number of datasets
504  if (append) {
505  // this is the one that needs the space to get a new value
506  long pos = ftell(fp);
507  fgets_no_newline(line, max_line_len, fp);
508  int oldval = 0;
509  if (sscanf(line, "%d", &oldval) != 1) {
510  fclose(fp);
511  hoc_execerror("nrncore_write append: error reading number of groupids", NULL);
512  }
513  if (oldval == -1) {
514  fclose(fp);
516  "nrncore_write append: existing files.dat has gap junction indicator where we "
517  "expected a groupgid count.",
518  NULL);
519  }
520  iSumThread += oldval;
521  fseek(fp, pos, SEEK_SET);
522  }
523  fprintf(fp, "%10d\n", iSumThread);
524 
525  if (append) {
526  // Start writing the groupids starting at the end of the file.
527  fseek(fp, 0, SEEK_END);
528  }
529 
530  // write all dataset ids
531  for (int i = 0; i < iRecvVec.size(); ++i) {
532  fprintf(fp, "%d\n", iRecvVec[i]);
533  }
534 
535  fclose(fp);
536  }
537 }
538 
539 /** @brief dump mapping information to gid_3.dat file */
540 void nrn_write_mapping_info(const char* path, int gid, NrnMappingInfo& minfo) {
541  /** full path of mapping file */
542  std::stringstream ss;
543  ss << path << "/" << gid << "_3.dat";
544 
545  std::string fname(ss.str());
546  FILE* f = fopen(fname.c_str(), "w");
547 
548  if (!f) {
549  hoc_execerror("nrnbbcore_write could not open for writing:", fname.c_str());
550  }
551 
552  fprintf(f, "%s\n", bbcore_write_version);
553 
554  /** number of gids in NrnThread */
555  fprintf(f, "%zd\n", minfo.size());
556 
557  /** all cells mapping information in NrnThread */
558  for (size_t i = 0; i < minfo.size(); i++) {
559  CellMapping* c = minfo.mapping[i];
560 
561  /** gid, #section, #compartments, #sectionlists */
562  fprintf(f, "%d %d %d %zd\n", c->gid, c->num_sections(), c->num_segments(), c->size());
563 
564  for (size_t j = 0; j < c->size(); j++) {
565  SecMapping* s = c->secmapping[j];
566  /** section list name, number of sections, number of segments */
567  fprintf(f, "%s %d %zd\n", s->name.c_str(), s->nsec, s->size());
568 
569  /** section - segment mapping */
570  if (s->size()) {
571  writeint(&(s->sections.front()), s->size());
572  writeint(&(s->segments.front()), s->size());
573  }
574  }
575  }
576  fclose(f);
577 }
static void nrnmpi_barrier()
short type
Definition: cabvars.h:9
std::vector< MlWithArtItem > MlWithArt
Definition: cell_group.h:16
int group_id
Definition: cell_group.h:25
int n_real_output
Definition: cell_group.h:29
int * netcon_srcgid
Definition: cell_group.h:40
int * output_gid
Definition: cell_group.h:35
int n_presyn
Definition: cell_group.h:27
MlWithArt mlwithart
Definition: cell_group.h:50
int n_netcon
Definition: cell_group.h:38
int n_output
Definition: cell_group.h:28
int ndiam
Definition: cell_group.h:30
static Frame * fp
Definition: code.cpp:161
VEC * cgs(MTX_FN A, void *A_params, VEC *b, VEC *r0, double tol, VEC *x)
Definition: conjgrad.c:179
int secondorder
Definition: init.cpp:96
#define c
void hoc_execerror(const char *, const char *)
Definition: hoc.cpp:754
#define assert(ex)
Definition: hocassrt.h:32
static char line[MAXLINE]
Definition: ivecop.c:35
void
int ifarg(int)
Definition: code.cpp:1581
#define nodeindices
Definition: md1redef.h:26
#define area
Definition: md1redef.h:5
#define v
Definition: md1redef.h:4
#define i
Definition: md1redef.h:12
#define pdata
Definition: md1redef.h:28
char * name
Definition: init.cpp:16
void append(Item *ql, Item *q)
Definition: list.cpp:318
int nrn_nthread
Definition: multicore.cpp:46
#define fprintf
Definition: mwprefix.h:30
int * nrn_prop_param_size_
Definition: init.cpp:140
#define nrn_assert(ex)
Definition: nrnassrt.h:53
int nrnthread_dat2_corepointer_mech(int tid, int type, int &icnt, int &dcnt, int *&iArray, double *&dArray)
int nrnthread_dat2_3(int tid, int nweight, int *&output_vindex, double *&output_threshold, int *&netcon_pnttype, int *&netcon_pntindex, double *&weights, double *&delays)
void * get_global_dbl_item(void *p, const char *&name, int &size, double *&val)
int nrnthread_dat2_1(int tid, int &ngid, int &n_real_gid, int &nnode, int &ndiam, int &nmech, int *&tml_index, int *&ml_nodecount, int &nidata, int &nvdata, int &nweight)
int nrnthread_dat2_vecplay(int tid, std::vector< int > &indices)
int nrnthread_dat2_vecplay_inst(int tid, int i, int &vptype, int &mtype, int &ix, int &sz, double *&yvec, double *&tvec, int &last_index, int &discon_index, int &ubound_index)
void write_memb_mech_types_direct(std::ostream &s)
int nrnthread_dat2_mech(int tid, size_t i, int dsz_inst, int *&nodeindices, double *&data, int *&pdata, std::vector< int > &pointer2type)
int nrnthread_dat2_corepointer(int tid, int &n)
int nrnthread_dat2_2(int tid, int *&v_parent_index, double *&a, double *&b, double *&area, double *&v, double *&diamvec)
short * nrn_is_artificial_
Definition: init.cpp:193
void write_contiguous_art_data(double **data, int nitem, int szitem, FILE *f)
Definition: nrncore_io.cpp:306
void(* nrnthread_v_transfer_)(NrnThread *)
Definition: fadvance.cpp:153
void write_memb_mech_types(const char *fname)
Definition: nrncore_io.cpp:59
#define writeint(p, size)
Definition: nrncore_io.cpp:303
void create_dir_path(const std::string &path)
create directory with given path
Definition: nrncore_io.cpp:29
std::string get_filename(const std::string &path, std::string file_name)
Definition: nrncore_io.cpp:52
void write_globals(const char *fname)
Definition: nrncore_io.cpp:75
void writeint_(int *p, size_t size, FILE *f)
Definition: nrncore_io.cpp:291
int * bbcore_dparam_size
void nrn_write_mapping_info(const char *path, int gid, NrnMappingInfo &minfo)
dump mapping information to gid_3.dat file
Definition: nrncore_io.cpp:540
static void fgets_no_newline(char *s, int size, FILE *f)
Definition: nrncore_io.cpp:352
void write_nrnthread_task(const char *path, CellGroup *cgs, bool append)
Write all dataset ids to files.dat.
Definition: nrncore_io.cpp:375
bbcore_write_t * nrn_bbcore_write_
Definition: init.cpp:152
void write_nrnthread(const char *path, NrnThread &nt, CellGroup &cg)
Definition: nrncore_io.cpp:118
double * contiguous_art_data(double **data, int nitem, int szitem)
Definition: nrncore_io.cpp:316
NetCvode * net_cvode_instance
Definition: cvodestb.cpp:27
void writedbl_(double *p, size_t size, FILE *f)
Definition: nrncore_io.cpp:297
int chkpnt
Definition: nrncore_io.cpp:24
#define writedbl(p, size)
Definition: nrncore_io.cpp:304
void nrnbbcore_vecplay_write(FILE *f, NrnThread &nt)
Definition: nrncore_io.cpp:328
std::string get_write_path()
Definition: nrncore_io.cpp:44
const char * bbcore_write_version
Definition: nrncore_io.cpp:25
T * begin_ptr(std::vector< T > &v)
Definition: nrncore_io.h:18
int const size_t const size_t n
Definition: nrngsl.h:11
size_t p
size_t j
int nrnmpi_myid
int nrnmpi_numprocs
void(*)(double *, int *, int *, int *, double *, Datum *, Datum *, NrnThread *) bbcore_write_t
Definition: init.cpp:151
static philox4x32_key_t k
Definition: nrnran123.cpp:11
uint32_t nrnran123_get_globalindex()
Definition: nrnran123.cpp:24
bool makePath(const std::string &path)
Definition: ocfile.cpp:561
bool isDirExist(const std::string &path)
Definition: ocfile.cpp:545
#define data
Definition: rbtqueue.cpp:49
int _nrnunit_use_legacy_
Definition: hoc_init.cpp:409
FILE * fopen()
#define NULL
Definition: sptree.h:16
Compartment mapping information for a cell.
int nodecount
Definition: nrnoc_ml.h:18
Compartment mapping information for NrnThread.
size_t size()
number of cells
std::vector< CellMapping * > mapping
list of cells mapping
Represent main neuron object computed by single thread.
Definition: multicore.h:58
int * _v_parent_index
Definition: multicore.h:76
int ncell
Definition: multicore.h:64
int id
Definition: multicore.h:66
int end
Definition: multicore.h:65
double * _actual_b
Definition: multicore.h:73
double * _actual_v
Definition: multicore.h:74
double * _actual_a
Definition: multicore.h:72
double * _actual_area
Definition: multicore.h:75
Section to segment mapping.
std::string name
name of section list
std::vector< int > segments
list of segments
int nsec
number of sections in section list
std::vector< int > sections
list sections associated with each segment
static const char * fname(const char *name)
Definition: nrnbbs.cpp:113