Salome HOME
bos #29628 Remove MEFISTO 2D algorithm
[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 tetrahedral mesh
18
19 Mesh = smesh_builder.Mesh(Sphere)
20 Mesh.Segment().NumberOfSegments(5)
21 Mesh.Triangle()
22 Mesh.Tetrahedron()
23
24 # compute mesh
25
26 Mesh.Compute()
27
28 # convert to quadratic
29 # theForce3d = 1; this results in the medium node lying at the
30 # middle of the line segments connecting start and end node of a mesh
31 # element
32
33 Mesh.ConvertToQuadratic( theForce3d=1 )
34
35 # revert back to the non-quadratic mesh
36
37 Mesh.ConvertFromQuadratic()
38
39 # convert to quadratic
40 # theForce3d = 0; this results in the medium node lying at the
41 # geometrical edge from which the mesh element is built
42
43 Mesh.ConvertToQuadratic( theForce3d=0 )
44
45 # to convert not the whole mesh but a sub-mesh, provide it as 
46 # an additional argument to the functions:
47 # Mesh.ConvertToQuadratic( 0, subMesh )
48 # Mesh.ConvertFromQuadratic( subMesh )
49 #
50 # Note that the mesh becomes non-conformal at conversion of sub-mesh.