File Coverage

pp-plgriddata.c
Criterion Covered Total %
statement 55 56 98.2
branch 45 82 54.8
condition n/a
subroutine n/a
pod n/a
total 100 138 72.4


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-plgriddata.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             void pltr_iv_set(IV iv0, IV iv1, IV iv2);
40             void pltr_callback_set(SV *sv, char *msg);
41             void pltr_callback(PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, PLPointer pltr_data);
42             void* get_standard_pltrcb(SV* cb);
43             void defined_callback_set(SV *sv, char *msg);
44             PLINT defined_callback(PLFLT x, PLFLT y);
45             void default_magic(pdl *p, size_t pa);
46             void mapform_callback_set(SV *sv, char *msg);
47             void mapform_callback(PLINT n, PLFLT* x, PLFLT* y);
48             void xform_callback_set(SV *sv, char *msg);
49             void xform_callback(PLFLT x, PLFLT y, PLFLT *xt, PLFLT *yt, PLPointer data);
50             void labelfunc_callback_set(SV *sv, char *msg);
51             void labelfunc_callback(PLINT axis, PLFLT value, char *label_text, PLINT length, void *data);
52              
53             #line 1857 "lib/PDL/PP.pm"
54             pdl_error pdl_plgriddata_readdata(pdl_trans *__privtrans) {
55             pdl_error PDL_err = {0, NULL, 0};
56             #line 57 "pp-plgriddata.c"
57 12 50         if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in plgriddata:" "broadcast.incs NULL");
58             /* broadcastloop declarations */
59             int __brcloopval;
60             register PDL_Indx __tind0,__tind1; /* counters along dim */
61 12           register PDL_Indx __tnpdls = __privtrans->broadcast.npdls;
62             /* dims here are how many steps along those dims */
63 12           register PDL_Indx __tinc0_x = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,0);
64 12           register PDL_Indx __tinc0_y = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,0);
65 12           register PDL_Indx __tinc0_z = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,0);
66 12           register PDL_Indx __tinc0_xg = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,0);
67 12           register PDL_Indx __tinc0_yg = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,0);
68 12           register PDL_Indx __tinc0_type = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,5,0);
69 12           register PDL_Indx __tinc0_data = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,6,0);
70 12           register PDL_Indx __tinc0_zg = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,7,0);
71 12           register PDL_Indx __tinc1_x = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,1);
72 12           register PDL_Indx __tinc1_y = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,1);
73 12           register PDL_Indx __tinc1_z = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,1);
74 12           register PDL_Indx __tinc1_xg = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,1);
75 12           register PDL_Indx __tinc1_yg = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,1);
76 12           register PDL_Indx __tinc1_type = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,5,1);
77 12           register PDL_Indx __tinc1_data = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,6,1);
78 12           register PDL_Indx __tinc1_zg = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,7,1);
79             #define PDL_BROADCASTLOOP_START_plgriddata_readdata PDL_BROADCASTLOOP_START( \
80             readdata, \
81             __privtrans->broadcast, \
82             __privtrans->vtable, \
83             x_datap += __offsp[0]; \
84             y_datap += __offsp[1]; \
85             z_datap += __offsp[2]; \
86             xg_datap += __offsp[3]; \
87             yg_datap += __offsp[4]; \
88             type_datap += __offsp[5]; \
89             data_datap += __offsp[6]; \
90             zg_datap += __offsp[7]; \
91             , \
92             ( ,x_datap += __tinc1_x - __tinc0_x * __tdims0 \
93             ,y_datap += __tinc1_y - __tinc0_y * __tdims0 \
94             ,z_datap += __tinc1_z - __tinc0_z * __tdims0 \
95             ,xg_datap += __tinc1_xg - __tinc0_xg * __tdims0 \
96             ,yg_datap += __tinc1_yg - __tinc0_yg * __tdims0 \
97             ,type_datap += __tinc1_type - __tinc0_type * __tdims0 \
98             ,data_datap += __tinc1_data - __tinc0_data * __tdims0 \
99             ,zg_datap += __tinc1_zg - __tinc0_zg * __tdims0 \
100             ), \
101             ( ,x_datap += __tinc0_x \
102             ,y_datap += __tinc0_y \
103             ,z_datap += __tinc0_z \
104             ,xg_datap += __tinc0_xg \
105             ,yg_datap += __tinc0_yg \
106             ,type_datap += __tinc0_type \
107             ,data_datap += __tinc0_data \
108             ,zg_datap += __tinc0_zg \
109             ) \
110             )
111             #define PDL_BROADCASTLOOP_END_plgriddata_readdata PDL_BROADCASTLOOP_END( \
112             __privtrans->broadcast, \
113             x_datap -= __tinc1_x * __tdims1 + __offsp[0]; \
114             y_datap -= __tinc1_y * __tdims1 + __offsp[1]; \
115             z_datap -= __tinc1_z * __tdims1 + __offsp[2]; \
116             xg_datap -= __tinc1_xg * __tdims1 + __offsp[3]; \
117             yg_datap -= __tinc1_yg * __tdims1 + __offsp[4]; \
118             type_datap -= __tinc1_type * __tdims1 + __offsp[5]; \
119             data_datap -= __tinc1_data * __tdims1 + __offsp[6]; \
120             zg_datap -= __tinc1_zg * __tdims1 + __offsp[7]; \
121             )
122 12           register PDL_Indx __inc_x_npts = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,0,0)]; (void)__inc_x_npts;
123 12           register PDL_Indx __inc_xg_nptsx = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,3,0)]; (void)__inc_xg_nptsx;
124 12           register PDL_Indx __inc_y_npts = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,1,0)]; (void)__inc_y_npts;
125 12           register PDL_Indx __inc_yg_nptsy = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,4,0)]; (void)__inc_yg_nptsy;
126 12           register PDL_Indx __inc_z_npts = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,2,0)]; (void)__inc_z_npts;
127 12           register PDL_Indx __inc_zg_nptsx = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,7,0)]; (void)__inc_zg_nptsx;register PDL_Indx __inc_zg_nptsy = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,7,1)]; (void)__inc_zg_nptsy;
128             #ifndef PDL_DECLARE_PARAMS_plgriddata_1
129             #define PDL_DECLARE_PARAMS_plgriddata_1(PDL_TYPE_OP,PDL_PPSYM_OP,PDL_TYPE_PARAM_type,PDL_PPSYM_PARAM_type) \
130             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, x, (__privtrans->pdls[0]), 1, PDL_PPSYM_OP) \
131             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, y, (__privtrans->pdls[1]), 1, PDL_PPSYM_OP) \
132             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, z, (__privtrans->pdls[2]), 1, PDL_PPSYM_OP) \
133             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, xg, (__privtrans->pdls[3]), 1, PDL_PPSYM_OP) \
134             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, yg, (__privtrans->pdls[4]), 1, PDL_PPSYM_OP) \
135             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_type, type, (__privtrans->pdls[5]), 1, PDL_PPSYM_PARAM_type) \
136             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, data, (__privtrans->pdls[6]), 1, PDL_PPSYM_OP) \
137             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, zg, (__privtrans->pdls[7]), 1, PDL_PPSYM_OP)
138             #endif
139             #define PDL_IF_BAD(t,f) f
140 12 50         switch (__privtrans->__datatype) { /* Start generic switch */
141 12           case PDL_D: {
142 12 50         PDL_DECLARE_PARAMS_plgriddata_1(PDL_Double,D,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          
143 48 50         PDL_BROADCASTLOOP_START_plgriddata_readdata {
    50          
    50          
    50          
    50          
    100          
    100          
144             int i, j, size_x, size_y;
145             PLFLT** zg;
146              
147 12           size_x = __privtrans->ind_sizes[1];
148 12           size_y = __privtrans->ind_sizes[2];
149              
150 12           plAlloc2dGrid (&zg, size_x, size_y);
151              
152 12           c_plgriddata (x_datap, y_datap, z_datap, __privtrans->ind_sizes[0],
153             xg_datap, size_x, yg_datap, size_y,
154             zg, (type_datap)[0], (data_datap)[0]);
155              
156 312 100         for (i = 0; i < size_x; i++)
157 6300 100         for (j = 0; j < size_y; j++)
158 6000           (zg_datap)[0+(__inc_zg_nptsx*(i))+(__inc_zg_nptsy*(j))] = zg[i][j];
159              
160 12           plFree2dGrid (zg, size_x, size_y);
161 12 50         }PDL_BROADCASTLOOP_END_plgriddata_readdata
    50          
162 12           } break;
163 0           default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in plgriddata: unhandled datatype(%d), only handles (D)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype);
164             }
165             #undef PDL_IF_BAD
166 12           return PDL_err;
167             }
168              
169             static pdl_datatypes pdl_plgriddata_vtable_gentypes[] = { PDL_D, -1 };
170             static PDL_Indx pdl_plgriddata_vtable_realdims[] = { 1, 1, 1, 1, 1, 0, 0, 2 };
171             static char *pdl_plgriddata_vtable_parnames[] = { "x","y","z","xg","yg","type","data","zg" };
172             static short pdl_plgriddata_vtable_parflags[] = {
173             PDL_PARAM_ISPHYS,
174             PDL_PARAM_ISPHYS,
175             PDL_PARAM_ISPHYS,
176             PDL_PARAM_ISPHYS,
177             PDL_PARAM_ISPHYS,
178             PDL_PARAM_ISTYPED,
179             0,
180             PDL_PARAM_ISCREAT|PDL_PARAM_ISOUT|PDL_PARAM_ISWRITE
181             };
182             static pdl_datatypes pdl_plgriddata_vtable_partypes[] = { -1, -1, -1, -1, -1, PDL_L, -1, -1 };
183             static PDL_Indx pdl_plgriddata_vtable_realdims_starts[] = { 0, 1, 2, 3, 4, 5, 5, 5 };
184             static PDL_Indx pdl_plgriddata_vtable_realdims_ind_ids[] = { 0, 0, 0, 1, 2, 1, 2 };
185             static char *pdl_plgriddata_vtable_indnames[] = { "npts","nptsx","nptsy" };
186             pdl_transvtable pdl_plgriddata_vtable = {
187             PDL_TRANS_DO_BROADCAST|PDL_TRANS_NO_PARALLEL, 0, pdl_plgriddata_vtable_gentypes, 7, 8, NULL /*CORE21*/,
188             pdl_plgriddata_vtable_realdims, pdl_plgriddata_vtable_parnames,
189             pdl_plgriddata_vtable_parflags, pdl_plgriddata_vtable_partypes,
190             pdl_plgriddata_vtable_realdims_starts, pdl_plgriddata_vtable_realdims_ind_ids, 7,
191             3, pdl_plgriddata_vtable_indnames,
192             NULL, pdl_plgriddata_readdata, NULL,
193             NULL,
194             0,"PDL::Graphics::PLplot::plgriddata"
195             };
196              
197              
198 12           pdl_error pdl_run_plgriddata(pdl *x,pdl *y,pdl *z,pdl *xg,pdl *yg,pdl *type,pdl *data,pdl *zg) {
199 12           pdl_error PDL_err = {0, NULL, 0};
200 12 50         if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0};
201 12           pdl_trans *__privtrans = PDL->create_trans(&pdl_plgriddata_vtable);
202 12 50         if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans");
203 12           __privtrans->pdls[0] = x;
204 12           __privtrans->pdls[1] = y;
205 12           __privtrans->pdls[2] = z;
206 12           __privtrans->pdls[3] = xg;
207 12           __privtrans->pdls[4] = yg;
208 12           __privtrans->pdls[5] = type;
209 12           __privtrans->pdls[6] = data;
210 12           __privtrans->pdls[7] = zg;
211 12 50         PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans));
212 12 50         PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans));
213 12           return PDL_err;
214             }