IGLBaseField
Module: cae
Base container class for scalar, vector, or tensor field data associated
with finite element or geometry entities.
This class stores field values mapped to mesh entity IDs such as nodes,
elements, faces, or integration points. It provides efficient O(1) ID-based
lookup, bulk value extraction, and basic statistical operations commonly
required for FEA post-processing and visualization workflows.
The field may represent quantities such as displacement, stress, strain,
temperature, pressure, velocity, or any other simulation result.
Attributes
----------
_name : str
User-defined field name.
_location : IGLFieldLocation
Spatial association of the field data, such as nodal or elemental.
_field_type : IGLFieldType
Data classification describing whether the field is scalar, vector,
tensor, etc.
_ids : np.ndarray
Integer array containing entity IDs associated with the field values.
_values : np.ndarray
Array containing field values corresponding to the entity IDs.
_id_to_index : dict[int, int]
Internal lookup table mapping entity IDs to array indices for fast
retrieval.
__init__
method
__init__(self, name, location, field_type, ids, values)
Initialize the field container.
Parameters
| Name | Type | Description |
|---|---|---|
| name | str | Name of the field. |
| location | IGLFieldLocation | Location where the field is defined, such as nodal or elemental. |
| field_type | IGLFieldType | Type of field data, such as scalar, vector, or tensor. |
| ids | array-like | Sequence of mesh entity IDs associated with the field values. |
| values | array-like | Sequence or array of field values corresponding to the entity IDs. |
name
property
name(self)
Get the field name.
Returns
-------
str
Field name.
location
property
location(self)
Get the field location type.
Returns
-------
IGLFieldLocation
Field spatial location definition.
field_type
property
field_type(self)
Get the field data type.
Returns
-------
IGLFieldType
Field classification such as scalar, vector, or tensor.
ids
property
ids(self)
Get the entity ID array.
Returns
-------
np.ndarray
Integer array of mesh entity IDs.
values
property
values(self)
Get the field value array.
Returns
-------
np.ndarray
Array containing field values.
size
property
size(self)
Get the number of field entries.
Returns
-------
int
Total number of entity-value pairs stored in the field.
has_id
method
has_id(self, entity_id)
Check whether a field value exists for a given entity ID.
Parameters
| Name | Type | Description |
|---|---|---|
| entity_id | int | Mesh entity ID. |
Returns
bool
True if the entity ID exists in the field, otherwise False.
get_index
method
get_index(self, entity_id)
Get the internal array index associated with an entity ID.
Parameters
| Name | Type | Description |
|---|---|---|
| entity_id | int | Mesh entity ID. |
Returns
int
Zero-based index into the field arrays. Returns -1 if the entity
ID does not exist.
get_value
method
get_value(self, entity_id)
Retrieve the field value associated with a specific entity ID.
Parameters
| Name | Type | Description |
|---|---|---|
| entity_id | int | Mesh entity ID. |
Returns
np.ndarray | float | None
Field value associated with the entity ID. Returns None if the
entity ID does not exist.
get_values
method
get_values(self, entity_ids)
Retrieve field values for multiple entity IDs.
Invalid entity IDs are ignored.
Invalid entity IDs are ignored.
Parameters
| Name | Type | Description |
|---|---|---|
| entity_ids | iterable[int] | Collection of mesh entity IDs. |
Returns
np.ndarray
Array containing field values corresponding to the valid entity IDs.
min
method
min(self)
Compute the minimum field value.
Returns
-------
np.float32
Minimum value in the field data array.
max
method
max(self)
Compute the maximum field value.
Returns
-------
np.float32
Maximum value in the field data array.
abs_max
method
abs_max(self)
Compute the maximum absolute field magnitude.
Useful for symmetric result ranges in FEA visualization and contour
normalization.
Returns
-------
np.float32
Maximum absolute value in the field data array.