15 template <
typename Callable>
18 auto*
const dparam_semantics =
memb_func[
type].dparam_semantics.get();
22 auto const sem = dparam_semantics[
field];
26 std::invoke(callable,
field);
41 template <std::
size_t NumFloatingPo
intFields, std::
size_t NumDatumFields>
56 assert(ptr_cache.size() <= NumDatumFields);
97 template <
int variable,
int array_size>
99 static_assert(variable < NumFloatingPointFields);
104 template <
int variable,
int array_size>
106 return data_array<variable, array_size>(0);
116 template <
int variable>
117 [[nodiscard]]
double&
fpfield(std::size_t instance) {
118 return *data_array<variable, 1>(instance);
121 template <
int variable>
123 return data_array<variable, 1>(0);
145 template <
int variable>
147 static_assert(variable < NumDatumFields);
151 template <
int variable>
153 static_assert(variable < NumDatumFields);
208 template <std::
size_t NumFloatingPo
intFields, std::
size_t NumDatumFields>
250 if (
this != &other) {
256 for (
auto i = 0;
i < NumDatumFields; ++
i) {
283 template <
typename MechInstance,
typename MechRange>
bool nrn_semantics_is_ion(int i)
int _nrn_mechanism_get_type(Prop *prop)
neuron::container::generic_data_handle *& _nrn_mechanism_access_dparam(Prop *prop)
static const char * mechanism[]
void indices_to_cache(short type, Callable callable)
Call the given method with each dparam index that should be cached for a mechanism.
void set_globals_from_prop(Prop *p, MechInstance &ml, MechRange *&ml_ptr, std::size_t &iml)
Helper for legacy MOD files that mess with _p in VERBATIM blocks.
std::vector< double *const * > const & _pdata_ptr_cache_data(neuron::model_sorted_token const &cache_token, int mech_type)
std::size_t _current_row(Prop *prop)
int get_field_count< double >(int mech_type)
int const * get_array_dims(int mech_type)
Get the array dimensions for fields of the given type.
T *const * get_data_ptrs(int mech_type)
Pointer to a range of pointers to the start of contiguous storage ranges.
int * nrn_prop_dparam_size_
std::vector< Memb_func > memb_func
A view into a set of mechanism instances.
int type() const
Get the mechanism type.
Represent main neuron object computed by single thread.
Specialised version of MechanismRange for a single instance.
MechanismInstance & operator=(MechanismInstance const &other)
Copy assignment.
MechanismInstance(MechanismInstance const &other)
Copy constructor.
std::array< double *, NumDatumFields > m_dptr_cache
Cached double* values for this instance, calculated from Datum.
MechanismInstance(Prop *prop)
Construct from a single mechanism instance.
std::array< double *const *, NumDatumFields > m_dptr_datums
Pointers to m_dptr_cache needed to satisfy MechanismRange's requirements.
Version of Memb_list for use in performance-critical code.
double *const * dptr_field_ptr()
MechanismRange(neuron::model_sorted_token const &cache_token, NrnThread &, Memb_list &ml, int type)
Deprecated.
double & fpfield(std::size_t instance)
Get a RANGE variable value.
std::size_t m_data_offset
Offset of this contiguous range of mechanism instances into the global range.
double *const * m_data_ptrs
Pointer to a range of pointers to the start of RANGE variable storage.
double * data_array_ptr()
MechanismRange(neuron::model_sorted_token const &cache_token, Memb_list &ml)
Construct a MechanismRange from sorted model data.
double * data_array(std::size_t instance)
Get the range of values for an array RANGE variable.
int const * m_data_array_dims
Pointer to a range of array dimensions for the RANGE variables in this mechanism.
double *const *const * m_pdata_ptrs
Pointer to a range of pointers to the start of POINTER variable caches.
double * dptr_field(std::size_t instance)
Get a POINTER variable.
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.
double & data(std::size_t instance, container::field_index ind)
Get a RANGE variable value.
std::size_t m_dptr_offset
MechanismRange(int mech_type, std::size_t offset)
Calls MechanismRange(mech_type, offset, offset).
Struct used to index SoAoS data, such as array range variables.