1 # Convert mesh to/from quadratic
4 salome.salome_init_without_session()
6 from salome.geom import geomBuilder
7 from salome.smesh import smeshBuilder
9 geom_builder = geomBuilder.New()
10 smesh_builder = smeshBuilder.New()
12 # create sphere of radius 100
14 Sphere = geom_builder.MakeSphereR( 100 )
15 geom_builder.addToStudy( Sphere, "Sphere" )
17 # create simple trihedral mesh
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()
27 isDone = Mesh.Compute()
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
34 Mesh.ConvertToQuadratic( theForce3d=1 )
36 # revert back to the non-quadratic mesh
38 Mesh.ConvertFromQuadratic()
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
44 Mesh.ConvertToQuadratic( theForce3d=0 )
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 )
51 # Note that the mesh becomes non-conformal at conversion of sub-mesh.