Changeset 380e8c9 in sasmodels for sasmodels/kernel_iq.c


Ignore:
Timestamp:
Mar 24, 2016 10:56:44 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:
151f3bc
Parents:
60eab2a
Message:

progress on new polydispersity loop, but still broken

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/kernel_iq.c

    r60eab2a r380e8c9  
    5454  double *pvec = (double *)(&local_values);  // Alias named parameters with a vector 
    5555 
    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) { 
    5958    // Shouldn't need to copy!! 
    6059    for (int k=0; k < NPARS; k++) { 
     
    7271    } 
    7372    return; 
     73  } 
     74 
    7475#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 
     77printf("Entering polydispersity\n"); 
    8178  // Since we are no longer looping over the entire polydispersity hypercube 
    8279  // for each q, we need to track the normalization values for each q in a 
     
    107104  // Location in the polydispersity hypercube, one index per dimension. 
    108105  local int pd_index[MAX_PD]; 
     106 
     107  // polydispersity loop index positions 
     108  local int offset[NPARS];  // NPARS excludes scale/background 
    109109 
    110110  // Trigger the reset behaviour that happens at the end the fast loop 
     
    132132      for (int k=1; k < MAX_PD; k++) { 
    133133        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]]; 
    135135        partial_weight *= wi; 
    136136        if (problem->pd_isvol[k]) partial_volweight *= wi; 
    137137      } 
     138      printf("slow %d: ", loop_index); 
    138139      for (int k=0; k < NPARS; k++) { 
    139140        int coord = problem->par_coord[k]; 
     
    149150        offset[k] = this_offset; 
    150151        pvec[k] = values[this_offset]; 
    151       } 
     152        printf("p[%d]=v[%d]=%g ", k, offset[k], pvec[k]); 
     153      } 
     154      printf("\n"); 
    152155      weight = partial_weight * weights[problem->pd_offset[0]+pd_index[0]]; 
    153156      if (problem->theta_par >= 0) { 
     
    157160        weight *= spherical_correction; 
    158161      } 
     162      pd_index[0] += 1; 
    159163 
    160164    } else { 
    161165 
    162166      // INCREMENT INDICES 
    163       pd_index[0] += 1; 
    164167      const double wi = weights[problem->pd_offset[0]+pd_index[0]]; 
    165168      weight = partial_weight*wi; 
    166169      if (problem->pd_isvol[0]) vol_weight *= wi; 
     170      printf("fast %d: ", loop_index); 
    167171      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]) { 
    179178        weight *= fabs(cos(M_PI_180*pvec[problem->theta_par])); 
    180179      } 
     180      pd_index[0] += 1; 
    181181    } 
    182182    #ifdef INVALID 
     
    201201  } 
    202202 
    203   //Makes a normalization available for the next round 
     203  // Make normalization available for the next round 
    204204  result[nq] = norm; 
    205205  result[nq+1] = vol; 
    206206  result[nq+2] = norm_vol; 
    207207 
    208   //End of the PD loop we can normalize 
     208  // End of the PD loop we can normalize 
    209209  if (pd_stop >= problem->pd_stride[MAX_PD-1]) { 
    210210    #ifdef USE_OPENMP 
Note: See TracChangeset for help on using the changeset viewer.