@@ -2318,7 +2318,6 @@ Cell_Definition* initialize_cell_definition_from_pugixml( pugi::xml_node cd_node
23182318 // otherwise, modify properties of that model
23192319
23202320 // set up the death models
2321- // int death_model_index = 0;
23222321 node = cd_node.child ( " phenotype" );
23232322 node = node.child ( " death" );
23242323 if ( node )
@@ -2412,17 +2411,13 @@ Cell_Definition* initialize_cell_definition_from_pugixml( pugi::xml_node cd_node
24122411 if ( node_temp )
24132412 { death_params.lysed_fluid_change_rate = xml_get_my_double_value ( node_temp ); }
24142413
2415- // death_params.time_units =
2416- // get_string_attribute_value( node, "unlysed_fluid_change_rate", "units" );
2417-
24182414 node = node.parent ();
24192415 }
24202416
24212417 // set the model
24222418 // if the model already exists, just overwrite the parameters
24232419 if (model == PhysiCell_constants::apoptosis_death_model)
24242420 {
2425- // pCD->phenotype.death.add_death_model( rate , &apoptosis , apoptosis_parameters );
24262421 if ( death_model_already_exists == false )
24272422 {
24282423 pCD->phenotype .death .add_death_model ( rate , &apoptosis , death_params );
@@ -2437,7 +2432,6 @@ Cell_Definition* initialize_cell_definition_from_pugixml( pugi::xml_node cd_node
24372432 else if (model == PhysiCell_constants::necrosis_death_model)
24382433 {
24392434 // set necrosis parameters
2440- // pCD->phenotype.death.add_death_model( rate , &necrosis , necrosis_parameters );
24412435 if ( death_model_already_exists == false )
24422436 {
24432437 pCD->phenotype .death .add_death_model ( rate , &necrosis , death_params );
@@ -2960,11 +2954,7 @@ Cell_Definition* initialize_cell_definition_from_pugixml( pugi::xml_node cd_node
29602954 // pCI->dead_phagocytosis_rate = xml_get_my_double_value(node_dpr);
29612955 dead_phagocytosis_rate = xml_get_my_double_value (node_dpr);
29622956 }
2963- /*
2964- pCI->apoptotic_phagocytosis_rate = pCI->dead_phagocytosis_rate;
2965- pCI->necrotic_phagocytosis_rate = pCI->dead_phagocytosis_rate;
2966- pCI->other_dead_phagocytosis_rate = pCI->dead_phagocytosis_rate;
2967- */
2957+
29682958 pCI->apoptotic_phagocytosis_rate = dead_phagocytosis_rate;
29692959 pCI->necrotic_phagocytosis_rate = dead_phagocytosis_rate;
29702960 pCI->other_dead_phagocytosis_rate = dead_phagocytosis_rate;
@@ -3141,64 +3131,14 @@ Cell_Definition* initialize_cell_definition_from_pugixml( pugi::xml_node cd_node
31413131
31423132 // intracellular
31433133 node = cd_node.child ( " phenotype" );
3144- node = node.child ( " intracellular" );
3145- if ( node )
3134+ node = node.child (" intracellular" );
3135+ if (node)
3136+ {
3137+ parse_intracellular_model (node, pCD, pParent);
3138+ }
3139+ else
31463140 {
3147- std::string model_type = node.attribute ( " type" ).value ();
3148-
3149- #ifdef ADDON_PHYSIBOSS
3150- if (model_type == " maboss" ) {
3151- argument_parser.read_intracellular_files (node, pCD->name , model_type);
3152- // If it has already be copied
3153- if (pParent != NULL && pParent->phenotype .intracellular != NULL ) {
3154- pCD->phenotype .intracellular ->initialize_intracellular_from_pugixml (node);
3155-
3156- // Otherwise we need to create a new one
3157- } else {
3158- MaBoSSIntracellular* pIntra = new MaBoSSIntracellular (node);
3159- pCD->phenotype .intracellular = pIntra->getIntracellularModel ();
3160- }
3161- }
3162- #endif
3163-
3164- #ifdef ADDON_ROADRUNNER
3165- if (model_type == " roadrunner" )
3166- {
3167- argument_parser.read_intracellular_files (node, pCD->name , model_type);
3168- // If it has already be copied
3169- if (pParent != NULL && pParent->phenotype .intracellular != NULL )
3170- {
3171- pCD->phenotype .intracellular ->initialize_intracellular_from_pugixml (node);
3172- }
3173- // Otherwise we need to create a new one
3174- else
3175- {
3176- RoadRunnerIntracellular* pIntra = new RoadRunnerIntracellular (node);
3177- pCD->phenotype .intracellular = pIntra->getIntracellularModel ();
3178- }
3179- pCD->phenotype .intracellular ->validate_PhysiCell_tokens (pCD->phenotype );
3180- pCD->phenotype .intracellular ->validate_SBML_species ();
3181- }
3182- #endif
3183-
3184- #ifdef ADDON_PHYSIDFBA
3185- if (model_type == " dfba" ) {
3186- argument_parser.read_intracellular_files (node, pCD->name , model_type);
3187- // If it has already be copied
3188- if (pParent != NULL && pParent->phenotype .intracellular != NULL ) {
3189- pCD->phenotype .intracellular ->initialize_intracellular_from_pugixml (node);
3190- // Otherwise we need to create a new one
3191- } else {
3192- dFBAIntracellular* pIntra = new dFBAIntracellular (node);
3193- pCD->phenotype .intracellular = pIntra->getIntracellularModel ();
3194- }
3195- }
3196- #endif
3197-
3198- } else {
3199-
32003141 pCD->phenotype .intracellular = NULL ;
3201-
32023142 }
32033143
32043144 // set up custom data
@@ -3283,10 +3223,90 @@ Cell_Definition* initialize_cell_definition_from_pugixml( pugi::xml_node cd_node
32833223 exit (-1 );
32843224#endif
32853225 }
3286-
3226+
32873227 return pCD;
32883228}
32893229
3230+ void parse_intracellular_model (pugi::xml_node node, Cell_Definition* pCD, Cell_Definition* pParent)
3231+ {
3232+ std::string model_type = node.attribute ( " type" ).value ();
3233+ bool uses_intracellular = argument_parser.read_intracellular_files (node, pCD->name , model_type);
3234+ if (!uses_intracellular) {
3235+ return ;
3236+ }
3237+
3238+ if (model_type == " maboss" )
3239+ {
3240+ #ifdef ADDON_PHYSIBOSS
3241+ // If it has already be copied
3242+ if (pParent != NULL && pParent->phenotype .intracellular != NULL )
3243+ {
3244+ pCD->phenotype .intracellular ->initialize_intracellular_from_pugixml (node);
3245+
3246+ // Otherwise we need to create a new one
3247+ }
3248+ else
3249+ {
3250+ MaBoSSIntracellular *pIntra = new MaBoSSIntracellular (node);
3251+ pCD->phenotype .intracellular = pIntra->getIntracellularModel ();
3252+ }
3253+ #else
3254+ std::cerr << " ERROR: MaBoSS intracellular model is not supported in this build." << std::endl
3255+ << " \t Make sure to compile with the -D ADDON_PHYSIBOSS flag." << std::endl;
3256+ exit (-1 );
3257+ #endif
3258+ }
3259+
3260+ else if (model_type == " roadrunner" )
3261+ {
3262+ #ifdef ADDON_ROADRUNNER
3263+ // If it has already be copied
3264+ if (pParent != NULL && pParent->phenotype .intracellular != NULL )
3265+ {
3266+ pCD->phenotype .intracellular ->initialize_intracellular_from_pugixml (node);
3267+ }
3268+ // Otherwise we need to create a new one
3269+ else
3270+ {
3271+ RoadRunnerIntracellular *pIntra = new RoadRunnerIntracellular (node);
3272+ pCD->phenotype .intracellular = pIntra->getIntracellularModel ();
3273+ }
3274+ pCD->phenotype .intracellular ->validate_PhysiCell_tokens (pCD->phenotype );
3275+ pCD->phenotype .intracellular ->validate_SBML_species ();
3276+ #else
3277+ std::cerr << " ERROR: RoadRunner intracellular model is not supported in this build." << std::endl
3278+ << " \t Make sure to compile with the -D ADDON_ROADRUNNER flag." << std::endl;
3279+ exit (-1 );
3280+ #endif
3281+ }
3282+
3283+ else if (model_type == " dfba" )
3284+ {
3285+ #ifdef ADDON_PHYSIDFBA
3286+ // If it has already be copied
3287+ if (pParent != NULL && pParent->phenotype .intracellular != NULL )
3288+ {
3289+ pCD->phenotype .intracellular ->initialize_intracellular_from_pugixml (node);
3290+ // Otherwise we need to create a new one
3291+ }
3292+ else
3293+ {
3294+ dFBAIntracellular *pIntra = new dFBAIntracellular (node);
3295+ pCD->phenotype .intracellular = pIntra->getIntracellularModel ();
3296+ }
3297+ #else
3298+ std::cerr << " ERROR: dFBA intracellular model is not supported in this build." << std::endl
3299+ << " \t Make sure to compile with the -D ADDON_PHYSIDFBA flag." << std::endl;
3300+ #endif
3301+ }
3302+
3303+ else
3304+ {
3305+ std::cerr << " ERROR: Intracellular model type " << model_type << " is not supported." << std::endl;
3306+ exit (-1 );
3307+ }
3308+ }
3309+
32903310void initialize_cell_definitions_from_pugixml ( pugi::xml_node root )
32913311{
32923312 pugi::xml_node node_options;
0 commit comments