SphereGeometryBoundaryCondition.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 SPHEREGEOMETRYBOUNDARYCONDITION_HPP_
00030 #define SPHEREGEOMETRYBOUNDARYCONDITION_HPP_
00031
00032 #include "AbstractCellPopulationBoundaryCondition.hpp"
00033
00034 #include "ChasteSerialization.hpp"
00035 #include <boost/serialization/base_object.hpp>
00036 #include <boost/serialization/vector.hpp>
00037
00044 template<unsigned DIM>
00045 class SphereGeometryBoundaryCondition : public AbstractCellPopulationBoundaryCondition<DIM>
00046 {
00047 private:
00048
00050 c_vector<double, DIM> mCentreOfSphere;
00051
00053 double mRadiusOfSphere;
00054
00056 double mMaximumDistance;
00057
00059 friend class boost::serialization::access;
00066 template<class Archive>
00067 void serialize(Archive & archive, const unsigned int version)
00068 {
00069 archive & boost::serialization::base_object<AbstractCellPopulationBoundaryCondition<DIM> >(*this);
00070 archive & mMaximumDistance;
00071 }
00072
00073 public:
00074
00083 SphereGeometryBoundaryCondition(AbstractCellPopulation<DIM>* pCellPopulation,
00084 c_vector<double, DIM> centre,
00085 double radius,
00086 double distance=1e-5);
00087
00091 const c_vector<double, DIM>& rGetCentreOfSphere() const;
00092
00096 double GetRadiusOfSphere() const;
00097
00105 void ImposeBoundaryCondition(const std::vector< c_vector<double, DIM> >& rOldLocations);
00106
00114 bool VerifyBoundaryCondition();
00115
00122 void OutputCellPopulationBoundaryConditionParameters(out_stream& rParamsFile);
00123 };
00124
00125 #include "SerializationExportWrapper.hpp"
00126 EXPORT_TEMPLATE_CLASS_SAME_DIMS(SphereGeometryBoundaryCondition)
00127
00128 namespace boost
00129 {
00130 namespace serialization
00131 {
00135 template<class Archive, unsigned DIM>
00136 inline void save_construct_data(
00137 Archive & ar, const SphereGeometryBoundaryCondition<DIM>* t, const BOOST_PFTO unsigned int file_version)
00138 {
00139
00140 const AbstractCellPopulation<DIM>* const p_cell_population = t->GetCellPopulation();
00141 ar << p_cell_population;
00142
00143
00144 c_vector<double, DIM> point = t->rGetCentreOfSphere();
00145 for (unsigned i=0; i<DIM; i++)
00146 {
00147 ar << point[i];
00148 }
00149
00150
00151 double radius = t->GetRadiusOfSphere();
00152 ar << radius;
00153 }
00154
00158 template<class Archive, unsigned DIM>
00159 inline void load_construct_data(
00160 Archive & ar, SphereGeometryBoundaryCondition<DIM>* t, const unsigned int file_version)
00161 {
00162
00163 AbstractCellPopulation<DIM>* p_cell_population;
00164 ar >> p_cell_population;
00165
00166
00167 c_vector<double, DIM> point;
00168 for (unsigned i=0; i<DIM; i++)
00169 {
00170 ar >> point[i];
00171 }
00172
00173
00174 double radius;
00175 ar >> radius;
00176
00177
00178 ::new(t)SphereGeometryBoundaryCondition<DIM>(p_cell_population, point, radius);
00179 }
00180 }
00181 }
00182
00183 #endif