Changeset 380e8c9 in sasmodels for sasmodels/kernel_iq.c
- Timestamp:
- Mar 24, 2016 10:56:44 AM (8 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 151f3bc
- Parents:
- 60eab2a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/kernel_iq.c
r60eab2a r380e8c9 54 54 double *pvec = (double *)(&local_values); // Alias named parameters with a vector 55 55 56 #if MAX_PD > 0 57 if (problem->pd_length[0] == 1) { 58 #endif // MAX_PD > 0 56 // Monodisperse computation 57 if (pd_stop == 1) { 59 58 // Shouldn't need to copy!! 60 59 for (int k=0; k < NPARS; k++) { … … 72 71 } 73 72 return; 73 } 74 74 75 #if MAX_PD > 0 75 } 76 77 // polydispersity loop index positions 78 local int offset[NPARS]; // NPARS excludes scale/background 79 80 printf("Entering polydispersity\n"); 76 77 printf("Entering polydispersity\n"); 81 78 // Since we are no longer looping over the entire polydispersity hypercube 82 79 // for each q, we need to track the normalization values for each q in a … … 107 104 // Location in the polydispersity hypercube, one index per dimension. 108 105 local int pd_index[MAX_PD]; 106 107 // polydispersity loop index positions 108 local int offset[NPARS]; // NPARS excludes scale/background 109 109 110 110 // Trigger the reset behaviour that happens at the end the fast loop … … 132 132 for (int k=1; k < MAX_PD; k++) { 133 133 pd_index[k] = (loop_index%problem->pd_length[k])/problem->pd_stride[k]; 134 const double wi = weights[problem->pd_offset[ 0]+pd_index[0]];134 const double wi = weights[problem->pd_offset[k]+pd_index[k]]; 135 135 partial_weight *= wi; 136 136 if (problem->pd_isvol[k]) partial_volweight *= wi; 137 137 } 138 printf("slow %d: ", loop_index); 138 139 for (int k=0; k < NPARS; k++) { 139 140 int coord = problem->par_coord[k]; … … 149 150 offset[k] = this_offset; 150 151 pvec[k] = values[this_offset]; 151 } 152 printf("p[%d]=v[%d]=%g ", k, offset[k], pvec[k]); 153 } 154 printf("\n"); 152 155 weight = partial_weight * weights[problem->pd_offset[0]+pd_index[0]]; 153 156 if (problem->theta_par >= 0) { … … 157 160 weight *= spherical_correction; 158 161 } 162 pd_index[0] += 1; 159 163 160 164 } else { 161 165 162 166 // INCREMENT INDICES 163 pd_index[0] += 1;164 167 const double wi = weights[problem->pd_offset[0]+pd_index[0]]; 165 168 weight = partial_weight*wi; 166 169 if (problem->pd_isvol[0]) vol_weight *= wi; 170 printf("fast %d: ", loop_index); 167 171 for (int k=0; k < problem->fast_coord_count; k++) { 168 printf("fast loop %d coord %d idx %d ?%d offset %d %g\n", 169 k,problem->fast_coord_pars[k],pd_index[0], 170 problem->fast_coord_pars[k], 171 offset[problem->fast_coord_pars[k]], 172 values[offset[problem->fast_coord_pars[k]]] 173 ); 174 pvec[problem->fast_coord_pars[k]] 175 = values[offset[problem->fast_coord_pars[k]]++]; 176 177 } 178 if (problem->theta_par ==problem->pd_par[0]) { 172 const int pindex = problem->fast_coord_pars[k]; 173 pvec[pindex] = values[++offset[pindex]]; 174 printf("p[%d]=v[%d]=%g ", pindex, offset[pindex], pvec[pindex]); 175 } 176 printf("\n"); 177 if (problem->theta_par == problem->pd_par[0]) { 179 178 weight *= fabs(cos(M_PI_180*pvec[problem->theta_par])); 180 179 } 180 pd_index[0] += 1; 181 181 } 182 182 #ifdef INVALID … … 201 201 } 202 202 203 // Makes anormalization available for the next round203 // Make normalization available for the next round 204 204 result[nq] = norm; 205 205 result[nq+1] = vol; 206 206 result[nq+2] = norm_vol; 207 207 208 // End of the PD loop we can normalize208 // End of the PD loop we can normalize 209 209 if (pd_stop >= problem->pd_stride[MAX_PD-1]) { 210 210 #ifdef USE_OPENMP
Note: See TracChangeset
for help on using the changeset viewer.