AveragedSourcePde.hpp
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 #ifndef AVERAGEDSOURCEPDE_HPP_
00030 #define AVERAGEDSOURCEPDE_HPP_
00031
00032 #include "ChasteSerialization.hpp"
00033 #include <boost/serialization/base_object.hpp>
00034 #include <boost/serialization/vector.hpp>
00035
00036 #include "AbstractCellPopulation.hpp"
00037 #include "TetrahedralMesh.hpp"
00038 #include "AbstractLinearEllipticPde.hpp"
00039
00044 template<unsigned DIM>
00045 class AveragedSourcePde : public AbstractLinearEllipticPde<DIM,DIM>
00046 {
00047 friend class TestCellBasedPdes;
00048
00049 private:
00050
00052 friend class boost::serialization::access;
00059 template<class Archive>
00060 void serialize(Archive & archive, const unsigned int version)
00061 {
00062 archive & boost::serialization::base_object<AbstractLinearEllipticPde<DIM, DIM> >(*this);
00063 archive & mCoefficient;
00064 archive & mCellDensityOnCoarseElements;
00065 }
00066
00067 protected:
00068
00070 AbstractCellPopulation<DIM>& mrCellPopulation;
00071
00073 double mCoefficient;
00074
00076 std::vector<double> mCellDensityOnCoarseElements;
00077
00078 public:
00079
00086 AveragedSourcePde(AbstractCellPopulation<DIM>& rCellPopulation, double coefficient=0.0);
00087
00091 const AbstractCellPopulation<DIM>& rGetCellPopulation() const;
00092
00096 double GetCoefficient() const;
00097
00104 void virtual SetupSourceTerms(TetrahedralMesh<DIM,DIM>& rCoarseMesh, std::map<CellPtr, unsigned>* pCellPdeElementMap=NULL);
00105
00115 double ComputeConstantInUSourceTerm(const ChastePoint<DIM>& rX, Element<DIM,DIM>* pElement);
00116
00126 double ComputeLinearInUCoeffInSourceTerm(const ChastePoint<DIM>& rX, Element<DIM,DIM>* pElement);
00127
00135 c_matrix<double,DIM,DIM> ComputeDiffusionTerm(const ChastePoint<DIM>& rX);
00136
00142 double GetUptakeRateForElement(unsigned elementIndex);
00143 };
00144
00145 #include "SerializationExportWrapper.hpp"
00146 EXPORT_TEMPLATE_CLASS_SAME_DIMS(AveragedSourcePde)
00147
00148 namespace boost
00149 {
00150 namespace serialization
00151 {
00155 template<class Archive, unsigned DIM>
00156 inline void save_construct_data(
00157 Archive & ar, const AveragedSourcePde<DIM>* t, const BOOST_PFTO unsigned int file_version)
00158 {
00159
00160 const AbstractCellPopulation<DIM>* p_cell_population = &(t->rGetCellPopulation());
00161 ar & p_cell_population;
00162 }
00163
00167 template<class Archive, unsigned DIM>
00168 inline void load_construct_data(
00169 Archive & ar, AveragedSourcePde<DIM>* t, const unsigned int file_version)
00170 {
00171
00172 AbstractCellPopulation<DIM>* p_cell_population;
00173 ar >> p_cell_population;
00174
00175
00176 ::new(t)AveragedSourcePde<DIM>(*p_cell_population);
00177 }
00178 }
00179 }
00180
00181 #endif