38#include "ApoptoticCellProperty.hpp"
39#include "CellAncestor.hpp"
41#include "CellLabel.hpp"
42#include "DefaultCellProliferativeType.hpp"
43#include "NullSrnModel.hpp"
46Cell::Cell(boost::shared_ptr<AbstractCellProperty> pMutationState,
52 mCellPropertyCollection(cellPropertyCollection),
53 mpCellCycleModel(pCellCycleModel),
54 mpSrnModel(pSrnModel),
56 mStartOfApoptosisTime(DBL_MAX),
58 mUndergoingApoptosis(false),
65 EXCEPTION(
"Cell is setting up a cell-cycle model but SimulationTime has not been set up");
68 if (pCellCycleModel ==
nullptr)
76 if (pSrnModel ==
nullptr)
92 p_cell_id->AssignCellId();
98 EXCEPTION(
"Attempting to create cell with a cell mutation state that is not a subtype of AbstractCellMutationState");
140 (*property_iter)->IncrementCellCount();
159 EXCEPTION(
"Attempting to give cell a cell proliferative type that is not a subtype of AbstractCellProliferativeType");
164 p_old_proliferative_type->DecrementCellCount();
180 assert(proliferative_type_collection.
GetSize() == 1);
182 return boost::static_pointer_cast<AbstractCellProliferativeType>(proliferative_type_collection.
GetProperty());
245 EXCEPTION(
"Attempting to give cell a cell mutation state that is not a subtype of AbstractCellMutationState");
248 boost::shared_ptr<AbstractCellMutationState> p_old_mutation_state =
GetMutationState();
249 p_old_mutation_state->DecrementCellCount();
265 assert(mutation_state_collection.
GetSize() == 1);
267 return boost::static_pointer_cast<AbstractCellMutationState>(mutation_state_collection.
GetProperty());
278 assert(cell_data_collection.
GetSize() <= 1);
280 return boost::static_pointer_cast<CellData>(cell_data_collection.
GetProperty());
291 assert(collection.
GetSize() <= 1);
293 return boost::static_pointer_cast<CellEdgeData>(collection.
GetProperty());
311 assert(cell_data_collection.
GetSize() <= 1);
313 return boost::static_pointer_cast<CellVecData>(cell_data_collection.
GetProperty());
332 rProperty->IncrementCellCount();
352 EXCEPTION(
"StartApoptosis() called when already undergoing apoptosis");
384 assert(apoptosisTime > 0.0);
392 EXCEPTION(
"Shouldn't be checking time until apoptosis as it isn't set");
418 (*property_iter)->DecrementCellCount();
427 EXCEPTION(
"Attempting to give cell a cell ancestor which is not a CellAncestor");
432 if (ancestor_collection.
GetSize() == 0)
439 RemoveCellProperty<CellAncestor>();
448 assert(ancestor_collection.
GetSize() <= 1);
449 if (ancestor_collection.
GetSize() == 0)
454 boost::shared_ptr<CellAncestor> p_ancestor = boost::static_pointer_cast<CellAncestor>(ancestor_collection.
GetProperty());
456 return p_ancestor->GetAncestor();
463 assert(cell_id_collection.
GetSize() == 1);
465 boost::shared_ptr<CellId> p_cell_id = boost::static_pointer_cast<CellId>(cell_id_collection.
GetProperty());
467 return p_cell_id->GetCellId();
508 boost::shared_ptr<CellData> p_cell_data =
GetCellData();
513 daughter_property_collection.
AddProperty(p_daughter_cell_data);
521 daughter_property_collection.
AddProperty(p_daughter_cell_edge_data);
527 boost::shared_ptr<CellVecData> p_cell_vec_data =
GetCellVecData();
532 daughter_property_collection.
AddProperty(p_daughter_cell_vec_data);
539 p_new_cell->GetCellCycleModel()->InitialiseDaughterCell();
540 p_new_cell->GetSrnModel()->InitialiseDaughterCell();
#define EXCEPTION(message)
const unsigned UNSIGNED_UNSET
#define MAKE_PTR_ARGS(TYPE, NAME, ARGS)
#define MAKE_PTR(TYPE, NAME)
virtual void SetBirthTime(double birthTime)
virtual AbstractCellCycleModel * CreateCellCycleModel()=0
virtual void Initialise()
virtual bool ReadyToDivide()=0
void SetCell(CellPtr pCell)
virtual void ResetForDivision()
double GetBirthTime() const
virtual void SimulateToCurrentTime()=0
virtual AbstractSrnModel * CreateSrnModel()=0
virtual void SetCell(CellPtr pCell)
virtual void ResetForDivision()
virtual void Initialise()
bool HasProperty(const boost::shared_ptr< AbstractCellProperty > &rProp) const
boost::shared_ptr< AbstractCellProperty > GetProperty() const
bool HasPropertyType() const
CollectionType::iterator Iterator
CellPropertyCollection GetPropertiesType() const
void AddProperty(const boost::shared_ptr< AbstractCellProperty > &rProp)
CellPropertyRegistry * GetCellPropertyRegistry()
static CellPropertyRegistry * Instance()
boost::shared_ptr< AbstractCellProperty > Get()
unsigned GetCellId() const
AbstractSrnModel * GetSrnModel() const
AbstractCellCycleModel * GetCellCycleModel() const
void InitialiseSrnModel()
AbstractSrnModel * mpSrnModel
AbstractCellCycleModel * mpCellCycleModel
bool HasCellVecData() const
void SetSrnModel(AbstractSrnModel *pSrnModel)
Cell(boost::shared_ptr< AbstractCellProperty > pMutationState, AbstractCellCycleModel *pCellCycleModel, AbstractSrnModel *pSrnModel=nullptr, bool archiving=false, CellPropertyCollection cellPropertyCollection=CellPropertyCollection())
double mStartOfApoptosisTime
double GetBirthTime() const
double GetStartOfApoptosisTime() const
void AddCellProperty(const boost::shared_ptr< AbstractCellProperty > &rProperty)
void SetBirthTime(double birthTime)
boost::shared_ptr< AbstractCellProliferativeType > GetCellProliferativeType() const
CellPropertyCollection mCellPropertyCollection
bool mUndergoingApoptosis
void SetCellCycleModel(AbstractCellCycleModel *pCellCycleModel)
boost::shared_ptr< CellData > GetCellData() const
bool HasApoptosisBegun() const
unsigned GetAncestor() const
boost::shared_ptr< CellVecData > GetCellVecData() const
void SetApoptosisTime(double apoptosisTime)
double GetApoptosisTime() const
CellPropertyCollection & rGetCellPropertyCollection()
boost::shared_ptr< CellEdgeData > GetCellEdgeData() const
void SetMutationState(boost::shared_ptr< AbstractCellProperty > pMutationState)
void SetCellProliferativeType(boost::shared_ptr< AbstractCellProperty > pProliferativeType)
void SetAncestor(boost::shared_ptr< AbstractCellProperty > pCellAncestor)
void StartApoptosis(bool setDeathTime=true)
double GetTimeUntilDeath() const
void InitialiseCellCycleModel()
boost::shared_ptr< AbstractCellMutationState > GetMutationState() const
static SimulationTime * Instance()