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

circular.h

Go to the documentation of this file.
00001 #ifndef CIRCULAR_H
00002 #define CIRCULAR_H
00003 
00004 #include <render.h>
00005 #include <block.h>
00006 #include <stack.h>
00007 
00008 typedef struct {
00009         blocklist_t     bl;
00010         int                orderCount;
00011         int                blockCount;
00012         nstack_t*  bcstack;
00013         attrsym_t* N_artpos;
00014         attrsym_t* N_root;
00015         char*      rootname;
00016         double     min_dist;
00017 } circ_state;
00018 
00019 typedef struct {
00020   Agnode_t* dnode;
00021 } ndata;
00022 
00023 /* Extra node data used for layout:
00024  * Pass O: build derived graph
00025  * Pass 1: construct blocks
00026  * Pass 2: construct block tree
00027  * Pass 3: layout block
00028  *      a:  construct block skeleton
00029  *      b:  construct skeleton spanning tree
00030  *      c:  construct circular list of nodes
00031  * Pass 4: connect blocks
00032  */
00033 typedef struct {
00034   union {    /* Pointer to node/cluster in original graph */
00035     Agraph_t*  g;
00036     Agnode_t*  np;
00037   } orig;
00038   int           flags;
00039   node_t*       parent;   /* parent in block-cutpoint traversal (1,2,4) */
00040   block_t*      block;    /* Block containing node (1,2,3,4) */
00041   union {
00042     struct {          /* Pass  1 */
00043       node_t*   next;   /* used for stack */
00044       int       val;
00045       int       low_val;
00046     } bc;
00047     node_t*  clone;   /* Cloned node (3a)*/
00048     struct {         /* Spanning tree and longest path (3b) */
00049       node_t*  tparent;  /* Parent in tree */
00050       node_t*  first;    /* Leaf on longest path from node */
00051       node_t*  second;   /* Leaf on 2nd longest path from node */
00052       int      fdist;    /* Length of longest path from node */
00053       int      sdist;    /* Length of 2nd longest path from node */
00054     } t;
00055     struct {
00056           int     pos;     /* Index of node in block circle (3c,4) */
00057           double  psi;     /* Offset angle of children (4) */
00058         } f;
00059   } u;
00060 } cdata;
00061 
00062 typedef struct {
00063   int           order;
00064 } edata;
00065 
00066 #define NDATA(n) ((ndata*)((n)->u.alg))
00067 #define DNODE(n)        (NDATA(n)->dnode)
00068 
00069 #define EDGEDATA(e)  ((edata*)((e)->u.alg))
00070 #define EDGEORDER(e) (EDGEDATA(e)->order)
00071 
00072 #define DATA(n) ((cdata*)((n)->u.alg))
00073 #define ORIGG(n)        (DATA(n)->orig.g)
00074 #define ORIGN(n)        (DATA(n)->orig.np)
00075 #define FLAGS(n) (DATA(n)->flags)
00076 #define PARENT(n) (DATA(n)->parent)
00077 #define BLOCK(n) (DATA(n)->block)
00078 #define NEXT(n) (DATA(n)->u.bc.next)
00079 #define VAL(n) (DATA(n)->u.bc.val)
00080 #define LOWVAL(n)        (DATA(n)->u.bc.low_val)
00081 #define CLONE(n) (DATA(n)->u.clone)
00082 #define TPARENT(n)      (DATA(n)->u.t.tparent)
00083 #define LEAFONE(n)      (DATA(n)->u.t.first)
00084 #define LEAFTWO(n)      (DATA(n)->u.t.second)
00085 #define DISTONE(n)      (DATA(n)->u.t.fdist)
00086 #define DISTTWO(n)      (DATA(n)->u.t.sdist)
00087 #define POSITION(n) (DATA(n)->u.f.pos)
00088 #define PSI(n) (DATA(n)->u.f.psi)
00089 
00090 #define VISITED_F   (1 << 0)
00091 #define BCDONE_F    (1 << 1)
00092 #define ONSTACK_F   (1 << 2)
00093 #define PARENT_F    (1 << 3)
00094 #define PATH_F      (1 << 4)
00095 #define NEIGHBOR_F  (1 << 5)
00096 
00097 #define VISITED(n) (FLAGS(n)&VISITED_F)
00098 #define BCDONE(n)        (FLAGS(n)&BCDONE_F)
00099 #define ONSTACK(n)       (FLAGS(n)&ONSTACK_F)
00100 #define ISPARENT(n)      (FLAGS(n)&PARENT_F)
00101 #define ONPATH(n)        (FLAGS(n)&PATH_F)
00102 #define NEIGHBOR(n)      (FLAGS(n)&NEIGHBOR_F)
00103 
00104 #define SET_VISITED(n) (FLAGS(n) |= VISITED_F)
00105 #define SET_BCDONE(n)    (FLAGS(n) |= BCDONE_F)
00106 #define SET_ONSTACK(n)   (FLAGS(n) |= ONSTACK_F)
00107 #define SET_PARENT(n)    (FLAGS(n) |= PARENT_F)
00108 #define SET_ONPATH(n)    (FLAGS(n) |= PATH_F)
00109 #define SET_NEIGHBOR(n)  (FLAGS(n) |= NEIGHBOR_F)
00110 
00111 #define UNSET_VISITED(n) (FLAGS(n) &= ~VISITED_F)
00112 #define UNSET_BCDONE(n)  (FLAGS(n) &= ~BCDONE_F)
00113 #define UNSET_ONSTACK(n)         (FLAGS(n) &= ~ONSTACK_F)
00114 #define UNSET_NEIGHBOR(n)        (FLAGS(n) &= ~NEIGHBOR_F)
00115 
00116 #define DEGREE(n) (ND_order(n))
00117 
00118 #include <circo.h>
00119 
00120 #ifdef __cplusplus
00121 extern "C" {
00122 #endif
00123 
00124 #ifdef DEBUG
00125 extern void prData (Agnode_t* n, int pass);
00126 #endif
00127 
00128 #ifdef __cplusplus
00129 }
00130 #endif
00131 
00132 #endif
Untitled Document Pesquisa Psi SourceForge.net Logo