File Coverage

pp-plsurf3dl.c
Criterion Covered Total %
statement 58 59 98.3
branch 48 88 54.5
condition n/a
subroutine n/a
pod n/a
total 106 147 72.1


line stmt bran cond sub pod time code
1              
2             #line 453 "lib/PDL/PP.pm"
3             /*
4             * THIS FILE WAS GENERATED BY PDL::PP from plplot.pd! Do not modify!
5             */
6              
7             #define PDL_FREE_CODE(trans, destroy, comp_free_code, ntpriv_free_code) \
8             if (destroy) { \
9             comp_free_code \
10             } \
11             if ((trans)->dims_redone) { \
12             ntpriv_free_code \
13             }
14              
15             #include "EXTERN.h"
16             #include "perl.h"
17             #include "XSUB.h"
18             #include "pdl.h"
19             #include "pdlcore.h"
20             #define PDL PDL_Graphics_PLplot
21             extern Core* PDL; /* Structure hold core C functions */
22             #line 23 "pp-plsurf3dl.c"
23             #include
24             #include
25             #include
26             #include
27              
28             #ifndef PDL /* this is needed for PDL pre-2.058 */
29             #define PDL PDL_Graphics_PLplot
30             Core* PDL = NULL; PDL_COMMENT("Structure hold core C functions")
31             #endif
32              
33             #define PLPTR_DEFINE(t) typedef t *t ## Ptr; typedef t *t ## Ptr__OUT;
34             PLPTR_DEFINE(PLcGrid)
35             PLPTR_DEFINE(PLcGrid2)
36             #define PLPTR_RECEIVE_IN(t, v, v_in) t *v = (t *)v_in;
37             #define PLPTR_RECEIVE_SV(v) ((PLPointer) (SvROK(v) ? SvIV((SV*)SvRV(v)) : (IV)NULL))
38              
39             #line 1857 "lib/PDL/PP.pm"
40             pdl_error pdl_plsurf3dl_readdata(pdl_trans *__privtrans) {
41             pdl_error PDL_err = {0, NULL, 0};
42             #line 43 "pp-plsurf3dl.c"
43 2 50         if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in plsurf3dl:" "broadcast.incs NULL");
44             /* broadcastloop declarations */
45             int __brcloopval;
46             register PDL_Indx __tind0,__tind1; /* counters along dim */
47 2           register PDL_Indx __tnpdls = __privtrans->broadcast.npdls;
48             /* dims here are how many steps along those dims */
49 2           register PDL_Indx __tinc0_x = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,0);
50 2           register PDL_Indx __tinc0_y = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,0);
51 2           register PDL_Indx __tinc0_z = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,0);
52 2           register PDL_Indx __tinc0_opt = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,0);
53 2           register PDL_Indx __tinc0_clevel = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,0);
54 2           register PDL_Indx __tinc0_indexxmin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,5,0);
55 2           register PDL_Indx __tinc0_indexxmax = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,6,0);
56 2           register PDL_Indx __tinc0_indexymin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,7,0);
57 2           register PDL_Indx __tinc0_indexymax = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,8,0);
58 2           register PDL_Indx __tinc1_x = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,1);
59 2           register PDL_Indx __tinc1_y = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,1);
60 2           register PDL_Indx __tinc1_z = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,1);
61 2           register PDL_Indx __tinc1_opt = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,1);
62 2           register PDL_Indx __tinc1_clevel = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,1);
63 2           register PDL_Indx __tinc1_indexxmin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,5,1);
64 2           register PDL_Indx __tinc1_indexxmax = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,6,1);
65 2           register PDL_Indx __tinc1_indexymin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,7,1);
66 2           register PDL_Indx __tinc1_indexymax = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,8,1);
67             #define PDL_BROADCASTLOOP_START_plsurf3dl_readdata PDL_BROADCASTLOOP_START( \
68             readdata, \
69             __privtrans->broadcast, \
70             __privtrans->vtable, \
71             x_datap += __offsp[0]; \
72             y_datap += __offsp[1]; \
73             z_datap += __offsp[2]; \
74             opt_datap += __offsp[3]; \
75             clevel_datap += __offsp[4]; \
76             indexxmin_datap += __offsp[5]; \
77             indexxmax_datap += __offsp[6]; \
78             indexymin_datap += __offsp[7]; \
79             indexymax_datap += __offsp[8]; \
80             , \
81             ( ,x_datap += __tinc1_x - __tinc0_x * __tdims0 \
82             ,y_datap += __tinc1_y - __tinc0_y * __tdims0 \
83             ,z_datap += __tinc1_z - __tinc0_z * __tdims0 \
84             ,opt_datap += __tinc1_opt - __tinc0_opt * __tdims0 \
85             ,clevel_datap += __tinc1_clevel - __tinc0_clevel * __tdims0 \
86             ,indexxmin_datap += __tinc1_indexxmin - __tinc0_indexxmin * __tdims0 \
87             ,indexxmax_datap += __tinc1_indexxmax - __tinc0_indexxmax * __tdims0 \
88             ,indexymin_datap += __tinc1_indexymin - __tinc0_indexymin * __tdims0 \
89             ,indexymax_datap += __tinc1_indexymax - __tinc0_indexymax * __tdims0 \
90             ), \
91             ( ,x_datap += __tinc0_x \
92             ,y_datap += __tinc0_y \
93             ,z_datap += __tinc0_z \
94             ,opt_datap += __tinc0_opt \
95             ,clevel_datap += __tinc0_clevel \
96             ,indexxmin_datap += __tinc0_indexxmin \
97             ,indexxmax_datap += __tinc0_indexxmax \
98             ,indexymin_datap += __tinc0_indexymin \
99             ,indexymax_datap += __tinc0_indexymax \
100             ) \
101             )
102             #define PDL_BROADCASTLOOP_END_plsurf3dl_readdata PDL_BROADCASTLOOP_END( \
103             __privtrans->broadcast, \
104             x_datap -= __tinc1_x * __tdims1 + __offsp[0]; \
105             y_datap -= __tinc1_y * __tdims1 + __offsp[1]; \
106             z_datap -= __tinc1_z * __tdims1 + __offsp[2]; \
107             opt_datap -= __tinc1_opt * __tdims1 + __offsp[3]; \
108             clevel_datap -= __tinc1_clevel * __tdims1 + __offsp[4]; \
109             indexxmin_datap -= __tinc1_indexxmin * __tdims1 + __offsp[5]; \
110             indexxmax_datap -= __tinc1_indexxmax * __tdims1 + __offsp[6]; \
111             indexymin_datap -= __tinc1_indexymin * __tdims1 + __offsp[7]; \
112             indexymax_datap -= __tinc1_indexymax * __tdims1 + __offsp[8]; \
113             )
114 2           register PDL_Indx __inc_clevel_nlevel = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,4,0)]; (void)__inc_clevel_nlevel;
115 2           register PDL_Indx __inc_indexymax_nx = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,8,0)]; (void)__inc_indexymax_nx;
116 2           register PDL_Indx __inc_indexymin_nx = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,7,0)]; (void)__inc_indexymin_nx;
117 2           register PDL_Indx __inc_x_nx = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,0,0)]; (void)__inc_x_nx;
118 2           register PDL_Indx __inc_y_ny = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,1,0)]; (void)__inc_y_ny;
119 2           register PDL_Indx __inc_z_nx = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,2,0)]; (void)__inc_z_nx;register PDL_Indx __inc_z_ny = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,2,1)]; (void)__inc_z_ny;
120             #ifndef PDL_DECLARE_PARAMS_plsurf3dl_1
121             #define PDL_DECLARE_PARAMS_plsurf3dl_1(PDL_TYPE_OP,PDL_PPSYM_OP,PDL_TYPE_PARAM_opt,PDL_PPSYM_PARAM_opt,PDL_TYPE_PARAM_indexxmin,PDL_PPSYM_PARAM_indexxmin,PDL_TYPE_PARAM_indexxmax,PDL_PPSYM_PARAM_indexxmax,PDL_TYPE_PARAM_indexymin,PDL_PPSYM_PARAM_indexymin,PDL_TYPE_PARAM_indexymax,PDL_PPSYM_PARAM_indexymax) \
122             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, x, (__privtrans->pdls[0]), 1, PDL_PPSYM_OP) \
123             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, y, (__privtrans->pdls[1]), 1, PDL_PPSYM_OP) \
124             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, z, (__privtrans->pdls[2]), 1, PDL_PPSYM_OP) \
125             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_opt, opt, (__privtrans->pdls[3]), 1, PDL_PPSYM_PARAM_opt) \
126             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, clevel, (__privtrans->pdls[4]), 1, PDL_PPSYM_OP) \
127             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_indexxmin, indexxmin, (__privtrans->pdls[5]), 1, PDL_PPSYM_PARAM_indexxmin) \
128             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_indexxmax, indexxmax, (__privtrans->pdls[6]), 1, PDL_PPSYM_PARAM_indexxmax) \
129             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_indexymin, indexymin, (__privtrans->pdls[7]), 1, PDL_PPSYM_PARAM_indexymin) \
130             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_indexymax, indexymax, (__privtrans->pdls[8]), 1, PDL_PPSYM_PARAM_indexymax)
131             #endif
132             #define PDL_IF_BAD(t,f) f
133 2 50         switch (__privtrans->__datatype) { /* Start generic switch */
134 2           case PDL_D: {
135 2 50         PDL_DECLARE_PARAMS_plsurf3dl_1(PDL_Double,D,PDL_Long,L,PDL_Long,L,PDL_Long,L,PDL_Long,L,PDL_Long,L)
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
136 8 50         PDL_BROADCASTLOOP_START_plsurf3dl_readdata {
    50          
    50          
    50          
    50          
    100          
    100          
137             int i, j, size_x, size_y;
138             PLFLT** zz;
139 2           size_x = __privtrans->ind_sizes[1];
140 2           size_y = __privtrans->ind_sizes[2];
141 2           plAlloc2dGrid (&zz, size_x, size_y);
142 72 100         for (i = 0; i < size_x; i++)
143 3220 100         for (j = 0; j < size_y; j++)
144 3150           zz[i][j] = (z_datap)[0+(__inc_z_nx*(i))+(__inc_z_ny*(j))];
145 2           c_plsurf3dl(
146             x_datap, y_datap, (const PLFLT **) zz, size_x, size_y, (opt_datap)[0],
147 2           clevel_datap, __privtrans->ind_sizes[0],
148             (indexxmin_datap)[0], (indexxmax_datap)[0], indexymin_datap, indexymax_datap
149             );
150 4 50         plFree2dGrid (zz, size_x, size_y);}PDL_BROADCASTLOOP_END_plsurf3dl_readdata
    50          
151 2           } break;
152 0           default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in plsurf3dl: unhandled datatype(%d), only handles (D)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype);
153             }
154             #undef PDL_IF_BAD
155 2           return PDL_err;
156             }
157              
158             static pdl_datatypes pdl_plsurf3dl_vtable_gentypes[] = { PDL_D, -1 };
159             static PDL_Indx pdl_plsurf3dl_vtable_realdims[] = { 1, 1, 2, 0, 1, 0, 0, 1, 1 };
160             static char *pdl_plsurf3dl_vtable_parnames[] = { "x","y","z","opt","clevel","indexxmin","indexxmax","indexymin","indexymax" };
161             static short pdl_plsurf3dl_vtable_parflags[] = {
162             PDL_PARAM_ISPHYS,
163             PDL_PARAM_ISPHYS,
164             0,
165             PDL_PARAM_ISTYPED,
166             PDL_PARAM_ISPHYS,
167             PDL_PARAM_ISTYPED,
168             PDL_PARAM_ISTYPED,
169             PDL_PARAM_ISPHYS|PDL_PARAM_ISTYPED,
170             PDL_PARAM_ISPHYS|PDL_PARAM_ISTYPED
171             };
172             static pdl_datatypes pdl_plsurf3dl_vtable_partypes[] = { -1, -1, -1, PDL_L, -1, PDL_L, PDL_L, PDL_L, PDL_L };
173             static PDL_Indx pdl_plsurf3dl_vtable_realdims_starts[] = { 0, 1, 2, 4, 4, 5, 5, 5, 6 };
174             static PDL_Indx pdl_plsurf3dl_vtable_realdims_ind_ids[] = { 1, 2, 1, 2, 0, 1, 1 };
175             static char *pdl_plsurf3dl_vtable_indnames[] = { "nlevel","nx","ny" };
176             pdl_transvtable pdl_plsurf3dl_vtable = {
177             PDL_TRANS_DO_BROADCAST|PDL_TRANS_NO_PARALLEL, 0, pdl_plsurf3dl_vtable_gentypes, 9, 9, NULL /*CORE21*/,
178             pdl_plsurf3dl_vtable_realdims, pdl_plsurf3dl_vtable_parnames,
179             pdl_plsurf3dl_vtable_parflags, pdl_plsurf3dl_vtable_partypes,
180             pdl_plsurf3dl_vtable_realdims_starts, pdl_plsurf3dl_vtable_realdims_ind_ids, 7,
181             3, pdl_plsurf3dl_vtable_indnames,
182             NULL, pdl_plsurf3dl_readdata, NULL,
183             NULL,
184             0,"PDL::Graphics::PLplot::plsurf3dl"
185             };
186              
187              
188 2           pdl_error pdl_run_plsurf3dl(pdl *x,pdl *y,pdl *z,pdl *opt,pdl *clevel,pdl *indexxmin,pdl *indexxmax,pdl *indexymin,pdl *indexymax) {
189 2           pdl_error PDL_err = {0, NULL, 0};
190 2 50         if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0};
191 2           pdl_trans *__privtrans = PDL->create_trans(&pdl_plsurf3dl_vtable);
192 2 50         if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans");
193 2           __privtrans->pdls[0] = x;
194 2           __privtrans->pdls[1] = y;
195 2           __privtrans->pdls[2] = z;
196 2           __privtrans->pdls[3] = opt;
197 2           __privtrans->pdls[4] = clevel;
198 2           __privtrans->pdls[5] = indexxmin;
199 2           __privtrans->pdls[6] = indexxmax;
200 2           __privtrans->pdls[7] = indexymin;
201 2           __privtrans->pdls[8] = indexymax;
202 2 50         PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans));
203 2 50         PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans));
204 2           return PDL_err;
205             }