Graphviz  2.41.20170921.2350
fdp.h
Go to the documentation of this file.
1 /* $Id$ $Revision$ */
2 /* vim:set shiftwidth=4 ts=8: */
3 
4 /*************************************************************************
5  * Copyright (c) 2011 AT&T Intellectual Property
6  * All rights reserved. This program and the accompanying materials
7  * are made available under the terms of the Eclipse Public License v1.0
8  * which accompanies this distribution, and is available at
9  * http://www.eclipse.org/legal/epl-v10.html
10  *
11  * Contributors: See CVS logs. Details at http://www.graphviz.org/
12  *************************************************************************/
13 
14 #ifndef FDP_H
15 #define FDP_H
16 
17 #include <render.h>
18 
19 #ifdef FDP_PRIVATE
20 
21 #define NDIM 2
22 
23 typedef struct bport_s {
24  edge_t *e;
25  node_t *n;
26  double alpha;
27 } bport_t;
28 
29 /* gdata is attached to the root graph, each cluster graph,
30  * and to each derived graph.
31  * Graphs also use "builtin" fields:
32  * n_cluster, clust - to record clusters
33  */
34 typedef struct {
35  bport_t *ports; /* boundary ports. 0-terminated */
36  int nports; /* no. of ports */
37  boxf bb; /* bounding box of graph */
38  int flags;
39  int level; /* depth in graph hierarchy */
40  graph_t *parent; /* smallest containing cluster */
41 #ifdef DEBUG
42  graph_t *orig; /* original of derived graph */
43 #endif
44 } gdata;
45 
46 #define GDATA(g) ((gdata*)(GD_alg(g)))
47 #define BB(g) (GDATA(g)->bb)
48 #define PORTS(g) (GDATA(g)->ports)
49 #define NPORTS(g) (GDATA(g)->nports)
50 #define LEVEL(g) (GDATA(g)->level)
51 #define GPARENT(g) (GDATA(g)->parent)
52 #ifdef DEBUG
53 #define GORIG(g) (GDATA(g)->orig)
54 #endif
55 
56 #if 0
57 /* ndata is attached to nodes in real graphs.
58  * Real nodes also use "builtin" fields:
59  * pos - position information
60  * width,height - node dimensions
61  * xsize,ysize - node dimensions in points
62  */
63 typedef struct {
64  node_t *dn; /* points to corresponding derived node,
65  * which may represent the node or its
66  * containing cluster. */
67  graph_t *parent; /* smallest containing cluster */
68 } ndata;
69 
70 #define NDATA(n) ((ndata*)(ND_alg(n)))
71 #define DNODE(n) (NDATA(n)->dn)
72 #define PARENT(n) (NDATA(n)->parent)
73 #endif
74 
75 /*
76  * Real nodes use "builtin" fields:
77  * ND_pos - position information
78  * ND_width,ND_height - node dimensions
79  * ND_pinned
80  * ND_lw,ND_rw,ND_ht - node dimensions in points
81  * ND_id
82  * ND_shape, ND_shape_info
83  *
84  * In addition, we use two of the dot fields for parent and derived node.
85  * Previously, we attached these via ND_alg, but ND_alg may be needed for
86  * spline routing, and splines=compound also requires the parent field.
87  */
88 #define DNODE(n) (ND_next(n))
89 #define PARENT(n) (ND_clust(n))
90 
91 /* dndata is attached to nodes in derived graphs.
92  * Derived nodes also use "builtin" fields:
93  * clust - for cluster nodes, points to cluster in real graph.
94  * pos - position information
95  * width,height - node dimensions
96  */
97 typedef struct {
98  int deg; /* degree of node */
99  int wdeg; /* weighted degree of node */
100  node_t *dn; /* If derived node is not a cluster, */
101  /* dn points real node. */
102  double disp[NDIM]; /* incremental displacement */
103 } dndata;
104 
105 #define DNDATA(n) ((dndata*)(ND_alg(n)))
106 #define DISP(n) (DNDATA(n)->disp)
107 #define ANODE(n) (DNDATA(n)->dn)
108 #define DEG(n) (DNDATA(n)->deg)
109 #define WDEG(n) (DNDATA(n)->wdeg)
110 #define IS_PORT(n) (!ANODE(n) && !ND_clust(n))
111 
112 #endif /* FDP_PRIVATE */
113 
114 #ifdef __cplusplus
115 extern "C" {
116 #endif
117 
118 struct fdpParms_s {
119  int useGrid; /* use grid for speed up */
120  int useNew; /* encode x-K into attractive force */
121  int numIters; /* actual iterations in layout */
122  int unscaled; /* % of iterations used in pass 1 */
123  double C; /* Repulsion factor in xLayout */
124  double Tfact; /* scale temp from default expression */
125  double K; /* spring constant; ideal distance */
126  double T0; /* initial temperature */
127 };
128 typedef struct fdpParms_s fdpParms_t;
129 
130  extern void fdp_layout(Agraph_t * g);
131  extern void fdp_init_node_edge(Agraph_t * g);
132  extern void fdp_cleanup(Agraph_t * g);
133 
134 #ifdef __cplusplus
135 }
136 #endif
137 #endif
#define parent(i)
Definition: closest.c:88
int useNew
Definition: fdp.h:120
void fdp_cleanup(Agraph_t *g)
Definition: fdpinit.c:145
void fdp_layout(Agraph_t *g)
Definition: layout.c:1114
Definition: circular.h:30
double T0
Definition: fdp.h:126
int unscaled
Definition: fdp.h:122
int numIters
Definition: fdp.h:121
double C
Definition: fdp.h:123
double K
Definition: fdp.h:125
double Tfact
Definition: fdp.h:124
#define alpha
Definition: shapes.c:3902
int useGrid
Definition: fdp.h:119
void fdp_init_node_edge(Agraph_t *g)
Definition: fdpinit.c:83
Definition: geom.h:35