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
00029 #include "Alarcon2004OxygenBasedCellCycleModel.hpp"
00030
00031 #include "CellwiseData.hpp"
00032 #include "CellLabel.hpp"
00033 #include "PetscTools.hpp"
00034
00035 Alarcon2004OxygenBasedCellCycleModel::Alarcon2004OxygenBasedCellCycleModel(boost::shared_ptr<AbstractCellCycleModelOdeSolver> pOdeSolver)
00036 : AbstractOdeBasedCellCycleModel(SimulationTime::Instance()->GetTime(), pOdeSolver)
00037 {
00038 if (!mpOdeSolver)
00039 {
00040 mpOdeSolver = CellCycleModelOdeSolver<Alarcon2004OxygenBasedCellCycleModel, RungeKutta4IvpOdeSolver>::Instance();
00041 mpOdeSolver->Initialise();
00042 }
00043 SetDt(0.0001);
00044 }
00045
00046 void Alarcon2004OxygenBasedCellCycleModel::ResetForDivision()
00047 {
00048 AbstractOdeBasedCellCycleModel::ResetForDivision();
00049 assert(mpOdeSystem != NULL);
00050
00051
00052
00053 std::vector<double> init_conds = mpOdeSystem->GetInitialConditions();
00054 for (unsigned i=0; i<5; i++)
00055 {
00056 mpOdeSystem->rGetStateVariables()[i] = init_conds[i];
00057 }
00058 }
00059
00060 AbstractCellCycleModel* Alarcon2004OxygenBasedCellCycleModel::CreateCellCycleModel()
00061 {
00062
00063 Alarcon2004OxygenBasedCellCycleModel* p_model = new Alarcon2004OxygenBasedCellCycleModel(mpOdeSolver);
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 p_model->SetBirthTime(mBirthTime);
00078 p_model->SetDimension(mDimension);
00079 p_model->SetCellProliferativeType(mCellProliferativeType);
00080 p_model->SetMinimumGapDuration(mMinimumGapDuration);
00081 p_model->SetStemCellG1Duration(mStemCellG1Duration);
00082 p_model->SetTransitCellG1Duration(mTransitCellG1Duration);
00083 p_model->SetSDuration(mSDuration);
00084 p_model->SetG2Duration(mG2Duration);
00085 p_model->SetMDuration(mMDuration);
00086 p_model->SetDivideTime(mDivideTime);
00087 p_model->SetFinishedRunningOdes(mFinishedRunningOdes);
00088 p_model->SetG2PhaseStartTime(mG2PhaseStartTime);
00089 p_model->SetLastTime(mLastTime);
00090
00091
00092
00093
00094
00095 assert(mpOdeSystem);
00096 bool is_labelled = mpCell->HasCellProperty<CellLabel>();
00097 switch (mDimension)
00098 {
00099 case 1:
00100 {
00101 const unsigned DIM = 1;
00102 p_model->SetOdeSystem(new Alarcon2004OxygenBasedCellCycleOdeSystem(CellwiseData<DIM>::Instance()->GetValue(mpCell,0), is_labelled));
00103 break;
00104 }
00105 case 2:
00106 {
00107 const unsigned DIM = 2;
00108 p_model->SetOdeSystem(new Alarcon2004OxygenBasedCellCycleOdeSystem(CellwiseData<DIM>::Instance()->GetValue(mpCell,0), is_labelled));
00109 break;
00110 }
00111 case 3:
00112 {
00113 const unsigned DIM = 3;
00114 p_model->SetOdeSystem(new Alarcon2004OxygenBasedCellCycleOdeSystem(CellwiseData<DIM>::Instance()->GetValue(mpCell,0), is_labelled));
00115 break;
00116 }
00117 default:
00118 NEVER_REACHED;
00119 }
00120 p_model->SetStateVariables(mpOdeSystem->rGetStateVariables());
00121
00122 return p_model;
00123 }
00124
00125 void Alarcon2004OxygenBasedCellCycleModel::Initialise()
00126 {
00127 assert(mpOdeSystem == NULL);
00128 assert(mpCell != NULL);
00129
00130 bool is_labelled = mpCell->HasCellProperty<CellLabel>();
00131
00132 switch (mDimension)
00133 {
00134 case 1:
00135 {
00136 const unsigned DIM = 1;
00137 mpOdeSystem = new Alarcon2004OxygenBasedCellCycleOdeSystem(CellwiseData<DIM>::Instance()->GetValue(mpCell,0), is_labelled);
00138 break;
00139 }
00140 case 2:
00141 {
00142 const unsigned DIM = 2;
00143 mpOdeSystem = new Alarcon2004OxygenBasedCellCycleOdeSystem(CellwiseData<DIM>::Instance()->GetValue(mpCell,0), is_labelled);
00144 break;
00145 }
00146 case 3:
00147 {
00148 const unsigned DIM = 3;
00149 mpOdeSystem = new Alarcon2004OxygenBasedCellCycleOdeSystem(CellwiseData<DIM>::Instance()->GetValue(mpCell,0), is_labelled);
00150 break;
00151 }
00152 default:
00153 NEVER_REACHED;
00154 }
00155
00156 mpOdeSystem->SetStateVariables(mpOdeSystem->GetInitialConditions());
00157 }
00158
00159 void Alarcon2004OxygenBasedCellCycleModel::AdjustOdeParameters(double currentTime)
00160 {
00161
00162 switch (mDimension)
00163 {
00164 case 1:
00165 {
00166 const unsigned DIM = 1;
00167 mpOdeSystem->rGetStateVariables()[5] = CellwiseData<DIM>::Instance()->GetValue(mpCell, 0);
00168 break;
00169 }
00170 case 2:
00171 {
00172 const unsigned DIM = 2;
00173 mpOdeSystem->rGetStateVariables()[5] = CellwiseData<DIM>::Instance()->GetValue(mpCell, 0);
00174 break;
00175 }
00176 case 3:
00177 {
00178 const unsigned DIM = 3;
00179 mpOdeSystem->rGetStateVariables()[5] = CellwiseData<DIM>::Instance()->GetValue(mpCell, 0);
00180 break;
00181 }
00182 default:
00183 NEVER_REACHED;
00184 }
00185
00186
00187 bool is_labelled = mpCell->HasCellProperty<CellLabel>();
00188 static_cast<Alarcon2004OxygenBasedCellCycleOdeSystem*>(mpOdeSystem)->SetIsLabelled(is_labelled);
00189 }
00190
00191 void Alarcon2004OxygenBasedCellCycleModel::OutputCellCycleModelParameters(out_stream& rParamsFile)
00192 {
00193
00194
00195
00196 AbstractOdeBasedCellCycleModel::OutputCellCycleModelParameters(rParamsFile);
00197 }
00198
00199
00200 #include "SerializationExportWrapperForCpp.hpp"
00201 CHASTE_CLASS_EXPORT(Alarcon2004OxygenBasedCellCycleModel)
00202 #include "CellCycleModelOdeSolverExportWrapper.hpp"
00203 EXPORT_CELL_CYCLE_MODEL_ODE_SOLVER(Alarcon2004OxygenBasedCellCycleModel)