Skip to content

Commit 02771a3

Browse files
committed
Add constructor that uses Int64 for the number of panels
1 parent def0d92 commit 02771a3

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

src/wing_geometry.jl

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,71 @@ mutable struct Wing{P} <: AbstractWing
252252
cache::Vector{PreallocationTools.LazyBufferCache{typeof(identity), typeof(identity)}}
253253
end
254254

255+
# Compatibility constructor for full positional initialization with integer panel counts.
256+
# This keeps call sites that pass Int values working after n_panels/n_unrefined_sections
257+
# were tightened to Int16 fields.
258+
function Wing(
259+
n_panels::Integer,
260+
n_unrefined_sections::Integer,
261+
spanwise_distribution::PanelDistribution,
262+
panel_props::PanelProperties{P},
263+
spanwise_direction::MVec3,
264+
unrefined_sections::Vector{Section},
265+
refined_sections::Vector{Section},
266+
remove_nan::Bool,
267+
use_prior_polar::Bool,
268+
billowing_percentage::Float64,
269+
refined_panel_mapping::Vector{Int16},
270+
non_deformed_sections::Vector{Section},
271+
theta_dist::Vector{Float64},
272+
delta_dist::Vector{Float64},
273+
mass::Float64,
274+
gamma_tip::Float64,
275+
inertia_tensor::Matrix{Float64},
276+
T_cad_body::MVec3,
277+
R_cad_body::MMat3,
278+
radius::Float64,
279+
le_interp::Union{Nothing, NTuple{3, Interpolations.Extrapolation}},
280+
te_interp::Union{Nothing, NTuple{3, Interpolations.Extrapolation}},
281+
area_interp::Union{Nothing, Interpolations.Extrapolation},
282+
cache::Vector{PreallocationTools.LazyBufferCache{typeof(identity), typeof(identity)}}
283+
) where {P}
284+
285+
n_panels_i16 = Int16(n_panels)
286+
n_unrefined_sections_i16 = Int16(n_unrefined_sections)
287+
288+
Int(n_panels_i16) == P || throw(ArgumentError(
289+
"n_panels ($n_panels) must match PanelProperties{$P}"
290+
))
291+
292+
return Wing{P}(
293+
n_panels_i16,
294+
n_unrefined_sections_i16,
295+
spanwise_distribution,
296+
panel_props,
297+
spanwise_direction,
298+
unrefined_sections,
299+
refined_sections,
300+
remove_nan,
301+
use_prior_polar,
302+
billowing_percentage,
303+
refined_panel_mapping,
304+
non_deformed_sections,
305+
theta_dist,
306+
delta_dist,
307+
mass,
308+
gamma_tip,
309+
inertia_tensor,
310+
T_cad_body,
311+
R_cad_body,
312+
radius,
313+
le_interp,
314+
te_interp,
315+
area_interp,
316+
cache
317+
)
318+
end
319+
255320
"""
256321
Wing(n_panels::Int;
257322
n_unrefined_sections=nothing,

0 commit comments

Comments
 (0)