1 # Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
18 # See http://www.salome-platform.org/
21 # Hexahedrization of the geometry generated by the Python script
23 # Hypothesis and algorithms for the mesh generation are global
30 compshell = SMESH_fixation.compshell
31 idcomp = SMESH_fixation.idcomp
32 geompy = SMESH_fixation.geompy
33 salome = SMESH_fixation.salome
35 print "Analysis of the geometry to be meshed :"
36 subShellList = geompy.SubShapeAll(compshell, geompy.ShapeType["SHELL"])
37 subFaceList = geompy.SubShapeAll(compshell, geompy.ShapeType["FACE"])
38 subEdgeList = geompy.SubShapeAll(compshell, geompy.ShapeType["EDGE"])
40 print "number of Shells in compshell : ", len(subShellList)
41 print "number of Faces in compshell : ", len(subFaceList)
42 print "number of Edges in compshell : ", len(subEdgeList)
44 status = geompy.CheckShape(compshell)
45 print " check status ", status
47 ### ---------------------------- SMESH --------------------------------------
48 smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
50 smeshgui = salome.ImportComponentGUI("SMESH")
51 smeshgui.Init(salome.myStudyId)
53 print "-------------------------- create Hypothesis"
55 print "-------------------------- NumberOfSegments"
59 hypNbSeg = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
60 hypNbSeg.SetNumberOfSegments(numberOfSegments)
62 print hypNbSeg.GetName()
63 print hypNbSeg.GetId()
64 print hypNbSeg.GetNumberOfSegments()
66 smeshgui.SetName(salome.ObjectToID(hypNbSeg), "NumberOfSegments_5")
68 print "-------------------------- create Algorithms"
70 print "-------------------------- Regular_1D"
72 regular1D = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
74 smeshgui.SetName(salome.ObjectToID(regular1D), "Wire Discretisation")
76 print "-------------------------- Quadrangle_2D"
78 quad2D = smesh.CreateHypothesis("Quadrangle_2D", "libStdMeshersEngine.so")
80 smeshgui.SetName(salome.ObjectToID(quad2D), "Quadrangle_2D")
82 print "-------------------------- Hexa_3D"
84 hexa3D = smesh.CreateHypothesis("Hexa_3D", "libStdMeshersEngine.so")
86 smeshgui.SetName(salome.ObjectToID(hexa3D), "Hexa_3D")
88 # ---- init a Mesh with the compshell
89 shape_mesh = salome.IDToObject( idcomp )
91 mesh = smesh.CreateMesh(shape_mesh)
92 smeshgui.SetName(salome.ObjectToID(mesh), "MeshCompShell")
95 print "-------------------------- add hypothesis to compshell"
97 mesh.AddHypothesis(shape_mesh,regular1D)
98 mesh.AddHypothesis(shape_mesh,hypNbSeg)
100 mesh.AddHypothesis(shape_mesh,quad2D)
101 mesh.AddHypothesis(shape_mesh,hexa3D)
103 salome.sg.updateObjBrowser(1)
105 print "-------------------------- compute compshell"
106 ret = smesh.Compute(mesh, shape_mesh)
109 log = mesh.GetLog(0) # no erase trace
112 print "Information about the MeshcompShel:"
113 print "Number of nodes : ", mesh.NbNodes()
114 print "Number of edges : ", mesh.NbEdges()
115 print "Number of faces : ", mesh.NbFaces()
116 print "Number of quadrangles : ", mesh.NbQuadrangles()
117 print "Number of volumes : ", mesh.NbVolumes()
118 print "Number of hexahedrons : ", mesh.NbHexas()
120 print "problem when Computing the mesh"