File Coverage

lib/PDL/ImageND-pp-combcoords.c
Criterion Covered Total %
statement 36 45 80.0
branch 29 96 30.2
condition n/a
subroutine n/a
pod n/a
total 65 141 46.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 lib/PDL/ImageND.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_ImageND
21             extern Core* PDL; /* Structure hold core C functions */
22              
23             #line 1857 "lib/PDL/PP.pm"
24             pdl_error pdl_combcoords_redodims(pdl_trans *__privtrans) {
25             pdl_error PDL_err = {0, NULL, 0};
26             #line 27 "lib/PDL/ImageND-pp-combcoords.c"
27 1           __privtrans->ind_sizes[0] = 3;
28 1 50         PDL_RETERROR(PDL_err, PDL->redodims_default(__privtrans));
29 1           return PDL_err;
30             }
31              
32              
33             #line 1857 "lib/PDL/PP.pm"
34             pdl_error pdl_combcoords_readdata(pdl_trans *__privtrans) {
35             pdl_error PDL_err = {0, NULL, 0};
36             #line 37 "lib/PDL/ImageND-pp-combcoords.c"
37 2 50         if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in combcoords:" "broadcast.incs NULL");
38             /* broadcastloop declarations */
39             int __brcloopval;
40             register PDL_Indx __tind0,__tind1; /* counters along dim */
41 2           register PDL_Indx __tnpdls = __privtrans->broadcast.npdls;
42             /* dims here are how many steps along those dims */
43 2           register PDL_Indx __tinc0_x = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,0);
44 2           register PDL_Indx __tinc0_y = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,0);
45 2           register PDL_Indx __tinc0_z = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,0);
46 2           register PDL_Indx __tinc0_coords = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,0);
47 2           register PDL_Indx __tinc1_x = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,1);
48 2           register PDL_Indx __tinc1_y = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,1);
49 2           register PDL_Indx __tinc1_z = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,1);
50 2           register PDL_Indx __tinc1_coords = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,1);
51             #define PDL_BROADCASTLOOP_START_combcoords_readdata PDL_BROADCASTLOOP_START( \
52             readdata, \
53             __privtrans->broadcast, \
54             __privtrans->vtable, \
55             x_datap += __offsp[0]; \
56             y_datap += __offsp[1]; \
57             z_datap += __offsp[2]; \
58             coords_datap += __offsp[3]; \
59             , \
60             ( ,x_datap += __tinc1_x - __tinc0_x * __tdims0 \
61             ,y_datap += __tinc1_y - __tinc0_y * __tdims0 \
62             ,z_datap += __tinc1_z - __tinc0_z * __tdims0 \
63             ,coords_datap += __tinc1_coords - __tinc0_coords * __tdims0 \
64             ), \
65             ( ,x_datap += __tinc0_x \
66             ,y_datap += __tinc0_y \
67             ,z_datap += __tinc0_z \
68             ,coords_datap += __tinc0_coords \
69             ) \
70             )
71             #define PDL_BROADCASTLOOP_END_combcoords_readdata PDL_BROADCASTLOOP_END( \
72             __privtrans->broadcast, \
73             x_datap -= __tinc1_x * __tdims1 + __offsp[0]; \
74             y_datap -= __tinc1_y * __tdims1 + __offsp[1]; \
75             z_datap -= __tinc1_z * __tdims1 + __offsp[2]; \
76             coords_datap -= __tinc1_coords * __tdims1 + __offsp[3]; \
77             )
78 2           register PDL_Indx __inc_coords_tri = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,3,0)]; (void)__inc_coords_tri;
79             #ifndef PDL_DECLARE_PARAMS_combcoords_1
80             #define PDL_DECLARE_PARAMS_combcoords_1(PDL_TYPE_OP,PDL_PPSYM_OP,PDL_TYPE_PARAM_coords,PDL_PPSYM_PARAM_coords) \
81             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, x, (__privtrans->pdls[0]), 1, PDL_PPSYM_OP) \
82             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, y, (__privtrans->pdls[1]), 1, PDL_PPSYM_OP) \
83             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, z, (__privtrans->pdls[2]), 1, PDL_PPSYM_OP) \
84             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_coords, coords, (__privtrans->pdls[3]), 1, PDL_PPSYM_PARAM_coords)
85             #endif
86             #define PDL_IF_BAD(t,f) f
87 2           switch (__privtrans->__datatype) { /* Start generic switch */
88 2           case PDL_F: {
89 2 50         PDL_DECLARE_PARAMS_combcoords_1(PDL_Float,F,PDL_Float,F)
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
90 8 50         PDL_BROADCASTLOOP_START_combcoords_readdata {
    50          
    50          
    50          
    50          
    100          
    100          
91 2           (coords_datap)[0+(__inc_coords_tri*(0))] = (x_datap)[0];
92 2           (coords_datap)[0+(__inc_coords_tri*(1))] = (y_datap)[0];
93 2           (coords_datap)[0+(__inc_coords_tri*(2))] = (z_datap)[0];
94 2 50         }PDL_BROADCASTLOOP_END_combcoords_readdata
    50          
95 2           } break;
96 0           case PDL_D: {
97 0 0         PDL_DECLARE_PARAMS_combcoords_1(PDL_Double,D,PDL_Float,F)
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
98 0 0         PDL_BROADCASTLOOP_START_combcoords_readdata {
    0          
    0          
    0          
    0          
    0          
    0          
99 0           (coords_datap)[0+(__inc_coords_tri*(0))] = (x_datap)[0];
100 0           (coords_datap)[0+(__inc_coords_tri*(1))] = (y_datap)[0];
101 0           (coords_datap)[0+(__inc_coords_tri*(2))] = (z_datap)[0];
102 0 0         }PDL_BROADCASTLOOP_END_combcoords_readdata
    0          
103 0           } break;
104 0           default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in combcoords: unhandled datatype(%d), only handles (FD)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype);
105             }
106             #undef PDL_IF_BAD
107 2           return PDL_err;
108             }
109              
110             static pdl_datatypes pdl_combcoords_vtable_gentypes[] = { PDL_F, PDL_D, -1 };
111             static PDL_Indx pdl_combcoords_vtable_realdims[] = { 0, 0, 0, 1 };
112             static char *pdl_combcoords_vtable_parnames[] = { "x","y","z","coords" };
113             static short pdl_combcoords_vtable_parflags[] = {
114             0,
115             0,
116             0,
117             PDL_PARAM_ISCREAT|PDL_PARAM_ISOUT|PDL_PARAM_ISTYPED|PDL_PARAM_ISWRITE
118             };
119             static pdl_datatypes pdl_combcoords_vtable_partypes[] = { -1, -1, -1, PDL_F };
120             static PDL_Indx pdl_combcoords_vtable_realdims_starts[] = { 0, 0, 0, 0 };
121             static PDL_Indx pdl_combcoords_vtable_realdims_ind_ids[] = { 0 };
122             static char *pdl_combcoords_vtable_indnames[] = { "tri" };
123             pdl_transvtable pdl_combcoords_vtable = {
124             PDL_TRANS_DO_BROADCAST, PDL_ITRANS_DO_DATAFLOW_ANY, pdl_combcoords_vtable_gentypes, 3, 4, NULL /*CORE21*/,
125             pdl_combcoords_vtable_realdims, pdl_combcoords_vtable_parnames,
126             pdl_combcoords_vtable_parflags, pdl_combcoords_vtable_partypes,
127             pdl_combcoords_vtable_realdims_starts, pdl_combcoords_vtable_realdims_ind_ids, 1,
128             1, pdl_combcoords_vtable_indnames,
129             pdl_combcoords_redodims, pdl_combcoords_readdata, NULL,
130             NULL,
131             0,"PDL::ImageND::combcoords"
132             };
133              
134              
135 1           pdl_error pdl_run_combcoords(pdl *x,pdl *y,pdl *z,pdl *coords) {
136 1           pdl_error PDL_err = {0, NULL, 0};
137 1 50         if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0};
138 1           pdl_trans *__privtrans = PDL->create_trans(&pdl_combcoords_vtable);
139 1 50         if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans");
140 1           __privtrans->pdls[0] = x;
141 1           __privtrans->pdls[1] = y;
142 1           __privtrans->pdls[2] = z;
143 1           __privtrans->pdls[3] = coords;
144 1 50         PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans));
145 1 50         PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans));
146 1           return PDL_err;
147             }