Salome HOME
85efccae490b60835841bf6493afc6da44dae1d3
[modules/hexablock.git] / doc / test_doc / extrudeQuad / extrude_quad.py
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2009-2023  CEA, EDF
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20
21 ####### Test for Extrude Quad ###############
22
23 import hexablock
24
25
26 doc = hexablock.addDocument("Extrude Quad Test")
27
28 dimx = 11
29 dimy = 11
30 dimz = 2
31
32 orig1 = doc.addVertex ( 0,0,0)
33 vx    = doc.addVector ( 1,0,0)
34 vy    = doc.addVector ( 0,1,0)
35 vz    = doc.addVector ( 0,0,1)
36 dir1  = doc.addVector ( 1,1,1)
37 dir2  = doc.addVector ( 1,1,-1)
38
39 dx =1
40 dy=1
41 dz=1
42
43 grid1 = doc.makeCartesianUni (orig1, vx,vy,vz, dx,dy,dz, dimx,dimy,dimz)
44
45 mx = dimx/2
46 my = dimy/2
47 liste1 = []
48 liste2 = []
49
50 liste1.append(grid1.getQuadIJ (mx, my, dimz))
51 liste2.append(grid1.getQuadIJ (mx, my, 0))
52 for nx in range(dimx):
53     if nx!=mx:     
54         liste1.append(grid1.getQuadIJ (nx, my, dimz))
55         liste2.append(grid1.getQuadIJ (nx, my, 0))
56
57 for ny in range(dimy):
58     if ny!=my:
59         liste1.append(grid1.getQuadIJ (mx, ny, dimz))
60         liste2.append(grid1.getQuadIJ (mx, ny, 0))
61
62 tlen = []
63 dh0  = 1
64 dh   = 0.02
65 lh = 0
66 for nro in range(5):
67     dh = 1.5*dh + 1
68     lh += dh
69     tlen.append(lh)
70
71 nbiter = 5
72 doc.saveVtk ("prisme1.vtk")
73 prisme2 = doc.extrudeQuadsUni (liste2, dir2, dh0, nbiter)
74 doc.saveVtk ("prisme2.vtk")
75
76 prisme1 = doc.extrudeQuads (liste1, dir1, tlen)
77
78 doc.saveVtk ("prisme3.vtk")