From 2cfbc80f06eb85cc9879a3b549f69e22404b3eb0 Mon Sep 17 00:00:00 2001 From: bue Date: Tue, 17 Feb 2026 19:25:13 -0500 Subject: [PATCH 1/2] Update the if-query so that it spans all possible contact with cells cases. --- core/PhysiCell_signal_behavior.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/PhysiCell_signal_behavior.cpp b/core/PhysiCell_signal_behavior.cpp index 8780e8d7c..424ca0993 100644 --- a/core/PhysiCell_signal_behavior.cpp +++ b/core/PhysiCell_signal_behavior.cpp @@ -1065,7 +1065,7 @@ double get_single_signal( Cell* pCell, int index ) // physical contact with cells (of each type) // individual contact signals are a bit costly static int contact_ind = find_signal_index( "contact with " + cell_definitions_by_type[0]->name ); - if( contact_ind <= index && index < contact_ind + n+2 ) + if( contact_ind <= index && index < contact_ind + n+5 ) { std::vector counts( n , 0 ); // process all neighbors From 5eef794f366eacd1bf52bb9dd0ca7e3f721e3d1c Mon Sep 17 00:00:00 2001 From: bue Date: Sat, 21 Mar 2026 10:52:36 -0400 Subject: [PATCH 2/2] add contact_with_built_in variable and change the code accordingly. --- core/PhysiCell_signal_behavior.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/PhysiCell_signal_behavior.cpp b/core/PhysiCell_signal_behavior.cpp index 424ca0993..fb0b9192c 100644 --- a/core/PhysiCell_signal_behavior.cpp +++ b/core/PhysiCell_signal_behavior.cpp @@ -79,6 +79,8 @@ std::map behavior_to_int; std::map int_to_signal; std::map int_to_behavior; +int contact_with_built_in = 5; // live, dead, apoptotic, necrotic, other + void setup_signal_behavior_dictionaries( void ) { extern std::unordered_map cell_definition_indices_by_name; @@ -804,7 +806,7 @@ std::vector get_signals( Cell* pCell ) signals[volume_ind] = pCell->phenotype.volume.total; // physical contact with cells (of each type) - // increment signals + // increment signals int dead_cells = 0; int apop_cells = 0; int necro_cells = 0; @@ -964,7 +966,7 @@ std::vector get_cell_contact_signals( Cell* pCell ) // rescale std::string search_for = "contact with " + cell_definitions_by_type[0]->name; static int scaling_start_index = find_signal_index( search_for ); - for( int i=0; i < n+2 ; i++ ) + for( int i=0; i < n+contact_with_built_in; i++ ) { output[i] /= signal_scales[scaling_start_index+i]; } return output; @@ -986,7 +988,7 @@ std::vector get_selected_signals( Cell* pCell , std::vector indices for( int i=0; i < indices.size() ; i++ ) { int ind = indices[i]; - if( ind >= contact_start_index && ind < contact_start_index+n+2) + if( ind >= contact_start_index && ind < contact_start_index+n+contact_with_built_in ) { signals[i] = contact_signals[ind-contact_start_index]; } else { signals[i] = get_single_signal( pCell , ind ); } @@ -1065,7 +1067,7 @@ double get_single_signal( Cell* pCell, int index ) // physical contact with cells (of each type) // individual contact signals are a bit costly static int contact_ind = find_signal_index( "contact with " + cell_definitions_by_type[0]->name ); - if( contact_ind <= index && index < contact_ind + n+5 ) + if( contact_ind <= index && index < contact_ind+n+contact_with_built_in ) { std::vector counts( n , 0 ); // process all neighbors