Change how sampling resolution is specified in statistics contourmap ui

This commit is contained in:
jonjenssen 2025-01-15 20:44:20 +01:00 committed by jonjenssen
parent b999faf293
commit 15428304be
6 changed files with 117 additions and 17 deletions

View File

@ -100,6 +100,7 @@ list(
ProjectDataModel/CMakeLists_files.cmake ProjectDataModel/CMakeLists_files.cmake
ProjectDataModel/AnalysisPlots/CMakeLists_files.cmake ProjectDataModel/AnalysisPlots/CMakeLists_files.cmake
ProjectDataModel/CorrelationPlots/CMakeLists_files.cmake ProjectDataModel/CorrelationPlots/CMakeLists_files.cmake
ProjectDataModel/ContourMap/CMakeLists_files.cmake
ProjectDataModel/Cloud/CMakeLists_files.cmake ProjectDataModel/Cloud/CMakeLists_files.cmake
ProjectDataModel/Faults/CMakeLists_files.cmake ProjectDataModel/Faults/CMakeLists_files.cmake
ProjectDataModel/GeoMech/CMakeLists_files.cmake ProjectDataModel/GeoMech/CMakeLists_files.cmake

View File

@ -0,0 +1,11 @@
set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RimContourMapResolutionTools.h
)
set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RimContourMapResolutionTools.cpp
)
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
list(APPEND CODE_SOURCE_FILES ${SOURCE_GROUP_SOURCE_FILES})

View File

@ -0,0 +1,56 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2025 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimContourMapResolutionTools.h"
#include "cafAppEnum.h"
namespace caf
{
template <>
void caf::AppEnum<RimContourMapResolutionTools::SamplingResolution>::setUp()
{
addItem( RimContourMapResolutionTools::SamplingResolution::EXTRA_FINE, "Extra Fine", "Extra Fine" );
addItem( RimContourMapResolutionTools::SamplingResolution::FINE, "Fine", "Fine" );
addItem( RimContourMapResolutionTools::SamplingResolution::BASE, "Base", "Normal" );
addItem( RimContourMapResolutionTools::SamplingResolution::COARSE, "Coarse", "Coarse" );
addItem( RimContourMapResolutionTools::SamplingResolution::EXTRA_COARSE, "Extra Coarse", "Extra Coarse" );
setDefault( RimContourMapResolutionTools::SamplingResolution::BASE );
}
}; // namespace caf
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimContourMapResolutionTools::resolutionFromEnumValue( SamplingResolution resEnumVal )
{
switch ( resEnumVal )
{
case RimContourMapResolutionTools::SamplingResolution::EXTRA_FINE:
return 0.5;
case RimContourMapResolutionTools::SamplingResolution::FINE:
return 1.0;
case RimContourMapResolutionTools::SamplingResolution::COARSE:
return 5.0;
case RimContourMapResolutionTools::SamplingResolution::EXTRA_COARSE:
return 8.0;
case RimContourMapResolutionTools::SamplingResolution::BASE:
default:
return 2.0;
}
}

View File

@ -0,0 +1,35 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2025 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
class RimContourMapResolutionTools
{
public:
enum class SamplingResolution
{
EXTRA_FINE,
FINE,
BASE,
COARSE,
EXTRA_COARSE
};
static double resolutionFromEnumValue( RimContourMapResolutionTools::SamplingResolution resEnumVal );
private:
RimContourMapResolutionTools(){};
};

View File

@ -79,11 +79,16 @@ RimStatisticsContourMap::RimStatisticsContourMap()
{ {
CAF_PDM_InitObject( "Statistics Contour Map", ":/Histogram16x16.png" ); CAF_PDM_InitObject( "Statistics Contour Map", ":/Histogram16x16.png" );
CAF_PDM_InitField( &m_boundingBoxExpPercent, "BoundingBoxExpPercent", 5.0, "Bounding Box Expansion (%)" ); CAF_PDM_InitField( &m_boundingBoxExpPercent,
"BoundingBoxExpPercent",
5.0,
"Bounding Box Expansion (%)",
"",
"How much to increase the bounding box of the primary case to cover for any grid size differences across the "
"ensemble." );
m_boundingBoxExpPercent.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); m_boundingBoxExpPercent.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
CAF_PDM_InitField( &m_relativeSampleSpacing, "SampleSpacing", 2.0, "Sample Spacing Factor" ); CAF_PDM_InitFieldNoDefault( &m_resolution, "Resolution", "Sampling Resolution" );
m_relativeSampleSpacing.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
CAF_PDM_InitFieldNoDefault( &m_resultAggregation, "ResultAggregation", "Result Aggregation" ); CAF_PDM_InitFieldNoDefault( &m_resultAggregation, "ResultAggregation", "Result Aggregation" );
@ -130,8 +135,8 @@ void RimStatisticsContourMap::defineUiOrdering( QString uiConfigName, caf::PdmUi
auto genGrp = uiOrdering.addNewGroup( "General" ); auto genGrp = uiOrdering.addNewGroup( "General" );
genGrp->add( &m_resultAggregation ); genGrp->add( &m_resultAggregation );
genGrp->add( &m_resolution );
genGrp->add( &m_primaryCase ); genGrp->add( &m_primaryCase );
genGrp->add( &m_relativeSampleSpacing );
genGrp->add( &m_boundingBoxExpPercent ); genGrp->add( &m_boundingBoxExpPercent );
auto tsGroup = uiOrdering.addNewGroup( "Time Step Selection" ); auto tsGroup = uiOrdering.addNewGroup( "Time Step Selection" );
@ -289,16 +294,6 @@ void RimStatisticsContourMap::defineEditorAttribute( const caf::PdmFieldHandle*
attrib->m_buttonText = "Compute"; attrib->m_buttonText = "Compute";
} }
} }
else if ( &m_relativeSampleSpacing == field )
{
if ( auto myAttr = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>( attribute ) )
{
myAttr->m_minimum = 0.2;
myAttr->m_maximum = 20.0;
myAttr->m_sliderTickCount = 20;
myAttr->m_delaySliderUpdateUntilRelease = true;
}
}
else if ( &m_boundingBoxExpPercent == field ) else if ( &m_boundingBoxExpPercent == field )
{ {
if ( auto myAttr = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>( attribute ) ) if ( auto myAttr = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>( attribute ) )
@ -407,7 +402,7 @@ void RimStatisticsContourMap::computeStatistics()
double sampleSpacing = 1.0; double sampleSpacing = 1.0;
if ( auto mainGrid = eclipseCase()->mainGrid() ) if ( auto mainGrid = eclipseCase()->mainGrid() )
{ {
sampleSpacing = m_relativeSampleSpacing * mainGrid->characteristicIJCellSize(); sampleSpacing = sampleSpacingFactor() * mainGrid->characteristicIJCellSize();
} }
auto contourMapGrid = std::make_unique<RigContourMapGrid>( gridBoundingBox, sampleSpacing ); auto contourMapGrid = std::make_unique<RigContourMapGrid>( gridBoundingBox, sampleSpacing );
@ -590,7 +585,7 @@ bool RimStatisticsContourMap::isColumnResult() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
double RimStatisticsContourMap::sampleSpacingFactor() const double RimStatisticsContourMap::sampleSpacingFactor() const
{ {
return m_relativeSampleSpacing; return RimContourMapResolutionTools::resolutionFromEnumValue( m_resolution() );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -22,6 +22,7 @@
#include "cafPdmChildArrayField.h" #include "cafPdmChildArrayField.h"
#include "cafPdmField.h" #include "cafPdmField.h"
#include "ContourMap/RimContourMapResolutionTools.h"
#include "RimContourMapProjection.h" #include "RimContourMapProjection.h"
#include <map> #include <map>
@ -89,7 +90,6 @@ private:
void doStatisticsCalculation( std::map<size_t, std::vector<std::vector<double>>>& timestep_results ); void doStatisticsCalculation( std::map<size_t, std::vector<std::vector<double>>>& timestep_results );
caf::PdmField<double> m_boundingBoxExpPercent; caf::PdmField<double> m_boundingBoxExpPercent;
caf::PdmField<double> m_relativeSampleSpacing;
caf::PdmField<RimContourMapProjection::ResultAggregation> m_resultAggregation; caf::PdmField<RimContourMapProjection::ResultAggregation> m_resultAggregation;
caf::PdmField<std::vector<int>> m_selectedTimeSteps; caf::PdmField<std::vector<int>> m_selectedTimeSteps;
caf::PdmChildField<RimEclipseResultDefinition*> m_resultDefinition; caf::PdmChildField<RimEclipseResultDefinition*> m_resultDefinition;
@ -97,6 +97,8 @@ private:
caf::PdmField<QString> m_primaryCase; caf::PdmField<QString> m_primaryCase;
caf::PdmField<caf::AppEnum<RimContourMapResolutionTools::SamplingResolution>> m_resolution;
std::unique_ptr<RigContourMapGrid> m_contourMapGrid; std::unique_ptr<RigContourMapGrid> m_contourMapGrid;
std::map<size_t, std::map<StatisticsType, std::vector<double>>> m_timeResults; std::map<size_t, std::map<StatisticsType, std::vector<double>>> m_timeResults;