aboutsummaryrefslogtreecommitdiff
path: root/R/mkinfit.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2023-04-15 15:35:06 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2023-04-15 15:35:06 +0200
commitb0b710ee9f9bb9bbe9708676d0c5822465e02203 (patch)
tree537dcf86326ab2e03100a5defb11b264a4b72a17 /R/mkinfit.R
parent50ea6d11f8c79218c98ee8ae56d8bdcd42cc703a (diff)
Make predefined symbols safer
We still need to create a parallel processing cluster _after_ creating a compiled model that is moved to a user defined location, at least I did not find another way to make it work. This is not a problem with parallel processing without a cluster, which is not available on Windows.
Diffstat (limited to 'R/mkinfit.R')
-rw-r--r--R/mkinfit.R14
1 files changed, 10 insertions, 4 deletions
diff --git a/R/mkinfit.R b/R/mkinfit.R
index b97bc7e2..c851fddb 100644
--- a/R/mkinfit.R
+++ b/R/mkinfit.R
@@ -501,10 +501,15 @@ mkinfit <- function(mkinmod, observed,
}
# Get native symbol before iterations info for speed
+ use_symbols = FALSE
if (solution_type == "deSolve" & use_compiled[1] != FALSE) {
- mkinmod[["symbols"]] <- deSolve::checkDLL(dllname = mkinmod$dll_info[["name"]],
- func = "diffs", initfunc = "initpar",
- jacfunc = NULL, nout = 0, outnames = NULL)
+ mkinmod[["symbols"]] <- try(
+ deSolve::checkDLL(dllname = mkinmod$dll_info[["name"]],
+ func = "diffs", initfunc = "initpar",
+ jacfunc = NULL, nout = 0, outnames = NULL))
+ if (!inherits(mkinmod[["symbols"]], "try-error")) {
+ use_symbols = TRUE
+ }
}
# Get the error model and the algorithm for fitting
@@ -616,8 +621,9 @@ mkinfit <- function(mkinmod, observed,
odeini, outtimes,
solution_type = solution_type,
use_compiled = use_compiled,
+ use_symbols = use_symbols,
method.ode = method.ode,
- atol = atol, rtol = rtol,
+ atol = atol, rtol = rtol,
...)
observed_index <- cbind(as.character(observed$time), as.character(observed$name))

Contact - Imprint