2d Maps: Remove volume adjustment code with little effect.

This commit is contained in:
Gaute Lindkvist 2018-11-13 14:31:08 +01:00
parent a8feee287c
commit 052b3e0c7c

View File

@ -684,9 +684,6 @@ std::vector<std::pair<size_t, double>> RimContourMapProjection::visibleCellsAndO
KLayerCellWeightMap matchingVisibleCellsWeightPerKLayer;
std::array<cvf::Vec3d, 8> hexCorners;
double sumOverlapVolumes = 0.0;
double maxHeight = -std::numeric_limits<double>::infinity();
double minHeight = std::numeric_limits<double>::infinity();
for (size_t globalCellIdx : allCellIndices)
{
if ((*m_cellGridIdxVisibility)[globalCellIdx])
@ -723,43 +720,18 @@ std::vector<std::pair<size_t, double>> RimContourMapProjection::visibleCellsAndO
}
if (weight > 0.0)
{
double height = overlapBBox.max().z();
matchingVisibleCellsWeightPerKLayer[k].push_back(std::make_pair(globalCellIdx, weight));
sumOverlapVolumes += overlapVolume;
maxHeight = std::max(maxHeight, height);
minHeight = std::min(minHeight, overlapBBox.min().z());
}
}
}
}
double volAdjustmentFactor = 1.0;
if (sumOverlapVolumes > 0.0)
{
cvf::Vec3d improvedBottomSwCorner = bottomSWCorner;
improvedBottomSwCorner.z() = minHeight;
cvf::Vec3d improvedTopNECorner = topNECorner;
improvedTopNECorner.z() = maxHeight;
cvf::BoundingBox improvedBbox2dElement = cvf::BoundingBox(improvedBottomSwCorner, improvedTopNECorner);
cvf::Vec3d improvedBboxExtent = improvedBbox2dElement.extent();
double improvedBboxVolume = improvedBboxExtent.x() * improvedBboxExtent.y() * improvedBboxExtent.z();
if (sumOverlapVolumes > improvedBboxVolume)
{
// Total volume weights for 2d Element should never be larger than the volume of the extruded 2d element.
volAdjustmentFactor = improvedBboxVolume / sumOverlapVolumes;
}
}
std::vector<std::pair<size_t, double>> matchingVisibleCellsAndWeight;
for (auto kLayerCellWeight : matchingVisibleCellsWeightPerKLayer)
{
for (auto cellWeight : kLayerCellWeight.second)
{
matchingVisibleCellsAndWeight.push_back(std::make_pair(cellWeight.first, cellWeight.second * volAdjustmentFactor));
matchingVisibleCellsAndWeight.push_back(std::make_pair(cellWeight.first, cellWeight.second));
}
}