def hasMtnumIninp(self, inpfile, matnum): mh = McnpinpHandler() cellcards = mh.readCellCards(inpfile) matincellcard = [] for line in cellcards: lists = line.strip().split() matincellcard.append(lists[1]) for mat in matnum: if mat not in matincellcard: mh.errorMessage(' material number {:} do not exists!\n'.format(mat)) return False return True
def isTMPIdentical(self, filename, workpath=None): inpfile = filename tmpdic = {} if workpath: inpfile = os.path.join(workpath, filename) mh = McnpinpHandler() cellcards = mh.readCellCards(inpfile) for line in cellcards: lists = line.strip().split() mat = lists[1] if mat not in tmpdic.keys(): tmpdic[mat] = [] for ii, eachstr in enumerate(lists): if 'tmp' in eachstr or 'TMP' in eachstr: tmp = lists[ii][4:] tmpdic[mat].append(tmp) for key, tmps in tmpdic.items(): if len(set(tmps)) > 1: mh.errorMessage('The TMP card of material {:} is inconsistent!\n'.format(key)) return False return True