Salome HOME
Check result of Compute in examples
[modules/smesh.git] / doc / examples / radial_prism_3d_algo.py
1 # Usage of Radial Prism 3D meshing algorithm
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 geometry: hollow sphere
13
14 sphere_1 = geom_builder.MakeSphereR( 100 )
15 sphere_2 = geom_builder.MakeSphereR( 50 )
16
17 hollow_sphere = geom_builder.MakeCut( sphere_1, sphere_2, theName="hollow sphere")
18
19 faces = geom_builder.ExtractShapes( hollow_sphere, geom_builder.ShapeType["FACE"] )
20
21 # Create mesh 
22
23 mesh = smesh_builder.Mesh( hollow_sphere, "Mesh of hollow sphere" )
24
25 # assign Global Radial Prism algorithm
26 prism_algo = mesh.Prism()
27
28 # define projection between the inner and outer spheres
29 mesh.Triangle( smeshBuilder.NETGEN_1D2D, faces[0] )    # NETGEN on faces[0]
30 mesh.Projection1D2D( faces[1] ).SourceFace( faces[0] ) # projection faces[0] -> faces[1]
31
32 # define distribution of layers using Number of Segments hypothesis in logarithmic mode
33 prism_algo.NumberOfSegments( 4, 5. )
34
35 # compute the mesh
36 if not mesh.Compute(): raise Exception("Error when computing Mesh")