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