return sp.ones(cp.shape[0])#cp[:,0] def initialu(cp): return cp[:,0] def plot3d(x,c,title = 'band'): # z = c-c.min() # z /= z.max() pl.figure() pl.points3d(x[:,0],x[:,1],x[:,2],c,mode='point') if __name__ == '__main__': opt = {'M':50,'m':10,'d':3} surface = MeshWrapper() pl.triangular_mesh(surface.v[:,0],surface.v[:,1],surface.v[:,2],surface.f,opacity = 0.2) comm = MPI.COMM_WORLD band = Band(surface,comm,opt) la,lv,gv,wv = band.createGLVectors() v = band.getCoordinates() dt = 0.3*band.dx**2 vv = sp.array([[0,0,0],[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]]) weights = sp.array([-6,1,1,1,1,1,1])*(dt/band.dx**2) L = band.createAnyMat(vv, weights, (7,3)) PETSc.Sys.Print('Laplacian') band.test_initialu(test_initialu) L.mult(gv,wv) c = wv.getArray() # wv.view() plot3d(v,c,title='Lu') # wv.view() M = band.createExtensionMat()
def setUp(self): self.comm = MPI.COMM_WORLD surface = Surface() self.bnd = Band(surface,self.comm) self.bnd.createGLVectors()