def load_hdf5_file(self, hdf5_file, encoding): from pyNastran.utils.dict_to_h5py import _cast keys = list(hdf5_file.keys()) for key in keys: if key in ['_begin_count', 'debug', 'write_begin_bulk']: # scalars value = _cast(hdf5_file[key]) setattr(self, key, value) elif key in [ 'reject_lines', 'begin_bulk', 'lines', 'output_lines' ]: # lists of strings value_bytes = _cast(hdf5_file[key]).tolist() value_str = [line.decode(encoding) for line in value_bytes] elif key == 'subcases': subcase_group = hdf5_file[key] keys = list(subcase_group.keys()) keys.remove('keys') subcases = {} for key in keys: sub_group = subcase_group[key] ikey = int(key) subcase = Subcase(id=ikey) subcase.log = self.log subcase.load_hdf5_file(sub_group, encoding) subcases[ikey] = subcase str(subcase) self.subcases = subcases #print(value_bytes) else: # pragma: no cover self.log.warning('skipping CaseControlDeck/%s' % key) raise RuntimeError('error loading hdf5 CaseControlDeck/%s' % key)
def load_hdf5_file(self, hdf5_file, encoding: str) -> None: """loads the case control deck section from a hdf5 file""" from pyNastran.utils.dict_to_h5py import _cast keys = list(hdf5_file.keys()) for key in keys: if key in ['_begin_count', 'debug', 'write_begin_bulk']: # scalars value = _cast(hdf5_file[key]) setattr(self, key, value) elif key in [ 'reject_lines', 'begin_bulk', 'lines', 'output_lines' ]: # lists of strings unused_lines_str = decode_lines(_cast(hdf5_file[key]), encoding) elif key == 'subcases': subcase_group = hdf5_file[key] keys = list(subcase_group.keys()) keys.remove('keys') subcases = {} for key2 in keys: sub_group = subcase_group[key2] ikey2 = int(key2) subcase = Subcase(id=ikey2) subcase.log = self.log subcase.load_hdf5_file(sub_group, encoding) subcases[ikey2] = subcase str(subcase) self.subcases = subcases #print(value_bytes) else: # pragma: no cover self.log.warning('skipping CaseControlDeck/%s' % key) raise RuntimeError('error loading hdf5 CaseControlDeck/%s' % key)
def __init__(self, lines: List[str], log: Optional[Any] = None) -> None: """ Parameters ---------- lines : List[str] list of lines that represent the case control deck ending with BEGIN BULK log : log() a :mod: `logging` object """ self.use_card_dict = True # pulls the logger from the BDF object self.log = get_logger(log, level="debug") self.debug = False self.sol_200_map = { 'STATICS': 101, 'STATIC': 101, 'MODES': 103, 'MODE': 103, 'BUCK': 105, 'BUCKLING': 105, 'DFREQ': 108, 'MFREQ': 111, 'SAERO': 144, 'FLUTTER': 145, 'FLUT': 145, 'DIVERGE': 144, 'DIVERG': 145, # 'HEAT' : , # 'STRUCTURE' : , 'NLSTATICS': 400, 'LNSTATICS': 400, 'MTRAN': 112, 'DCEIG': 107, } # 'HEAT', 'ANALYSIS', 'MFREQ', 'STATICS', 'MODES', 'DFREQ', # 'MTRAN', 'BUCK', 'MCEIG', 'DCEIG', 'SAERO', 'NLSTATIC', 'NLSTAT', # 'STATIC', 'MTRANS', 'MODE', 'FLUTTER', 'DIVERG', 'NLTRAN', 'FLUT', #self.debug = True #: stores a single copy of 'BEGIN BULK' or 'BEGIN SUPER' self.reject_lines = [] # type: List[str] self.begin_bulk = ['BEGIN', 'BULK'] # allows BEGIN BULK to be turned off self.write_begin_bulk = True self._begin_count = 0 self.lines = lines self.subcases = {0: Subcase(id=0)} # type: Dict[int, Subcase] try: self._read(self.lines) except: self.log.error('Invalid Case Control Deck:\n' + '\n'.join(self.lines)) raise
def __init__(self, lines, log=None): """ :param self: the CaseControlDeck object :param lines: list of lines that represent the case control deck ending with BEGIN BULK :param log: a :mod: `logging` object """ # pulls the logger from the BDF object self.log = get_logger(log, "debug") self.debug = False #self.debug = True #: stores a single copy of 'BEGIN BULK' or 'BEGIN SUPER' self.begin_bulk = ['BEGIN', 'BULK'] # allows BEGIN BULK to be turned off self.write_begin_bulk = True self._begin_count = 0 self.lines = lines self.subcases = {0: Subcase(id=0)} self._read(self.lines)
def __init__(self, lines, log=None): """ @param self the case control deck object @param lines list of lines that represent the case control deck ending with BEGIN BULK @param log a logger object """ if log is None: #if 1: from pyNastran.general.logger import dummyLogger word = 'debug' loggerObj = dummyLogger() log = loggerObj.startLog(word) # or info self.debug = False #self.debug = True self.log = log self.lines = lines self.subcases = {0: Subcase(id=0)} self._read(self.lines)
def __init__(self, lines: List[str], log: Optional[Any]=None) -> None: """ Creates the CaseControlDeck from a set of lines Parameters ---------- lines : List[str] list of lines that represent the case control deck ending with BEGIN BULK log : log() a :mod: `logging` object """ # pulls the logger from the BDF object self.log = get_logger(log, level="debug") self.debug = False self.sol_200_map = { #101 - Linear Static #103 - Modal #105 - Buckling #106 - Non-Linear Static #107 - Direct Complex Eigenvalue #108 - Direct Frequency Response #109 - Direct Transient Response #110 - Modal Complex Eigenvalue #111 - Modal Frequency Response #112 - Modal Transient Response #129 - Nonlinear Transient #144 - Static Aeroelastic Analysis #145 - Flutter / Aeroservoelastic analysis #146 - Dynamic Aeroelastic Analysis #153 - Non-Linear static coupled with heat transfer #159 - Nonlinear Transient coupled with Heat transfer #187 - Dynamic Design Analysis Method #200 - Design Optimization and Sensitivity analysis #400 - Non-Linear Static and Dynamic (implicit) (MSC.NASTRAN native, supersedes 106, 129, 153 and 159 - part of MSC.NASTRAN) #401 - Non-Linear Static (SAMCEF based for NX.NASTRAN) #402 - Non-Linear Static and Dynamic (implicit) (SAMCEF based for NX.NASTRAN) #600 - Non-Linear Static and Dynamic (implicit) (front end to MSC.Marc - part of MSC.NASTRAN) #601 - Implicit Non-Linear (ADINA for NX Nastran, will no longer be available in NX NASTRAN after 2020) #700 - Explicit Non-Linear (LS Dyna plus MSC.Dytran - part of MSC.NASTRAN) #701 - Explicit Non-Linear (ADINA for NX Nastran, will no longer be available in NX NASTRAN after 2020) 'STATICS' : 101, 'STATIC' : 101, 'MODES' : 103, 'MODE' : 103, 'BUCK' : 105, 'BUCKLING' : 105, 'DFREQ' : 108, 'MFREQ' : 111, 'SAERO' : 144, 'FLUTTER' : 145, 'FLUT' : 145, 'DIVERGE' : 144, 'DIVERG' : 145, # 'HEAT' : , # 'STRUCTURE' : , 'NLSTATICS' : 400, 'LNSTATICS' : 400, 'MTRAN' : 112, 'DCEIG' : 107, } # 'HEAT', 'ANALYSIS', 'MFREQ', 'STATICS', 'MODES', 'DFREQ', # 'MTRAN', 'BUCK', 'MCEIG', 'DCEIG', 'SAERO', 'NLSTATIC', 'NLSTAT', # 'STATIC', 'MTRANS', 'MODE', 'FLUTTER', 'DIVERG', 'NLTRAN', 'FLUT', #self.debug = True #: stores a single copy of 'BEGIN BULK' or 'BEGIN SUPER' self.reject_lines = [] # type: List[str] self.begin_bulk = ['BEGIN', 'BULK'] # allows BEGIN BULK to be turned off self.write_begin_bulk = True self._begin_count = 0 self.lines = lines self.subcases = {0: Subcase(id=0)} # type: Dict[int, Subcase] try: self._read(self.lines) except: self.log.error('Invalid Case Control Deck:\n' + '\n'.join(self.lines)) raise