#define PROG_NAME "SubGon" #define PROG_DESC "???" #define PROG_VERS "1.0" /* Last edited on 2007-02-03 12:34:26 by stolfi */ #define SubGon_C_COPYRIGHT \ "" #define PROG_INFO \ "" \ " " /* This program receives as input a single cell (the envelope) and produces a include file with the barycentric subdivision of walls (2-skeleton) and cells (3-skeleton) but in an exploding way. */ #define SubGon_C_author \ "Modified by L.A.P.Lozada on 2000-05-19." #include #include #include #define _GNU_SOURCE #include TYPE typedef struct Options_t { uint order; /* order of the triangle star */ char *outFile; /* Output file name prefix */ } Options_t *GetOptions(int argc, char **argv); int main(int argc, char **argv) REF Place_vec_t a ; { ElemTableRec_t top; Options_t *o = GetOptions(argc, argv); char *topo_cmt = jsprintf("Created by %s on %s", PROG_NAME, Today()); /* Random_t coins = MakeRandomSource(4615); */ { Place_vec_t a = Place_vec_new(o->order); for (i = 0; i < o->order; i++) { a[i] = Squared.MakeTriangle(); } for (i = 0; i < o->order; i++) { SetNextF(NextE(a[i]), Clock(PrevE(a[(i+1) % o->order]))); SetRingEdgeInfo(NextE(a[i]), PEdge(NextE(a[i]))); } for (i = 0; i < o->order; i++) { SetOrgAll(NextE(a[i]), OrgV(NextE(a[i]))); SetOrgAll(PrevE(a[i]), OrgV(PrevE(a[i]))); SetOrgAll(a[i], OrgV(a[i])); } top = MakeElemTable(a[0]); ??? c = GenCoords(top); { WriteTopology(o->outFile, top, "Created by SubGon: gon-" \ Fmt.Int(o->order) & ".tp"); WriteState(o->outFile, top, c^, "Created by SubGon: gon-" & Fmt.Int(o->order) & ".st"); WriteMaterials(o->outFile, top,"Created by SubGon: gon-" \ Fmt.Int(o->order) & ".ma"); } } } DoIt; 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); { ¦TRY argparser_get_keyword(pp, "-outFile"); o->outFile = argparser_get_next(pp); argparser_get_keyword(pp, "-order"); o->order = argparser_get_next_int(pp, 2,20); argparser_finish(pp); ----------------------------------- #define _HELP \ fprintf(stderr, "Usage: SubGon \\\n" \ " -order \\\n" \ " -outFile \n"); END¦ } } return o; } /* END GetOptions */ { DoIt() } SubGon. /* Copyright © 2001 Universidade Estadual de Campinas (UNICAMP) */