pterasoftware.save()¶
- pterasoftware.save( ) None¶
Saves a Ptera Software object to a .psz file.
A .psz file is a zip archive of compressed JSON members. The first member is a header holding the serialization format version, provenance metadata, the saved object's class name, and a manifest of the members that follow. The last member holds the object itself. For an unsteady solver or an unsteady problem, the per time step data (each step's SteadyProblem and the solver's per step bound and wake vortex arrays) is split out of the last member into one member per time step, so that saving never holds more than one time step's worth of serialized data in memory at once on top of the object itself.
Shared references are preserved. An object referenced from many places (e.g., an Airfoil shared by every per step WingCrossSection) is written once, every other reference is written as a pointer to it, and load() restores the sharing.
Custom callables (custom spacing functions, an AeroelasticWingMovement's second- derivative functions, and a FreeFlightUnsteadyProblem's external_loads_fn) cannot be written to JSON as code. Each is stored as an inert marker holding its qualified name, its source text when that can be retrieved, and a hash of that text. The built in "sine" and "uniform" spacings are stored by name and restored exactly. See load() for how the markers are restored.
The archive records an internal serialization format version. load() accepts a file only when that format version matches the running code's exactly, and there is no migration of files written under a different format version. The format version is independent of the package version and bumps whenever the serialized structure changes. To read a saved file later, run a build of Ptera Software whose format version matches the file's.
- Parameters:
path -- The file path to save to. Should end with ".psz".
obj -- The Ptera Software object to save. Must be a public Ptera Software class (e.g., Airplane, SteadyProblem, or a solver). Internal classes such as Panel cannot be saved directly.
- Returns:
None