diff --git a/NAMESPACE b/NAMESPACE index d4e57ad55f6f3c6fd45a5032f39676d915a9a529..5c5e5eea911164389d8350fdcd540b0b833084aa 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,3 +1,4 @@ # Generated by roxygen2: do not edit by hand export(loadConfig) +export(sic_run_fortran) diff --git a/R/sic_run_fortran.R b/R/sic_run_fortran.R new file mode 100644 index 0000000000000000000000000000000000000000..5d19221369cdfe3b19814e9b338c0207a7d98695 --- /dev/null +++ b/R/sic_run_fortran.R @@ -0,0 +1,32 @@ +#' Run Talweg, Fluvia or Sirene +#' +#' @param prog [character], the program to run. Should be one of "talweg" +#' @param params [list] or [character], see details +#' @param cfg +#' +#' @details If argument `params` is a [list], arguments are injected in the command line by taking the items of the list with the conversion +#' `[key]=[value]`. If argument `params` is a [character] +#' +#' @return +#' @export +#' +#' @examples +#' \dontrun{ +#' # Run steady simulation for the scenario #1 +#' params <- list(SCE=1) +#' sic_run_fortran("fluvia", params) +#'} +sic_run_fortran <- function(prog, params, cfg = loadConfig()) { + if (is.list(params)) params <- convert_sic_params(params, cfg) + shell( + shQuote( + paste( + file.path(cfg$sic$path, cfg$sic[[prog]]), + shQuote(sic$project$path, type = "cmd"), + params + ), + type = "cmd2"), + wait = T, + translate = T + ) +} diff --git a/man/sic_run_fortran.Rd b/man/sic_run_fortran.Rd new file mode 100644 index 0000000000000000000000000000000000000000..e513d4532fadce6f6067aed17f5f7cf80b68cf3a --- /dev/null +++ b/man/sic_run_fortran.Rd @@ -0,0 +1,32 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/sic_run_fortran.R +\name{sic_run_fortran} +\alias{sic_run_fortran} +\title{Run Talweg, Fluvia or Sirene} +\usage{ +sic_run_fortran(prog, params, cfg = loadConfig()) +} +\arguments{ +\item{prog}{\link{character}, the program to run. Should be one of "talweg"} + +\item{params}{\link{list} or \link{character}, see details} + +\item{cfg}{} +} +\value{ + +} +\description{ +Run Talweg, Fluvia or Sirene +} +\details{ +If argument \code{params} is a \link{list}, arguments are injected in the command line by taking the items of the list with the conversion +\verb{[key]=[value]}. If argument \code{params} is a \link{character} +} +\examples{ +\dontrun{ +# Run steady simulation for the scenario #1 +params <- list(SCE=1) +sic_run_fortran("fluvia", params) +} +}