#define PROG_NAME "TestePolyTopology" #define PROG_DESC "???" #define PROG_VERS "1.0" /* Last edited on 2024-12-21 11:42:04 by stolfi */ #define TestePolyTopology_C_COPYRIGHT \ "" #define PROG_INFO \ "" \ " " #include #include #include #include TYPE typedef struct Options_t { inFile: char *; } Options_t *GetOptions(int argc, char **argv); int main(int argc, char **argv) ov,oe,of : REF ARRAY OF INTEGER; { 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; { for (i = 0; i < top->cell.nel; i++) { ??? a = Srot(top.cell[i]); ??? top = MakeCellTopology(a); ??? pn = OrgV(a); { fprintf(stderr, "Cell: " & Fmt.Int(i) & "\n"); fprintf(stderr, " nv : " & Fmt.Int(top.node.nel) & "\n"); fprintf(stderr, " ne : " & Fmt.Int(top.edge.nel) & "\n"); fprintf(stderr, " nf : " & Fmt.Int(top.wall.nel) & "\n"); assert(top.node.nel-top.edge.nel+top.wall.nel==2); fprintf(stderr, " Nodes:\n"); fprintf(stderr, " "); ov = NEW(REF ARRAY OF INTEGER, top.node.nel); for (j = 0; j < top.node.nel; j++) { ??? ver = top.vRef[j]; { assert(PnegP(top.vRef[j]) == pn); ov[j] = OrgV(ver)->num; } } Mis.InsertionSort(top.node.nel-1,ov); for (j = 0; j < top.node.nel; j++) { fprintf(stderr, Fmt.Pad(Fmt.Int(ov[j]),2) & " "); } fprintf(stderr, "\n"); oe = NEW(REF ARRAY OF INTEGER, top.edge.nel); for (j = 0; j < top.edge.nel; j++) { ??? eer = top.eRef[j]; { assert(PnegP(top.eRef[j]) == pn); oe[j] = PEdge(eer)->num; } } Mis.InsertionSort(top.edge.nel-1,oe); fprintf(stderr, " @{Edge->?}s:\n"); fprintf(stderr, " "); for (j = 0; j < top.edge.nel; j++) { if (j == 24){ fprintf(stderr, "\n" & " "); } fprintf(stderr, Fmt.Pad(Fmt.Int(oe[j]),2) & " "); } fprintf(stderr, "\n"); of = NEW(REF ARRAY OF INTEGER, top.wall.nel); for (j = 0; j < top.wall.nel; j++) { ??? fer = top.fRef[j]; { assert(PnegP(top.fRef[j]) == pn); of[j] = PWall(fer)->num; } } Mis.InsertionSort(top.wall.nel-1,of); fprintf(stderr, " Walls:\n"); fprintf(stderr, " "); for (j = 0; j < top.wall.nel; j++) { fprintf(stderr, Fmt.Pad(Fmt.Int(of[j]),2) & " "); } fprintf(stderr, "\n"); } } return 0; } Options_t GetOptions () { 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); argparser_finish(pp); ----------------------------------- #define _HELP \ fprintf(stderr, "Usage: Teste" \ " -inFile " \ "\n"); END¦ } } return o; } /* END GetOptions */ { DoIt() } TestePolyTopology. /* Copyright © 2001 Universidade Estadual de Campinas (UNICAMP) */