4 This file creates a box using GEOM then meshes the same using Gmsh's different algorithms
6 1. Frontal Delaunay ----> Gmsh_Parameters.Set3DAlgo( 0 )
7 2. Frontal Hex ----> Gmsh_Parameters.Set3DAlgo( 1 )
8 3. MMG3D ----> Gmsh_Parameters.Set3DAlgo( 2 )
9 4. R-Tree ----> Gmsh_Parameters.Set3DAlgo( 3 )
11 This file is solely for the propose of testing and we do overwrite the meshes.
17 #------------------------------------
18 # GEOM: Creating a box of size 10^3
19 #------------------------------------
21 from salome.geom import geomBuilder
23 geompy = geomBuilder.New()
24 Box_1 = geompy.MakeBoxDXDYDZ(10, 10, 10)
26 #------------------------------------
27 # SMESH: Using Gmsh algorithm with size (3,10) (min,max)
28 #------------------------------------
30 from salome.smesh import smeshBuilder
31 smesh = smeshBuilder.New()
33 Mesh_1 = smesh.Mesh(Box_1)
34 GMSH = Mesh_1.Tetrahedron(algo=smeshBuilder.GMSH)
35 Gmsh_Parameters = GMSH.Parameters()
36 Gmsh_Parameters.Set2DAlgo( 0 )
37 Gmsh_Parameters.SetMinSize( 3 )
38 Gmsh_Parameters.SetMaxSize( 10 )
39 Gmsh_Parameters.SetIs2d( 0 )
45 #-------------------------------------
46 # Test: Frontal Delaunay
47 #-------------------------------------
49 Gmsh_Parameters.Set3DAlgo( 0 )
50 isDone = Mesh_1.Compute()
52 errorMsg+= '\n ERROR: failed to mesh the box using Frontal Delaunay algorithm from Gmsh\n'
54 okMsg+= '\n PASSED: Successfully meshed the box using Frontal Delaunay algorithm from Gmsh\n'
56 errorMsg+='\n ERROR: Exception raised in Mesh computation'
58 #-------------------------------------
60 #-------------------------------------
62 Gmsh_Parameters.Set3DAlgo( 1 )
63 isDone = Mesh_1.Compute()
65 errorMsg+= '\n ERROR: failed to mesh the box using Frontal Hex algorithm from Gmsh\n'
67 okMsg+= '\n PASSED: Successfully meshed the box using Frontal Hex algorithm from Gmsh\n'
69 errorMsg+='\n ERROR: Exception raised in Mesh computation'
71 #-------------------------------------
73 #-------------------------------------
75 Gmsh_Parameters.Set3DAlgo( 2 )
76 isDone = Mesh_1.Compute()
78 errorMsg+= '\n ERROR: failed to mesh the box using MMG3D algorithm from Gmsh\n'
80 okMsg+= '\n PASSED: Successfully meshed the box using MMG3D algorithm from Gmsh\n'
82 errorMsg+='\n ERROR: Exception raised in Mesh computation'
84 #-------------------------------------
85 # Test: R-Tree Algorithm
86 #-------------------------------------
88 Gmsh_Parameters.Set3DAlgo( 3 )
89 isDone = Mesh_1.Compute()
91 errorMsg+= '\n ERROR: failed to mesh the box using R-Tree algorithm from Gmsh\n'
93 okMsg+= '\n PASSED: Successfully meshed the box using R-Tree algorithm from Gmsh\n'
95 errorMsg+='\n ERROR: Exception raised in Mesh computation'
97 #-------------------------------------
98 # Message that test are OK or not
99 #-------------------------------------
105 raise RuntimeError (errorMsg + "\n Test is KO.")
107 if salome.sg.hasDesktop():
108 salome.sg.updateObjBrowser()