1 # -*- coding: latin-1 -*-
2 # Copyright (C) 2009-2013 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
28 # ================================================================= save_schema
30 def __init__ (self, doc, radical):
33 self.radical = radical
37 sauvegarde vtk du modele de bloc
40 file_name = os.path.join(self.radical + str(self.count) + '.vtk')
41 self.document.saveVtk(file_name)
43 # ================================================================= add_grid
44 def add_grid (doc, size_x, size_y, size_z) :
45 orig = doc.addVertex(0, 0, 0)
47 vx = doc.addVector (1, 0, 0)
48 vy = doc.addVector (0, 1, 0)
49 vz = doc.addVector (0, 0, 1)
50 grid = doc.makeCartesian (orig, vx, vy, vz, size_x, size_y, size_z)
53 # ========================================================== test_hexa_quads_5
54 def test_hexa_quads_5 () :
55 doc = hexablock.addDocument ("default")
56 vtk = FileVtk (doc, "HexaQuads5");
57 grid = add_grid (doc, 3, 3, 2)
60 hexa = grid.getHexaIJK (1,1,1)
72 doc.addHexa5Quads (qa, qc, qd, qe, qf);
75 doc.removeElements (grid)
78 # ========================================================== test_hexa_quads_ab
79 def test_hexa_quads_ab () :
80 doc = hexablock.addDocument ("default")
81 vtk = FileVtk (doc, "HexaQuadsAB");
82 grid = add_grid (doc, 1, 1, 3)
85 hexa = grid.getHexaIJK (0,0,1)
100 doc.addHexa2Quads (qa, qb)
103 doc.removeElements (grid)
106 # ========================================================== test_hexa_quads_ac
107 def test_hexa_quads_ac () :
108 doc = hexablock.addDocument ("default")
109 vtk = FileVtk (doc, "HexaQuadsAC");
110 grid = add_grid (doc, 2, 1, 2)
113 hexa = grid.getHexaIJK (1,0,1)
115 qa = hexa.getQuad (0)
116 qb = hexa.getQuad (1)
117 qc = hexa.getQuad (2)
118 qd = hexa.getQuad (3)
119 qe = hexa.getQuad (4)
120 qf = hexa.getQuad (5)
128 doc.addHexa2Quads (qa, qe)
131 doc.removeElements (grid)
134 # ======================================================= test_hexa_quads_acd
135 def test_hexa_quads_acd () :
137 doc = hexablock.addDocument ("default")
138 vtk = FileVtk (doc, "HexaQuadsACD");
139 grid = add_grid (doc, 3, 1, 2)
142 hexa = grid.getHexaIJK (1,0,1)
144 qa = hexa.getQuad (0)
145 qb = hexa.getQuad (1)
146 qc = hexa.getQuad (2)
147 qd = hexa.getQuad (3)
148 qe = hexa.getQuad (4)
149 qf = hexa.getQuad (5)
156 doc.addHexa3Quads (qa, qe, qf)
159 doc.removeElements (grid)
163 # ======================================================= test_hexa_quads_ace
164 def test_hexa_quads_ace () :
166 doc = hexablock.addDocument ("default")
167 vtk = FileVtk (doc, "HexaQuadsACE");
168 grid = add_grid (doc, 2, 2, 2)
171 hexa = grid.getHexaIJK (1,0,1)
173 qa = hexa.getQuad (0)
174 qb = hexa.getQuad (1)
175 qc = hexa.getQuad (2)
176 qd = hexa.getQuad (3)
177 qe = hexa.getQuad (4)
178 qf = hexa.getQuad (5)
185 doc.addHexa3Quads (qa, qd, qe)
188 doc.removeElements (grid)
191 # ======================================================= test_hexa_quads_abcd
192 def test_hexa_quads_abcd () :
194 doc = hexablock.addDocument ("default")
195 vtk = FileVtk (doc, "HexaQuadsABCD");
196 grid = add_grid (doc, 3, 1, 3)
199 hexa = grid.getHexaIJK (1,0,1)
201 qa = hexa.getQuad (0)
202 qb = hexa.getQuad (1)
203 qc = hexa.getQuad (2)
204 qd = hexa.getQuad (3)
205 qe = hexa.getQuad (4)
206 qf = hexa.getQuad (5)
212 doc.addHexa4Quads (qa, qb, qe, qf)
215 doc.removeElements (grid)
218 # ======================================================= test_hexa_quads_abce
219 def test_hexa_quads_abce () :
221 doc = hexablock.addDocument ("default")
222 vtk = FileVtk (doc, "HexaQuadsABCE");
223 grid = add_grid (doc, 3, 2, 2)
226 hexa = grid.getHexaIJK (1,0,1)
228 qa = hexa.getQuad (0)
229 qb = hexa.getQuad (1)
230 qc = hexa.getQuad (2)
231 qd = hexa.getQuad (3)
232 qe = hexa.getQuad (4)
233 qf = hexa.getQuad (5)
239 doc.addHexa4Quads (qa, qd, qe, qf)
242 doc.removeElements (grid)
246 # ================================================================= Begin
249 test_hexa_quads_ab ()
250 test_hexa_quads_ac ()
251 test_hexa_quads_acd ()
252 test_hexa_quads_ace ()
253 test_hexa_quads_abcd ()
254 test_hexa_quads_abce ()