def test_cpenta_01(self): """tests a cpenta15""" lines = [ 'CPENTA,85,22,201,202,203,205,206,207,+PN2', '+PN2,209,210,217, , , ,213,214,', ',218' ] bdf = BDF(debug=False) card = bdf.process_card(lines) card = BDFCard(card) solid = CPENTA15.add_card(card, comment='cpenta15') solid.write_card(size=8, is_double=False) solid.write_card(size=16, is_double=False) solid.raw_fields() node_ids = solid.node_ids assert node_ids == [ 201, 202, 203, 205, 206, 207, 209, 210, 217, None, None, None, 213, 214, 218 ], node_ids nids = [ 201, 202, 203, 205, 206, 207, 209, 210, 217, None, None, None, 213, 214, 218 ] CPENTA15.add_card(card, comment='spike') eid = 85 pid = 22 bdf.add_cpenta(eid, pid, nids, comment='spike')
def test_cpenta_01(self): """tests a cpenta15""" lines = [ 'CPENTA,85,22,201,202,203,205,206,207,+PN2', '+PN2,209,210,217, , , ,213,214,', ',218' ] bdf = BDF(debug=False) card = bdf.process_card(lines) card = BDFCard(card) solid = CPENTA15.add_card(card, comment='cpenta15') solid.write_card(size=8, is_double=False) solid.write_card(size=16, is_double=False) solid.raw_fields() node_ids = solid.node_ids assert node_ids == [201, 202, 203, 205, 206, 207, 209, 210, 217, None, None, None, 213, 214, 218], node_ids nids = [201, 202, 203, 205, 206, 207, 209, 210, 217, None, None, None, 213, 214, 218] CPENTA.add_card(card, comment='spike') eid = 85 pid = 22 bdf.add_cpenta(eid, pid, nids, comment='spike')
def test_cpenta_01(self): lines = ["CPENTA,85,22,201,202,203,205,206,207,+PN2", "+PN2,209,210,217, , , ,213,214,", ",218"] card = bdf.process_card(lines) card = BDFCard(card) size = 8 card = CPENTA15.add_card(card) card.write_card(size, "dummy") node_ids = card.node_ids assert node_ids == [201, 202, 203, 205, 206, 207, 209, 210, 217, None, None, None, 213, 214, 218], node_ids card.raw_fields()
def readCPENTA(self, data): """ CPENTA(4108,41,280) - the marker for Record 62 """ #print "reading CPENTA" n = 0 nEntries = len(data) // 68 for i in range(nEntries): eData = data[n:n + 68] # 17*4 out = unpack('iiiiiiiiiiiiiiiii', eData) (eid, pid, g1, g2, g3, g4, g5, g6, g7, g8, g9, g10, g11, g12, g13, g14, g15) = out dataIn = [eid, pid, g1, g2, g3, g4, g5, g6] bigNodes = [g7, g8, g9, g10, g11, g12, g13, g14, g15] if sum(bigNodes) > 0: elem = CPENTA15(None, dataIn + bigNodes) else: elem = CPENTA6(None, dataIn) self.addOp2Element(elem) n += 68 data = data[n:]
def _readCPENTA(self, data, n): """ CPENTA(4108,41,280) - the marker for Record 62 """ s = Struct(b'17i') nelements = (len(data) - n) // 68 for i in xrange(nelements): eData = data[n:n + 68] # 17*4 out = s.unpack(eData) (eid, pid, g1, g2, g3, g4, g5, g6, g7, g8, g9, g10, g11, g12, g13, g14, g15) = out dataIn = [eid, pid, g1, g2, g3, g4, g5, g6] bigNodes = [g7, g8, g9, g10, g11, g12, g13, g14, g15] if sum(bigNodes) > 0: elem = CPENTA15(None, dataIn + bigNodes) else: elem = CPENTA6(None, dataIn) self.addOp2Element(elem) n += 68 self.card_count['CPENTA'] = nelements return n