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 tetrahedral mesh
19 Mesh = smesh_builder.Mesh(Sphere)
20 Mesh.Segment().NumberOfSegments(5)
26 if not Mesh.Compute(): raise Exception("Error when computing Mesh")
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
33 Mesh.ConvertToQuadratic( theForce3d=1 )
35 # revert back to the non-quadratic mesh
37 Mesh.ConvertFromQuadratic()
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
43 Mesh.ConvertToQuadratic( theForce3d=0 )
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 )
50 # Note that the mesh becomes non-conformal at conversion of sub-mesh.