C.from.slv | R Documentation |
The function creates deSolve-compatible C code from .SLV image and save it to a file.
C.from.slv(slv, file = "model.c", output = slv$output.on, dbs.compatibility = FALSE)
slv |
object of |
file |
filename to save .C code. |
output |
character vector with names of additional output values. |
dbs.compatibility |
logical value to use DBSolve-like method of parameters updates. |
import.slv
deSolve
ode
### create and compile C code for 'example1.slv', Rtools may be reqired C.from.slv(example1_ruSlv, output="D") ## Not run: system("R CMD SHLIB model.c") # compilation for .DLL library(deSolve) dyn.load(paste0("model", .Platform$dynlib.ext)) res<-ode(y=example1_ruSlv$ode.initials, times=seq(0,example1_ruSlv$solver.time.limit,0.1), func = "derivs", parms=example1_ruSlv$ode.parameters.external, dllname = "model", initfunc = "initmod", nout=length("D"), outnames = "D" ) dyn.unload(paste0("model", .Platform$dynlib.ext)) plot(res) ## End(Not run) ### plot simulations from SLV model ## Not run: filePath<-system.file(package = "dbs", "extdata/example1.slv") raw<-read.slv(filePath) # read from example compatible.slv(raw) # TRUE example1_ruSlv<-import.slv(raw) C.from.slv(example1_ruSlv, output="D") system("R CMD SHLIB model.c") # compilation for .DLL library(deSolve) dyn.load(paste0("model", .Platform$dynlib.ext)) res<-ode(y=example1_ruSlv$ode.initials, times=seq(0,example1_ruSlv$solver.time.limit,0.1), func = "derivs", parms=example1_ruSlv$ode.parameters.external, dllname = "model", initfunc = "initmod", nout=length("D"), outnames = "D" ) dyn.unload(paste0("model", .Platform$dynlib.ext)) plot(res) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.