PLplot  5.9.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
f77/sc3d.c
Go to the documentation of this file.
1 // $Id: sc3d.c 12095 2011-12-03 08:56:15Z andrewross $
2 //
3 // Stub routines for 3d plots.
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 void
29  PLINT *nx, PLINT *ny, PLINT *opt,
30  PLFLT *clevel, PLINT *nlevel, PLINT *lx )
31 {
32  PLFLT ** a;
33  int i, j;
34 
35 // Create a vectored a array from transpose of the fortran z array.
36  plAlloc2dGrid( &a, *nx, *ny );
37  for ( i = 0; i < *nx; i++ )
38  {
39  for ( j = 0; j < *ny; j++ )
40  {
41  a[i][j] = z[i + j * *lx];
42  }
43  }
44 
45  c_plot3dc( x, y, (const PLFLT * const *) a, *nx, *ny, *opt, clevel, *nlevel );
46 
47 // Clean up memory allocated for a
48  plFree2dGrid( a, *nx, *ny );
49 }
50 
51 void
53  PLINT *nx, PLINT *ny, PLINT *opt,
54  PLFLT *clevel, PLINT *nlevel, PLINT *lx )
55 {
56  PLOT3DC__( x, y, z, nx, ny, opt, clevel, nlevel, lx );
57 }
58 
59 void
61  PLINT *nx, PLINT *ny, PLINT *opt,
62  PLFLT *clevel, PLINT *nlevel, PLINT *lx )
63 {
64  int i, j;
65  PLFLT **temp;
66 
67  // Create the vectored C matrix from the Fortran matrix
68  // To make things easy we save a temporary copy of the transpose of the
69  // Fortran matrix, so that the first dimension of z corresponds to the x
70  // direction.
71 
72  if ( !( temp = (PLFLT **) malloc( (size_t) *nx * sizeof ( PLFLT * ) ) ) )
73  {
74  plabort( "PLSURF3D: Out of memory" );
75  return;
76  }
77 
78  for ( i = 0; i < *nx; i++ )
79  {
80  if ( !( temp[i] = (PLFLT *) malloc( (size_t) *ny * sizeof ( PLFLT ) ) ) )
81  {
82  int ii;
83 
84  for ( ii = 0; ii < i - 1; ii++ )
85  free( (void *) temp[i] );
86  free( (void *) temp );
87  plabort( "PLSURF3D: Out of memory" );
88  return;
89  }
90  }
91 
92  for ( i = 0; i < *nx; i++ )
93  for ( j = 0; j < *ny; j++ )
94  temp[i][j] = *( z + j * *lx + i );
95 
96  c_plsurf3d( x, y, (const PLFLT * const *) temp, *nx, *ny, *opt, clevel, *nlevel );
97 
98  for ( i = 0; i < *nx; i++ )
99  free( (void *) temp[i] );
100 
101  free( (void *) temp );
102 }
103 
104 void
106  PLINT *nx, PLINT *ny, PLINT *opt, PLINT *lx )
107 {
108  PLINT optlocal, nlevel = 0;
109  PLFLT clevel = 0.;
110 
111  optlocal = *opt | MESH;
112  PLOT3DC__( x, y, z, nx, ny, &optlocal, &clevel, &nlevel, lx );
113 }
114 
115 void
117  PLINT *nx, PLINT *ny, PLINT *opt,
118  PLFLT *clevel, PLINT *nlevel, PLINT *lx )
119 {
120  PLINT optlocal;
121  optlocal = *opt | MESH;
122  PLOT3DC__( x, y, z, nx, ny, &optlocal, clevel, nlevel, lx );
123 }
124 
125 
126 void
128  PLINT *nx, PLINT *ny, PLINT *opt, PLINT *side, PLINT *lx )
129 {
130  PLINT optlocal, nlevel = 0;
131  PLFLT clevel = 0.;
132 
133  optlocal = *opt | ( *side == 1 ? DRAW_SIDES : 0 );
134  PLOT3DC__( x, y, z, nx, ny, &optlocal, &clevel, &nlevel, lx );
135 }
136 
void plFree2dGrid(PLFLT **f, PLINT nx, PLINT PL_UNUSED(ny))
Definition: pdfutils.c:1130
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT PLINT PLFLT PLFLT PLINT PLFLT PLINT const PLINT const char *const PLINT nx
void PLOT3D(PLFLT *x, PLFLT *y, PLFLT *z, PLINT *nx, PLINT *ny, PLINT *opt, PLINT *side, PLINT *lx)
Definition: f77/sc3d.c:127
void PLSURF3D(PLFLT *x, PLFLT *y, PLFLT *z, PLINT *nx, PLINT *ny, PLINT *opt, PLFLT *clevel, PLINT *nlevel, PLINT *lx)
Definition: f77/sc3d.c:60
void PLFLT PLINT PLINT PLFLT x
void plAlloc2dGrid(PLFLT ***f, PLINT nx, PLINT ny)
Definition: pdfutils.c:1104
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT PLINT PLFLT PLFLT PLINT PLFLT PLINT const PLINT const char *const PLINT const char *const const PLFLT const PLINT const PLINT const PLFLT * a
void c_plsurf3d(const PLFLT *x, const PLFLT *y, const PLFLT *const *z, PLINT nx, PLINT ny, PLINT opt, const PLFLT *clevel, PLINT nlevel)
Definition: plot3d.c:326
void PLMESHC(PLFLT *x, PLFLT *y, PLFLT *z, PLINT *nx, PLINT *ny, PLINT *opt, PLFLT *clevel, PLINT *nlevel, PLINT *lx)
Definition: f77/sc3d.c:116
#define MESH
Definition: plplot.h:1393
void PLOT3DC(PLFLT *x, PLFLT *y, PLFLT *z, PLINT *nx, PLINT *ny, PLINT *opt, PLFLT *clevel, PLINT *nlevel, PLINT *lx)
Definition: f77/sc3d.c:52
int PLINT
Definition: plplot.h:175
void PLOT3DC__(PLFLT *x, PLFLT *y, PLFLT *z, PLINT *nx, PLINT *ny, PLINT *opt, PLFLT *clevel, PLINT *nlevel, PLINT *lx)
Definition: f77/sc3d.c:28
void PLFLT PLINT PLINT PLFLT PLFLT y
#define DRAW_SIDES
Definition: plplot.h:1391
void c_plot3dc(const PLFLT *x, const PLFLT *y, const PLFLT *const *z, PLINT nx, PLINT ny, PLINT opt, const PLFLT *clevel, PLINT nlevel)
Definition: plot3d.c:881
void plabort(const char *errormsg)
Definition: plctrl.c:1877
float PLFLT
Definition: plplot.h:159
void PLMESH(PLFLT *x, PLFLT *y, PLFLT *z, PLINT *nx, PLINT *ny, PLINT *opt, PLINT *lx)
Definition: f77/sc3d.c:105
void PLFLT PLINT opt