CryptSimulation2d.hpp

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 #ifndef CRYPTSIMULATION2D_HPP_
00029 #define CRYPTSIMULATION2D_HPP_
00030 
00031 #include <boost/serialization/access.hpp>
00032 #include <boost/serialization/base_object.hpp>
00033 
00034 #include "TissueSimulation.hpp"
00035 #include "SimpleDataWriter.hpp"
00036 #include "MeshBasedTissueWithGhostNodes.hpp"
00037 
00038 // Needs to be included last
00039 #include <boost/serialization/export.hpp>
00040 
00041 
00046 class CryptSimulation2d : public TissueSimulation<2>
00047 {
00048     // Allow tests to access private members, in order to test computation of
00049     // private functions eg. DoCellBirth
00050     friend class TestCryptSimulation2d;
00051 
00052 private :
00053 
00055     friend class boost::serialization::access;
00062     template<class Archive>
00063     void serialize(Archive & archive, const unsigned int version)
00064     {
00065         // If Archive is an output archive, then & resolves to <<
00066         // If Archive is an input archive, then & resolves to >>
00067         archive & boost::serialization::base_object<TissueSimulation<2> >(*this);
00068         archive & mUseJiggledBottomCells;
00069     }
00070 
00072     bool mUseJiggledBottomCells;
00073 
00075     out_stream mBetaCatResultsFile;
00076 
00078     MeshBasedTissueWithGhostNodes<2> *mpStaticCastTissue;
00079 
00090     c_vector<double, 2> CalculateDividingCellCentreLocations(TissueCell* pParentCell);
00091 
00097     void WriteVisualizerSetupFile();
00098 
00102     void SetupWriteBetaCatenin();
00103 
00109     void WriteBetaCatenin(double time);
00110 
00116     void SetupSolve();
00117 
00123     void PostSolve();
00124 
00131     void AfterSolve();
00132 
00133 public :
00134 
00143     CryptSimulation2d(AbstractTissue<2>& rTissue,
00144                       std::vector<AbstractForce<2>*> forceCollection,
00145                       bool deleteTissueAndForceCollection=false,
00146                       bool initialiseCells=true);
00147 
00149     void UseJiggledBottomCells();
00150 
00160     void ApplyTissueBoundaryConditions(const std::vector<c_vector<double,2> >& rOldLocations);
00161 
00162 };
00163 
00164 
00165 // Declare identifier for the serializer
00166 BOOST_CLASS_EXPORT(CryptSimulation2d)
00167 
00168 namespace boost
00169 {
00170 namespace serialization
00171 {
00175 template<class Archive>
00176 inline void save_construct_data(
00177     Archive & ar, const CryptSimulation2d * t, const BOOST_PFTO unsigned int file_version)
00178 {
00179     // Save data required to construct instance
00180     const AbstractTissue<2> *p_tissue = &(t->rGetTissue());
00181     ar & p_tissue;
00182     const std::vector<AbstractForce<2>*> force_collection = t->rGetForceCollection();
00183     ar & force_collection;
00184 }
00185 
00189 template<class Archive>
00190 inline void load_construct_data(
00191     Archive & ar, CryptSimulation2d * t, const unsigned int file_version)
00192 {
00193     // Retrieve data from archive required to construct new instance
00194     AbstractTissue<2>*p_tissue;
00195     ar >> p_tissue;
00196     std::vector<AbstractForce<2>*> force_collection;
00197     ar >> force_collection;
00198 
00199     // Invoke inplace constructor to initialise instance
00200     ::new(t)CryptSimulation2d(*p_tissue, force_collection, true, false);
00201 }
00202 }
00203 } // namespace
00204 
00205 #endif /*CRYPTSIMULATION2D_HPP_*/
00206 

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