From b95b66b96a755ac7f90f9a56c71ce3e1e3799e62 Mon Sep 17 00:00:00 2001 From: Charles Kawczynski Date: Fri, 19 Apr 2024 16:39:06 -0400 Subject: [PATCH] Fix Vararg warning in MultipleConditions struct Bump patch version --- Project.toml | 2 +- src/utilities/convergence_condition.jl | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Project.toml b/Project.toml index f670d14e..4bcb82cf 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ClimaTimeSteppers" uuid = "595c0a79-7f3d-439a-bc5a-b232dc3bde79" authors = ["Climate Modeling Alliance"] -version = "0.7.19" +version = "0.7.20" [deps] ClimaComms = "3a4d1b5c-c61d-41fd-a00a-5873ba7a1b0d" diff --git a/src/utilities/convergence_condition.jl b/src/utilities/convergence_condition.jl index a746acb2..1ce7e7b0 100644 --- a/src/utilities/convergence_condition.jl +++ b/src/utilities/convergence_condition.jl @@ -92,15 +92,18 @@ updated_cache((; rate, order)::MinimumRateOfConvergence, cache, val, err, iter) Checks multiple `ConvergenceCondition`s, combining their results with either `all` or `any`. """ -struct MultipleConditions{ - CC <: Union{typeof(all), typeof(any)}, - C <: Tuple{Vararg{T} where {T <: ConvergenceCondition}}, -} <: ConvergenceCondition +struct MultipleConditions{CC, C} <: ConvergenceCondition condition_combiner::CC conditions::C + function MultipleConditions( + condition_combiner::Union{typeof(all), typeof(any)}, + conditions::Vararg{<:ConvergenceCondition}, + ) + return new{typeof(condition_combiner), typeof(conditions)}(condition_combiner, conditions) + end end -MultipleConditions(condition_combiner::Union{typeof(all), typeof(any)} = all, conditions::ConvergenceCondition...) = - MultipleConditions(condition_combiner, conditions) + +MultipleConditions(conditions::ConvergenceCondition...) = MultipleConditions(all, conditions) cache_type((; conditions)::MultipleConditions, ::Type{FT}) where {FT} = Tuple{map(condition -> cache_type(condition, FT), conditions)...} has_converged(alg::MultipleConditions, caches, val, err, iter) = alg.condition_combiner(