Skip to content

Commit 642869e

Browse files
committed
correctly puts Output() constructor as inner constructor
1 parent b22d444 commit 642869e

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/output.jl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ struct Output
88
prob::Problem
99
path::String
1010
fields::Dict{Symbol,Function}
11+
function Output(prob, path, fields::Dict{Symbol,Function})
12+
truepath = uniquepath(withoutjld2(path)*".jld2") # ensure path ends in ".jld2"
13+
new(prob, truepath, fields)
14+
end
1115
end
1216

1317
withoutjld2(path) = (length(path)>4 && path[end-4:end] == ".jld2") ? path[1:end-5] : path
@@ -29,12 +33,6 @@ function uniquepath(path)
2933
path
3034
end
3135

32-
function Output(prob, path, fields::Dict{Symbol,Function})
33-
truepath = uniquepath(withoutjld2(path)*".jld2") # ensure path ends in ".jld2"
34-
saveproblem(prob, truepath)
35-
Output(prob, filename, fields)
36-
end
37-
3836
Output(prob, path, fields...) = Output(prob, path, Dict{Symbol,Function}([fields...]))
3937
Output(prob, path, field::Tuple{Symbol,T}) where T = Output(prob, path, Dict{Symbol,Function}([field]))
4038

0 commit comments

Comments
 (0)