求高手释疑openmp

hbb21st 2011-03-04 09:38:47

void BEMPB::getselfmtrx( int nnode, double (*znode)[3], double (*znodevn)[3],double *arep,double *arepn,
double (*arep3)[3],int *ipnc,int *ipnc1, int *lsnc, double (*px)[3],int *ippt,
double (*xnrm)[3], double *xwt, double *A,double *B,double *C,double *D, double dei,
double Pi4, double kap,double sigm, double cut1, double cut2){
double GFACTOR1=1.0/2.0;
double GFACTOR2=1.0-GFACTOR1;
double gf1=GFACTOR1/dei+GFACTOR2;
double gf2=GFACTOR1+GFACTOR2/dei;

#pragma omp parallel for firstprivate(znode,znodevn,arep,arepn,arep3,ipnc,ipnc1,lsnc) num_threads(2)

for(int ijk=0; ijk<nnode; ijk++){
double rp0[3], vnx0[3], rp1[3], vnx[3];
double AH,BH,CH,DH;
int i=ipnc[ijk]-1;
rp0[0] = znode[i][0];
rp0[1] = znode[i][1];
rp0[2] = znode[i][2];
vnx0[0] = znodevn[i][0];
vnx0[1] = znodevn[i][1];
vnx0[2] = znodevn[i][2];

int k1 = *(ipnc1+ijk*2);
int k2 = *(ipnc1+ijk*2)+*(ipnc1+ijk*2+1)-1;

for(int kk=k1; kk<=k2; kk++){
int k = lsnc[kk-1]-1;
rp1[0] = znode[k][0];
rp1[1] = znode[k][1];
rp1[2] = znode[k][2];
vnx[0] = arep3[k][0];
vnx[1] = arep3[k][1];
vnx[2] = arep3[k][2];

double dst = distv_(rp0,rp1);

if(k==i){
A[kk-1] = 0.0;
B[kk-1] = gf1;
C[kk-1] = gf2;
D[kk-1] = 0.0;
}//frankly say it is a pity and this will be done one day!
else if(dst<cut1){
A[kk-1] = 0.0;
B[kk-1] = 0.0;
C[kk-1] = 0.0;
D[kk-1] = 0.0;
}else{
nsingcoef_(rp0,rp1,arep+k-1,arepn+k-1, vnx, vnx0,&AH,&BH,&CH,&DH,&kap,&sigm,&Pi4,&dei);
A[kk-1] = -AH;
B[kk-1] = BH;
C[kk-1] = -CH;
D[kk-1] = DH;
}
}//for kk
}//for ijk

}

...全文
81 1 打赏 收藏 转发到动态 举报

1 条回复

hbb21st 2011-03-04
• 打赏
• 举报

562

• 近7日
• 近30日
• 至今