00001 //----------------------------------------------------------------------------- 00002 // 00003 // Module: PseudoSphereArrangement.h 00004 // 00005 // Author: Feng Xie -- xief@mcmaster.ca 00006 // 00007 // Discription: Pseudo-sphere arrangement. 00008 // 00009 // Note: 1) Pseudo-sphere arrangement is represented by covectors. 00010 // 2) Only the positive vectors are used to represent cells, 00011 // edges, vertices and etc. And all the getNumXxx() methods 00012 // count only the positive ones. 00013 // 00014 // Todo: 1) Currently the set of edges are computed by assuming the 00015 // underlying OM is uniform. Change it for general OM's. 00016 // 2) Change the argument of constructor to "const Circuit &". 00017 // 00018 // Change log: 00019 // 09-06-24 Created. 00020 // 00021 //----------------------------------------------------------------------------- 00022 00023 #ifndef OMC_PSEUDO_SPHERE_ARRANGEMENT_H 00024 #define OMC_PSEUDO_SPHERE_ARRANGEMENT_H 00025 00026 #include "Vectors.h" 00027 #include <iostream> 00028 #include <set> 00029 00030 namespace omc 00031 { 00032 class PseudoSphereArrangement { 00033 public: 00034 PseudoSphereArrangement (Circuits &); // constructor 00035 00036 ~PseudoSphereArrangement () {}; // destructor 00037 00038 size_t getRank () const; // get the rank of the underlying OM 00039 size_t getNumSpheres () const; // get the # of pseudospheres 00040 size_t getNumCells () const; // get the # of cells 00041 size_t getNumFacets () const; // get the # of facets 00042 size_t getNumEdges () const; // get the # of edges 00043 size_t getNumVertices () const; // get the # of vertices 00044 00045 // Iterators. 00046 typedef std::set<SignedSet>::iterator cell_iterator; 00047 cell_iterator cell_begin (); 00048 cell_iterator cell_end (); 00049 00050 typedef std::set<SignedSet>::reverse_iterator reverse_cell_iterator; 00051 reverse_cell_iterator cell_rbegin (); 00052 reverse_cell_iterator cell_rend (); 00053 00054 typedef std::set<SignedSet>::iterator facet_iterator; 00055 cell_iterator facet_begin (); 00056 cell_iterator facet_end (); 00057 00058 typedef std::set<SignedSet>::reverse_iterator reverse_facet_iterator; 00059 reverse_cell_iterator facet_rbegin (); 00060 reverse_cell_iterator facet_rend (); 00061 00062 typedef std::set<SignedSet>::iterator edge_iterator; 00063 edge_iterator edge_begin (); 00064 edge_iterator edge_end (); 00065 00066 typedef std::set<SignedSet>::reverse_iterator reverse_edge_iterator; 00067 reverse_edge_iterator edge_rbegin (); 00068 reverse_edge_iterator edge_rend (); 00069 00070 typedef std::set<SignedSet>::iterator vertex_iterator; 00071 vertex_iterator vertex_begin (); 00072 vertex_iterator vertex_end (); 00073 00074 typedef std::set<SignedSet>::reverse_iterator reverse_vertex_iterator; 00075 reverse_vertex_iterator vertex_rbegin (); 00076 reverse_vertex_iterator vertex_rend (); 00077 00078 protected: 00079 Vectors m_covectors; // the vectors of the underlying OM 00080 00081 std::set <SignedSet> m_Cell; // set of vectors representing cells 00082 std::set <SignedSet> m_Facet; // set of vectors representing facets 00083 std::set <SignedSet> m_Edge; // set of vectors representing edges 00084 std::set <SignedSet> m_Vertex; // set of vectors representing vertices 00085 00086 }; // class PseudoSphereArrangement 00087 00088 // Output stream overloading. 00089 std::ostream & operator<< (std::ostream &, PseudoSphereArrangement &); 00090 00091 00093 inline size_t PseudoSphereArrangement::getRank () const { 00094 return m_covectors.getRank (); 00095 } 00096 00098 inline size_t PseudoSphereArrangement::getNumSpheres () const { 00099 return m_covectors.getNumElements (); 00100 } 00101 00103 inline size_t PseudoSphereArrangement::getNumCells () const { 00104 return m_Cell.size (); 00105 } 00106 00108 inline size_t PseudoSphereArrangement::getNumFacets () const { 00109 return m_Facet.size (); 00110 } 00111 00113 inline size_t PseudoSphereArrangement::getNumEdges () const { 00114 return m_Edge.size (); 00115 } 00116 00118 inline size_t PseudoSphereArrangement::getNumVertices () const { 00119 return m_Vertex.size (); 00120 } 00121 00123 inline PseudoSphereArrangement::cell_iterator 00124 PseudoSphereArrangement::cell_begin () 00125 { 00126 return m_Cell.begin (); 00127 } 00128 00130 inline PseudoSphereArrangement::cell_iterator 00131 PseudoSphereArrangement::cell_end () 00132 { 00133 return m_Cell.end (); 00134 } 00135 00137 inline PseudoSphereArrangement::reverse_cell_iterator 00138 PseudoSphereArrangement::cell_rbegin () 00139 { 00140 return m_Cell.rbegin (); 00141 } 00142 00144 inline PseudoSphereArrangement::reverse_cell_iterator 00145 PseudoSphereArrangement::cell_rend () 00146 { 00147 return m_Cell.rend (); 00148 } 00149 00151 inline PseudoSphereArrangement::facet_iterator 00152 PseudoSphereArrangement::facet_begin () 00153 { 00154 return m_Facet.begin (); 00155 } 00156 00158 inline PseudoSphereArrangement::facet_iterator 00159 PseudoSphereArrangement::facet_end () 00160 { 00161 return m_Facet.end (); 00162 } 00163 00165 inline PseudoSphereArrangement::reverse_facet_iterator 00166 PseudoSphereArrangement::facet_rbegin () 00167 { 00168 return m_Facet.rbegin (); 00169 } 00170 00172 inline PseudoSphereArrangement::reverse_facet_iterator 00173 PseudoSphereArrangement::facet_rend () 00174 { 00175 return m_Facet.rend (); 00176 } 00177 00179 inline PseudoSphereArrangement::edge_iterator 00180 PseudoSphereArrangement::edge_begin () 00181 { 00182 return m_Edge.begin (); 00183 } 00184 00186 inline PseudoSphereArrangement::edge_iterator 00187 PseudoSphereArrangement::edge_end () 00188 { 00189 return m_Edge.end (); 00190 } 00191 00193 inline PseudoSphereArrangement::reverse_edge_iterator 00194 PseudoSphereArrangement::edge_rbegin () 00195 { 00196 return m_Edge.rbegin (); 00197 } 00198 00200 inline PseudoSphereArrangement::reverse_edge_iterator 00201 PseudoSphereArrangement::edge_rend () 00202 { 00203 return m_Edge.rend (); 00204 } 00205 00207 inline PseudoSphereArrangement::vertex_iterator 00208 PseudoSphereArrangement::vertex_begin () 00209 { 00210 return m_Vertex.begin (); 00211 } 00212 00214 inline PseudoSphereArrangement::vertex_iterator 00215 PseudoSphereArrangement::vertex_end () 00216 { 00217 return m_Vertex.end (); 00218 } 00219 00221 inline PseudoSphereArrangement::reverse_vertex_iterator 00222 PseudoSphereArrangement::vertex_rbegin () 00223 { 00224 return m_Vertex.rbegin (); 00225 } 00226 00228 inline PseudoSphereArrangement::reverse_vertex_iterator 00229 PseudoSphereArrangement::vertex_rend () 00230 { 00231 return m_Vertex.rend (); 00232 } 00233 00234 }; // namespace omc 00235 00236 #endif // OMC_PSEUDO_SPHERE_ARRANGEMENT_H