Salome HOME
Update copyright information
[modules/smesh.git] / src / SMESH_SWIG / SMESH_fixation_netgen.py
1 #  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 #  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 #
6 #  This library is free software; you can redistribute it and/or
7 #  modify it under the terms of the GNU Lesser General Public
8 #  License as published by the Free Software Foundation; either
9 #  version 2.1 of the License.
10 #
11 #  This library is distributed in the hope that it will be useful,
12 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 #  Lesser General Public License for more details.
15 #
16 #  You should have received a copy of the GNU Lesser General Public
17 #  License along with this library; if not, write to the Free Software
18 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 #
20 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #
22 # Tetrahedrization of the geometry generated by the Python script
23 # SMESH_fixation.py
24 # The new Netgen algorithm is used that discretizes baoundaries itself
25 #
26 import SMESH_fixation
27 import smesh
28
29 compshell = SMESH_fixation.compshell
30 idcomp = SMESH_fixation.idcomp
31 geompy = SMESH_fixation.geompy
32 salome = SMESH_fixation.salome
33
34 print "Analysis of the geometry to be meshed :"
35 subShellList = geompy.SubShapeAll(compshell, geompy.ShapeType["SHELL"])
36 subFaceList  = geompy.SubShapeAll(compshell, geompy.ShapeType["FACE"])
37 subEdgeList  = geompy.SubShapeAll(compshell, geompy.ShapeType["EDGE"])
38
39 print "number of Shells in compshell : ", len(subShellList)
40 print "number of Faces  in compshell : ", len(subFaceList)
41 print "number of Edges  in compshell : ", len(subEdgeList)
42
43 status = geompy.CheckShape(compshell)
44 print " check status ", status
45
46 ### ---------------------------- SMESH --------------------------------------
47
48 print "-------------------------- create Mesh, algorithm, hypothesis"
49
50 mesh = smesh.Mesh(compshell, "MeshcompShel");
51 netgen = mesh.Tetrahedron(smesh.FULL_NETGEN)
52 netgen.SetMaxSize( 50 )
53 #netgen.SetSecondOrder( 0 )
54 netgen.SetFineness( smesh.Fine )
55 #netgen.SetOptimize( 1 )
56
57 salome.sg.updateObjBrowser(1)
58
59 print "-------------------------- compute mesh"
60 ret = mesh.Compute()
61 print ret
62 if ret != 0:
63     print "Information about the MeshcompShel:"
64     print "Number of nodes        : ", mesh.GetMesh().NbNodes()
65     print "Number of edges        : ", mesh.GetMesh().NbEdges()
66     print "Number of faces        : ", mesh.GetMesh().NbFaces()
67     print "Number of triangles    : ", mesh.GetMesh().NbTriangles()
68     print "Number of volumes      : ", mesh.GetMesh().NbVolumes()
69     print "Number of tetrahedrons : ", mesh.GetMesh().NbTetras()
70     
71 else:
72     print "problem when computing the mesh"