![]() |
NEURON
|
Version of Memb_list for use in performance-critical code. More...
#include <mechanism_range.hpp>
Public Member Functions | |
MechanismRange (neuron::model_sorted_token const &cache_token, Memb_list &ml) | |
Construct a MechanismRange from sorted model data. More... | |
MechanismRange (neuron::model_sorted_token const &cache_token, NrnThread &, Memb_list &ml, int type) | |
Deprecated. More... | |
template<int variable, int array_size> | |
double * | data_array (std::size_t instance) |
Get the range of values for an array RANGE variable. More... | |
template<int variable, int array_size> | |
double * | data_array_ptr () |
template<int variable> | |
double & | fpfield (std::size_t instance) |
Get a RANGE variable value. More... | |
template<int variable> | |
double * | fpfield_ptr () |
double & | data (std::size_t instance, container::field_index ind) |
Get a RANGE variable value. More... | |
template<int variable> | |
double * | dptr_field (std::size_t instance) |
Get a POINTER variable. More... | |
template<int variable> | |
double *const * | dptr_field_ptr () |
Protected Member Functions | |
MechanismRange (int mech_type, std::size_t offset) | |
Calls MechanismRange(mech_type, offset, offset) . More... | |
MechanismRange (int mech_type, std::size_t data_offset, std::size_t dptr_offset) | |
Sets up the pointers for data (not pdata) and the offsets. More... | |
Protected Attributes | |
double *const * | m_data_ptrs {} |
Pointer to a range of pointers to the start of RANGE variable storage. More... | |
int const * | m_data_array_dims {} |
Pointer to a range of array dimensions for the RANGE variables in this mechanism. More... | |
double *const *const * | m_pdata_ptrs {} |
Pointer to a range of pointers to the start of POINTER variable caches. More... | |
std::size_t | m_data_offset {} |
Offset of this contiguous range of mechanism instances into the global range. More... | |
std::size_t | m_dptr_offset {} |
Version of Memb_list for use in performance-critical code.
Unlike Memb_list, this requires that the number of fields is known at compile time. This is typically only true in translated MOD file code. The idea is that an instance of this class will be created outside a loop over the data vectors and then used inside the loop.
Definition at line 42 of file mechanism_range.hpp.
|
inline |
Construct a MechanismRange from sorted model data.
cache_token | Token showing the model data are sorted. |
ml | Range of mechanisms this MechanismRange refers to. |
This mirrors the signature of the functions (nrn_state, nrn_cur, nrn_init...) that are generated in C++ from MOD files. Typically those generated functions immediately create an instance of MechanismRange using this constructor.
Definition at line 52 of file mechanism_range.hpp.
|
inline |
Deprecated.
Definition at line 60 of file mechanism_range.hpp.
|
inlineprotected |
Calls MechanismRange(mech_type, offset, offset)
.
Definition at line 72 of file mechanism_range.hpp.
|
inlineprotected |
Sets up the pointers for data (not pdata) and the offsets.
data_offset | the offset for data (not pdata). |
dptr_offset | the offset for pdata. |
Definition at line 81 of file mechanism_range.hpp.
|
inline |
Get a RANGE variable value.
instance | Which mechanism instance to access inside this MechanismRange. |
ind | The index of the RANGE variable in the mechanism. This includes both the index of the variable and the index into an array RANGE variable. |
Definition at line 132 of file mechanism_range.hpp.
|
inline |
Get the range of values for an array RANGE variable.
variable | The index of the RANGE variable in the mechanism. |
array_size | The array dimension of the RANGE variable. |
instance | Which mechanism instance to access inside this mechanism range. |
Definition at line 98 of file mechanism_range.hpp.
|
inline |
Definition at line 105 of file mechanism_range.hpp.
|
inline |
Get a POINTER variable.
variable | The index of the POINTER variable in the pdata/dparam entries of the mechanism. |
instance | Which mechanism instance to access inside this mechanism range. |
Definition at line 146 of file mechanism_range.hpp.
|
inline |
Definition at line 152 of file mechanism_range.hpp.
|
inline |
Get a RANGE variable value.
variable | The index of the RANGE variable in the mechanism. |
instance | Which mechanism instance to access inside this MechanismRange. |
This is only intended for use with non-array RANGE variables, otherwise use data_array.
Definition at line 117 of file mechanism_range.hpp.
|
inline |
Definition at line 122 of file mechanism_range.hpp.
|
protected |
Pointer to a range of array dimensions for the RANGE variables in this mechanism.
m_data_array_dims
[i] is the array dimension of the \(\texttt{i}^{th}\) RANGE variable.
Definition at line 172 of file mechanism_range.hpp.
|
protected |
Offset of this contiguous range of mechanism instances into the global range.
Typically if there is more than one thread in the process then the instances of a particular mechanism type will be distributed across multiple NrnThread objects and processed by different threads, and the mechanism data will be permuted so that the instances owned by a given thread are contiguous. In that case the MechanismRange for the 0th thread would have an m_data_offset
of zero, and the MechanismRange for the next thread would have an m_data_offset
of the number of instances in the 0th thread.
Definition at line 195 of file mechanism_range.hpp.
|
protected |
Pointer to a range of pointers to the start of RANGE variable storage.
m_data_ptrs
[i] is a pointer to the start of the contiguous storage for the \(\texttt{i}^{th}\) RANGE variable.
Definition at line 165 of file mechanism_range.hpp.
|
protected |
Definition at line 196 of file mechanism_range.hpp.
|
protected |
Pointer to a range of pointers to the start of POINTER variable caches.
m_pdata_ptrs
[i][j] is the double*
corresponding to the \(\texttt{i}^{th}\) pdata
/ dparam
field and the \(\texttt{j}^{th}\) instance of the mechanism in the program.
Definition at line 181 of file mechanism_range.hpp.