def test_coord_xform_b(self): origin = array([0., 0., 0.]) zaxis = array([0., 0., 1.]) xzplane = array([1., 0., 0.]) cid0 = CORD2R(cid=0, rid=0, origin=origin, zaxis=zaxis, xzplane=xzplane) Lx = 2. Ly = 3. Lz = 5. Fy = 1.5 origin = array([-Lx, -Ly, -Lz]) z_axis = origin + array([0., 0., 1.]) xz_plane = origin + array([1., 0., 1.]) rid = 0 data = [1, rid] + list(origin) + list(z_axis) + list(xz_plane) fxyz = [0., -Fy, 0.] mxyz = [0., 0., 0.] cid_new = CORD2R.add_op2_data(data=data) model = None fxyz_local, mxyz_local = TransformLoadWRT(fxyz, mxyz, cid0, cid_new, model) r = array([Lx, Ly, Lz]) F = array([0., -Fy, 0.]) M = cross(r, F) self.assertTrue(array_equal(fxyz_local, F), 'expected=%s actual=%s' % (F, fxyz_local)) self.assertTrue(array_equal(mxyz_local, M), 'expected=%s actual=%s' % (M, mxyz_local))
def test_A(self): cid0 = CORD2R() Lx = 2. Ly = 0. Lz = 3. Fy = 1. origin = array([-Lx, 0., -Lz]) z_axis = origin + array([0., 0., 1.]) xz_plane = origin + array([1., 0., 1.]) rid = 0 data = [1, rid] + list(origin) + list(z_axis) + list(xz_plane) Fxyz = [0., -Fy, 0.] Mxyz = [0., 0., 0.] cid_new = CORD2R(data=data) model = None Fxyz_local, Mxyz_local = TransformLoadWRT(Fxyz, Mxyz, cid0, cid_new, model, is_cid_int=False) r = array([Lx, Ly, Lz]) F = array([0., -Fy, 0.]) M = cross(r, F) self.assertTrue(array_equal(Fxyz_local, F)), "expected=%s actual=%s" % (F, Fxyz_local) self.assertTrue(array_equal(Mxyz_local, cross(r, F))), "expected=%s actual=%s" % (M, Mxyz_local)