From 7f124b3b89ab79f49512d587060c8b4ed27e3bc9 Mon Sep 17 00:00:00 2001 From: Richard Plevin Date: Fri, 3 May 2019 11:14:28 -0700 Subject: [PATCH] - Added Base.dotview method for TimestepArrays to fix broadcast assignment bug - Added test of this feature --- src/core/time.jl | 1 + test/test_timesteparrays.jl | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/core/time.jl b/src/core/time.jl index 3042ca393..1122c1e54 100644 --- a/src/core/time.jl +++ b/src/core/time.jl @@ -356,6 +356,7 @@ end # # 4. TimestepArray methods # +Base.dotview(v::Mimi.TimestepArray, args...) = Base.dotview(v.data, args...) Base.fill!(obj::TimestepArray, value) = fill!(obj.data, value) diff --git a/test/test_timesteparrays.jl b/test/test_timesteparrays.jl index 94199af48..fd1e13c00 100644 --- a/test/test_timesteparrays.jl +++ b/test/test_timesteparrays.jl @@ -245,5 +245,9 @@ set_param!(m, :first, :par, 1:length(years)) @test_throws MissingException run(m) +# Check broadcast assignment to underlying array +x = Mimi.TimestepVector{Mimi.FixedTimestep{2005,10}, Float64}(zeros(10)) +x[:] .= 10 +@test all(x.data .== 10) end #module