Skip to content

postprocessing: property_recorder — buffer graph properties, write CSV / time-series VTK (closes #18) - #48

Merged
petlenz merged 3 commits into
mainfrom
feature/property-recorder
Sep 7, 2026
Merged

postprocessing: property_recorder — buffer graph properties, write CSV / time-series VTK (closes #18)#48
petlenz merged 3 commits into
mainfrom
feature/property-recorder

Conversation

@petlenz

@petlenz petlenz commented Sep 6, 2026

Copy link
Copy Markdown
Member

Implements #18. A post-processing material that buffers named graph properties as the analysis runs and writes them out afterwards, so a run's history can be inspected without a live plotting dependency or a hand-rolled loop in every driver.

The branch predates the plasticity split and the UMAT layer; main is merged in here. The only collision was tests/CMakeLists.txt (both sides append a test registration) — none of the recorder code touched anything the split moved. 269/269 tests pass, verified locally against the merge result.

Shape

It follows the same wiring as the existing live-plot postprocessor — "material::property" sources, a dummy output so the engine calls update() each step, one add_input per source — but accumulates a record_buffer instead of pushing to a plot:

param.insert<std::string>("name", "recorder");
param.insert<std::vector<std::string>>("scalar_sources", {"solver::dgamma"});
param.insert<std::vector<std::string>>("tensor_sources", {"j2::stress"});
auto& rec = ctx.create<property_recorder<P>>(param);
ctx.finalize();
for (...) ctx.update();                    // one row buffered per step
rec.write(csv_writer{}, "history.csv");    // or vtk_timeseries_writer{}

Rank-2 tensors are flattened to Dim*Dim component columns <name>_ij. Full storage — symmetric-only reduction is deliberately left as a later option rather than guessed at.

Writing is separated from recording: record_buffer (io/record_buffer.h) holds the data, and any output_writer consumes it. CSV and time-series VTK are provided; adding a format does not touch the material.

Review round already applied

The second commit addresses ten review findings; three are worth calling out because they are the kind that survive a passing test suite:

  • Locale-independent double formatting. The default stream locale can emit 0,5 for 0.5, silently producing a CSV that a reader splits into two columns. Formatting is now locale- and flag-independent, pinned by DoubleFormattingIgnoresLocaleAndFlags.
  • Colliding column names are rejected. Two sources flattening to the same column header produced a file with duplicate columns and no error.
  • Buffer and IO hardening on the write path.

Six tests cover the round trip, the rejections, and that the VTK output is well-formed rather than merely non-empty.

Not addressed here

property_recorder is not registered in the factory, so it cannot yet be named from a JSON document. #33 closed for the material and solver classes; this one is deliberately left for a follow-up, since a document-driven recorder wants its output path and format expressed in the deck too, and that is a design question rather than a registration line.

@petlenz
petlenz merged commit 82c5b53 into main Sep 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant