00001 00002 00003 STATIC int resort_down_layer (int i){ 00004 int c; int j; 00005 level_to_array (i + 1, 'd'); 00006 switch (crossing_heuristics) { 00007 case 0: for (j = 0; j < ((layer[i + 1]).anz); j++) ((sort_array[j])->bary) = predbary (sort_array[j]); break; 00008 case 1: for (j = 0; j < ((layer[i + 1]).anz); j++) ((sort_array[j])->bary) = predmedian (sort_array[j]); break; 00009 case 2: for (j = 0; j < ((layer[i + 1]).anz); j++) ((sort_array[j])->bary) = predbary (sort_array[j]) + predmedian (sort_array[j])/10000.0; break; 00010 case 3: for (j = 0; j < ((layer[i + 1]).anz); j++) ((sort_array[j])->bary) = predmedian (sort_array[j]) +predbary (sort_array[j])/10000.0; break; 00011 } 00012 00013 if (((layer[i + 1]).anz)) qsort (sort_array, ((layer[i + 1]).anz), sizeof (GNODE), (int (*)(const void *, const void *)) compare_bary); 00014 save_level (i + 1); 00015 array_to_level (i + 1); 00016 if (((layer[i + 1]).resort_necessary)) apply_horder (i + 1); 00017 c = layer_crossing (i); 00018 if (c <= ((tmp_layer[i]).cross)) { 00019 ((tmp_layer[i]).cross) = c; 00020 if (i < maxdepth) ((tmp_layer[i + 1]).cross) = layer_crossing (i + 1); 00021 return (1); 00022 } 00023 restore_level (i + 1); 00024 return (0); 00025 } 00026 00027 STATIC int resort_up_layer (int i){ 00028 int c; int j; 00029 level_to_array (i, 'u'); 00030 switch (crossing_heuristics) { 00031 case 0: for (j = 0;j < ((layer[i]).anz);j++)((sort_array[j])->bary) = succbary (sort_array[j]); break; 00032 case 1: for (j = 0;j < ((layer[i]).anz);j++)((sort_array[j])->bary) = succmedian (sort_array[j]); break; 00033 case 2: for (j = 0;j < ((layer[i]).anz);j++)((sort_array[j])->bary) = succbary (sort_array[j]) + succmedian (sort_array[j]) / 10000.0; break; 00034 case 3: for (j = 0; j < ((layer[i]).anz); j++) ((sort_array[j])->bary) =succmedian(sort_array[j])+succbary(sort_array[j])/10000.0;break; 00035 } 00036 if (((layer[i]).anz)) qsort (sort_array, ((layer[i]).anz), sizeof (GNODE), (int (*)(const void *, const void *)) compare_bary); 00037 save_level (i); 00038 array_to_level (i); 00039 if (((layer[i]).resort_necessary)) apply_horder (i); 00040 c = layer_crossing (i); 00041 if (c <= ((tmp_layer[i]).cross)) { 00042 ((tmp_layer[i]).cross) = c; 00043 if (i > 0) ((tmp_layer[i - 1]).cross) = layer_crossing (i - 1); 00044 return (1); 00045 } 00046 restore_level (i); 00047 return (0); 00048 }