# WARNING - Generated by {fusen} from dev/flat_kwb_simulate_inflow.Rmd: do not edit by hand # nolint: line_length_linter.

#' Default Max
#' 
#' This function does the same thing as kwb.utils::default_max(),
#' but it is bundled with *ambre* to avoid a hard dependency on the
#' unmaintained package.
#' 
#' @param org_max original maximum value 
#' @param new_max new maximum value for replacement
#' @param f function apply on "org_max" to transform to the correct 
#' dimension (e.g. "log" in case of "lognorm" or "log10" in case of log10_norm) 
#' (default: c())
#' @references
#'   Sonnenberg H (2024). kwb.utils: General Utility Functions Developed at KWB. R package version 0.15.0
#'   URL: \url{https://github.com/kwb-r/kwb.utils}
#'   (MIT Licence)
#' @noRd
#' @examples
#' default_max(org_max = 2, new_max = 0.01, f = log10)
#' default_max(org_max = 0, new_max = 0.01, f = log10)
#' default_max(org_max = 2, new_max = 0.01, f = log)
#' default_max(org_max = 0, new_max = 0.01, f = log)
default_max <- function(org_max, new_max, f = c)
{
  ifelse(org_max > 0, f(org_max), f(new_max))
}
