From 848e7e82f2661c8e374a18d04e94463d68c42606 Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Tue, 10 Feb 2026 14:25:17 -0500 Subject: [PATCH 01/13] update sample projects --- .../config/PhysiCell_settings.xml | 1 + sample_projects/asymmetric_division/main.cpp | 3 +- .../biorobots/config/PhysiCell_settings.xml | 1 + sample_projects/biorobots/main.cpp | 3 +- .../config/PhysiCell_settings.xml | 1 + sample_projects/cancer_biorobots/main.cpp | 3 +- .../config/PhysiCell_settings.xml | 1 + .../celltypes3/config/PhysiCell_settings.xml | 1 + sample_projects/celltypes3/main.cpp | 3 +- .../config/PhysiCell_settings.xml | 1 + sample_projects/custom_division/main.cpp | 3 +- .../episode/config/PhysiCell_settings.xml | 1 + sample_projects/episode/main.cpp | 3 +- .../config/PhysiCell_settings.xml | 1 + sample_projects/heterogeneity/main.cpp | 3 +- .../config/PhysiCell_settings.xml | 1 + sample_projects/immune_function/main.cpp | 3 +- .../config/PhysiCell_settings.xml | 1 + sample_projects/interactions/main.cpp | 3 +- .../mechano/config/PhysiCell_settings.xml | 1 + sample_projects/mechano/main.cpp | 3 +- .../physimess/config/PhysiCell_settings.xml | 1 + sample_projects/physimess/main.cpp | 3 +- .../config/PhysiCell_settings.xml | 1 + sample_projects/pred_prey_farmer/main.cpp | 3 +- .../config/PhysiCell_settings.xml | 1 + sample_projects/rules_sample/main.cpp | 3 +- .../template/config/PhysiCell_settings-0.xml | 249 ++++++++++++++++++ .../template/config/PhysiCell_settings.xml | 1 + sample_projects/template/main.cpp | 3 +- .../config/PhysiCell_settings.xml | 1 + sample_projects/virus_macrophage/main.cpp | 3 +- .../worm/config/PhysiCell_settings.xml | 1 + sample_projects/worm/main.cpp | 3 +- .../ode_energy/config/PhysiCell_settings.xml | 1 + .../ode/ode_energy/main.cpp | 3 +- 36 files changed, 301 insertions(+), 17 deletions(-) create mode 100644 sample_projects/template/config/PhysiCell_settings-0.xml diff --git a/sample_projects/asymmetric_division/config/PhysiCell_settings.xml b/sample_projects/asymmetric_division/config/PhysiCell_settings.xml index 994749fe0..ae5a8a0bd 100644 --- a/sample_projects/asymmetric_division/config/PhysiCell_settings.xml +++ b/sample_projects/asymmetric_division/config/PhysiCell_settings.xml @@ -52,6 +52,7 @@ true false 0 + 30 diff --git a/sample_projects/asymmetric_division/main.cpp b/sample_projects/asymmetric_division/main.cpp index bf6e65d15..f0bd5f674 100644 --- a/sample_projects/asymmetric_division/main.cpp +++ b/sample_projects/asymmetric_division/main.cpp @@ -118,7 +118,8 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = 30; + double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; + std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects/biorobots/config/PhysiCell_settings.xml b/sample_projects/biorobots/config/PhysiCell_settings.xml index e005c6f71..84827def4 100644 --- a/sample_projects/biorobots/config/PhysiCell_settings.xml +++ b/sample_projects/biorobots/config/PhysiCell_settings.xml @@ -61,6 +61,7 @@ true true 0 + 30 diff --git a/sample_projects/biorobots/main.cpp b/sample_projects/biorobots/main.cpp index 2e5a302f0..3a2144d39 100644 --- a/sample_projects/biorobots/main.cpp +++ b/sample_projects/biorobots/main.cpp @@ -118,7 +118,8 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = 30; + double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; + std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects/cancer_biorobots/config/PhysiCell_settings.xml b/sample_projects/cancer_biorobots/config/PhysiCell_settings.xml index fd9e9221a..d268a455c 100644 --- a/sample_projects/cancer_biorobots/config/PhysiCell_settings.xml +++ b/sample_projects/cancer_biorobots/config/PhysiCell_settings.xml @@ -61,6 +61,7 @@ true true 0 + 30 diff --git a/sample_projects/cancer_biorobots/main.cpp b/sample_projects/cancer_biorobots/main.cpp index 7b2131179..e4fc93e86 100644 --- a/sample_projects/cancer_biorobots/main.cpp +++ b/sample_projects/cancer_biorobots/main.cpp @@ -118,7 +118,8 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = 30; + double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; + std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects/cancer_immune/config/PhysiCell_settings.xml b/sample_projects/cancer_immune/config/PhysiCell_settings.xml index 958f1ddfa..4f6b75aa7 100644 --- a/sample_projects/cancer_immune/config/PhysiCell_settings.xml +++ b/sample_projects/cancer_immune/config/PhysiCell_settings.xml @@ -124,6 +124,7 @@ false true true + 30 diff --git a/sample_projects/celltypes3/config/PhysiCell_settings.xml b/sample_projects/celltypes3/config/PhysiCell_settings.xml index d33ac8a26..9c5b90228 100644 --- a/sample_projects/celltypes3/config/PhysiCell_settings.xml +++ b/sample_projects/celltypes3/config/PhysiCell_settings.xml @@ -121,6 +121,7 @@ false false + 30 diff --git a/sample_projects/celltypes3/main.cpp b/sample_projects/celltypes3/main.cpp index c329cfdfb..e0b95fcbe 100644 --- a/sample_projects/celltypes3/main.cpp +++ b/sample_projects/celltypes3/main.cpp @@ -108,7 +108,8 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = 30; + double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; + std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects/custom_division/config/PhysiCell_settings.xml b/sample_projects/custom_division/config/PhysiCell_settings.xml index c05d6a672..aa6db3dc4 100644 --- a/sample_projects/custom_division/config/PhysiCell_settings.xml +++ b/sample_projects/custom_division/config/PhysiCell_settings.xml @@ -51,6 +51,7 @@ true false 0 + 30 diff --git a/sample_projects/custom_division/main.cpp b/sample_projects/custom_division/main.cpp index bf6e65d15..5d8cdf246 100644 --- a/sample_projects/custom_division/main.cpp +++ b/sample_projects/custom_division/main.cpp @@ -118,7 +118,8 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = 30; + double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; + std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects/episode/config/PhysiCell_settings.xml b/sample_projects/episode/config/PhysiCell_settings.xml index 68ff43e83..26f848527 100644 --- a/sample_projects/episode/config/PhysiCell_settings.xml +++ b/sample_projects/episode/config/PhysiCell_settings.xml @@ -52,6 +52,7 @@ true false 74 + 30 diff --git a/sample_projects/episode/main.cpp b/sample_projects/episode/main.cpp index 2f32cb696..e4d40c20d 100644 --- a/sample_projects/episode/main.cpp +++ b/sample_projects/episode/main.cpp @@ -141,7 +141,8 @@ int main( int argc, char* argv[] ) // setup microenviroment and mechanics voxel size and match the data structure to BioFVM std::cout << "set densities ..." << std::endl; setup_microenvironment(); // modify this in the custom code - double mechanics_voxel_size = 30; + double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; + std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); // load cell type definition and setup tisse diff --git a/sample_projects/heterogeneity/config/PhysiCell_settings.xml b/sample_projects/heterogeneity/config/PhysiCell_settings.xml index 2cefeefa9..9582aaa78 100644 --- a/sample_projects/heterogeneity/config/PhysiCell_settings.xml +++ b/sample_projects/heterogeneity/config/PhysiCell_settings.xml @@ -61,6 +61,7 @@ true false 0 + 30 diff --git a/sample_projects/heterogeneity/main.cpp b/sample_projects/heterogeneity/main.cpp index 98b47d9e5..089e48023 100644 --- a/sample_projects/heterogeneity/main.cpp +++ b/sample_projects/heterogeneity/main.cpp @@ -118,7 +118,8 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = 30; + double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; + std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects/immune_function/config/PhysiCell_settings.xml b/sample_projects/immune_function/config/PhysiCell_settings.xml index bfd1cdc3d..ceb750d43 100644 --- a/sample_projects/immune_function/config/PhysiCell_settings.xml +++ b/sample_projects/immune_function/config/PhysiCell_settings.xml @@ -45,6 +45,7 @@ false true false + 30 diff --git a/sample_projects/immune_function/main.cpp b/sample_projects/immune_function/main.cpp index 8df1843ec..c07c64e92 100644 --- a/sample_projects/immune_function/main.cpp +++ b/sample_projects/immune_function/main.cpp @@ -118,7 +118,8 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = 30; + double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; + std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects/interactions/config/PhysiCell_settings.xml b/sample_projects/interactions/config/PhysiCell_settings.xml index c702bb526..08670359e 100644 --- a/sample_projects/interactions/config/PhysiCell_settings.xml +++ b/sample_projects/interactions/config/PhysiCell_settings.xml @@ -62,6 +62,7 @@ false false 0 + 30 diff --git a/sample_projects/interactions/main.cpp b/sample_projects/interactions/main.cpp index ec4b5f408..a20d51f21 100644 --- a/sample_projects/interactions/main.cpp +++ b/sample_projects/interactions/main.cpp @@ -118,7 +118,8 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = 30; + double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; + std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects/mechano/config/PhysiCell_settings.xml b/sample_projects/mechano/config/PhysiCell_settings.xml index 2faf3f248..f8f3af21d 100644 --- a/sample_projects/mechano/config/PhysiCell_settings.xml +++ b/sample_projects/mechano/config/PhysiCell_settings.xml @@ -61,6 +61,7 @@ true false 0 + 30 diff --git a/sample_projects/mechano/main.cpp b/sample_projects/mechano/main.cpp index 24c358803..68a86fca7 100644 --- a/sample_projects/mechano/main.cpp +++ b/sample_projects/mechano/main.cpp @@ -118,7 +118,8 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = 30; + double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; + std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects/physimess/config/PhysiCell_settings.xml b/sample_projects/physimess/config/PhysiCell_settings.xml index eb02d2bee..51e15e9d1 100644 --- a/sample_projects/physimess/config/PhysiCell_settings.xml +++ b/sample_projects/physimess/config/PhysiCell_settings.xml @@ -61,6 +61,7 @@ true true 0 + 30 diff --git a/sample_projects/physimess/main.cpp b/sample_projects/physimess/main.cpp index 86601cdb4..e32cf878b 100644 --- a/sample_projects/physimess/main.cpp +++ b/sample_projects/physimess/main.cpp @@ -118,7 +118,8 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = 30; + double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; + std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects/pred_prey_farmer/config/PhysiCell_settings.xml b/sample_projects/pred_prey_farmer/config/PhysiCell_settings.xml index 1d4159620..25c20eaee 100644 --- a/sample_projects/pred_prey_farmer/config/PhysiCell_settings.xml +++ b/sample_projects/pred_prey_farmer/config/PhysiCell_settings.xml @@ -122,6 +122,7 @@ false true false + 30 diff --git a/sample_projects/pred_prey_farmer/main.cpp b/sample_projects/pred_prey_farmer/main.cpp index 9797710f0..86be1f2e4 100644 --- a/sample_projects/pred_prey_farmer/main.cpp +++ b/sample_projects/pred_prey_farmer/main.cpp @@ -118,7 +118,8 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = 30; + double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; + std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects/rules_sample/config/PhysiCell_settings.xml b/sample_projects/rules_sample/config/PhysiCell_settings.xml index 79972ef99..f713036fd 100644 --- a/sample_projects/rules_sample/config/PhysiCell_settings.xml +++ b/sample_projects/rules_sample/config/PhysiCell_settings.xml @@ -52,6 +52,7 @@ true false 0 + 30 diff --git a/sample_projects/rules_sample/main.cpp b/sample_projects/rules_sample/main.cpp index 8df1843ec..c07c64e92 100644 --- a/sample_projects/rules_sample/main.cpp +++ b/sample_projects/rules_sample/main.cpp @@ -118,7 +118,8 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = 30; + double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; + std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects/template/config/PhysiCell_settings-0.xml b/sample_projects/template/config/PhysiCell_settings-0.xml new file mode 100644 index 000000000..6c9403c36 --- /dev/null +++ b/sample_projects/template/config/PhysiCell_settings-0.xml @@ -0,0 +1,249 @@ + + + + -500 + 500 + -500 + 500 + -10 + 10 + 20 + 20 + 20 + true + + + + 7200 + min + micron + 0.01 + 0.1 + 6 + + + + 6 + + + + output + + 60 + true + + + 60 + true + + substrate + YlOrRd + 0 + 1 + + + + false + + + + + false + true + false + 0 + + + + + + 100000.0 + 10 + + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + + + + true + true + + ./config/initial.mat + + + ./config/dirichlet.mat + + + + + + + + + + 300.0 + 480.0 + 240.0 + 60.0 + + + + + 5.31667e-05 + + 516 + + + 0.05 + 0 + 1.66667e-02 + 5.83333e-03 + 0 + 2.0 + + + + 0.0 + + 0 + 86400 + + + 1.11667e-2 + 8.33333e-4 + 5.33333e-5 + 2.16667e-3 + 0 + 2.0 + + + + + 2494 + 0.75 + 540 + 0.05 + 0.0045 + 0.0055 + 0 + 0 + 2.0 + + + 0.4 + 10.0 + 1.25 + + 1 + + + 1.8 + 15.12 + + 0.01 + 0.0 + 0.0 + 12 + + + 1 + 1 + .5 + + false + true + + false + substrate + 1 + + + false + false + + 0.0 + + + + + + + 0 + 1 + 0 + 0 + + + + 0 + 0 + 0 + + 0 + + + 0 + + 1 + 0.1 + + 0 + + + + + 0 + + + + 0.0 + 0.0 + + + + 1.0 + + + + Volume + 4 + 2 + 100000 + + + apoptosis + 1e-6 + 1e-2 + + + + + + + + ./config + cells.csv + + + + + + + ./config + cell_rules.csv + + + + + + + 5 + + \ No newline at end of file diff --git a/sample_projects/template/config/PhysiCell_settings.xml b/sample_projects/template/config/PhysiCell_settings.xml index 6c9403c36..9b3f5ec22 100644 --- a/sample_projects/template/config/PhysiCell_settings.xml +++ b/sample_projects/template/config/PhysiCell_settings.xml @@ -52,6 +52,7 @@ true false 0 + 30 diff --git a/sample_projects/template/main.cpp b/sample_projects/template/main.cpp index bf6e65d15..f0bd5f674 100644 --- a/sample_projects/template/main.cpp +++ b/sample_projects/template/main.cpp @@ -118,7 +118,8 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = 30; + double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; + std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects/virus_macrophage/config/PhysiCell_settings.xml b/sample_projects/virus_macrophage/config/PhysiCell_settings.xml index 5e3be1a7c..6517e970a 100644 --- a/sample_projects/virus_macrophage/config/PhysiCell_settings.xml +++ b/sample_projects/virus_macrophage/config/PhysiCell_settings.xml @@ -61,6 +61,7 @@ true false 0 + 30 diff --git a/sample_projects/virus_macrophage/main.cpp b/sample_projects/virus_macrophage/main.cpp index 7009514aa..f063bb3e3 100644 --- a/sample_projects/virus_macrophage/main.cpp +++ b/sample_projects/virus_macrophage/main.cpp @@ -118,7 +118,8 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = 30; + double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; + std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects/worm/config/PhysiCell_settings.xml b/sample_projects/worm/config/PhysiCell_settings.xml index 1c7ced5f9..41e3061b1 100644 --- a/sample_projects/worm/config/PhysiCell_settings.xml +++ b/sample_projects/worm/config/PhysiCell_settings.xml @@ -61,6 +61,7 @@ true true 0 + 30 diff --git a/sample_projects/worm/main.cpp b/sample_projects/worm/main.cpp index 9797710f0..b8dceb8e9 100644 --- a/sample_projects/worm/main.cpp +++ b/sample_projects/worm/main.cpp @@ -118,7 +118,8 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = 30; + double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; + std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects_intracellular/ode/ode_energy/config/PhysiCell_settings.xml b/sample_projects_intracellular/ode/ode_energy/config/PhysiCell_settings.xml index f0a40f2f4..80f0ade74 100644 --- a/sample_projects_intracellular/ode/ode_energy/config/PhysiCell_settings.xml +++ b/sample_projects_intracellular/ode/ode_energy/config/PhysiCell_settings.xml @@ -122,6 +122,7 @@ false true false + 30 diff --git a/sample_projects_intracellular/ode/ode_energy/main.cpp b/sample_projects_intracellular/ode/ode_energy/main.cpp index 828ce4dc9..6da2aa2c7 100644 --- a/sample_projects_intracellular/ode/ode_energy/main.cpp +++ b/sample_projects_intracellular/ode/ode_energy/main.cpp @@ -109,7 +109,8 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = 30; + double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; + std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ From 1cb79aed01c7dfcb85b90b3a65860322d4400270 Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Tue, 10 Feb 2026 14:34:14 -0500 Subject: [PATCH 02/13] add unique named main --- sample_projects/cancer_immune/main-cancer_immune_3D.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sample_projects/cancer_immune/main-cancer_immune_3D.cpp b/sample_projects/cancer_immune/main-cancer_immune_3D.cpp index 10f9aca2f..d31138aa3 100644 --- a/sample_projects/cancer_immune/main-cancer_immune_3D.cpp +++ b/sample_projects/cancer_immune/main-cancer_immune_3D.cpp @@ -121,7 +121,8 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = 30; + double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; + std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); create_cell_types(); From 20bc231719be4aa6adfdd83f097b25b80c024c86 Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Tue, 10 Feb 2026 14:35:54 -0500 Subject: [PATCH 03/13] mech grid size in xml --- core/PhysiCell_cell.cpp | 61 ++++++++++++++++++++++++++++++++++++ core/PhysiCell_cell.h | 1 + core/PhysiCell_constants.cpp | 1 + core/PhysiCell_constants.h | 1 + 4 files changed, 64 insertions(+) diff --git a/core/PhysiCell_cell.cpp b/core/PhysiCell_cell.cpp index 1f3e2646b..66e589abd 100644 --- a/core/PhysiCell_cell.cpp +++ b/core/PhysiCell_cell.cpp @@ -1330,6 +1330,67 @@ bool is_neighbor_voxel(Cell* pCell, std::vector my_voxel_center, std::ve return true; } +// bool is_neighbor_voxel_original(Cell* pCell, std::vector my_voxel_center, std::vector other_voxel_center, int other_voxel_index) +// bool is_neighbor_voxel_Claude(Cell* pCell, const std::vector& my_voxel_center, +// const std::vector& other_voxel_center, int other_voxel_index) +// { +// // Cache frequently used values +// const double max_interactive_distance = pCell->phenotype.mechanics.relative_maximum_adhesion_distance * +// pCell->phenotype.geometry.radius + +// pCell->get_container()->max_cell_interactive_distance_in_voxel[other_voxel_index]; +// const double max_distance_squared = max_interactive_distance * max_interactive_distance; +// const auto& pos = pCell->position; + +// // Helper lambda to compute squared distance +// auto squared_distance = [](double dx, double dy, double dz = 0.0) { +// return dx * dx + dy * dy + dz * dz; +// }; + +// // Count matching dimensions to determine neighbor type +// int matching_dims = 0; +// int differing_dim = -1; + +// for (int i = 0; i < 3; ++i) { +// if (my_voxel_center[i] == other_voxel_center[i]) { +// matching_dims++; +// } else { +// differing_dim = i; +// } +// } + +// // Case 1: Face neighbor (2 matching dimensions) +// if (matching_dims == 2) { +// const double surface_coord = 0.5 * (my_voxel_center[differing_dim] + other_voxel_center[differing_dim]); +// return std::fabs(pos[differing_dim] - surface_coord) <= max_interactive_distance; +// } + +// // Case 2: Edge neighbor (1 matching dimension) +// if (matching_dims == 1) { +// int dim1 = -1, dim2 = -1; +// for (int i = 0, count = 0; i < 3; ++i) { +// if (my_voxel_center[i] != other_voxel_center[i]) { +// if (count == 0) dim1 = i; +// else dim2 = i; +// count++; +// } +// } + +// const double line_coord1 = 0.5 * (my_voxel_center[dim1] + other_voxel_center[dim1]); +// const double line_coord2 = 0.5 * (my_voxel_center[dim2] + other_voxel_center[dim2]); +// const double dist_sq = squared_distance(pos[dim1] - line_coord1, pos[dim2] - line_coord2); + +// return dist_sq <= max_distance_squared; +// } + +// // Case 3: Corner neighbor (0 matching dimensions) +// const double corner_x = 0.5 * (my_voxel_center[0] + other_voxel_center[0]); +// const double corner_y = 0.5 * (my_voxel_center[1] + other_voxel_center[1]); +// const double corner_z = 0.5 * (my_voxel_center[2] + other_voxel_center[2]); +// const double dist_sq = squared_distance(pos[0] - corner_x, pos[1] - corner_y, pos[2] - corner_z); + +// return dist_sq <= max_distance_squared; +// } + std::vector& Cell::cells_in_my_container( void ) { return get_container()->agent_grid[get_current_mechanics_voxel_index()]; diff --git a/core/PhysiCell_cell.h b/core/PhysiCell_cell.h index 5b7c52d96..10bb2a58d 100644 --- a/core/PhysiCell_cell.h +++ b/core/PhysiCell_cell.h @@ -262,6 +262,7 @@ void save_all_cells_to_matlab( std::string filename ); //function to check if a neighbor voxel contains any cell that can interact with me bool is_neighbor_voxel(Cell* pCell, std::vector myVoxelCenter, std::vector otherVoxelCenter, int otherVoxelIndex); +// bool is_neighbor_voxel(Cell* pCell, const std::vector& myVoxelCenter, const std::vector& otherVoxelCenter, int otherVoxelIndex); // Claude extern std::unordered_map cell_definitions_by_name; diff --git a/core/PhysiCell_constants.cpp b/core/PhysiCell_constants.cpp index da001e1e0..0673191f7 100644 --- a/core/PhysiCell_constants.cpp +++ b/core/PhysiCell_constants.cpp @@ -76,6 +76,7 @@ double mechanics_dt = 0.1; double phenotype_dt = 6.0; double intracellular_dt = 0.01; +double mechanics_voxel_size = 30.0; // currently recognized cell cycle models const int PhysiCell_constants::advanced_Ki67_cycle_model= 0; diff --git a/core/PhysiCell_constants.h b/core/PhysiCell_constants.h index 9287c4213..a711d2ebd 100644 --- a/core/PhysiCell_constants.h +++ b/core/PhysiCell_constants.h @@ -157,6 +157,7 @@ extern double diffusion_dt; extern double mechanics_dt; extern double phenotype_dt; extern double intracellular_dt; +extern double mechanics_voxel_size; extern std::unordered_map cycle_model_codes; From 95fea5f0c63efab729fbf1105a9cc2264ecb0f65 Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Tue, 10 Feb 2026 15:01:42 -0500 Subject: [PATCH 04/13] add mechanics_voxel_size --- modules/PhysiCell_settings.cpp | 24 ++++++++++++++++++++++++ modules/PhysiCell_settings.h | 3 +++ 2 files changed, 27 insertions(+) diff --git a/modules/PhysiCell_settings.cpp b/modules/PhysiCell_settings.cpp index a588383d1..6f6dd109b 100644 --- a/modules/PhysiCell_settings.cpp +++ b/modules/PhysiCell_settings.cpp @@ -154,6 +154,9 @@ PhysiCell_Settings::PhysiCell_Settings() intracellular_save_interval = 60; enable_intracellular_saves = false; + + // + mechanics_voxel_size = 30.0; // parallel options @@ -299,6 +302,27 @@ void PhysiCell_Settings::read_from_pugixml( void ) SeedRandom(seed); } + double mechanics_voxel_size_val; + pugi::xml_node mechanics_voxel_size_node = xml_find_node(node_options, "mechanics_voxel_size"); + if (mechanics_voxel_size_node) + { + mechanics_voxel_size_val = xml_get_my_double_value(mechanics_voxel_size_node ); + if (mechanics_voxel_size_val > 0.0) + { + PhysiCell_settings.mechanics_voxel_size = mechanics_voxel_size_val; // Update global value + std::cout << "Setting PhysiCell_settings.mechanics_voxel_size = " << PhysiCell_settings.mechanics_voxel_size << std::endl; + } + else + { + std::cout << "XML Error: mechanics_voxel_size must be > 0. Leaving at default value= " << mechanics_voxel_size << std::endl; + } + } + else + { + std::cout << "mechanics_voxel_size not found in XML , leaving at default value= " << mechanics_voxel_size << std::endl; + } + + // other options can go here, eventually } diff --git a/modules/PhysiCell_settings.h b/modules/PhysiCell_settings.h index 86afb2939..baa97fdfa 100644 --- a/modules/PhysiCell_settings.h +++ b/modules/PhysiCell_settings.h @@ -128,6 +128,9 @@ class PhysiCell_Settings double intracellular_save_interval = 60; bool enable_intracellular_saves = false; + // + double mechanics_voxel_size = 30.0; + // cell rules option bool rules_enabled = false; std::string rules_protocol = "Cell Behavior Hypothesis Grammar (CBHG)"; From 79702d52a5cd384549602d296f74a47d9cf34f89 Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Tue, 17 Feb 2026 15:11:35 -0500 Subject: [PATCH 05/13] cleanup --- .../template/config/PhysiCell_settings-0.xml | 249 ------------------ 1 file changed, 249 deletions(-) delete mode 100644 sample_projects/template/config/PhysiCell_settings-0.xml diff --git a/sample_projects/template/config/PhysiCell_settings-0.xml b/sample_projects/template/config/PhysiCell_settings-0.xml deleted file mode 100644 index 6c9403c36..000000000 --- a/sample_projects/template/config/PhysiCell_settings-0.xml +++ /dev/null @@ -1,249 +0,0 @@ - - - - -500 - 500 - -500 - 500 - -10 - 10 - 20 - 20 - 20 - true - - - - 7200 - min - micron - 0.01 - 0.1 - 6 - - - - 6 - - - - output - - 60 - true - - - 60 - true - - substrate - YlOrRd - 0 - 1 - - - - false - - - - - false - true - false - 0 - - - - - - 100000.0 - 10 - - 0 - 0 - - 0 - 0 - 0 - 0 - 0 - 0 - - - - true - true - - ./config/initial.mat - - - ./config/dirichlet.mat - - - - - - - - - - 300.0 - 480.0 - 240.0 - 60.0 - - - - - 5.31667e-05 - - 516 - - - 0.05 - 0 - 1.66667e-02 - 5.83333e-03 - 0 - 2.0 - - - - 0.0 - - 0 - 86400 - - - 1.11667e-2 - 8.33333e-4 - 5.33333e-5 - 2.16667e-3 - 0 - 2.0 - - - - - 2494 - 0.75 - 540 - 0.05 - 0.0045 - 0.0055 - 0 - 0 - 2.0 - - - 0.4 - 10.0 - 1.25 - - 1 - - - 1.8 - 15.12 - - 0.01 - 0.0 - 0.0 - 12 - - - 1 - 1 - .5 - - false - true - - false - substrate - 1 - - - false - false - - 0.0 - - - - - - - 0 - 1 - 0 - 0 - - - - 0 - 0 - 0 - - 0 - - - 0 - - 1 - 0.1 - - 0 - - - - - 0 - - - - 0.0 - 0.0 - - - - 1.0 - - - - Volume - 4 - 2 - 100000 - - - apoptosis - 1e-6 - 1e-2 - - - - - - - - ./config - cells.csv - - - - - - - ./config - cell_rules.csv - - - - - - - 5 - - \ No newline at end of file From 1ed6aff025586a2b195ef53674bc50157ff5682c Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Thu, 19 Feb 2026 16:12:03 -0500 Subject: [PATCH 06/13] cleanup --- core/PhysiCell_cell.cpp | 61 ----------------------------------------- 1 file changed, 61 deletions(-) diff --git a/core/PhysiCell_cell.cpp b/core/PhysiCell_cell.cpp index 66e589abd..1f3e2646b 100644 --- a/core/PhysiCell_cell.cpp +++ b/core/PhysiCell_cell.cpp @@ -1330,67 +1330,6 @@ bool is_neighbor_voxel(Cell* pCell, std::vector my_voxel_center, std::ve return true; } -// bool is_neighbor_voxel_original(Cell* pCell, std::vector my_voxel_center, std::vector other_voxel_center, int other_voxel_index) -// bool is_neighbor_voxel_Claude(Cell* pCell, const std::vector& my_voxel_center, -// const std::vector& other_voxel_center, int other_voxel_index) -// { -// // Cache frequently used values -// const double max_interactive_distance = pCell->phenotype.mechanics.relative_maximum_adhesion_distance * -// pCell->phenotype.geometry.radius + -// pCell->get_container()->max_cell_interactive_distance_in_voxel[other_voxel_index]; -// const double max_distance_squared = max_interactive_distance * max_interactive_distance; -// const auto& pos = pCell->position; - -// // Helper lambda to compute squared distance -// auto squared_distance = [](double dx, double dy, double dz = 0.0) { -// return dx * dx + dy * dy + dz * dz; -// }; - -// // Count matching dimensions to determine neighbor type -// int matching_dims = 0; -// int differing_dim = -1; - -// for (int i = 0; i < 3; ++i) { -// if (my_voxel_center[i] == other_voxel_center[i]) { -// matching_dims++; -// } else { -// differing_dim = i; -// } -// } - -// // Case 1: Face neighbor (2 matching dimensions) -// if (matching_dims == 2) { -// const double surface_coord = 0.5 * (my_voxel_center[differing_dim] + other_voxel_center[differing_dim]); -// return std::fabs(pos[differing_dim] - surface_coord) <= max_interactive_distance; -// } - -// // Case 2: Edge neighbor (1 matching dimension) -// if (matching_dims == 1) { -// int dim1 = -1, dim2 = -1; -// for (int i = 0, count = 0; i < 3; ++i) { -// if (my_voxel_center[i] != other_voxel_center[i]) { -// if (count == 0) dim1 = i; -// else dim2 = i; -// count++; -// } -// } - -// const double line_coord1 = 0.5 * (my_voxel_center[dim1] + other_voxel_center[dim1]); -// const double line_coord2 = 0.5 * (my_voxel_center[dim2] + other_voxel_center[dim2]); -// const double dist_sq = squared_distance(pos[dim1] - line_coord1, pos[dim2] - line_coord2); - -// return dist_sq <= max_distance_squared; -// } - -// // Case 3: Corner neighbor (0 matching dimensions) -// const double corner_x = 0.5 * (my_voxel_center[0] + other_voxel_center[0]); -// const double corner_y = 0.5 * (my_voxel_center[1] + other_voxel_center[1]); -// const double corner_z = 0.5 * (my_voxel_center[2] + other_voxel_center[2]); -// const double dist_sq = squared_distance(pos[0] - corner_x, pos[1] - corner_y, pos[2] - corner_z); - -// return dist_sq <= max_distance_squared; -// } - std::vector& Cell::cells_in_my_container( void ) { return get_container()->agent_grid[get_current_mechanics_voxel_index()]; From 8ffa631f6df0ee4fd9c10003394a6d83e9f1ca56 Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Thu, 19 Feb 2026 16:16:02 -0500 Subject: [PATCH 07/13] cleanup --- core/PhysiCell_cell.h | 1 - 1 file changed, 1 deletion(-) diff --git a/core/PhysiCell_cell.h b/core/PhysiCell_cell.h index 10bb2a58d..5b7c52d96 100644 --- a/core/PhysiCell_cell.h +++ b/core/PhysiCell_cell.h @@ -262,7 +262,6 @@ void save_all_cells_to_matlab( std::string filename ); //function to check if a neighbor voxel contains any cell that can interact with me bool is_neighbor_voxel(Cell* pCell, std::vector myVoxelCenter, std::vector otherVoxelCenter, int otherVoxelIndex); -// bool is_neighbor_voxel(Cell* pCell, const std::vector& myVoxelCenter, const std::vector& otherVoxelCenter, int otherVoxelIndex); // Claude extern std::unordered_map cell_definitions_by_name; From cdccd724127422e3af4e28555a45ec480526ea72 Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Sat, 21 Feb 2026 12:15:03 -0500 Subject: [PATCH 08/13] add unit test --- .../config/PhysiCell_settings-backup.xml | 271 ++++++++++++++++++ .../config/PhysiCell_settings.xml | 250 ++++++++++++++++ .../mech_voxel_size/config/cell_000.csv | 2 + .../mech_voxel_size/config/cell_rules.csv | 0 .../config/test_mech_grid_size_20.xml | 250 ++++++++++++++++ .../config/test_mech_grid_size_25.xml | 250 ++++++++++++++++ .../config/test_mech_grid_size_30.xml | 250 ++++++++++++++++ .../mech_voxel_size/custom_modules/custom.cpp | 259 +++++++++++++++++ .../mech_voxel_size/custom_modules/custom.h | 92 ++++++ .../mech_voxel_size/custom_modules/empty.txt | 0 unit_tests/mech_voxel_size/main.cpp | 254 ++++++++++++++++ 11 files changed, 1878 insertions(+) create mode 100644 unit_tests/mech_voxel_size/config/PhysiCell_settings-backup.xml create mode 100644 unit_tests/mech_voxel_size/config/PhysiCell_settings.xml create mode 100644 unit_tests/mech_voxel_size/config/cell_000.csv create mode 100644 unit_tests/mech_voxel_size/config/cell_rules.csv create mode 100644 unit_tests/mech_voxel_size/config/test_mech_grid_size_20.xml create mode 100644 unit_tests/mech_voxel_size/config/test_mech_grid_size_25.xml create mode 100644 unit_tests/mech_voxel_size/config/test_mech_grid_size_30.xml create mode 100644 unit_tests/mech_voxel_size/custom_modules/custom.cpp create mode 100644 unit_tests/mech_voxel_size/custom_modules/custom.h create mode 100644 unit_tests/mech_voxel_size/custom_modules/empty.txt create mode 100644 unit_tests/mech_voxel_size/main.cpp diff --git a/unit_tests/mech_voxel_size/config/PhysiCell_settings-backup.xml b/unit_tests/mech_voxel_size/config/PhysiCell_settings-backup.xml new file mode 100644 index 000000000..e3cd03b4a --- /dev/null +++ b/unit_tests/mech_voxel_size/config/PhysiCell_settings-backup.xml @@ -0,0 +1,271 @@ + + + + -500 + 500 + -500 + 500 + -10 + 10 + 20 + 20 + 20 + true + + + + 14400 + min + micron + 0.01 + 0.1 + 6 + + + + 6 + + + + output + + 60 + true + + + 60 + true + + + false + + + + + false + true + + + + + + 100000.0 + 0.1 + + 38 + 0 + + 38 + 10 + 10 + 38 + 0 + 0 + + + + + 10 + .1 + + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + + + + + 10 + 0.1 + + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + + + + true + true + + ./config/initial.mat + + + ./config/dirichlet.mat + + + + + + + + + + 0.000 + + + + + 5.31667e-05 + + 516 + + + 0.05 + 0 + 1.66667e-02 + 5.83333e-03 + 0 + 2.0 + + + + 2.80E-03 + + 0 + 86400 + + + 1.11667e-2 + 8.33333e-4 + 5.33333e-5 + 2.16667e-3 + 0 + 2.0 + + + + + 2494 + 0.75 + 540 + 0.05 + 0.0045 + 0.0055 + 0 + 0 + 2.0 + + + 0.4 + 10.0 + 1.25 + + 1 + + + 1.8 + 15.12 + + 4.0 + 10.0 + 0.01 + 0.0 + 0.0 + + + 1 + 1 + .5 + + false + true + + false + oxygen + 1 + + + false + false + + 0.0 + 0.0 + 0.0 + + + + + + + 0 + 1 + 10 + 0 + + + 0.0 + 1 + 0.0 + 0.0 + + + 0.0 + 1 + 0.0 + 0.0 + + + + 0 + + 0 + 0 + + + 0 + 0 + + 1 + + 0 + 0 + + + + + 0 + 0 + + + + + 1.0 + + + + + + + ./config + cells.csv + + + + + + + ./config + cell_rules_v2.csv + + + + + + + + 0 + 0 + + \ No newline at end of file diff --git a/unit_tests/mech_voxel_size/config/PhysiCell_settings.xml b/unit_tests/mech_voxel_size/config/PhysiCell_settings.xml new file mode 100644 index 000000000..510217810 --- /dev/null +++ b/unit_tests/mech_voxel_size/config/PhysiCell_settings.xml @@ -0,0 +1,250 @@ + + + + -300.0 + 300.0 + -300.0 + 300.0 + -10.0 + 10.0 + 20.0 + 20.0 + 20.0 + true + + + + 2880 + min + micron + 0.01 + 0.1 + 6 + + + + 1 + + + + output_mech_voxel_30 + + 30 + true + + + 30 + true + + substrate + YlOrRd + 0 + 1 + + + + false + + + + + false + true + false + 0 + 30 + + + + + + 100000.0 + 10 + + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + + + + true + false + + ./config/initial.mat + + + ./config/dirichlet.mat + + + + + + + + + + 1388.88889 + + + 1.0 + + + + + 0 + + 516 + + + 0.05 + 0 + 1.66667e-02 + 5.83333e-03 + 0 + 2.0 + + + + 0.0 + + 0 + 86400 + + + 1.11667e-2 + 8.33333e-4 + 5.33333e-5 + 2.16667e-3 + 0 + 2.0 + + + + + 2494 + 0.75 + 540 + 0.05 + 0.0045 + 0.0055 + 0 + 0 + 2.0 + + + 0.4 + 10.0 + 1.25 + + 1 + + + 1.8 + 15.12 + + 0.01 + 0.0 + 0.0 + 12 + + + 1 + 1 + .5 + + false + true + + false + substrate + 1 + + + false + false + + 0.0 + + + + + + + 0 + 1 + 0 + 0 + + + + 0 + 0 + 0 + + 0 + + + 0 + + 1 + 0.1 + + 0 + + + + + 0 + + + + 0.0 + 0.0 + + + + 1.0 + + + + Volume + 4 + 2 + 100000 + + + apoptosis + 1e-6 + 1e-2 + + + + + + + + ./config + cell_000.csv + + + + + + + ./config + cell_rules.csv + + + + + + + 0 + + \ No newline at end of file diff --git a/unit_tests/mech_voxel_size/config/cell_000.csv b/unit_tests/mech_voxel_size/config/cell_000.csv new file mode 100644 index 000000000..b7ad7a8eb --- /dev/null +++ b/unit_tests/mech_voxel_size/config/cell_000.csv @@ -0,0 +1,2 @@ +x,y,z,type +0,0,0,default diff --git a/unit_tests/mech_voxel_size/config/cell_rules.csv b/unit_tests/mech_voxel_size/config/cell_rules.csv new file mode 100644 index 000000000..e69de29bb diff --git a/unit_tests/mech_voxel_size/config/test_mech_grid_size_20.xml b/unit_tests/mech_voxel_size/config/test_mech_grid_size_20.xml new file mode 100644 index 000000000..62df3c98f --- /dev/null +++ b/unit_tests/mech_voxel_size/config/test_mech_grid_size_20.xml @@ -0,0 +1,250 @@ + + + + -300.0 + 300.0 + -300.0 + 300.0 + -10.0 + 10.0 + 20.0 + 20.0 + 20.0 + true + + + + 2880 + min + micron + 0.01 + 0.1 + 6 + + + + 1 + + + + output_mech_voxel_20 + + 30 + true + + + 30 + true + + substrate + YlOrRd + 0 + 1 + + + + false + + + + + false + true + false + 0 + 20 + + + + + + 100000.0 + 10 + + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + + + + true + false + + ./config/initial.mat + + + ./config/dirichlet.mat + + + + + + + + + + 1388.88889 + + + 1.0 + + + + + 0 + + 516 + + + 0.05 + 0 + 1.66667e-02 + 5.83333e-03 + 0 + 2.0 + + + + 0.0 + + 0 + 86400 + + + 1.11667e-2 + 8.33333e-4 + 5.33333e-5 + 2.16667e-3 + 0 + 2.0 + + + + + 2494 + 0.75 + 540 + 0.05 + 0.0045 + 0.0055 + 0 + 0 + 2.0 + + + 0.4 + 10.0 + 1.25 + + 1 + + + 1.8 + 15.12 + + 0.01 + 0.0 + 0.0 + 12 + + + 1 + 1 + .5 + + false + true + + false + substrate + 1 + + + false + false + + 0.0 + + + + + + + 0 + 1 + 0 + 0 + + + + 0 + 0 + 0 + + 0 + + + 0 + + 1 + 0.1 + + 0 + + + + + 0 + + + + 0.0 + 0.0 + + + + 1.0 + + + + Volume + 4 + 2 + 100000 + + + apoptosis + 1e-6 + 1e-2 + + + + + + + + ./config + cell_000.csv + + + + + + + ./config + cell_rules.csv + + + + + + + 0 + + \ No newline at end of file diff --git a/unit_tests/mech_voxel_size/config/test_mech_grid_size_25.xml b/unit_tests/mech_voxel_size/config/test_mech_grid_size_25.xml new file mode 100644 index 000000000..1af8c6dbc --- /dev/null +++ b/unit_tests/mech_voxel_size/config/test_mech_grid_size_25.xml @@ -0,0 +1,250 @@ + + + + -300.0 + 300.0 + -300.0 + 300.0 + -10.0 + 10.0 + 20.0 + 20.0 + 20.0 + true + + + + 2880 + min + micron + 0.01 + 0.1 + 6 + + + + 1 + + + + output_mech_voxel_25 + + 30 + true + + + 30 + true + + substrate + YlOrRd + 0 + 1 + + + + false + + + + + false + true + false + 0 + 25 + + + + + + 100000.0 + 10 + + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + + + + true + false + + ./config/initial.mat + + + ./config/dirichlet.mat + + + + + + + + + + 1388.88889 + + + 1.0 + + + + + 0 + + 516 + + + 0.05 + 0 + 1.66667e-02 + 5.83333e-03 + 0 + 2.0 + + + + 0.0 + + 0 + 86400 + + + 1.11667e-2 + 8.33333e-4 + 5.33333e-5 + 2.16667e-3 + 0 + 2.0 + + + + + 2494 + 0.75 + 540 + 0.05 + 0.0045 + 0.0055 + 0 + 0 + 2.0 + + + 0.4 + 10.0 + 1.25 + + 1 + + + 1.8 + 15.12 + + 0.01 + 0.0 + 0.0 + 12 + + + 1 + 1 + .5 + + false + true + + false + substrate + 1 + + + false + false + + 0.0 + + + + + + + 0 + 1 + 0 + 0 + + + + 0 + 0 + 0 + + 0 + + + 0 + + 1 + 0.1 + + 0 + + + + + 0 + + + + 0.0 + 0.0 + + + + 1.0 + + + + Volume + 4 + 2 + 100000 + + + apoptosis + 1e-6 + 1e-2 + + + + + + + + ./config + cell_000.csv + + + + + + + ./config + cell_rules.csv + + + + + + + 0 + + \ No newline at end of file diff --git a/unit_tests/mech_voxel_size/config/test_mech_grid_size_30.xml b/unit_tests/mech_voxel_size/config/test_mech_grid_size_30.xml new file mode 100644 index 000000000..510217810 --- /dev/null +++ b/unit_tests/mech_voxel_size/config/test_mech_grid_size_30.xml @@ -0,0 +1,250 @@ + + + + -300.0 + 300.0 + -300.0 + 300.0 + -10.0 + 10.0 + 20.0 + 20.0 + 20.0 + true + + + + 2880 + min + micron + 0.01 + 0.1 + 6 + + + + 1 + + + + output_mech_voxel_30 + + 30 + true + + + 30 + true + + substrate + YlOrRd + 0 + 1 + + + + false + + + + + false + true + false + 0 + 30 + + + + + + 100000.0 + 10 + + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + + + + true + false + + ./config/initial.mat + + + ./config/dirichlet.mat + + + + + + + + + + 1388.88889 + + + 1.0 + + + + + 0 + + 516 + + + 0.05 + 0 + 1.66667e-02 + 5.83333e-03 + 0 + 2.0 + + + + 0.0 + + 0 + 86400 + + + 1.11667e-2 + 8.33333e-4 + 5.33333e-5 + 2.16667e-3 + 0 + 2.0 + + + + + 2494 + 0.75 + 540 + 0.05 + 0.0045 + 0.0055 + 0 + 0 + 2.0 + + + 0.4 + 10.0 + 1.25 + + 1 + + + 1.8 + 15.12 + + 0.01 + 0.0 + 0.0 + 12 + + + 1 + 1 + .5 + + false + true + + false + substrate + 1 + + + false + false + + 0.0 + + + + + + + 0 + 1 + 0 + 0 + + + + 0 + 0 + 0 + + 0 + + + 0 + + 1 + 0.1 + + 0 + + + + + 0 + + + + 0.0 + 0.0 + + + + 1.0 + + + + Volume + 4 + 2 + 100000 + + + apoptosis + 1e-6 + 1e-2 + + + + + + + + ./config + cell_000.csv + + + + + + + ./config + cell_rules.csv + + + + + + + 0 + + \ No newline at end of file diff --git a/unit_tests/mech_voxel_size/custom_modules/custom.cpp b/unit_tests/mech_voxel_size/custom_modules/custom.cpp new file mode 100644 index 000000000..a2e94b53d --- /dev/null +++ b/unit_tests/mech_voxel_size/custom_modules/custom.cpp @@ -0,0 +1,259 @@ +/* +############################################################################### +# If you use PhysiCell in your project, please cite PhysiCell and the version # +# number, such as below: # +# # +# We implemented and solved the model using PhysiCell (Version x.y.z) [1]. # +# # +# [1] A Ghaffarizadeh, R Heiland, SH Friedman, SM Mumenthaler, and P Macklin, # +# PhysiCell: an Open Source Physics-Based Cell Simulator for Multicellu- # +# lar Systems, PLoS Comput. Biol. 14(2): e1005991, 2018 # +# DOI: 10.1371/journal.pcbi.1005991 # +# # +# See VERSION.txt or call get_PhysiCell_version() to get the current version # +# x.y.z. Call display_citations() to get detailed information on all cite-# +# able software used in your PhysiCell application. # +# # +# Because PhysiCell extensively uses BioFVM, we suggest you also cite BioFVM # +# as below: # +# # +# We implemented and solved the model using PhysiCell (Version x.y.z) [1], # +# with BioFVM [2] to solve the transport equations. # +# # +# [1] A Ghaffarizadeh, R Heiland, SH Friedman, SM Mumenthaler, and P Macklin, # +# PhysiCell: an Open Source Physics-Based Cell Simulator for Multicellu- # +# lar Systems, PLoS Comput. Biol. 14(2): e1005991, 2018 # +# DOI: 10.1371/journal.pcbi.1005991 # +# # +# [2] A Ghaffarizadeh, SH Friedman, and P Macklin, BioFVM: an efficient para- # +# llelized diffusive transport solver for 3-D biological simulations, # +# Bioinformatics 32(8): 1256-8, 2016. DOI: 10.1093/bioinformatics/btv730 # +# # +############################################################################### +# # +# BSD 3-Clause License (see https://opensource.org/licenses/BSD-3-Clause) # +# # +# Copyright (c) 2015-2021, Paul Macklin and the PhysiCell Project # +# All rights reserved. # +# # +# Redistribution and use in source and binary forms, with or without # +# modification, are permitted provided that the following conditions are met: # +# # +# 1. Redistributions of source code must retain the above copyright notice, # +# this list of conditions and the following disclaimer. # +# # +# 2. Redistributions in binary form must reproduce the above copyright # +# notice, this list of conditions and the following disclaimer in the # +# documentation and/or other materials provided with the distribution. # +# # +# 3. Neither the name of the copyright holder nor the names of its # +# contributors may be used to endorse or promote products derived from this # +# software without specific prior written permission. # +# # +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE # +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # +# POSSIBILITY OF SUCH DAMAGE. # +# # +############################################################################### +*/ + +#include "./custom.h" + +void create_cell_types( void ) +{ + // set the random seed + if (parameters.ints.find_index("random_seed") != -1) + { + SeedRandom(parameters.ints("random_seed")); + } + + /* + Put any modifications to default cell definition here if you + want to have "inherited" by other cell types. + + This is a good place to set default functions. + */ + + initialize_default_cell_definition(); + cell_defaults.phenotype.secretion.sync_to_microenvironment( µenvironment ); + + cell_defaults.functions.volume_update_function = standard_volume_update_function; + cell_defaults.functions.update_velocity = standard_update_cell_velocity; + + cell_defaults.functions.update_migration_bias = NULL; + cell_defaults.functions.update_phenotype = NULL; // update_cell_and_death_parameters_O2_based; + cell_defaults.functions.custom_cell_rule = NULL; + cell_defaults.functions.contact_function = NULL; + + cell_defaults.functions.add_cell_basement_membrane_interactions = NULL; + cell_defaults.functions.calculate_distance_to_membrane = NULL; + + /* + This parses the cell definitions in the XML config file. + */ + + initialize_cell_definitions_from_pugixml(); + + /* + This builds the map of cell definitions and summarizes the setup. + */ + + build_cell_definitions_maps(); + + /* + This intializes cell signal and response dictionaries + */ + + setup_signal_behavior_dictionaries(); + + /* + Cell rule definitions + */ + + setup_cell_rules(); + + /* + Put any modifications to individual cell definitions here. + + This is a good place to set custom functions. + */ + + cell_defaults.functions.update_phenotype = phenotype_function; + cell_defaults.functions.custom_cell_rule = custom_function; + cell_defaults.functions.contact_function = contact_function; + + /* + This builds the map of cell definitions and summarizes the setup. + */ + + display_cell_definitions( std::cout ); + + return; +} + +void setup_microenvironment( void ) +{ + // set domain parameters + + // put any custom code to set non-homogeneous initial conditions or + // extra Dirichlet nodes here. + + // initialize BioFVM + + initialize_microenvironment(); + + return; +} + +void setup_tissue( void ) +{ + double Xmin = microenvironment.mesh.bounding_box[0]; + double Ymin = microenvironment.mesh.bounding_box[1]; + double Zmin = microenvironment.mesh.bounding_box[2]; + + double Xmax = microenvironment.mesh.bounding_box[3]; + double Ymax = microenvironment.mesh.bounding_box[4]; + double Zmax = microenvironment.mesh.bounding_box[5]; + + if( default_microenvironment_options.simulate_2D == true ) + { + Zmin = 0.0; + Zmax = 0.0; + } + + double Xrange = Xmax - Xmin; + double Yrange = Ymax - Ymin; + double Zrange = Zmax - Zmin; + + // create some of each type of cell + + Cell* pC; + + for( int k=0; k < cell_definitions_by_index.size() ; k++ ) + { + Cell_Definition* pCD = cell_definitions_by_index[k]; + std::cout << "Placing cells of type " << pCD->name << " ... " << std::endl; + for( int n = 0 ; n < parameters.ints("number_of_cells") ; n++ ) + { + std::vector position = {0,0,0}; + position[0] = Xmin + UniformRandom()*Xrange; + position[1] = Ymin + UniformRandom()*Yrange; + position[2] = Zmin + UniformRandom()*Zrange; + + pC = create_cell( *pCD ); + pC->assign_position( position ); + } + } + std::cout << std::endl; + + // load cells from your CSV file (if enabled) + load_cells_from_pugixml(); + + return; +} + +std::vector my_coloring_function( Cell* pCell ) +{ + + std::vector out = paint_by_number_cell_coloring(pCell); + + if( pCell->type_name == "tumor cell") + { + double damage = get_single_signal( pCell , "damage"); + double max_damage = 30; + int color = (int) round( 255.0 * damage / max_damage ); + if( color > 255 ) + { color = 255; } + + if( get_single_signal(pCell,"dead") < 0.5 ) + { + std::string blah = "rgb(" + std::to_string(color) + "," + std::to_string(color) + "," + std::to_string(255-color) + ")"; + out[0] = blah; + out[2] = blah; + out[3] = blah; + } + return out; + } + + if( pCell->type_name == "macrophage" ) + { out[0] = "orange"; out[2] = "orange" ; out[3] = "orange"; return out; } + + + if( pCell->type_name == "fast T cell" ) + { + std::string blah = "rgb(255,164,164)"; + if( get_single_signal(pCell, "attacking") > 0.5 ) + { blah = "rgb(196,0,0)"; } + out[0] = blah; out[2] = blah; out[3] = blah; + return out; + } + + if( pCell->type_name == "slow T cell" ) + { + std::string blah = "rgb(164,255,164)"; + if( get_single_signal(pCell, "attacking") > 0.5 ) + { blah = "rgb(0,128,0)"; } + out[0] = blah; out[2] = blah; out[3] = blah; + return out; + } + + + return out; +} + +void phenotype_function( Cell* pCell, Phenotype& phenotype, double dt ) +{ return; } + +void custom_function( Cell* pCell, Phenotype& phenotype , double dt ) +{ return; } + +void contact_function( Cell* pMe, Phenotype& phenoMe , Cell* pOther, Phenotype& phenoOther , double dt ) +{ return; } \ No newline at end of file diff --git a/unit_tests/mech_voxel_size/custom_modules/custom.h b/unit_tests/mech_voxel_size/custom_modules/custom.h new file mode 100644 index 000000000..0e6df8d02 --- /dev/null +++ b/unit_tests/mech_voxel_size/custom_modules/custom.h @@ -0,0 +1,92 @@ +/* +############################################################################### +# If you use PhysiCell in your project, please cite PhysiCell and the version # +# number, such as below: # +# # +# We implemented and solved the model using PhysiCell (Version x.y.z) [1]. # +# # +# [1] A Ghaffarizadeh, R Heiland, SH Friedman, SM Mumenthaler, and P Macklin, # +# PhysiCell: an Open Source Physics-Based Cell Simulator for Multicellu- # +# lar Systems, PLoS Comput. Biol. 14(2): e1005991, 2018 # +# DOI: 10.1371/journal.pcbi.1005991 # +# # +# See VERSION.txt or call get_PhysiCell_version() to get the current version # +# x.y.z. Call display_citations() to get detailed information on all cite-# +# able software used in your PhysiCell application. # +# # +# Because PhysiCell extensively uses BioFVM, we suggest you also cite BioFVM # +# as below: # +# # +# We implemented and solved the model using PhysiCell (Version x.y.z) [1], # +# with BioFVM [2] to solve the transport equations. # +# # +# [1] A Ghaffarizadeh, R Heiland, SH Friedman, SM Mumenthaler, and P Macklin, # +# PhysiCell: an Open Source Physics-Based Cell Simulator for Multicellu- # +# lar Systems, PLoS Comput. Biol. 14(2): e1005991, 2018 # +# DOI: 10.1371/journal.pcbi.1005991 # +# # +# [2] A Ghaffarizadeh, SH Friedman, and P Macklin, BioFVM: an efficient para- # +# llelized diffusive transport solver for 3-D biological simulations, # +# Bioinformatics 32(8): 1256-8, 2016. DOI: 10.1093/bioinformatics/btv730 # +# # +############################################################################### +# # +# BSD 3-Clause License (see https://opensource.org/licenses/BSD-3-Clause) # +# # +# Copyright (c) 2015-2021, Paul Macklin and the PhysiCell Project # +# All rights reserved. # +# # +# Redistribution and use in source and binary forms, with or without # +# modification, are permitted provided that the following conditions are met: # +# # +# 1. Redistributions of source code must retain the above copyright notice, # +# this list of conditions and the following disclaimer. # +# # +# 2. Redistributions in binary form must reproduce the above copyright # +# notice, this list of conditions and the following disclaimer in the # +# documentation and/or other materials provided with the distribution. # +# # +# 3. Neither the name of the copyright holder nor the names of its # +# contributors may be used to endorse or promote products derived from this # +# software without specific prior written permission. # +# # +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE # +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # +# POSSIBILITY OF SUCH DAMAGE. # +# # +############################################################################### +*/ + +#include "../core/PhysiCell.h" +#include "../modules/PhysiCell_standard_modules.h" + +using namespace BioFVM; +using namespace PhysiCell; + +// setup functions to help us along + +void create_cell_types( void ); +void setup_tissue( void ); + +// set up the BioFVM microenvironment +void setup_microenvironment( void ); + +// custom pathology coloring function + +std::vector my_coloring_function( Cell* ); + +// custom functions can go here + +void phenotype_function( Cell* pCell, Phenotype& phenotype, double dt ); +void custom_function( Cell* pCell, Phenotype& phenotype , double dt ); + +void contact_function( Cell* pMe, Phenotype& phenoMe , Cell* pOther, Phenotype& phenoOther , double dt ); + diff --git a/unit_tests/mech_voxel_size/custom_modules/empty.txt b/unit_tests/mech_voxel_size/custom_modules/empty.txt new file mode 100644 index 000000000..e69de29bb diff --git a/unit_tests/mech_voxel_size/main.cpp b/unit_tests/mech_voxel_size/main.cpp new file mode 100644 index 000000000..01f55c0a8 --- /dev/null +++ b/unit_tests/mech_voxel_size/main.cpp @@ -0,0 +1,254 @@ +/* +############################################################################### +# If you use PhysiCell in your project, please cite PhysiCell and the version # +# number, such as below: # +# # +# We implemented and solved the model using PhysiCell (Version x.y.z) [1]. # +# # +# [1] A Ghaffarizadeh, R Heiland, SH Friedman, SM Mumenthaler, and P Macklin, # +# PhysiCell: an Open Source Physics-Based Cell Simulator for Multicellu- # +# lar Systems, PLoS Comput. Biol. 14(2): e1005991, 2018 # +# DOI: 10.1371/journal.pcbi.1005991 # +# # +# See VERSION.txt or call get_PhysiCell_version() to get the current version # +# x.y.z. Call display_citations() to get detailed information on all cite-# +# able software used in your PhysiCell application. # +# # +# Because PhysiCell extensively uses BioFVM, we suggest you also cite BioFVM # +# as below: # +# # +# We implemented and solved the model using PhysiCell (Version x.y.z) [1], # +# with BioFVM [2] to solve the transport equations. # +# # +# [1] A Ghaffarizadeh, R Heiland, SH Friedman, SM Mumenthaler, and P Macklin, # +# PhysiCell: an Open Source Physics-Based Cell Simulator for Multicellu- # +# lar Systems, PLoS Comput. Biol. 14(2): e1005991, 2018 # +# DOI: 10.1371/journal.pcbi.1005991 # +# # +# [2] A Ghaffarizadeh, SH Friedman, and P Macklin, BioFVM: an efficient para- # +# llelized diffusive transport solver for 3-D biological simulations, # +# Bioinformatics 32(8): 1256-8, 2016. DOI: 10.1093/bioinformatics/btv730 # +# # +############################################################################### +# # +# BSD 3-Clause License (see https://opensource.org/licenses/BSD-3-Clause) # +# # +# Copyright (c) 2015-2022, Paul Macklin and the PhysiCell Project # +# All rights reserved. # +# # +# Redistribution and use in source and binary forms, with or without # +# modification, are permitted provided that the following conditions are met: # +# # +# 1. Redistributions of source code must retain the above copyright notice, # +# this list of conditions and the following disclaimer. # +# # +# 2. Redistributions in binary form must reproduce the above copyright # +# notice, this list of conditions and the following disclaimer in the # +# documentation and/or other materials provided with the distribution. # +# # +# 3. Neither the name of the copyright holder nor the names of its # +# contributors may be used to endorse or promote products derived from this # +# software without specific prior written permission. # +# # +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE # +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # +# POSSIBILITY OF SUCH DAMAGE. # +# # +############################################################################### +*/ + +#include +#include +#include +#include +#include +#include +#include + +#include "./core/PhysiCell.h" +#include "./modules/PhysiCell_standard_modules.h" + +// put custom code modules here! + +#include "./custom_modules/custom.h" + +using namespace BioFVM; +using namespace PhysiCell; + +int main( int argc, char* argv[] ) +{ + // load and parse settings file(s) + + bool XML_status = false; + char copy_command [1024]; + if( argc > 1 ) + { + XML_status = load_PhysiCell_config_file( argv[1] ); + sprintf( copy_command , "cp %s %s" , argv[1] , PhysiCell_settings.folder.c_str() ); + } + else + { + XML_status = load_PhysiCell_config_file( "./config/PhysiCell_settings.xml" ); + sprintf( copy_command , "cp ./config/PhysiCell_settings.xml %s" , PhysiCell_settings.folder.c_str() ); + } + if( !XML_status ) + { exit(-1); } + + // copy config file to output directry + system( copy_command ); + + // OpenMP setup + omp_set_num_threads(PhysiCell_settings.omp_num_threads); + + // time setup + std::string time_units = "min"; + + /* Microenvironment setup */ + + setup_microenvironment(); // modify this in the custom code + + /* PhysiCell setup */ + + // set mechanics voxel size, and match the data structure to BioFVM + double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; + std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; + Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); + + /* Users typically start modifying here. START USERMODS */ + + create_cell_types(); + + setup_tissue(); + + /* Users typically stop modifying here. END USERMODS */ + + // set MultiCellDS save options + + set_save_biofvm_mesh_as_matlab( true ); + set_save_biofvm_data_as_matlab( true ); + set_save_biofvm_cell_data( true ); + set_save_biofvm_cell_data_as_custom_matlab( true ); + + // save a simulation snapshot + + char filename[1024]; + sprintf( filename , "%s/initial" , PhysiCell_settings.folder.c_str() ); + save_PhysiCell_to_MultiCellDS_v2( filename , microenvironment , PhysiCell_globals.current_time ); + + // save a quick SVG cross section through z = 0, after setting its + // length bar to 200 microns + + PhysiCell_SVG_options.length_bar = 200; + + // for simplicity, set a pathology coloring function + + std::vector (*cell_coloring_function)(Cell*) = my_coloring_function; + + sprintf( filename , "%s/initial.svg" , PhysiCell_settings.folder.c_str() ); + SVG_plot( filename , microenvironment, 0.0 , PhysiCell_globals.current_time, cell_coloring_function ); + + sprintf( filename , "%s/legend.svg" , PhysiCell_settings.folder.c_str() ); + create_plot_legend( filename , cell_coloring_function ); + + display_citations(); + + // set the performance timers + + BioFVM::RUNTIME_TIC(); + BioFVM::TIC(); + + std::ofstream report_file; + if( PhysiCell_settings.enable_legacy_saves == true ) + { + sprintf( filename , "%s/simulation_report.txt" , PhysiCell_settings.folder.c_str() ); + + report_file.open(filename); // create the data log file + report_file<<"simulated time\tnum cells\tnum division\tnum death\twall time"< PhysiCell_globals.next_full_save_time - 0.5 * diffusion_dt ) + { + display_simulation_status( std::cout ); + if( PhysiCell_settings.enable_legacy_saves == true ) + { + log_output( PhysiCell_globals.current_time , PhysiCell_globals.full_output_index, microenvironment, report_file); + } + + if( PhysiCell_settings.enable_full_saves == true ) + { + sprintf( filename , "%s/output%08u" , PhysiCell_settings.folder.c_str(), PhysiCell_globals.full_output_index ); + + save_PhysiCell_to_MultiCellDS_v2( filename , microenvironment , PhysiCell_globals.current_time ); + } + + PhysiCell_globals.full_output_index++; + PhysiCell_globals.next_full_save_time += PhysiCell_settings.full_save_interval; + } + + // save SVG plot if it's time + if( PhysiCell_globals.current_time > PhysiCell_globals.next_SVG_save_time - 0.5 * diffusion_dt ) + { + if( PhysiCell_settings.enable_SVG_saves == true ) + { + sprintf( filename , "%s/snapshot%08u.svg" , PhysiCell_settings.folder.c_str() , PhysiCell_globals.SVG_output_index ); + SVG_plot( filename , microenvironment, 0.0 , PhysiCell_globals.current_time, cell_coloring_function ); + + PhysiCell_globals.SVG_output_index++; + PhysiCell_globals.next_SVG_save_time += PhysiCell_settings.SVG_save_interval; + } + } + + // update the microenvironment + // microenvironment.simulate_diffusion_decay( diffusion_dt ); + + // run PhysiCell + ((Cell_Container *)microenvironment.agent_container)->update_all_cells( PhysiCell_globals.current_time ); + + /* + Custom add-ons could potentially go here. + */ + + PhysiCell_globals.current_time += diffusion_dt; + } + + if( PhysiCell_settings.enable_legacy_saves == true ) + { + log_output(PhysiCell_globals.current_time, PhysiCell_globals.full_output_index, microenvironment, report_file); + report_file.close(); + } + } + catch( const std::exception& e ) + { // reference to the base of a polymorphic object + std::cout << e.what(); // information from length_error printed + } + + // save a final simulation snapshot + + sprintf( filename , "%s/final" , PhysiCell_settings.folder.c_str() ); + save_PhysiCell_to_MultiCellDS_v2( filename , microenvironment , PhysiCell_globals.current_time ); + + sprintf( filename , "%s/final.svg" , PhysiCell_settings.folder.c_str() ); + SVG_plot( filename , microenvironment, 0.0 , PhysiCell_globals.current_time, cell_coloring_function ); + + // timer + + std::cout << std::endl << "Total simulation runtime: " << std::endl; + BioFVM::display_stopwatch_value( std::cout , BioFVM::runtime_stopwatch_value() ); + + return 0; +} From 954504ee2c461a4f874b7f44ca3a8652bc8cf0ad Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Sat, 21 Feb 2026 18:36:55 -0500 Subject: [PATCH 09/13] add Makefile --- user_projects/mech_voxel_size/Makefile | 323 +++++++++++++++++++++++++ 1 file changed, 323 insertions(+) create mode 100644 user_projects/mech_voxel_size/Makefile diff --git a/user_projects/mech_voxel_size/Makefile b/user_projects/mech_voxel_size/Makefile new file mode 100644 index 000000000..7aa7d18d2 --- /dev/null +++ b/user_projects/mech_voxel_size/Makefile @@ -0,0 +1,323 @@ +VERSION := $(shell grep . VERSION.txt | cut -f1 -d:) +PROGRAM_NAME := project + +CC := g++ +# CC := g++-mp-7 # typical macports compiler name +# CC := g++-7 # typical homebrew compiler name + +# Check for environment definitions of compiler +# e.g., on CC = g++-7 on OSX +ifdef PHYSICELL_CPP + CC := $(PHYSICELL_CPP) +endif + +ifndef STATIC_OPENMP + STATIC_OPENMP = -fopenmp +endif + +ARCH := native # best auto-tuning +# ARCH := core2 # a reasonably safe default for most CPUs since 2007 +# ARCH := corei7 +# ARCH := corei7-avx # earlier i7 +# ARCH := core-avx-i # i7 ivy bridge or newer +# ARCH := core-avx2 # i7 with Haswell or newer +# ARCH := nehalem +# ARCH := westmere +# ARCH := sandybridge # circa 2011 +# ARCH := ivybridge # circa 2012 +# ARCH := haswell # circa 2013 +# ARCH := broadwell # circa 2014 +# ARCH := skylake # circa 2015 +# ARCH := bonnell +# ARCH := silvermont +# ARCH := skylake-avx512 +# ARCH := nocona #64-bit pentium 4 or later + +# CFLAGS := -march=$(ARCH) -Ofast -s -fomit-frame-pointer -mfpmath=both -fopenmp -m64 -std=c++11 +CFLAGS := -march=$(ARCH) -O3 -fomit-frame-pointer -mfpmath=both -fopenmp -m64 -std=c++11 + +ifeq ($(OS),Windows_NT) +else + UNAME_S := $(shell uname -s) + ifeq ($(UNAME_S),Darwin) + UNAME_P := $(shell uname -p) + var := $(shell which $(CC) | xargs file) + ifeq ($(lastword $(var)),arm64) + CFLAGS := -march=$(ARCH) -O3 -fomit-frame-pointer -fopenmp -m64 -std=c++11 + endif + endif +endif + +CFLAGS_LINK := $(shell echo $(CFLAGS) | sed -e "s/-fopenmp//g") +COMPILE_COMMAND := $(CC) $(CFLAGS) $(EXTRA_FLAGS) +LINK_COMMAND := $(CC) $(CFLAGS_LINK) $(EXTRA_FLAGS) + +BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ +BioFVM_utilities.o BioFVM_basic_agent.o BioFVM_MultiCellDS.o BioFVM_agent_container.o + +PhysiCell_core_OBJECTS := PhysiCell_phenotype.o PhysiCell_cell_container.o PhysiCell_standard_models.o \ +PhysiCell_cell.o PhysiCell_custom.o PhysiCell_utilities.o PhysiCell_constants.o PhysiCell_basic_signaling.o \ +PhysiCell_signal_behavior.o PhysiCell_rules.o + +PhysiCell_module_OBJECTS := PhysiCell_SVG.o PhysiCell_pathology.o PhysiCell_MultiCellDS.o PhysiCell_various_outputs.o \ +PhysiCell_pugixml.o PhysiCell_settings.o PhysiCell_geometry.o + +# put your custom objects here (they should be in the custom_modules directory) + +PhysiCell_custom_module_OBJECTS := custom.o + +pugixml_OBJECTS := pugixml.o + +PhysiCell_OBJECTS := $(BioFVM_OBJECTS) $(pugixml_OBJECTS) $(PhysiCell_core_OBJECTS) $(PhysiCell_module_OBJECTS) +ALL_OBJECTS := $(PhysiCell_OBJECTS) $(PhysiCell_custom_module_OBJECTS) + +# compile the project + +all: main.cpp $(ALL_OBJECTS) + $(COMPILE_COMMAND) -o $(PROGRAM_NAME) $(ALL_OBJECTS) main.cpp + make name + +static: main.cpp $(ALL_OBJECTS) $(MaBoSS) + $(LINK_COMMAND) $(INC) -o $(PROGRAM_NAME) $(ALL_OBJECTS) main.cpp $(LIB) -static-libgcc -static-libstdc++ $(STATIC_OPENMP) + +name: + @echo "" + @echo "Executable name is" $(PROGRAM_NAME) + @echo "" + +# PhysiCell core components + +PhysiCell_phenotype.o: ./core/PhysiCell_phenotype.cpp + $(COMPILE_COMMAND) -c ./core/PhysiCell_phenotype.cpp + +PhysiCell_digital_cell_line.o: ./core/PhysiCell_digital_cell_line.cpp + $(COMPILE_COMMAND) -c ./core/PhysiCell_digital_cell_line.cpp + +PhysiCell_cell.o: ./core/PhysiCell_cell.cpp + $(COMPILE_COMMAND) -c ./core/PhysiCell_cell.cpp + +PhysiCell_cell_container.o: ./core/PhysiCell_cell_container.cpp + $(COMPILE_COMMAND) -c ./core/PhysiCell_cell_container.cpp + +PhysiCell_standard_models.o: ./core/PhysiCell_standard_models.cpp + $(COMPILE_COMMAND) -c ./core/PhysiCell_standard_models.cpp + +PhysiCell_utilities.o: ./core/PhysiCell_utilities.cpp + $(COMPILE_COMMAND) -c ./core/PhysiCell_utilities.cpp + +PhysiCell_custom.o: ./core/PhysiCell_custom.cpp + $(COMPILE_COMMAND) -c ./core/PhysiCell_custom.cpp + +PhysiCell_constants.o: ./core/PhysiCell_constants.cpp + $(COMPILE_COMMAND) -c ./core/PhysiCell_constants.cpp + +PhysiCell_signal_behavior.o: ./core/PhysiCell_signal_behavior.cpp + $(COMPILE_COMMAND) -c ./core/PhysiCell_signal_behavior.cpp + +PhysiCell_rules.o: ./core/PhysiCell_rules.cpp + $(COMPILE_COMMAND) -c ./core/PhysiCell_rules.cpp + +# BioFVM core components (needed by PhysiCell) + +BioFVM_vector.o: ./BioFVM/BioFVM_vector.cpp + $(COMPILE_COMMAND) -c ./BioFVM/BioFVM_vector.cpp + +BioFVM_agent_container.o: ./BioFVM/BioFVM_agent_container.cpp + $(COMPILE_COMMAND) -c ./BioFVM/BioFVM_agent_container.cpp + +BioFVM_mesh.o: ./BioFVM/BioFVM_mesh.cpp + $(COMPILE_COMMAND) -c ./BioFVM/BioFVM_mesh.cpp + +BioFVM_microenvironment.o: ./BioFVM/BioFVM_microenvironment.cpp + $(COMPILE_COMMAND) -c ./BioFVM/BioFVM_microenvironment.cpp + +BioFVM_solvers.o: ./BioFVM/BioFVM_solvers.cpp + $(COMPILE_COMMAND) -c ./BioFVM/BioFVM_solvers.cpp + +BioFVM_utilities.o: ./BioFVM/BioFVM_utilities.cpp + $(COMPILE_COMMAND) -c ./BioFVM/BioFVM_utilities.cpp + +BioFVM_basic_agent.o: ./BioFVM/BioFVM_basic_agent.cpp + $(COMPILE_COMMAND) -c ./BioFVM/BioFVM_basic_agent.cpp + +BioFVM_matlab.o: ./BioFVM/BioFVM_matlab.cpp + $(COMPILE_COMMAND) -c ./BioFVM/BioFVM_matlab.cpp + +BioFVM_MultiCellDS.o: ./BioFVM/BioFVM_MultiCellDS.cpp + $(COMPILE_COMMAND) -c ./BioFVM/BioFVM_MultiCellDS.cpp + +pugixml.o: ./BioFVM/pugixml.cpp + $(COMPILE_COMMAND) -c ./BioFVM/pugixml.cpp + +# standard PhysiCell modules + +PhysiCell_SVG.o: ./modules/PhysiCell_SVG.cpp + $(COMPILE_COMMAND) -c ./modules/PhysiCell_SVG.cpp + +PhysiCell_pathology.o: ./modules/PhysiCell_pathology.cpp + $(COMPILE_COMMAND) -c ./modules/PhysiCell_pathology.cpp + +PhysiCell_MultiCellDS.o: ./modules/PhysiCell_MultiCellDS.cpp + $(COMPILE_COMMAND) -c ./modules/PhysiCell_MultiCellDS.cpp + +PhysiCell_various_outputs.o: ./modules/PhysiCell_various_outputs.cpp + $(COMPILE_COMMAND) -c ./modules/PhysiCell_various_outputs.cpp + +PhysiCell_pugixml.o: ./modules/PhysiCell_pugixml.cpp + $(COMPILE_COMMAND) -c ./modules/PhysiCell_pugixml.cpp + +PhysiCell_settings.o: ./modules/PhysiCell_settings.cpp + $(COMPILE_COMMAND) -c ./modules/PhysiCell_settings.cpp + +PhysiCell_basic_signaling.o: ./core/PhysiCell_basic_signaling.cpp + $(COMPILE_COMMAND) -c ./core/PhysiCell_basic_signaling.cpp + +PhysiCell_geometry.o: ./modules/PhysiCell_geometry.cpp + $(COMPILE_COMMAND) -c ./modules/PhysiCell_geometry.cpp + +# user-defined PhysiCell modules + +custom.o: ./custom_modules/custom.cpp + $(COMPILE_COMMAND) -c ./custom_modules/custom.cpp + +# cleanup + +reset: + rm -f *.cpp + cp ./sample_projects/Makefile-default Makefile + rm -f ./custom_modules/* + touch ./custom_modules/empty.txt + touch ALL_CITATIONS.txt + touch ./core/PhysiCell_cell.cpp + rm ALL_CITATIONS.txt + cp ./config/PhysiCell_settings-backup.xml ./config/PhysiCell_settings.xml + touch ./config/empty.csv + rm -f ./config/*.csv + +clean: + rm -f *.o + rm -f $(PROGRAM_NAME)* + +data-cleanup: + rm -rf ./output + mkdir ./output + touch ./output/empty.txt + +# archival + +checkpoint: + zip -r $$(date +%b_%d_%Y_%H%M).zip Makefile *.cpp *.h config/*.xml custom_modules/* + +zip: + zip -r latest.zip Makefile* *.cpp *.h BioFVM/* config/* core/* custom_modules/* matlab/* modules/* sample_projects/* + cp latest.zip $$(date +%b_%d_%Y_%H%M).zip + cp latest.zip VERSION_$(VERSION).zip + mv *.zip archives/ + +tar: + tar --ignore-failed-read -czf latest.tar Makefile* *.cpp *.h BioFVM/* config/* core/* custom_modules/* matlab/* modules/* sample_projects/* + cp latest.tar $$(date +%b_%d_%Y_%H%M).tar + cp latest.tar VERSION_$(VERSION).tar + mv *.tar archives/ + +unzip: + cp ./archives/latest.zip . + unzip latest.zip + +untar: + cp ./archives/latest.tar . + tar -xzf latest.tar + +# easier animation + +FRAMERATE := 24 +OUTPUT := output + +jpeg: + @magick identify -format "%h" $(OUTPUT)/initial.svg > __H.txt + @magick identify -format "%w" $(OUTPUT)/initial.svg > __W.txt + @expr 2 \* \( $$(grep . __H.txt) / 2 \) > __H1.txt + @expr 2 \* \( $$(grep . __W.txt) / 2 \) > __W1.txt + @echo "$$(grep . __W1.txt)!x$$(grep . __H1.txt)!" > __resize.txt + @magick mogrify -format jpg -resize $$(grep . __resize.txt) $(OUTPUT)/s*.svg + rm -f __H*.txt __W*.txt __resize.txt + +gif: + magick convert $(OUTPUT)/s*.svg $(OUTPUT)/out.gif + +movie: + ffmpeg -r $(FRAMERATE) -f image2 -i $(OUTPUT)/snapshot%08d.jpg -vcodec libx264 -pix_fmt yuv420p -strict -2 -tune animation -crf 15 -acodec none $(OUTPUT)/out.mp4 + +# upgrade rules + +SOURCE := PhysiCell_upgrade.zip +get-upgrade: + @echo $$(curl https://raw.githubusercontent.com/MathCancer/PhysiCell/master/VERSION.txt) > VER.txt + @echo https://github.com/MathCancer/PhysiCell/releases/download/$$(grep . VER.txt)/PhysiCell_V.$$(grep . VER.txt).zip > DL_FILE.txt + rm -f VER.txt + $$(curl -L $$(grep . DL_FILE.txt) --output PhysiCell_upgrade.zip) + rm -f DL_FILE.txt + +PhysiCell_upgrade.zip: + make get-upgrade + +upgrade: $(SOURCE) + unzip $(SOURCE) PhysiCell/VERSION.txt + mv -f PhysiCell/VERSION.txt . + unzip $(SOURCE) PhysiCell/core/* + cp -r PhysiCell/core/* core + unzip $(SOURCE) PhysiCell/modules/* + cp -r PhysiCell/modules/* modules + unzip $(SOURCE) PhysiCell/sample_projects/* + cp -r PhysiCell/sample_projects/* sample_projects + unzip $(SOURCE) PhysiCell/BioFVM/* + cp -r PhysiCell/BioFVM/* BioFVM + unzip $(SOURCE) PhysiCell/documentation/User_Guide.pdf + mv -f PhysiCell/documentation/User_Guide.pdf documentation + rm -f -r PhysiCell + rm -f $(SOURCE) + +# use: make save PROJ=your_project_name +PROJ := my_project + +save: + echo "Saving project as $(PROJ) ... " + mkdir -p ./user_projects + mkdir -p ./user_projects/$(PROJ) + mkdir -p ./user_projects/$(PROJ)/custom_modules + mkdir -p ./user_projects/$(PROJ)/config + cp main.cpp ./user_projects/$(PROJ) + cp Makefile ./user_projects/$(PROJ) + cp VERSION.txt ./user_projects/$(PROJ) + cp ./config/* ./user_projects/$(PROJ)/config + cp ./custom_modules/* ./user_projects/$(PROJ)/custom_modules + +load: + echo "Loading project from $(PROJ) ... " + cp ./user_projects/$(PROJ)/main.cpp . + cp ./user_projects/$(PROJ)/Makefile . + cp ./user_projects/$(PROJ)/config/* ./config/ + cp ./user_projects/$(PROJ)/custom_modules/* ./custom_modules/ + +pack: + @echo " " + @echo "Preparing project $(PROJ) for sharing ... " + @echo " " + cd ./user_projects && zip -r $(PROJ).zip $(PROJ) + @echo " " + @echo "Share ./user_projects/$(PROJ).zip ... " + @echo "Other users can unzip $(PROJ).zip in their ./user_projects, compile, and run." + @echo " " + +unpack: + @echo " " + @echo "Preparing shared project $(PROJ).zip for use ... " + @echo " " + cd ./user_projects && unzip $(PROJ).zip + @echo " " + @echo "Load this project via make load PROJ=$(PROJ) ... " + @echo " " + +list-user-projects: + @echo "user projects::" + @cd ./user_projects && ls -dt1 * | grep . | sed 's!empty.txt!!' From b8ee96b640b84ba43af9b02b952941be3d70a32f Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Sun, 22 Feb 2026 15:47:51 -0500 Subject: [PATCH 10/13] test case with missing param --- .../config/test_mech_grid_size_missing.xml | 249 ++++++++++++++++++ 1 file changed, 249 insertions(+) create mode 100644 unit_tests/mech_voxel_size/config/test_mech_grid_size_missing.xml diff --git a/unit_tests/mech_voxel_size/config/test_mech_grid_size_missing.xml b/unit_tests/mech_voxel_size/config/test_mech_grid_size_missing.xml new file mode 100644 index 000000000..adebf82c4 --- /dev/null +++ b/unit_tests/mech_voxel_size/config/test_mech_grid_size_missing.xml @@ -0,0 +1,249 @@ + + + + -300.0 + 300.0 + -300.0 + 300.0 + -10.0 + 10.0 + 20.0 + 20.0 + 20.0 + true + + + + 2880 + min + micron + 0.01 + 0.1 + 6 + + + + 1 + + + + output_mech_voxel_missing + + 30 + true + + + 30 + true + + substrate + YlOrRd + 0 + 1 + + + + false + + + + + false + true + false + 0 + + + + + + 100000.0 + 10 + + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + + + + true + false + + ./config/initial.mat + + + ./config/dirichlet.mat + + + + + + + + + + 1388.88889 + + + 1.0 + + + + + 0 + + 516 + + + 0.05 + 0 + 1.66667e-02 + 5.83333e-03 + 0 + 2.0 + + + + 0.0 + + 0 + 86400 + + + 1.11667e-2 + 8.33333e-4 + 5.33333e-5 + 2.16667e-3 + 0 + 2.0 + + + + + 2494 + 0.75 + 540 + 0.05 + 0.0045 + 0.0055 + 0 + 0 + 2.0 + + + 0.4 + 10.0 + 1.25 + + 1 + + + 1.8 + 15.12 + + 0.01 + 0.0 + 0.0 + 12 + + + 1 + 1 + .5 + + false + true + + false + substrate + 1 + + + false + false + + 0.0 + + + + + + + 0 + 1 + 0 + 0 + + + + 0 + 0 + 0 + + 0 + + + 0 + + 1 + 0.1 + + 0 + + + + + 0 + + + + 0.0 + 0.0 + + + + 1.0 + + + + Volume + 4 + 2 + 100000 + + + apoptosis + 1e-6 + 1e-2 + + + + + + + + ./config + cell_000.csv + + + + + + + ./config + cell_rules.csv + + + + + + + 0 + + \ No newline at end of file From 828b6be6e6b205a3d8e187b651c780555c35de52 Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Sun, 22 Feb 2026 15:50:27 -0500 Subject: [PATCH 11/13] remove mechanics_voxel_size --- core/PhysiCell_constants.cpp | 1 - core/PhysiCell_constants.h | 1 - 2 files changed, 2 deletions(-) diff --git a/core/PhysiCell_constants.cpp b/core/PhysiCell_constants.cpp index 0673191f7..da001e1e0 100644 --- a/core/PhysiCell_constants.cpp +++ b/core/PhysiCell_constants.cpp @@ -76,7 +76,6 @@ double mechanics_dt = 0.1; double phenotype_dt = 6.0; double intracellular_dt = 0.01; -double mechanics_voxel_size = 30.0; // currently recognized cell cycle models const int PhysiCell_constants::advanced_Ki67_cycle_model= 0; diff --git a/core/PhysiCell_constants.h b/core/PhysiCell_constants.h index a711d2ebd..9287c4213 100644 --- a/core/PhysiCell_constants.h +++ b/core/PhysiCell_constants.h @@ -157,7 +157,6 @@ extern double diffusion_dt; extern double mechanics_dt; extern double phenotype_dt; extern double intracellular_dt; -extern double mechanics_voxel_size; extern std::unordered_map cycle_model_codes; From cbdbb41851dc986e39cab9a8b0bebf3e11511d79 Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Sun, 22 Feb 2026 16:15:33 -0500 Subject: [PATCH 12/13] remove cout of mechanics_voxel_size --- sample_projects/asymmetric_division/main.cpp | 4 +--- sample_projects/biorobots/main.cpp | 4 +--- sample_projects/cancer_biorobots/main.cpp | 4 +--- sample_projects/cancer_immune/main-cancer_immune_3D.cpp | 4 +--- sample_projects/celltypes3/main.cpp | 4 +--- sample_projects/custom_division/main.cpp | 4 +--- sample_projects/episode/main.cpp | 7 ++----- sample_projects/heterogeneity/main.cpp | 4 +--- sample_projects/immune_function/main.cpp | 4 +--- sample_projects/interactions/main.cpp | 4 +--- sample_projects/mechano/main.cpp | 4 +--- sample_projects/physimess/main.cpp | 4 +--- sample_projects/pred_prey_farmer/main.cpp | 4 +--- sample_projects/rules_sample/main.cpp | 4 +--- sample_projects/template/main.cpp | 4 +--- sample_projects/virus_macrophage/main.cpp | 4 +--- sample_projects/worm/main.cpp | 4 +--- sample_projects_intracellular/ode/ode_energy/main.cpp | 4 +--- unit_tests/mech_voxel_size/main.cpp | 4 +--- 19 files changed, 20 insertions(+), 59 deletions(-) diff --git a/sample_projects/asymmetric_division/main.cpp b/sample_projects/asymmetric_division/main.cpp index f0bd5f674..965717e9b 100644 --- a/sample_projects/asymmetric_division/main.cpp +++ b/sample_projects/asymmetric_division/main.cpp @@ -118,9 +118,7 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; - std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; - Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); + Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, PhysiCell_settings.mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects/biorobots/main.cpp b/sample_projects/biorobots/main.cpp index 3a2144d39..2a83fe921 100644 --- a/sample_projects/biorobots/main.cpp +++ b/sample_projects/biorobots/main.cpp @@ -118,9 +118,7 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; - std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; - Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); + Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, PhysiCell_settings.mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects/cancer_biorobots/main.cpp b/sample_projects/cancer_biorobots/main.cpp index e4fc93e86..a2b015fe0 100644 --- a/sample_projects/cancer_biorobots/main.cpp +++ b/sample_projects/cancer_biorobots/main.cpp @@ -118,9 +118,7 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; - std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; - Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); + Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, PhysiCell_settings.mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects/cancer_immune/main-cancer_immune_3D.cpp b/sample_projects/cancer_immune/main-cancer_immune_3D.cpp index d31138aa3..99950d6a6 100644 --- a/sample_projects/cancer_immune/main-cancer_immune_3D.cpp +++ b/sample_projects/cancer_immune/main-cancer_immune_3D.cpp @@ -121,9 +121,7 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; - std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; - Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); + Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, PhysiCell_settings.mechanics_voxel_size ); create_cell_types(); setup_tissue(); diff --git a/sample_projects/celltypes3/main.cpp b/sample_projects/celltypes3/main.cpp index e0b95fcbe..c42a2f843 100644 --- a/sample_projects/celltypes3/main.cpp +++ b/sample_projects/celltypes3/main.cpp @@ -108,9 +108,7 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; - std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; - Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); + Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, PhysiCell_settings.mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects/custom_division/main.cpp b/sample_projects/custom_division/main.cpp index 5d8cdf246..965717e9b 100644 --- a/sample_projects/custom_division/main.cpp +++ b/sample_projects/custom_division/main.cpp @@ -118,9 +118,7 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; - std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; - Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); + Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, PhysiCell_settings.mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects/episode/main.cpp b/sample_projects/episode/main.cpp index e4d40c20d..a9f57c4f0 100644 --- a/sample_projects/episode/main.cpp +++ b/sample_projects/episode/main.cpp @@ -141,9 +141,7 @@ int main( int argc, char* argv[] ) // setup microenviroment and mechanics voxel size and match the data structure to BioFVM std::cout << "set densities ..." << std::endl; setup_microenvironment(); // modify this in the custom code - double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; - std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; - Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); + Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, PhysiCell_settings.mechanics_voxel_size ); // load cell type definition and setup tisse std::cout << "load cell type definition and setup tissue ..." << std::endl; @@ -187,8 +185,7 @@ int main( int argc, char* argv[] ) std::cout << "reset densities ..." << std::endl; set_microenvironment_initial_condition(); microenvironment.display_information( std::cout ); - double mechanics_voxel_size = 30; - Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); + Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, PhysiCell_settings.mechanics_voxel_size ); // reset tissue std::cout << "reset tissue ..." << std::endl; diff --git a/sample_projects/heterogeneity/main.cpp b/sample_projects/heterogeneity/main.cpp index 089e48023..63b14b03e 100644 --- a/sample_projects/heterogeneity/main.cpp +++ b/sample_projects/heterogeneity/main.cpp @@ -118,9 +118,7 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; - std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; - Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); + Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, PhysiCell_settings.mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects/immune_function/main.cpp b/sample_projects/immune_function/main.cpp index c07c64e92..835779485 100644 --- a/sample_projects/immune_function/main.cpp +++ b/sample_projects/immune_function/main.cpp @@ -118,9 +118,7 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; - std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; - Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); + Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, PhysiCell_settings.mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects/interactions/main.cpp b/sample_projects/interactions/main.cpp index a20d51f21..4249e1610 100644 --- a/sample_projects/interactions/main.cpp +++ b/sample_projects/interactions/main.cpp @@ -118,9 +118,7 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; - std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; - Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); + Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, PhysiCell_settings.mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects/mechano/main.cpp b/sample_projects/mechano/main.cpp index 68a86fca7..104f9969b 100644 --- a/sample_projects/mechano/main.cpp +++ b/sample_projects/mechano/main.cpp @@ -118,9 +118,7 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; - std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; - Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); + Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, PhysiCell_settings.mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects/physimess/main.cpp b/sample_projects/physimess/main.cpp index e32cf878b..884483ebd 100644 --- a/sample_projects/physimess/main.cpp +++ b/sample_projects/physimess/main.cpp @@ -118,9 +118,7 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; - std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; - Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); + Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, PhysiCell_settings.mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects/pred_prey_farmer/main.cpp b/sample_projects/pred_prey_farmer/main.cpp index 86be1f2e4..f8e082ede 100644 --- a/sample_projects/pred_prey_farmer/main.cpp +++ b/sample_projects/pred_prey_farmer/main.cpp @@ -118,9 +118,7 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; - std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; - Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); + Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, PhysiCell_settings.mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects/rules_sample/main.cpp b/sample_projects/rules_sample/main.cpp index c07c64e92..835779485 100644 --- a/sample_projects/rules_sample/main.cpp +++ b/sample_projects/rules_sample/main.cpp @@ -118,9 +118,7 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; - std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; - Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); + Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, PhysiCell_settings.mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects/template/main.cpp b/sample_projects/template/main.cpp index f0bd5f674..965717e9b 100644 --- a/sample_projects/template/main.cpp +++ b/sample_projects/template/main.cpp @@ -118,9 +118,7 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; - std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; - Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); + Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, PhysiCell_settings.mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects/virus_macrophage/main.cpp b/sample_projects/virus_macrophage/main.cpp index f063bb3e3..1bb6eca9c 100644 --- a/sample_projects/virus_macrophage/main.cpp +++ b/sample_projects/virus_macrophage/main.cpp @@ -118,9 +118,7 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; - std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; - Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); + Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, PhysiCell_settings.mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects/worm/main.cpp b/sample_projects/worm/main.cpp index b8dceb8e9..f8e082ede 100644 --- a/sample_projects/worm/main.cpp +++ b/sample_projects/worm/main.cpp @@ -118,9 +118,7 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; - std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; - Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); + Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, PhysiCell_settings.mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/sample_projects_intracellular/ode/ode_energy/main.cpp b/sample_projects_intracellular/ode/ode_energy/main.cpp index 6da2aa2c7..210029d85 100644 --- a/sample_projects_intracellular/ode/ode_energy/main.cpp +++ b/sample_projects_intracellular/ode/ode_energy/main.cpp @@ -109,9 +109,7 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; - std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; - Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); + Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, PhysiCell_settings.mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ diff --git a/unit_tests/mech_voxel_size/main.cpp b/unit_tests/mech_voxel_size/main.cpp index 01f55c0a8..ed6f219a5 100644 --- a/unit_tests/mech_voxel_size/main.cpp +++ b/unit_tests/mech_voxel_size/main.cpp @@ -118,9 +118,7 @@ int main( int argc, char* argv[] ) /* PhysiCell setup */ // set mechanics voxel size, and match the data structure to BioFVM - double mechanics_voxel_size = PhysiCell_settings.mechanics_voxel_size; - std::cout << "Setting mechanics voxel size= " << mechanics_voxel_size << std::endl; - Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); + Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, PhysiCell_settings.mechanics_voxel_size ); /* Users typically start modifying here. START USERMODS */ From 9b373b86d558aa85336a8f3fc1c1dcb8ec58f61d Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Sun, 22 Feb 2026 20:52:24 -0500 Subject: [PATCH 13/13] move Makefile --- {user_projects => unit_tests}/mech_voxel_size/Makefile | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {user_projects => unit_tests}/mech_voxel_size/Makefile (100%) diff --git a/user_projects/mech_voxel_size/Makefile b/unit_tests/mech_voxel_size/Makefile similarity index 100% rename from user_projects/mech_voxel_size/Makefile rename to unit_tests/mech_voxel_size/Makefile