mmgp.morphing ============= .. py:module:: mmgp.morphing Attributes ---------- .. autoapisummary:: mmgp.morphing.available_morphing_algos Classes ------- .. autoapisummary:: mmgp.morphing.Morphing Functions --------- .. autoapisummary:: mmgp.morphing.renumber_mesh_for_parametrization mmgp.morphing.floater_mesh_parametrization Module Contents --------------- .. py:data:: available_morphing_algos :value: ['Floater'] List of available morphing algorithms .. py:class:: Morphing(algo: str, options: str) Bases: :py:obj:`object` The Morphing class is designed to perform mesh parametrization using different algorithms. Initializes an instance of the Morphing class. :class:`Sample `. :param algo: The name of the parametrization algorithm to use. :type algo: str :param options: options and settings for the algorithm. :type options: str :raises AssertionError: If the specified 'algo' is not in the list of available morphing algos. .. rubric:: Example .. code-block:: python from mmgp.morphing import Morphing morphing = Morphing('Floater','None') .. py:attribute:: algo .. py:attribute:: options .. py:method:: transform(mesh: Muscat.Containers.Mesh.Mesh) -> Muscat.Containers.Mesh.Mesh Transforms the input mesh using the specified parametrization algorithm." :param mesh: The input mesh to be parametrized. :type mesh: Mesh :returns: The parametrized mesh resulting from the transformation. :rtype: Mesh .. py:function:: 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] 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. :param in_mesh: input triangular to be renumbered :type in_mesh: Mesh :param in_place: if "True", in_mesh is modified if "False", in_mesh is let unmodified, and a new mesh is produced :type in_place: bool :param boundary_orientation: 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 :type boundary_orientation: str :param fixed_boundary_points: 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 :type fixed_boundary_points: list :param starting_point_rank_on_boundary: node id (in the complete mesh) of the point on the boundary where the mapping starts :type starting_point_rank_on_boundary: int :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 .. py:function:: 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]] 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) :param in_mesh: Renumbered triangular mesh to parametrize :type in_mesh: Mesh :param n_boundary: number nodes on the line boundary :type n_boundary: int :param out_shape: 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 :type out_shape: str :param boundary_orientation: 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 :type boundary_orientation: str :param curv_abs_boundary: 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 :type curv_abs_boundary: bool :param fixed_interior_points: 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 :type fixed_interior_points: dict :param fixed_boundary_points: 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. :type fixed_boundary_points: list :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" .. rubric:: References [1] M. S. Floater. Parametrization and smooth approximation of surface triangulations, 1997. URL: https://www.sciencedirect.com/science/article/abs/pii/S0167839696000313