NEURON
nrncore_callbacks.cpp File Reference
#include <vector>
#include <unordered_map>
#include "nrncore_callbacks.h"
#include "nrnconf.h"
#include "nrnmpi.h"
#include "section.h"
#include "netcon.h"
#include "nrncvode.h"
#include "nrniv_mf.h"
#include "hocdec.h"
#include "nrncore_write/utils/nrncore_utils.h"
#include "nrncore_write/data/cell_group.h"
#include "nrncore_write/io/nrncore_io.h"
#include "parse.hpp"
#include "nrnran123.h"
#include "netcvode.h"
#include "vrecitem.h"
#include "nrnwrap_dlfcn.h"
#include "nrnsection_mapping.h"

Go to the source code of this file.

Macros

#define NRN_SENTINAL   100000000000
 

Functions

TQueuenet_cvode_instance_event_queue (NrnThread *)
 
double nrn_ion_charge (Symbol *)
 
void * nrn_interthread_enqueue (NrnThread *)
 
void map_coreneuron_callbacks (void *handle)
 Populate function pointers by mapping function pointers for callback. More...
 
void write_memb_mech_types_direct (std::ostream &s)
 
int get_global_int_item (const char *name)
 
void * get_global_dbl_item (void *p, const char *&name, int &size, double *&val)
 
void nrnthreads_all_weights_return (std::vector< double * > &weights)
 Copy weights from all coreneuron::NrnThread to NetCon instances. More...
 
size_t nrnthreads_type_return (int type, int tid, double *&data, std::vector< double * > &mdata)
 Return location for CoreNEURON to copy data into. More...
 
void nrnthread_group_ids (int *grp)
 
int nrnthread_dat1 (int tid, int &n_presyn, int &n_netcon, std::vector< int > &output_gid, int *&netcon_srcgid, std::vector< int > &netcon_negsrcgid_tid)
 
void nrnthread_dat3_cell_count (int &cell_count)
 
void nrnthread_dat3_cellmapping (int i, int &gid, int &nsec, int &nseg, int &n_seclist)
 
void nrnthread_dat3_secmapping (int i_c, int i_sec, std::string &sclname, int &nsec, int &nseg, size_t &total_lfp_factors, int &n_electrodes, std::vector< int > &data_sec, std::vector< int > &data_seg, std::vector< double > &data_lfp)
 
int nrnthread_dat2_1 (int tid, int &ncell, int &ngid, int &n_real_gid, int &nnode, int &ndiam, int &nmech, int *&tml_index, int *&ml_nodecount, int &nidata, int &nvdata, int &nweight)
 
int nrnthread_dat2_2 (int tid, int *&v_parent_index, double *&a, double *&b, double *&area, double *&v, double *&diamvec)
 
int nrnthread_dat2_mech (int tid, size_t i, int dsz_inst, int *&nodeindices, double *&data, int *&pdata, std::vector< uint32_t > &nmodlrandom, std::vector< int > &pointer2type)
 
int nrnthread_dat2_3 (int tid, int nweight, int *&output_vindex, double *&output_threshold, int *&netcon_pnttype, int *&netcon_pntindex, double *&weights, double *&delays)
 
int nrnthread_dat2_corepointer (int tid, int &n)
 
int nrnthread_dat2_corepointer_mech (int tid, int type, int &icnt, int &dcnt, int *&iArray, double *&dArray)
 
int core2nrn_corepointer_mech (int tid, int type, int icnt, int dcnt, int *iArray, double *dArray)
 
int core2nrn_nmodlrandom (int tid, int type, const std::vector< int > &indices, const std::vector< double > &nmodlrandom)
 
int * datum2int (int type, Memb_list *ml, NrnThread &nt, CellGroup &cg, DatumIndices &di, int ml_vdata_offset, std::vector< int > &pointer2type)
 
void part2_clean ()
 
int nrnthread_dat2_vecplay (int tid, std::vector< int > &indices)
 
int nrnthread_dat2_vecplay_inst (int tid, int i, int &vptype, int &mtype, int &ix, int &sz, double *&yvec, double *&tvec, int &last_index, int &discon_index, int &ubound_index)
 
void core2nrn_vecplay (int tid, int i, int last_index, int discon_index, int ubound_index)
 getting one item at a time from CoreNEURON More...
 
void core2nrn_vecplay_events ()
 start the vecplay events More...
 
void nrn2core_transfer_WatchCondition (WatchCondition *wc, void(*cb)(int, int, int, int, int))
 getting one item at a time from nrn2core_transfer_WATCH More...
 
static void setup_type2semantics ()
 
static void set_info (TQItem *tqi, int tid, NrnCoreTransferEvents *core_te, std::unordered_map< NetCon *, std::vector< size_t >> &netcon2intdata, std::unordered_map< PreSyn *, std::vector< size_t >> &presyn2intdata, std::unordered_map< double *, std::vector< size_t >> &weight2intdata)
 
NrnCoreTransferEventsnrn2core_transfer_tqueue (int tid)
 
void core2nrn_clear_queues (double time)
 Initialize queues before transfer Probably aleady clear, but if binq then must be initialized to time. More...
 
void core2nrn_NetCon_event (int tid, double td, size_t nc_index)
 Called from CoreNEURON core2nrn_tqueue_item. More...
 
static void core2nrn_SelfEvent_helper (int tid, double td, int tar_type, int tar_index, double flag, double *weight, int is_movable)
 
void core2nrn_SelfEvent_event (int tid, double td, int tar_type, int tar_index, double flag, size_t nc_index, int is_movable)
 
void core2nrn_SelfEvent_event_noweight (int tid, double td, int tar_type, int tar_index, double flag, int is_movable)
 
void core2nrn_PreSyn_flag (int tid, std::set< int > presyns_flag_true)
 
void nrn2core_PreSyn_flag (int tid, std::set< int > &presyns_flag_true)
 
void core2nrn_watch_activate (int tid, int type, int watch_begin, Core2NrnWatchInfo &wi)
 
void * nrn_patternstim_info_ref (Datum *)
 
void nrn2core_patternstim (void **info)
 
void nrn2core_subworld_info (int &cnt, int &subworld_index, int &subworld_rank, int &numprocs_subworld, int &numprocs_world)
 

Variables

bbcore_write_tnrn_bbcore_write_
 
bbcore_write_tnrn_bbcore_read_
 
short * nrn_is_artificial_
 
bool corenrn_direct
 
int * bbcore_dparam_size
 
CellGroupcellgroups_
 
NrnMappingInfo mapinfo
 mapping information More...
 
NetCvodenet_cvode_instance
 
char * pnt_map
 
static std::map< int, int > type2movable
 
static int patternstim_type
 

Macro Definition Documentation

◆ NRN_SENTINAL

#define NRN_SENTINAL   100000000000

Function Documentation

◆ core2nrn_clear_queues()

void core2nrn_clear_queues ( double  time)

Initialize queues before transfer Probably aleady clear, but if binq then must be initialized to time.

Definition at line 1124 of file nrncore_callbacks.cpp.

◆ core2nrn_corepointer_mech()

int core2nrn_corepointer_mech ( int  tid,
int  type,
int  icnt,
int  dcnt,
int *  iArray,
double *  dArray 
)

Definition at line 581 of file nrncore_callbacks.cpp.

◆ core2nrn_NetCon_event()

void core2nrn_NetCon_event ( int  tid,
double  td,
size_t  nc_index 
)

Called from CoreNEURON core2nrn_tqueue_item.

Definition at line 1131 of file nrncore_callbacks.cpp.

◆ core2nrn_nmodlrandom()

int core2nrn_nmodlrandom ( int  tid,
int  type,
const std::vector< int > &  indices,
const std::vector< double > &  nmodlrandom 
)

Definition at line 606 of file nrncore_callbacks.cpp.

◆ core2nrn_PreSyn_flag()

void core2nrn_PreSyn_flag ( int  tid,
std::set< int >  presyns_flag_true 
)

Definition at line 1212 of file nrncore_callbacks.cpp.

◆ core2nrn_SelfEvent_event()

void core2nrn_SelfEvent_event ( int  tid,
double  td,
int  tar_type,
int  tar_index,
double  flag,
size_t  nc_index,
int  is_movable 
)

Definition at line 1179 of file nrncore_callbacks.cpp.

◆ core2nrn_SelfEvent_event_noweight()

void core2nrn_SelfEvent_event_noweight ( int  tid,
double  td,
int  tar_type,
int  tar_index,
double  flag,
int  is_movable 
)

Definition at line 1200 of file nrncore_callbacks.cpp.

◆ core2nrn_SelfEvent_helper()

static void core2nrn_SelfEvent_helper ( int  tid,
double  td,
int  tar_type,
int  tar_index,
double  flag,
double *  weight,
int  is_movable 
)
static

Definition at line 1143 of file nrncore_callbacks.cpp.

◆ core2nrn_vecplay()

void core2nrn_vecplay ( int  tid,
int  i,
int  last_index,
int  discon_index,
int  ubound_index 
)

getting one item at a time from CoreNEURON

Definition at line 817 of file nrncore_callbacks.cpp.

◆ core2nrn_vecplay_events()

void core2nrn_vecplay_events ( )

start the vecplay events

Definition at line 830 of file nrncore_callbacks.cpp.

◆ core2nrn_watch_activate()

void core2nrn_watch_activate ( int  tid,
int  type,
int  watch_begin,
Core2NrnWatchInfo wi 
)

Definition at line 1272 of file nrncore_callbacks.cpp.

◆ datum2int()

int* datum2int ( int  type,
Memb_list ml,
NrnThread nt,
CellGroup cg,
DatumIndices di,
int  ml_vdata_offset,
std::vector< int > &  pointer2type 
)

Definition at line 636 of file nrncore_callbacks.cpp.

◆ get_global_dbl_item()

void* get_global_dbl_item ( void *  p,
const char *&  name,
int &  size,
double *&  val 
)

Definition at line 93 of file nrncore_callbacks.cpp.

◆ get_global_int_item()

int get_global_int_item ( const char *  name)

Definition at line 82 of file nrncore_callbacks.cpp.

◆ map_coreneuron_callbacks()

void map_coreneuron_callbacks ( void *  handle)

Populate function pointers by mapping function pointers for callback.

Definition at line 36 of file nrncore_callbacks.cpp.

◆ net_cvode_instance_event_queue()

TQueue* net_cvode_instance_event_queue ( NrnThread nt)

Definition at line 270 of file netcvode.cpp.

◆ nrn2core_patternstim()

void nrn2core_patternstim ( void **  info)

Definition at line 1307 of file nrncore_callbacks.cpp.

◆ nrn2core_PreSyn_flag()

void nrn2core_PreSyn_flag ( int  tid,
std::set< int > &  presyns_flag_true 
)

Definition at line 1249 of file nrncore_callbacks.cpp.

◆ nrn2core_subworld_info()

void nrn2core_subworld_info ( int &  cnt,
int &  subworld_index,
int &  subworld_rank,
int &  numprocs_subworld,
int &  numprocs_world 
)

Definition at line 1324 of file nrncore_callbacks.cpp.

◆ nrn2core_transfer_tqueue()

NrnCoreTransferEvents* nrn2core_transfer_tqueue ( int  tid)

Definition at line 1034 of file nrncore_callbacks.cpp.

◆ nrn2core_transfer_WatchCondition()

void nrn2core_transfer_WatchCondition ( WatchCondition wc,
void(*)(int, int, int, int, int)  cb 
)

getting one item at a time from nrn2core_transfer_WATCH

In nrncore_callbacks.cpp.

Definition at line 841 of file nrncore_callbacks.cpp.

◆ nrn_interthread_enqueue()

void* nrn_interthread_enqueue ( NrnThread nt)

Definition at line 6800 of file netcvode.cpp.

◆ nrn_ion_charge()

double nrn_ion_charge ( Symbol sym)

Definition at line 60 of file eion.cpp.

◆ nrn_patternstim_info_ref()

void* nrn_patternstim_info_ref ( Datum )

◆ nrnthread_dat1()

int nrnthread_dat1 ( int  tid,
int &  n_presyn,
int &  n_netcon,
std::vector< int > &  output_gid,
int *&  netcon_srcgid,
std::vector< int > &  netcon_negsrcgid_tid 
)

Definition at line 215 of file nrncore_callbacks.cpp.

◆ nrnthread_dat2_1()

int nrnthread_dat2_1 ( int  tid,
int &  ncell,
int &  ngid,
int &  n_real_gid,
int &  nnode,
int &  ndiam,
int &  nmech,
int *&  tml_index,
int *&  ml_nodecount,
int &  nidata,
int &  nvdata,
int &  nweight 
)

Definition at line 269 of file nrncore_callbacks.cpp.

◆ nrnthread_dat2_2()

int nrnthread_dat2_2 ( int  tid,
int *&  v_parent_index,
double *&  a,
double *&  b,
double *&  area,
double *&  v,
double *&  diamvec 
)

Definition at line 325 of file nrncore_callbacks.cpp.

◆ nrnthread_dat2_3()

int nrnthread_dat2_3 ( int  tid,
int  nweight,
int *&  output_vindex,
double *&  output_threshold,
int *&  netcon_pnttype,
int *&  netcon_pntindex,
double *&  weights,
double *&  delays 
)

Definition at line 475 of file nrncore_callbacks.cpp.

◆ nrnthread_dat2_corepointer()

int nrnthread_dat2_corepointer ( int  tid,
int &  n 
)

Definition at line 523 of file nrncore_callbacks.cpp.

◆ nrnthread_dat2_corepointer_mech()

int nrnthread_dat2_corepointer_mech ( int  tid,
int  type,
int &  icnt,
int &  dcnt,
int *&  iArray,
double *&  dArray 
)

Definition at line 539 of file nrncore_callbacks.cpp.

◆ nrnthread_dat2_mech()

int nrnthread_dat2_mech ( int  tid,
size_t  i,
int  dsz_inst,
int *&  nodeindices,
double *&  data,
int *&  pdata,
std::vector< uint32_t > &  nmodlrandom,
std::vector< int > &  pointer2type 
)

Definition at line 375 of file nrncore_callbacks.cpp.

◆ nrnthread_dat2_vecplay()

int nrnthread_dat2_vecplay ( int  tid,
std::vector< int > &  indices 
)

Definition at line 734 of file nrncore_callbacks.cpp.

◆ nrnthread_dat2_vecplay_inst()

int nrnthread_dat2_vecplay_inst ( int  tid,
int  i,
int &  vptype,
int &  mtype,
int &  ix,
int &  sz,
double *&  yvec,
double *&  tvec,
int &  last_index,
int &  discon_index,
int &  ubound_index 
)

Definition at line 763 of file nrncore_callbacks.cpp.

◆ nrnthread_dat3_cell_count()

void nrnthread_dat3_cell_count ( int &  cell_count)

Definition at line 234 of file nrncore_callbacks.cpp.

◆ nrnthread_dat3_cellmapping()

void nrnthread_dat3_cellmapping ( int  i,
int &  gid,
int &  nsec,
int &  nseg,
int &  n_seclist 
)

Definition at line 238 of file nrncore_callbacks.cpp.

◆ nrnthread_dat3_secmapping()

void nrnthread_dat3_secmapping ( int  i_c,
int  i_sec,
std::string &  sclname,
int &  nsec,
int &  nseg,
size_t &  total_lfp_factors,
int &  n_electrodes,
std::vector< int > &  data_sec,
std::vector< int > &  data_seg,
std::vector< double > &  data_lfp 
)

Definition at line 246 of file nrncore_callbacks.cpp.

◆ nrnthread_group_ids()

void nrnthread_group_ids ( int *  grp)

Definition at line 208 of file nrncore_callbacks.cpp.

◆ nrnthreads_all_weights_return()

void nrnthreads_all_weights_return ( std::vector< double * > &  weights)

Copy weights from all coreneuron::NrnThread to NetCon instances.

This depends on the CoreNEURON weight order for each thread to be the same as was originally sent from NEURON. See how that order was constructed in CellGroup::mk_cgs_netcon_info.

Definition at line 131 of file nrncore_callbacks.cpp.

◆ nrnthreads_type_return()

size_t nrnthreads_type_return ( int  type,
int  tid,
double *&  data,
std::vector< double * > &  mdata 
)

Return location for CoreNEURON to copy data into.

The type is mechanism type or special negative type for voltage, i_membrane_, or time. See coreneuron/io/nrn_setup.cpp:legacy_index2pointer. We allow coreneuron to copy to NEURON's AoS data as CoreNEURON knows how its data is arranged (SoA and possibly permuted). This function figures out the size (just for sanity check) and data pointer to be returned based on type and thread id. The ARTIFICIAL_CELL type case is special as there is no thread specific Memb_list for those.

Definition at line 159 of file nrncore_callbacks.cpp.

◆ part2_clean()

void part2_clean ( )

Definition at line 700 of file nrncore_callbacks.cpp.

◆ set_info()

static void set_info ( TQItem tqi,
int  tid,
NrnCoreTransferEvents core_te,
std::unordered_map< NetCon *, std::vector< size_t >> &  netcon2intdata,
std::unordered_map< PreSyn *, std::vector< size_t >> &  presyn2intdata,
std::unordered_map< double *, std::vector< size_t >> &  weight2intdata 
)
static

Definition at line 900 of file nrncore_callbacks.cpp.

◆ setup_type2semantics()

static void setup_type2semantics ( )
static

Definition at line 882 of file nrncore_callbacks.cpp.

◆ write_memb_mech_types_direct()

void write_memb_mech_types_direct ( std::ostream &  s)

Definition at line 51 of file nrncore_callbacks.cpp.

Variable Documentation

◆ bbcore_dparam_size

int* bbcore_dparam_size
extern

Definition at line 117 of file nrncore_write.cpp.

◆ cellgroups_

CellGroup* cellgroups_
extern

Definition at line 132 of file nrncore_write.cpp.

◆ corenrn_direct

bool corenrn_direct
extern

Definition at line 139 of file nrncore_write.cpp.

◆ mapinfo

NrnMappingInfo mapinfo
extern

mapping information

Definition at line 134 of file nrncore_write.cpp.

◆ net_cvode_instance

NetCvode* net_cvode_instance
extern

Definition at line 26 of file cvodestb.cpp.

◆ nrn_bbcore_read_

bbcore_write_t* nrn_bbcore_read_
extern

Definition at line 174 of file init.cpp.

◆ nrn_bbcore_write_

bbcore_write_t* nrn_bbcore_write_
extern

Definition at line 173 of file init.cpp.

◆ nrn_is_artificial_

short* nrn_is_artificial_
extern

Definition at line 214 of file init.cpp.

◆ patternstim_type

int patternstim_type
static

Definition at line 1304 of file nrncore_callbacks.cpp.

◆ pnt_map

char* pnt_map
extern

Definition at line 150 of file init.cpp.

◆ type2movable

std::map<int, int> type2movable
static

Definition at line 881 of file nrncore_callbacks.cpp.