PLplot: sccont.c Source File

PLplot 5.10.0

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
sccont.c
Go to the documentation of this file.
1 // $Id: sccont.c 12836 2013-12-09 19:33:53Z arjenmarkus $
2 //
3 // Contour plotter front-ends for Fortran.
4 //
5 // Copyright (C) 2004 Alan W. Irwin
6 //
7 // This file is part of PLplot.
8 //
9 // PLplot is free software; you can redistribute it and/or modify
10 // it under the terms of the GNU Library General Public License as published
11 // by the Free Software Foundation; either version 2 of the License, or
12 // (at your option) any later version.
13 //
14 // PLplot is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU Library General Public License for more details.
18 //
19 // You should have received a copy of the GNU Library General Public License
20 // along with PLplot; if not, write to the Free Software
21 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 //
23 //
24
25 #include "plstubs.h"
26
27 // Function prototypes
28 void pltr0f( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data );
29 void PLCON07( PLFLT *z, PLINT *nx, PLINT *ny, PLINT *kx, PLINT *lx,
30 PLINT *ky, PLINT *ly, PLFLT *clevel, PLINT *nlevel );
31 void PLCON17( PLFLT *z, PLINT *nx, PLINT *ny, PLINT *kx, PLINT *lx,
32 PLINT *ky, PLINT *ly, PLFLT *clevel, PLINT *nlevel,
33 PLFLT *xg, PLFLT *yg );
34 void PLCON27( PLFLT *z, PLINT *nx, PLINT *ny, PLINT *kx, PLINT *lx,
35 PLINT *ky, PLINT *ly, PLFLT *clevel, PLINT *nlevel,
36 PLFLT *xg, PLFLT *yg );
37 void PLVEC07( PLFLT *u, PLFLT *v, PLINT *nx, PLINT *ny, PLFLT *scale );
38 void PLVEC17( PLFLT *u, PLFLT *v, PLINT *nx, PLINT *ny, PLFLT *scale,
39 PLFLT *xg, PLFLT *yg );
40 void PLVEC27( PLFLT *u, PLFLT *v, PLINT *nx, PLINT *ny, PLFLT *scale,
41 PLFLT *xg, PLFLT *yg );
42 static void pltr( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data );
43 void PLCONT7( PLFLT *z, PLINT *nx, PLINT *ny, PLINT *kx, PLINT *lx,
44 PLINT *ky, PLINT *ly, PLFLT *clevel, PLINT *nlevel, PLFLT *ftr );
45 void PLVECT7( PLFLT *u, PLFLT *v, PLINT *nx, PLINT *ny, PLFLT *scale,
46 PLFLT *ftr );
47 void PLSHADE07( PLFLT *z, PLINT *nx, PLINT *ny, const char *defined,
48 PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax,
49 PLFLT *shade_min, PLFLT *shade_max,
50 PLINT *sh_cmap, PLFLT *sh_color, PLFLT *sh_width,
51 PLINT *min_color, PLFLT *min_width,
52 PLINT *max_color, PLFLT *max_width, PLINT *lx );
53 void PLSHADE17( PLFLT *z, PLINT *nx, PLINT *ny, const char *defined,
54 PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax,
55 PLFLT *shade_min, PLFLT *shade_max,
56 PLINT *sh_cmap, PLFLT *sh_color, PLFLT *sh_width,
57 PLINT *min_color, PLFLT *min_width,
58 PLINT *max_color, PLFLT *max_width,
59 PLFLT *xg1, PLFLT *yg1, PLINT *lx );
60 void PLSHADE27( PLFLT *z, PLINT *nx, PLINT *ny, const char *defined,
61 PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax,
62 PLFLT *shade_min, PLFLT *shade_max,
63 PLINT *sh_cmap, PLFLT *sh_color, PLFLT *sh_width,
64 PLINT *min_color, PLFLT *min_width,
65 PLINT *max_color, PLFLT *max_width,
66 PLFLT *xg2, PLFLT *yg2, PLINT *lx );
67 void PLSHADE7( PLFLT *z, PLINT *nx, PLINT *ny, const char *defined,
68 PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax,
69 PLFLT *shade_min, PLFLT *shade_max,
70 PLINT *sh_cmap, PLFLT *sh_color, PLFLT *sh_width,
71 PLINT *min_color, PLFLT *min_width,
72 PLINT *max_color, PLFLT *max_width, PLFLT *ftr, PLINT *lx );
73 void PLSHADES07( PLFLT *z, PLINT *nx, PLINT *ny, const char *defined,
74 PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax,
75 PLFLT *clevel, PLINT *nlevel, PLFLT *fill_width,
76 PLINT *cont_color, PLFLT *cont_width, PLINT *lx, PLINT *rect );
77 void PLSHADES17( PLFLT *z, PLINT *nx, PLINT *ny, const char *defined,
78 PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax,
79 PLFLT *clevel, PLINT *nlevel, PLFLT *fill_width,
80 PLINT *cont_color, PLFLT *cont_width,
81 PLFLT *xg1, PLFLT *yg1, PLINT *lx, PLINT *rect );
82 void PLSHADES27( PLFLT *z, PLINT *nx, PLINT *ny, const char *defined,
83 PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax,
84 PLFLT *clevel, PLINT *nlevel, PLFLT *fill_width,
85 PLINT *cont_color, PLFLT *cont_width,
86 PLFLT *xg2, PLFLT *yg2, PLINT *lx, PLINT *rect );
87 void PLSHADES7( PLFLT *z, PLINT *nx, PLINT *ny, const char *defined,
88 PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax,
89 PLFLT *clevel, PLINT *nlevel, PLFLT *fill_width,
90 PLINT *cont_color, PLFLT *cont_width, PLFLT *ftr, PLINT *lx, PLINT *rect );
91 void PLGRIDDATA( PLFLT *x, PLFLT *y, PLFLT *z, PLINT *npts, PLFLT *xg,
92 PLINT *nx, PLFLT *yg, PLINT *ny, PLFLT *zg, PLINT *type,
93 PLFLT *data );
94 void PLIMAGEFR07( PLFLT *idata, PLINT *nx, PLINT *ny,
95 PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax,
96 PLFLT *zmin, PLFLT *zmax, PLFLT *valuemin, PLFLT *valuemax,
97 PLINT *lx );
98 void PLIMAGEFR17( PLFLT *idata, PLINT *nx, PLINT *ny,
99 PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax,
100 PLFLT *zmin, PLFLT *zmax, PLFLT *valuemin, PLFLT *valuemax,
101 PLFLT *xg, PLFLT *yg, PLINT *lx );
102 void PLIMAGEFR27( PLFLT *idata, PLINT *nx, PLINT *ny,
103 PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax,
104 PLFLT *zmin, PLFLT *zmax, PLFLT *valuemin, PLFLT *valuemax,
105 PLFLT *xg, PLFLT *yg, PLINT *lx );
106 void PLIMAGEFR7( PLFLT *idata, PLINT *nx, PLINT *ny,
107 PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax,
108 PLFLT *zmin, PLFLT *zmax, PLFLT *valuemin, PLFLT *valuemax,
109 PLFLT *ftr, PLINT *lx );
110
111
112
113
114 //--------------------------------------------------------------------------
115 // pltr0f()
116 //
117 // Identity transformation for plots from Fortran.
118 // Only difference from C-language identity function (pltr0) is that the
119 // Fortran paradigm for array index is used, i.e. starting at 1.
120 //--------------------------------------------------------------------------
121
122 void
123 pltr0f( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *PL_UNUSED( pltr_data ) )
124 {
125 *tx = x + 1.0;
126 *ty = y + 1.0;
127 }
128
129 //--------------------------------------------------------------------------
130 // Contour plotter front-ends.
131 // These specify the row-dominant function evaluator in the plfcont
132 // argument list. NO TRANSPOSE IS NECESSARY. The routines are as follows:
133 //
134 // - plcon0 no transformation
135 // - plcon1 linear interpolation from singly dimensioned coord arrays
136 // - plcon2 linear interpolation from doubly dimensioned coord arrays
137 //
138 // The latter two work by calling plfcont() with the appropriate grid
139 // structure for input to pltr2f().
140 //--------------------------------------------------------------------------
141
142 // no transformation
143
144 void
145 PLCON07( PLFLT *z, PLINT *nx, PLINT *ny, PLINT *kx, PLINT *lx,
146 PLINT *ky, PLINT *ly, PLFLT *clevel, PLINT *nlevel )
147 {
148 PLfGrid fgrid;
149
150 fgrid.nx = *nx;
151 fgrid.ny = *ny;
152 fgrid.f = z;
153
154 plfcont( plf2evalr, (void *) &fgrid,
155 *nx, *ny, *kx, *lx, *ky, *ly, clevel, *nlevel,
156 pltr0f, NULL );
157 }
158
159 // 1-d transformation
160
161 void
162 PLCON17( PLFLT *z, PLINT *nx, PLINT *ny, PLINT *kx, PLINT *lx,
163 PLINT *ky, PLINT *ly, PLFLT *clevel, PLINT *nlevel,
164 PLFLT *xg, PLFLT *yg )
165 {
166 PLfGrid fgrid;
167 PLcGrid cgrid;
168
169 fgrid.nx = *nx;
170 fgrid.ny = *ny;
171 fgrid.f = z;
172
173 cgrid.nx = *nx;
174 cgrid.ny = *ny;
175 cgrid.xg = xg;
176 cgrid.yg = yg;
177
178 plfcont( plf2evalr, (void *) &fgrid,
179 *nx, *ny, *kx, *lx, *ky, *ly, clevel, *nlevel,
180 pltr1, (void *) &cgrid );
181 }
182
183 // 2-d transformation
184
185 void
186 PLCON27( PLFLT *z, PLINT *nx, PLINT *ny, PLINT *kx, PLINT *lx,
187 PLINT *ky, PLINT *ly, PLFLT *clevel, PLINT *nlevel,
188 PLFLT *xg, PLFLT *yg )
189 {
190 PLfGrid fgrid;
191 PLcGrid cgrid;
192
193 fgrid.nx = *nx;
194 fgrid.ny = *ny;
195 fgrid.f = z;
196
197 cgrid.nx = *nx;
198 cgrid.ny = *ny;
199 cgrid.xg = xg;
200 cgrid.yg = yg;
201
202 plfcont( plf2evalr, (void *) &fgrid,
203 *nx, *ny, *kx, *lx, *ky, *ly, clevel, *nlevel,
204 pltr2f, (void *) &cgrid );
205 }
206
207 //--------------------------------------------------------------------------
208 // Vector plotter front-ends.
209 // These specify the row-dominant function evaluator in the plfvect
210 // argument list. NO TRANSPOSE IS NECESSARY. The routines are as follows:
211 //
212 // - plvec0 no transformation
213 // - plvec1 linear interpolation from singly dimensioned coord arrays
214 // - plvec2 linear interpolation from doubly dimensioned coord arrays
215 //
216 // The latter two work by calling plfvect() with the appropriate grid
217 // structure for input to pltr2f().
218 //--------------------------------------------------------------------------
219
220 // no transformation
221
222 void
223 PLVEC07( PLFLT *u, PLFLT *v, PLINT *nx, PLINT *ny, PLFLT *scale )
224 {
225 PLfGrid fgrid1, fgrid2;
226
227 fgrid1.nx = *nx;
228 fgrid1.ny = *ny;
229 fgrid1.f = u;
230
231 fgrid2.nx = *nx;
232 fgrid2.ny = *ny;
233 fgrid2.f = v;
234
235 plfvect( plf2evalr, (void *) &fgrid1, (void *) &fgrid2,
236 *nx, *ny, *scale, pltr0f, NULL );
237 }
238
239 // 1-d transformation
240
241 void
242 PLVEC17( PLFLT *u, PLFLT *v, PLINT *nx, PLINT *ny, PLFLT *scale,
243 PLFLT *xg, PLFLT *yg )
244 {
245 PLfGrid fgrid1;
246 PLfGrid fgrid2;
247 PLcGrid cgrid;
248
249 fgrid1.nx = *nx;
250 fgrid1.ny = *ny;
251 fgrid1.f = u;
252
253 fgrid2.nx = *nx;
254 fgrid2.ny = *ny;
255 fgrid2.f = v;
256
257 cgrid.nx = *nx;
258 cgrid.ny = *ny;
259 cgrid.xg = xg;
260 cgrid.yg = yg;
261
262 plfvect( plf2evalr, (void *) &fgrid1, (void *) &fgrid2,
263 *nx, *ny, *scale, pltr1, (void *) &cgrid );
264 }
265
266 // 2-d transformation
267
268 void
269 PLVEC27( PLFLT *u, PLFLT *v, PLINT *nx, PLINT *ny, PLFLT *scale,
270 PLFLT *xg, PLFLT *yg )
271 {
272 PLfGrid fgrid1;
273 PLfGrid fgrid2;
274 PLcGrid cgrid;
275
276 fgrid1.nx = *nx;
277 fgrid1.ny = *ny;
278 fgrid1.f = u;
279
280 fgrid2.nx = *nx;
281 fgrid2.ny = *ny;
282 fgrid2.f = v;
283
284 cgrid.nx = *nx;
285 cgrid.ny = *ny;
286 cgrid.xg = xg;
287 cgrid.yg = yg;
288
289 plfvect( plf2evalr, (void *) &fgrid1, (void *) &fgrid2,
290 *nx, *ny, *scale, pltr2f, (void *) &cgrid );
291 }
292
293 //--------------------------------------------------------------------------
294 // Here are the old contour plotters.
295 //--------------------------------------------------------------------------
296
297 static void
298 pltr( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data )
299 {
300 PLFLT *tr = (PLFLT *) pltr_data;
301
302 *tx = tr[0] * x + tr[1] * y + tr[2];
303 *ty = tr[3] * x + tr[4] * y + tr[5];
304 }
305
306 void
307 PLCONT7( PLFLT *z, PLINT *nx, PLINT *ny, PLINT *kx, PLINT *lx,
308 PLINT *ky, PLINT *ly, PLFLT *clevel, PLINT *nlevel, PLFLT *ftr )
309 {
310 PLfGrid fgrid;
311
312 fgrid.nx = *nx;
313 fgrid.ny = *ny;
314 fgrid.f = z;
315
316 plfcont( plf2evalr, (void *) &fgrid,
317 *nx, *ny, *kx, *lx, *ky, *ly, clevel, *nlevel,
318 pltr, (void *) ftr );
319 }
320
321 void
322 PLVECT7( PLFLT *u, PLFLT *v, PLINT *nx, PLINT *ny, PLFLT *scale,
323 PLFLT *ftr )
324 {
325 PLfGrid fgrid1;
326 PLfGrid fgrid2;
327
328 fgrid1.nx = *nx;
329 fgrid1.ny = *ny;
330 fgrid1.f = u;
331
332 fgrid2.nx = *nx;
333 fgrid2.ny = *ny;
334 fgrid2.f = v;
335
336 plfvect( plf2evalr, (void *) &fgrid1, (void *) &fgrid2,
337 *nx, *ny, *scale,
338 pltr, (void *) ftr );
339 }
340
341 //--------------------------------------------------------------------------
342 // plfshade front-ends.
343 // These specify the row-dominant function evaluator in the plfshade
344 // argument list. NO TRANSPOSE IS NECESSARY. The routines are as follows:
345 //
346 // - plshade0 map indices to xmin, xmax, ymin, ymax.
347 // The next two work by calling plfshade() with the appropriate grid
348 // structure for input to pltr2f().
349 // - plshade1 linear interpolation from singly dimensioned coord arrays
350 // - plshade2 linear interpolation from doubly dimensioned coord arrays
351 // - plshade tr array transformation
352 //
353 //--------------------------------------------------------------------------
354
355 void
356 PLSHADE07( PLFLT *z, PLINT *nx, PLINT *ny, const char *PL_UNUSED( defined ),
357 PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax,
358 PLFLT *shade_min, PLFLT *shade_max,
359 PLINT *sh_cmap, PLFLT *sh_color, PLFLT *sh_width,
360 PLINT *min_color, PLFLT *min_width,
361 PLINT *max_color, PLFLT *max_width, PLINT *lx )
362 {
363 PLINT rect = 1;
364 PLFLT ** a;
365 int i, j;
366
367 // Create a vectored a array from transpose of the fortran z array.
368 plAlloc2dGrid( &a, *nx, *ny );
369 for ( i = 0; i < *nx; i++ )
370 {
371 for ( j = 0; j < *ny; j++ )
372 {
373 a[i][j] = z[i + j * *lx];
374 }
375 }
376
377 c_plshade( (const PLFLT * const *) a, *nx, *ny, NULL,
378 *xmin, *xmax, *ymin, *ymax,
379 *shade_min, *shade_max,
380 *sh_cmap, *sh_color, *sh_width,
381 *min_color, *min_width, *max_color, *max_width,
382 c_plfill, rect, NULL, NULL );
383
384 // Clean up memory allocated for a
385 plFree2dGrid( a, *nx, *ny );
386 }
387
388
389 // 1-d transformation
390
391 void
392 PLSHADE17( PLFLT *z, PLINT *nx, PLINT *ny, const char * PL_UNUSED( defined ),
393 PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax,
394 PLFLT *shade_min, PLFLT *shade_max,
395 PLINT *sh_cmap, PLFLT *sh_color, PLFLT *sh_width,
396 PLINT *min_color, PLFLT *min_width,
397 PLINT *max_color, PLFLT *max_width,
398 PLFLT *xg1, PLFLT *yg1, PLINT *lx )
399 {
400 PLINT rect = 1;
401 PLFLT ** a;
402 int i, j;
403 PLcGrid cgrid;
404
405 // Create a vectored a array from transpose of the fortran z array.
406 plAlloc2dGrid( &a, *nx, *ny );
407 for ( i = 0; i < *nx; i++ )
408 {
409 for ( j = 0; j < *ny; j++ )
410 {
411 a[i][j] = z[i + j * *lx];
412 }
413 }
414
415 cgrid.nx = *nx;
416 cgrid.ny = *ny;
417 cgrid.xg = xg1;
418 cgrid.yg = yg1;
419 c_plshade( (const PLFLT * const *) a, *nx, *ny, NULL,
420 *xmin, *xmax, *ymin, *ymax,
421 *shade_min, *shade_max,
422 *sh_cmap, *sh_color, *sh_width,
423 *min_color, *min_width, *max_color, *max_width,
424 c_plfill, rect, pltr1, ( PLPointer ) & cgrid );
425
426 // Clean up memory allocated for a
427 plFree2dGrid( a, *nx, *ny );
428 }
429
430 // 2-d transformation
431
432 void
433 PLSHADE27( PLFLT *z, PLINT *nx, PLINT *ny, const char * PL_UNUSED( defined ),
434 PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax,
435 PLFLT *shade_min, PLFLT *shade_max,
436 PLINT *sh_cmap, PLFLT *sh_color, PLFLT *sh_width,
437 PLINT *min_color, PLFLT *min_width,
438 PLINT *max_color, PLFLT *max_width,
439 PLFLT *xg2, PLFLT *yg2, PLINT *lx )
440 {
441 PLINT rect = 0;
442 PLFLT **a;
443 int i, j;
444 PLcGrid2 cgrid2;
445
446 // Create a vectored a array from transpose of the fortran z array.
447 plAlloc2dGrid( &a, *nx, *ny );
448 plAlloc2dGrid( &cgrid2.xg, *nx, *ny );
449 plAlloc2dGrid( &cgrid2.yg, *nx, *ny );
450 cgrid2.nx = *nx;
451 cgrid2.ny = *ny;
452 for ( i = 0; i < *nx; i++ )
453 {
454 for ( j = 0; j < *ny; j++ )
455 {
456 a[i][j] = z[i + j * *lx];
457 cgrid2.xg[i][j] = xg2[i + j * *lx];
458 cgrid2.yg[i][j] = yg2[i + j * *lx];
459 }
460 }
461
462 c_plshade( (const PLFLT * const *) a, *nx, *ny, NULL,
463 *xmin, *xmax, *ymin, *ymax,
464 *shade_min, *shade_max,
465 *sh_cmap, *sh_color, *sh_width,
466 *min_color, *min_width, *max_color, *max_width,
467 c_plfill, rect, pltr2, (void *) &cgrid2 );
468
469 // Clean up memory allocated for a
470 plFree2dGrid( a, *nx, *ny );
471 plFree2dGrid( cgrid2.xg, *nx, *ny );
472 plFree2dGrid( cgrid2.yg, *nx, *ny );
473 }
474
475 void
476 PLSHADE7( PLFLT *z, PLINT *nx, PLINT *ny, const char * PL_UNUSED( defined ),
477 PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax,
478 PLFLT *shade_min, PLFLT *shade_max,
479 PLINT *sh_cmap, PLFLT *sh_color, PLFLT *sh_width,
480 PLINT *min_color, PLFLT *min_width,
481 PLINT *max_color, PLFLT *max_width, PLFLT *ftr, PLINT *lx )
482 {
483 PLINT rect = 1;
484 PLFLT ** a;
485 int i, j;
486
487 // Create a vectored a array from transpose of the fortran z array.
488 plAlloc2dGrid( &a, *nx, *ny );
489 for ( i = 0; i < *nx; i++ )
490 {
491 for ( j = 0; j < *ny; j++ )
492 {
493 a[i][j] = z[i + j * *lx];
494 }
495 }
496
497 c_plshade( (const PLFLT * const *) a, *nx, *ny, NULL,
498 *xmin, *xmax, *ymin, *ymax,
499 *shade_min, *shade_max,
500 *sh_cmap, *sh_color, *sh_width,
501 *min_color, *min_width, *max_color, *max_width,
502 c_plfill, rect, pltr, (void *) ftr );
503
504 // Clean up memory allocated for a
505 plFree2dGrid( a, *nx, *ny );
506 }
507
508 //--------------------------------------------------------------------------
509 // plshades front-ends.
510 //
511 // - plshades0 map indices to xmin, xmax, ymin, ymax
512 // - plshades1 linear interpolation from singly dimensioned coord arrays
513 // - plshades2 linear interpolation from doubly dimensioned coord arrays
514 // - plshades pass tr information with plplot common block (and
515 // then pass tr as last argument of PLSHADES7)
516 //--------------------------------------------------------------------------
517
518 void
519 PLSHADES07( PLFLT *z, PLINT *nx, PLINT *ny, const char * PL_UNUSED( defined ),
520 PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax,
521 PLFLT *clevel, PLINT *nlevel, PLFLT *fill_width,
522 PLINT *cont_color, PLFLT *cont_width, PLINT *lx, PLINT *rect )
523 {
524 PLFLT ** a;
525 int i, j;
526
527 // Create a vectored a array from transpose of the fortran z array.
528 plAlloc2dGrid( &a, *nx, *ny );
529 for ( i = 0; i < *nx; i++ )
530 {
531 for ( j = 0; j < *ny; j++ )
532 {
533 a[i][j] = z[i + j * *lx];
534 }
535 }
536
537 c_plshades( (const PLFLT * const *) a, *nx, *ny, NULL,
538 *xmin, *xmax, *ymin, *ymax,
539 clevel, *nlevel, *fill_width,
540 *cont_color, *cont_width,
541 c_plfill, *rect, NULL, NULL );
542
543 // Clean up memory allocated for a
544 plFree2dGrid( a, *nx, *ny );
545 }
546
547 void
548 PLSHADES17( PLFLT *z, PLINT *nx, PLINT *ny, const char * PL_UNUSED( defined ),
549 PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax,
550 PLFLT *clevel, PLINT *nlevel, PLFLT *fill_width,
551 PLINT *cont_color, PLFLT *cont_width,
552 PLFLT *xg1, PLFLT *yg1, PLINT *lx, PLINT *rect )
553 {
554 PLFLT ** a;
555 int i, j;
556 PLcGrid cgrid;
557
558 // Create a vectored a array from transpose of the fortran z array.
559 plAlloc2dGrid( &a, *nx, *ny );
560 for ( i = 0; i < *nx; i++ )
561 {
562 for ( j = 0; j < *ny; j++ )
563 {
564 a[i][j] = z[i + j * *lx];
565 }
566 }
567
568 cgrid.nx = *nx;
569 cgrid.ny = *ny;
570 cgrid.xg = xg1;
571 cgrid.yg = yg1;
572
573 c_plshades( (const PLFLT * const *) a, *nx, *ny, NULL,
574 *xmin, *xmax, *ymin, *ymax,
575 clevel, *nlevel, *fill_width,
576 *cont_color, *cont_width,
577 c_plfill, *rect, pltr1, ( PLPointer ) & cgrid );
578
579 // Clean up memory allocated for a
580 plFree2dGrid( a, *nx, *ny );
581 }
582
583 void
584 PLSHADES27( PLFLT *z, PLINT *nx, PLINT *ny, const char * PL_UNUSED( defined ),
585 PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax,
586 PLFLT *clevel, PLINT *nlevel, PLFLT *fill_width,
587 PLINT *cont_color, PLFLT *cont_width,
588 PLFLT *xg2, PLFLT *yg2, PLINT *lx, PLINT *rect )
589 {
590 PLFLT **a;
591 int i, j;
592 PLcGrid2 cgrid2;
593
594 // Create a vectored a array from transpose of the fortran z array.
595 plAlloc2dGrid( &a, *nx, *ny );
596 plAlloc2dGrid( &cgrid2.xg, *nx, *ny );
597 plAlloc2dGrid( &cgrid2.yg, *nx, *ny );
598 cgrid2.nx = *nx;
599 cgrid2.ny = *ny;
600 for ( i = 0; i < *nx; i++ )
601 {
602 for ( j = 0; j < *ny; j++ )
603 {
604 a[i][j] = z[i + j * *lx];
605 cgrid2.xg[i][j] = xg2[i + j * *lx];
606 cgrid2.yg[i][j] = yg2[i + j * *lx];
607 }
608 }
609
610 c_plshades( (const PLFLT * const *) a, *nx, *ny, NULL,
611 *xmin, *xmax, *ymin, *ymax,
612 clevel, *nlevel, *fill_width,
613 *cont_color, *cont_width,
614 c_plfill, *rect, pltr2, (void *) &cgrid2 );
615
616 // Clean up allocated memory
617 plFree2dGrid( a, *nx, *ny );
618 plFree2dGrid( cgrid2.xg, *nx, *ny );
619 plFree2dGrid( cgrid2.yg, *nx, *ny );
620 }
621
622 void
623 PLSHADES7( PLFLT *z, PLINT *nx, PLINT *ny, const char * PL_UNUSED( defined ),
624 PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax,
625 PLFLT *clevel, PLINT *nlevel, PLFLT *fill_width,
626 PLINT *cont_color, PLFLT *cont_width, PLFLT *ftr, PLINT *lx, PLINT *rect )
627 {
628 PLFLT ** a;
629 int i, j;
630
631 // Create a vectored a array from transpose of the fortran z array.
632 plAlloc2dGrid( &a, *nx, *ny );
633 for ( i = 0; i < *nx; i++ )
634 {
635 for ( j = 0; j < *ny; j++ )
636 {
637 a[i][j] = z[i + j * *lx];
638 }
639 }
640
641 c_plshades( (const PLFLT * const *) a, *nx, *ny, NULL,
642 *xmin, *xmax, *ymin, *ymax,
643 clevel, *nlevel, *fill_width,
644 *cont_color, *cont_width,
645 c_plfill, *rect, pltr, (void *) ftr );
646
647 // Clean up memory allocated for a
648 plFree2dGrid( a, *nx, *ny );
649 }
650
651 void
652 PLGRIDDATA( PLFLT *x, PLFLT *y, PLFLT *z, PLINT *npts, PLFLT *xg,
653 PLINT *nx, PLFLT *yg, PLINT *ny, PLFLT *zg, PLINT *type, PLFLT *data )
654 {
655 PLFLT ** a;
656 int i, j;
657
658 // Create a vectored a array from transpose of the fortran z array.
659 plAlloc2dGrid( &a, *nx, *ny );
660
661 c_plgriddata( x, y, z, *npts, xg, *nx, yg, *ny, a, *type, *data );
662
663 for ( i = 0; i < *nx; i++ )
664 {
665 for ( j = 0; j < *ny; j++ )
666 {
667 zg[i + j * *nx] = a[i][j];
668 }
669 }
670
671 // Clean up memory allocated for a
672 plFree2dGrid( a, *nx, *ny );
673 }
674
675 void
676 PLIMAGEFR07( PLFLT *idata, PLINT *nx, PLINT *ny,
677 PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax,
678 PLFLT *zmin, PLFLT *zmax, PLFLT *valuemin, PLFLT *valuemax,
679 PLINT *lx )
680 {
681 int i, j;
682 PLFLT **pidata;
683
684 plAlloc2dGrid( &pidata, *nx, *ny );
685
686 for ( i = 0; i < *nx; i++ )
687 {
688 for ( j = 0; j < *ny; j++ )
689 {
690 pidata[i][j] = idata[i + j * ( *lx )];
691 }
692 }
693
694 c_plimagefr( (const PLFLT * const *) pidata, *nx, *ny,
695 *xmin, *xmax, *ymin, *ymax, *zmin, *zmax,
696 *valuemin, *valuemax, pltr0, NULL );
697
698 plFree2dGrid( pidata, *nx, *ny );
699 }
700
701 void
702 PLIMAGEFR17( PLFLT *idata, PLINT *nx, PLINT *ny,
703 PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax,
704 PLFLT *zmin, PLFLT *zmax, PLFLT *valuemin, PLFLT *valuemax,
705 PLFLT *xg, PLFLT *yg, PLINT *lx )
706 {
707 int i, j;
708 PLFLT **pidata;
709 PLcGrid cgrid;
710
711 plAlloc2dGrid( &pidata, *nx, *ny );
712
713 cgrid.nx = ( *nx ) + 1;
714 cgrid.ny = ( *ny ) + 1;
715 cgrid.xg = xg;
716 cgrid.yg = yg;
717
718 for ( i = 0; i < *nx; i++ )
719 {
720 for ( j = 0; j < *ny; j++ )
721 {
722 pidata[i][j] = idata[i + j * ( *lx )];
723 }
724 }
725
726 c_plimagefr( (const PLFLT * const *) pidata, *nx, *ny,
727 *xmin, *xmax, *ymin, *ymax, *zmin, *zmax,
728 *valuemin, *valuemax, pltr1, (void *) &cgrid );
729
730 plFree2dGrid( pidata, *nx, *ny );
731 }
732
733 void
734 PLIMAGEFR27( PLFLT *idata, PLINT *nx, PLINT *ny,
735 PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax,
736 PLFLT *zmin, PLFLT *zmax, PLFLT *valuemin, PLFLT *valuemax,
737 PLFLT *xg, PLFLT *yg, PLINT *lx )
738 {
739 int i, j;
740 PLFLT **pidata;
741 PLcGrid2 cgrid2;
742
743 plAlloc2dGrid( &pidata, *nx, *ny );
744 plAlloc2dGrid( &cgrid2.xg, ( *nx ) + 1, ( *ny ) + 1 );
745 plAlloc2dGrid( &cgrid2.yg, ( *nx ) + 1, ( *ny ) + 1 );
746
747 cgrid2.nx = ( *nx ) + 1;
748 cgrid2.ny = ( *ny ) + 1;
749 for ( i = 0; i <= *nx; i++ )
750 {
751 for ( j = 0; j <= *ny; j++ )
752 {
753 cgrid2.xg[i][j] = xg[i + j * ( ( *lx ) + 1 )];
754 cgrid2.yg[i][j] = yg[i + j * ( ( *lx ) + 1 )];
755 }
756 }
757
758 for ( i = 0; i < *nx; i++ )
759 {
760 for ( j = 0; j < *ny; j++ )
761 {
762 pidata[i][j] = idata[i + j * ( *lx )];
763 }
764 }
765
766 c_plimagefr( (const PLFLT * const *) pidata, *nx, *ny,
767 *xmin, *xmax, *ymin, *ymax, *zmin, *zmax,
768 *valuemin, *valuemax, pltr2, (void *) &cgrid2 );
769
770 plFree2dGrid( pidata, *nx, *ny );
771 plFree2dGrid( cgrid2.xg, ( *nx ) + 1, ( *ny ) + 1 );
772 plFree2dGrid( cgrid2.yg, ( *nx ) + 1, ( *ny ) + 1 );
773 }
774
775 void
776 PLIMAGEFR7( PLFLT *idata, PLINT *nx, PLINT *ny,
777 PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax,
778 PLFLT *zmin, PLFLT *zmax, PLFLT *valuemin, PLFLT *valuemax,
779 PLFLT *ftr, PLINT *lx )
780 {
781 int i, j;
782 PLFLT **pidata;
783
784 plAlloc2dGrid( &pidata, *nx, *ny );
785
786 for ( i = 0; i < *nx; i++ )
787 {
788 for ( j = 0; j < *ny; j++ )
789 {
790 pidata[i][j] = idata[i + j * ( *lx )];
791 }
792 }
793
794 c_plimagefr( (const PLFLT * const *) pidata, *nx, *ny,
795 *xmin, *xmax, *ymin, *ymax, *zmin, *zmax,
796 *valuemin, *valuemax, pltr, (void *) ftr );
797
798 plFree2dGrid( pidata, *nx, *ny );
799 }