Salome HOME
Updated copyright comment
[modules/hexablock.git] / doc / test_doc / test_cone / test_cone.py
1 # -*- coding: latin-1 -*-
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 import hexablock
22
23
24
25 doc  = hexablock.addDocument ("test_cone")
26
27 orig = doc.addVertex (0, 0, 0)
28 ori2 = doc.addVertex (0, 0, 10)
29 vz   = doc.addVector (0, 0, 1)
30 vx   = doc.addVector (1 ,0, 0)
31
32 rad1   = 2.0
33 rad2   = 1.0
34 height = 5.0
35 angle  = 270.0
36 hollow = False
37
38 nr = 2
39 na = 8
40 nl = 1
41
42 c1 = doc.makeCylindrical (orig, vx,vz, rad1, angle, height, nr,na,nl, hollow)
43 c2 = doc.makeCylindrical (ori2, vx,vz, rad2, angle, height, nr,na,nl, hollow)
44
45 vh0 = c2.getVertexIJK (0, 0, 0)
46 vh1 = c2.getVertexIJK (1, 0, 0)
47
48 vb0 = c1.getVertexIJK (0, 0, nl)
49 vb1 = c1.getVertexIJK (1, 0, nl)
50
51 qcible = c2.getQuadIJ (0, 0, 0)
52 qliste = []
53 for ni in range (nr) :
54     for nj in range (na) :
55         quad = c1.getQuadIJ (ni, nj, nl)
56         qliste.append (quad)
57
58 ## Join quads to make a cone between the 2 cylinders
59 doc.joinQuads  (qliste, qcible, vb0, vh0, vb1, vh1, 1)
60
61 ### -------------------- Mesh 
62 law = doc.addLaw ("Uniform", 4)
63
64 for np in range(doc.countPropagation()):
65     propa = doc.getPropagation (np)
66     propa.setLaw (law) 
67
68 mesh_hexas = hexablock.mesh(doc)
69