index.h

Go to the documentation of this file.
00001 #ifndef  __index_h
00002 #define  __index_h
00003 
00004 #include  <map>
00005 #include  <set>
00006 
00007 #include  "stlio.h"
00008 #include  "gascoigne.h"
00009 
00010 /*------------------------------------------*/
00011 
00012 namespace Gascoigne
00013 {
00014 class Index
00015 {
00016  protected:
00017 
00018   typedef  std::map<int,int>  IntMap;
00019 
00020   IntVector  vl2g, el2g, hl2g, ql2g;
00021   IntMap     vg2l, eg2l, hg2l, qg2l;
00022 
00023  public:
00024 
00025  protected:
00026 
00028   // Local To Global
00030 
00031   const IntVector&  Vertexl2g() const { return vl2g;}
00032   const IntVector&  Edgel2g()   const { return el2g;}
00033         IntVector&  Edgel2g()         { return el2g;}
00034 
00035   int Edgel2g  (int i)  const { return el2g[i];}
00036 
00037  public:
00038 
00040   // Constructors
00042 
00043   Index();
00044   Index(const Index& I);
00045   Index& operator=(const Index& I);
00046   
00047   int Vertexl2g(int i)  const { return vl2g[i];}
00048 
00049         IntVector&  Quadl2g()         { return ql2g;}
00050         IntVector&  Hexl2g()          { return hl2g;}
00051   const IntVector&  Hexl2g()    const { return hl2g;}
00052   const IntVector&  Quadl2g()   const { return ql2g;}
00053   int Quadl2g  (int i)  const { return ql2g[i];}
00054   int Hexl2g   (int i)  const { return hl2g[i];}
00055   const IntMap&  Quadg2l()   const { return qg2l;}
00056   const IntMap&  Hexg2l()    const { return hg2l;}
00057   
00059   // Sizes
00061 
00062   int nnodes   ()    const  { return VertexSize();}
00063   int VertexSize ()   const { return vl2g.size();}
00064   int VertexGSize()   const { return vg2l.size();}
00065   int EdgeSize ()     const { return el2g.size();}
00066   int EdgeGSize()     const { return eg2l.size();}
00067   int HexSize ()      const { return hl2g.size();}
00068   int HexGSize()      const { return hg2l.size();}
00069   int QuadSize ()     const { return ql2g.size();}
00070   int QuadGSize()     const { return qg2l.size();}
00071 
00073   // Global To Local
00075 
00076   const IntMap&  Vertexg2l() const { return vg2l;}
00077   const IntMap&  Edgeg2l()   const { return eg2l;}
00078         IntMap&  Edgeg2l()         { return eg2l;}
00079 
00080   int Quadg2l  (int i) const
00081     {
00082       std::map<int,int>::const_iterator ip = qg2l .find(i);
00083       if(ip==qg2l.end()) {
00084         std::cerr << "Index:: Quadg2l" << std::endl;
00085         std::cerr << "there is no " << " "<< i << std::endl;
00086         assert(0);}
00087       return ip->second; 
00088     }
00089   int Hexg2l   (int i) const
00090     {
00091       std::map<int,int>::const_iterator ip = hg2l .find(i);
00092       if(ip==hg2l.end()) {
00093         std::cerr << "Index:: Hexg2l" << std::endl;
00094         std::cerr << "there is no " << " "<< i << std::endl;
00095         assert(0);}
00096       return ip->second; 
00097     }
00098   int Vertexg2l(int i) const
00099     {
00100       std::map<int,int>::const_iterator ip = vg2l .find(i);
00101       if(ip==vg2l.end()) {
00102         std::cerr << "Index:: Vertexg2l" << std::endl;
00103         std::cerr << "there is no " << " "<< i << std::endl;
00104         assert(0);}
00105       return ip->second; 
00106     }
00107   int Edgeg2l  (int i) const
00108     {
00109       std::map<int,int>::const_iterator ip = eg2l .find(i);
00110       if(ip==eg2l.end()) {
00111         std::cerr << "Index:: Edgeg2l" << std::endl;
00112         std::cerr << "there is no " << " "<< i << std::endl;
00113         assert(0);}
00114       return ip->second; 
00115     }
00116 
00118   // Global To Local Check
00120 
00121   // gibt -2 zurueck, falls globaler vertex nicht in levelmesh
00122 
00123   int Vertexg2lCheck(int i) const
00124   {
00125     IntMap::const_iterator ip = vg2l .find(i);
00126     if(ip==vg2l .end()) return -2;
00127     return ip->second;
00128   }
00129   int Edgeg2lCheck  (int i) const
00130   {
00131     IntMap::const_iterator ip = eg2l .find(i);
00132     if(ip==eg2l .end()) return -2;
00133     return ip->second;
00134   }
00135   int Quadg2lCheck  (int i) const
00136   {
00137     IntMap::const_iterator ip = qg2l .find(i);
00138     if(ip==qg2l .end()) return -2;
00139     return ip->second;
00140   }
00141   int Hexg2lCheck   (int i) const
00142   {
00143     IntMap::const_iterator ip = hg2l .find(i);
00144     if(ip==hg2l .end()) return -2;
00145     return ip->second;
00146   }
00147   
00148   friend std::ostream& operator<<(std::ostream& os, const Index& I);
00149 
00150   void  InitNodes (const IntSet& nodes);
00151   void  InitEdges (const IntSet& edges);
00152   void  InitQuads ();
00153   void  InitHexs  ();
00154 };
00155 }
00156 
00157 #endif

Generated on Thu Sep 14 10:34:37 2006 for Gascoigne by  doxygen 1.4.7