ContactInhibitionCellCycleModel.cpp

00001 /*
00002 
00003 Copyright (C) University of Oxford, 2005-2011
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 
00029 #include "ContactInhibitionCellCycleModel.hpp"
00030 #include "CellLabel.hpp"
00031 #include "CellwiseData.hpp"
00032 
00033 ContactInhibitionCellCycleModel::ContactInhibitionCellCycleModel()
00034     : AbstractSimpleCellCycleModel(),
00035       mQuiescentVolumeFraction(DOUBLE_UNSET),
00036       mEquilibriumVolume(DOUBLE_UNSET),
00037       mCurrentQuiescentOnsetTime(SimulationTime::Instance()->GetTime()),
00038       mCurrentQuiescentDuration(0.0)
00039 {
00040 }
00041 
00042 void ContactInhibitionCellCycleModel::UpdateCellCyclePhase()
00043 {
00044     if ((mQuiescentVolumeFraction == DOUBLE_UNSET) || (mEquilibriumVolume == DOUBLE_UNSET))
00045     {
00046         EXCEPTION("The member variables mQuiescentVolumeFraction and mEquilibriumVolume have not yet been set.");
00047     }
00048 
00049     // Get cell volume
00050     double cell_volume;
00051     switch (mDimension)
00052     {
00053         case 1:
00054         {
00055             const unsigned DIM = 1;
00056             cell_volume = CellwiseData<DIM>::Instance()->GetValue(mpCell, 0);
00057             break;
00058         }
00059         case 2:
00060         {
00061             const unsigned DIM = 2;
00062             cell_volume = CellwiseData<DIM>::Instance()->GetValue(mpCell, 0);
00063             break;
00064         }
00065         case 3:
00066         {
00067             const unsigned DIM = 3;
00068             cell_volume = CellwiseData<DIM>::Instance()->GetValue(mpCell, 0);
00069             break;
00070         }
00071         default:
00072             NEVER_REACHED;
00073     }
00074 
00075     // Removes the cell label
00076     mpCell->RemoveCellProperty<CellLabel>();
00077 
00078     if (mCurrentCellCyclePhase == G_ONE_PHASE)
00079     {
00080         // Update G1 duration based on cell volume
00081         double dt = SimulationTime::Instance()->GetTimeStep();
00082         double quiescent_volume = mEquilibriumVolume * mQuiescentVolumeFraction;
00083 
00084         if (cell_volume < quiescent_volume)
00085         {
00086             // Update the duration of the current period of hypoxia
00087             mCurrentQuiescentDuration = SimulationTime::Instance()->GetTime() - mCurrentQuiescentOnsetTime;
00088             mG1Duration += dt;
00089             mpCell->AddCellProperty(CellPropertyRegistry::Instance()->Get<CellLabel>());
00090         }
00091         else
00092         {
00093             // Reset the cell's quiescent duration and update the time at which the onset of quiescent occurs
00094             mCurrentQuiescentDuration = 0.0;
00095             mCurrentQuiescentOnsetTime = SimulationTime::Instance()->GetTime();
00096         }
00097     }
00098 
00099     double time_since_birth = GetAge();
00100     assert(time_since_birth >= 0);
00101 
00102     if (mpCell->GetCellCycleModel()->GetCellProliferativeType()==DIFFERENTIATED)
00103     {
00104         mCurrentCellCyclePhase = G_ZERO_PHASE;
00105     }
00106     else if ( time_since_birth < GetMDuration() )
00107     {
00108         mCurrentCellCyclePhase = M_PHASE;
00109     }
00110     else if ( time_since_birth < GetMDuration() + mG1Duration)
00111     {
00112         mCurrentCellCyclePhase = G_ONE_PHASE;
00113     }
00114     else if ( time_since_birth < GetMDuration() + mG1Duration + GetSDuration())
00115     {
00116         mCurrentCellCyclePhase = S_PHASE;
00117     }
00118     else if ( time_since_birth < GetMDuration() + mG1Duration + GetSDuration() + GetG2Duration())
00119     {
00120         mCurrentCellCyclePhase = G_TWO_PHASE;
00121     }
00122 }
00123 
00124 AbstractCellCycleModel* ContactInhibitionCellCycleModel::CreateCellCycleModel()
00125 {
00126     // Create a new cell-cycle model
00127     ContactInhibitionCellCycleModel* p_model = new ContactInhibitionCellCycleModel();
00128 
00129     /*
00130      * Set each member variable of the new cell-cycle model that inherits
00131      * its value from the parent.
00132      *
00133      * Note 1: some of the new cell-cycle model's member variables (namely
00134      * mBirthTime, mCurrentCellCyclePhase, mReadyToDivide, mTimeSpentInG1Phase,
00135      * mCurrentHypoxicDuration, mCurrentHypoxiaOnsetTime) will already have been
00136      * correctly initialized in its constructor.
00137      *
00138      * Note 2: one or more of the new cell-cycle model's member variables
00139      * may be set/overwritten as soon as InitialiseDaughterCell() is called on
00140      * the new cell-cycle model.
00141      */
00142     p_model->SetBirthTime(mBirthTime);
00143     p_model->SetDimension(mDimension);
00144     p_model->SetCellProliferativeType(mCellProliferativeType);
00145     p_model->SetMinimumGapDuration(mMinimumGapDuration);
00146     p_model->SetStemCellG1Duration(mStemCellG1Duration);
00147     p_model->SetTransitCellG1Duration(mTransitCellG1Duration);
00148     p_model->SetSDuration(mSDuration);
00149     p_model->SetG2Duration(mG2Duration);
00150     p_model->SetMDuration(mMDuration);
00151     p_model->SetQuiescentVolumeFraction(mQuiescentVolumeFraction);
00152     p_model->SetEquilibriumVolume(mEquilibriumVolume);
00153     p_model->SetCurrentQuiescentOnsetTime(mCurrentQuiescentOnsetTime);
00154     p_model->SetCurrentQuiescentDuration(mCurrentQuiescentDuration);
00155 
00156     return p_model;
00157 }
00158 
00159 void ContactInhibitionCellCycleModel::SetQuiescentVolumeFraction(double quiescentVolumeFraction)
00160 {
00161     mQuiescentVolumeFraction = quiescentVolumeFraction;
00162 }
00163 
00164 double ContactInhibitionCellCycleModel::GetQuiescentVolumeFraction()
00165 {
00166     return mQuiescentVolumeFraction;
00167 }
00168 
00169 void ContactInhibitionCellCycleModel::SetEquilibriumVolume(double equilibriumVolume)
00170 {
00171     mEquilibriumVolume = equilibriumVolume;
00172 }
00173 
00174 double ContactInhibitionCellCycleModel::GetEquilibriumVolume()
00175 {
00176     return mEquilibriumVolume;
00177 }
00178 
00179 void ContactInhibitionCellCycleModel::SetCurrentQuiescentDuration(double currentQuiescentDuration)
00180 {
00181     mCurrentQuiescentDuration = currentQuiescentDuration;
00182 }
00183 
00184 double ContactInhibitionCellCycleModel::GetCurrentQuiescentDuration()
00185 {
00186     return mCurrentQuiescentDuration;
00187 }
00188 
00189 void ContactInhibitionCellCycleModel::SetCurrentQuiescentOnsetTime(double currentQuiescentOnsetTime)
00190 {
00191     mCurrentQuiescentOnsetTime = currentQuiescentOnsetTime;
00192 }
00193 
00194 double ContactInhibitionCellCycleModel::GetCurrentQuiescentOnsetTime()
00195 {
00196     return mCurrentQuiescentOnsetTime;
00197 }
00198 
00199 void ContactInhibitionCellCycleModel::OutputCellCycleModelParameters(out_stream& rParamsFile)
00200 {
00201     *rParamsFile << "\t\t\t<QuiescentVolumeFraction>" << mQuiescentVolumeFraction << "</QuiescentVolumeFraction>\n";
00202     *rParamsFile << "\t\t\t<EquilibriumVolume>" << mEquilibriumVolume << "</EquilibriumVolume>\n";
00203 
00204     // Call method on direct parent class
00205     AbstractSimpleCellCycleModel::OutputCellCycleModelParameters(rParamsFile);
00206 }
00207 
00208 // Serialization for Boost >= 1.36
00209 #include "SerializationExportWrapperForCpp.hpp"
00210 CHASTE_CLASS_EXPORT(ContactInhibitionCellCycleModel)
Generated on Thu Dec 22 13:00:04 2011 for Chaste by  doxygen 1.6.3