@pimms.value<EOL><INDENT>def all_border_triangles(all_border_triangle_addresses, surface):<DEDENT>
conv = lambda surf: tuple([tuple([pimms.imm_array(surf.unaddress(xs).T) for xs in bta])<EOL>for bta in all_border_triangle_addresses])<EOL>if isinstance(surface, Topology):<EOL><INDENT>return pimms.lazy_map({k:curry(lambda k: conv(surface.surfaces[k]), k)<EOL>for k in six.iterkeys(surface.surfaces)})<EOL><DEDENT>else: return conv(surface)<EOL>
path.all_border_triangles is tuple of two (3 x d x n) arrays--the first dimension of each
array corresponds to the triangle vertex, the second to the x/y/z coordinate of the vertex,
and the final dimension to the triangle id. The first gives the inner or left border
triangle coordinates while the second gives the right or the outer coordinates.

If path.surface is a topology, then border_triangles is instead a lazy-map of the border
triangle coordinates, one set for each surface in topo.