PyT3D project

Python preprocessor for T3D, a three-dimensional sequential mesh generator

Examples (from PyT3D tests)

Sphere

v,c,s,r = sphere(Vector3(-1,-1,-1),1)
base = '/tmp/testt3d3'
iName,oName = base+'.in',base+'.out'
r.toFile(iName)
run(iName,oName,graphics=True,defaultSize=.3)

example3 example3

Polyhedron

points = (
Vector3(-0.1634818932346831,0.7688992672464797,0.05873657044469649),
Vector3(0.015850275829110416,0.6718631991774959,-0.22677882055936593),
Vector3(-0.22876190049809825,0.48658585191827297,-0.36944181998865977),
Vector3(0.6307125885035532,-0.27338588231869887,-0.33766671105972496),
Vector3(0.4259677990174599,-0.5372445534669197,0.3078872673786138),
Vector3(0.4257163388008502,-0.5477957452347594,0.21524803044970098),
Vector3(-0.09203058515098259,0.7997086337395551,0.198955405611554),
Vector3(-0.5996481131044418,0.13259076669030956,0.45708535138940715),
Vector3(0.5219487893773398,0.5058338313161991,0.19412386887140254),
Vector3(-0.4563240642657833,-0.018457868595066262,-0.6128579214123338),
Vector3(-0.690524883016468,-0.14017873539269599,0.17453784531012723),
Vector3(-0.44981277431566136,-0.43175592997968776,0.20190172149273977),
Vector3(0.4517566296513138,0.47817101092271275,-0.14686026070994462),
Vector3(-0.6143952846500577,-0.23215735748057442,-0.4244121312024095),
Vector3(-0.4893245261907091,-0.06449930822776606,-0.5772382784432337),
Vector3(0.5521208485776086,0.45204648348887955,0.20487351840362672),
Vector3(0.7437946204974012,-0.060422833059922146,-0.07999894517202047),
Vector3(0.4190112855730076,-0.5352499276625208,0.3171688669164757),
Vector3(0.3067381080473122,-0.388334866362265,0.4742730967780291),
Vector3(-0.10859713854487155,-0.42104419886986,0.5421878946113429),
Vector3(-0.11144349606353582,-0.4401824809544859,0.5258049696893764),
Vector3(-0.23442641561519706,0.7115028262250923,0.24373911980122265),
Vector3(0.49046121377308205,-0.3257390290800893,-0.401536813141529),
Vector3(0.14501261800363582,-0.5594572410312575,-0.2166965478463329),
Vector3(0.7259484221548133,-0.1083206684037577,-0.25120123392742455),
Vector3(-0.4010198596382339,-0.4906776218252549,-0.2564376751546061),
Vector3(-0.12371086512259293,0.791609999566323,0.06951319516095045),
Vector3(-0.6014748783005928,-0.24780292621802935,-0.4358618675498305),
)
connectivity = (
(0, 26, 1, 2),
(24, 16, 4, 5, 3),
(8, 12, 1, 26, 6),
(12, 24, 3, 22, 9, 2, 1),
(10, 7, 21, 0, 2, 9, 14, 13),
(4, 16, 15, 18, 17),
(19, 7, 10, 11, 20),
(25, 27, 14, 9, 22, 23),
(8, 6, 21, 7, 19, 18, 15),
(13, 27, 25, 11, 10),
(0, 21, 6, 26),
(18, 19, 20, 17),
(25, 23, 5, 4, 17, 20, 11),
(8, 15, 16, 24, 12),
(3, 5, 23, 22),
(27, 13, 14),
)
v,c,p,r = polyhedron(points,connectivity)
base = '/tmp/testt3d4'
iName,oName = base+'.in',base+'.out'
r.toFile(iName)
run(iName,oName,defaultSize=1)

example4 example4 example4

Box with another box as subregion

v,c,s,r1 = axisAlignedBox(Vector3(1,1,1),Vector3(5,5,5))
v,c,s,r2 = axisAlignedBox(Vector3(2,2,2),Vector3(3,3,3))
for vv in v+c+s+[r2]: vv.size = 0.1
r1.subregions.append(r2)
r1.property = 1
r2.property = 2
base = '/tmp/testt3d2'
iName,oName = base+'.in',base+'.out'
r1.toFile(iName)
run(iName,oName)

example2 example2 example2

Simple region

v1 = Vertex(xyz=(0,0,0))
v2 = Vertex(xyz=(2,0,1))
v3 = Vertex(xyz=(2,2,0))
v4 = Vertex(xyz=(0,2,0))
v5 = Vertex(xyz=(0,0,5))
v6 = Vertex(xyz=(2,0,5))
p1 = Polygon(xyz=(0,-1,-1))
c1 = Curve(v1,v2,polygons=[p1])
c2 = Curve(v2,v3)
c3 = Curve(v3,v4)
c4 = Curve(v4,v1)
c5 = Curve(v2,v6)
c6 = Curve(v3,v6)
c7 = Curve(v1,v5)
c8 = Curve(v4,v5)
c9 = Curve(v5,v6)
s1 = Surface((c1,c2,c3,c4))
s2 = Surface((c1,c5,c7,c9))
p1 = Patch((c2,c5,c6))
p2 = Patch((c4,c7,c8))
p3 = Patch((c3,c6,c8,c9))
r1 = Region(surfaces=(s1,s2),patches=(p1,p2,p3))
base = '/tmp/testt3d1'
iName,oName = base+'.in',base+'.out'
r1.toFile(iName)
run(iName,oName)

example1 example1
Contact: e-mail
Last update: 4th September 2022
© 2011 - 2022   Jan Stránský
All rights reserved
Valid XHTML 1.1
Valid CSS