Skip to content

Commit

Permalink
Only saving cells data when there are cells
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-noel committed Feb 11, 2025
1 parent 69a23db commit b163811
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions modules/PhysiCell_MultiCellDS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ void add_PhysiCell_cells_to_open_xml_pugi_v2( pugi::xml_document& xml_dom, std::
// get number of cell types
static int n = cell_definition_indices_by_name.size(); // number_of_cell_types
// get number of death models
static int nd = (*all_cells)[0]->phenotype.death.rates.size(); //
static int nd = cell_defaults.phenotype.death.rates.size(); //
// get number of custom data
static int nc = 0; //
static int nc_scalar = 0;
Expand Down Expand Up @@ -587,7 +587,7 @@ void add_PhysiCell_cells_to_open_xml_pugi_v2( pugi::xml_document& xml_dom, std::
"damage_repair_rate" , "1/min" , 1 );

// custom
for( int j=0 ; j < (*all_cells)[0]->custom_data.variables.size(); j++ )
for( int j=0 ; j < cell_defaults.custom_data.variables.size(); j++ )
{
name = (*all_cells)[0]->custom_data.variables[j].name;
units = (*all_cells)[0]->custom_data.variables[j].units;
Expand All @@ -596,7 +596,7 @@ void add_PhysiCell_cells_to_open_xml_pugi_v2( pugi::xml_document& xml_dom, std::
}

// custom vector variables
for( int j=0 ; j < (*all_cells)[0]->custom_data.vector_variables.size(); j++ )
for( int j=0 ; j < cell_defaults.custom_data.vector_variables.size(); j++ )
{
name = (*all_cells)[0]->custom_data.vector_variables[j].name;
units = (*all_cells)[0]->custom_data.vector_variables[j].units;
Expand Down Expand Up @@ -995,11 +995,11 @@ void add_PhysiCell_cells_to_open_xml_pugi_v2( pugi::xml_document& xml_dom, std::

// custom
// custom scalar variables
for( int j=0 ; j < (*all_cells)[0]->custom_data.variables.size(); j++ )
for( int j=0 ; j < cell_defaults.custom_data.variables.size(); j++ )
{ std::fwrite( &( pCell->custom_data.variables[j].value ) , sizeof(double) , 1 , fp ); }

// custom vector variables
for( int j=0 ; j < (*all_cells)[0]->custom_data.vector_variables.size(); j++ )
for( int j=0 ; j < cell_defaults.custom_data.vector_variables.size(); j++ )
{
int size_temp = pCell->custom_data.vector_variables[j].value.size();
std::fwrite( pCell->custom_data.vector_variables[j].value.data() , sizeof(double) , size_temp , fp );
Expand Down

0 comments on commit b163811

Please sign in to comment.