Graph MakeGraph(int numvert, int numproc) { int perproc = numvert/numproc; int i,j; int count1; Vertex v,tmp; Vertex block; Graph retval; #ifdef FUTURES future_cell_int fc[MAXPROC]; #endif retval = (Graph) ALLOC(0,sizeof(*retval)); for (i=0; i<MAXPROC; i++) { retval->vlist[i]=NULL; } chatting("Make phase 2\n"); for (j=numproc-1; j>=0; j--) { block = (Vertex) ALLOC(j,perproc*(sizeof(*tmp))); v = NULL; for (i=0; i<perproc; i++) { tmp = block+(perproc-i-1); HashRange = numvert/4; tmp->mindist = 9999999; tmp->edgehash = MakeHash(numvert/4,hashfunc); tmp->next = v; v=tmp; } retval->vlist[j] = v; } chatting("Make phase 3\n"); for (j=numproc-1; j>=0; j--) { count1 = j*perproc; #ifndef FUTURES AddEdges(count1, retval, numproc, perproc, numvert, j); #else FUTURE(count1,retval,numproc,perproc,numvert,j,AddEdges,&fc[j]); #endif } /* for j... */ chatting("Make phase 4\n"); #ifdef FUTURES for (j=0; j<numproc; j++) { TOUCH(&fc[j]); } #endif chatting("Make returning\n"); return retval; }
void print_list(Tree t) { Tree tmp; double x,y; if (!t) return; x = t->x; y = t->y; chatting("%f %f\n",x,y); for (tmp=t->next; tmp!=t; tmp=tmp->next) { x = tmp->x; y = tmp->y; chatting("%f %f\n",x,y); } }
void main() { textbackground(0); welcome(); chatwindow(); chatting(); }
Graph MakeGraph(int numvert, int numproc) { int perproc = numvert/numproc; int i,j; int count1; Vertex v,tmp; Vertex block; Graph retval; retval = (Graph)malloc(sizeof(*retval)); for (i=0; i<MAXPROC; i++) { retval->vlist[i]=NULL; } chatting("Make phase 2\n"); for (j=numproc-1; j>=0; j--) { block = (Vertex) malloc(perproc*(sizeof(*tmp))); v = NULL; for (i=0; i<perproc; i++) { tmp = block+(perproc-i-1); HashRange = numvert/4; tmp->mindist = 9999999; tmp->edgehash = MakeHash(numvert/4,hashfunc); tmp->next = v; v=tmp; } retval->vlist[j] = v; } chatting("Make phase 3\n"); for (j=numproc-1; j>=0; j--) { count1 = j*perproc; AddEdges(count1, retval, numproc, perproc, numvert, j); } /* for j... */ chatting("Make phase 4\n"); chatting("Make returning\n"); return retval; }
int main(int argc,char *argv[]) { Tree t; int num; num=dealwithargs(argc,argv); chatting("Building tree of size %d\n",num); t=build_tree(num,0,0,NumNodes,0.0,1.0,0.0,1.0); if (!flag) chatting("Past build\n"); if (flag) chatting("newgraph\n"); if (flag) chatting("newcurve pts\n"); printf("Call tsp(t, %d, %d)\n", conquer_thresold, NumNodes); tsp(t,conquer_thresold, NumNodes); if (flag) print_list(t); if (flag) chatting("linetype solid\n"); return 0; }
void print_tree(Tree t) { Tree left,right; double x,y; if (!t) return; x = t->x; y = t->y; chatting("x=%f,y=%f\n",x,y); left = t->left; right=t->right; print_tree(left); print_tree(right); }
int main(void) { Tree___0 t ; int num ; struct tree *tmp ; int tmp___0 ; struct tree *__cil_tmp5 ; { { #line 74 num = dealwithargs(); #line 76 chatting("Building tree of size %d\n", num); #line 77 tmp = build_tree(num, 0, 0, __NumNodes, 0.0, 1.0, 0.0, 1.0); #line 77 t = (struct tree___0 *)tmp; } #line 81 if (! flag) { { #line 81 chatting("Past build\n"); } } else { } #line 82 if (flag) { { #line 82 chatting("newgraph\n"); } } else { } #line 83 if (flag) { { #line 83 chatting("newcurve pts\n"); } } else { } { #line 86 timer_start(0); #line 87 __cil_tmp5 = (struct tree *)t; #line 87 tsp(__cil_tmp5, 150, __NumNodes); #line 88 timer_stop(0); } #line 89 if (flag) { { #line 89 print_list(t); } } else { } #line 90 if (flag) { { #line 90 chatting("linetype solid\n"); } } else { } { #line 91 tmp___0 = timer_elapsed(0); #line 91 chatting("Time for TSP = %f\n", tmp___0); #line 99 exit(0); } } }
void print_list(Tree___0 t ) { Tree___0 tmp ; double x ; double y ; unsigned int __cil_tmp5 ; unsigned int __cil_tmp6 ; unsigned int __cil_tmp7 ; unsigned int __cil_tmp8 ; unsigned int __cil_tmp9 ; unsigned int __cil_tmp10 ; struct tree *__cil_tmp11 ; unsigned int __cil_tmp12 ; unsigned int __cil_tmp13 ; unsigned int __cil_tmp14 ; unsigned int __cil_tmp15 ; unsigned int __cil_tmp16 ; unsigned int __cil_tmp17 ; unsigned int __cil_tmp18 ; unsigned int __cil_tmp19 ; struct tree *__cil_tmp20 ; double *mem_21 ; double *mem_22 ; struct tree **mem_23 ; double *mem_24 ; double *mem_25 ; struct tree **mem_26 ; { #line 57 if (! t) { #line 57 return; } else { } { #line 58 __cil_tmp5 = (unsigned int )t; #line 58 __cil_tmp6 = __cil_tmp5 + 4; #line 58 mem_21 = (double *)__cil_tmp6; #line 58 x = *mem_21; #line 58 __cil_tmp7 = (unsigned int )t; #line 58 __cil_tmp8 = __cil_tmp7 + 12; #line 58 mem_22 = (double *)__cil_tmp8; #line 58 y = *mem_22; #line 59 chatting("%f %f\n", x, y); #line 60 __cil_tmp9 = (unsigned int )t; #line 60 __cil_tmp10 = __cil_tmp9 + 28; #line 60 mem_23 = (struct tree **)__cil_tmp10; #line 60 __cil_tmp11 = *mem_23; #line 60 tmp = (struct tree___0 *)__cil_tmp11; } { #line 60 while (1) { while_1_continue: /* CIL Label */ ; { #line 60 __cil_tmp12 = (unsigned int )t; #line 60 __cil_tmp13 = (unsigned int )tmp; #line 60 if (__cil_tmp13 != __cil_tmp12) { } else { goto while_1_break; } } { #line 62 __cil_tmp14 = (unsigned int )tmp; #line 62 __cil_tmp15 = __cil_tmp14 + 4; #line 62 mem_24 = (double *)__cil_tmp15; #line 62 x = *mem_24; #line 62 __cil_tmp16 = (unsigned int )tmp; #line 62 __cil_tmp17 = __cil_tmp16 + 12; #line 62 mem_25 = (double *)__cil_tmp17; #line 62 y = *mem_25; #line 63 chatting("%f %f\n", x, y); #line 60 __cil_tmp18 = (unsigned int )tmp; #line 60 __cil_tmp19 = __cil_tmp18 + 28; #line 60 mem_26 = (struct tree **)__cil_tmp19; #line 60 __cil_tmp20 = *mem_26; #line 60 tmp = (struct tree___0 *)__cil_tmp20; } } while_1_break: /* CIL Label */ ; } #line 65 return; } }
void print_tree(Tree___0 t ) { Tree___0 left ; Tree___0 right ; double x ; double y ; unsigned int __cil_tmp6 ; unsigned int __cil_tmp7 ; unsigned int __cil_tmp8 ; unsigned int __cil_tmp9 ; unsigned int __cil_tmp10 ; unsigned int __cil_tmp11 ; struct tree *__cil_tmp12 ; unsigned int __cil_tmp13 ; unsigned int __cil_tmp14 ; struct tree *__cil_tmp15 ; double *mem_16 ; double *mem_17 ; struct tree **mem_18 ; struct tree **mem_19 ; { #line 44 if (! t) { #line 44 return; } else { } { #line 45 __cil_tmp6 = (unsigned int )t; #line 45 __cil_tmp7 = __cil_tmp6 + 4; #line 45 mem_16 = (double *)__cil_tmp7; #line 45 x = *mem_16; #line 45 __cil_tmp8 = (unsigned int )t; #line 45 __cil_tmp9 = __cil_tmp8 + 12; #line 45 mem_17 = (double *)__cil_tmp9; #line 45 y = *mem_17; #line 46 chatting("x=%f,y=%f\n", x, y); #line 47 __cil_tmp10 = (unsigned int )t; #line 47 __cil_tmp11 = __cil_tmp10 + 20; #line 47 mem_18 = (struct tree **)__cil_tmp11; #line 47 __cil_tmp12 = *mem_18; #line 47 left = (struct tree___0 *)__cil_tmp12; #line 47 __cil_tmp13 = (unsigned int )t; #line 47 __cil_tmp14 = __cil_tmp13 + 24; #line 47 mem_19 = (struct tree **)__cil_tmp14; #line 47 __cil_tmp15 = *mem_19; #line 47 right = (struct tree___0 *)__cil_tmp15; #line 48 print_tree(left); #line 49 print_tree(right); } #line 50 return; } }