1
1
using ModelingToolkit, OrdinaryDiffEq, Test
2
+ using SymbolicIndexingInterface
2
3
using ModelingToolkit: t_nounits as t, D_nounits as D
3
4
@variables x (t), y (t)
4
5
@@ -16,10 +17,12 @@ prob3 = ODEProblem(sys3, [3.0, 3.0], (0.0, 1.0))
16
17
# test that when passing a vector of problems, trajectories and the prob_func are chosen appropriately
17
18
ensemble_prob = EnsembleProblem ([prob1, prob2, prob3])
18
19
sol = solve (ensemble_prob, Tsit5 (), EnsembleThreads ())
20
+ xidx = variable_index (sys1, x)
21
+ yidx = variable_index (sys1, y)
19
22
for i in 1 : 3
20
- @test sol[1 , :, i] == sol. u[i][x]
21
- @test sol[2 , :, i] == sol. u[i][y]
23
+ @test sol[xidx , :, i] == sol. u[i][x]
24
+ @test sol[yidx , :, i] == sol. u[i][y]
22
25
end
23
26
# Ensemble is a recursive array
24
- @test only .(sol (0.0 , idxs = [x])) == sol[1 , 1 , :]
25
- @test only .(sol (1.0 , idxs = [x])) ≈ [sol[i][1 , end ] for i in 1 : 3 ]
27
+ @test only .(sol (0.0 , idxs = [x])) == sol[xidx , 1 , :]
28
+ @test only .(sol (1.0 , idxs = [x])) ≈ [sol[i][xidx , end ] for i in 1 : 3 ]
0 commit comments