From 1aed2f5d07405aea21231a9d0245cdbe35fd51f3 Mon Sep 17 00:00:00 2001 From: vsr Date: Wed, 13 Feb 2013 14:13:20 +0000 Subject: [PATCH] Fix bugs in unitary tests --- .../examples/transforming_meshes_ex11.py | 46 +++++++++++-------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/doc/salome/examples/transforming_meshes_ex11.py b/doc/salome/examples/transforming_meshes_ex11.py index 55fbe8f28..f94aafeda 100644 --- a/doc/salome/examples/transforming_meshes_ex11.py +++ b/doc/salome/examples/transforming_meshes_ex11.py @@ -1,10 +1,18 @@ # Duplicate nodes import salome +import geompy import smesh -import SMESH_test1 -mesh = SMESH_test1.mesh +# Create a box + +box = geompy.MakeBox(0., 0., 0., 100., 200., 300.) + +# Define hexa mesh on a box +mesh = smesh.Mesh(box, "Mesh") +mesh.Segment().NumberOfSegments(7) +mesh.Quadrangle() +mesh.Hexahedron() # Compute mesh mesh.Compute() @@ -13,53 +21,53 @@ mesh.Compute() # Nodes to duplicate nodes1 = mesh.CreateEmptyGroup( smesh.NODE, 'nodes1' ) -nodes1.Add( [ 289, 278, 302, 285 ] ) +nodes1.Add( [ 119, 125, 131, 137 ] ) # Group of faces to replace nodes with new ones faces1 = mesh.CreateEmptyGroup( smesh.FACE, 'faces1' ) -faces1.Add( [ 519, 556, 557 ] ) +faces1.Add( [ 144, 151, 158 ] ) # Duplicate nodes print "\nMesh before the first nodes duplication:" -print "Nodes : ", mesh.NbNodes() -print "Edges : ", mesh.NbEdges() -print "Triangles : ", mesh.NbTriangles() +print "Nodes : ", mesh.NbNodes() +print "Edges : ", mesh.NbEdges() +print "Quadrangles : ", mesh.NbQuadrangles() groupOfCreatedNodes = mesh.DoubleNodeGroup(nodes1, faces1, theMakeGroup=True) print "New nodes:", groupOfCreatedNodes.GetIDs() print "\nMesh after the first nodes duplication:" -print "Nodes : ", mesh.NbNodes() -print "Edges : ", mesh.NbEdges() -print "Triangles : ", mesh.NbTriangles() +print "Nodes : ", mesh.NbNodes() +print "Edges : ", mesh.NbEdges() +print "Quadrangles : ", mesh.NbQuadrangles() # With the duplication of border elements # Edges to duplicate edges = mesh.CreateEmptyGroup( smesh.EDGE, 'edges' ) -edges.Add( [ 29, 30, 31 ] ) +edges.Add( [ 32, 33, 34 ] ) # Nodes not to duplicate nodes2 = mesh.CreateEmptyGroup( smesh.NODE, 'nodes2' ) -nodes2.Add( [ 32, 5 ] ) +nodes2.Add( [ 35, 38 ] ) # Group of faces to replace nodes with new ones faces2 = mesh.CreateEmptyGroup( smesh.FACE, 'faces2' ) -faces2.Add( [ 576, 578, 580 ] ) +faces2.Add( [ 141, 148, 155 ] ) # Duplicate nodes print "\nMesh before the second nodes duplication:" -print "Nodes : ", mesh.NbNodes() -print "Edges : ", mesh.NbEdges() -print "Triangles : ", mesh.NbTriangles() +print "Nodes : ", mesh.NbNodes() +print "Edges : ", mesh.NbEdges() +print "Quadrangles : ", mesh.NbQuadrangles() groupOfNewEdges = mesh.DoubleNodeElemGroup( edges, nodes2, faces2, theMakeGroup=True ) print "New edges:", groupOfNewEdges.GetIDs() print "\nMesh after the second nodes duplication:" -print "Nodes : ", mesh.NbNodes() -print "Edges : ", mesh.NbEdges() -print "Triangles : ", mesh.NbTriangles() +print "Nodes : ", mesh.NbNodes() +print "Edges : ", mesh.NbEdges() +print "Quadrangles : ", mesh.NbQuadrangles() # Update object browser if salome.sg.hasDesktop(): -- 2.39.2