get_card
Module
digraph inheritance9341aa273d {
bgcolor=transparent;
rankdir=LR;
size="";
"pyNastran.bdf.bdf_interface.attributes.BDFAttributes" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="defines attributes of the BDF"];
"pyNastran.bdf.bdf_interface.get_card.GetCard" [URL="#pyNastran.bdf.bdf_interface.get_card.GetCard",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="defines various methods to access high level BDF data"];
"pyNastran.bdf.bdf_interface.get_methods.GetMethods" -> "pyNastran.bdf.bdf_interface.get_card.GetCard" [arrowsize=0.5,style="setlinewidth(0.5)"];
"pyNastran.bdf.bdf_interface.get_methods.GetMethods" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="defines various methods to access low level BDF data"];
"pyNastran.bdf.bdf_interface.attributes.BDFAttributes" -> "pyNastran.bdf.bdf_interface.get_methods.GetMethods" [arrowsize=0.5,style="setlinewidth(0.5)"];
}
- defines various methods to access high level BDF data:
GetCard() - get_card_ids_by_card_types(self, card_types=None, reset_type_to_slot_map=False,
stop_on_missing_card=False, combine=False)
get_rslot_map(self, reset_type_to_slot_map=False)
- get_cards_by_card_types(self, card_types, reset_type_to_slot_map=False,
stop_on_missing_card=False)
get_SPCx_node_ids(self, spc_id, stop_on_failure=True)
get_SPCx_node_ids_c1( spc_id, stop_on_failure=True)
get_reduced_loads(self, load_id, scale=1., skip_scale_factor0=True, msg=’’)
get_reduced_dloads(self, dload_id, scale=1., skip_scale_factor0=True, msg=’’)
get_node_ids_with_elements(self, eids, msg=’’)
- get_elements_nodes_by_property_type(self, dtype=’int32’,
save_element_types=False)
get_elements_properties_nodes_by_element_type(self, dtype=’int32’, solids=None)
get_element_ids_list_with_pids(self, pids=None)
get_pid_to_node_ids_and_elements_array(self, pids=None, etypes=None, idtype=’int32’)
get_element_ids_dict_with_pids(self, pids=None, stop_if_no_eids=True)
get_node_id_to_element_ids_map(self)
get_node_id_to_elements_map(self)
get_property_id_to_element_ids_map(self)
get_material_id_to_property_ids_map(self)
get_reduced_mpcs(self, mpc_id)
get_reduced_spcs(self, spc_id)
get_spcs(self, spc_id, consider_nodes=False)
- class pyNastran.bdf.bdf_interface.get_card.GetCard[source]
Bases:
GetMethods
defines various methods to access high level BDF data
creates the attributes for the BDF
- get_MPCx_node_ids(mpc_id: int, consider_mpcadd: bool = True, stop_on_failure: bool = True) list[list[int]] [source]
see
pyNastran.bdf.mesh_utils.mpc_dependency.get_mpc_node_ids(...)
- get_MPCx_node_ids_c1(mpc_id: int, consider_mpcadd: bool = True, stop_on_failure: bool = True) tuple[dict[str, list[int]], dict[str, list[int]]] [source]
see
pyNastran.bdf.mesh_utils.mpc_dependency.get_mpc_node_ids_c1(...)
- get_SPCx_node_ids(spc_id: int, consider_spcadd: bool = True, stop_on_failure: bool = True) list[int] [source]
Get the SPC/SPCADD/SPC1/SPCAX IDs.
- Parameters:
- spc_idint
the SPC id
- stop_on_failurebool; default=True
errors if parsing something new
- Returns:
- node_idslist[int]
the constrained associated node ids
- get_SPCx_node_ids_c1(spc_id: int, stop_on_failure: bool = True) dict[str, list[int]] [source]
Get the SPC/SPCADD/SPC1/SPCAX IDs.
- Parameters:
- spc_idint
the SPC id
- stop_on_failurebool; default=True
errors if parsing something new
- Returns:
- node_ids_c1dict[component] = node_ids
- componentstr
the DOF to constrain
- node_idslist[int]
the constrained node ids
- get_card_ids_by_card_types(card_types: list[str] = None, reset_type_to_slot_map: bool = False, stop_on_missing_card: bool = False, combine: bool = False) dict[str, list[int]] [source]
- Parameters:
- card_typesstr / list[str] / default=None
the list of keys to consider (list of strings; string) None : all cards
- reset_type_to_slot_mapbool
should the mapping dictionary be rebuilt (default=False); set to True if you added cards
- stop_on_missing_cardbool
crashes if you request a card and it doesn’t exist
- combinebool; default=False
change out_dict into out_list combine the list of cards
- Returns:
- out_dict: dict[str]=list[ids]
the key=card_type, value=the ID of the card object
- out_list: list[ids]
value=the ID of the card object useful
Examples
>>> out_dict = model.get_card_ids_by_card_types( card_types=['GRID', 'CTRIA3', 'CQUAD4'], combine=False) >>> out_dict = { 'GRID' : [1, 2, 10, 42, 1000], 'CTRIA3' : [1, 2, 3, 5], 'CQUAD4' : [4], }
shell elements
>>> out_dict = model.get_card_ids_by_card_types( card_types=['CTRIA3', 'CQUAD4'], combine=True) >>> out_dict = { [1, 2, 3, 4, 5], }
- get_cards_by_card_types(card_types: list[str], reset_type_to_slot_map: bool = False, stop_on_missing_card: bool = False) dict[str, Any] [source]
- Parameters:
- card_typeslist[str]
the list of keys to consider
- reset_type_to_slot_mapbool
should the mapping dictionary be rebuilt (default=False); set to True if you added cards
- stop_on_missing_cardbool
crashes if you request a card and it doesn’t exist
- Returns:
- out_dictdict[str] = list[BDFCard()]
the key=card_type, value=the card object
- get_dependent_nid_to_components(mpc_id=None, stop_on_failure=True)[source]
see
pyNastran.bdf.mesh_utils.mpc_dependency.get_dependent_nid_to_components(...)
- get_element_ids_dict_with_pids(pids: list[int] | int | None = None, stop_if_no_eids: bool = True, msg: str = '') dict[int, list[int]] [source]
Gets all the element IDs with a specific property ID.
- Parameters:
- pidslist[int] / int
list of property ID
- stop_if_no_eidsbool; default=True
prevents crashing if there are no elements setting this to False really doesn’t make sense for non-DMIG models
- Returns:
- element_idsdict[pid] = list[eid]
dictionary of lists by property pid : int
property id
- eidint
element id
- For example, we want all the elements with
pids=[4, 5, 6]
, - but we want them in separate groups
Notes
What happens with CONRODs?
- get_element_ids_list_with_pids(pids: list[int] | None = None) list[int] [source]
Gets all the element IDs with a specific property ID.
- Parameters:
- pidslist[int]; default=None -> all
list of property ID
- Returns:
- element_idslist[int]
the element ids
- For example, we want to get all the element ids with
pids=[1, 2, 3]
- get_elements_nodes_by_property_type(dtype: str = 'int32', save_element_types: bool = False) tuple[dict[tuple[str, int], tuple[list[int], list[int]]]] [source]
Gets a dictionary of (etype, pid) to [eids, node_ids]
- Parameters:
- dtypestr; default=’int32’
the type of the integers
- save_element_typesbool; default=False
adds the etype_to_eids_pids_nids output
- Returns:
- etype_pid_to_eids_nidsdict[(etype, pid)][eids, nids]
- etypestr
the element type
- pidint
the property id CONRODS have a pid of 0
- eids(neids, ) int ndarray
the elements with the property id of pid
- nids(neids, nnodes/element) int ndarray
the nodes corresponding to the element
- etype_to_eids_pids_nidsdict[etype][eids, pids, nids]
Enabled by save_element_types; default=None etype : str
the element type
- eids(neids, ) int ndarray
the elements with the property id of pid
- pids(neids, ) int ndarray
the property ids CONRODS have a pid of 0
- nids(neids, nnodes/element) int ndarray
the nodes corresponding to the element
- get_elements_properties_nodes_by_element_type(dtype: str = 'int32', solids: dict[str, Any] | None = None, stop_if_no_eids: bool = True) array [source]
Gets a dictionary of element type to [eids, pids, node_ids]
- Parameters:
- dtypestr; default=’int32’
the type of the integers
- solidsdict[etype]value
- etypestr
the element type should only be CTETRA, CHEXA, CPENTA, CPYRAM
- valuevaries
- (nnodes_min, nnodes_max)Tuple(int, int)
the min/max number of nodes for the element
- (nnodes, )Tuple(int, )
the number of nodes useful if you only have CTETRA4s or only want CTETRA10s fails if you’re wrong (and too low)
- Returns:
- etype_to_eids_pids_nidsdict[etype][eids, pids, nids]
- etypestr
the element type
- eids(neids, ) int ndarray
the elements with the property id of pid
- pids(neids, ) int ndarray
the property ids CONRODS have a pid of 0
- nids(neids, nnodes/element) int ndarray
the nodes corresponding to the element
- get_material_id_to_property_ids_map(msg: str = '') dict[int, list[int]] [source]
Returns a dictionary that maps a material ID to a list of properties
- Returns:
- mid_to_pids_mapdict[int] = int
the mapping
- msgstr; default=’’
a message added to the error message
Note
all properties require an mid to be counted (except for PCOMP, which has multiple mids)
- get_mpcs(mpc_id: int, consider_mpcadd: bool = True, stop_on_failure: bool = True) tuple[list[int], list[str]] [source]
see
pyNastran.bdf.mesh_utils.mpc_dependency.get_mpcs(...)
- get_nid_map(sort_ids: bool = True) dict[int, int] [source]
Maps the GRID/SPOINT/EPOINT ids to a sorted/unsorted order.
- Parameters:
- sort_idsbool; default=True
sort the ids
- Returns:
- nid_mapdict[nid]i
- nidint
the GRID/SPOINT/EPOINT id
- iint
the index
- ..note :: GRIDs, SPOINTs, & EPOINTs are stored in separate slots,
so they are unorganized.
- get_node_id_to_element_ids_map() dict[int, list[int]] [source]
Returns a dictionary that maps node IDs to a list of elemnent IDs
Todo
support 0d or 1d elements
Todo
support elements with missing nodes (e.g. CQUAD8 with missing nodes)
- get_node_id_to_elements_map() dict[int, list[int]] [source]
Returns a dictionary that maps node IDs to a list of elements.
- Returns:
- nid_to_elements_mapdict[nid]=list[eid]
node id to a list of elements
Todo
support 0d or 1d elements ..
Todo
support elements with missing nodes (e.g. CQUAD8 with missing nodes)
- get_node_ids_with_elements(eids: list[int], msg: str = '', return_array: bool = False) set[int] | ndarray [source]
Get the node IDs associated with a list of element IDs
- Parameters:
- eidslist[int]
list of element ID
- msgstr
An additional message to print out if an element is not found
- return_array: bool; default=False
True: returns a numpy array False: returns a set
- Returns:
- node_idsset[int]; np.ndarray
set of node IDs
- For example::
eids = [1, 2, 3] # list of elements with pid=1 msg = ‘ which are required for pid=1’ node_ids = bdf.get_node_ids_with_elements(eids, msg=msg)
- get_pid_to_node_ids_and_elements_array(pids: list[int] | int | None = None, etypes: list[str] | None = None, idtype: str = 'int32', msg: str = '') tuple[dict[int, str], ndarray] [source]
a work in progress
- Parameters:
- pidslist[int]
list of property ID
- etypeslist[str]
element types to consider
- Returns:
- pid_to_eids_ieids_mapdict[(pid, etype)] = eid_ieid
- eid_ieid(Nelements, 2) int ndarray
eid is the element id ieid is the index in the node_ids array
- node_ids(nelements, nnodes) int ndarray
- nelementsint
the number of elements in the property type
- nnodesint
varies based on the element type
- get_property_id_to_element_ids_map(msg: str = '') dict[int, list[int]] [source]
Returns a dictionary that maps a property ID to a list of elements.
- Returns:
- pid_to_eids_mapdict[pid]=list[eid]
property id to a list of elements
- msgstr; default=’’
a message added to the error message
- get_reduced_dloads(dload_id, scale=1.0, consider_dload_combinations=True, skip_scale_factor0=False, msg='')[source]
Accounts for scale factors.
- Parameters:
- dload_idint
the desired DLOAD id
- consider_dload_combinationsbool; default=True
look at the DLOAD card
- scalefloat; default=1.0
additional scale factor on top of the existing LOADs
- skip_scale_factor0bool; default=False
Skip loads with scale factor=0.0. Nastran does not do this. Nastran will fail if referenced loads do not exist.
- msgstr
debug message
- Returns:
- dloadslist[loads]
a series of dload objects
- scale_factorslist[float]
the associated scale factors
Warning
assumes xref=True ..
- get_reduced_loads(load_case_id: int, scale: float = 1.0, consider_load_combinations: bool = True, skip_scale_factor0: bool = False, stop_on_failure: bool = True, msg: str = '')[source]
Accounts for scale factors.
- Parameters:
- load_case_idint
the desired LOAD id
- consider_load_combinationsbool; default=True
look at the LOAD card
- scalefloat; default=1.0
additional scale factor on top of the existing LOADs
- skip_scale_factor0bool; default=False
Skip loads with scale factor=0.0. Nastran does not do this. Nastran will fail if referenced loads do not exist.
- stop_on_failurebool; default=True
errors if parsing something new
- msgstr
debug message
- Returns:
- loadslist[loads]
a series of load objects
- scale_factorslist[float]
the associated scale factors
- is_gravbool
is there a gravity card
Warning
assumes xref=True ..
- get_reduced_mpcs(mpc_id: int, consider_mpcadd: bool = False, stop_on_failure: bool = True) list[Any] [source]
Get all traced MPCs that are part of a set
- Parameters:
- mpc_idint
the MPC id
- consider_mpcaddbool
MPCADDs should not be considered when referenced from an MPCADD from a case control, True should be used.
- stop_on_failurebool; default=True
errors if parsing something new
- Returns:
- mpcslist[MPC]
the various MPCs
- get_reduced_nsms(nsm_id: int, consider_nsmadd: bool = True, stop_on_failure: bool = True) list[Any] [source]
Get all traced NSMs that are part of a set
- Parameters:
- nsm_idint
the NSM id
- consider_nsmaddbool
NSMADDs should not be considered when referenced from an NSMADD from a case control, True should be used.
- stop_on_failurebool; default=True
errors if parsing something new
- Returns:
- mpcslist[NSM]
the various NSMs
- get_reduced_spcs(spc_id: int, consider_spcadd: bool = True, stop_on_failure: bool = True) list[Any] [source]
Get all traced SPCs that are part of a set
- Parameters:
- spc_idint
the SPC id
- consider_spcaddbool
SPCADDs should not be considered when referenced from an SPCADD from a case control, True should be used.
- stop_on_failurebool; default=True
errors if parsing something new
- Returns:
- spcslist[SPC]
the various SPCs
- get_rigid_elements_with_node_ids(node_ids)[source]
see
pyNastran.bdf.mesh_utils.mpc_dependency.get_rigid_elements_with_node_ids(...)
- get_spcs(spc_id: int, consider_nodes: bool = False, stop_on_failure: bool = True) tuple[list[int], list[str]] [source]
Gets the SPCs in a semi-usable form.
- Parameters:
- spc_idint
the desired SPC ID
- consider_nodesbool; default=False
True : consider the GRID card PS field False: consider the GRID card PS field
- Returns:
- nidslist[int]
the constrained nodes
- compslist[str]
the components that are constrained on each node
- Considers:
SPC
SPC1
SPCADD
GRID
- Doesn’t consider:
non-zero enforced value on SPC
GMSPC
- property nid_map: dict[int, int]
Gets the GRID/SPOINT/EPOINT ids to a sorted order.
- Parameters:
- sort_idsbool; default=True
sort the ids
- Returns:
- nid_mapdict[nid]i
- nidint
the GRID/SPOINT/EPOINT id
- iint
the index
- ..note :: GRIDs, SPOINTs, & EPOINTs are stored in separate slots,
so they are unorganized.
- ..note :: see
self.get_nid_map(sort_ids=False)
for the unsorted version
- pyNastran.bdf.bdf_interface.get_card._get_pid_to_node_ids_and_elements_array(model: BDF, pids: list[int], etypes: list[str], msg: str, idtype: str)[source]
a work in progress
- Parameters:
- pidslist[int]
list of property ID
- etypeslist[str]
element types to consider
- msgstr
???
- idetypestr
‘int32’, ‘int64’
- Returns:
- pid_to_eids_ieids_mapdict[(pid, etype)] = eid_ieid
- eid_ieid(Nelements, 2) int ndarray
eid is the element id ieid is the index in the node_ids array
- node_ids(nelements, nnodes) int ndarray
- nelementsint
the number of elements in the property type
- nnodesint
varies based on the element type