Skip to content

Commit 661fc83

Browse files
committed
Less allocs
1 parent 538f1b8 commit 661fc83

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/solver.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -624,22 +624,22 @@ Linearize the ram air wing aero model around an operating point using automatic
624624
- `J`: Jacobian matrix (∂forces/∂inputs)
625625
- `forces_op`: Forces at the operating point [Fx, Fy, Fz, Mx, My, Mz]
626626
"""
627-
function linearize(solver::Solver, body_aero::BodyAerodynamics, wing::RamAirWing, y;
627+
function linearize(solver::Solver, body_aero::BodyAerodynamics, wing::RamAirWing, y::Vector{T};
628628
theta_idxs=1:4,
629629
delta_idxs=nothing,
630630
va_idxs=nothing,
631631
omega_idxs=nothing,
632-
kwargs...)
632+
kwargs...) where T
633633

634-
init_va = solver.cache_lin[1][body_aero.va]
634+
init_va = body_aero.cache[1][body_aero.va]
635635
init_va .= body_aero.va
636636
if !isnothing(theta_idxs)
637-
last_theta = solver.cache_lin[2][y[theta_idxs]]
638-
last_theta .= y[theta_idxs]
637+
@views last_theta::Vector{T} = body_aero.cache[2][y[theta_idxs]]
638+
@views last_theta .= y[theta_idxs]
639639
end
640640
if !isnothing(delta_idxs)
641-
last_delta = solver.cache_lin[3][y[delta_idxs]]
642-
last_delta .= y[delta_idxs]
641+
@views last_delta::Vector{T} = body_aero.cache[3][y[delta_idxs]]
642+
@views last_delta .= y[delta_idxs]
643643
end
644644

645645
# Function to compute forces for given control inputs

0 commit comments

Comments
 (0)