Skip to content

Commit 8add4db

Browse files
Merge pull request #205 from SciML/sa
Require ArrayInterfaceStaticArrays to fix downstream
2 parents 0016985 + 73db9f4 commit 8add4db

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ version = "2.28.0"
66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
88
ArrayInterfaceCore = "30b0a656-2188-435a-8636-2ec0e6a096e2"
9+
ArrayInterfaceStaticArrays = "b0d46f97-bff5-4637-a19a-dd75974142cd"
910
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
1011
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
1112
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
@@ -19,6 +20,7 @@ ZygoteRules = "700de1a5-db45-46bc-99cf-38207098b444"
1920
[compat]
2021
Adapt = "3"
2122
ArrayInterfaceCore = "0.1.1"
23+
ArrayInterfaceStaticArrays = "0.1"
2224
ChainRulesCore = "0.10.7, 1"
2325
DocStringExtensions = "0.8"
2426
FillArrays = "0.11, 0.12, 0.13"

src/RecursiveArrayTools.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ import ChainRulesCore
1212
import ChainRulesCore: NoTangent
1313
import ZygoteRules, Adapt
1414

15+
# Required for the downstream_events.jl test
16+
# Since `ismutable` on an ArrayPartition needs
17+
# to know static arrays are not mutable
18+
import ArrayInterfaceStaticArrays
19+
1520
using FillArrays
1621

1722
abstract type AbstractVectorOfArray{T, N, A} <: AbstractArray{T, N} end

test/downstream/downstream_events.jl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using OrdinaryDiffEq, StaticArrays, RecursiveArrayTools
2+
u0 = ArrayPartition(SVector{1}(50.0), SVector{1}(0.0))
3+
tspan = (0.0,15.0)
4+
5+
function f(u,p,t)
6+
ArrayPartition(SVector{1}(u[2]), SVector{1}(-9.81))
7+
end
8+
9+
prob = ODEProblem(f,u0,tspan)
10+
11+
affect! = nothingf =
12+
affect_neg! = function (integrator)
13+
integrator.u = ArrayPartition(SVector{1}(integrator.u[1]), SVector{1}(-integrator.u[2]))
14+
end
15+
16+
callback = ContinuousCallback(condition,affect!,affect_neg!,interp_points=100)
17+
18+
sol = solve(prob,Tsit5(),callback=callback,adaptive=false,dt=1/4)

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ end
3333
if !is_APPVEYOR && GROUP == "Downstream"
3434
activate_downstream_env()
3535
@time @testset "DiffEqArray Indexing Tests" begin include("downstream/symbol_indexing.jl") end
36+
@time @testset "Event Tests with ArrayPartition" begin include("downstream/downstream_events.jl") end
3637
end
3738

3839
if !is_APPVEYOR && GROUP == "GPU"

0 commit comments

Comments
 (0)