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