def test_cord3g(self): """tests the CORD3G card""" cid = 1 #method_es = 'E313' method_es = 'E' method_int = 123 form = 'EQN' thetas = [110, 111, 112] rid = 0 cord3g_e = CORD3G(cid, method_es, method_int, form, thetas, rid, comment='cord3g') fields = BDFCard(cord3g_e.raw_fields()) cord3g_e.repr_fields() cord3g_e.add_card(fields) xyz = [0., 0., 0.] cord3g_e.coord3g_transform_to_global(xyz) method_es = 'S' cord3g_s = CORD3G(cid, method_es, method_int, form, thetas, rid, comment='cord3g') fields = BDFCard(cord3g_s.raw_fields()) cord3g_s.repr_fields() cord3g_s.add_card(fields) with self.assertRaises(NotImplementedError): # TODO: add me cord3g_s.coord3g_transform_to_global(xyz)
def test_cord3g(self): cid = 1 #method_es = 'E313' method_es = 'E' method_int = 42 form = 'EQN' thetas = [110, 111, 112] rid = 0 cord3g = CORD3G(cid, method_es, method_int, form, thetas, rid, comment='cord3g') fields = BDFCard(cord3g.raw_fields()) cord3g.repr_fields() cord3g.add_card(fields)
def _read_cord3g(self, data, n): """ (14301,143,651) - the marker for Record 7 .. todo:: isnt this a CORD3G, not a CORD3R ??? """ struct_4i = Struct(self._endian + b'4i') nentries = (len(data) - n) // 16 for i in range(nentries): edata = data[n:n + 16] # 4*4 out = struct_4i.unpack(edata) (cid, n1, n2, n3) = out coord = CORD3G.add_op2_data(out) if self.is_debug_file: self.binary_debug.write(' CORD3G=%s\n' % str(out)) self._add_coord_object(coord, allow_overwrites=True) n += 16 self.increase_card_count('CORD3G', nentries) return n
def _read_cord3g(self, data, n): """ (14301,143,651) - the marker for Record 7 .. todo:: isnt this a CORD3G, not a CORD3R ??? """ s = Struct(b(self._endian + '4i')) nentries = (len(data) - n) // 16 for i in range(nentries): edata = data[n:n + 16] # 4*4 out = s.unpack(edata) (cid, n1, n2, n3) = out coord = CORD3G.add_op2_data(out) if self.is_debug_file: self.binary_debug.write(' CORD3G=%s\n' % str(out)) self.add_coord(coord, allow_overwrites=True) n += 16 self._increase_card_count('CORD3G', nentries) return n
def _read_cord3g(self, data: bytes, n: int) -> int: """ (14301,143,651) - the marker for Record 7 .. todo:: isnt this a CORD3G, not a CORD3R ??? """ ntotal = 16 * self.factor struct_4i = Struct(self._endian + b'4i') nentries = (len(data) - n) // ntotal for unused_i in range(nentries): edata = data[n:n + ntotal] # 4*4 out = struct_4i.unpack(edata) #(cid, n1, n2, n3) = out coord = CORD3G.add_op2_data(out) if self.is_debug_file: self.binary_debug.write(' CORD3G=%s\n' % str(out)) self._add_coord_object(coord, allow_overwrites=False) n += ntotal self.increase_card_count('CORD3G', nentries) return n