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;
62 proposed_new_parent_coords(0) = parent_coords(0) - random_vector(0);
63 c_vector<double, SPACE_DIM> proposed_new_daughter_coords;
64 proposed_new_daughter_coords = parent_coords + random_vector;
66 if ((proposed_new_parent_coords(0) >= 0.0) && (proposed_new_daughter_coords(0) >= 0.0))
69 parent_coords = proposed_new_parent_coords;
70 daughter_coords = proposed_new_daughter_coords;
74 proposed_new_daughter_coords = parent_coords + 2.0*random_vector;
75 while (proposed_new_daughter_coords(0) < 0.0)
78 random_vector(0) = 0.5*separation*fresh_random_direction;
79 proposed_new_daughter_coords = parent_coords + random_vector;
81 daughter_coords = proposed_new_daughter_coords;
85 assert(daughter_coords(0) >= 0.0);
86 assert(parent_coords(0) >= 0.0);
98 random_angle *= 2.0*M_PI;
100 random_vector(0) = 0.5*separation*cos(random_angle);
101 random_vector(1) = 0.5*separation*sin(random_angle);
103 c_vector<double, 2> proposed_new_parent_coords;
104 proposed_new_parent_coords = parent_coords - random_vector;
105 c_vector<double, 2> proposed_new_daughter_coords;
106 proposed_new_daughter_coords = parent_coords + random_vector;
108 if ((proposed_new_parent_coords(1) >= 0.0) && (proposed_new_daughter_coords(1) >= 0.0))
111 parent_coords = proposed_new_parent_coords;
112 daughter_coords = proposed_new_daughter_coords;
116 proposed_new_daughter_coords = parent_coords + 2.0*random_vector;
117 while (proposed_new_daughter_coords(1) < 0.0)
120 random_angle *= 2.0*M_PI;
122 random_vector(0) = separation*cos(random_angle);
123 random_vector(1) = separation*sin(random_angle);
124 proposed_new_daughter_coords = parent_coords + random_vector;
126 daughter_coords = proposed_new_daughter_coords;
130 assert(daughter_coords(1) >= 0.0);
131 assert(parent_coords(1) >= 0.0);
136 EXCEPTION(
"CryptCentreBasedDivisionRule is not implemented for SPACE_DIM == 3");
144 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)