CoreNEURON
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
coreneuron::PlayRecordEvent::PlayRecordEvent
PlayRecordEvent()=default
coreneuron::PlayRecord::play_init
virtual void play_init()
Definition: vrecitem.h:41
coreneuron::VecPlayContinuous::t_
IvocVect t_
Definition: vrecitem.h:80
coreneuron::VecPlayContinuous::continuous
void continuous(double tt) override
Definition: vrecord.cpp:106
coreneuron::VecPlayContinuous::event
virtual PlayRecordEvent * event() override
Definition: vrecitem.h:63
coreneuron::VecPlayContinuous::VecPlayContinuous
VecPlayContinuous(double *, IvocVect &&yvec, IvocVect &&tvec, IvocVect *discon, int ith)
Definition: vrecord.cpp:40
coreneuron::VecPlayContinuous::deliver
virtual void deliver(double tt, NetCvode *) override
Definition: vrecord.cpp:75
coreneuron::PlayRecord::ith_
int ith_
Definition: vrecitem.h:54
coreneuron::PlayRecordEvent::playrecord_send_
static unsigned long playrecord_send_
Definition: vrecitem.h:29
coreneuron::PlayRecordEvent::~PlayRecordEvent
virtual ~PlayRecordEvent()=default
coreneuron::VecPlayContinuous::ubound_index_
std::size_t ubound_index_
Definition: vrecitem.h:84
coreneuron
THIS FILE IS AUTO GENERATED DONT MODIFY IT.
Definition: corenrn_parameters.cpp:12
coreneuron::VecPlayContinuous::discon_index_
std::size_t discon_index_
Definition: vrecitem.h:83
coreneuron::t
double t
Definition: register_mech.cpp:22
coreneuron::PlayRecordEvent::playrecord_deliver_
static unsigned long playrecord_deliver_
Definition: vrecitem.h:30
coreneuron::VecPlayContinuous::~VecPlayContinuous
virtual ~VecPlayContinuous()
Definition: vrecord.cpp:53
coreneuron::PlayRecord::continuous
virtual void continuous(double)
Definition: vrecitem.h:42
ivocvect.hpp
coreneuron::VecPlayContinuous::play_init
virtual void play_init() override
Definition: vrecord.cpp:57
VecPlayContinuousType
#define VecPlayContinuousType
Definition: vrecitem.h:17
coreneuron::PlayRecordEvent::type
virtual int type() const override
Definition: vrecitem.h:31
coreneuron::PlayRecordEvent::pr
virtual void pr(const char *, double t, NetCvode *) override
Definition: vrecord.cpp:27
coreneuron::DiscreteEvent
Definition: netcon.hpp:33
coreneuron::PlayRecordEvent::plr_
PlayRecord * plr_
Definition: vrecitem.h:28
coreneuron::NrnThread
Definition: multicore.hpp:75
coreneuron::VecPlayContinuous::pr
virtual void pr() override
Definition: vrecord.cpp:157
coreneuron::PlayRecordEvent
Definition: vrecitem.h:21
netcon.hpp
coreneuron::VecPlayContinuous::e_
PlayRecordEvent * e_
Definition: vrecitem.h:86
coreneuron::fixed_vector< double >
coreneuron::VecPlayContinuous::y_
IvocVect y_
Definition: vrecitem.h:79
coreneuron::PlayRecord::PlayRecord
PlayRecord(double *pd, int ith)
Definition: vrecord.cpp:32
coreneuron::PlayRecord::event
virtual PlayRecordEvent * event()
Definition: vrecitem.h:45
coreneuron::PlayRecord::~PlayRecord
virtual ~PlayRecord()=default
PlayRecordEventType
#define PlayRecordEventType
Definition: vrecitem.h:18
coreneuron::VecPlayContinuous::last_index_
std::size_t last_index_
Definition: vrecitem.h:82
PlayRecordType
#define PlayRecordType
Definition: vrecitem.h:16
coreneuron::PlayRecordEvent::thread
virtual NrnThread * thread()
Definition: vrecord.cpp:23
coreneuron::PlayRecord::deliver
virtual void deliver(double, NetCvode *)
Definition: vrecitem.h:44
coreneuron::PlayRecord
Definition: vrecitem.h:37
coreneuron::PlayRecordEvent::deliver
virtual void deliver(double, NetCvode *, NrnThread *) override
Definition: vrecord.cpp:19
coreneuron::VecPlayContinuous::search
void search(double tt)
Definition: vrecord.cpp:147
coreneuron::VecPlayContinuous::interpolate
double interpolate(double tt)
Definition: vrecord.cpp:120
coreneuron::VecPlayContinuous::discon_indices_
IvocVect * discon_indices_
Definition: vrecitem.h:81
coreneuron::VecPlayContinuous::type
virtual int type() const override
Definition: vrecitem.h:75
coreneuron::VecPlayContinuous::interp
double interp(double th, double x0, double x1)
Definition: vrecitem.h:70
coreneuron::PlayRecord::pr
virtual void pr()
Definition: vrecord.cpp:36
coreneuron::NetCvode
Definition: netcvode.hpp:59
coreneuron::PlayRecord::type
virtual int type() const
Definition: vrecitem.h:49
coreneuron::PlayRecord::pd_
double * pd_
Definition: vrecitem.h:53
coreneuron::VecPlayContinuous
Definition: vrecitem.h:57