Skip to content

Commit

Permalink
expose internal
Browse files Browse the repository at this point in the history
  • Loading branch information
philchalmers committed Feb 6, 2025
1 parent 8d4ce08 commit bdda25f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: SimDesign
Title: Structure for Organizing Monte Carlo Simulation Designs
Version: 2.18.1
Version: 2.18.2
Authors@R: c(person("Phil", "Chalmers", email = "[email protected]", role = c("aut", "cre"),
comment = c(ORCID="0000-0001-5332-2810")),
person("Matthew", "Sigal", role = c("ctb")),
Expand Down
2 changes: 1 addition & 1 deletion R/runArraySimulation.R
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ runArraySimulation <- function(design, ..., replications,
if(!is.null(control$save_seeds) && isTRUE(control$save_seeds))
stop(c('save_seeds not supported for array jobs. If this is truely',
' necessary use store_Random.seeds instead'))
control$from.runArraySimulation <- TRUE
control$global_fun_level <- 3
rngkind <- RNGkind()
RNGkind("L'Ecuyer-CMRG")
on.exit(RNGkind(rngkind[1L]))
Expand Down
8 changes: 6 additions & 2 deletions R/runSimulation.R
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,10 @@
#' used throughout the simulation? Set to \code{FALSE} if unnecessary or if the call to
#' \code{\link{gc}} is unnecessarily time consuming}
#'
#' \item{\code{global_fun_level}}{determines how many levels to search until global environment
#' frame is located. Default is 2, though for \code{\link{runArraySimulation}} this is set to 3.
#' Use 3 or more whenever \code{runSimulation} is used within the context of another function}
#'
#' \item{\code{max_time}}{
#' Similar to \code{\link{runArraySimulation}}, specifies the (approximate) maximum
#' time that the simulation is allowed to be executed. However, unlike the implementation
Expand Down Expand Up @@ -1002,6 +1006,7 @@ runSimulation <- function(design, replications, generate, analyse, summarise,
stopifnot("Argument(s) to save_details list invalid"=
all(names(save_details) %in% valid_save_details.list()))
}
if(!is.null(control$global_fun_level)) control$global_fun_level <- 2
if(replications < 3L){
if(verbose)
message('save, stop_on_fatal, and print_RAM flags disabled for testing purposes')
Expand Down Expand Up @@ -1283,8 +1288,7 @@ runSimulation <- function(design, replications, generate, analyse, summarise,
on.exit(undebug(Functions[[debug]]), add = TRUE)
}
}
export_funs <- if(!is.null(control$from.runArraySimulation))
parent_env_fun(3L) else parent_env_fun()
export_funs <- parent_env_fun(control$global_fun_level)
if(parallel){
if(!useFuture && is.null(cl)){
cl <- parallel::makeCluster(ncores, type=type)
Expand Down
4 changes: 4 additions & 0 deletions man/runSimulation.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bdda25f

Please sign in to comment.