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 #include <map>
00036
00037 #include "MutableMesh.hpp"
00038 #include "TrianglesMeshWriter.hpp"
00039
00040 #include <boost/serialization/export.hpp>
00041
00050 class Cylindrical2dMesh : public MutableMesh<2,2>
00051 {
00052 friend class TestCylindrical2dMesh;
00053 private:
00054
00056 double mWidth;
00057
00059 double mTop;
00060
00062 double mBottom;
00063
00065 std::vector<unsigned> mLeftOriginals;
00066
00068 std::vector<unsigned> mLeftImages;
00069
00071 std::map<unsigned, unsigned> mImageToLeftOriginalNodeMap;
00072
00074 std::vector<unsigned> mRightOriginals;
00075
00077 std::vector<unsigned> mRightImages;
00078
00080 std::map<unsigned, unsigned> mImageToRightOriginalNodeMap;
00081
00083 std::set<unsigned> mLeftPeriodicBoundaryElementIndices;
00084
00086 std::set<unsigned> mRightPeriodicBoundaryElementIndices;
00087
00089 std::vector<unsigned > mTopHaloNodes;
00090
00092 std::vector<unsigned > mBottomHaloNodes;
00093
00100 void UpdateTopAndBottom();
00101
00110 void CreateHaloNodes();
00111
00118 void CreateMirrorNodes();
00119
00132 void ReconstructCylindricalMesh();
00133
00140 void DeleteHaloNodes();
00141
00152 void CorrectNonPeriodicMesh();
00153
00164 void GenerateVectorsOfElementsStraddlingPeriodicBoundaries();
00165
00172 unsigned GetCorrespondingNodeIndex(unsigned nodeIndex);
00173
00182 void UseTheseElementsToDecideMeshing(std::set<unsigned> mainSideElements);
00183
00192 bool IsThisIndexInList(const unsigned& rNodeIndex, const std::vector<unsigned>& rListOfNodes);
00193
00195 friend class boost::serialization::access;
00206 template<class Archive>
00207 void serialize(Archive & archive, const unsigned int version)
00208 {
00209 archive & mWidth;
00210 archive & mTop;
00211 archive & mBottom;
00212
00213 archive & boost::serialization::base_object<MutableMesh<2,2> >(*this);
00214 }
00215
00216 public:
00217
00223 Cylindrical2dMesh(double width);
00224
00232 Cylindrical2dMesh(double width, std::vector<Node<2> *> nodes);
00233
00237 ~Cylindrical2dMesh()
00238 {
00239 }
00240
00251 void ReMesh(NodeMap &map);
00252
00261 c_vector<double, 2> GetVectorFromAtoB(const c_vector<double, 2>& rLocation1, const c_vector<double, 2>& rLocation2);
00262
00276 void SetNode(unsigned index, ChastePoint<2> point, bool concreteMove);
00277
00283 double GetWidth(const unsigned& rDimension) const;
00284
00294 unsigned AddNode(Node<2>* pNewNode);
00295
00296 };
00297
00298
00299 namespace boost
00300 {
00301 namespace serialization
00302 {
00306 template<class Archive>
00307 inline void save_construct_data(
00308 Archive & ar, const Cylindrical2dMesh * t, const BOOST_PFTO unsigned int file_version)
00309 {
00310
00311 const double width = t->GetWidth(0);
00312 ar << width;
00313 }
00314
00318 template<class Archive>
00319 inline void load_construct_data(
00320 Archive & ar, Cylindrical2dMesh * t, const unsigned int file_version)
00321 {
00322
00323 double width;
00324 ar >> width;
00325
00326
00327 ::new(t)Cylindrical2dMesh(width);
00328 }
00329 }
00330 }
00331
00332 BOOST_CLASS_EXPORT(Cylindrical2dMesh)
00333
00334 #endif