This function parses, compiles, links, and loads the shared object that implements an RxODE model.
rx.initCmpMgr(model, modName, wd, extraC = NULL, debug = TRUE,
mmod = FALSE, calcJac = NULL, calcSens = NULL, collapseModel = FALSE)
This is the ODE model specification. It can be:
a string containing the set of ordinary differential equations (ODE) and other expressions defining the changes in the dynamic system.
a file name where the ODE system equation is contained
An ODE expression enclosed in {}
(see also the filename
argument). For
details, see the sections “Details” and
“RxODE Syntax
” below.
a string to be used as the model name. This string
is used for naming various aspects of the computations,
including generating C symbol names, dynamic libraries,
etc. Therefore, it is necessary that modName
consists of
simple ASCII alphanumeric characters starting with a letter.
character string with a working directory where to
create a subdirectory according to modName
. When
specified, a subdirectoy named after the
“modName.d
” will be created and populated with a
C file, a dynamic loading library, plus various other working
files. If missing, the files are created (and removed) in the
temporary directory, and the RxODE DLL for the model is
created in the current directory named rx_????_platform
, for
example rx_129f8f97fb94a87ca49ca8dafe691e1e_i386.dll
Extra c code to include in the model. This can be
useful to specify functions in the model. These C functions
should usually take double
precision arguments, and
return double
precision values.
is a boolean indicating if the executable should be compiled with verbose debugging information turned on.
A boolean telling if the modName from RxODE
was
missing. This affects how the model is created and used.
boolean indicating if RxODE will calculate the Jacobain according to the specified ODEs.
boolean indicating if RxODE will calculate the sennsitivities according to the specified ODEs.
boolean indicating if RxODE will remove all LHS variables when calculating sensitivites.
An object (closure) with the following member functions:
this function parses (translates) the ODE-based model specification and generates a C file to implement the model.
compiles the generated C file for the ODE system and dynamically loads the machine code in the shared object.
if needed, dynamically loads the dynamic library
produced in the compile()
step. Note that the shared
object persists across R sessions, thus the dynLoad
needs
to be issued as needed.
this function unloads the previously dynamically loaded model object code. Mainly for internal use.
a string with the name of the C symbol for this model solver.
a string with the name of the dynamic link (or shared object) file.
function that returns a list with 3 character
vectors, params
, state
, and lhs
of variable
names (identifiers) used in the model specification.
These will be output when the model is computed (i.e., the ODE solved).
a function that (naively) checks for model validity, namely that the C object code reflects the latest model specification.
helper function to extract the index of one or more system variables (state, parameter, or other).
internal (not user callable) function.
The function parses and compiles (if needed) the RxODE
model specified in the string model
into a dynamic link
library (DLL on Windows) or a shared object (*.so
on
Unix-like systems).
It then dynamically loads this code into the current R session. (Models previously parsed and compiled in previous R sessions only need to be dynamically loaded into the current R session.)
# NOT RUN {
cmpMgt <- rx.initCmpMgr(model, "tst1", wd = ".")
# }
Run the code above in your browser using DataLab