Salome HOME
Merge from V6_main 28/02/2013
[modules/smesh.git] / doc / salome / examples / modifying_meshes_ex26.py
1 # Convert mesh to/from quadratic
2
3 import geompy
4 import smesh
5
6 # create sphere of radius 100
7
8 Sphere = geompy.MakeSphereR( 100 )
9 geompy.addToStudy( Sphere, "Sphere" )
10
11 # create simple trihedral mesh
12
13 Mesh = smesh.Mesh(Sphere)
14 Regular_1D = Mesh.Segment()
15 Nb_Segments = Regular_1D.NumberOfSegments(5)
16 MEFISTO_2D = Mesh.Triangle()
17 Tetrahedron = Mesh.Tetrahedron()
18
19 # compute mesh
20
21 isDone = Mesh.Compute()
22
23 # convert to quadratic
24 # theForce3d = 1; this results in the medium node lying at the
25 # middle of the line segments connecting start and end node of a mesh
26 # element
27
28 Mesh.ConvertToQuadratic( theForce3d=1 )
29
30 # revert back to the non-quadratic mesh
31
32 Mesh.ConvertFromQuadratic()
33
34 # convert to quadratic
35 # theForce3d = 0; this results in the medium node lying at the
36 # geometrical edge from which the mesh element is built
37
38 Mesh.ConvertToQuadratic( theForce3d=0 )
39
40 # to convert not the whole mesh but a sub-mesh, provide it as 
41 # an additional argument to the functions:
42 # Mesh.ConvertToQuadratic( 0, subMesh )
43 # Mesh.ConvertFromQuadratic( subMesh )
44 #
45 # Note that the mesh becomes non-conformal at conversion of sub-mesh.