mmgp.morphing

Attributes

available_morphing_algos

List of available morphing algorithms

Classes

Morphing

The Morphing class is designed to perform mesh parametrization using different algorithms.

Functions

renumber_mesh_for_parametrization(...)

Only for linear triangle meshes

floater_mesh_parametrization(...)

STILL LARGELY EXPERIMENTAL

Module Contents

mmgp.morphing.available_morphing_algos = ['Floater'][source]

List of available morphing algorithms

class mmgp.morphing.Morphing(algo: str, options: str)[source]

Bases: object

The Morphing class is designed to perform mesh parametrization using different algorithms.

Initializes an instance of the Morphing class. Sample.

Parameters:
  • algo (str) – The name of the parametrization algorithm to use.

  • options (str) – options and settings for the algorithm.

Raises:

AssertionError – If the specified ‘algo’ is not in the list of available morphing algos.

Example

from mmgp.morphing import Morphing
morphing = Morphing('Floater','None')
algo[source]
options[source]
transform(mesh: Muscat.Containers.Mesh.Mesh) Muscat.Containers.Mesh.Mesh[source]

Transforms the input mesh using the specified parametrization algorithm.”

Parameters:

mesh (Mesh) – The input mesh to be parametrized.

Returns:

The parametrized mesh resulting from the transformation.

Return type:

Mesh

mmgp.morphing.renumber_mesh_for_parametrization(in_mesh: Muscat.Containers.Mesh.Mesh, in_place: bool = True, boundary_orientation: str = 'direct', fixed_boundary_points: list = None, starting_point_rank_on_boundary: int = None) Tuple[Muscat.Containers.Mesh.Mesh, numpy.ndarray, int][source]

Only for linear triangle meshes Renumber the node IDs, such that the points on the boundary are placed at the end of the numbering. Serves as a preliminary step for mesh parametrization.

Parameters:
  • in_mesh (Mesh) – input triangular to be renumbered

  • in_place (bool) – if “True”, in_mesh is modified if “False”, in_mesh is let unmodified, and a new mesh is produced

  • boundary_orientation (str) – if “direct, the boundary of the parametrisation is constructed in the direct trigonometric order if “indirect”, the boundary of the parametrisation is constructed in the indirect trigonometric orderc order

  • fixed_boundary_points (list) – list containing lists of two np.ndarrays. Each 2-member list is used to identify one point on the boundary: the first array contains the specified components, and the second the

  • starting_point_rank_on_boundary (int) – node id (in the complete mesh) of the point on the boundary where the mapping starts

Returns:

  • Mesh – renumbered mesh

  • ndarray(1) of ints – renumbering of the nodes of the returned renumbered mesh, with respect to in_mesh

  • int – number of node of the boundary of in_mesh

mmgp.morphing.floater_mesh_parametrization(in_mesh: Muscat.Containers.Mesh.Mesh, n_boundary: int, out_shape: str = 'circle', boundary_orientation: str = 'direct', curv_abs_boundary: bool = True, fixed_interior_points: dict[str, list] = None, fixed_boundary_points: list = None) Tuple[Muscat.Containers.Mesh.Mesh, dict[str, float]][source]

STILL LARGELY EXPERIMENTAL

Only for linear triangular meshes

Computes the Mesh Parametrization algorithm [1] proposed by Floater, in the case of target parametrization fitted to the unit 2D circle (R=1) or square (L=1). Adapted for ML need: the out_shape’s boundary is sampled following the curvilinear abscissa along the boundary on in_mesh (only for out_shape = “circle” for the moment)

Parameters:
  • in_mesh (Mesh) – Renumbered triangular mesh to parametrize

  • n_boundary (int) – number nodes on the line boundary

  • out_shape (str) – if “circle”, the boundary of in_mesh is mapped into the unit circle if “square”, the boundary of in_mesh is mapped into the unit square

  • boundary_orientation (str) – if “direct, the boundary of the parametrisation is constructed in the direct trigonometric order if “indirect”, the boundary of the parametrisation is constructed in the indirect trigonometric order

  • curv_abs_boundary (bool) – only if fixed_interior_points = None if True, the point density on the boundary of out_shape is the same as the point density on the boundary of in_mesh if False, the point density on the boundary is uniform

  • fixed_interior_points (dict) – with one key, and corresponding value, a list: [ndarray(n), ndarray(n,2)], with n the number of interior points to be fixed; the first ndarray is the index of the considered interior point, the second ndarray is the corresponding prescribed positions if key is “mean”, the interior points are displaced by the mean of the prescribed positions if key is “value”, the interior points are displaced by the value of the prescribed positions

  • fixed_boundary_points (list) – list of lists: [ndarray(2), ndarray(2)], helping definining a point in in_mesh; the first ndarray is the component of a point on the boundary, and the second array is the value of corresponding component. Tested for triangular meshes in the 3D space.

Returns:

  • Mesh – parametrization of mesh

  • dict – containing 3 keys: “minEdge”, “maxEdge” and “weights”, with values floats containing the minimal and maximal edged length of the parametrized mesh, and the weights (lambda) in the Floater algorithm

Attention

mesh must be a renumbered Mesh of triangles (either in a 2D or 3D ambiant space), with a line boundary (no closed surface in 3D). out_shape = “circle” is more robust in the sense that is in_mesh has a 2D square-like, for triangles may ended up flat with out_shape = “square”

References

[1] M. S. Floater. Parametrization and smooth approximation of surface triangulations, 1997. URL: https://www.sciencedirect.com/science/article/abs/pii/S0167839696000313