TissueCell.hpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef TISSUECELL_HPP_
00029 #define TISSUECELL_HPP_
00030
00031 #include "ChasteSerialization.hpp"
00032 #include <boost/shared_ptr.hpp>
00033 #include <boost/serialization/shared_ptr.hpp>
00034
00035 #include "Element.hpp"
00036 #include "CellProliferativeTypes.hpp"
00037 #include "AbstractCellMutationState.hpp"
00038 #include "AbstractCellCycleModel.hpp"
00039 #include "SimulationTime.hpp"
00040
00041 class AbstractCellCycleModel;
00042
00043
00051 class TissueCell
00052 {
00053 private:
00054
00056 bool mCanDivide;
00057
00059 friend class boost::serialization::access;
00066 template<class Archive>
00067 void serialize(Archive & archive, const unsigned int version)
00068 {
00069
00070
00071
00072 archive & mCanDivide;
00073 archive & mCellProliferativeType;
00074 archive & mpMutationState;
00075 archive & mpCellCycleModel;
00076 archive & mUndergoingApoptosis;
00077 archive & mDeathTime;
00078 archive & mStartOfApoptosisTime;
00079 archive & mIsDead;
00080 archive & mIsLogged;
00081 archive & mAncestor;
00082 archive & mCellId;
00083 archive & mMaxCellId;
00084 }
00085
00086 protected:
00087
00088
00089
00091 CellProliferativeType mCellProliferativeType;
00092
00094 boost::shared_ptr<AbstractCellMutationState> mpMutationState;
00095
00097 AbstractCellCycleModel* mpCellCycleModel;
00098
00100 unsigned mAncestor;
00101
00103 unsigned mCellId;
00104
00106 static unsigned mMaxCellId;
00107
00109 double mDeathTime;
00110
00112 double mStartOfApoptosisTime;
00113
00115 bool mUndergoingApoptosis;
00116
00121 bool mIsDead;
00122
00124 bool mIsLogged;
00125
00131 void CommonCopy(const TissueCell& rOtherCell);
00132
00133 public:
00134
00143 TissueCell(CellProliferativeType cellType,
00144 boost::shared_ptr<AbstractCellMutationState> pMutationState,
00145 AbstractCellCycleModel* pCellCycleModel,
00146 bool archiving = false);
00147
00151 ~TissueCell();
00152
00157 TissueCell(const TissueCell& rOtherCell);
00158
00164 TissueCell& operator=(const TissueCell& rOtherCell);
00165
00171 void SetBirthTime(double birthTime);
00172
00178 void SetCellCycleModel(AbstractCellCycleModel* pCellCycleModel);
00179
00183 AbstractCellCycleModel* GetCellCycleModel() const;
00184
00188 void InitialiseCellCycleModel();
00189
00193 double GetAge() const;
00194
00198 double GetBirthTime() const;
00199
00203 double GetStartOfApoptosisTime() const;
00204
00208 CellProliferativeType GetCellProliferativeType() const;
00209
00215 void SetCellProliferativeType(CellProliferativeType cellType);
00216
00220 boost::shared_ptr<AbstractCellMutationState> GetMutationState() const;
00221
00227 void SetMutationState(boost::shared_ptr<AbstractCellMutationState> pMutationState);
00228
00233 bool ReadyToDivide();
00234
00241 TissueCell Divide();
00242
00249 void StartApoptosis(bool setDeathTime=true);
00250
00255 void Kill();
00256
00260 bool HasApoptosisBegun() const;
00261
00265 double GetTimeUntilDeath() const;
00266
00270 bool IsDead();
00271
00275 void SetLogged();
00276
00280 bool IsLogged();
00281
00287 void SetAncestor(unsigned ancestorIndex);
00288
00293 unsigned GetAncestor() const;
00294
00298 unsigned GetCellId() const;
00299
00303 static void ResetMaxCellId();
00304 };
00305
00306
00307 #include "SerializationExportWrapper.hpp"
00308 CHASTE_CLASS_EXPORT(TissueCell);
00309
00310 namespace boost
00311 {
00312 namespace serialization
00313 {
00317 template<class Archive>
00318 inline void save_construct_data(
00319 Archive & ar, const TissueCell * t, const BOOST_PFTO unsigned int file_version)
00320 {
00321
00322 const CellProliferativeType cell_type = t->GetCellProliferativeType();
00323 const boost::shared_ptr<AbstractCellMutationState> p_mutation_state = t->GetMutationState();
00324
00325 const AbstractCellCycleModel* const p_cell_cycle_model = t->GetCellCycleModel();
00326 ar << cell_type;
00327 ar << p_mutation_state;
00328 ar << p_cell_cycle_model;
00329 }
00330
00334 template<class Archive>
00335 inline void load_construct_data(
00336 Archive & ar, TissueCell * t, const unsigned int file_version)
00337 {
00338
00339 CellProliferativeType cell_type;
00340 boost::shared_ptr<AbstractCellMutationState> p_mutation_state;
00341 AbstractCellCycleModel* p_cell_cycle_model;
00342
00343 ar >> cell_type;
00344 ar >> p_mutation_state;
00345 ar >> p_cell_cycle_model;
00346 bool archiving = true;
00347
00348
00349 ::new(t)TissueCell(cell_type, p_mutation_state, p_cell_cycle_model, archiving);
00350 }
00351 }
00352 }
00353
00354 #endif