1 # -*- coding: latin-1 -*-
2 # Copyright (C) 2009-2019 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
27 # ================================================================= save_schema
29 def __init__ (self, doc, radical):
32 self.radical = radical
36 sauvegarde vtk du modele de bloc
39 file_name = os.path.join(self.radical + str(self.count) + '.vtk')
40 self.document.saveVtk(file_name)
42 # ================================================================= add_grid
43 def add_grid (doc, size_x, size_y, size_z) :
44 orig = doc.addVertex(0, 0, 0)
46 vx = doc.addVector (1, 0, 0)
47 vy = doc.addVector (0, 1, 0)
48 vz = doc.addVector (0, 0, 1)
49 grid = doc.makeCartesian (orig, vx, vy, vz, size_x, size_y, size_z)
52 # ========================================================== test_hexa_quads_5
53 def test_hexa_quads_5 () :
54 doc = hexablock.addDocument ("default")
55 vtk = FileVtk (doc, "HexaQuads5");
56 grid = add_grid (doc, 3, 3, 2)
59 hexa = grid.getHexaIJK (1,1,1)
71 doc.addHexa5Quads (qa, qc, qd, qe, qf);
74 doc.removeElements (grid)
77 # ========================================================== test_hexa_quads_ab
78 def test_hexa_quads_ab () :
79 doc = hexablock.addDocument ("default")
80 vtk = FileVtk (doc, "HexaQuadsAB");
81 grid = add_grid (doc, 1, 1, 3)
84 hexa = grid.getHexaIJK (0,0,1)
99 doc.addHexa2Quads (qa, qb)
102 doc.removeElements (grid)
105 # ========================================================== test_hexa_quads_ac
106 def test_hexa_quads_ac () :
107 doc = hexablock.addDocument ("default")
108 vtk = FileVtk (doc, "HexaQuadsAC");
109 grid = add_grid (doc, 2, 1, 2)
112 hexa = grid.getHexaIJK (1,0,1)
114 qa = hexa.getQuad (0)
115 qb = hexa.getQuad (1)
116 qc = hexa.getQuad (2)
117 qd = hexa.getQuad (3)
118 qe = hexa.getQuad (4)
119 qf = hexa.getQuad (5)
127 doc.addHexa2Quads (qa, qe)
130 doc.removeElements (grid)
133 # ======================================================= test_hexa_quads_acd
134 def test_hexa_quads_acd () :
136 doc = hexablock.addDocument ("default")
137 vtk = FileVtk (doc, "HexaQuadsACD");
138 grid = add_grid (doc, 3, 1, 2)
141 hexa = grid.getHexaIJK (1,0,1)
143 qa = hexa.getQuad (0)
144 qb = hexa.getQuad (1)
145 qc = hexa.getQuad (2)
146 qd = hexa.getQuad (3)
147 qe = hexa.getQuad (4)
148 qf = hexa.getQuad (5)
155 doc.addHexa3Quads (qa, qe, qf)
158 doc.removeElements (grid)
162 # ======================================================= test_hexa_quads_ace
163 def test_hexa_quads_ace () :
165 doc = hexablock.addDocument ("default")
166 vtk = FileVtk (doc, "HexaQuadsACE");
167 grid = add_grid (doc, 2, 2, 2)
170 hexa = grid.getHexaIJK (1,0,1)
172 qa = hexa.getQuad (0)
173 qb = hexa.getQuad (1)
174 qc = hexa.getQuad (2)
175 qd = hexa.getQuad (3)
176 qe = hexa.getQuad (4)
177 qf = hexa.getQuad (5)
184 doc.addHexa3Quads (qa, qd, qe)
187 doc.removeElements (grid)
190 # ======================================================= test_hexa_quads_abcd
191 def test_hexa_quads_abcd () :
193 doc = hexablock.addDocument ("default")
194 vtk = FileVtk (doc, "HexaQuadsABCD");
195 grid = add_grid (doc, 3, 1, 3)
198 hexa = grid.getHexaIJK (1,0,1)
200 qa = hexa.getQuad (0)
201 qb = hexa.getQuad (1)
202 qc = hexa.getQuad (2)
203 qd = hexa.getQuad (3)
204 qe = hexa.getQuad (4)
205 qf = hexa.getQuad (5)
211 doc.addHexa4Quads (qa, qb, qe, qf)
214 doc.removeElements (grid)
217 # ======================================================= test_hexa_quads_abce
218 def test_hexa_quads_abce () :
220 doc = hexablock.addDocument ("default")
221 vtk = FileVtk (doc, "HexaQuadsABCE");
222 grid = add_grid (doc, 3, 2, 2)
225 hexa = grid.getHexaIJK (1,0,1)
227 qa = hexa.getQuad (0)
228 qb = hexa.getQuad (1)
229 qc = hexa.getQuad (2)
230 qd = hexa.getQuad (3)
231 qe = hexa.getQuad (4)
232 qf = hexa.getQuad (5)
238 doc.addHexa4Quads (qa, qd, qe, qf)
241 doc.removeElements (grid)
245 # ================================================================= Begin
248 test_hexa_quads_ab ()
249 test_hexa_quads_ac ()
250 test_hexa_quads_acd ()
251 test_hexa_quads_ace ()
252 test_hexa_quads_abcd ()
253 test_hexa_quads_abce ()