def setSpecimen(self, xyPoints): """ Set specimen coorindates @param xyPoints list of unique (x, y) tuples, ordered counterclockwise """ spcDic = self._buildSparseSystem(xyPoints) spcDic['rho'] = superlu.solve(spcDic['rhoMat'], spcDic['rhoBVec']) spcDic['the'] = superlu.solve(spcDic['theMat'], spcDic['theBVec']) self._toPolyData(spcDic, self.spcData) self.spcDic = spcDic
def setReference(self, xyPoints): """ Set reference coordinates @param xyPoints list of unique (x, y) tuples, ordered counterclockwise """ refDic = self._buildSparseSystem(xyPoints) refDic['rho'] = superlu.solve(refDic['rhoMat'], refDic['rhoBVec']) refDic['the'] = superlu.solve(refDic['theMat'], refDic['theBVec']) self._toPolyData(refDic, self.refData) self.refDic = refDic
x = grid.x(i) db[i] = 1.0 F, g, s = '1.', '0.', '0.' tic = time.time() equ = ellipt2d(grid, F, g, s) [amat, s] = equ.stiffnessMat() print ' amat = ', amat equ.dirichletB(db, amat, s) toc = time.time() print 'time to assemble siffness matrix %10.2f secs' % (toc - tic) #v0 = s; v = amat.CGsolve(v0,s,1.0e-6, len(s) ) tic = time.time() #print 'time CGPython %10.2f secs'% (tic-toc) import superlu v = superlu.solve(amat, s) toc = time.time() print 'time to solve %10.2f secs' % (toc - tic) print 'max(v)=', max(v), ' min(v)=', min(v) from tkplot import * root = Tk() frame = Frame(root) frame.pack() WIDTH, HEIGHT = 300, 300 button = Button(frame, text="OK", fg="red", command=frame.quit) button.pack(side=BOTTOM) canvas = Canvas(bg="white", width=WIDTH, height=HEIGHT) canvas.pack() tkplot(canvas, grid, v, 0, 0, 1, WIDTH, HEIGHT)