Salome HOME
Updated copyright comment
[modules/hexablock.git] / doc / test_doc / hemisphere / rind.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 ####### Rind Grid Test ##########
22
23 import hexablock
24
25
26 doc  = hexablock.addDocument ("Rind Grid Test")
27
28
29 # Simple Rind -----
30
31
32 nr = 4
33 na = 8
34 nh = 12
35
36 rind0 = doc.makeRindTop(nr, na, nh)
37 rind0.saveVtk("makeRindTop.vtk")
38
39 # Uniform Rind -----
40
41 center  = doc.addVertex (0, 0, 0)
42 vplan = doc.addVertex (0, 0, -0.5)
43 vx    = doc.addVector (1, 0, 0)
44 vz    = doc.addVector (0, 0, 1)
45 rtrou = 1
46 rint  = 8
47 rext  = 10
48 angle = 180
49
50 rind1 = doc.makeRindUni(center, vx, vz, rtrou, rint, rext, angle, vplan, nr, na, nh)
51 rind1.saveVtk("makeRindUni.vtk")
52
53 # Custom Rind -----
54
55 dr     = (rext-rtrou)/nr
56 dtheta = angle/na
57 dphi   = 180.0/nh
58 trad = []
59 tang = []
60 tphi = []
61
62 trad.append(rtrou)
63 for nro in range(nr+1):
64   trad.append(rint + nro*dr)
65   
66 for nro in range(na+1):
67   tang.append(nro*dtheta)
68   
69 for nro in range(nh+1):
70   tphi.append(-90 + nro*dphi)
71
72 rind2 = doc.makeRind(center, vx, vz, trad, tang, tphi)
73 rind2.saveVtk("makeRind.vtk")