src/p/y/pysundials-HEAD/2.3.0/examples/cvodes/serial/cvsadjdenx.py pysundials(Download)
cvodes.CVodeMalloc(cvode_mem, f, 0.0, y, cvodes.CV_WF, 0.0, None) cvodes.CVodeSetEwtFn(cvode_mem, ewt, None) cvodes.CVodeSetFdata(cvode_mem, ctypes.pointer(data)) cvodes.CVDense(cvode_mem, 3) cvodes.CVDenseSetJacFn(cvode_mem, Jac, ctypes.pointer(data)) cvodes.CVodeQuadMalloc(cvode_mem, fQ, q) cvodes.CVodeSetQuadFdata(cvode_mem, ctypes.pointer(data))
cvodes.CVodeCreateB(cvadj_mem, cvodes.CV_BDF, cvodes.CV_NEWTON) cvodes.CVodeMallocB(cvadj_mem, fB, 4.0e7, yB, cvodes.CV_SS, reltolB, abstolB) cvodes.CVodeSetFdataB(cvadj_mem, ctypes.pointer(data)) cvodes.CVDenseB(cvadj_mem, 3) cvodes.CVDenseSetJacFnB(cvadj_mem, JacB, ctypes.pointer(data)) cvodes.CVodeQuadMallocB(cvadj_mem, fQB, qB) cvodes.CVodeSetQuadFdataB(cvadj_mem, ctypes.pointer(data))
src/p/y/pymacadmin-HEAD/examples/ctypes/airport-update.py pymacadmin(Download)
password_data = ctypes.c_char_p(256)
system_keychain = ctypes.c_void_p()
keychain_ptr = ctypes.pointer(system_keychain)
rc = SECURITY.SecKeychainOpen("/Library/Keychains/System.keychain", keychain_ptr)
if rc != 0:
len(ssid), # Account name length
ssid, # Account name
ctypes.byref(password_length), # Will be filled with pw length
ctypes.pointer(password_data), # Will be filled with pw data
ctypes.pointer(item)
)
src/p/y/pysundials-HEAD/2.3.0/examples/cvodes/serial/cvsadjkryx_pnt.py pysundials(Download)
print "\nCreate and allocate CVODES memory for forward run" cvode_mem = cvodes.CVodeCreate(cvodes.CV_BDF, cvodes.CV_NEWTON) wdata.cvode_memF = cvode_mem.obj cvodes.CVodeSetFdata(cvode_mem, ctypes.pointer(wdata)) cvodes.CVodeMalloc(cvode_mem, f, T0, c, cvodes.CV_SS, RTOL, ATOL) cvodes.CVSpgmr(cvode_mem, cvodes.PREC_LEFT, 0) cvodes.CVSpilsSetPreconditioner(cvode_mem, Precond, PSolve, ctypes.pointer(wdata))
print "\nCreate and allocate CVODES memory for backward run" cvodes.CVodeCreateB(cvadj_mem, cvodes.CV_BDF, cvodes.CV_NEWTON) cvodes.CVodeSetFdataB(cvadj_mem, ctypes.pointer(wdata)) cvodes.CVodeMallocB(cvadj_mem, fB, TOUT, cB, cvodes.CV_SS, RTOL, ATOL) cvodes.CVSpgmrB(cvadj_mem, cvodes.PREC_LEFT, 0) cvodes.CVSpilsSetPreconditionerB(cvadj_mem, PrecondB, PSolveB, ctypes.pointer(wdata))
src/p/y/pysundials-HEAD/2.3.0/examples/cvodes/serial/cvsadjkryx_int.py pysundials(Download)
print "\nCreate and allocate CVODE memory for forward run" cvode_mem = cvodes.CVodeCreate(cvodes.CV_BDF, cvodes.CV_NEWTON) wdata.cvode_memF = cvode_mem.obj cvodes.CVodeSetFdata(cvode_mem, ctypes.pointer(wdata)) cvodes.CVodeMalloc(cvode_mem, f, T0, c, cvodes.CV_SS, RTOL, ATOL) cvodes.CVSpgmr(cvode_mem, cvodes.PREC_LEFT, 0) cvodes.CVSpilsSetPreconditioner(cvode_mem, Precond, PSolve, ctypes.pointer(wdata))
print "\nCreate and allocate CVODES memory for backward run" cvodes.CVodeCreateB(cvadj_mem, cvodes.CV_BDF, cvodes.CV_NEWTON) cvodes.CVodeSetFdataB(cvadj_mem, ctypes.pointer(wdata)) cvodes.CVodeSetMaxNumStepsB(cvadj_mem, 1000) cvodes.CVodeMallocB(cvadj_mem, fB, TOUT, cB, cvodes.CV_SS, RTOL, ATOL) cvodes.CVSpgmrB(cvadj_mem, cvodes.PREC_LEFT, 0) cvodes.CVSpilsSetPreconditionerB(cvadj_mem, PrecondB, PSolveB, ctypes.pointer(wdata))
src/p/y/pysundials-HEAD/2.3.0/examples/cvodes/serial/cvsadjbanx.py pysundials(Download)
print "\nCreate and allocate CVODES memory for forward runs" cvode_mem = cvodes.CVodeCreate(cvodes.CV_BDF, cvodes.CV_NEWTON) cvodes.CVodeSetFdata(cvode_mem, ctypes.pointer(data)) cvodes.CVodeMalloc(cvode_mem, f, T0, u, cvodes.CV_SS, reltol, abstol) cvodes.CVBand(cvode_mem, NEQ, MY, MY) cvodes.CVBandSetJacFn(cvode_mem, Jac, ctypes.pointer(data))
print "\nCreate and allocate CVODES memory for backward run" cvodes.CVodeCreateB(cvadj_mem, cvodes.CV_BDF, cvodes.CV_NEWTON) cvodes.CVodeSetFdataB(cvadj_mem, ctypes.pointer(data)) cvodes.CVodeMallocB(cvadj_mem, fB, TOUT, uB, cvodes.CV_SS, reltolB, abstolB) cvodes.CVBandB(cvadj_mem, NEQ, MY, MY) cvodes.CVBandSetJacFnB(cvadj_mem, JacB, ctypes.pointer(data))
src/p/y/pysundials-HEAD/2.3.0/examples/cvodes/serial/cvskrydem_lin.py pysundials(Download)
data.hdco = KH/(data.dx**2) data.haco = VEL/(2.0*data.dx) data.vdco = (1.0/(data.dy**2))*KV0 pdata = ctypes.pointer(data) SetInitialProfiles(u, data.dx, data.dy) abstol= cvodes.realtype(1.0e-5*100) reltol= cvodes.realtype(1.0e-5) cvodes_mem = cvodes.CVodeCreate(cvodes.CV_BDF, cvodes.CV_NEWTON) cvodes.CVodeSetFdata(cvodes_mem, ctypes.pointer(data))
data.hdco = KH/(data.dx**2) data.haco = VEL/(2.0*data.dx) data.vdco = (1.0/(data.dy**2))*KV0 pdata = ctypes.pointer(data) SetInitialProfiles(u, data.dx, data.dy) cvodes.CVodeReInit(cvodes_mem, f, T0, u, cvodes.CV_SS, reltol, abstol)
print " -------" cvodes.CVSpgmr(cvodes_mem, cvodes.PREC_LEFT, 0) cvodes.CVSpilsSetGSType(cvodes_mem, cvodes.MODIFIED_GS) cvodes.CVSpilsSetPreconditioner(cvodes_mem, Precond, PSolve, ctypes.pointer(data)) elif linsolver == USE_SPBCG: print " ------- " print "| SPBCG |" print " -------" cvodes.CVSpbcg(cvodes_mem, cvodes.PREC_LEFT, 0) cvodes.CVSpilsSetPreconditioner(cvodes_mem, Precond, PSolve, ctypes.pointer(data))
print "| SPTFQMR |" print " ---------" cvodes.CVSptfqmr(cvodes_mem, cvodes.PREC_LEFT, 0) cvodes.CVSpilsSetPreconditioner(cvodes_mem, Precond, PSolve, ctypes.pointer(data)) print " \n2-species diurnal advection-diffusion problem\n" iout = 1
src/p/y/pysundials-HEAD/2.3.0/examples/cvode/serial/cvkrydem_lin.py pysundials(Download)
data.hdco = KH/(data.dx**2) data.haco = VEL/(2.0*data.dx) data.vdco = (1.0/(data.dy**2))*KV0 pdata = ctypes.pointer(data) SetInitialProfiles(u, data.dx, data.dy) abstol= cvode.realtype(1.0e-5*100) reltol= cvode.realtype(1.0e-5) cvode_mem = cvode.CVodeCreate(cvode.CV_BDF, cvode.CV_NEWTON) cvode.CVodeSetFdata(cvode_mem, ctypes.pointer(data))
data.hdco = KH/(data.dx**2) data.haco = VEL/(2.0*data.dx) data.vdco = (1.0/(data.dy**2))*KV0 pdata = ctypes.pointer(data) SetInitialProfiles(u, data.dx, data.dy) cvode.CVodeReInit(cvode_mem, f, T0, u, cvode.CV_SS, reltol, abstol)
print " -------" cvode.CVSpgmr(cvode_mem, cvode.PREC_LEFT, 0) cvode.CVSpilsSetGSType(cvode_mem, cvode.MODIFIED_GS) cvode.CVSpilsSetPreconditioner(cvode_mem, Precond, PSolve, ctypes.pointer(data)) elif linsolver == USE_SPBCG: print " ------- " print "| SPBCG |" print " -------" cvode.CVSpbcg(cvode_mem, cvode.PREC_LEFT, 0) cvode.CVSpilsSetPreconditioner(cvode_mem, Precond, PSolve, ctypes.pointer(data))
print "| SPTFQMR |" print " ---------" cvode.CVSptfqmr(cvode_mem, cvode.PREC_LEFT, 0) cvode.CVSpilsSetPreconditioner(cvode_mem, Precond, PSolve, ctypes.pointer(data)) print " \n2-species diurnal advection-diffusion problem\n" iout = 1
src/p/y/pysundials-HEAD/2.3.0/examples/cvode/serial/cvbanx.py pysundials(Download)
cvode_mem = cvode.CVodeCreate(cvode.CV_BDF, cvode.CV_NEWTON); cvode.CVodeMalloc(cvode_mem, f, 0.0, u, cvode.CV_SS, reltol, abstol) cvode.CVodeSetFdata(cvode_mem, ctypes.pointer(data)); cvode.CVBand(cvode_mem, 50, 5, 5); cvode.CVBandSetJacFn(cvode_mem, Jac, ctypes.pointer(data));
src/p/y/pysundials-HEAD/2.3.0/examples/cvodes/serial/cvsbanx.py pysundials(Download)
cvode_mem = cvodes.CVodeCreate(cvodes.CV_BDF, cvodes.CV_NEWTON) cvodes.CVodeMalloc(cvode_mem, f, 0.0, u, cvodes.CV_SS, reltol, abstol) cvodes.CVodeSetFdata(cvode_mem, ctypes.pointer(data)) cvodes.CVBand(cvode_mem, 50, 5, 5) cvodes.CVBandSetJacFn(cvode_mem, Jac, ctypes.pointer(data))
src/p/y/pysundials-HEAD/2.3.0/examples/ida/serial/idakrydem_lin.py pysundials(Download)
up[:] = [0]*len(up) resHeat(0.0, uu, up, res, ctypes.pointer(data)) up[:] = -res
atol = 1.0e-3 mem = ida.IDACreate() ida.IDASetRdata(mem, ctypes.pointer(data)) ida.IDASetConstraints(mem, constraints) ida.IDAMalloc(mem, resHeat, t0, uu, up, ida.IDA_SS, rtol, atol)
print "| SPGMR |" print " -------" ida.IDASpgmr(mem, 0) ida.IDASpilsSetPreconditioner(mem, PsetupHeat, PsolveHeat, ctypes.pointer(data)) elif linsolver == USE_SPBCG: print " ------- " print "| SPBCG |" print " -------" ida.IDASpbcg(mem, 0) ida.IDASpilsSetPreconditioner(mem, PsetupHeat, PsolveHeat, ctypes.pointer(data))
print "| SPTFQMR |" print " ---------" ida.IDASptfqmr(mem, 0) ida.IDASpilsSetPreconditioner(mem, PsetupHeat, PsolveHeat, ctypes.pointer(data)) print "\nidakrydem_lin: Heat equation, serial example problem for IDA" print " Discretized heat equation on 2D unit square."
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next