Skip to content

Commit 4c753d3

Browse files
Merge pull request #105 from bmad-sim/newmapparams
nonbreaking default
2 parents d3105b6 + a642b2f commit 4c753d3

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Beamlines"
22
uuid = "5bb90b03-0719-46b8-8ce4-1ef3afd3cd4b"
33
authors = ["Matt Signorelli <mgs255@cornell.edu> and contributors"]
4-
version = "0.8.3"
4+
version = "0.8.4"
55

66
[deps]
77
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"

src/misc.jl

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
@kwdef mutable struct MapParams{F<:Function, P<:Tuple} <: AbstractParams
1+
@kwdef mutable struct MapParams{F<:Function, P} <: AbstractParams
22
transport_map::F = (v, q, p=nothing) -> (v, q)
3-
transport_map_params::P = ()
3+
transport_map_params::P = nothing
44
end
55

66
function Base.isapprox(a::MapParams, b::MapParams)
7-
return a.transport_map == b.transport_map &&
8-
all(a.transport_map_params .≈ b.transport_map_params)
7+
if xor(isnothing(a.transport_map_params), isnothing(b.transport_map_params))
8+
return false
9+
elseif isnothing(a.transport_map_params) && isnothing(b.transport_map_params)
10+
return true
11+
else
12+
return a.transport_map == b.transport_map &&
13+
all(a.transport_map_params .≈ b.transport_map_params)
14+
end
915
end
1016

17+
1118
# === THIS BLOCK WAS PARTIALLY WRITTEN BY CLAUDE ===
1219
# Generated function for arbitrary-length tuples
1320
@generated function deval(mp::MapParams{F,P}) where {F,P}

0 commit comments

Comments
 (0)