ansys.dyna.core.lib.domain_mapper#
Maps keywords to logical domains based on their prefix.
This module is duplicated from codegen/keyword_generation/utils/domain_mapper.py to enable runtime categorization of keywords without requiring codegen dependencies.
Attributes#
Functions#
|
Categorize a keyword by domain based on its prefix. |
|
Get a sorted list of all unique domains. |
Module Contents#
- ansys.dyna.core.lib.domain_mapper.by_domain(keyword: ansys.dyna.core.lib.keyword_base.KeywordBase | str) str[source]#
Categorize a keyword by domain based on its prefix.
This function can be used as a key function for splitting decks by domain.
- Parameters:
- keyword
Union[KeywordBase,str] The keyword to categorize (either a KeywordBase object or raw string).
- keyword
- Returns:
strThe domain name (e.g., “mat”, “section”, “control”, “other”).
Examples
>>> from ansys.dyna.core.lib.deck import Deck >>> from ansys.dyna.core.lib.domain_mapper import by_domain >>> deck = Deck() >>> # ... populate deck ... >>> decks_by_domain = deck.split(by_domain) >>> mat_deck = decks_by_domain["mat"]