For lower-level odin functions odin_parse, odin_validate we only accept a list of options rather than individually named options.

odin_options(verbose = NULL, target = NULL, workdir = NULL,
  validate = NULL, pretty = NULL, skip_cache = NULL,
  compiler_warnings = NULL, no_check_unused_equations = NULL,
  rewrite_dims = NULL, rewrite_constants = NULL, debug_enable = NULL,
  substitutions = NULL, options = NULL)

Arguments

verbose

Logical scalar indicating if the compilation should be verbose. Defaults to the value of the option odin.verbose or FALSE otherwise.

target

Compilation target. Options are "c", "r" or "js", defaulting to the option odin.target or "c" otherwise.

workdir

Directory to use for any generated files. This is only relevant for the "c" target. Defaults to the value of the option odin.workdir or tempdir() otherwise.

validate

Validate the model's intermediate representation against the included schema. Normally this is not needed and is intended primarily for development use. Defaults to the value of the option odin.validate or FALSE otherwise.

pretty

Pretty-print the model's intermediate representation. Normally this is not needed and is intended primarily for development use. Defaults to the value of the option odin.pretty or FALSE otherwise.

skip_cache

Skip odin's cache. This might be useful if the model appears not to compile when you would expect it to. Hopefully this will not be needed often. Defaults to the option odin.skip_cache or FALSE otherwise.

compiler_warnings

Previously this attempted detection of compiler warnings (with some degree of success), but is currently ignored. This may become supported again in a future version depending on underlying support in pkgbuild.

no_check_unused_equations

If TRUE, then don't print messages about unused variables. Defaults to the option odin.no_check_unused_equations or FALSE otherwise.

rewrite_dims

Logical, indicating if odin should try and rewrite your model dimensions (if using arrays). If TRUE then we replace dimensions known at compile-time with literal integers, and those known at initialisation with simplified and shared expressions. You may get less-comprehensible error messages with this option set to TRUE because parts of the model have been effectively evaluated during processing.

rewrite_constants

Logical, indicating if odin should try and rewrite all constant scalars. This is a superset of rewrite_dims and may be slow for large models. Doing this will make your model less debuggable; error messages will reference expressions that have been extensively rewritten, some variables will have been removed entirely or merged with other identical expressions, and the generated code may not be obviously connected to the original code.

debug_enable

Enable debugging commands in generated code (currently print()). If TRUE then these are generated by odin targets that support them, and will generally make your program slower.

substitutions

Optionally, a list of values to substitute into model specification as constants, even though they are declared as user(). This will be most useful in conjunction with rewrite_dims to create a copy of your model with dimensions known at compile time and all loops using literal integers.

options

Named list of options. If provided, then all other options are ignored.

Value

A list of parameters, of class odin_options

Examples

odin_options()
#> $validate
#> [1] FALSE
#> 
#> $verbose
#> [1] TRUE
#> 
#> $target
#> [1] "c"
#> 
#> $pretty
#> [1] FALSE
#> 
#> $workdir
#> [1] "/tmp/RtmpqvdibS/file17334d1b67f8"
#> 
#> $skip_cache
#> [1] FALSE
#> 
#> $rewrite_dims
#> [1] FALSE
#> 
#> $rewrite_constants
#> [1] FALSE
#> 
#> $substitutions
#> NULL
#> 
#> $debug_enable
#> [1] FALSE
#> 
#> $no_check_unused_equations
#> [1] FALSE
#> 
#> $compiler_warnings
#> [1] FALSE
#> 
#> $read_include
#> function (filename) 
#> {
#>     d <- readLines(filename)
#>     re1 <- "^[[:alnum:]_*]+ ([[:alnum:]_]+)(.+)"
#>     i1 <- grep(re1, d)
#>     i2 <- grep("^}$", d)
#>     if (length(i1) != length(i2)) {
#>         stop("Parse error for ", filename)
#>     }
#>     name <- sub(re1, "\\1", d[i1])
#>     defn <- setNames(vcapply(seq_along(i1), function(k) {
#>         paste(d[i1[[k]]:i2[[k]]], collapse = "\n")
#>     }), name)
#>     decl <- sub("^([^{]*?)\\s*\\{.*", "\\1;", defn)
#>     list(names = name, data = list(names = name, declarations = decl, 
#>         definitions = defn, filename = filename))
#> }
#> <bytecode: 0x55ceac32aaf0>
#> <environment: namespace:odin>
#> 
#> attr(,"class")
#> [1] "odin_options"