Checkpoint state capture¶
OpenPFC exposes a serialization-agnostic capture/restore seam under
include/openpfc/kernel/checkpoint/ so a future checkpoint manager can
orchestrate save/restore without inventing per-app dumps.
Headers¶
Header |
Role |
|---|---|
|
|
|
Namespace: pfc::checkpoint.
Field payloads¶
A FieldPayload carries:
stable
field_idFieldDtype(Float64,Complex128)owned-cell
extents(nx, ny, nz)CoordinateOrder::XFastest(OpenPFC row-major, x fastest)format
version(kFieldPayloadFormatVersion)optional
DecompositionMeta(rank count/rank, global/local extents, local offset)contiguous
bytesof owned cell values only
Component payloads¶
A ComponentPayload holds irreducible integrator/controller cross-step state
(component_id, version, bytes). Explicit Euler / Heun typically use
empty_component_payload("euler") (empty bytes). Do not store driver-owned
pfc::sim::Time / step counters / config identity in component payloads.
Validate-before-mutate restore¶
restore_field / restore_component check all of the following before any
destination write:
format version
field / component id
dtype (fields)
extents / shape (fields)
coordinate order (fields; must be
XFastest)optional decomposition equality when the caller supplies expected metadata
exact
payload.bytes.size() == expected_nbytes(BytesSizeMismatchotherwise — truncated or oversized bytes with matching metadata still reject)destination capacity (
BufferTooSmallif too small)
On any failure the destination buffer is left unchanged. Multi-field adapters
(Wave2D restore_uv) validate every field fully before mutating any buffer.
App adapters¶
App |
Header |
API |
|---|---|---|
Heat3D (scalar) |
|
|
Wave2D (coupled) |
|
|
Physics model headers (heat_model.hpp, wave_model.hpp) stay free of OpenPFC
includes; adapters live beside them.
Exclusions¶
The following are not part of captured payloads:
Stage / scratch buffers (
Workspacestages, RHS temporaries)FFT plans and spectral operator caches
Halo / ghost rings (recomputable via exchange)
Driver-owned
Time, increments, and run-config identity
This API does not define a checkpoint file format, atomic publish, or manager orchestration — those belong to sibling checkpoint-manager leaves.
Tests¶
Kernel:
tests/unit/kernel/checkpoint/test_state_capture.cpp([checkpoint][state_capture])Heat3D:
apps/heat3d/tests/test_heat3d.cpp([heat3d][state_capture])Wave2D:
apps/wave2d/tests/test_wave2d.cpp([wave2d][state_capture])
See also¶
Class tour —
FieldPayload/ComponentPayloadrows