Back to index

salome-smesh  6.5.0
SMESH_fixation_netgen.py
Go to the documentation of this file.
00001 #  -*- coding: iso-8859-1 -*-
00002 # Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00003 #
00004 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00005 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00006 #
00007 # This library is free software; you can redistribute it and/or
00008 # modify it under the terms of the GNU Lesser General Public
00009 # License as published by the Free Software Foundation; either
00010 # version 2.1 of the License.
00011 #
00012 # This library is distributed in the hope that it will be useful,
00013 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 # Lesser General Public License for more details.
00016 #
00017 # You should have received a copy of the GNU Lesser General Public
00018 # License along with this library; if not, write to the Free Software
00019 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00020 #
00021 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00022 #
00023 
00024 # Tetrahedrization of the geometry generated by the Python script
00025 # SMESH_fixation.py
00026 # The new Netgen algorithm is used that discretizes baoundaries itself
00027 #
00028 import SMESH_fixation
00029 import smesh
00030 
00031 compshell = SMESH_fixation.compshell
00032 idcomp = SMESH_fixation.idcomp
00033 geompy = SMESH_fixation.geompy
00034 salome = SMESH_fixation.salome
00035 
00036 print "Analysis of the geometry to be meshed :"
00037 subShellList = geompy.SubShapeAll(compshell, geompy.ShapeType["SHELL"])
00038 subFaceList  = geompy.SubShapeAll(compshell, geompy.ShapeType["FACE"])
00039 subEdgeList  = geompy.SubShapeAll(compshell, geompy.ShapeType["EDGE"])
00040 
00041 print "number of Shells in compshell : ", len(subShellList)
00042 print "number of Faces  in compshell : ", len(subFaceList)
00043 print "number of Edges  in compshell : ", len(subEdgeList)
00044 
00045 status = geompy.CheckShape(compshell)
00046 print " check status ", status
00047 
00048 ### ---------------------------- SMESH --------------------------------------
00049 smesh.SetCurrentStudy(salome.myStudy)
00050 
00051 print "-------------------------- create Mesh, algorithm, hypothesis"
00052 
00053 mesh = smesh.Mesh(compshell, "MeshcompShel");
00054 netgen = mesh.Tetrahedron(smesh.FULL_NETGEN)
00055 netgen.SetMaxSize( 50 )
00056 #netgen.SetSecondOrder( 0 )
00057 netgen.SetFineness( smesh.Fine )
00058 #netgen.SetOptimize( 1 )
00059 
00060 salome.sg.updateObjBrowser(1)
00061 
00062 print "-------------------------- compute mesh"
00063 ret = mesh.Compute()
00064 print ret
00065 if ret != 0:
00066     print "Information about the MeshcompShel:"
00067     print "Number of nodes        : ", mesh.GetMesh().NbNodes()
00068     print "Number of edges        : ", mesh.GetMesh().NbEdges()
00069     print "Number of faces        : ", mesh.GetMesh().NbFaces()
00070     print "Number of triangles    : ", mesh.GetMesh().NbTriangles()
00071     print "Number of volumes      : ", mesh.GetMesh().NbVolumes()
00072     print "Number of tetrahedrons : ", mesh.GetMesh().NbTetras()
00073     
00074 else:
00075     print "problem when computing the mesh"