@@ -302,67 +302,62 @@ double zridd_gpu(double x1, double x2, struct neutron_params *neutron, struct ph
302302
303303 void findroots(double brack_low, double brack_mid, double brack_high,
304304 double *list, int* index, double (*f)(struct neutron_params*, struct phonon_params*),
305- struct neutron_params *neutron, struct phonon_params *phonon)
306- {
307- double root;
308- // Energy gain and energy loss spaces are not equally big. We check uniformly
309- // So we use two different ranges
310- double range_low = brack_mid - brack_low;
311- double range_high = brack_high - brack_mid;
312- // First in energy loss for the neutron
313- for (int i=0; i<phonon->e_steps_low_; i++){
305+ struct neutron_params *neutron, struct phonon_params *phonon) {
306+ double root;
307+ // Energy gain and energy loss spaces are not equally big. We check uniformly
308+ // So we use two different ranges
309+ double range_low = brack_mid - brack_low;
310+ double range_high = brack_high - brack_mid;
311+ // First in energy loss for the neutron
312+ for (int i=0; i<phonon->e_steps_low_; i++){
314313 root = zridd(f, brack_low+range_low*i/ phonon->e_steps_low_,
315314 brack_low+range_low*(i+1)/ phonon->e_steps_low_,
316315 neutron, phonon, ROOTACC);
317- if (root != UNUSED)
318- {
319- list[(*index)++]=root;
316+ if (root != UNUSED) {
317+ list[(*index)++]=root;
320318 }
321- }
319+ }
322320
323321 // Then in energy gain for the neutron
324322 for (int i=0; i<phonon->e_steps_high_; i++){
325323 root = zridd(f, brack_low+range_high*i/ phonon->e_steps_high_,
326- brack_low+range_high*(i+1)/ phonon->e_steps_high_,
327- neutron, phonon, ROOTACC);
324+ brack_low+range_high*(i+1)/ phonon->e_steps_high_,
325+ neutron, phonon, ROOTACC);
328326 if (root != UNUSED){
329- list[(*index)++]=root;
327+ list[(*index)++]=root;
330328 }
331- }
332329 }
330+ }
333331
334332#pragma acc routine
335333 void findroots_gpu(double brack_low, double brack_mid, double brack_high,
336- double *list, int* index, struct neutron_params *neutron, struct phonon_params *phonon)
337- {
338- double root;
339- // Energy gain and energy loss spaces are not equally big. We check uniformly
340- // So we use two different ranges
341- double range_low = brack_mid - brack_low;
342- double range_high = brack_high - brack_mid;
343- // First in energy loss for the neutron
344- for (int i=0; i<phonon->e_steps_low_; i++){
334+ double *list, int* index, struct neutron_params *neutron, struct phonon_params *phonon) {
335+ double root;
336+ // Energy gain and energy loss spaces are not equally big. We check uniformly
337+ // So we use two different ranges
338+ double range_low = brack_mid - brack_low;
339+ double range_high = brack_high - brack_mid;
340+ // First in energy loss for the neutron
341+ for (int i=0; i<phonon->e_steps_low_; i++){
345342 root = zridd_gpu(brack_low+range_low*i/ phonon->e_steps_low_,
346- brack_low+range_low*(i+1)/ phonon->e_steps_low_,
347- neutron, phonon, ROOTACC);
348- if (root != UNUSED)
349- {
350- list[(*index)++]=root;
343+ brack_low+range_low*(i+1)/ phonon->e_steps_low_,
344+ neutron, phonon, ROOTACC);
345+ if (root != UNUSED) {
346+ list[(*index)++]=root;
351347 }
352- }
348+ }
353349
354350 // Then in energy gain for the neutron
355351 for (int i=0; i<phonon->e_steps_high_; i++){
356352 root = zridd_gpu(brack_low+range_high*i/ phonon->e_steps_high_,
357- brack_low+range_high*(i+1)/ phonon->e_steps_high_,
358- neutron, phonon, ROOTACC);
353+ brack_low+range_high*(i+1)/ phonon->e_steps_high_,
354+ neutron, phonon, ROOTACC);
359355 if (root != UNUSED){
360- list[(*index)++]=root;
356+ list[(*index)++]=root;
361357 }
362- }
363358 }
359+ }
364360
365-
366361#undef UNUSED
367362#undef MAXRIDD
368363#endif
0 commit comments