def test_cord1r_01(self): """simple CORD1R input/output test""" lines = ['cord1r,2,1,4,3'] model = BDF(debug=False) card = model._process_card(lines) card = BDFCard(card) size = 8 coord = CORD1R.add_card(card) self.assertEqual(coord.Cid(), 2) self.assertEqual(coord.Rid(), 0) coord.write_card(size, 'dummy') coord.raw_fields()
def _read_cord1r(self, data, n): """ (1801,18,5) - the marker for Record 2 """ struct_6i = Struct(self._endian + b'6i') nentries = (len(data) - n) // 24 for i in range(nentries): edata = data[n:n + 24] # 6*4 out = struct_6i.unpack(edata) (cid, one1, one2, g1, g2, g3) = out if self.is_debug_file: self.binary_debug.write(' CORD1R=%s\n' % str(out)) assert one1 == 1, one1 assert one2 == 1, one2 data_in = [cid, g1, g2, g3] coord = CORD1R.add_op2_data(data_in) self._add_coord_object(coord) n += 24 self.increase_card_count('CORD1R', nentries) return n
def _read_cord1r(self, data, n): """ (1801,18,5) - the marker for Record 2 """ s = Struct(b(self._endian + '6i')) nentries = (len(data) - n) // 24 for i in range(nentries): edata = data[n:n + 24] # 6*4 out = s.unpack(edata) (cid, one1, one2, g1, g2, g3) = out if self.is_debug_file: self.binary_debug.write(' CORD1R=%s\n' % str(out)) assert one1 == 1, one1 assert one2 == 1, one2 data_in = [cid, g1, g2, g3] coord = CORD1R.add_op2_data(data_in) self.add_coord(coord) n += 24 self._increase_card_count('CORD1R', nentries) return n
def _read_cord1r(self, data, n): """ (1801,18,5) - the marker for Record 2 """ ntotal = 24 * self.factor # 6*4 struct_6i = Struct(mapfmt(self._endian + b'6i', self.size)) nentries = (len(data) - n) // ntotal for unused_i in range(nentries): edata = data[n:n + ntotal] out = struct_6i.unpack(edata) (cid, one1, one2, g1, g2, g3) = out if self.is_debug_file: self.binary_debug.write(' CORD1R=%s\n' % str(out)) assert one1 == 1, one1 assert one2 == 1, one2 data_in = [cid, g1, g2, g3] coord = CORD1R.add_op2_data(data_in) self._add_coord_object(coord) n += ntotal self.increase_card_count('CORD1R', nentries) return n
def add_cord1r(self, card, comment=''): """adds a CORD1R card""" coord = CORD1R.add_card(card, comment=comment) self.coords[coord.cid] = coord self.n += 1