1.23
2.0
main
test-branch
| Line | |
|---|
| 1 | // using of private() clause
|
|---|
| 2 |
|
|---|
| 3 | #include <stdio.h>
|
|---|
| 4 | #include <math.h>
|
|---|
| 5 |
|
|---|
| 6 | #define MSIZE 200
|
|---|
| 7 | int n=MSIZE, m=MSIZE;
|
|---|
| 8 | double alpha = 0.0543;
|
|---|
| 9 | double u[MSIZE][MSIZE], f[MSIZE][MSIZE], uold[MSIZE][MSIZE];
|
|---|
| 10 | double dx, dy;
|
|---|
| 11 |
|
|---|
| 12 | void
|
|---|
| 13 | initialize ()
|
|---|
| 14 | {
|
|---|
| 15 | int i, j, xx, yy;
|
|---|
| 16 |
|
|---|
| 17 | dx = 2.0 / (n - 1); // -->dx@112:2
|
|---|
| 18 | dy = 2.0 / (m - 1); //-->dy@113:2
|
|---|
| 19 |
|
|---|
| 20 | /* Initialize initial condition and RHS */
|
|---|
| 21 | #pragma omp parallel for private(i,j,xx,yy)
|
|---|
| 22 | for (i = 0; i < n; i++)
|
|---|
| 23 | for (j = 0; j < m; j++)
|
|---|
| 24 | {
|
|---|
| 25 | xx = (int) (-1.0 + dx * (i - 1)); /* -1 < x < 1 */
|
|---|
| 26 | yy = (int) (-1.0 + dy * (j - 1)); /* -1 < y < 1 */
|
|---|
| 27 | u[i][j] = 0.0;
|
|---|
| 28 | f[i][j] = -1.0 * alpha * (1.0 - xx * xx) * (1.0 - yy * yy)
|
|---|
| 29 | - 2.0 * (1.0 - xx * xx) - 2.0 * (1.0 - yy * yy);
|
|---|
| 30 |
|
|---|
| 31 | }
|
|---|
| 32 | }
|
|---|
| 33 |
|
|---|
| 34 | int main()
|
|---|
| 35 | {
|
|---|
| 36 | initialize();
|
|---|
| 37 | return 0;
|
|---|
| 38 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.