From 681dad8d4e013eed9710cd56a4e9198ee492ab18 Mon Sep 17 00:00:00 2001 From: Lilith Hafner Date: Wed, 18 Oct 2023 12:01:12 -0500 Subject: [PATCH] add input preparation to ensemble problems --- src/ensemble/ensemble_problems.jl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ensemble/ensemble_problems.jl b/src/ensemble/ensemble_problems.jl index c2a6c8ac8..4e493c380 100644 --- a/src/ensemble/ensemble_problems.jl +++ b/src/ensemble/ensemble_problems.jl @@ -23,21 +23,25 @@ function EnsembleProblem(prob::AbstractVector{<:AbstractSciMLProblem}; kwargs... kwargs...) end function EnsembleProblem(prob; - output_func = DEFAULT_OUTPUT_FUNC, prob_func = DEFAULT_PROB_FUNC, + output_func = DEFAULT_OUTPUT_FUNC, reduction = DEFAULT_REDUCTION, u_init = nothing, safetycopy = prob_func !== DEFAULT_PROB_FUNC) - EnsembleProblem(prob, prob_func, output_func, reduction, u_init, safetycopy) + _prob_func = prepare_function(prob_func) + _output_func = prepare_function(output_func) + _reduction = prepare_function(reduction) + _u_init = prepare_initial_state(u_init) + EnsembleProblem(prob, _prob_func, _output_func, _reduction, _u_init, safetycopy) end function EnsembleProblem(; prob, - output_func = DEFAULT_OUTPUT_FUNC, prob_func = DEFAULT_PROB_FUNC, + output_func = DEFAULT_OUTPUT_FUNC, reduction = DEFAULT_REDUCTION, u_init = nothing, p = nothing, safetycopy = prob_func !== DEFAULT_PROB_FUNC) - EnsembleProblem(prob, prob_func, output_func, reduction, u_init, safetycopy) + EnsembleProblem(prob; prob_func, output_func, reduction, u_init, safetycopy) end struct WeightedEnsembleProblem{T1 <: AbstractEnsembleProblem, T2 <: AbstractVector} <: