36 #include "CryptCentreBasedDivisionRule.hpp" 37 #include "RandomNumberGenerator.hpp" 40 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
49 c_vector<double, SPACE_DIM> random_vector;
52 c_vector<double, SPACE_DIM> daughter_coords;
59 random_vector(0) = 0.5*separation*random_direction;
60 c_vector<double, SPACE_DIM> proposed_new_parent_coords = parent_coords - random_vector;
61 c_vector<double, SPACE_DIM> proposed_new_daughter_coords = parent_coords + random_vector;
63 if ((proposed_new_parent_coords(0) >= 0.0) && (proposed_new_daughter_coords(0) >= 0.0))
66 parent_coords = proposed_new_parent_coords;
67 daughter_coords = proposed_new_daughter_coords;
71 proposed_new_daughter_coords = parent_coords + 2.0*random_vector;
72 while (proposed_new_daughter_coords(0) < 0.0)
75 random_vector(0) = 0.5*separation*fresh_random_direction;
76 proposed_new_daughter_coords = parent_coords + random_vector;
78 daughter_coords = proposed_new_daughter_coords;
82 assert(daughter_coords(0) >= 0.0);
83 assert(parent_coords(0) >= 0.0);
95 random_angle *= 2.0*M_PI;
97 random_vector(0) = 0.5*separation*cos(random_angle);
98 random_vector(1) = 0.5*separation*sin(random_angle);
100 c_vector<double, 2> proposed_new_parent_coords = parent_coords - random_vector;
101 c_vector<double, 2> proposed_new_daughter_coords = parent_coords + random_vector;
103 if ((proposed_new_parent_coords(1) >= 0.0) && (proposed_new_daughter_coords(1) >= 0.0))
106 parent_coords = proposed_new_parent_coords;
107 daughter_coords = proposed_new_daughter_coords;
111 proposed_new_daughter_coords = parent_coords + 2.0*random_vector;
112 while (proposed_new_daughter_coords(1) < 0.0)
115 random_angle *= 2.0*M_PI;
117 random_vector(0) = separation*cos(random_angle);
118 random_vector(1) = separation*sin(random_angle);
119 proposed_new_daughter_coords = parent_coords + random_vector;
121 daughter_coords = proposed_new_daughter_coords;
125 assert(daughter_coords(1) >= 0.0);
126 assert(parent_coords(1) >= 0.0);
131 EXCEPTION(
"CryptCentreBasedDivisionRule is not implemented for SPACE_DIM == 3");
139 std::pair<c_vector<double, SPACE_DIM>, c_vector<double, SPACE_DIM> > positions(parent_coords, daughter_coords);
#define EXCEPTION(message)
double GetMeinekeDivisionSeparation()
static RandomNumberGenerator * Instance()
virtual std::pair< c_vector< double, SPACE_DIM >, c_vector< double, SPACE_DIM > > CalculateCellDivisionVector(CellPtr pParentCell, AbstractCentreBasedCellPopulation< ELEMENT_DIM, SPACE_DIM > &rCellPopulation)
#define EXPORT_TEMPLATE_CLASS_ALL_DIMS(CLASS)
c_vector< double, SPACE_DIM > GetLocationOfCellCentre(CellPtr pCell)