Salome HOME
bos #29171 Refactor testing procedure
[modules/smesh.git] / doc / examples / defining_hypotheses_ex13.py
1 # Radial Quadrangle 1D-2D example
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 face from the wire and add to study
13 Face = geom_builder.MakeSketcher("Sketcher:F 0 0:TT 20 0:R 90:C 20 90:WF", [0, 0, 0, 1, 0, 0, 0, 0, 1])
14 geom_builder.addToStudy(Face,"Face")
15 circle, radius1, radius2 = geom_builder.SubShapeAllSorted(Face, geom_builder.ShapeType["EDGE"])
16 geom_builder.addToStudyInFather(Face, radius1,"radius1")
17 geom_builder.addToStudyInFather(Face, radius2,"radius2")
18 geom_builder.addToStudyInFather(Face, circle,"circle")
19
20 # Define geometry for mesh, and Radial Quadrange algorithm
21 mesh = smesh_builder.Mesh(Face)
22 radial_Quad_algo = mesh.Quadrangle(algo=smeshBuilder.RADIAL_QUAD)
23
24 # The Radial Quadrange algorithm can work without any hypothesis
25 # In this case it uses "Default Nb of Segments" preferences parameter to discretize edges
26 # So by default there will be 15 segments in both radial and circular directions
27 mesh.Compute()
28
29 # The Radial Quadrange uses global or local 1d hypotheses if it does
30 # not have its own hypotheses.
31 # Define global hypotheses to discretize radial edges and a local one for circular edge
32 # So that there will be 5 radial layers and 10 circular segments
33 global_Nb_Segments = mesh.Segment().NumberOfSegments(5)
34 local_Nb_Segments  = mesh.Segment(circle).NumberOfSegments(10)
35 mesh.Compute()
36
37 # Define own parameters of Radial Quadrange algorithm
38 # The number of radial layers will be 4
39 radial_Quad_algo.NumberOfLayers( 4 )
40 mesh.Compute()