Skip to content

Commit 088f4fe

Browse files
authored
Merge pull request #411 from elmbeech/patch1142dev_signal_contact
update the if-query so that it spans all possible contact with cells cases.
2 parents b68fe2d + 5eef794 commit 088f4fe

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎core/PhysiCell_signal_behavior.cpp‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ std::map<std::string,int> behavior_to_int;
7979
std::map<int,std::string> int_to_signal;
8080
std::map<int,std::string> int_to_behavior;
8181

82+
int contact_with_built_in = 5; // live, dead, apoptotic, necrotic, other
83+
8284
void setup_signal_behavior_dictionaries( void )
8385
{
8486
extern std::unordered_map<std::string,int> cell_definition_indices_by_name;
@@ -804,7 +806,7 @@ std::vector<double> get_signals( Cell* pCell )
804806
signals[volume_ind] = pCell->phenotype.volume.total;
805807

806808
// physical contact with cells (of each type)
807-
// increment signals
809+
// increment signals
808810
int dead_cells = 0;
809811
int apop_cells = 0;
810812
int necro_cells = 0;
@@ -964,7 +966,7 @@ std::vector<double> get_cell_contact_signals( Cell* pCell )
964966
// rescale
965967
std::string search_for = "contact with " + cell_definitions_by_type[0]->name;
966968
static int scaling_start_index = find_signal_index( search_for );
967-
for( int i=0; i < n+2 ; i++ )
969+
for( int i=0; i < n+contact_with_built_in; i++ )
968970
{ output[i] /= signal_scales[scaling_start_index+i]; }
969971

970972
return output;
@@ -986,7 +988,7 @@ std::vector<double> get_selected_signals( Cell* pCell , std::vector<int> indices
986988
for( int i=0; i < indices.size() ; i++ )
987989
{
988990
int ind = indices[i];
989-
if( ind >= contact_start_index && ind < contact_start_index+n+2)
991+
if( ind >= contact_start_index && ind < contact_start_index+n+contact_with_built_in )
990992
{ signals[i] = contact_signals[ind-contact_start_index]; }
991993
else
992994
{ signals[i] = get_single_signal( pCell , ind ); }
@@ -1065,7 +1067,7 @@ double get_single_signal( Cell* pCell, int index )
10651067
// physical contact with cells (of each type)
10661068
// individual contact signals are a bit costly
10671069
static int contact_ind = find_signal_index( "contact with " + cell_definitions_by_type[0]->name );
1068-
if( contact_ind <= index && index < contact_ind + n+2 )
1070+
if( contact_ind <= index && index < contact_ind+n+contact_with_built_in )
10691071
{
10701072
std::vector<int> counts( n , 0 );
10711073
// process all neighbors

0 commit comments

Comments
 (0)