aboutsummaryrefslogtreecommitdiff
path: root/R/mkinpredict.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/mkinpredict.R')
-rw-r--r--R/mkinpredict.R17
1 files changed, 11 insertions, 6 deletions
diff --git a/R/mkinpredict.R b/R/mkinpredict.R
index 7222e247..a294a114 100644
--- a/R/mkinpredict.R
+++ b/R/mkinpredict.R
@@ -38,7 +38,6 @@
#' @param \dots Further arguments passed to the ode solver in case such a
#' solver is used.
#' @import deSolve
-#' @importFrom inline getDynLib
#' @return A matrix with the numeric solution in wide format
#' @author Johannes Ranke
#' @examples
@@ -117,7 +116,7 @@ mkinpredict.mkinmod <- function(x,
solution_type = "deSolve",
use_compiled = "auto",
method.ode = "lsoda", atol = 1e-8, rtol = 1e-10,
- map_output = TRUE,
+ map_output = TRUE,
na_stop = TRUE,
...)
{
@@ -170,12 +169,18 @@ mkinpredict.mkinmod <- function(x,
if (solution_type == "deSolve") {
if (!is.null(x$cf) & use_compiled[1] != FALSE) {
- out <- ode(
+ DLL <- try(inline::getDynLib(x$cf))
+ if (inherits(DLL, "try-error")) {
+ x$cf <- inline::readDynLib(x$cf_name, x$cf_dir)
+ }
+ cf_env <- environment(x$cf)
+
+ out <- deSolve::ode(
y = odeini,
times = outtimes,
- func = "func",
+ func = cf_env$name,
initfunc = "initpar",
- dllname = getDynLib(x$cf)[["name"]],
+ dllname = cf_env$f,
parms = odeparms[x$parms], # Order matters when using compiled models
method = method.ode,
atol = atol,
@@ -195,7 +200,7 @@ mkinpredict.mkinmod <- function(x,
}
return(list(c(diffs)))
}
- out <- ode(
+ out <- deSolve::ode(
y = odeini,
times = outtimes,
func = mkindiff,

Contact - Imprint