X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH_SWIG%2FSMESH_hexaedre.py;h=d32e9b0bd1012101f445f6c4708bd39df041be28;hb=ea772b0267fd60b9577b47c6dd5a75f3e33d0081;hp=0a058a2a01cf356b5a9868bd83708f5902b8d850;hpb=c63ee099ad2b149bd70136839c973e8910137bc5;p=modules%2Fsmesh.git diff --git a/src/SMESH_SWIG/SMESH_hexaedre.py b/src/SMESH_SWIG/SMESH_hexaedre.py index 0a058a2a0..d32e9b0bd 100755 --- a/src/SMESH_SWIG/SMESH_hexaedre.py +++ b/src/SMESH_SWIG/SMESH_hexaedre.py @@ -1,4 +1,6 @@ -# Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS # # This library is free software; you can redistribute it and/or @@ -15,7 +17,7 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # #============================================================================== # Info. @@ -24,11 +26,10 @@ # Author : Kovaltchuk Alexey # Project : PAL/SALOME #============================================================================== - +# import salome -from salome import sg - import geompy +import smesh import math @@ -37,7 +38,6 @@ import math geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM") myBuilder = salome.myStudy.NewBuilder() gg = salome.ImportComponentGUI("GEOM") -from salome import sg ShapeTypeCompSolid = 1 ShapeTypeSolid = 2 @@ -95,72 +95,67 @@ salome.sg.updateObjBrowser(1) print "-------------------------- mesh" -import SMESH -import StdMeshers -smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") -smesh.SetCurrentStudy(salome.myStudy) - -# ---- create Hypothesis -print "-------------------------- create Hypothesis" -numberOfSegments = 4 -hypNbSegA=smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so") -hypNbSegA.SetNumberOfSegments(numberOfSegments) -numberOfSegments = 10 -hypNbSegB=smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so") -hypNbSegB.SetNumberOfSegments(numberOfSegments) -numberOfSegments = 15 -hypNbSegC=smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so") -hypNbSegC.SetNumberOfSegments(numberOfSegments) - -# ---- create Algorithms -print "-------------------------- create Algorithms" -regular1D=smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so") -quad2D=smesh.CreateHypothesis("Quadrangle_2D", "libStdMeshersEngine.so") -hexa3D=smesh.CreateHypothesis("Hexa_3D", "libStdMeshersEngine.so") - # ---- init a Mesh with the geom shape shape_mesh = blob -myMesh=smesh.CreateMesh(shape_mesh) +mesh=smesh.Mesh(shape_mesh, "MeshBlob") # ---- add hypothesis and algorithms to mesh print "-------------------------- add hypothesis to mesh" -myMesh.AddHypothesis(shape_mesh,regular1D) -myMesh.AddHypothesis(shape_mesh,quad2D) -myMesh.AddHypothesis(shape_mesh,hexa3D) +algo1 = mesh.Segment() +algo2 = mesh.Quadrangle() +algo3 = mesh.Hexahedron() + +numberOfSegmentsA = 4 + +algo = mesh.Segment(aretes[0]) +algo.NumberOfSegments(numberOfSegmentsA) +algo = mesh.Segment(aretes[2]) +algo.NumberOfSegments(numberOfSegmentsA) +algo = mesh.Segment(aretes[8]) +algo.NumberOfSegments(numberOfSegmentsA) +algo = mesh.Segment(aretes[10]) +algo.NumberOfSegments(numberOfSegmentsA) + + +numberOfSegmentsC = 15 -#myMesh.AddHypothesis(shape_mesh,hypNbSeg) +algo = mesh.Segment(aretes[1]) +algo.NumberOfSegments(numberOfSegmentsC) +algo = mesh.Segment(aretes[3]) +algo.NumberOfSegments(numberOfSegmentsC) +algo = mesh.Segment(aretes[9]) +algo.NumberOfSegments(numberOfSegmentsC) +algo = mesh.Segment(aretes[11]) +algo.NumberOfSegments(numberOfSegmentsC) -myMesh.AddHypothesis(aretes[0],hypNbSegA) -myMesh.AddHypothesis(aretes[2],hypNbSegA) -myMesh.AddHypothesis(aretes[8],hypNbSegA) -myMesh.AddHypothesis(aretes[10],hypNbSegA) -myMesh.AddHypothesis(aretes[1],hypNbSegC) -myMesh.AddHypothesis(aretes[3],hypNbSegC) -myMesh.AddHypothesis(aretes[9],hypNbSegC) -myMesh.AddHypothesis(aretes[11],hypNbSegC) +numberOfSegmentsB = 10 +algo = mesh.Segment(aretes[4]) +algo.NumberOfSegments(numberOfSegmentsB) +algo = mesh.Segment(aretes[5]) +algo.NumberOfSegments(numberOfSegmentsB) +algo = mesh.Segment(aretes[6]) +algo.NumberOfSegments(numberOfSegmentsB) +algo = mesh.Segment(aretes[7]) +algo.NumberOfSegments(numberOfSegmentsB) -myMesh.AddHypothesis(aretes[4],hypNbSegB) -myMesh.AddHypothesis(aretes[5],hypNbSegB) -myMesh.AddHypothesis(aretes[6],hypNbSegB) -myMesh.AddHypothesis(aretes[7],hypNbSegB) # ---- compute mesh print "-------------------------- compute mesh" -ret=smesh.Compute(myMesh, shape_mesh) +ret=mesh.Compute() print ret if ret != 0: - #log=myMesh.GetLog(0) # no erase trace + #log=mesh.GetLog(0) # no erase trace #for linelog in log: # print linelog print "Information about the Mesh:" - print "Number of nodes : ", myMesh.NbNodes() - print "Number of edges : ", myMesh.NbEdges() - print "Number of faces : ", myMesh.NbFaces() - print "Number of quadrangles : ", myMesh.NbQuadrangles() - print "Number of volumes : ", myMesh.NbVolumes() - print "Number of hexahedrons : ", myMesh.NbHexas() + print "Number of nodes : ", mesh.NbNodes() + print "Number of edges : ", mesh.NbEdges() + print "Number of faces : ", mesh.NbFaces() + print "Number of quadrangles : ", mesh.NbQuadrangles() + print "Number of volumes : ", mesh.NbVolumes() + print "Number of hexahedrons : ", mesh.NbHexas() else: print "problem when Computing the mesh"