Skip to content

Commit

Permalink
Add convert method for IsotopeLinear
Browse files Browse the repository at this point in the history
This is needed for StructArrays v0.6.8 https://github.com/JuliaArrays/StructArrays.jl/releases/tag/v0.6.8
See
JuliaArrays/StructArrays.jl#131
JuliaArrays/StructArrays.jl#216

It's not clear to me whether the behaviour of StructArrays.jl is now correct (so this is a PALEOboxes.jl fix that
used to not matter) or whether this is a workaround for a newly introduced StructArrays.jl issue
  • Loading branch information
sjdaines committed May 27, 2022
1 parent abecdd1 commit cd512b6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/data/IsotopeData.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ Base.:*(a::IsotopeLinear, b::Real) = IsotopeLinear(a.v*b, a.v_molde
Base.:*(a::Real, b::IsotopeLinear) = IsotopeLinear(a*b.v, a*b.v_moldelta)
Base.:/(a::IsotopeLinear, b::Real) = IsotopeLinear(a.v/b, a.v_moldelta/b)

# convert methods for cases (eg from Float64 to an AD type) where scalar components v, v_moldelta can be converted
IsotopeLinear{T1, T2}(x::IsotopeLinear) where {T1, T2} = IsotopeLinear{T1, T2}(x.v, x.v_moldelta)
Base.convert(::Type{IsotopeLinear{T1, T2}}, x::IsotopeLinear) where {T1, T2} = IsotopeLinear{T1, T2}(x)

"""
IsotopeTypes::Tuple
Expand Down

0 comments on commit cd512b6

Please sign in to comment.