NEURON
netcon.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 
11 #include "coreneuron/mpi/nrnmpi.h"
12 
13 #undef check
14 namespace coreneuron {
15 class PreSyn;
16 class InputPreSyn;
17 class TQItem;
18 struct NrnThread;
19 struct Point_process;
20 class NetCvode;
21 
22 #define DiscreteEventType 0
23 #define TstopEventType 1
24 #define NetConType 2
25 #define SelfEventType 3
26 #define PreSynType 4
27 #define NetParEventType 7
28 #define InputPreSynType 20
29 #define ReportEventType 8
30 
31 struct DiscreteEvent {
32  DiscreteEvent() = default;
33  virtual ~DiscreteEvent() = default;
34  virtual void send(double deliverytime, NetCvode*, NrnThread*);
35  virtual void deliver(double t, NetCvode*, NrnThread*);
36  virtual int type() const {
37  return DiscreteEventType;
38  }
39  virtual bool require_checkpoint() {
40  return true;
41  }
42  virtual void pr(const char*, double t, NetCvode*);
43 };
44 
45 class NetCon: public DiscreteEvent {
46  public:
47  bool active_{};
48  double delay_{1.0};
50  union {
52  int srcgid_; // only to help InputPreSyn during setup
53  // before weights are read and stored. Saves on transient
54  // memory requirements by avoiding storage of all group file
55  // netcon_srcgid lists. ie. that info is copied into here.
56  } u;
57 
58  NetCon() = default;
59  virtual ~NetCon() = default;
60  virtual void send(double sendtime, NetCvode*, NrnThread*) override;
61  virtual void deliver(double, NetCvode* ns, NrnThread*) override;
62  virtual int type() const override {
63  return NetConType;
64  }
65  virtual void pr(const char*, double t, NetCvode*) override;
66 };
67 
68 class SelfEvent: public DiscreteEvent {
69  public:
70  double flag_;
72  void** movable_; // actually a TQItem**
74 
75  SelfEvent() = default;
76  virtual ~SelfEvent() = default;
77  virtual void deliver(double, NetCvode*, NrnThread*) override;
78  virtual int type() const override {
79  return SelfEventType;
80  }
81 
82  virtual void pr(const char*, double t, NetCvode*) override;
83 
84  private:
86 };
87 
89  public:
90  // condition detection factored out of PreSyn for re-use
91  ConditionEvent() = default;
92  virtual ~ConditionEvent() = default;
93  virtual bool check(NrnThread*);
94  virtual double value(NrnThread*) {
95  return -1.;
96  }
97 
98  int flag_{}; // true when below, false when above. (changed from bool to int to avoid cray acc
99  // bug(?))
100 };
101 
102 class PreSyn: public ConditionEvent {
103  public:
104 #if NRNMPI
105  unsigned char localgid_{}; // compressed gid for spike transfer
106 #endif
107  int nc_index_{}; // replaces dil_, index into global NetCon** netcon_in_presyn_order_
108  int nc_cnt_{}; // how many netcon starting at nc_index_
110  int gid_{-1};
111  double threshold_{10.};
112  int thvar_index_{-1}; // >=0 points into NrnThread._actual_v
114 
115  PreSyn() = default;
116  virtual ~PreSyn() = default;
117  virtual void send(double sendtime, NetCvode*, NrnThread*) override;
118  virtual void deliver(double, NetCvode*, NrnThread*) override;
119  virtual int type() const override {
120  return PreSynType;
121  }
122 
123  virtual double value(NrnThread*) override;
124  void record(double t);
125 #if NRN_MULTISEND
126  int multisend_index_{-1};
127 #endif
128 };
129 
130 class InputPreSyn: public DiscreteEvent {
131  public:
132  int nc_index_{-1}; // replaces dil_, index into global NetCon** netcon_in_presyn_order_
133  int nc_cnt_{}; // how many netcon starting at nc_index_
134 
135  InputPreSyn() = default;
136  virtual ~InputPreSyn() = default;
137  virtual void send(double sendtime, NetCvode*, NrnThread*) override;
138  virtual void deliver(double, NetCvode*, NrnThread*) override;
139  virtual int type() const override {
140  return InputPreSynType;
141  }
142 #if NRN_MULTISEND
143  int multisend_phase2_index_{-1};
144 #endif
145 };
146 
147 class NetParEvent: public DiscreteEvent {
148  public:
149  int ithread_; // for pr()
150  double wx_, ws_; // exchange time and "spikes to Presyn" time
151 
152  NetParEvent();
153  virtual ~NetParEvent() = default;
154  virtual void send(double, NetCvode*, NrnThread*) override;
155  virtual void deliver(double, NetCvode*, NrnThread*) override;
156  virtual int type() const override {
157  return NetParEventType;
158  }
159 
160  virtual void pr(const char*, double t, NetCvode*) override;
161 };
162 } // namespace coreneuron
Definition: netcon.h:258
virtual double value(NrnThread *)
Definition: netcon.hpp:94
virtual bool check(NrnThread *)
Definition: netcvode.cpp:350
virtual ~ConditionEvent()=default
virtual void send(double sendtime, NetCvode *, NrnThread *) override
Definition: netcvode.cpp:442
virtual ~InputPreSyn()=default
virtual void deliver(double, NetCvode *, NrnThread *) override
Definition: netcvode.cpp:460
virtual int type() const override
Definition: netcon.hpp:139
virtual void send(double sendtime, NetCvode *, NrnThread *) override
Definition: netcvode.cpp:372
virtual void pr(const char *, double t, NetCvode *) override
Definition: netcvode.cpp:400
virtual void deliver(double, NetCvode *ns, NrnThread *) override
Definition: netcvode.cpp:379
union coreneuron::NetCon::@0 u
virtual ~NetCon()=default
Point_process * target_
Definition: netcon.hpp:49
virtual int type() const override
Definition: netcon.hpp:62
virtual void deliver(double, NetCvode *, NrnThread *) override
Definition: netpar.cpp:121
virtual int type() const override
Definition: netcon.hpp:156
virtual void send(double, NetCvode *, NrnThread *) override
Definition: netpar.cpp:117
virtual void pr(const char *, double t, NetCvode *) override
Definition: netpar.cpp:128
virtual ~NetParEvent()=default
virtual int type() const override
Definition: netcon.hpp:119
virtual void send(double sendtime, NetCvode *, NrnThread *) override
Definition: netcvode.cpp:409
void record(double t)
Definition: netcvode.cpp:341
virtual ~PreSyn()=default
virtual void deliver(double, NetCvode *, NrnThread *) override
Definition: netcvode.cpp:456
virtual double value(NrnThread *) override
Definition: netcvode.cpp:521
Point_process * pntsrc_
Definition: netcon.hpp:113
virtual ~SelfEvent()=default
virtual void pr(const char *, double t, NetCvode *) override
Definition: netcvode.cpp:483
void call_net_receive(NetCvode *)
Definition: netcvode.cpp:471
virtual int type() const override
Definition: netcon.hpp:78
Point_process * target_
Definition: netcon.hpp:71
virtual void deliver(double, NetCvode *, NrnThread *) override
Definition: netcvode.cpp:464
THIS FILE IS AUTO GENERATED DONT MODIFY IT.
#define NetParEventType
Definition: netcon.hpp:27
#define PreSynType
Definition: netcon.hpp:26
#define DiscreteEventType
Definition: netcon.hpp:22
#define InputPreSynType
Definition: netcon.hpp:28
#define SelfEventType
Definition: netcon.hpp:25
#define NetConType
Definition: netcon.hpp:24
Represent main neuron object computed by single thread.
Definition: multicore.h:58
A point process is computed just like regular mechanisms.
Definition: section_fwd.hpp:77
Definition: tqitem.hpp:3
virtual ~DiscreteEvent()=default
virtual void pr(const char *, double t, NetCvode *)
Definition: netcvode.cpp:368
virtual void deliver(double t, NetCvode *, NrnThread *)
Definition: netcvode.cpp:366
virtual bool require_checkpoint()
Definition: netcon.hpp:39
virtual void send(double deliverytime, NetCvode *, NrnThread *)
Definition: netcvode.cpp:362
virtual int type() const
Definition: netcon.hpp:36