collpase_card
Module
- defines:
collapse_thru_by(fields, get_packs=False)
collapse_thru_by_float(fields)
collapse_thru(fields, nthru=None)
collapse_thru_packs(fields)
collapse_colon_packs(fields, thru_split=3)
condense(value_list)
build_thru_packs(packs, max_dv=1, thru_split=3)
build_thru(packs, max_dv=None, nthru=None)
build_thru_float(packs, max_dv=None)
- pyNastran.bdf.cards.collpase_card.build_thru(packs, max_dv: int | None = None, nthru: int | None = None)[source]
Takes a pack [1,7,2] and converts it into fields used by a SET card. The values correspond to the first value, last value, and delta in the list. This means that [1,1001,2] represents 500 values. [1,1001,1] represents 1001 values and will be written as [1,THRU,1001]..
- Parameters:
- packslist[pack]
- packlist[int first, int last, int delta]
the first, last, delta id values
- max_dvint; default=None -> no limit
defines the max allowable delta between two values
- nthruint; default=None
don’t use this; it will crash
- Returns:
- valuevaries
the value of the field
- pyNastran.bdf.cards.collpase_card.build_thru_float(packs: list[list[int]], max_dv: int | None = None) list[int | str] [source]
Takes a pack [1,7,2] and converts it into fields used by a SET card. The values correspond to the first value, last value, and delta in the list. This means that [1,1001,2] represents 500 values. [1,1001,1] represents 1001 values and will be written as [1,THRU,1001].
- Parameters:
- packslist[pack]
pack : list[first, last, delta] first, last, delta are integers
- max_dvint; default=None -> no limit
integer defining the max allowable delta between two values (default=None; no limit)
- pyNastran.bdf.cards.collpase_card.build_thru_packs(packs: list[int], max_dv: int = 1, thru_split: int = 3.0) tuple[list[int], list[list[int]]] [source]
Applies THRU and BY to packs to shorten output as Nastran does on cards like the SPOINT
- Parameters:
- packslist[pack]
- packlist[id_low, id_high, delta_id]
a list representation of the min/max/delta id values
- max_dvint; default=1
maximum allowed delta between two values
- thru_splitint; default=3
the length to not write THRU 3 : [10, 11, 12] will write as ‘10 THRU 12’ 4 : [10, 11, 12] will write as ‘10 11 12’
- Returns:
- singleslist[int]
the list of singles
- doubleslist[pack]
- packlist[varies]
[3, THRU, 13] [3, THRU, 13, BY, 5]
the double packs
- # invalid
- SET1,4000, 1, 3, THRU, 10, 20, THRU, 30
- # valid
- SET1,4000, 1
- SET1,4000, 3, THRU, 10
- SET1,4000, 20, THRU, 30
- returns
singles = [1] doubles = [[3, ‘THRU’, 10], [20, ‘THRU’, 30]]
- pyNastran.bdf.cards.collpase_card.collapse_colon_packs(fields: list[int], thru_split: int = 3) tuple[list[int], list[list[int]]] [source]
Applies colons (:) to packs to represent THRU and BY as is used by Patran.
- Parameters:
- fieldslist[int]
the values to collapse
- thru_splitint; default=3
the length to not write THRU 3 : [10, 11, 12] will write as ‘10 THRU 12’ 4 : [10, 11, 12] will write as ‘10 11 12’
- Returns:
- singleslist[int]
the list of singles
- doubleslist[pack]
- packlist[varies]
[3, :, 13] [3, :, 13, :, 5]
the double packs
- # invalid
- SET1,4000, 1, 3, :, 10, 20, :, 30
- # valid
- SET1,4000, 1
- SET1,4000, 3, :, 10
- SET1,4000, 20, :, 30
- # output
- singles = [1]
- doubles = [[3, ‘:’, 10], [20, ‘:’, 30]]
- pyNastran.bdf.cards.collpase_card.collapse_thru(fields, nthru: int | None = None) list[tuple[int, int, int]] [source]
Collapses fields into a set of packs
- Parameters:
- fieldslist[int, int, …]
the list of integers to compress
- nthruint; default=1
currently unused
- Returns:
- packs = list[pack]
pack = list[int first_val, int last_val, int_by]
- pyNastran.bdf.cards.collpase_card.collapse_thru_by(fields: list[int], get_packs: bool = False) list[list[int]] [source]
- Parameters:
- fieldslist[int]
the list of fields to collapse
- get_packsbool; default=False
get the list of packs so “special” formatting can be done
- fields packs
- [1, 2, 3…150] -> [1, 150, 1]
- [1, 3, 5…150] -> [1, 150, 2]
- pyNastran.bdf.cards.collpase_card.collapse_thru_by_float(fields: list[float]) list[int | str] [source]
- pyNastran.bdf.cards.collpase_card.collapse_thru_ipacks(ifields: list[int], fields: list[int])[source]
- pyNastran.bdf.cards.collpase_card.collapse_thru_packs(fields: list[int]) tuple[list[int], list[list[int]]] [source]
- pyNastran.bdf.cards.collpase_card.condense(value_list) list[list[int]] [source]
Builds a list of packs (list of 3 values representing the first, last, and delta values for condensing a SET card.
- Parameters:
- value_listlist[int]
list of values to pack
- Returns:
- packslist[pack]
- packlist[id_low, id_high, delta_id]
a list representation of the min/max/delta id values
See also
build_thru ..
- pyNastran.bdf.cards.collpase_card.condensei(value_ilist: list[int], value_list: list[int]) list[list[int]] [source]
Builds a list of packs (list of 3 values representing the first, last, and delta values for condensing a DMI card.
- Parameters:
- value_ilistlist[int]
list of ivalues to pack
- value_listlist[int]
list of values to pack
- Returns:
- packslist[pack]
- packlist[id_low, id_high, delta_id]
a list representation of the min/max/delta id values
See also
build_thru ..