def from_manifold(manifold, areas=None, insphere_scale=0.05, weights=None): if manifold.solution_type() != 'all tetrahedra positively oriented': return NonGeometricRaytracingData(t3m.Mcomplex(manifold)) num_cusps = manifold.num_cusps() # Make a copy of the manifold. On the copy, we can set all # the Dehn-fillings to (0,0) so that gluing_equations gives # us both the meridian and longitude. snappy_trig = Triangulation(manifold) snappy_trig.dehn_fill(num_cusps * [(0, 0)]) # Develops the cusps of the manifold. This is needed to # compute the data for the horospheres (complete cusps) # or "Margulis tubes" (incomplete cusps). c = ComplexCuspCrossSection.fromManifoldAndShapes( manifold, manifold.tetrahedra_shapes('rect'), one_cocycle='develop') c.normalize_cusps() c.compute_translations() c.add_vertex_positions_to_horotriangles() c.lift_vertex_positions_of_horotriangles() c.move_lifted_vertex_positions_to_zero_first() # c.mcomplex is the same triangulation encoded as # t3m.Mcomplex triangulation r = IdealRaytracingData(c.mcomplex, manifold) z = c.mcomplex.Tetrahedra[0].ShapeParameters[t3m.E01] r.RF = z.real().parent() r.insphere_scale = r.RF(insphere_scale) resolved_areas = num_cusps * [1.0] if areas is None else areas r.areas = [r.RF(area) for area in resolved_areas] r.peripheral_gluing_equations = snappy_trig.gluing_equations( )[snappy_trig.num_tetrahedra():] # For debugging! Delete! r.c = c r._add_horotriangle_heights() r._add_complex_vertices() r._add_R13_vertices() r._add_O13_matrices_to_faces() r._add_R13_planes_to_faces() r._add_R13_horosphere_scales_to_vertices() r._add_cusp_to_tet_matrices() r._add_margulis_tube_ends() r._add_inspheres() r._add_log_holonomies() r._add_cusp_triangle_vertex_positions() r.add_weights(weights) return r
def testCocycles(isoSig): """ Testing. >>> testCocycles("kLLLvQQkccfgighjijjlnannwnashp") True >>> testCocycles("qLLvLAzMAQAkcdjifjhlnkmlnnopphsksskcimafjwovqw") True """ T = Triangulation(isoSig, remove_finite_vertices=False) hyperbolic_structure = compute_verified_hyperbolic_structure(T, source='new', bits_prec=106) engine = VerifyHyperbolicStructureEngine(hyperbolic_structure) tester = CocycleTester(engine) tester.test() return True
from snappy import Triangulation from snappy.ptolemy.homology import * import sys def to_index(s): var, face_num, tet_num = s.split('_') if var != 's': raise Exception("Not s") return 4 * int(tet_num) + int(face_num) trig = Triangulation(sys.argv[1], remove_finite_vertices=False) # trig.reverse_orientation() face_classes = trig._ptolemy_equations_identified_face_classes() H = homology_basis_representatives_with_orders( trig._ptolemy_equations_boundary_map_2()[0], trig._ptolemy_equations_boundary_map_3()[0], 0) for h, o in H: weights = (4 * trig.num_tetrahedra()) * [0] for e, face_class in zip(h, face_classes): for i, face in enumerate(face_class[2:]): weights[to_index(face)] = (-1)**i * e print("Order: ", o)
face_classes = trig._ptolemy_equations_identified_face_classes() pos_c2 = [ weights[to_index(face_class[2])] for face_class in face_classes ] neg_c2 = [ weights[to_index(face_class[3])] for face_class in face_classes ] for p, n in zip(pos_c2, neg_c2): if p != -n: raise Exception("Not matching") for row in trig._ptolemy_equations_boundary_map_2()[0]: if len(row) != len(pos_c2): raise Exception("Not matching") s = sum([e * p for e, p in zip(row, pos_c2)]) if s != 0: raise Exception("Not in kernel") if __name__ == '__main__': print(sys.argv) if sys.argv[1] == 'perf': run_perf_test() else: trig = Triangulation(sys.argv[1], remove_finite_vertices = False) weights = None if len(sys.argv) == 3: weights = eval(sys.argv[2]) check_weights(trig, weights) main(trig, weights)