Skip to content

add update_density and update_parameter function#298

Closed
elmbeech wants to merge 11 commits intoMathCancer:developmentfrom
elmbeech:patch1140_addupdate_density_parameter
Closed

add update_density and update_parameter function#298
elmbeech wants to merge 11 commits intoMathCancer:developmentfrom
elmbeech:patch1140_addupdate_density_parameter

Conversation

@elmbeech
Copy link
Contributor

pull request for the staled pull request #264, #250 and #232.

this pull request is compatible with physicell version 1.14.0 and keeps the changes to the existing code bases as small as possible.
default settings were chosen so that the current models not will break through these changes.
each case was manually tested, the code works as expected.

add_density and add_parameter functions:

Microenvironment::add_density: throw error, if a density with the same name already exists.
Parameters::add_parameter : throw error, if a parameter with the same name and type already exists.

update_density and update_parameter functions:

Microenvironment::update_density : new function which does not throw an error but updates the values, if a density with the same name already exists.
Parameters::update_parameter : new function which does not throw an error but updates the values, if a parameter with the same name and type already exists.

function calls arguments:

load_PhysiCell_config_file: additional bool update_variables argument with default set to false.
setup_microenvironment_from_XML (called from load_PhysiCell_config_file): additional bool update_density argument with default set to false.
User_Parameters::read_from_pugixml (called from load_PhysiCell_config_file): additional bool update_parameter argument with default set to false.

…xists. additionally, update_parameter functions were implemented and an update_variables argument with default setting false was added to the load_PhysiCell_config_file, parameters.read_from_pugixml, and setup_microenvironment_from_XML functions.
…through an error, if one tries to update a density or parameter that not already exists.
…through an error, if one tries to update a density or parameter that not already exists.
@elmbeech
Copy link
Contributor Author

as discussed, update_density and update_parameter through an error, if one tries to update a density or parameter that not already exists. the rest is the same.

@elmbeech
Copy link
Contributor Author

@drbergman can you please give your ok to this change?
I really would like to get this pull request in now!
thank you, Elmar

@MathCancer MathCancer deleted the branch MathCancer:development December 13, 2024 23:02
@MathCancer MathCancer closed this Dec 13, 2024
@MathCancer MathCancer reopened this Dec 20, 2024
@elmbeech
Copy link
Contributor Author

elmbeech commented Dec 26, 2024

Hi Paul (@MathCancer )!
I attached a zip folder which contains physicell 1.14.1 inclusive the changes from this pull request.
The main.cpp and the custom.cpp were adjusted to run consecutive episodes.

  • the main.cpp contains an extra episode loop.
  • the custom.cpp has generate_cell_types and a reset_cell_types function, which are based on the original create_cell_types function.
    I tried to use the physicell high-level functions as much as possible.
    All works well, if episodes run for e.g. 1440 min, but if episodes are e.g. set to 7200 min, the in the following episode I run into a core dump, when I try to delete all the cells.
    This is where I am at this moment stuck with this pull request.
    Elmar
    Dec_26_2024_0443.zip

@rheiland
Copy link
Collaborator

I'd suggest making any new arguments to functions as optional, if possible. E.g., void initialize_microenvironment( bool update_microenvironment = true). This would avoid needing to edit all the sample projects.

@elmbeech
Copy link
Contributor Author

elmbeech commented Jan 1, 2025

Thank you, @rheiland!
This is exactly the way I implemented it.
BioFVM/BioFVM_microenvironment.cpp line 1178 (1178 -1230) and BioFVM/BioFVM_microenvironment.h line 370.
However, I set the default from bool update_microenvironment = false because update is only needed if you run another episode.
The code is passing all the old unit tests. It will not break with the past. There is no need to change any old project code.

…f exit(-1) to make try catch exception possible.
@elmbeech
Copy link
Contributor Author

elmbeech commented Jan 3, 2025

superseded by pull request: #344

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.

4 participants