Skip to content

Add automatic check for Ansys reserved variable names in ComputationBase - #34

Merged
sadda merged 2 commits into
mainfrom
16-reserved-variable-check
Sep 10, 2026
Merged

sadda merged 2 commits into
mainfrom
16-reserved-variable-check

Conversation

@haitao-ZCU

@haitao-ZCU haitao-ZCU commented Sep 8, 2026 •

Copy link
Copy Markdown
Collaborator

Add an automatic check in ComputationBase that raises a ValueError if any key in oper_params or output_vars matches one of Ansys's reserved intrinsic variable names (see https://ansyshelp.ansys.com/public/Views/Secured/Electronics/v242/en/Subsystems/Maxwell/Content/UsingIntrinsicVariables.htm), which is exactly the class of bug found in #30 (f colliding with Ansys's own F).

tests/test_computation.py covers this with four cases:

  • a normal set of names that should pass without raising,
  • a reserved name placed in oper_params,
  • a reserved name placed in output_vars,
  • the same oper_params case written in lowercase to confirm the check is case insensitive.

@haitao-ZCU haitao-ZCU linked an issue Sep 8, 2026 that may be closed by this pull request
@sadda

sadda commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

@haitao-ZCU Is there a reason why the checks are performed only for ComputationBase and not GeometryBase? If no, please create one checking function and call it from both inits.

@sadda
sadda merged commit c2a8477 into main Sep 10, 2026
6 checks passed
@haitao-ZCU
haitao-ZCU deleted the 16-reserved-variable-check branch September 10, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate the output variables

2 participants