Cylindrical2dMesh.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 #ifndef CYLINDRICAL2DMESH_HPP_
00036 #define CYLINDRICAL2DMESH_HPP_
00037
00038 #include "ChasteSerialization.hpp"
00039 #include <boost/serialization/base_object.hpp>
00040
00041 #include <cmath>
00042 #include <map>
00043
00044 #include "MutableMesh.hpp"
00045 #include "TrianglesMeshWriter.hpp"
00046
00055 class Cylindrical2dMesh : public MutableMesh<2,2>
00056 {
00057 friend class TestCylindrical2dMesh;
00058 private:
00059
00061 double mWidth;
00062
00064 double mTop;
00065
00067 double mBottom;
00068
00070 std::vector<unsigned> mLeftOriginals;
00071
00073 std::vector<unsigned> mLeftImages;
00074
00076 std::map<unsigned, unsigned> mImageToLeftOriginalNodeMap;
00077
00079 std::vector<unsigned> mRightOriginals;
00080
00082 std::vector<unsigned> mRightImages;
00083
00085 std::map<unsigned, unsigned> mImageToRightOriginalNodeMap;
00086
00088 std::set<unsigned> mLeftPeriodicBoundaryElementIndices;
00089
00091 std::set<unsigned> mRightPeriodicBoundaryElementIndices;
00092
00094 std::vector<unsigned > mTopHaloNodes;
00095
00097 std::vector<unsigned > mBottomHaloNodes;
00098
00100 bool mMismatchedBoundaryElements;
00101
00108 void UpdateTopAndBottom();
00109
00118 void CreateHaloNodes();
00119
00126 void CreateMirrorNodes();
00127
00140 void ReconstructCylindricalMesh();
00141
00148 void DeleteHaloNodes();
00149
00160 void CorrectNonPeriodicMesh();
00161
00172 void GenerateVectorsOfElementsStraddlingPeriodicBoundaries();
00173
00181 unsigned GetCorrespondingNodeIndex(unsigned nodeIndex);
00182
00193 void UseTheseElementsToDecideMeshing(std::set<unsigned>& rMainSideElements);
00194
00196 friend class boost::serialization::access;
00208 template<class Archive>
00209 void serialize(Archive & archive, const unsigned int version)
00210 {
00211 archive & boost::serialization::base_object<MutableMesh<2,2> >(*this);
00212 archive & mWidth;
00213 archive & mTop;
00214 archive & mBottom;
00215 }
00216
00217 public:
00218
00224 Cylindrical2dMesh(double width);
00225
00233 Cylindrical2dMesh(double width, std::vector<Node<2>*> nodes);
00234
00238 ~Cylindrical2dMesh();
00239
00250 void ReMesh(NodeMap& rMap);
00251
00262 c_vector<double, 2> GetVectorFromAtoB(const c_vector<double, 2>& rLocation1, const c_vector<double, 2>& rLocation2);
00263
00274 void SetNode(unsigned index, ChastePoint<2> point, bool concreteMove);
00275
00285 double GetWidth(const unsigned& rDimension) const;
00286
00293 unsigned AddNode(Node<2>* pNewNode);
00294
00298 bool GetInstanceOfMismatchedBoundaryNodes();
00299 };
00300
00301 namespace boost
00302 {
00303 namespace serialization
00304 {
00308 template<class Archive>
00309 inline void save_construct_data(
00310 Archive & ar, const Cylindrical2dMesh * t, const BOOST_PFTO unsigned int file_version)
00311 {
00312
00313 const double width = t->GetWidth(0);
00314 ar & width;
00315 }
00316
00320 template<class Archive>
00321 inline void load_construct_data(
00322 Archive & ar, Cylindrical2dMesh * t, const unsigned int file_version)
00323 {
00324
00325 double width;
00326 ar & width;
00327
00328
00329 ::new(t)Cylindrical2dMesh(width);
00330 }
00331 }
00332 }
00333
00334 #include "SerializationExportWrapper.hpp"
00335 CHASTE_CLASS_EXPORT(Cylindrical2dMesh)
00336
00337 #endif