Salome HOME
0022108: EDF 2547 SMESH: Duplicate elements only
[modules/smesh.git] / doc / salome / examples / defining_hypotheses_ex08.py
1 # Propagation
2
3 import salome
4 salome.salome_init()
5 import GEOM
6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
8
9 import SMESH, SALOMEDS
10 from salome.smesh import smeshBuilder
11 smesh =  smeshBuilder.New(salome.myStudy)
12
13 # create a box
14 box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
15 geompy.addToStudy(box, "Box")
16
17 # get one edge of the box to put local hypothesis on
18 p5 = geompy.MakeVertex(5., 0., 0.)
19 EdgeX = geompy.GetEdgeNearPoint(box, p5)
20 geompy.addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
21
22 # create a hexahedral mesh on the box
23 hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
24
25 # set global algorithms and hypotheses
26 algo1D = hexa.Segment()
27 hexa.Quadrangle()
28 hexa.Hexahedron()
29 algo1D.NumberOfSegments(4)
30
31 # create a sub-mesh with local 1D hypothesis and propagation
32 algo_local = hexa.Segment(EdgeX)
33
34 # define "Arithmetic1D" hypothesis to cut an edge in several segments with increasing length
35 algo_local.Arithmetic1D(1, 4)
36
37 # define "Propagation" hypothesis that propagates all other 1D hypotheses
38 # from all edges on the opposite side of a face in case of quadrangular faces
39 algo_local.Propagation()
40
41 # compute the mesh
42 hexa.Compute()