R/prep_param_files.R
prep_param_files.Rd
If you call prep_param_files()
ahead of time, subsequent calls
to the engines will initialize much faster. This is useful in situations
like trial execution mode, which require calling an engine function
on each new simulation. This function does not actually modify
the param files themselves on disk.
prep_param_files(param_files)
A character vector of param files and/or directories containing param files.
A list of special "params_files"
objects
that the engine functions can process fast.
prep_param_files()
searches for the required *.param
files
groups them by directory, sorts them, and returns the result
as a list of special param_files
objects.
(It does not modify the actual contents of the *.param`` files.) This preprocessing step is fast when executed once, but slow when executed thousands of times. So if you need to call a
run_engine_*()function repeatedly, consider passing it an object from
prep_param_files()`.
# Can only run if system dependencies are configured:
if (file.exists(Sys.getenv("RFACTS_PATHS"))) {
facts_file <- get_facts_file_example("contin.facts")
out <- run_flfll(facts_file, verbose = FALSE)
param_files <- prep_param_files(out) # For speed.
param_files # Shows where the param files live and how they are organized.
run_engine_contin(
param_files,
n_sims = 2,
verbose = FALSE,
version = "6.2.5"
)
# Slower: run_engine_contin(out, n_sims = 2, verbose = FALSE) # nolint
}