#define PROG_NAME "TestGeomDege" #define PROG_DESC "???" #define PROG_VERS "1.0" #define TestGeomDege_C_COPYRIGHT \ "" #define PROG_INFO \ "" \ " " /* Program to find degenerations on the topologies to builds by several "Make" programs. */ #define TestGeomDege_C_author \ "Created by L. Lozada, 1999-2000.\n" \ "Modified by L.A.P.Lozada on 2000-01-19." #include #include #include #define _GNU_SOURCE #include #include TYPE typedef struct Options_t { char *inFile; /* Initial guess file name (minus ".tp") */ bool_t @{edge->?}; bool_t wall; bool_t all; } Options_t *GetOptions(int argc, char **argv); int main(int argc, char **argv) e1,e2,f1,f2: REF ARRAY OF INTEGER; v : REF ARRAY OF bool_t; { Options_t *o = GetOptions(argc, argv); char *topo_cmt = jsprintf("Created by %s on %s", PROG_NAME, Today()); /* Random_t coins = MakeRandomSource(4615); */ ??? tc = Triangulation.ReadToMa(o->inFile); ??? top = tc.top; { if ((o->edge) || (o->all)) { filefmt_write_comment(stderr, "\nTest of @{Edge->?}s\n" & "\n",'|'); for (i = 0; i < top->NE; i++) { for (j = i+1; j < top->NE; j++) { ??? ei = top->edge[i].pa; ??? ej = top->edge[j].pa; Node_t ei0 = OrgV(ei)->num; ??? ei1 = OrgV(Clock(ei))->num; Node_t ej0 = OrgV(ej)->num; ??? ej1 = OrgV(Clock(ej))->num; { e1 = NEW(REF ARRAY OF INTEGER, 2); e1[0] = ei0; e1[1] = ei1; Mis.InsertionSort(1,e1); e2 = NEW(REF ARRAY OF INTEGER, 2); e2[0] = ej0; e2[1] = ej1; Mis.InsertionSort(1,e2); if ((e1[0] == e2[0]) && (e1[1] == e2[1])) { fprintf(stderr, "Failed Test Of @{Edge->?}s\n"); fprintf(stderr,Fmt.Int(e1[0]) & " "& Fmt.Int(e1[1]) & "\n"); Process.Exit¦(1); } } } } } if ((o->wall) || (o->all)) { filefmt_write_comment(stderr, "\nTest of Walls\n" & "\n",'|'); for (i = 0; i < top->wall.nel; i++) { for (j = i+1; j < top->wall.nel; j++) { ??? fi = top->wall[i]; ??? fj = top->wall[j]; ??? pi = fi.pa; ??? pj = fj.pa; ??? ri = Octf.DegreeOfEdge(pi); ??? rj = Octf.DegreeOfEdge(pj); { if (ri == rj) { f1 = NEW(REF ARRAY OF INTEGER, ri); f2 = NEW(REF ARRAY OF INTEGER, ri); for (k = 0; k < ri; k++) { f1[k] = OrgV(pi)->num; pi = NextE(pi); f2[k] = OrgV(pj)->num; pj = NextE(pj); } Mis.InsertionSort(ri-1,f1); Mis.InsertionSort(ri-1,f2); v = NEW(REF ARRAY OF bool_t, ri); for (k = 0; k < ri; k++) { v[k] = (f1[k] == f2[k]); } INTEGER n = 0; VAR { for (k = 0; k < ri; k++) { if (v[k]){ n++; } } if (n == ri) { fprintf(stderr, "Failed Test Of Walls\n"); for (k = 0; k < ri; k++) { fprintf(stderr,Fmt.Int(f1[k]) & " "); } fprintf(stderr,"\n"); Process.Exit¦(1); } } } } } } } } } DoIt; Options_t *GetOptions(int argc, char **argv) { Options_t *o = (Options_t *)malloc(sizeof(Options_t)); argparser_t *pp = argparser_new(stderr, argc, argv); argparser_set_help(pp, PROG_NAME " version " PROG_VERS ", usage:\n" PROG_HELP); argparser_set_info(pp, PROG_INFO); argparser_process_help_info_options(pp); argparser_get_keyword(pp, "-inFile"); o->inFile = argparser_get_next(pp); o->edge = argparser_keyword_present(pp, "-@{edge->?}"); o->wall = argparser_keyword_present(pp, "-wall"); o->all = argparser_keyword_present(pp, "-all"); argparser_finish(pp); ----------------------------------- #define _HELP \ fprintf(stderr, "Usage: TestGeomDege -inFile \\\n" \ " [ -@{edge->?} | -wall | -all ]\n"); END¦ } } return o; } /* END GetOptions */ { DoIt() } TestGeomDege. /* Copyright © 2001 Universidade Estadual de Campinas (UNICAMP) */