aboutsummaryrefslogtreecommitdiff
path: root/R/mkinpredict.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2015-04-16 10:03:02 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2015-04-16 10:03:02 +0200
commit10fb9aac470d87afbe2d4ee9e3d1898bfc3f1aa7 (patch)
treea1ee701046f3ccc69a05eb9e5461cf8167e3ddda /R/mkinpredict.R
parentd34e5c053794a08cc73c9042ccccfb334ae0f62d (diff)
parent7f5455e1a49f44a0fa341ee7cca86dfb03e273a2 (diff)
Merge branch 'compile_odes'
Diffstat (limited to 'R/mkinpredict.R')
-rw-r--r--R/mkinpredict.R22
1 files changed, 13 insertions, 9 deletions
diff --git a/R/mkinpredict.R b/R/mkinpredict.R
index da013d50..bed82441 100644
--- a/R/mkinpredict.R
+++ b/R/mkinpredict.R
@@ -87,17 +87,21 @@ mkinpredict <- function(mkinmod, odeparms, odeini,
names(out) <- c("time", mod_vars)
}
if (solution_type == "deSolve") {
- mkindiff <- function(t, state, parms) {
+ if (!is.null(mkinmod$compiled)) {
+ mkindiff <- mkinmod$compiled
+ } else {
+ mkindiff <- function(t, state, parms) {
- time <- t
- diffs <- vector()
- for (box in names(mkinmod$diffs))
- {
- diffname <- paste("d", box, sep="_")
- diffs[diffname] <- with(as.list(c(time, state, parms)),
- eval(parse(text=mkinmod$diffs[[box]])))
+ time <- t
+ diffs <- vector()
+ for (box in names(mkinmod$diffs))
+ {
+ diffname <- paste("d", box, sep="_")
+ diffs[diffname] <- with(as.list(c(time, state, parms)),
+ eval(parse(text=mkinmod$diffs[[box]])))
+ }
+ return(list(c(diffs)))
}
- return(list(c(diffs)))
}
out <- ode(
y = odeini,

Contact - Imprint