1 # -*- coding: latin-1 -*-
2 # Copyright (C) 2009-2014 CEA/DEN, EDF R&D
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.
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.
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
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 # Hexa : Creation d'hexaedres
26 #---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
29 # ======================================================= test_double_t
30 def test_double_t () :
32 doc = hexablock.addDocument ("default")
34 ori1 = doc.addVertex ( 0, 0, 0)
35 ori2 = doc.addVertex (-5, 0, 5)
36 ori3 = doc.addVertex ( 0, 0, 12)
37 ori4 = doc.addVertex (-5, 0, 17)
39 vx = doc.addVector ( 1 ,0, 0)
40 vz = doc.addVector ( 0, 0, 1)
49 cyl1 = doc.addCylinder (ori1, vz, rbig, nl1)
50 cyl2 = doc.addCylinder (ori2, vx, rmoy, nl2)
52 cyl3 = doc.addCylinder (ori3, vz, rbig, nl1)
53 cyl4 = doc.addCylinder (ori4, vx, rmoy, nl2)
55 grid1 = doc.makeCylinders (cyl1, cyl2)
56 grid2 = doc.makeCylinders (cyl4, cyl3)
68 qb = grid1. getQuadIJ (cyl_big, nx_ext, S_E, 4)
69 qh = grid2. getQuadIJ (cyl_big, nx_ext, S_E, 0)
71 vb0 = grid1.getVertexIJK (cyl_big, 2, S_E, 4) ## cible
72 vb1 = grid1.getVertexIJK (cyl_big, 2, S_NE, 4)
73 vh0 = grid2.getVertexIJK (cyl_big, 2, S_E, 0) ## depart
74 vh1 = grid2.getVertexIJK (cyl_big, 2, S_NE, 0)
79 for ny in range (S_MAXI) :
81 hliste.append (grid2.getQuadIJ (cyl_big, nx_ext, ny, 0))
84 hliste.append (grid2.getQuadIJ (cyl_big, nx_int, ny, 0))
87 doc.joinQuads (hliste, qb, vh0, vb0, vh1, vb1, hauteur)
89 doc.saveVtk ("double_t.vtk")
92 # ======================================================= test_lorraine
93 def test_lorraine () :
95 doc = hexablock.addDocument ("default")
97 ori1 = doc.addVertex ( 0, 0, 0)
98 ori2 = doc.addVertex (-5, 0, 5)
99 ori3 = doc.addVertex ( 0, 0, 12)
100 ori4 = doc.addVertex (-5, 0, 17)
102 vx = doc.addVector ( 1 ,0, 0)
103 vz = doc.addVector ( 0, 0, 1)
112 cyl1 = doc.addCylinder (ori1, vz, rmoy, nl1)
113 cyl2 = doc.addCylinder (ori2, vx, rsmall, nl2)
115 cyl3 = doc.addCylinder (ori3, vz, rmoy, nl1)
116 cyl4 = doc.addCylinder (ori4, vx, rbig, nl2)
118 grid1 = doc.makeCylinders (cyl1, cyl2)
119 grid2 = doc.makeCylinders (cyl4, cyl3)
131 qb = grid1. getQuadIJ (cyl_big, nx_ext, S_E, 4)
132 qh = grid2. getQuadIJ (cyl_small, nx_ext, S_N, 0)
134 vb0 = grid1.getVertexIJK (cyl_big, 2, S_E, 4) ## cible
135 vb1 = grid1.getVertexIJK (cyl_big, 2, S_NE, 4)
136 vh0 = grid2.getVertexIJK (cyl_small, 2, S_N, 0) ## depart
137 vh1 = grid2.getVertexIJK (cyl_small, 2, S_NW, 0)
142 for ny in range (S_MAXI) :
144 hliste.append (grid2.getQuadIJ (cyl_small, nx_ext, ny, 0))
146 for ny in range (4) :
147 hliste.append (grid2.getQuadIJ (cyl_small, nx_int, ny, 0))
150 doc.joinQuads (hliste, qb, vh0, vb0, vh1, vb1, hauteur)
152 doc.saveVtk ("lorraine.vtk")
155 # ================================================================= Begin
157 doc = test_double_t ()
159 law = doc.addLaw("Uniform", 4)
161 for j in range(doc.countPropagation()):
162 propa = doc.getPropagation(j)
165 mesh_hexas = hexablock.mesh(doc, "maillage:hexas")