Created
May 24, 2017 04:22
-
-
Save kaityo256/97e5af97879890ed55cd181bb68d99ae to your computer and use it in GitHub Desktop.
Before SIMDization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void | |
| force_sorted_z(void) { | |
| const int pn = particle_number; | |
| for (int i = 0; i < pn; i++) { | |
| const double qx_key = z[i][X]; | |
| const double qy_key = z[i][Y]; | |
| const double qz_key = z[i][Z]; | |
| const int np = number_of_partners[i]; | |
| double pfx = 0; | |
| double pfy = 0; | |
| double pfz = 0; | |
| const int kp = pointer[i]; | |
| for (int k = 0; k < np; k++) { | |
| const int j = sorted_list[kp + k]; | |
| double dx = z[j][X] - qx_key; | |
| double dy = z[j][Y] - qy_key; | |
| double dz = z[j][Z] - qz_key; | |
| double r2 = (dx * dx + dy * dy + dz * dz); | |
| double r6 = r2 * r2 * r2; | |
| double df = ((24.0 * r6 - 48.0) / (r6 * r6 * r2)) * dt; | |
| if (r2 > CL2) df=0.0; | |
| pfx += df * dx; | |
| pfy += df * dy; | |
| pfz += df * dz; | |
| z[j][PX] -= df * dx; | |
| z[j][PY] -= df * dy; | |
| z[j][PZ] -= df * dz; | |
| } | |
| z[i][PX] += pfx; | |
| z[i][PY] += pfy; | |
| z[i][PZ] += pfz; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment