|
16 | 16 | end |
17 | 17 |
|
18 | 18 | @Base.kwdef mutable struct VSMSettings |
19 | | - wings::Vector{WingSettings} = [WingSettings(), WingSettings()] |
| 19 | + wings::Vector{WingSettings} = [WingSettings()] |
20 | 20 | solver_settings::SolverSettings = SolverSettings() |
21 | 21 | end |
22 | 22 |
|
23 | 23 | const VSM_SETTINGS = VSMSettings() |
24 | 24 |
|
25 | 25 | function vs(filename=filename) |
| 26 | + VSM_SETTINGS = VSMSettings() |
26 | 27 | res = VSM_SETTINGS |
27 | 28 | data = YAML.load_file(joinpath("data", filename)) |
28 | 29 | res.solver_settings.max_iterations = data["solver_settings"]["max_iterations"] |
29 | 30 | res.solver_settings.aerodynamic_model_type = eval(Symbol(data["solver_settings"]["aerodynamic_model_type"])) |
30 | 31 | for (i, wing) in pairs(data["wings"]) |
31 | | - println(i) |
| 32 | + if i > length(res.wings) |
| 33 | + push!(res.wings, WingSettings()) |
| 34 | + end |
| 35 | + res.wings[i].name = wing["name"] |
32 | 36 | res.wings[i].n_panels = wing["n_panels"] |
33 | 37 | res.wings[i].n_groups = wing["n_groups"] |
34 | 38 | res.wings[i].spanwise_panel_distribution = eval(Symbol(wing["spanwise_panel_distribution"])) |
|
40 | 44 |
|
41 | 45 | function Base.show(io::IO, vs::VSMSettings) |
42 | 46 | println(io, "VSMSettings:") |
43 | | - for wing in vs.wings |
44 | | - print(io, " ", replace(repr(wing), "\n" => "\n ")) |
| 47 | + for (i, wing) in pairs(vs.wings) |
| 48 | + if i==1 |
| 49 | + print(io, " ") |
| 50 | + end |
| 51 | + print(io, replace(repr(wing), "\n" => "\n ")) |
45 | 52 | end |
46 | 53 | print(io, replace(repr(vs.solver_settings), "\n" => "\n ")) |
47 | 54 | end |
0 commit comments