home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 344b.lha / plplot_v2.6 / src / plcont.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-01-27  |  1.1 KB  |  40 lines

  1. /* Draws a contour plot from data in z(nx,ny), using the subarray */
  2. /* from kx to lx in the x direction and from ky to ly in the y */
  3. /* direction. The array of contour levels is clevel(nlevel), and */
  4. /* "pltr" is the name of a subroutine which transforms array indicies */
  5. /* into world coordinates */
  6.  
  7. #include "plplot.h"
  8. #include "declare.h"
  9. #include <stdio.h>
  10. #ifdef PLSTDC
  11. #include <stdlib.h>
  12. #else
  13. extern char *malloc();
  14. extern void free();
  15. #endif
  16.  
  17. void plcont(z,nx,ny,kx,lx,ky,ly,clevel,nlevel,pltr)
  18. PLINT nx, ny, kx, lx, ky, ly, nlevel;
  19. PLFLT *z, *clevel;
  20. void (*pltr)();
  21. {
  22.       PLINT i, mx, my, nstor, *heapc;
  23.  
  24.       mx = lx - kx + 1;
  25.       my = ly - ky + 1;
  26.  
  27.       if (kx < 1 || lx > nx || kx >= lx || ky < 1 || ky > ny || ky >= ly)
  28.                plexit("Argument error in plcont.");
  29.  
  30.       nstor = mx*my/5;
  31.       if(( heapc = (PLINT *)malloc((mx+2*nstor)*sizeof(PLINT))) == NULL)
  32.          plexit("Out of memory in plcont.");
  33.       for (i=0; i<nlevel; i++) {
  34.         plcntr(z,nx,ny,kx,lx,ky,ly,clevel[i],&heapc[0],
  35.                &heapc[nx],&heapc[nx+nstor],nstor,pltr);
  36.       }
  37.       free((VOID *)heapc);
  38.  
  39. }
  40.