FORM  4.2.1
gentopo.h
1 #pragma once
2 
3 // Temporal definition of big integer
4 #define BigInt long
5 #define ToBigInt(x) ((BigInt) (x))
6 //
7 // Temporal definition of ratio of two big integers
8 #define Fraction double
9 #define ToFraction(x, y) (((double) (x))/((double) (y)))
10 
11 //==============================================================
12 // Output to FROM
13 
14 //==============================================================
15 // class of nodes for EGraph
16 
17 class ENode {
18  public:
19  int deg;
20  int ext;
21  int *edges;
22 };
23 
24 class EEdge {
25  public:
26  int nodes[2];
27  int ext;
28  int momn;
29  char momc[2]; // no more used
30  // momentum is printed like: ("%s%d", (enode.ext)?"Q":"p", enode.momn)
31  char padding[6];
32 };
33 
34 class EGraph {
35  public:
36  long gId;
37  int pId;
38  int nNodes;
39  int nEdges;
40  int maxdeg;
41  int nExtern;
42 
43  int opi;
44  BigInt nsym, esym;
45 
46  ENode *nodes;
47  EEdge *edges;
48 
49  EGraph(int nnodes, int nedges, int mxdeg);
50  ~EGraph();
51  void print(void);
52  void init(int pid, long gid, int **adjmat, int sopi, BigInt nsym, BigInt esym);
53 
54  void setExtern(int nd, int val);
55  void endSetExtern(void);
56 };
57 
58 //==============================================================
59 // class of nodes for MGraph
60 
61 class MNode {
62  public:
63  int id; // node id
64  int deg; // degree(node) = the number of legs
65  int clss; // initial class number in which the node belongs
66  int ext;
67 
68  int freelg; // the number of free legs
69  int visited;
70 
71  MNode(int id, int deg, int ext, int clss);
72 };
73 
74 //===============================================================
75 // class of node-classes for MGraph
76 class MNodeClass;
77 
78 //===============================================================
79 // class of scalar graph expressed by matrix form
80 //
81 // Input : the classified set of nodes.
82 // Output : control passed to 'EGraph(self)'
83 
84 class MGraph {
85 
86  public:
87 
88  // initial conditions
89  int pId; // process/subprocess ID
90  int nNodes; // the number of nodes
91  int nEdges; // the number of edges
92  int nLoops; // the number of loops
93  MNode **nodes; // table of MNode object
94  int *clist; // list of initial classes
95  int nClasses; // the number of initial classes
96  // int ndcl; // node --> initial class number
97  int mindeg; // minimum value of degree of nodes
98  int maxdeg; // maximum value of degree of nodes
99 
100  int selOPI; // flag to select 1PI graphs
101 
102  // generated set of graphs
103  long ndiag; // the total number of generated graphs
104  long n1PI; // the total number of 1PI graphs
105  int nBridges; // the number of bridges
106 
107  // the current graph
108  int c1PI; // the number of 1PI components
109  int **adjMat; // adjacency matrix
110  BigInt nsym; // symmetry factor from nodes
111  BigInt esym; // symmetry factor from edges
112  Fraction wsum; // weighted sum of graphs
113  Fraction wsopi; // weighted sum of 1PI graphs
114  MNodeClass *curcl; // the current 'MNodeClass' object
115  EGraph *egraph;
116 
117  // measures of efficiency
118  long ngen; // generated graph before check
119  long ngconn; // generated connected graph before check
120 
121  long nCallRefine;
122  long discardOrd;
123  long discardRefine;
124  long discardDisc;
125  long discardIso;
126 
127  // functions */
128  MGraph(int pid, int ncl, int *cldeg, int *clnum, int *clext, int sopi);
129  ~MGraph();
130  long generate(void);
131 
132  private:
133  // work space for isomorphism
134  int **modmat; // permutated adjacency matrix
135  int *permp;
136  int *permq;
137  int *permr;
138 
139  // work space for biconnected component
140  int *bidef;
141  int *bilow;
142  int bicount;
143  int padding;
144 
145  void printAdjMat(MNodeClass *cl);
146  int isConnected(void);
147  int visit(int nd);
148  int isIsomorphic(MNodeClass *cl);
149  void permMat(int size, int *perm, int **mat0, int **mat1);
150  int compMat(int size, int **mat0, int **mat1);
151  MNodeClass *refineClass(MNodeClass *cl, int cn);
152  void bisearchM(int nd, int pd, int ne);
153  int count1PI(void);
154 
155  int findNextCl(MNodeClass *cl, int *dscl);
156  int findNextTCl(MNodeClass *cl, int *dcl);
157  void connectClass(MNodeClass *cl, int *dscl);
158  void connectNode(int sc, int ss, MNodeClass *cl, int *dscl);
159  void connectLeg(int sc, int sn, int tc, int ts, MNodeClass *cl, int *dscl, int* dtcl);
160  void newGraph(MNodeClass *cl);
161 
162 };
Definition: gentopo.h:61
Definition: gentopo.h:34
Definition: gentopo.h:17
Definition: gentopo.h:84
Definition: gentopo.h:24