Skip to content

Commit

Permalink
Add podo0 and dose0
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed Dec 4, 2024
1 parent be7a573 commit bb33aba
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 2 deletions.
Binary file modified data/rxReservedKeywords.rda
Binary file not shown.
Binary file modified data/rxResidualError.rda
Binary file not shown.
Binary file modified data/rxSyntaxFunctions.rda
Binary file not shown.
5 changes: 5 additions & 0 deletions inst/include/rxode2_model_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,14 @@ static inline double Rx_pow_di_(double a, double b, rx_solve *rx) {
#define _logitInv1(x) expit(x, 0.0, 1.0)
#define _logitInv2(x, y) expit(x, y, 1.0)
#define _podo0() (_solveData->subjects[_cSub].curDose)
#define _podo00() (ISNA(_solveData->subjects[_cSub].curDose) ? 0 : _solveData->subjects[_cSub].curDose)
#define _podo1(x) (_solveData->subjects[_cSub].curDoseS[x])
#define _podo01(x) (ISNA(_solveData->subjects[_cSub].curDoseS[x]) ? 0 : _solveData->subjects[_cSub].curDoseS[x])

#define _dose0() (_solveData->subjects[_cSub].curDose)
#define _dose1(x) (_solveData->subjects[_cSub].curDoseS[x])
#define _dose00() (ISNA(_solveData->subjects[_cSub].curDose) ? 0 : _solveData->subjects[_cSub].curDose)
#define _dose01(x) (ISNA(_solveData->subjects[_cSub].curDoseS[x]) ? 0 : _solveData->subjects[_cSub].curDoseS[x])
#define _tad0() (t-_solveData->subjects[_cSub].tlast)
#define _tad1(x) (t-_solveData->subjects[_cSub].tlastS[x])
#define _tad00() (ISNA(_solveData->subjects[_cSub].tlast)? 0 : (t- _solveData->subjects[_cSub].tlast))
Expand Down
1 change: 0 additions & 1 deletion man/reexports.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/genModelVars.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,12 @@ static inline int sortStateVectorsErrHandle(int prop, int pass, int i) {
if ((prop & propDose) != 0) {
sAppend(&sbt, "'dose(%s)', ", buf);
}
if ((prop & propPodo0) != 0) {
sAppend(&sbt, "'podo0(%s)', ", buf);
}
if ((prop & propDose0) != 0) {
sAppend(&sbt, "'dose0(%s)', ", buf);
}
// Take off trailing "',
sbt.o -= 2;
sbt.s[sbt.o] = 0;
Expand Down
7 changes: 7 additions & 0 deletions src/parseFuns.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ typedef struct transFunctions {
int isDose;
int isPodo;

int isDose0;
int isPodo0;

int isTfirst;
int isTfirst0;

Expand Down Expand Up @@ -140,6 +143,10 @@ static inline void transFunctionsIni(transFunctions *tf) {
tf->isDose = 0;
tf->isPodo = 0;

tf->isDose0 = 0;
tf->isPodo0 = 0;


tf->isTfirst = 0;
tf->isTfirst0 = 0;

Expand Down
9 changes: 8 additions & 1 deletion src/parseFunsDosing.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ static inline int isFunctionTadType(transFunctions *tf) {
(tf->isTfirst0 = !strcmp("tfirst0", tf->v)) ||

(tf->isDose = !strcmp("dose", tf->v)) ||
(tf->isPodo = !strcmp("podo", tf->v));
(tf->isPodo = !strcmp("podo", tf->v)) ||

(tf->isPodo0 = !strcmp("podo0", tf->v)) ||
(tf->isDose0 = !strcmp("dose0", tf->v));
}
static inline int handleFunctionTadEmptyCcode(transFunctions *tf,char *v2) {
if (allSpaces(v2)){
Expand Down Expand Up @@ -101,6 +104,10 @@ static inline int handleFunctionTadSingleStateCcode(transFunctions *tf,char *v2)
tb.dprop[tb.id] += propDose;
} else if (tf->isPodo && (tb.dprop[tb.id] & propPodo) == 0) {
tb.dprop[tb.id] += propPodo;
} else if (tf->isPodo0 && (tb.dprop[tb.id] & propPodo0) == 0) {
tb.dprop[tb.id] += propPodo0;
} else if (tf->isDose0 && (tb.dprop[tb.id] & propDose0) == 0) {
tb.dprop[tb.id] += propDose0;
}
return 1;
}
Expand Down
3 changes: 3 additions & 0 deletions src/tran.h
Original file line number Diff line number Diff line change
Expand Up @@ -389,4 +389,7 @@ char *getLine (char *src, int line, int *lloc);
#define propPodo 8192
#define propDose 16384

#define propPodo0 32768
#define propDose0 65536

#endif // __TRAN_H__

0 comments on commit bb33aba

Please sign in to comment.