X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=test%2Fbody_fitting_quanta_sphere.py;fp=test%2Fbody_fitting_quanta_sphere.py;h=553d6f7e5de11e3fd32c0a6065960d734be50eca;hp=0000000000000000000000000000000000000000;hb=9a170f0e1e02756cc5ea83e717a69ce72732f0b9;hpb=3b570ddfbea2964cea7fe285a5722c45bf0675ee diff --git a/test/body_fitting_quanta_sphere.py b/test/body_fitting_quanta_sphere.py new file mode 100644 index 000000000..553d6f7e5 --- /dev/null +++ b/test/body_fitting_quanta_sphere.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New() + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New() + +O = geompy.MakeVertex(0, 0, 0) +OX = geompy.MakeVectorDXDYDZ(1, 0, 0) +OY = geompy.MakeVectorDXDYDZ(0, 1, 0) +OZ = geompy.MakeVectorDXDYDZ(0, 0, 1) +Sphere_1 = geompy.MakeSphereR(100) +geompy.addToStudy( O, 'O' ) +geompy.addToStudy( OX, 'OX' ) +geompy.addToStudy( OY, 'OY' ) +geompy.addToStudy( OZ, 'OZ' ) +geompy.addToStudy( Sphere_1, 'Sphere_1' ) + +Mesh_1 = smesh.Mesh(Sphere_1,'Mesh_1') +Cartesian_3D = Mesh_1.BodyFitted() +Body_Fitting_Parameters_1 = Cartesian_3D.SetGrid([ [ '34.641' ], [ 0, 1 ]],[ [ '34.641' ], [ 0, 1 ]],[ [ '34.641' ], [ 0, 1 ]],4,0) +Body_Fitting_Parameters_1.SetToUseQuanta( 1 ) +Body_Fitting_Parameters_1.SetQuanta( 0.8 ) +isDone = Mesh_1.Compute() + +Polys = Mesh_1.NbPolyhedrons() +Hexas1 = Mesh_1.NbHexas() + +#No polyhedrons in the mesh +assert(Polys==0) + +Body_Fitting_Parameters_1.SetQuanta( 0.2 ) +isDone = Mesh_1.Compute() + +Polys = Mesh_1.NbPolyhedrons() +Hexas2 = Mesh_1.NbHexas() + +#Still no polyhedrons in the mesh +assert(Polys==0) + +#Numher of hexahedrons is bigger for hexas2 becuase quanta value is smaller +assert( Hexas1 < Hexas2 ) + +if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser()