mymesh.implicit.SurfaceNodeOptimization#

mymesh.implicit.SurfaceNodeOptimization(M, func, h, iterate=1, threshold=0, FixedNodes={}, FreeNodes=None, FixEdges=False, finite_diff_step=1e-05, smooth=True, InPlace=False, springs=True)[source]#

Optimize the placement of surface node to lie on the “true” surface. This This simultaneously moves nodes towards the isosurface and redistributes nodes more evenly, thus smoothing the mesh without shrinkage or destruction of features. This method is consists of using the Z-flow (and R-flow if smooth=True) from Ohtake and Belyaev [OB01].

Parameters:
  • M (mesh.mesh) – Mesh object

  • func (function or sympy-type function) – Implicit function describing the mesh surface. This should be the same function used to create the mesh.

  • h (float) – Element size of the surface mesh

  • iterate (int, optional) – Number of iterations to perform, by default 1

  • FixedNodes (set, optional) – Nodes to hold in place during repositioning, by default set()

  • FreeNodes (NoneType, set, or array_like) – Movable nodes, if None these will be the surface nodes. The any nodes in both FreeNodes and FixedNodes will be removed from FreeNodes. By default None.

  • FixEdges (bool, optional) – Option to detect and hold in place exposed surface edges, by default False

  • finite_diff_step (float, optional) – Small number used to calculate finite difference approximations to the gradient. Only used if the function is not convertible to a sympy-differentiable function, by default 1e-5.

  • smooth (str, optional) – Option to perform smoothing. This can be either ‘local’ for local Laplacian smoothing or ‘tangential’ for tangential Laplacian smoothing, by default ‘tangential’. For any other option, smoothing will not be performed. Tangential smoothing differs from local in that nodes are only repositioned in the tangent plane (based on the normal vector obtain from the gradient).

  • InPlace (bool, optional) – If False, will create a copy of the mesh, rather than altering node positions of the original mesh object “in-place”, by default False

  • springs (bool, optional) – If True and the mesh is a volume mesh, internal nodes will be treated as if they are connected by springs (see NodeSpringSmoothing()) to reduce risk of element distortion or inversion, by default True.

Returns:

M – Mesh with repositioned surface vertices

Return type:

mesh.mesh