![]() |
00001 // Copyright (C) 2002 Johan Hoffman and Anders Logg. 00002 // Licensed under the GNU GPL Version 2. 00003 00004 #ifndef __MESH_H 00005 #define __MESH_H 00006 00007 #include <dolfin/dolfin_log.h> 00008 #include <dolfin/Variable.h> 00009 #include <dolfin/constants.h> 00010 #include <dolfin/List.h> 00011 #include <dolfin/Point.h> 00012 #include <dolfin/Node.h> 00013 #include <dolfin/Cell.h> 00014 #include <dolfin/Edge.h> 00015 #include <dolfin/Face.h> 00016 #include <dolfin/BoundaryData.h> 00017 #include <dolfin/MeshData.h> 00018 00019 namespace dolfin { 00020 00021 class MeshData; 00022 00076 00077 class Mesh : public Variable 00078 { 00079 public: 00080 00081 enum Type { triangles, tetrahedrons }; 00082 00084 Mesh(); 00085 00087 Mesh(const char *filename); 00088 00090 Mesh(const Mesh& mesh); 00091 00093 ~Mesh(); 00094 00096 00098 void clear(); 00099 00101 int noNodes() const; 00102 00104 int noCells() const; 00105 00107 int noEdges() const; 00108 00110 int noFaces() const; 00111 00113 Type type() const; 00114 00116 Node& node(unsigned int id); 00117 00119 Cell& cell(unsigned int id); 00120 00122 Edge& edge(unsigned int id); 00123 00125 Face& face(unsigned int id); 00126 00128 Boundary boundary(); 00129 00131 00133 void mark(Cell& cell); 00134 00136 void refine(); 00137 00139 void refineUniformly(); 00140 00142 Mesh& parent(); 00143 00145 Mesh& child(); 00146 00148 bool operator==(const Mesh& mesh) const; 00149 00151 bool operator!=(const Mesh& mesh) const; 00152 00154 00156 void show(); 00157 00159 friend LogStream& operator<< (LogStream& stream, const Mesh& mesh); 00160 00162 friend class GenericCell; 00163 friend class Edge; 00164 friend class XMLMesh; 00165 friend class MeshInit; 00166 friend class MeshRefinement; 00167 friend class TriMeshRefinement; 00168 friend class TetMeshRefinement; 00169 friend class MeshHierarchy; 00170 friend class Boundary; 00171 friend class BoundaryInit; 00172 friend class NodeIterator::MeshNodeIterator; 00173 friend class NodeIterator::BoundaryNodeIterator; 00174 friend class CellIterator::MeshCellIterator; 00175 friend class EdgeIterator::MeshEdgeIterator; 00176 friend class EdgeIterator::BoundaryEdgeIterator; 00177 friend class FaceIterator::MeshFaceIterator; 00178 friend class FaceIterator::BoundaryFaceIterator; 00179 00180 private: 00181 00182 // Create a new mesh as a child to this mesh 00183 Mesh& createChild(); 00184 00185 // Create a new node at given position 00186 Node& createNode(Point p); 00187 Node& createNode(real x, real y, real z); 00188 00189 // Create a new cell from the given nodes 00190 Cell& createCell(int n0, int n1, int n2); 00191 Cell& createCell(int n0, int n1, int n2, int n3); 00192 Cell& createCell(Node& n0, Node& n1, Node& n2); 00193 Cell& createCell(Node& n0, Node& n1, Node& n2, Node& n3); 00194 00195 // Create a new edge from the given nodes 00196 Edge& createEdge(int n0, int n1); 00197 Edge& createEdge(Node& n0, Node& n1); 00198 00199 // Create a new face from the given edges 00200 Face& createFace(int e0, int e1, int e2); 00201 Face& createFace(Edge& e0, Edge& e1, Edge& e2); 00202 00203 // Remove node, cell, edge, face (use with care) 00204 void remove(Node& node); 00205 void remove(Cell& cell); 00206 void remove(Edge& edge); 00207 void remove(Face& face); 00208 00210 void init(); 00211 00213 void swap(Mesh& mesh); 00214 00215 //--- Mesh data --- 00216 00217 // Mesh data 00218 MeshData* md; 00219 00220 // Boundary data 00221 BoundaryData* bd; 00222 00223 // Parent mesh 00224 Mesh* _parent; 00225 00226 // Child mesh 00227 Mesh* _child; 00228 00229 // Mesh type 00230 Type _type; 00231 00232 }; 00233 00234 } 00235 00236 #endif
![]()
Documentation automatically generated with Doxygen on 10 Sep 2004.