Salome HOME
Correction for parallel mesh
[modules/smesh.git] / test / body_fitting_quanta_sphere.py
1 #!/usr/bin/env python
2
3 import salome
4 salome.salome_init()
5 import GEOM
6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New()
8
9 import SMESH, SALOMEDS
10 from salome.smesh import smeshBuilder
11 smesh =  smeshBuilder.New()
12
13 O = geompy.MakeVertex(0, 0, 0)
14 OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
15 OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
16 OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
17 Sphere_1 = geompy.MakeSphereR(100)
18 geompy.addToStudy( O, 'O' )
19 geompy.addToStudy( OX, 'OX' )
20 geompy.addToStudy( OY, 'OY' )
21 geompy.addToStudy( OZ, 'OZ' )
22 geompy.addToStudy( Sphere_1, 'Sphere_1' )
23
24 Mesh_1 = smesh.Mesh(Sphere_1,'Mesh_1')
25 Cartesian_3D = Mesh_1.BodyFitted()
26 Body_Fitting_Parameters_1 = Cartesian_3D.SetGrid([ [ '34.641' ], [ 0, 1 ]],[ [ '34.641' ], [ 0, 1 ]],[ [ '34.641' ], [ 0, 1 ]],4,0)
27 Body_Fitting_Parameters_1.SetToUseQuanta( 1 )
28 Body_Fitting_Parameters_1.SetQuanta( 0.8 )
29 isDone = Mesh_1.Compute()
30
31 Polys   = Mesh_1.NbPolyhedrons()
32 Hexas1  = Mesh_1.NbHexas()
33
34 #No polyhedrons in the mesh
35 assert(Polys==0)
36
37 Body_Fitting_Parameters_1.SetQuanta( 0.2 )
38 isDone = Mesh_1.Compute()
39
40 Polys   = Mesh_1.NbPolyhedrons()
41 Hexas2  = Mesh_1.NbHexas()
42
43 #Still no polyhedrons in the mesh
44 assert(Polys==0)
45
46 #Numher of hexahedrons is bigger for hexas2 becuase quanta value is smaller
47 assert( Hexas1 < Hexas2 )
48
49 if salome.sg.hasDesktop():
50   salome.sg.updateObjBrowser()