#define PROG_NAME "TesteElasticity" #define PROG_DESC "???" #define PROG_VERS "1.0" /* Last edited on 2024-12-21 11:43:19 by stolfi */ #define TesteElasticity_C_COPYRIGHT \ "" #define PROG_INFO \ "" \ " " #include #include #include #include #include #include #include #include CONST double A = LR3x3.T { (r3_t){0.0, 1.0, 1.0}, (r3_t){1.0, 0.0, 1.0}, (r3_t){1.0, 1.0, 0.0} } double B = LR4x4.T { (r4_t){0.0, 0.0, 0.0, 1.0}, (r4_t){0.0, 1.0, 1.0, 1.0}, (r4_t){1.0, 1.0, 0.0, 1.0}, (r4_t){1.0, 0.0, 1.0, 1.0} } TYPE double LR4x3 = ARRAY [0..3] OF r3_t; double LR3x4 = ARRAY [0..2] OF r4_t; LR4x3 Transpose_3x4(*m: LR3x4) /* Return the transpose of a matrix 3x4. */ t : LR4x3; { t[0] = (r3_t){m[0,0], m[1,0], m[2,0]}; t[1] = (r3_t){m[0,1], m[1,1], m[2,1]}; t[2] = (r3_t){m[0,2], m[1,2], m[2,2]}; t[3] = (r3_t){m[0,3], m[1,3], m[2,3]}; return t; } /* END Transpose_3x4 */ LR3x4 Transpose_4x3(*m: LR4x3) /* return the transpose of a matrix 3x3. */ t : LR3x4; { t[0] = (r4_t){m[0,0], m[1,0], m[2,0], m[3,0]}; t[1] = (r4_t){m[0,1], m[1,1], m[2,1], m[3,1]}; t[2] = (r4_t){m[0,2], m[1,2], m[2,2], m[3,2]}; return t; } /* END Transpose_4x3 */ LR4x3 Mul_4x3_3x3(*a: LR4x3; *b: LR3x3.T) /* Return the product of the matrix "a" 4x3 and matrix "b" 3x3. */ c : LR4x3; { ??? a00 = a[0; with (0], a01 == a[0,1], a02 == a[0,2], double a10 = a[1,0], a11 == a[1,1], a12 == a[1,2]; double a20 = a[2,0], a21 == a[2,1], a22 == a[2,2]; double a30 = a[3,0], a31 == a[3,1], a32 == a[3,2]; double b00 = b[0,0], b01 == b[0,1], b02 == b[0,2]; double b10 = b[1,0], b11 == b[1,1], b12 == b[1,2]; double b20 = b[2,0], b21 == b[2,1], b22 == b[2,2]; double c00 = a00 * b00 + a01 * b10 + a02 * b20; double c01 = a00 * b01 + a01 * b11 + a02 * b21; double c02 = a00 * b02 + a01 * b12 + a02 * b22; double c10 = a10 * b00 + a11 * b10 + a12 * b20; double c11 = a10 * b01 + a11 * b11 + a12 * b21; double c12 = a10 * b02 + a11 * b12 + a12 * b22; double c20 = a20 * b00 + a21 * b10 + a22 * b20; double c21 = a20 * b01 + a21 * b11 + a22 * b21; double c22 = a20 * b02 + a21 * b12 + a22 * b22; double c30 = a30 * b00 + a31 * b10 + a32 * b20; double c31 = a30 * b01 + a31 * b11 + a32 * b21; double c32 = a30 * b02 + a31 * b12 + a32 * b22; double c0 = (r3_t){c00,c01,c02}; double c1 = (r3_t){c10,c11,c12}; double c2 = (r3_t){c20,c21,c22}; double c3 = (r3_t){c30,c31,c32} ){ c[0] = c0; c[1] = c1; c[2] = c2; c[3] = c3; return c; } } /* END Mul_4x3_3x3 */ LR3x3.T Mul_3x4_4x3(*a: LR3x4; *b: LR4x3) /* Return the product of the matrix "a" 3x4 and matrix "b" 4x3. */ { ??? a00 = a[0; with (0], a01 == a[0,1], a02 == a[0,2], a03 == a[0,3], double a10 = a[1,0], a11 == a[1,1], a12 == a[1,2], a13 == a[1,3]; double a20 = a[2,0], a21 == a[2,1], a22 == a[2,2], a23 == a[2,3]; double b00 = b[0,0], b01 == b[0,1], b02 == b[0,2]; double b10 = b[1,0], b11 == b[1,1], b12 == b[1,2]; double b20 = b[2,0], b21 == b[2,1], b22 == b[2,2]; double b30 = b[3,0], b31 == b[3,1], b32 == b[3,2]; double c00 = a00 * b00 + a01 * b10 + a02 * b20 + a03 * b30; double c01 = a00 * b01 + a01 * b11 + a02 * b21 + a03 * b31; double c02 = a00 * b02 + a01 * b12 + a02 * b22 + a03 * b32; double c10 = a10 * b00 + a11 * b10 + a12 * b20 + a13 * b30; double c11 = a10 * b01 + a11 * b11 + a12 * b21 + a13 * b31; double c12 = a10 * b02 + a11 * b12 + a12 * b22 + a13 * b32; double c20 = a20 * b00 + a21 * b10 + a22 * b20 + a23 * b30; double c21 = a20 * b01 + a21 * b11 + a22 * b21 + a23 * b31; double c22 = a20 * b02 + a21 * b12 + a22 * b22 + a23 * b32; double c0 = (r3_t){c00,c01,c02}; double c1 = (r3_t){c10,c11,c12}; double c2 = (r3_t){c20,c21,c22} ){ return LR3x3.T{c0,c1,c2}; } } /* END Mul_3x4_4x3 */ PROCEDURE PrintMatrix_3x3(*a: LR3x3.T) { for (i = 0; i < 3; i++){ for (j = 0; j < 3; j++) { Mis.WriteLong(stderr, a[i,j]); fprintf(stderr, " "); } fprintf(stderr, "\n"); } } /* END PrintMatrix_3x3 */ PROCEDURE PrintMatrix_3x4(*a: LR3x4) { for (i = 0; i < 3; i++){ for (j = 0; j < 4; j++) { Mis.WriteLong(stderr, a[i,j]); fprintf(stderr, " "); } fprintf(stderr, "\n"); } } /* END PrintMatrix_3x4 */ PROCEDURE PrintMatrix_4x3(*a: LR4x3) { for (i = 0; i < 4; i++){ for (j = 0; j < 3; j++) { Mis.WriteLong(stderr, a[i,j]); fprintf(stderr, " "); } fprintf(stderr, "\n"); } } /* END PrintMatrix_4x3 */ Options_t *GetOptions(int argc, char **argv); int main(int argc, char **argv) B : LR4x3; { with ( double b0 = (r3_t){10.0, 10.0, 10.0}; double b1 = (r3_t){10.0, 10.0, 10.0}; double b2 = (r3_t){10.0, 10.0, 10.0}; double b3 = (r3_t){10.0, 10.0, 10.0} ){ B[0] = b0; B[1] = b1; B[2] = b2; B[3] = b3; fprintf(stderr, "\nMatrix A\n"); PrintMatrix_3x3(A); fprintf(stderr, "\nMatrix B\n"); PrintMatrix_4x3(B); fprintf(stderr, "\nMatrix A_1\n"); PrintMatrix_3x3(LR3x3.Inv(A)); fprintf(stderr, "\nMatrix A* A_1\n"); PrintMatrix_3x3(LR3x3.Mul(A,LR3x3.Inv(A))); /* fprintf(stderr, "\nMatrix B'\n"); PrintMatrix_3x4(Transpose_4x3(B)); fprintf(stderr, "\nMatrix B''\n"); PrintMatrix_4x3(Transpose_3x4(Transpose_4x3(B))); fprintf(stderr, "\nMatrix BxA\n"); PrintMatrix_4x3(Mul_4x3_3x3(B,A)); fprintf(stderr, "\nMatrix B'xB\n"); PrintMatrix_3x3(Mul_3x4_4x3(Transpose_4x3(B),B)); */ fprintf(stderr, "\nMatrix BxA_1\n"); PrintMatrix_4x3(Mul_4x3_3x3(B,LR3x3.Inv(A))); return 0; } { DoIt(); fprintf(stderr, "volume :" & Fmt.LongReal(1.0/6.0*LR3x3.Det(A)) \ "\n"); } TesteElasticity. /* Copyright © 1999 Universidade Estadual de Campinas (UNICAMP) */ /* Testes Matrix A 1.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 1.00 Matrix B 1.00 0.00 0.00 0.00 2.00 0.00 0.00 0.00 3.00 1.00 1.00 1.00 Matrix B' 1.00 0.00 0.00 1.00 0.00 2.00 0.00 1.00 0.00 0.00 3.00 1.00 Matrix B'' 1.00 0.00 0.00 0.00 2.00 0.00 0.00 0.00 3.00 1.00 1.00 1.00 Matrix BxA 1.00 0.00 0.00 0.00 2.00 0.00 0.00 0.00 3.00 1.00 1.00 1.00 Matrix B'xB 2.00 1.00 1.00 1.00 5.00 1.00 1.00 1.00 10.00 */~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cur/progs-more/TesteOpGeo.c /* Programa para testar os procedientos Geometricos no R4 */ #define TesteOpGeo_C_author \ "Created by L. P. Lozada, 1999-2000." TYPE double RowT = ARRAY [1..4] OF double; double Wedge_t = TriangulationWedge_t; double Place_t = TriangulationPlace_t; TYPE typedef struct Options_t { char *inFile; /* Initial guess file name (minus ".tp") */ } /* UNUSED */ PROCEDURE PrtNextF(Place_t @p) { fprintf(stdout, "a: "); Octf.PrintPlace(stdout, a, 1); fprintf(stdout, " NextF(a): "); Octf.PrintPlace(stdout, NextF(a), 1); fprintf(stdout, "\n"); } /* END PrtNextF */ /* UNUSED */ PROCEDURE Poly(Place_t @p) @{Node->?} *p; { Octf.PrintPlace(stdout, a, 5); fprintf(stdout, " "); p = PnegP(a); fprintf(Stdio.stdout, "PnegP->num: " & Fmt.Pad(Fmt.Int(p->num),2) & "\n"); } /* END Poly */ Options_t *GetOptions(int argc, char **argv); int main(int argc, char **argv) bool_t *iso; b,nb,vn,n : r4_t; mvd, mel, n1, n2 : double; uint d; v : REF r4_vec_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.Read(o->inFile); ??? top = tc.top; ??? cmt = tc.cmt; ??? c = tc.c^; { /* for (j = 0; j < 6; j++) { ??? a = top->wall[j].pa^; ??? p1 = PnegP(a)->num; ??? p2 = PposP(a)->num; ??? t = Srot(top->cell[p1]); Place_t a = Tors(t); Place_t t1 = Clock(PrevE(t)); Place_t a1 = Tors(t1); Node_t un = OrgV(a)->num; Node_t vn = OrgV(NextE(a))->num; Node_t wn = OrgV(PrevE(a))->num; Node_t xn = OrgV(PrevE(a1))->num; ??? tt = Srot(top->cell[p2]); Place_t aa = Tors(tt); Place_t tt1 = Clock(PrevE(tt)); Place_t aa1 = Tors(tt1); ??? u1n = OrgV(aa)->num; ??? v1n = OrgV(NextE(aa))->num; ??? w1n = OrgV(PrevE(aa))->num; ??? x1n = OrgV(PrevE(aa1))->num; { fprintf(stdout, Fmt.Pad(Fmt.Int(un), 5) & " "); fprintf(stdout, Fmt.Pad(Fmt.Int(vn), 5) & " "); fprintf(stdout, Fmt.Pad(Fmt.Int(wn), 5) & " "); fprintf(stdout, Fmt.Pad(Fmt.Int(xn), 5) & "\n"); fprintf(stdout, Fmt.Pad(Fmt.Int(u1n), 5) & " "); fprintf(stdout, Fmt.Pad(Fmt.Int(v1n), 5) & " "); fprintf(stdout, Fmt.Pad(Fmt.Int(w1n), 5) & " "); fprintf(stdout, Fmt.Pad(Fmt.Int(x1n), 5) & "\n"); fprintf(stdout, "\n"); } } fprintf(stdout, "\n"); for (i = 0; i < top->node.nel; i++) { ??? poly1 = Triangulation.StarOfNode(top->node[i],top); { for(i = 0; i < poly1.nel; i++) { fprintf(Stdio.stdout, Fmt.Int(poly1[i][0]->num) & " "); fprintf(Stdio.stdout, Fmt.Int(poly1[i][1]->num) & " "); fprintf(Stdio.stdout, Fmt.Int(poly1[i][2]->num) & " "); fprintf(Stdio.stdout, Fmt.Int(poly1[i][3]->num) & "\n"); } } fprintf(stdout, "\n"); } for (i = 0; i < top->node.nel; i++) { ??? a = top->node[i]; { fprintf(Stdio.stdout, " OrgV->num: " & Fmt.Int(OrgV(a)->num) & " "); d = Triangulation.DegreeOfNode(a); fprintf(stdout, " Degree : " & Fmt.Int(d) & "\n"); d = Triangulation->numberPolyOfStar(a,top); fprintf(stdout, " Number of Poly on the star: " & Fmt.Int(d) \ "\n"); Mis.WriteComments(stdout, "\nThe Vetor Normal is: "); vn = Triangulation.NodeNormal(a, c, top); Mis.WritePoint(vn); n2 = r4_Norm(vn); fprintf(Stdio.stdout, ", Their norm is : "); fprintf(Stdio.stdout, Fmt.LongReal(n2, Fmt.Style.Fix, prec = 3) & "\n"); nb = Triangulation.NeighborBarycenter(a,c); Mis.WriteComments(stdout, "\nThe Neighbor Baricenter is: "); Mis.WritePoint(nb); fprintf(stdout, "\n"); } } fprintf(stdout, "\n"); Mis.WriteComments(stdout, "\nThe All Node Normal are: "); v = Triangulation.ComputeAllNodeNormals(top,c); for (i = 0; i < top->node.nel; i++) { Mis.WritePoint(v[i]); n2 = r4_Norm(v[i]); fprintf(Stdio.stdout, ", Their norm is : "); fprintf(Stdio.stdout, Fmt.LongReal(n2, Fmt.Style.Fix, prec = 3) & "\n"); } fprintf(stdout, "\n"); Mis.WriteComments(stdout, "\nThe All @{Edge->?} Normal are: "); v = Triangulation.ComputeAllEdgeNormals(top,c); for (i = 0; i < top->NE; i++) { Mis.WritePoint(v[i]); n2 = r4_Norm(v[i]); fprintf(Stdio.stdout, ", Their norm is : "); fprintf(Stdio.stdout, Fmt.LongReal(n2, Fmt.Style.Fix, prec = 3) & "\n"); } fprintf(stdout, "\n"); Mis.WriteComments(stdout, "\nThe All Wall Normal are: "); v = Triangulation.ComputeAllWallNormals(top,c); for (i = 0; i < top->wall.nel; i++) { Mis.WritePoint(v[i]); n2 = r4_Norm(v[i]); fprintf(Stdio.stdout, ", Their norm is : "); fprintf(Stdio.stdout, Fmt.LongReal(n2, Fmt.Style.Fix, prec = 3) & "\n"); } Mis.WriteComments(stdout, "\nThe All Cell Normal are: "); v = Triangulation.ComputeAllCellNormals(top,c); for (i = 0; i < top->cell.nel; i++) { Mis.WritePoint(v[i]); n2 = r4_Norm(v[i]); fprintf(Stdio.stdout, ", Their norm is : "); fprintf(Stdio.stdout, Fmt.LongReal(n2, Fmt.Style.Fix, prec = 3) & "\n"); } for (i = 0; i <= (0); i++) { Octf.EnumWedges(top->wedge[0], PrtNextF, FALSE); } Mis.WriteComments(stdout, "\nTests of of geometric tools procedures " \ "and the procedure Read\n" & "\n"); b = Triangulation.Barycenter(top,c); Mis.WriteComments(stdout, "\n" & "The Baricenter is: \n"); fprintf(stdout, "ola\n"); */ Mis.WriteComments(stdout, "\nThe node coordenates\n" & "\n"); for (i = 0; i < top->node.nel; i++) { Node_t v = OrgV(top->node.el[i]); { Mis.WritePoint(Stdio.stdout, c[v->num]); fprintf(Stdio.stdout, "\n"); } } b = Triangulation.Barycenter(top,c); Mis.WriteComments(stdout, "\n" & "The Baricenter is: \n"); mvd = Triangulation.MeanNodeDistance(top,c); Mis.WriteComments(stdout, "\nThe Average distance of nodes is: " \ Fmt.LongReal(mvd, Fmt.Style.Fix, prec = 4) & "\n"); /* mel = Triangulation.MeanEdgeLength(top,c); Mis.WriteComments(stdout, "\nThe Average length of @{edge->?}s is: " \ Fmt.LongReal(mel, Fmt.Style.Fix, prec = 4) & "\n"); Triangulation.Displace(top,RowT{5.0,5.0,5.0,5.0},c); Mis.WriteComments(stdout, "\nThe node coordenates displace" \ " 5.0,5.0,5.0,5.0\n"); for (i = 0; i < top->node.nel; i++) { Node_t v = OrgV(top->node.el[i]); { Mis.WritePoint(Stdio.stdout, c[v->num]); fprintf(Stdio.stdout, "\n"); } } mvd = Triangulation.MeanNodeDistance(top,c); Mis.WriteComments(stdout, "\nThe Average distance of nodes is: " \ Fmt.LongReal(mvd, Fmt.Style.Fix, prec = 4) & "\n"); */ Triangulation.NormalizeNodeDistance(top,c); /* Mis.WriteComments(stdout, "\nThe Normalize Node Distance\n"); for (i = 0; i < top->node.nel; i++) { Node_t v = OrgV(top->node.el[i]); { Mis.WritePoint(Stdio.stdout,c[v->num]); fprintf(Stdio.stdout, "\n"); } } mvd = Triangulation.MeanNodeDistance(top,c); Mis.WriteComments(stdout, "\nThe Average distance of nodes is: " \ Fmt.LongReal(mvd, Fmt.Style.Fix, prec = 4) & "\n"); Triangulation.Scale(top,10.0,c); Mis.WriteComments(stdout, "\nThe node coordenates scale 10.0\n" \ "\n"); for (i = 0; i < top->node.nel; i++) { Node_t v = OrgV(top->node.el[i]); { Mis.WritePoint(Stdio.stdout,c[v->num]); fprintf(Stdio.stdout, "\n"); } } Triangulation.NormalizeNodeDistance(top,c); Mis.WriteComments(stdout, "\nThe Normalize Node Distance\n"); for (i = 0; i < top->node.nel; i++) { Node_t v = OrgV(top->node.el[i]); { Mis.WritePoint(Stdio.stdout,c[v->num]); fprintf(Stdio.stdout, "\n"); } } */ mvd = Triangulation.MeanNodeDistance(top,c); Mis.WriteComments(stdout, "\nThe Average distance of nodes is: " \ Fmt.LongReal(mvd, Fmt.Style.Fix, prec = 4) & "\n"); b = Triangulation.Barycenter(top,c); Mis.WriteComments(stdout, "\n" & "The Baricenter is: \n"); /* Triangulation.NormalizeNodeDistance(top,c); mvd = Triangulation.MeanNodeDistance(top,c); Mis.WriteComments(stdout, "\nThe Average distance of nodes normalized is: " \ Fmt.LongReal(mvd, Fmt.Style.Fix, prec = 4) & "\n"); Triangulation.NormalizeEdgeLengths(top,c); mel = Triangulation.MeanEdgeLength(top,c); Mis.WriteComments(stdout, "\nThe Average length of @{edge->?}s normalized is: " & Fmt.LongReal(mel, Fmt.Style.Fix, prec = 4) & "\n"); for (i = 0; i < top->NE; i++) { ??? a = top->edge[i].pa^; { PEdge(a)->exists = TRUE; d = Octf.DegreeRingWalls(a); fprintf(Stdio.stdout, " Degree Ring Wall is: "); fprintf(Stdio.stdout, Fmt.Int(d) & "\n"); n = Triangulation.EdgeNormal(a,c); Mis.WriteComments(stdout, "\nthe edge Normal is: "); Mis.WritePoint(n); n1 = r4_Norm(n); fprintf(Stdio.stdout, ", Their Norma is: "); fprintf(Stdio.stdout, Fmt.LongReal(n1, Fmt.Style.Fix, prec = 3) & "\n"); } } Mis.WriteComments(stdout, "\nThe Vetor Cross is: "); vn = Triangulation.NodeCross(a, c); Mis.WritePoint(vn); n1 = r4_Norm(vn); fprintf(Stdio.stdout, ", Their Norma is: "); fprintf(Stdio.stdout, Fmt.LongReal(n1, Fmt.Style.Fix, prec = 3) & "\n"); Mis.WriteComments(stdout, "\nThe Vetor Normal is: "); vn = Triangulation.NodeNormal(a, c); Mis.WritePoint(vn); n2 = r4_Norm(vn); fprintf(Stdio.stdout, ", Their norm is : "); fprintf(Stdio.stdout, Fmt.LongReal(n2, Fmt.Style.Fix, prec = 3) & "\n"); Mis.WriteComments(stdout, "\nThe All Node Normal are: "); v = Triangulation.ComputeAllNodeNormals(top,c); for (i = 0; i < top->node.nel; i++) { ??? a = top->node[i]; { d = Triangulation.DegreeOfNode(a); Mis.WriteComments(stdout, "\n" \ "The Degree of Origin the @place Spin(ac1) is: " & Fmt.Int(d) & "\n"); } }; for (i = 0; i < top->node.nel; i++) { Mis.WritePoint(v[i]); n2 = r4_Norm(vn); fprintf(Stdio.stdout, ", Their norm is : "); fprintf(Stdio.stdout, Fmt.LongReal(n2, Fmt.Style.Fix, prec = 3) & "\n"); }; } } Mis.WriteComments(stdout, "\nThe All Wall Normal are: "); for (i = 0; i < top->wall.nel; i++) { ??? a = top->wall[i].pa^; { vn = Triangulation.WallNormal(a,c); Mis.WritePoint(vn); n2 = r4_Norm(vn); fprintf(Stdio.stdout, ", Their norm is : "); fprintf(Stdio.stdout, Fmt.LongReal(n2, Fmt.Style.Fix, prec = 3) & "\n"); } }; } iso = Triangulation.TriviallyIsomorphic(top, top); if (! iso) { Mis.WriteComments(stdout, "Complexes are not isomorphic\n"); } else { Mis.WriteComments(stdout, "Complexes are isomorphic\n"); } Mis.WriteComments(stdout, "\nThe out register\n" & "\n"); for (i = 0; i < top->node.nel; i++) { ??? v = top->node[i]; { fprintf(stdout, " top->node[" & Fmt.Int(i) & "]:"); Octf.PrintPlace(stdout, v,4); fprintf(Stdio.stdout, "\n"); }; } Mis.WriteComments(stdout, "\nThe region register\n" & "\n"); for (i = 0; i < top->cell.nel; i++) { ??? p = Srot(top.cell[i]); { fprintf(stdout," Srot(top->cell[" & Fmt.Pad(Fmt.Int(i),2) & "]):"); Octf.PrintPlace(stdout, p,4); fprintf(Stdio.stdout, "\n"); }; } Mis.WriteComments(stdout, "\nTests of Procedure Read\n"); Mis.WriteComments(stdout, cmt); fprintf(stdout, "Read.NV: " & Fmt.Int(top->node.nel) & "\n"); fprintf(stdout, "Read.NE: " & Fmt.Int(top->NE) & "\n"); fprintf(stdout, "Read.NF: " & Fmt.Int(top->wall.nel) & "\n"); fprintf(stdout, "Read.NP: " & Fmt.Int(top->cell.nel) & "\n"); fprintf(stdout, "Read.NFE: " & Fmt.Int(top->wall.nelE) & "\n"); fprintf(stdout, o->inFile & "\n"); Mis.WriteComments(stdout, "\nNode data by Read\n" & "\n"); for (i = 0; i < top->node.nel; i++) { Node_t v = OrgV(top->node.el[i]); { /* fprintf(stdout, Fmt.Pad(Fmt.Int(v->num),2) & " "); if (v->exists) { fprintf(stdout, "T" & " "); } else { fprintf(stdout, "F" & " "); } if (v.fixed) { fprintf(stdout, "T" & " "); } else { fprintf(stdout, "F" & " "); } Mis.WritePoint(c[v->num]); Mis.WriteColor(v.color); fprintf(stdout, " " & Fmt.Real(v.radius) & "\n"); fprintf(stdout, "\n"); }; } Mis.WriteComments(stdout, "\n@{Edge->?} data by Read\n" & "\n"); for (i = 0; i < top->NE; i++) { ??? e = top->edge[i]; { fprintf(stdout, Fmt.Pad(Fmt.Int(e->num),2) & " "); Octf.PrintPlace(stdout, e.pa^, 4); if (e->exists) { fprintf(stdout, " T" & " "); } else { fprintf(stdout, " F" & " "); } if (e.spring) { fprintf(stdout, " T" & " "); } else { fprintf(stdout, " F" & " "); } Mis.WriteColor(e.color); fprintf(stdout, " " & Fmt.Real(e.radius) & "\n"); }; } Mis.WriteComments(stdout, "\nWall data by Read\n" & "\n"); for (i = 0; i < top->wall.nel; i++) { ??? f = top->wall[i]; { fprintf(stdout, Fmt.Pad(Fmt.Int(f->num),2) & " "); if (f->exists) { fprintf(stdout, " T" & " "); } else { fprintf(stdout, " F" & " "); } Mis.WriteColor(f.color); fprintf(stdout, " "); Mis.WriteColor(f.transp); fprintf(stdout, "\n"); }; } Mis.WriteComments(stdout, "\nCell data by Read\n" & "\n"); for (i = 0; i < top->cell.nel; i++) { ??? p = top->cell[i]; { fprintf(stdout, Fmt.Pad(Fmt.Int(p->num),2) & " "); if (p->exists) { fprintf(stdout, " T" & " "); } else { fprintf(stdout, " F" & " "); } Mis.WriteColor(p.color); fprintf(stdout, " "); Mis.WriteColor(p.transp); fprintf(stdout, "\n"); }; } Mis.WriteComments(stdout, "\nwedge data by Read\n" & "\n"); for (i = 0; i < top->wall.nelE; i++) { ??? fe = NARROW(PWedge(top->wedge[i]), Wedge_t); { fprintf(stdout, Fmt.Pad(Fmt.Int(fe->num),4) & " "); Octf.PrintWedge(stdout,fe,5); fprintf(stdout, " "); VAR sPlace_t @p = top->wedge[i]; { for (j = 0; j < 4; j++) { ??? n = OrgV(sa); { TYPECASE n OF break; case NULL: assert(FALSE); | Node(v) ==> fprintf(stdout, Fmt.Pad(Fmt.Int(v->num), 2) & "v "); | Cell(p) ==> fprintf(stdout, Fmt.Pad(Fmt.Int(p->num), 2) & "p "); } else { assert(FALSE); } } sa = Srot(sa); } } if (fe->exists) { fprintf(stdout, " T" & " "); } else { fprintf(stdout, " F" & " "); } fprintf(stdout, "\n"); } } Mis.WriteComments(stdout, "\nAnother informations\n" & "\n"); for (i = 0; i < top->wall.nelE; i++) { VAR sPlace_t @p = top->wedge[i]; { for (j = 0; j < 4; j++) { ??? n = OrgV(sa); { TYPECASE n OF break; case NULL: assert(FALSE); | Node(v) ==> fprintf(stdout, " top->node[" \ Fmt.Int(v->num) & "]:"); Octf.PrintPlace(stdout, top->node[v->num], 4); | Cell(p) ==> fprintf(stdout," Srot(top->cell[" \ Fmt.Pad(Fmt.Int(p->num),2) & "]):"); Octf.PrintPlace(stdout, Srot(top->cell[p->num]), 4); } else { assert(FALSE); } } sa = Srot(sa); } fprintf(stdout, "\n"); }; } for (i = 0; i < top->cell.nel; i++) { fprintf(Stdio.stdout, "Cell: " & Fmt.Pad(Fmt.Int(i),2) & "===>"); ??? v = Srot(top.cell[i]), a == Tors(v); { Place_t ae = NextE(a); Place_t aee = NextE(ae); Place_t aff = PrevF(a); Node_t k = OrgV(a)->num; Node_t l = OrgV(ae)->num; Node_t m = OrgV(aee)->num; Node_t n = OrgV(PrevE(aff))->num; { assert(PnegP(a)->num == i); assert(PnegP(Clock(aff)) == PnegP(a)); fprintf(stdout, Fmt.Pad(Fmt.Int(k), 5) & " "); fprintf(stdout, Fmt.Pad(Fmt.Int(l), 5) & " "); fprintf(stdout, Fmt.Pad(Fmt.Int(m), 5) & " "); fprintf(stdout, Fmt.Pad(Fmt.Int(n), 5) & "\n"); } }; } for (i = 0; i < top->cell.nel; i++) { ??? p = top->cell[i]; ??? p1 = p.node[0]->num; ??? p2 = p.node[1]->num; ??? p3 = p.node[2]->num; ??? p4 = p.node[3]->num; { fprintf(stdout, Fmt.Pad(Fmt.Int(p1), 2) & " "); fprintf(stdout, Fmt.Pad(Fmt.Int(p2), 2) & " "); fprintf(stdout, Fmt.Pad(Fmt.Int(p3), 2) & " "); fprintf(stdout, Fmt.Pad(Fmt.Int(p4), 2) & "\n"); }; } Mis.WriteComments(stdout, "\nNode data by Read\n" & "\n"); for (i = 0; i < top->node.nel; i++) { Node_t v = OrgV(top->node.el[i]); { Mis.WritePoint(c[v->num]); fprintf(stdout, "\n"); }; } } */ } /* END 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); argparser_get_keyword(pp, "-inFile"); o->inFile = argparser_get_next(pp); argparser_finish(pp); ----------------------------------- #define _HELP \ fprintf(stderr, "Usage: Read" \ " -inFile " \ "\n"); END¦ } } return o; } /* END GetOptions */ { DoIt() } TesteOpGeo.