00001 #ifndef SUNDANCERIVARAELEMENT_H
00002 #define SUNDANCERIVARAELEMENT_H
00003
00004 #include "SundanceDefs.hpp"
00005 #include "SundanceRivaraTreeNode.hpp"
00006 #include "SundanceRivaraNode.hpp"
00007 #include "SundanceRivaraEdge.hpp"
00008 #include "SundanceRivaraFace.hpp"
00009 #include "Teuchos_Array.hpp"
00010 #include "Teuchos_RefCountPtr.hpp"
00011
00012
00013 namespace Sundance
00014 {
00015 namespace Rivara
00016 {
00017 class RivaraMesh;
00018 using Teuchos::Array;
00019 using Teuchos::RefCountPtr;
00020
00021
00022
00023
00024 class Element : public TreeNode
00025 {
00026 public:
00027 Element(RivaraMesh* mesh,
00028 const RCP<Node>& a,
00029 const RCP<Node>& b,
00030 const RCP<Node>& c,
00031 int ownerProc, int label);
00032
00033 Element(RivaraMesh* mesh,
00034 const RCP<Node>& a,
00035 const RCP<Node>& b,
00036 const RCP<Node>& c,
00037 const RCP<Node>& d,
00038 int ownerProc, int label);
00039
00040
00041
00042 virtual ~Element() {deleteChildren();}
00043
00044
00045 double volume() const ;
00046
00047
00048
00049
00050 bool hasHangingNode() const ;
00051
00052
00053
00054
00055 int ownerProc() const {return ownerProc_;}
00056
00057
00058
00059
00060 int label() const {return label_;}
00061
00062
00063
00064
00065 int longestEdgeIndex() const ;
00066
00067
00068
00069
00070 void refine(RivaraMesh* mesh, double maxArea);
00071
00072
00073
00074
00075 void getNeighbors(Array<Element*>& neighbors,
00076 Array<int>& weights) const ;
00077
00078
00079
00080
00081 const Array<RCP<Node> >& nodes() const
00082 {return nodes_;}
00083
00084
00085 const RCP<Edge>& edge(int i) const {return edges_[i];}
00086
00087 RCP<Edge> edge(int i) {return edges_[i];}
00088
00089
00090 const RCP<Face>& face(int i) const {return faces_[i];}
00091
00092 RCP<Face> face(int i) {return faces_[i];}
00093
00094
00095 bool hasNoEdgeLabels() const ;
00096
00097
00098 bool hasNoFaceLabels() const ;
00099
00100
00101
00102
00103 Array<int> showNodes() const ;
00104 private:
00105
00106 int label_;
00107
00108 Array<RCP<Node> > nodes_;
00109
00110 Array<RCP<Edge> > edges_;
00111
00112 Array<RCP<Face> > faces_;
00113
00114 Array<int> edgeSigns_;
00115
00116 int ownerProc_;
00117 };
00118
00119 }
00120 }
00121
00122 #endif