I have a problem with a loop which contains various variables, I want to share them. See the part of my code in C++ here:

Code: Select all

```
double *force_X;
double *WallY0_f;
double *WallY1_f ;
force_X = (double *) calloc ((size_t) (nb), sizeof(double));
WallY0_f = (double *) calloc ((size_t) (nb), sizeof(double));
WallY1_f = (double *) calloc ((size_t) (nb), sizeof(double));
int i,j,k;
#pragma omp parallel for shared(force_X, force_Y, force_Z, WallY0_f, WallY1_f) private(k)
for (k = 0; k < nbreInteractions ; ++k) {
i = particle[k];
j = Voisin[k];
if (_paire[k]==0)
{
Sphere_Sphere(i,j,k);
force_X[i] += FX[k];
force_X[j] -= FX[k];
}
else if (_paire[k]==1)
{
Sphere_WallY0(i,k);
force_X[i] -= FX[k];
WallY0_f[i] -= FY[k];
}
else if (_paire[k]==2)
{
Sphere_WallY1(i,k);
force_X[i] += FX[k];
WallY1_f[i] += FY[k];
}
}
```

Do you see an error into my loop ?

Thanks for your request.

Regards

Jf

PS: the value of FX[k] and FY[k] is calculted into the functions: Sphere_WallY1, Sphere_WallY0 and Sphere_Sphere.