Skip to content

Commit 99b3226

Browse files
authored
Add constructor without type (#233)
* Add constructor without type * Fix docstring * Fix precompile
1 parent d125463 commit 99b3226

5 files changed

Lines changed: 39 additions & 13 deletions

File tree

NEWS.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
## VortexStepMethod v3.3.0 2026-05-05
2+
3+
### Added
4+
- `ForwardDiff` compatibility, used by default in `linearize` (#232)
5+
- `backend` keyword argument for `linearize`
6+
- example `linearize_check.jl` comparing FiniteDiff and ForwardDiff tangents
7+
8+
### Changed
9+
- core structs are parameterized on the scalar type `T` so dual numbers can
10+
propagate through them; public constructors are unchanged
11+
112
## VortexStepMethod v3.2.0 2026-05-02
213

314
### Added

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "VortexStepMethod"
22
uuid = "ed3cd733-9f0f-46a9-93e0-89b8d4998dd9"
33
authors = ["1-Bart-1 <bart@vandelint.net>", "Oriol Cayon and contributors"]
4-
version = "3.2.0"
4+
version = "3.3.0"
55

66
[workspace]
77
projects = ["examples", "examples_cp", "docs", "test"]

docs/src/types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ A body is constructed of one or more abstract wings. All wings are of type Wing.
3636
A Wing has one or more sections and can be created from YAML files or OBJ geometry.
3737
```@docs
3838
Section
39-
Section(LE_point::PosVector, TE_point::PosVector, aero_model)
39+
Section(LE_point, TE_point, aero_model)
4040
Wing
4141
Wing(n_panels::Int; spanwise_distribution::PanelDistribution=LINEAR,
4242
spanwise_direction::PosVector=MVec3([0.0, 1.0, 0.0]))

src/wing_geometry.jl

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,29 @@
11
"""
2-
@with_kw mutable struct Section
2+
mutable struct Section{T}
33
44
Represents a wing section with leading edge, trailing edge, and aerodynamic properties.
55
66
# Fields
7-
- `LE_point::MVec3` = zeros(MVec3): Leading edge point coordinates
8-
- `TE_point::MVec3` = zeros(MVec3): Trailing edge point coordinates
9-
- `aero_model`::AeroModel = INVISCID: [AeroModel](@ref)
10-
- `aero_data`::AeroData = nothing: See: [AeroData](@ref)
7+
- `LE_point::MVector{3, T}`: Leading edge point coordinates
8+
- `TE_point::MVector{3, T}`: Trailing edge point coordinates
9+
- `aero_model::AeroModel`: [AeroModel](@ref)
10+
- `aero_data::AeroData`: See: [AeroData](@ref)
1111
"""
12-
@with_kw mutable struct Section{T}
13-
LE_point::MVector{3, T} = zeros(MVector{3, T})
14-
TE_point::MVector{3, T} = zeros(MVector{3, T})
15-
aero_model::AeroModel = INVISCID
16-
aero_data::AeroData = nothing
12+
mutable struct Section{T}
13+
LE_point::MVector{3, T}
14+
TE_point::MVector{3, T}
15+
aero_model::AeroModel
16+
aero_data::AeroData
1717
end
1818

19+
Section{T}(; LE_point=zeros(MVector{3, T}), TE_point=zeros(MVector{3, T}),
20+
aero_model=INVISCID, aero_data=nothing) where {T} =
21+
Section{T}(LE_point, TE_point, aero_model, aero_data)
22+
23+
Section() = Section{Float64}()
24+
1925
"""
20-
Section(LE_point::PosVector, TE_point::PosVector, aero_model)
26+
Section(LE_point, TE_point, aero_model)
2127
2228
Create a new wing section with the specified leading edge point, trailing edge point,
2329
and aerodynamic model.

test/wing_geometry/test_wing_geometry.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ function ==(a::Section, b::Section)
2020
end
2121

2222
@testset "Wing Geometry Tests" begin
23+
@testset "Section default constructor" begin
24+
s = Section()
25+
@test s isa Section{Float64}
26+
@test s.LE_point == zeros(3)
27+
@test s.TE_point == zeros(3)
28+
@test s.aero_model === INVISCID
29+
@test isnothing(s.aero_data)
30+
end
31+
2332
@testset "Wing initialization" begin
2433
example_wing = Wing(10; spanwise_distribution=LINEAR)
2534
@test example_wing.n_panels == 10

0 commit comments

Comments
 (0)