AbstractCellCycleModel.cpp

00001 /*
00002 
00003 Copyright (C) University of Oxford, 2005-2009
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 
00031 AbstractCellCycleModel::AbstractCellCycleModel()
00032     : mpCell(NULL),
00033       mBirthTime(SimulationTime::Instance()->GetTime()),
00034       mCurrentCellCyclePhase(M_PHASE),
00035       mG1Duration(DOUBLE_UNSET),
00036       mReadyToDivide(false)
00037 {
00038 }
00039 
00040 
00041 AbstractCellCycleModel::~AbstractCellCycleModel()
00042 {
00043     // Don't delete the cell - the cell deletes the cell cycle model
00044     // when it is destroyed (not the following way round):
00045     // delete mpCell;
00046 }
00047 
00048 
00049 void AbstractCellCycleModel::SetCell(TissueCell* pCell)
00050 {
00051     mpCell = pCell;
00052 }
00053 
00054 
00055 TissueCell* AbstractCellCycleModel::GetCell()
00056 {
00057     assert(mpCell!=NULL);
00058     return mpCell;
00059 }
00060 
00061 
00062 void AbstractCellCycleModel::SetBirthTime(double birthTime)
00063 {
00064     mBirthTime = birthTime;
00065 }
00066 
00067 
00068 double AbstractCellCycleModel::GetBirthTime() const
00069 {
00070     return mBirthTime;
00071 }
00072 
00073 
00074 double AbstractCellCycleModel::GetAge()
00075 {
00076     return SimulationTime::Instance()->GetTime() - mBirthTime;
00077 }
00078 
00079 
00080 CellCyclePhase AbstractCellCycleModel::GetCurrentCellCyclePhase()
00081 {
00082     return mCurrentCellCyclePhase;
00083 }
00084 
00085 
00086 void AbstractCellCycleModel::ResetForDivision()
00087 {
00088     assert(mReadyToDivide);
00089     mCurrentCellCyclePhase = M_PHASE;
00090     mReadyToDivide = false;
00091 }
00092 
00093 
00094 double AbstractCellCycleModel::GetSDuration()
00095 {
00096     return TissueConfig::Instance()->GetSDuration();
00097 }
00098 
00099 
00100 double AbstractCellCycleModel::GetG1Duration()
00101 {
00102     return mG1Duration;
00103 }
00104 
00105 
00106 double AbstractCellCycleModel::GetG2Duration()
00107 {
00108     return TissueConfig::Instance()->GetG2Duration();
00109 }
00110 
00111 
00112 double AbstractCellCycleModel::GetMDuration()
00113 {
00114     return TissueConfig::Instance()->GetMDuration();
00115 }
00116 
00117 
00118 bool AbstractCellCycleModel::ReadyToDivide()
00119 {
00120     assert(mpCell != NULL);
00121 
00122     if (!mReadyToDivide)
00123     {
00124         UpdateCellCyclePhase();
00125         if ( (mCurrentCellCyclePhase != G_ZERO_PHASE) &&
00126              (GetAge() >= GetMDuration() + GetG1Duration() + GetSDuration() + GetG2Duration()) )
00127         {
00128             mReadyToDivide = true;
00129         }
00130     }
00131     return mReadyToDivide;
00132 }

Generated on Tue Aug 4 16:10:21 2009 for Chaste by  doxygen 1.5.5