def glob2Elem(self, a, coords): a_bar = empty(a.shape) R = eye(9) crd = zeros(shape=(2, 2)) crd[0, :] = coords[0, :] crd[1, :] = coords[2, :] R[:2, :2] = getRotationMatrix(crd) R[6:8, 6:8] = R[:2, :2] a_bar = dot(R, a) return a_bar
def glob2Elem( self , a , coords ): a_bar = empty( a.shape ) R = eye( 9) crd = zeros( shape=(2,2) ) crd[0,:] = coords[0,:] crd[1,:] = coords[2,:] R[:2,:2] = getRotationMatrix( crd ) R[6:8,6:8] = R[:2,:2] a_bar = dot( R , a ) return a_bar
def elem2Glob(self, a_bar, coords): a = empty(a_bar.shape) R = eye(9) crd = zeros(shape=(2, 2)) crd[0, :] = coords[0, :] crd[1, :] = coords[2, :] R[:2, :2] = getRotationMatrix(crd) R[6:8, 6:8] = R[:2, :2] if len(a_bar.shape) == 1: a = dot(R.transpose(), a_bar) elif len(a_bar.shape) == 2: a = dot(R.transpose(), dot(a_bar, R)) return a
def elem2Glob( self , a_bar , coords ): a = empty( a_bar.shape ) R = eye( 9) crd = zeros( shape=(2,2) ) crd[0,:] = coords[0,:] crd[1,:] = coords[2,:] R[:2,:2] = getRotationMatrix( crd ) R[6:8,6:8] = R[:2,:2] if len(a_bar.shape) == 1: a = dot( R.transpose() , a_bar ) elif len(a_bar.shape) == 2: a = dot( R.transpose(), dot ( a_bar , R ) ) return a
def toElementCoordinates( self , a , coords ): a_bar = empty( a.shape ) R = eye( 9) crd = zeros( shape=(2,2) ) #crd[:,0] = coords[:,0] #crd[:,1] = coords[:,2] crd[0,:] = coords[0,:] crd[1,:] = coords[2,:] R[:2,:2] = getRotationMatrix( crd ) R[3:5,3:5] = R[:2,:2] R[6:8,6:8] = R[:2,:2] a_bar = dot( R , a ) return a_bar
def toGlobalCoordinates( self , a_bar , coords ): a = empty( a_bar.shape ) R = eye( 9) crd = zeros( shape=(2,2) ) #crd[:,0] = coords[:,0] #crd[:,1] = coords[:,2] crd[0,:] = coords[0,:] crd[1,:] = coords[2,:] R[:2,:2] = getRotationMatrix( crd ) R[3:5,3:5] = R[:2,:2] R[6:8,6:8] = R[:2,:2] if len(a_bar.shape) == 1: a = dot( R.transpose() , a_bar ) elif len(a_bar.shape) == 2: #a = dot( dot( R.transpose(), a_bar ) , R ) a = dot( R.transpose(), dot ( a_bar , R ) ) return a