simdesign.utils.tags
This module provides the integer tag encoding used for the geometry (points, lines and rectangles) and for the objects of the numerical models (nodes, elements, materials and sections).
The tags are readable: the grid location and the role of an object can be read directly from its tag. Each grid index (i, j, k) takes two digits, so that grids with up to 99 bays in each direction and 99 storeys are supported.
Points:
tag = S * 10**6 + i * 10**4 + j * 10**2 + kwith the level flagSequal to 0 for floor-level grid points and 1 for stair mid-level points, which take the grid indices of the point above them.Nodes derived from points:
tag = E * 10**8 + T * 10**7 + point_tag, whereTis the node type (seeNODE_TYPES) andEis 1 for the element-end nodes next to the plastic hinges of concentrated plasticity models.Lines:
tag = code * 10**6 + i * 10**4 + j * 10**2 + k(seeLINE_CODES), anchored at the minimum grid indices.Rectangles:
tag = code * 10**6 + i * 10**4 + j * 10**2 + k(seeRECTANGLE_CODES), anchored at the minimum grid indices.Lines and rectangles with a stair mid-level point are anchored at the floor level below it, and take the stair codes (‘Z_lower’, ‘Z_upper’, ‘X_stairs’, ‘lower’, ‘upper’). The tags of points, lines and rectangles can be derived from their grid indices with
point_tag_from_grid(),line_tag_from_grids()andrectangle_tag_from_grids().Sub-objects (materials, sections, infill struts, …):
tag = owner_tag * 100 + local_id.
All tags stay below the 32-bit integer limit of OpenSees.
Examples
>>> encode_point_tag(3, 1, 2)
30102
>>> node_tag(30102, 'floor')
10030102
>>> decode_node_tag(10030102)
(0, 1, 0, 3, 1, 2)
- simdesign.utils.tags.encode_point_tag(i, j, k)[source]
Encode the grid indices of a floor-level point into a tag.
- Parameters:
i (int) – Grid indices along x, y, z (0-based, at most
MAX_INDEX).j (int) – Grid indices along x, y, z (0-based, at most
MAX_INDEX).k (int) – Grid indices along x, y, z (0-based, at most
MAX_INDEX).
- Returns:
Point tag,
i * 10**4 + j * 10**2 + k.- Return type:
int
- simdesign.utils.tags.decode_point_tag(tag)[source]
Decode a point tag back into grid indices.
- Parameters:
tag (int) – Point tag.
- Returns:
Grid indices
(i, j, k). For stair mid-level points, these are the indices of the point above.- Return type:
Tuple[int, int, int]
- simdesign.utils.tags.stairs_point_tag(top_point_tag)[source]
Tag of the stair mid-level point below a floor-level point.
- Parameters:
top_point_tag (int) – Tag of the floor-level point above the mid-level point.
- Returns:
Point tag with the level flag
S = 1.- Return type:
int
- simdesign.utils.tags.encode_line_tag(i, j, k, line_type)[source]
Encode the anchor grid indices and the type of a line into a tag.
- Parameters:
i (int) – Anchor grid indices of the line (minimum indices along each axis).
j (int) – Anchor grid indices of the line (minimum indices along each axis).
k (int) – Anchor grid indices of the line (minimum indices along each axis).
line_type (str) – Key of
LINE_CODES, e.g. ‘X’, ‘Y’, ‘Z’.
- Returns:
Line tag,
code * 10**6 + i * 10**4 + j * 10**2 + k.- Return type:
int
- simdesign.utils.tags.decode_line_tag(tag)[source]
Decode a line tag back into anchor grid indices and type.
- Parameters:
tag (int) – Line tag.
- Returns:
(i, j, k, line_type);line_typeis ‘?’ if unknown.- Return type:
Tuple[int, int, int, str]
- simdesign.utils.tags.encode_rectangle_tag(i, j, k, plane)[source]
Encode the anchor grid indices and the type of a rectangle into a tag.
- Parameters:
i (int) – Anchor grid indices of the rectangle (lower/near corner).
j (int) – Anchor grid indices of the rectangle (lower/near corner).
k (int) – Anchor grid indices of the rectangle (lower/near corner).
plane (str) – Key of
RECTANGLE_CODES, e.g. ‘XY’, ‘YZ’, ‘XZ’.
- Returns:
Rectangle tag,
code * 10**6 + i * 10**4 + j * 10**2 + k.- Return type:
int
- simdesign.utils.tags.decode_rectangle_tag(tag)[source]
Decode a rectangle tag back into anchor grid indices and type.
- Parameters:
tag (int) – Rectangle tag.
- Returns:
(i, j, k, plane);planeis ‘?’ if unknown.- Return type:
Tuple[int, int, int, str]
- simdesign.utils.tags.point_tag_from_grid(grid_ids)[source]
Tag of a point from its grid indices.
- Parameters:
grid_ids (Sequence[float]) – Grid indices
(i, j, k)of the point. Stair mid-level points havekending with .5.- Returns:
Point tag. Stair mid-level points take the level flag
S = 1and the grid indices of the point above them.- Return type:
int
- simdesign.utils.tags.line_tag_from_grids(grids)[source]
Tag of a line from the grid indices of its end points.
- Parameters:
grids (Sequence[Sequence[float]]) – Grid indices
(i, j, k)of the two end points.- Returns:
Line tag anchored at the minimum grid indices, rounded down. Columns split by a stair landing take the ‘Z_lower’ and ‘Z_upper’ codes, and beams at a stair mid-level take the ‘X_stairs’ code.
- Return type:
int
- Raises:
ValueError – If the line is not parallel to the X, Y or Z axis, or if a beam at a stair mid-level is not parallel to the X axis.
- simdesign.utils.tags.rectangle_tag_from_grids(grids)[source]
Tag of a rectangle from the grid indices of its corner points.
- Parameters:
grids (Sequence[Sequence[float]]) – Grid indices
(i, j, k)of the four corner points.- Returns:
Rectangle tag anchored at the minimum grid indices, rounded down. Infills split by a stair landing take the ‘lower’ and ‘upper’ codes.
- Return type:
int
- Raises:
ValueError – If the rectangle is not parallel to the XY, XZ or YZ plane, or if a slab (XY) is at a stair mid-level.
- simdesign.utils.tags.node_tag(point_tag, node_type)[source]
Tag of a node associated with a geometry point.
- Parameters:
point_tag (int) – Tag of the geometry point (floor-level or stair mid-level).
node_type (str) – Key of
NODE_TYPES.
- Returns:
Node tag,
T * 10**7 + point_tag.- Return type:
int
- simdesign.utils.tags.element_end_node_tag(tag)[source]
Tag of the element-end node next to a plastic hinge.
- Parameters:
tag (int) – Tag of the node on the other side of the hinge (joint offset or foundation node).
- Returns:
Node tag with the element-end flag
E = 1.- Return type:
int
- simdesign.utils.tags.diaphragm_node_tag(floor)[source]
Tag of the retained (master) node of a floor diaphragm.
- Parameters:
floor (int) – Floor number (1-based).
- Returns:
Node tag with type
T = 9andk = floor.- Return type:
int
- simdesign.utils.tags.decode_node_tag(tag)[source]
Decode a node tag.
- Parameters:
tag (int) – Node tag.
- Returns:
(E, T, S, i, j, k): element-end flag, node type (seeNODE_TYPES), level flag and grid indices.- Return type:
Tuple[int, int, int, int, int, int]
- simdesign.utils.tags.sub_tag(owner_tag, local_id)[source]
Tag of a sub-object (material, section, strut, …) of an owner.
- Parameters:
owner_tag (int) – Tag of the owner object (e.g. line, rectangle or node tag).
local_id (int) – Local identifier of the sub-object (0-99).
- Returns:
Tag,
owner_tag * 100 + local_id.- Return type:
int