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 # ======================================================= make_grid
33 ori = doc.addVertex ( 0, 0, 0)
34 vz = doc.addVector ( 0, 0, 1)
35 vx = doc.addVector ( 1 ,0, 0)
44 grid = doc.makeCylindrical (ori, vx,vz, dr,da,dl, nr,na,nl, False)
45 doc .saveVtk ("transfo1.vtk")
48 # ======================================================= test_translation
49 def test_translation () :
51 doc = hexablock.addDocument ("default")
52 grid = make_grid (doc)
54 devant = doc.addVector (10, 0, 0)
55 grid2 = doc.performTranslation (grid, devant)
57 doc .saveVtk ("transfo2.vtk")
60 # ======================================================= test_scale
63 doc = hexablock.addDocument ("default")
64 grid = make_grid (doc)
66 dest = doc.addVertex (15, 0, 0)
67 grid2 = doc.performScale (grid, dest, 0.5)
69 doc .saveVtk ("transfo3.vtk")
72 # ======================================================= test_sym_point
73 def test_sym_point () :
75 doc = hexablock.addDocument ("default")
76 grid = make_grid (doc)
78 orig = doc.addVertex (5, 0, 0)
79 ier = doc.performSymmetryPoint (grid, orig)
81 doc .saveVtk ("transfo4.vtk")
84 # ======================================================= test_sym_line
85 def test_sym_line () :
87 doc = hexablock.addDocument ("default")
88 grid = make_grid (doc)
90 orig = doc.addVertex (5, 0, 0)
91 dir = doc.addVector (0, 0, 1);
92 ier = doc.performSymmetryLine (grid, orig, dir)
94 doc .saveVtk ("transfo5.vtk")
97 # ======================================================= test_sym_plan
98 def test_sym_plan () :
100 doc = hexablock.addDocument ("default")
101 grid = make_grid (doc)
103 orig = doc.addVertex (5, 0, 0)
104 dir = doc.addVector (1, 0, 0);
105 ier = doc.performSymmetryPlane (grid, orig, dir)
107 doc .saveVtk ("transfo6.vtk")
110 # ================================================================= Begin
112 ### doc = test_translation ()
114 ### doc = test_sym_point ()
115 ### doc = test_sym_line ()
116 ### doc = test_sym_plan ()
118 law = doc.addLaw("Uniform", 4)
120 for j in range(doc.countPropagation()):
121 propa = doc.getPropagation(j)
124 mesh_hexas = hexablock.mesh(doc, "maillage:hexas")