Refactor the absolute sample spacing

This commit is contained in:
Gaute Lindkvist
2020-09-25 11:48:41 +02:00
parent effc0d4c73
commit 6d37c6239a
6 changed files with 85 additions and 55 deletions

View File

@@ -130,6 +130,19 @@ void RimGeoMechContourMapProjection::updateLegend()
legendConfig()->setTitle( projectionLegendText );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimGeoMechContourMapProjection::sampleSpacing() const
{
RimGeoMechCase* geoMechCase = this->geoMechCase();
if ( geoMechCase )
{
return m_relativeSampleSpacing * geoMechCase->characteristicCellSize();
}
return 0.0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -205,7 +218,6 @@ void RimGeoMechContourMapProjection::updateGridInformation()
RimGeoMechCase* geoMechCase = this->geoMechCase();
m_femPart = geoMechCase->geoMechData()->femParts()->part( 0 );
m_femPartGrid = m_femPart->getOrCreateStructGrid();
m_sampleSpacing = m_relativeSampleSpacing * geoMechCase->characteristicCellSize();
m_femPart->ensureIntersectionSearchTreeIsBuilt();
m_gridBoundingBox = geoMechCase->activeCellsBoundingBox();
@@ -232,8 +244,8 @@ void RimGeoMechContourMapProjection::updateGridInformation()
// Re-jig max point to be an exact multiple of cell size
cvf::Vec3d minPoint = m_expandedBoundingBox.min();
cvf::Vec3d maxPoint = m_expandedBoundingBox.max();
maxPoint.x() = minPoint.x() + m_mapSize.x() * m_sampleSpacing;
maxPoint.y() = minPoint.y() + m_mapSize.y() * m_sampleSpacing;
maxPoint.x() = minPoint.x() + m_mapSize.x() * sampleSpacing();
maxPoint.y() = minPoint.y() + m_mapSize.y() * sampleSpacing();
m_expandedBoundingBox = cvf::BoundingBox( minPoint, maxPoint );
}
@@ -281,7 +293,7 @@ std::vector<bool> RimGeoMechContourMapProjection::getMapCellVisibility()
cvf::Vec3d porExtent = validResBoundingBox.extent();
double radius = std::max( porExtent.x(), porExtent.y() ) * 0.25;
double expansion = m_paddingAroundPorePressureRegion * radius;
size_t cellPadding = std::ceil( expansion / m_sampleSpacing );
size_t cellPadding = std::ceil( expansion / sampleSpacing() );
for ( size_t cellIndex = 0; cellIndex < cellResults.size(); ++cellIndex )
{
if ( !mapCellVisibility[cellIndex] )
@@ -583,13 +595,13 @@ QList<caf::PdmOptionItemInfo>
if ( fieldNeedingOptions == &m_resultAggregation )
{
std::vector<ResultAggregationEnum> validOptions = {RESULTS_TOP_VALUE,
RESULTS_MEAN_VALUE,
RESULTS_GEOM_VALUE,
RESULTS_HARM_VALUE,
RESULTS_MIN_VALUE,
RESULTS_MAX_VALUE,
RESULTS_SUM};
std::vector<ResultAggregationEnum> validOptions = { RESULTS_TOP_VALUE,
RESULTS_MEAN_VALUE,
RESULTS_GEOM_VALUE,
RESULTS_HARM_VALUE,
RESULTS_MIN_VALUE,
RESULTS_MAX_VALUE,
RESULTS_SUM };
for ( ResultAggregationEnum option : validOptions )
{