1 # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 # Tetrahedrization of a simple box. Hypothesis and algorithms for
23 # the mesh generation are global
32 box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
34 idbox = geompy.addToStudy(box, "box")
36 print "Analysis of the geometry box :"
37 subShellList = geompy.SubShapeAll(box, geompy.ShapeType["SHELL"])
38 subFaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
39 subEdgeList = geompy.SubShapeAll(box, geompy.ShapeType["EDGE"])
41 print "number of Shells in box : ", len(subShellList)
42 print "number of Faces in box : ", len(subFaceList)
43 print "number of Edges in box : ", len(subEdgeList)
46 ### ---------------------------- SMESH --------------------------------------
48 # ---- init a Mesh with the boxe
50 mesh = smesh.Mesh(box, "MeshBox")
52 # ---- set Hypothesis and Algorithm
54 print "-------------------------- NumberOfSegments"
57 regular1D = mesh.Segment()
58 hypNbSeg = regular1D.NumberOfSegments(numberOfSegments)
59 print hypNbSeg.GetName()
60 print hypNbSeg.GetId()
61 print hypNbSeg.GetNumberOfSegments()
62 smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments))
64 print "-------------------------- MaxElementArea"
68 mefisto2D = mesh.Triangle()
69 hypArea = mefisto2D.MaxElementArea(maxElementArea)
70 print hypArea.GetName()
72 print hypArea.GetMaxElementArea()
73 smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea))
75 print "-------------------------- MaxElementVolume"
77 maxElementVolume = 500
79 netgen3D = mesh.Tetrahedron(smesh.NETGEN)
80 hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
81 print hypVolume.GetName()
82 print hypVolume.GetId()
83 print hypVolume.GetMaxElementVolume()
84 smesh.SetName(hypVolume, "MaxElementVolume_" + str(maxElementVolume))
86 salome.sg.updateObjBrowser(1)
88 print "-------------------------- compute the mesh of the boxe"
92 log = mesh.GetLog(0) # no erase trace
95 print "Information about the MeshBox:"
96 print "Number of nodes : ", mesh.NbNodes()
97 print "Number of edges : ", mesh.NbEdges()
98 print "Number of faces : ", mesh.NbFaces()
99 print "Number of triangles : ", mesh.NbTriangles()
100 print "Number of volumes : ", mesh.NbVolumes()
101 print "Number of tetrahedrons: ", mesh.NbTetras()
103 print "probleme when computing the mesh"