From 32c4c2c1becbd547cc1c1eb168b4393449c3b028 Mon Sep 17 00:00:00 2001 From: Nathanael Bosch Date: Sat, 4 Nov 2023 16:07:02 +0100 Subject: [PATCH] JuliaFormatter.jl --- src/initialization/autodiffinit.jl | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/initialization/autodiffinit.jl b/src/initialization/autodiffinit.jl index f405ef57a..f98bf849e 100644 --- a/src/initialization/autodiffinit.jl +++ b/src/initialization/autodiffinit.jl @@ -15,7 +15,7 @@ function initial_update!(integ, cache, init::AutodiffInitializationScheme) f_derivatives = get_derivatives(init, u, f, p, t) integ.stats.nf += init.order - @assert length(f_derivatives) == init.order+1 + @assert length(f_derivatives) == init.order + 1 # This is hacky and should definitely be removed. But it also works so 🤷 MM = if f.mass_matrix isa UniformScaling @@ -49,7 +49,13 @@ end """ Compute initial derivatives of an IIP ODEProblem with TaylorIntegration.jl """ -function get_derivatives(init::TaylorModeInit, u, f::SciMLBase.AbstractODEFunction{true}, p, t) +function get_derivatives( + init::TaylorModeInit, + u, + f::SciMLBase.AbstractODEFunction{true}, + p, + t, +) q = init.order tT = Taylor1(typeof(t), q) tT[0] = t @@ -64,7 +70,13 @@ function get_derivatives(init::TaylorModeInit, u, f::SciMLBase.AbstractODEFuncti return [evaluate.(differentiate.(uT, i)) for i in 0:q] end -function get_derivatives(init::ForwardDiffInit, u, f::SciMLBase.AbstractODEFunction{true}, p, t) +function get_derivatives( + init::ForwardDiffInit, + u, + f::SciMLBase.AbstractODEFunction{true}, + p, + t, +) q = init.order _f(u) = (du = copy(u); f(du, u, p, t); du) f_n = _f @@ -85,8 +97,14 @@ function forwarddiff_oop_vectorfield_derivative_iteration(f_n, f_0) return df end - -function forwarddiff_get_derivatives!(out, u, f::SciMLBase.AbstractODEFunction{true}, p, t, q) +function forwarddiff_get_derivatives!( + out, + u, + f::SciMLBase.AbstractODEFunction{true}, + p, + t, + q, +) _f(du, u) = f(du, u, p, t) d = length(u0) f_n = _f