00001 #ifndef SUNDANCERIVARAFACE_H
00002 #define SUNDANCERIVARAFACE_H
00003 
00004 #include "SundanceDefs.hpp"
00005 #include "SundanceRivaraTreeNode.hpp"
00006 #include "SundanceRivaraNode.hpp"
00007 #include "SundanceSet.hpp"
00008 #include "Teuchos_Array.hpp"
00009 #include "Teuchos_RefCountPtr.hpp"
00010 
00011 using namespace Teuchos;
00012 namespace Sundance
00013 {
00014 namespace Rivara
00015 {
00016 class Element;
00017 class RivaraMesh;
00018 
00019 using Sundance::Set;
00020 using Sundance::makeSet;
00021 using Teuchos::Array;
00022 using Teuchos::RefCountPtr;
00023 
00024 
00025 class FaceNodes
00026 {
00027 public:
00028 
00029   FaceNodes(
00030     const RCP<Node>& a, 
00031     const RCP<Node>& b,
00032     const RCP<Node>& c)
00033     : nodeLIDSet_(rcp(new Set<int>(makeSet(a->localIndex(), b->localIndex(), c->localIndex()))))
00034     {}
00035 
00036 
00037 
00038   bool operator<(const FaceNodes& other) const
00039     {
00040       return (*nodeLIDSet_) < (*(other.nodeLIDSet_));
00041     }
00042 
00043 
00044   const Set<int>& nodes() const {return *nodeLIDSet_;}
00045 
00046 private:
00047   RCP<Set<int> > nodeLIDSet_;
00048 };
00049 
00050 
00051 
00052 
00053 
00054 class Face
00055 {
00056 public:
00057 
00058 
00059 
00060   Face(
00061     const RCP<Node>& a, 
00062     const RCP<Node>& b,
00063     const RCP<Node>& c
00064     )
00065     : label_(-1), 
00066       globalIndex_(-1), 
00067       nodes_(a,b,c), 
00068       ownerProc_(std::max(std::max(a->ownerProc(), b->ownerProc()), c->ownerProc()))
00069     {}
00070 
00071 
00072   const FaceNodes& nodes() const {return nodes_;}
00073 
00074 
00075   int ownerProc() const {return ownerProc_;}
00076 
00077 
00078 
00079 
00080   int globalIndex() const {return globalIndex_;}
00081 
00082 
00083 
00084 
00085   void setGlobalIndex(int globalIndex) {globalIndex_ = globalIndex;}
00086 
00087 
00088 
00089 
00090   void setLabel(int label) {label_=label;}
00091 
00092 
00093 
00094 
00095   int label() const {return label_;}
00096 private:
00097 
00098   int label_;
00099   int globalIndex_;
00100   FaceNodes nodes_;
00101   int ownerProc_;
00102 };
00103 }
00104 }
00105 
00106 #endif