Changeset e44432d in sasmodels for sasmodels/kernel_iq.c
- Timestamp:
- Oct 19, 2018 3:46:26 PM (5 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- be43e39
- Parents:
- 2586ab72
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/kernel_iq.c
r2773c66 re44432d 26 26 // MAGNETIC_PARS : a comma-separated list of indices to the sld 27 27 // parameters in the parameter table. 28 // CALL_VOLUME( table) : call the form volume function28 // CALL_VOLUME(form, shell, table) : assign form and shell values 29 29 // CALL_EFFECTIVE_RADIUS(type, table) : call the R_eff function 30 30 // CALL_IQ(q, table) : call the Iq function for 1D calcs. … … 275 275 276 276 // ==================== KERNEL CODE ======================== 277 #define COMPUTE_F1_F2 defined(CALL_FQ)278 277 kernel 279 278 void KERNEL_NAME( … … 345 344 // version must loop over all q. 346 345 #ifdef USE_OPENCL 347 #if COMPUTE_F1_F2346 #if defined(CALL_FQ) 348 347 double weight_norm = (pd_start == 0 ? 0.0 : result[2*nq]); 349 double weighted_volume = (pd_start == 0 ? 0.0 : result[2*nq+1]); 350 double weighted_radius = (pd_start == 0 ? 0.0 : result[2*nq+2]); 348 double weighted_form = (pd_start == 0 ? 0.0 : result[2*nq+1]); 349 double weighted_shell = (pd_start == 0 ? 0.0 : result[2*nq+2]); 350 double weighted_radius = (pd_start == 0 ? 0.0 : result[2*nq+3]); 351 351 double this_F2 = (pd_start == 0 ? 0.0 : result[2*q_index+0]); 352 352 double this_F1 = (pd_start == 0 ? 0.0 : result[2*q_index+1]); 353 353 #else 354 354 double weight_norm = (pd_start == 0 ? 0.0 : result[nq]); 355 double weighted_volume = (pd_start == 0 ? 0.0 : result[nq+1]); 356 double weighted_radius = (pd_start == 0 ? 0.0 : result[nq+2]); 355 double weighted_form = (pd_start == 0 ? 0.0 : result[nq+1]); 356 double weighted_shell = (pd_start == 0 ? 0.0 : result[nq+2]); 357 double weighted_radius = (pd_start == 0 ? 0.0 : result[nq+3]); 357 358 double this_result = (pd_start == 0 ? 0.0 : result[q_index]); 358 359 #endif 359 360 #else // !USE_OPENCL 360 #if COMPUTE_F1_F2361 #if defined(CALL_FQ) 361 362 double weight_norm = (pd_start == 0 ? 0.0 : result[2*nq]); 362 double weighted_volume = (pd_start == 0 ? 0.0 : result[2*nq+1]); 363 double weighted_radius = (pd_start == 0 ? 0.0 : result[2*nq+2]); 363 double weighted_form = (pd_start == 0 ? 0.0 : result[2*nq+1]); 364 double weighted_shell = (pd_start == 0 ? 0.0 : result[2*nq+2]); 365 double weighted_radius = (pd_start == 0 ? 0.0 : result[2*nq+3]); 364 366 #else 365 367 double weight_norm = (pd_start == 0 ? 0.0 : result[nq]); 366 double weighted_volume = (pd_start == 0 ? 0.0 : result[nq+1]); 367 double weighted_radius = (pd_start == 0 ? 0.0 : result[nq+2]); 368 double weighted_form = (pd_start == 0 ? 0.0 : result[nq+1]); 369 double weighted_shell = (pd_start == 0 ? 0.0 : result[nq+2]); 370 double weighted_radius = (pd_start == 0 ? 0.0 : result[nq+3]); 368 371 #endif 369 372 if (pd_start == 0) { … … 371 374 #pragma omp parallel for 372 375 #endif 373 #if COMPUTE_F1_F2376 #if defined(CALL_FQ) 374 377 // 2*nq for F^2,F pairs 375 378 for (int q_index=0; q_index < 2*nq; q_index++) result[q_index] = 0.0; … … 378 381 #endif 379 382 } 380 //if (q_index==0) printf("start %d %g %g\n", pd_start, weighted_ volume, result[0]);383 //if (q_index==0) printf("start %d %g %g\n", pd_start, weighted_shell, result[0]); 381 384 #endif // !USE_OPENCL 382 385 … … 693 696 // Note: weight==0 must always be excluded 694 697 if (weight > cutoff) { 695 weighted_volume += weight * CALL_VOLUME(local_values.table);696 #if COMPUTE_F1_F2698 double form, shell; 699 CALL_VOLUME(form, shell, local_values.table); 697 700 weight_norm += weight; 698 #endif 701 weighted_form += weight * form; 702 weighted_shell += weight * shell; 699 703 if (effective_radius_type != 0) { 700 704 weighted_radius += weight * CALL_EFFECTIVE_RADIUS(effective_radius_type, local_values.table); … … 747 751 } 748 752 #else // !MAGNETIC 749 #if COMPUTE_F1_F2753 #if defined(CALL_FQ) 750 754 CALL_KERNEL(); // sets F1 and F2 by reference 751 755 #else … … 756 760 757 761 #ifdef USE_OPENCL 758 #if COMPUTE_F1_F2762 #if defined(CALL_FQ) 759 763 this_F2 += weight * F2; 760 764 this_F1 += weight * F1; … … 763 767 #endif 764 768 #else // !USE_OPENCL 765 #if COMPUTE_F1_F2769 #if defined(CALL_FQ) 766 770 result[2*q_index+0] += weight * F2; 767 771 result[2*q_index+1] += weight * F1; … … 793 797 // Remember the current result and the updated norm. 794 798 #ifdef USE_OPENCL 795 #if COMPUTE_F1_F2799 #if defined(CALL_FQ) 796 800 result[2*q_index+0] = this_F2; 797 801 result[2*q_index+1] = this_F1; 798 802 if (q_index == 0) { 799 803 result[2*nq+0] = weight_norm; 800 result[2*nq+1] = weighted_volume; 801 result[2*nq+2] = weighted_radius; 804 result[2*nq+1] = weighted_form; 805 result[2*nq+3] = weighted_shell; 806 result[2*nq+3] = weighted_radius; 802 807 } 803 808 #else … … 805 810 if (q_index == 0) { 806 811 result[nq+0] = weight_norm; 807 result[nq+1] = weighted_volume; 808 result[nq+2] = weighted_radius; 812 result[nq+1] = weighted_form; 813 result[nq+2] = weighted_shell; 814 result[nq+3] = weighted_radius; 809 815 } 810 816 #endif 811 817 812 //if (q_index == 0) printf("res: %g/%g\n", result[0], weig thed_volume);818 //if (q_index == 0) printf("res: %g/%g\n", result[0], weighted_shell); 813 819 #else // !USE_OPENCL 814 #if COMPUTE_F1_F2820 #if defined(CALL_FQ) 815 821 result[2*nq] = weight_norm; 816 result[2*nq+1] = weighted_volume; 817 result[2*nq+2] = weighted_radius; 822 result[2*nq+1] = weighted_form; 823 result[2*nq+2] = weighted_shell; 824 result[2*nq+3] = weighted_radius; 818 825 #else 819 826 result[nq] = weight_norm; 820 result[nq+1] = weighted_volume; 821 result[nq+2] = weighted_radius; 827 result[nq+1] = weighted_form; 828 result[nq+2] = weighted_shell; 829 result[nq+3] = weighted_radius; 822 830 #endif 823 //printf("res: %g/%g\n", result[0], weighted_ volume);831 //printf("res: %g/%g\n", result[0], weighted_shell); 824 832 #endif // !USE_OPENCL 825 833 826 834 // ** clear the macros in preparation for the next kernel ** 827 #undef COMPUTE_F1_F2828 835 #undef PD_INIT 829 836 #undef PD_OPEN
Note: See TracChangeset
for help on using the changeset viewer.