Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/hexablock.git] / src / TEST_PY / test_unit / asso_grid.py
1 # -*- coding: latin-1 -*-
2
3 # Copyright (C) 2009-2012  CEA/DEN, EDF R&D
4 #
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License.
9 #
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 # Lesser General Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
18 #
19 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #
21
22 import os
23 import geompy
24 import hexablock
25 import math
26
27 STEP_PATH = os.path.expandvars("$HEXABLOCK_ROOT_DIR/bin/salome/crank.stp")
28
29 #==========================================================================
30
31 doc = hexablock.addDocument ("default")
32
33
34 orig1 = doc.addVertex ( 0, 0,0);
35 vz    = doc.addVector (0,0,1);
36 vx    = doc.addVector (1,0,0);
37
38 dr = 1.0
39 dl = 1.0
40 nr = 2
41 nl = 3
42 na = 8
43
44 c1 = doc.makeCylindrical (orig1, vx,vz,dr, 300, dl, nr, na, nl, False);
45
46 #====================================
47 # Definir une loi de discretisation
48 #====================================
49 law = doc.addLaw("Uniform", 4)
50
51 for j in range(doc.countPropagation()):
52     propa = doc.getPropagation(j)
53     propa.setLaw(law) 
54
55 mesh_hexas = hexablock.mesh(doc, "Grille:hexas")
56
57 print "Nombre d hexaedres:", mesh_hexas.NbHexas()
58 print "Nombre de quadrangles:", mesh_hexas.NbQuadrangles()
59 print "Nombre de segments:", mesh_hexas.NbEdges()
60 print "Nombre de noeuds:", mesh_hexas.NbNodes()
61
62