Deck
#
- class ansys.dyna.core.lib.deck.Deck(title: str = None, **kwargs)#
Provides a collection of keywords that can read and write to a keyword file.
Overview#
Clear all keywords from the deck. |
|
Registers an ImportHandler object |
|
Add a keyword to the collection. |
|
Remove a keyword from the collection by index. |
|
Add a list of keywords to the deck. |
|
Get a new deck that is flattened copy of self. |
|
Get the keyword file representation of all keywords as a string. |
|
Write the card in the dyna keyword format. |
|
Load all keywords from the keyword file as a string. |
|
Validate the collection of keywords. |
|
Get all keywords for a given type. |
|
Get all keywords for a given full type. |
|
Get the SECTION keyword in the collection for a given section ID. |
|
Get a list of keywords. |
|
Import a keyword file. |
|
Export the keyword file to a new keyword file. |
|
Plot the node and element of the mesh using PyVista. |
Comment header of the keyword database. |
|
Title of the keyword database. |
|
Format type of the deck. |
|
List of all keywords. |
|
List of keywords as a raw string. |
|
List of keywords as a raw string. |
|
List of processed keywords. |
|
Import detail#
from ansys.dyna.core.lib.deck import Deck
Property detail#
- property Deck.format: ansys.dyna.core.lib.format_type.format_type#
Format type of the deck.
- property Deck.transform_handler: ansys.dyna.core.lib.transform.TransformHandler#
- property Deck.parameters: ansys.dyna.core.lib.parameters.ParameterSet#
- property Deck.all_keywords: List[str | ansys.dyna.core.lib.keyword_base.KeywordBase | ansys.dyna.core.lib.encrypted_keyword.EncryptedKeyword]#
List of all keywords.
- property Deck.keywords#
List of processed keywords.
Method detail#
- Deck.__add__(other)#
Add two decks together.
- Deck.clear()#
Clear all keywords from the deck.
- Deck.register_import_handler(import_handler: ansys.dyna.core.lib.import_handler.ImportHandler) None #
Registers an ImportHandler object
- Deck.append(keyword: ansys.dyna.core.lib.keyword_base.KeywordBase | str, check=False) None #
Add a keyword to the collection.
- Deck.extend(kwlist: list) None #
Add a list of keywords to the deck.
- Parameters:
- kwlist
list
List of keywords.
- kwlist
- Deck.expand(cwd=None, recurse=True)#
Get a new deck that is flattened copy of self.
A flattened deck is one where the
*INCLUDE
keywords are replaced by the contents of the file that is included. cwd is a working directory used to resolve the filename If recurse is true,*INCLUDE
keywords within included decks are expanded, recursively.
- Deck.dumps() str #
Get the keyword file representation of all keywords as a string.
- Returns:
str
Keyword file representation of all keywords as a string.
- Deck.write(buf: TextIO | None = None, format: ansys.dyna.core.lib.format_type.format_type | None = None)#
Write the card in the dyna keyword format.
- Parameters:
- buf
optional
Buffer to write to. The default is
None
, in which case the output is returned as a string.- format
optional
Format to write in. The default is
None
.
- buf
- Deck.loads(value: str, context: ansys.dyna.core.lib.import_handler.ImportContext | None = None) ansys.dyna.keywords.lib.deck_loader.DeckLoaderResult #
Load all keywords from the keyword file as a string.
When adding all keywords from the file, this method overwrites the title and user comment, if any.
- Parameters:
- value
str
- context: ImportContext
the context
- value
- Deck.get_kwds_by_type(str_type: str) Iterator[ansys.dyna.core.lib.keyword_base.KeywordBase] #
Get all keywords for a given type.
- Parameters:
- str_type
str
Keyword type.
- str_type
- Returns:
typing.Iterator
[KeywordBase
]
Examples
Get all
*SECTION_*
keywords in the deck.>>>deck.get_kwds_by_type(“SECTION”)
- Deck.get_kwds_by_full_type(str_type: str, str_subtype: str) Iterator[ansys.dyna.core.lib.keyword_base.KeywordBase] #
Get all keywords for a given full type.
- Parameters:
- Returns:
typing.Iterator
[KeywordBase
]
Examples
Get all
*SECTION_SHELL
keyword instances in the deck.>>>deck.get_kwds_by_full_type(“SECTION”, “SHELL”)
- Deck.get_section_by_id(id: int) ansys.dyna.core.lib.keyword_base.KeywordBase | None #
Get the SECTION keyword in the collection for a given section ID.
- Deck.get(**kwargs) List[ansys.dyna.core.lib.keyword_base.KeywordBase] #
Get a list of keywords.
- Parameters:
- - *kwargs* (``dict``) –
Keyword arguments. * type (
str
) – The type of keyword to get. For example, “SECTION” returns all section keywords. * filter (callable
) – The filter to apply to the result. Only keywords which pass the filter will be returned.
- Deck.import_file(path: str, encoding: str = 'utf-8') ansys.dyna.keywords.lib.deck_loader.DeckLoaderResult #
Import a keyword file.
- Parameters:
- path
str
Full path for the keyword file.
- encoding: str
String encoding used to read the keyword file.
- path
- Deck.export_file(path: str, encoding='utf-8') None #
Export the keyword file to a new keyword file.
- Parameters:
- path
str
Full path for the new keyword file.
- path
- Deck.plot(**args)#
Plot the node and element of the mesh using PyVista.
- Parameters:
- **args
Keyword arguments. Use * cwd (
int
) if the deck and include files are in a separate directory.