-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Checkpointer revival #326
Checkpointer revival #326
Changes from 1 commit
1212c82
d434e55
40fd4b0
b47fda8
f7476b4
171f582
14c221b
823d310
7793b1e
02cb710
ddbc1d6
8aeacbd
0f933c8
ebb0f34
6935cf6
c96175b
cbd4a8d
64db4c7
c2c01ee
3552f77
89518cf
cffc11d
bcfaff8
ea91e5f
517b32b
898216b
00b6eba
4e72d35
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -392,19 +392,29 @@ VerticalPlanes(model) = VerticalPlanes(model.arch, model.grid) | |
mutable struct Checkpointer <: OutputWriter | ||
dir :: String | ||
prefix :: String | ||
output_frequency :: Int | ||
frequency :: Int | ||
interval :: FT | ||
structs :: S | ||
fieldsets :: F | ||
end | ||
|
||
function Checkpointer(; output_frequency, dir=".", prefix="checkpoint", force=false) | ||
function Checkpointer(; output_frequency, dir=".", prefix="checkpoint", | ||
checkpointed_structs = (:arch, :boundary_conditions, :grid, :clock, :eos, :constants, :closure), | ||
checkpointed_fieldsets = (:velocities, :tracers, :G, :Gp), | ||
force=false) | ||
mkpath(dir) | ||
return Checkpointer(dir, prefix, output_frequency) | ||
end | ||
|
||
function savesubfields!(file, model, name, flds=propertynames(getproperty(model, name))) | ||
for f in flds | ||
file["$name/$f"] = Array(getproperty(getproperty(model, name), f).data.parent) | ||
if name ∉ (:forcing) | ||
for f in flds | ||
file["$name/$f"] = Array(getproperty(getproperty(model, name), f).data.parent) | ||
end | ||
else | ||
@warn "Cannot save subfields of $name" | ||
end | ||
return nothing | ||
return | ||
end | ||
|
||
checkpointed_structs = [:arch, :boundary_conditions, :grid, :clock, :eos, :constants, :closure] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These fields could be made properties of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ali-ramadhan was this resolved? |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit confused about how this function works:
Field
(as it looks to me), but provide a hook whenname=:forcing
?type
of the object being saved? Other fields (like boundary conditions, or future fields that we add to model) may be functions.I think it'd be better to use a function that dispatches on the type of the object being saved, eg
Using such a function may be more robust and general.