From: <sm...@us...> - 2009-06-03 08:12:49
|
Revision: 10028 http://plplot.svn.sourceforge.net/plplot/?rev=10028&view=rev Author: smekal Date: 2009-06-03 08:12:27 +0000 (Wed, 03 Jun 2009) Log Message: ----------- D bindings now include improved plcont() function. The D bindings provide PLcGrid and PLcGrid2 structs now. D example 9 fully ported. Modified Paths: -------------- trunk/bindings/d/plplot.d trunk/examples/d/CMakeLists.txt trunk/examples/d/x09d.d trunk/examples/d/x15d.d Modified: trunk/bindings/d/plplot.d =================================================================== --- trunk/bindings/d/plplot.d 2009-06-02 23:23:25 UTC (rev 10027) +++ trunk/bindings/d/plplot.d 2009-06-03 08:12:27 UTC (rev 10028) @@ -15,9 +15,26 @@ alias void function(PLINT, PLFLT*, PLFLT*) mapform_func; } +// D definition of PLcGrid and PLcGrid2 +struct PLcGrid +{ + PLFLT[] xg; + PLFLT[] yg; + PLFLT[] zg; +} +struct PLcGrid2 +{ + PLFLT[][] xg; + PLFLT[][] yg; + PLFLT[][] zg; +} + // helper function to convert D dynamic arrays in C dynamic arrays private PLFLT** convert_array(PLFLT[][] a) { + if(!a) + return null; + size_t nx=a.length; size_t ny=a[0].length; @@ -85,8 +102,59 @@ /* Draws a contour plot from data in f(nx,ny). Is just a front-end to * plfcont, with a particular choice for f2eval and f2eval_data. */ -//void c_plcont(PLFLT **f, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT *clevel, PLINT nlevel, void function(PLFLT , PLFLT , PLFLT *, PLFLT *, PLPointer )pltr, PLPointer pltr_data); +void plcont(PLFLT[][] f, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT[] clevel, + pltr_func pltr, PLPointer pltr_data=null) +{ + PLINT nx=f.length; + PLINT ny=f[0].length; + c_plcont(convert_array(f), nx, ny, kx, lx, ky, ly, clevel.ptr, clevel.length, + pltr, pltr_data); +} + +void plcont(PLFLT[][] f, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT[] clevel, + ref PLcGrid cgrid) +{ + PLINT nx=f.length; + PLINT ny=f[0].length; + + c_PLcGrid c; + c.xg = cgrid.xg.ptr; + c.nx = cgrid.xg.length; + c.yg = cgrid.yg.ptr; + c.ny = cgrid.yg.length; + c.zg = cgrid.zg.ptr; + c.nz = cgrid.zg.length; + + c_plcont(convert_array(f), nx, ny, kx, lx, ky, ly, clevel.ptr, clevel.length, + &pltr1, &c); +} + +void plcont(PLFLT[][] f, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT[] clevel, + ref PLcGrid2 cgrid2) +{ + PLINT nx=f.length; + PLINT ny=f[0].length; + + c_PLcGrid2 c2; + c2.xg = convert_array(cgrid2.xg); + c2.yg = convert_array(cgrid2.yg); + c2.zg = convert_array(cgrid2.zg); + c2.nx = cgrid2.xg.length; + c2.ny = cgrid2.xg[0].length; + if(cgrid2.yg) { + assert(c2.nx==cgrid2.yg.length, "plcont(): Arrays must be of same length!"); + assert(c2.ny==cgrid2.yg[0].length, "plcont(): Arrays must be of same length!"); + } + if(cgrid2.zg) { + assert(c2.nx==cgrid2.zg.length, "plcont(): Arrays must be of same length!"); + assert(c2.ny==cgrid2.zg[0].length, "plcont(): Arrays must be of same length!"); + } + + c_plcont(convert_array(f), nx, ny, kx, lx, ky, ly, clevel.ptr, clevel.length, + &pltr2, &c2); +} + /* Draws a contour plot using the function evaluator f2eval and data stored * by way of the f2eval_data pointer. This allows arbitrary organizations * of 2d array data to be used. @@ -772,7 +840,7 @@ PLINT ny; PLINT nz; } -alias _N7 PLcGrid; +alias _N7 c_PLcGrid; /* * PLcGrid2 is for passing (as arrays of pointers) 2d coordinate @@ -788,7 +856,7 @@ PLINT nx; PLINT ny; } -alias _N8 PLcGrid2; +alias _N8 c_PLcGrid2; /* * NOTE: a PLcGrid3 is a good idea here but there is no way to exploit it yet @@ -898,7 +966,7 @@ alias c_plclear plclear; alias c_plcol0 plcol0; alias c_plcol1 plcol1; -alias c_plcont plcont; +//alias c_plcont plcont; alias c_plcpstrm plcpstrm; alias c_plctime plctime; alias c_plend plend; @@ -1103,34 +1171,30 @@ void c_plbox3(char *xopt, char *xlabel, PLFLT xtick, PLINT nsubx, char *yopt, char *ylabel, PLFLT ytick, PLINT nsuby, char *zopt, char *zlabel, PLFLT ztick, PLINT nsubz); /* Calculate world coordinates and subpage from relative device coordinates. */ +void c_plcalc_world(PLFLT rx, PLFLT ry, PLFLT *wx, PLFLT *wy, PLINT *window); -void c_plcalc_world(PLFLT rx, PLFLT ry, PLFLT *wx, PLFLT *wy, PLINT *window); - /* Clear current subpage. */ +void c_plclear(); -void c_plclear(); - /* Set color, map 0. Argument is integer between 0 and 15. */ +void c_plcol0(PLINT icol0); -void c_plcol0(PLINT icol0); - /* Set color, map 1. Argument is a float between 0. and 1. */ +void c_plcol1(PLFLT col1); -void c_plcol1(PLFLT col1); - /* Draws a contour plot from data in f(nx,ny). Is just a front-end to * plfcont, with a particular choice for f2eval and f2eval_data. */ +void c_plcont(PLFLT **f, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly, + PLFLT *clevel, PLINT nlevel, + void function(PLFLT, PLFLT, PLFLT*, PLFLT*, PLPointer) pltr, PLPointer pltr_data); -void c_plcont(PLFLT **f, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT *clevel, PLINT nlevel, void function(PLFLT , PLFLT , PLFLT *, PLFLT *, PLPointer )pltr, PLPointer pltr_data); - /* Draws a contour plot using the function evaluator f2eval and data stored * by way of the f2eval_data pointer. This allows arbitrary organizations * of 2d array data to be used. */ +void plfcont(PLFLT function(PLINT , PLINT , PLPointer )f2eval, PLPointer f2eval_data, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT *clevel, PLINT nlevel, void function(PLFLT , PLFLT , PLFLT *, PLFLT *, PLPointer )pltr, PLPointer pltr_data); -void plfcont(PLFLT function(PLINT , PLINT , PLPointer )f2eval, PLPointer f2eval_data, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT *clevel, PLINT nlevel, void function(PLFLT , PLFLT , PLFLT *, PLFLT *, PLPointer )pltr, PLPointer pltr_data); - /* Copies state parameters from the reference stream to the current stream. */ void c_plcpstrm(PLINT iplsr, PLBOOL flags); Modified: trunk/examples/d/CMakeLists.txt =================================================================== --- trunk/examples/d/CMakeLists.txt 2009-06-02 23:23:25 UTC (rev 10027) +++ trunk/examples/d/CMakeLists.txt 2009-06-03 08:12:27 UTC (rev 10028) @@ -28,7 +28,7 @@ "06" "07" "08" -# "09" + "09" "10" "11" "12" Modified: trunk/examples/d/x09d.d =================================================================== --- trunk/examples/d/x09d.d 2009-06-02 23:23:25 UTC (rev 10027) +++ trunk/examples/d/x09d.d 2009-06-03 08:12:27 UTC (rev 10028) @@ -21,32 +21,15 @@ */ import std.string; +import std.math; import plplot; -#define XPTS 35 /* Data points in x */ -#define YPTS 46 /* Data points in y */ +const int XPTS=35; /* Data points in x */ +const int YPTS=46; /* Data points in y */ -#define XSPA 2./(XPTS-1) -#define YSPA 2./(YPTS-1) - -/* polar plot data */ -#define PERIMETERPTS 100 -#define RPTS 40 -#define THETAPTS 40 - -/* potential plot data */ -#define PPERIMETERPTS 100 -#define PRPTS 40 -#define PTHETAPTS 64 -#define PNLEVEL 20 - -static PLFLT clevel[11] = -{-1., -.8, -.6, -.4, -.2, 0, .2, .4, .6, .8, 1.}; - /* Transformation function */ - extern (C) { - PLFLT[] tr = {XSPA, 0.0, -1.0, 0.0, YSPA, -1.0}; + PLFLT[] tr = [ 2./(XPTS-1), 0.0, -1.0, 0.0, 2./(YPTS-1), -1.0 ]; void mypltr(PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, void* pltr_data) { @@ -55,56 +38,61 @@ } } -static void polar() /*polar contour plot example.*/ +void polar() { - int i,j; - PLcGrid2 cgrid2; - PLFLT **z; - PLFLT px[PERIMETERPTS], py[PERIMETERPTS]; - PLFLT t, r, theta; - PLFLT lev[10]; + const int PERIMETERPTS=100; + const int RPTS=40; + const int THETAPTS=40; - plenv(-1., 1., -1., 1., 0, -2); - plcol0(1); + plenv(-1., 1., -1., 1., 0, -2); + plcol0(1); -/*Perimeter*/ - for (i = 0; i < PERIMETERPTS; i++) { - t = (2.*M_PI/(PERIMETERPTS-1))*(double)i; - px[i] = cos(t); - py[i] = sin(t); - } - plline(PERIMETERPTS, px, py); + /*Perimeter*/ + PLFLT[] px, py; + px.length = PERIMETERPTS; + py.length = PERIMETERPTS; + PLFLT t; + for(int i=0; i<PERIMETERPTS; i++) { + t = 2.*PI/(PERIMETERPTS-1)*i; + px[i] = cos(t); + py[i] = sin(t); + } + plline(px, py); -/*create data to be contoured.*/ - plAlloc2dGrid(&cgrid2.xg, RPTS, THETAPTS); - plAlloc2dGrid(&cgrid2.yg, RPTS, THETAPTS); - plAlloc2dGrid(&z, RPTS, THETAPTS); - cgrid2.nx = RPTS; - cgrid2.ny = THETAPTS; + /*create data to be contoured.*/ + PLcGrid2 cgrid2; + cgrid2.xg = new PLFLT[][RPTS]; + for(int i=0; i<RPTS; i++) + cgrid2.xg[i] = new PLFLT[THETAPTS]; + cgrid2.yg = new PLFLT[][RPTS]; + for(int i=0; i<RPTS; i++) + cgrid2.yg[i] = new PLFLT[THETAPTS]; - for (i = 0; i < RPTS; i++) { - r = i/(double)(RPTS-1); - for (j = 0; j < THETAPTS; j++) { - theta = (2.*M_PI/(double)(THETAPTS-1))*(double)j; - cgrid2.xg[i][j] = r*cos(theta); - cgrid2.yg[i][j] = r*sin(theta); - z[i][j] = r; - } - } + PLFLT[][] z = new PLFLT[][RPTS]; + for(int i=0; i<RPTS; i++) + z[i] = new PLFLT[THETAPTS]; - for (i = 0; i < 10; i++) { - lev[i] = 0.05 + 0.10*(double) i; - } + PLFLT r, theta; + for(int i=0; i<RPTS; i++) { + r = i/cast(double)(RPTS-1); + for(int j=0; j<THETAPTS; j++) { + theta = 2.*PI/(THETAPTS-1)*j; + cgrid2.xg[i][j] = r*cos(theta); + cgrid2.yg[i][j] = r*sin(theta); + z[i][j] = r; + } + } - plcol0(2); - plcont(z, RPTS, THETAPTS, 1, RPTS, 1, THETAPTS, lev, 10, - pltr2, (void *) &cgrid2); - plcol0(1); - pllab("", "", "Polar Contour Plot"); - plFree2dGrid(z, RPTS, THETAPTS); - plFree2dGrid(cgrid2.xg, RPTS, THETAPTS); - plFree2dGrid(cgrid2.yg, RPTS, THETAPTS); + PLFLT[] lev; + lev.length=10; + for(int i=0; i<10; i++) + lev[i] = 0.05 + 0.10*i; + + plcol0(2); + plcont(z, 1, RPTS, 1, THETAPTS, lev, cgrid2); + plcol0(1); + pllab("", "", "Polar Contour Plot"); } /*--------------------------------------------------------------------------*\ @@ -112,89 +100,87 @@ * * Returns min & max of input 2d array. \*--------------------------------------------------------------------------*/ - -static void -f2mnmx(PLFLT **f, PLINT nx, PLINT ny, PLFLT *fmin, PLFLT *fmax) +void f2mnmx(PLFLT[][] f, out PLFLT fmn, out PLFLT fmx) { - int i, j; + fmx = f[0][0]; + fmn = fmx; - *fmax = f[0][0]; - *fmin = *fmax; - - for (i = 0; i < nx; i++) { - for (j = 0; j < ny; j++) { - *fmax = MAX(*fmax, f[i][j]); - *fmin = MIN(*fmin, f[i][j]); - } + for(int i=0; i<f.length; i++) { + for(int j=0; j<f[i].length; j++) { + fmx = fmax(fmx, f[i][j]); + fmn = fmin(fmn, f[i][j]); } + } } -static void potential() + /*shielded potential contour plot example.*/ +void potential() { - PLcGrid2 cgrid2; - PLFLT rmax, xmin, xmax, x0, ymin, ymax, y0, zmin, zmax; - PLFLT peps, xpmin, xpmax, ypmin, ypmax; - PLFLT eps, q1, d1, q1i, d1i, q2, d2, q2i, d2i; - PLFLT div1, div1i, div2, div2i; - PLFLT **z; - PLINT nlevelneg, nlevelpos; - PLFLT dz, clevel, clevelneg[PNLEVEL], clevelpos[PNLEVEL]; - PLINT ncollin, ncolbox, ncollab; - PLFLT px[PPERIMETERPTS], py[PPERIMETERPTS]; - PLFLT t, r, theta; + const int PERIMETERPTS=100; + const int RPTS=40; + const int THETAPTS=64; + const int NLEVEL=20; /*create data to be contoured.*/ - plAlloc2dGrid(&cgrid2.xg, PRPTS, PTHETAPTS); - plAlloc2dGrid(&cgrid2.yg, PRPTS, PTHETAPTS); - plAlloc2dGrid(&z, PRPTS, PTHETAPTS); - cgrid2.nx = PRPTS; - cgrid2.ny = PTHETAPTS; + PLcGrid2 cgrid2; + cgrid2.xg = new PLFLT[][RPTS]; + for(int i=0; i<RPTS; i++) + cgrid2.xg[i] = new PLFLT[THETAPTS]; + cgrid2.yg = new PLFLT[][RPTS]; + for(int i=0; i<RPTS; i++) + cgrid2.yg[i] = new PLFLT[THETAPTS]; + + PLFLT[][] z = new PLFLT[][RPTS]; + for(int i=0; i<RPTS; i++) + z[i] = new PLFLT[THETAPTS]; - for (i = 0; i < PRPTS; i++) { - r = 0.5 + (double) i; - for (j = 0; j < PTHETAPTS; j++) { - theta = (2.*M_PI/(double)(PTHETAPTS-1))*(0.5 + (double) j); - cgrid2.xg[i][j] = r*cos(theta); - cgrid2.yg[i][j] = r*sin(theta); + PLFLT r, theta; + for(int i=0; i<RPTS; i++) { + r = 0.5+i; + for(int j=0; j<THETAPTS; j++) { + theta = 2.*PI/(THETAPTS-1)*(0.5+j); + cgrid2.xg[i][j] = r*cos(theta); + cgrid2.yg[i][j] = r*sin(theta); } } + PLFLT rmax = r; + + PLFLT xmin, xmax, ymin, ymax; + f2mnmx(cgrid2.xg, xmin, xmax); + f2mnmx(cgrid2.yg, ymin, ymax); + PLFLT x0 = (xmin+xmax)/2.; + PLFLT y0 = (ymin+ymax)/2.; - rmax = r; - f2mnmx(cgrid2.xg, PRPTS, PTHETAPTS, &xmin, &xmax); - f2mnmx(cgrid2.yg, PRPTS, PTHETAPTS, &ymin, &ymax); - x0 = (xmin + xmax)/2.; - y0 = (ymin + ymax)/2.; - /* Expanded limits */ - peps = 0.05; - xpmin = xmin - fabs(xmin)*peps; - xpmax = xmax + fabs(xmax)*peps; - ypmin = ymin - fabs(ymin)*peps; - ypmax = ymax + fabs(ymax)*peps; + PLFLT peps = 0.05; + PLFLT xpmin = xmin - fabs(xmin)*peps; + PLFLT xpmax = xmax + fabs(xmax)*peps; + PLFLT ypmin = ymin - fabs(ymin)*peps; + PLFLT ypmax = ymax + fabs(ymax)*peps; /* Potential inside a conducting cylinder (or sphere) by method of images. Charge 1 is placed at (d1, d1), with image charge at (d2, d2). Charge 2 is placed at (d1, -d1), with image charge at (d2, -d2). Also put in smoothing term at small distances. */ + PLFLT eps = 2.; - eps = 2.; + PLFLT q1 = 1.; + PLFLT d1 = rmax/4.; - q1 = 1.; - d1 = rmax/4.; + PLFLT q1i = - q1*rmax/d1; + PLFLT d1i = pow(rmax, 2.)/d1; - q1i = - q1*rmax/d1; - d1i = pow(rmax, 2.)/d1; + PLFLT q2 = -1.; + PLFLT d2 = rmax/4.; - q2 = -1.; - d2 = rmax/4.; + PLFLT q2i = - q2*rmax/d2; + PLFLT d2i = pow(rmax, 2.)/d2; - q2i = - q2*rmax/d2; - d2i = pow(rmax, 2.)/d2; - - for(int i=0; i<PRPTS; i++) { - for(int j=0; j<PTHETAPTS; j++) { + PLFLT div1, div1i, div2, div2i; + for(int i=0; i<RPTS; i++) { + for(int j=0; j<THETAPTS; j++) { div1 = sqrt(pow(cgrid2.xg[i][j]-d1, 2.) + pow(cgrid2.yg[i][j]-d1, 2.) + pow(eps, 2.)); div1i = sqrt(pow(cgrid2.xg[i][j]-d1i, 2.) + pow(cgrid2.yg[i][j]-d1i, 2.) + pow(eps, 2.)); div2 = sqrt(pow(cgrid2.xg[i][j]-d2, 2.) + pow(cgrid2.yg[i][j]+d2, 2.) + pow(eps, 2.)); @@ -202,13 +188,18 @@ z[i][j] = q1/div1 + q1i/div1i + q2/div2 + q2i/div2i; } } + PLFLT zmin, zmax; f2mnmx(z, zmin, zmax); /* Positive and negative contour levels.*/ - dz = (zmax-zmin)/PNLEVEL; - nlevelneg = 0; - nlevelpos = 0; - for(int i=0; i<PNLEVEL; i++) { + PLFLT dz = (zmax-zmin)/NLEVEL; + PLFLT[] clevelneg, clevelpos; + PLFLT clevel; + clevelneg.length = NLEVEL; + clevelpos.length = NLEVEL; + int nlevelneg = 0; + int nlevelpos = 0; + for(int i=0; i<NLEVEL; i++) { clevel = zmin + (i+0.5)*dz; if(clevel<=0.) clevelneg[nlevelneg++] = clevel; @@ -216,9 +207,9 @@ clevelpos[nlevelpos++] = clevel; } /* Colours! */ - ncollin = 11; - ncolbox = 1; - ncollab = 2; + PLINT ncollin = 11; + PLINT ncolbox = 1; + PLINT ncollab = 2; /* Finally start plotting this page! */ pladv(0); @@ -232,18 +223,22 @@ if(nlevelneg >0) { /* Negative contours */ pllsty(2); - plcont(z, 1, PRPTS, 1, PTHETAPTS, clevelneg, pltr2, (void*)&cgrid2); + plcont(z, 1, RPTS, 1, THETAPTS, clevelneg, cgrid2); } if(nlevelpos >0) { /* Positive contours */ pllsty(1); - plcont(z, 1, PRPTS, 1, PTHETAPTS, clevelpos, pltr2, (void*)&cgrid2); + plcont(z, 1, RPTS, 1, THETAPTS, clevelpos, cgrid2); } /* Draw outer boundary */ - for(int i=0; i<PPERIMETERPTS; i++) { - t = (2.*PI/(PPERIMETERPTS-1))*i; + PLFLT[] px, py; + px.length = PERIMETERPTS; + py.length = PERIMETERPTS; + PLFLT t; + for(int i=0; i<PERIMETERPTS; i++) { + t = (2.*PI/(PERIMETERPTS-1))*i; px[i] = x0 + rmax*cos(t); py[i] = y0 + rmax*sin(t); } @@ -264,6 +259,7 @@ int main(char[][] args) { PLINT[] mark = [ 1500 ], space = [ 1500 ]; + PLFLT[] clevel = [ -1., -.8, -.6, -.4, -.2, 0, .2, .4, .6, .8, 1. ]; /* Parse and process command line arguments */ plparseopts(args, PL_PARSE_FULL); @@ -272,7 +268,6 @@ plinit(); /* Set up function arrays */ - PLFLT xx, yy; PLFLT[][] z = new PLFLT[][XPTS]; for(int i=0; i<XPTS; i++) z[i] = new PLFLT[YPTS]; @@ -281,6 +276,7 @@ for(int i=0; i<XPTS; i++) w[i] = new PLFLT[YPTS]; + PLFLT xx, yy; for(int i=0; i<XPTS; i++) { xx = cast(double)(i-(XPTS/2))/(XPTS/2); for(int j=0; j<YPTS; j++) { @@ -291,14 +287,16 @@ } /* Set up grids */ - cgrid1.xg = (new PLFLT[XPTS]).ptr; - cgrid1.yg = (new PLFLT[XPTS]).ptr; + PLcGrid cgrid1; + cgrid1.xg = new PLFLT[XPTS]; + cgrid1.yg = new PLFLT[YPTS]; - PLFLT[][] cgrid2.xg = new PLFLT[][XPTS]; + PLcGrid2 cgrid2; + cgrid2.xg = new PLFLT[][XPTS]; for(int i=0; i<XPTS; i++) cgrid2.xg[i] = new PLFLT[YPTS]; - PLFLT[][] cgrid2.yg = new PLFLT[][XPTS]; + cgrid2.yg = new PLFLT[][XPTS]; for(int i=0; i<XPTS; i++) cgrid2.yg[i] = new PLFLT[YPTS]; @@ -307,8 +305,8 @@ for(int j=0; j<YPTS; j++) { mypltr(cast(PLFLT)i, cast(PLFLT)j, &xx, &yy, null); - argx = xx * M_PI/2; - argy = yy * M_PI/2; + argx = xx*PI/2; + argy = yy*PI/2; distort = 0.4; cgrid1.xg[i] = xx + distort * cos(argx); @@ -320,14 +318,15 @@ } /* Plot using identity transform */ + pl_setcontlabelformat(4, 3); pl_setcontlabelparam(0.006, 0.3, 0.1, 1); plenv(-1.0, 1.0, -1.0, 1.0, 0, 0); plcol0(2); - plcont(z, 1, XPTS, 1, YPTS, clevel, mypltr); + plcont(z, 1, XPTS, 1, YPTS, clevel, &mypltr); plstyl(mark, space); plcol0(3); - plcont(w, 1, XPTS, 1, YPTS, clevel, mypltr); + plcont(w, 1, XPTS, 1, YPTS, clevel, &mypltr); plstyl(null, null); plcol0(1); pllab("X Coordinate", "Y Coordinate", "Streamlines of flow"); @@ -336,11 +335,11 @@ /* Plot using 1d coordinate transform */ plenv(-1.0, 1.0, -1.0, 1.0, 0, 0); plcol0(2); - plcont(z, 1, XPTS, 1, YPTS, clevel, pltr1, cast(void*)&cgrid1); + plcont(z, 1, XPTS, 1, YPTS, clevel, cgrid1); - plstyl(1, mark, space); + plstyl(mark, space); plcol0(3); - plcont(w, 1, XPTS, 1, YPTS, clevel, pltr1, cast(void*)&cgrid1); + plcont(w, 1, XPTS, 1, YPTS, clevel, cgrid1); plstyl(null, null); plcol0(1); pllab("X Coordinate", "Y Coordinate", "Streamlines of flow"); @@ -348,11 +347,11 @@ /* Plot using 2d coordinate transform */ plenv(-1.0, 1.0, -1.0, 1.0, 0, 0); plcol0(2); - plcont(z, 1, XPTS, 1, YPTS, clevel, pltr2, (void *)&cgrid2); + plcont(z, 1, XPTS, 1, YPTS, clevel, cgrid2); plstyl(mark, space); plcol0(3); - plcont(w, 1, XPTS, 1, YPTS, clevel, pltr2, (void *)&cgrid2); + plcont(w, 1, XPTS, 1, YPTS, clevel, cgrid2); plstyl(null, null); plcol0(1); pllab("X Coordinate", "Y Coordinate", "Streamlines of flow"); Modified: trunk/examples/d/x15d.d =================================================================== --- trunk/examples/d/x15d.d 2009-06-02 23:23:25 UTC (rev 10027) +++ trunk/examples/d/x15d.d 2009-06-03 08:12:27 UTC (rev 10028) @@ -229,7 +229,7 @@ fmn = fmx; for(int i=0; i<f.length; i++) { - for(int j=0; j<f[0].length; j++) { + for(int j=0; j<f[i].length; j++) { fmx = fmax(fmx, f[i][j]); fmn = fmin(fmn, f[i][j]); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |