NEURON
membfunc.h File Reference
#include "neuron/container/data_handle.hpp"
#include "nrnoc_ml.h"
#include "oc_ansi.h"
#include "options.h"
#include "ion_semantics.h"
#include <string>
#include <type_traits>
#include <vector>
#include <unordered_map>

Go to the source code of this file.

Classes

struct  Memb_func
 
struct  NPyDirectMechFunc
 
struct  BAMech
 
struct  neuron::mechanism::field< T >
 

Namespaces

 neuron
 In mechanism libraries, cannot use auto const token = nrn_ensure_model_data_are_sorted(); because the return type is incomplete (from include/neuron/model_data.hpp).
 
 neuron::extracellular
 
 neuron::mechanism
 
 neuron::mechanism::detail
 
 neuron::mechanism::_get
 

Macros

#define NULL_CUR   (Pfri) 0
 
#define NULL_ALLOC   (Pfri) 0
 
#define NULL_STATE   (Pfri) 0
 
#define NULL_INITIALIZE   (Pfri) 0
 
#define IMEMFAST   -2
 
#define VINDEX   -1
 
#define CABLESECTION   1
 
#define MORPHOLOGY   2
 
#define CAP   3
 
#define EXTRACELL   5
 
#define nrnocCONST   1
 
#define DEP   2
 
#define STATE   3 /* STATE: See init.cpp and cabvars.h for order of nrnocCONST, DEP, and STATE */
 
#define NRNPOINTER
 
#define _AMBIGUOUS   5
 
#define NMODLRANDOM   6
 
#define BEFORE_INITIAL   0
 
#define AFTER_INITIAL   1
 
#define BEFORE_BREAKPOINT   2
 
#define AFTER_SOLVE   3
 
#define BEFORE_STEP   4
 
#define BEFORE_AFTER_SIZE   5 /* 1 more than the previous */
 

Typedefs

typedef struct NrnThread NrnThread
 
typedef Datum *(* Pfrpdat) ()
 
typedef void(* Pvmi) (struct NrnThread *, Memb_list *, int)
 
typedef void(* Pvmp) (Prop *)
 
typedef int(* nrn_ode_count_t) (int)
 
using nrn_bamech_t = void(*)(Node *, Datum *, Datum *, NrnThread *, Memb_list *, std::size_t, neuron::model_sorted_token const &)
 
using nrn_cur_t = void(*)(neuron::model_sorted_token const &, NrnThread *, Memb_list *, int)
 
using nrn_init_t = nrn_cur_t
 
using nrn_jacob_t = nrn_cur_t
 
using nrn_ode_map_t = void(*)(Prop *, int, neuron::container::data_handle< double > *, neuron::container::data_handle< double > *, double *, int)
 
using nrn_ode_matsol_t = nrn_cur_t
 
using nrn_ode_spec_t = nrn_cur_t
 
using nrn_ode_synonym_t = void(*)(neuron::model_sorted_token const &, NrnThread &, Memb_list &, int)
 
using nrn_state_t = nrn_cur_t
 
using nrn_thread_table_check_t = void(*)(Memb_list *, std::size_t, Datum *, Datum *, double *, NrnThread *, int, neuron::model_sorted_token const &)
 
using NPyDirectMechFuncs = std::unordered_map< std::string, NPyDirectMechFunc * >
 
typedef struct BAMech BAMech
 

Functions

void hoc_register_prop_size (int type, int psize, int dpsize)
 Legacy way of registering mechanism data/pdata size. More...
 
void hoc_register_npy_direct (int type, NPyDirectMechFunc *)
 Support mechanism FUNCTION/PROCEDURE python syntax seg.mech.f() More...
 
void hoc_register_parm_default (int type, const std::vector< double > *)
 
std::size_t neuron::extracellular::xraxial_index_ext (std::size_t ilayer)
 
std::size_t neuron::extracellular::xg_index_ext (std::size_t ilayer)
 
std::size_t neuron::extracellular::xc_index_ext (std::size_t ilayer)
 
std::size_t neuron::extracellular::e_extracellular_index_ext ()
 
std::size_t neuron::extracellular::sav_rhs_index_ext ()
 
std::size_t neuron::extracellular::vext_pseudoindex ()
 
int nrn_dparam_semantics_to_int (const char *)
 
std::vector< int > & nrn_mech_random_indices (int type)
 dparam indices with random semantics for mechtype More...
 
void neuron::mechanism::detail::register_data_fields (int mechtype, std::vector< std::pair< const char *, int >> const &param_info, std::vector< std::pair< const char *, const char * >> const &dparam_info)
 
void neuron::mechanism::detail::register_data_fields (int mechtype, std::vector< std::pair< std::string, int >> const &param_info, std::vector< std::pair< std::string, std::string >> const &dparam_info)
 
template<typename... Fields>
static void neuron::mechanism::register_data_fields (int mech_type, Fields const &... fields)
 Type- and array-aware version of hoc_register_prop_size. More...
 
template<typename >
int neuron::mechanism::get_field_count (int mech_type)
 Get the number of fields (some of which may be arrays) of the given type. More...
 
template<typename T >
T *const * neuron::mechanism::get_data_ptrs (int mech_type)
 Pointer to a range of pointers to the start of contiguous storage ranges. More...
 
template<typename >
int const * neuron::mechanism::get_array_dims (int mech_type)
 Get the array dimensions for fields of the given type. More...
 
std::size_t neuron::mechanism::_get::_current_row (Prop *prop)
 
std::vector< double *const * > const & neuron::mechanism::_get::_pdata_ptr_cache_data (neuron::model_sorted_token const &cache_token, int mech_type)
 
long & _nrn_mechanism_access_alloc_seq (Prop *)
 
Node_nrn_mechanism_access_node (Prop *prop)
 
double & _nrn_mechanism_access_a (Node *)
 
double & _nrn_mechanism_access_b (Node *)
 
double & _nrn_mechanism_access_d (Node *)
 
neuron::container::generic_data_handle *& _nrn_mechanism_access_dparam (Prop *)
 
Extnode *& _nrn_mechanism_access_extnode (Node *)
 
double & _nrn_mechanism_access_param (Prop *, int field, int array_index=0)
 
double & _nrn_mechanism_access_rhs (Node *)
 
double & _nrn_mechanism_access_voltage (Node *)
 
neuron::container::data_handle< double > _nrn_mechanism_get_area_handle (Node *)
 
Section_nrn_mechanism_get_child (Section *)
 
int _nrn_mechanism_get_nnode (Section *)
 
Node_nrn_mechanism_get_node (Section *, int)
 
int _nrn_mechanism_get_num_vars (Prop *)
 
neuron::container::data_handle< double > _nrn_mechanism_get_param_handle (Prop *prop, neuron::container::field_index field)
 
neuron::container::data_handle< double > _nrn_mechanism_get_param_handle (Prop *prop, int field, int array_index=0)
 
Section_nrn_mechanism_get_sibling (Section *)
 
NrnThread_nrn_mechanism_get_thread (Node *)
 
int _nrn_mechanism_get_type (Prop *)
 
int _nrn_mechanism_get_v_node_index (Node *)
 

Variables

std::unordered_map< int, NPyDirectMechFuncsnrn_mech2funcs_map
 
int nrn_nlayer_extracellular
 
static constexpr auto neuron::extracellular::xraxial_index = 0
 
static constexpr auto neuron::extracellular::xg_index = 1
 
static constexpr auto neuron::extracellular::xc_index = 2
 
static constexpr auto neuron::extracellular::e_extracellular_index = 3
 
static constexpr auto neuron::extracellular::i_membrane_index = 4
 
static constexpr auto neuron::extracellular::sav_g_index = 5
 
static constexpr auto neuron::extracellular::sav_rhs_index = 6
 
BAMech ** bamech_
 
std::vector< Memb_funcmemb_func
 
int n_memb_func
 
int * nrn_prop_param_size_
 
int * nrn_prop_dparam_size_
 
std::vector< Memb_listmemb_list
 
short * memb_order_
 
std::unordered_map< int, void(*)(Prop *)> nrn_mech_inst_destruct
 

Macro Definition Documentation

◆ _AMBIGUOUS

#define _AMBIGUOUS   5

Definition at line 166 of file membfunc.h.

◆ AFTER_INITIAL

#define AFTER_INITIAL   1

Definition at line 170 of file membfunc.h.

◆ AFTER_SOLVE

#define AFTER_SOLVE   3

Definition at line 172 of file membfunc.h.

◆ BEFORE_AFTER_SIZE

#define BEFORE_AFTER_SIZE   5 /* 1 more than the previous */

Definition at line 174 of file membfunc.h.

◆ BEFORE_BREAKPOINT

#define BEFORE_BREAKPOINT   2

Definition at line 171 of file membfunc.h.

◆ BEFORE_INITIAL

#define BEFORE_INITIAL   0

Definition at line 169 of file membfunc.h.

◆ BEFORE_STEP

#define BEFORE_STEP   4

Definition at line 173 of file membfunc.h.

◆ CABLESECTION

#define CABLESECTION   1

Definition at line 116 of file membfunc.h.

◆ CAP

#define CAP   3

Definition at line 118 of file membfunc.h.

◆ DEP

#define DEP   2

Definition at line 161 of file membfunc.h.

◆ EXTRACELL

#define EXTRACELL   5

Definition at line 120 of file membfunc.h.

◆ IMEMFAST

#define IMEMFAST   -2

Definition at line 114 of file membfunc.h.

◆ MORPHOLOGY

#define MORPHOLOGY   2

Definition at line 117 of file membfunc.h.

◆ NMODLRANDOM

#define NMODLRANDOM   6

Definition at line 167 of file membfunc.h.

◆ nrnocCONST

#define nrnocCONST   1

Definition at line 160 of file membfunc.h.

◆ NRNPOINTER

#define NRNPOINTER
Value:
4 /* added on to list of mechanism variables.These are \
pointers which connect variables from other mechanisms via the _ppval array. \
*/

Definition at line 163 of file membfunc.h.

◆ NULL_ALLOC

#define NULL_ALLOC   (Pfri) 0

Definition at line 54 of file membfunc.h.

◆ NULL_CUR

#define NULL_CUR   (Pfri) 0

Definition at line 53 of file membfunc.h.

◆ NULL_INITIALIZE

#define NULL_INITIALIZE   (Pfri) 0

Definition at line 56 of file membfunc.h.

◆ NULL_STATE

#define NULL_STATE   (Pfri) 0

Definition at line 55 of file membfunc.h.

◆ STATE

#define STATE   3 /* STATE: See init.cpp and cabvars.h for order of nrnocCONST, DEP, and STATE */

Definition at line 162 of file membfunc.h.

◆ VINDEX

#define VINDEX   -1

Definition at line 115 of file membfunc.h.

Typedef Documentation

◆ BAMech

typedef struct BAMech BAMech

◆ NPyDirectMechFuncs

using NPyDirectMechFuncs = std::unordered_map<std::string, NPyDirectMechFunc*>

Definition at line 108 of file membfunc.h.

◆ nrn_bamech_t

using nrn_bamech_t = void (*)(Node*, Datum*, Datum*, NrnThread*, Memb_list*, std::size_t, neuron::model_sorted_token const&)

Definition at line 24 of file membfunc.h.

◆ nrn_cur_t

using nrn_cur_t = void (*)(neuron::model_sorted_token const&, NrnThread*, Memb_list*, int)

Definition at line 31 of file membfunc.h.

◆ nrn_init_t

Definition at line 32 of file membfunc.h.

◆ nrn_jacob_t

Definition at line 33 of file membfunc.h.

◆ nrn_ode_count_t

typedef int(* nrn_ode_count_t) (int)

Definition at line 23 of file membfunc.h.

◆ nrn_ode_map_t

using nrn_ode_map_t = void (*)(Prop*, int , neuron::container::data_handle<double>* , neuron::container::data_handle<double>* , double* , int )

Definition at line 34 of file membfunc.h.

◆ nrn_ode_matsol_t

Definition at line 40 of file membfunc.h.

◆ nrn_ode_spec_t

Definition at line 41 of file membfunc.h.

◆ nrn_ode_synonym_t

Definition at line 42 of file membfunc.h.

◆ nrn_state_t

Definition at line 43 of file membfunc.h.

◆ nrn_thread_table_check_t

using nrn_thread_table_check_t = void (*)(Memb_list*, std::size_t, Datum*, Datum*, double*, NrnThread*, int, neuron::model_sorted_token const&)

Definition at line 44 of file membfunc.h.

◆ NrnThread

typedef struct NrnThread NrnThread

Definition at line 2 of file membfunc.h.

◆ Pfrpdat

typedef Datum*(* Pfrpdat) ()

Definition at line 20 of file membfunc.h.

◆ Pvmi

typedef void(* Pvmi) (struct NrnThread *, Memb_list *, int)

Definition at line 21 of file membfunc.h.

◆ Pvmp

typedef void(* Pvmp) (Prop *)

Definition at line 22 of file membfunc.h.

Function Documentation

◆ _nrn_mechanism_access_a()

double& _nrn_mechanism_access_a ( Node node)

Definition at line 28 of file membfunc.cpp.

◆ _nrn_mechanism_access_alloc_seq()

long& _nrn_mechanism_access_alloc_seq ( Prop prop)

Definition at line 20 of file membfunc.cpp.

◆ _nrn_mechanism_access_b()

double& _nrn_mechanism_access_b ( Node node)

Definition at line 31 of file membfunc.cpp.

◆ _nrn_mechanism_access_d()

double& _nrn_mechanism_access_d ( Node node)

Definition at line 34 of file membfunc.cpp.

◆ _nrn_mechanism_access_dparam()

neuron::container::generic_data_handle*& _nrn_mechanism_access_dparam ( Prop prop)

Definition at line 37 of file membfunc.cpp.

◆ _nrn_mechanism_access_extnode()

Extnode*& _nrn_mechanism_access_extnode ( Node node)

Definition at line 40 of file membfunc.cpp.

◆ _nrn_mechanism_access_node()

Node* _nrn_mechanism_access_node ( Prop prop)

Definition at line 24 of file membfunc.cpp.

◆ _nrn_mechanism_access_param()

double& _nrn_mechanism_access_param ( Prop prop,
int  field,
int  array_index = 0 
)

Definition at line 43 of file membfunc.cpp.

◆ _nrn_mechanism_access_rhs()

double& _nrn_mechanism_access_rhs ( Node node)

Definition at line 46 of file membfunc.cpp.

◆ _nrn_mechanism_access_voltage()

double& _nrn_mechanism_access_voltage ( Node node)

Definition at line 49 of file membfunc.cpp.

◆ _nrn_mechanism_get_area_handle()

neuron::container::data_handle<double> _nrn_mechanism_get_area_handle ( Node node)

Definition at line 52 of file membfunc.cpp.

◆ _nrn_mechanism_get_child()

Section* _nrn_mechanism_get_child ( Section sec)

Definition at line 59 of file membfunc.cpp.

◆ _nrn_mechanism_get_nnode()

int _nrn_mechanism_get_nnode ( Section sec)

Definition at line 62 of file membfunc.cpp.

◆ _nrn_mechanism_get_node()

Node* _nrn_mechanism_get_node ( Section sec,
int  idx 
)

Definition at line 65 of file membfunc.cpp.

◆ _nrn_mechanism_get_num_vars()

int _nrn_mechanism_get_num_vars ( Prop prop)

Definition at line 68 of file membfunc.cpp.

◆ _nrn_mechanism_get_param_handle() [1/2]

neuron::container::data_handle<double> _nrn_mechanism_get_param_handle ( Prop prop,
int  field,
int  array_index = 0 
)
inline

Definition at line 316 of file membfunc.h.

◆ _nrn_mechanism_get_param_handle() [2/2]

neuron::container::data_handle<double> _nrn_mechanism_get_param_handle ( Prop prop,
neuron::container::field_index  field 
)

Definition at line 71 of file membfunc.cpp.

◆ _nrn_mechanism_get_sibling()

Section* _nrn_mechanism_get_sibling ( Section sec)

Definition at line 79 of file membfunc.cpp.

◆ _nrn_mechanism_get_thread()

NrnThread* _nrn_mechanism_get_thread ( Node node)

Definition at line 76 of file membfunc.cpp.

◆ _nrn_mechanism_get_type()

int _nrn_mechanism_get_type ( Prop prop)

Definition at line 82 of file membfunc.cpp.

◆ _nrn_mechanism_get_v_node_index()

int _nrn_mechanism_get_v_node_index ( Node node)

Definition at line 85 of file membfunc.cpp.

◆ hoc_register_npy_direct()

void hoc_register_npy_direct ( int  mechtype,
NPyDirectMechFunc f 
)

Support mechanism FUNCTION/PROCEDURE python syntax seg.mech.f()

Python (density) mechanism registration uses nrn_mechs2func_map to create a per mechanism map of f members that can be called directly without prior call to setmech.

Definition at line 957 of file init.cpp.

◆ hoc_register_parm_default()

void hoc_register_parm_default ( int  type,
const std::vector< double > *  pd 
)

Definition at line 741 of file init.cpp.

◆ hoc_register_prop_size()

void hoc_register_prop_size ( int  mechtype,
int  psize,
int  dpsize 
)

Legacy way of registering mechanism data/pdata size.

Superseded by neuron::mechanism::register_data_fields.

Definition at line 970 of file init.cpp.

◆ nrn_dparam_semantics_to_int()

int nrn_dparam_semantics_to_int ( const char *  name)

Definition at line 984 of file init.cpp.

◆ nrn_mech_random_indices()

std::vector<int>& nrn_mech_random_indices ( int  type)

dparam indices with random semantics for mechtype

Definition at line 991 of file init.cpp.

Variable Documentation

◆ bamech_

BAMech** bamech_
extern

Definition at line 151 of file init.cpp.

◆ memb_func

std::vector<Memb_func> memb_func
extern

Definition at line 145 of file init.cpp.

◆ memb_list

std::vector<Memb_list> memb_list
extern

Definition at line 146 of file init.cpp.

◆ memb_order_

short* memb_order_
extern

Definition at line 147 of file init.cpp.

◆ n_memb_func

int n_memb_func
extern

Definition at line 448 of file init.cpp.

◆ nrn_mech2funcs_map

std::unordered_map<int, NPyDirectMechFuncs> nrn_mech2funcs_map
extern

Definition at line 963 of file init.cpp.

◆ nrn_mech_inst_destruct

std::unordered_map<int, void (*)(Prop*)> nrn_mech_inst_destruct
extern

Definition at line 167 of file init.cpp.

◆ nrn_nlayer_extracellular

int nrn_nlayer_extracellular
extern

Definition at line 16 of file extcelln.cpp.

◆ nrn_prop_dparam_size_

int* nrn_prop_dparam_size_
extern

Definition at line 163 of file init.cpp.

◆ nrn_prop_param_size_

int* nrn_prop_param_size_
extern

Definition at line 162 of file init.cpp.