mrgsolve
Loading...
Searching...
No Matches
databox_cpp.h
Go to the documentation of this file.
1// Copyright (C) 2013 - 2025 Metrum Research Group
2//
3// This file is part of mrgsolve.
4//
5// mrgsolve is free software: you can redistribute it and/or modify it
6// under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 2 of the License, or
8// (at your option) any later version.
9//
10// mrgsolve is distributed in the hope that it will be useful, but
11// WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with mrgsolve. If not, see <http://www.gnu.org/licenses/>.
17
18
19#ifndef DATABOX_CPP_H
20#define DATABOX_CPP_H
21
22void databox::mevent(double time_, int evid_) {
23 if(time_ < time) return;
24 mrgsolve::evdata ev(time_,evid_);
25 ev.check_unique = true;
26 mevector.push_back(ev);
27}
28
29double databox::mtime(double time_) {
30 if(time_ < time) return time_;
31 mrgsolve::evdata ev(time_,2);
32 ev.check_unique = true;
33 mevector.push_back(ev);
34 return time_;
35}
36
44double databox::tad() {
45 static double told = -1.;
46 if(newind <= 1) told = -1.0;
47 if((evid == 1) || (evid == 4)) told = time;
48 return told < 0 ? -1.0 : time - told;
49}
50
52 mevector.push_back(x);
53 return;
54}
55
56#endif
double time
current simulation time
Definition mrgsolv.h:102
int evid
event ID flag
Definition mrgsolv.h:103
double tad()
calculates time after dose
Definition databox_cpp.h:44
double mtime(double time_)
creates evdata object for simple model event time
Definition databox_cpp.h:29
unsigned int newind
new individual flag
Definition mrgsolv.h:101
void mevent(double time_, int evid_)
constructor for evdata objects
Definition databox_cpp.h:22
void push(mrgsolve::evdata x)
Definition databox_cpp.h:51
std::vector< mrgsolve::evdata > mevector
a collection of model events to pass back
Definition mrgsolv.h:119
Definition mrgsolv.h:51
bool check_unique
Definition mrgsolv.h:71