36 #include "CryptShovingCaBasedDivisionRule.hpp" 37 #include "RandomNumberGenerator.hpp" 38 #include "StemCellProliferativeType.hpp" 43 unsigned num_neighbours = neighbouring_node_indices.size();
46 if (num_neighbours == 4)
50 else if (num_neighbours == 3)
53 if (NodeIndex < 0.5*pPottsMesh->GetNumNodes())
59 EXCEPTION(
"Cells reaching the top of the crypt need to increase length to at least double the sloughing height.");
84 bool is_not_on_base =
IsNodeOnBase(parent_node_index,static_cast_mesh);
103 std::set<unsigned>::iterator neighbour_iter = neighbouring_node_indices.begin();
104 for (
unsigned i=0; i<direction; i++)
108 assert(neighbour_iter != neighbouring_node_indices.end());
110 unsigned daughter_node_index = *neighbour_iter;
112 assert(daughter_node_index < static_cast_mesh->GetNumNodes());
117 std::list<std::pair<unsigned,unsigned> > cell_moves;
119 bool is_neighbour_occupied =
true;
121 unsigned current_node_index = parent_node_index;
122 unsigned target_node_index = daughter_node_index;
123 while (is_neighbour_occupied)
125 current_node_index = target_node_index;
128 unsigned num_neighbours = neighbouring_node_indices.size();
134 std::set<unsigned>::iterator neighbour_iter = neighbouring_node_indices.begin();
135 for (
unsigned i=0; i<num_neighbours-1; i++)
139 assert(neighbour_iter != neighbouring_node_indices.end());
141 target_node_index = *neighbour_iter;
143 std::pair<unsigned, unsigned> new_move(current_node_index, target_node_index);
145 cell_moves.push_back(new_move);
150 is_neighbour_occupied =
false;
154 current_node_index = target_node_index;
158 for (std::list<std::pair<unsigned, unsigned> >::reverse_iterator reverse_iter = cell_moves.rbegin();
159 reverse_iter != cell_moves.rend();
162 assert(rCellPopulation.
IsSiteAvailable(reverse_iter->second, pNewCell));
163 assert(!(rCellPopulation.
IsSiteAvailable(reverse_iter->first, pNewCell)));
170 assert(rCellPopulation.
IsSiteAvailable(daughter_node_index, pNewCell));
173 return daughter_node_index;
virtual bool IsRoomToDivide(CellPtr pParentCell, CaBasedCellPopulation< 2 > &rCellPopulation)
unsigned randMod(unsigned base)
virtual CellPtr GetCellUsingLocationIndex(unsigned index)
PottsMesh< DIM > & rGetMesh()
unsigned GetLocationIndexUsingCell(CellPtr pCell)
bool IsNodeOnBase(unsigned NodeIndex, PottsMesh< 2 > *pPottsMesh)
#define EXCEPTION(message)
virtual bool IsSiteAvailable(unsigned index, CellPtr pCell)
std::set< unsigned > GetVonNeumannNeighbouringNodeIndices(unsigned nodeIndex)
void MoveCellInLocationMap(CellPtr pCell, unsigned old_index, unsigned new_index)
static RandomNumberGenerator * Instance()
virtual unsigned CalculateDaughterNodeIndex(CellPtr pNewCell, CellPtr pParentCell, CaBasedCellPopulation< 2 > &rCellPopulation)
#define CHASTE_CLASS_EXPORT(T)