Skip to content

Resolve output folder before seeding RNG and copying inputs#53

Merged
drbergman merged 1 commit into
my-physicellfrom
claude/intelligent-chaum-2135f9
Jun 17, 2026
Merged

Resolve output folder before seeding RNG and copying inputs#53
drbergman merged 1 commit into
my-physicellfrom
claude/intelligent-chaum-2135f9

Conversation

@drbergman

Copy link
Copy Markdown
Owner

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.

Copilot AI review requested due to automatic review settings June 17, 2026 02:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 new setup_random_seed_from_config() helper.
  • Adds a warning when random_seed.txt cannot 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.

Comment thread modules/PhysiCell_settings.cpp
Comment thread core/PhysiCell_utilities.cpp
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
drbergman force-pushed the claude/intelligent-chaum-2135f9 branch from 01b5bd5 to ad45607 Compare June 17, 2026 03:26
@drbergman
drbergman merged commit 0d3e85a into my-physicell Jun 17, 2026
86 of 208 checks passed
@drbergman
drbergman deleted the claude/intelligent-chaum-2135f9 branch June 17, 2026 03:26
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.

2 participants