The class of algorithm has methods to set up meshing parameters.
Below you can see examples of usage of this class for hexahedral mesh generation.
23 from salome.geom
import geomBuilder
24 geompy = geomBuilder.New(salome.myStudy)
26 from salome.smesh
import smeshBuilder
27 smesh = smeshBuilder.New(salome.myStudy)
31 sphere = geompy.MakeSphereR(100.)
32 geompy.addToStudy(sphere,
"sphere")
35 mghexaMesh = smesh.Mesh(sphere,
"sphere: MG-CADSurf and MG-Hexa mesh")
38 MG_CADSurf = mghexaMesh.Triangle(algo=smeshBuilder.MG_CADSurf)
39 MG_CADSurf.SetGeometricMesh( 1 )
42 MG_Hexa = mghexaMesh.Hexahedron(algo=smeshBuilder.MG_Hexa)
48 MG_Hexa.SetMinMaxHexes(4, 8)
56 faces = geompy.SubShapeAll(sphere, geompy.ShapeType[
"FACE"])
59 MG_Hexa.SetMinMaxSize(10, 20)
60 MG_Hexa.SetSizeMap(faces[0], 10)
22 theStudy = salome.myStudy
24 from salome.geom
import geomBuilder
25 geompy = geomBuilder.New(salome.myStudy)
27 import SMESH, SALOMEDS
28 from salome.smesh
import smeshBuilder
29 smesh = smeshBuilder.New(salome.myStudy)
32 Box_1 = geompy.MakeBoxDXDYDZ(50, 50, 50)
33 geompy.addToStudy( Box_1,
'Box_1' )
36 Mesh_mghexa_vl = smesh.Mesh(Box_1,
"Mesh_mghexa_vl")
38 Regular_1D = Mesh_mghexa_vl.Segment()
39 Local_Length_1 = Regular_1D.LocalLength(8.66025,
None,1e-07)
41 MEFISTO_2D = Mesh_mghexa_vl.Triangle(algo=smeshBuilder.MEFISTO)
43 MG_Hexa = Mesh_mghexa_vl.Hexahedron(algo=smeshBuilder.MG_Hexa)
44 MG_Hexa_Parameters = MG_Hexa.Parameters()
45 MG_Hexa.SetViscousLayers(5,5,3,smeshBuilder.Inward,[13,23])
46 MG_Hexa_Parameters.SetMinSize( 2 )
47 MG_Hexa_Parameters.SetMaxSize( 4 )
48 MG_Hexa_Parameters.SetHexesMinLevel( 2 )
49 MG_Hexa_Parameters.SetHexesMaxLevel( 4 )
52 Mesh_mghexa_vl.Compute()
This example illustrates the sub-domain mode of MG-Hexa.
23 from salome.geom
import geomBuilder
24 geompy = geomBuilder.New(salome.myStudy)
26 import SMESH, SALOMEDS
27 from salome.smesh
import smeshBuilder
28 smesh = smeshBuilder.New(salome.myStudy)
32 Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
33 Sphere_1 = geompy.MakeSphereR(75)
34 Sphere_2 = geompy.MakeSphereR(25)
35 geompy.TranslateDXDYDZ(Box_1, -100, -100, -100)
36 Cut_1 = geompy.MakeCut(Sphere_1, Sphere_2)
37 Cut_2 = geompy.MakeCut(Box_1, Cut_1)
38 geompy.addToStudy( Box_1,
'Box_1' )
39 geompy.addToStudy( Sphere_1,
'Sphere_1' )
40 geompy.addToStudy( Sphere_2,
'Sphere_2' )
41 geompy.addToStudy( Cut_1,
'Cut_1' )
42 geompy.addToStudy( Cut_2,
'Cut_2' )
46 aFilter1 = smesh.GetFilter(SMESH.VOLUME,SMESH.FT_BelongToGeom,
'=',Sphere_2)
48 aFilter2 = smesh.GetFilterFromCriteria([smesh.GetCriterion(SMESH.VOLUME,SMESH.FT_BelongToGeom,
'=',Sphere_1, SMESH.FT_LogicalAND),
49 smesh.GetCriterion(SMESH.VOLUME,SMESH.FT_BelongToGeom,
'=',Sphere_2, SMESH.FT_LogicalNOT)])
51 aFilter3 = smesh.GetFilter(SMESH.VOLUME,SMESH.FT_BelongToGeom,
'=',Sphere_1, SMESH.FT_LogicalNOT)
54 print "Create mesh of Cut_2 with sd mode 1"
55 Mesh_mghexa_sd1 = smesh.Mesh(Cut_2,
"Mesh_mghexa_sd1")
58 Mesh_mghexa_sd1.Triangle(algo=smeshBuilder.MG_CADSurf).SetGeometricMesh( 1 )
64 Mesh_mghexa_sd1.Hexahedron(algo=smeshBuilder.MG_Hexa).SetMinMaxHexes(4, 8).SetHexoticSdMode( 1 )
67 g1 = Mesh_mghexa_sd1.GroupOnFilter(SMESH.VOLUME,
'small sphere', aFilter1 )
68 g1.SetColor( SALOMEDS.Color( 1, 0, 0 ))
69 g2 = Mesh_mghexa_sd1.GroupOnFilter(SMESH.VOLUME,
'big sphere - small sphere', aFilter2 )
70 g2.SetColor( SALOMEDS.Color( 0, 1, 0 ))
71 g3 = Mesh_mghexa_sd1.GroupOnFilter(SMESH.VOLUME,
'box - big sphere', aFilter3 )
72 g3.SetColor( SALOMEDS.Color( 0, 0, 1 ))
75 Mesh_mghexa_sd1.Compute()
23 from salome.geom
import geomBuilder
24 geompy = geomBuilder.New(salome.myStudy)
26 import SMESH, SALOMEDS
27 from salome.smesh
import smeshBuilder
28 smesh = smeshBuilder.New(salome.myStudy)
31 Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
32 Sphere_1 = geompy.MakeSphereR(75)
33 Sphere_2 = geompy.MakeSphereR(25)
34 geompy.TranslateDXDYDZ(Box_1, -100, -100, -100)
35 Cut_1 = geompy.MakeCut(Sphere_1, Sphere_2)
36 Cut_2 = geompy.MakeCut(Box_1, Cut_1)
37 geompy.addToStudy( Box_1,
'Box_1' )
38 geompy.addToStudy( Sphere_1,
'Sphere_1' )
39 geompy.addToStudy( Sphere_2,
'Sphere_2' )
40 geompy.addToStudy( Cut_1,
'Cut_1' )
41 geompy.addToStudy( Cut_2,
'Cut_2' )
45 aFilter1 = smesh.GetFilter(SMESH.VOLUME,SMESH.FT_BelongToGeom,
'=',Sphere_2)
47 aFilter2 = smesh.GetFilterFromCriteria([smesh.GetCriterion(SMESH.VOLUME,SMESH.FT_BelongToGeom,
'=',Sphere_1, SMESH.FT_LogicalAND),
48 smesh.GetCriterion(SMESH.VOLUME,SMESH.FT_BelongToGeom,
'=',Sphere_2, SMESH.FT_LogicalNOT)])
50 aFilter3 = smesh.GetFilter(SMESH.VOLUME,SMESH.FT_BelongToGeom,
'=',Sphere_1, SMESH.FT_LogicalNOT)
53 print "Create mesh of Cut_2 with sd mode 2"
54 Mesh_mghexa_sd2 = smesh.Mesh(Cut_2,
"Mesh_mghexa_sd2")
57 Mesh_mghexa_sd2.Triangle(algo=smeshBuilder.MG_CADSurf).SetGeometricMesh( 1 )
63 Mesh_mghexa_sd2.Hexahedron(smeshBuilder.MG_Hexa).SetMinMaxHexes(4, 8).SetHexoticSdMode( 2 )
66 g1 = Mesh_mghexa_sd2.GroupOnFilter(SMESH.VOLUME,
'small sphere', aFilter1 )
67 g1.SetColor( SALOMEDS.Color( 1, 0, 0 ))
68 g2 = Mesh_mghexa_sd2.GroupOnFilter(SMESH.VOLUME,
'big sphere - small sphere', aFilter2 )
69 g2.SetColor( SALOMEDS.Color( 0, 1, 0 ))
70 g3 = Mesh_mghexa_sd2.GroupOnFilter(SMESH.VOLUME,
'box - big sphere', aFilter3 )
71 g3.SetColor( SALOMEDS.Color( 0, 0, 1 ))
74 Mesh_mghexa_sd2.Compute()
23 from salome.geom
import geomBuilder
24 geompy = geomBuilder.New(salome.myStudy)
26 import SMESH, SALOMEDS
27 from salome.smesh
import smeshBuilder
28 smesh = smeshBuilder.New(salome.myStudy)
31 Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
32 Sphere_1 = geompy.MakeSphereR(75)
33 Sphere_2 = geompy.MakeSphereR(25)
34 geompy.TranslateDXDYDZ(Box_1, -100, -100, -100)
35 Cut_1 = geompy.MakeCut(Sphere_1, Sphere_2)
36 Cut_2 = geompy.MakeCut(Box_1, Cut_1)
37 geompy.addToStudy( Box_1,
'Box_1' )
38 geompy.addToStudy( Sphere_1,
'Sphere_1' )
39 geompy.addToStudy( Sphere_2,
'Sphere_2' )
40 geompy.addToStudy( Cut_1,
'Cut_1' )
41 geompy.addToStudy( Cut_2,
'Cut_2' )
45 aFilter1 = smesh.GetFilter(SMESH.VOLUME,SMESH.FT_BelongToGeom,
'=',Sphere_2)
47 aFilter2 = smesh.GetFilterFromCriteria([smesh.GetCriterion(SMESH.VOLUME,SMESH.FT_BelongToGeom,
'=',Sphere_1, SMESH.FT_LogicalAND),
48 smesh.GetCriterion(SMESH.VOLUME,SMESH.FT_BelongToGeom,
'=',Sphere_2, SMESH.FT_LogicalNOT)])
50 aFilter3 = smesh.GetFilter(SMESH.VOLUME,SMESH.FT_BelongToGeom,
'=',Sphere_1, SMESH.FT_LogicalNOT)
53 print "Create mesh of Cut_2 with sd mode 3"
54 Mesh_mghexa_sd3 = smesh.Mesh(Cut_2,
"Mesh_mghexa_sd3")
57 Mesh_mghexa_sd3.Triangle(algo=smeshBuilder.MG_CADSurf).SetGeometricMesh( 1 )
63 Mesh_mghexa_sd3.Hexahedron(algo=smeshBuilder.MG_Hexa).SetMinMaxHexes(4, 8).SetHexoticSdMode( 3 )
66 g1 = Mesh_mghexa_sd3.GroupOnFilter(SMESH.VOLUME,
'small sphere', aFilter1 )
67 g1.SetColor( SALOMEDS.Color( 1, 0, 0 ))
68 g2 = Mesh_mghexa_sd3.GroupOnFilter(SMESH.VOLUME,
'big sphere - small sphere', aFilter2 )
69 g2.SetColor( SALOMEDS.Color( 0, 1, 0 ))
70 g3 = Mesh_mghexa_sd3.GroupOnFilter(SMESH.VOLUME,
'box - big sphere', aFilter3 )
71 g3.SetColor( SALOMEDS.Color( 0, 0, 1 ))
74 Mesh_mghexa_sd3.Compute()
23 from salome.geom
import geomBuilder
24 geompy = geomBuilder.New(salome.myStudy)
26 from salome.smesh
import smeshBuilder
27 smesh = smeshBuilder.New(salome.myStudy)
30 Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
31 Translation_1 = geompy.MakeTranslation(Box_1, 0, 200, 0)
32 Partition_1 = geompy.MakePartition([Box_1, Translation_1])
33 geompy.addToStudy( Box_1,
'Box_1' )
34 geompy.addToStudy( Translation_1,
'Translation_1' )
35 geompy.addToStudy( Partition_1,
'Partition_1' )
38 Mesh_mghexa_sd4 = smesh.Mesh(Partition_1,
"Mesh_mghexa_sd4")
39 Mesh_mghexa_sd4.Triangle(smeshBuilder.MG_CADSurf)
40 Mesh_mghexa_sd4.Hexahedron(smeshBuilder.MG_Hexa).SetMinMaxHexes(4, 8).SetHexoticSdMode( 4 )
43 Mesh_mghexa_sd4.Compute()