From b47000d0158ae5a5643b8ad730673855076690fb Mon Sep 17 00:00:00 2001 From: Christian Zimmermann Date: Mon, 17 Oct 2022 12:20:09 +0200 Subject: [PATCH] corrections in TFor --- src/include/ranges/xpr/for.cc.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/include/ranges/xpr/for.cc.h b/src/include/ranges/xpr/for.cc.h index b129fc1..69192fb 100644 --- a/src/include/ranges/xpr/for.cc.h +++ b/src/include/ranges/xpr/for.cc.h @@ -144,14 +144,15 @@ namespace CNORXZ inline SizeT TFor::operator()(const PosT1& mlast, const PosT2& last) const { int i = 0; -#pragma omp parallel shared(mXpr) private(i) + const int size = static_cast(mSize); +#pragma omp parallel { auto xpr = mXpr; #pragma omp for - for(i = 0; i < mSize; i++){ + for(i = 0; i < size; i++){ const auto mpos = mlast + mStep * UPos(i); const auto pos = last + mExt * UPos(i); - mXpr(mpos, pos); + xpr(mpos, pos); } } return 0; @@ -161,14 +162,15 @@ namespace CNORXZ inline SizeT TFor::operator()() const { int i = 0; -#pragma omp parallel shared(mXpr) private(i) + const int size = static_cast(mSize); +#pragma omp parallel { auto xpr = mXpr; #pragma omp for - for(i = 0; i < static_cast(mSize); i++){ + for(i = 0; i < size; i++){ const auto mpos = mStep * UPos(i); const auto pos = mExt * UPos(i); - mXpr(mpos, pos); + xpr(mpos, pos); } } return 0;