00001 #ifndef SUNDANCERIVARAEDGE_H 00002 #define SUNDANCERIVARAEDGE_H 00003 00004 #include "SundanceDefs.hpp" 00005 #include "SundanceRivaraTreeNode.hpp" 00006 #include "SundanceRivaraNode.hpp" 00007 #include "Teuchos_Array.hpp" 00008 #include "Teuchos_RefCountPtr.hpp" 00009 00010 namespace Sundance 00011 { 00012 namespace Rivara 00013 { 00014 class Element; 00015 class RivaraMesh; 00016 00017 using Teuchos::Array; 00018 using Teuchos::RefCountPtr; 00019 00020 /** 00021 * class Edge is a one-dimensional edge in a simplicial mesh. 00022 */ 00023 00024 class Edge : public TreeNode 00025 { 00026 public: 00027 /** 00028 * Construct with two nodes 00029 */ 00030 Edge(const RCP<Node>& a, 00031 const RCP<Node>& b); 00032 00033 /** 00034 * Add an element to the list of elements containing this edge 00035 */ 00036 void addConnectingElement(Element* elem); 00037 00038 /** 00039 * Return the length of the edge. 00040 */ 00041 double length() const ; 00042 00043 /** 00044 * Return a list of the cofacets of this edge that still need refinement 00045 */ 00046 void getUnrefinedCofacets(Array<Element*>& elements) const ; 00047 00048 /** 00049 * Bisect the edge. 00050 * @return a new node created at the midpoint of the edge 00051 */ 00052 RCP<Node> bisect(RivaraMesh* mesh); 00053 00054 const RCP<Node>& node(int i) const {return nodes_[i];} 00055 00056 int ownerProc() const {return ownerProc_;} 00057 00058 /** 00059 * Return the global index of this edge 00060 */ 00061 int globalIndex() const ; 00062 00063 /** 00064 * Set the global index of this edge 00065 */ 00066 void setGlobalIndex(int globalIndex) ; 00067 00068 /** 00069 * Set the label of this edge 00070 */ 00071 void setLabel(int label) {label_=label;} 00072 00073 /** 00074 * Get the label 00075 */ 00076 int label() const {return label_;} 00077 private: 00078 00079 int label_; 00080 Array<RCP<Node> > nodes_; 00081 Array<Element*> elements_; 00082 00083 RCP<Node> midpoint_; 00084 00085 int ownerProc_; 00086 }; 00087 } 00088 } 00089 00090 #endif