1 # -*- coding: latin-1 -*-
2 # Copyright (C) 2009-2012 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.
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
27 #---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
30 # ======================================================= test_double_t
31 def test_double_t () :
33 doc = hexablock.addDocument ("default")
35 ori1 = doc.addVertex ( 0, 0, 0)
36 ori2 = doc.addVertex (-5, 0, 5)
37 ori3 = doc.addVertex ( 0, 0, 12)
38 ori4 = doc.addVertex (-5, 0, 17)
40 vx = doc.addVector ( 1 ,0, 0)
41 vz = doc.addVector ( 0, 0, 1)
50 cyl1 = doc.addCylinder (ori1, vz, rbig, nl1)
51 cyl2 = doc.addCylinder (ori2, vx, rmoy, nl2)
53 cyl3 = doc.addCylinder (ori3, vz, rbig, nl1)
54 cyl4 = doc.addCylinder (ori4, vx, rmoy, nl2)
56 grid1 = doc.makeCylinders (cyl1, cyl2)
57 grid2 = doc.makeCylinders (cyl4, cyl3)
69 qb = grid1. getQuadIJ (cyl_big, nx_ext, S_E, 4)
70 qh = grid2. getQuadIJ (cyl_big, nx_ext, S_E, 0)
72 vb0 = grid1.getVertexIJK (cyl_big, 2, S_E, 4) ## cible
73 vb1 = grid1.getVertexIJK (cyl_big, 2, S_NE, 4)
74 vh0 = grid2.getVertexIJK (cyl_big, 2, S_E, 0) ## depart
75 vh1 = grid2.getVertexIJK (cyl_big, 2, S_NE, 0)
80 for ny in range (S_MAXI) :
82 hliste.append (grid2.getQuadIJ (cyl_big, nx_ext, ny, 0))
85 hliste.append (grid2.getQuadIJ (cyl_big, nx_int, ny, 0))
88 doc.joinQuads (hliste, qb, vh0, vb0, vh1, vb1, hauteur)
90 doc.saveVtk ("double_t.vtk")
93 # ======================================================= test_lorraine
94 def test_lorraine () :
96 doc = hexablock.addDocument ("default")
98 ori1 = doc.addVertex ( 0, 0, 0)
99 ori2 = doc.addVertex (-5, 0, 5)
100 ori3 = doc.addVertex ( 0, 0, 12)
101 ori4 = doc.addVertex (-5, 0, 17)
103 vx = doc.addVector ( 1 ,0, 0)
104 vz = doc.addVector ( 0, 0, 1)
113 cyl1 = doc.addCylinder (ori1, vz, rmoy, nl1)
114 cyl2 = doc.addCylinder (ori2, vx, rsmall, nl2)
116 cyl3 = doc.addCylinder (ori3, vz, rmoy, nl1)
117 cyl4 = doc.addCylinder (ori4, vx, rbig, nl2)
119 grid1 = doc.makeCylinders (cyl1, cyl2)
120 grid2 = doc.makeCylinders (cyl4, cyl3)
132 qb = grid1. getQuadIJ (cyl_big, nx_ext, S_E, 4)
133 qh = grid2. getQuadIJ (cyl_small, nx_ext, S_N, 0)
135 vb0 = grid1.getVertexIJK (cyl_big, 2, S_E, 4) ## cible
136 vb1 = grid1.getVertexIJK (cyl_big, 2, S_NE, 4)
137 vh0 = grid2.getVertexIJK (cyl_small, 2, S_N, 0) ## depart
138 vh1 = grid2.getVertexIJK (cyl_small, 2, S_NW, 0)
143 for ny in range (S_MAXI) :
145 hliste.append (grid2.getQuadIJ (cyl_small, nx_ext, ny, 0))
147 for ny in range (4) :
148 hliste.append (grid2.getQuadIJ (cyl_small, nx_int, ny, 0))
151 doc.joinQuads (hliste, qb, vh0, vb0, vh1, vb1, hauteur)
153 doc.saveVtk ("lorraine.vtk")
156 # ================================================================= Begin
158 doc = test_double_t ()
160 law = doc.addLaw("Uniform", 4)
162 for j in range(doc.countPropagation()):
163 propa = doc.getPropagation(j)
166 mesh_hexas = hexablock.mesh(doc, "maillage:hexas")