Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

/home/r0/dav/atlas.dir/atlas3/sources/gkmod/wgraph.h

Go to the documentation of this file.
00001 /*
00002   This is wgraph.h
00003 
00004   Copyright (C) 2004,2005 Fokko du Cloux
00005   part of the Atlas of Reductive Lie Groups
00006 
00007   See file main.cpp for full copyright notice
00008 */
00009 
00010 #ifndef WGRAPH_H  /* guard against multiple inclusions */
00011 #define WGRAPH_H
00012 
00013 #include <iostream>
00014 
00015 #include "bitset.h"
00016 #include "graph.h"
00017 #include "partition.h"
00018 #include "blocks_fwd.h"
00019 
00020 namespace atlas {
00021 
00022 /******** type declarations *************************************************/
00023 
00024 namespace wgraph {
00025 
00026 class WGraph;
00027 
00028  typedef unsigned short Coeff;
00029  typedef std::vector<Coeff> CoeffList;
00030 
00031 }
00032 
00033 /******** function declarations *********************************************/
00034 
00035 namespace wgraph {
00036 
00037 void cells(std::vector<WGraph>&, const WGraph&);
00038 
00039 // Functions
00040 
00041 WGraph wGraph
00042   ( std::ifstream& block_file
00043   , std::ifstream& matrix_file
00044   , std::ifstream& KL_file);
00045 
00046 }
00047 
00048 /******** type definitions **************************************************/
00049 
00050 namespace wgraph {
00051 
00052 class WGraph {
00053 
00054  private:
00055 
00056   size_t d_rank;
00057   graph::OrientedGraph d_graph;
00058   std::vector<CoeffList> d_coeff;
00059   std::vector<bitset::RankFlags> d_descent;
00060 
00061  public:
00062 
00063 // constructors and destructors
00064   explicit WGraph(size_t);
00065 
00066   ~WGraph();
00067 
00068 // copy, assignment and swap
00069   void swap(WGraph&);
00070 
00071 // accessors
00072   void cells(partition::Partition& pi, graph::OrientedGraph* p = 0) const {
00073     d_graph.cells(pi,p);
00074   }
00075 
00076   const CoeffList& coeffList(graph::Vertex x) const {
00077     return d_coeff[x];
00078   }
00079 
00080   const bitset::RankFlags& descent(graph::Vertex x) const {
00081     return d_descent[x];
00082   }
00083 
00084   const graph::EdgeList& edgeList(graph::Vertex x) const {
00085     return d_graph.edgeList(x);
00086   }
00087 
00088   const graph::OrientedGraph& graph() const {
00089     return d_graph;
00090   }
00091 
00092   const size_t rank() const {
00093     return d_rank;
00094   }
00095 
00096   size_t size() const {
00097     return d_graph.size();
00098   }
00099 
00100 // manipulators
00101   CoeffList& coeffList(graph::Vertex x) {
00102     return d_coeff[x];
00103   }
00104 
00105   bitset::RankFlags& descent(graph::Vertex x) {
00106     return d_descent[x];
00107   }
00108 
00109   graph::EdgeList& edgeList(graph::Vertex x) {
00110     return d_graph.edgeList(x);
00111   }
00112 
00113   void reset();
00114 
00115   void resize(size_t);
00116 };
00117 
00118 class DecomposedWGraph {
00119 
00120   typedef unsigned int cell_no;
00121 
00122   std::vector<WGraph> d_cell; // the strong components
00123 
00124   std::vector<cell_no> d_part;    // assigns strong component to each BlockElt
00125   std::vector< std::vector<blocks::BlockElt> > d_id; // original vertex numbers
00126 
00127   graph::OrientedGraph d_induced; // induced graph on cells
00128 
00129  public:
00130 
00131 // constructors and destructors
00132   explicit DecomposedWGraph(const WGraph& wg);
00133   ~DecomposedWGraph() {}
00134 
00135 // copy, assignment and swap
00136   void swap(DecomposedWGraph& other)
00137   {
00138     d_cell.swap(other.d_cell);
00139     d_part.swap(other.d_part);
00140     d_id.swap(other.d_id);
00141     d_induced.swap(other.d_induced);
00142   }
00143 
00144 // accessors
00145   size_t rank () const { return d_cell[0].rank(); } // all ranks are equal
00146   size_t cellCount() const { return d_cell.size(); }
00147   const graph::OrientedGraph& inducedGraph() const { return d_induced; }
00148   const wgraph::WGraph& cell (size_t c) const { return d_cell[c]; }
00149   const std::vector<blocks::BlockElt>& cellMembers(size_t c) const
00150     { return d_id[c]; }
00151 
00152 };
00153 
00154 } // namespace wgraph
00155 
00156 } // namespace atlas
00157 
00158 #endif

Generated on Wed Mar 26 16:49:34 2008 for atlas by  doxygen 1.3.9.1