NEURON
vrecitem.h
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 namespace coreneuron {
14 class PlayRecord;
15 
16 #define PlayRecordType 0
17 #define VecPlayContinuousType 4
18 #define PlayRecordEventType 21
19 
20 // used by PlayRecord subclasses that utilize discrete events
22  public:
23  PlayRecordEvent() = default;
24  virtual ~PlayRecordEvent() = default;
25  virtual void deliver(double, NetCvode*, NrnThread*) override;
26  virtual void pr(const char*, double t, NetCvode*) override;
27  virtual NrnThread* thread();
29  static unsigned long playrecord_send_;
30  static unsigned long playrecord_deliver_;
31  virtual int type() const override {
32  return PlayRecordEventType;
33  }
34 };
35 
36 // common interface for Play and Record for all integration methods.
37 class PlayRecord {
38  public:
39  PlayRecord(double* pd, int ith);
40  virtual ~PlayRecord() = default;
41  virtual void play_init() {} // called near beginning of finitialize
42  virtual void continuous(double) {
43  } // play - every f(y, t) or res(y', y, t); record - advance_tn and initialize flag
44  virtual void deliver(double, NetCvode*) {} // at associated DiscreteEvent
45  virtual PlayRecordEvent* event() {
46  return nullptr;
47  }
48  virtual void pr(); // print identifying info
49  virtual int type() const {
50  return PlayRecordType;
51  }
52 
53  double* pd_;
54  int ith_; // The thread index
55 };
56 
58  public:
59  VecPlayContinuous(double*, IvocVect&& yvec, IvocVect&& tvec, IvocVect* discon, int ith);
60  virtual ~VecPlayContinuous();
61  virtual void play_init() override;
62  virtual void deliver(double tt, NetCvode*) override;
63  virtual PlayRecordEvent* event() override {
64  return e_;
65  }
66  virtual void pr() override;
67 
68  void continuous(double tt) override;
69  double interpolate(double tt);
70  double interp(double th, double x0, double x1) {
71  return x0 + (x1 - x0) * th;
72  }
73  void search(double tt);
74 
75  virtual int type() const override {
76  return VecPlayContinuousType;
77  }
78 
82  std::size_t last_index_{};
83  std::size_t discon_index_{};
84  std::size_t ubound_index_{};
85 
86  PlayRecordEvent* e_ = nullptr; // Need to be a raw pointer for acc
87 };
88 } // namespace coreneuron
virtual void pr(const char *, double t, NetCvode *) override
Definition: vrecord.cpp:27
static unsigned long playrecord_deliver_
Definition: vrecitem.h:30
virtual NrnThread * thread()
Definition: vrecord.cpp:23
virtual ~PlayRecordEvent()=default
static unsigned long playrecord_send_
Definition: vrecitem.h:29
virtual void deliver(double, NetCvode *, NrnThread *) override
Definition: vrecord.cpp:19
virtual int type() const override
Definition: vrecitem.h:31
virtual void deliver(double, NetCvode *)
Definition: vrecitem.h:44
virtual int type() const
Definition: vrecitem.h:49
virtual void pr()
Definition: vrecord.cpp:36
virtual ~PlayRecord()=default
virtual void play_init()
Definition: vrecitem.h:41
PlayRecord(double *pd, int ith)
Definition: vrecord.cpp:32
virtual PlayRecordEvent * event()
Definition: vrecitem.h:45
virtual void continuous(double)
Definition: vrecitem.h:42
virtual PlayRecordEvent * event() override
Definition: vrecitem.h:63
virtual int type() const override
Definition: vrecitem.h:75
virtual void pr() override
Definition: vrecord.cpp:157
VecPlayContinuous(double *, IvocVect &&yvec, IvocVect &&tvec, IvocVect *discon, int ith)
Definition: vrecord.cpp:40
void continuous(double tt) override
Definition: vrecord.cpp:106
virtual void play_init() override
Definition: vrecord.cpp:57
double interpolate(double tt)
Definition: vrecord.cpp:120
virtual void deliver(double tt, NetCvode *) override
Definition: vrecord.cpp:75
PlayRecordEvent * e_
Definition: vrecitem.h:86
double interp(double th, double x0, double x1)
Definition: vrecitem.h:70
#define PlayRecordType
Definition: vrecitem.h:16
#define VecPlayContinuousType
Definition: vrecitem.h:17
#define PlayRecordEventType
Definition: vrecitem.h:18
THIS FILE IS AUTO GENERATED DONT MODIFY IT.