File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change 11# fix allocations of this array comprehension:
22# y = [panel.control_point[2] for panel in body_aero.panels]
33
4- using VortexStepMethod
4+ using VortexStepMethod, PreallocationTools
55
66# Step 1: Define wing parameters
77n_panels = 20 # Number of panels
@@ -31,12 +31,17 @@ body_aero::BodyAerodynamics = BodyAerodynamics([wing])
3131y = [panel. control_point[2 ] for panel in body_aero. panels]
3232n = @allocated y = [panel. control_point[2 ] for panel in body_aero. panels]
3333
34- function test (body_aero)
35- # for panel in body_aero.panels end
36- y = [panel. control_point[2 ] for panel in body_aero. panels]
37- nothing
34+ function test (body_aero, gamma_i)
35+ y = body_aero. y
36+ for (i, panel) in pairs (body_aero. panels)
37+ y[i] = panel. control_point[2 ]
38+ end
39+ # y = [panel.control_point[2] for panel in body_aero.panels]
40+ y
3841end
3942
40- test (body_aero)
41- @allocated test (body_aero)
43+ gamma_i= zeros (length (body_aero. panels))
44+
45+ test (body_aero, gamma_i)
46+ @allocated test (body_aero, gamma_i)
4247
You can’t perform that action at this time.
0 commit comments