Salome HOME
[bos #38643][EDF] Laplacian Smoothing 2D.
[modules/smesh.git] / doc / examples / modifying_meshes_ex21.py
1 # Smoothing
2
3 from mechanic import *
4
5 # select the top face
6 faces = geom_builder.SubShapeAllSorted(mechanic, geom_builder.ShapeType["FACE"])
7
8 # create a group of faces to be smoothed
9 group_smooth = mesh.GroupOnGeom(faces[3], "Group of faces (smooth)", SMESH.FACE)
10
11 # perform smoothing
12
13 # boolean SmoothObject(Object, IDsOfFixedNodes, MaxNbOfIterations, MaxAspectRatio, Method)
14 res0 = mesh.SmoothObject(group_smooth, [], 20, 2., smesh_builder.CENTROIDAL_SMOOTH)
15 res1 = mesh.SmoothObject(group_smooth, [], 20, 2., smesh_builder.LAPLACIAN_SMOOTH)
16 print("\nSmoothing ... ", end=' ')
17 if not (res0 and res1): print("failed!")
18 else:       print("done.")