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 # ======================================================= make_grid
32 ori = doc.addVertex ( 0, 0, 0)
33 vz = doc.addVector ( 0, 0, 1)
34 vx = doc.addVector ( 1 ,0, 0)
43 grid = doc.makeCylindrical (ori, vx,vz, dr,da,dl, nr,na,nl, False)
44 doc .saveVtk ("transfo1.vtk")
47 # ======================================================= test_translation
48 def test_translation () :
50 doc = hexablock.addDocument ("default")
51 grid = make_grid (doc)
53 devant = doc.addVector (10, 0, 0)
54 grid2 = doc.performTranslation (grid, devant)
56 doc .saveVtk ("transfo2.vtk")
59 # ======================================================= test_scale
62 doc = hexablock.addDocument ("default")
63 grid = make_grid (doc)
65 dest = doc.addVertex (15, 0, 0)
66 grid2 = doc.performScale (grid, dest, 0.5)
68 doc .saveVtk ("transfo3.vtk")
71 # ======================================================= test_sym_point
72 def test_sym_point () :
74 doc = hexablock.addDocument ("default")
75 grid = make_grid (doc)
77 orig = doc.addVertex (5, 0, 0)
78 ier = doc.performSymmetryPoint (grid, orig)
80 doc .saveVtk ("transfo4.vtk")
83 # ======================================================= test_sym_line
84 def test_sym_line () :
86 doc = hexablock.addDocument ("default")
87 grid = make_grid (doc)
89 orig = doc.addVertex (5, 0, 0)
90 dir = doc.addVector (0, 0, 1);
91 ier = doc.performSymmetryLine (grid, orig, dir)
93 doc .saveVtk ("transfo5.vtk")
96 # ======================================================= test_sym_plan
97 def test_sym_plan () :
99 doc = hexablock.addDocument ("default")
100 grid = make_grid (doc)
102 orig = doc.addVertex (5, 0, 0)
103 dir = doc.addVector (1, 0, 0);
104 ier = doc.performSymmetryPlane (grid, orig, dir)
106 doc .saveVtk ("transfo6.vtk")
109 # ================================================================= Begin
111 ### doc = test_translation ()
113 ### doc = test_sym_point ()
114 ### doc = test_sym_line ()
115 ### doc = test_sym_plan ()
117 law = doc.addLaw("Uniform", 4)
119 for j in range(doc.countPropagation()):
120 propa = doc.getPropagation(j)
123 mesh_hexas = hexablock.mesh(doc, "maillage:hexas")