add omp critical, corrected openmp

This commit is contained in:
大窪 貴洋
2022-03-17 18:25:54 +09:00
parent c86de83c0c
commit 25af2e45b2
+3
View File
@@ -248,8 +248,11 @@ void CalcCn_pp(DATA *data, HEAD *head, TYPE *type, DATASET *cn,
if (cn->xmin < d && d < cn->xmax){ if (cn->xmin < d && d < cn->xmax){
p = (int)floor((d - cn->xmin)/cn->dx); p = (int)floor((d - cn->xmin)/cn->dx);
k = type->pairid[data[i].type_new][data[j].type_new]; k = type->pairid[data[i].type_new][data[j].type_new];
#pragma omp critical
{
cn_[p][k] = cn_[p][k] + 1.0; cn_[p][k] = cn_[p][k] + 1.0;
cn_[p][cn->m-1] = cn_[p][cn->m-1] + 1.0; cn_[p][cn->m-1] = cn_[p][cn->m-1] + 1.0;
}
} }
} }
} }