#define PROG_NAME "RefineTriangGood" #define PROG_DESC "???" #define PROG_VERS "1.0" #define RefineTriangGood_C_COPYRIGHT \ "" #define PROG_INFO \ "" \ " " /* Refines (or duplicate) a given triangulation (".tp" file). (see notice of copyright at the end of this file). This program is inspired in the implementations of for the bidimensional case. */ #define RefineTriangGood_C_author \ "Created in 1999 by L. Lozada, basd on a 2D version by R. M. Rosi and J. Stolfi" #include #include #include #include #define _GNU_SOURCE #include TYPE typedef struct Options_t { char *inFileTp; /* Input file name (minus ".tp" extension) */ char *inFileSt; /* Input file name (minus ".st" extension) */ char *outFile; /* Output file name prefix */ bool_t fixOriginal; /* TRUE to fix original nodes */ } double RowT = ARRAY [0..3] OF Place_t; Options_t *GetOptions(int argc, char **argv); int main(int argc, char **argv) CONST double Thin@{Edge->?}Radius = 0.0025; uint NNE = 0; NNV: uint = 0; NNP: uint = 0; gi : REF ARRAY OF Place_vec_t; n{ 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); */ ??? tc = Triangulation.ReadToTaMa(o->inFileTp); ??? top = tc.top; ??? rc = Triangulation.ReadState(o->inFileSt); ??? c = rc^; ??? half = Place_vec_new(2*top->wall.nelE)^; ??? vnew = Node_vec_new(top->node.nel)^; { if (top->der!=3) { fprintf(stderr,"This topology isn't a triangulation\n"); Process.Exit¦(1); } fprintf(stderr, "Refining from: " & o->inFileTp & ".tp\n"); gi = NEW(REF ARRAY OF Place_vec_t, top->cell.nel, 4); Place_t Half(Place_t @p) { ??? na = PWedge(a)->num; ??? oa = OrientationBit(a); ??? sa = SpinBit(a); ??? h = half[2*na + oa]; { if (sa == 0){ return h }else{ return Spin(h); } } } Half; Place_t MakeTriangle(void) /* Make one triangular wall and set of the three places with the same wall component. */ { Place_t a = MakeWedge(); Place_t b = MakeWedge(); Place_t c = MakeWedge(); Wall_t f = PWall(a); Node_t u = MakeNode(0); Node_t v = MakeNode(1); Node_t w = MakeNode(2); { PWedge(a)->num = NNE; NNE++; PWedge(a)->num = NNE; NNE++; PEdge(a).radius = Thin@{Edge->?}Radius; SetOrg(a, u); SetOrg(Clock(a),v); PWedge(b)->num = NNE; NNE++; PEdge(b).radius = Thin@{Edge->?}Radius; SetNextE(a,b); SetWallInfo(b,f); SetOrg(b,v); SetOrg(Clock(b),w); PWedge(c)->num = NNE; NNE++; PEdge(c).radius = Thin@{Edge->?}Radius; SetNextE(b,c); SetWallInfo(c,f); SetOrg(c, w); SetOrg(Clock(c), OrgV(a)); return a; } } MakeTriangle; /* ====== Refine the Tetrahedral Cell ====== */ void RefineCell(g: RowT) { /* To insert four walls obliques "i", "j", "k", "l" */ ??? i = MakeTriangle(); with ( j == MakeTriangle(), double k = MakeTriangle(), l == MakeTriangle() ){ /* the wall "i" will be splice with g[1], g[2], g[3] */ SetNextF(i,Clock(g[1])); SetNextF(NextE(i),NextE(g[3])); SetNextF(PrevE(i),Clock(g[2])); /* Update the component @{edge->?} */ SetEdgeInfo(i, PEdge(g[1])); SetEdgeInfo(NextE(i), PEdge(NextE(g[3]))); SetEdgeInfo(PrevE(i), PEdge(g[2])); /* Update the origins */ SetOrg(i, OrgV(g[2])); SetOrg(Clock(i), OrgV(g[1])); SetOrg(NextE(i), OrgV(Clock(i))); SetOrg(Clock(NextE(i)), OrgV(NextE(g[2]))); SetOrg(PrevE(i), OrgV(Clock(NextE(i)))); SetOrg(Clock(PrevE(i)), OrgV(i)); /* the wall "j" will be splice with: g[0], g[1], g[2] */ SetNextF(j,NextE(g[0])); SetNextF(NextE(j),Clock(NextE(g[1]))); SetNextF(PrevE(j),Clock(PrevE(g[2]))); /* Update the component @{edge->?} */ SetEdgeInfo(j, PEdge(NextE(g[0]))); SetEdgeInfo(NextE(j), PEdge(NextE(g[1]))); SetEdgeInfo(PrevE(j), PEdge(PrevE(g[2]))); /* Update the origins */ SetOrg(j, OrgV(NextE(g[0]))); SetOrg(Clock(j), OrgV(PrevE(g[0]))); SetOrg(NextE(j), OrgV(Clock(j))); SetOrg(Clock(NextE(j)), OrgV(g[2])); SetOrg(PrevE(j), OrgV(Clock(NextE(j)))); SetOrg(Clock(PrevE(j)), OrgV(j)); /* the wall "k" will be splice with: g[0], g[1], g[3]) */ SetNextF(k,Clock(PrevF(PrevE(g[0])))); SetNextF(NextE(k),NextF(PrevE(g[1]))); SetNextF(PrevE(k),Clock(PrevF(g[3]))); /* Update the component @{edge->?} */ SetEdgeInfo(k,PEdge(PrevE(g[0]))); SetEdgeInfo(NextE(k),PEdge(PrevE(g[1]))); SetEdgeInfo(PrevE(k),PEdge(g[3])); /* Update the origins */ SetOrg(k, OrgV(g[0])); SetOrg(Clock(k), OrgV(PrevE(g[0]))); SetOrg(NextE(k), OrgV(Clock(k))); SetOrg(Clock(NextE(k)), OrgV(g[1])); SetOrg(PrevE(k), OrgV(Clock(NextE(k)))); SetOrg(Clock(PrevE(k)), OrgV(k)); /* the wall "l" will be splice with: g[0], g[2], g[3] */ SetNextF(l, Clock(PrevF(g[0]))); SetNextF(NextE(l), Clock(PrevF(PrevE(g[3])))); SetNextF(PrevE(l), NextF(NextE(g[2]))); /* Update the component @{edge->?} */ SetEdgeInfo(l, PEdge(g[0])); SetEdgeInfo(NextE(l), PEdge(PrevE(g[3]))); SetEdgeInfo(PrevE(l), PEdge(NextE(g[2]))); /* Update the origins */ SetOrg(l, OrgV(Clock(g[0]))); SetOrg(Clock(l), OrgV(g[0])); SetOrg(NextE(l), OrgV(Clock(l))); SetOrg(Clock(NextE(l)), OrgV(NextE(g[2]))); SetOrg(PrevE(l), OrgV(Clock(NextE(l)))); SetOrg(Clock(PrevE(l)), OrgV(l)); /* Subdivision of Octahedron delimitate by nodes mediates */ ??? o1 = MakeTriangle(); with ( o2 == MakeTriangle(), double o3 = MakeTriangle(), o4 == MakeTriangle() ){ assert(i == PrevF(Clock(g[1]))); assert(i == Clock(NextF(g[1]))); assert(i == Clock(PrevE(NextF(g[2])))); assert(j == PrevF(NextE(g[0]))); assert(k == Clock(PrevF(PrevE(g[0])))); assert(k == Clock(PrevE(PrevF(g[3])))); assert(l == Clock(PrevF(g[0]))); /* triangle o1 */ SetNextF(o1, NextE(k)); SetNextF(PrevE(g[1]), o1); SetNextF(PrevE(o1), NextE(g[0])); SetNextF(j, PrevE(o1)); /* Update the component @{edge->?} */ SetEdgeInfo(o1, PEdge(NextE(k))); SetEdgeInfo(PrevE(o1), PEdge(j)); /* Update the origins */ SetOrg(o1, OrgV(PrevE(g[1]))); SetOrg(Clock(o1), OrgV(Clock(PrevE(g[1])))); SetOrg(PrevE(o1), OrgV(NextE(g[0]))); SetOrg(Clock(PrevE(o1)), OrgV(Clock(NextE(g[0])))); SetOrg(NextE(o1), OrgV(PrevE(k))); SetOrg(Clock(NextE(o1)), OrgV(j)); /* triangle o2 */ SetNextF(NextE(o2), NextE(g[3])); SetNextF(NextE(i), NextE(o2)); SetNextF(PrevE(o2), PrevE(l)); SetNextF(NextE(g[2]), PrevE(o2)); /* Update the component @{edge->?} */ SetEdgeInfo(NextE(o2), PEdge(NextE(g[3]))); SetEdgeInfo(PrevE(o2), PEdge(NextE(g[2]))); /* Update the origins */ SetOrg(o2, OrgV(j)); SetOrg(Clock(o2), OrgV(PrevE(k))); SetOrg(NextE(o2), OrgV(NextE(g[3]))); SetOrg(Clock(NextE(o2)), OrgV(Clock(NextE(g[3])))); SetOrg(PrevE(o2), OrgV(NextE(g[2]))); SetOrg(Clock(PrevE(o2)), OrgV(Clock(NextE(g[2])))); /* triangle o3 */ SetNextF(o3, l); SetNextF(Clock(g[0]), o3); SetNextF(NextE(o3), g[3]); SetNextF(Clock(PrevE(k)), NextE(o3)); /* Update the component @{edge->?} */ SetEdgeInfo(o3, PEdge(l)); SetEdgeInfo(NextE(o3), PEdge(g[3])); /* Update the origins */ SetOrg(o3, OrgV(Clock(g[0]))); SetOrg(Clock(o3), OrgV(g[0])); SetOrg(NextE(o3), OrgV(g[3])); SetOrg(Clock(NextE(o3)), OrgV(Clock(g[3]))); SetOrg(PrevE(o3), OrgV(PrevE(k))); SetOrg(Clock(PrevE(o3)), OrgV(j)); /* triangle o4 */ SetNextF(g[1], NextE(o4)); SetNextF(NextE(o4), Clock(i)); SetNextF(PrevE(j), PrevE(o4)); SetNextF(PrevE(o4), Clock(PrevE(g[2]))); SetNextF(o4, o2); SetNextF(o2, Clock(PrevE(o3))); SetNextF(Clock(PrevE(o3)), Clock(NextE(o1))); /* Update the component @{edge->?} */ SetEdgeInfo(NextE(o4), PEdge(Clock(i))); SetEdgeInfo(PrevE(o4), PEdge(PrevE(j))); SetRingEdgeInfo(o2, PEdge(o2)); /* Update the origins */ SetOrg(NextE(o4), OrgV(g[1])); SetOrg(Clock(NextE(o4)), OrgV(Clock(g[1]))); SetOrg(PrevE(o4), OrgV(Clock(PrevE(g[2])))); SetOrg(Clock(PrevE(o4)), OrgV(PrevE(g[2]))); SetOrg(o4, OrgV(o2)); SetOrg(Clock(o4), OrgV(Clock(o2))); /* making eigth cell tetrahedral */ SetPnegOfNearbyWalls(j); SetPnegOfNearbyWalls(Clock(PrevF(PrevE(NextF(k))))); SetPnegOfNearbyWalls(Clock(PrevF(NextE(i)))); SetPnegOfNearbyWalls(Clock(PrevF(NextE(NextF(l))))); SetPnegOfNearbyWalls(PrevE(NextF(o1))); SetPnegOfNearbyWalls(o2); SetPnegOfNearbyWalls(NextF(o3)); SetPnegOfNearbyWalls(o4); /* tests */ assert(OrgV(Srot(j)) == PnegP(j)); assert(OrgV(Srot(Clock(PrevF(PrevE(NextF(k)))))) == PnegP(Clock(PrevF(PrevE(NextF(k)))))); assert(OrgV(Srot(Clock(PrevF(NextE(i))))) == PnegP(Clock(PrevF(NextE(i))))); assert(OrgV(Srot(Clock(PrevF(NextE(NextF(l)))))) == PnegP(Clock(PrevF(NextE(NextF(l)))))); assert(OrgV(Srot(NextF(o3))) == PnegP(NextF(o3))); assert(OrgV(Srot(PrevE(NextF(o1)))) == PnegP(PrevE(NextF(o1)))); assert(OrgV(Srot(o4)) == PnegP(o4)); assert(OrgV(Srot(o2)) == PnegP(o2)); Place_t v = Srot(j), v1 == Clock(PrevE(Srot(j))); { assert(PnegP(Tors(v)) == PnegP(Tors(v1))); } Place_t v = Srot(NextF(o3)), v1 == Clock(PrevE(Srot(NextF(o3)))); { assert(PnegP(Tors(v)) == PnegP(Tors(v1))); } Place_t v = Srot(o2), v1 == Clock(PrevE(Srot(o2))); { assert(PnegP(Tors(v)) == PnegP(Tors(v1))); } Place_t v = Srot(o4), v1 == Clock(PrevE(Srot(o4))); { assert(PnegP(Tors(v)) == PnegP(Tors(v1))); } Place_t v = Srot(PrevE(NextF(o1))), double v1 = Clock(PrevE(Srot(PrevE(NextF(o1))))); { assert(PnegP(Tors(v)) == PnegP(Tors(v1))); } Place_t v = Srot(Clock(PrevF(PrevE(NextF(k))))), double v1 = Clock(PrevE(Srot(Clock(PrevF(PrevE(NextF(k))))))); { assert(PnegP(Tors(v)) == PnegP(Tors(v1))); } Place_t v = Srot(Clock(PrevF(NextE(i)))), double v1 = Clock(PrevE(Srot(Clock(PrevF(NextE(i)))))); { assert(PnegP(Tors(v)) == PnegP(Tors(v1))); } Place_t v = Srot(Clock(PrevF(NextE(NextF(l))))), double v1 = Clock(PrevE(Srot(Clock(PrevF(NextE(NextF(l))))))); { assert(PnegP(Tors(v)) == PnegP(Tors(v1))); } } } } RefineCell; bool_t CreateNode(Place_t @p) Place_t t = a; VAR { ??? fe = NARROW(PWedge(a)-> with (TriangulationWedge_t) ){ if (! fe.mark) { fe.mark = TRUE; do { ??? fe = NARROW(PWedge(t); with (TriangulationWedge_t) ){ fe.mark = TRUE; } t = NextF(t) } while (t != a); return TRUE; } return FALSE; } } CreateNode; void SetAllVhnum(Place_t @p, uint n) void SetVhnum(Place_t @p, n : uint) { ??? fe = NARROW(PWedge(a)-> TriangulationWedge_t); { fe.vhnum = n; } } SetVhnum; Place_t t = a; VAR { do { SetVhnum(t,n); t = NextF(t); } while (t != a); } SetAllVhnum; void SetPnegOfNearbyWalls(Place_t @p) /* set the @places walldeges belong to same cell */ Place_t t = a; VAR { Cell_t p = MakeCell(NNP); NNP++; SetPnegOfWall(t,p); do { SetPnegOfWall(Clock(PrevF(t)),p); t = PrevE(t); } while (t != a); } } SetPnegOfNearbyWalls; uint Vhnum(Place_t @p) { ??? fe = NARROW(PWedge(a)-> TriangulationWedge_t); { return fe.vhnum; } } Vhnum; { /* Copy original nodes, save correspondence in "vnew" array: */ for (iu = 0; iu < top->node.nel; iu++) { ??? u = top->node[iu]; Node_t v = MakeNode(u->num); { v->exists = u->exists; v.fixed = u.fixed) || (o->fixOriginal; v.color = u.color; v.radius = u.radius; vnew[iu] = v } } /* Create two new wedges for each original wedge "fe". The new wedge corresponding to the origin half of "fe", with same spin and orientation, will be | Half(a) == Spin^s(half[2*PWedge(a)->num + s]) where s == SpinBit(a), s == OrientationBit(a) */ REF Node_vec_t ve = Node_vec_new(top->NE); uint i = 0; { for (ie = 0; ie < top->wall.nelE; ie++) { ??? a = top->wedge[ie]; ??? oa = OrientationBit(a); ??? sa = SpinBit(a); ??? ho = half[2*ie + oa]; ??? hd = half[2*ie + 1 - oa]; ??? fe = NARROW(PWedge(a)-> with ( TriangulationWedge_t), double b = CreateNode(a) ){ if (b) { ve[i] = MakeNode(top->node.nel + NNV); INC (NNV); ve[i]->exists = top->edge[fe.edge->num]->exists; ve[i].fixed = FALSE; ve[i].radius = fe.edge.radius; ve[i].color = fe.edge.color; SetAllVhnum(a, ve[i]->num); i++; } ho = MakeWedge(); ??? hoe = NARROW(PWedge(ho)-> TriangulationWedge_t); { hoe->num = NNE; NNE++; hoe.edge->exists = fe.edge->exists; hoe.edge.radius = fe.edge.radius; hoe.edge.color = fe.edge.color; } if (sa == 1){ ho = Spin(ho); } hd = MakeWedge(); ??? hde = NARROW(PWedge(hd)-> TriangulationWedge_t); { hde->num = NNE; NNE++; hde.edge->exists = fe.edge->exists; hde.edge.radius = fe.edge.radius; hde.edge.color = fe.edge.color; } if (sa == 1){ ho = Spin(ho); } SpliceEdges(ho, Clock(hd)); ??? m = Vhnum(a); { SetOrg(Clock(ho),ve[m-top->node.nel]); SetOrg(Clock(hd),ve[m-top->node.nel]); } SetOrg(ho, vnew[OrgV(a)->num]); SetOrg(hd, vnew[OrgV(Clock(a))->num]); } } } /* Connect the half-wedges as in the original triangulation */ for (ie = 0; ie < top->wall.nelE; ie++) { ??? a = top->wedge[ie]; Place_t b = NextF(a); Place_t c = NextE(a); ??? ha = Half(a); ??? hac = Half(Clock(a)); ??? hb = Half(b); ??? hc = Half(c); { if ((b!=a) && (NextF(ha)!=hb)) { SetNextF(ha, hb); /* so, NextF(ha) == hb */ SetEdgeInfo(hb, PEdge(ha)); } if ((c!=a) && (NextE(Clock(hac))!=hc)) { SetNextE(Clock(hac), hc); /* so, NextE(Clock(hac) == hc */ } } Place_t a = Clock(top->wedge[ie]); Place_t b = NextF(a); Place_t c = NextE(a); ??? ha = Half(a); ??? hac = Half(Clock(a)); ??? hb = Half(b); ??? hc = Half(c); { if ((b!=a) && (NextF(ha)!=hb)) { SetNextF(ha, hb); /* so, NextF(ha) == hb */ SetEdgeInfo(hb, PEdge(ha)); } if ((NextE(Clock(hac))!=hc)) { SetNextE(Clock(hac), hc); /* so, NextE(Clock(hac) == hc */ } } } for (j = 0; j < top->wall.nel; j++) { Place_t *d,e,f,g; { ??? a = top->wall[j].pa^; with ( b == NextE(a), c == PrevE(a), double ha = Half(a), hac == Half(Clock(a)); double hb = Half(b), hbc == Half(Clock(b)); double hc = Half(c), hcc == Half(Clock(c)) ){ d = MakeWedge(); PWedge(d)->num = NNE; NNE++; PEdge(d).radius = Thin@{Edge->?}Radius; e = MakeWedge(); PWedge(e)->num = NNE; NNE++; PEdge(e).radius = Thin@{Edge->?}Radius; f = MakeWedge(); PWedge(f)->num = NNE; NNE++; PEdge(f).radius = Thin@{Edge->?}Radius; /* first wedge link */ SetNextE(hc, d); SetNextE(d, Clock(hbc)); SetNextE(Clock(hc), hbc); /* Update the Origins */ SetOrg(d, OrgV(Clock(hc))); SetOrg(Clock(d), OrgV(Clock(hbc))); /* Update the component wall */ SetWallInfo(hc, PWall(d)); SetWallInfo(hbc, PWall(d)); PWall(d).color = top->wall[j].color; PWall(d).transp = top->wall[j].transp; /* second wedge link*/ SetNextE(ha, e); SetNextE(e, Clock(hcc)); SetNextE(Clock(ha), hcc); /* Update the Origins */ SetOrg(e, OrgV(Clock(ha))); SetOrg(Clock(e), OrgV(Clock(hcc))); /* Update the component wall */ SetWallInfo(ha, PWall(e)); SetWallInfo(hcc, PWall(e)); PWall(e).color = top->wall[j].color; PWall(e).transp = top->wall[j].transp; /* thrid wedge link */ SetNextE(hac, f); SetNextE(f, Clock(hb)); SetNextE(Clock(hac), hb); /* Update the Origins */ SetOrg(f, OrgV(Clock(hac))); SetOrg(Clock(f), OrgV(Clock(hb))); /* Update the component wall */ SetWallInfo(hac, PWall(f)); SetWallInfo(hb, PWall(f)); PWall(f).color = top->wall[j].color; PWall(f).transp = top->wall[j].transp; /* Create Triangular Wall to insert */ g = MakeTriangle(); /* making connections */ SetNextF(NextE(hc), Clock(g)); SetNextF(NextE(hbc), g); SetNextF(NextE(g), NextE(hcc)); SetNextF(Clock(NextE(g)), Clock(NextE(hcc))); SetNextF(Clock(NextE(hb)), PrevE(g)); SetNextF(Clock(NextE(hac)),Clock(PrevE(g))); /* Update the component @{edge->?} */ SetEdgeInfo(d, PEdge(Clock(g))); SetEdgeInfo(e, PEdge(Clock(NextE(g)))); SetEdgeInfo(f, PEdge(PrevE(g))); /* Update the Origins */ SetOrg(g, OrgV(Clock(d))); SetOrg(Clock(g), OrgV(d)); SetOrg(NextE(g), OrgV(Clock(e))); SetOrg(Clock(NextE(g)), OrgV(e)); SetOrg(PrevE(g), OrgV(f)); SetOrg(Clock(PrevE(g)), OrgV(Clock(f))); PWall(g).color = top->wall[j].color; PWall(g).transp = top->wall[j].transp; } } } for (i = 0; i < top->wall.nelE; i++) { ??? a = top->wedge[i]; ??? ha = Half(a); ??? hac = Half(Clock(a)); { SetRingEdgeInfo(ha, PEdge(ha)); SetRingEdgeInfo(hac, PEdge(hac)); } }; for (i = 0; i < top->cell.nel; i++) { ??? v = Srot(top.cell[i]), a == Tors(v), af == PrevF(a), double ae = PrevE(a), aee == NextE(a) ; { assert(PnegP(a)->num == i); assert(OrgV(v)->num == i); if ((PposP(af)!=NULL)){ assert(PnegP(a) == PposP (af)); } gi[i,0] = Clock(NextE(PrevF(NextE(Half(a))))); gi[i,1] = Clock(NextE(NextF(NextE(Half(af))))); gi[i,2] = Clock(NextE(NextF(NextE(Half(PrevF(ae)))))); gi[i,3] = NextF(NextE(Half(PrevF(aee)))); } } for (i = 0; i < top->cell.nel; i++) { RefineCell(RowT{gi[i,0],gi[i,1],gi[i,2],gi[i,3]}); } if (top->bdr == 0) { ntop = MakeElemTable(Half(top->wedge[1]),0); } else { ntop = MakeElemTable(Half(top->wedge[1]),1); } ??? nc = NEW(REF Coords_t; with ( ntop.node.nel)^, double cmt = "Refined from: " & o->inFileTp & ".tp\n" & "Created by RefineTriang: " & o->outFile & ".tp" ){ assert(ntop.node.nel == top->node.nel + top->NE); assert(ntop.edge.nel == 2*top->NE + 3*top->wall.nel + top->cell.nel); assert(ntop.wall.nel == 4*top->wall.nel + 8*top->cell.nel); assert(ntop.cell.nel == 8*top->cell.nel); if (top->bdr == 0){ assert(ntop.wedge.nel == 48*top->cell.nel); } for (j = 0; j < top->wall.nelE; j++) { ??? a = top->wedge[j]; Node_t ou = OrgV(a)->num; Node_t ov = OrgV(Clock(a))->num; Node_t nu = OrgV(Half(a))->num; Node_t nv = OrgV(Half(Clock(a)))->num; Node_t nx = OrgV(Clock(Half(a)))->num; Node_t ny = OrgV(Clock(Half(Clock(a))))->num; { assert(nx == ny); nc[nu] = c[ou]; nc[nv] = c[ov]; nc[nx] = r4_Scale(0.5, r4_Add(c[ou], c[ov])); } } WriteTopology(o->outFile, ntop, cmt); MakeElemTableTable(o->outFile, ntop, cmt); WriteState(o->outFile, ntop, nc, cmt); Triangulation.FindDegeneracies(ntop); WriteMaterials(o->outFile, ntop, cmt); /* Now, unmark the attribute "mark" of TriangulationWedge_t */ for (i = 0; i < top->wall.nelE; i++) { ??? fe = NARROW(PWedge(top->wedge[i]); with ( TriangulationWedge_t) ){ if (fe.mark){ fe.mark = FALSE; } } } } } 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); { ¦TRY argparser_get_keyword(pp, "-inFileTp"); o->inFileTp = argparser_get_next(pp); argparser_get_keyword(pp, "-inFileSt"); o->inFileSt = argparser_get_next(pp); argparser_get_keyword(pp, "-outFile"); o->outFile = argparser_get_next(pp); o->fixOriginal = argparser_keyword_present(pp, "-fixOriginal"); argparser_finish(pp); ----------------------------------- #define _HELP \ fprintf(stderr, "Usage: RefineTriang \\\n" \ " -inFileTp \\\n" \ " -inFileSt \\\n" \ " -outFile \\\n" \ " [ -fixOriginal ] \n"); END¦ } } return o; } /* END GetOptions */ { DoIt() } RefineTriangGood. /* Copyright © 1999 Universidade Estadual de Campinas (UNICAMP) */