atlas  0.6
wgraph.h
Go to the documentation of this file.
1 /*
2  This is wgraph.h
3 
4  Copyright (C) 2004,2005 Fokko du Cloux
5  part of the Atlas of Lie Groups and Representations
6 
7  For license information see the LICENSE file
8 */
9 
10 #ifndef WGRAPH_H /* guard against multiple inclusions */
11 #define WGRAPH_H
12 
13 #include <iostream>
14 
15 #include "bitset.h" // inlines
16 #include "graph.h" // containment
17 
18 #include "../Atlas.h"
19 
20 namespace atlas {
21 
22 /******** type declarations (see ../Atlas.h) ***************************/
23 
24 
25 /******** function declarations *********************************************/
26 
27 namespace wgraph {
28 
29 void cells(std::vector<WGraph>&, const WGraph&);
30 
31 // Functions
32 
33 WGraph wGraph
34  ( std::ifstream& block_file
35  , std::ifstream& matrix_file
36  , std::ifstream& KL_file);
37 
38 }
39 
40 /******** type definitions **************************************************/
41 
42 namespace wgraph {
43 
44 class WGraph
45 {
46  size_t d_rank;
48  std::vector<WCoeffList> d_coeff;
49  std::vector<RankFlags> d_descent;
50 
51  public:
52 
53 // constructors and destructors
54  explicit WGraph(size_t r) :d_rank(r) {}
55 
56 // copy, assignment and swap
57  void swap(WGraph&);
58 
59 // accessors
60  void cells(Partition& pi, graph::OrientedGraph* p = 0) const {
61  d_graph.cells(pi,p);
62  }
63 
65  return d_coeff[x];
66  }
67 
68  const RankFlags& descent(graph::Vertex x) const {
69  return d_descent[x];
70  }
71 
73  return d_graph.edgeList(x);
74  }
75 
76  const graph::OrientedGraph& graph() const {
77  return d_graph;
78  }
79 
80  const size_t rank() const {
81  return d_rank;
82  }
83 
84  size_t size() const {
85  return d_graph.size();
86  }
87 
88 // manipulators
90  return d_coeff[x];
91  }
92 
94  return d_descent[x];
95  }
96 
98  return d_graph.edgeList(x);
99  }
100 
101  void reset();
102 
103  void resize(size_t);
104 }; // |class WGraph|
105 
107 {
108  typedef unsigned int cell_no;
109 
110  std::vector<WGraph> d_cell; // the strong components
111 
112  std::vector<cell_no> d_part; // assigns strong component to each BlockElt
113  std::vector< std::vector<BlockElt> > d_id; // original vertex numbers
114 
115  graph::OrientedGraph d_induced; // induced graph on cells
116 
117  public:
118 
119 // constructors and destructors
120  explicit DecomposedWGraph(const WGraph& wg);
122 
123 // copy, assignment and swap
124  void swap(DecomposedWGraph& other)
125  {
126  d_cell.swap(other.d_cell);
127  d_part.swap(other.d_part);
128  d_id.swap(other.d_id);
129  d_induced.swap(other.d_induced);
130  }
131 
132 // accessors
133  size_t rank () const { return d_cell[0].rank(); } // all ranks are equal
134  size_t cellCount() const { return d_cell.size(); }
135  const graph::OrientedGraph& inducedGraph() const { return d_induced; }
136  const wgraph::WGraph& cell (size_t c) const { return d_cell[c]; }
137  const std::vector<BlockElt>& cellMembers(size_t c) const
138  { return d_id[c]; }
139 
140 }; // |class DecomposedWGraph|
141 
142 } // |namespace wgraph|
143 
144 } // |namespace atlas|
145 
146 #endif
const std::vector< BlockElt > & cellMembers(size_t c) const
Definition: wgraph.h:137
const EdgeList & edgeList(const Vertex &x) const
Definition: graph.h:47
graph::OrientedGraph d_induced
Definition: wgraph.h:115
size_t cellCount() const
Definition: wgraph.h:134
unsigned int cell_no
Definition: wgraph.h:108
graph::EdgeList & edgeList(graph::Vertex x)
Definition: wgraph.h:97
uA p
Definition: lists.cpp:26
BitSet< constants::RANK_MAX > RankFlags
Definition: Atlas.h:60
graph::OrientedGraph d_graph
Definition: wgraph.h:47
std::vector< WGraph > d_cell
Definition: wgraph.h:110
set::Elt Vertex
Definition: Atlas.h:101
void swap(simple_list< T, Alloc > &x, simple_list< T, Alloc > &y)
Definition: sl_list.h:674
~DecomposedWGraph()
Definition: wgraph.h:121
size_t rank() const
Definition: wgraph.h:133
size_t d_rank
Definition: wgraph.h:46
size_t size() const
Definition: graph.h:49
void swap(DecomposedWGraph &other)
Definition: wgraph.h:124
std::vector< std::vector< BlockElt > > d_id
Definition: wgraph.h:113
std::vector< unsigned short > WCoeffList
Definition: Atlas.h:376
size_t size() const
Definition: wgraph.h:84
Definition: wgraph.h:106
const WCoeffList & coeffList(graph::Vertex x) const
Definition: wgraph.h:64
WGraph wGraph(std::ifstream &block_file, std::ifstream &matrix_file, std::ifstream &KL_file)
Definition: wgraph.cpp:182
WGraph(size_t r)
Definition: wgraph.h:54
const RankFlags & descent(graph::Vertex x) const
Definition: wgraph.h:68
const graph::EdgeList & edgeList(graph::Vertex x) const
Definition: wgraph.h:72
RankFlags & descent(graph::Vertex x)
Definition: wgraph.h:93
const size_t rank() const
Definition: wgraph.h:80
const graph::OrientedGraph & graph() const
Definition: wgraph.h:76
Definition: graph.h:27
std::vector< Edge > EdgeList
Definition: Atlas.h:104
Definition: wgraph.h:44
const wgraph::WGraph & cell(size_t c) const
Definition: wgraph.h:136
void cells(partition::Partition &, OrientedGraph *p=0) const
Definition: graph.cpp:128
void cells(Partition &pi, graph::OrientedGraph *p=0) const
Definition: wgraph.h:60
Definition: Atlas.h:38
std::vector< WCoeffList > d_coeff
Definition: wgraph.h:48
void cells(std::vector< WGraph > &wc, const WGraph &wg)
Definition: wgraph.cpp:139
const graph::OrientedGraph & inducedGraph() const
Definition: wgraph.h:135
Class definitions and function declarations for the BitSet class.
void swap(OrientedGraph &other)
Definition: graph.h:40
std::vector< cell_no > d_part
Definition: wgraph.h:112
std::vector< RankFlags > d_descent
Definition: wgraph.h:49
WCoeffList & coeffList(graph::Vertex x)
Definition: wgraph.h:89