@@ -286,23 +286,7 @@ Save the system to a BSON file.
286286 - `nothing`: The function does not return anything, it saves the system to a file
287287"""
288288function save_system_to_bson (system:: System , filename:: AbstractString )
289- fields = (
290- :TF , :AIC , :w , :Γ , :V , :grids , :ratios , :surfaces , :invert_normals ,
291- :sections , :properties , :wakes , :trefftz , :reference ,
292- :freestream , :symmetric , :nwake , :surface_id , :wake_finite_core ,
293- :trailing_vortices , :xhat , :near_field_analysis , :derivatives , :dw , :dΓ ,
294- :dproperties , :wake_shedding_locations , :previous_surfaces , :Vcp , :Vh ,
295- :Vv , :Vte , :dΓdt
296- )
297- data = Dict {Symbol,Any} ()
298- for f in fields
299- if f === :TF
300- data[:TF ] = eltype (system)
301- else
302- data[f] = getfield (system, f)
303- end
304- end
305- BSON. bson (filename, data)
289+ JLD2. save_object (filename, system)
306290 return nothing
307291end
308292
@@ -316,42 +300,6 @@ Load a system from a BSON file.
316300 - `system`: The system loaded from the file
317301"""
318302function load_system_from_bson (filename:: AbstractString )
319- data = BSON. load (filename)
320- TF = data[:TF ]
321-
322- system = System {TF} (
323- convert (Matrix{TF}, data[:AIC ]),
324- convert (Vector{TF}, data[:w ]),
325- convert (Vector{TF}, data[:Γ ]),
326- [convert (Matrix{SVector{3 ,TF}}, v) for v in data[:V ]],
327- [convert (Array{TF,3 }, g) for g in data[:grids ]],
328- [convert (Array{TF,3 }, r) for r in data[:ratios ]],
329- [convert (Matrix{SurfacePanel{TF}}, s) for s in data[:surfaces ]],
330- convert (Vector{Bool}, data[:invert_normals ]),
331- [convert (Vector{SectionProperties{TF}}, sec) for sec in data[:sections ]],
332- [convert (Matrix{PanelProperties{TF}}, p) for p in data[:properties ]],
333- [convert (Matrix{WakePanel{TF}}, w) for w in data[:wakes ]],
334- [convert (Vector{TrefftzPanel{TF}}, t) for t in data[:trefftz ]],
335- convert (Array{Reference{TF},0 }, data[:reference ]),
336- convert (Array{Freestream{TF},0 }, data[:freestream ]),
337- convert (Vector{Bool}, data[:symmetric ]),
338- convert (Vector{Int}, data[:nwake ]),
339- convert (Vector{Int}, data[:surface_id ]),
340- convert (Vector{Bool}, data[:wake_finite_core ]),
341- convert (Vector{Bool}, data[:trailing_vortices ]),
342- convert (Array{SVector{3 ,TF},0 }, data[:xhat ]),
343- convert (Array{Bool,0 }, data[:near_field_analysis ]),
344- convert (Array{Bool,0 }, data[:derivatives ]),
345- Tuple (convert (Vector{TF}, d) for d in data[:dw ]),
346- Tuple (convert (Vector{TF}, d) for d in data[:dΓ ]),
347- Tuple ([convert (Matrix{PanelProperties{TF}}, dp) for dp in d] for d in data[:dproperties ]),
348- [convert (Vector{SVector{3 ,TF}}, wsl) for wsl in data[:wake_shedding_locations ]],
349- [convert (Matrix{SurfacePanel{TF}}, ps) for ps in data[:previous_surfaces ]],
350- [convert (Matrix{SVector{3 ,TF}}, vcp) for vcp in data[:Vcp ]],
351- [convert (Matrix{SVector{3 ,TF}}, vh) for vh in data[:Vh ]],
352- [convert (Matrix{SVector{3 ,TF}}, vv) for vv in data[:Vv ]],
353- [convert (Vector{SVector{3 ,TF}}, vte) for vte in data[:Vte ]],
354- convert (Vector{TF}, data[:dΓdt ])
355- )
303+ system = JLD2. load_object (filename)
356304 return system
357305end
0 commit comments