def test_gap_01(self): """tests a CGAP/PGAP""" log = get_logger(level='warning') model = BDF(log=log) lines = [ 'CGAP 899 90 21 99 0. 1. 0. 0' ] card = model._process_card(lines) card = BDFCard(card) cgap = CGAP.add_card(card, comment='cgap') node_ids = cgap.node_ids assert node_ids == [21, 99], node_ids self.assertEqual(cgap.eid, 899) self.assertEqual(cgap.Pid(), 90) cgap.write_card(size=8) cgap.raw_fields() lines = ['PGAP 90 1.E+5'] card = model._process_card(lines) card = BDFCard(card) pgap = PGAP.add_card(card, comment='pgap') pgap.write_card(size=8) pgap.write_card(size=16) self.assertEqual(pgap.Pid(), 90) pgap.raw_fields()
def test_pgap_01(self): lines = ['PGAP 90 1.E+5'] card = bdf.process_card(lines) card = BDFCard(card) size = 8 card = PGAP(card) card.write_bdf(size, 'dummy') self.assertEquals(card.Pid(), 90) card.raw_fields()
def test_pgap_01(self): lines = ['PGAP 90 1.E+5'] card = bdf.process_card(lines) card = BDFCard(card) size = 8 elem = PGAP.add_card(card) elem.write_card(size, 'dummy') self.assertEqual(elem.Pid(), 90) elem.raw_fields()
def readPGAP(self, data): """ PGAP(3201,32,55) - the marker for Record 42 """ #print "reading PGAP" while len(data) >= 44: # 11*4 eData = data[:44] data = data[44:] out = unpack(b'i10f', eData) #(pid,u0,f0,ka,kb,kt,mu1,mu2,tmax,mar,trmin) = out prop = PGAP(None, out) self.addOp2Property(prop)
def _readPGAP(self, data, n): """ PGAP(3201,32,55) - the marker for Record 42 """ s = Struct(b'i10f') nproperties = (len(data) - n) // 44 for i in range(nproperties): eData = data[n:n + 44] out = s.unpack(eData) self.binary_debug.write(' PGAP=%s\n' % str(out)) #(pid,u0,f0,ka,kb,kt,mu1,mu2,tmax,mar,trmin) = out prop = PGAP(None, out) self.addOp2Property(prop) return n
def test_gap_01(self): """tests a CGAP/PGAP""" log = get_logger(level='warning') model = BDF(log=log) lines = [ 'CGAP 899 90 21 99 0. 1. 0. 0' ] card = model._process_card(lines) card = BDFCard(card) cgap = CGAP.add_card(card, comment='cgap') node_ids = cgap.node_ids assert node_ids == [21, 99], node_ids self.assertEqual(cgap.eid, 899) self.assertEqual(cgap.Pid(), 90) cgap.write_card(size=8) cgap.raw_fields() model.elements[899] = cgap lines = ['PGAP 90 1.E+5'] card = model._process_card(lines) card = BDFCard(card) pgap = PGAP.add_card(card, comment='pgap') pgap.write_card(size=8) pgap.write_card(size=16) self.assertEqual(pgap.Pid(), 90) pgap.raw_fields() model.properties[90] = pgap model.add_grid(3, [-1., 0., 0.]) model.add_grid(21, [0., 0., 0.]) model.add_grid(99, [1., 0., 0.]) eid = 100 pid = 90 nids = [21, 99] x = None g0 = 3 cid = None cgap = model.add_cgap(eid, pid, nids, x, g0, cid, comment='cgap') node_ids = cgap.node_ids assert node_ids == [21, 99], node_ids self.assertEqual(cgap.eid, 100) self.assertEqual(cgap.Pid(), 90) cgap.write_card(size=8) cgap.raw_fields() model.cross_reference() save_load_deck(model)
def _read_pgap(self, data, n): """ PGAP(3201,32,55) - the marker for Record 42 """ s = Struct(b(self._endian + 'i10f')) nproperties = (len(data) - n) // 44 for i in range(nproperties): edata = data[n:n+44] out = s.unpack(edata) if self.is_debug_file: self.binary_debug.write(' PGAP=%s\n' % str(out)) #(pid,u0,f0,ka,kb,kt,mu1,mu2,tmax,mar,trmin) = out prop = PGAP.add_op2_data(out) self._add_op2_property(prop) #self.card_count['PGAP'] = nproperties return n