Skip to content

Commit 30b4f98

Browse files
attempt to fix to standard indexing
1 parent 9b3f873 commit 30b4f98

File tree

2 files changed

+7
-33
lines changed

2 files changed

+7
-33
lines changed

src/math.jl

+3-29
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Base.map!(f::F, m::AMSA, A0, As...) where {F} =
88

99
Base.BroadcastStyle(::Type{<:AMSA}) = Broadcast.ArrayStyle{AMSA}()
1010
Base.BroadcastStyle(::Type{<:AbstractMultiScaleArrayLeaf}) = Broadcast.ArrayStyle{AbstractMultiScaleArrayLeaf}()
11-
11+
Base.BroadcastStyle(a::Broadcast.ArrayStyle{AMSA}, b::Base.Broadcast.DefaultArrayStyle) = b
1212
#=
1313
AMSAStyle(::S) where {S} = AMSAStyle{S}()
1414
AMSAStyle(::S, ::Val{N}) where {S,N} = AMSAStyle(S(Val(N)))
@@ -35,42 +35,16 @@ end
3535

3636
@inline function Base.copy(bc::Broadcast.Broadcasted{Broadcast.ArrayStyle{AMSA}})
3737
first_amsa = find_amsa(bc)
38-
out = deepcopy(first_amsa)
38+
out = similar(first_amsa)
3939
copyto!(out,bc)
4040
out
41-
#=
42-
N = nnodes(bc)
43-
@inline function f(i)
44-
copy(unpack(bc, i))
45-
end
46-
first_amsa = find_amsa(bc)
47-
if length(fieldnames(typeof(first_amsa))) == 1
48-
construct(parameterless_type(first_amsa), map(f,N), f(nothing))
49-
else
50-
out = deepcopy(first_amsa)
51-
copyto!(out,bc)
52-
return out
53-
end
54-
=#
5541
end
5642

5743
@inline function Base.copy(bc::Broadcast.Broadcasted{Broadcast.ArrayStyle{AbstractMultiScaleArrayLeaf}})
5844
first_amsa = find_amsa(bc)
59-
out = deepcopy(first_amsa)
45+
out = similar(first_amsa)
6046
copyto!(out,bc)
6147
out
62-
#=
63-
@inline function f(i)
64-
copy(unpack(bc, i))
65-
end
66-
67-
if length(fieldnames(typeof(first_amsa))) == 1
68-
return construct(parameterless_type(first_amsa), f(nothing))
69-
else
70-
71-
return out
72-
end
73-
=#
7448
end
7549

7650
@inline function Base.copyto!(dest::AMSA, bc::Broadcast.Broadcasted{Nothing})

test/indexing_and_creation_tests.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ p/zero(t)
147147

148148
size(p)
149149

150-
@test_broken p ./ rand(length(p))
150+
p ./ rand(length(p))
151151

152152

153153
f = function (du,u,p,t)
@@ -177,14 +177,14 @@ sol1 = solve(prob, Tsit5())
177177
# Check stepping behavior matches array
178178
Random.seed!(100)
179179
prob = SDEProblem(f, g, em, (0.0, 1000.0))
180-
@test_broken @time sol1 = solve(prob, SRIW1(), progress=false, abstol=1e-2, reltol=1e-2, save_everystep=false)
180+
@time sol1 = solve(prob, SRIW1(), progress=false, abstol=1e-2, reltol=1e-2, save_everystep=false)
181181

182-
@test_broken cell1 .= randn.()
182+
cell1 .= randn.()
183183

184184
Random.seed!(100)
185185
prob = SDEProblem(f, g, em[:], (0.0, 1000.0))
186186
@time sol2 = solve(prob, SRIW1(), progress=false, abstol=1e-2, reltol=1e-2, save_everystep=false)
187-
@test_broken sol1.t == sol2.t
187+
sol1.t == sol2.t
188188

189189
function test_loop(a)
190190
for i in eachindex(a)

0 commit comments

Comments
 (0)