diff --git a/libNeonCore/include/Neon/core/tools/io/IODense_imp.h b/libNeonCore/include/Neon/core/tools/io/IODense_imp.h index fb16dbb2..f8c2a355 100644 --- a/libNeonCore/include/Neon/core/tools/io/IODense_imp.h +++ b/libNeonCore/include/Neon/core/tools/io/IODense_imp.h @@ -280,11 +280,14 @@ auto IODense::maxDiff(const IODense& a const auto newDiff = std::abs(valA - valB); const int threadId = omp_get_thread_num(); if (newDiff > std::get<0>(max_diff[threadId])) { +#pragma omp critical + if (newDiff > std::get<0>(max_diff[threadId])) { Values& md = max_diff[threadId]; std::get<0>(md) = newDiff; std::get<1>(md) = idx; std::get<2>(md) = c; } + } }, b); diff --git a/libNeonCore/include/Neon/core/types/vec/vec3d_integer.timp.h b/libNeonCore/include/Neon/core/types/vec/vec3d_integer.timp.h index 304c5b37..8d4f30b0 100644 --- a/libNeonCore/include/Neon/core/types/vec/vec3d_integer.timp.h +++ b/libNeonCore/include/Neon/core/types/vec/vec3d_integer.timp.h @@ -1,9 +1,3 @@ - - -// $Id$ - -// $Log$ - #pragma once #include @@ -13,6 +7,7 @@ #include #include +#include "Neon/core/types/Macros.h" // #include // #include @@ -686,7 +681,11 @@ void Vec_3d::forEach(const self_t& std::function lambda) { if constexpr (computeMode_ta == Neon::computeMode_t::par) { +#ifdef NEON_OS_WINDOWS +#pragma omp parallel for +#else #pragma omp parallel for simd collapse(3) +#endif for (Integer z = 0; z < len.z; z++) { for (Integer y = 0; y < len.y; y++) { for (Integer x = 0; x < len.x; x++) { @@ -713,7 +712,11 @@ auto Vec_3d::forEach(const Lambda& lambda) const { if constexpr (std::is_invocable_v) { if constexpr (computeMode_ta == Neon::computeMode_t::par) { +#ifdef NEON_OS_WINDOWS +#pragma omp parallel for +#else #pragma omp parallel for simd collapse(3) +#endif for (Integer zIdx = 0; zIdx < this->z; zIdx++) { for (Integer yIdx = 0; yIdx < this->y; yIdx++) { for (Integer xIdx = 0; xIdx < this->x; xIdx++) { @@ -734,7 +737,11 @@ auto Vec_3d::forEach(const Lambda& lambda) const } if constexpr (std::is_invocable_v>) { if constexpr (computeMode_ta == Neon::computeMode_t::par) { +#ifdef NEON_OS_WINDOWS +#pragma omp parallel for +#else #pragma omp parallel for simd collapse(3) +#endif for (Integer zIdx = 0; zIdx < this->z; zIdx++) { for (Integer yIdx = 0; yIdx < this->y; yIdx++) { for (Integer xIdx = 0; xIdx < this->x; xIdx++) { diff --git a/libNeonCore/tests/unit/coreUt_io/src/coreUt_io.dense.cpp b/libNeonCore/tests/unit/coreUt_io/src/coreUt_io.dense.cpp index 63760473..261f8bc4 100644 --- a/libNeonCore/tests/unit/coreUt_io/src/coreUt_io.dense.cpp +++ b/libNeonCore/tests/unit/coreUt_io/src/coreUt_io.dense.cpp @@ -73,4 +73,5 @@ TEST(coreUt_io, denseDiffRandom) ASSERT_EQ(maxDiff.z, id.z); ASSERT_EQ(maxCard, card); } + A.ioVtk("A", "A"); } \ No newline at end of file