Skip to content

Re-allow restart in driven solver by parsing csv table from file #393

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

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

phdum-a
Copy link
Contributor

@phdum-a phdum-a commented Jun 27, 2025

This resolves #376.

Palace had the "Restart" flag in the driven solver. Previously this was simple because printing always appended to files row-by-row. A started run did not need to know what happened or what was written before the restart.

With then new_postpro changes (#302) and multi-excitation support (#309), this is more complicated since all data for the full run is stored by PostOperatorCSV. This is all due to the fact that multi-excitations can't just append to rows below but need to change columns to the side. To re-enable restart, we have to parse back the csv file from disk, which we do using scnlib. When we load from the csv, we have to compare to the expected table, in order to (a) validate that the read in tables are in a good state (b) recover information about the Table state (like internal column names) not in the csv.

Additionally, we clean up various parts of the code for simplicity and to make it more testable. We add several unit tests for the table reload.

The commits have been squashed and cleaned to be understandable one-by-one.

phdum-a added 13 commits June 24, 2025 13:58
- Add DrivenSolverIndex data container to group values
- Restart acts on total sample (freq and excitation combined)
- Add EnumerateView helper for C++17 compatibility
- Add tests
- Don't allow empty_cell_val per column for consistent re-parsing
- Fix lshift bug in Column
- Remove unused drive_source_index in PostOperator CSV
- Remove unused AppendHeader, Append Row in TableWithCSVFile
- Add comments
- Add small tweaks for measurement table parsing

Propagate table column block index

- Needed for row alignment check during table reload
- Assumes all entries are all double
- Add function to return csv filepath for potential error messages
- Replace pointer to common options with explicit passing, in order to not write custom move
- Must validate table structure against expectation
- Must copy some parameter from reference that can't be parsed
- Validate cursor location with restart
- Properly set nr_expected_measurement_rows for all solvers
- Thread through objects needed for init and print in call
- Move fem_op_t so PostOperatorCSV ctor can use it
- Move expected filling pattern into free function for testing
- Add test case csv files to load
In PostOperatorCSV:
- m_idx_row -> row_i
- m_idx_value -> row_idx_v
- excitation_idx_all -> ex_idx_v_all
- SingleColBlock() -> HasSingleExIdx()
- may_reload_table() -> MayReloadTable

Also some test names changed.
@phdum-a phdum-a requested a review from hughcars June 27, 2025 02:52
@phdum-a phdum-a force-pushed the phdum/fix_restart_printing branch from 17083ed to bb9f14d Compare June 27, 2025 17:17
@phdum-a phdum-a force-pushed the phdum/fix_restart_printing branch from b20b718 to 0c9f142 Compare June 27, 2025 18:08
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.

"Restart" not working in driven simulation
1 participant