1 # Change priority of sub-meshes in Mesh
6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New()
10 from salome.smesh import smeshBuilder
11 smesh = smeshBuilder.New()
13 Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
14 [Face_1,Face_2,Face_3,Face_4,Face_5,Face_6] = geompy.SubShapeAllSorted(Box_1, geompy.ShapeType["FACE"])
16 # create Mesh object on Box shape
17 Mesh_1 = smesh.Mesh(Box_1)
19 # assign mesh algorithms and hypotheses
20 Regular_1D = Mesh_1.Segment()
21 Nb_Segments_1 = Regular_1D.NumberOfSegments(20)
22 MEFISTO_2D = Mesh_1.Triangle()
23 Max_Element_Area_1 = MEFISTO_2D.MaxElementArea(1200)
24 Tetrahedron = Mesh_1.Tetrahedron()
25 Max_Element_Volume_1 = Tetrahedron.MaxElementVolume(40000)
27 # create sub-mesh and assign algorithms on Face_1
28 Regular_1D_1 = Mesh_1.Segment(geom=Face_1)
29 Nb_Segments_2 = Regular_1D_1.NumberOfSegments(4)
30 MEFISTO_2D_1 = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO,geom=Face_1)
31 SubMesh_1 = MEFISTO_2D_1.GetSubMesh()
33 # create sub-mesh and assign algorithms on Face_2
34 Regular_1D_2 = Mesh_1.Segment(geom=Face_2)
35 Nb_Segments_3 = Regular_1D_2.NumberOfSegments(8)
36 MEFISTO_2D_2 = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO,geom=Face_2)
37 SubMesh_2 = MEFISTO_2D_2.GetSubMesh()
39 # create sub-mesh and assign algorithms on Face_3
40 Regular_1D_3 = Mesh_1.Segment(geom=Face_3)
41 Nb_Segments_4 = Regular_1D_3.NumberOfSegments(12)
42 MEFISTO_2D_3 = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO,geom=Face_3)
43 SubMesh_3 = MEFISTO_2D_3.GetSubMesh()
45 # check existing sub-mesh priority order
46 [ [ SubMesh_1, SubMesh_3, SubMesh_2 ] ] = Mesh_1.GetMeshOrder()
47 isDone = Mesh_1.Compute()
48 print("Nb elements at initial order of sub-meshes:", Mesh_1.NbElements())
50 # set new sub-mesh order
51 isDone = Mesh_1.SetMeshOrder( [ [ SubMesh_1, SubMesh_2, SubMesh_3 ] ])
53 isDone = Mesh_1.Compute()
54 print("Nb elements at new order of sub-meshes:", Mesh_1.NbElements())
56 # compute with other sub-mesh order
57 isDone = Mesh_1.SetMeshOrder( [ [ SubMesh_2, SubMesh_1, SubMesh_3 ] ])
58 isDone = Mesh_1.Compute()
59 print("Nb elements at another order of sub-meshes:", Mesh_1.NbElements())