Skip to content

Commit e2f0d08

Browse files
Merge pull request #151 from YingboMa/myb/array
Make oop ODEFunction Array compatible
2 parents 894614e + c33c244 commit e2f0d08

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/utils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function build_function(rhss, vs, ps, args = (), conv = rhs -> convert(Expr, rhs
5454
end
5555
function $fname(u,p,$(args...))
5656
X = $let_expr
57-
T = $(constructor === nothing ? :(StaticArrays.similar_type(typeof(u), eltype(X))) : constructor)
57+
T = $(constructor === nothing ? :(u isa StaticArrays.StaticArray ? StaticArrays.similar_type(typeof(u), eltype(X)) : x->(du=similar(u, eltype(X)); du .= x)) : constructor)
5858
T(X)
5959
end
6060
end

test/system_construction.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ de = ODESystem(eqs)
161161
du = [0.0,0.0]
162162
f(du, [1.0,2.0], [1,2,3], 0.0)
163163
du [-1, -1/3]
164+
du f([1.0,2.0], [1,2,3], 0.0)
164165
end
165166

166167
# Now nonlinear system with only variables

0 commit comments

Comments
 (0)