mymesh.improvement.SmartLaplacianSmoothing#
- mymesh.improvement.SmartLaplacianSmoothing(M, target='mean', TangentialSurface=True, labels=None, options={})[source]#
Performs smart Laplacian smoothing [Fre97], repositioning each node to the center of its adjacent nodes only if doing so doesn’t reduce the element quality.
- Parameters:
M (mymesh.mesh) – Mesh object to smooth
target (str) –
Determines whether criteria for repositioning a node, by default ‘mean’.
’mean’ - repositioning is allowed if the average quality of the connected elements doesn’t decrease.
’min’ - repositioning is allowed if the minimum quality of the connected elements doesn’t decrease.
TangentialSurface (bool, optional) – Option to use tangential laplacian smoothing on the surface (and interfaces, if labels are provided), by default True.
options (dict, optional) –
Smoothing options. Available options are:
- methodstr
’simultaneous’ or ‘sequential’. Specifies if smoothing is performed on all nodes at the same time, or one after another. Simultaneous laplacian smoothing will move nodes to the center of their neighbors’ initial positions, while sequential will use the current positions of previously smoothed nodes, by default ‘sequential’.
- iterateint or str
Fixed number of iterations to perform, or ‘converge’ to iterate until convergence, by default ‘converge’.
- tolerancefloat
Convergence tolerance. For local Laplacian smoothing, iteration will terminate if the largest movement of a node is less than the specified tolerance, by default 1e-6.
- maxIterint
Maximum number of iterations when iterate=’converge’, By default 100.
- FixedNodesset or array_like
Set of nodes that are held fixed during iteration, by default none are fixed.
- FixFeaturesbool
If true, feature nodes on edges or corners (identified by
DetectFeatures()
) will be held in place, by default False.- FixSurfbool
If true, all nodes on the surface will be held in place and only interior nodes will be smoothed, by default False.
- qualityFuncfunction
Function used for computing quality. It is assumed that a larger number corresponds to higher quality, be default quality.MeanRatio
- InPlacebool
If True, the input mesh is modified directly, otherwise a new copy of the mesh is created, by default False.
- Returns:
Mnew – Mesh object with the new node locations.
- Return type: