CoreNEURON
netcvode.hpp
Go to the documentation of this file.
1 /*
2 # =============================================================================
3 # Copyright (c) 2016 - 2021 Blue Brain Project/EPFL
4 #
5 # See top-level LICENSE file for details.
6 # =============================================================================.
7 */
8 
9 #pragma once
10 
13 
14 #define PRINT_EVENT 0
15 
16 /** QTYPE options include: spltree, pq_que
17  * STL priority queue is used instead of the splay tree by default.
18  * @todo: check if stl queue works with move_event functions.
19  */
20 
21 #ifdef ENABLE_SPLAYTREE_QUEUING
22 #define QTYPE spltree
23 #else
24 #define QTYPE pq_que
25 #endif
26 namespace coreneuron {
27 
28 // defined in coreneuron/network/cvodestb.cpp
29 extern void init_net_events(void);
30 extern void nrn_play_init(void);
31 extern void deliver_net_events(NrnThread*);
32 extern void nrn_deliver_events(NrnThread*);
33 extern void fixed_play_continuous(NrnThread*);
34 
35 struct DiscreteEvent;
36 class NetCvode;
37 
38 extern NetCvode* net_cvode_instance;
39 extern void interthread_enqueue(NrnThread*);
40 
43  double t_;
44 };
45 
47  public:
50  std::vector<InterThreadEvent> inter_thread_events_;
52 
54  virtual ~NetCvodeThreadData();
55  void interthread_send(double, DiscreteEvent*, NrnThread*);
56  void enqueue(NetCvode*, NrnThread*);
57 };
58 
59 class NetCvode {
60  public:
62  int pcnt_;
65  static double eps_;
66 
67  NetCvode(void);
68  virtual ~NetCvode();
69  void p_construct(int);
70  void check_thresh(NrnThread*);
71  static double eps(double x) {
72  return eps_ * fabs(x);
73  }
74  TQItem* event(double tdeliver, DiscreteEvent*, NrnThread*);
75  void move_event(TQItem*, double, NrnThread*);
76  TQItem* bin_event(double tdeliver, DiscreteEvent*, NrnThread*);
77  void deliver_net_events(NrnThread*); // for default staggered time step method
78  void deliver_events(double til, NrnThread*); // for initialization events
79  bool deliver_event(double til, NrnThread*); // uses TQueue atomically
80  void clear_events();
81  void init_events();
82  void point_receive(int, Point_process*, double*, double);
83 };
84 } // namespace coreneuron
coreneuron::NetCvode::deliver_net_events
void deliver_net_events(NrnThread *)
Definition: netcvode.cpp:631
coreneuron::NetCvodeThreadData::enqueue
void enqueue(NetCvode *, NrnThread *)
Definition: netcvode.cpp:142
OMP_Mutex
Definition: nrnmutdec.hpp:55
coreneuron::InterThreadEvent::t_
double t_
Definition: netcvode.hpp:43
coreneuron::Point_process
Definition: mechanism.hpp:35
coreneuron::TQItem
Definition: tqueue.hpp:69
coreneuron::NetCvode::check_thresh
void check_thresh(NrnThread *)
Definition: netcvode.cpp:525
tqueue.hpp
coreneuron::NetCvodeThreadData::inter_thread_events_
std::vector< InterThreadEvent > inter_thread_events_
Definition: netcvode.hpp:50
coreneuron::NetCvode::p_construct
void p_construct(int)
Definition: netcvode.cpp:179
coreneuron::NetCvode::event
TQItem * event(double tdeliver, DiscreteEvent *, NrnThread *)
Definition: netcvode.cpp:216
coreneuron::NetCvode::p
NetCvodeThreadData * p
Definition: netcvode.hpp:64
coreneuron::NetCvodeThreadData::interthread_send
void interthread_send(double, DiscreteEvent *, NrnThread *)
If the PreSyn is on a different thread than the target, we have to lock the buffer.
Definition: netcvode.cpp:133
coreneuron
THIS FILE IS AUTO GENERATED DONT MODIFY IT.
Definition: corenrn_parameters.cpp:12
coreneuron::NetCvodeThreadData::tqe_
TQueue< QTYPE > * tqe_
Definition: netcvode.hpp:49
coreneuron::NetCvode::enqueueing_
int enqueueing_
Definition: netcvode.hpp:63
coreneuron::NetCvode::clear_events
void clear_events()
Definition: netcvode.cpp:225
coreneuron::DiscreteEvent
Definition: netcon.hpp:33
coreneuron::InterThreadEvent
Definition: netcvode.hpp:41
coreneuron::NrnThread
Definition: multicore.hpp:75
coreneuron::NetCvode::bin_event
TQItem * bin_event(double tdeliver, DiscreteEvent *, NrnThread *)
Definition: netcvode.cpp:198
coreneuron::NetCvode::NetCvode
NetCvode(void)
Definition: netcvode.cpp:150
coreneuron::deliver_net_events
void deliver_net_events(NrnThread *nt)
Definition: cvodestb.cpp:24
coreneuron::init_net_events
void init_net_events()
Definition: cvodestb.cpp:53
coreneuron::NetCvodeThreadData
Definition: netcvode.hpp:46
coreneuron::NetCvode::deliver_events
void deliver_events(double til, NrnThread *)
Definition: netcvode.cpp:331
coreneuron::interthread_enqueue
void interthread_enqueue(NrnThread *nt)
Definition: netcvode.cpp:138
coreneuron::NetCvode::eps_
static double eps_
Definition: netcvode.hpp:65
coreneuron::nrn_play_init
void nrn_play_init()
Definition: cvodestb.cpp:72
coreneuron::NetCvode::~NetCvode
virtual ~NetCvode()
Definition: netcvode.cpp:167
coreneuron::net_cvode_instance
NetCvode * net_cvode_instance
Definition: netcvode.cpp:35
nrnmutdec.hpp
coreneuron::NetCvode::deliver_event
bool deliver_event(double til, NrnThread *)
Definition: netcvode.cpp:273
coreneuron::NetCvodeThreadData::NetCvodeThreadData
NetCvodeThreadData()
Definition: netcvode.cpp:122
coreneuron::NetCvodeThreadData::unreffed_event_cnt_
int unreffed_event_cnt_
Definition: netcvode.hpp:48
coreneuron::NetCvode::point_receive
void point_receive(int, Point_process *, double *, double)
coreneuron::InterThreadEvent::de_
DiscreteEvent * de_
Definition: netcvode.hpp:42
coreneuron::NetCvodeThreadData::mut
OMP_Mutex mut
Definition: netcvode.hpp:51
coreneuron::NetCvode::print_event_
int print_event_
Definition: netcvode.hpp:61
coreneuron::TQueue< QTYPE >
coreneuron::NetCvodeThreadData::~NetCvodeThreadData
virtual ~NetCvodeThreadData()
Definition: netcvode.cpp:127
coreneuron::NetCvode::pcnt_
int pcnt_
Definition: netcvode.hpp:62
coreneuron::NetCvode::eps
static double eps(double x)
Definition: netcvode.hpp:71
coreneuron::NetCvode
Definition: netcvode.hpp:59
coreneuron::nrn_deliver_events
void nrn_deliver_events(NrnThread *nt)
Definition: cvodestb.cpp:32
coreneuron::NetCvode::move_event
void move_event(TQItem *, double, NrnThread *)
Definition: netcvode.cpp:314
coreneuron::NetCvode::init_events
void init_events()
Definition: netcvode.cpp:240
coreneuron::fixed_play_continuous
void fixed_play_continuous(NrnThread *nt)
Definition: cvodestb.cpp:81