From 0f41652fbc65a9e3293fafcc16af7dcab203514e Mon Sep 17 00:00:00 2001 From: Olli Lupton Date: Fri, 24 Mar 2023 14:47:07 +0100 Subject: [PATCH] Cope with Section being a forward declaration. Needed for new data structures. --- README.html | 1 + mod/child.mod | 12 ++++++++---- mod/childa.mod | 13 ++++++++----- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/README.html b/README.html index 7c0fac2..8ebbe10 100644 --- a/README.html +++ b/README.html @@ -61,4 +61,5 @@ Changelog --------- 2023-02-28: updated for C++ compatibility (NEURON 9+) +2023-04-20: updated for SoA data compatibility (NEURON 9+) diff --git a/mod/child.mod b/mod/child.mod index fea047b..866f48e 100644 --- a/mod/child.mod +++ b/mod/child.mod @@ -13,14 +13,18 @@ } VERBATIM + #ifdef NRN_MECHANISM_DATA_IS_SOA + #define get_child(sec) _nrn_mechanism_get_child(sec) + #define get_sibling(sec) _nrn_mechanism_get_sibling(sec) + #else + #define get_child(sec) sec->child + #define get_sibling(sec) sec->sibling + #endif static void subtree(Section* sec, Symbol* sym) { - Section* child; - nrn_pushsec(sec); /* move these three (sec becomes child) */ hoc_run_stmt(sym); /* into the loop to do only the first level */ nrn_popsec(); - - for (child = sec->child; child; child = child->sibling) { + for (Section* child = get_child(sec); child; child = get_sibling(child)) { subtree(child, sym); } } diff --git a/mod/childa.mod b/mod/childa.mod index dc78043..adeb4b7 100644 --- a/mod/childa.mod +++ b/mod/childa.mod @@ -13,12 +13,15 @@ NEURON { } VERBATIM +#ifdef NRN_MECHANISM_DATA_IS_SOA +#define get_child(sec) _nrn_mechanism_get_child(sec) +#define get_sibling(sec) _nrn_mechanism_get_sibling(sec) +#else +#define get_child(sec) sec->child +#define get_sibling(sec) sec->sibling +#endif static void subtree(Section* sec, Symbol* sym) { - Section* child; - - - - for (child = sec->child; child; child = child->sibling) { + for (Section* child = get_child(sec); child; child = get_sibling(child)) { nrn_pushsec(child); /* move these three (sec becomes child) */ hoc_run_stmt(sym); /* into the loop to do only the first level */ nrn_popsec();