@@ -407,6 +407,7 @@ mutable struct RamAirWing <: AbstractWing
407407 area_interp:: Extrapolation
408408 theta_dist:: Vector{Float64}
409409 delta_dist:: Vector{Float64}
410+ cache:: Vector{PreallocationTools.LazyBufferCache{typeof(identity), typeof(identity)}}
410411end
411412
412413"""
@@ -505,11 +506,12 @@ function RamAirWing(obj_path, dat_path; alpha=0.0, crease_frac=0.75, wind_vel=10
505506 end
506507
507508 panel_props = PanelProperties {n_panels} ()
509+ cache = [LazyBufferCache ()]
508510
509511 RamAirWing (n_panels, spanwise_distribution, panel_props, spanwise_direction, sections,
510512 refined_sections, remove_nan, non_deformed_sections,
511513 mass, gamma_tip, inertia_tensor, center_of_mass, radius,
512- le_interp, te_interp, area_interp, zeros (n_panels), zeros (n_panels))
514+ le_interp, te_interp, area_interp, zeros (n_panels), zeros (n_panels), cache )
513515
514516 catch e
515517 if e isa BoundsError
@@ -557,7 +559,7 @@ function smooth_deform!(wing::RamAirWing, theta_angles::AbstractVector, delta_an
557559
558560 window_size = wing. n_panels ÷ length (theta_angles)
559561 if n_panels > window_size
560- smoothed = copy ( theta_dist)
562+ smoothed = wing . cache[ 1 ][ theta_dist]
561563 for i in (window_size÷ 2 + 1 ): (n_panels - window_size÷ 2 )
562564 @views smoothed[i] = mean (theta_dist[(i - window_size÷ 2 ): (i + window_size÷ 2 )])
563565 end
0 commit comments