bdf_card
Module¶
Defines the BDFCard class that is passed into the various Nastran cards.
-
class
pyNastran.bdf.bdf_interface.bdf_card.
BDFCard
(card, has_none=True)[source]¶ Bases:
object
A BDFCard is a list that has a default value of None for fields out of range.
Parameters: - card : List[str]
the split values for the card
- has_none : bool; default=True
helps with a special case to speed up runtime
- # definitely bad
- card = [‘GRID’, ‘1’, ‘’, ‘1.0’, ‘2.0’, ‘3.0’]
- BDFCard(card, has_none=False)
- # definitely correct
- card = [‘GRID’, ‘1’, None, ‘1.0’, ‘2.0’, ‘3.0’]
- BDFCard(card, has_none=True)
- # ???
- card = [‘GRID’, ‘1’, ‘’, 1.0, 2.0, 3.0]
- BDFCard(card, has_none=True)
-
field
(self, i, default=None)[source]¶ Gets the ith field on the card
Parameters: - i : int
the ith field on the card (following list notation)
- default : int/float/str/None
the default value for the field
Returns: - value : int/float/str/None
the value on the ith field
-
fields
(self, i=0, j=None, defaults=None)[source]¶ Gets multiple fields on the card
Parameters: - i : int > 0
the ith field on the card (following list notation)
- j : int / None
int : the jth field on the card None : last field on the card
- defaults : List[int/float/str]
the default value for the field (as a list) len(defaults)=i-j-1
Returns: - values : List[varies]
int/float/str the values on the ith-jth fields