Changeset 0a7e5eb4 in sasmodels


Ignore:
Timestamp:
Mar 21, 2016 9:46:38 AM (8 years ago)
Author:
Paul Kienzle <pkienzle@…>
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
Message:

rename pars to values for clarity and consistency across routines

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/kernel_iq.c

    r9f4409a r0a7e5eb4  
    2020    int32_t pd_par[MAX_PD];     // id of the nth polydispersity variable 
    2121    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 vector 
     22    int32_t pd_offset[MAX_PD];  // offset of pd weights in the value & weight vector 
    2323    int32_t pd_stride[MAX_PD];  // stride to move to the next index at this level 
    2424    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 vector 
     25    int32_t par_offset[NPARS];  // offset of par values in the value & weight vector 
    2626    int32_t par_coord[NPARS];   // polydispersity coordination bitvector 
    2727    int32_t fast_coord_pars[NPARS]; // ids of the fast coordination parameters 
    2828    int32_t fast_coord_count;   // number of parameters coordinated with pd 1 
    29     int32_t theta_var;          // id of spherical correction variable 
     29    int32_t theta_par;          // id of spherical correction variable 
    3030} ProblemDetails; 
    3131 
     
    4343    global const ProblemDetails *problem, 
    4444    global const double *weights, 
    45     global const double *pars, 
     45    global const double *values, 
    4646    global const double *q, // nq q values, with padding to boundary 
    4747    global double *result,  // nq+3 return values, again with padding 
     
    5151  // Storage for the current parameter values.  These will be updated as we 
    5252  // walk the polydispersity cube. 
    53   local ParameterBlock local_pars;  // current parameter values 
    54   double *pvec = (double *)(&local_pars);  // Alias named parameters with a vector 
     53  local ParameterBlock local_values;  // current parameter values 
     54  double *pvec = (double *)(&local_values);  // Alias named parameters with a vector 
    5555 
    5656  local int offset[NPARS];  // NPARS excludes scale/background 
     
    6161 
    6262    for (int k=0; k < NPARS; k++) { 
    63       pvec[k] = pars[k+2];  // skip scale and background 
    64     } 
    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); 
    6767    #ifdef USE_OPENMP 
    6868    #pragma omp parallel for 
    6969    #endif 
    7070    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]; 
    7373    } 
    7474    return; 
     
    147147        } 
    148148        offset[k] = this_offset; 
    149         pvec[k] = pars[this_offset]; 
     149        pvec[k] = values[this_offset]; 
    150150      } 
    151151      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]) { 
    156156        weight *= spherical_correction; 
    157157      } 
     
    166166      for (int k=0; k < problem->fast_coord_count; k++) { 
    167167        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])); 
    172172      } 
    173173    } 
    174174 
    175175    #ifdef INVALID 
    176     if (INVALID(local_pars)) continue; 
     176    if (INVALID(local_values)) continue; 
    177177    #endif 
    178178 
     
    181181    if (weight > cutoff) { 
    182182      norm += weight; 
    183       vol += vol_weight * CALL_VOLUME(local_pars); 
     183      vol += vol_weight * CALL_VOLUME(local_values); 
    184184      norm_vol += vol_weight; 
    185185 
     
    188188      #endif 
    189189      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); 
    191191        result[i] += weight*scattering; 
    192192      } 
     
    207207        result[i] *= norm_vol/vol; 
    208208      } 
    209       result[i] = pars[0]*result[i]/norm + pars[1]; 
     209      result[i] = values[0]*result[i]/norm + values[1]; 
    210210    } 
    211211  } 
Note: See TracChangeset for help on using the changeset viewer.