Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
Include linCmtRate too
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed Oct 6, 2023
1 parent 34109c1 commit f2e91f9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions inst/include/rxode2parseGetTime.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ extern "C" {
static inline double getRate(rx_solving_options_ind *ind, int id, int cmt, double dose, double t){
rx_solving_options *op = &op_global;
returnBadTime(t);
if (cmt >= op->neq) {
return ind->linCmtRate[cmt - op->neq];
}
double ret = RATE(id, cmt, dose, t);
if (ISNA(ret)){
op->badSolve=1;
Expand Down
1 change: 1 addition & 0 deletions inst/include/rxode2parseStruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ extern "C" {
double *linCmtLag;
double *linCmtF;
double *linCmtDur;
double *linCmtRate;
} rx_solving_options_ind;

typedef struct {
Expand Down
11 changes: 9 additions & 2 deletions src/comp.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,13 @@ double linCmtCompA(rx_solve *rx, unsigned int id, double _t, int linCmt,
ind->linCmtF[1] = d_F2;
ind->linCmtDur[0] = d_dur1;
ind->linCmtDur[1] = d_dur2;
ind->linCmtRate[0] = d_rate1;
ind->linCmtRate[1] = d_rate2;
} else {
ind->linCmtLag[0] = d_tlag;
ind->linCmtF[0] = d_F;
ind->linCmtDur[0] = d_dur1;
ind->linCmtRate[0] = d_rate1;
}
void *ctx = &(lin);
if (ind->idx == 0) {
Expand Down Expand Up @@ -417,11 +420,15 @@ SEXP _rxode2parse_compC(SEXP in, SEXP mv) {
linCmtF[0] = linCmtF[1] = 1.0;
indR.linCmtF = linCmtF;
double linCmtDur[2];
linCmtDur[0] = linCmtDur[1] = 0.0;
indR.linCmtDur = linCmtDur;

double linCmtRate[2];
linCmtRate[0] = linCmtRate[1] = 0.0;
indR.linCmtRate = linCmtRate;
int rc[1];
rc[0] = 0;
indR.rc=rc;
linCmtDur[0] = linCmtDur[1] = 0.0;
indR.linCmtDur = linCmtDur;
indR.nBadDose = 0;
indR.HMAX = 0.0; // Determined by diff
indR.curDose = NA_REAL;
Expand Down

0 comments on commit f2e91f9

Please sign in to comment.