2 # -*- coding: latin-1 -*-
3 # Copyright (C) 2009-2016 CEA/DEN, EDF R&D
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License, or (at your option) any later version.
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 # Hexa : Creation d'hexaedres
25 geompy = hexablock.geompy
30 the_name = "pave_troue"
50 # ======================================================= save_vtk
55 filename = "%s_%02d.vtk" % (the_name,nbr_fic)
56 the_doc.saveVtk (filename)
59 # ======================================================= make_toit
65 for ni in range (imax) :
66 for nj in range (jmax) :
67 if ni != ichem or nj != jchem :
68 the_doc.removeHexa (the_grid.getHexaIJK (ni,nj,kmax))
70 # ======================================================= make_trou1
77 for ni in range (nc1) :
78 for nj in range (nc1) :
79 for nk in range (kmax) :
80 the_doc.removeHexa (the_grid.getHexaIJK (ic1+ni, jc1+nj, nk))
84 orig1 = the_doc.addVertex (xc1, yc1, 0)
85 vxy = the_doc.addVector (1,1,0)
90 theta = 360.0 / nbsect
91 cyl1_ray = [ rayon, rext]
93 for na in range (nbsect+1) :
94 cyl1_ang.append (na*theta)
98 cyl1 = the_doc.makePipe (orig1, vxy, vz, cyl1_ray, cyl1_ang, cyl1_h)
102 va1 = cyl1 .getVertexIJK (1, 1, 0)
103 va2 = cyl1 .getVertexIJK (1, 1, 1)
104 vc1 = the_grid.getVertexIJK (ic1+nc1-1, jc1+nc1, 0)
105 vc2 = the_grid.getVertexIJK (ic1+nc1-1, jc1+nc1, 1)
107 cible = the_grid.getQuadIK (ic1+2, jc1+nc1, 0)
109 for nk in range (len(cyl1_h)-1) :
110 for nj in range (len(cyl1_ang)-1) :
111 tab_quads.append (cyl1.getQuadJK (1, nj, nk))
123 tab_quads[0].setColor (5)
127 the_doc.joinQuadsUni (tab_quads, cible, va1, vc1, va2, vc2, 1)
131 # ======================================================= make_trou2
136 for nj in range (jmax) :
137 the_doc.removeHexa (the_grid.getHexaIJK (ic2, nj, kc2))
141 orig2 = the_doc.addVertex (xc2, 0, zc2)
142 vxz = the_doc.addVector (1,0,1)
147 theta = 360.0 / nbsect
148 cyl2_ray = [ rayon, rext]
150 for na in range (nbsect+1) :
151 cyl2_ang.append (na*theta)
154 cyl2 = the_doc.makePipe (orig2, vxz, vy, cyl2_ray, cyl2_ang, cyl2_h)
157 va1 = cyl2 .getVertexIJK (1, 0, 0)
158 va2 = cyl2 .getVertexIJK (1, 0, 1)
159 vc1 = the_grid.getVertexIJK (ic2+1, 0, kc2+1)
160 vc2 = the_grid.getVertexIJK (ic2+1, 1, kc2+1)
162 cible = the_grid.getQuadJK (ic2+1, 0, kc2)
164 for nk in range (len(cyl2_h)-1) :
165 for nj in range (len(cyl2_ang)-1) :
166 tab_quads.append (cyl2.getQuadJK (1, nj, nk))
178 tab_quads[0].setColor (5)
182 the_doc.joinQuadsUni (tab_quads, cible, va1, vc1, va2, vc2, 1)
186 # ======================================================= trait_vertical
187 def trait_vertical () :
190 for nk in range (kmax) :
191 for nj in range (2) :
192 the_doc.removeHexa (the_grid.getHexaIJK (ivert,nj,nk))
194 # ================================================================= make_pave
197 global the_doc, the_grid, tab_y, tab_z, vz, vy
199 the_doc = hexablock.addDocument (the_name)
200 vx = the_doc.addVector (1,0,0)
201 vy = the_doc.addVector (0,1,0)
202 vz = the_doc.addVector (0,0,1)
203 orig = the_doc.addVertex (0, 0, 0)
206 tab_x = [50, 62.5, 67.5, 70, 75, 85, 105, 120]
207 tab_y = [10, 15, 22.5, 25, 27.5, 40]
208 tab_z = [25, 40, 50, 53]
210 tab_x = [50, 55, 62.5, 67.5, 75, 85, 95, 115, 120]
211 tab_y = [10, 15, 22.5, 27.5, 35, 40]
212 tab_z = [10, 30, 40, 50, 53]
216 the_grid = the_doc.makeCartesian (orig, vx, vy, vz, tab_x, tab_y, tab_z)
219 global imax, jmax, kmax
222 kmax = len (tab_z) - 1
226 the_doc.removeHexa (the_grid.getHexaIJK (0,0,kmax-1))
239 print(" ________________________ Maillage")
240 the_doc.addLaws (2, True)
241 mesh_hexas = hexablock.mesh(the_doc)
244 the_doc.save (the_name)
252 # ================================================================= Begin