diff --git a/ApplicationLibCode/CMakeLists.txt b/ApplicationLibCode/CMakeLists.txt index c54a0ba788..f81ac0ed6c 100644 --- a/ApplicationLibCode/CMakeLists.txt +++ b/ApplicationLibCode/CMakeLists.txt @@ -100,6 +100,7 @@ list( ProjectDataModel/CMakeLists_files.cmake ProjectDataModel/AnalysisPlots/CMakeLists_files.cmake ProjectDataModel/CorrelationPlots/CMakeLists_files.cmake + ProjectDataModel/ContourMap/CMakeLists_files.cmake ProjectDataModel/Cloud/CMakeLists_files.cmake ProjectDataModel/Faults/CMakeLists_files.cmake ProjectDataModel/GeoMech/CMakeLists_files.cmake diff --git a/ApplicationLibCode/ProjectDataModel/ContourMap/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/ContourMap/CMakeLists_files.cmake new file mode 100644 index 0000000000..d53d50af92 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/ContourMap/CMakeLists_files.cmake @@ -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}) diff --git a/ApplicationLibCode/ProjectDataModel/ContourMap/RimContourMapResolutionTools.cpp b/ApplicationLibCode/ProjectDataModel/ContourMap/RimContourMapResolutionTools.cpp new file mode 100644 index 0000000000..6eebc41c2c --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/ContourMap/RimContourMapResolutionTools.cpp @@ -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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimContourMapResolutionTools.h" + +#include "cafAppEnum.h" + +namespace caf +{ +template <> +void caf::AppEnum::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; + } +} diff --git a/ApplicationLibCode/ProjectDataModel/ContourMap/RimContourMapResolutionTools.h b/ApplicationLibCode/ProjectDataModel/ContourMap/RimContourMapResolutionTools.h new file mode 100644 index 0000000000..089c5cf90a --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/ContourMap/RimContourMapResolutionTools.h @@ -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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +class RimContourMapResolutionTools +{ +public: + enum class SamplingResolution + { + EXTRA_FINE, + FINE, + BASE, + COARSE, + EXTRA_COARSE + }; + + static double resolutionFromEnumValue( RimContourMapResolutionTools::SamplingResolution resEnumVal ); + +private: + RimContourMapResolutionTools(){}; +}; diff --git a/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.cpp b/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.cpp index 7dee3cd8e5..6b183a404e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.cpp @@ -79,11 +79,16 @@ RimStatisticsContourMap::RimStatisticsContourMap() { 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() ); - CAF_PDM_InitField( &m_relativeSampleSpacing, "SampleSpacing", 2.0, "Sample Spacing Factor" ); - m_relativeSampleSpacing.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); + CAF_PDM_InitFieldNoDefault( &m_resolution, "Resolution", "Sampling Resolution" ); CAF_PDM_InitFieldNoDefault( &m_resultAggregation, "ResultAggregation", "Result Aggregation" ); @@ -130,8 +135,8 @@ void RimStatisticsContourMap::defineUiOrdering( QString uiConfigName, caf::PdmUi auto genGrp = uiOrdering.addNewGroup( "General" ); genGrp->add( &m_resultAggregation ); + genGrp->add( &m_resolution ); genGrp->add( &m_primaryCase ); - genGrp->add( &m_relativeSampleSpacing ); genGrp->add( &m_boundingBoxExpPercent ); auto tsGroup = uiOrdering.addNewGroup( "Time Step Selection" ); @@ -289,16 +294,6 @@ void RimStatisticsContourMap::defineEditorAttribute( const caf::PdmFieldHandle* attrib->m_buttonText = "Compute"; } } - else if ( &m_relativeSampleSpacing == field ) - { - if ( auto myAttr = dynamic_cast( attribute ) ) - { - myAttr->m_minimum = 0.2; - myAttr->m_maximum = 20.0; - myAttr->m_sliderTickCount = 20; - myAttr->m_delaySliderUpdateUntilRelease = true; - } - } else if ( &m_boundingBoxExpPercent == field ) { if ( auto myAttr = dynamic_cast( attribute ) ) @@ -407,7 +402,7 @@ void RimStatisticsContourMap::computeStatistics() double sampleSpacing = 1.0; if ( auto mainGrid = eclipseCase()->mainGrid() ) { - sampleSpacing = m_relativeSampleSpacing * mainGrid->characteristicIJCellSize(); + sampleSpacing = sampleSpacingFactor() * mainGrid->characteristicIJCellSize(); } auto contourMapGrid = std::make_unique( gridBoundingBox, sampleSpacing ); @@ -590,7 +585,7 @@ bool RimStatisticsContourMap::isColumnResult() const //-------------------------------------------------------------------------------------------------- double RimStatisticsContourMap::sampleSpacingFactor() const { - return m_relativeSampleSpacing; + return RimContourMapResolutionTools::resolutionFromEnumValue( m_resolution() ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.h b/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.h index 5a73587c2c..115df9a990 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.h +++ b/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.h @@ -22,6 +22,7 @@ #include "cafPdmChildArrayField.h" #include "cafPdmField.h" +#include "ContourMap/RimContourMapResolutionTools.h" #include "RimContourMapProjection.h" #include @@ -89,7 +90,6 @@ private: void doStatisticsCalculation( std::map>>& timestep_results ); caf::PdmField m_boundingBoxExpPercent; - caf::PdmField m_relativeSampleSpacing; caf::PdmField m_resultAggregation; caf::PdmField> m_selectedTimeSteps; caf::PdmChildField m_resultDefinition; @@ -97,6 +97,8 @@ private: caf::PdmField m_primaryCase; + caf::PdmField> m_resolution; + std::unique_ptr m_contourMapGrid; std::map>> m_timeResults;