#include "bary.h"
Include dependency graph for testmain.c:
Go to the source code of this file.
Functions | |
void | init_barycentering (void) |
void | barycentering (void) |
int | main () |
|
Definition at line 383 of file bary_functions.c. References copy_layers(), G_timelimit, graph_crossings(), gs_wait_message(), have_alternative, layer, max_baryiterations, maxdepth, min_baryiterations, nr_bary_iterations, nr_crossings, phase1_allowed, phase1_down(), phase1_up(), phase2_down(), phase2_startlevel, phase2_up(), skip_baryphase2, test_timelimit(), and tmp_layer.
00384 { 00385 int alt; 00386 int cross; 00387 int changed; 00388 int tmp_startlevel, alt_startlevel; 00389 tmp_startlevel = alt_startlevel = 0; 00390 changed = 1; 00391 while (phase1_allowed && changed) 00392 { 00393 nr_bary_iterations++; 00394 if (nr_bary_iterations >= max_baryiterations) 00395 { 00396 gs_wait_message ('t'); 00397 break; 00398 } 00399 if (G_timelimit > 0) if (test_timelimit (60)) 00400 { 00401 gs_wait_message ('t'); 00402 break; 00403 } 00404 changed = 0; 00405 phase1_down (); 00406 cross = graph_crossings (); 00407 alt = 0; 00408 if ((cross < nr_crossings) || (nr_bary_iterations < min_baryiterations)) 00409 { 00410 changed = 1; 00411 copy_layers (layer, tmp_layer); 00412 nr_crossings = cross; 00413 alt_startlevel = tmp_startlevel; 00414 } 00415 else if (have_alternative) 00416 { 00417 copy_layers (tmp_layer, layer); 00418 phase1_down (); 00419 cross = graph_crossings (); 00420 if (cross < nr_crossings) 00421 { 00422 changed = 1; 00423 copy_layers (layer, tmp_layer); 00424 nr_crossings = cross; 00425 alt_startlevel = tmp_startlevel; 00426 } 00427 else if (cross > nr_crossings) 00428 { 00429 copy_layers (tmp_layer, layer); 00430 tmp_startlevel = alt_startlevel; 00431 } 00432 else 00433 alt = 1; 00434 } else if (cross == nr_crossings) 00435 alt = 1; 00436 else 00437 { 00438 copy_layers (tmp_layer, layer); 00439 tmp_startlevel = alt_startlevel; 00440 } 00441 have_alternative = alt; 00442 phase1_up (); 00443 cross = graph_crossings (); 00444 alt = 0; 00445 if ((cross < nr_crossings) || (nr_bary_iterations < min_baryiterations)) 00446 { 00447 changed = 1; 00448 copy_layers (layer, tmp_layer); 00449 nr_crossings = cross; 00450 alt_startlevel = tmp_startlevel; 00451 } 00452 else if (have_alternative) 00453 { 00454 copy_layers (tmp_layer, layer); 00455 phase1_up (); 00456 cross = graph_crossings (); 00457 if (cross < nr_crossings) 00458 { 00459 changed = 1; 00460 copy_layers (layer, tmp_layer); 00461 nr_crossings = cross; 00462 alt_startlevel = tmp_startlevel; 00463 } 00464 else if (cross > nr_crossings) 00465 { 00466 copy_layers (tmp_layer, layer); 00467 tmp_startlevel = alt_startlevel; 00468 } 00469 else 00470 alt = 1; 00471 } else if (cross == nr_crossings) 00472 alt = 1; 00473 else 00474 { 00475 copy_layers (tmp_layer, layer); 00476 tmp_startlevel = alt_startlevel; 00477 } 00478 have_alternative = alt; 00479 00480 if (nr_crossings == 0) 00481 return; 00482 00483 } 00484 if (nr_crossings == 0) 00485 return; 00486 00487 if (skip_baryphase2) 00488 return; 00489 00490 phase1_allowed = 0; 00491 tmp_startlevel = alt_startlevel = 0; 00492 changed = 1; 00493 while (changed) 00494 { 00495 nr_bary_iterations++; 00496 if (nr_bary_iterations >= max_baryiterations) 00497 { 00498 gs_wait_message ('t'); 00499 break; 00500 } 00501 if (G_timelimit > 0) if (test_timelimit (60)) 00502 { 00503 gs_wait_message ('t'); 00504 break; 00505 } 00506 changed = 0; 00507 phase2_startlevel = tmp_startlevel; 00508 phase2_down (); 00509 tmp_startlevel = phase2_startlevel; 00510 00511 if (tmp_startlevel > maxdepth) tmp_startlevel = 0; 00512 cross = graph_crossings (); 00513 alt = 0; 00514 00515 if (cross < nr_crossings) 00516 { 00517 changed = 1; 00518 copy_layers (layer, tmp_layer); 00519 nr_crossings = cross; 00520 alt_startlevel = tmp_startlevel; 00521 } 00522 else if (have_alternative) 00523 { 00524 copy_layers (tmp_layer, layer); 00525 phase2_startlevel = tmp_startlevel = alt_startlevel; 00526 phase2_down (); 00527 tmp_startlevel = phase2_startlevel; 00528 if (tmp_startlevel > maxdepth) tmp_startlevel = 0; 00529 cross = graph_crossings (); 00530 if (cross < nr_crossings) 00531 { 00532 changed = 1; 00533 copy_layers (layer, tmp_layer); 00534 nr_crossings = cross; 00535 alt_startlevel = tmp_startlevel; 00536 } 00537 else if (cross > nr_crossings) 00538 { 00539 copy_layers (tmp_layer, layer); 00540 tmp_startlevel = alt_startlevel; 00541 } 00542 else alt = 1; 00543 } else if (cross == nr_crossings) alt = 1; 00544 else 00545 { 00546 copy_layers (tmp_layer, layer); 00547 tmp_startlevel = alt_startlevel; 00548 } 00549 have_alternative = alt; 00550 00551 if (nr_crossings == 0) 00552 return; 00553 } 00554 00555 tmp_startlevel = alt_startlevel = maxdepth + 1; 00556 changed = 1; 00557 while (changed) 00558 { 00559 nr_bary_iterations++; 00560 if (nr_bary_iterations >= max_baryiterations) 00561 { 00562 gs_wait_message ('t'); 00563 break; 00564 } if (G_timelimit > 0) if (test_timelimit (60)) 00565 { 00566 gs_wait_message ('t'); 00567 break; 00568 } changed = 0; 00569 phase2_startlevel = tmp_startlevel; 00570 phase2_up (); 00571 tmp_startlevel = phase2_startlevel; 00572 if (tmp_startlevel < 0) tmp_startlevel = maxdepth; 00573 cross = graph_crossings (); 00574 alt = 0; 00575 if (cross < nr_crossings) 00576 { 00577 changed = 1; 00578 copy_layers (layer, tmp_layer); 00579 nr_crossings = cross; 00580 alt_startlevel = tmp_startlevel; 00581 } else if (have_alternative) { 00582 00583 copy_layers (tmp_layer, layer); 00584 phase2_startlevel = tmp_startlevel = alt_startlevel; 00585 phase2_up (); 00586 tmp_startlevel = phase2_startlevel; 00587 if (tmp_startlevel < 0) tmp_startlevel = maxdepth; 00588 cross = graph_crossings (); 00589 if (cross < nr_crossings) 00590 { 00591 changed = 1; 00592 copy_layers (layer, tmp_layer); 00593 nr_crossings = cross; 00594 alt_startlevel = tmp_startlevel; 00595 } 00596 else if (cross > nr_crossings) 00597 { 00598 copy_layers (tmp_layer, layer); 00599 tmp_startlevel = alt_startlevel; 00600 } 00601 else 00602 alt = 1; 00603 } else if (cross == nr_crossings) alt = 1; 00604 else 00605 { 00606 copy_layers (tmp_layer, layer); 00607 tmp_startlevel = alt_startlevel; 00608 } 00609 have_alternative = alt; 00610 if (nr_crossings == 0) 00611 return; 00612 } 00613 } |
|
Definition at line 378 of file bary_functions.c. References have_alternative, phase1_allowed, and STATIC. Referenced by main().
00378 { 00379 have_alternative = 0; 00380 phase1_allowed = 1; 00381 } |
|
Definition at line 5 of file testmain.c. References barycentering(), init_barycentering(), max_baryiterations, and maxdepth.
00006 { 00007 max_baryiterations=1000; 00008 maxdepth=100; 00009 init_barycentering(); 00010 00011 // level_to_array needs to have the following data :a 00012 // (tmp_layer[i]).succlist is read, following the next 00013 // sort_array is filled 00014 00015 barycentering (); 00016 00017 00018 } |