| 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-plAllocGrid.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 1846 "lib/PDL/PP.pm" |
|
40
|
|
|
|
|
|
|
typedef struct pdl_params_plAllocGrid { |
|
41
|
|
|
|
|
|
|
#line 42 "pp-plAllocGrid.c" |
|
42
|
|
|
|
|
|
|
PLcGridPtr__OUT *grid; |
|
43
|
|
|
|
|
|
|
} pdl_params_plAllocGrid; |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
#line 1857 "lib/PDL/PP.pm" |
|
47
|
|
|
|
|
|
|
pdl_error pdl_plAllocGrid_readdata(pdl_trans *__privtrans) { |
|
48
|
|
|
|
|
|
|
pdl_error PDL_err = {0, NULL, 0}; |
|
49
|
|
|
|
|
|
|
#line 50 "pp-plAllocGrid.c" |
|
50
|
3
|
|
|
|
|
|
pdl_params_plAllocGrid *__params = __privtrans->params; (void)__params; |
|
51
|
3
|
50
|
|
|
|
|
if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in plAllocGrid:" "broadcast.incs NULL"); |
|
52
|
|
|
|
|
|
|
/* broadcastloop declarations */ |
|
53
|
|
|
|
|
|
|
int __brcloopval; |
|
54
|
|
|
|
|
|
|
register PDL_Indx __tind0,__tind1; /* counters along dim */ |
|
55
|
3
|
|
|
|
|
|
register PDL_Indx __tnpdls = __privtrans->broadcast.npdls; |
|
56
|
|
|
|
|
|
|
/* dims here are how many steps along those dims */ |
|
57
|
3
|
|
|
|
|
|
register PDL_Indx __tinc0_xg = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,0); |
|
58
|
3
|
|
|
|
|
|
register PDL_Indx __tinc0_yg = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,0); |
|
59
|
3
|
|
|
|
|
|
register PDL_Indx __tinc1_xg = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,1); |
|
60
|
3
|
|
|
|
|
|
register PDL_Indx __tinc1_yg = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,1); |
|
61
|
|
|
|
|
|
|
#define PDL_BROADCASTLOOP_START_plAllocGrid_readdata PDL_BROADCASTLOOP_START( \ |
|
62
|
|
|
|
|
|
|
readdata, \ |
|
63
|
|
|
|
|
|
|
__privtrans->broadcast, \ |
|
64
|
|
|
|
|
|
|
__privtrans->vtable, \ |
|
65
|
|
|
|
|
|
|
xg_datap += __offsp[0]; \ |
|
66
|
|
|
|
|
|
|
yg_datap += __offsp[1]; \ |
|
67
|
|
|
|
|
|
|
, \ |
|
68
|
|
|
|
|
|
|
( ,xg_datap += __tinc1_xg - __tinc0_xg * __tdims0 \ |
|
69
|
|
|
|
|
|
|
,yg_datap += __tinc1_yg - __tinc0_yg * __tdims0 \ |
|
70
|
|
|
|
|
|
|
), \ |
|
71
|
|
|
|
|
|
|
( ,xg_datap += __tinc0_xg \ |
|
72
|
|
|
|
|
|
|
,yg_datap += __tinc0_yg \ |
|
73
|
|
|
|
|
|
|
) \ |
|
74
|
|
|
|
|
|
|
) |
|
75
|
|
|
|
|
|
|
#define PDL_BROADCASTLOOP_END_plAllocGrid_readdata PDL_BROADCASTLOOP_END( \ |
|
76
|
|
|
|
|
|
|
__privtrans->broadcast, \ |
|
77
|
|
|
|
|
|
|
xg_datap -= __tinc1_xg * __tdims1 + __offsp[0]; \ |
|
78
|
|
|
|
|
|
|
yg_datap -= __tinc1_yg * __tdims1 + __offsp[1]; \ |
|
79
|
|
|
|
|
|
|
) |
|
80
|
3
|
|
|
|
|
|
register PDL_Indx __inc_xg_nx = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,0,0)]; (void)__inc_xg_nx; |
|
81
|
3
|
|
|
|
|
|
register PDL_Indx __inc_yg_ny = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,1,0)]; (void)__inc_yg_ny; |
|
82
|
|
|
|
|
|
|
#ifndef PDL_DECLARE_PARAMS_plAllocGrid_1 |
|
83
|
|
|
|
|
|
|
#define PDL_DECLARE_PARAMS_plAllocGrid_1(PDL_TYPE_OP,PDL_PPSYM_OP,PDL_TYPE_PARAM_xg,PDL_PPSYM_PARAM_xg,PDL_TYPE_PARAM_yg,PDL_PPSYM_PARAM_yg) \ |
|
84
|
|
|
|
|
|
|
PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_xg, xg, (__privtrans->pdls[0]), 1, PDL_PPSYM_PARAM_xg) \ |
|
85
|
|
|
|
|
|
|
PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_yg, yg, (__privtrans->pdls[1]), 1, PDL_PPSYM_PARAM_yg) |
|
86
|
|
|
|
|
|
|
#endif |
|
87
|
|
|
|
|
|
|
#define PDL_IF_BAD(t,f) f |
|
88
|
3
|
50
|
|
|
|
|
switch (__privtrans->__datatype) { /* Start generic switch */ |
|
89
|
3
|
|
|
|
|
|
case PDL_D: { |
|
90
|
3
|
50
|
|
|
|
|
PDL_DECLARE_PARAMS_plAllocGrid_1(PDL_Double,D,PDL_Double,D,PDL_Double,D) |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
91
|
12
|
50
|
|
|
|
|
PDL_BROADCASTLOOP_START_plAllocGrid_readdata { |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
PLcGrid *grid; |
|
93
|
3
|
|
|
|
|
|
int i, nx = __privtrans->ind_sizes[0], ny = __privtrans->ind_sizes[1]; |
|
94
|
3
|
|
|
|
|
|
Newx(grid, 1, PLcGrid); |
|
95
|
3
|
50
|
|
|
|
|
if(grid == NULL) return PDL->make_error(PDL_EUSERERROR, "Error in plAllocGrid:" "Failed to allocate memory for grid"); |
|
96
|
3
|
|
|
|
|
|
Newxz(grid->xg, nx, PLFLT); |
|
97
|
3
|
50
|
|
|
|
|
if(grid->xg == NULL) return PDL->make_error(PDL_EUSERERROR, "Error in plAllocGrid:" "Failed to allocate memory for grid->xg"); |
|
98
|
3
|
|
|
|
|
|
Newxz(grid->yg, ny, PLFLT); |
|
99
|
3
|
50
|
|
|
|
|
if(grid->yg == NULL) return PDL->make_error(PDL_EUSERERROR, "Error in plAllocGrid:" "Failed to allocate memory for grid->yg"); |
|
100
|
3
|
|
|
|
|
|
grid->nx = nx; |
|
101
|
3
|
|
|
|
|
|
grid->ny = ny; |
|
102
|
108
|
100
|
|
|
|
|
for (i = 0; i < nx; i++) |
|
103
|
105
|
|
|
|
|
|
grid->xg[i] = (xg_datap)[0+(__inc_xg_nx*(i))]; |
|
104
|
141
|
100
|
|
|
|
|
for (i = 0; i < ny; i++) |
|
105
|
138
|
|
|
|
|
|
grid->yg[i] = (yg_datap)[0+(__inc_yg_ny*(i))]; |
|
106
|
6
|
50
|
|
|
|
|
(*(__params->grid)) = (PLcGridPtr__OUT)grid;}PDL_BROADCASTLOOP_END_plAllocGrid_readdata |
|
|
|
50
|
|
|
|
|
|
|
107
|
3
|
|
|
|
|
|
} break; |
|
108
|
0
|
|
|
|
|
|
default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in plAllocGrid: unhandled datatype(%d), only handles (D)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype); |
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
#undef PDL_IF_BAD |
|
111
|
3
|
|
|
|
|
|
return PDL_err; |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
static pdl_datatypes pdl_plAllocGrid_vtable_gentypes[] = { PDL_D, -1 }; |
|
115
|
|
|
|
|
|
|
static PDL_Indx pdl_plAllocGrid_vtable_realdims[] = { 1, 1 }; |
|
116
|
|
|
|
|
|
|
static char *pdl_plAllocGrid_vtable_parnames[] = { "xg","yg" }; |
|
117
|
|
|
|
|
|
|
static short pdl_plAllocGrid_vtable_parflags[] = { |
|
118
|
|
|
|
|
|
|
PDL_PARAM_ISTYPED, |
|
119
|
|
|
|
|
|
|
PDL_PARAM_ISTYPED |
|
120
|
|
|
|
|
|
|
}; |
|
121
|
|
|
|
|
|
|
static pdl_datatypes pdl_plAllocGrid_vtable_partypes[] = { PDL_D, PDL_D }; |
|
122
|
|
|
|
|
|
|
static PDL_Indx pdl_plAllocGrid_vtable_realdims_starts[] = { 0, 1 }; |
|
123
|
|
|
|
|
|
|
static PDL_Indx pdl_plAllocGrid_vtable_realdims_ind_ids[] = { 0, 1 }; |
|
124
|
|
|
|
|
|
|
static char *pdl_plAllocGrid_vtable_indnames[] = { "nx","ny" }; |
|
125
|
|
|
|
|
|
|
pdl_transvtable pdl_plAllocGrid_vtable = { |
|
126
|
|
|
|
|
|
|
PDL_TRANS_DO_BROADCAST|PDL_TRANS_NO_PARALLEL|PDL_TRANS_OUTPUT_OTHERPAR, 0, pdl_plAllocGrid_vtable_gentypes, 2, 2, NULL /*CORE21*/, |
|
127
|
|
|
|
|
|
|
pdl_plAllocGrid_vtable_realdims, pdl_plAllocGrid_vtable_parnames, |
|
128
|
|
|
|
|
|
|
pdl_plAllocGrid_vtable_parflags, pdl_plAllocGrid_vtable_partypes, |
|
129
|
|
|
|
|
|
|
pdl_plAllocGrid_vtable_realdims_starts, pdl_plAllocGrid_vtable_realdims_ind_ids, 2, |
|
130
|
|
|
|
|
|
|
2, pdl_plAllocGrid_vtable_indnames, |
|
131
|
|
|
|
|
|
|
NULL, pdl_plAllocGrid_readdata, NULL, |
|
132
|
|
|
|
|
|
|
NULL, |
|
133
|
|
|
|
|
|
|
sizeof(pdl_params_plAllocGrid),"PDL::Graphics::PLplot::plAllocGrid" |
|
134
|
|
|
|
|
|
|
}; |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
|
137
|
3
|
|
|
|
|
|
pdl_error pdl_run_plAllocGrid(pdl *xg,pdl *yg,PLcGridPtr__OUT *grid) { |
|
138
|
3
|
|
|
|
|
|
pdl_error PDL_err = {0, NULL, 0}; |
|
139
|
3
|
50
|
|
|
|
|
if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0}; |
|
140
|
3
|
|
|
|
|
|
pdl_trans *__privtrans = PDL->create_trans(&pdl_plAllocGrid_vtable); |
|
141
|
3
|
50
|
|
|
|
|
if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans"); |
|
142
|
3
|
|
|
|
|
|
pdl_params_plAllocGrid *__params = __privtrans->params; |
|
143
|
3
|
|
|
|
|
|
__privtrans->pdls[0] = xg; |
|
144
|
3
|
|
|
|
|
|
__privtrans->pdls[1] = yg; |
|
145
|
3
|
50
|
|
|
|
|
PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans)); |
|
146
|
3
|
|
|
|
|
|
(__params->grid) = (grid); /* CType.get_copy */ |
|
147
|
3
|
50
|
|
|
|
|
PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans)); |
|
148
|
3
|
|
|
|
|
|
return PDL_err; |
|
149
|
|
|
|
|
|
|
} |