1 # Copyright (C) 2009-2020 CEA/DEN, EDF R&D
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 # ================================================ rename
23 def rename (elt, pref, indices) :
24 if elt == None : return
25 elt.setName (pref + indices)
26 # ================================================ begin
27 doc = hexablock.addDocument ("model")
32 grid = doc.makeCylinderTop (nr, na, nh)
33 for i in range (nr+1) :
35 for k in range (nh+1) :
36 name = "(%d,%d,%d)" % (i,j,k)
37 vertex = grid.getVertexIJK (i,j,k)
38 ei = grid.getEdgeI (i,j,k)
39 ej = grid.getEdgeJ (i,j,k)
40 ek = grid.getEdgeK (i,j,k)
41 rename (vertex, 'v', name)
42 rename (ei, 'ei', name)
43 rename (ej, 'ej', name)
44 rename (ek, 'ek', name)
47 doc.saveVtk ("cylinder.vtk")
49 mesh_hexas = hexablock.mesh(doc)