Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

Edge.h

Go to the documentation of this file.
00001 // Copyright (C) 2003 Johan Hoffman and Anders Logg.
00002 // Licensed under the GNU GPL Version 2.
00003 
00004 #ifndef __EDGE_H
00005 #define __EDGE_H
00006 
00007 #include <dolfin/dolfin_log.h>
00008 #include <dolfin/NodeIterator.h>
00009 #include <dolfin/CellIterator.h>
00010 #include <dolfin/EdgeIterator.h>
00011 #include <dolfin/FaceIterator.h>
00012 
00013 namespace dolfin {
00014 
00015   class Point;
00016   class Mesh;
00017   class EdgeRefData;
00018 
00019   class Edge{
00020   public:
00021     
00023     Edge();
00024     
00026     Edge(Node& n0, Node& n1);
00027 
00029     ~Edge();
00030 
00032     void clear();
00033     
00035     
00037     int  id() const;
00038 
00040     unsigned int noCellNeighbors() const;
00041 
00043     Node& node(int i) const;
00044 
00046     Cell& cell(int i) const;
00047 
00049     Point& coord(int i) const;
00050     
00052     real length() const;
00053 
00055     Point midpoint() const;
00056     
00058     bool equals(const Node& n0, const Node& n1) const;
00059 
00061     bool contains(const Node& n) const;
00062 
00064    
00066     friend LogStream& operator<<(LogStream& stream, const Edge& edge);
00067     
00068     // Friends
00069     friend class Mesh;
00070     friend class Node;
00071     friend class GenericCell;
00072     friend class MeshData;
00073     friend class MeshInit;
00074     friend class MeshRefinement;
00075     friend class TriMeshRefinement;
00076     friend class TetMeshRefinement;
00077     friend class NodeIterator::CellNodeIterator;
00078     friend class CellIterator::CellCellIterator;
00079     friend class EdgeIterator::CellEdgeIterator;
00080     friend class FaceIterator::CellFaceIterator;
00081     friend class Triangle;
00082     friend class Tetrahedron;
00083     
00084   private:
00085       
00086     // Specify global edge number
00087     int setID(int id, Mesh& mesh);
00088     
00089     // Set the mesh pointer
00090     void setMesh(Mesh& mesh);
00091 
00093     void set(Node& n0, Node& n1);
00094 
00095     // Initialize marker (if not already done)
00096     void initMarker();
00097 
00098     // Mark by given cell
00099     void mark(Cell& cell);
00100 
00101     // Check if cell has been marked for refinement
00102     bool marked();
00103 
00104     // Check if cell has been marked for refinement by given cell
00105     bool marked(Cell& cell);
00106 
00107     // Clear marks
00108     void clearMarks();
00109 
00110     //--- Edge data ---
00111     
00112     // The mesh containing this edge
00113     Mesh* mesh;
00114     
00115     // Global edge number
00116     int _id;
00117     
00118     // Nodes
00119     Node* n0;
00120     Node* n1;
00121 
00122     // Connectivity
00123     Array<Cell*> ec;
00124 
00125     // Mesh refinement data
00126     EdgeRefData* rd;
00127 
00128   };
00129   
00130 }
00131 
00132 #endif


Documentation automatically generated with Doxygen on 10 Sep 2004.