1 # CEA/LGLS 2004, Francis KLOSS (OCC)
2 # ==================================
16 smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
17 smesh.SetCurrentStudy(salome.myStudy)
18 smeshgui = salome.ImportComponentGUI("SMESH")
19 smeshgui.Init(salome.myStudyId)
21 # Hexahedrical meshing
23 # Examples: cube2pyGibi.py, lines 270-295
24 # cube2partition.py, lines 72-83
25 # --------------------
33 # Sets algorithm and hypothesis for 1D discretization of the <shape>:
34 # - algorithm "Regular_1D"
35 # - hypothesis "NumberOfSegments" with number of segments <n>
36 # --------------------
38 def Mesh1D(self, shape, n):
39 hyp1D=smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
40 smeshgui.SetName(salome.ObjectToID(hyp1D), self.name+"/WireDiscretisation/"+str(self.cpt))
41 self.mesh.AddHypothesis(shape, hyp1D)
43 hyp=smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
44 hyp.SetNumberOfSegments(n)
45 smeshgui.SetName(salome.ObjectToID(hyp), self.name+"/Segments_"+str(n)+"/"+str(self.cpt))
46 self.mesh.AddHypothesis(shape, hyp)
52 # Creates mesh on the shape <piece>,
53 # sets GUI name of this mesh to <name>.
54 # Sets the following global algorithms and hypotheses:
55 # - for 1D discretization:
56 # - algorithm "Regular_1D"
57 # - hypothesis "NumberOfSegments" with number of segments <n>,
58 # - for 2D discretization:
59 # - algorithm "Quadrangle_2D"
60 # - for 3D discretization:
61 # - algorithm "Hexa_3D"
62 # --------------------
64 def __init__(self, piece, n, name):
68 self.mesh = smesh.CreateMesh(piece)
69 smeshgui.SetName(salome.ObjectToID(self.mesh), name)
73 hyp2D=smesh.CreateHypothesis("Quadrangle_2D", "libStdMeshersEngine.so")
74 smeshgui.SetName(salome.ObjectToID(hyp2D), name+"/Quadrangle")
75 self.mesh.AddHypothesis(piece, hyp2D)
77 hyp3D=smesh.CreateHypothesis("Hexa_3D", "libStdMeshersEngine.so")
78 smeshgui.SetName(salome.ObjectToID(hyp3D), name+"/ijk")
79 self.mesh.AddHypothesis(piece, hyp3D)
81 # Creates sub-mesh of the mesh, created by constructor.
82 # This sub-mesh will be created on edge <edge>.
83 # Set algorithm and hypothesis for 1D discretization of the <edge>:
84 # - algorithm "Regular_1D"
85 # - hypothesis "NumberOfSegments" with number of segments <n>
86 # Note: the <edge> will be automatically published in study under the shape, given in constructor.
87 # --------------------
89 def local(self, edge, n):
90 geompy.addToStudyInFather(self.piece, edge, geompy.SubShapeName(edge, self.piece))
91 submesh = self.mesh.GetSubMesh(edge, self.name+"/SubMeshEdge/"+str(self.cpt))
94 # Computes mesh, created by constructor.
95 # --------------------
98 smesh.Compute(self.mesh, self.piece)
99 salome.sg.updateObjBrowser(1)
101 MeshHexa = MeshHexaImpl