Changeset 0a7e5eb4 in sasmodels
- Timestamp:
- Mar 21, 2016 9:46:38 AM (9 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:
- c072f83
- Parents:
- 9f4409a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/kernel_iq.c
r9f4409a r0a7e5eb4 20 20 int32_t pd_par[MAX_PD]; // id of the nth polydispersity variable 21 21 int32_t pd_length[MAX_PD]; // length of the nth polydispersity weight vector 22 int32_t pd_offset[MAX_PD]; // offset of pd weights in the par& weight vector22 int32_t pd_offset[MAX_PD]; // offset of pd weights in the value & weight vector 23 23 int32_t pd_stride[MAX_PD]; // stride to move to the next index at this level 24 24 int32_t pd_isvol[MAX_PD]; // True if parameter is a volume weighting parameter 25 int32_t par_offset[NPARS]; // offset of par values in the par& weight vector25 int32_t par_offset[NPARS]; // offset of par values in the value & weight vector 26 26 int32_t par_coord[NPARS]; // polydispersity coordination bitvector 27 27 int32_t fast_coord_pars[NPARS]; // ids of the fast coordination parameters 28 28 int32_t fast_coord_count; // number of parameters coordinated with pd 1 29 int32_t theta_ var; // id of spherical correction variable29 int32_t theta_par; // id of spherical correction variable 30 30 } ProblemDetails; 31 31 … … 43 43 global const ProblemDetails *problem, 44 44 global const double *weights, 45 global const double * pars,45 global const double *values, 46 46 global const double *q, // nq q values, with padding to boundary 47 47 global double *result, // nq+3 return values, again with padding … … 51 51 // Storage for the current parameter values. These will be updated as we 52 52 // walk the polydispersity cube. 53 local ParameterBlock local_ pars; // current parameter values54 double *pvec = (double *)(&local_ pars); // Alias named parameters with a vector53 local ParameterBlock local_values; // current parameter values 54 double *pvec = (double *)(&local_values); // Alias named parameters with a vector 55 55 56 56 local int offset[NPARS]; // NPARS excludes scale/background … … 61 61 62 62 for (int k=0; k < NPARS; k++) { 63 pvec[k] = pars[k+2]; // skip scale and background64 } 65 66 const double volume = CALL_VOLUME(local_ pars);63 pvec[k] = values[k+2]; // skip scale and background 64 } 65 66 const double volume = CALL_VOLUME(local_values); 67 67 #ifdef USE_OPENMP 68 68 #pragma omp parallel for 69 69 #endif 70 70 for (int i=0; i < nq; i++) { 71 const double scattering = CALL_IQ(q, i, local_ pars);72 result[i] = pars[0]*scattering/volume + pars[1];71 const double scattering = CALL_IQ(q, i, local_values); 72 result[i] = values[0]*scattering/volume + values[1]; 73 73 } 74 74 return; … … 147 147 } 148 148 offset[k] = this_offset; 149 pvec[k] = pars[this_offset];149 pvec[k] = values[this_offset]; 150 150 } 151 151 weight = partial_weight * weights[problem->pd_offset[0]+pd_index[0]]; 152 if (problem->theta_ var >= 0) {153 spherical_correction = fabs(cos(M_PI_180*pvec[problem->theta_ var]));154 } 155 if (problem->theta_ var == problem->pd_par[0]) {152 if (problem->theta_par >= 0) { 153 spherical_correction = fabs(cos(M_PI_180*pvec[problem->theta_par])); 154 } 155 if (problem->theta_par == problem->pd_par[0]) { 156 156 weight *= spherical_correction; 157 157 } … … 166 166 for (int k=0; k < problem->fast_coord_count; k++) { 167 167 pvec[problem->fast_coord_pars[k]] 168 = pars[offset[problem->fast_coord_pars[k]]++];169 } 170 if (problem->theta_ var ==problem->pd_par[0]) {171 weight *= fabs(cos(M_PI_180*pvec[problem->theta_ var]));168 = values[offset[problem->fast_coord_pars[k]]++]; 169 } 170 if (problem->theta_par ==problem->pd_par[0]) { 171 weight *= fabs(cos(M_PI_180*pvec[problem->theta_par])); 172 172 } 173 173 } 174 174 175 175 #ifdef INVALID 176 if (INVALID(local_ pars)) continue;176 if (INVALID(local_values)) continue; 177 177 #endif 178 178 … … 181 181 if (weight > cutoff) { 182 182 norm += weight; 183 vol += vol_weight * CALL_VOLUME(local_ pars);183 vol += vol_weight * CALL_VOLUME(local_values); 184 184 norm_vol += vol_weight; 185 185 … … 188 188 #endif 189 189 for (int i=0; i < nq; i++) { 190 const double scattering = CALL_IQ(q, i, local_ pars);190 const double scattering = CALL_IQ(q, i, local_values); 191 191 result[i] += weight*scattering; 192 192 } … … 207 207 result[i] *= norm_vol/vol; 208 208 } 209 result[i] = pars[0]*result[i]/norm + pars[1];209 result[i] = values[0]*result[i]/norm + values[1]; 210 210 } 211 211 }
Note: See TracChangeset
for help on using the changeset viewer.