Skip to content

Commit

Permalink
more zona work
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveDoyle2 committed Jun 20, 2018
1 parent 9e51575 commit 8fa6e45
Show file tree
Hide file tree
Showing 9 changed files with 214 additions and 126 deletions.
3 changes: 1 addition & 2 deletions pyNastran/bdf/bdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3903,8 +3903,7 @@ def _parse_primary_file_header(self, bdf_filename):
else:
break

print('nastran_format = %r' % self.nastran_format)
if self.nastran_format == 'zaero':
if self.nastran_format == 'zona':
self._card_parser['TRIM'] = (TRIMZONA, self._add_trim_object)
self._card_parser['CAERO7'] = (CAERO7, self._add_caero_object)
self._card_parser['AEROZ'] = (AEROZ, self._add_aeros_object)
Expand Down
4 changes: 2 additions & 2 deletions pyNastran/bdf/bdf_interface/add_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -918,10 +918,10 @@ def _add_spline_object(self, spline):
def _add_panlst_object(self, panlst):
# type: (Any) -> None
"""adds an PANLST1/PANLST2/PANLST3 object"""
assert panlst.eid not in self.panlsts
assert panlst.eid not in self.zona.panlsts
assert panlst.eid > 0
key = panlst.eid
self.panlsts[key] = panlst
self.zona.panlsts[key] = panlst
self._type_to_id_map[panlst.type].append(key)

def _add_gust_object(self, gust):
Expand Down
27 changes: 23 additions & 4 deletions pyNastran/bdf/bdf_interface/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from __future__ import print_function, unicode_literals
from collections import defaultdict
from typing import List, Dict, Optional, Any
from six import itervalues
from numpy import array # type: ignore

from pyNastran.utils import object_attributes, object_methods
Expand All @@ -10,6 +11,26 @@
from pyNastran.bdf.cards.coordinate_systems import CORD2R
#from pyNastran.bdf.cards.constraints import ConstraintObject

class ZONA(object):
def __init__(self, model):
self.model = model
self.caero_to_name_map = {}
#: store PANLST1,PANLST2,PANLST3
self.panlsts = {}

def cross_reference(self):
if self.model.nastran_format != 'zona':
return
for caero in itervalues(self.model.caeros):
self.caero_to_name_map[caero.label] = caero.eid

def safe_cross_reference(self):
self.cross_reference()

def write_bdf(self, bdf_file, size=8, is_double=False):
for panlst in self.panlsts:
bdf_file.write(panlst.write_bdf(size=size, is_double=is_double))

class BDFAttributes(object):
"""defines attributes of the BDF"""

Expand Down Expand Up @@ -490,8 +511,7 @@ def __init_attributes(self):

#: store SPLINE1,SPLINE2,SPLINE4,SPLINE5
self.splines = {} # type: Dict[int, Any]
#: store PANLST1,PANLST2,PANLST3
self.panlsts = {}
self.zona = ZONA(self)

# axisymmetric
self.axic = None # type: Optional[Any]
Expand Down Expand Up @@ -807,9 +827,8 @@ def nastran_format(self):
@nastran_format.setter
def nastran_format(self, nastran_format):
fmt_lower = nastran_format.lower().strip()
if fmt_lower not in ['nx', 'msc', 'zaero']:
if fmt_lower not in ['nx', 'msc', 'zona']:
raise RuntimeError(nastran_format)
print('fmt =', fmt_lower)
self._nastran_format = fmt_lower

@property
Expand Down
1 change: 1 addition & 0 deletions pyNastran/bdf/bdf_interface/cross_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ def _cross_reference_aero(self, check_caero_element_ids=False):
Links up all the aero cards
- CAEROx, PAEROx, SPLINEx, AECOMP, AELIST, AEPARAM, AESTAT, AESURF, AESURFS
"""
self.zona.cross_reference()
for caero in itervalues(self.caeros):
caero.cross_reference(self)

Expand Down
9 changes: 7 additions & 2 deletions pyNastran/bdf/bdf_interface/pybdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ def _get_lines(self, bdf_filename, punch=False):
all_lines = self._lines_to_deck_lines(main_lines)
out = _lines_to_decks(all_lines, punch)
system_lines, executive_control_lines, case_control_lines, bulk_data_lines = out
if self.nastran_format == 'zaero':
if self.nastran_format in ['msc', 'nx']:
pass
elif self.nastran_format == 'zona':
system_lines2 = []
for system_line in system_lines:
if system_line.upper().startswith('ASSIGN'):
Expand All @@ -78,6 +80,7 @@ def _get_lines(self, bdf_filename, punch=False):
if header.startswith('ASSIGN FEM'):
fem, filename = header.split('=')
filename = filename.strip('"\'')
self.log.debug('reading %s' % filename)
if filename.lower().endswith('.f06'):
filename = os.path.splitext(filename)[0] + '.bdf'
assert filename.endswith('.bdf'), filename
Expand All @@ -94,9 +97,11 @@ def _get_lines(self, bdf_filename, punch=False):
pass
else:
raise NotImplementedError(system_line)
print(system_line)
system_lines2.append(system_line)
system_lines = system_lines
else:
msg = 'nastran_format=%r and must be msc, nx, or zona' % self.nastran_format
raise NotImplementedError(msg)
return system_lines, executive_control_lines, case_control_lines, bulk_data_lines

def _get_main_lines(self, bdf_filename):
Expand Down
1 change: 1 addition & 0 deletions pyNastran/bdf/bdf_interface/safe_cross_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def _safe_cross_reference_aero(self):
Links up all the aero cards
- CAEROx, PAEROx, SPLINEx, AECOMP, AELIST, AEPARAM, AESTAT, AESURF, AESURFS
"""
self.zona.safe_cross_reference()
xref_errors = defaultdict(list)
for caero in itervalues(self.caeros):
caero.safe_cross_reference(self, xref_errors)
Expand Down
1 change: 1 addition & 0 deletions pyNastran/bdf/bdf_interface/write_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ def _write_aero(self, bdf_file, size=8, is_double=False, is_long_ids=None):
bdf_file.write(spline.write_card(size, is_double))
for monitor_point in self.monitor_points:
bdf_file.write(monitor_point.write_card(size, is_double))
self.zona.write_bdf(bdf_file, size=8, is_double=False)

def _write_aero_control(self, bdf_file, size=8, is_double=False, is_long_ids=None):
# type: (Any, int, bool) -> None
Expand Down
Loading

0 comments on commit 8fa6e45

Please sign in to comment.