Go to the documentation of this file.
41 typedef std::vector<rec_ptr>
reclist;
67 #define MRGSOLVE_GET_PRED_CL (pred[0])
68 #define MRGSOLVE_GET_PRED_VC (pred[1])
69 #define MRGSOLVE_GET_PRED_KA (pred[2])
70 #define MRGSOLVE_GET_PRED_Q (pred[3])
71 #define MRGSOLVE_GET_PRED_VP (pred[4])
72 #define MRGSOLVE_GET_PRED_K10 (pred[0]/pred[1])
73 #define MRGSOLVE_GET_PRED_K12 (pred[3]/pred[1])
74 #define MRGSOLVE_GET_PRED_K21 (pred[3]/pred[4])
81 template<
typename T,
typename type2>
void tofunptr(T b, type2
a) {
82 b = reinterpret_cast<T>(R_ExternalPtrAddr(
a));
113 void y_init(
int pos,
double value);
115 void y_add(
const unsigned int pos,
const double& value);
123 void omega(Rcpp::NumericMatrix& x);
124 void sigma(Rcpp::NumericMatrix& x);
136 void rate(
unsigned int pos,
double value) {
R[pos] = value;}
137 double rate(
unsigned int pos) {
return R[pos];}
138 void rate0(
unsigned int pos,
double value) {
R0[pos] = value;}
139 double rate0(
unsigned int pos){
return R0[pos];}
142 void rate_add(
unsigned int pos,
const double& value);
143 void rate_rm(
unsigned int pos,
const double& value);
144 void rate_bump(
const unsigned int pos,
const double& value);
148 void dur(
unsigned int pos,
double value) {
D[pos] = value;}
149 double dur(
unsigned int pos){
return D[pos];}
153 void eta(
int pos,
double value) {
d.
ETA[pos] = value;}
154 void eps(
int pos,
double value) {
d.
EPS[pos] = value;}
157 void on(
unsigned short int cmt);
158 void off(
unsigned short int cmt);
160 int is_on(
unsigned int eq_n){
return On[eq_n];}
162 void fbio(
unsigned int pos,
double value) {
F.at(pos) = value;}
163 double fbio(
unsigned int pos);
164 double alag(
int cmt);
172 void advan2(
const double& tfrom,
const double& tto);
173 void advan4(
const double& tfrom,
const double& tto);
175 void neta(
const int n);
176 void neps(
const int n);
193 void y(
const int pos,
const double value){
Y[pos] = value;}
194 double y(
const int pos){
return Y[pos];}
203 void tol(
double atol,
double rtol);
206 std::vector<double>
Y;
223 std::vector<double>
R0;
225 std::vector<double>
R;
226 std::vector<double>
D;
229 std::vector<double>
F;
236 std::vector<double>
a;
256 double PolyExp(
const double& x,
262 const std::vector<double>& a,
263 const std::vector<double>& alpha,
266 Rcpp::List
TOUCH_FUNS(
const Rcpp::NumericVector& lparam,
267 const Rcpp::NumericVector& linit,
268 const Rcpp::CharacterVector&
capture,
269 const Rcpp::List& funs);
int rate_count(unsigned int pos)
Definition: odeproblem.h:141
int rown
current output row number
Definition: mrgsolv.h:101
void rown(int n)
sets the currenw data set row number
Definition: odeproblem.h:181
void eta(int pos, double value)
Definition: odeproblem.h:153
unsigned short int systemoff()
Definition: odeproblem.h:155
double Rtol
relative tolerance used by ODE solver
Definition: odeproblem.h:212
void advance(double tfrom, double tto, LSODA &solver)
Definition: odeproblem.cpp:325
unsigned short int SYSTEMOFF
flag to stop advancing system for current ID
Definition: mrgsolv.h:94
int Istate
istate value
Definition: odeproblem.h:217
std::vector< double > R0
acutal current infusion rate
Definition: odeproblem.h:223
int is_on(unsigned int eq_n)
Definition: odeproblem.h:160
arma::mat Sigma
variance/covariance matrix for within-subject variability
Definition: odeproblem.h:243
std::vector< double > alpha
used for advan 1/2/3/4 calculation
Definition: odeproblem.h:237
databox d
various data passed to model functions
Definition: odeproblem.h:233
main_deriv_func main_derivs
Definition: odeproblem.h:78
std::vector< reclist > recstack
vector of reclist vectors comprising a data set
Definition: odeproblem.h:44
config_func Config
$PREAMBLE function
Definition: odeproblem.h:250
#define MRGSOLVE_CONFIG_SIGNATURE
signature for $PREAMBLE
Definition: mrgsolv.h:129
std::vector< double > pred
brings clearances, volumes, and & for advan 1/2/3/4
Definition: odeproblem.h:245
void reset_newid(const double id_)
Reset odeproblem object for new individual.
Definition: odeproblem.cpp:272
void istate(int value)
Definition: odeproblem.h:196
int Neq
number of equations
Definition: odeproblem.h:216
const std::vector< double > & param()
Definition: odeproblem.h:133
arma::mat mv_sigma(int n)
Definition: odeproblem.cpp:743
void pass_envir(Rcpp::Environment *x)
Definition: odeproblem.h:129
void init_call(const double &time)
Definition: odeproblem.cpp:197
void advan2(const double &tfrom, const double &tto)
Definition: odeproblem.cpp:352
double ssRtol
Definition: odeproblem.h:214
std::shared_ptr< datarecord > rec_ptr
Definition: datarecord.h:29
std::vector< int > Ss_cmt
vector of compartments to consider for SS
Definition: odeproblem.h:221
void newind(unsigned int newind_)
Definition: odeproblem.h:167
void do_init_calc(bool answer)
Definition: odeproblem.h:103
void(* LSODA_ODE_SYSTEM_TYPE)(double t, double *y, double *dydt, odeproblem *_data)
function to hand off to DLSODA
Definition: odeproblem.h:60
void main_deriv_func(int *neq, double *t, double *y, double *ydot)
Definition: odeproblem.h:62
#define MRGSOLVE_TABLE_SIGNATURE
signature for $TABLE
Definition: mrgsolv.h:121
std::vector< double > D
receive user input for infusion duration
Definition: odeproblem.h:226
std::vector< double > Yout
used to hold Y values during solving
Definition: odeproblem.h:208
mrgsolve::resim simeps
functor for resimulating epsilons
Definition: odeproblem.h:240
std::vector< double > dvec
vector of doubles
Definition: mrgsolv.h:114
table_func Table
$TABLE function
Definition: odeproblem.h:249
double ssAtol
absolute tolerance when finding steady state
Definition: odeproblem.h:213
int Npar
number of parameters
Definition: odeproblem.h:215
void off(unsigned short int cmt)
Definition: odeproblem.cpp:317
void(* init_func)(MRGSOLVE_INIT_SIGNATURE)
$MAIN function
Definition: odeproblem.h:47
arma::mat mv_omega(int n)
Definition: odeproblem.cpp:739
double time
current simulation time
Definition: mrgsolv.h:92
void neps(const int n)
set number of EPSs in the model
Definition: odeproblem.cpp:126
std::vector< unsigned int > infusion_count
number of active infusions
Definition: odeproblem.h:224
void nid(int n)
sets the number of IDs
Definition: odeproblem.h:178
unsigned int newind
new individual flag
Definition: mrgsolv.h:91
void rate_add(unsigned int pos, const double &value)
Definition: odeproblem.cpp:292
std::vector< double > R
receive user input for infusion rate
Definition: odeproblem.h:225
double Atol
absolute tolerance used by ODE solver
Definition: odeproblem.h:211
bool Do_Init_Calc
Flag regulating whether or not initials are taken from $MAIN
Definition: odeproblem.h:252
int npar()
returns the number of parameters
Definition: odeproblem.h:199
int idn
current ID number
Definition: mrgsolv.h:99
double rate0(unsigned int pos)
Definition: odeproblem.h:139
int Advan
simulation mode: 1/2/3/4 (PK models) or 13 (odes)
Definition: odeproblem.h:235
void param(int pos, double value)
Definition: odeproblem.h:134
void(* config_func)(MRGSOLVE_CONFIG_SIGNATURE)
$PREAMBLE function
Definition: odeproblem.h:56
std::vector< double > Param
parameter vector
Definition: odeproblem.h:209
void rate0(unsigned int pos, double value)
Definition: odeproblem.h:138
void rate(unsigned int pos, double value)
Definition: odeproblem.h:136
void(* table_func)(MRGSOLVE_TABLE_SIGNATURE)
$TABLE function
Definition: odeproblem.h:50
std::vector< double > EPS
vector of EPS values
Definition: mrgsolv.h:90
double y(const int pos)
Definition: odeproblem.h:194
void fbio(unsigned int pos, double value)
Definition: odeproblem.h:162
void copy_funs(const Rcpp::List &funs)
Definition: odeproblem.cpp:663
void nrow(int n)
sets the number of data set rows
Definition: odeproblem.h:179
int istate()
Definition: odeproblem.h:195
std::vector< mrgsolve::evdata > mtimes()
Definition: odeproblem.h:191
void tol(double atol, double rtol)
sets the absolute and relative tolerances
Definition: odeproblem.cpp:130
void y_add(const unsigned int pos, const double &value)
add value to compartment pos
Definition: odeproblem.cpp:158
std::vector< int > On
compartment on/off indicator
Definition: odeproblem.h:232
void lsoda_init()
Definition: odeproblem.h:197
double capture(int i)
Definition: odeproblem.h:184
int neq()
returns the number of state variables
Definition: odeproblem.h:201
void y_init(int pos, double value)
Definition: odeproblem.cpp:143
bool CFONSTOP
carry forward on stop indicator
Definition: mrgsolv.h:102
double PolyExp(const double &x, const double &dose, const double &rate, const double &xinf, const double &tau, const bool ss, const std::vector< double > &a, const std::vector< double > &alpha, const int n)
Definition: odeproblem.cpp:539
std::vector< double > ETA
vector of ETA values
Definition: mrgsolv.h:89
std::vector< rec_ptr > reclist
vector of datarecord objects for one ID
Definition: odeproblem.h:38
member functions mevent and tad come in via housemodel; see inst/base/databox.cpp
Definition: mrgsolv.h:87
std::vector< double > Init_dummy
initial conditions for user input
Definition: odeproblem.h:228
std::vector< double > Ydot
dxdt values
Definition: odeproblem.h:207
void advan4(const double &tfrom, const double &tto)
Definition: odeproblem.cpp:425
std::vector< double > Alag
dosing lag time
Definition: odeproblem.h:230
int ss_n
Max number of doses during SS advance before warning is issued.
Definition: odeproblem.h:219
std::vector< mrgsolve::evdata > mevector
a collection of model events to pass back
Definition: mrgsolv.h:107
dvec & get_capture()
Definition: odeproblem.h:183
Resim functor.
Definition: mrgsolv.h:38
void set_d(rec_ptr this_rec)
Definition: odeproblem.cpp:185
bool ss_fixed
If true, then no warning is issued if SS not reached in ss_n doses.
Definition: odeproblem.h:218
#define MRGSOLVE_INIT_SIGNATURE
signature for $MAIN
Definition: mrgsolv.h:117
void dosimeps(void *)
Definition: odeproblem.cpp:41
arma::mat Omega
variance/covariance matrix for between-subject variability
Definition: odeproblem.h:242
void on(unsigned short int cmt)
Definition: odeproblem.cpp:313
odeproblem(Rcpp::NumericVector param, Rcpp::NumericVector init, Rcpp::List funs, int n_capture_)
Definition: odeproblem.cpp:49
void copy_parin(const Rcpp::List &parin)
copies items passed in through parin into the odeproblem object
Definition: odeproblem.cpp:647
void config_call()
Call $PREAMBLE function.
Definition: odeproblem.cpp:232
Rcpp::List TOUCH_FUNS(const Rcpp::NumericVector &lparam, const Rcpp::NumericVector &linit, const Rcpp::CharacterVector &capture, const Rcpp::List &funs)
std::vector< double > Init_value
initial conditions
Definition: odeproblem.h:227
void init_call_record(const double &time)
Definition: odeproblem.cpp:221
void call_derivs(double *t, double *y, double *ydot)
Definition: odeproblem.cpp:174
void dosimeta(void *)
Definition: odeproblem.cpp:33
init_func Inits
$MAIN function
Definition: odeproblem.h:248
void rate_main(rec_ptr rec)
Definition: odeproblem.cpp:244
void neta(const int n)
set number of ETAs in the model
Definition: odeproblem.cpp:121
void rate_bump(const unsigned int pos, const double &value)
Definition: odeproblem.cpp:297
void sigma(Rcpp::NumericMatrix &x)
Definition: odeproblem.cpp:735
double dur(unsigned int pos)
Definition: odeproblem.h:149
void omega(Rcpp::NumericMatrix &x)
Definition: odeproblem.cpp:731
int nrow
number of rows in output data set
Definition: mrgsolv.h:100
void y(const int pos, const double value)
Definition: odeproblem.h:193
void rate_rm(unsigned int pos, const double &value)
Definition: odeproblem.cpp:301
bool CFONSTOP()
Definition: odeproblem.h:131
deriv_func Derivs
$ODE function
Definition: odeproblem.h:247
void neg_istate(int istate)
bool any_mtime()
Definition: odeproblem.h:190
double alag(int cmt)
Definition: odeproblem.cpp:114
void(* deriv_func)(MRGSOLVE_ODE_SIGNATURE)
$ODE function
Definition: odeproblem.h:53
~odeproblem()
Definition: odeproblem.h:101
mrgsolve::resim simeta
functor for resimulating etas
Definition: odeproblem.h:239
void rate_reset()
Reset all infusion rates.
Definition: odeproblem.cpp:237
void(* MRGSOLVE_ODE_FUNC)(int neq, double *t, double *y, double *ydot, std::vector< double > ¶m)
Definition: odeproblem.h:64
double rate(unsigned int pos)
Definition: odeproblem.h:137
std::vector< double > F
bioavability
Definition: odeproblem.h:229
void dur(unsigned int pos, double value)
Definition: odeproblem.h:148
void clear_mtime()
Definition: odeproblem.h:192
void eps(int pos, double value)
Definition: odeproblem.h:154
std::vector< double > a
used for advan 1/2/3/4 calculations
Definition: odeproblem.h:236
unsigned int newind()
Definition: odeproblem.h:168
void idn(int n)
sets the current ID number
Definition: odeproblem.h:180
#define MRGSOLVE_ODE_SIGNATURE
signature for $ODE
Definition: mrgsolv.h:125
void * envir
model environment
Definition: mrgsolv.h:103
Definition: odeproblem.h:94
bool ss_flag
flag indicating when the system is advancing to SS
Definition: odeproblem.h:220
void table_call()
Call $TABLE function.
Definition: odeproblem.cpp:227
double init(int pos)
Definition: odeproblem.h:107
int nid
number of IDs in the data set
Definition: mrgsolv.h:98
void time(double time_)
Definition: odeproblem.h:166
std::vector< double > Capture
captured data items
Definition: odeproblem.h:210
int advan()
Definition: odeproblem.h:171
void init(int pos, double value)
Definition: odeproblem.h:106
std::vector< double > Y
compartment amounts
Definition: odeproblem.h:206
void init_derivs(double time)
Definition: odeproblem.cpp:181