def test_cord1s_01(self): lines = ['cord1s,2,1,4,3'] model = BDF(debug=False) card = model._process_card(lines) cardi = BDFCard(card) size = 8 card = CORD1S.add_card(cardi) self.assertEqual(card.Cid(), 2) self.assertEqual(card.Rid(), 0) card.write_card(size, 'dummy') card.raw_fields() model = BDF(debug=False) model.set_error_storage(nparse_errors=0, stop_on_parsing_error=True, nxref_errors=0, stop_on_xref_error=True) cid = 2 grid1, grid2, grid3 = 1, 4, 3 coord = model.add_cord1s(cid, grid1, grid2, grid3, comment='cord1c') coord.comment = '' assert coord == card, 'card:\n%r\ncoord:\n%r' % (str(coord), str(card)) make_tri(model) coord.cross_reference(model) model2 = deepcopy(model) model2.cross_reference() save_load_deck(model2, run_renumber=False) unused_cord2s = coord.to_cord2x(model, rid=0) model.pop_parse_errors() model.pop_xref_errors() model.coords[cid] = coord model.cross_reference() save_load_deck(model, run_renumber=False)
def test_cord1s_01(self): lines = ['cord1s,2,1,4,3'] model = BDF(debug=False) card = model._process_card(lines) cardi = BDFCard(card) size = 8 card = CORD1S.add_card(cardi) self.assertEqual(card.Cid(), 2) self.assertEqual(card.Rid(), 0) card.write_card(size, 'dummy') card.raw_fields() model = BDF(debug=False) cid = 2 grid1, grid2, grid3 = 1, 4, 3 coord = model.add_cord1s(cid, grid1, grid2, grid3, comment='cord1c') coord.comment = '' assert coord == card, 'card:\n%r\ncoord:\n%r' % (str(coord), str(card)) model.add_grid(1, [0., 0., 0.]) model.add_grid(3, [0., 0., 1.]) model.add_grid(4, [1., 0., 1.]) coord.cross_reference(model) unused_cord2s = coord.to_cord2x(model, rid=0)
def _read_cord1s(self, data, n): """ (1901,19,7) - the marker for Record 3 """ 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, three, one, g1, g2, g3) = out if self.is_debug_file: self.binary_debug.write(' CORD1S=%s\n' % str(out)) assert three == 3, three assert one == 1, one data_in = [cid, g1, g2, g3] coord = CORD1S.add_op2_data(data_in) self._add_coord_object(coord, allow_overwrites=True) n += 24 self.increase_card_count('CORD1S', nentries) return n
def _read_cord1s(self, data, n): """ (1901,19,7) - the marker for Record 3 """ 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, three, one, g1, g2, g3) = out if self.is_debug_file: self.binary_debug.write(' CORD1S=%s\n' % str(out)) assert three == 3, three assert one == 1, one data_in = [cid, g1, g2, g3] coord = CORD1S.add_op2_data(data_in) self.add_coord(coord, allow_overwrites=True) n += 24 self._increase_card_count('CORD1S', nentries) return n
def _read_cord1s(self, data, n): """ (1901,19,7) - the marker for Record 3 """ 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, three, one, g1, g2, g3) = out if self.is_debug_file: self.binary_debug.write(' CORD1S=%s\n' % str(out)) assert three == 3, three assert one == 1, one data_in = [cid, g1, g2, g3] coord = CORD1S.add_op2_data(data_in) self._add_coord_object(coord, allow_overwrites=False) n += ntotal self.increase_card_count('CORD1S', nentries) return n
def add_cord1s(self, card, comment=''): """adds a CORD1S card""" coord = CORD1S.add_card(card, comment=comment) self.coords[coord.cid] = coord self.n += 1