Пример #1
0
 def readSPOINT(self, data):
     """
     (5551,49,105)    - the marker for Record 118
     """
     while len(data) >= 4:  # 4*4
         eData = data[:4]
         data = data[4:]
         (nid, ) = unpack('i', eData)
         spoint = SPOINTs(None, [nid])
         self.add_SPOINT(spoint)
Пример #2
0
 def _readSPOINT(self, data, n):
     """
     (5551,49,105)    - the marker for Record 118
     """
     npoints = (len(data) - n) // 4
     fmt = b'%ii' % npoints
     nids = unpack(fmt, data[n:])
     spoint = SPOINTs(None, list(nids))
     self.add_SPOINT(spoint)
     self.card_count['SPOINT'] = npoints
     return n
Пример #3
0
    def test_spoint_01(self):
        #      12345678 2345678 2345678 2345678 2345678 2345678
        msg = 'SPOINT         1       3       5\n'
        card = BDFCard(['SPOINT', 1, 3, 5])
        s1 = SPOINT.add_card(card)
        s1.write_card()
        assert list(s1.points) == [1, 3, 5], '\n%s' % list(s1.points)
        assert s1.write_card() == msg, '\n%s---\n%s' % (s1.write_card(), msg)

        #      12345678 2345678 2345678 2345678 2345678 2345678
        msg = 'SPOINT         1    THRU       5\n'
        card = BDFCard(['SPOINT', 1, 'THRU', 5])
        s2 = SPOINT.add_card(card)
        assert list(s2.points) == [1, 2, 3, 4, 5], '\n%s' % list(s2.points)
        #assert s2.write_card() == msg, '\n%s---\n%s' % (s2.write_card(), msg)

        #       12345678 2345678 2345678 2345678 2345678 2345678
        msg = 'SPOINT         7\n'
        msg += 'SPOINT         1    THRU       5\n'
        card = BDFCard(['SPOINT', 1, 2, 3, 4, 5, 7])
        s3 = SPOINT.add_card(card)
        assert list(s3.points) == [1, 2, 3, 4, 5, 7], '\n%s' % list(s3.points)
        #assert s3.write_card() == msg, '\n%s---\n%s' % (s3.write_card(), msg)

        #       12345678 2345678 2345678 2345678 2345678 2345678
        msg = 'SPOINT         7\n'
        msg += 'SPOINT         1    THRU       5\n'
        card = BDFCard(['SPOINT', 1, 'THRU', 5, 7])
        s4 = SPOINT.add_card(card)
        assert list(s4.points) == [1, 2, 3, 4, 5, 7], '\n%s' % list(s4.points)
        #assert s4.write_card() == msg, '\n%s---\n%s' % (s4.write_card(), msg)


        #       12345678 2345678 2345678 2345678 2345678 2345678
        msg = 'SPOINT         7\n'
        msg += 'SPOINT         1    THRU       5\n'
        card = BDFCard(['SPOINT', 1, 'THRU', 5, 7])
        s5 = SPOINT.add_card(card)
        assert list(s5.points) == [1, 2, 3, 4, 5, 7], '\n%s' % list(s5.points)
        assert s5.write_card() == msg, '\n%s---\n%s' % (s5.write_card(), msg)
Пример #4
0
 def _read_spoint(self, data, n):
     """
     (5551,49,105)    - the marker for Record 118
     """
     npoints = (len(data) - n) // 4
     fmt = b'%ii' % npoints
     nids = unpack(fmt, data[n:])
     if self.is_debug_file:
         self.binary_debug.write('SPOINT=%s\n' % str(nids))
     spoint = SPOINTs.add_op2_data(list(nids))
     self.add_spoint(spoint)
     self.card_count['SPOINT'] = npoints
     return n