Model.morphmanualapplyenvelope#

Model.morphmanualapplyenvelope(e_collection, f_collection, mode, mbias, fbias, integ, envelope, undisplayed)#

Turns manually modified node positions into a morph. This function can only be used after Model.morphmanualinit().

If mode=0, no other information is required, the difference in positions of the nodes between the Model.morphmanualinit() function and the Model.morphmanualapplyenvelope() is converted into a morph.

If mode=1, then temporary handles are created for all moving and fixed nodes to determine the stretching of the affected elements. If integ=0, a general domain is temporarily created for the affected elements. If integ=1, the domains currently in the model are used. If integ=2, 1D, 2D, 3D, and edge domains are temporarily created for the affected elements but the 2D domains are not partitioned. If integ=3, then handle influences are applied using a spatial relationship rather than through a domain. If integ=4, only the selected moving nodes are moved and all others are held fixed. If integ=5, 1D, 2D, 3D, and edge domains are temporarily created for the affected elements and the 2D domains are partitioned. Any handles created due to partitioning are moved based on their distance from the moving and fixed nodes. If integ=6, then handle influences are applied using the Kriging algorithm. If integ=7, then handle influences extend only up to a given distance (if envelope is positive) or a given multiple of the applied perturbations (if envelope is negative) away from the moving nodes.

The bias factors function as they would for handles except that all moving nodes will have the mbias value and all fixed nodes will have the fbias value.

If mode=2, then the previous Model.morphmanualapplyenvelope() function is rejected and the nodes are left in their manually perturbed positions. The model is still ‘initialized’ and thus another Model.morphmanualapplyenvelope() function can be called after a reject. To restore the model to the way it was, call Model.morphmanualrestore().

If mode=3 then the memory set aside by Model.morphmanualinit() is freed, and Model.morphmanualapplyenvelope() can no longer be used until another Model.morphmanualinit() function is called. It is good practice to use this mode to free memory which is no longer needed.

If integ is set to 3, 6, or 7, nodes on undisplayed elements and components can be morphed, fixed, or excluded depending on the value sent in for undisplayed.

Parameters:
  • e_collection (Collection) – The collection containing the affected element entities.

  • f_collection (Collection) – The collection containing the fixed node entities.

  • mode (int) –

    0 - Apply as node perturbations

    1 - Apply as handles

    2 - Reject last Model.morphmanualapplyenvelope()

    3 - Clear memory set aside by Model.morphmanualinit()

  • mbias (double) – Bias factor for moving nodes on affected elements.

  • fbias (double) – Bias factor for fixed nodes on affected elements.

  • integ (int) –

    0 - Free edges (a single general domain)

    1 - Use existing domains

    2 - Inferred edges (1D, 2D, 3D, and edge domains - no partitioning)

    3 - Morph all nodes using a proximity algorithm

    4 - Morph all moving nodes and fix the unselected nodes

    5 - Partitioned edges (1D, 2D, 3D, and edge domains with partitioning)

    6 - Morph all nodes using the Kriging algorithm

    7 - Morph all nodes within an envelope around the moving nodes

  • envelope (double) –

    If positive, all nodes beyond the given distance away from the moving nodes will be fixed.

    If negative, all nodes beyond a distance calculated by multiplying the total perturbation of each moving node by the absolute value of the envelope and extended away from each moving node will be fixed.

    If integ=7, the calculated distance defines an envelope around the moving nodes within which the morphing of those nodes will linearly taper from fully matching the nearest moving node to zero at the edge of the envelope. If any fixed nodes are within the envelope they will also reduce the morphing of nearby nodes.

  • undisplayed (int) –

    If integ is set to 3, 6, or 7, nodes which are not displayed can be affected by the morphing. This defines how undisplayed nodes are handled:

    0 - Morph nodes on undisplayed elements

    1 - Fix nodes on undisplayed elements, they will function just like nodes on the fixed mark

    2 - Exclude nodes on undisplayed elements, they will not be morphed nor affect the morphing

Example#

Move manually the nodes and apply them to the mesh as if they were handles using internally generated domains with inferred edges, then reject the changes#
import hm
import hm.entities as ent

model = hm.Model()

model.morphmanualinit()

"""
Any function that move nodes
"""

model.morphmanualapplyenvelope(
    e_collection=hm.Collection(model, ent.Element),
    f_collection=hm.Collection(model, ent.Node, [21, 22, 23]),
    mode=1,
    mbias=1.0,
    fbias=1.0,
    integ=2,
    envelope=0.0,
    undisplayed=0,
)
model.morphmanualrestore()