38#include "ApoptoticCellProperty.hpp"
39#include "CellAncestor.hpp"
41#include "DefaultCellProliferativeType.hpp"
42#include "NullSrnModel.hpp"
45Cell::Cell(boost::shared_ptr<AbstractCellProperty> pMutationState,
51 mCellPropertyCollection(cellPropertyCollection),
52 mpCellCycleModel(pCellCycleModel),
53 mpSrnModel(pSrnModel),
55 mStartOfApoptosisTime(DBL_MAX),
57 mUndergoingApoptosis(false),
64 EXCEPTION(
"Cell is setting up a cell-cycle model but SimulationTime has not been set up");
67 if (pCellCycleModel ==
nullptr)
75 if (pSrnModel ==
nullptr)
91 p_cell_id->AssignCellId();
97 EXCEPTION(
"Attempting to create cell with a cell mutation state that is not a subtype of AbstractCellMutationState");
139 (*property_iter)->IncrementCellCount();
158 EXCEPTION(
"Attempting to give cell a cell proliferative type that is not a subtype of AbstractCellProliferativeType");
163 p_old_proliferative_type->DecrementCellCount();
179 assert(proliferative_type_collection.
GetSize() == 1);
181 return boost::static_pointer_cast<AbstractCellProliferativeType>(proliferative_type_collection.
GetProperty());
244 EXCEPTION(
"Attempting to give cell a cell mutation state that is not a subtype of AbstractCellMutationState");
247 boost::shared_ptr<AbstractCellMutationState> p_old_mutation_state =
GetMutationState();
248 p_old_mutation_state->DecrementCellCount();
264 assert(mutation_state_collection.
GetSize() == 1);
266 return boost::static_pointer_cast<AbstractCellMutationState>(mutation_state_collection.
GetProperty());
277 assert(cell_data_collection.
GetSize() <= 1);
279 return boost::static_pointer_cast<CellData>(cell_data_collection.
GetProperty());
290 assert(collection.
GetSize() <= 1);
292 return boost::static_pointer_cast<CellEdgeData>(collection.
GetProperty());
310 assert(cell_data_collection.
GetSize() <= 1);
312 return boost::static_pointer_cast<CellVecData>(cell_data_collection.
GetProperty());
331 rProperty->IncrementCellCount();
351 EXCEPTION(
"StartApoptosis() called when already undergoing apoptosis");
383 assert(apoptosisTime > 0.0);
391 EXCEPTION(
"Shouldn't be checking time until apoptosis as it isn't set");
417 (*property_iter)->DecrementCellCount();
426 EXCEPTION(
"Attempting to give cell a cell ancestor which is not a CellAncestor");
431 if (ancestor_collection.
GetSize() == 0)
438 RemoveCellProperty<CellAncestor>();
447 assert(ancestor_collection.
GetSize() <= 1);
448 if (ancestor_collection.
GetSize() == 0)
453 boost::shared_ptr<CellAncestor> p_ancestor = boost::static_pointer_cast<CellAncestor>(ancestor_collection.
GetProperty());
455 return p_ancestor->GetAncestor();
462 assert(cell_id_collection.
GetSize() == 1);
464 boost::shared_ptr<CellId> p_cell_id = boost::static_pointer_cast<CellId>(cell_id_collection.
GetProperty());
466 return p_cell_id->GetCellId();
507 boost::shared_ptr<CellData> p_cell_data =
GetCellData();
512 daughter_property_collection.
AddProperty(p_daughter_cell_data);
520 daughter_property_collection.
AddProperty(p_daughter_cell_edge_data);
526 boost::shared_ptr<CellVecData> p_cell_vec_data =
GetCellVecData();
531 daughter_property_collection.
AddProperty(p_daughter_cell_vec_data);
538 p_new_cell->GetCellCycleModel()->InitialiseDaughterCell();
539 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()