Model code is written to a file in native mrgsolve format. This
can be useful for (1) breaking connection to NONMEM modeling outputs that
are imported by $NMXML
or $NMEXT
and (2) saving model updates (e.g.,
an updated parameter list). Models can be read back using mread()
.
Value
A list containing data that was written out to the cpp file, with added
item file
, is returned invisibly.
Details
See important details in mwrite_yaml()
.
Examples
temp <- tempfile(fileext = ".mod")
mod <- modlib("pk1", compile = FALSE)
x <- mwrite_cpp(mod, file = temp)
mod <- mread(x$file, compile = FALSE)
mod
#>
#>
#> ---------- source: file1661c3600664e.mod ----------
#>
#> project: /private/var/fol.../T/RtmpRwrIeP
#> shared object: file1661c3600664e.mod-so-1661c7ac700d9 <not loaded>
#>
#> time: start: 0 end: 24 delta: 1
#> add: <none>
#> compartments: EV CENT [2]
#> parameters: CL V KA [3]
#> captures: CP [1]
#> omega: 0x0
#> sigma: 0x0
#>
#> solver: rtol: 1e-08 atol: 1e-08 itol: 1 (scalar)
#> ------------------------------------------------------