-# Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
#
-# See http://www.salome-platform.org/
+# You should have received a copy of the GNU Lesser General Public
+# 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
+#
+
#==============================================================================
# Info.
# Bug (from script, bug) : hexaedre_modified.py, PAL6194, PAL7153
# Author : Kovaltchuk Alexey
# Project : PAL/SALOME
#==============================================================================
-
+#
import salome
-from salome import sg
-
import geompy
+import smesh
import math
geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
myBuilder = salome.myStudy.NewBuilder()
gg = salome.ImportComponentGUI("GEOM")
-from salome import sg
ShapeTypeCompSolid = 1
ShapeTypeSolid = 2
# -----------------------------------------------------------------------------
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"