Changeset 60eab2a in sasmodels for sasmodels/kernel_iq.c


Ignore:
Timestamp:
Mar 24, 2016 6:12:07 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:
380e8c9
Parents:
e69b36f
Message:

support autogenerated Iqxy in C models

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/kernel_iq.c

    r69aa451 r60eab2a  
    1616 
    1717typedef struct { 
     18#if MAX_PD > 0 
    1819    int32_t pd_par[MAX_PD];     // id of the nth polydispersity variable 
    1920    int32_t pd_length[MAX_PD];  // length of the nth polydispersity weight vector 
     
    2122    int32_t pd_stride[MAX_PD];  // stride to move to the next index at this level 
    2223    int32_t pd_isvol[MAX_PD];   // True if parameter is a volume weighting parameter 
     24#endif // MAX_PD > 0 
    2325    int32_t par_offset[NPARS];  // offset of par values in the value & weight vector 
    2426    int32_t par_coord[NPARS];   // polydispersity coordination bitvector 
     
    5254  double *pvec = (double *)(&local_values);  // Alias named parameters with a vector 
    5355 
    54   local int offset[NPARS];  // NPARS excludes scale/background 
    55  
    56 #if 0 // defined(USE_SHORTCUT_OPTIMIZATION) 
     56#if MAX_PD > 0 
    5757  if (problem->pd_length[0] == 1) { 
     58#endif // MAX_PD > 0 
    5859    // Shouldn't need to copy!! 
    59  
    6060    for (int k=0; k < NPARS; k++) { 
    6161      pvec[k] = values[k+2];  // skip scale and background 
     
    6767    #endif 
    6868    for (int i=0; i < nq; i++) { 
    69       const double scattering = CALL_IQ(q, i, local_values); 
    70       result[i] = values[0]*scattering/volume + values[1]; 
     69      double scattering = CALL_IQ(q, i, local_values); 
     70      if (volume != 0.0) scattering /= volume; 
     71      result[i] = values[0]*scattering + values[1]; 
    7172    } 
    7273    return; 
    73   } 
    74   printf("falling through\n"); 
    75 #endif 
     74#if MAX_PD > 0 
     75  } 
     76 
     77  // polydispersity loop index positions 
     78  local int offset[NPARS];  // NPARS excludes scale/background 
    7679 
    7780  printf("Entering polydispersity\n"); 
     
    177180      } 
    178181    } 
    179     printf("rad len %f %f\n",local_values.radius, local_values.length); 
    180182    #ifdef INVALID 
    181183    if (INVALID(local_values)) continue; 
     
    199201  } 
    200202 
    201   //Makes a normalization avialable for the next round 
     203  //Makes a normalization available for the next round 
    202204  result[nq] = norm; 
    203205  result[nq+1] = vol; 
     
    216218    } 
    217219  } 
     220#endif // MAX_PD > 0 
    218221} 
Note: See TracChangeset for help on using the changeset viewer.