Go to the documentation of this file.00001
00002
00003
00004 #ifndef geoLists_hh
00005 #define geoLists_hh
00006
00007 #include <iostream>
00008 #include "basics/vectorsMatrices.hh"
00009 #include "toolbox/hashMap.hh"
00010 #include "toolbox/hashSet.hh"
00011 #include "space/postProcess.hh"
00012
00013 namespace concepts {
00014
00015 }
00016
00017 namespace graphics {
00018
00019 using concepts::Real;
00020
00021
00022
00033 class VertexInfo {
00034 friend std::ostream& operator<< (std::ostream& os, const VertexInfo& v);
00035 public:
00040 VertexInfo(concepts::Real3d coord, uint index = 0) :
00041 index_(index), coord_(coord) {}
00042
00044 void addEdge(uint edge) { edges_.insert(edge); }
00045
00047 void addFace(uint face) { faces_.insert(face); }
00048
00050 void addVolume(uint volume) { volumes_.insert(volume); }
00051
00053 uint& index() { return index_; }
00055 uint index() const { return index_; }
00056
00058 concepts::Real3d coordinates() const { return coord_; }
00059 private:
00065 uint index_;
00066
00068 concepts::Real3d coord_;
00069
00071 __gnu_cxx::hash_set<uint> edges_;
00072
00074 __gnu_cxx::hash_set<uint> faces_;
00075
00077 __gnu_cxx::hash_set<uint> volumes_;
00078 };
00079
00080
00081
00095 class VertexList : public concepts::CellPostprocess<Real> {
00096 public:
00097 typedef __gnu_cxx::hash_map<uint, VertexInfo>::iterator iterator;
00098 typedef __gnu_cxx::hash_map<uint, VertexInfo>::const_iterator
00099 const_iterator;
00100
00107 enum vtxInfo { COORD = 0, EDGES = 1, FACES = 2, VOLUMES = 4, ALL = 7 };
00108
00111 VertexList(enum vtxInfo info = ALL) : vtxInfo_(info) {}
00112
00114 VertexList(const VertexList& vl);
00115
00116 virtual ~VertexList() {}
00117
00122 VertexInfo* vertex(uint v);
00123
00129 VertexInfo* addVertex(uint v, concepts::Real3d coord);
00130
00132 uint size() const { return vertices_.size(); }
00133
00135 iterator begin() { return vertices_.begin(); }
00136 const_iterator begin() const { return vertices_.begin(); }
00137
00139 iterator end() { return vertices_.end(); }
00140 const_iterator end() const { return vertices_.end(); }
00141
00143 iterator find(uint k) { return vertices_.find(k); }
00144 const_iterator find(uint k) const { return vertices_.find(k); }
00145
00151 virtual void operator() (const concepts::Cell& cell);
00152
00158 virtual void operator() (const concepts::Element<Real>& elm);
00159
00161 enum vtxInfo vertexInfo() const { return vtxInfo_; }
00162 protected:
00163 virtual std::ostream& info(std::ostream& os) const;
00164 private:
00166 __gnu_cxx::hash_map<uint, VertexInfo> vertices_;
00167
00169 enum vtxInfo vtxInfo_;
00170 };
00171
00172 }
00173
00174 #endif // geoLists_hh