Skip to content

Commit

Permalink
Merge pull request #349 from elmbeech/patch1141_episode
Browse files Browse the repository at this point in the history
episode sample project
  • Loading branch information
MathCancer authored Jan 20, 2025
2 parents a3bdeea + 6d44ee4 commit cffa248
Show file tree
Hide file tree
Showing 17 changed files with 1,739 additions and 64 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/build_binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
{short_name: "rules", project: "rules-sample", name: "PhysiCell Rules", binary: "project", extra_run: ""},
{short_name: "physimess", project: "physimess-sample", name: "PhysiMeSS", binary: "project", extra_run: ""},
{short_name: "interaction", project: "interaction-sample", name: "PhysiCell Interaction", binary: "interaction_demo", extra_run: ""},
{short_name: "episode", project: "episode-sample", name: "PhysiCell Episode", binary: "project", extra_run: ""},
]

runs-on: ubuntu-latest
Expand All @@ -32,7 +33,7 @@ jobs:
make ${{ matrix.projects.project }}
make clean
${{ matrix.projects.extra_run }}
make static STATIC_OPENMP=/usr/lib/gcc/x86_64-linux-gnu/11/libgomp.a
make static STATIC_OPENMP=/usr/lib/gcc/x86_64-linux-gnu/12/libgomp.a
- name: Checking binary for ${{ matrix.projects.name }}
run: |
Expand Down Expand Up @@ -66,6 +67,7 @@ jobs:
{short_name: "rules", project: "rules-sample", name: "PhysiCell Rules", binary: "project", extra_run: ""},
{short_name: "physimess", project: "physimess-sample", name: "PhysiMeSS", binary: "project", extra_run: ""},
{short_name: "interaction", project: "interaction-sample", name: "PhysiCell Interaction", binary: "interaction_demo", extra_run: ""},
{short_name: "episode", project: "episode-sample", name: "PhysiCell Episode", binary: "project", extra_run: ""},
]

runs-on: windows-latest
Expand Down Expand Up @@ -122,6 +124,7 @@ jobs:
{short_name: "rules", project: "rules-sample", name: "PhysiCell Rules", binary: "project", extra_run: ""},
{short_name: "physimess", project: "physimess-sample", name: "PhysiMeSS", binary: "project", extra_run: ""},
{short_name: "interaction", project: "interaction-sample", name: "PhysiCell Interaction", binary: "interaction_demo", extra_run: ""},
{short_name: "episode", project: "episode-sample", name: "PhysiCell Episode", binary: "project", extra_run: ""},
]

runs-on: macos-13
Expand Down Expand Up @@ -171,6 +174,7 @@ jobs:
{short_name: "rules", project: "rules-sample", name: "PhysiCell Rules", binary: "project", extra_run: ""},
{short_name: "physimess", project: "physimess-sample", name: "PhysiMeSS", binary: "project", extra_run: ""},
{short_name: "interaction", project: "interaction-sample", name: "PhysiCell Interaction", binary: "interaction_demo", extra_run: ""},
{short_name: "episode", project: "episode-sample", name: "PhysiCell Episode", binary: "project", extra_run: ""},
]

runs-on: macos-14
Expand Down Expand Up @@ -220,6 +224,7 @@ jobs:
{short_name: "rules", project: "rules-sample", name: "PhysiCell Rules", binary: "project", extra_run: ""},
{short_name: "physimess", project: "physimess-sample", name: "PhysiMeSS", binary: "project", extra_run: ""},
{short_name: "interaction", project: "interaction-sample", name: "PhysiCell Interaction", binary: "interaction_demo", extra_run: ""},
{short_name: "episode", project: "episode-sample", name: "PhysiCell Episode", binary: "project", extra_run: ""},
]

runs-on: macos-13
Expand Down Expand Up @@ -266,4 +271,4 @@ jobs:
upload_url: ${{ github.event.release.upload_url }}
asset_name: ${{ matrix.projects.short_name }}-macos.tar.gz
asset_path: ${{ github.workspace }}/${{ matrix.projects.short_name }}-macos.tar.gz
asset_content_type: application/gzip
asset_content_type: application/gzip
5 changes: 3 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ jobs:
{project: "interaction-sample", name: "PhysiCell interactions", binary: "interaction_demo", config: "config/PhysiCell_settings.xml", max_time: 120, output_folder: ""},
{project: "pred-prey-farmer", name: "PhysiCell prey predator", binary: "pred_prey", config: "config/PhysiCell_settings.xml", max_time: 120, output_folder: ""},
{project: "rules-sample", name: "PhysiCell rules sample", binary: "rules_sample", config: "config/PhysiCell_settings.xml", max_time: 120, output_folder: ""},
{project: "asymmetric-division-sample", name: "PhysiCell asymmetric division", binary: "project", config: "config/PhysiCell_settings.xml", max_time: 120, output_folder: ""}
{project: "asymmetric-division-sample", name: "PhysiCell asymmetric division", binary: "project", config: "config/PhysiCell_settings.xml", max_time: 120, output_folder: ""},
{project: "episode-sample", name: "PhysiCell Episode", binary: "project", max_time: 120, config: "config/PhysiCell_settings.xml", output_folder: ""},
]

name: Testing ${{ matrix.projects.name }} on ${{ matrix.os.name }}
Expand Down Expand Up @@ -64,4 +65,4 @@ jobs:
- name: Check ${{ matrix.projects.name }} project simulation results
if: matrix.projects.output_folder != ''
run: |
python beta/test_diff_svg.py ${{ matrix.projects.output_folder }} tests/cases/output_${{ matrix.projects.project }}
python beta/test_diff_svg.py ${{ matrix.projects.output_folder }} tests/cases/output_${{ matrix.projects.project }}
53 changes: 6 additions & 47 deletions BioFVM/BioFVM_microenvironment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ bool Microenvironment::get_substrate_dirichlet_activation( int substrate_index )
// TODO? fix confusing swapped usage of args
double Microenvironment::get_substrate_dirichlet_value( int substrate_index, int index )
{
return dirichlet_value_vectors[index][substrate_index];
return dirichlet_value_vectors[index][substrate_index];
}

// new functions for finer-grained control of Dirichlet conditions -- 1.7.0
Expand Down Expand Up @@ -487,7 +487,7 @@ void Microenvironment::add_density( std::string name , std::string units )

void Microenvironment::add_density( std::string name , std::string units, double diffusion_constant, double decay_rate )
{
// fix in PhysiCell preview November 2017
// check if density exist
if ( find_density_index( name ) != -1 )
{
std::cout << "ERROR: density named " << name << " already exists. You probably want your substrates all have unique names!" << std::endl;
Expand Down Expand Up @@ -1198,7 +1198,11 @@ void initialize_microenvironment( void )
}

// set the initial condition
set_microenvironment_initial_condition();
}

void set_microenvironment_initial_condition( void )
{
if (default_microenvironment_options.initial_condition_from_file_enabled)
{
if (default_microenvironment_options.initial_condition_file_type=="matlab")
Expand Down Expand Up @@ -1389,51 +1393,6 @@ void initialize_microenvironment( void )
}

}

/*
if( default_microenvironment_options.outer_Dirichlet_conditions == true )
{
for( unsigned int k=0 ; k < microenvironment.mesh.z_coordinates.size() ; k++ )
{
// set Dirichlet conditions along the 4 outer edges
for( unsigned int i=0 ; i < microenvironment.mesh.x_coordinates.size() ; i++ )
{
int J = microenvironment.mesh.y_coordinates.size()-1;
microenvironment.add_dirichlet_node( microenvironment.voxel_index(i,0,k) , default_microenvironment_options.Dirichlet_condition_vector );
microenvironment.add_dirichlet_node( microenvironment.voxel_index(i,J,k) , default_microenvironment_options.Dirichlet_condition_vector );
}
int I = microenvironment.mesh.x_coordinates.size()-1;
for( unsigned int j=1; j < microenvironment.mesh.y_coordinates.size()-1 ; j++ )
{
microenvironment.add_dirichlet_node( microenvironment.voxel_index(0,j,k) , default_microenvironment_options.Dirichlet_condition_vector );
microenvironment.add_dirichlet_node( microenvironment.voxel_index(I,j,k) , default_microenvironment_options.Dirichlet_condition_vector );
}
}
// if 3-D, also along the corresponding additional faces
if( default_microenvironment_options.simulate_2D == false )
{
int K = microenvironment.mesh.z_coordinates.size()-1;
for( unsigned int j=1 ; j < microenvironment.mesh.y_coordinates.size()-1 ; j++ )
{
for( unsigned int i=1; i < microenvironment.mesh.x_coordinates.size()-1 ; i++ )
{
microenvironment.add_dirichlet_node( microenvironment.voxel_index(i,j,0) , default_microenvironment_options.Dirichlet_condition_vector );
microenvironment.add_dirichlet_node( microenvironment.voxel_index(i,j,K) , default_microenvironment_options.Dirichlet_condition_vector );
}
}
}
}
*/

// April 2023: no longer necessary after flipping our approach and doing an "additive" instead of "subtractive" DCs handling. I.e., we assume DC activation is false by default; make true on-demand.

// // set the Dirichlet condition activation vector to match the microenvironment options
// for( int i=0 ; i < default_microenvironment_options.Dirichlet_activation_vector.size(); i++ )
// {
// microenvironment.set_substrate_dirichlet_activation( i , default_microenvironment_options.Dirichlet_activation_vector[i] );
// }

microenvironment.display_information(std::cout);
return;
Expand Down
3 changes: 2 additions & 1 deletion BioFVM/BioFVM_microenvironment.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,8 @@ class Microenvironment_Options
extern Microenvironment_Options default_microenvironment_options;
extern Microenvironment microenvironment;

void initialize_microenvironment( void );
void initialize_microenvironment( void );
void set_microenvironment_initial_condition( void );

void load_initial_conditions_from_matlab( std::string filename );
void load_initial_conditions_from_csv( std::string filename );
Expand Down
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ list-projects:
@echo "Sample projects: template biorobots-sample cancer-biorobots-sample cancer-immune-sample"
@echo " celltypes3-sample heterogeneity-sample pred-prey-farmer virus-macrophage-sample"
@echo " worm-sample interaction-sample mechano-sample rules-sample physimess-sample custom-division-sample"
@echo " asymmetric-division-sample immune-function-sample"
@echo " asymmetric-division-sample immune-function-sample episode-sample"
@echo ""
@echo "Sample intracellular projects: template_BM ode-energy-sample physiboss-cell-lines-sample"
@echo " cancer-metabolism-sample physiboss-tutorial physiboss-tutorial-invasion"
Expand Down Expand Up @@ -225,6 +225,14 @@ immune-function-sample:
cp ./config/PhysiCell_settings.xml ./config/PhysiCell_settings-backup.xml
cp -r ./sample_projects/immune_function/config/* ./config/

episode-sample:
cp -r ./sample_projects/episode/custom_modules/* ./custom_modules/
touch main.cpp && cp main.cpp main-backup.cpp
cp ./sample_projects/episode/main.cpp ./main.cpp
cp Makefile Makefile-backup
cp ./sample_projects/episode/Makefile .
cp -r ./sample_projects/episode/config/* ./config

# ---- intracellular projects
ode-energy-sample:
cp ./sample_projects_intracellular/ode/ode_energy/custom_modules/* ./custom_modules/
Expand Down
26 changes: 17 additions & 9 deletions modules/PhysiCell_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,12 @@ bool physicell_config_dom_initialized = false;
pugi::xml_document physicell_config_doc;
pugi::xml_node physicell_config_root;

bool load_PhysiCell_config_file( std::string filename )
bool read_PhysiCell_config_file( std::string filename )
{
physicell_config_dom_initialized = false;

std::cout << "Using config file " << filename << " ... " << std::endl ;
pugi::xml_parse_result result = physicell_config_doc.load_file( filename.c_str() );
pugi::xml_parse_result result = physicell_config_doc.load_file( filename.c_str() );

if( result.status != pugi::xml_parse_status::status_ok )
{
Expand All @@ -92,22 +94,28 @@ bool load_PhysiCell_config_file( std::string filename )

physicell_config_root = physicell_config_doc.child("PhysiCell_settings");
physicell_config_dom_initialized = true;

return true;
}

bool load_PhysiCell_config_file( std::string filename )
{
if (!read_PhysiCell_config_file( filename ))
{ return false; }

PhysiCell_settings.read_from_pugixml();

// now read the microenvironment (optional)

if( !setup_microenvironment_from_XML( physicell_config_root ) )
{
std::cout << std::endl
<< "Warning: microenvironment_setup not found in " << filename << std::endl
<< " Either manually setup microenvironment in setup_microenvironment() (custom.cpp)" << std::endl
<< " or consult documentation to add microenvironment_setup to your configuration file." << std::endl << std::endl;
std::cout << std::endl
<< "Warning: microenvironment_setup not found in " << filename << std::endl
<< " Either manually setup microenvironment in setup_microenvironment() (custom.cpp)" << std::endl
<< " or consult documentation to add microenvironment_setup to your configuration file." << std::endl << std::endl;
}

// now read user parameters

parameters.read_from_pugixml( physicell_config_root );
parameters.read_from_pugixml( physicell_config_root );

create_output_directory( PhysiCell_settings.folder );

Expand Down
3 changes: 2 additions & 1 deletion modules/PhysiCell_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ namespace PhysiCell{

extern pugi::xml_node physicell_config_root;

bool load_PhysiCell_config_file( std::string filename );
bool read_PhysiCell_config_file( std::string filename );
bool load_PhysiCell_config_file( std::string filename );

class PhysiCell_Settings
{
Expand Down
10 changes: 9 additions & 1 deletion sample_projects/Makefile-default
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ list-projects:
@echo "Sample projects: template biorobots-sample cancer-biorobots-sample cancer-immune-sample"
@echo " celltypes3-sample heterogeneity-sample pred-prey-farmer virus-macrophage-sample"
@echo " worm-sample interaction-sample mechano-sample rules-sample physimess-sample custom-division-sample"
@echo " asymmetric-division-sample immune-function-sample"
@echo " asymmetric-division-sample immune-function-sample episode-sample"
@echo ""
@echo "Sample intracellular projects: template_BM ode-energy-sample physiboss-cell-lines-sample"
@echo " cancer-metabolism-sample physiboss-tutorial physiboss-tutorial-invasion"
Expand Down Expand Up @@ -225,6 +225,14 @@ immune-function-sample:
cp ./config/PhysiCell_settings.xml ./config/PhysiCell_settings-backup.xml
cp -r ./sample_projects/immune_function/config/* ./config/

episode-sample:
cp -r ./sample_projects/episode/custom_modules/* ./custom_modules/
touch main.cpp && cp main.cpp main-backup.cpp
cp ./sample_projects/episode/main.cpp ./main.cpp
cp Makefile Makefile-backup
cp ./sample_projects/episode/Makefile .
cp -r ./sample_projects/episode/config/* ./config

# ---- intracellular projects
ode-energy-sample:
cp ./sample_projects_intracellular/ode/ode_energy/custom_modules/* ./custom_modules/
Expand Down
Loading

0 comments on commit cffa248

Please sign in to comment.