1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
4 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
5 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License.
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 # Tetrahedrization of the geometry generated by the Python script
26 # Hypothesis and algorithms for the mesh generation are global
31 compshell = SMESH_fixation.compshell
32 idcomp = SMESH_fixation.idcomp
33 geompy = SMESH_fixation.geompy
34 salome = SMESH_fixation.salome
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"])
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)
45 status = geompy.CheckShape(compshell)
46 print " check status ", status
48 ### ---------------------------- SMESH --------------------------------------
49 smesh.SetCurrentStudy(salome.myStudy)
51 # ---- init a Mesh with the compshell
53 mesh = smesh.Mesh(compshell, "MeshcompShell")
56 # ---- set Hypothesis and Algorithm
58 print "-------------------------- NumberOfSegments"
62 regular1D = mesh.Segment()
63 regular1D.SetName("Wire Discretisation")
64 hypNbSeg = regular1D.NumberOfSegments(numberOfSegments)
65 print hypNbSeg.GetName()
66 print hypNbSeg.GetId()
67 print hypNbSeg.GetNumberOfSegments()
68 smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments))
70 ## print "-------------------------- MaxElementArea"
72 ## maxElementArea = 80
74 ## mefisto2D = mesh.Triangle()
75 ## mefisto2D.SetName("MEFISTO_2D")
76 ## hypArea = mefisto2D.MaxElementArea(maxElementArea)
77 ## print hypArea.GetName()
78 ## print hypArea.GetId()
79 ## print hypArea.GetMaxElementArea()
80 ## smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea))
82 print "-------------------------- LengthFromEdges"
84 mefisto2D = mesh.Triangle()
85 mefisto2D.SetName("MEFISTO_2D")
86 hypLengthFromEdges = mefisto2D.LengthFromEdges()
87 print hypLengthFromEdges.GetName()
88 print hypLengthFromEdges.GetId()
89 smesh.SetName(hypLengthFromEdges, "LengthFromEdges")
92 print "-------------------------- MaxElementVolume"
94 maxElementVolume = 1000
96 netgen3D = mesh.Tetrahedron(smesh.NETGEN)
97 netgen3D.SetName("NETGEN_3D")
98 hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
99 print hypVolume.GetName()
100 print hypVolume.GetId()
101 print hypVolume.GetMaxElementVolume()
102 smesh.SetName(hypVolume, "MaxElementVolume_" + str(maxElementVolume))
105 salome.sg.updateObjBrowser(1)
107 print "-------------------------- compute compshell"
108 ret = mesh.Compute(mesh)
111 log = mesh.GetLog(0) # no erase trace
114 print "Information about the MeshcompShel:"
115 print "Number of nodes : ", mesh.NbNodes()
116 print "Number of edges : ", mesh.NbEdges()
117 print "Number of faces : ", mesh.NbFaces()
118 print "Number of triangles : ", mesh.NbTriangles()
119 print "Number of volumes : ", mesh.NbVolumes()
120 print "Number of tetrahedrons : ", mesh.NbTetras()
123 print "problem when computing the mesh"