7 # create an empty mesh structure
10 # Create nodes for 12-hedron with pentagonal faces
11 al = 2 * math.pi / 5.0
14 rr = aa / (2.0 * math.sin(al/2.0))
17 dh = rr * math.sqrt(2.0 * (1.0 - cosal * (1.0 + 2.0 * cosal)))
18 hh = 2.0 * dh - dr * (rr*(cosal - 1) + (rr + dr)*(math.cos(al/2) - 1)) / dh
22 bb = [] # above bottom
26 cos_bot = math.cos(i*al)
27 sin_bot = math.sin(i*al)
29 cos_top = math.cos(i*al + al/2.0)
30 sin_top = math.sin(i*al + al/2.0)
32 nd = mesh.AddNode(rr * cos_top, rr * sin_top, hh ) # top
33 nc = mesh.AddNode(r1 * cos_top, r1 * sin_top, hh - dh) # below top
34 nb = mesh.AddNode(r1 * cos_bot, r1 * sin_bot, dh) # above bottom
35 na = mesh.AddNode(rr * cos_bot, rr * sin_bot, 0) # bottom
37 cc.append(nc) # below top
38 bb.append(nb) # above bottom
39 aa.append(na) # bottom
42 # Create a polyhedral volume (12-hedron with pentagonal faces)
43 mesh.GetMeshEditor().AddPolyhedralVolume([dd[0], dd[1], dd[2], dd[3], dd[4], # top
44 dd[0], cc[0], bb[1], cc[1], dd[1], # -
45 dd[1], cc[1], bb[2], cc[2], dd[2], # -
46 dd[2], cc[2], bb[3], cc[3], dd[3], # - below top
47 dd[3], cc[3], bb[4], cc[4], dd[4], # -
48 dd[4], cc[4], bb[0], cc[0], dd[0], # -
49 aa[4], bb[4], cc[4], bb[0], aa[0], # .
50 aa[3], bb[3], cc[3], bb[4], aa[4], # .
51 aa[2], bb[2], cc[2], bb[3], aa[3], # . above bottom
52 aa[1], bb[1], cc[1], bb[2], aa[2], # .
53 aa[0], bb[0], cc[0], bb[1], aa[1], # .
54 aa[0], aa[1], aa[2], aa[3], aa[4]], # bottom
55 [5,5,5,5,5,5,5,5,5,5,5,5])
57 salome.sg.updateObjBrowser(1)