Skip to content

Commit

Permalink
Make implicit conversion explicit (#55)
Browse files Browse the repository at this point in the history
* Make implicit conversion explicit

* Add ComponentArrays

* mutable parameters

---------

Co-authored-by: Jordi Bolibar <[email protected]>
  • Loading branch information
ChrisRackauckas and JordiBolibar authored Dec 2, 2024
1 parent b0fcef5 commit 15f3942
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ version = "0.7.0"

[deps]
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66"
CondaPkg = "992eb4ea-22a4-4c89-a5bb-47a3300528ab"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
Expand Down
1 change: 1 addition & 0 deletions src/Sleipnir.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ using Statistics
using CairoMakie
using Downloads
using HDF5
using ComponentArrays

include("setup/ssl.jl")
using PythonCall, CondaPkg
Expand Down
2 changes: 1 addition & 1 deletion src/glaciers/climate/climate2D_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ end

function partial_year(period::Type{<:Period}, float)
_year, Δ = divrem(float, 1)
year_start = Date(_year)
year_start = Date(convert(Int,_year))
year = period((year_start + Year(1)) - year_start)
partial = period(round(Dates.value(year) * Δ))
year_start + partial
Expand Down
2 changes: 1 addition & 1 deletion src/parameters/Parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ abstract type AbstractParameters end

const AbstractEmptyParams = Union{AbstractParameters,Nothing}

struct Parameters{PPHY <: AbstractEmptyParams, PSIM <: AbstractEmptyParams, PHY <: AbstractEmptyParams,
mutable struct Parameters{PPHY <: AbstractEmptyParams, PSIM <: AbstractEmptyParams, PHY <: AbstractEmptyParams,
PSOL <: AbstractEmptyParams, PUDE <: AbstractEmptyParams, POGGM <: AbstractEmptyParams, PINV <: AbstractEmptyParams}
physical::PPHY
simulation::PSIM
Expand Down
4 changes: 2 additions & 2 deletions src/simulations/results/Results.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ mutable struct Results{F <: AbstractFloat}
Δy::F
lon::Union{Nothing, F}
lat::Union{Nothing, F}
θ::Union{Nothing, Vector{F}}
θ::Union{Nothing, ComponentArray{F}}
loss::Union{Nothing, Vector{F}}
end

Expand All @@ -36,7 +36,7 @@ function Results(glacier::G, ifm::IF;
Δy::F = glacier.Δy,
lon::Union{Nothing, F} = glacier.cenlon,
lat::Union{Nothing, F} = glacier.cenlat,
θ::Union{Nothing,Vector{F}} = nothing,
θ::Union{Nothing,ComponentArray{F}} = nothing,
loss::Union{Nothing,Vector{F}} = nothing
) where {G <: AbstractGlacier, F <: AbstractFloat, IF <: AbstractModel}

Expand Down

0 comments on commit 15f3942

Please sign in to comment.