Salome HOME
Join modifications from branch OCC_debug_for_3_2_0b1
[modules/smesh.git] / src / SMESH_SWIG / SMESH_fixation_netgen.py
1 #  Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 #
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.
8 #
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.
13 #
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
17 #
18 #  See http://www.salome-platform.org/
19 #
20 #
21 # Tetrahedrization of the geometry generated by the Python script
22 # SMESH_fixation.py
23 # The new Netgen algorithm is used that discretizes baoundaries itself
24 #
25
26 import StdMeshers
27 import NETGENPlugin
28 import SMESH_fixation
29 import smesh
30
31 compshell = SMESH_fixation.compshell
32 idcomp = SMESH_fixation.idcomp
33 geompy = SMESH_fixation.geompy
34 salome = SMESH_fixation.salome
35
36 print "Analysis of the geometry to be meshed :"
37 subShellList = geompy.SubShapeAll(compshell, geompy.ShapeType["SHELL"])
38 subFaceList  = geompy.SubShapeAll(compshell, geompy.ShapeType["FACE"])
39 subEdgeList  = geompy.SubShapeAll(compshell, geompy.ShapeType["EDGE"])
40
41 print "number of Shells in compshell : ", len(subShellList)
42 print "number of Faces  in compshell : ", len(subFaceList)
43 print "number of Edges  in compshell : ", len(subEdgeList)
44
45 status = geompy.CheckShape(compshell)
46 print " check status ", status
47
48 ### ---------------------------- SMESH --------------------------------------
49
50 print "-------------------------- create Mesh, algorithm, hypothesis"
51
52 mesh = smesh.Mesh(compshell, "MeshcompShel");
53 netgen = mesh.Netgen(1)
54 hyp = netgen.Parameters()
55 hyp.SetMaxSize( 50 )
56 #hyp.SetSecondOrder( 0 )
57 hyp.SetFineness( 3 )
58 #hyp.SetOptimize( 1 )
59
60 salome.sg.updateObjBrowser(1)
61
62 print "-------------------------- compute mesh"
63 ret = mesh.Compute()
64 print ret
65 if ret != 0:
66     print "Information about the MeshcompShel:"
67     print "Number of nodes        : ", mesh.GetMesh().NbNodes()
68     print "Number of edges        : ", mesh.GetMesh().NbEdges()
69     print "Number of faces        : ", mesh.GetMesh().NbFaces()
70     print "Number of triangles    : ", mesh.GetMesh().NbTriangles()
71     print "Number of volumes      : ", mesh.GetMesh().NbVolumes()
72     print "Number of tetrahedrons : ", mesh.GetMesh().NbTetras()
73     
74 else:
75     print "problem when computing the mesh"