NEURON
nrnste.h
Go to the documentation of this file.
1 #pragma once
3 
4 #include <vector>
5 // StateTransitionEvent is a finite state machine in which a transtion occurs
6 // when the transition condition is true. For speed the transition condition
7 // is of the form *var1 > *var2 and allows second order interpolation.
8 // Transition conditions are checked only if the source state is the
9 // current state.
10 
11 class HocCommand;
13 class STECondition;
14 
15 struct STETransition {
17  void event(); // from STECondition::deliver
18  double value() {
19  assert(var1_ && var2_);
20  return *var1_ - *var2_;
21  }
22  void activate(); // add ste_ to watch list
23  void deactivate(); // remove ste_ from watch list
24 
26  std::unique_ptr<HocCommand> hc_{};
28  std::unique_ptr<STECondition> stec_;
29  int dest_{};
30  bool var1_is_time_{};
31 };
32 
33 struct STEState {
35  std::vector<STETransition> transitions_;
36 };
37 
41  void transition(int src,
42  int dest,
45  std::unique_ptr<HocCommand>);
46  void state(int i); // set current state -- update watch list.
47  int state() {
48  return istate_;
49  }
50  int nstate() {
51  return states_.size();
52  }
53  void activate();
54  void deactivate();
55 
56  int istate_{};
57  std::vector<STEState> states_{};
59  int activated_{-1};
60 };
#define i
Definition: md1redef.h:19
#define assert(ex)
Definition: hocassrt.h:24
A point process is computed just like regular mechanisms.
Definition: section_fwd.hpp:77
STETransition & add_transition(Point_process *pnt)
Definition: nrnste.cpp:113
std::vector< STETransition > transitions_
Definition: nrnste.h:35
neuron::container::data_handle< double > var1_
Definition: nrnste.h:25
double value()
Definition: nrnste.h:18
neuron::container::data_handle< double > var2_
Definition: nrnste.h:25
StateTransitionEvent * ste_
Definition: nrnste.h:27
void deactivate()
Definition: netcvode.cpp:5379
std::unique_ptr< HocCommand > hc_
Definition: nrnste.h:26
void event()
Definition: nrnste.cpp:122
std::unique_ptr< STECondition > stec_
Definition: nrnste.h:28
void activate()
Definition: netcvode.cpp:5367
bool var1_is_time_
Definition: nrnste.h:30
int dest_
Definition: nrnste.h:29
STETransition(Point_process *pnt)
Definition: nrnste.cpp:110
Point_process * pnt_
Definition: nrnste.h:58
std::vector< STEState > states_
Definition: nrnste.h:57
void transition(int src, int dest, neuron::container::data_handle< double > var1, neuron::container::data_handle< double > var2, std::unique_ptr< HocCommand >)
Definition: netcvode.cpp:5353
StateTransitionEvent(int nstate, Point_process *)
Definition: nrnste.cpp:72