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
|
example$ regina-python
Regina 4.1.3
A Normal Surface Theory Calculator
Copyright (c) 1999-2004, Ben Burton
>>> ################################
... #
... # Sample Python Script
... #
... # Illustrates the traversal and manipulation of an entire packet tree.
... #
... # See the file "tree.session" for the results of running this script.
... #
... ################################
...
>>> # Create a new census of finite orientable closed 3-manifold
... # triangulations with two tetrahedra.
... from regina import NBoolSet
>>> census = regina.NContainer()
>>> regina.NCensus.formCensus(census, 2, NBoolSet.sTrue,
... NBoolSet.sTrue, NBoolSet.sFalse, 0, 0)
16
>>>
>>> # Calculate the homology of each triangulation in the census.
... # Note that formCensus() will have inserted each new triangulation as
... # a child packet of the overall census container.
... tri = census.getFirstTreeChild()
>>> while tri != None:
... print tri.getPacketLabel() + ":", tri.getHomologyH1()
... tri = tri.getNextTreeSibling()
...
Item 1: Z_7
Item 2: Z_5
Item 3: Z
Item 4: Z_3
Item 5: Z_8
Item 6: 0
Item 7: 0
Item 8: 0
Item 9: Z_2
Item 10: 0
Item 11: 0
Item 12: Z_3
Item 13: 0
Item 14: Z_3
Item 15: 2 Z_2
Item 16: Z_2
>>>
>>> # Remove from the tree each triangulation with trivial homology.
... tri = census.getFirstTreeChild()
>>> while tri != None:
... next = tri.getNextTreeSibling()
... hom = tri.getHomologyH1()
... if hom.isTrivial():
... tri.makeOrphan()
... tri = next
...
>>>
>>> # Print the homology of each remaining triangulation.
... tri = census.getFirstTreeChild()
>>> while tri != None:
... print tri.getPacketLabel() + ":", tri.getHomologyH1()
... tri = tri.getNextTreeSibling()
...
Item 1: Z_7
Item 2: Z_5
Item 3: Z
Item 4: Z_3
Item 5: Z_8
Item 9: Z_2
Item 12: Z_3
Item 14: Z_3
Item 15: 2 Z_2
Item 16: Z_2
>>>
|