ansys.dyna.core.lib.card_set#

Set of cards that act as one card.

It is a generic card, so it needs to be given a type as an argument. That type is used for each card, and behaves like a keyword.

Classes#

CardSet

Abstract base class for all the implementations of keyword cards.

Functions#

read_cards_with_discriminator(→ bool)

Read cards where a discriminator field determines which card variant to use.

ensure_card_set_properties(→ None)

Help with handling card sets.

Module Contents#

ansys.dyna.core.lib.card_set.read_cards_with_discriminator(cards: List, buf: TextIO, parameters, discriminator: Field, cards_with_field: List[int]) bool[source]#

Read cards where a discriminator field determines which card variant to use.

This handles the “chicken-and-egg” problem where card conditionals depend on a field value that is IN those very cards. The solution: 1. Read non-discriminator cards first (cards before the first discriminator card) 2. Peek at next line to extract the discriminator field value 3. Set the field on all cards that have it (so conditionals evaluate correctly) 4. Read remaining cards (only active ones will consume data)

Args:

cards: List of Card objects in the CardSet item buf: Text buffer to read from parameters: Parameter set for substitution discriminator: Field instance with name, offset, width, and default value cards_with_field: List of card indices that contain the discriminator field

Returns:
True if the reader hit end of keyword early, False otherwise.
ansys.dyna.core.lib.card_set.ensure_card_set_properties(kwd, for_setter: bool) None[source]#

Help with handling card sets.

For convenience the first card set can be manipulated by the keyword if it is currently empty. Getters, on the other hand, only work if a card set has been added.