File: verify-snappea-census-data.py

package info (click to toggle)
regina-normal 4.93-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 28,576 kB
  • sloc: cpp: 86,815; ansic: 13,030; xml: 9,089; perl: 951; sh: 380; python: 273; makefile: 103
file content (47 lines) | stat: -rw-r--r-- 1,104 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/regina-python --nolibs
#
# TODO: Document this.

import sys

if len(sys.argv) != 2:
    print "Usage: " + sys.argv[0] + " <filename>"
    sys.exit(1)

tree = regina.readFileMagic(sys.argv[1])
if not tree:
    print "E: Could not open file " + sys.argv[1] + "."
    print
    print "Usage: " + sys.argv[0] + " <filename>"
    sys.exit(1)

def process(tri):
    label = tri.getPacketLabel()
    print label

    section = label[0]
    index = int(label[1:])

    manifold = regina.NSnapPeaCensusManifold(section, index)
    con = manifold.construct()
    hom = manifold.getHomologyH1()

    if con == None:
        print 'ERROR: No construction'
        sys.exit(1)
    elif not con.isIsomorphicTo(tri):
        print 'ERROR: Non-isomorphic triangulation'
        sys.exit(1)
    if hom == None:
        print 'ERROR: No homology'
        sys.exit(1)
    elif not hom == tri.getHomologyH1():
        print 'ERROR: Non-isomorphic homology'
        sys.exit(1)

p = tree
while p != None:
    if p.getPacketType() == regina.NTriangulation.packetType:
        process(p)
    p = p.nextTreePacket()