Salome HOME
bos #29171 Refactor testing procedure
[modules/smesh.git] / doc / examples / modifying_meshes_ex26.py
1 # Convert mesh to/from quadratic
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 sphere of radius 100
13
14 Sphere = geom_builder.MakeSphereR( 100 )
15 geom_builder.addToStudy( Sphere, "Sphere" )
16
17 # create simple trihedral mesh
18
19 Mesh = smesh_builder.Mesh(Sphere)
20 Regular_1D = Mesh.Segment()
21 Nb_Segments = Regular_1D.NumberOfSegments(5)
22 MEFISTO_2D = Mesh.Triangle()
23 Tetrahedron = Mesh.Tetrahedron()
24
25 # compute mesh
26
27 isDone = Mesh.Compute()
28
29 # convert to quadratic
30 # theForce3d = 1; this results in the medium node lying at the
31 # middle of the line segments connecting start and end node of a mesh
32 # element
33
34 Mesh.ConvertToQuadratic( theForce3d=1 )
35
36 # revert back to the non-quadratic mesh
37
38 Mesh.ConvertFromQuadratic()
39
40 # convert to quadratic
41 # theForce3d = 0; this results in the medium node lying at the
42 # geometrical edge from which the mesh element is built
43
44 Mesh.ConvertToQuadratic( theForce3d=0 )
45
46 # to convert not the whole mesh but a sub-mesh, provide it as 
47 # an additional argument to the functions:
48 # Mesh.ConvertToQuadratic( 0, subMesh )
49 # Mesh.ConvertFromQuadratic( subMesh )
50 #
51 # Note that the mesh becomes non-conformal at conversion of sub-mesh.