NEURON
neuron::cache::MechanismInstance< NumFloatingPointFields, NumDatumFields > Struct Template Reference

Specialised version of MechanismRange for a single instance. More...

#include <mechanism_range.hpp>

Inheritance diagram for neuron::cache::MechanismInstance< NumFloatingPointFields, NumDatumFields >:
neuron::cache::MechanismRange< NumFloatingPointFields, NumDatumFields >

Public Types

using base_type = MechanismRange< NumFloatingPointFields, NumDatumFields >
 Shorthand for the MechanismRange base class. More...
 

Public Member Functions

 MechanismInstance (Prop *prop)
 Construct from a single mechanism instance. More...
 
 MechanismInstance (MechanismInstance const &other)
 Copy constructor. More...
 
MechanismInstanceoperator= (MechanismInstance const &other)
 Copy assignment. More...
 
- Public Member Functions inherited from neuron::cache::MechanismRange< NumFloatingPointFields, NumDatumFields >
 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 ()
 

Private Attributes

std::array< double *, NumDatumFields > m_dptr_cache {}
 Cached double* values for this instance, calculated from Datum. More...
 
std::array< double *const *, NumDatumFields > m_dptr_datums {}
 Pointers to m_dptr_cache needed to satisfy MechanismRange's requirements. More...
 

Additional Inherited Members

- Protected Member Functions inherited from neuron::cache::MechanismRange< NumFloatingPointFields, NumDatumFields >
 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 inherited from neuron::cache::MechanismRange< NumFloatingPointFields, NumDatumFields >
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 {}
 

Detailed Description

template<std::size_t NumFloatingPointFields, std::size_t NumDatumFields>
struct neuron::cache::MechanismInstance< NumFloatingPointFields, NumDatumFields >

Specialised version of MechanismRange for a single instance.

This is used inside generated code that takes a single mechanism instance (Prop) instead of a range of instances (Memb_list). A key feature of methods that take Prop is that they should not require a call to nrn_ensure_model_data_are_sorted(). This is conceptually fine, as if we are only concerned with a single mechanism instance then it doesn't matter where it lives in the global storage vectors. In this case, m_dptr_cache contains an array of pointers that m_dptr_datums can refer to.

Definition at line 209 of file mechanism_range.hpp.

Member Typedef Documentation

◆ base_type

template<std::size_t NumFloatingPointFields, std::size_t NumDatumFields>
using neuron::cache::MechanismInstance< NumFloatingPointFields, NumDatumFields >::base_type = MechanismRange<NumFloatingPointFields, NumDatumFields>

Shorthand for the MechanismRange base class.

Definition at line 213 of file mechanism_range.hpp.

Constructor & Destructor Documentation

◆ MechanismInstance() [1/2]

template<std::size_t NumFloatingPointFields, std::size_t NumDatumFields>
neuron::cache::MechanismInstance< NumFloatingPointFields, NumDatumFields >::MechanismInstance ( Prop prop)
inline

Construct from a single mechanism instance.

Parameters
propHandle to a single mechanism instance.

Definition at line 219 of file mechanism_range.hpp.

◆ MechanismInstance() [2/2]

template<std::size_t NumFloatingPointFields, std::size_t NumDatumFields>
neuron::cache::MechanismInstance< NumFloatingPointFields, NumDatumFields >::MechanismInstance ( MechanismInstance< NumFloatingPointFields, NumDatumFields > const &  other)
inline

Copy constructor.

Definition at line 238 of file mechanism_range.hpp.

Member Function Documentation

◆ operator=()

template<std::size_t NumFloatingPointFields, std::size_t NumDatumFields>
MechanismInstance& neuron::cache::MechanismInstance< NumFloatingPointFields, NumDatumFields >::operator= ( MechanismInstance< NumFloatingPointFields, NumDatumFields > const &  other)
inline

Copy assignment.

This has to be implemented manually because the base class (MechanismInstance) member m_pdata_ptrs has to be updated to point at the derived class (MechanismInstance) member m_dptr_datums.

Definition at line 249 of file mechanism_range.hpp.

Member Data Documentation

◆ m_dptr_cache

template<std::size_t NumFloatingPointFields, std::size_t NumDatumFields>
std::array<double*, NumDatumFields> neuron::cache::MechanismInstance< NumFloatingPointFields, NumDatumFields >::m_dptr_cache {}
private

Cached double* values for this instance, calculated from Datum.

Definition at line 268 of file mechanism_range.hpp.

◆ m_dptr_datums

template<std::size_t NumFloatingPointFields, std::size_t NumDatumFields>
std::array<double* const*, NumDatumFields> neuron::cache::MechanismInstance< NumFloatingPointFields, NumDatumFields >::m_dptr_datums {}
private

Pointers to m_dptr_cache needed to satisfy MechanismRange's requirements.

Invariant
m_dptr_datums[i] is equal to &m_dptr_cache[i] for all i.
MechanismInstance::m_pdata_ptrs is equal to m_dptr_datums.data().

Definition at line 275 of file mechanism_range.hpp.


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