00001 #ifndef SUNDANCERIVARAMESH_HPP 00002 #define SUNDANCERIVARAMESH_HPP 00003 00004 #include "SundanceDefs.hpp" 00005 #include "SundanceRivaraElement.hpp" 00006 #include <stack> 00007 #include "SundanceMap.hpp" 00008 #include "SundanceIncrementallyCreatableMesh.hpp" 00009 #include "SundanceRivaraElementIterator.hpp" 00010 00011 00012 namespace Sundance 00013 { 00014 namespace Rivara 00015 { 00016 using Sundance::Map; 00017 00018 00019 class RivaraMesh 00020 { 00021 public: 00022 RivaraMesh(int dim, const MPIComm& comm); 00023 00024 int addNode(const RCP<Node>& node); 00025 int addVertex(int globalIndex, const Point& x, int ownerProcID, int label); 00026 00027 void addElement(const RCP<Element>& tri); 00028 int addElement(int globalIndex, const Array<int>& vertexGIDs, int ownerProc, 00029 int label); 00030 00031 RCP<Edge> tryEdge(const RCP<Node>& a, 00032 const RCP<Node>& b, 00033 int& edgeSign); 00034 00035 RCP<Face> tryFace(const RCP<Node>& a, 00036 const RCP<Node>& b, 00037 const RCP<Node>& c); 00038 00039 const RCP<Face>& getFace(const RCP<Node>& a, 00040 const RCP<Node>& b, 00041 const RCP<Node>& c) const ; 00042 00043 const RCP<Node>& node(int i) const {return nodes_[i];} 00044 00045 int numNodes() const {return nodes_.length();} 00046 00047 std::stack<Element*>& refinementSet() 00048 {return refinementSet_;} 00049 00050 std::stack<double>& refinementAreas() 00051 {return refinementAreas_;} 00052 00053 void refine(); 00054 00055 ElementIterator iterator() const ; 00056 00057 friend class ElementIterator; 00058 00059 RCP<Element> element(int i) const {return elements_[i];} 00060 00061 int numRootElements() const {return elements_.length();} 00062 00063 int numElements() const ; 00064 00065 int spatialDim() const ; 00066 00067 int& nextGID() {return nextGID_;} 00068 00069 int nextGID() const {return nextGID_;} 00070 private: 00071 00072 int spatialDim_; 00073 00074 int nextGID_; 00075 00076 Array<RCP<Node> > nodes_; 00077 00078 Array<RCP<Edge> > edges_; 00079 00080 Array<RCP<Face> > faces_; 00081 00082 Array<RCP<Element> > elements_; 00083 00084 Array<Map<int, int> > nodeToEdgeMap_; 00085 00086 Map<FaceNodes, int> faceToLIDMap_; 00087 00088 std::stack<Element*> refinementSet_; 00089 00090 std::stack<double> refinementAreas_; 00091 }; 00092 } 00093 } 00094 00095 #endif