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

Node.h

Go to the documentation of this file.
00001 // Copyright (C) 2002 Johan Hoffman and Anders Logg.
00002 // Licensed under the GNU GPL Version 2.
00003 
00004 #ifndef __NODE_HH
00005 #define __NODE_HH
00006 
00007 #include <dolfin/dolfin_log.h>
00008 #include <dolfin/constants.h>
00009 #include <dolfin/Array.h>
00010 #include <dolfin/Point.h>
00011 #include <dolfin/NodeIterator.h>
00012 #include <dolfin/CellIterator.h>
00013 #include <dolfin/EdgeIterator.h>
00014 
00015 namespace dolfin{
00016 
00017   class GenericCell;
00018   class Cell;
00019   class Edge;
00020   class MeshInit;
00021   
00022   class Node{
00023   public:
00024 
00026     Node();
00027 
00029     Node(real x);
00030     
00032     Node(real x, real y);
00033 
00035     Node(real x, real y, real z);
00036 
00038     ~Node();
00039 
00041     void clear();
00042     
00044 
00046     int id() const;
00047 
00049     int noNodeNeighbors() const;
00050 
00052     int noCellNeighbors() const;
00053 
00055     int noEdgeNeighbors() const;
00056 
00058     Node& node(int i) const;
00059 
00061     Cell& cell(int i) const;
00062 
00064     Edge& edge(int i) const;
00065 
00067     Node* parent() const;
00068 
00070     Node* child() const;
00071 
00073     Point& coord();
00074 
00076     Point coord() const;
00077     
00079     Point midpoint(const Node& n) const;
00080 
00082     real dist(const Node& n) const;    
00083 
00085     real dist(const Point& p) const;    
00086     
00088     real dist(real x, real y = 0.0, real z = 0.0) const;
00089 
00091     bool neighbor(const Node& n) const;
00092 
00094     bool operator==(const Node& node) const;
00095 
00097     bool operator!=(const Node& node) const;
00098 
00100 
00101     bool operator== (int id) const;
00102     bool operator<  (int id) const;
00103     bool operator<= (int id) const;
00104     bool operator>  (int id) const;
00105     bool operator>= (int id) const;
00106 
00107     friend bool operator== (int id, const Node& node);
00108     friend bool operator<  (int id, const Node& node);
00109     friend bool operator<= (int id, const Node& node);
00110     friend bool operator>  (int id, const Node& node);
00111     friend bool operator>= (int id, const Node& node);
00112 
00114    
00116     friend LogStream& operator<<(LogStream& stream, const Node& node);
00117     
00119     friend class Mesh;
00120     friend class MeshRefinement;
00121     friend class TriMeshRefinement;
00122     friend class TetMeshRefinement;
00123     friend class Triangle;
00124     friend class Tetrahedron;
00125     friend class MeshData;
00126     friend class MeshInit;
00127     friend class NodeIterator::NodeNodeIterator;
00128     friend class CellIterator::NodeCellIterator;         
00129     friend class EdgeIterator::NodeEdgeIterator;         
00130     
00131   private:
00132 
00133     // Specify global node number
00134     int setID(int id, Mesh& mesh);
00135     
00136     // Set the mesh pointer
00137     void setMesh(Mesh& mesh);
00138 
00139     // Set parent node
00140     void setParent(Node& parent);
00141 
00142     // Set child node
00143     void setChild(Node& child);
00144 
00145     // Remove parent node
00146     void removeParent(Node& parent);
00147 
00148     // Remove child node
00149     void removeChild();
00150 
00151     // Specify coordinate
00152     void set(real x, real y, real z);
00153 
00154     //--- Node data ---
00155     
00156     // The mesh containing this node
00157     Mesh* mesh;
00158 
00159     // Global node number
00160     int _id;
00161 
00162     // Node coordinate
00163     Point p;
00164 
00165     // Connectivity
00166     Array<Node*> nn;
00167     Array<Cell*> nc;
00168     Array<Edge*> ne;
00169 
00170     // Parent-child info
00171     Node* _parent;
00172     Node* _child;
00173 
00174   };
00175   
00176 }
00177 
00178 #endif


Documentation automatically generated with Doxygen on 10 Sep 2004.