22 void* (*nrn2core_get_global_dbl_item_)(
void*,
const char*&
name,
int& size,
double*& val);
26 using PSD = std::pair<std::size_t, double*>;
27 using N2V = std::map<std::string, PSD>;
35 for (
size_t i = 0; ds[
i].
name; ++
i) {
38 for (
size_t i = 0; dv[
i].
name; ++
i) {
43 void set_globals(
const char* path,
bool cli_global_seed,
int cli_global_seed_value) {
48 (*n2v)[
"dt"] =
PSD(0, &
dt);
49 (*n2v)[
"t"] =
PSD(0, &
t);
50 (*n2v)[
"PI"] =
PSD(0, &
pi);
56 double* val =
nullptr;
59 p = (*nrn2core_get_global_dbl_item_)(
p,
name, size, val);
64 N2V::iterator it =
n2v->find(
name);
65 if (it !=
n2v->end()) {
68 *(it->second.second) = val[0];
71 double*
pval = it->second.second;
72 for (
int i = 0;
i < size; ++
i) {
84 secondorder = (*nrn2core_get_global_int_item_)(
"secondorder");
88 std::string fname = std::string(path) + std::string(
"/globals.dat");
89 FILE* f = fopen(fname.c_str(),
"r");
91 printf(
"ignore: could not open %s\n", fname.c_str());
108 if (sscanf(line,
"%s %lf",
name, &val) == 2) {
109 if (strcmp(
name,
"0") == 0) {
113 if (it !=
n2v->end()) {
115 *(it->second.second) = val;
117 }
else if (sscanf(line,
"%[^[][%d]\n",
name, &
n) == 2) {
118 if (strcmp(
name,
"0") == 0) {
122 if (it !=
n2v->end()) {
124 double*
pval = it->second.second;
125 for (
int i = 0;
i <
n; ++
i) {
136 while (fgets(line, 256, f)) {
139 if (sscanf(line,
"%s %d",
name, &
n) == 2) {
140 if (strcmp(
name,
"secondorder") == 0) {
142 }
else if (strcmp(
name,
"Random123_globalindex") == 0) {
151 if (cli_global_seed) {
157 for (
const auto& item: *
n2v) {
158 printf(
"%s %ld %p\n", item.first.c_str(), item.second.first, item.second.second);
int(* nrn2core_get_global_int_item_)(const char *name)
THIS FILE IS AUTO GENERATED DONT MODIFY IT.
void nrnran123_set_globalindex(uint32_t gix)
void set_globals(const char *path, bool cli_global_seed, int cli_global_seed_value)
void check_bbcore_write_version(const char *)
void hoc_register_var(DoubScal *ds, DoubVec *dv, VoidFunc *)
std::pair< std::size_t, double * > PSD
std::map< std::string, PSD > N2V
bool corenrn_embedded
--> Coreneuron
#define nrn_assert(x)
assert()-like macro, independent of NDEBUG status
int const size_t const size_t n