MODULE Mapi; (* This module contain essentially procedures created by J. Stolfi and R. Marcone (see the copyright and authorship futher down), modified L. P. Lozada for the case tridimensional. *) IMPORT Octf, Triangulation, Word; FROM Octf IMPORT Spin; REVEAL FacetEdge = PublicFacetEdge BRANDED OBJECT OVERRIDES init := MapInit; END; PROCEDURE MapInit(s: FacetEdge; order1,order2: CARDINAL): FacetEdge = BEGIN EVAL NARROW(s, Octf.FacetEdge).init(); s.ca := Triangulation.MakeTetraTopo(order1,order2); s.order1 := order1; s.order2 := order2; RETURN s END MapInit; PROCEDURE MakeFacetEdge(order1,order2: CARDINAL): Pair = BEGIN WITH e = NEW(FacetEdge).init(order1,order2) DO RETURN Pair{facetedge := e, bits := 0}; END; END MakeFacetEdge; PROCEDURE Corner(a: Pair): Triangulation.Pair = BEGIN WITH r = a.bits DO RETURN a.facetedge.ca[r]; END; END Corner; PROCEDURE SetCorner(a: Pair; c: Triangulation.Pair) = BEGIN WITH r = a.bits DO a.facetedge.ca[r] := c; END; END SetCorner; PROCEDURE CCorner(a: Pair): Triangulation.Pair = BEGIN WITH r = Word.Xor(a.bits, 1) DO RETURN Spin(a.facetedge.ca[r]); END; END CCorner; PROCEDURE SetCCorner(a: Pair; c: Triangulation.Pair) = BEGIN WITH r = Word.Xor(a.bits, 1) DO a.facetedge.ca[r] := Spin(c); END; END SetCCorner; BEGIN END Mapi. (* ***************** START OF COPYRIGHT AND AUTHORSHIP NOTICE ********** All files in this directory tree are Copyright 1996 by Jorge Stolfi, Rober Marcone Rosi, and Universidade Estadual de Campinas, Brazil--- unless stated otherwise in the files themselves. THESE FILES ARE DISTRIBUTED WITH NO GUARANTEE OF ANY KIND. Neither the authors nor their employers may be held responsible for any losses or damages attributed to their use. These files may be freely copied, distributed, modified, and used for any purpose; provided that any subtantial excerpt of these files that is redistributed or incorporated in other software packages is accompanied by this copyright and authorship notice, and is made freely available under these same terms. ***************** END OF COPYRIGHT AND AUTHORSHIP NOTICE ************ *)