Skip to content

Commit e15ff97

Browse files
committed
ONR fixes
minor warning fixes
1 parent db5f7bc commit e15ff97

File tree

10 files changed

+25
-63
lines changed

10 files changed

+25
-63
lines changed

pyNastran/bdf/bdf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,7 @@ def disable_cards(self, cards: Sequence[str]) -> None:
11491149
if cards is None:
11501150
return
11511151
elif isinstance(cards, str):
1152-
disable_set = set([cards])
1152+
disable_set = {cards}
11531153
else:
11541154
disable_set = set(cards)
11551155
self.cards_to_read = self.cards_to_read.difference(disable_set)

pyNastran/bdf/cards/aero/aero.py

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,22 +1060,9 @@ def add_card(cls, card, comment=''):
10601060
@property
10611061
def aesid(self) -> int:
10621062
return self.aesurf_id
1063-
@property
1064-
def alid1(self) -> int:
1065-
return self.aelist_id1
1066-
@property
1067-
def alid2(self) -> int:
1068-
return self.aelist_id2
1069-
10701063
@aesid.setter
10711064
def aesid(self, aesid: int) -> None:
10721065
self.aesurf_id = aesid
1073-
@alid1.setter
1074-
def alid1(self, alid1: int) -> None:
1075-
self.aelist_id1 = alid1
1076-
@aesid.setter
1077-
def alid2(self, alid2: int) -> None:
1078-
self.aelist_id2 = alid2
10791066

10801067
#@property
10811068
#def aesid_ref(self):
@@ -1161,9 +1148,9 @@ def update(self, unused_model, maps):
11611148
if self.cid2:
11621149
self.cid2 = coord_map[self.cid2]
11631150

1164-
self.alid1 = aelist_map[self.alid1]
1165-
if self.alid2:
1166-
self.alid2 = aelist_map[self.alid2]
1151+
self.aelist_idid1 = aelist_map[self.aelist_idid1]
1152+
if self.aelist_id2:
1153+
self.aelist_id2 = aelist_map[self.alid2]
11671154

11681155
def raw_fields(self):
11691156
"""

pyNastran/bdf/cards/constraints.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,36 +1259,6 @@ def add_card(cls, card, comment=''):
12591259
assert len(card) > 1, f'len(SPCOFF card) = {len(card):d}\ncard={card}'
12601260
return SPCOFF(nodes, components, comment=comment)
12611261

1262-
@classmethod
1263-
def add_op2_data(cls, data, comment=''):
1264-
"""
1265-
Adds a SPCOFF card from the OP2
1266-
1267-
Parameters
1268-
----------
1269-
data : list[varies]
1270-
a list of fields defined in OP2 format
1271-
comment : str; default=''
1272-
a comment for the card
1273-
1274-
"""
1275-
nodes = [data[0]]
1276-
components = data[1]
1277-
assert 0 <= components <= 123456, data
1278-
enforced = [data[2]]
1279-
assert nodes[0] > 0, data
1280-
components_str = str(components)
1281-
assert len(components_str) <= 6, data
1282-
components = [components_str]
1283-
#if components[0] == 0:
1284-
#components[0] = 0
1285-
#if components[0] == 16:
1286-
#components[0] = '16'
1287-
#else:
1288-
#raise RuntimeError('SPC; components=%s data=%s' % (components, data))
1289-
#assert 0 < components[0] > 1000, data
1290-
return SPCOFF(nodes, components, enforced, comment=comment)
1291-
12921262
@property
12931263
def constraints(self):
12941264
return self.components

pyNastran/bdf/case_control_deck2.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,7 @@ def _read(self, lines: list[str]) -> None:
517517
518518
"""
519519
isubcase = 0
520+
log = self.log
520521
lines = _clean_lines(lines)
521522
self.output_lines = []
522523
i = 0
@@ -531,11 +532,11 @@ def _read(self, lines: list[str]) -> None:
531532
lines2.append(lines[i])
532533
#comment = lines[i][72:]
533534
(unused_j, fail_flag, key, value, options, param_type) = _parse_entry(
534-
lines2, self.log, debug=self.debug)
535+
lines2, log, debug=self.debug)
535536
i += 1
536537

537538
if fail_flag:
538-
self.log.warning(f'skipping Case Control line {i}: {line!r}')
539+
log.warning(f'skipping Case Control line {i}: {line!r}')
539540
continue
540541

541542
line_upper = line.upper()

pyNastran/bdf/mesh_utils/cleanup_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def remove_element_chain(model: BDF,
243243
nodes_all: set[int],
244244
element_types: Union[str, set[str]]) -> tuple[set[int], list[int]]:
245245
if isinstance(element_types, str):
246-
element_types = set([element_types])
246+
element_types = {element_types}
247247
eids_to_delete = []
248248
nodes_all2 = set([])
249249
for eid, elem in model.elements.items():

pyNastran/bdf/mesh_utils/dev/dev_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def extract_surface_patches(bdf_filename, starting_eids, theta_tols=40.):
325325
for starting_eid, theta_tol in zip(starting_eids, theta_tols):
326326
print('starting_eid = %s' % starting_eid)
327327
group = set()
328-
check = set([starting_eid])
328+
check = {starting_eid}
329329
while check:
330330
eid = next(iter(check))
331331
#print(' eid = %s' % eid)

pyNastran/bdf/mesh_utils/extract_bodies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def extract_bodies(bdf_filename, mpc_id=0):
9494
keys = list(nid_to_eid_map.keys())
9595
all_nids_to_check = set(keys)
9696
key0 = keys[0]
97-
nids_to_check = set([key0])
97+
nids_to_check = {key0}
9898
if debug: # pragma: no cover
9999
print('all_nids_to_check= ', all_nids_to_check)
100100
body_eids = {ibody : set()}

pyNastran/bdf/mesh_utils/get_oml.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def get_oml_eids(bdf_filename: str | BDF | PurePath | StringIO,
4747
#2818 # close
4848

4949
#eids_oml = np.array([eid_start])
50-
eids_oml = set([eid_start])
50+
eids_oml = {eid_start}
5151
#---------------------------------
5252
theta_tol = np.radians(theta_tol)
5353

@@ -75,7 +75,7 @@ def get_oml_eids(bdf_filename: str | BDF | PurePath | StringIO,
7575
etypes_skipped.add(elem.type)
7676

7777
#eid_starts = eids_oml.tolist()
78-
eids_next = set([eid_start])
78+
eids_next = {eid_start}
7979
while eids_next:
8080
eid_starts = deepcopy(eids_next)
8181
eids_oml_start = deepcopy(eids_oml)

pyNastran/gui/dev/qt_groups.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ def _check_add(self, res_format, name, element_id=None, property_id=None, coord_
106106

107107
def _add_coord_id(self, name, coord_id):
108108
if coord_id is None:
109-
coord_id = set([0])
109+
coord_id = {0}
110110
elif isinstance(coord_id, int):
111-
coord_id = set([coord_id])
111+
coord_id = {coord_id}
112112
else:
113113
for cid in coord_id:
114114
assert isinstance(cid, int), type(cid)

pyNastran/op2/tables/oee_energy/onr.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
'TRIA3FD' : 'ctria3_strain_energy',
2525
'TRIA6' : 'ctria6_strain_energy',
2626
'TRIAX6' : 'ctriax6_strain_energy',
27+
'CTRIA6N' : 'ctria6_strain_energy', # per JG
2728
'TRIAR' : 'ctriar_strain_energy',
2829
'TRIAX3FD' : 'ctriax_strain_energy',
2930
'TRIAXFD' : 'ctriax_strain_energy',
@@ -32,6 +33,7 @@
3233
'QUADFD' : 'cquad4_strain_energy',
3334
'QUAD4FD' : 'cquad4_strain_energy',
3435
'QUAD8' : 'cquad8_strain_energy',
36+
'CQUAD8N' : 'cquad8_strain_energy', # guessed per JG
3537
# TODO: this will probably be a problem someday...cquad8_nonlinear_strain_energy
3638
'QUAD8N' : 'cquad8_strain_energy',
3739

@@ -442,7 +444,7 @@ def _read_onr2_3(self, data: bytes, ndata: int):
442444
op2._read_title(data)
443445
op2._write_debug_bits()
444446

445-
def _read_onr1_4(self, data: bytes, ndata: int):
447+
def _read_onr1_4(self, data: bytes, ndata: int) -> int:
446448
"""
447449
reads ONRGY1 subtable 4
448450
"""
@@ -456,7 +458,7 @@ def _read_onr1_4(self, data: bytes, ndata: int):
456458
raise NotImplementedError(op2.table_code)
457459
return n
458460

459-
def _read_element_strain_energy(self, data: bytes, ndata: int):
461+
def _read_element_strain_energy(self, data: bytes, ndata: int) -> int:
460462
"""
461463
table_code = 19
462464
"""
@@ -663,7 +665,7 @@ def _read_element_strain_energy(self, data: bytes, ndata: int):
663665
#print "%s" %(self.get_element_type(self.element_type)), data_in
664666
#eid = op2.obj.add_new_eid_sort1(out)
665667
if op2.is_debug_file:
666-
op2.binary_debug.write(' eid=%i; %s\n' % (eid, str(out)))
668+
op2.binary_debug.write(' eid=%s; %s\n' % (eid, str(out)))
667669
obj.add_sort1(dt, word, energy, percent, density)
668670
n += ntotal
669671
elif op2.format_code in [2, 3] and op2.num_wide == 4:
@@ -705,8 +707,9 @@ def _read_element_strain_energy(self, data: bytes, ndata: int):
705707
return n
706708

707709

708-
def complex_strain_energy_5(op2, data, sort_method,
709-
size, n, ntotal, nelements, dt) -> int:
710+
def complex_strain_energy_5(op2: OP2, data: bytes, sort_method: int,
711+
size: int, n: int,
712+
ntotal: int, nelements: int, dt) -> int:
710713
obj: RealStrainEnergyArray = op2.obj
711714

712715
#fmt = mapfmt(op2._endian + op2._analysis_code_fmt + b'3f', size)
@@ -807,8 +810,9 @@ def real_strain_energy_4(op2: OP2,
807810
n += ntotal
808811
return n
809812

810-
def complex_strain_energy_4(op2, data, sort_method,
811-
size, n, ntotal, nnodes, dt):
813+
def complex_strain_energy_4(op2: OP2, data: bytes, sort_method: int,
814+
size: int, n: int,
815+
ntotal: int, nnodes: int, dt) -> int:
812816
obj: ComplexStrainEnergyArray = op2.obj
813817
s = Struct(op2._endian + b'8s3f')
814818
for unused_i in range(nnodes):

0 commit comments

Comments
 (0)