MonodomainTissue.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 
00030 #ifndef MONODOMAINTISSUE_HPP_
00031 #define MONODOMAINTISSUE_HPP_
00032 
00033 #include "ChasteSerialization.hpp"
00034 #include <boost/serialization/vector.hpp>
00035 #include <boost/serialization/base_object.hpp>
00036 
00037 #include <vector>
00038 #include "AbstractCardiacTissue.hpp"
00039 
00040 
00047 template <unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
00048 class MonodomainTissue : public virtual AbstractCardiacTissue<ELEMENT_DIM,SPACE_DIM>
00049 {
00050 private:
00051     friend class TestMonodomainTissue;
00052 
00054     friend class boost::serialization::access;
00061     template<class Archive>
00062     void serialize(Archive & archive, const unsigned int version)
00063     {
00064         archive & boost::serialization::base_object<AbstractCardiacTissue<ELEMENT_DIM, SPACE_DIM> >(*this);
00065     }
00066 
00067 
00068 public:
00075     MonodomainTissue(AbstractCardiacCellFactory<ELEMENT_DIM,SPACE_DIM>* pCellFactory, bool exchangeHalos=false);
00076 
00082     MonodomainTissue(AbstractTetrahedralMesh<ELEMENT_DIM,SPACE_DIM>* pMesh);
00083 };
00084 
00085 
00086 // Declare identifier for the serializer
00087 #include "SerializationExportWrapper.hpp" // Must be last
00088 EXPORT_TEMPLATE_CLASS2(MonodomainTissue, 1, 1)
00089 EXPORT_TEMPLATE_CLASS2(MonodomainTissue, 1, 2)
00090 EXPORT_TEMPLATE_CLASS2(MonodomainTissue, 1, 3)
00091 EXPORT_TEMPLATE_CLASS2(MonodomainTissue, 2, 2)
00092 EXPORT_TEMPLATE_CLASS2(MonodomainTissue, 3, 3)
00093 
00094 namespace boost
00095 {
00096 namespace serialization
00097 {
00098 
00099 template<class Archive, unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00100 inline void save_construct_data(
00101     Archive & ar, const MonodomainTissue<ELEMENT_DIM, SPACE_DIM> * t, const unsigned int file_version)
00102 {
00103     const AbstractTetrahedralMesh<ELEMENT_DIM,SPACE_DIM>* p_mesh = t->pGetMesh();
00104     ar & p_mesh;
00105 
00106     // CreateIntracellularConductivityTensor() is called by constructor and uses HeartConfig. So make sure that it is
00107     // archived too (needs doing before construction so appears here instead of usual archive location).
00108     HeartConfig* p_config = HeartConfig::Instance();
00109     ar & *p_config;
00110     ar & p_config;
00111 }
00112 
00117 template<class Archive, unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00118 inline void load_construct_data(
00119     Archive & ar, MonodomainTissue<ELEMENT_DIM, SPACE_DIM> * t, const unsigned int file_version)
00120 {
00121     AbstractTetrahedralMesh<ELEMENT_DIM,SPACE_DIM>* p_mesh;
00122     ar & p_mesh;
00123     
00124     // CreateIntracellularConductivityTensor() is called by AbstractCardiacTissue constructor and uses HeartConfig.
00125     // So make sure that it is archived too (needs doing before construction so appears here instead of usual archive location).
00126     HeartConfig* p_config = HeartConfig::Instance();
00127     ar & *p_config;
00128     ar & p_config;
00129 
00130     ::new(t)MonodomainTissue<ELEMENT_DIM, SPACE_DIM>(p_mesh);
00131 }
00132 }
00133 } // namespace ...
00134 
00135 
00136 #endif /*MONODOMAINTISSUE_HPP_*/

Generated on Mon Apr 18 11:35:28 2011 for Chaste by  doxygen 1.5.5