mirror of
https://github.com/microsoft/UVAtlas
synced 2024-11-09 13:50:05 +00:00
Add use of OpenMP for a heavy loop (#42)
This commit is contained in:
parent
aeafbbfe47
commit
908732a091
@ -9,6 +9,9 @@ cmake_minimum_required (VERSION 3.11)
|
||||
|
||||
project (UVAtlas LANGUAGES CXX)
|
||||
|
||||
# #pragma omp is used to specify Directives and Clauses. If /openmp is not specified in a compilation, the compiler ignores OpenMP clauses and directives
|
||||
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/openmp>)
|
||||
|
||||
option(BUILD_TOOLS "Build UVAtlasTool" ON)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
|
@ -395,14 +395,17 @@ float CIsochartMesh::CalOptimalAvgL2SquaredStretch(
|
||||
bool bAllChartSatisfiedStretch = true;
|
||||
const CBaseMeshInfo& baseInfo = chartList[0]->m_baseInfo;
|
||||
float fSumSqrtEiiaii = 0;
|
||||
for (size_t ii=0; ii<chartList.size(); ii++)
|
||||
#pragma omp parallel for
|
||||
for (int ii = 0; ii < chartList.size(); ii++)
|
||||
{
|
||||
float fEii = chartList[ii]->m_fParamStretchL2;
|
||||
float faii = chartList[ii]->m_fChart2DArea;
|
||||
bAllChartSatisfiedStretch =
|
||||
bAllChartSatisfiedStretch =
|
||||
(bAllChartSatisfiedStretch && (fEii == faii));
|
||||
|
||||
fSumSqrtEiiaii += IsochartSqrtf(fEii * faii);
|
||||
auto temp = IsochartSqrtf(fEii * faii); // For better profiling
|
||||
#pragma atomic
|
||||
fSumSqrtEiiaii += temp;
|
||||
}
|
||||
|
||||
if (bAllChartSatisfiedStretch)
|
||||
|
Loading…
Reference in New Issue
Block a user