Changeset 4f1f876 in sasmodels
- Timestamp:
- Jul 28, 2016 6:39:28 PM (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:
- 58210db
- Parents:
- 0f00d95
- Location:
- sasmodels
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/details.py
r9eb3632 r4f1f876 176 176 if all(len(w)==1 for w in weights): 177 177 call_details = mono_details(kernel.info) 178 data = np.array(scalars+scalars+[1]*len(scalars), dtype=kernel.dtype) 178 # Pad value array to a 32 value boundary 179 data_len = 3*len(scalars) 180 extra = ((data_len+31)//32)*32 - data_len 181 data = np.array(scalars+scalars+[1.]*len(scalars)+[0.]*extra, dtype=kernel.dtype) 179 182 else: 180 183 call_details = poly_details(kernel.info, weights) 181 data = np.hstack(scalars+list(values)+list(weights)).astype(kernel.dtype) 184 # Pad value array to a 32 value boundary 185 data_len = len(scalars) + 2*sum(len(v) for v in values) 186 extra = ((data_len+31)//32)*32 - data_len 187 data = np.hstack(scalars+list(values)+list(weights)+[0.]*extra).astype(kernel.dtype) 182 188 is_magnetic = convert_magnetism(kernel.info.parameters, data) 183 189 #call_details.show() -
sasmodels/kernel_iq.cl
r0f00d95 r4f1f876 28 28 } ProblemDetails; 29 29 30 // Intel HD 4000 needs private arrays to be a multiple of 4 long 30 31 typedef struct { 31 32 PARAMETER_TABLE 33 } ParameterTable; 34 typedef union { 35 ParameterTable table; 36 double vector[4*((NUM_PARS+3)/4)]; 32 37 } ParameterBlock; 33 38 #endif // _PAR_BLOCK_ … … 87 92 // walk the polydispersity cube. local_values will be aliased to pvec. 88 93 ParameterBlock local_values; 89 double *pvec = (double *)&local_values;90 94 91 95 // Fill in the initial variables 92 96 for (int i=0; i < NUM_PARS; i++) { 93 pvec[i] = values[2+i];94 //if (q_index==0) printf("p%d = %g\n",i, pvec[i]);97 local_values.vector[i] = values[2+i]; 98 //if (q_index==0) printf("p%d = %g\n",i, local_values.vector[i]); 95 99 } 96 100 97 101 #if defined(MAGNETIC) && NUM_MAGNETIC>0 98 // Location of the sld parameters in the parameter pvec.102 // Location of the sld parameters in the parameter vector. 99 103 // These parameters are updated with the effective sld due to magnetism. 100 104 #if NUM_MAGNETIC > 3 … … 183 187 const double weight5 = 1.0; 184 188 while (i4 < n4) { 185 pvec[p4] = v4[i4];189 local_values.vector[p4] = v4[i4]; 186 190 double weight4 = w4[i4] * weight5; 187 //if (q_index == 0) printf("step:%d level %d: p:%d i:%d n:%d value:%g weight:%g\n", step, 4, p4, i4, n4, pvec[p4], weight4);191 //if (q_index == 0) printf("step:%d level %d: p:%d i:%d n:%d value:%g weight:%g\n", step, 4, p4, i4, n4, local_values.vector[p4], weight4); 188 192 #elif MAX_PD>3 189 193 const double weight4 = 1.0; … … 191 195 #if MAX_PD>3 192 196 while (i3 < n3) { 193 pvec[p3] = v3[i3];197 local_values.vector[p3] = v3[i3]; 194 198 double weight3 = w3[i3] * weight4; 195 //if (q_index == 0) printf("step:%d level %d: p:%d i:%d n:%d value:%g weight:%g\n", step, 3, p3, i3, n3, pvec[p3], weight3);199 //if (q_index == 0) printf("step:%d level %d: p:%d i:%d n:%d value:%g weight:%g\n", step, 3, p3, i3, n3, local_values.vector[p3], weight3); 196 200 #elif MAX_PD>2 197 201 const double weight3 = 1.0; … … 199 203 #if MAX_PD>2 200 204 while (i2 < n2) { 201 pvec[p2] = v2[i2];205 local_values.vector[p2] = v2[i2]; 202 206 double weight2 = w2[i2] * weight3; 203 //if (q_index == 0) printf("step:%d level %d: p:%d i:%d n:%d value:%g weight:%g\n", step, 2, p2, i2, n2, pvec[p2], weight2);207 //if (q_index == 0) printf("step:%d level %d: p:%d i:%d n:%d value:%g weight:%g\n", step, 2, p2, i2, n2, local_values.vector[p2], weight2); 204 208 #elif MAX_PD>1 205 209 const double weight2 = 1.0; … … 207 211 #if MAX_PD>1 208 212 while (i1 < n1) { 209 pvec[p1] = v1[i1];213 local_values.vector[p1] = v1[i1]; 210 214 double weight1 = w1[i1] * weight2; 211 //if (q_index == 0) printf("step:%d level %d: p:%d i:%d n:%d value:%g weight:%g\n", step, 1, p1, i1, n1, pvec[p1], weight1);215 //if (q_index == 0) printf("step:%d level %d: p:%d i:%d n:%d value:%g weight:%g\n", step, 1, p1, i1, n1, local_values.vector[p1], weight1); 212 216 #elif MAX_PD>0 213 217 const double weight1 = 1.0; … … 215 219 #if MAX_PD>0 216 220 if (slow_theta) { // Theta is not in inner loop 217 spherical_correction = fmax(fabs(cos(M_PI_180* pvec[theta_par])), 1.e-6);221 spherical_correction = fmax(fabs(cos(M_PI_180*local_values.vector[theta_par])), 1.e-6); 218 222 } 219 223 while(i0 < n0) { 220 pvec[p0] = v0[i0];224 local_values.vector[p0] = v0[i0]; 221 225 double weight0 = w0[i0] * weight1; 222 //if (q_index == 0) printf("step:%d level %d: p:%d i:%d n:%d value:%g weight:%g\n", step, 0, p0, i0, n0, pvec[p0], weight0);226 //if (q_index == 0) printf("step:%d level %d: p:%d i:%d n:%d value:%g weight:%g\n", step, 0, p0, i0, n0, local_values.vector[p0], weight0); 223 227 if (fast_theta) { // Theta is in inner loop 224 spherical_correction = fmax(fabs(cos(M_PI_180* pvec[p0])), 1.e-6);228 spherical_correction = fmax(fabs(cos(M_PI_180*local_values.vector[p0])), 1.e-6); 225 229 } 226 230 #else … … 228 232 #endif 229 233 230 //if (q_index == 0) {printf("step:%d of %d, pars:",step,pd_stop); for (int i=0; i < NUM_PARS; i++) printf("p%d=%g ",i, pvec[i]); printf("\n"); }234 //if (q_index == 0) {printf("step:%d of %d, pars:",step,pd_stop); for (int i=0; i < NUM_PARS; i++) printf("p%d=%g ",i, local_values.vector[i]); printf("\n"); } 231 235 //if (q_index == 0) printf("sphcor: %g\n", spherical_correction); 232 236 233 237 #ifdef INVALID 234 if (!INVALID(local_values ))238 if (!INVALID(local_values.table)) 235 239 #endif 236 240 { … … 241 245 // would be problems looking at models with theta=90. 242 246 const double weight = weight0 * spherical_correction; 243 pd_norm += weight * CALL_VOLUME(local_values );247 pd_norm += weight * CALL_VOLUME(local_values.table); 244 248 245 249 #if defined(MAGNETIC) && NUM_MAGNETIC > 0 … … 267 271 #define M3 NUM_PARS+13 268 272 #define SLD(_M_offset, _sld_offset) \ 269 pvec[_sld_offset] = xs * (axis \273 local_values.vector[_sld_offset] = xs * (axis \ 270 274 ? (index==1 ? -values[_M_offset+2] : values[_M_offset+2]) \ 271 275 : mag_sld(qx, qy, pk, values[_M_offset], values[_M_offset+1], \ … … 285 289 } 286 290 #endif 287 scattering += CALL_IQ(q, q_index, local_values );291 scattering += CALL_IQ(q, q_index, local_values.table); 288 292 } 289 293 } … … 291 295 } 292 296 #else // !MAGNETIC 293 const double scattering = CALL_IQ(q, q_index, local_values );297 const double scattering = CALL_IQ(q, q_index, local_values.table); 294 298 #endif // !MAGNETIC 295 299 this_result += weight * scattering;
Note: See TracChangeset
for help on using the changeset viewer.