Changeset 924a119 in sasmodels for sasmodels/kernel_iq.c


Ignore:
Timestamp:
Jan 16, 2018 6:34:23 PM (6 years ago)
Author:
GitHub <noreply@…>
Branches:
master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
0014c77
Parents:
c1bccff (diff), 8fb2a94 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Paul Butler <butlerpd@…> (01/16/18 18:34:23)
git-committer:
GitHub <noreply@…> (01/16/18 18:34:23)
Message:

Merge pull request #57 from SasView?/ticket-1043

use Iqac/Iqabc? for the new orientation interface but Iqxy for the old. Fixes #1043

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/kernel_iq.c

    rec8d4ac r924a119  
    3131//  CALL_IQ_AC(qa, qc, table) : call the Iqxy function for symmetric shapes 
    3232//  CALL_IQ_ABC(qa, qc, table) : call the Iqxy function for asymmetric shapes 
     33//  CALL_IQ_XY(qx, qy, table) : call the Iqxy function for arbitrary models 
    3334//  INVALID(table) : test if the current point is feesible to calculate.  This 
    3435//      will be defined in the kernel definition file. 
     
    469470  #define APPLY_ROTATION() qabc_apply(&rotation, qx, qy, &qa, &qb, &qc) 
    470471  #define CALL_KERNEL() CALL_IQ_ABC(qa, qb, qc, local_values.table) 
    471 #endif 
    472  
    473 // Doing jitter projection code outside the previous if block so that we don't 
    474 // need to repeat the identical logic in the IQ_AC and IQ_ABC branches.  This 
    475 // will become more important if we implement more projections, or more 
    476 // complicated projections. 
    477 #if defined(CALL_IQ) || defined(CALL_IQ_A) 
     472#elif defined(CALL_IQ_XY) 
     473  // direct call to qx,qy calculator 
     474  double qx, qy; 
     475  #define FETCH_Q() do { qx = q[2*q_index]; qy = q[2*q_index+1]; } while (0) 
     476  #define BUILD_ROTATION() do {} while(0) 
     477  #define APPLY_ROTATION() do {} while(0) 
     478  #define CALL_KERNEL() CALL_IQ_XY(qx, qy, local_values.table) 
     479#endif 
     480 
     481// Define APPLY_PROJECTION depending on model symmetries. We do this outside 
     482// the previous if block so that we don't need to repeat the identical 
     483// logic in the IQ_AC and IQ_ABC branches.  This will become more important 
     484// if we implement more projections, or more complicated projections. 
     485#if defined(CALL_IQ) || defined(CALL_IQ_A)  // no orientation 
    478486  #define APPLY_PROJECTION() const double weight=weight0 
    479 #else // !spherosymmetric projection 
     487#elif defined(CALL_IQ_XY) // pass orientation to the model 
     488  // CRUFT: support oriented model which define Iqxy rather than Iqac or Iqabc 
     489  // Need to plug the values for the orientation angles back into parameter 
     490  // table in case they were overridden by the orientation offset.  This 
     491  // means that orientation dispersity will not work for these models, but 
     492  // it was broken anyway, so no matter.  Still want to provide Iqxy in case 
     493  // the user model wants full control of orientation/magnetism. 
     494  #if defined(HAVE_PSI) 
     495    const double theta = values[details->theta_par+2]; 
     496    const double phi = values[details->theta_par+3]; 
     497    const double psi = values[details->theta_par+4]; 
     498    double weight; 
     499    #define APPLY_PROJECTION() do { \ 
     500      local_values.table.theta = theta; \ 
     501      local_values.table.phi = phi; \ 
     502      local_values.table.psi = psi; \ 
     503      weight=weight0; \ 
     504    } while (0) 
     505  #elif defined(HAVE_THETA) 
     506    const double theta = values[details->theta_par+2]; 
     507    const double phi = values[details->theta_par+3]; 
     508    double weight; 
     509    #define APPLY_PROJECTION() do { \ 
     510      local_values.table.theta = theta; \ 
     511      local_values.table.phi = phi; \ 
     512      weight=weight0; \ 
     513    } while (0) 
     514  #else 
     515    #define APPLY_PROJECTION() const double weight=weight0 
     516  #endif 
     517#else // apply jitter and view before calling the model 
    480518  // Grab the "view" angles (theta, phi, psi) from the initial parameter table. 
    481519  const double theta = values[details->theta_par+2]; 
     
    488526  // we go through the mesh. 
    489527  double dtheta, dphi, weight; 
    490   #if PROJECTION == 1 
     528  #if PROJECTION == 1 // equirectangular 
    491529    #define APPLY_PROJECTION() do { \ 
    492530      dtheta = local_values.table.theta; \ 
     
    494532      weight = fabs(cos(dtheta*M_PI_180)) * weight0; \ 
    495533    } while (0) 
    496   #elif PROJECTION == 2 
     534  #elif PROJECTION == 2 // sinusoidal 
    497535    #define APPLY_PROJECTION() do { \ 
    498536      dtheta = local_values.table.theta; \ 
     
    504542    } while (0) 
    505543  #endif 
    506 #endif // !spherosymmetric projection 
     544#endif // done defining APPLY_PROJECTION 
    507545 
    508546// ** define looping macros ** 
Note: See TracChangeset for help on using the changeset viewer.