Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)

linDG2D/meshInfo.hh
Go to the documentation of this file.
00001 #ifndef dgMeshInfo_hh
00002 #define dgMeshInfo_hh
00003 
00004 #include "edgeInfo.hh"
00005 
00006 // forward declaration
00007 namespace concepts {
00008   class Mesh2;
00009 }
00010 
00011 namespace linDG2D {
00012 
00020   class MeshInfo {
00021   public:
00022     typedef concepts::Scan<EdgeInfo> Scanner;
00026     MeshInfo(concepts::Mesh2& mesh);
00028     Scanner* scan() const { return new S(edgeInfos_); }
00030     const EdgeInfo& edgeInfo(const concepts::Edge& edge) const {
00031       return edgeInfos_.find(edge.key())->second;
00032     }
00033   private:
00035     class S : public Scanner {
00036     public:
00037       inline S(const __gnu_cxx::hash_map<uint, EdgeInfo>& edgeInfos) :
00038         idx_(edgeInfos.begin()), edgeInfos_(edgeInfos) {}
00039       inline S(const S& scan) : idx_(scan.idx_), edgeInfos_(scan.edgeInfos_) {}
00040       inline bool eos() const { return idx_ == edgeInfos_.end(); }
00041       inline EdgeInfo& operator++(int) {
00042         return const_cast<EdgeInfo&>((*idx_++).second);
00043       }
00044       inline S* clone() const { return new S(*this); }
00045     private:
00046       __gnu_cxx::hash_map<uint, EdgeInfo>::const_iterator idx_;
00047       const __gnu_cxx::hash_map<uint, EdgeInfo>& edgeInfos_;
00048     };
00050     __gnu_cxx::hash_map<uint, EdgeInfo> edgeInfos_;
00051   };
00052 
00053 } // namespace linDG2D
00054 
00055 #endif // dgMeshInfo_hh

Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)