Пример #1
0
gpu.labelCenter(gr, nzones/2,   r"$i$")
gpu.labelCenter(gr, nzones/2-1, r"$i-1$")
gpu.labelCenter(gr, nzones/2+1, r"$i+1$")
gpu.labelCenter(gr, nzones/2-2, r"$i-2$")
gpu.labelCenter(gr, nzones/2+2, r"$i+2$")


# draw the data
i = 0
while i < nzones:
    gpu.drawFDData(gr, i, a[i], color="r")    
    i += 1
    

gpu.labelFD(gr, nzones/2, a[nzones/2], r"$f_i$", color="r")

# label dx
pylab.plot([gr.xc[gr.ng+nzones/2-1], gr.xc[gr.ng+nzones/2-1]], [-0.35,-0.25], color="k")
pylab.plot([gr.xc[gr.ng+nzones/2], gr.xc[gr.ng+nzones/2]], [-0.35,-0.25], color="k")
pylab.plot([gr.xc[gr.ng+nzones/2-1], gr.xc[gr.ng+nzones/2]], [-0.3,-0.3], color="k")
pylab.text(0.5*(gr.xc[gr.ng+nzones/2-1] + gr.xc[gr.ng+nzones/2]), -0.45, r"$\Delta x$", 
           horizontalalignment="center")



pylab.axis([gr.xmin-gr.dx,gr.xmax+gr.dx, -0.5, 1.2])
pylab.axis("off")

pylab.subplots_adjust(left=0.05,right=0.95,bottom=0.05,top=0.95)
Пример #2
0
gpu.drawGrid(gr)

gpu.labelCenter(gr, nzones / 2, r"$i$")
gpu.labelCenter(gr, nzones / 2 - 1, r"$i-1$")
gpu.labelCenter(gr, nzones / 2 + 1, r"$i+1$")
gpu.labelCenter(gr, nzones / 2 - 2, r"$i-2$")
gpu.labelCenter(gr, nzones / 2 + 2, r"$i+2$")

# draw the data
i = 0
while i < nzones:
    gpu.drawFDData(gr, i, a[i], color="r")
    i += 1

gpu.labelFD(gr, nzones / 2, a[nzones / 2], r"$f_i$", color="r")

# label dx
pylab.plot([gr.xc[gr.ng + nzones / 2 - 1], gr.xc[gr.ng + nzones / 2 - 1]],
           [-0.35, -0.25],
           color="k")
pylab.plot([gr.xc[gr.ng + nzones / 2], gr.xc[gr.ng + nzones / 2]],
           [-0.35, -0.25],
           color="k")
pylab.plot([gr.xc[gr.ng + nzones / 2 - 1], gr.xc[gr.ng + nzones / 2]],
           [-0.3, -0.3],
           color="k")
pylab.text(0.5 * (gr.xc[gr.ng + nzones / 2 - 1] + gr.xc[gr.ng + nzones / 2]),
           -0.45,
           r"$\Delta x$",
           horizontalalignment="center")
Пример #3
0
labels = ["-1", "0", "1", "", "i-1", "i", "i+1", "", "N-2", "N-1", "N"]

i = gr.ilo - gr.ng
while (i < gr.ng + gr.nx + 1):

    if not labels[i] == "":
        gpu.labelCenter(gr, i, r"$%s$" % (labels[i]), fontsize="medium")
    i += 1

# draw the data
i = gr.ilo
while i < gr.ihi + 1:
    gpu.drawFDData(gr, i, a[i - gr.ng], color="r")
    i += 1

gpu.labelFD(gr, gr.ilo + 4, a[gr.ilo + 4 - gr.ng], r"$a_i$", color="r")

# label dx
pylab.plot([gr.xc[gr.ng + nzones / 2 - 1], gr.xc[gr.ng + nzones / 2 - 1]],
           [-0.35, -0.25],
           color="k")
pylab.plot([gr.xc[gr.ng + nzones / 2], gr.xc[gr.ng + nzones / 2]],
           [-0.35, -0.25],
           color="k")
pylab.plot([gr.xc[gr.ng + nzones / 2 - 1], gr.xc[gr.ng + nzones / 2]],
           [-0.3, -0.3],
           color="k")
pylab.text(0.5 * (gr.xc[gr.ng + nzones / 2 - 1] + gr.xc[gr.ng + nzones / 2]),
           -0.45,
           r"$\Delta x$",
           horizontalalignment="center",
Пример #4
0
gpu.drawGrid(gr, emphasizeEnd=1, drawGhost=1)

gpu.labelCenter(gr, ng + nnodes / 2, r"$i$")
gpu.labelCenter(gr, ng + nnodes / 2 - 1, r"$i-1$")
gpu.labelCenter(gr, ng + nnodes / 2 + 1, r"$i+1$")
#gpu.labelCenter(gr, ng+nnodes/2-2, r"$i-2$")
#gpu.labelCenter(gr, ng+nnodes/2+2, r"$i+2$")

# draw the data
i = 0
while i < nnodes + 2 * ng:
    gpu.drawFDData(gr, i, anode[i], color="r")
    i += 1

gpu.labelFD(gr, ng + nnodes / 2, anode[ng + nnodes / 2], r"$f_i$", color="r")

# label dx
pylab.plot([gr.xc[gr.ng + nnodes / 2 - 1], gr.xc[gr.ng + nnodes / 2 - 1]],
           [-0.35, -0.25],
           color="k")
pylab.plot([gr.xc[gr.ng + nnodes / 2], gr.xc[gr.ng + nnodes / 2]],
           [-0.35, -0.25],
           color="k")
pylab.plot([gr.xc[gr.ng + nnodes / 2 - 1], gr.xc[gr.ng + nnodes / 2]],
           [-0.3, -0.3],
           color="k")
pylab.text(0.5 * (gr.xc[gr.ng + nnodes / 2 - 1] + gr.xc[gr.ng + nnodes / 2]),
           -0.45,
           r"$\Delta x$",
           horizontalalignment="center")
Пример #5
0
i = gr.ilo-gr.ng
while (i < gr.ng+gr.nx+1):

    if not labels[i] == "":
        gpu.labelCenter(gr, i,   r"$%s$" % (labels[i]), fontsize="medium")
    i += 1

    
# draw the data
i = gr.ilo
while i < gr.ihi+1:
    gpu.drawFDData(gr, i, a[i-gr.ng], color="r")    
    i += 1
    

gpu.labelFD(gr, gr.ilo+4, a[gr.ilo+4-gr.ng], r"$a_i$", color="r")

# label dx
pylab.plot([gr.xc[gr.ng+nzones/2-1], gr.xc[gr.ng+nzones/2-1]], [-0.35,-0.25], color="k")
pylab.plot([gr.xc[gr.ng+nzones/2], gr.xc[gr.ng+nzones/2]], [-0.35,-0.25], color="k")
pylab.plot([gr.xc[gr.ng+nzones/2-1], gr.xc[gr.ng+nzones/2]], [-0.3,-0.3], color="k")
pylab.text(0.5*(gr.xc[gr.ng+nzones/2-1] + gr.xc[gr.ng+nzones/2]), -0.45, 
           r"$\Delta x$", 
           horizontalalignment="center", fontsize=16)


pylab.axis([gr.xmin-1.1*gr.dx,gr.xmax+1.1*gr.dx, -0.5, 1.3])
pylab.axis("off")

pylab.subplots_adjust(left=0.05,right=0.95,bottom=0.05,top=0.95)