| 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 1877 "lib/PDL/PP.pm" |
| 24 |
|
| typedef struct pdl_params_attract { |
| 25 |
|
| #line 26 "lib/PDL/ImageND-pp-attract.c" |
| 26 |
|
| double m; |
| 27 |
|
| double ms; |
| 28 |
|
| } pdl_params_attract; |
| 29 |
|
| |
| 30 |
|
| |
| 31 |
|
| #line 1888 "lib/PDL/PP.pm" |
| 32 |
|
| pdl_error pdl_attract_readdata(pdl_trans *__privtrans) { |
| 33 |
|
| pdl_error PDL_err = {0, NULL, 0}; |
| 34 |
|
| #line 35 "lib/PDL/ImageND-pp-attract.c" |
| 35 |
1 |
| pdl_params_attract *__params = __privtrans->params; (void)__params; |
| 36 |
1 |
| register PDL_Indx __nc_size = __privtrans->ind_sizes[0]; |
| 37 |
1 |
| register PDL_Indx __nl_size = __privtrans->ind_sizes[1]; |
| 38 |
1 |
| register PDL_Indx __np_size = __privtrans->ind_sizes[2]; |
| 39 |
1 |
▶ | if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in attract:" "broadcast.incs NULL"); |
Branch: 1 branch
| Branch | True | False | Total |
| if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in attract:" "broadcast.incs NULL"); |
0 |
1 |
1 |
|
| 40 |
|
| /* broadcastloop declarations */ |
| 41 |
|
| int __brcloopval; |
| 42 |
|
| register PDL_Indx __tind0,__tind1; /* counters along dim */ |
| 43 |
1 |
| register PDL_Indx __tnpdls = __privtrans->broadcast.npdls; |
| 44 |
|
| /* dims here are how many steps along those dims */ |
| 45 |
1 |
| register PDL_Indx __tinc0_coords = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,0); |
| 46 |
1 |
| register PDL_Indx __tinc0_from = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,0); |
| 47 |
1 |
| register PDL_Indx __tinc0_to = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,0); |
| 48 |
1 |
| register PDL_Indx __tinc0_strength = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,0); |
| 49 |
1 |
| register PDL_Indx __tinc0_vecs = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,0); |
| 50 |
1 |
| register PDL_Indx __tinc1_coords = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,1); |
| 51 |
1 |
| register PDL_Indx __tinc1_from = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,1); |
| 52 |
1 |
| register PDL_Indx __tinc1_to = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,1); |
| 53 |
1 |
| register PDL_Indx __tinc1_strength = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,1); |
| 54 |
1 |
| register PDL_Indx __tinc1_vecs = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,1); |
| 55 |
|
| #define PDL_BROADCASTLOOP_START_attract_readdata PDL_BROADCASTLOOP_START( \ |
| 56 |
|
| readdata, \ |
| 57 |
|
| __privtrans->broadcast, \ |
| 58 |
|
| __privtrans->vtable, \ |
| 59 |
|
| coords_datap += __offsp[0]; \ |
| 60 |
|
| from_datap += __offsp[1]; \ |
| 61 |
|
| to_datap += __offsp[2]; \ |
| 62 |
|
| strength_datap += __offsp[3]; \ |
| 63 |
|
| vecs_datap += __offsp[4]; \ |
| 64 |
|
| , \ |
| 65 |
|
| ( ,coords_datap += __tinc1_coords - __tinc0_coords * __tdims0 \ |
| 66 |
|
| ,from_datap += __tinc1_from - __tinc0_from * __tdims0 \ |
| 67 |
|
| ,to_datap += __tinc1_to - __tinc0_to * __tdims0 \ |
| 68 |
|
| ,strength_datap += __tinc1_strength - __tinc0_strength * __tdims0 \ |
| 69 |
|
| ,vecs_datap += __tinc1_vecs - __tinc0_vecs * __tdims0 \ |
| 70 |
|
| ), \ |
| 71 |
|
| ( ,coords_datap += __tinc0_coords \ |
| 72 |
|
| ,from_datap += __tinc0_from \ |
| 73 |
|
| ,to_datap += __tinc0_to \ |
| 74 |
|
| ,strength_datap += __tinc0_strength \ |
| 75 |
|
| ,vecs_datap += __tinc0_vecs \ |
| 76 |
|
| ) \ |
| 77 |
|
| ) |
| 78 |
|
| #define PDL_BROADCASTLOOP_END_attract_readdata PDL_BROADCASTLOOP_END( \ |
| 79 |
|
| __privtrans->broadcast, \ |
| 80 |
|
| coords_datap -= __tinc1_coords * __tdims1 + __offsp[0]; \ |
| 81 |
|
| from_datap -= __tinc1_from * __tdims1 + __offsp[1]; \ |
| 82 |
|
| to_datap -= __tinc1_to * __tdims1 + __offsp[2]; \ |
| 83 |
|
| strength_datap -= __tinc1_strength * __tdims1 + __offsp[3]; \ |
| 84 |
|
| vecs_datap -= __tinc1_vecs * __tdims1 + __offsp[4]; \ |
| 85 |
|
| ) |
| 86 |
1 |
| register PDL_Indx __inc_coords_nc = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,0,0)]; (void)__inc_coords_nc;register PDL_Indx __inc_coords_np = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,0,1)]; (void)__inc_coords_np; |
| 87 |
1 |
| register PDL_Indx __inc_from_nl = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,1,0)]; (void)__inc_from_nl; |
| 88 |
1 |
| register PDL_Indx __inc_strength_nl = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,3,0)]; (void)__inc_strength_nl; |
| 89 |
1 |
| register PDL_Indx __inc_to_nl = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,2,0)]; (void)__inc_to_nl; |
| 90 |
1 |
| register PDL_Indx __inc_vecs_nc = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,4,0)]; (void)__inc_vecs_nc;register PDL_Indx __inc_vecs_np = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,4,1)]; (void)__inc_vecs_np; |
| 91 |
|
| #ifndef PDL_DECLARE_PARAMS_attract_1 |
| 92 |
|
| #define PDL_DECLARE_PARAMS_attract_1(PDL_TYPE_OP,PDL_PPSYM_OP,PDL_TYPE_PARAM_from,PDL_PPSYM_PARAM_from,PDL_TYPE_PARAM_to,PDL_PPSYM_PARAM_to) \ |
| 93 |
|
| PDL_DECLARE_PARAMETER(PDL_TYPE_OP, coords, (__privtrans->pdls[0]), 1, PDL_PPSYM_OP) \ |
| 94 |
|
| PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_from, from, (__privtrans->pdls[1]), 1, PDL_PPSYM_PARAM_from) \ |
| 95 |
|
| PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_to, to, (__privtrans->pdls[2]), 1, PDL_PPSYM_PARAM_to) \ |
| 96 |
|
| PDL_DECLARE_PARAMETER(PDL_TYPE_OP, strength, (__privtrans->pdls[3]), 1, PDL_PPSYM_OP) \ |
| 97 |
|
| PDL_DECLARE_PARAMETER(PDL_TYPE_OP, vecs, (__privtrans->pdls[4]), 1, PDL_PPSYM_OP) |
| 98 |
|
| #endif |
| 99 |
|
| #define PDL_IF_BAD(t,f) f |
| 100 |
1 |
| switch (__privtrans->__datatype) { /* Start generic switch */ |
| 101 |
1 |
| case PDL_F: { |
| 102 |
1 |
▶ | PDL_DECLARE_PARAMS_attract_1(PDL_Float,F,PDL_Long,L,PDL_Long,L) |
Branch: 15 branches
| Branch | True | False | Total |
| PDL_DECLARE_PARAMS_attract_1(PDL_Float,F,PDL_Long,L,PDL_Long,L) |
0 |
1 |
1 |
| PDL_DECLARE_PARAMS_attract_1(PDL_Float,F,PDL_Long,L,PDL_Long,L) |
1 |
0 |
1 |
| PDL_DECLARE_PARAMS_attract_1(PDL_Float,F,PDL_Long,L,PDL_Long,L) |
0 |
1 |
1 |
| PDL_DECLARE_PARAMS_attract_1(PDL_Float,F,PDL_Long,L,PDL_Long,L) |
0 |
1 |
1 |
| PDL_DECLARE_PARAMS_attract_1(PDL_Float,F,PDL_Long,L,PDL_Long,L) |
1 |
0 |
1 |
| PDL_DECLARE_PARAMS_attract_1(PDL_Float,F,PDL_Long,L,PDL_Long,L) |
0 |
1 |
1 |
| PDL_DECLARE_PARAMS_attract_1(PDL_Float,F,PDL_Long,L,PDL_Long,L) |
0 |
1 |
1 |
| PDL_DECLARE_PARAMS_attract_1(PDL_Float,F,PDL_Long,L,PDL_Long,L) |
1 |
0 |
1 |
| PDL_DECLARE_PARAMS_attract_1(PDL_Float,F,PDL_Long,L,PDL_Long,L) |
0 |
1 |
1 |
| PDL_DECLARE_PARAMS_attract_1(PDL_Float,F,PDL_Long,L,PDL_Long,L) |
0 |
1 |
1 |
| PDL_DECLARE_PARAMS_attract_1(PDL_Float,F,PDL_Long,L,PDL_Long,L) |
1 |
0 |
1 |
| PDL_DECLARE_PARAMS_attract_1(PDL_Float,F,PDL_Long,L,PDL_Long,L) |
0 |
1 |
1 |
| PDL_DECLARE_PARAMS_attract_1(PDL_Float,F,PDL_Long,L,PDL_Long,L) |
0 |
1 |
1 |
| PDL_DECLARE_PARAMS_attract_1(PDL_Float,F,PDL_Long,L,PDL_Long,L) |
1 |
0 |
1 |
| PDL_DECLARE_PARAMS_attract_1(PDL_Float,F,PDL_Long,L,PDL_Long,L) |
0 |
1 |
1 |
|
| 103 |
4 |
▶ | PDL_BROADCASTLOOP_START_attract_readdata {double m = __params->m; |
Branch: 7 branches
| Branch | True | False | Total |
| PDL_BROADCASTLOOP_START_attract_readdata {double m = __params->m; |
0 |
1 |
1 |
| PDL_BROADCASTLOOP_START_attract_readdata {double m = __params->m; |
0 |
1 |
1 |
| PDL_BROADCASTLOOP_START_attract_readdata {double m = __params->m; |
0 |
1 |
1 |
| PDL_BROADCASTLOOP_START_attract_readdata {double m = __params->m; |
0 |
1 |
1 |
| PDL_BROADCASTLOOP_START_attract_readdata {double m = __params->m; |
0 |
1 |
1 |
| PDL_BROADCASTLOOP_START_attract_readdata {double m = __params->m; |
1 |
1 |
2 |
| PDL_BROADCASTLOOP_START_attract_readdata {double m = __params->m; |
1 |
1 |
2 |
|
| 104 |
1 |
| double ms = __params->ms; |
| 105 |
22 |
▶ | {/* Open nc */ PDL_EXPAND2(register PDL_Indx nc=0, __nc_stop=(__nc_size)); for(; nc<__nc_stop; nc+=1) {{/* Open np */ PDL_EXPAND2(register PDL_Indx np=0, __np_stop=(__np_size)); for(; np<__np_stop; np+=1) { (vecs_datap)[0+(__inc_vecs_nc*(nc))+(__inc_vecs_np*(np))] = 0; }} /* Close nc */}} /* Close np */ |
Branch: 2 branches
| Branch | True | False | Total |
| {/* Open nc */ PDL_EXPAND2(register PDL_Indx nc=0, __nc_stop=(__nc_size)); for(; nc<__nc_stop; nc+=1) {{/* Open np */ PDL_EXPAND2(register PDL_Indx np=0, __np_stop=(__np_size)); for(; np<__np_stop; np+=1) { (vecs_datap)[0+(__inc_vecs_nc*(nc))+(__inc_vecs_np*(np))] = 0; }} /* Close nc */}} /* Close np */ |
18 |
3 |
21 |
| {/* Open nc */ PDL_EXPAND2(register PDL_Indx nc=0, __nc_stop=(__nc_size)); for(; nc<__nc_stop; nc+=1) {{/* Open np */ PDL_EXPAND2(register PDL_Indx np=0, __np_stop=(__np_size)); for(; np<__np_stop; np+=1) { (vecs_datap)[0+(__inc_vecs_nc*(nc))+(__inc_vecs_np*(np))] = 0; }} /* Close nc */}} /* Close np */ |
3 |
1 |
4 |
|
| 106 |
11 |
▶ | {/* Open nl */ PDL_EXPAND2(register PDL_Indx nl=0, __nl_stop=(__nl_size)); for(; nl<__nl_stop; nl+=1) { |
Branch: 1 branch
| Branch | True | False | Total |
| {/* Open nl */ PDL_EXPAND2(register PDL_Indx nl=0, __nl_stop=(__nl_size)); for(; nl<__nl_stop; nl+=1) { |
10 |
1 |
11 |
|
| 107 |
10 |
| int f = (from_datap)[0+(__inc_from_nl*(nl))]; |
| 108 |
10 |
| int t = (to_datap)[0+(__inc_to_nl*(nl))]; |
| 109 |
10 |
| double s = (strength_datap)[0+(__inc_strength_nl*(nl))]; |
| 110 |
10 |
| double dist = 0; |
| 111 |
|
| double tmp; |
| 112 |
40 |
▶ | {/* Open nc */ PDL_EXPAND2(register PDL_Indx nc=0, __nc_stop=(__nc_size)); for(; nc<__nc_stop; nc+=1) { |
Branch: 1 branch
| Branch | True | False | Total |
| {/* Open nc */ PDL_EXPAND2(register PDL_Indx nc=0, __nc_stop=(__nc_size)); for(; nc<__nc_stop; nc+=1) { |
30 |
10 |
40 |
|
| 113 |
30 |
| tmp = (coords_datap)[0+(__inc_coords_nc*(nc))+(__inc_coords_np*(f))] - (coords_datap)[0+(__inc_coords_nc*(nc))+(__inc_coords_np*(t))]; |
| 114 |
30 |
| dist += tmp * tmp; |
| 115 |
|
| }} /* Close nc */ |
| 116 |
10 |
| s *= ms * dist + m * sqrt(dist); |
| 117 |
40 |
▶ | {/* Open nc */ PDL_EXPAND2(register PDL_Indx nc=0, __nc_stop=(__nc_size)); for(; nc<__nc_stop; nc+=1) { |
Branch: 1 branch
| Branch | True | False | Total |
| {/* Open nc */ PDL_EXPAND2(register PDL_Indx nc=0, __nc_stop=(__nc_size)); for(; nc<__nc_stop; nc+=1) { |
30 |
10 |
40 |
|
| 118 |
30 |
| tmp = (coords_datap)[0+(__inc_coords_nc*(nc))+(__inc_coords_np*(f))] - (coords_datap)[0+(__inc_coords_nc*(nc))+(__inc_coords_np*(t))]; |
| 119 |
30 |
| (vecs_datap)[0+(__inc_vecs_nc*(nc))+(__inc_vecs_np*(f))] -= tmp * s; |
| 120 |
30 |
| (vecs_datap)[0+(__inc_vecs_nc*(nc))+(__inc_vecs_np*(t))] += tmp * s; |
| 121 |
|
| }} /* Close nc */ |
| 122 |
|
| }} /* Close nl */ |
| 123 |
1 |
▶ | }PDL_BROADCASTLOOP_END_attract_readdata |
Branch: 2 branches
| Branch | True | False | Total |
| }PDL_BROADCASTLOOP_END_attract_readdata |
0 |
1 |
1 |
| }PDL_BROADCASTLOOP_END_attract_readdata |
0 |
1 |
1 |
|
| 124 |
1 |
| } break; |
| 125 |
0 |
| case PDL_D: { |
| 126 |
0 |
▶ | PDL_DECLARE_PARAMS_attract_1(PDL_Double,D,PDL_Long,L,PDL_Long,L) |
Branch: 15 branches
| Branch | True | False | Total |
| PDL_DECLARE_PARAMS_attract_1(PDL_Double,D,PDL_Long,L,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_attract_1(PDL_Double,D,PDL_Long,L,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_attract_1(PDL_Double,D,PDL_Long,L,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_attract_1(PDL_Double,D,PDL_Long,L,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_attract_1(PDL_Double,D,PDL_Long,L,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_attract_1(PDL_Double,D,PDL_Long,L,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_attract_1(PDL_Double,D,PDL_Long,L,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_attract_1(PDL_Double,D,PDL_Long,L,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_attract_1(PDL_Double,D,PDL_Long,L,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_attract_1(PDL_Double,D,PDL_Long,L,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_attract_1(PDL_Double,D,PDL_Long,L,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_attract_1(PDL_Double,D,PDL_Long,L,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_attract_1(PDL_Double,D,PDL_Long,L,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_attract_1(PDL_Double,D,PDL_Long,L,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_attract_1(PDL_Double,D,PDL_Long,L,PDL_Long,L) |
0 |
0 |
0 |
|
| 127 |
0 |
▶ | PDL_BROADCASTLOOP_START_attract_readdata {double m = __params->m; |
Branch: 7 branches
| Branch | True | False | Total |
| PDL_BROADCASTLOOP_START_attract_readdata {double m = __params->m; |
0 |
0 |
0 |
| PDL_BROADCASTLOOP_START_attract_readdata {double m = __params->m; |
0 |
0 |
0 |
| PDL_BROADCASTLOOP_START_attract_readdata {double m = __params->m; |
0 |
0 |
0 |
| PDL_BROADCASTLOOP_START_attract_readdata {double m = __params->m; |
0 |
0 |
0 |
| PDL_BROADCASTLOOP_START_attract_readdata {double m = __params->m; |
0 |
0 |
0 |
| PDL_BROADCASTLOOP_START_attract_readdata {double m = __params->m; |
0 |
0 |
0 |
| PDL_BROADCASTLOOP_START_attract_readdata {double m = __params->m; |
0 |
0 |
0 |
|
| 128 |
0 |
| double ms = __params->ms; |
| 129 |
0 |
▶ | {/* Open nc */ PDL_EXPAND2(register PDL_Indx nc=0, __nc_stop=(__nc_size)); for(; nc<__nc_stop; nc+=1) {{/* Open np */ PDL_EXPAND2(register PDL_Indx np=0, __np_stop=(__np_size)); for(; np<__np_stop; np+=1) { (vecs_datap)[0+(__inc_vecs_nc*(nc))+(__inc_vecs_np*(np))] = 0; }} /* Close nc */}} /* Close np */ |
Branch: 2 branches
| Branch | True | False | Total |
| {/* Open nc */ PDL_EXPAND2(register PDL_Indx nc=0, __nc_stop=(__nc_size)); for(; nc<__nc_stop; nc+=1) {{/* Open np */ PDL_EXPAND2(register PDL_Indx np=0, __np_stop=(__np_size)); for(; np<__np_stop; np+=1) { (vecs_datap)[0+(__inc_vecs_nc*(nc))+(__inc_vecs_np*(np))] = 0; }} /* Close nc */}} /* Close np */ |
0 |
0 |
0 |
| {/* Open nc */ PDL_EXPAND2(register PDL_Indx nc=0, __nc_stop=(__nc_size)); for(; nc<__nc_stop; nc+=1) {{/* Open np */ PDL_EXPAND2(register PDL_Indx np=0, __np_stop=(__np_size)); for(; np<__np_stop; np+=1) { (vecs_datap)[0+(__inc_vecs_nc*(nc))+(__inc_vecs_np*(np))] = 0; }} /* Close nc */}} /* Close np */ |
0 |
0 |
0 |
|
| 130 |
0 |
▶ | {/* Open nl */ PDL_EXPAND2(register PDL_Indx nl=0, __nl_stop=(__nl_size)); for(; nl<__nl_stop; nl+=1) { |
Branch: 1 branch
| Branch | True | False | Total |
| {/* Open nl */ PDL_EXPAND2(register PDL_Indx nl=0, __nl_stop=(__nl_size)); for(; nl<__nl_stop; nl+=1) { |
0 |
0 |
0 |
|
| 131 |
0 |
| int f = (from_datap)[0+(__inc_from_nl*(nl))]; |
| 132 |
0 |
| int t = (to_datap)[0+(__inc_to_nl*(nl))]; |
| 133 |
0 |
| double s = (strength_datap)[0+(__inc_strength_nl*(nl))]; |
| 134 |
0 |
| double dist = 0; |
| 135 |
|
| double tmp; |
| 136 |
0 |
▶ | {/* Open nc */ PDL_EXPAND2(register PDL_Indx nc=0, __nc_stop=(__nc_size)); for(; nc<__nc_stop; nc+=1) { |
Branch: 1 branch
| Branch | True | False | Total |
| {/* Open nc */ PDL_EXPAND2(register PDL_Indx nc=0, __nc_stop=(__nc_size)); for(; nc<__nc_stop; nc+=1) { |
0 |
0 |
0 |
|
| 137 |
0 |
| tmp = (coords_datap)[0+(__inc_coords_nc*(nc))+(__inc_coords_np*(f))] - (coords_datap)[0+(__inc_coords_nc*(nc))+(__inc_coords_np*(t))]; |
| 138 |
0 |
| dist += tmp * tmp; |
| 139 |
|
| }} /* Close nc */ |
| 140 |
0 |
| s *= ms * dist + m * sqrt(dist); |
| 141 |
0 |
▶ | {/* Open nc */ PDL_EXPAND2(register PDL_Indx nc=0, __nc_stop=(__nc_size)); for(; nc<__nc_stop; nc+=1) { |
Branch: 1 branch
| Branch | True | False | Total |
| {/* Open nc */ PDL_EXPAND2(register PDL_Indx nc=0, __nc_stop=(__nc_size)); for(; nc<__nc_stop; nc+=1) { |
0 |
0 |
0 |
|
| 142 |
0 |
| tmp = (coords_datap)[0+(__inc_coords_nc*(nc))+(__inc_coords_np*(f))] - (coords_datap)[0+(__inc_coords_nc*(nc))+(__inc_coords_np*(t))]; |
| 143 |
0 |
| (vecs_datap)[0+(__inc_vecs_nc*(nc))+(__inc_vecs_np*(f))] -= tmp * s; |
| 144 |
0 |
| (vecs_datap)[0+(__inc_vecs_nc*(nc))+(__inc_vecs_np*(t))] += tmp * s; |
| 145 |
|
| }} /* Close nc */ |
| 146 |
|
| }} /* Close nl */ |
| 147 |
0 |
▶ | }PDL_BROADCASTLOOP_END_attract_readdata |
Branch: 2 branches
| Branch | True | False | Total |
| }PDL_BROADCASTLOOP_END_attract_readdata |
0 |
0 |
0 |
| }PDL_BROADCASTLOOP_END_attract_readdata |
0 |
0 |
0 |
|
| 148 |
0 |
| } break; |
| 149 |
0 |
| default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in attract: unhandled datatype(%d), only handles (FD)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype); |
| 150 |
|
| } |
| 151 |
|
| #undef PDL_IF_BAD |
| 152 |
1 |
| return PDL_err; |
| 153 |
|
| } |
| 154 |
|
| |
| 155 |
|
| static pdl_datatypes pdl_attract_vtable_gentypes[] = { PDL_F, PDL_D, -1 }; |
| 156 |
|
| static PDL_Indx pdl_attract_vtable_realdims[] = { 2, 1, 1, 1, 2 }; |
| 157 |
|
| static char *pdl_attract_vtable_parnames[] = { "coords","from","to","strength","vecs" }; |
| 158 |
|
| static short pdl_attract_vtable_parflags[] = { |
| 159 |
|
| 0, |
| 160 |
|
| PDL_PARAM_ISTYPED, |
| 161 |
|
| PDL_PARAM_ISTYPED, |
| 162 |
|
| 0, |
| 163 |
|
| PDL_PARAM_ISCREAT|PDL_PARAM_ISOUT|PDL_PARAM_ISWRITE |
| 164 |
|
| }; |
| 165 |
|
| static pdl_datatypes pdl_attract_vtable_partypes[] = { -1, PDL_L, PDL_L, -1, -1 }; |
| 166 |
|
| static PDL_Indx pdl_attract_vtable_realdims_starts[] = { 0, 2, 3, 4, 5 }; |
| 167 |
|
| static PDL_Indx pdl_attract_vtable_realdims_ind_ids[] = { 0, 2, 1, 1, 1, 0, 2 }; |
| 168 |
|
| static char *pdl_attract_vtable_indnames[] = { "nc","nl","np" }; |
| 169 |
|
| pdl_transvtable pdl_attract_vtable = { |
| 170 |
|
| PDL_TRANS_DO_BROADCAST, 0, pdl_attract_vtable_gentypes, 4, 5, NULL /*CORE21*/, |
| 171 |
|
| pdl_attract_vtable_realdims, pdl_attract_vtable_parnames, |
| 172 |
|
| pdl_attract_vtable_parflags, pdl_attract_vtable_partypes, |
| 173 |
|
| pdl_attract_vtable_realdims_starts, pdl_attract_vtable_realdims_ind_ids, 7, |
| 174 |
|
| 3, pdl_attract_vtable_indnames, |
| 175 |
|
| NULL, pdl_attract_readdata, NULL, |
| 176 |
|
| NULL, |
| 177 |
|
| sizeof(pdl_params_attract),"PDL::ImageND::attract" |
| 178 |
|
| }; |
| 179 |
|
| |
| 180 |
|
| |
| 181 |
1 |
| pdl_error pdl_run_attract(pdl *coords,pdl *from,pdl *to,pdl *strength,pdl *vecs,double m,double ms) { |
| 182 |
1 |
| pdl_error PDL_err = {0, NULL, 0}; |
| 183 |
1 |
▶ | if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0}; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0}; |
0 |
1 |
1 |
|
| 184 |
1 |
| pdl_trans *__privtrans = PDL->create_trans(&pdl_attract_vtable); |
| 185 |
1 |
▶ | if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans"); |
Branch: 1 branch
| Branch | True | False | Total |
| if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans"); |
0 |
1 |
1 |
|
| 186 |
1 |
| pdl_params_attract *__params = __privtrans->params; |
| 187 |
1 |
| __privtrans->pdls[0] = coords; |
| 188 |
1 |
| __privtrans->pdls[1] = from; |
| 189 |
1 |
| __privtrans->pdls[2] = to; |
| 190 |
1 |
| __privtrans->pdls[3] = strength; |
| 191 |
1 |
| __privtrans->pdls[4] = vecs; |
| 192 |
1 |
▶ | PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans)); |
Branch: 1 branch
| Branch | True | False | Total |
| PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans)); |
0 |
1 |
1 |
|
| 193 |
1 |
| (__params->m) = (m); /* CType.get_copy */ |
| 194 |
1 |
| (__params->ms) = (ms); /* CType.get_copy */ |
| 195 |
1 |
▶ | PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans)); |
Branch: 1 branch
| Branch | True | False | Total |
| PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans)); |
0 |
1 |
1 |
|
| 196 |
1 |
| return PDL_err; |
| 197 |
|
| } |