@@ -62,10 +62,9 @@ function DiffEqBase.__solve(
62
62
63
63
eval_string (" options = odeset('RelTol',reltol,'AbsTol',abstol);" )
64
64
algstr = string (typeof (alg). name. name)
65
- @show algstr
66
65
eval_string (" mxsol = $(algstr) (diffeqf,tspan,u0,options);" )
67
66
eval_string (" mxsolstats = struct(mxsol.stats);" )
68
- solstats= get_variable (:mxsolstats )
67
+ solstats = get_variable (:mxsolstats )
69
68
eval_string (" t = mxsol.x;" )
70
69
ts = jvector (get_mvariable (:t ))
71
70
eval_string (" u = mxsol.y';" )
@@ -81,13 +80,21 @@ function DiffEqBase.__solve(
81
80
timeseries = timeseries_tmp
82
81
end
83
82
84
- destats = DiffEqBase. DEStats (0 )
85
-
86
- # destats.naccept = solstats["nsteps"]
87
- # #destats.nsolve = solstats[""]
83
+ destats = buildDEStats (solstats)
88
84
89
85
DiffEqBase. build_solution (prob,alg,ts,timeseries,
90
- timeseries_errors = timeseries_errors,destats= solstats)
86
+ timeseries_errors = timeseries_errors,destats = destats)
87
+ end
88
+
89
+ function buildDEStats (solverstats:: Dict )
90
+
91
+ destats = DiffEqBase. DEStats (0 )
92
+ destats. nf = if (haskey (solverstats, " nfevals" )) solverstats[" nfevals" ] else 0 end
93
+ destats. nreject = if (haskey (solverstats, " nfailed" )) solverstats[" nfailed" ] else 0 end
94
+ destats. naccept = if (haskey (solverstats, " nsteps" )) solverstats[" nsteps" ] else 0 end
95
+ destats. nsolve = if (haskey (solverstats, " nsolves" )) solverstats[" nsolves" ] else 0 end
96
+ destats. njacs = if (haskey (solverstats, " npds" )) solverstats[" npds" ] else 0 end
97
+ destats
91
98
end
92
99
93
100
end # module
0 commit comments