Salome HOME
Merge branch 'V8_5_asterstudy'
[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 base = geompy.MakeSketcher("Sketcher:F 0 0:TT 10 0:TT 20 10:TT 0 10:WF", theName="F")
15 box  = geompy.MakePrismDXDYDZ( base, 0,0,10 )
16 geompy.addToStudy(box, "Box")
17
18 # get one edge of the box to put local hypothesis on
19 p5 = geompy.MakeVertex(5., 0., 0.)
20 EdgeX = geompy.GetEdgeNearPoint(box, p5)
21 geompy.addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
22
23 # create a hexahedral mesh on the box
24 hexa = smesh.Mesh(box, "Propagation of hypothesis")
25
26 # set global algorithms and hypotheses
27 algo1D = hexa.Segment()
28 hexa.Quadrangle()
29 hexa.Hexahedron()
30 algo1D.NumberOfSegments(4)
31
32 # create a sub-mesh with local 1D hypothesis and "Propagation of 1D Hypothesis"
33 algo_local = hexa.Segment(EdgeX)
34
35 # define "Arithmetic1D" hypothesis to cut an edge in several segments with increasing length
36 algo_local.Arithmetic1D(1, 4)
37
38 # define "Propagation" hypothesis that propagates "Arithmetic1D" hypothesis
39 # from 'EdgeX' on opposite sides of all quadilateral faces
40 algo_local.Propagation()
41
42 # compute the mesh which contains prisms
43 hexa.Compute()
44
45
46 # create another mesh on the box
47 mesh = smesh.Mesh(box, "Propagation of distribution of nodes")
48
49 # set global algorithms and hypotheses
50 algo1D = mesh.Segment()
51 mesh.Quadrangle()
52 mesh.Hexahedron()
53 algo1D.NumberOfSegments(4)
54
55 # create a sub-mesh with local 1D hypothesis and "Propagation of Node Distribution"
56 algo_local = mesh.Segment(EdgeX)
57 algo_local.Arithmetic1D(1, 4)
58
59 # define "Propagation Of Distribution" hypothesis that propagates
60 # distribution of nodes generated by "Arithmetic1D" hypothesis
61 # from 'EdgeX' on opposite sides of all quadilateral faces
62 algo_local.PropagationOfDistribution()
63
64 # compute the mesh which contains hexahedra only
65 mesh.Compute()