diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp index 7ef5ea598f..e50836cc85 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp @@ -66,7 +66,7 @@ CAF_PDM_SOURCE_INIT( RimEclipseStatisticsCase, "RimStatisticalCalculation" ); RimEclipseStatisticsCase::RimEclipseStatisticsCase() : RimEclipseCase() { - CAF_PDM_InitObject( "Case Group Statistics", ":/Histogram16x16.png" ); + CAF_PDM_InitScriptableObject( "Case Group Statistics", ":/Histogram16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_calculateEditCommand, "m_editingAllowed", "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &m_calculateEditCommand ); @@ -202,6 +202,44 @@ void RimEclipseStatisticsCase::populateResultSelectionAfterLoadingGrid() m_populateSelectionAfterLoadingGrid = true; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseStatisticsCase::setSourceProperties( RiaDefines::ResultCatType propertyType, const std::vector& propertyNames ) +{ + switch ( propertyType ) + { + case RiaDefines::ResultCatType::DYNAMIC_NATIVE: + m_selectedDynamicProperties = propertyNames; + break; + case RiaDefines::ResultCatType::STATIC_NATIVE: + m_selectedStaticProperties = propertyNames; + break; + case RiaDefines::ResultCatType::SOURSIMRL: + break; + case RiaDefines::ResultCatType::GENERATED: + m_selectedGeneratedProperties = propertyNames; + break; + case RiaDefines::ResultCatType::INPUT_PROPERTY: + m_selectedInputProperties = propertyNames; + break; + case RiaDefines::ResultCatType::FORMATION_NAMES: + break; + case RiaDefines::ResultCatType::ALLAN_DIAGRAMS: + break; + case RiaDefines::ResultCatType::FLOW_DIAGNOSTICS: + break; + case RiaDefines::ResultCatType::INJECTION_FLOODING: + break; + case RiaDefines::ResultCatType::REMOVED: + break; + case RiaDefines::ResultCatType::UNDEFINED: + break; + default: + break; + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.h b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.h index e1a660b278..1bade5cb64 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.h +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.h @@ -74,6 +74,8 @@ public: void populateResultSelectionAfterLoadingGrid(); + void setSourceProperties( RiaDefines::ResultCatType propertyType, const std::vector& propertyNames ); + private: void scheduleACTIVEGeometryRegenOnReservoirViews(); diff --git a/ApplicationLibCode/ProjectDataModelCommands/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModelCommands/CMakeLists_files.cmake index 9799f85800..cc717830d2 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModelCommands/CMakeLists_files.cmake @@ -24,6 +24,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RimcThermalFractureTemplate.h ${CMAKE_CURRENT_LIST_DIR}/RimcIntersection.h ${CMAKE_CURRENT_LIST_DIR}/RimcEclipseCase.h + ${CMAKE_CURRENT_LIST_DIR}/RimcEclipseStatisticsCase.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -52,6 +53,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimcThermalFractureTemplate.cpp ${CMAKE_CURRENT_LIST_DIR}/RimcIntersection.cpp ${CMAKE_CURRENT_LIST_DIR}/RimcEclipseCase.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimcEclipseStatisticsCase.cpp ) list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcEclipseStatisticsCase.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcEclipseStatisticsCase.cpp new file mode 100644 index 0000000000..2d1432fe9a --- /dev/null +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcEclipseStatisticsCase.cpp @@ -0,0 +1,148 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2020- 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 "RimcEclipseStatisticsCase.h" + +#include "RiaApplication.h" +#include "RiaGuiApplication.h" + +#include "RicImportSummaryCasesFeature.h" + +/* +#include "RimEclipseCase.h" +#include "RimFileSummaryCase.h" +#include "RimOilField.h" +#include "RimProject.h" +#include "RimSummaryCase.h" +#include "RimSurfaceCollection.h" +#include "RiuPlotMainWindow.h" +*/ + +#include "RiaLogging.h" +#include "RimEclipseStatisticsCase.h" +#include "cafPdmFieldScriptingCapability.h" + +/* +#include +#include + +#include +*/ + +CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimEclipseStatisticsCase, RimcEclipseStatisticsCase_defineSourceProperties, "set_source_result" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimcEclipseStatisticsCase_defineSourceProperties::RimcEclipseStatisticsCase_defineSourceProperties( caf::PdmObjectHandle* self ) + : caf::PdmObjectMethod( self ) +{ + CAF_PDM_InitObject( "Define Source Properties" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_propertyType, "PropertyType", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_propertyNames, "PropertyNames", "" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +caf::PdmObjectHandle* RimcEclipseStatisticsCase_defineSourceProperties::execute() +{ + RiaDefines::ResultCatType myEnum = caf::AppEnum::fromText( m_propertyType() ); + + if ( myEnum == RiaDefines::ResultCatType::DYNAMIC_NATIVE || myEnum == RiaDefines::ResultCatType::STATIC_NATIVE || + myEnum == RiaDefines::ResultCatType::INPUT_PROPERTY || myEnum == RiaDefines::ResultCatType::GENERATED ) + { + auto eclipseCase = self(); + eclipseCase->setSourceProperties( myEnum, m_propertyNames ); + } + else + { + RiaLogging::error( "Wrong result type. Supported types are DYNAMIC_NATIVE, STATIC_NATIVE, INPUT_PROPERTY, GENERATED" ); + } + + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimcEclipseStatisticsCase_defineSourceProperties::resultIsPersistent() const +{ + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::unique_ptr RimcEclipseStatisticsCase_defineSourceProperties::defaultResult() const +{ + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimcEclipseStatisticsCase_defineSourceProperties::isNullptrValidResult() const +{ + return true; +} + +CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimEclipseStatisticsCase, RimcEclipseStatisticsCase_computeStatistics, "compute_statistics" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimcEclipseStatisticsCase_computeStatistics::RimcEclipseStatisticsCase_computeStatistics( caf::PdmObjectHandle* self ) + : caf::PdmObjectMethod( self ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +caf::PdmObjectHandle* RimcEclipseStatisticsCase_computeStatistics::execute() +{ + auto eclipseCase = self(); + eclipseCase->computeStatistics(); + + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimcEclipseStatisticsCase_computeStatistics::resultIsPersistent() const +{ + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::unique_ptr RimcEclipseStatisticsCase_computeStatistics::defaultResult() const +{ + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimcEclipseStatisticsCase_computeStatistics::isNullptrValidResult() const +{ + return true; +} diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcEclipseStatisticsCase.h b/ApplicationLibCode/ProjectDataModelCommands/RimcEclipseStatisticsCase.h new file mode 100644 index 0000000000..dcc29a767f --- /dev/null +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcEclipseStatisticsCase.h @@ -0,0 +1,63 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2020- 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. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafPdmField.h" +#include "cafPdmObjectHandle.h" +#include "cafPdmObjectMethod.h" + +#include + +#include + +//================================================================================================== +/// +//================================================================================================== +class RimcEclipseStatisticsCase_defineSourceProperties : public caf::PdmObjectMethod +{ + CAF_PDM_HEADER_INIT; + +public: + RimcEclipseStatisticsCase_defineSourceProperties( caf::PdmObjectHandle* self ); + + caf::PdmObjectHandle* execute() override; + bool resultIsPersistent() const override; + std::unique_ptr defaultResult() const override; + bool isNullptrValidResult() const override; + +private: + caf::PdmField m_propertyType; + caf::PdmField> m_propertyNames; +}; + +//================================================================================================== +/// +//================================================================================================== +class RimcEclipseStatisticsCase_computeStatistics : public caf::PdmObjectMethod +{ + CAF_PDM_HEADER_INIT; + +public: + RimcEclipseStatisticsCase_computeStatistics( caf::PdmObjectHandle* self ); + + caf::PdmObjectHandle* execute() override; + bool resultIsPersistent() const override; + std::unique_ptr defaultResult() const override; + bool isNullptrValidResult() const override; +};