Salome HOME
4d58b2c493f6d1efe36d8d09a35ef0b8b8d1ba84
[modules/hexablock.git] / src / TEST_PY / test_unit / test_rind.py
1 # -*- coding: latin-1 -*-
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 # Hexa : Creation d'hexaedres 
22
23 import hexablock
24 import os
25
26 #---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
27
28
29 # ======================================================= test_sphere
30 def test_sphere () :
31
32     doc  = hexablock.addDocument ("default")
33
34     center  = doc.addVertex (0,0,0)
35     radius  = 8
36     orig    = doc.addVertex (0,0,0)
37     vz      = doc.addVector (0,0,1)
38     vx      = doc.addVector (1,0,0)
39     radhole = 1
40     nrad    = 3
41     nang    = 16
42     nhaut   = 8
43
44     doc.makeSphere (center, vx, vz, radius, radhole, orig, nrad, nang, nhaut)
45     doc.saveVtk ("Rind1.vtk")
46     return doc
47
48 # ======================================================= test_part_sphere
49 def test_part_sphere () :
50
51     doc  = hexablock.addDocument ("default")
52
53     center  = doc.addVertex (0,0,0)
54     radius  = 8
55     orig    = doc.addVertex (0,0,-4)
56     vz      = doc.addVector (0,0,1)
57     vx      = doc.addVector (1,0,0)
58     angle   = 90
59     radhole = 1
60     nrad    = 3
61     nang    = 4
62     nhaut   = 8
63
64     doc.makePartSphere (center, vx, vz, radius, radhole, orig, angle, 
65                         nrad, nang, nhaut)
66     doc.saveVtk ("Rind2.vtk")
67     return doc
68
69 # ======================================================= test_rind
70 def test_rind () :
71
72     doc  = hexablock.addDocument ("default")
73
74     center  = doc.addVertex (0,0,0)
75     radius  = 8
76     radint  = 7
77     orig    = doc.addVertex (0,0,0)
78     vz      = doc.addVector (0,0,1)
79     vx      = doc.addVector (1,0,0)
80     radhole = 1
81     nrad    = 3
82     nang    = 16
83     nhaut   = 8
84
85     doc.makeRind (center, vx, vz, radius, radint, radhole, orig, 
86                   nrad, nang, nhaut)
87     doc.saveVtk ("Rind3.vtk")
88     return doc
89
90 # ======================================================= test_part_rind
91 def test_part_rind () :
92
93     doc  = hexablock.addDocument ("default")
94
95     center  = doc.addVertex (0,0,0)
96     radius  = 8
97     radint  = 7
98     orig    = doc.addVertex (0,0,0)
99     vz      = doc.addVector (0,0,1)
100     vx      = doc.addVector (1,0,0)
101     angle   = 90
102     radhole = 1
103     nrad    = 3
104     nang    = 14
105     nhaut   = 8
106
107     doc.makePartRind (center, vx, vz, radius, radint, radhole, orig, angle,
108                       nrad, nang, nhaut)
109     doc.saveVtk ("Rind4.vtk")
110     return doc
111
112 # ================================================================= Begin
113
114 ##test_sphere  ()
115 ##test_part_sphere  ()
116 doc = test_part_rind  ()
117 ##test_rind  ()
118
119 law = doc.addLaw("Uniform", 4)
120
121 for j in range(doc.countPropagation()):
122     propa = doc.getPropagation(j)
123     propa.setLaw(law) 
124
125 mesh_hexas = hexablock.mesh(doc, "rind:hexas")