mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3941 Slighly improve contour map performance
This commit is contained in:
parent
602bca4ea6
commit
a309ffd1ea
@ -128,6 +128,18 @@ std::vector<cvf::Vec4d> RimContourMapProjection::generateTrianglesWithVertexValu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<std::vector<std::vector<cvf::Vec3d>>> subtractPolygons;
|
||||||
|
if (!m_contourPolygons.empty())
|
||||||
|
{
|
||||||
|
subtractPolygons.resize(m_contourPolygons.size());
|
||||||
|
for (size_t i = 0; i < m_contourPolygons.size() - 1; ++i)
|
||||||
|
{
|
||||||
|
for (size_t j = 0; j < m_contourPolygons[i + 1].size(); ++j)
|
||||||
|
{
|
||||||
|
subtractPolygons[i].push_back(m_contourPolygons[i + 1][j].vertices);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
std::vector<std::vector<cvf::Vec4d>> threadTriangles(omp_get_max_threads());
|
std::vector<std::vector<cvf::Vec4d>> threadTriangles(omp_get_max_threads());
|
||||||
|
|
||||||
#pragma omp parallel
|
#pragma omp parallel
|
||||||
@ -137,7 +149,7 @@ std::vector<cvf::Vec4d> RimContourMapProjection::generateTrianglesWithVertexValu
|
|||||||
|
|
||||||
std::set<int64_t> excludedFaceIndices;
|
std::set<int64_t> excludedFaceIndices;
|
||||||
|
|
||||||
#pragma omp for
|
#pragma omp for schedule(dynamic)
|
||||||
for (int64_t i = 0; i < (int64_t) faceList->size(); i += 3)
|
for (int64_t i = 0; i < (int64_t) faceList->size(); i += 3)
|
||||||
{
|
{
|
||||||
std::vector<cvf::Vec3d> triangle(3);
|
std::vector<cvf::Vec3d> triangle(3);
|
||||||
@ -182,22 +194,14 @@ std::vector<cvf::Vec4d> RimContourMapProjection::generateTrianglesWithVertexValu
|
|||||||
excludedFaceIndices.insert(i);
|
excludedFaceIndices.insert(i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::vector<cvf::Vec3d>> subtractPolygons;
|
|
||||||
if (c < m_contourPolygons.size() - 1)
|
|
||||||
{
|
|
||||||
for (size_t j = 0; j < m_contourPolygons[c + 1].size(); ++j)
|
|
||||||
{
|
|
||||||
subtractPolygons.push_back(m_contourPolygons[c + 1][j].vertices);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
std::vector<std::vector<cvf::Vec3d>> clippedPolygons;
|
std::vector<std::vector<cvf::Vec3d>> clippedPolygons;
|
||||||
|
|
||||||
if (!subtractPolygons.empty())
|
if (!subtractPolygons[c].empty())
|
||||||
{
|
{
|
||||||
for (const std::vector<cvf::Vec3d>& polygon : intersectPolygons)
|
for (const std::vector<cvf::Vec3d>& polygon : intersectPolygons)
|
||||||
{
|
{
|
||||||
std::vector<std::vector<cvf::Vec3d>> fullyClippedPolygons = RigCellGeometryTools::subtractPolygons(polygon, subtractPolygons);
|
std::vector<std::vector<cvf::Vec3d>> fullyClippedPolygons = RigCellGeometryTools::subtractPolygons(polygon, subtractPolygons[c]);
|
||||||
clippedPolygons.insert(clippedPolygons.end(), fullyClippedPolygons.begin(), fullyClippedPolygons.end());
|
clippedPolygons.insert(clippedPolygons.end(), fullyClippedPolygons.begin(), fullyClippedPolygons.end());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user