Skip to content
Open
1 change: 1 addition & 0 deletions core/PhysiCell_constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

As best I can tell, this mechanics_voxel_size is not being used anywhere else. Should we remove it from PhysiCell_constants and have it only exist within PhysiCell_settings?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I had mistakely convinced myself that it need to be in both _constants and _settings, but I was apparently wrong. I removed it from _constants. Also, I agree that it's cleaner to just pass PhysiCell_settings.mechanics_voxel_size in all main.cpp create_cell_container_for_microenvironment and I pushed those changes.


// currently recognized cell cycle models
const int PhysiCell_constants::advanced_Ki67_cycle_model= 0;
Expand Down
1 change: 1 addition & 0 deletions core/PhysiCell_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string,int> cycle_model_codes;
Expand Down
24 changes: 24 additions & 0 deletions modules/PhysiCell_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ PhysiCell_Settings::PhysiCell_Settings()

intracellular_save_interval = 60;
enable_intracellular_saves = false;

// <options>
mechanics_voxel_size = 30.0;

// parallel options

Expand Down Expand Up @@ -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 <options>, leaving at default value= " << mechanics_voxel_size << std::endl;
}


// other options can go here, eventually
}

Expand Down
3 changes: 3 additions & 0 deletions modules/PhysiCell_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ class PhysiCell_Settings
double intracellular_save_interval = 60;
bool enable_intracellular_saves = false;

// <options>
double mechanics_voxel_size = 30.0;

// cell rules option
bool rules_enabled = false;
std::string rules_protocol = "Cell Behavior Hypothesis Grammar (CBHG)";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<virtual_wall_at_domain_edge>true</virtual_wall_at_domain_edge>
<disable_automated_spring_adhesions>false</disable_automated_spring_adhesions>
<random_seed>0</random_seed>
<mechanics_voxel_size>30</mechanics_voxel_size>
</options>

<microenvironment_setup>
Expand Down
3 changes: 2 additions & 1 deletion sample_projects/asymmetric_division/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In the main.cpp, mechanics_voxel_size is exclusively used to pass in to create_cell_container_for_microenvironment. Should we continue defining this variable scoped only to the main function for this? Or just rely on the PhysiCell constant we are defining?

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 */
Expand Down
1 change: 1 addition & 0 deletions sample_projects/biorobots/config/PhysiCell_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
<virtual_wall_at_domain_edge>true</virtual_wall_at_domain_edge>
<disable_automated_spring_adhesions>true</disable_automated_spring_adhesions>
<random_seed>0</random_seed>
<mechanics_voxel_size>30</mechanics_voxel_size>
</options>

<microenvironment_setup>
Expand Down
3 changes: 2 additions & 1 deletion sample_projects/biorobots/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
<virtual_wall_at_domain_edge>true</virtual_wall_at_domain_edge>
<disable_automated_spring_adhesions>true</disable_automated_spring_adhesions>
<random_seed>0</random_seed>
<mechanics_voxel_size>30</mechanics_voxel_size>
</options>

<microenvironment_setup>
Expand Down
3 changes: 2 additions & 1 deletion sample_projects/cancer_biorobots/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
<legacy_random_points_on_sphere_in_divide>false</legacy_random_points_on_sphere_in_divide>
<virtual_wall_at_domain_edge>true</virtual_wall_at_domain_edge>
<disable_automated_spring_adhesions>true</disable_automated_spring_adhesions>
<mechanics_voxel_size>30</mechanics_voxel_size>
</options>

<microenvironment_setup>
Expand Down
3 changes: 2 additions & 1 deletion sample_projects/cancer_immune/main-cancer_immune_3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions sample_projects/celltypes3/config/PhysiCell_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
<options>
<legacy_random_points_on_sphere_in_divide>false</legacy_random_points_on_sphere_in_divide>
<disable_automated_spring_adhesions>false</disable_automated_spring_adhesions>
<mechanics_voxel_size>30</mechanics_voxel_size>
</options>

<microenvironment_setup>
Expand Down
3 changes: 2 additions & 1 deletion sample_projects/celltypes3/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<virtual_wall_at_domain_edge>true</virtual_wall_at_domain_edge>
<disable_automated_spring_adhesions>false</disable_automated_spring_adhesions>
<random_seed>0</random_seed>
<mechanics_voxel_size>30</mechanics_voxel_size>
</options>

<microenvironment_setup>
Expand Down
3 changes: 2 additions & 1 deletion sample_projects/custom_division/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
1 change: 1 addition & 0 deletions sample_projects/episode/config/PhysiCell_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<virtual_wall_at_domain_edge>true</virtual_wall_at_domain_edge>
<disable_automated_spring_adhesions>false</disable_automated_spring_adhesions>
<random_seed>74</random_seed>
<mechanics_voxel_size>30</mechanics_voxel_size>
</options>

<microenvironment_setup>
Expand Down
3 changes: 2 additions & 1 deletion sample_projects/episode/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
<virtual_wall_at_domain_edge>true</virtual_wall_at_domain_edge>
<disable_automated_spring_adhesions>false</disable_automated_spring_adhesions>
<random_seed>0</random_seed>
<mechanics_voxel_size>30</mechanics_voxel_size>
</options>

<microenvironment_setup>
Expand Down
3 changes: 2 additions & 1 deletion sample_projects/heterogeneity/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<legacy_random_points_on_sphere_in_divide>false</legacy_random_points_on_sphere_in_divide>
<virtual_wall_at_domain_edge>true</virtual_wall_at_domain_edge>
<disable_automated_spring_adhesions>false</disable_automated_spring_adhesions>
<mechanics_voxel_size>30</mechanics_voxel_size>
</options>

<microenvironment_setup>
Expand Down
3 changes: 2 additions & 1 deletion sample_projects/immune_function/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
1 change: 1 addition & 0 deletions sample_projects/interactions/config/PhysiCell_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
<legacy_cell_defaults_copy>false</legacy_cell_defaults_copy>
<disable_automated_spring_adhesions>false</disable_automated_spring_adhesions>
<random_seed>0</random_seed>
<mechanics_voxel_size>30</mechanics_voxel_size>
</options>

<microenvironment_setup>
Expand Down
3 changes: 2 additions & 1 deletion sample_projects/interactions/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
1 change: 1 addition & 0 deletions sample_projects/mechano/config/PhysiCell_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
<virtual_wall_at_domain_edge>true</virtual_wall_at_domain_edge>
<disable_automated_spring_adhesions>false</disable_automated_spring_adhesions>
<random_seed>0</random_seed>
<mechanics_voxel_size>30</mechanics_voxel_size>
</options>

<microenvironment_setup>
Expand Down
3 changes: 2 additions & 1 deletion sample_projects/mechano/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
1 change: 1 addition & 0 deletions sample_projects/physimess/config/PhysiCell_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
<virtual_wall_at_domain_edge>true</virtual_wall_at_domain_edge>
<disable_automated_spring_adhesions>true</disable_automated_spring_adhesions>
<random_seed>0</random_seed>
<mechanics_voxel_size>30</mechanics_voxel_size>
</options>

<microenvironment_setup>
Expand Down
3 changes: 2 additions & 1 deletion sample_projects/physimess/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
<legacy_random_points_on_sphere_in_divide>false</legacy_random_points_on_sphere_in_divide>
<virtual_wall_at_domain_edge>true</virtual_wall_at_domain_edge>
<disable_automated_spring_adhesions>false</disable_automated_spring_adhesions>
<mechanics_voxel_size>30</mechanics_voxel_size>
</options>

<microenvironment_setup>
Expand Down
3 changes: 2 additions & 1 deletion sample_projects/pred_prey_farmer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
1 change: 1 addition & 0 deletions sample_projects/rules_sample/config/PhysiCell_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<virtual_wall_at_domain_edge>true</virtual_wall_at_domain_edge>
<disable_automated_spring_adhesions>false</disable_automated_spring_adhesions>
<random_seed>0</random_seed>
<mechanics_voxel_size>30</mechanics_voxel_size>
</options>

<microenvironment_setup>
Expand Down
3 changes: 2 additions & 1 deletion sample_projects/rules_sample/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
1 change: 1 addition & 0 deletions sample_projects/template/config/PhysiCell_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<virtual_wall_at_domain_edge>true</virtual_wall_at_domain_edge>
<disable_automated_spring_adhesions>false</disable_automated_spring_adhesions>
<random_seed>0</random_seed>
<mechanics_voxel_size>30</mechanics_voxel_size>
</options>

<microenvironment_setup>
Expand Down
3 changes: 2 additions & 1 deletion sample_projects/template/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
<virtual_wall_at_domain_edge>true</virtual_wall_at_domain_edge>
<disable_automated_spring_adhesions>false</disable_automated_spring_adhesions>
<random_seed>0</random_seed>
<mechanics_voxel_size>30</mechanics_voxel_size>
</options>

<microenvironment_setup>
Expand Down
3 changes: 2 additions & 1 deletion sample_projects/virus_macrophage/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
1 change: 1 addition & 0 deletions sample_projects/worm/config/PhysiCell_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
<virtual_wall_at_domain_edge>true</virtual_wall_at_domain_edge>
<disable_automated_spring_adhesions>true</disable_automated_spring_adhesions>
<random_seed>0</random_seed>
<mechanics_voxel_size>30</mechanics_voxel_size>
</options>

<microenvironment_setup>
Expand Down
3 changes: 2 additions & 1 deletion sample_projects/worm/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
<legacy_random_points_on_sphere_in_divide>false</legacy_random_points_on_sphere_in_divide>
<virtual_wall_at_domain_edge>true</virtual_wall_at_domain_edge>
<disable_automated_spring_adhesions>false</disable_automated_spring_adhesions>
<mechanics_voxel_size>30</mechanics_voxel_size>
</options>

<microenvironment_setup>
Expand Down
3 changes: 2 additions & 1 deletion sample_projects_intracellular/ode/ode_energy/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
Loading