|
1 | 1 | module MechGlueDiffEqBase |
2 | | -import MechanicalUnits.Unitfu.AbstractQuantity |
| 2 | +import Unitfu: AbstractQuantity, Quantity |
3 | 3 | import DiffEqBase: value, ODE_DEFAULT_NORM, UNITLESS_ABS2 |
| 4 | +import SciMLBase |
| 5 | +import SciMLBase: AbstractTimeseriesSolution, RecipesBase |
| 6 | +import SciMLBase: AbstractDiscreteProblem, AbstractRODESolution, SensitivityInterpolation |
| 7 | +import RecipesBase.@recipe |
4 | 8 | export value, ODE_DEFAULT_NORM, UNITLESS_ABS2, Unitfu |
5 | 9 |
|
6 | 10 | function value(x::Type{AbstractQuantity{T,D,U}}) where {T,D,U} |
|
23 | 27 | end |
24 | 28 |
|
25 | 29 |
|
| 30 | +@recipe function f(sol::AbstractTimeseriesSolution{T, N, A}; |
| 31 | + plot_analytic=false, |
| 32 | + denseplot = (sol.dense || |
| 33 | + typeof(sol.prob) <: AbstractDiscreteProblem) && |
| 34 | + !(typeof(sol) <: AbstractRODESolution) && |
| 35 | + !(hasfield(typeof(sol),:interp) && |
| 36 | + typeof(sol.interp) <: SensitivityInterpolation), |
| 37 | + plotdensity = min(Int(1e5),sol.tslocation==0 ? |
| 38 | + (typeof(sol.prob) <: AbstractDiscreteProblem ? |
| 39 | + max(1000,100*length(sol)) : |
| 40 | + max(1000,10*length(sol))) : |
| 41 | + 1000*sol.tslocation), |
| 42 | + tspan = nothing, axis_safety = 0.1, |
| 43 | + vars=nothing) where {T<:Quantity, N, A<:Array{<:Quantity}} |
| 44 | + |
| 45 | + print("----------------------------------MechGlueDiffEqBase") |
| 46 | + return Unifu.ustrip(sol.u), Unifu.ustrip(sol.t) |
| 47 | +end |
| 48 | + # T = Quantity{Float64, ᴸ∙ ᴹ∙ ᵀ⁻², Unitfu.FreeUnits{(N,), ᴸ∙ ᴹ∙ ᵀ⁻², nothing}} |
| 49 | + # N = 1 |
| 50 | + # A = Vector{Quantity{Float64, ᴸ∙ ᴹ∙ ᵀ⁻², Unitfu.FreeUnits{(N,), ᴸ∙ ᴹ∙ ᵀ⁻², nothing}}} |
| 51 | + |
| 52 | + |
26 | 53 | end |
0 commit comments