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
00030
00031
00032
00033
00034
00035
00036 #ifndef SPHEREGEOMETRYBOUNDARYCONDITION_HPP_
00037 #define SPHEREGEOMETRYBOUNDARYCONDITION_HPP_
00038
00039 #include "AbstractCellPopulationBoundaryCondition.hpp"
00040
00041 #include "ChasteSerialization.hpp"
00042 #include <boost/serialization/base_object.hpp>
00043 #include <boost/serialization/vector.hpp>
00044
00051 template<unsigned DIM>
00052 class SphereGeometryBoundaryCondition : public AbstractCellPopulationBoundaryCondition<DIM>
00053 {
00054 private:
00055
00057 c_vector<double, DIM> mCentreOfSphere;
00058
00060 double mRadiusOfSphere;
00061
00063 double mMaximumDistance;
00064
00066 friend class boost::serialization::access;
00073 template<class Archive>
00074 void serialize(Archive & archive, const unsigned int version)
00075 {
00076 archive & boost::serialization::base_object<AbstractCellPopulationBoundaryCondition<DIM> >(*this);
00077 archive & mMaximumDistance;
00078 }
00079
00080 public:
00081
00090 SphereGeometryBoundaryCondition(AbstractCellPopulation<DIM>* pCellPopulation,
00091 c_vector<double, DIM> centre,
00092 double radius,
00093 double distance=1e-5);
00094
00098 const c_vector<double, DIM>& rGetCentreOfSphere() const;
00099
00103 double GetRadiusOfSphere() const;
00104
00112 void ImposeBoundaryCondition(const std::map<Node<DIM>*, c_vector<double, DIM> >& rOldLocations);
00113
00121 bool VerifyBoundaryCondition();
00122
00129 void OutputCellPopulationBoundaryConditionParameters(out_stream& rParamsFile);
00130 };
00131
00132 #include "SerializationExportWrapper.hpp"
00133 EXPORT_TEMPLATE_CLASS_SAME_DIMS(SphereGeometryBoundaryCondition)
00134
00135 namespace boost
00136 {
00137 namespace serialization
00138 {
00142 template<class Archive, unsigned DIM>
00143 inline void save_construct_data(
00144 Archive & ar, const SphereGeometryBoundaryCondition<DIM>* t, const BOOST_PFTO unsigned int file_version)
00145 {
00146
00147 const AbstractCellPopulation<DIM>* const p_cell_population = t->GetCellPopulation();
00148 ar << p_cell_population;
00149
00150
00151 c_vector<double, DIM> point = t->rGetCentreOfSphere();
00152 for (unsigned i=0; i<DIM; i++)
00153 {
00154 ar << point[i];
00155 }
00156
00157
00158 double radius = t->GetRadiusOfSphere();
00159 ar << radius;
00160 }
00161
00165 template<class Archive, unsigned DIM>
00166 inline void load_construct_data(
00167 Archive & ar, SphereGeometryBoundaryCondition<DIM>* t, const unsigned int file_version)
00168 {
00169
00170 AbstractCellPopulation<DIM>* p_cell_population;
00171 ar >> p_cell_population;
00172
00173
00174 c_vector<double, DIM> point;
00175 for (unsigned i=0; i<DIM; i++)
00176 {
00177 ar >> point[i];
00178 }
00179
00180
00181 double radius;
00182 ar >> radius;
00183
00184
00185 ::new(t)SphereGeometryBoundaryCondition<DIM>(p_cell_population, point, radius);
00186 }
00187 }
00188 }
00189
00190 #endif