/* See {Torus3.h} */ #include /* Last edited on 2009-02-10 09:51:33 by stolfi */ #define Torus3_C_COPYRIGHT \ "Copyright © 2000,2007 Universidade Estadual de Campinas (UNICAMP)" #include #include #include #include #include #include #include #include #include #include #include Place_t MakeTorus3(uint order) { /* Make a big cube divided into {order×order×order} cubelets: */ TwoPlaces_vec_t a = MakeBigCube(order); /* Glue opposite faces of the big cube: */ GlueBigCube(Clock(Spin(PrevF(a.e[(order-1)*order + 0].p[0]))), Spin(PrevF(PrevE(PrevE(a.e[0*order+0].p[0])))), order); GlueBigCube(Spin(a.e[(order-1)*order + 0].p[1]), Clock(Spin(a.e[(order-1)*order + 0].p[0])),order); GlueBigCube(Spin(NextF(PrevE(a.e[0*order + 0].p[1]))), Clock(Spin(NextF(NextE(a.e[0*order + (order-1)].p[1])))), order); /* Return a place not killed by the GlueBigCube procedure: */ return a.e[0*order + 0].p[1]; } Place_t MakeTorus3Bis(uint order) { /* Make a big cube divided into {order×order×order} cubelets: */ TwoPlaces_vec_t a = MakeBigCube(order); /* Set all elements (nodes, edgess, walls), as non-existing: */ Place_t p = a.e[(order-1)*order + 0].p[0]; ElemTableRec_t top = MakeElemTable(Place_vec_make_desc(&p, 1)); int i; for (i = 0; i < top.wall.ne; i++) { PWall(top.wall.e[i])->exists = FALSE; } for (i = 0; i < top.edge.ne; i++) { PEdge(top.edge.e[i])->exists = FALSE; } for (i = 0; i < top.node.ne; i++) { OrgV(top.node.e[i])->exists = FALSE; } /* Now emphasize the original elements (nodes,edges,walls): */ SetCubeProperties(&a, order, &top); /* Glue opposite faces of the big cube: */ GlueBigCube(Clock(Spin(PrevF(a.e[(order-1)*order + 0].p[0]))), Spin(PrevF(PrevE(PrevE(a.e[0*order+0].p[0])))), order); GlueBigCube(Spin(a.e[(order-1)*order + 0].p[1]), Clock(Spin(a.e[(order-1)*order + 0].p[0])),order); GlueBigCube(Spin(NextF(PrevE(a.e[0*order + 0].p[1]))), Clock(Spin(NextF(NextE(a.e[0*order + (order-1)].p[1])))), order); /* Return a place not killed by the GlueBigCube procedure: */ return a.e[0*order + 0].p[1]; } #define Torus3_C_author \ "Created by L. A. P. Lozada, 1999-2000.\n" \ "Modification history:\n" \ " 2007-02-01 Added {MakeTorus3} from {MakeComplexWf.c} and {MakeManifold.c} \n" \ " 2007-02-01 Added {MakeTorus3Bis} from {MakeManifold.c}"