Salome HOME
Updated copyright comment
[modules/hexablock.git] / doc / test_doc / joinQuad / join_quad.py
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2009-2024  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 Join Quad ###############
22
23 import hexablock
24
25
26
27 doc = hexablock.addDocument("Join Quad Test")
28
29 dimx = 11
30 dimy = 11
31 dimz = 2
32
33 grid1 = doc.makeCartesianTop (dimx,dimy,dimz)
34
35 orig2 = doc.addVertex(dimx/2.0,0,8)
36 vectj = doc.addVector (0,1,0);
37 vecti = doc.addVector (1,0,0);
38 grid2 = doc.makeCylinderUni (orig2, vecti, vectj, 1.0, 2.0, 180.0, 11.0, dimz,dimy,dimx)
39
40 mx = dimx/2
41 my = dimy/2
42 prems = grid1.getQuadIJ (mx, my, dimz)
43 cible = grid2.getQuadJK (dimz, mx, my)
44
45 va1 = prems.getVertex (0)
46 va2 = prems.getVertex (1)
47
48 vb1 = cible.getVertex (1)
49 vb2 = cible.getVertex (2)
50
51 hauteur = 5
52
53 liste = []
54
55 liste.append(prems)
56 for nx in range(mx):
57     if nx!=mx:
58         liste.append(grid1.getQuadIJ(nx, my, dimz))
59
60 for ny in range(dimy):
61     if (ny!=my):
62         liste.append(grid1.getQuadIJ (mx, ny, dimz))
63
64 doc.saveVtk ("jointQuad1.vtk")
65 joint = doc.joinQuadsUni (liste, cible, va1,vb1,va2,vb2, hauteur)
66 doc.saveVtk ("jointQuad2.vtk")