Chaste Commit::baa90ac2819b962188b7562f2326be23c47859a7
AbstractCentreBasedCellPopulation.hpp
1/*
2
3Copyright (c) 2005-2024, University of Oxford.
4All rights reserved.
5
6University of Oxford means the Chancellor, Masters and Scholars of the
7University of Oxford, having an administrative office at Wellington
8Square, Oxford OX1 2JD, UK.
9
10This file is part of Chaste.
11
12Redistribution and use in source and binary forms, with or without
13modification, are permitted provided that the following conditions are met:
14 * Redistributions of source code must retain the above copyright notice,
15 this list of conditions and the following disclaimer.
16 * Redistributions in binary form must reproduce the above copyright notice,
17 this list of conditions and the following disclaimer in the documentation
18 and/or other materials provided with the distribution.
19 * Neither the name of the University of Oxford nor the names of its
20 contributors may be used to endorse or promote products derived from this
21 software without specific prior written permission.
22
23THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
29GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
32OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
34*/
35
36#ifndef ABSTRACTCENTREBASEDCELLPOPULATION_HPP_
37#define ABSTRACTCENTREBASEDCELLPOPULATION_HPP_
38
39#include "AbstractOffLatticeCellPopulation.hpp"
40#include "AbstractCentreBasedDivisionRule.hpp"
41
42template<unsigned ELEMENT_DIM, unsigned SPACE_DIM> class AbstractCentreBasedDivisionRule; // Circular definition thing.
43
51#ifdef DOXYGEN_CHASTE_ISSUE_199 // See https://github.com/Chaste/Chaste/issues/199
52template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
53#else
54template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
55#endif
57{
58private:
63
72 template<class Archive>
73 void serialize(Archive & archive, const unsigned int version)
74 {
75 archive & boost::serialization::base_object<AbstractOffLatticeCellPopulation<ELEMENT_DIM, SPACE_DIM> >(*this);
77 archive & mMarkedSprings;
79 }
80
81protected:
87
93 std::set<std::pair<CellPtr,CellPtr> > mMarkedSprings;
94
98 boost::shared_ptr<AbstractCentreBasedDivisionRule<ELEMENT_DIM, SPACE_DIM> > mpCentreBasedDivisionRule;
99
106
115 virtual void WriteVtkResultsToFile(const std::string& rDirectory)=0;
116
123
124public:
125
134 std::vector<CellPtr>& rCells,
135 const std::vector<unsigned> locationIndices=std::vector<unsigned>());
136
145 c_vector<double, SPACE_DIM> GetLocationOfCellCentre(CellPtr pCell);
146
155
171 virtual double GetCellDataItemAtPdeNode(unsigned pdeNodeIndex,
172 std::string& rVariableName,
173 bool dirichletBoundaryConditionApplies=false,
174 double dirichletBoundaryValue=0.0);
175
184 CellPtr AddCell(CellPtr pNewCell, CellPtr pParentCell=CellPtr());
185
195 std::pair<CellPtr,CellPtr> CreateCellPair(CellPtr pCell1, CellPtr pCell2);
196
202 bool IsMarkedSpring(const std::pair<CellPtr,CellPtr>& rCellPair);
203
209 void MarkSpring(std::pair<CellPtr,CellPtr>& rCellPair);
210
216 void UnmarkSpring(std::pair<CellPtr,CellPtr>& rCellPair);
217
225 bool IsCellAssociatedWithADeletedLocation(CellPtr pCell);
226
235 virtual std::set<unsigned> GetNeighbouringLocationIndices(CellPtr pCell);
236
246 virtual void CheckForStepSizeException(unsigned nodeIndex, c_vector<double,SPACE_DIM>& rDisplacement, double dt);
247
264 virtual double GetDampingConstant(unsigned nodeIndex);
265
274 virtual bool IsGhostNode(unsigned index);
275
284 virtual bool IsParticle(unsigned index);
285
294 virtual std::vector< std::pair<Node<SPACE_DIM>*, Node<SPACE_DIM>* > >& rGetNodePairs()=0;
295
300
306 void SetMeinekeDivisionSeparation(double divisionSeparation);
307
311 boost::shared_ptr<AbstractCentreBasedDivisionRule<ELEMENT_DIM, SPACE_DIM> > GetCentreBasedDivisionRule();
312
318 void SetCentreBasedDivisionRule(boost::shared_ptr<AbstractCentreBasedDivisionRule<ELEMENT_DIM, SPACE_DIM> > pCentreBasedDivisionRule);
319
325 virtual void OutputCellPopulationParameters(out_stream& rParamsFile);
326
337 virtual double GetDefaultTimeStep();
338};
339
340#endif /*ABSTRACTCENTREBASEDCELLPOPULATION_HPP_*/
void MarkSpring(std::pair< CellPtr, CellPtr > &rCellPair)
std::set< std::pair< CellPtr, CellPtr > > mMarkedSprings
void UnmarkSpring(std::pair< CellPtr, CellPtr > &rCellPair)
virtual void OutputCellPopulationParameters(out_stream &rParamsFile)
virtual void CheckForStepSizeException(unsigned nodeIndex, c_vector< double, SPACE_DIM > &rDisplacement, double dt)
std::pair< CellPtr, CellPtr > CreateCellPair(CellPtr pCell1, CellPtr pCell2)
void SetCentreBasedDivisionRule(boost::shared_ptr< AbstractCentreBasedDivisionRule< ELEMENT_DIM, SPACE_DIM > > pCentreBasedDivisionRule)
void serialize(Archive &archive, const unsigned int version)
void SetMeinekeDivisionSeparation(double divisionSeparation)
virtual std::vector< std::pair< Node< SPACE_DIM > *, Node< SPACE_DIM > * > > & rGetNodePairs()=0
virtual double GetDampingConstant(unsigned nodeIndex)
bool IsMarkedSpring(const std::pair< CellPtr, CellPtr > &rCellPair)
boost::shared_ptr< AbstractCentreBasedDivisionRule< ELEMENT_DIM, SPACE_DIM > > mpCentreBasedDivisionRule
virtual void WriteVtkResultsToFile(const std::string &rDirectory)=0
c_vector< double, SPACE_DIM > GetLocationOfCellCentre(CellPtr pCell)
virtual double GetCellDataItemAtPdeNode(unsigned pdeNodeIndex, std::string &rVariableName, bool dirichletBoundaryConditionApplies=false, double dirichletBoundaryValue=0.0)
virtual std::set< unsigned > GetNeighbouringLocationIndices(CellPtr pCell)
Node< SPACE_DIM > * GetNodeCorrespondingToCell(CellPtr pCell)
CellPtr AddCell(CellPtr pNewCell, CellPtr pParentCell=CellPtr())
boost::shared_ptr< AbstractCentreBasedDivisionRule< ELEMENT_DIM, SPACE_DIM > > GetCentreBasedDivisionRule()
Definition Node.hpp:59