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