Hi,
I am trying to parallel a function and this is the code (I only include map function):
void mymap(f32 x, f32& density, boolean exist){
using namespace arbb;
array coord;
position(coord);
_if(exist){
i32 ck = coord.at(2);
i32 cj = coord.at(1);
i32 cioriginal = coord.at(0);
i32 ci = cioriginal/16;
i32 index;
index = (ck*ny + cj)*nx + ci)*16+cioriginal%16;
_for(i32 C = 0, C < 27, C++){
i32 kk = ck + ((C%9)%3)-1;
i32 jj = cj + ((C%9)/3)-1;
i32 ii = ci + (C/9)-1;
_if(ii >= 0 && ii < nx && jj >= 0 && jj < ny && kk >= 0 && kk < nz){
i32 cellNeigh = ((kk*ny + jj)*nx + ii)*16;S
_for(i32 particleNeigh=ii*16, particleNeigh<16+ii*16 && neighbor(exist,particleNeigh-cioriginal,jj-cj,kk-ck), particleNeigh++){
_if(cellNeigh+(particleNeigh-ii*16) < index){
f32 dispX = (x - neighbor(x,particleNeigh-cioriginal,jj-cj,kk-ck));
f32 distSq = dispX * dispX;
density+=distSq;
}_end_if
}_end_for
}_end_if
}_end_for
}_end_if
}
Usingthe function position I need to use ArBBtypes (it cannot be used
the function value) and the statements _if and _for . However, the
operations are independent ones to each other so therefore, it would be
better to introduce statements for and if. With the code shown I obtain worse results than the serial version, any suggestion?
Thanks



