1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
example$ regina-python
Regina 4.1.3
A Normal Surface Theory Calculator
Copyright (c) 1999-2004, Ben Burton
>>> ################################
... #
... # Sample Python Script
... #
... # Illustrates various queries and actions that can be performed upon a
... # 3-manifold triangulation and its normal surfaces.
... #
... # See the file "triangulation.session" for the results of running this
... # script.
... #
... ################################
...
>>> # Create a new (3,4,7) layered solid torus. This is a 3-tetrahedron
... # triangulation of a solid torus.
... t = regina.NTriangulation()
>>> t.insertLayeredSolidTorus(3,4)
<regina.NTetrahedron object at 0x401f3ed4>
>>> print t
Triangulation with 3 tetrahedra.
>>>
>>> # Dump skeletal information for the triangulation.
... print t.toStringLong()
Size of the skeleton:
Tetrahedra: 3
Faces: 7
Edges: 5
Vertices: 1
Tetrahedron gluing:
Tet | glued to: (012) (013) (023) (123)
-----+-------------------------------------------------------
0 | boundary boundary 1 (012) 1 (130)
1 | 0 (023) 0 (312) 2 (013) 2 (120)
2 | 1 (312) 1 (023) 2 (312) 2 (230)
Vertices:
Tet | vertex: 0 1 2 3
-----+--------------------------
0 | 0 0 0 0
1 | 0 0 0 0
2 | 0 0 0 0
Edges:
Tet | edge: 01 02 03 12 13 23
-----+--------------------------------
0 | 0 1 2 2 1 3
1 | 1 2 3 3 2 4
2 | 2 4 3 3 4 3
Faces:
Tet | face: 012 013 023 123
-----+------------------------
0 | 0 1 2 3
1 | 2 3 4 5
2 | 5 4 6 6
>>>
>>> # Calculate some algebraic properties of the triangulation.
... print t.getHomologyH1()
Z
>>> print t.getHomologyH1Bdry()
2 Z
>>>
>>> # Test for 0-efficiency, which involves searching for particular types
... # of normal surface.
... print t.isZeroEfficient()
0
>>>
>>> # Get a list of normal surfaces in standard tri-quad coordinates.
... from regina import NNormalSurfaceList
>>> surfaces = NNormalSurfaceList.enumerate(t, NNormalSurfaceList.STANDARD)
>>>
>>> # Verify that the normal surface list has been made a child packet of the
... # triangulation. This happens automatically whenever the normal
... # surfaces (or angle structures) of a triangulation are enumerated.
... if surfaces.getTreeParent() == t:
... print "OK: Parent-child relationship is correct."
... else:
... print "ERROR: Parent-child relationship is incorrect."
...
OK: Parent-child relationship is correct.
>>>
>>> # Dump the entire list of vertex normal surfaces.
... print surfaces.toStringLong()
Embedded vertex normal surfaces
Coordinates: Standard normal (tri-quad)
Number of surfaces is 9
0 0 0 0 ; 0 1 0 || 0 0 0 0 ; 1 0 0 || 0 0 0 0 ; 0 1 0
0 0 1 1 ; 1 0 0 || 1 1 0 0 ; 1 0 0 || 0 0 0 0 ; 0 2 0
1 1 0 0 ; 0 0 1 || 1 1 0 0 ; 0 0 0 || 0 0 0 0 ; 0 1 0
1 1 1 1 ; 0 0 0 || 1 1 0 0 ; 1 0 0 || 0 0 0 0 ; 0 2 0
0 0 1 1 ; 1 0 0 || 1 1 1 1 ; 0 0 0 || 1 1 1 1 ; 0 0 0
0 0 0 0 ; 0 2 0 || 0 0 1 1 ; 1 0 0 || 1 1 1 1 ; 0 0 0
1 1 1 1 ; 0 0 0 || 1 1 1 1 ; 0 0 0 || 1 1 1 1 ; 0 0 0
0 0 0 0 ; 0 0 2 || 0 0 0 0 ; 0 2 0 || 0 0 1 1 ; 1 0 0
3 3 0 0 ; 0 0 1 || 1 1 0 0 ; 0 0 2 || 1 1 0 0 ; 0 0 1
>>>
>>> # Print the Euler characteristic and orientability of each surface.
... for i in range(surfaces.getNumberOfSurfaces()):
... s = surfaces.getSurface(i)
... print "Chi =", s.getEulerCharacteristic(), "; Or =", s.isOrientable()
...
Chi = -1 ; Or = false
Chi = -2 ; Or = true
Chi = 0 ; Or = false
Chi = -1 ; Or = true
Chi = 0 ; Or = true
Chi = 0 ; Or = true
Chi = 1 ; Or = true
Chi = 0 ; Or = true
Chi = 1 ; Or = true
>>>
>>> # List all the surfaces with more than one quad in the first tetrahedron.
... for i in range(surfaces.getNumberOfSurfaces()):
... s = surfaces.getSurface(i)
... if s.getQuadCoord(0,0) + s.getQuadCoord(0,1) + s.getQuadCoord(0,2) > 1:
... print s
...
0 0 0 0 ; 0 2 0 || 0 0 1 1 ; 1 0 0 || 1 1 1 1 ; 0 0 0
0 0 0 0 ; 0 0 2 || 0 0 0 0 ; 0 2 0 || 0 0 1 1 ; 1 0 0
>>>
>>> # Tidy up.
... # Delete the triangulation; this will automatically delete the surface
... # list since the surface list is a child packet of the triangulation.
... t = None
>>>
|