4 This file creates a box using GEOM then meshes the same using Gmsh's different algorithms
6 1. Delaunay ----> Gmsh_Parameters.Set3DAlgo( 0 )
7 2. Frontal Delaunay ----> Gmsh_Parameters.Set3DAlgo( 1 )
8 3. MMG3D ----> Gmsh_Parameters.Set3DAlgo( 2 )
9 4. R-Tree ----> Gmsh_Parameters.Set3DAlgo( 3 )
10 5. Parallel Delaunay(HXT) ----> Gmsh_Parameters.Set3DAlgo( 4 )
12 This file is solely for the propose of testing and we do overwrite the meshes.
18 #------------------------------------
19 # GEOM: Creating a box of size 10^3
20 #------------------------------------
22 from salome.geom import geomBuilder
24 geompy = geomBuilder.New()
25 Box_1 = geompy.MakeBoxDXDYDZ(10, 10, 10)
27 #------------------------------------
28 # SMESH: Using Gmsh algorithm with size (3,10) (min,max)
29 #------------------------------------
31 from salome.smesh import smeshBuilder
32 smesh = smeshBuilder.New()
34 Mesh_1 = smesh.Mesh(Box_1)
35 GMSH = Mesh_1.Tetrahedron(algo=smeshBuilder.GMSH)
36 Gmsh_Parameters = GMSH.Parameters()
37 Gmsh_Parameters.Set2DAlgo( 0 )
38 Gmsh_Parameters.SetMinSize( 3 )
39 Gmsh_Parameters.SetMaxSize( 10 )
40 Gmsh_Parameters.SetIs2d( 0 )
46 #-------------------------------------
47 # Test: Frontal Delaunay
48 #-------------------------------------
50 Gmsh_Parameters.Set3DAlgo( 0 )
51 isDone = Mesh_1.Compute()
53 errorMsg+= '\n ERROR: failed to mesh the box using Delaunay algorithm from Gmsh\n'
55 okMsg+= '\n PASSED: Successfully meshed the box using Delaunay algorithm from Gmsh\n'
57 errorMsg+='\n ERROR: Exception raised in Mesh computation'
59 #-------------------------------------
61 #-------------------------------------
63 Gmsh_Parameters.Set3DAlgo( 1 )
64 isDone = Mesh_1.Compute()
66 errorMsg+= '\n ERROR: failed to mesh the box using Frontal Delaunay algorithm from Gmsh\n'
68 okMsg+= '\n PASSED: Successfully meshed the box using Frontal Delaunay algorithm from Gmsh\n'
70 errorMsg+='\n ERROR: Exception raised in Mesh computation'
72 #-------------------------------------
74 #-------------------------------------
76 Gmsh_Parameters.Set3DAlgo( 2 )
77 isDone = Mesh_1.Compute()
79 errorMsg+= '\n ERROR: failed to mesh the box using MMG3D algorithm from Gmsh\n'
81 okMsg+= '\n PASSED: Successfully meshed the box using MMG3D algorithm from Gmsh\n'
83 errorMsg+='\n ERROR: Exception raised in Mesh computation'
85 #-------------------------------------
86 # Test: R-Tree Algorithm
87 #-------------------------------------
89 Gmsh_Parameters.Set3DAlgo( 3 )
90 isDone = Mesh_1.Compute()
92 errorMsg+= '\n ERROR: failed to mesh the box using R-Tree algorithm from Gmsh\n'
94 okMsg+= '\n PASSED: Successfully meshed the box using R-Tree algorithm from Gmsh\n'
96 errorMsg+='\n ERROR: Exception raised in Mesh computation'
99 #-------------------------------------
100 # Test: R-Tree Algorithm
101 #-------------------------------------
103 Gmsh_Parameters.Set3DAlgo( 4 )
104 isDone = Mesh_1.Compute()
106 errorMsg+= '\n ERROR: failed to mesh the box using Parallel Delaunay HXT algorithm from Gmsh\n'
108 okMsg+= '\n PASSED: Successfully meshed the box using Parallel Delaunay HXT algorithm from Gmsh\n'
110 errorMsg+='\n ERROR: Exception raised in Mesh computation'
112 #-------------------------------------
113 # Message that test are OK or not
114 #-------------------------------------
120 raise RuntimeError (errorMsg + "\n Test is KO.")
122 if salome.sg.hasDesktop():
123 salome.sg.updateObjBrowser()