Skip to content

Commit

Permalink
Add Parameters for Algorithm.
Browse files Browse the repository at this point in the history
  • Loading branch information
waltergu committed Apr 20, 2022
1 parent e4dbd15 commit 873b5be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Essentials/Frameworks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,7 @@ mutable struct Assignment{A<:Action, P<:Parameters, M<:Function, D<:Tuple{Vararg
end
@inline Base.:(==)(assign₁::Assignment, assign₂::Assignment) = ==(efficientoperations, assign₁, assign₂)
@inline Base.isequal(assign₁::Assignment, assign₂::Assignment) = isequal(efficientoperations, assign₁, assign₂)
@inline Parameters(assignment::Assignment) = assignment.parameters

"""
valtype(assign::Assignment)
Expand Down Expand Up @@ -710,6 +711,7 @@ function Base.show(io::IO, alg::Algorithm)
@printf io "_%s" decimaltostr(value, 10)
end
end
@inline Parameters(algorithm::Algorithm) = algorithm.parameters

"""
Algorithm(name::Symbol, engine::Engine; din::String=".", dout::String=".", parameters::Parameters=Parameters(engine), map::Function=identity)
Expand Down
2 changes: 2 additions & 0 deletions test/Essentials/Frameworks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ end
vca = Algorithm(:test, vca)
@test vca == deepcopy(vca)
@test isequal(vca, deepcopy(vca))
@test Parameters(vca) == vca.parameters
@test repr(vca, (:U)) == "test(VCA)_1.0"
@test repr(vca) == "test(VCA)_1.0_8.0"

Expand All @@ -229,6 +230,7 @@ end
dos = vca.assignments[:DOS]
@test dos == deepcopy(dos)
@test isequal(dos, deepcopy(dos))
@test Parameters(dos) == dos.parameters
@test valtype(dos) == valtype(typeof(dos)) == Float
@test dos.data == 32.0
@test dos.action.mu == -3.5
Expand Down

0 comments on commit 873b5be

Please sign in to comment.