Skip to content

Commit 044923f

Browse files
Merge pull request #271 from CliMA/ck/warning
Fix Vararg warning in MultipleConditions struct
2 parents 16fb851 + b95b66b commit 044923f

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ClimaTimeSteppers"
22
uuid = "595c0a79-7f3d-439a-bc5a-b232dc3bde79"
33
authors = ["Climate Modeling Alliance"]
4-
version = "0.7.19"
4+
version = "0.7.20"
55

66
[deps]
77
ClimaComms = "3a4d1b5c-c61d-41fd-a00a-5873ba7a1b0d"

src/utilities/convergence_condition.jl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,18 @@ updated_cache((; rate, order)::MinimumRateOfConvergence, cache, val, err, iter)
9292
Checks multiple `ConvergenceCondition`s, combining their results with either
9393
`all` or `any`.
9494
"""
95-
struct MultipleConditions{
96-
CC <: Union{typeof(all), typeof(any)},
97-
C <: Tuple{Vararg{T} where {T <: ConvergenceCondition}},
98-
} <: ConvergenceCondition
95+
struct MultipleConditions{CC, C} <: ConvergenceCondition
9996
condition_combiner::CC
10097
conditions::C
98+
function MultipleConditions(
99+
condition_combiner::Union{typeof(all), typeof(any)},
100+
conditions::Vararg{<:ConvergenceCondition},
101+
)
102+
return new{typeof(condition_combiner), typeof(conditions)}(condition_combiner, conditions)
103+
end
101104
end
102-
MultipleConditions(condition_combiner::Union{typeof(all), typeof(any)} = all, conditions::ConvergenceCondition...) =
103-
MultipleConditions(condition_combiner, conditions)
105+
106+
MultipleConditions(conditions::ConvergenceCondition...) = MultipleConditions(all, conditions)
104107
cache_type((; conditions)::MultipleConditions, ::Type{FT}) where {FT} =
105108
Tuple{map(condition -> cache_type(condition, FT), conditions)...}
106109
has_converged(alg::MultipleConditions, caches, val, err, iter) = alg.condition_combiner(

0 commit comments

Comments
 (0)