Skip to content

Commit 5e73c34

Browse files
committed
Add solver stats and linked with Destats
1 parent 28bdf41 commit 5e73c34

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/MATLABDiffEq.jl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,13 @@ function DiffEqBase.__solve(
6262

6363
eval_string("options = odeset('RelTol',reltol,'AbsTol',abstol);")
6464
algstr = string(typeof(alg).name.name)
65-
#algstr = replace(string(typeof(alg)),"MATLABDiffEq.","")
66-
eval_string("[t,u] = $(algstr)(diffeqf,tspan,u0,options);")
65+
@show algstr
66+
eval_string("mxsol = $(algstr)(diffeqf,tspan,u0,options);")
67+
eval_string("mxsolstats = struct(mxsol.stats);")
68+
solstats= get_variable(:mxsolstats)
69+
eval_string("t = mxsol.x;")
6770
ts = jvector(get_mvariable(:t))
71+
eval_string("u = mxsol.y';")
6872
timeseries_tmp = jarray(get_mvariable(:u))
6973

7074
# Reshape the result if needed
@@ -78,7 +82,7 @@ function DiffEqBase.__solve(
7882
end
7983

8084
DiffEqBase.build_solution(prob,alg,ts,timeseries,
81-
timeseries_errors = timeseries_errors)
85+
timeseries_errors = timeseries_errors,destats=solstats)
8286
end
8387

8488
end # module

0 commit comments

Comments
 (0)