Model.spatialrenumbering#

Model.spatialrenumbering(collection, type, renumbering_type=0, system_entity=Entity(), start_id=0, primary_axis=0, primary_tolerance=0.0, primaryid_increment=0, secondary_axis=0, secondary_tolerance=0.0, secondaryid_increment=0, ternary_axis=0, ternary_tolerance=0.0, ternaryid_increment=0, start_entity=Entity(), primary_entity=Entity(), secondary_entity=Entity(), ternary_entity=Entity())#

Renumbers the solver IDs for nodes or elements based on spatial locations. First, it sorts all selected entities based on the preference axis and then it renumbers them. The input for preference axis can be given by specifying the axis or by selecting nodes/elements in the direction of preference axis. The sorted nodes/elements can be renumbered in continuous or non-continuous way.

Parameters:
  • collection (Collection) – The collection containing the entities for renumbering. Valid entities are nodes and elements.

  • type (hwString) –

    The type of renumbering.

    axis - Primary, secondary, and ternary axis defined by a system axis.

    adjacent - Primary, secondary, and ternary axis defined by an entity. Only supported for quad4 or quad8 elements and their associated nodes.

  • renumbering_type (unsigned int) –

    The renumbering method.

    0 - Rectangular grid (non-continuous) renumbering

    1 - Spatial (continuous) renumbering

  • system_entity (Entity) – The object describing the system entity.

  • start_id (unsigned int) – The ID to be assigned to the first entity (Only for type="axis"). The value must be an unsigned integer.

  • primary_axis (int) – The primary axis followed by the renumbering (Only for type="axis"). +x=1, -x=-1, +y=2, -y=-2, +z=+3, -z=-3, none=0.

  • primary_tolerance (double) – The primary tolerance value (Only for type="axis").

  • primaryid_increment (unsigned int) – The renumbering increment in the primary direction (Only for type="axis").

  • secondary_axis (int) – The secondary axis followed by the renumbering (Only for type="axis"). +x=1, -x=-1, +y=2, -y=-2, +z=+3, -z=-3, none=0.

  • secondary_tolerance (double) – The secondary tolerance value (Only for type="axis").

  • secondaryid_increment (unsigned int) – The renumbering increment in the secondary direction (Only for type="axis").

  • ternary_axis (int) – The ternary axis followed by the renumbering (Only for type="axis"). +x=1, -x=-1, +y=2, -y=-2, +z=+3, -z=-3, none=0.

  • ternary_tolerance (double) – The ternary tolerance value (Only for type="axis").

  • ternaryid_increment (unsigned int) – The renumbering increment in the secondary direction (Only for type="axis").

  • start_entity (Entity) – The object describing the entity to start the renumbering. The entity must be part of collection.

  • primary_entity (Entity) – The object describing the entity that defines the direction of the primary axis. The direction is given by taking the start_entity as the starting point and pointing towards the primary_entity. The entity must be part of collection.

  • secondary_entity (Entity) – The object describing the entity that defines the direction of the primary axis. The direction is given by taking the start_entity as the starting point and pointing towards the secondary_entity. The entity must be part of collection. Set to None if not specified.

  • ternary_entity (Entity) – The object describing the entity that defines the direction of the primary axis. The direction is given by taking the start_entity as starting point and pointing towards the ternary_entity. The entity must be part of collection. Set to None if not specified.

Examples#

Renumbere the solver IDs of the displayed elements with type = axis and renumbere type as spatial with the start ID equal to 1 with an increment of 1 and a tolerance value of 0.5 in all directions , use x direction of the global system as the primary axis , y direction as the secondary axis , and z direction as the ternary axis#
import hm
import hm.entities as ent

model = hm.Model()

model.sort_midsurfaces(mode=1)

model.spatialrenumbering(
collection=hm.CollectionByDisplayed(model, ent.Element),
type="axis",
renumbering_type=1,
start_id=1,
primary_axis=1,
primary_tolerance=0.5,
primaryid_increment=1,
secondary_axis=2,
secondary_tolerance=0.5,
secondaryid_increment=1,
ternary_axis=3,
ternary_tolerance=0.5,
ternaryid_increment=1,
)
Renumbere the solver IDs of the displayed elements with type="adjacent " , start from 1 with an increment of 1 in the primary axis , an increment of 10 in the secondary axis , an increment of 100 in ternary axis , start entity ID as 349 , primary entity ID as 351 , secondary entity ID as 2 , and ternary entity ID not specified#
import hm
import hm.entities as ent

model = hm.Model()

model.sort_midsurfaces(mode=1)

model.spatialrenumbering(
collection=hm.CollectionByDisplayed(model, ent.Element),
type="adjacent",
start_entity=ent.Element(model,349),
primary_entity=ent.Element(model,351),
secondary_entity=ent.Element(model,2),
start_id=1,
primaryid_increment=1,
secondaryid_increment=10,
ternaryid_increment=100,
)