bdf_renumber
Module
- defines:
- bdf_renumber(bdf_filename, bdf_filename_out, size=8, is_double=False,
starting_id_dict=None, round_ids=False, cards_to_skip=None, log=None, debug=False)
- superelement_renumber(bdf_filename, bdf_filename_out=None, size=8, is_double=False,
starting_id_dict=None, cards_to_skip=None, log=None, debug=False)
- pyNastran.bdf.mesh_utils.bdf_renumber._create_nid_maps(model, starting_id_dict, nid)[source]
builds the nid_maps
- pyNastran.bdf.mesh_utils.bdf_renumber._get_bdf_model(bdf_filename, cards_to_skip=None, log=None, debug=False)[source]
helper method
- pyNastran.bdf.mesh_utils.bdf_renumber._update_case_control(model, mapper)[source]
Updates the case control deck; helper method for
bdf_renumber
.- Parameters:
- modelBDF()
the BDF object
- mapperdict[str] = list[int]
Defines the possible case control header values for each entry (e.g. LOAD)
- pyNastran.bdf.mesh_utils.bdf_renumber._update_case_key(key, elemental_quantities, seti2, eid_map, nid_map)[source]
Updates a Case Control SET card. A set may have an elemental result or a nodal result.
- pyNastran.bdf.mesh_utils.bdf_renumber._update_coords(model, starting_id_dict, cid, cid_map)[source]
updates the coords
- pyNastran.bdf.mesh_utils.bdf_renumber._update_elements(model, starting_id_dict, eid, eid_map, mass_id_map, rigid_elements_map)[source]
updates the elements
- pyNastran.bdf.mesh_utils.bdf_renumber._update_materials(unused_model, starting_id_dict, mid, mid_map, all_materials)[source]
- pyNastran.bdf.mesh_utils.bdf_renumber._update_mpcs(model, starting_id_dict, mpc_id, mpc_map)[source]
updates the mpcs
- pyNastran.bdf.mesh_utils.bdf_renumber._update_nodes(model, starting_id_dict, nid, nid_map)[source]
updates the nodes
- pyNastran.bdf.mesh_utils.bdf_renumber._update_properties(model, starting_id_dict, pid, properties_map, properties_mass_map)[source]
updates the properties
- pyNastran.bdf.mesh_utils.bdf_renumber._update_spcs(model, starting_id_dict, spc_id, spc_map)[source]
updates the spcs
- pyNastran.bdf.mesh_utils.bdf_renumber._write_bdf(model, bdf_filename_out, size=8, is_double=False)[source]
helper method
- pyNastran.bdf.mesh_utils.bdf_renumber.bdf_renumber(bdf_filename: str | BDF | StringIO, bdf_filename_out: str, size=8, is_double=False, starting_id_dict=None, round_ids: bool = False, cards_to_skip: list[str] | None = None, log=None, debug=False) BDF [source]
Renumbers a BDF
- Parameters:
- bdf_filenamestr / BDF
str : a bdf_filename (string; supported) BDF : a BDF model that has been cross referenced and is fully valid (an equivalenced deck is not valid)
- bdf_filename_outstr / None
str : a bdf_filename to write None : don’t write the BDF
- sizeint; {8, 16}; default=8
the bdf write precision
- is_doublebool; default=False
the field precision to write
- starting_id_dictdict, None (default=None)
None : renumber everything starting from 1 dict : {key : starting_id}
- keystr
the key (e.g. eid, nid, cid, …)
- starting_idint, None
int : the value to start from None : don’t renumber this key
- round_idsbool; default=False
Should a rounding up be applied for each variable? This makes it easier to read a deck and verify that it’s been renumbered properly. This only really applies when starting_id_dict is None
- cards_to_skiplist[str]; (default=None -> don’t skip any cards)
There are edge cases (e.g. FLUTTER analysis) where things can break due to uncross-referenced cards. You need to disable entire classes of cards in that case (e.g. all aero cards).
- Returns:
- modelBDF()
a renumbered BDF object corresponding to bdf_filename_out
- mapperdict[bdf_attribute]old_id_to_new_id_dict
list of mapper dictionaries of original ids to merged bdf_attribute : str
a BDF attribute (e.g., ‘nodes’, ‘elements’)
- old_id_to_new_id_dictdict[id_old]id_new
a sub dictionary that is used to map the node/element/etc. ids
- mapper = {
‘elements’ : eid_map, ‘nodes’ : nid_map, ‘coords’ : cid_map, …
}
Todo
bdf_model option for bdf_filename hasn’t been tested ..
Todo
add support for subsets (e.g. renumber only a subset of nodes/elements) ..
Todo
doesn’t support partial renumbering ..
Todo
doesn’t support element material coordinate systems ..
- ..warning :: spoints might be problematic…check
- ..warning :: still in development, but it usually brutally crashes
if it’s not supported
- ..warning :: be careful of card unsupported cards (e.g. ones not read in)
- Supports
GRIDs - no superelements
COORDx
- elements
CELASx/CONROD/CBAR/CBEAM/CQUAD4/CTRIA3/CTETRA/CPENTA/CHEXA
RBAR/RBAR1/RBE1/RBE2/RBE3/RSPLINE/RSSCON
- properties
PSHELL/PCOMP/PCOMPG/PSOLID/PSHEAR/PBAR/PBARL PROD/PTUBE/PBEAM
- mass
CMASSx/CONMx/PMASS
aero - FLFACT - SPLINEx - FLUTTER
partial case control - METHOD/CMETHOD/FREQENCY - LOAD/DLOAD/LSEQ/LOADSET…LOADSET/LSEQ is iffy - SET cards
nodes
elements
SPC/MPC/FLUTTER/FLFACT
- constraints
SPC/SPCADD/SPCAX/SPCD
MPC/MPCADD
SUPORT/SUPORT1
- solution control/methods
TSTEP/TSTEPNL
NLPARM
EIGB/EIGC/EIGRL/EIGR
- sets
USET
- other
tables
materials
loads/dloads
- Not Done
SPOINT
any cards with SPOINTs - DMIG/DMI/DMIJ/DMIJI/DMIK/etc. - CELASx - CDAMPx
superelements
aero cards - CAEROx - PAEROx
thermal cards?
optimization cards
SETx
PARAM,GRDPNT,x; where x>0
GRID SEID
case control - STATSUB - SUBCASE - global SET cards won’t be renumbered properly
Examples
Renumber Everything; Start from 1
>>> bdf_renumber(bdf_filename, bdf_filename_out, size=8, is_double=False, round_ids=False)
Renumber Everything; Start Material IDs from 100
>>> starting_id_dict = { 'mid' : 100, } >>> bdf_renumber(bdf_filename, bdf_filename_out, size=8, is_double=False, starting_ids_dict=starting_ids_dict, round_ids=False)
Only Renumber Material IDs
>>> starting_id_dict = { 'cid' : None, 'nid' : None, 'eid' : None, 'pid' : None, 'mid' : 1, 'spc_id' : None, 'mpc_id' : None, 'load_id' : None, 'dload_id' : None,
‘method_id’ : None, ‘cmethod_id’ : None, ‘spline_id’ : None, ‘table_id’ : None, ‘flfact_id’ : None, ‘flutter_id’ : None, ‘freq_id’ : None, ‘tstep_id’ : None, ‘tstepnl_id’ : None, ‘suport_id’ : None, ‘suport1_id’ : None, ‘tf_id’ : None, ‘set_id’ : None,
} >>> bdf_renumber(bdf_filename, bdf_filename_out, size=8, is_double=False,
starting_ids_dict=starting_ids_dict, round_ids=False)
- pyNastran.bdf.mesh_utils.bdf_renumber.get_renumber_starting_ids_from_model(model: BDF) dict[str, int] [source]
Get the starting ids dictionary used for renumbering with ids greater than those in model.
- Parameters:
- modelBDF
BDF object to get maximum ids from.
- Returns:
- starting_id_dictdict {strint, …}
Dictionary from id type to starting id.
- pyNastran.bdf.mesh_utils.bdf_renumber.superelement_renumber(bdf_filename, bdf_filename_out=None, size=8, is_double=False, starting_id_dict=None, cards_to_skip=None, log=None, debug=False)[source]
Renumbers a superelement
- Parameters:
- bdf_filenamestr / BDF
str : a bdf_filename (string; supported) BDF : a BDF model that has been cross referenced and is fully valid (an equivalenced deck is not valid)
- bdf_filename_outstr / None
str : a bdf_filename to write None : don’t write the BDF
- sizeint; {8, 16}; default=8
the bdf write precision
- is_doublebool; default=False
the field precision to write
- starting_id_dictdict, None (default=None)
None : renumber everything starting from 1 dict : {key : starting_id}
- keystr
the key (e.g. eid, nid, cid, …)
- starting_idint, None
int : the value to start from None : don’t renumber this key
- cards_to_skiplist[str]; (default=None -> don’t skip any cards)
There are edge cases (e.g. FLUTTER analysis) where things can break due to uncross-referenced cards. You need to disable entire classes of cards in that case (e.g. all aero cards).
- Returns:
- modelBDF()
a renumbered BDF object corresponding to bdf_filename_out