mrgsolve
mrgsolve-tad.h
Go to the documentation of this file.
1 
2 
3 namespace mrgsolve {
49 class tadose {
50 public:
51  int cmt;
52  double told;
53  bool had_dose;
54  tadose(int cmt_);
55  tadose();
56  double tad(databox& self);
57  void reset();
58 };
65 tadose::tadose(int cmt_) {
66  cmt = cmt_;
67  told = -1e9;
68 }
74  told = -1e9;
75 }
76 
87 double tadose::tad(databox& self) {
88  if(self.newind <= 1) this->reset();
89  if(self.evid==0) {
90  return had_dose ? self.time - told : -1.0;
91  }
92  if((self.cmt == cmt) && (self.evid == 1 || self.evid == 4)) {
93  told = self.time;
94  had_dose = true;
95  return 0.0;
96  }
97  return had_dose ? self.time - told : -1.0;
98 }
106  had_dose = false;
107  told = -1e9;
108 }
109 }
mrgsolve::tadose::reset
void reset()
Definition: mrgsolve-tad.h:105
mrgsolve::tadose::tadose
tadose()
Definition: mrgsolve-tad.h:73
databox
member functions mevent and tad come in via housemodel; see inst/base/databox.cpp
Definition: mrgsolv.h:87
mrgsolve::tadose
Definition: mrgsolve-tad.h:49
mrgsolve::tadose::tad
double tad(databox &self)
Definition: mrgsolve-tad.h:87
mrgsolve::tadose::told
double told
time of last dose
Definition: mrgsolve-tad.h:52
mrgsolve
Definition: mrgsolv.h:30
mrgsolve::tadose::cmt
int cmt
dosing compartment number to follow
Definition: mrgsolve-tad.h:51
mrgsolve::tadose::had_dose
bool had_dose
has the current individual received a dose yet?
Definition: mrgsolve-tad.h:53