36 #include "GeometryTools.hpp" 37 #include "CellPopulationMigrationRule.hpp" 38 #include "RandomNumberGenerator.hpp" 40 template<
unsigned DIM>
49 template <
unsigned DIM>
56 template<
unsigned DIM>
62 template<
unsigned DIM>
65 if(volume_fraction >1.0)
67 EXCEPTION(
"Specified volume fractions should not be greater than 1.");
70 typedef std::map<boost::shared_ptr<AbstractCellMutationState> ,
double>::iterator it_type; it_type iterator;
73 if (iterator->first->IsSame(mutation_state))
75 iterator->second = volume_fraction;
87 template<
unsigned DIM>
90 typedef std::map<boost::shared_ptr<AbstractCellMutationState> ,
double>::iterator it_type; it_type iterator;
93 if (iterator->first->IsSame(mutation_state))
95 return iterator->second;
104 template<
unsigned DIM>
106 std::vector<unsigned> neighbourIndices,
unsigned gridIndex)
108 std::vector<double> probability_of_moving(neighbourIndices.size(), 0.0);
110 for(
unsigned idx=0; idx<neighbourIndices.size(); idx++)
113 double total_occupancy = 0.0;
119 if(total_occupancy>=1.0)
127 bool already_attached =
false;
128 for (
unsigned seg_index = 0; seg_index < pNode->GetNumberOfSegments(); seg_index++)
130 if(pNode->GetSegment(seg_index)->GetOppositeNode(pNode)->IsCoincident(neighbour_location))
132 already_attached =
true;
150 probability_of_moving[idx] = this->
mMovementProbability * SimulationTime::Instance()->GetTimeStep();
152 return probability_of_moving;
155 template<
unsigned DIM>
160 EXCEPTION(
"A regular grid is required for this type of migration rule.");
165 EXCEPTION(
"A vessel network is required for this type of migration rule.");
170 EXCEPTION(
"A cell population is required for this type of migration rule.");
176 std::vector<int> indices(rNodes.size(), -1);
179 std::vector<std::vector<boost::shared_ptr<VesselNode<DIM> > > > point_node_map = this->
mpGrid->GetPointNodeMap();
182 std::vector<std::vector<unsigned> > neighbour_indices = this->
mpGrid->GetNeighbourData();
185 for(
unsigned idx = 0; idx < rNodes.size(); idx++)
188 unsigned grid_index = this->
mpGrid->GetNearestGridIndex(rNodes[idx]->rGetLocation());
194 double sum = std::fabs(std::accumulate(probability_of_moving.begin(), probability_of_moving.end(), 0.0));
static boost::shared_ptr< CellPopulationMigrationRule< DIM > > Create()
double GetOccupyingVolumeFraction(boost::shared_ptr< AbstractCellMutationState > mutation_state)
virtual int GetNeighbourMovementIndex(std::vector< double > movementProbabilities, std::vector< unsigned > neighbourIndices)
virtual std::vector< double > GetNeighbourMovementProbabilities(boost::shared_ptr< VesselNode< DIM > > pNode, std::vector< unsigned > neighbourIndices, unsigned gridIndex)
boost::shared_ptr< RegularGrid< DIM > > mpGrid
virtual std::vector< int > GetIndices(const std::vector< boost::shared_ptr< VesselNode< DIM > > > &rNodes)
std::map< boost::shared_ptr< AbstractCellMutationState >, double > mVolumeFractionMap
boost::shared_ptr< AbstractCellPopulation< DIM > > mpCellPopulation
void SetVolumeFraction(boost::shared_ptr< AbstractCellMutationState > mutation_state, double volume_fraction)
boost::shared_ptr< VesselNetwork< DIM > > mpVesselNetwork
CellPopulationMigrationRule()
std::vector< std::vector< CellPtr > > mPointCellMap
double mMovementProbability
virtual ~CellPopulationMigrationRule()