Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a pointer from Prop to Node. #2768

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/nrnoc/section.h
Expand Up @@ -225,17 +225,20 @@ struct Node {
#include "hocdec.h" /* Prop needs Datum and Datum needs Symbol */
#endif


#define PROP_PY_INDEX 10
struct Prop {
// Working assumption is that we can safely equate "Prop" with "instance
// of a mechanism" apart from a few special cases like CABLESECTION
Prop(short type)
: _type{type} {
Prop(Node* node, short type)
: node(node)
, _type{type} {
if (type != CABLESECTION) {
m_mech_handle = neuron::container::Mechanism::owning_handle{
neuron::model().mechanism_data(type)};
}
}
Node* node; /* The node this property belongs to. */
Prop* next; /* linked list of properties */
short _type; /* type of membrane, e.g. passive, HH, etc. */
int dparam_size; /* for notifying hoc_free_val_array */
Expand Down
2 changes: 1 addition & 1 deletion src/nrnoc/treeset.cpp
Expand Up @@ -675,7 +675,7 @@ Prop* prop_alloc(Prop** pp, int type, Node* nd) {
nrn_alloc_node_ = nd; // this might be null
v_structure_change = 1;
current_prop_list = pp;
auto* p = new Prop{static_cast<short>(type)};
auto* p = new Prop{nd, static_cast<short>(type)};
p->next = *pp;
p->ob = nullptr;
p->_alloc_seq = -1;
Expand Down