From 7904a232f94d57fb0884725481d0c616f02c2520 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 10 Nov 2007 12:57:06 +0000 Subject: [PATCH] compute bd^2/l --- anneal.c | 167 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 122 insertions(+), 45 deletions(-) diff --git a/anneal.c b/anneal.c index 3a49db8..ab521f4 100644 --- a/anneal.c +++ b/anneal.c @@ -3,34 +3,34 @@ * * Vertices in strip are numbered as follows: * - * ___ L-2 ___ L-1 ___ 0 ___ 1 ___ 2 ___ 3 ___ 4 __ - * W-1 W-1 0 0 0 0 0 + * ___ X-2 ___ X-1 ___ 0 ___ 1 ___ 2 ___ 3 ___ 4 __ + * Y-1 Y-1 0 0 0 0 0 * / \ / \ / \ / \ / \ / \ / \ * / \ / \ / \ / \ / \ / \ / \ - * L-3 ___ L-2 ___ L-1 ___ 0 ___ 1 ___ 2 ___ 3 ___ 4 - * W-2 W-2 W-2 1 1 1 1 1 + * X-3 ___ X-2 ___ X-1 ___ 0 ___ 1 ___ 2 ___ 3 ___ 4 + * Y-2 Y-2 Y-2 1 1 1 1 1 * \ / \ / \ / \ / \ / \ / \ / * \ / \ / \ / \ / \ / \ / \ / - * ___ L-3 ___ L-2 ___ L-1 ___ 0 ___ 1 ___ 2 ___ 3 __ - * W-3 W-3 W-3 2 2 2 2 + * ___ X-3 ___ X-2 ___ X-1 ___ 0 ___ 1 ___ 2 ___ 3 __ + * Y-3 Y-3 Y-3 2 2 2 2 * * . . . . . . . . . . . . . . . * - * L-4 ___ L-3 ___ L-2 ___ L-1 ___ 0 ___ 1 ___ 2 ___ 3 - * 1 1 1 1 W-2 W-2 W-2 W-2 + * X-4 ___ X-3 ___ X-2 ___ X-1 ___ 0 ___ 1 ___ 2 ___ 3 + * 1 1 1 1 Y-2 Y-2 Y-2 Y-2 * \ / \ / \ / \ / \ / \ / \ / * \ / \ / \ / \ / \ / \ / \ / - * ___ L-4 ___ L-3 ___ L-2 ___ L-1 ___ 0 ___ 1 ___ 2 __ - * 0 0 0 0 W-1 W-1 W-1 + * ___ X-4 ___ X-3 ___ X-2 ___ X-1 ___ 0 ___ 1 ___ 2 __ + * 0 0 0 0 Y-1 Y-1 Y-1 * * Node x,y for - * 0 <= x < L x = distance along L = length - * 0 <= y < W y = distance across W = width + * 0 <= x < X x = distance along + * 0 <= y < Y y = distance across * * Vertices are in reading order from diagram above ie x varies fastest. * - * W must be even. The actual location opposite (0,0) is (L-(W-1)/2,0), - * and likewise opposite (0,W-1) is ((W-1)/2,0). + * Y must be even. The actual location opposite (0,0) is (X-(Y-1)/2,0), + * and likewise opposite (0,Y-1) is ((Y-1)/2,0). * * To label edges, we counte anticlockwise[*] from to-the-right: * @@ -43,19 +43,27 @@ * * [*] That is, in the direction represented as anticlockwise for * the vertices (0,*)..(4,*) in the diagram above; and of course - * that is clockwise for the vertices (L-5,*)..(L-1,*). The - * numbering has an actual discontinuity between (L-1,*) and (0,*). + * that is clockwise for the vertices (X-5,*)..(X-1,*). The + * numbering has an actual discontinuity between (X-1,*) and (0,*). * * When we iterate over edges, we iterate first over vertices and then * over edges 0 to 2, disregarding edges 3 to 5. */ -#define LN2W 4 -#define L (1<= 0) ; else + if (((v2)= EDGE_END2((v1),(e))) < 0) ; else #define FOR_EDGE(v1,e,v2) \ FOR_VERTEX((v1)) \ FOR_VEDGE((v1),(e),(v2)) -static double energy_function(const double vertices[N][3]) { - int vertex; - - FOR_VERTEX { - +#define FOR_COORD(k) \ + for ((k)=0; (k)