Skip to content

Commit

Permalink
Optimize code generated for diam and area.
Browse files Browse the repository at this point in the history
  • Loading branch information
1uc committed Jun 13, 2024
1 parent 8c39669 commit 2d75d7e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/neuron/cache/mechanism_range.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void indices_to_cache(short type, Callable callable) {
auto const sem = dparam_semantics[field];
// See https://github.com/neuronsimulator/nrn/issues/2312 for discussion of possible
// extensions to caching.
if ((sem > 0 && sem < 1000) || sem == -1 /* area */) {
if ((sem > 0 && sem < 1000) || sem == -1 /* area */ || sem == -9 /* diam */) {
std::invoke(callable, field);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/nmodl/nocpout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2496,15 +2496,15 @@ int iondef(int* p_pointercount) {

if (diamdec) { /* must be last */
Sprintf(buf,
"#define diam *_ppvar[%d].get<double*>()\n",
"#define diam (*(_ml->dptr_field<%d>(_iml)))\n",
ioncount + *p_pointercount + num_random_vars);
q2 = lappendstr(defs_list, buf);
q2->itemtype = VERBATIM;
} /* notice that ioncount is not incremented */
if (areadec) { /* must be last, if we add any more the administrative
procedures must be redone */
Sprintf(buf,
"#define area *_ppvar[%d].get<double*>()\n",
"#define area (*(_ml->dptr_field<%d>(_iml)))\n",
ioncount + *p_pointercount + num_random_vars + diamdec);
q2 = lappendstr(defs_list, buf);
q2->itemtype = VERBATIM;
Expand Down
2 changes: 1 addition & 1 deletion src/nrnoc/treeset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2367,7 +2367,7 @@ neuron::model_sorted_token nrn_ensure_model_data_are_sorted() {
nrn_sort_node_data(node_token, cache);
assert(node_data.is_sorted());
// TODO: maybe we should separate out cache population from sorting.
std::size_t n{}; // eww
std::size_t n{};
model.apply_to_mechanisms([&cache, &n, &mech_tokens](auto& mech_data) {
// TODO do we need to pass `node_token` to `nrn_sort_mech_data`?
nrn_sort_mech_data(mech_tokens[n], cache, mech_data);
Expand Down

0 comments on commit 2d75d7e

Please sign in to comment.