#3634 Regression Test : Use flag to control OpenMP when building geometry

This commit is contained in:
Magne Sjaastad
2018-11-12 07:33:08 +01:00
parent ca07e710c6
commit cfbbcacc23
7 changed files with 91 additions and 45 deletions

View File

@@ -172,8 +172,9 @@ bool CellRangeFilter::hasIncludeRanges() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
StructGridGeometryGenerator::StructGridGeometryGenerator(const StructGridInterface* grid)
: m_grid(grid)
StructGridGeometryGenerator::StructGridGeometryGenerator(const StructGridInterface* grid, bool useOpenMP)
: m_grid(grid),
m_useOpenMP(useOpenMP)
{
CVF_ASSERT(grid);
m_quadMapper = new StructGridQuadToCellFaceMapper;
@@ -373,7 +374,7 @@ void StructGridGeometryGenerator::computeArrays()
cvf::Vec3d offset = m_grid->displayModelOffset();
#pragma omp parallel for schedule(dynamic)
#pragma omp parallel for schedule(dynamic) if (m_useOpenMP)
for (int k = 0; k < static_cast<int>(m_grid->cellCountK()); k++)
{
size_t j;

View File

@@ -164,7 +164,7 @@ private:
class StructGridGeometryGenerator : public Object
{
public:
explicit StructGridGeometryGenerator(const StructGridInterface* grid);
explicit StructGridGeometryGenerator(const StructGridInterface* grid, bool useOpenMP);
~StructGridGeometryGenerator();
// Setup methods
@@ -209,6 +209,11 @@ private:
// Mappings
ref<StructGridQuadToCellFaceMapper> m_quadMapper;
ref<StuctGridTriangleToCellFaceMapper> m_triangleMapper;
// Multiple treads can be used when building geometry data structures.
// This causes visual artifacts due to transparency algorithm, and a stable visual image
// can be produced if OpenMP is disabled. Currently used by regression test comparing images
bool m_useOpenMP;
};
}