MutableMesh.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 #ifndef MUTABLEMESH_HPP_
00030 #define MUTABLEMESH_HPP_
00031
00032 #include "ChasteSerialization.hpp"
00033 #include <boost/serialization/base_object.hpp>
00034
00035 #include "TetrahedralMesh.hpp"
00036 #include "NodeMap.hpp"
00037
00041 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00042 class MutableMesh : public TetrahedralMesh<ELEMENT_DIM, SPACE_DIM>
00043 {
00045 friend class boost::serialization::access;
00046
00057 template<class Archive>
00058 void serialize(Archive & archive, const unsigned int version)
00059 {
00060 archive & boost::serialization::base_object<TetrahedralMesh<ELEMENT_DIM, SPACE_DIM> >(*this);
00061
00062
00063
00064
00065 NodeMap map(this->GetNumNodes());
00066 this->ReMesh(map);
00067 assert(map.IsIdentityMap());
00068 }
00069
00070 protected:
00071
00076 std::vector<unsigned> mDeletedElementIndices;
00077
00082 std::vector<unsigned> mDeletedBoundaryElementIndices;
00083
00088 std::vector<unsigned> mDeletedNodeIndices;
00089
00091 bool mAddedNodes;
00092
00093 private:
00094
00095 #define COVERAGE_IGNORE
00096
00103 bool CheckIsVoronoi(Element<ELEMENT_DIM, SPACE_DIM>* pElement, double maxPenetration);
00104 #undef COVERAGE_IGNORE
00105
00106 public:
00107
00111 MutableMesh();
00112
00118 MutableMesh(std::vector<Node<SPACE_DIM> *> nodes);
00119
00123 virtual ~MutableMesh();
00124
00128 void Clear();
00129
00133 unsigned GetNumNodes() const;
00134
00138 unsigned GetNumElements() const;
00139
00143 unsigned GetNumBoundaryElements() const;
00144
00146
00153 void RescaleMeshFromBoundaryNode(ChastePoint<1> updatedPoint, unsigned boundaryNodeIndex);
00154
00162 virtual unsigned AddNode(Node<SPACE_DIM>* pNewNode);
00163
00172 virtual void SetNode(unsigned index, ChastePoint<SPACE_DIM> point, bool concreteMove=true);
00173
00183 void MoveMergeNode(unsigned index, unsigned targetIndex, bool concreteMove=true);
00184
00185 #define COVERAGE_IGNORE
00186
00192 void DeleteNode(unsigned index);
00193 #undef COVERAGE_IGNORE
00194
00195 #define COVERAGE_IGNORE
00196
00204 void DeleteNodePriorToReMesh(unsigned index);
00205 #undef COVERAGE_IGNORE
00206
00213 unsigned RefineElement(Element<ELEMENT_DIM,SPACE_DIM>* pElement, ChastePoint<SPACE_DIM> point);
00214
00227 void DeleteBoundaryNodeAt(unsigned index);
00228
00229 #define COVERAGE_IGNORE
00230
00236 void ReIndex(NodeMap& map);
00237 #undef COVERAGE_IGNORE
00238
00239 #define COVERAGE_IGNORE
00240
00245 virtual void ReMesh(NodeMap& map);
00246 #undef COVERAGE_IGNORE
00247
00248 #define COVERAGE_IGNORE
00249
00253 void ReMesh();
00254 #undef COVERAGE_IGNORE
00255
00256 #define COVERAGE_IGNORE
00257
00265 bool CheckIsVoronoi(double maxPenetration=0.0);
00266 #undef COVERAGE_IGNORE
00267 };
00268
00269 #include "SerializationExportWrapper.hpp"
00270 EXPORT_TEMPLATE_CLASS_ALL_DIMS(MutableMesh);
00271
00272 #endif