Salome HOME
3b1c2c6ccfc490e7c6d2543de0c5477df1abad39
[modules/hexablock.git] / src / TEST_PY / test_unit / test_cuve.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
22 # Francis KLOSS - 2011-2013 - CEA-Saclay, DEN, DM2S, SFME, LGLS, F-91191 Gif-sur-Yvette, France
23 # =============================================================================================
24
25 import hexablock
26
27 doc = hexablock.addDocument("cuve")
28
29 # Construire la grille cylindrique
30 # --------------------------------
31
32 centre = doc.addVertex(0, 0, 0)
33
34 vecteur_px = doc.addVector(1, 0, 0)
35 vecteur_pz = doc.addVector(0, 0, 1)
36
37 grille = doc.makeCylindrical(centre, vecteur_px, vecteur_pz,  1, 360, 1,  3, 8, 1,  False)
38
39 # Ajouter le centre
40 # -----------------
41
42 quad_0 = grille.getQuadJK(0, 0, 0)
43 quad_6 = grille.getQuadJK(0, 6, 0)
44 quad_7 = grille.getQuadJK(0, 7, 0)
45
46 hexa_a = doc.addHexa3Quads(quad_0, quad_6, quad_7)
47
48 quad_2 = grille.getQuadJK(0, 2, 0)
49 quad_3 = grille.getQuadJK(0, 3, 0)
50 quad_4 = grille.getQuadJK(0, 4, 0)
51
52 hexa_b = doc.addHexa3Quads(quad_2, quad_3, quad_4)
53
54 quad_1 = grille.getQuadJK(0, 1, 0)
55 quad_5 = grille.getQuadJK(0, 5, 0)
56
57 quad_a = hexa_a.getQuad(1)
58 quad_b = hexa_b.getQuad(1)
59
60 hexa_c = doc.addHexa4Quads(quad_1, quad_a, quad_5, quad_b)
61
62
63 law = doc.addLaw("Uniform", 3)
64
65 for j in range(doc.countPropagation()):
66     propa = doc.getPropagation(j)
67     propa.setLaw(law) 
68
69 mesh_hexas = hexablock.mesh (doc)
70
71