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 #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
00093 bool mMismatchedBoundaryElements;
00094
00101 void UpdateTopAndBottom();
00102
00111 void CreateHaloNodes();
00112
00119 void CreateMirrorNodes();
00120
00133 void ReconstructCylindricalMesh();
00134
00141 void DeleteHaloNodes();
00142
00153 void CorrectNonPeriodicMesh();
00154
00165 void GenerateVectorsOfElementsStraddlingPeriodicBoundaries();
00166
00174 unsigned GetCorrespondingNodeIndex(unsigned nodeIndex);
00175
00186 void UseTheseElementsToDecideMeshing(std::set<unsigned>& rMainSideElements);
00187
00189 friend class boost::serialization::access;
00201 template<class Archive>
00202 void serialize(Archive & archive, const unsigned int version)
00203 {
00204 archive & boost::serialization::base_object<MutableMesh<2,2> >(*this);
00205 archive & mWidth;
00206 archive & mTop;
00207 archive & mBottom;
00208 }
00209
00210 public:
00211
00217 Cylindrical2dMesh(double width);
00218
00226 Cylindrical2dMesh(double width, std::vector<Node<2>*> nodes);
00227
00231 ~Cylindrical2dMesh();
00232
00243 void ReMesh(NodeMap& rMap);
00244
00255 c_vector<double, 2> GetVectorFromAtoB(const c_vector<double, 2>& rLocation1, const c_vector<double, 2>& rLocation2);
00256
00267 void SetNode(unsigned index, ChastePoint<2> point, bool concreteMove);
00268
00278 double GetWidth(const unsigned& rDimension) const;
00279
00286 unsigned AddNode(Node<2>* pNewNode);
00287
00291 bool GetInstanceOfMismatchedBoundaryNodes();
00292 };
00293
00294 namespace boost
00295 {
00296 namespace serialization
00297 {
00301 template<class Archive>
00302 inline void save_construct_data(
00303 Archive & ar, const Cylindrical2dMesh * t, const BOOST_PFTO unsigned int file_version)
00304 {
00305
00306 const double width = t->GetWidth(0);
00307 ar & width;
00308 }
00309
00313 template<class Archive>
00314 inline void load_construct_data(
00315 Archive & ar, Cylindrical2dMesh * t, const unsigned int file_version)
00316 {
00317
00318 double width;
00319 ar & width;
00320
00321
00322 ::new(t)Cylindrical2dMesh(width);
00323 }
00324 }
00325 }
00326
00327 #include "SerializationExportWrapper.hpp"
00328 CHASTE_CLASS_EXPORT(Cylindrical2dMesh)
00329
00330 #endif