36 #include "AbstractCentreBasedCellPopulation.hpp" 37 #include "RandomDirectionCentreBasedDivisionRule.hpp" 38 #include "RandomNumberGenerator.hpp" 39 #include "StepSizeException.hpp" 40 #include "WildTypeCellMutationState.hpp" 42 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
44 std::vector<CellPtr>& rCells,
45 const std::vector<unsigned> locationIndices)
47 mMeinekeDivisionSeparation(0.3)
50 std::list<CellPtr>::iterator it = this->
mCells.begin();
53 for (
unsigned i=0; it != this->
mCells.end(); ++it, ++i, ++node_iter)
55 unsigned index = locationIndices.empty() ? node_iter->GetIndex() : locationIndices[i];
62 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
69 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
75 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
82 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
84 unsigned pdeNodeIndex,
85 std::string& rVariableName,
86 bool dirichletBoundaryConditionApplies,
87 double dirichletBoundaryValue)
90 double value = p_cell->GetCellData()->GetItem(rVariableName);
95 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
99 std::pair<c_vector<double, SPACE_DIM>, c_vector<double, SPACE_DIM> > positions =
mpCentreBasedDivisionRule->CalculateCellDivisionVector(pParentCell, *
this);
101 c_vector<double, SPACE_DIM> parent_position = positions.first;
102 c_vector<double, SPACE_DIM> daughter_position = positions.second;
107 this->
SetNode(node_index, parent_point);
116 if (this->
GetNode(node_index)->HasNodeAttributes())
121 unsigned new_node_index = this->
AddNode(p_new_node);
124 this->
mCells.push_back(pNewCell);
133 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
139 std::pair<CellPtr,CellPtr> cell_pair;
141 if (pCell1->GetCellId() < pCell2->GetCellId())
143 cell_pair.first = pCell1;
144 cell_pair.second = pCell2;
148 cell_pair.first = pCell2;
149 cell_pair.second = pCell1;
154 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
158 assert(rCellPair.first->GetCellId() < rCellPair.second->GetCellId());
163 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
167 assert(rCellPair.first->GetCellId() < rCellPair.second->GetCellId());
172 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
176 assert(rCellPair.first->GetCellId() < rCellPair.second->GetCellId());
181 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
187 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
194 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
197 double length = norm_2(rDisplacement);
201 std::ostringstream message;
202 message <<
"Cells are moving by " << length;
203 message <<
", which is more than the AbsoluteMovementThreshold: use a smaller timestep to avoid this exception.";
212 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
233 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
239 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
245 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
251 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
254 assert(divisionSeparation <= 1.0);
255 assert(divisionSeparation >= 0.0);
259 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
263 node_iter != this->
rGetMesh().GetNodeIteratorEnd();
276 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
282 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
288 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
294 *rParamsFile <<
"\t\t<CentreBasedDivisionRule>\n";
296 *rParamsFile <<
"\t\t</CentreBasedDivisionRule>\n";
302 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
boost::shared_ptr< AbstractCentreBasedDivisionRule< ELEMENT_DIM, SPACE_DIM > > mpCentreBasedDivisionRule
virtual Node< SPACE_DIM > * GetNode(unsigned index)=0
void UnmarkSpring(std::pair< CellPtr, CellPtr > &rCellPair)
virtual unsigned AddNode(Node< SPACE_DIM > *pNewNode)=0
virtual void AcceptCellWritersAcrossPopulation()
virtual CellPtr GetCellUsingLocationIndex(unsigned index)
unsigned GetLocationIndexUsingCell(CellPtr pCell)
std::vector< boost::shared_ptr< AbstractCellWriter< ELEMENT_DIM, SPACE_DIM > > > mCellWriters
double GetDampingConstantNormal()
bool IsCellAssociatedWithADeletedLocation(CellPtr pCell)
double GetDampingConstantMutant()
virtual double GetCellDataItemAtPdeNode(unsigned pdeNodeIndex, std::string &rVariableName, bool dirichletBoundaryConditionApplies=false, double dirichletBoundaryValue=0.0)
virtual bool IsParticle(unsigned index)
double GetMeinekeDivisionSeparation()
std::vector< double > & rGetNodeAttributes()
std::pair< CellPtr, CellPtr > CreateCellPair(CellPtr pCell1, CellPtr pCell2)
virtual bool IsGhostNode(unsigned index)
virtual void OutputCellPopulationParameters(out_stream &rParamsFile)
double mMeinekeDivisionSeparation
virtual void SetNode(unsigned nodeIndex, ChastePoint< SPACE_DIM > &rNewLocation)=0
void SetCellUsingLocationIndex(unsigned index, CellPtr pCell)
std::map< Cell *, unsigned > mCellLocationMap
virtual std::set< unsigned > GetNeighbouringLocationIndices(CellPtr pCell)
AbstractCentreBasedCellPopulation(AbstractMesh< ELEMENT_DIM, SPACE_DIM > &rMesh)
virtual std::set< unsigned > GetNeighbouringNodeIndices(unsigned index)=0
Node< SPACE_DIM > * GetNodeCorrespondingToCell(CellPtr pCell)
virtual void AcceptCellWriter(boost::shared_ptr< AbstractCellWriter< ELEMENT_DIM, SPACE_DIM > > pCellWriter, CellPtr pCell)=0
virtual double GetDefaultTimeStep()
boost::shared_ptr< AbstractCentreBasedDivisionRule< ELEMENT_DIM, SPACE_DIM > > GetCentreBasedDivisionRule()
CellPtr AddCell(CellPtr pNewCell, CellPtr pParentCell=CellPtr())
NodeIterator GetNodeIteratorBegin(bool skipDeletedNodes=true)
void MarkSpring(std::pair< CellPtr, CellPtr > &rCellPair)
double mAbsoluteMovementThreshold
virtual void OutputCellPopulationParameters(out_stream &rParamsFile)
bool IsMarkedSpring(const std::pair< CellPtr, CellPtr > &rCellPair)
std::list< CellPtr > mCells
AbstractMesh< ELEMENT_DIM, SPACE_DIM > & rGetMesh()
virtual void AddCellUsingLocationIndex(unsigned index, CellPtr pCell)
void SetMeinekeDivisionSeparation(double divisionSeparation)
virtual double GetDampingConstant(unsigned nodeIndex)
c_vector< double, SPACE_DIM > GetLocationOfCellCentre(CellPtr pCell)
std::set< std::pair< CellPtr, CellPtr > > mMarkedSprings
virtual void CheckForStepSizeException(unsigned nodeIndex, c_vector< double, SPACE_DIM > &rDisplacement, double dt)
virtual unsigned GetNumNodes()=0
void SetCentreBasedDivisionRule(boost::shared_ptr< AbstractCentreBasedDivisionRule< ELEMENT_DIM, SPACE_DIM > > pCentreBasedDivisionRule)