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 #ifndef CYLINDRICAL2DMESH_HPP_
00029 #define CYLINDRICAL2DMESH_HPP_
00030
00031 #include "ChasteSerialization.hpp"
00032 #include <boost/serialization/base_object.hpp>
00033
00034 #include <cmath>
00035 #include <map>
00036
00037 #include "MutableMesh.hpp"
00038 #include "TrianglesMeshWriter.hpp"
00039
00048 class Cylindrical2dMesh : public MutableMesh<2,2>
00049 {
00050 friend class TestCylindrical2dMesh;
00051 private:
00052
00054 double mWidth;
00055
00057 double mTop;
00058
00060 double mBottom;
00061
00063 std::vector<unsigned> mLeftOriginals;
00064
00066 std::vector<unsigned> mLeftImages;
00067
00069 std::map<unsigned, unsigned> mImageToLeftOriginalNodeMap;
00070
00072 std::vector<unsigned> mRightOriginals;
00073
00075 std::vector<unsigned> mRightImages;
00076
00078 std::map<unsigned, unsigned> mImageToRightOriginalNodeMap;
00079
00081 std::set<unsigned> mLeftPeriodicBoundaryElementIndices;
00082
00084 std::set<unsigned> mRightPeriodicBoundaryElementIndices;
00085
00087 std::vector<unsigned > mTopHaloNodes;
00088
00090 std::vector<unsigned > mBottomHaloNodes;
00091
00098 void UpdateTopAndBottom();
00099
00108 void CreateHaloNodes();
00109
00116 void CreateMirrorNodes();
00117
00130 void ReconstructCylindricalMesh();
00131
00138 void DeleteHaloNodes();
00139
00150 void CorrectNonPeriodicMesh();
00151
00162 void GenerateVectorsOfElementsStraddlingPeriodicBoundaries();
00163
00171 unsigned GetCorrespondingNodeIndex(unsigned nodeIndex);
00172
00183 void UseTheseElementsToDecideMeshing(std::set<unsigned>& rMainSideElements);
00184
00186 friend class boost::serialization::access;
00198 template<class Archive>
00199 void serialize(Archive & archive, const unsigned int version)
00200 {
00201 archive & boost::serialization::base_object<MutableMesh<2,2> >(*this);
00202 archive & mWidth;
00203 archive & mTop;
00204 archive & mBottom;
00205 }
00206
00207 public:
00208
00214 Cylindrical2dMesh(double width);
00215
00223 Cylindrical2dMesh(double width, std::vector<Node<2>*> nodes);
00224
00228 ~Cylindrical2dMesh();
00229
00240 void ReMesh(NodeMap& rMap);
00241
00252 c_vector<double, 2> GetVectorFromAtoB(const c_vector<double, 2>& rLocation1, const c_vector<double, 2>& rLocation2);
00253
00264 void SetNode(unsigned index, ChastePoint<2> point, bool concreteMove);
00265
00275 double GetWidth(const unsigned& rDimension) const;
00276
00283 unsigned AddNode(Node<2>* pNewNode);
00284 };
00285
00286 namespace boost
00287 {
00288 namespace serialization
00289 {
00293 template<class Archive>
00294 inline void save_construct_data(
00295 Archive & ar, const Cylindrical2dMesh * t, const BOOST_PFTO unsigned int file_version)
00296 {
00297
00298 const double width = t->GetWidth(0);
00299 ar & width;
00300 }
00301
00305 template<class Archive>
00306 inline void load_construct_data(
00307 Archive & ar, Cylindrical2dMesh * t, const unsigned int file_version)
00308 {
00309
00310 double width;
00311 ar & width;
00312
00313
00314 ::new(t)Cylindrical2dMesh(width);
00315 }
00316 }
00317 }
00318
00319 #include "SerializationExportWrapper.hpp"
00320 CHASTE_CLASS_EXPORT(Cylindrical2dMesh)
00321
00322 #endif