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 <boost/serialization/access.hpp>
00032 #include <boost/serialization/base_object.hpp>
00033
00034 #include <cmath>
00035
00036 #include "MutableMesh.hpp"
00037 #include "TrianglesMeshWriter.hpp"
00038
00039 #include <boost/serialization/export.hpp>
00040
00049 class Cylindrical2dMesh : public MutableMesh<2,2>
00050 {
00051 friend class TestCylindrical2dMesh;
00052 private:
00053
00055 double mWidth;
00056
00058 double mTop;
00059
00061 double mBottom;
00062
00064 std::vector<unsigned> mLeftOriginals;
00065
00067 std::vector<unsigned> mLeftImages;
00068
00070 std::map<unsigned, unsigned> mImageToLeftOriginalNodeMap;
00071
00073 std::vector<unsigned> mRightOriginals;
00074
00076 std::vector<unsigned> mRightImages;
00077
00079 std::map<unsigned, unsigned> mImageToRightOriginalNodeMap;
00080
00082 std::set<unsigned> mLeftPeriodicBoundaryElementIndices;
00083
00085 std::set<unsigned> mRightPeriodicBoundaryElementIndices;
00086
00088 std::vector<unsigned > mTopHaloNodes;
00089
00091 std::vector<unsigned > mBottomHaloNodes;
00092
00099 void UpdateTopAndBottom();
00100
00109 void CreateHaloNodes();
00110
00117 void CreateMirrorNodes();
00118
00131 void ReconstructCylindricalMesh();
00132
00139 void DeleteHaloNodes();
00140
00151 void CorrectNonPeriodicMesh();
00152
00163 void GenerateVectorsOfElementsStraddlingPeriodicBoundaries();
00164
00171 unsigned GetCorrespondingNodeIndex(unsigned nodeIndex);
00172
00181 void UseTheseElementsToDecideMeshing(std::set<unsigned> mainSideElements);
00182
00191 bool IsThisIndexInList(const unsigned& rNodeIndex, const std::vector<unsigned>& rListOfNodes);
00192
00194 friend class boost::serialization::access;
00205 template<class Archive>
00206 void serialize(Archive & archive, const unsigned int version)
00207 {
00208 archive & boost::serialization::base_object<MutableMesh<2,2> >(*this);
00209 archive & mWidth;
00210 archive & mTop;
00211 archive & mBottom;
00212 }
00213
00214 public:
00215
00221 Cylindrical2dMesh(double width);
00222
00230 Cylindrical2dMesh(double width, std::vector<Node<2> *> nodes);
00231
00235 ~Cylindrical2dMesh()
00236 {
00237 }
00238
00249 void ReMesh(NodeMap &map);
00250
00259 c_vector<double, 2> GetVectorFromAtoB(const c_vector<double, 2>& rLocation1, const c_vector<double, 2>& rLocation2);
00260
00274 void SetNode(unsigned index, ChastePoint<2> point, bool concreteMove);
00275
00281 double GetWidth(const unsigned& rDimension) const;
00282
00292 unsigned AddNode(Node<2> *pNewNode);
00293
00294 };
00295
00296
00297 namespace boost
00298 {
00299 namespace serialization
00300 {
00304 template<class Archive>
00305 inline void save_construct_data(
00306 Archive & ar, const Cylindrical2dMesh * t, const BOOST_PFTO unsigned int file_version)
00307 {
00308
00309 const double width = t->GetWidth(0);
00310 ar << width;
00311 }
00312
00316 template<class Archive>
00317 inline void load_construct_data(
00318 Archive & ar, Cylindrical2dMesh * t, const unsigned int file_version)
00319 {
00320
00321 double width;
00322 ar >> width;
00323
00324
00325 ::new(t)Cylindrical2dMesh(width);
00326 }
00327 }
00328 }
00329
00330 BOOST_CLASS_EXPORT(Cylindrical2dMesh)
00331
00332 #endif