diff --git a/NAMESPACE b/NAMESPACE index 77ce98b1c710aa01560155b94da4a1f84608c46c..fd18f048c231f40a475228ee3fcbd607952b14f8 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,5 +1,6 @@ # Generated by roxygen2: do not edit by hand +export(convert_sic_params) export(loadConfig) export(set_initial_conditions) export(sic_run_fortran) diff --git a/R/convert_sic_params.R b/R/convert_sic_params.R new file mode 100644 index 0000000000000000000000000000000000000000..d6b840e7c5bbc25fd09bcdc6825a588fa174cc6c --- /dev/null +++ b/R/convert_sic_params.R @@ -0,0 +1,18 @@ +#' Convert a list of parameters into command line arguments +#' +#' @param params a [list] of [character] with each item is identified by +#' @param cfg +#' +#' @return A [character] with each parameter is converted to "[key param]=[value param]" and each parameter separated by a space character. +#' @export +#' +#' @examples +convert_sic_params <- function(params, cfg = loadConfig()) { + if (!"INTERF" %in% names(params)) { + params <- c(list(INTERF = cfg$sic$fortran$prms$INTERF), params) + } + params <- sapply(names(params), function(key) { + paste(key, params[[key]], sep= "=") + }) + paste(params, collapse = " ") +} diff --git a/man/convert_sic_params.Rd b/man/convert_sic_params.Rd new file mode 100644 index 0000000000000000000000000000000000000000..375b4d9b578b4e801a422e869991d7f68722a224 --- /dev/null +++ b/man/convert_sic_params.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/convert_sic_params.R +\name{convert_sic_params} +\alias{convert_sic_params} +\title{Convert a list of parameters into command line arguments} +\usage{ +convert_sic_params(params, cfg = loadConfig()) +} +\arguments{ +\item{params}{a \link{list} of \link{character} with each item is identified by} + +\item{cfg}{} +} +\value{ +A \link{character} with each parameter is converted to "\link{key param}=\link{value param}" and each parameter separated by a space character. +} +\description{ +Convert a list of parameters into command line arguments +}