![]() |
00001 // Copyright (C) 2002 Johan Hoffman and Anders Logg. 00002 // Licensed under the GNU GPL Version 2. 00003 00004 // A couple of comments: 00005 // 00006 // - Is the check in createNode() really necessary? 00007 00008 #ifndef __MESH_DATA_H 00009 #define __MESH_DATA_H 00010 00011 #include <dolfin/Table.h> 00012 #include <dolfin/Node.h> 00013 #include <dolfin/Cell.h> 00014 #include <dolfin/Edge.h> 00015 #include <dolfin/Face.h> 00016 00017 namespace dolfin { 00018 00063 00064 class MeshData { 00065 public: 00066 00068 MeshData(Mesh& mesh); 00069 00071 ~MeshData(); 00072 00074 void clear(); 00075 00076 Node& createNode(Point p); 00077 Node& createNode(real x, real y, real z); 00078 00079 Cell& createCell(int n0, int n1, int n2); 00080 Cell& createCell(int n0, int n1, int n2, int n3); 00081 Cell& createCell(Node& n0, Node& n1, Node& n2); 00082 Cell& createCell(Node& n0, Node& n1, Node& n2, Node& n3); 00083 00084 Edge& createEdge(int n0, int n1); 00085 Edge& createEdge(Node& n0, Node& n1); 00086 00087 Face& createFace(int e0, int e1, int e2); 00088 Face& createFace(Edge& e0, Edge& e1, Edge& e2); 00089 00090 Node& node(int id); 00091 Cell& cell(int id); 00092 Edge& edge(int id); 00093 Face& face(int id); 00094 00095 void remove(Node& node); 00096 void remove(Cell& cell); 00097 void remove(Edge& edge); 00098 void remove(Face& face); 00099 00100 int noNodes() const; 00101 int noCells() const; 00102 int noEdges() const; 00103 int noFaces() const; 00104 00105 // Friends 00106 friend class Mesh; 00107 friend class MeshInit; 00108 friend class NodeIterator::MeshNodeIterator; 00109 friend class CellIterator::MeshCellIterator; 00110 friend class EdgeIterator::MeshEdgeIterator; 00111 friend class FaceIterator::MeshFaceIterator; 00112 00113 private: 00114 00115 // Change the mesh pointer 00116 void setMesh(Mesh& mesh); 00117 00118 // The mesh 00119 Mesh* mesh; 00120 00121 // Table of all nodes within the mesh 00122 Table<Node> nodes; 00123 00124 // Table of all cells within the mesh 00125 Table<Cell> cells; 00126 00127 // Table of all edges within the mesh 00128 Table<Edge> edges; 00129 00130 // Table of all faces within the mesh 00131 Table<Face> faces; 00132 00133 }; 00134 00135 } 00136 00137 #endif
Documentation automatically generated with Doxygen on 10 Sep 2004.