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 VERTEXELEMENT_HPP_
00029 #define VERTEXELEMENT_HPP_
00030
00031 #include "AbstractElement.hpp"
00032
00033 #include "ChasteSerialization.hpp"
00034 #include <boost/serialization/base_object.hpp>
00035 #include <boost/serialization/vector.hpp>
00036
00043 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00044 class VertexElement : public AbstractElement<ELEMENT_DIM, SPACE_DIM>
00045 {
00046 private:
00047
00051 std::vector<VertexElement<ELEMENT_DIM-1, SPACE_DIM>*> mFaces;
00052
00063 std::vector<bool> mOrientations;
00064
00066 friend class boost::serialization::access;
00078 template<class Archive>
00079 void serialize(Archive & archive, const unsigned int version)
00080 {
00081
00082 archive & mFaces;
00083 archive & mOrientations;
00084 archive & boost::serialization::base_object<AbstractElement<ELEMENT_DIM, SPACE_DIM> >(*this);
00085 }
00086
00087 public:
00088
00096 VertexElement(unsigned index,
00097 const std::vector<VertexElement<ELEMENT_DIM-1, SPACE_DIM>*>& rFaces,
00098 const std::vector<bool>& rOrientations);
00099
00109 VertexElement(unsigned index);
00110
00117 VertexElement(unsigned index,
00118 const std::vector<Node<SPACE_DIM>*>& rNodes);
00119
00130 VertexElement(unsigned index,
00131 const std::vector<VertexElement<ELEMENT_DIM-1, SPACE_DIM>*>& rFaces,
00132 const std::vector<bool>& rOrientations,
00133 const std::vector<Node<SPACE_DIM>*>& rNodes);
00134
00138 ~VertexElement();
00139
00143 unsigned GetNumFaces() const;
00144
00150 void RegisterWithNodes();
00151
00158 void MarkAsDeleted();
00159
00165 void ResetIndex(unsigned index);
00166
00173 void UpdateNode(const unsigned& rIndex, Node<SPACE_DIM>* pNode);
00174
00180 void DeleteNode(const unsigned& rIndex);
00181
00188 void AddNode(const unsigned& rIndex, Node<SPACE_DIM>* pNode);
00189
00195 void AddFace(VertexElement<ELEMENT_DIM-1, SPACE_DIM>* pFace);
00196
00204 unsigned GetNodeLocalIndex(unsigned globalIndex) const;
00205
00211 VertexElement<ELEMENT_DIM-1, SPACE_DIM>* GetFace(unsigned index) const;
00212
00218 bool FaceIsOrientatedClockwise(unsigned index) const;
00219
00225 bool IsElementOnBoundary() const;
00226
00227 };
00228
00229
00231
00232
00233
00235
00240 template<unsigned SPACE_DIM>
00241 class VertexElement<1, SPACE_DIM> : public AbstractElement<1,SPACE_DIM>
00242 {
00243 public:
00244
00251 VertexElement(unsigned index, const std::vector<Node<SPACE_DIM>*>& rNodes);
00252
00256 virtual ~VertexElement();
00257
00261 unsigned GetNumFaces() const;
00262
00269 void UpdateNode(const unsigned& rIndex, Node<SPACE_DIM>* pNode);
00270
00276 void RegisterWithNodes();
00277
00284 void MarkAsDeleted();
00285
00291 void ResetIndex(unsigned index);
00292
00298 void DeleteNode(const unsigned& rIndex);
00299
00306 void AddNode(const unsigned& rIndex, Node<SPACE_DIM>* pNode);
00307
00315 unsigned GetNodeLocalIndex(unsigned globalIndex) const;
00316
00322 VertexElement<0, SPACE_DIM>* GetFace(unsigned index) const;
00323
00329 bool FaceIsOrientatedClockwise(unsigned index) const;
00330
00336 bool IsElementOnBoundary() const;
00337 };
00338
00339 #endif