Salome HOME
bos #29171 Refactor testing procedure
[modules/smesh.git] / doc / examples / defining_hypotheses_ex08.py
1 # Propagation
2
3 import salome
4 salome.salome_init_without_session()
5
6 from salome.geom import geomBuilder
7 from salome.smesh import smeshBuilder
8
9 geom_builder = geomBuilder.New()
10 smesh_builder = smeshBuilder.New()
11
12 # create a box
13 base = geom_builder.MakeSketcher("Sketcher:F 0 0:TT 10 0:TT 20 10:TT 0 10:WF", theName="F")
14 box  = geom_builder.MakePrismDXDYDZ( base, 0,0,10 )
15 geom_builder.addToStudy(box, "Box")
16
17 # get one edge of the box to put local hypothesis on
18 p5 = geom_builder.MakeVertex(5., 0., 0.)
19 EdgeX = geom_builder.GetEdgeNearPoint(box, p5)
20 geom_builder.addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
21
22 # create a hexahedral mesh on the box
23 hexa = smesh_builder.Mesh(box, "Propagation of hypothesis")
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 of 1D Hypothesis"
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 "Arithmetic1D" hypothesis
38 # from 'EdgeX' on opposite sides of all quadilateral faces
39 algo_local.Propagation()
40
41 # compute the mesh which contains prisms
42 hexa.Compute()
43
44 # create another mesh on the box
45 mesh = smesh_builder.Mesh(box, "Propagation of distribution of nodes")
46
47 # set global algorithms and hypotheses
48 algo1D = mesh.Segment()
49 mesh.Quadrangle()
50 mesh.Hexahedron()
51 algo1D.NumberOfSegments(4)
52
53 # create a sub-mesh with local 1D hypothesis and "Propagation of Node Distribution"
54 algo_local = mesh.Segment(EdgeX)
55 algo_local.Arithmetic1D(1, 4)
56
57 # define "Propagation Of Distribution" hypothesis that propagates
58 # distribution of nodes generated by "Arithmetic1D" hypothesis
59 # from 'EdgeX' on opposite sides of all quadilateral faces
60 algo_local.PropagationOfDistribution()
61
62 # compute the mesh which contains hexahedra only
63 mesh.Compute()