IGLFEAMesh
Module: cae
Finite element mesh container for storing nodal coordinates, element
connectivity, and generating renderable surface topology for visualization.
This class provides functionality for:
- Managing node and element data
- Fast node ID to index lookup
- Extracting exterior faces from solid meshes
- Building triangle and edge topology for rendering
- Converting FEA mesh data into an IGLMeshDS visualization structure
Supported element types include:
- TET4
- HEX8
- TET10 (linearized)
- HEX20 (linearized)
- TRI3
- TRI6 (linearized)
- QUAD4
- QUAD8 (linearized)
Notes
-----
Higher-order elements are reduced to their corner-node topology for
visualization and surface extraction.
__init__
method
__init__(self)
Initialize an empty finite element mesh container.
set_nodes
method
set_nodes(self, node_ids, coordinates)
Set nodal IDs and spatial coordinates.
Parameters
| Name | Type | Description |
|---|---|---|
| node_ids | array-like | Sequence of unique node IDs. |
| coordinates | array-like | Nodal coordinate array of shape (N, 3), where each row contains the X, Y, and Z coordinates of a node. |
node_ids
property
node_ids(self)
Get the node ID array.
Returns
-------
np.ndarray
Integer array containing mesh node IDs.
nodes
property
nodes(self)
Get nodal coordinates.
Returns
-------
np.ndarray
Array of nodal coordinates with shape (N, 3).
num_nodes
property
num_nodes(self)
Get the total number of nodes in the mesh.
Returns
-------
int
Number of nodes.
get_node_index
method
get_node_index(self, node_id: int)
Get the internal node array index associated with a node ID.
Parameters
| Name | Type | Description |
|---|---|---|
| node_id | int | Node ID. |
Returns
int
Zero-based node index. Returns -1 if the node ID does not exist.
add_element
method
add_element(self, element_id: int, element_type: int, connectivity)
Add a finite element to the mesh.
Parameters
| Name | Type | Description |
|---|---|---|
| element_id | int | Unique element ID. |
| element_type | int | Internal element type identifier. |
| connectivity | array-like | Sequence of node IDs defining the element connectivity. |
elements
property
elements(self)
Get the element dictionary.
Returns
-------
dict
Dictionary containing element definitions indexed by element ID.
num_elements
property
num_elements(self)
Get the total number of elements.
Returns
-------
int
Number of elements stored in the mesh.
_getelementsides
method
_getelementsides(self, elemtyp: int, ELNds)
Extract element boundary entities for visualization.
Depending on the element type, this method returns:
- Surface faces for solid elements
- Renderable polygons for shell/surface elements
Node ordering is preserved to maintain correct face winding and
surface normal orientation.
Depending on the element type, this method returns:
- Surface faces for solid elements
- Renderable polygons for shell/surface elements
Node ordering is preserved to maintain correct face winding and
surface normal orientation.
Parameters
| Name | Type | Description |
|---|---|---|
| elemtyp | int | Internal element type identifier. |
| ELNds | array-like | Element connectivity node IDs. |
Returns
list
List of element boundary entities represented as node ID lists.
_extractexteriorentities
method
_extractexteriorentities(self, Elems: dict)
Extract exterior faces or surface entities from the element set.
Interior faces shared between adjacent solid elements are removed
using topology-based matching.
Interior faces shared between adjacent solid elements are removed
using topology-based matching.
Parameters
| Name | Type | Description |
|---|---|---|
| Elems | dict | Dictionary of element definitions. |
Returns
list
List of exterior surface entities represented by node ID lists.
_build_triangles
method
_build_triangles(self, Elems: dict)
Generate triangulated exterior surface geometry.
Quad entities are automatically triangulated into two triangles.
Quad entities are automatically triangulated into two triangles.
Parameters
| Name | Type | Description |
|---|---|---|
| Elems | dict | Dictionary containing finite element definitions. |
Returns
tuple
Tuple containing:
- list : Triangle connectivity list
- list : Exterior entities before triangulation
_build_edges
method
_build_edges(self, ExteriorEntities)
Build a unique edge list from exterior surface entities.
Parameters
| Name | Type | Description |
|---|---|---|
| ExteriorEntities | list | Exterior face or polygon entities. |
Returns
np.ndarray
Array of unique mesh edges with shape (N, 2).
BuildMeshDS
method
BuildMeshDS(self)
Build an IGLMeshDS visualization mesh from the FEA mesh.
The generated mesh contains:
- Surface triangles
- Exterior edges
- Nodal coordinates
- Node ID lookup mapping
Returns
-------
IGLMeshDS
Visualization-ready mesh data structure.