File: triangulation.py

package info (click to toggle)
regina-normal 5.1-6
  • links: PTS
  • area: main
  • in suites: buster
  • size: 54,488 kB
  • sloc: cpp: 142,029; ansic: 19,218; xml: 9,844; objc: 7,729; perl: 1,190; python: 623; sh: 614; makefile: 34
file content (61 lines) | stat: -rw-r--r-- 1,818 bytes parent folder | download | duplicates (3)
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
################################
#
#  Sample Python Script
#
#  Illustrates different queries and actions on 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 = Triangulation3()
t.insertLayeredSolidTorus(3,4)
print t

# Print the full skeleton of the triangulation.
print t.detail()

# Calculate some algebraic properties of the triangulation.
print t.homology()
print t.homologyBdry()

# Test for 0-efficiency, which asks Regina to search for certain types
# of normal surfaces.
print t.isZeroEfficient()

# Make our own list of vertex normal surfaces in standard coordinates.
surfaces = NormalSurfaces.enumerate(t, NS_STANDARD)

# Verify that the normal surface list is already a child packet of the
# triangulation.  This happens automatically whenever you enumerate
# normal surfaces (or angle structures).
if surfaces.parent() == t:
    print "OK: Parent-child relationship is correct."
else:
    print "ERROR: Parent-child relationship is incorrect."


# Print the full list of vertex normal surfaces.
print surfaces.detail()

# Print the Euler characteristic and orientability of each surface.
for i in range(surfaces.size()):
    s = surfaces.surface(i)
    print "Chi =", s.eulerChar(), "; Or =", s.isOrientable()


# List all surfaces with more than one quad in the first tetrahedron.
for i in range(surfaces.size()):
    s = surfaces.surface(i)
    if s.quads(0,0) + s.quads(0,1) + s.quads(0,2) > 1:
        print s


# Tidy up.
# Delete the triangulation.  This will automatically delete the surface
# list, which is a child of the triangulation in the packet tree.
t = None