Resolve output folder before seeding RNG and copying inputs#53
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes output-folder ordering so folder-dependent side effects (RNG seeding/random_seed.txt and config/input copying) occur only after the final output directory is resolved (including the -o/--output override) and created, preventing artifacts from being written into stale/nonexistent directories.
Changes:
- Reorders
load_PhysiCell_config_file()to finalize and create the output directory before any folder-dependent writes. - Moves random-seed parsing/seeding out of
PhysiCell_Settings::read_from_pugixml()into a newsetup_random_seed_from_config()helper. - Adds a warning when
random_seed.txtcannot be written instead of failing silently.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| modules/PhysiCell_settings.h | Declares the new setup_random_seed_from_config() helper. |
| modules/PhysiCell_settings.cpp | Reorders output folder resolution/creation and relocates RNG seeding logic out of XML parsing. |
| core/PhysiCell_utilities.cpp | Improves robustness by warning when random_seed.txt cannot be written. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The random seed was applied during read_from_pugixml(), which ran before the -o/--output command-line override and before the output directory was created. As a result random_seed.txt was written to a stale or nonexistent folder: missing entirely on a fresh run, or split off into the XML <save><folder> while every other artifact went to the -o folder. Make folder resolution a single ordered sequence in load_PhysiCell_config_file(): parse the config, apply the -o override, create the output directory, then perform all folder-dependent writes (random_seed.txt and the copied input files). Move random-seed handling out of read_from_pugixml() into setup_random_seed_from_config() so parsing has no filesystem side effects, and warn instead of silently dropping the seed file if it cannot be written. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
drbergman
force-pushed
the
claude/intelligent-chaum-2135f9
branch
from
June 17, 2026 03:26
01b5bd5 to
ad45607
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The random seed was applied during read_from_pugixml(), which ran before the -o/--output command-line override and before the output directory was created. As a result random_seed.txt was written to a stale or nonexistent folder: missing entirely on a fresh run, or split off into the XML while every other artifact went to the -o folder.
Make folder resolution a single ordered sequence in load_PhysiCell_config_file(): parse the config, apply the -o override, create the output directory, then perform all folder-dependent writes (random_seed.txt and the copied input files). Move random-seed handling out of read_from_pugixml() into setup_random_seed_from_config() so parsing has no filesystem side effects, and warn instead of silently dropping the seed file if it cannot be written.