Skip to content

Commit caf7728

Browse files
authored
Merge pull request #41 from drbergman/my-physicell-dev
1.14.2-drbergman-2.3.1
2 parents 07919da + dae08ab commit caf7728

File tree

4 files changed

+18
-68
lines changed

4 files changed

+18
-68
lines changed

VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.14.2-drbergman-2.3.0
1+
1.14.2-drbergman-2.3.1

core/PhysiCell_cell.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -623,19 +623,24 @@ Cell* Cell::divide( )
623623
rand_vec *= radius; // multiply direction times the displacement
624624
*/
625625

626+
// direction to displace daughter cell
626627
std::vector<double> rand_vec = cell_division_orientation();
628+
// make it orthogonal to the cell's orientation
627629
rand_vec = rand_vec- phenotype.geometry.polarity*(rand_vec[0]*state.orientation[0]+
628630
rand_vec[1]*state.orientation[1]+rand_vec[2]*state.orientation[2])*state.orientation;
629-
rand_vec *= phenotype.geometry.radius;
631+
// make sure it is a unit vector
632+
normalize( &rand_vec );
633+
// push the cells far enough apart to avoid strong overlap, but still maintain some overlap
634+
rand_vec *= 0.5 * phenotype.geometry.radius;
630635

631636
child->assign_position(position[0] + rand_vec[0],
632637
position[1] + rand_vec[1],
633638
position[2] + rand_vec[2]);
634639

635640
//change my position to keep the center of mass intact
636641
// and then see if I need to update my voxel index
637-
static double negative_one_half = -0.5;
638-
axpy( &position, negative_one_half , rand_vec ); // position = position - 0.5*rand_vec;
642+
static double negative_one = -1.0;
643+
axpy( &position, negative_one , rand_vec ); // position = position - rand_vec;
639644

640645
//If this cell has been moved outside of the boundaries, mark it as such.
641646
//(If the child cell is outside of the boundaries, that has been taken care of in the assign_position function.)

core/PhysiCell_standard_models.cpp

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,64 +1098,8 @@ double distance_to_domain_edge(Cell* pCell, Phenotype& phenotype, double dummy)
10981098
min_distance = temp_distance;
10991099
nearest_boundary = 5;
11001100
}
1101-
1102-
// check for 3D exceptions
1103-
1104-
// lines
1105-
if( fabs( (pCell->position[0]) - (pCell->position[1]) ) < tolerance &&
1106-
fabs( (pCell->position[1]) - (pCell->position[2]) ) < tolerance &&
1107-
fabs( (pCell->position[0]) - (pCell->position[2]) ) < tolerance )
1108-
{
1109-
if( pCell->position[0] > 0 )
1110-
{
1111-
if( pCell->position[0] > 0 && pCell->position[1] > 0 )
1112-
{ pCell->displacement = { -one_over_sqrt_3 , -one_over_sqrt_3 , -one_over_sqrt_3 }; }
1113-
if( pCell->position[0] < 0 && pCell->position[1] > 0 )
1114-
{ pCell->displacement = { one_over_sqrt_3 , -one_over_sqrt_3 , -one_over_sqrt_3 }; }
1115-
1116-
if( pCell->position[0] > 0 && pCell->position[1] < 0 )
1117-
{ pCell->displacement = { -one_over_sqrt_3 , one_over_sqrt_3 , -one_over_sqrt_3 }; }
1118-
if( pCell->position[0] < 0 && pCell->position[1] < 0 )
1119-
{ pCell->displacement = { one_over_sqrt_3 , one_over_sqrt_3 , -one_over_sqrt_3 }; }
1120-
}
1121-
else
1122-
{
1123-
if( pCell->position[0] > 0 && pCell->position[1] > 0 )
1124-
{ pCell->displacement = { -one_over_sqrt_3 , -one_over_sqrt_3 , one_over_sqrt_3 }; }
1125-
if( pCell->position[0] < 0 && pCell->position[1] > 0 )
1126-
{ pCell->displacement = { one_over_sqrt_3 , -one_over_sqrt_3 , one_over_sqrt_3 }; }
1127-
1128-
if( pCell->position[0] > 0 && pCell->position[1] < 0 )
1129-
{ pCell->displacement = { -one_over_sqrt_3 , one_over_sqrt_3 , one_over_sqrt_3 }; }
1130-
if( pCell->position[0] < 0 && pCell->position[1] < 0 )
1131-
{ pCell->displacement = { one_over_sqrt_3 , one_over_sqrt_3 , one_over_sqrt_3 }; }
1132-
}
1133-
return min_distance;
1134-
}
1135-
1136-
// planes - let's not worry for today
1137-
1138-
}
1139-
else
1140-
{
1141-
// check for 2D exceptions
1142-
1143-
if( fabs( (pCell->position[0]) - (pCell->position[1]) ) < tolerance )
1144-
{
1145-
if( pCell->position[0] > 0 && pCell->position[1] > 0 )
1146-
{ pCell->displacement = { -one_over_sqrt_2 , -one_over_sqrt_2 , 0 }; }
1147-
if( pCell->position[0] < 0 && pCell->position[1] > 0 )
1148-
{ pCell->displacement = { one_over_sqrt_2 , -one_over_sqrt_2 , 0 }; }
1149-
1150-
if( pCell->position[0] > 0 && pCell->position[1] < 0 )
1151-
{ pCell->displacement = { -one_over_sqrt_2 , one_over_sqrt_2 , 0 }; }
1152-
if( pCell->position[0] < 0 && pCell->position[1] < 0 )
1153-
{ pCell->displacement = { one_over_sqrt_2 , one_over_sqrt_2 , 0 }; }
1154-
return min_distance;
1155-
}
11561101
}
11571102

1158-
// no exceptions
11591103
switch(nearest_boundary)
11601104
{
11611105
case 0:

modules/PhysiCell_settings.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,17 +1266,18 @@ void set_intracellular_files(pugi::xml_node &node_config_intracellular, const pu
12661266
{
12671267
std::string rr_filename = base_path_to_filename + "_" + intracellular_type + ".xml";
12681268
// determine if file exists already
1269-
if (std::ifstream(rr_filename))
1270-
{ return; }
1271-
pugi::xml_node node_rr_root = node_this_intracellular.child("sbml");
1272-
pugi::xml_document rr_doc;
1273-
rr_doc.append_copy(node_rr_root);
1274-
rr_doc.save_file(rr_filename.c_str());
1269+
if (!std::ifstream(rr_filename))
1270+
{
1271+
pugi::xml_node node_rr_root = node_this_intracellular.child("sbml");
1272+
pugi::xml_document rr_doc;
1273+
rr_doc.append_copy(node_rr_root);
1274+
rr_doc.save_file(rr_filename.c_str());
1275+
}
12751276
pugi::xml_node node_sbml_filename = node_config_intracellular.child("sbml_filename");
12761277
if (!node_sbml_filename)
12771278
{
12781279
node_sbml_filename = node_config_intracellular.append_child("sbml_filename");
1279-
node_sbml_filename.append_child( pugi::node_pcdata );
1280+
node_sbml_filename.append_child(pugi::node_pcdata);
12801281
}
12811282
if (!node_sbml_filename.first_child().set_value(rr_filename.c_str()))
12821283
{
@@ -1291,4 +1292,4 @@ void set_intracellular_files(pugi::xml_node &node_config_intracellular, const pu
12911292
}
12921293
return;
12931294
}
1294-
};
1295+
};

0 commit comments

Comments
 (0)