Salome HOME
e8655d37bdee5b8d1078cc12173d5533e106aab0
[modules/hexablock.git] / src / TEST_PY / test_unit / asso_grid.py
1 # -*- coding: latin-1 -*-
2
3 # Copyright (C) 2009-2023  CEA, EDF
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, or (at your option) any later version.
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 hexablock
24 import math
25
26 STEP_PATH = os.path.expandvars("$HEXABLOCK_ROOT_DIR/bin/salome/crank.stp")
27
28 #==========================================================================
29
30 doc = hexablock.addDocument ("default")
31
32
33 orig1 = doc.addVertex ( 0, 0,0);
34 vz    = doc.addVector (0,0,1);
35 vx    = doc.addVector (1,0,0);
36
37 dr = 1.0
38 dl = 1.0
39 nr = 2
40 nl = 3
41 na = 8
42
43 c1 = doc.makeCylindrical (orig1, vx,vz,dr, 300, dl, nr, na, nl, False);
44
45 #====================================
46 # Definir une loi de discretisation
47 #====================================
48 law = doc.addLaw("Uniform", 4)
49
50 for j in range(doc.countPropagation()):
51     propa = doc.getPropagation(j)
52     propa.setLaw(law) 
53
54 mesh_hexas = hexablock.mesh(doc, "Grille:hexas")
55
56 print("Nombre d hexaedres:", mesh_hexas.NbHexas())
57 print("Nombre de quadrangles:", mesh_hexas.NbQuadrangles())
58 print("Nombre de segments:", mesh_hexas.NbEdges())
59 print("Nombre de noeuds:", mesh_hexas.NbNodes())
60
61