#4210 Fix crash when creating contour map

This commit is contained in:
Gaute Lindkvist committed 2019-03-22 09:28:47 +01:00
1 parent 64fc6447f4
commit 4c3c01a661
7 files changed
+82 -42

No files matched your search

@@ -724,14 +724,12 @@ std::pair<double, double> RimContourMapProjection::minmaxValuesAllTimeSteps()
{
clearTimeStepRange();
m_minResultAllTimeSteps = std::min(m_minResultAllTimeSteps, minValue(m_aggregatedResults));
m_maxResultAllTimeSteps = std::max(m_maxResultAllTimeSteps, maxValue(m_aggregatedResults));
for (int i = 0; i < (int)baseView()->ownerCase()->timeStepStrings().size() - 1; ++i)
{
if (i == m_currentResultTimestep)
{
m_minResultAllTimeSteps = std::min(m_minResultAllTimeSteps, minValue(m_aggregatedResults));
m_maxResultAllTimeSteps = std::max(m_maxResultAllTimeSteps, maxValue(m_aggregatedResults));
}
else
if (i != m_currentResultTimestep)
{
std::vector<double> aggregatedResults = generateResults(i);
m_minResultAllTimeSteps = std::min(m_minResultAllTimeSteps, minValue(aggregatedResults));
@@ -1078,8 +1076,6 @@ void RimContourMapProjection::generateContourPolygons()
{
std::vector<ContourPolygons> contourPolygons;
const double simplifyEpsilon = m_smoothContourLines() ? 5.0e-2 * m_sampleSpacing : 1.0e-3 * m_sampleSpacing;
std::vector<double> contourLevels;
if (resultRangeIsValid() && legendConfig()->mappingMode() != RimRegularLegendConfig::CATEGORY_INTEGER)
{
@@ -1101,6 +1097,17 @@ void RimContourMapProjection::generateContourPolygons()
contourLevels.front() *= 0.5;
}
double simplifyEpsilon = m_smoothContourLines() ? 5.0e-2 * m_sampleSpacing : 1.0e-3 * m_sampleSpacing;
if (nContourLevels >= 10)
{
simplifyEpsilon *= 2.0;
}
if (numberOfCells() > 100000)
{
simplifyEpsilon *= 2.0;
}
std::vector<caf::ContourLines::ListOfLineSegments> unorderedLineSegmentsPerLevel =
caf::ContourLines::create(m_aggregatedVertexResults, xVertexPositions(), yVertexPositions(), contourLevels);
@@ -202,7 +202,11 @@ std::vector<double> RimEclipseContourMapProjection::generateResults(int timeStep
else
{
m_currentResultName = cellColors->resultVariable();
gridResultValues = resultData->cellScalarResults(RigEclipseResultAddress( cellColors->resultType(), cellColors->resultVariable()), timeStep);
RigEclipseResultAddress resAddr(cellColors->resultType(), cellColors->resultVariable());
if (resAddr.isValid() && resultData->hasResultEntry(resAddr))
{
gridResultValues = resultData->cellScalarResults(resAddr, timeStep);
}
}
if (!gridResultValues.empty())
@@ -393,11 +397,13 @@ double RimEclipseContourMapProjection::calculateOverlapVolume(size_t globalCellI
localGrid->cellCornerVertices(localCellIdx, hexCorners.data());
cvf::BoundingBox overlapBBox;
std::array<cvf::Vec3d, 8> overlapCorners =
RigCellGeometryTools::estimateHexOverlapWithBoundingBox(hexCorners, bbox, &overlapBBox);
double overlapVolume = RigCellGeometryTools::calculateCellVolume(overlapCorners);
return overlapVolume;
std::array<cvf::Vec3d, 8> overlapCorners;
if (RigCellGeometryTools::estimateHexOverlapWithBoundingBox(hexCorners, bbox, &overlapCorners, &overlapBBox))
{
double overlapVolume = RigCellGeometryTools::calculateCellVolume(overlapCorners);
return overlapVolume;
}
return 0.0;
}
//--------------------------------------------------------------------------------------------------
@@ -427,11 +427,13 @@ double RimGeoMechContourMapProjection::calculateOverlapVolume(size_t
m_femPartGrid->cellCornerVertices(globalCellIdx, hexCorners.data());
cvf::BoundingBox overlapBBox;
std::array<cvf::Vec3d, 8> overlapCorners =
RigCellGeometryTools::estimateHexOverlapWithBoundingBox(hexCorners, bbox, &overlapBBox);
double overlapVolume = RigCellGeometryTools::calculateCellVolume(overlapCorners);
return overlapVolume;
std::array<cvf::Vec3d, 8> overlapCorners;
if (RigCellGeometryTools::estimateHexOverlapWithBoundingBox(hexCorners, bbox, &overlapCorners, &overlapBBox))
{
double overlapVolume = RigCellGeometryTools::calculateCellVolume(overlapCorners);
return overlapVolume;
}
return 0.0;
}
//--------------------------------------------------------------------------------------------------