test.testT(t, 2) # Join 2 NON-STRUCT PENTA a1 = G.cartPenta((0., 0., 0.), (1., 1., 1), (11, 11, 10)) a2 = G.cartPenta((10., 0., 0.), (1., 1., 1), (10, 10, 10)) a1 = C.initVars(a1, 'F', 2) a1 = C.initVars(a1, 'centers:G', 1) a2 = C.initVars(a2, 'F', 3) a2 = C.initVars(a2, 'centers:G', 3) t = C.newPyTree(['Base', 2]) a = T.join(a1, a2) t[2][1][2].append(a) test.testT(t, 9) # Join 2 NON-STRUCT PYRA a1 = G.cartPyra((0., 0., 0.), (1., 1., 1), (11, 11, 10)) a2 = G.cartPyra((10., 0., 0.), (1., 1., 1), (10, 10, 10)) a1 = C.initVars(a1, 'F', 2) a1 = C.initVars(a1, 'centers:G', 1) a2 = C.initVars(a2, 'F', 3) a2 = C.initVars(a2, 'centers:G', 3) t = C.newPyTree(['Base', 2]) a = T.join(a1, a2) t[2][1][2].append(a) test.testT(t, 10) # Join 2 NON-STRUCT QUADS a1 = G.cartTetra((0., 0., 0.), (1., 1., 1), (11, 11, 1)) a2 = G.cartTetra((10., 0., 0.), (1., 1., 1), (10, 10, 1)) a1 = C.initVars(a1, 'F', 2) a1 = C.initVars(a1, 'centers:G', 1)
#!/usr/bin/python # coding: utf-8 r"""cartPyra (pyTree) Generator.cartPyra((xo, yo, zo), (hi, hj, hk), (ni, nj, nk)) Create an unstructured pyramidal mesh defined from a regular Cartesian mesh. The initial Cartesian mesh is defined by ni x nj x nk points starting from point (xo,yo,zo) and of step (hi,hj,hk). Type of elements is ‘PYRA’. Parameters: (xo,yo,zo) (3-tuple of floats) – coordinates of the starting point (hi,hj,hk) (3-tuple of floats) – values of advancing step in the three directions (ni,nj,nk) (3-tuple of integers) – number of points in each direction Returns:a 1D, 2D or 3D unstructured mesh Return type:array or pyTree zone """ import Generator.PyTree as G import Converter.PyTree as C import CPlot.PyTree a = G.cartPyra((0., 0., 0.), (0.1, 0.1, 0.2), (10, 10, 10)) C.convertPyTree2File(a, 'out.cgns') CPlot.PyTree.display(a, displayBB=0, mode='mesh', meshStyle=1)
a = C.addVars(a,'Density'); a = C.initVars(a,'centers:cellN',1.) a2 = G.close(a, 1.e-1) test.testT(a2,3) # test 3D cylindre HEXA ni = 20; nj = 20; nk = 5 a0 = G.cylinder((0.,0.,0.), 0., 1., 0., 359, 1., (ni,nj,nk)) a0 = T.subzone(a0,(1,10,1),(20,13,5)) a = C.convertArray2Hexa(a0) a = C.addVars(a,'Density'); a = C.initVars(a,'centers:cellN',1.) a2 = G.close(a, 1.e-2) test.testT(a2,4) # test 3D TETRA a = C.convertArray2Tetra(a0) a = C.addVars(a,'Density'); a = C.initVars(a,'centers:cellN',1.) a2 = G.close(a,2.e-2) test.testT(a2,5) # test 3D PENTA a = G.cartPenta((0.,0.,0.), (0.1,0.1,0.2), (10,10,10)); a = C.addVars(a,'F') a = C.addVars(a,'Density'); a = C.initVars(a,'centers:cellN',1.) a2 = G.close(a, 2.e-2) test.testT([a2],6) # test 3D PYRA a = G.cartPyra((0.,0.,0.), (0.1,0.1,0.2), (10,10,10)); a = C.addVars(a,'F') a = C.addVars(a,'Density'); a = C.initVars(a,'centers:cellN',1.) a2 = G.close(a, 2.e-2) test.testT([a2],7)