Skip to content

Restore resumed custom vector variables from the saved values - #448

Open
drbergman wants to merge 1 commit into
MathCancer:developmentfrom
drbergman:fix-resume-custom-vector
Open

drbergman wants to merge 1 commit into
MathCancer:developmentfrom
drbergman:fix-resume-custom-vector

Conversation

@drbergman

Copy link
Copy Markdown
Collaborator

When resuming with resume_from_MultiCellDS(), recreate_sim_state() wrote each custom vector variable's length into every element instead of the value it had just read, so a resumed 3-element custom vector came back as [3, 3, 3] in every cell. The scalar branch already had this fix.

While here, the custom-data lookups and the cycle phase-index lookup now only run when create_cells is true. With create_cells=false they dereferenced an unset pCell, and the reader segfaulted partway through the file.

🤖 Generated with Claude Code

recreate_sim_state() assigned the vector's length to every element of every
custom vector variable instead of the value it had just read. Also skip the
custom data lookups and the cycle phase index lookup when create_cells is
false, since pCell is never set in that case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings December 3, 2026 19:42

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.

🟢 Approval recommended

No active review issues remain for the custom-vector restoration and guarded cell-dependent lookups.

No open issues 🎉

What changed in this PR

Fixes custom-vector restoration in PhysiCell’s MultiCellDS resume reader and guards cell-dependent lookups when cell creation is disabled.

Changes:

  • Restore each custom-vector element from its saved value instead of the vector length.
  • Run custom-data and cycle phase-index lookups only when create_cells is true.
File Description
modules/​PhysiCell_MultiCellDS.cpp Corrects vector restoration and guards cell-dependent lookups.

Review effort: Balanced

@drbergman

Copy link
Copy Markdown
Collaborator Author

@rheiland another case where Claude found this bug. reading the code, I agree that the bug exists (your comments and debug prints both suggest we should be grabbing dTemp and not pair.second)

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