PhysiCell
PhysiCell copied to clipboard
add update_density and update_parameter function
pull request for the staled pull request https://github.com/MathCancer/PhysiCell/pull/264, https://github.com/MathCancer/PhysiCell/pull/250 and https://github.com/MathCancer/PhysiCell/pull/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.
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.
@drbergman can you please give your ok to this change? I really would like to get this pull request in now! thank you, Elmar
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.cppcontains an extraepisode loop. - the
custom.cpphasgenerate_cell_typesand areset_cell_typesfunction, which are based on the originalcreate_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
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.
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.
superseded by pull request: https://github.com/MathCancer/PhysiCell/pull/344