AbstractCellCycleModel.cpp

00001 /*
00002 
00003 Copyright (C) University of Oxford, 2005-2010
00004 
00005 University of Oxford means the Chancellor, Masters and Scholars of the
00006 University of Oxford, having an administrative office at Wellington
00007 Square, Oxford OX1 2JD, UK.
00008 
00009 This file is part of Chaste.
00010 
00011 Chaste is free software: you can redistribute it and/or modify it
00012 under the terms of the GNU Lesser General Public License as published
00013 by the Free Software Foundation, either version 2.1 of the License, or
00014 (at your option) any later version.
00015 
00016 Chaste is distributed in the hope that it will be useful, but WITHOUT
00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00019 License for more details. The offer of Chaste under the terms of the
00020 License is subject to the License being interpreted in accordance with
00021 English Law and subject to any action against the University of Oxford
00022 being under the jurisdiction of the English Courts.
00023 
00024 You should have received a copy of the GNU Lesser General Public License
00025 along with Chaste. If not, see <http://www.gnu.org/licenses/>.
00026 
00027 */
00028 #include "AbstractCellCycleModel.hpp"
00029 
00030 AbstractCellCycleModel::AbstractCellCycleModel()
00031     : mpCell(NULL),
00032       mBirthTime(SimulationTime::Instance()->GetTime()),
00033       mCurrentCellCyclePhase(M_PHASE),
00034       mG1Duration(DOUBLE_UNSET),
00035       mReadyToDivide(false),
00036       mDimension(0)
00037 {
00038 }
00039 
00040 AbstractCellCycleModel::~AbstractCellCycleModel()
00041 {
00042     // Don't delete the cell - the cell deletes the cell cycle model
00043     // when it is destroyed (not the following way round):
00044     // delete mpCell;
00045 }
00046 
00047 void AbstractCellCycleModel::SetCell(TissueCell* pCell)
00048 {
00049     mpCell = pCell;
00050 }
00051 
00052 TissueCell* AbstractCellCycleModel::GetCell()
00053 {
00054     assert(mpCell!=NULL);
00055     return mpCell;
00056 }
00057 
00058 void AbstractCellCycleModel::SetBirthTime(double birthTime)
00059 {
00060     mBirthTime = birthTime;
00061 }
00062 
00063 double AbstractCellCycleModel::GetBirthTime() const
00064 {
00065     return mBirthTime;
00066 }
00067 
00068 double AbstractCellCycleModel::GetAge()
00069 {
00070     return SimulationTime::Instance()->GetTime() - mBirthTime;
00071 }
00072 
00073 CellCyclePhase AbstractCellCycleModel::GetCurrentCellCyclePhase()
00074 {
00075     return mCurrentCellCyclePhase;
00076 }
00077 
00078 void AbstractCellCycleModel::ResetForDivision()
00079 {
00080     assert(mReadyToDivide);
00081     mCurrentCellCyclePhase = M_PHASE;
00082     mReadyToDivide = false;
00083 }
00084 
00085 double AbstractCellCycleModel::GetSDuration()
00086 {
00087     return TissueConfig::Instance()->GetSDuration();
00088 }
00089 
00090 double AbstractCellCycleModel::GetG1Duration()
00091 {
00092     return mG1Duration;
00093 }
00094 
00095 double AbstractCellCycleModel::GetG2Duration()
00096 {
00097     return TissueConfig::Instance()->GetG2Duration();
00098 }
00099 
00100 double AbstractCellCycleModel::GetMDuration()
00101 {
00102     return TissueConfig::Instance()->GetMDuration();
00103 }
00104 
00105 bool AbstractCellCycleModel::ReadyToDivide()
00106 {
00107     assert(mpCell != NULL);
00108 
00109     if (!mReadyToDivide)
00110     {
00111         UpdateCellCyclePhase();
00112         if ( (mCurrentCellCyclePhase != G_ZERO_PHASE) &&
00113              (GetAge() >= GetMDuration() + GetG1Duration() + GetSDuration() + GetG2Duration()) )
00114         {
00115             mReadyToDivide = true;
00116         }
00117     }
00118     return mReadyToDivide;
00119 }
00120 
00121 void AbstractCellCycleModel::SetDimension(unsigned dimension)
00122 {
00123     if (dimension != 1 && dimension !=2 && dimension != 3)
00124     {
00125         EXCEPTION("Dimension must be 1, 2 or 3");
00126     }
00127     mDimension = dimension;
00128 }
00129 
00130 unsigned AbstractCellCycleModel::GetDimension()
00131 {
00132     return mDimension;
00133 }
00134 
00135 double AbstractCellCycleModel::GetAverageTransitCellCycleTime()
00136 {
00137     return TissueConfig::Instance()->GetTransitCellG1Duration()
00138             + TissueConfig::Instance()->GetSG2MDuration();
00139 }
00140 
00141 double AbstractCellCycleModel::GetAverageStemCellCycleTime()
00142 {
00143     return TissueConfig::Instance()->GetStemCellG1Duration()
00144             + TissueConfig::Instance()->GetSG2MDuration();
00145 }
00146 
00147 bool AbstractCellCycleModel::CanCellTerminallyDifferentiate()
00148 {
00149     return true;
00150 }

Generated by  doxygen 1.6.2