From 503441b0a958c1df50df0ee7cfc3bde4ea1b1865 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Fri, 20 Nov 2020 19:43:46 +0100 Subject: Support storing mkinmod compiled code as CFunc objects With automatic reloading in mkinfit and mkinpredict in case the DLL is not loaded and the original DLL path has been cleaned up. Depends on jranke/inline@974bdea04fcedfafaab231e6f359c88270b56cb9 See inline#13 --- man/mkinmod.Rd | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'man') diff --git a/man/mkinmod.Rd b/man/mkinmod.Rd index e5b1c8f3..f71ebfb3 100644 --- a/man/mkinmod.Rd +++ b/man/mkinmod.Rd @@ -9,9 +9,11 @@ mkinmod( ..., use_of_ff = "max", + name = NULL, speclist = NULL, quiet = FALSE, - verbose = FALSE + verbose = FALSE, + cf_dir = NULL ) \method{print}{mkinmod}(x, ...) @@ -40,6 +42,8 @@ formation fractions are always used (default). If "min", a minimum use of formation fractions is made, i.e. each pathway to a metabolite has its own rate constant.} +\item{name}{A name for the model. Should be a valid R object name.} + \item{speclist}{The specification of the observed variables and their submodel types and pathways can be given as a single list using this argument. Default is NULL.} @@ -49,6 +53,9 @@ argument. Default is NULL.} \item{verbose}{If \code{TRUE}, passed to \code{\link[inline:cfunction]{inline::cfunction()}} if applicable to give detailed information about the C function being built.} +\item{cf_dir}{Directory where CFunc objects should be saved. Specifying +'cf_dir' without specifying a 'name' for the object is an error.} + \item{x}{An \code{\link{mkinmod}} object.} \item{submodel}{Character vector of length one to specify the submodel type. @@ -113,7 +120,6 @@ For kinetic models with more than one observed variable, a symbolic solution of the system of differential equations is included in the resulting mkinmod object in some cases, speeding up the solution. -If a C compiler is found by \code{\link[pkgbuild:has_compiler]{pkgbuild::has_compiler()}} and there is more than one observed variable in the specification, C code is generated for evaluating the differential equations, compiled using \code{\link[inline:cfunction]{inline::cfunction()}} and added to the resulting mkinmod object. @@ -132,17 +138,17 @@ SFO <- mkinmod(parent = mkinsub("SFO")) SFO_SFO <- mkinmod( parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO")) +print(SFO_SFO) \dontrun{ -# Now supplying full names used for plotting + fit_sfo_sfo <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE, solution_type = "deSolve") + + # Now supplying full names used for plotting, and write to user defined location SFO_SFO.2 <- mkinmod( parent = mkinsub("SFO", "m1", full_name = "Test compound"), - m1 = mkinsub("SFO", full_name = "Metabolite M1")) - -# The above model used to be specified like this, before the advent of mkinsub() -SFO_SFO <- mkinmod( - parent = list(type = "SFO", to = "m1"), - m1 = list(type = "SFO")) + m1 = mkinsub("SFO", full_name = "Metabolite M1"), + name = "SFOSFO", cf_dir = tempdir()) +fit_sfo_sfo <- mkinfit(SFO_SFO.2, FOCUS_2006_D, quiet = TRUE, solution_type = "deSolve") # Show details of creating the C function SFO_SFO <- mkinmod( @@ -166,13 +172,6 @@ fit_DFOP_par_c <- mkinfit(m_synth_DFOP_par, quiet = TRUE) } - - m_synth_SFO_lin <- mkinmod(parent = list(type = "SFO", to = "M1"), - M1 = list(type = "SFO", to = "M2"), - M2 = list(type = "SFO"), use_of_ff = "max") - - print(m_synth_SFO_lin) - } \references{ FOCUS (2006) \dQuote{Guidance Document on Estimating Persistence -- cgit v1.2.1