text: /*
  
  Copyright (c) 2005-2015, University of Oxford.
  All rights reserved.
  
  University of Oxford means the Chancellor, Masters and Scholars of the
  University of Oxford, having an administrative office at Wellington
  Square, Oxford OX1 2JD, UK.
  
  This file is part of Chaste.
  
  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions are met:
   * Redistributions of source code must retain the above copyright notice,
     this list of conditions and the following disclaimer.
   * Redistributions in binary form must reproduce the above copyright notice,
     this list of conditions and the following disclaimer in the documentation
     and/or other materials provided with the distribution.
   * Neither the name of the University of Oxford nor the names of its
     contributors may be used to endorse or promote products derived from this
     software without specific prior written permission.
  
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
  */
  
  #ifndef TYSONNOVAKCELLCYCLEMODEL_HPP_
  #define TYSONNOVAKCELLCYCLEMODEL_HPP_
  
  #include "ChasteSerialization.hpp"
  #include <boost/serialization/base_object.hpp>
  
  #include "AbstractOdeBasedCellCycleModel.hpp"
  #include "TysonNovak2001OdeSystem.hpp"
  
  
  /**
   *  Tyson-Novak 2001 cell-cycle model, taken from the version at  doi:10.1006/jtbi.2001.2293
   *
   *  Note that this is not a model for murine or human colonic-cell cycling, but is
   *  included in chaste as one of the most commonly known ODE based cell-cycle models.
   *
   *  Time taken to progress through the cycle is deterministic and given by
   *  an ODE system independent of external factors.
   */
  class TysonNovakCellCycleModel : public AbstractOdeBasedCellCycleModel
  {
  private:
  
      friend class TestOdeBasedCellCycleModels;
  
      /** Needed for serialization. */
      friend class boost::serialization::access;
      /**
       * Archive the cell-cycle model, never used directly - boost uses this.
       *
       * @param archive the archive
       * @param version the current version of this class
       */
      template<class Archive>
      void serialize(Archive & archive, const unsigned int version)
      {
          archive & boost::serialization::base_object<AbstractOdeBasedCellCycleModel>(*this);
      }
  
  public:
  
      /**
       * Default constructor.
       *
       * @param pOdeSolver An optional pointer to a cell-cycle model ODE solver object (allows the use of different ODE solvers)
       */
      TysonNovakCellCycleModel(boost::shared_ptr<AbstractCellCycleModelOdeSolver> pOdeSolver = boost::shared_ptr<AbstractCellCycleModelOdeSolver>());
  
      /**
       * Initialise the cell-cycle model at the start of a simulation.
       *
       * This method will be called precisely once per cell set up in the initial
       * cell population. It is not called on cell division; use ResetForDivision(),
       * CreateCellCycleModel() and InitialiseDaughterCell() for that.
       *
       * By the time this is called, a CellPopulation will have been set up, so the model
       * can know where its cell is located in space. If relevant to the simulation,
       * any singletons will also have been initialised.
       */
      void Initialise();
  
      /**
       * Reset cell-cycle model by calling AbstractOdeBasedCellCycleModelWithStoppingEvent::ResetForDivision()
       * and setting initial conditions for protein concentrations.
       */
      void ResetForDivision();
  
      /**
       * Overridden builder method to create new copies of
       * this cell-cycle model.
       * @return new cell-cycle model
       */
      AbstractCellCycleModel* CreateCellCycleModel();
  
      /**
       * @return the duration of the cell's S phase.
       */
      double GetSDuration();
  
      /**
       * @return the duration of the cell's G2 phase.
       */
      double GetG2Duration();
  
      /**
       * @return the duration of the cell's M phase.
       */
      double GetMDuration();
  
      /**
       * If the daughter cell type is stem, change it to transit.
       */
      void InitialiseDaughterCell();
  
      /**
       * Overridden GetAverageTransitCellCycleTime() method.
       * @return time
       */
      double GetAverageTransitCellCycleTime();
  
      /**
       * Overridden GetAverageStemCellCycleTime() method.
       * @return time
       */
      double GetAverageStemCellCycleTime();
  
      /**
       * Overridden CanCellTerminallyDifferentiate() method.
       * @return whether cell can terminally differentiate
       */
      bool CanCellTerminallyDifferentiate();
  
      /**
       * Outputs cell cycle model parameters to file.
       *
       * @param rParamsFile the file stream to which the parameters are output
       */
      virtual void OutputCellCycleModelParameters(out_stream& rParamsFile);
  };
  
  // Declare identifier for the serializer
  #include "SerializationExportWrapper.hpp"
  CHASTE_CLASS_EXPORT(TysonNovakCellCycleModel)
  #include "CellCycleModelOdeSolverExportWrapper.hpp"
  EXPORT_CELL_CYCLE_MODEL_ODE_SOLVER(TysonNovakCellCycleModel)
  
  #endif /*TYSONNOVAKCELLCYCLEMODEL_HPP_*/
  