CryptSimulation2d.hpp

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 #ifndef CRYPTSIMULATION2D_HPP_
00030 #define CRYPTSIMULATION2D_HPP_
00031 
00032 #include "ChasteSerialization.hpp"
00033 #include <boost/serialization/base_object.hpp>
00034 
00035 #include "WntConcentration.hpp"
00036 #include "OffLatticeSimulation.hpp"
00037 #include "MeshBasedCellPopulationWithGhostNodes.hpp"
00038 #include "VertexBasedCellPopulation.hpp"
00039 #include "CryptSimulationBoundaryCondition.hpp"
00040 
00046 class CryptSimulation2d : public OffLatticeSimulation<2>
00047 {
00048     // Allow tests to access private members, in order to test computation of private functions e.g. DoCellBirth()
00049     friend class TestCryptSimulation2dWithMeshBasedCellPopulation;
00050     friend class TestCryptSimulation2dWithVertexBasedCellPopulation;
00051 
00052 protected:
00053 
00055     friend class boost::serialization::access;
00062     template<class Archive>
00063     void serialize(Archive & archive, const unsigned int version)
00064     {
00065         archive & boost::serialization::base_object<OffLatticeSimulation<2> >(*this);
00066 
00067         SerializableSingleton<WntConcentration<2> >* p_wnt_wrapper = WntConcentration<2>::Instance()->GetSerializationWrapper();
00068         archive & p_wnt_wrapper;
00069 
00070         archive & mWriteBetaCatenin;
00071     }
00072 
00079     bool mWriteBetaCatenin;
00080 
00082     out_stream mVizBetaCateninResultsFile;
00083 
00088     bool mUsingMeshBasedCellPopulation;
00089 
00108     c_vector<double, 2> CalculateCellDivisionVector(CellPtr pParentCell);
00109 
00113     void SetupWriteBetaCatenin();
00114 
00120     virtual void WriteBetaCatenin(double time);
00121 
00127     void SetupSolve();
00128 
00134     void PostSolve();
00135 
00142     void AfterSolve();
00143 
00144 public:
00145 
00154     CryptSimulation2d(AbstractCellPopulation<2>& rCellPopulation,
00155                       bool deleteCellPopulationInDestructor=false,
00156                       bool initialiseCells=true);
00157 
00163     virtual ~CryptSimulation2d();
00164 
00168     void UseJiggledBottomCells();
00169 
00174     void SetBottomCellAncestors();
00175 
00184     void OutputSimulationParameters(out_stream& rParamsFile);
00185 };
00186 
00187 // Declare identifier for the serializer
00188 #include "SerializationExportWrapper.hpp"
00189 CHASTE_CLASS_EXPORT(CryptSimulation2d)
00190 
00191 namespace boost
00192 {
00193 namespace serialization
00194 {
00198 template<class Archive>
00199 inline void save_construct_data(
00200     Archive & ar, const CryptSimulation2d * t, const BOOST_PFTO unsigned int file_version)
00201 {
00202     // Save data required to construct instance
00203     const AbstractCellPopulation<2>* p_cell_population = &(t->rGetCellPopulation());
00204     ar & p_cell_population;
00205 }
00206 
00210 template<class Archive>
00211 inline void load_construct_data(
00212     Archive & ar, CryptSimulation2d * t, const unsigned int file_version)
00213 {
00214     // Retrieve data from archive required to construct new instance
00215     AbstractCellPopulation<2>* p_cell_population;
00216     ar & p_cell_population;
00217 
00218     // Invoke inplace constructor to initialise instance
00219     ::new(t)CryptSimulation2d(*p_cell_population, true, false);
00220 }
00221 }
00222 } // namespace
00223 
00224 #endif /*CRYPTSIMULATION2D_HPP_*/
Generated on Thu Dec 22 13:00:05 2011 for Chaste by  doxygen 1.6.3