ansys.dyna.core.lib.parameters.ParameterSet#
- class ansys.dyna.core.lib.parameters.ParameterSet(parent: ParameterSet | None = None)#
Hierarchical parameter storage for LS-DYNA deck parameters.
Child scopes see parent parameters but local parameters don’t leak upward.
- add(param: str, value: Any) None#
Add a parameter to the local scope.
This method is for global parameters (PARAMETER keyword). They are added to the local scope but will be visible to child scopes.
- Parameters:
- param
str Parameter name.
- value
Any Parameter value.
- param
- add_local(param: str, value: Any) None#
Add a parameter to local scope only (PARAMETER_LOCAL).
Local parameters are only visible within the current scope and child scopes created from it, but won’t leak to parent or sibling scopes.
- Parameters:
- param
str Parameter name.
- value
Any Parameter value.
- param
- copy_with_child_scope() ParameterSet#
Create a new ParameterSet with this as the parent scope.
The child scope will be able to see parameters from this scope, but parameters added to the child won’t leak back to this scope.
- Returns:
ParameterSetNew ParameterSet with this as parent.
- scope(segment: str) Generator[None, None, None]#
Context manager to scope a URI segment during card reading.
As the read stack descends (keyword -> card -> field), each layer pushes its segment and pops on exit. Parameter references are recorded at the current full URI path.
Examples
>>> with parameter_set.scope("12345"): # keyword id ... with parameter_set.scope("card0"): ... parameter_set.record_ref("secid", "&mysec") ... # Records at URI: "12345/card0/secid"
- record_ref(field: str, ref: str) None#
Record a parameter reference at the current URI path.
Called during card reading when a parameter reference (e.g., &myvar) is resolved. Stores the original reference string so it can be written back instead of the resolved value.