NEURON
Prop Struct Reference

#include <section.h>

Public Member Functions

 Prop (Node *node, short type)
 
auto id () const
 Get the identifier of this instance. More...
 
bool owns (neuron::container::data_handle< double > const &handle) const
 Check if the given handle refers to data owned by this Prop. More...
 
double & param (int field_index, int array_index=0)
 Return a reference to the i-th floating point data field associated with this Prop. More...
 
double const & param (int field_index, int array_index=0) const
 Return a reference to the i-th double value associated with this Prop. More...
 
auto param_handle (int field, int array_index=0)
 Return a handle to the i-th double value associated with this Prop. More...
 
auto param_handle (neuron::container::field_index ind)
 
double & param_legacy (int legacy_index)
 
double const & param_legacy (int legacy_index) const
 
auto param_handle_legacy (int legacy_index)
 
int param_size () const
 Return how many double values are assocated with this Prop. More...
 
int param_num_vars () const
 Return how many (possibly-array) variables are associated with this Prop. More...
 
int param_array_dimension (int field) const
 Return the array dimension of the given value. More...
 
std::size_t current_row () const
 

Public Attributes

Nodenode
 
Propnext
 
short _type
 
int dparam_size
 
Datumdparam
 
long _alloc_seq
 
Objectob
 

Private Member Functions

std::pair< int, int > translate_legacy_index (int legacy_index) const
 Translate a legacy (flat) index into a (variable, array offset) pair. More...
 

Private Attributes

std::optional< neuron::container::Mechanism::owning_handlem_mech_handle
 

Friends

std::ostream & operator<< (std::ostream &os, Prop const &p)
 

Detailed Description

Definition at line 231 of file section.h.

Constructor & Destructor Documentation

◆ Prop()

Prop::Prop ( Node node,
short  type 
)
inline

Definition at line 234 of file section.h.

Member Function Documentation

◆ current_row()

std::size_t Prop::current_row ( ) const
inline

Definition at line 390 of file section.h.

◆ id()

auto Prop::id ( ) const
inline

Get the identifier of this instance.

Definition at line 256 of file section.h.

◆ owns()

bool Prop::owns ( neuron::container::data_handle< double > const &  handle) const
inline

Check if the given handle refers to data owned by this Prop.

Definition at line 264 of file section.h.

◆ param() [1/2]

double& Prop::param ( int  field_index,
int  array_index = 0 
)
inline

Return a reference to the i-th floating point data field associated with this Prop.

Note that there is a subtlety with the numbering scheme in case of array variables. If we have 3 array variables (a, b, c) with dimensions x, y, z: a[x] b[y] c[z] then, for example, the second element of b (assume y >= 2) is obtained with param(1, 1). In AoS NEURON these values were all stored contiguously, and the values were obtained using a single index; taking the same example, the second element of b used to be found at index x + 1 in the param array. In all of the above, scalar variables are treated the same and simply have dimension 1. In SoA NEURON then a[1] is stored immediately after a[0] in memory, but for a given mechanism instance b[0] is not stored immediately after a[x-1].

It is possible, but a little inefficient, to calculate the new pair of indices from an old index. For that, see the param_legacy and param_handle_legacy functions.

Definition at line 294 of file section.h.

◆ param() [2/2]

double const& Prop::param ( int  field_index,
int  array_index = 0 
) const
inline

Return a reference to the i-th double value associated with this Prop.

See the discussion above about numbering schemes.

Definition at line 304 of file section.h.

◆ param_array_dimension()

int Prop::param_array_dimension ( int  field) const
inline

Return the array dimension of the given value.

Definition at line 385 of file section.h.

◆ param_handle() [1/2]

auto Prop::param_handle ( int  field,
int  array_index = 0 
)
inline

Return a handle to the i-th double value associated with this Prop.

See the discussion above about numbering schemes.

Definition at line 314 of file section.h.

◆ param_handle() [2/2]

auto Prop::param_handle ( neuron::container::field_index  ind)
inline

Definition at line 319 of file section.h.

◆ param_handle_legacy()

auto Prop::param_handle_legacy ( int  legacy_index)
inline

Definition at line 355 of file section.h.

◆ param_legacy() [1/2]

double& Prop::param_legacy ( int  legacy_index)
inline

Definition at line 345 of file section.h.

◆ param_legacy() [2/2]

double const& Prop::param_legacy ( int  legacy_index) const
inline

Definition at line 350 of file section.h.

◆ param_num_vars()

int Prop::param_num_vars ( ) const
inline

Return how many (possibly-array) variables are associated with this Prop.

In case of array variables, this ignores array dimensions. i.e. if a mechanism has a[2] b[2] then param_size()=4 and param_num_vars()=2.

Definition at line 377 of file section.h.

◆ param_size()

int Prop::param_size ( ) const
inline

Return how many double values are assocated with this Prop.

In case of array variables, this is the sum over array dimensions. i.e. if a mechanism has a[2] b[2] then param_size()=4 and param_num_vars()=2.

Definition at line 366 of file section.h.

◆ translate_legacy_index()

std::pair<int, int> Prop::translate_legacy_index ( int  legacy_index) const
inlineprivate

Translate a legacy (flat) index into a (variable, array offset) pair.

Todo:
Reimplement this using the new helpers.

Definition at line 328 of file section.h.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
Prop const &  p 
)
friend

Definition at line 395 of file section.h.

Member Data Documentation

◆ _alloc_seq

long Prop::_alloc_seq

Definition at line 251 of file section.h.

◆ _type

short Prop::_type

Definition at line 244 of file section.h.

◆ dparam

Datum* Prop::dparam

Definition at line 247 of file section.h.

◆ dparam_size

int Prop::dparam_size

Definition at line 245 of file section.h.

◆ m_mech_handle

std::optional<neuron::container::Mechanism::owning_handle> Prop::m_mech_handle
private

Definition at line 407 of file section.h.

◆ next

Prop* Prop::next

Definition at line 243 of file section.h.

◆ node

Node* Prop::node

Definition at line 242 of file section.h.

◆ ob

Object* Prop::ob

Definition at line 252 of file section.h.


The documentation for this struct was generated from the following file: