Skip to content

Commit d81be96

Browse files
authored
Rename files, struct and functions (#156)
* rename files, struct and functions * bump version
1 parent 8c6953d commit d81be96

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "Sleipnir"
22
uuid = "f5e6c550-199f-11ee-3608-394420200519"
3-
version = "0.12.4"
3+
version = "0.12.5"
44
authors = ["Jordi Bolibar <jordi.bolibar@gmail.com>", "Facundo Sapienza <fsapienza@berkeley.edu>", "Alban Gossard <alban.paul.gossard@gmail.com>", "Mathieu Le Séac'h"]
55

66
[deps]

src/models/Model.jl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ abstract type AbstractModel end
1111
const AbstractEmptyModel = Union{AbstractModel, Nothing}
1212

1313
"""
14-
Model{IFM <: AbstractEmptyModel, MBM <: AbstractEmptyModel, MLM <: AbstractEmptyModel}
14+
Model{IFM <: AbstractEmptyModel, MBM <: AbstractEmptyModel, TC <: AbstractEmptyModel}
1515
1616
A mutable struct that represents a model with three components: iceflow, mass balance, and machine learning.
1717
1818
Model(
1919
iceflow::IFM,
2020
mass_balance::MBM,
21-
machine_learning::MLM,
22-
) where {IFM <: AbstractEmptyModel, MBM <: AbstractEmptyModel, MLM <: AbstractEmptyModel}
21+
trainable_components::TC,
22+
) where {IFM <: AbstractEmptyModel, MBM <: AbstractEmptyModel, TC <: AbstractEmptyModel}
2323
2424
Model(;iceflow, mass_balance) = Model(iceflow, mass_balance, nothing)
2525
@@ -29,28 +29,28 @@ Initialize Model (no machine learning model).
2929
3030
- `iceflow::IFM}`: Represents the iceflow component, which is an instance of `IFM`.
3131
- `mass_balance::Union{MBM, Vector{MBM}}`: Represents the mass balance component, which is an instance of `MBM`.
32-
- `machine_learning::MLM`: Represents the machine learning component, which is an instance of `MLM`.
32+
- `trainable_components::TC`: Represents the trainable components, which is an instance of `TC`.
3333
3434
# Type Parameters
3535
3636
- `IFM`: A subtype of `AbstractEmptyModel` representing the type of the iceflow model.
3737
- `MBM`: A subtype of `AbstractEmptyModel` representing the type of the mass balance model.
38-
- `MLM`: A subtype of `AbstractEmptyModel` representing the type of the machine learning model.
38+
- `TC`: A subtype of `AbstractEmptyModel` representing the type of the trainable components.
3939
"""
4040
mutable struct Model{
41-
IFM <: AbstractEmptyModel, MBM <: AbstractEmptyModel, MLM <: AbstractEmptyModel}
41+
IFM <: AbstractEmptyModel, MBM <: AbstractEmptyModel, TC <: AbstractEmptyModel}
4242
iceflow::IFM
4343
mass_balance::MBM
44-
machine_learning::MLM
44+
trainable_components::TC
4545

4646
function Model(
4747
iceflow::IFM,
4848
mass_balance::MBM,
49-
machine_learning::MLM
49+
trainable_components::TC
5050
) where {
51-
IFM <: AbstractEmptyModel, MBM <: AbstractEmptyModel, MLM <: AbstractEmptyModel}
52-
new{typeof(iceflow), typeof(mass_balance), typeof(machine_learning)}(
53-
iceflow, mass_balance, machine_learning)
51+
IFM <: AbstractEmptyModel, MBM <: AbstractEmptyModel, TC <: AbstractEmptyModel}
52+
new{typeof(iceflow), typeof(mass_balance), typeof(trainable_components)}(
53+
iceflow, mass_balance, trainable_components)
5454
end
5555
end
5656
Model(; iceflow, mass_balance) = Model(iceflow, mass_balance, nothing)
@@ -99,11 +99,11 @@ function Base.show(io::IO, type::MIME"text/plain", model::Model)
9999
println(io)
100100
Base.show(io, type, model.mass_balance)
101101
println(io)
102-
if isnothing(model.machine_learning)
102+
if isnothing(model.trainable_components)
103103
println(io, "No learnable components")
104104
else
105105
println(io, "Learnable components")
106-
Base.show(io, type, model.machine_learning)
106+
Base.show(io, type, model.trainable_components)
107107
println(io)
108108
end
109109
print(io, "***************")

src/simulations/results/results_utils.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ function create_results(
7171

7272
glacier = simulation.glaciers[glacier_idx]
7373
iceflow_cache = simulation.cache.iceflow
74-
if !isnothing(simulation.model.machine_learning)
75-
θ = simulation.model.machine_learning.θ
74+
if !isnothing(simulation.model.trainable_components)
75+
θ = simulation.model.trainable_components.θ
7676
else
7777
θ = nothing
7878
end

0 commit comments

Comments
 (0)