sgio.validate_element_ids#
- sgio.validate_element_ids(element_ids: List[List[int]] | List[_SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]], format: Literal['generic', 'vabs', 'swiftcomp', 'abaqus'] = 'generic') None#
Validate element ID numbering according to format requirements.
Validates that element IDs meet the requirements for the specified format: - generic: No specific requirements (always passes) - vabs/swiftcomp: Must be consecutive integers from 1 across all cell blocks, no duplicates - abaqus: Must be positive integers (>= 1), no duplicates, ID=0 forbidden
- Parameters:
element_ids (list of lists or list of arrays) – Element IDs organized by cell block. Each item is a list/array of element IDs for that cell type.
format ({'generic', 'vabs', 'swiftcomp', 'abaqus'}, default 'generic') – Format to validate against: - ‘generic’: No validation (always passes) - ‘vabs’: Requires consecutive integers from 1 - ‘swiftcomp’: Requires consecutive integers from 1 - ‘abaqus’: Requires positive integers, no ID=0
- Raises:
ValueError – If element IDs do not meet format requirements (duplicates, forbidden IDs, or non-consecutive numbering).
Examples
>>> # Valid consecutive numbering across blocks >>> element_ids = [[1, 2, 3], [4, 5, 6]] >>> validate_element_ids(element_ids, format='vabs')
>>> # Invalid - missing element 4 >>> element_ids = [[1, 2, 3], [5, 6, 7]] >>> validate_element_ids(element_ids, format='vabs') ValueError: Element IDs must be consecutive integers from 1 to 7
>>> # Invalid - duplicate IDs >>> element_ids = [[1, 2, 3], [3, 4, 5]] >>> validate_element_ids(element_ids, format='vabs') ValueError: Duplicate Element IDs found: [3]
>>> # Invalid - forbidden ID=0 for Abaqus >>> element_ids = [[0, 1, 2], [3, 4, 5]] >>> validate_element_ids(element_ids, format='abaqus') ValueError: Forbidden Element IDs found: [0]