From 300dbdebc75cbc1d26d3a44a53e1ca4876763599 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 27 Sep 2024 12:47:15 +0200 Subject: [PATCH 001/160] Bump to 2024.09.1-dev.01 --- ResInsightVersion.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index e965c61016..0896fdd773 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -1,17 +1,17 @@ set(RESINSIGHT_MAJOR_VERSION 2024) set(RESINSIGHT_MINOR_VERSION 09) -set(RESINSIGHT_PATCH_VERSION 0) +set(RESINSIGHT_PATCH_VERSION 1) # Opional text with no restrictions -#set(RESINSIGHT_VERSION_TEXT "-dev") +set(RESINSIGHT_VERSION_TEXT "-dev") #set(RESINSIGHT_VERSION_TEXT "-RC") # Optional text # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -#set(RESINSIGHT_DEV_VERSION ".03") +set(RESINSIGHT_DEV_VERSION ".01") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") From 69d947309ae08c7a17b4e6c25414229dc8e34c61 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 16 Sep 2024 08:53:19 +0200 Subject: [PATCH 002/160] Ubuntu 24.04 support: modernize pip install, and silence gcc 13 warnings. --- CMakeLists.txt | 13 ++++++++++--- GrpcInterface/CMakeLists.txt | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a7e68405de..9378325474 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,9 +56,16 @@ elseif(MSVC) endif() if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - set(CMAKE_CXX_FLAGS - "-DCVF_LINUX -pipe -Wextra -Woverloaded-virtual -Wformat -Wno-unused-parameter" - ) + if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + set(CMAKE_CXX_FLAGS + "-DCVF_LINUX -pipe -Wextra -Woverloaded-virtual -Wformat -Wno-unused-parameter" + ) + + else() + set(CMAKE_CXX_FLAGS + "-DCVF_LINUX -pipe -Wextra -Woverloaded-virtual -Wformat -Wno-unused-parameter -Wno-array-bounds -Wno-dangling-reference -Wno-stringop-overflow" + ) + endif() set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -g3 -O0 -DDEBUG -D_DEBUG") set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNO_DEBUG") endif() diff --git a/GrpcInterface/CMakeLists.txt b/GrpcInterface/CMakeLists.txt index 6b296dd382..e65a2fecf4 100644 --- a/GrpcInterface/CMakeLists.txt +++ b/GrpcInterface/CMakeLists.txt @@ -250,7 +250,7 @@ if(RESINSIGHT_GRPC_PYTHON_EXECUTABLE AND RESINSIGHT_GRPC_DOWNLOAD_PYTHON_MODULE) message(STATUS "Installing Python modules (dev-requirements.txt)") add_custom_command( TARGET PipInstall - COMMAND ${RESINSIGHT_GRPC_PYTHON_EXECUTABLE} ARGS -m pip install -r ${GRPC_PYTHON_SOURCE_PATH}/dev-requirements.txt --user ) + COMMAND ${RESINSIGHT_GRPC_PYTHON_EXECUTABLE} ARGS -m pip install -r ${GRPC_PYTHON_SOURCE_PATH}/dev-requirements.txt ) endif() if(RESINSIGHT_GRPC_PYTHON_EXECUTABLE AND RESINSIGHT_GRPC_BUNDLE_PYTHON_MODULE) From 596ab564c8e93ccf54a7d3b6b77da50aecdb7c55 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 20 Sep 2024 12:58:00 +0200 Subject: [PATCH 003/160] Fix "nonnull asserts" warnings on gcc 13. The C++ standard guarantees that the this pointer is never nullptr in valid programs. --- Fwk/VizFwk/LibCore/cvfObject.inl | 2 -- 1 file changed, 2 deletions(-) diff --git a/Fwk/VizFwk/LibCore/cvfObject.inl b/Fwk/VizFwk/LibCore/cvfObject.inl index 10b8876155..e733187aa9 100644 --- a/Fwk/VizFwk/LibCore/cvfObject.inl +++ b/Fwk/VizFwk/LibCore/cvfObject.inl @@ -70,7 +70,6 @@ inline Object::~Object() //-------------------------------------------------------------------------------------------------- inline int Object::addRef() const { - CVF_TIGHT_ASSERT(this); return ++m_refCount; } @@ -103,7 +102,6 @@ inline int Object::release() const //-------------------------------------------------------------------------------------------------- inline int Object::refCount() const { - CVF_TIGHT_ASSERT(this); return m_refCount; } From 212f5bf5aea3dea5f83b6eec8339c24c93923cd9 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 30 Sep 2024 11:21:17 +0200 Subject: [PATCH 004/160] Add support for Qt6 and disable Qt5 Required changes to use Qt6 and disable support for Qt5. There are still some adjustments related to Qt6 to be done, but these changes are not required to make Qt6 compile on relevant systems. * Build system changes Qt6 * Override enterEvent * Update QKeySequence * QtChart changes * Use QScreen to instepct dotsPerInch * Add app->quit() * Required updates for code related to QString * Use RiaQDateTimeTools * Required changes related to regular expressions * Support compile on Qt < 6.5 When version < 6.5 is found, qt_generate_deploy_app_script() is disabled. Compilation of ResInsight will work, but the install target will be incomplete. * Octave: add missing header. * Qt Advanced Docking: force Qt6 where both Qt5 and Qt6 is available. --------- Co-authored-by: magnesj <1793152+magnesj@users.noreply.github.com> Co-authored-by: Kristian Bendiksen --- .github/workflows/ResInsightWithCache.yml | 19 +- .gitignore | 4 +- ApplicationExeCode/CMakeLists.txt | 311 +++++------------- .../Application/RiaFontCache.cpp | 5 +- .../Application/RiaGuiApplication.cpp | 13 +- .../Application/Tools/RiaColorTools.cpp | 12 +- .../Application/Tools/RiaTextStringTools.cpp | 57 +++- .../Application/Tools/RiaTextStringTools.h | 6 + ApplicationLibCode/CMakeLists.txt | 86 +++-- .../RicExitApplicationFeature.cpp | 5 + ApplicationLibCode/Commands/CMakeLists.txt | 24 +- .../RicCreateDepthAdjustedLasFilesImpl.cpp | 6 +- .../HoloLensCommands/VdeVizDataExtractor.cpp | 2 +- .../Commands/RicRecursiveFileSearchDialog.cpp | 17 +- .../RifCaseRealizationParametersReader.cpp | 13 +- .../FileInterface/RifCsvUserDataParser.cpp | 8 +- .../RifEclipseSummaryAddress.cpp | 6 +- .../FileInterface/RifFileParseTools.cpp | 5 +- .../FileInterface/RifParameterXmlReader.cpp | 12 +- .../FileInterface/RifReaderEclipseRft.cpp | 3 +- .../FileInterface/RifStimPlanXmlReader.cpp | 57 ++-- .../FileInterface/RifWellPathImporter.cpp | 4 +- .../RimWellPathCompletionSettings.h | 2 + .../GeoMech/RimGeoMechResultDefinition.cpp | 2 +- .../ProjectDataModel/RimStatisticsPlot.cpp | 2 - .../RigReservoirBuilderMock.cpp | 2 + .../SocketInterface/RiaSocketServerDefines.h | 2 + ApplicationLibCode/UnitTests/CMakeLists.txt | 4 +- .../UnitTests/RiaStdStringTools-Test.cpp | 2 +- .../UnitTests/RiaTextFileCompare-Test.cpp | 6 +- .../UnitTests/RimWellPathCompletions-Test.cpp | 2 + .../UserInterface/RiuQtChartView.cpp | 8 +- .../UserInterface/RiuQtChartView.h | 2 +- .../UserInterface/RiuQtChartsPlotCurve.cpp | 40 +-- .../UserInterface/RiuQtChartsPlotCurve.h | 17 +- .../RiuQtChartsPlotCurveSymbol.cpp | 6 +- .../RiuQtChartsPlotCurveSymbol.h | 8 +- .../UserInterface/RiuQtChartsPlotWidget.cpp | 2 - .../UserInterface/RiuQtChartsPlotWidget.h | 53 ++- .../UserInterface/RiuQtChartsToolTip.cpp | 4 +- .../UserInterface/RiuQtChartsToolTip.h | 20 +- .../UserInterface/RiuTreeViewEventFilter.cpp | 4 +- .../UserInterface/RiuViewer.cpp | 2 +- ApplicationLibCode/UserInterface/RiuViewer.h | 2 +- CMakeLists.txt | 82 ++--- CMakePresets.json | 19 ++ CMakeUserPresets-example.json | 45 +++ .../cafTestApplication/CMakeLists.txt | 1 - Fwk/AppFwk/cafViewer/CMakeLists.txt | 2 + GrpcInterface/CMakeLists.txt | 9 - .../CMakeLists.txt | 4 +- 51 files changed, 499 insertions(+), 530 deletions(-) create mode 100644 CMakePresets.json create mode 100644 CMakeUserPresets-example.json diff --git a/.github/workflows/ResInsightWithCache.yml b/.github/workflows/ResInsightWithCache.yml index 81de5064ad..964c0ba1fd 100644 --- a/.github/workflows/ResInsightWithCache.yml +++ b/.github/workflows/ResInsightWithCache.yml @@ -37,7 +37,8 @@ jobs: publish-to-pypi: false, vcpkg-bootstrap: bootstrap-vcpkg.bat, vcpkg-triplet: x64-windows-release, - qt-version: 5.12.12, + qt-version: 6.7.0, + ri-unit-test-path: "ResInsight-tests", } - { name: "Ubuntu 22.04 gcc", @@ -51,7 +52,8 @@ jobs: publish-to-pypi: true, vcpkg-bootstrap: bootstrap-vcpkg.sh, vcpkg-triplet: x64-linux-release, - qt-version: 5.12.12, + qt-version: 6.7.0, + ri-unit-test-path: "ResInsight-tests", } - { name: "Ubuntu 22.04 clang-16", @@ -65,7 +67,8 @@ jobs: publish-to-pypi: false, vcpkg-bootstrap: bootstrap-vcpkg.sh, vcpkg-triplet: x64-linux-release, - qt-version: 5.12.12, + qt-version: 6.7.0, + ri-unit-test-path: "ResInsight-tests", } steps: - name: Checkout @@ -95,6 +98,8 @@ jobs: - name: Use CMake uses: lukka/get-cmake@latest + with: + cmakeVersion: "~3.28.0" - name: Use MSVC (Windows) uses: ilammy/msvc-dev-cmd@v1 @@ -178,7 +183,7 @@ jobs: version: ${{ matrix.config.qt-version }} dir: "${{ github.workspace }}/Qt/" cache: true - modules: "qtnetworkauth" + modules: "qtnetworkauth qtcharts qt5compat" - name: Export GitHub Actions cache environment variables uses: actions/github-script@v7 @@ -226,7 +231,9 @@ jobs: if: matrix.config.execute-unit-tests shell: bash run: | - cmakebuild/ApplicationLibCode/UnitTests/ResInsight-tests + echo "Content of unit test folder " + ls cmakebuild/${{ matrix.config.ri-unit-test-path }} + cmakebuild/${{ matrix.config.ri-unit-test-path }} - name: (Python) Check types using mypy if: matrix.config.build-python-module @@ -239,7 +246,7 @@ jobs: - name: Run pytest if: matrix.config.execute-pytests env: - RESINSIGHT_EXECUTABLE: ${{ runner.workspace }}/ResInsight/cmakebuild/ApplicationExeCode/ResInsight + RESINSIGHT_EXECUTABLE: ${{ runner.workspace }}/ResInsight/cmakebuild/ResInsight run: | cd GrpcInterface/Python python setup.py sdist diff --git a/.gitignore b/.gitignore index 1d10c73f7c..4427822bbe 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,7 @@ CMakeCache.txt cmake_install.cmake CPack*.cmake CTest*.cmake -cmakebuild/ +cmakebuild*/ #Unit test binaries *_UnitTests @@ -64,7 +64,7 @@ out build CMakeSettings.json enc_temp_folder -CMakePresets.json +CMakeUserPresets.json #Visual Studio Code files .vscode diff --git a/ApplicationExeCode/CMakeLists.txt b/ApplicationExeCode/CMakeLists.txt index 28ba766559..df72302909 100644 --- a/ApplicationExeCode/CMakeLists.txt +++ b/ApplicationExeCode/CMakeLists.txt @@ -19,41 +19,36 @@ endif() # Open GL find_package(OpenGL) -find_package(Qt5 ${RI_QT_MINIMUM_VERSION} COMPONENTS Core) - -if(Qt5Core_FOUND) - find_package( - Qt5 ${RI_QT_MINIMUM_VERSION} - COMPONENTS Core - Gui - OpenGL - Network - NetworkAuth - Widgets - Xml - Concurrent - PrintSupport - Svg - Sql - OPTIONAL_COMPONENTS Charts - ) - set(QT_LIBRARIES - Qt5::Core - Qt5::Gui - Qt5::Network - Qt5::NetworkAuth - Qt5::OpenGL - Qt5::Widgets - Qt5::Xml - Qt5::Concurrent - Qt5::PrintSupport - Qt5::Svg - Qt5::Sql - ) - if(Qt5Charts_FOUND) - list(APPEND QT_LIBRARIES Qt5::Charts) - endif(Qt5Charts_FOUND) -endif(Qt5Core_FOUND) +find_package( + Qt6 + COMPONENTS Core + Gui + OpenGL + Network + NetworkAuth + Widgets + Xml + Concurrent + PrintSupport + Svg + Sql + OPTIONAL_COMPONENTS Charts +) +set(QT_LIBRARIES + Qt6::Core + Qt6::Gui + Qt6::OpenGL + Qt6::Network + Qt6::NetworkAuth + Qt6::Widgets + Qt6::Xml + Qt6::Concurrent + Qt6::PrintSupport + Qt6::Svg + Qt6::Sql +) +qt_standard_project_setup() +set(CMAKE_AUTORCC ON) if(MSVC) # Avoid Qt warnings about macro redefinitions for math constants @@ -126,10 +121,6 @@ list(APPEND CPP_SOURCES ${CODE_SOURCE_FILES}) set(QRC_FILES ${QRC_FILES} Resources/ResInsight.qrc) -# Runs RCC and MOC on specified files -qt5_add_resources(QRC_FILES_CPP ${QRC_FILES}) -qt5_wrap_cpp(MOC_SOURCE_FILES ${QT_MOC_HEADERS}) - # Adding resource (RC) files for Windows if(MSVC) set(WIN_RESOURCE Resources/ResInsight.rc) @@ -157,7 +148,7 @@ set(EXE_FILES ${CPP_SOURCES} ${MOC_SOURCE_FILES} ${FORM_FILES_CPP} - ${QRC_FILES_CPP} + ${QRC_FILES} ${WIN_RESOURCE} ${HEADER_FILES} ${REFERENCED_CMAKE_FILES} @@ -165,7 +156,7 @@ set(EXE_FILES .clang-tidy ) -add_executable(ResInsight ${EXE_FILES}) +qt_add_executable(ResInsight ${EXE_FILES}) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") set_target_properties( @@ -288,10 +279,10 @@ if(RESINSIGHT_USE_ODB_API) list(APPEND LINK_LIBRARIES RifOdbReader) endif() -target_link_libraries(ResInsight ${LINK_LIBRARIES}) +target_link_libraries(ResInsight PRIVATE ${LINK_LIBRARIES}) if(UNIX AND NOT APPLE) - target_link_libraries(ResInsight xcb) + target_link_libraries(ResInsight PRIVATE xcb) endif() # ############################################################################## @@ -332,7 +323,7 @@ foreach(riFileName ${RI_FILENAMES}) -E copy_if_different ${riFileName} - $ + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ) endforeach() add_custom_target(PreBuildFileCopy ${copyCommands}) @@ -378,123 +369,6 @@ endif(RESINSIGHT_ENABLE_GRPC) # bundle libraries together with private installation if(RESINSIGHT_PRIVATE_INSTALL) - if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - - set(RESINSIGHT_INSTALL_RPATH - "" - CACHE STRING "RPATH to be injected into binary" - ) - mark_as_advanced(FORCE RESINSIGHT_INSTALL_RPATH) - - # Add ORIGIN to represent the directory where the binary is located - set(RESINSIGHT_INSTALL_RPATH ${RESINSIGHT_INSTALL_RPATH} "\$ORIGIN") - - if(${RESINSIGHT_USE_ODB_API}) - # This is a "hack" to make ResInsight runtime find the ODB so files used - # when compiling. statoil wanted it this way, but we should probbly make a - # different installoptions that does things this way, and really do copy - # them when doing PRIVATE_INSTALL - set(RESINSIGHT_INSTALL_RPATH ${RESINSIGHT_INSTALL_RPATH} - ${RESINSIGHT_ODB_API_DIR}/lib - ) - endif() - - if(EXISTS ${RESINSIGHT_ERT_EXTERNAL_LIB_ROOT}) - # append the external ERT lib root - set(RESINSIGHT_INSTALL_RPATH ${RESINSIGHT_INSTALL_RPATH} - ${RESINSIGHT_ERT_EXTERNAL_LIB_ROOT} - ) - endif() - - # message("RESINSIGHT_INSTALL_RPATH : " "${RESINSIGHT_INSTALL_RPATH}") - - set_target_properties( - ResInsight PROPERTIES INSTALL_RPATH "${RESINSIGHT_INSTALL_RPATH}" - ) - - # bundle Qt5 libraries - option(RESINSIGHT_QT5_BUNDLE_LIBRARIES "Bundle Qt5 libraries" OFF) - mark_as_advanced(FORCE RESINSIGHT_QT5_BUNDLE_LIBRARIES) - if(RESINSIGHT_QT5_BUNDLE_LIBRARIES) - message(STATUS "Bundling of Qt5 libraries is enabled") - - # Get root directory - get_property( - _filepath - TARGET "Qt5::Core" - PROPERTY LOCATION_RELEASE - ) - get_filename_component(_dir ${_filepath} PATH) - - foreach(qtlib ${QT_LIBRARIES}) - get_target_property(FILE_NAME_FULL_PATH ${qtlib} LOCATION) - message(STATUS "${qtlib} location on disk - ${FILE_NAME_FULL_PATH}") - get_filename_component(FILE_NAME_WE ${FILE_NAME_FULL_PATH} NAME_WE) - message(STATUS "${FILE_NAME_WE} name without ext - ${FILE_NAME_WE}") - - list(APPEND QT_INSTALL_FILES_WITHOUT_EXTENSION ${FILE_NAME_WE}) - endforeach() - - # XcbQpa is used by libXcb.so required by platform plugin xcb - list(APPEND QT_INSTALL_FILES_WITHOUT_EXTENSION libQt5XcbQpa libQt5DBus) - - # append icu - list(APPEND QT_INSTALL_FILES_WITHOUT_EXTENSION libicu*) - - foreach(installfile ${QT_INSTALL_FILES_WITHOUT_EXTENSION}) - file(GLOB FILE_AND_SYMLINKS ${_dir}/${installfile}.so*) - install( - FILES ${FILE_AND_SYMLINKS} - DESTINATION ${RESINSIGHT_INSTALL_FOLDER} - OPTIONAL - ) - endforeach() - - set(QT_PLUGIN_PATH "$ENV{QT_PLUGIN_PATH}") - if(QT_PLUGIN_PATH STREQUAL "") - set(QT_PLUGIN_PATH "${_dir}/qt5/plugins/") - endif() - message(STATUS "QT_PLUGIN_PATH : ${QT_PLUGIN_PATH}") - - # include platform files - install(FILES ${QT_PLUGIN_PATH}/platforms/libqxcb.so - DESTINATION ${RESINSIGHT_INSTALL_FOLDER}/platforms/ - ) - install(FILES ${QT_PLUGIN_PATH}/imageformats/libqsvg.so - DESTINATION ${RESINSIGHT_INSTALL_FOLDER}/imageformats/ - ) - install(FILES ${QT_PLUGIN_PATH}/iconengines/libqsvgicon.so - DESTINATION ${RESINSIGHT_INSTALL_FOLDER}/iconengines/ - ) - # Required when using --platform offscreen - install(FILES ${QT_PLUGIN_PATH}/platforms/libqoffscreen.so - DESTINATION ${RESINSIGHT_INSTALL_FOLDER}/platforms/ - ) - - # Required by xcb module used to create OpenGL widgets - install( - FILES ${QT_PLUGIN_PATH}/xcbglintegrations/libqxcb-egl-integration.so - DESTINATION ${RESINSIGHT_INSTALL_FOLDER}/plugins/xcbglintegrations/ - OPTIONAL - ) - install( - FILES ${QT_PLUGIN_PATH}/xcbglintegrations/libqxcb-glx-integration.so - DESTINATION ${RESINSIGHT_INSTALL_FOLDER}/plugins/xcbglintegrations/ - OPTIONAL - ) - - # Required sql driver - install( - FILES ${QT_PLUGIN_PATH}/sqldrivers/libqsqlite.so - DESTINATION ${RESINSIGHT_INSTALL_FOLDER}/sqldrivers/ - OPTIONAL - ) - - install(FILES qt.conf DESTINATION ${RESINSIGHT_INSTALL_FOLDER}/) - - endif(RESINSIGHT_QT5_BUNDLE_LIBRARIES) - - endif() if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") # put a .exe.local file in the target directory to pick up DLLs from there @@ -504,79 +378,6 @@ if(RESINSIGHT_PRIVATE_INSTALL) set(RESINSIGHT_FILES ${RI_FILENAMES}) - if(WIN32 - AND TARGET Qt5::qmake - AND NOT TARGET Qt5::windeployqt - ) - get_target_property(_qt5_qmake_location Qt5::qmake IMPORTED_LOCATION) - - execute_process( - COMMAND "${_qt5_qmake_location}" -query QT_INSTALL_PREFIX - RESULT_VARIABLE return_code - OUTPUT_VARIABLE qt5_install_prefix - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - - set(imported_location "${qt5_install_prefix}/bin/windeployqt.exe") - - message(STATUS "QMAKE: ${_qt5_qmake_location}") - message(STATUS "QTPREFIX: ${qt5_install_prefix}") - - if(EXISTS ${imported_location}) - add_executable(Qt5::windeployqt IMPORTED) - - set_target_properties( - Qt5::windeployqt PROPERTIES IMPORTED_LOCATION ${imported_location} - ) - endif() - endif() - - # TODO(wjwwood): find a way to make this optional or to run without - # "deploying" the necessary dlls and stuff to the bin folder. see: - # https://stackoverflow.com/questions/41193584/deploy-all-qt-dependencies-when-building#41199492 - if(TARGET Qt5::windeployqt) - # execute windeployqt in a tmp directory after build - add_custom_command( - TARGET ResInsight - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E remove_directory - "${CMAKE_CURRENT_BINARY_DIR}/windeployqt" - COMMAND set PATH=%PATH%$${qt5_install_prefix}/bin - COMMAND - Qt5::windeployqt --no-compiler-runtime --no-system-d3d-compiler - --no-quick-import --no-translations --verbose 0 --dir - "${CMAKE_CURRENT_BINARY_DIR}/windeployqt" - "$/$" - ) - - # Qt DLLs - message(STATUS "Creating post build step for copying Qt DLLs") - - # copy all files in the windeployqt directory to the installation - # directory - add_custom_command( - TARGET ResInsight - POST_BUILD - COMMAND - ${CMAKE_COMMAND} -E copy_directory - "${CMAKE_CURRENT_BINARY_DIR}/windeployqt/" - $ - ) - - # copy deployment directory during installation - install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/windeployqt/" - DESTINATION ${RESINSIGHT_INSTALL_FOLDER} - ) - - # install additional DLLS not able to be found by windeployqt - set(qt5_offscreen_name "$,qoffscreend,qoffscreen>") - install( - FILES ${qt5_install_prefix}/plugins/platforms/${qt5_offscreen_name}.dll - DESTINATION ${RESINSIGHT_INSTALL_FOLDER}/platforms - ) - - endif() - # install GRPC-related DLLs and generated_classes.py if(RESINSIGHT_ENABLE_GRPC) set(ZLIB_DLL "$,zlibd1,zlib1>") @@ -628,9 +429,36 @@ if(RESINSIGHT_PRIVATE_INSTALL) endif() install(TARGETS ResInsight DESTINATION ${RESINSIGHT_INSTALL_FOLDER}) - install(FILES ${RESINSIGHT_FILES} DESTINATION ${RESINSIGHT_INSTALL_FOLDER}) + if(WIN32 AND WINDEPLOYQT_EXECUTABLE) + # Add a post-build command to run windeployqt. This makes it possible to + # debug the binary from a debugger without any manual steps. This also fixes + # an issue related to the Install() command and usage of windeployqt as part + # of installation. The installation tried to use windeployqt on the + # executable in the build directory, which did not find the Qt libraries. + # + # TODO: This command copies all required dlls, so we should probably not use + # the Install() command to copy external dlls dependencies. + # + add_custom_command( + TARGET ResInsight + POST_BUILD + COMMAND ${WINDEPLOYQT_EXECUTABLE} $ --release + --no-translations + COMMENT + "Running windeployqt to deploy Qt dependencies to the build folder, required by install()" + ) + + # Running windeployqt to deploy Qt dependencies to the install folder" + install( + TARGETS ResInsight + DESTINATION ${RESINSIGHT_INSTALL_FOLDER} + RUNTIME_DEPENDENCIES PRE_EXCLUDE_REGEXES "api-ms-" "ext-ms-" + POST_EXCLUDE_REGEXES ".*system32/.*\\.dll" + ) + endif() + if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/resinsight @@ -672,6 +500,19 @@ endif(RESINSIGHT_PRIVATE_INSTALL) # Installation packaging # ############################################################################## +if(Qt6Widgets_VERSION VERSION_LESS 6.5.0) + message("Detected Qt version ${Qt6Widgets_VERSION}") + message( + "Install target is not complete as Qt 6.5 is required to use qt_generate_deploy_app_script()" + ) +else() + qt_generate_deploy_app_script( + TARGET ResInsight OUTPUT_SCRIPT deploy_script NO_UNSUPPORTED_PLATFORM_ERROR + NO_TRANSLATIONS + ) + install(SCRIPT ${deploy_script}) +endif() + if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") set(CPACK_GENERATOR TGZ) elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows") diff --git a/ApplicationLibCode/Application/RiaFontCache.cpp b/ApplicationLibCode/Application/RiaFontCache.cpp index 85e4f53d31..0f5b6e266d 100644 --- a/ApplicationLibCode/Application/RiaFontCache.cpp +++ b/ApplicationLibCode/Application/RiaFontCache.cpp @@ -23,8 +23,6 @@ #include "cafAssert.h" #include "cafFixedAtlasFont.h" -#include - #include //-------------------------------------------------------------------------------------------------- @@ -72,8 +70,9 @@ cvf::ref RiaFontCache::getFont( int pointSize ) int currentDPI = 96; if ( RiaGuiApplication::isRunning() ) { - currentDPI = RiaGuiApplication::desktop()->logicalDpiX(); + currentDPI = RiaGuiApplication::applicationResolution(); } + // the Fixed Atlas Fonts appear to be assuming a DPI of 96, so we need scaling. double scaling = currentDPI / 96.0; int scaledSize = scaling * pointSize; diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index fa54439c78..83edacb759 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -125,7 +125,6 @@ #include "cvfqtUtils.h" #include -#include #include #include #include @@ -1142,8 +1141,8 @@ void RiaGuiApplication::showFormattedTextInMessageBoxOrConsole( const QString& t // Resize dialog to fit text etc. textEdit->document()->adjustSize(); QSizeF docSize = textEdit->document()->size(); - dlg.resize( 20 + docSize.width() + 2 * layout->margin(), - 20 + docSize.height() + 2 * layout->margin() + layout->spacing() + okButton->sizeHint().height() ); + dlg.resize( 20 + docSize.width() + 2 * layout->contentsMargins().left(), + 20 + docSize.height() + 2 * layout->contentsMargins().left() + layout->spacing() + okButton->sizeHint().height() ); dlg.exec(); } @@ -1529,7 +1528,13 @@ void RiaGuiApplication::applyGuiPreferences( const RiaPreferences* //-------------------------------------------------------------------------------------------------- int RiaGuiApplication::applicationResolution() { - return QApplication::desktop()->logicalDpiX(); + if ( auto screen = QGuiApplication::primaryScreen() ) + { + return screen->logicalDotsPerInchX(); + } + + const int defaultDPI = 96; + return defaultDPI; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/Tools/RiaColorTools.cpp b/ApplicationLibCode/Application/Tools/RiaColorTools.cpp index 5e21f25594..8863c2d68d 100644 --- a/ApplicationLibCode/Application/Tools/RiaColorTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaColorTools.cpp @@ -207,15 +207,15 @@ cvf::Color3f RiaColorTools::makeLighter( const cvf::Color3f& color, float normal { auto qColor = toQColor( color ); - double h = 0.0; - double s = 0.0; - double l = 0.0; + float h = 0.0; + float s = 0.0; + float l = 0.0; qColor.getHslF( &h, &s, &l ); // A negative value will make the color darker l = l + ( 1.0 - l ) * normalizedScalingFactor; - l = std::clamp( l, 0.0, 1.0 ); + l = std::clamp( l, 0.0f, 1.0f ); qColor.setHslF( h, s, l ); @@ -228,10 +228,10 @@ cvf::Color3f RiaColorTools::makeLighter( const cvf::Color3f& color, float normal QColor RiaColorTools::modifySaturation( const QColor& color, double factor ) { auto colorSaturation( color ); - qreal h, s, v; + float h, s, v; color.getHsvF( &h, &s, &v ); - s = std::clamp( s * factor, 0.0, 1.0 ); + s = std::clamp( (float)( s * factor ), 0.0f, 1.0f ); colorSaturation.setHsvF( h, s, v ); return colorSaturation; diff --git a/ApplicationLibCode/Application/Tools/RiaTextStringTools.cpp b/ApplicationLibCode/Application/Tools/RiaTextStringTools.cpp index 7822d9e770..11058d2073 100644 --- a/ApplicationLibCode/Application/Tools/RiaTextStringTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaTextStringTools.cpp @@ -17,6 +17,7 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RiaTextStringTools.h" +#include "RiaStdStringTools.h" #include #include @@ -128,11 +129,24 @@ QString RiaTextStringTools::trimNonAlphaNumericCharacters( const QString& s ) //-------------------------------------------------------------------------------------------------- QStringList RiaTextStringTools::splitSkipEmptyParts( const QString& text, const QString& sep /*= " " */ ) { -#if QT_VERSION >= QT_VERSION_CHECK( 5, 14, 0 ) - return text.split( sep, Qt::SkipEmptyParts, Qt::CaseInsensitive ); -#else - return text.split( sep, QString::SkipEmptyParts, Qt::CaseInsensitive ); -#endif + bool skipEmptyParts = true; + return splitString( text, sep, skipEmptyParts ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QStringList RiaTextStringTools::splitString( const QString& text, const QString& sep, bool skipEmptyParts ) +{ + return text.split( sep, skipEmptyParts ? Qt::SkipEmptyParts : Qt::KeepEmptyParts, Qt::CaseInsensitive ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QStringList RiaTextStringTools::splitString( const QString& text, const QRegExp& regExp, bool skipEmptyParts ) +{ + return regExp.splitString( text, skipEmptyParts ? Qt::SkipEmptyParts : Qt::KeepEmptyParts ); } //-------------------------------------------------------------------------------------------------- @@ -158,16 +172,39 @@ QString RiaTextStringTools::replaceTemplateTextWithValues( const QString& templa return resolvedText; } +//-------------------------------------------------------------------------------------------------- +/// Qt recommends pass-by-value instead of pass-by-const-ref for QStringView +/// https://doc.qt.io/qt-6/qstringview.html +//-------------------------------------------------------------------------------------------------- +bool RiaTextStringTools::isTextEqual( QStringView text, QStringView compareText ) +{ + return text.compare( compareText, Qt::CaseInsensitive ) == 0; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiaTextStringTools::isNumber( const QString& text, const QString& decimalPoint ) +{ + if ( text.isEmpty() || decimalPoint.isEmpty() ) + { + return false; + } + + auto stdString = text.toStdString(); + auto decimalChar = decimalPoint.toLatin1()[0]; + + return RiaStdStringTools::isNumber( stdString, decimalChar ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- QStringList RiaTextStringTools::splitSkipEmptyParts( const QString& text, const QRegExp& regExp ) { -#if QT_VERSION >= QT_VERSION_CHECK( 5, 14, 0 ) - return text.split( regExp, Qt::SkipEmptyParts ); -#else - return text.split( regExp, QString::SkipEmptyParts ); -#endif + bool skipEmptyParts = true; + + return splitString( text, regExp, skipEmptyParts ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/Tools/RiaTextStringTools.h b/ApplicationLibCode/Application/Tools/RiaTextStringTools.h index cd14bc3beb..34710045f9 100644 --- a/ApplicationLibCode/Application/Tools/RiaTextStringTools.h +++ b/ApplicationLibCode/Application/Tools/RiaTextStringTools.h @@ -18,6 +18,7 @@ #pragma once +#include #include #include @@ -37,7 +38,12 @@ QString trimNonAlphaNumericCharacters( const QString& s ); QStringList splitSkipEmptyParts( const QString& text, const QString& sep = " " ); QStringList splitSkipEmptyParts( const QString& text, const QRegExp& regExp ); +QStringList splitString( const QString& text, const QString& sep, bool skipEmptyParts ); +QStringList splitString( const QString& text, const QRegExp& regExp, bool skipEmptyParts ); + QString replaceTemplateTextWithValues( const QString& templateText, const std::map& valueMap ); +bool isTextEqual( QStringView text, QStringView compareText ); +bool isNumber( const QString& text, const QString& decimalPoint ); } // namespace RiaTextStringTools diff --git a/ApplicationLibCode/CMakeLists.txt b/ApplicationLibCode/CMakeLists.txt index da5036c463..5ba4d90f68 100644 --- a/ApplicationLibCode/CMakeLists.txt +++ b/ApplicationLibCode/CMakeLists.txt @@ -23,41 +23,38 @@ option(RESINSIGHT_TREAT_WARNINGS_AS_ERRORS "Treat warnings as errors (stops build)" OFF ) -find_package(Qt5 ${RI_QT_MINIMUM_VERSION} COMPONENTS Core) - -if(Qt5Core_FOUND) - find_package( - Qt5 ${RI_QT_MINIMUM_VERSION} - COMPONENTS Core - Gui - OpenGL - Network - NetworkAuth - Widgets - Xml - Concurrent - PrintSupport - Svg - Sql - OPTIONAL_COMPONENTS Charts - ) - set(QT_LIBRARIES - Qt5::Core - Qt5::Gui - Qt5::Network - Qt5::NetworkAuth - Qt5::OpenGL - Qt5::Widgets - Qt5::Xml - Qt5::Concurrent - Qt5::PrintSupport - Qt5::Svg - Qt5::Sql - ) - if(Qt5Charts_FOUND) - list(APPEND QT_LIBRARIES Qt5::Charts) - endif(Qt5Charts_FOUND) -endif(Qt5Core_FOUND) +find_package( + Qt6 + COMPONENTS Core + Gui + OpenGL + Network + NetworkAuth + Widgets + Xml + Concurrent + PrintSupport + Svg + Sql + Core5Compat + OPTIONAL_COMPONENTS Charts +) +set(QT_LIBRARIES + Qt6::Core + Qt6::Gui + Qt6::OpenGL + Qt6::Network + Qt6::NetworkAuth + Qt6::Widgets + Qt6::Xml + Qt6::Concurrent + Qt6::PrintSupport + Qt6::Svg + Qt6::Sql + Qt6::Core5Compat + Qt6::Charts +) +qt_standard_project_setup() if(RESINSIGHT_GRPC_PYTHON_EXECUTABLE) set(Python3_EXECUTABLE ${RESINSIGHT_GRPC_PYTHON_EXECUTABLE}) @@ -218,19 +215,6 @@ if(RESINSIGHT_FOUND_HDF5) endif() -# ############################################################################## -# Qt specifics: Moc, ui, resources -# ############################################################################## - -set(QT_MOC_HEADERS - ${QT_MOC_HEADERS} ProjectDataModel/RimMimeData.h - ProjectDataModel/Intersections/RimBoxIntersection.h - SocketInterface/RiaSocketServer.h -) - -qt5_wrap_cpp(MOC_SOURCE_FILES ${QT_MOC_HEADERS}) -qt5_wrap_ui(FORM_FILES_CPP ${QT_UI_FILES}) - # ############################################################################## # Create source groups - see also included CMakeLists_files.cmake # ############################################################################## @@ -267,6 +251,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") -Wno-call-to-pure-virtual-from-ctor-dtor -Wno-delete-non-abstract-non-virtual-dtor -Wno-ambiguous-reversed-operator + -Wno-deprecated-declarations ) endif() @@ -414,6 +399,9 @@ set(UNITY_EXCLUDE_FILES # Exclude files including opm-common ProjectDataModel/RimVfpTableExtractor.cpp ProjectDataModel/RimVfpPlot.cpp + # Exclude moc files as they cause template instanciation issues + # https://cmake.org/cmake/help/latest/prop_tgt/AUTOGEN_BUILD_DIR.html + ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_autogen/mocs_compilation.cpp ProjectDataModel/RiaOpmParserTools.cpp FileInterface/RifOsduWellPathReader.cpp FileInterface/RifOsduWellLogReader.cpp @@ -421,6 +409,8 @@ set(UNITY_EXCLUDE_FILES FileInterface/RifArrowTools.cpp ) +message("Files excluded from UNITY_BUILD : ${UNITY_EXCLUDE_FILES}") + if(RESINSIGHT_ENABLE_UNITY_BUILD) foreach(fileToExclude ${UNITY_EXCLUDE_FILES}) set_source_files_properties( diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicExitApplicationFeature.cpp b/ApplicationLibCode/Commands/ApplicationCommands/RicExitApplicationFeature.cpp index b15eb2e983..274c6a55e3 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicExitApplicationFeature.cpp +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicExitApplicationFeature.cpp @@ -62,6 +62,11 @@ void RicExitApplicationFeature::onActionTriggered( bool isChecked ) { app->mainPlotWindow()->close(); } + + // This was required after moving to Qt6, causing the application not to shut down properly, and ghost processes remains after a forced + // shutdown. The slot onLastWindowClosed() configured in RiaGuiApplication::RiaGuiApplication is never called. Testing with + // processEvents() had no effect. + app->quit(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/CMakeLists.txt b/ApplicationLibCode/Commands/CMakeLists.txt index 34d7e65b88..b4ae51064e 100644 --- a/ApplicationLibCode/Commands/CMakeLists.txt +++ b/ApplicationLibCode/Commands/CMakeLists.txt @@ -6,6 +6,22 @@ if(RESINSIGHT_ENABLE_UNITY_BUILD) set(CMAKE_UNITY_BUILD true) endif() +set(UNITY_EXCLUDE_FILES + # Exclude moc files as they cause template instanciation issues + # https://cmake.org/cmake/help/latest/prop_tgt/AUTOGEN_BUILD_DIR.html + ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_autogen/mocs_compilation.cpp +) + +message("Files excluded from UNITY_BUILD : ${UNITY_EXCLUDE_FILES}") + +if(RESINSIGHT_ENABLE_UNITY_BUILD) + foreach(fileToExclude ${UNITY_EXCLUDE_FILES}) + set_source_files_properties( + ${fileToExclude} PROPERTIES SKIP_UNITY_BUILD_INCLUSION TRUE + ) + endforeach(fileToExclude) +endif() + set(COMMAND_REFERENCED_CMAKE_FILES CMakeLists_files.cmake AnalysisPlotCommands/CMakeLists_files.cmake @@ -52,9 +68,6 @@ endforeach(referencedfile) find_package(Eigen3 REQUIRED) -# Prefix files with COMMAND_ to avoid clash with application global lists -qt5_wrap_cpp(COMMAND_MOC_SOURCE_FILES ${COMMAND_QT_MOC_HEADERS}) - add_library( ${PROJECT_NAME} OBJECT ${COMMAND_CODE_SOURCE_FILES} ${COMMAND_CODE_HEADER_FILES} @@ -82,9 +95,14 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") -Wno-call-to-pure-virtual-from-ctor-dtor -Wno-delete-non-abstract-non-virtual-dtor -Wno-ambiguous-reversed-operator + -Wno-deprecated-declarations ) endif() +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + target_compile_options(Commands PRIVATE -Wno-deprecated-declarations) +endif() + if(RESINSIGHT_TREAT_WARNINGS_AS_ERRORS) if(MSVC) target_compile_options(Commands PRIVATE /WX) diff --git a/ApplicationLibCode/Commands/ExportCommands/RicCreateDepthAdjustedLasFilesImpl.cpp b/ApplicationLibCode/Commands/ExportCommands/RicCreateDepthAdjustedLasFilesImpl.cpp index dd9be2acf7..3e1c6fb469 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicCreateDepthAdjustedLasFilesImpl.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicCreateDepthAdjustedLasFilesImpl.cpp @@ -40,6 +40,8 @@ #include "NRLib/nrlib/well/laswell.hpp" +#include + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -248,9 +250,9 @@ void RicCreateDepthAdjustedLasFilesImpl::createDestinationWellLasFile( const QSt // Replace white space from well names in file name QString sourceWell = sourceWellLogData->wellName(); - sourceWell = sourceWell.replace( QRegExp( "[\\s]+" ), "_" ); + sourceWell = sourceWell.replace( QRegularExpression( "[\\s]+" ), "_" ); QString destinationWell = wellName; - destinationWell = destinationWell.replace( QRegExp( "[\\s]+" ), "_" ); + destinationWell = destinationWell.replace( QRegularExpression( "[\\s]+" ), "_" ); // Create full file path name QString fullPathName = exportFolder + "/" + destinationWell + "_Depth_Adjusted_Using_" + sourceWell + "_" + caseDescription + diff --git a/ApplicationLibCode/Commands/HoloLensCommands/VdeVizDataExtractor.cpp b/ApplicationLibCode/Commands/HoloLensCommands/VdeVizDataExtractor.cpp index 751ee30c50..ca8186c79a 100644 --- a/ApplicationLibCode/Commands/HoloLensCommands/VdeVizDataExtractor.cpp +++ b/ApplicationLibCode/Commands/HoloLensCommands/VdeVizDataExtractor.cpp @@ -405,7 +405,7 @@ QString VdeVizDataExtractor::createModelMetaJsonString( const std::vector jsonLabelEntry; jsonLabelEntry["position"] = jsonPos; - jsonLabelEntry["text"] = txt.toAscii().ptr(); + jsonLabelEntry["text"] = QString::fromLatin1( txt.toAscii().ptr() ); jsonLabelList.push_back( jsonLabelEntry ); } diff --git a/ApplicationLibCode/Commands/RicRecursiveFileSearchDialog.cpp b/ApplicationLibCode/Commands/RicRecursiveFileSearchDialog.cpp index 8f84bf3ea0..62a5db76c0 100644 --- a/ApplicationLibCode/Commands/RicRecursiveFileSearchDialog.cpp +++ b/ApplicationLibCode/Commands/RicRecursiveFileSearchDialog.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -662,8 +663,8 @@ QStringList RicRecursiveFileSearchDialog::createFileNameFilterList() //-------------------------------------------------------------------------------------------------- QString RicRecursiveFileSearchDialog::replaceWithRealizationStar( const QString& text ) { - const QString pattern = "realization-\\d+"; - QRegExp regexp( pattern, Qt::CaseInsensitive ); + const QString pattern = "realization-\\d+"; + QRegularExpression regexp( pattern, QRegularExpression::CaseInsensitiveOption ); QString textWithStar = text; textWithStar.replace( regexp, "realization-*" ); @@ -681,7 +682,7 @@ void RicRecursiveFileSearchDialog::populateComboBoxHistoryFromRegistry( QComboBo const int maxItemsInRegistry = 10; - int numRecentFiles = std::min( files.size(), maxItemsInRegistry ); + int numRecentFiles = std::min( (int)files.size(), maxItemsInRegistry ); for ( int i = 0; i < numRecentFiles; i++ ) { comboBox->addItem( files[i] ); @@ -723,7 +724,7 @@ void RicRecursiveFileSearchDialog::setOkButtonEnabled( bool enabled ) //-------------------------------------------------------------------------------------------------- void RicRecursiveFileSearchDialog::warningIfInvalidCharacters() { - if ( fileNameFilter().contains( QRegExp( "[\\\\/:]" ) ) ) + if ( fileNameFilter().contains( QRegularExpression( "[\\\\/:]" ) ) ) { QToolTip::showText( m_fileFilterField->mapToGlobal( QPoint( 0, 0 ) ), "File pattern contains invalid characters" ); m_effectiveFilterContentLabel->setText( "(Invalid filter)" ); @@ -1045,7 +1046,7 @@ QStringList RicRecursiveFileSearchDialog::buildDirectoryListRecursive( const QSt QString pathFilter = pathFilterWithoutStartSeparator(); if ( !pathFilter.startsWith( "*" ) ) { - int wildcardIndex = pathFilter.indexOf( QRegExp( QString( "[*%1]" ).arg( RiaFilePathTools::separator() ) ) ); + int wildcardIndex = pathFilter.indexOf( QRegularExpression( QString( "[*%1]" ).arg( RiaFilePathTools::separator() ) ) ); if ( wildcardIndex >= 0 ) { currPathFilter = pathFilter.left( wildcardIndex + 1 ); @@ -1085,8 +1086,10 @@ bool RicRecursiveFileSearchDialog::pathFilterMatch( const QString& pathFilter, c if ( relPath.endsWith( RiaFilePathTools::separator() ) && !pathFilter.endsWith( RiaFilePathTools::separator() ) ) pattern += RiaFilePathTools::separator(); - QRegExp regexp( pattern, Qt::CaseInsensitive, QRegExp::Wildcard ); - return regexp.exactMatch( relPath ); + QRegularExpression regexp( pattern, QRegularExpression::CaseInsensitiveOption ); + auto match = regexp.match( relPath ); + + return match.hasMatch(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/FileInterface/RifCaseRealizationParametersReader.cpp b/ApplicationLibCode/FileInterface/RifCaseRealizationParametersReader.cpp index 979b6301b0..ba945f1cd2 100644 --- a/ApplicationLibCode/FileInterface/RifCaseRealizationParametersReader.cpp +++ b/ApplicationLibCode/FileInterface/RifCaseRealizationParametersReader.cpp @@ -21,6 +21,7 @@ #include "RiaLogging.h" #include "RiaStdStringTools.h" +#include "RiaTextStringTools.h" #include #include @@ -132,7 +133,7 @@ void RifCaseRealizationParametersReader::parse() QString& name = cols[0]; QString& strValue = cols[1]; - if ( RiaStdStringTools::isNumber( strValue.toStdString(), QLocale::c().decimalPoint().toLatin1() ) ) + if ( RiaTextStringTools::isNumber( strValue, QLocale::c().decimalPoint() ) ) { bool parseOk = true; double value = QLocale::c().toDouble( strValue, &parseOk ); @@ -192,23 +193,23 @@ void RifCaseRealizationRunspecificationReader::parse() if ( xml.isStartElement() ) { - if ( xml.name() == "modifier" ) + if ( RiaTextStringTools::isTextEqual( xml.name(), QString( "modifier" ) ) ) { paramName = ""; } - if ( xml.name() == "id" ) + if ( RiaTextStringTools::isTextEqual( xml.name(), QString( "id" ) ) ) { paramName = xml.readElementText(); } - if ( xml.name() == "value" ) + if ( RiaTextStringTools::isTextEqual( xml.name(), QString( "value" ) ) ) { QString paramStrValue = xml.readElementText(); if ( paramName.isEmpty() ) continue; - if ( RiaStdStringTools::isNumber( paramStrValue.toStdString(), QLocale::c().decimalPoint().toLatin1() ) ) + if ( RiaTextStringTools::isNumber( paramStrValue, QLocale::c().decimalPoint() ) ) { bool parseOk = true; double value = QLocale::c().toDouble( paramStrValue, &parseOk ); @@ -230,7 +231,7 @@ void RifCaseRealizationRunspecificationReader::parse() } else if ( xml.isEndElement() ) { - if ( xml.name() == "modifier" ) + if ( RiaTextStringTools::isTextEqual( xml.name(), QString( "modifier" ) ) ) { paramName = ""; } diff --git a/ApplicationLibCode/FileInterface/RifCsvUserDataParser.cpp b/ApplicationLibCode/FileInterface/RifCsvUserDataParser.cpp index 14277573fe..048ae252ad 100644 --- a/ApplicationLibCode/FileInterface/RifCsvUserDataParser.cpp +++ b/ApplicationLibCode/FileInterface/RifCsvUserDataParser.cpp @@ -349,7 +349,7 @@ bool RifCsvUserDataParser::parseColumnInfo( QTextStream* QStringList candidateColumnHeaders = RifFileParseTools::splitLineAndTrim( candidateLine, parseOptions.cellSeparator ); for ( const auto& text : candidateColumnHeaders ) { - if ( RiaStdStringTools::isNumber( text.toStdString(), parseOptions.locale.decimalPoint().toLatin1() ) ) + if ( RiaTextStringTools::isNumber( text, parseOptions.locale.decimalPoint() ) ) { hasDataValues = true; } @@ -504,8 +504,8 @@ bool RifCsvUserDataParser::parseColumnBasedData( const RifAsciiDataParseOptions& { for ( int iCol = 0; iCol < colCount; iCol++ ) { - std::string colData = lineColumns[iCol].toStdString(); - Column& col = columnInfoList[iCol]; + auto colData = lineColumns[iCol]; + Column& col = columnInfoList[iCol]; // Determine column data type if ( col.dataType == Column::NONE ) @@ -517,7 +517,7 @@ bool RifCsvUserDataParser::parseColumnBasedData( const RifAsciiDataParseOptions& else { if ( parseOptions.assumeNumericDataColumns || - RiaStdStringTools::isNumber( colData, parseOptions.locale.decimalPoint().toLatin1() ) ) + RiaTextStringTools::isNumber( colData, parseOptions.locale.decimalPoint() ) ) { col.dataType = Column::NUMERIC; } diff --git a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp index 1de9f37e2c..1f3dcc0a34 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp @@ -19,10 +19,12 @@ #include "RifEclipseSummaryAddress.h" #include "RiaStdStringTools.h" +#include "RiaTextStringTools.h" #include "RifEclEclipseSummary.h" #include "RiuSummaryQuantityNameInfoProvider.h" +#include #include #include @@ -1213,7 +1215,7 @@ std::string RifEclipseSummaryAddress::blockAsString() const //-------------------------------------------------------------------------------------------------- std::tuple RifEclipseSummaryAddress::ijkTupleFromUiText( const std::string& s ) { - QStringList ijk = QString().fromStdString( s ).trimmed().split( QRegExp( "[,]" ) ); + auto ijk = RiaTextStringTools::splitSkipEmptyParts( QString::fromStdString( s ).trimmed(), QRegExp( "[,]" ) ); if ( ijk.size() != 3 ) return std::make_tuple( -1, -1, -1 ); @@ -1235,7 +1237,7 @@ std::string RifEclipseSummaryAddress::formatUiTextRegionToRegion() const //-------------------------------------------------------------------------------------------------- std::pair RifEclipseSummaryAddress::regionToRegionPairFromUiText( const std::string& s ) { - QStringList r2r = QString().fromStdString( s ).trimmed().split( QRegExp( "[-]" ) ); + auto r2r = RiaTextStringTools::splitSkipEmptyParts( QString::fromStdString( s ).trimmed(), QRegExp( "[-]" ) ); if ( r2r.size() != 2 ) return std::make_pair( -1, -1 ); diff --git a/ApplicationLibCode/FileInterface/RifFileParseTools.cpp b/ApplicationLibCode/FileInterface/RifFileParseTools.cpp index 274ba3cf99..963e45b2dc 100644 --- a/ApplicationLibCode/FileInterface/RifFileParseTools.cpp +++ b/ApplicationLibCode/FileInterface/RifFileParseTools.cpp @@ -17,6 +17,7 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RifFileParseTools.h" +#include "RiaTextStringTools.h" // Disable deprecation warning for QString::SkipEmptyParts #ifdef _MSC_VER @@ -31,7 +32,7 @@ //-------------------------------------------------------------------------------------------------- QStringList RifFileParseTools::splitLineAndTrim( const QString& line, const QString& separator, bool skipEmptyParts ) { - QStringList cols = line.trimmed().split( separator, skipEmptyParts ? QString::SkipEmptyParts : QString::KeepEmptyParts ); + auto cols = RiaTextStringTools::splitString( line.trimmed(), separator, skipEmptyParts ); for ( QString& col : cols ) { col = col.trimmed(); @@ -44,7 +45,7 @@ QStringList RifFileParseTools::splitLineAndTrim( const QString& line, const QStr //-------------------------------------------------------------------------------------------------- QStringList RifFileParseTools::splitLineAndTrim( const QString& line, const QRegExp& regexp, bool skipEmptyParts ) { - QStringList cols = line.trimmed().split( regexp, skipEmptyParts ? QString::SkipEmptyParts : QString::KeepEmptyParts ); + auto cols = RiaTextStringTools::splitString( line.trimmed(), regexp, skipEmptyParts ); for ( QString& col : cols ) { col = col.trimmed(); diff --git a/ApplicationLibCode/FileInterface/RifParameterXmlReader.cpp b/ApplicationLibCode/FileInterface/RifParameterXmlReader.cpp index 6a5e69b1ce..02d6d7d184 100644 --- a/ApplicationLibCode/FileInterface/RifParameterXmlReader.cpp +++ b/ApplicationLibCode/FileInterface/RifParameterXmlReader.cpp @@ -18,6 +18,8 @@ #include "RifParameterXmlReader.h" +#include "RiaTextStringTools.h" + #include "RimDoubleParameter.h" #include "RimGenericParameter.h" #include "RimIntegerParameter.h" @@ -103,7 +105,7 @@ bool RifParameterXmlReader::parseFile( QString& outErrorText ) { if ( xml.isStartElement() ) { - if ( xml.name() == "group" ) + if ( RiaTextStringTools::isTextEqual( xml.name(), QString( "group" ) ) ) { // check that we have the required attributes for ( auto& reqattr : reqGroupAttrs ) @@ -136,7 +138,7 @@ bool RifParameterXmlReader::parseFile( QString& outErrorText ) } continue; } - else if ( xml.name() == "parameter" ) + else if ( RiaTextStringTools::isTextEqual( xml.name(), QString( "parameter" ) ) ) { if ( group == nullptr ) continue; @@ -192,7 +194,7 @@ bool RifParameterXmlReader::parseFile( QString& outErrorText ) currentList->addParameter( parameter->name() ); } } - else if ( xml.name() == "list" ) + else if ( RiaTextStringTools::isTextEqual( xml.name(), QString( "list" ) ) ) { // check that we have the required attributes for ( auto& reqattr : reqListAttrs ) @@ -213,7 +215,7 @@ bool RifParameterXmlReader::parseFile( QString& outErrorText ) } else if ( xml.isEndElement() ) { - if ( xml.name() == "group" ) + if ( RiaTextStringTools::isTextEqual( xml.name(), QString( "group" ) ) ) { if ( group != nullptr ) { @@ -221,7 +223,7 @@ bool RifParameterXmlReader::parseFile( QString& outErrorText ) group = nullptr; } } - else if ( xml.name() == "list" ) + else if ( RiaTextStringTools::isTextEqual( xml.name(), QString( "list" ) ) ) { if ( group ) { diff --git a/ApplicationLibCode/FileInterface/RifReaderEclipseRft.cpp b/ApplicationLibCode/FileInterface/RifReaderEclipseRft.cpp index 66c212048d..0584f316f7 100644 --- a/ApplicationLibCode/FileInterface/RifReaderEclipseRft.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderEclipseRft.cpp @@ -86,8 +86,7 @@ void RifReaderEclipseRft::open() time_t timeStepTime_t = ecl_rft_node_get_date( node ); - QDateTime timeStep = RiaQDateTimeTools::createUtcDateTime(); - timeStep.setTime_t( timeStepTime_t ); + QDateTime timeStep = RiaQDateTimeTools::fromTime_t( timeStepTime_t ); RifEclipseRftAddress addressPressure = RifEclipseRftAddress::createAddress( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ); diff --git a/ApplicationLibCode/FileInterface/RifStimPlanXmlReader.cpp b/ApplicationLibCode/FileInterface/RifStimPlanXmlReader.cpp index 0680bd63dc..d59da8e52e 100644 --- a/ApplicationLibCode/FileInterface/RifStimPlanXmlReader.cpp +++ b/ApplicationLibCode/FileInterface/RifStimPlanXmlReader.cpp @@ -27,6 +27,7 @@ #include "RigStimPlanFractureDefinition.h" #include +#include #include #include // Needed for HUGE_VAL on Linux @@ -107,20 +108,20 @@ cvf::ref RifStimPlanXmlReader::readStimPlanXMLFil if ( xmlStream2.isStartElement() ) { - if ( isTextEqual( xmlStream2.name(), "properties" ) ) + if ( RiaTextStringTools::isTextEqual( xmlStream2.name(), QString( "properties" ) ) ) { propertiesElementCount++; } - else if ( isTextEqual( xmlStream2.name(), "property" ) ) + else if ( RiaTextStringTools::isTextEqual( xmlStream2.name(), QString( "property" ) ) ) { - unit = getAttributeValueString( xmlStream2, "uom" ); - parameter = getAttributeValueString( xmlStream2, "name" ); + unit = getAttributeValueString( xmlStream2, QString( "uom" ) ); + parameter = getAttributeValueString( xmlStream2, QString( "name" ) ); RiaLogging::info( QString( "%1 [%2]" ).arg( parameter, unit ) ); } - else if ( isTextEqual( xmlStream2.name(), "time" ) ) + else if ( RiaTextStringTools::isTextEqual( xmlStream2.name(), QString( "time" ) ) ) { - double timeStepValue = getAttributeValueDouble( xmlStream2, "value" ); + double timeStepValue = getAttributeValueDouble( xmlStream2, QString( "value" ) ); std::vector> propertyValuesAtTimestep = stimPlanFileData->generateDataLayoutFromFileDataLayout( getAllDepthDataAtTimeStep( xmlStream2 ) ); @@ -201,12 +202,12 @@ void RifStimPlanXmlReader::readStimplanGridAndTimesteps( QXmlStreamReader& { RiaDefines::EclipseUnitSystem destinationUnit = requiredUnit; - if ( isTextEqual( xmlStream.name(), "grid" ) ) + if ( RiaTextStringTools::isTextEqual( xmlStream.name(), QString( "grid" ) ) ) { // Support for one grid per file if ( gridSectionCount < 1 ) { - QString gridunit = getAttributeValueString( xmlStream, "uom" ); + QString gridunit = getAttributeValueString( xmlStream, QString( "uom" ) ); if ( gridunit.compare( "m", Qt::CaseInsensitive ) == 0 ) stimPlanFileData->m_unitSet = RiaDefines::EclipseUnitSystem::UNITS_METRIC; @@ -234,42 +235,42 @@ void RifStimPlanXmlReader::readStimplanGridAndTimesteps( QXmlStreamReader& gridSectionCount++; } - else if ( isTextEqual( xmlStream.name(), "perf" ) ) + else if ( RiaTextStringTools::isTextEqual( xmlStream.name(), QString( "perf" ) ) ) { - QString perfUnit = getAttributeValueString( xmlStream, "uom" ); - QString fracName = getAttributeValueString( xmlStream, "frac" ); + QString perfUnit = getAttributeValueString( xmlStream, QString( "uom" ) ); + QString fracName = getAttributeValueString( xmlStream, QString( "frac" ) ); } - else if ( isTextEqual( xmlStream.name(), "topTVD" ) ) + else if ( RiaTextStringTools::isTextEqual( xmlStream.name(), QString( "topTVD" ) ) ) { auto valText = xmlStream.readElementText(); tvdToTopPerf = valText.toDouble(); } - else if ( isTextEqual( xmlStream.name(), "bottomTVD" ) ) + else if ( RiaTextStringTools::isTextEqual( xmlStream.name(), QString( "bottomTVD" ) ) ) { auto valText = xmlStream.readElementText(); tvdToBotPerf = valText.toDouble(); } - else if ( isTextEqual( xmlStream.name(), "topMD" ) ) + else if ( RiaTextStringTools::isTextEqual( xmlStream.name(), QString( "topMD" ) ) ) { auto valText = xmlStream.readElementText(); mdToTopPerf = valText.toDouble(); } - else if ( isTextEqual( xmlStream.name(), "bottomMD" ) ) + else if ( RiaTextStringTools::isTextEqual( xmlStream.name(), QString( "bottomMD" ) ) ) { auto valText = xmlStream.readElementText(); mdToBotPerf = valText.toDouble(); } - else if ( isTextEqual( xmlStream.name(), "FmDip" ) ) + else if ( RiaTextStringTools::isTextEqual( xmlStream.name(), QString( "FmDip" ) ) ) { auto valText = xmlStream.readElementText(); formationDip = valText.toDouble(); } - else if ( isTextEqual( xmlStream.name(), "orientation" ) ) + else if ( RiaTextStringTools::isTextEqual( xmlStream.name(), QString( "orientation" ) ) ) { auto valText = xmlStream.readElementText(); orientation = mapTextToOrientation( valText.trimmed() ); } - else if ( isTextEqual( xmlStream.name(), "xs" ) ) + else if ( RiaTextStringTools::isTextEqual( xmlStream.name(), QString( "xs" ) ) ) { std::vector gridValuesXs; { @@ -285,7 +286,7 @@ void RifStimPlanXmlReader::readStimplanGridAndTimesteps( QXmlStreamReader& stimPlanFileData->generateXsFromFileXs( mirrorMode == MirrorMode::MIRROR_AUTO ? !hasNegativeValues( gridValuesXs ) : (bool)mirrorMode ); } - else if ( xmlStream.name() == "ys" ) + else if ( RiaTextStringTools::isTextEqual( xmlStream.name(), QString( "ys" ) ) ) { std::vector gridValuesYs; { @@ -304,7 +305,7 @@ void RifStimPlanXmlReader::readStimplanGridAndTimesteps( QXmlStreamReader& stimPlanFileData->m_Ys = ys; } - else if ( xmlStream.name() == "time" ) + else if ( RiaTextStringTools::isTextEqual( xmlStream.name(), QString( "time" ) ) ) { double timeStepValue = getAttributeValueDouble( xmlStream, "value" ); stimPlanFileData->addTimeStep( timeStepValue ); @@ -355,11 +356,11 @@ std::vector> RifStimPlanXmlReader::getAllDepthDataAtTimeStep { std::vector> propertyValuesAtTimestep; - while ( !( xmlStream.isEndElement() && isTextEqual( xmlStream.name(), "time" ) ) ) + while ( !( xmlStream.isEndElement() && RiaTextStringTools::isTextEqual( xmlStream.name(), QString( "time" ) ) ) ) { xmlStream.readNext(); - if ( isTextEqual( xmlStream.name(), "depth" ) ) + if ( RiaTextStringTools::isTextEqual( xmlStream.name(), QString( "depth" ) ) ) { xmlStream.readElementText().toDouble(); std::vector propertyValuesAtDepth; @@ -446,14 +447,6 @@ double RifStimPlanXmlReader::valueInRequiredUnitSystem( RiaDefines::EclipseUnitS return value; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RifStimPlanXmlReader::isTextEqual( const QStringRef& text, const QString& compareText ) -{ - return text.compare( compareText, Qt::CaseInsensitive ) == 0; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -481,7 +474,7 @@ double RifStimPlanXmlReader::getAttributeValueDouble( QXmlStreamReader& xmlStrea double value = HUGE_VAL; for ( const QXmlStreamAttribute& attr : xmlStream.attributes() ) { - if ( isTextEqual( attr.name(), parameterName ) ) + if ( RiaTextStringTools::isTextEqual( attr.name(), parameterName ) ) { value = attr.value().toString().toDouble(); } @@ -497,7 +490,7 @@ QString RifStimPlanXmlReader::getAttributeValueString( QXmlStreamReader& xmlStre QString parameterValue; for ( const QXmlStreamAttribute& attr : xmlStream.attributes() ) { - if ( isTextEqual( attr.name(), parameterName ) ) + if ( RiaTextStringTools::isTextEqual( attr.name(), parameterName ) ) { parameterValue = attr.value().toString(); } diff --git a/ApplicationLibCode/FileInterface/RifWellPathImporter.cpp b/ApplicationLibCode/FileInterface/RifWellPathImporter.cpp index 16dc02d8e5..80d6c595ac 100644 --- a/ApplicationLibCode/FileInterface/RifWellPathImporter.cpp +++ b/ApplicationLibCode/FileInterface/RifWellPathImporter.cpp @@ -20,6 +20,8 @@ #include "RifWellPathImporter.h" +#include "RiaQDateTimeTools.h" + #include "RifJsonEncodeDecode.h" #include "cafUtils.h" @@ -140,7 +142,7 @@ RifWellPathImporter::WellMetaData RifWellPathImporter::readJsonWellMetaData( con QString updateDateStr = jsonMap["updateDate"].toString().trimmed(); uint updateDateUint = updateDateStr.toULongLong() / 1000; // Should be within 32 bit, maximum number is 4294967295 // which corresponds to year 2106 - metadata.m_updateDate.setTime_t( updateDateUint ); + metadata.m_updateDate = RiaQDateTimeTools::fromTime_t( updateDateUint ); return metadata; } diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.h b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.h index e7f8b62937..b5866fe875 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.h @@ -22,6 +22,8 @@ #include "cafPdmObject.h" #include "cafPdmProxyValueField.h" +#include + class RimMswCompletionParameters; class RimWellPathCompletionsLegacy; diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechResultDefinition.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechResultDefinition.cpp index f3c91c25ca..d0b485651c 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechResultDefinition.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechResultDefinition.cpp @@ -361,7 +361,7 @@ void RimGeoMechResultDefinition::fieldChangedByUi( const caf::PdmFieldHandle* ch &m_timeLapseBaseTimestep == changedField || &m_normalizeByHydrostaticPressure == changedField || &m_normalizationAirGap == changedField || &m_referenceTimeStep == changedField || &m_isChecked == changedField ) { - QStringList fieldComponentNames = m_resultVariableUiField().split( QRegExp( "\\s+" ) ); + QStringList fieldComponentNames = m_resultVariableUiField().split( QRegularExpression( "\\s+" ) ); if ( !fieldComponentNames.empty() ) { m_resultPositionType = m_resultPositionTypeUiField; diff --git a/ApplicationLibCode/ProjectDataModel/RimStatisticsPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimStatisticsPlot.cpp index 672473d980..c4b5647235 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStatisticsPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimStatisticsPlot.cpp @@ -49,8 +49,6 @@ #include -using namespace QtCharts; - namespace caf { template <> diff --git a/ApplicationLibCode/ReservoirDataModel/RigReservoirBuilderMock.cpp b/ApplicationLibCode/ReservoirDataModel/RigReservoirBuilderMock.cpp index e7886c8df8..6897c90bf8 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigReservoirBuilderMock.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigReservoirBuilderMock.cpp @@ -29,6 +29,8 @@ #include "RigWellResultFrame.h" #include "RigWellResultPoint.h" +#include + /* rand example: guess the number */ #include #include diff --git a/ApplicationLibCode/SocketInterface/RiaSocketServerDefines.h b/ApplicationLibCode/SocketInterface/RiaSocketServerDefines.h index e46b264ffe..a491f7f7d0 100644 --- a/ApplicationLibCode/SocketInterface/RiaSocketServerDefines.h +++ b/ApplicationLibCode/SocketInterface/RiaSocketServerDefines.h @@ -20,6 +20,8 @@ #include +#include + namespace riOctavePlugin { const int qtDataStreamVersion = QDataStream::Qt_4_0; diff --git a/ApplicationLibCode/UnitTests/CMakeLists.txt b/ApplicationLibCode/UnitTests/CMakeLists.txt index f78d38797a..e34298c1ba 100644 --- a/ApplicationLibCode/UnitTests/CMakeLists.txt +++ b/ApplicationLibCode/UnitTests/CMakeLists.txt @@ -151,13 +151,13 @@ foreach(riFileName ${RI_FILENAMES}) -E copy_if_different ${riFileName} - $ + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ) endforeach() add_custom_target(PreBuildFileCopyTest ${copyCommands}) set_property(TARGET PreBuildFileCopyTest PROPERTY FOLDER "FileCopyTargetsTest") -add_executable(ResInsight-tests ${SOURCE_UNITTEST_FILES} main.cpp) +qt_add_executable(ResInsight-tests ${SOURCE_UNITTEST_FILES} main.cpp) # Make ResInsight-tests depend on the prebuild target. add_dependencies(ResInsight-tests PreBuildFileCopyTest) diff --git a/ApplicationLibCode/UnitTests/RiaStdStringTools-Test.cpp b/ApplicationLibCode/UnitTests/RiaStdStringTools-Test.cpp index ff5c8d976d..da1435e10c 100644 --- a/ApplicationLibCode/UnitTests/RiaStdStringTools-Test.cpp +++ b/ApplicationLibCode/UnitTests/RiaStdStringTools-Test.cpp @@ -10,7 +10,7 @@ //-------------------------------------------------------------------------------------------------- TEST( RiaStdStringToolsTest, ParseNumbers ) { - auto decimalPoint = QLocale::c().decimalPoint().toLatin1(); + auto decimalPoint = QLocale::c().decimalPoint().toLatin1()[0]; { std::string text = "8.73705e+06"; diff --git a/ApplicationLibCode/UnitTests/RiaTextFileCompare-Test.cpp b/ApplicationLibCode/UnitTests/RiaTextFileCompare-Test.cpp index 40616e7ce3..fa184e234d 100644 --- a/ApplicationLibCode/UnitTests/RiaTextFileCompare-Test.cpp +++ b/ApplicationLibCode/UnitTests/RiaTextFileCompare-Test.cpp @@ -8,7 +8,7 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -TEST( RiaTextFileCompareTest, BasicCompareWithDiff ) +TEST( DISABLED_RiaTextFileCompareTest, BasicCompareWithDiff ) { RiaRegressionTest regTestConfig; regTestConfig.readSettingsFromApplicationStore(); @@ -29,7 +29,7 @@ TEST( RiaTextFileCompareTest, BasicCompareWithDiff ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -TEST( RiaTextFileCompareTest, BasicCompareNoDiff ) +TEST( DISABLED_RiaTextFileCompareTest, BasicCompareNoDiff ) { RiaRegressionTest regTestConfig; regTestConfig.readSettingsFromApplicationStore(); @@ -50,7 +50,7 @@ TEST( RiaTextFileCompareTest, BasicCompareNoDiff ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -TEST( RiaTextFileCompareTest, BasicCompareError ) +TEST( DISABLED_RiaTextFileCompareTest, BasicCompareError ) { RiaRegressionTest regTestConfig; regTestConfig.readSettingsFromApplicationStore(); diff --git a/ApplicationLibCode/UnitTests/RimWellPathCompletions-Test.cpp b/ApplicationLibCode/UnitTests/RimWellPathCompletions-Test.cpp index e40e12cd31..f880528045 100644 --- a/ApplicationLibCode/UnitTests/RimWellPathCompletions-Test.cpp +++ b/ApplicationLibCode/UnitTests/RimWellPathCompletions-Test.cpp @@ -2,6 +2,7 @@ #include "RimWellPathCompletions.h" +/* #include //-------------------------------------------------------------------------------------------------- /// @@ -48,3 +49,4 @@ TEST( RimWellPathCompletions, WellNameRegExpValidator ) int dummyPos; EXPECT_EQ( QValidator::Intermediate, validator.validate( emptyString, dummyPos ) ); } +*/ diff --git a/ApplicationLibCode/UserInterface/RiuQtChartView.cpp b/ApplicationLibCode/UserInterface/RiuQtChartView.cpp index fe81705a6b..ba8f5d300d 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartView.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartView.cpp @@ -24,7 +24,7 @@ /// //-------------------------------------------------------------------------------------------------- RiuQtChartView::RiuQtChartView( RimPlotWindow* plotWindow, QWidget* parent ) - : QtCharts::QChartView( parent ) + : QChartView( parent ) , m_plotWindow( plotWindow ) { setMouseTracking( true ); @@ -59,7 +59,7 @@ void RiuQtChartView::mousePressEvent( QMouseEvent* event ) } else { - QtCharts::QChartView::mousePressEvent( event ); + QChartView::mousePressEvent( event ); } } @@ -82,7 +82,7 @@ void RiuQtChartView::mouseReleaseEvent( QMouseEvent* event ) return QGraphicsView::mouseReleaseEvent( event ); } - QtCharts::QChartView::mouseReleaseEvent( event ); + QChartView::mouseReleaseEvent( event ); } } @@ -101,6 +101,6 @@ void RiuQtChartView::mouseMoveEvent( QMouseEvent* event ) } else { - QtCharts::QChartView::mouseMoveEvent( event ); + QChartView::mouseMoveEvent( event ); } } diff --git a/ApplicationLibCode/UserInterface/RiuQtChartView.h b/ApplicationLibCode/UserInterface/RiuQtChartView.h index 9edea6bca5..495251e7db 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartView.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartView.h @@ -29,7 +29,7 @@ class RimPlotWindow; //================================================================================================== // //================================================================================================== -class RiuQtChartView : public QtCharts::QChartView, public RiuInterfaceToViewWindow +class RiuQtChartView : public QChartView, public RiuInterfaceToViewWindow { public: RiuQtChartView( RimPlotWindow* plotWindow, QWidget* parent = nullptr ); diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp index ec410219cc..0052aee434 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp @@ -27,8 +27,10 @@ #include #include +#include #include #include +#include #include #include @@ -41,13 +43,13 @@ RiuQtChartsPlotCurve::RiuQtChartsPlotCurve( RimPlotCurve* ownerRimCurve, const Q { m_plotWidget = nullptr; - m_lineSeries = new QtCharts::QLineSeries(); + m_lineSeries = new QLineSeries(); m_lineSeries->setName( title ); - m_areaSeries = new QtCharts::QAreaSeries(); + m_areaSeries = new QAreaSeries(); m_areaSeries->setName( title ); - m_scatterSeries = new QtCharts::QScatterSeries(); + m_scatterSeries = new QScatterSeries(); m_scatterSeries->setName( title ); m_axisX = RiuPlotAxis::defaultBottom(); @@ -188,16 +190,16 @@ void RiuQtChartsPlotCurve::attachToPlot( RiuPlotWidget* plotWidget ) if ( m_plotWidget->getLineSeries( this ) && m_plotWidget->getScatterSeries( this ) ) { - m_plotWidget->qtChart()->legend()->setMarkerShape( QtCharts::QLegend::MarkerShape::MarkerShapeFromSeries ); + m_plotWidget->qtChart()->legend()->setMarkerShape( QLegend::MarkerShape::MarkerShapeFromSeries ); setVisibleInLegend( true ); lineSeries()->show(); } else { - if ( !m_lineSeries ) m_lineSeries = new QtCharts::QLineSeries(); - if ( !m_areaSeries ) m_areaSeries = new QtCharts::QAreaSeries(); - if ( !m_scatterSeries ) m_scatterSeries = new QtCharts::QScatterSeries(); + if ( !m_lineSeries ) m_lineSeries = new QLineSeries(); + if ( !m_areaSeries ) m_areaSeries = new QAreaSeries(); + if ( !m_scatterSeries ) m_scatterSeries = new QScatterSeries(); m_plotWidget->attach( this, m_lineSeries, m_areaSeries, m_scatterSeries, m_axisX, m_axisY ); // Plot widget takes ownership. @@ -227,13 +229,13 @@ void RiuQtChartsPlotCurve::attachToPlot( RiuPlotWidget* plotWidget ) //-------------------------------------------------------------------------------------------------- void RiuQtChartsPlotCurve::detach() { - QtCharts::QLineSeries* line = lineSeries(); + QLineSeries* line = lineSeries(); if ( line ) { line->hide(); } - QtCharts::QAreaSeries* area = areaSeries(); + QAreaSeries* area = areaSeries(); if ( area ) { area->hide(); @@ -275,10 +277,10 @@ void RiuQtChartsPlotCurve::setSamplesInPlot( const std::vector& xValues, values[i] = QPointF( xValues[i], yValues[i] ); } - QtCharts::QLineSeries* line = lineSeries(); + QLineSeries* line = lineSeries(); line->replace( values ); - QtCharts::QLineSeries* upper = new QtCharts::QLineSeries; + QLineSeries* upper = new QLineSeries; upper->replace( values ); areaSeries()->setUpperSeries( upper ); @@ -308,8 +310,8 @@ void RiuQtChartsPlotCurve::updateScatterSeries() { if ( axis->orientation() == Qt::Orientation::Horizontal ) { - QtCharts::QValueAxis* valueAxis = dynamic_cast( axis ); - QtCharts::QDateTimeAxis* dateTimeAxis = dynamic_cast( axis ); + QValueAxis* valueAxis = dynamic_cast( axis ); + QDateTimeAxis* dateTimeAxis = dynamic_cast( axis ); if ( valueAxis ) { minX = valueAxis->min(); @@ -520,10 +522,10 @@ void RiuQtChartsPlotCurve::setVisibleInLegend( bool isVisibleInLegend ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QtCharts::QLineSeries* RiuQtChartsPlotCurve::lineSeries() const +QLineSeries* RiuQtChartsPlotCurve::lineSeries() const { if ( m_lineSeries ) return m_lineSeries; - if ( m_plotWidget ) return dynamic_cast( m_plotWidget->getLineSeries( this ) ); + if ( m_plotWidget ) return dynamic_cast( m_plotWidget->getLineSeries( this ) ); return nullptr; } @@ -531,10 +533,10 @@ QtCharts::QLineSeries* RiuQtChartsPlotCurve::lineSeries() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QtCharts::QScatterSeries* RiuQtChartsPlotCurve::scatterSeries() const +QScatterSeries* RiuQtChartsPlotCurve::scatterSeries() const { if ( m_scatterSeries ) return m_scatterSeries; - if ( m_plotWidget ) return dynamic_cast( m_plotWidget->getScatterSeries( this ) ); + if ( m_plotWidget ) return dynamic_cast( m_plotWidget->getScatterSeries( this ) ); return nullptr; } @@ -542,10 +544,10 @@ QtCharts::QScatterSeries* RiuQtChartsPlotCurve::scatterSeries() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QtCharts::QAreaSeries* RiuQtChartsPlotCurve::areaSeries() const +QAreaSeries* RiuQtChartsPlotCurve::areaSeries() const { if ( m_areaSeries ) return m_areaSeries; - if ( m_plotWidget ) return dynamic_cast( m_plotWidget->getAreaSeries( this ) ); + if ( m_plotWidget ) return dynamic_cast( m_plotWidget->getAreaSeries( this ) ); return nullptr; } diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h index 3518adf4db..a8cc1925b3 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h @@ -30,6 +30,9 @@ class RiuQtChartsPlotWidget; class RiuPlotCurveSymbol; +class QLineSeries; +class QScatterSeries; +class QAreaSeries; //================================================================================================== // //================================================================================================== @@ -91,17 +94,17 @@ public slots: private: void setSamplesInPlot( const std::vector&, const std::vector& ) override; - bool isQtChartObjectsPresent() const; - QtCharts::QLineSeries* lineSeries() const; - QtCharts::QScatterSeries* scatterSeries() const; - QtCharts::QAreaSeries* areaSeries() const; + bool isQtChartObjectsPresent() const; + QLineSeries* lineSeries() const; + QScatterSeries* scatterSeries() const; + QAreaSeries* areaSeries() const; cvf::BoundingBox computeBoundingBox() const; private: - QtCharts::QLineSeries* m_lineSeries; - QtCharts::QScatterSeries* m_scatterSeries; - QtCharts::QAreaSeries* m_areaSeries; + QLineSeries* m_lineSeries; + QScatterSeries* m_scatterSeries; + QAreaSeries* m_areaSeries; std::shared_ptr m_symbol; QPointer m_plotWidget; RiuPlotAxis m_axisX; diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurveSymbol.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurveSymbol.cpp index a23873ccf2..1cac5db574 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurveSymbol.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurveSymbol.cpp @@ -76,7 +76,7 @@ void RiuQtChartsPlotCurveSymbol::setPixmap( const QPixmap& pixmap ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotCurveSymbol::applyToScatterSeries( QtCharts::QScatterSeries* series ) const +void RiuQtChartsPlotCurveSymbol::applyToScatterSeries( QScatterSeries* series ) const { if ( m_style == PointSymbolEnum::SYMBOL_NONE ) { @@ -99,9 +99,9 @@ void RiuQtChartsPlotCurveSymbol::applyToScatterSeries( QtCharts::QScatterSeries* //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotCurveSymbol::setImageBrush( QtCharts::QScatterSeries* series, const QImage& image ) const +void RiuQtChartsPlotCurveSymbol::setImageBrush( QScatterSeries* series, const QImage& image ) const { - series->setMarkerShape( QtCharts::QScatterSeries::MarkerShapeRectangle ); + series->setMarkerShape( QScatterSeries::MarkerShapeRectangle ); series->setBrush( image ); series->setPen( QColor( Qt::transparent ) ); } diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurveSymbol.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurveSymbol.h index 68af3f7186..77e519cc24 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurveSymbol.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurveSymbol.h @@ -29,11 +29,7 @@ class QPainter; class QPointF; class QRect; - -namespace QtCharts -{ class QScatterSeries; -} //-------------------------------------------------------------------------------------------------- /// @@ -58,12 +54,12 @@ public: QRect boundingRect() const override; - void applyToScatterSeries( QtCharts::QScatterSeries* series ) const; + void applyToScatterSeries( QScatterSeries* series ) const; QImage image() const; private: - void setImageBrush( QtCharts::QScatterSeries* series, const QImage& image ) const; + void setImageBrush( QScatterSeries* series, const QImage& image ) const; QColor m_color; QPen m_pen; diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp index 9b40d74598..566a720f5e 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp @@ -51,8 +51,6 @@ #include #include -using namespace QtCharts; - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h index 68bb3274dc..fe04346933 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h @@ -49,15 +49,12 @@ class QPaintDevice; class QWheelEvent; class RiuQwtDateScaleWrapper; -namespace QtCharts -{ class QValueAxis; class QChart; class QAbstractSeries; class QAbstractAxis; class QChartView; class QCategoryAxis; -}; // namespace QtCharts //================================================================================================== // @@ -159,22 +156,22 @@ public: RiuPlotCurve* createPlotCurve( RimPlotCurve* ownerRimCurve, const QString& title ) override; - QtCharts::QChart* qtChart(); + QChart* qtChart(); - void attach( RiuPlotCurve* plotCurve, - QtCharts::QAbstractSeries* lineSeries, - QtCharts::QAbstractSeries* areaSeries, - QtCharts::QAbstractSeries* scatterSeries, - RiuPlotAxis xAxis, - RiuPlotAxis yAxis ); + void attach( RiuPlotCurve* plotCurve, + QAbstractSeries* lineSeries, + QAbstractSeries* areaSeries, + QAbstractSeries* scatterSeries, + RiuPlotAxis xAxis, + RiuPlotAxis yAxis ); void detach( RiuPlotCurve* plotCurve ); - QtCharts::QAbstractSeries* getLineSeries( const RiuPlotCurve* plotCurve ) const; - QtCharts::QAbstractSeries* getAreaSeries( const RiuPlotCurve* plotCurve ) const; - QtCharts::QAbstractSeries* getScatterSeries( const RiuPlotCurve* plotCurve ) const; + QAbstractSeries* getLineSeries( const RiuPlotCurve* plotCurve ) const; + QAbstractSeries* getAreaSeries( const RiuPlotCurve* plotCurve ) const; + QAbstractSeries* getScatterSeries( const RiuPlotCurve* plotCurve ) const; - void setXAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series, RiuQtChartsPlotCurve* plotCurve ); - void setYAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series, RiuQtChartsPlotCurve* plotCurve ); + void setXAxis( RiuPlotAxis axis, QAbstractSeries* series, RiuQtChartsPlotCurve* plotCurve ); + void setYAxis( RiuPlotAxis axis, QAbstractSeries* series, RiuQtChartsPlotCurve* plotCurve ); const QColor& backgroundColor() const override; @@ -190,7 +187,7 @@ public: RiaDefines::TimeFormatComponents timeComponents ); protected: - void attachSeriesToAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series, RiuQtChartsPlotCurve* plotCurve ); + void attachSeriesToAxis( RiuPlotAxis axis, QAbstractSeries* series, RiuQtChartsPlotCurve* plotCurve ); void resizeEvent( QResizeEvent* event ) override; void keyPressEvent( QKeyEvent* event ) override; @@ -206,9 +203,9 @@ protected: virtual bool isZoomerActive() const; virtual void endZoomOperations(); - void rescaleAxis( RiuPlotAxis axis ); - QtCharts::QAbstractAxis* plotAxis( RiuPlotAxis axis ) const; - Qt::Orientation orientation( RiaDefines::PlotAxis axis ) const; + void rescaleAxis( RiuPlotAxis axis ); + QAbstractAxis* plotAxis( RiuPlotAxis axis ) const; + Qt::Orientation orientation( RiaDefines::PlotAxis axis ) const; void dragEnterEvent( QDragEnterEvent* event ) override; void dropEvent( QDropEvent* event ) override; @@ -230,20 +227,20 @@ private: static int defaultMinimumWidth(); void replot() override; - QtCharts::QCategoryAxis* categoryAxis(); + QCategoryAxis* categoryAxis(); - QString createNameFromSeries( QtCharts::QAbstractSeries* series ) const; + QString createNameFromSeries( QAbstractSeries* series ) const; private: - QPointer m_viewer; + QPointer m_viewer; - std::map m_axes; - std::map m_axesEnabled; - std::map m_axesAutoScale; + std::map m_axes; + std::map m_axesEnabled; + std::map m_axesAutoScale; - std::map m_lineSeriesMap; - std::map m_areaSeriesMap; - std::map m_scatterSeriesMap; + std::map m_lineSeriesMap; + std::map m_areaSeriesMap; + std::map m_scatterSeriesMap; RiuQwtDateScaleWrapper* m_dateScaleWrapper; RiuQtChartsToolTip* m_toolTip; diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsToolTip.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsToolTip.cpp index 151f9a8f31..a2bd19ae76 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsToolTip.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsToolTip.cpp @@ -24,12 +24,10 @@ #include #include -using namespace QtCharts; - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuQtChartsToolTip::RiuQtChartsToolTip( QChart* chart, QtCharts::QAbstractSeries* series ) +RiuQtChartsToolTip::RiuQtChartsToolTip( QChart* chart, QAbstractSeries* series ) : QGraphicsItem( chart ) , m_chart( chart ) , m_series( series ) diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsToolTip.h b/ApplicationLibCode/UserInterface/RiuQtChartsToolTip.h index d741bb83f9..5a399b2b41 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsToolTip.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsToolTip.h @@ -26,9 +26,9 @@ class RiuQtChartsToolTip : public QGraphicsItem { public: - RiuQtChartsToolTip( QtCharts::QChart* parent, QtCharts::QAbstractSeries* series ); + RiuQtChartsToolTip( QChart* parent, QAbstractSeries* series ); - void setSeries( QtCharts::QAbstractSeries* series ); + void setSeries( QAbstractSeries* series ); void setText( const QString& text ); void setAnchor( QPointF point ); void updateGeometry(); @@ -37,12 +37,12 @@ public: void paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget ) override; private: - QString m_text; - QRectF m_textRect; - QRectF m_rect; - QPointF m_anchor; - QFont m_font; - int m_radius; - QtCharts::QChart* m_chart; - QtCharts::QAbstractSeries* m_series; + QString m_text; + QRectF m_textRect; + QRectF m_rect; + QPointF m_anchor; + QFont m_font; + int m_radius; + QChart* m_chart; + QAbstractSeries* m_series; }; diff --git a/ApplicationLibCode/UserInterface/RiuTreeViewEventFilter.cpp b/ApplicationLibCode/UserInterface/RiuTreeViewEventFilter.cpp index bd57e9d412..5fa1974f36 100644 --- a/ApplicationLibCode/UserInterface/RiuTreeViewEventFilter.cpp +++ b/ApplicationLibCode/UserInterface/RiuTreeViewEventFilter.cpp @@ -55,7 +55,7 @@ RiuTreeViewEventFilter::RiuTreeViewEventFilter( QObject* parent, caf::PdmUiTreeV //-------------------------------------------------------------------------------------------------- bool RiuTreeViewEventFilter::activateFeatureFromKeyEvent( QKeyEvent* keyEvent ) { - QKeySequence keySeq( keyEvent->modifiers() + keyEvent->key() ); + QKeySequence keySeq( keyEvent->keyCombination() ); bool wasFeatureActivated = false; @@ -137,7 +137,7 @@ bool RiuTreeViewEventFilter::eventFilter( QObject* obj, QEvent* event ) } else { - QKeySequence keySeq( keyEvent->modifiers() + keyEvent->key() ); + QKeySequence keySeq( keyEvent->keyCombination() ); matches = caf::CmdFeatureManager::instance()->commandFeaturesMatchingKeyboardShortcut( keySeq ); } diff --git a/ApplicationLibCode/UserInterface/RiuViewer.cpp b/ApplicationLibCode/UserInterface/RiuViewer.cpp index ff55dfc44e..9f4810a832 100644 --- a/ApplicationLibCode/UserInterface/RiuViewer.cpp +++ b/ApplicationLibCode/UserInterface/RiuViewer.cpp @@ -1107,7 +1107,7 @@ void RiuViewer::mouseMoveEvent( QMouseEvent* mouseEvent ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuViewer::enterEvent( QEvent* e ) +void RiuViewer::enterEvent( QEnterEvent* e ) { if ( s_hoverCursor ) { diff --git a/ApplicationLibCode/UserInterface/RiuViewer.h b/ApplicationLibCode/UserInterface/RiuViewer.h index e25aa6c378..8f402176f3 100644 --- a/ApplicationLibCode/UserInterface/RiuViewer.h +++ b/ApplicationLibCode/UserInterface/RiuViewer.h @@ -143,7 +143,7 @@ protected: void optimizeClippingPlanes() override; void resizeGL( int width, int height ) override; void mouseMoveEvent( QMouseEvent* e ) override; - void enterEvent( QEvent* e ) override; + void enterEvent( QEnterEvent* e ) override; void leaveEvent( QEvent* ) override; private: diff --git a/CMakeLists.txt b/CMakeLists.txt index 9378325474..2cfbdd7fa0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,8 +5,17 @@ include(FetchContent) project(ResInsight) +# Ensure all binary files ensd up in the same folder as the executable +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + set(VIZ_MODULES_FOLDER_NAME Fwk/VizFwk) +# !!! For now, we force Qt to version 5 +set(CEE_USE_QT5 OFF) +message(STATUS "Forcing setting of CEE_USE_QT6 to ON") +set(CEE_USE_QT6 ON) +message(STATUS "CEE_USE_QT6=${CEE_USE_QT6}") + cmake_policy(SET CMP0020 NEW) if(POLICY CMP0077) cmake_policy(SET CMP0077 NEW) @@ -532,12 +541,29 @@ endif() # ############################################################################## # Qt # ############################################################################## -set(RI_QT_MINIMUM_VERSION 5.12) find_package( - Qt5 ${RI_QT_MINIMUM_VERSION} COMPONENTS Core Gui OpenGL Network NetworkAuth - Widgets + Qt6 + COMPONENTS + REQUIRED + Core + Gui + OpenGL + Network + Widgets + Charts + Core5Compat ) +set(QT_LIBRARIES + Qt6::Core + Qt6::Gui + Qt6::OpenGL + Qt6::Network + Qt6::Widgets + Qt6::Charts + Qt6::Core5Compat +) +qt_standard_project_setup() # Open GL find_package(OpenGL) @@ -545,23 +571,13 @@ find_package(OpenGL) # ############################################################################## # QtCharts # ############################################################################## -option(RESINSIGHT_USE_QT_CHARTS "Enable QtCharts in the code" ON) -if(RESINSIGHT_USE_QT_CHARTS) - find_package(Qt5 OPTIONAL_COMPONENTS Charts) - - if(Qt5Charts_FOUND) - message(STATUS "QtCharts found: ${Qt5Charts_LIBRARIES}") - add_definitions(-DUSE_QTCHARTS) - else() - message(STATUS "QtCharts not found.") - set(RESINSIGHT_USE_QT_CHARTS OFF) - endif() -endif() +set(RESINSIGHT_USE_QT_CHARTS ON) +add_definitions(-DUSE_QTCHARTS) # ############################################################################## # Qwt # ############################################################################## - +set(USE_QT6 ON) add_subdirectory(ThirdParty/qwt) if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") @@ -581,18 +597,19 @@ list(APPEND THIRD_PARTY_LIBRARIES qwt) # Qt Advanced Docking System # ############################################################################## set(ADS_VERSION "4.2.1") +set(QT_VERSION_MAJOR 6) add_subdirectory(ThirdParty/qtadvanceddocking EXCLUDE_FROM_ALL) if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - target_compile_options(qt5advanceddocking PRIVATE -Wno-deprecated-copy) + target_compile_options(qt6advanceddocking PRIVATE -Wno-deprecated-copy) elseif(MSVC) - target_compile_options(qt5advanceddocking PRIVATE /wd4996 /wd4005) + target_compile_options(qt6advanceddocking PRIVATE /wd4996 /wd4005) elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - target_compile_options(qt5advanceddocking PRIVATE -Wno-deprecated) + target_compile_options(qt6advanceddocking PRIVATE -Wno-deprecated) endif() -list(APPEND THIRD_PARTY_LIBRARIES qt5advanceddocking) +list(APPEND THIRD_PARTY_LIBRARIES qt6advanceddocking) # ############################################################################## # Nightcharts @@ -773,21 +790,13 @@ if(RESINSIGHT_ENABLE_UNITY_BUILD) # message("Cmake Unity build is enabled on : custom-opm-common") # set_property(TARGET custom-opm-common PROPERTY UNITY_BUILD true) message("Cmake Unity build is enabled on : qtadvanceddocking") - set_property(TARGET qt5advanceddocking PROPERTY UNITY_BUILD true) + set_property(TARGET qt6advanceddocking PROPERTY UNITY_BUILD true) endif() # ############################################################################## # Vizualization Framework # ############################################################################## -# !!! For now, we force Qt to version 5 -message(STATUS "Forcing setting of CEE_USE_QT5 to ON") -set(CEE_USE_QT5 - ON - CACHE BOOL "Force usage of Qt5" FORCE -) -message(STATUS "CEE_USE_QT5=${CEE_USE_QT5}") - add_subdirectory(${VIZ_MODULES_FOLDER_NAME}/LibCore) add_subdirectory(${VIZ_MODULES_FOLDER_NAME}/LibGeometry) add_subdirectory(${VIZ_MODULES_FOLDER_NAME}/LibRender) @@ -937,7 +946,9 @@ endif() # Installation settings # ############################################################################## -set(RESINSIGHT_INSTALL_FOLDER ".") +# Set the install folder to be the bin folder. TODO: Move Python scripts to a +# separate folder +set(RESINSIGHT_INSTALL_FOLDER "bin") # override system install prefix if private installation chosen option(RESINSIGHT_PRIVATE_INSTALL @@ -1068,17 +1079,6 @@ install(TARGETS extract-projectfile-versions DESTINATION ${RESINSIGHT_INSTALL_FOLDER} ) -if(MSVC) - # Install all the DLLs needed for the executable. System dependencies are not - # included - install( - TARGETS ResInsight - DESTINATION ${RESINSIGHT_INSTALL_FOLDER} - RUNTIME_DEPENDENCIES PRE_EXCLUDE_REGEXES "api-ms-" "ext-ms-" - POST_EXCLUDE_REGEXES ".*system32/.*\\.dll" - ) -endif(MSVC) - # ############################################################################## # Add OpenSSL 1.1.1 libraries The OpenSSL libraries are needed for the # NetworkAuth module in Qt 5 Installed by adding openssl-windows in vcpkg.json diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000000..6b8cf75a0d --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,19 @@ +{ + "version": 2, + "configurePresets": [ + { + "name": "ninja", + "hidden": true, + "generator": "Ninja", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": "ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake", + "RESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS": true, + "RESINSIGHT_TREAT_WARNINGS_AS_ERRORS": true, + "RESINSIGHT_ENABLE_UNITY_BUILD": false, + "RESINSIGHT_ENABLE_GRPC": false, + "CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install" + } + } + ] +} \ No newline at end of file diff --git a/CMakeUserPresets-example.json b/CMakeUserPresets-example.json new file mode 100644 index 0000000000..efb7750448 --- /dev/null +++ b/CMakeUserPresets-example.json @@ -0,0 +1,45 @@ +{ + "version": 2, + "configurePresets": [ + { + "name": "windows-base", + "hidden": true, + "displayName": "Windows Base", + "inherits": "ninja", + "architecture": { + "value": "x64", + "strategy": "external" + }, + "cacheVariables": { + "VCPKG_TARGET_TRIPLET": "x64-windows-release", + "RESINSIGHT_ENABLE_UNITY_BUILD": true, + "RESINSIGHT_ENABLE_GRPC": true, + "CMAKE_PREFIX_PATH": "c:/Qt/6.6.3/msvc2019_64;f:/tools/buildcache/bin", + "RESINSIGHT_GRPC_PYTHON_EXECUTABLE": "c:/Users/MagneSjaastad/AppData/Local/Programs/Python/Python38/python.exe", + "RESINSIGHT_ODB_API_DIR": "c:/odb/odb_2020/odb_api" + + } + }, + { + "name": "x64-debug", + "displayName": "x64 Debug", + "description": "Target Windows (64-bit) with the Visual Studio development environment. (Debug)", + "inherits": "windows-base", + "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" } + }, + { + "name": "x64-relwithdebinfo", + "displayName": "x64 Release with Debug Info", + "description": "Target Windows (64-bit) with the Visual Studio development environment. (RelWithDebInfo)", + "inherits": "windows-base", + "cacheVariables": { "CMAKE_BUILD_TYPE": "RelWithDebInfo" } + }, + { + "name": "x64-release", + "displayName": "x64 Release", + "description": "Target Windows (64-bit) with the Visual Studio development environment. (Release)", + "inherits": "windows-base", + "cacheVariables": { "CMAKE_BUILD_TYPE": "Release" } + } + ] +} \ No newline at end of file diff --git a/Fwk/AppFwk/cafTests/cafTestApplication/CMakeLists.txt b/Fwk/AppFwk/cafTests/cafTestApplication/CMakeLists.txt index 58491526c2..872198ae96 100644 --- a/Fwk/AppFwk/cafTests/cafTestApplication/CMakeLists.txt +++ b/Fwk/AppFwk/cafTests/cafTestApplication/CMakeLists.txt @@ -24,7 +24,6 @@ if(CEE_USE_QT6) ) set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL Qt6::Svg) qt_standard_project_setup() - set(CMAKE_AUTORCC ON) else() find_package( Qt5 diff --git a/Fwk/AppFwk/cafViewer/CMakeLists.txt b/Fwk/AppFwk/cafViewer/CMakeLists.txt index 1c09b2cd31..a3f0d1f83a 100644 --- a/Fwk/AppFwk/cafViewer/CMakeLists.txt +++ b/Fwk/AppFwk/cafViewer/CMakeLists.txt @@ -27,6 +27,8 @@ else() ) set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL) qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES}) + + set(QT5_OPENGL_FILES cafOpenGLWidget.cpp cafOpenGLWidget.h) endif() add_library( diff --git a/GrpcInterface/CMakeLists.txt b/GrpcInterface/CMakeLists.txt index e65a2fecf4..a88ddb3714 100644 --- a/GrpcInterface/CMakeLists.txt +++ b/GrpcInterface/CMakeLists.txt @@ -20,15 +20,6 @@ set(CMAKE_CXX_STANDARD 17) add_definitions(-D_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING) -find_package( - Qt5 - COMPONENTS Core Network - QUIET) - -set(QT_LIBRARIES - Qt5::Core - Qt5::Network) - set(SOURCE_GROUP_HEADER_FILES RiaGrpcServer.h RiaGrpcHelper.h diff --git a/ThirdParty/extract-projectfile-versions/CMakeLists.txt b/ThirdParty/extract-projectfile-versions/CMakeLists.txt index 9c21b24629..e540e992a1 100644 --- a/ThirdParty/extract-projectfile-versions/CMakeLists.txt +++ b/ThirdParty/extract-projectfile-versions/CMakeLists.txt @@ -7,11 +7,11 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) -find_package(Qt5 COMPONENTS Core Sql REQUIRED) +find_package(Qt6 COMPONENTS Core Sql REQUIRED) add_executable(extract-projectfile-versions main.cpp) -target_link_libraries(extract-projectfile-versions Qt5::Core Qt5::Sql) +target_link_libraries(extract-projectfile-versions Qt6::Core Qt6::Sql) if(MSVC) add_custom_command( From 13cf4508317aa5345a285478bab354138d279dd5 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 11 Sep 2024 12:40:09 +0200 Subject: [PATCH 005/160] Add result calculator for PORV*SOIL, PORV*SGAS, and PORV*(SOIL+SGAS). --- .../Application/RiaResultNames.cpp | 24 +++ .../Application/RiaResultNames.h | 3 + .../ResultCalculators/CMakeLists_files.cmake | 2 + .../RigPorvSoilSgasResultCalculator.cpp | 139 ++++++++++++++++++ .../RigPorvSoilSgasResultCalculator.h | 49 ++++++ .../RigCaseCellResultsData.cpp | 50 ++++++- .../RigCaseCellResultsData.h | 2 + 7 files changed, 268 insertions(+), 1 deletion(-) create mode 100644 ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigPorvSoilSgasResultCalculator.cpp create mode 100644 ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigPorvSoilSgasResultCalculator.h diff --git a/ApplicationLibCode/Application/RiaResultNames.cpp b/ApplicationLibCode/Application/RiaResultNames.cpp index ac928bf83d..74f19a0bef 100644 --- a/ApplicationLibCode/Application/RiaResultNames.cpp +++ b/ApplicationLibCode/Application/RiaResultNames.cpp @@ -325,6 +325,30 @@ QString RiaResultNames::riOilVolumeResultName() return "riOILVOLUME"; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaResultNames::riPorvSoil() +{ + return "riPORV*SOIL"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaResultNames::riPorvSgas() +{ + return "riPORV*SGAS"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaResultNames::riPorvSoilSgas() +{ + return "riPORV*(SOIL+SGAS)"; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaResultNames.h b/ApplicationLibCode/Application/RiaResultNames.h index 96c97c6046..08729868a0 100644 --- a/ApplicationLibCode/Application/RiaResultNames.h +++ b/ApplicationLibCode/Application/RiaResultNames.h @@ -67,6 +67,9 @@ QString combinedRiAreaNormTranResultName(); QString riCellVolumeResultName(); QString riOilVolumeResultName(); QString mobilePoreVolumeName(); +QString riPorvSoil(); +QString riPorvSgas(); +QString riPorvSoilSgas(); QString faultReactAssessmentPrefix(); diff --git a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/CMakeLists_files.cmake b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/CMakeLists_files.cmake index 3574828f35..eec6b78e88 100644 --- a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/CMakeLists_files.cmake +++ b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/CMakeLists_files.cmake @@ -8,6 +8,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RigCellVolumeResultCalculator.h ${CMAKE_CURRENT_LIST_DIR}/RigAllanUtil.h ${CMAKE_CURRENT_LIST_DIR}/RigCellsWithNncsCalculator.h + ${CMAKE_CURRENT_LIST_DIR}/RigPorvSoilSgasResultCalculator.cpp ) set(SOURCE_GROUP_SOURCE_FILES @@ -20,6 +21,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RigCellVolumeResultCalculator.cpp ${CMAKE_CURRENT_LIST_DIR}/RigAllanUtil.cpp ${CMAKE_CURRENT_LIST_DIR}/RigCellsWithNncsCalculator.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigPorvSoilSgasResultCalculator.cpp ) list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigPorvSoilSgasResultCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigPorvSoilSgasResultCalculator.cpp new file mode 100644 index 0000000000..09710e0d13 --- /dev/null +++ b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigPorvSoilSgasResultCalculator.cpp @@ -0,0 +1,139 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "RigPorvSoilSgasResultCalculator.h" +#include "RiaDefines.h" +#include "RiaResultNames.h" +#include "RigActiveCellInfo.h" +#include "RigCaseCellResultsData.h" +#include "RigEclipseResultAddress.h" +#include "RigMainGrid.h" + +//================================================================================================== +/// +//================================================================================================== +RigPorvSoilSgasResultCalculator::RigPorvSoilSgasResultCalculator( RigCaseCellResultsData& resultsData ) + : RigEclipseResultCalculator( resultsData ) +{ +} + +//================================================================================================== +/// +//================================================================================================== +RigPorvSoilSgasResultCalculator::~RigPorvSoilSgasResultCalculator() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RigPorvSoilSgasResultCalculator::isMatching( const RigEclipseResultAddress& resVarAddr ) const +{ + return ( ( resVarAddr.resultName() == RiaResultNames::riPorvSoil() || resVarAddr.resultName() == RiaResultNames::riPorvSgas() || + resVarAddr.resultName() == RiaResultNames::riPorvSoilSgas() ) && + resVarAddr.resultCatType() == RiaDefines::ResultCatType::DYNAMIC_NATIVE ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigPorvSoilSgasResultCalculator::calculate( const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex ) +{ + RigEclipseResultAddress soilAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::soil() ); + RigEclipseResultAddress sgasAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::sgas() ); + RigEclipseResultAddress porvAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "PORV" ); + + if ( resVarAddr.resultName() == RiaResultNames::riPorvSoil() ) + { + calculateProduct( porvAddress, soilAddress, resVarAddr ); + } + else if ( resVarAddr.resultName() == RiaResultNames::riPorvSgas() ) + { + calculateProduct( porvAddress, sgasAddress, resVarAddr ); + } + else if ( resVarAddr.resultName() == RiaResultNames::riPorvSoilSgas() ) + { + RigEclipseResultAddress soilAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::riPorvSoil() ); + RigEclipseResultAddress sgasAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::riPorvSgas() ); + + calculateSum( soilAddress, sgasAddress, resVarAddr ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigPorvSoilSgasResultCalculator::calculateProduct( const RigEclipseResultAddress& in1Addr, + const RigEclipseResultAddress& in2Addr, + const RigEclipseResultAddress& outAddr ) +{ + calculate( in1Addr, in2Addr, outAddr, std::multiplies{} ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigPorvSoilSgasResultCalculator::calculateSum( const RigEclipseResultAddress& in1Addr, + const RigEclipseResultAddress& in2Addr, + const RigEclipseResultAddress& outAddr ) +{ + calculate( in1Addr, in2Addr, outAddr, std::plus{} ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigPorvSoilSgasResultCalculator::calculate( const RigEclipseResultAddress& in1Addr, + const RigEclipseResultAddress& in2Addr, + const RigEclipseResultAddress& outAddr, + std::function op ) +{ + size_t in1Idx = m_resultsData->findOrLoadKnownScalarResult( in1Addr ); + size_t in2Idx = m_resultsData->findOrLoadKnownScalarResult( in2Addr ); + + size_t outIdx = m_resultsData->findOrCreateScalarResultIndex( outAddr, false ); + m_resultsData->m_cellScalarResults[outIdx].resize( m_resultsData->maxTimeStepCount() ); + + size_t activeCellCount = m_resultsData->m_activeCellInfo->reservoirActiveCellCount(); + for ( size_t timeStepIdx = 0; timeStepIdx < m_resultsData->maxTimeStepCount(); timeStepIdx++ ) + { + size_t timeStep1Idx = in1Addr.resultCatType() != RiaDefines::ResultCatType::STATIC_NATIVE ? timeStepIdx : 0; + const std::vector& in1Results = m_resultsData->m_cellScalarResults[in1Idx][timeStep1Idx]; + size_t timeStep2Idx = in2Addr.resultCatType() != RiaDefines::ResultCatType::STATIC_NATIVE ? timeStepIdx : 0; + const std::vector& in2Results = m_resultsData->m_cellScalarResults[in2Idx][timeStep2Idx]; + + std::vector& outResults = m_resultsData->m_cellScalarResults[outIdx][timeStepIdx]; + outResults.resize( activeCellCount, 0.0 ); + + bool res1ActiveOnly = in1Results.size() == activeCellCount; + bool res2ActiveOnly = in2Results.size() == activeCellCount; + +#pragma omp parallel for + for ( int nativeResvCellIndex = 0; nativeResvCellIndex < static_cast( m_resultsData->m_ownerMainGrid->globalCellArray().size() ); + nativeResvCellIndex++ ) + { + size_t resultIndex = m_resultsData->activeCellInfo()->cellResultIndex( nativeResvCellIndex ); + if ( resultIndex != cvf::UNDEFINED_SIZE_T ) + { + size_t idx1 = res1ActiveOnly ? resultIndex : nativeResvCellIndex; + size_t idx2 = res2ActiveOnly ? resultIndex : nativeResvCellIndex; + outResults[resultIndex] = op( in1Results[idx1], in2Results[idx2] ); + } + } + } +} diff --git a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigPorvSoilSgasResultCalculator.h b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigPorvSoilSgasResultCalculator.h new file mode 100644 index 0000000000..134e44a652 --- /dev/null +++ b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigPorvSoilSgasResultCalculator.h @@ -0,0 +1,49 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 +#include + +#include "RigEclipseResultCalculator.h" + +class RigCaseCellResultsData; +class RigEclipseResultAddress; + +//================================================================================================== +/// +//================================================================================================== +class RigPorvSoilSgasResultCalculator : public RigEclipseResultCalculator +{ +public: + RigPorvSoilSgasResultCalculator( RigCaseCellResultsData& resultsData ); + ~RigPorvSoilSgasResultCalculator() override; + bool isMatching( const RigEclipseResultAddress& resVarAddr ) const override; + void calculate( const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex ) override; + +private: + void calculateProduct( const RigEclipseResultAddress& in1Addr, + const RigEclipseResultAddress& in2Addr, + const RigEclipseResultAddress& outAddr ); + void calculateSum( const RigEclipseResultAddress& in1Addr, const RigEclipseResultAddress& in2Addr, const RigEclipseResultAddress& outAddr ); + void calculate( const RigEclipseResultAddress& in1Addr, + const RigEclipseResultAddress& in2Addr, + const RigEclipseResultAddress& outAddr, + std::function op ); +}; diff --git a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp index cb2f55eec1..379983c996 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp @@ -45,6 +45,7 @@ #include "RigMainGrid.h" #include "RigMobilePoreVolumeResultCalculator.h" #include "RigOilVolumeResultCalculator.h" +#include "RigPorvSoilSgasResultCalculator.h" #include "RigSoilResultCalculator.h" #include "RigStatisticsDataCache.h" #include "RigStatisticsMath.h" @@ -1140,6 +1141,30 @@ void RigCaseCellResultsData::createPlaceholderResultEntries() findOrCreateScalarResultIndex( RiaResultNames::staticIntegerAddress( RiaResultNames::indexKResultName() ), needsToBeStored ); } + if ( hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "PORV" ) ) ) + { + bool hasSgas = hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::sgas() ) ); + bool hasSoil = hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::soil() ) ); + if ( hasSoil ) + { + findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::riPorvSoil() ), + needsToBeStored ); + } + + if ( hasSgas ) + { + findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::riPorvSgas() ), + needsToBeStored ); + } + + if ( hasSoil && hasSgas ) + { + findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, + RiaResultNames::riPorvSoilSgas() ), + needsToBeStored ); + } + } + // Fault distance { findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::faultDistanceName() ), @@ -1496,6 +1521,11 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResult( const RigEclipseResu computeCellVolumes(); computeOilVolumes(); } + else if ( resultName == RiaResultNames::riPorvSoil() || resultName == RiaResultNames::riPorvSgas() || + resultName == RiaResultNames::riPorvSoilSgas() ) + { + computePorvSoilSgas(); + } // Allan results if ( resultName == RiaResultNames::formationAllanResultName() || resultName == RiaResultNames::formationBinaryAllanResultName() ) @@ -1535,7 +1565,7 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResult( const RigEclipseResu //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -size_t RigCaseCellResultsData::findOrLoadKnownScalarResultByResultTypeOrder( const RigEclipseResultAddress& resVarAddr, +size_t RigCaseCellResultsData::findOrLoadKnownScalarResultByResultTypeOrder( const RigEclipseResultAddress& resVarAddr, const std::vector& resultCategorySearchOrder ) { std::set otherResultTypesToSearch = { RiaDefines::ResultCatType::STATIC_NATIVE, @@ -2726,6 +2756,24 @@ void RigCaseCellResultsData::computeOilVolumes() calculator.calculate( addr, -1 ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigCaseCellResultsData::computePorvSoilSgas() +{ + std::vector results = { RiaResultNames::riPorvSoil(), RiaResultNames::riPorvSgas(), RiaResultNames::riPorvSoilSgas() }; + + RigPorvSoilSgasResultCalculator calculator( *this ); + + for ( QString resultName : results ) + { + RigEclipseResultAddress addr( RiaDefines::ResultCatType::DYNAMIC_NATIVE, resultName ); + + // Computes for all time steps + calculator.calculate( addr, -1 ); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.h b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.h index 24a917f6ed..6d33b72b87 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.h +++ b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.h @@ -170,6 +170,7 @@ private: friend class RigOilVolumeResultCalculator; friend class RigCellVolumeResultCalculator; friend class RigCellsWithNncsCalculator; + friend class RigPorvSoilSgasResultCalculator; size_t findOrCreateScalarResultIndex( const RigEclipseResultAddress& resVarAddr, bool needsToBeStored ); @@ -199,6 +200,7 @@ private: void computeOilVolumes(); void computeMobilePV(); + void computePorvSoilSgas(); void computeIndexResults(); void computeFaultDistance(); From b760fcebe2dc2c5881142eefb0498bd769e55e64 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 11 Sep 2024 14:22:35 +0200 Subject: [PATCH 006/160] #11689 Well Target Candidates: generate on well target clusters for single case. --- .../Commands/CMakeLists_files.cmake | 2 + ...ewWellTargetCandidatesGeneratorFeature.cpp | 49 ++ ...cNewWellTargetCandidatesGeneratorFeature.h | 33 + .../ProjectDataModel/CMakeLists_files.cmake | 2 + .../RimEclipseCaseEnsemble.cpp | 12 + .../ProjectDataModel/RimEclipseCaseEnsemble.h | 12 +- .../RimWellTargetCandidatesGenerator.cpp | 296 +++++++++ .../RimWellTargetCandidatesGenerator.h | 74 +++ .../ReservoirDataModel/CMakeLists_files.cmake | 2 + .../RigPorvSoilSgasResultCalculator.cpp | 4 +- .../RigPorvSoilSgasResultCalculator.h | 2 +- .../RigCaseCellResultsData.cpp | 2 +- .../RigWellTargetCandidatesGenerator.cpp | 603 ++++++++++++++++++ .../RigWellTargetCandidatesGenerator.h | 180 ++++++ 14 files changed, 1265 insertions(+), 8 deletions(-) create mode 100644 ApplicationLibCode/Commands/RicNewWellTargetCandidatesGeneratorFeature.cpp create mode 100644 ApplicationLibCode/Commands/RicNewWellTargetCandidatesGeneratorFeature.h create mode 100644 ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.h create mode 100644 ApplicationLibCode/ReservoirDataModel/RigWellTargetCandidatesGenerator.cpp create mode 100644 ApplicationLibCode/ReservoirDataModel/RigWellTargetCandidatesGenerator.h diff --git a/ApplicationLibCode/Commands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/CMakeLists_files.cmake index 3adb164c67..d96866c0a6 100644 --- a/ApplicationLibCode/Commands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/CMakeLists_files.cmake @@ -96,6 +96,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicImportWellLogCsvFileFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewViewForGridEnsembleFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewCustomVfpPlotFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicNewWellTargetCandidatesGeneratorFeature.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -196,6 +197,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicImportWellLogOsduFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewViewForGridEnsembleFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewCustomVfpPlotFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicNewWellTargetCandidatesGeneratorFeature.cpp ) if(RESINSIGHT_USE_QT_CHARTS) diff --git a/ApplicationLibCode/Commands/RicNewWellTargetCandidatesGeneratorFeature.cpp b/ApplicationLibCode/Commands/RicNewWellTargetCandidatesGeneratorFeature.cpp new file mode 100644 index 0000000000..77d0875b5f --- /dev/null +++ b/ApplicationLibCode/Commands/RicNewWellTargetCandidatesGeneratorFeature.cpp @@ -0,0 +1,49 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024 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 "RicNewWellTargetCandidatesGeneratorFeature.h" + +#include "RimEclipseCaseEnsemble.h" +#include "RimWellTargetCandidatesGenerator.h" + +#include "cafSelectionManagerTools.h" + +#include + +CAF_CMD_SOURCE_INIT( RicNewWellTargetCandidatesGeneratorFeature, "RicNewWellTargetCandidatesGeneratorFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewWellTargetCandidatesGeneratorFeature::onActionTriggered( bool isChecked ) +{ + auto ensembles = caf::selectedObjectsByTypeStrict(); + if ( ensembles.empty() ) return; + + auto ensemble = ensembles.front(); + ensemble->addWellTargetsGenerator( new RimWellTargetCandidatesGenerator() ); + ensemble->updateConnectedEditors(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewWellTargetCandidatesGeneratorFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Create Well Target Candidates Generator" ); +} diff --git a/ApplicationLibCode/Commands/RicNewWellTargetCandidatesGeneratorFeature.h b/ApplicationLibCode/Commands/RicNewWellTargetCandidatesGeneratorFeature.h new file mode 100644 index 0000000000..77430ae978 --- /dev/null +++ b/ApplicationLibCode/Commands/RicNewWellTargetCandidatesGeneratorFeature.h @@ -0,0 +1,33 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024 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 "cafCmdFeature.h" + +//================================================================================================== +/// +//================================================================================================== +class RicNewWellTargetCandidatesGeneratorFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +private: + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; diff --git a/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake index 67bccb2642..617e3b95fb 100644 --- a/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake @@ -134,6 +134,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RimEclipseViewCollection.h ${CMAKE_CURRENT_LIST_DIR}/RimEclipseCaseEnsemble.h ${CMAKE_CURRENT_LIST_DIR}/RimCameraPosition.h + ${CMAKE_CURRENT_LIST_DIR}/RimWellTargetCandidatesGenerator.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -268,6 +269,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimEclipseViewCollection.cpp ${CMAKE_CURRENT_LIST_DIR}/RimEclipseCaseEnsemble.cpp ${CMAKE_CURRENT_LIST_DIR}/RimCameraPosition.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimWellTargetCandidatesGenerator.cpp ) if(RESINSIGHT_USE_QT_CHARTS) diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCaseEnsemble.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseCaseEnsemble.cpp index f00e47e3d8..2fc769f359 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCaseEnsemble.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCaseEnsemble.cpp @@ -22,6 +22,7 @@ #include "RimEclipseCase.h" #include "RimEclipseView.h" #include "RimEclipseViewCollection.h" +#include "RimWellTargetCandidatesGenerator.h" #include "cafCmdFeatureMenuBuilder.h" #include "cafPdmFieldScriptingCapability.h" @@ -50,6 +51,8 @@ RimEclipseCaseEnsemble::RimEclipseCaseEnsemble() CAF_PDM_InitFieldNoDefault( &m_viewCollection, "ViewCollection", "Views" ); m_viewCollection = new RimEclipseViewCollection; + CAF_PDM_InitFieldNoDefault( &m_wellTargetGenerators, "WellTargetGenerators", "Well Target Candidates Generators" ); + setDeletable( true ); } @@ -169,6 +172,7 @@ void RimEclipseCaseEnsemble::fieldChangedByUi( const caf::PdmFieldHandle* change void RimEclipseCaseEnsemble::appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const { menuBuilder << "RicNewViewForGridEnsembleFeature"; + menuBuilder << "RicNewWellTargetCandidatesGeneratorFeature"; } //-------------------------------------------------------------------------------------------------- @@ -178,3 +182,11 @@ RimEclipseViewCollection* RimEclipseCaseEnsemble::viewCollection() const { return m_viewCollection; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseCaseEnsemble::addWellTargetsGenerator( RimWellTargetCandidatesGenerator* generator ) +{ + m_wellTargetGenerators.push_back( generator ); +} diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCaseEnsemble.h b/ApplicationLibCode/ProjectDataModel/RimEclipseCaseEnsemble.h index 2e723505e8..a66065d046 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCaseEnsemble.h +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCaseEnsemble.h @@ -29,6 +29,7 @@ class RimCaseCollection; class RimEclipseCase; class RimEclipseView; class RimEclipseViewCollection; +class RimWellTargetCandidatesGenerator; //================================================================================================== // @@ -54,14 +55,17 @@ public: RimEclipseViewCollection* viewCollection() const; + void addWellTargetsGenerator( RimWellTargetCandidatesGenerator* generator ); + protected: QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const override; private: - caf::PdmField m_groupId; - caf::PdmChildField m_caseCollection; - caf::PdmChildField m_viewCollection; - caf::PdmPtrField m_selectedCase; + caf::PdmField m_groupId; + caf::PdmChildField m_caseCollection; + caf::PdmChildField m_viewCollection; + caf::PdmChildArrayField m_wellTargetGenerators; + caf::PdmPtrField m_selectedCase; }; diff --git a/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.cpp b/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.cpp new file mode 100644 index 0000000000..abc6543295 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.cpp @@ -0,0 +1,296 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "RimWellTargetCandidatesGenerator.h" + +#include "RiaLogging.h" +#include "RiaPorosityModel.h" +#include "RiaResultNames.h" + +#include "RigCaseCellResultsData.h" +#include "RigEclipseResultAddress.h" +#include "RigWellTargetCandidatesGenerator.h" + +#include "RimEclipseCase.h" +#include "RimEclipseCaseEnsemble.h" +#include "RimEclipseView.h" +#include "RimProject.h" +#include "RimTools.h" + +#include "cafPdmUiDoubleSliderEditor.h" +#include "cafPdmUiSliderTools.h" + +#include "cvfMath.h" + +#include +#include + +CAF_PDM_SOURCE_INIT( RimWellTargetCandidatesGenerator, "RimWellTargetCandidatesGenerator" ); + +namespace caf +{ +template <> +void caf::AppEnum::setUp() +{ + addItem( RigWellTargetCandidatesGenerator::VolumeType::OIL, "OIL", "Oil" ); + addItem( RigWellTargetCandidatesGenerator::VolumeType::GAS, "GAS", "Gas" ); + addItem( RigWellTargetCandidatesGenerator::VolumeType::HYDROCARBON, "HYDROCARBON", "Hydrocarbon" ); + setDefault( RigWellTargetCandidatesGenerator::VolumeType::OIL ); +} + +template <> +void caf::AppEnum::setUp() +{ + addItem( RigWellTargetCandidatesGenerator::VolumeResultType::MOBILE, "MOBILE", "Mobile" ); + addItem( RigWellTargetCandidatesGenerator::VolumeResultType::TOTAL, "TOTAL", "Total" ); + setDefault( RigWellTargetCandidatesGenerator::VolumeResultType::TOTAL ); +} + +template <> +void caf::AppEnum::setUp() +{ + addItem( RigWellTargetCandidatesGenerator::VolumesType::RESERVOIR_VOLUMES, "RESERVOIR", "Reservoir Volumes (RFIPOIL, RFIPGAS)" ); + addItem( RigWellTargetCandidatesGenerator::VolumesType::SURFACE_VOLUMES, "SURFACE", "Surface Volumes (SFIPOIL, SFIPGAS)" ); + addItem( RigWellTargetCandidatesGenerator::VolumesType::COMPUTED_VOLUMES, "COMPUTED", "Computed Volumes (PORV*SOIL, PORV*SGAS)" ); + setDefault( RigWellTargetCandidatesGenerator::VolumesType::COMPUTED_VOLUMES ); +} + +} // End namespace caf + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimWellTargetCandidatesGenerator::RimWellTargetCandidatesGenerator() +{ + CAF_PDM_InitObject( "Well Target Candidates Generator" ); + + CAF_PDM_InitField( &m_timeStep, "TimeStep", 0, "Time Step" ); + + CAF_PDM_InitFieldNoDefault( &m_volumeType, "VolumeType", "Volume" ); + CAF_PDM_InitFieldNoDefault( &m_volumeResultType, "VolumeResultType", "Result" ); + CAF_PDM_InitFieldNoDefault( &m_volumesType, "VolumesType", "" ); + + CAF_PDM_InitField( &m_volume, "Volume", 0.0, "Volume" ); + m_volume.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); + + CAF_PDM_InitField( &m_pressure, "Pressure", 0.0, "Pressure" ); + m_pressure.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); + + CAF_PDM_InitField( &m_permeability, "Permeability", 0.0, "Permeability" ); + m_permeability.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); + + CAF_PDM_InitField( &m_transmissibility, "Transmissibility", 0.0, "Transmissibility" ); + m_transmissibility.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); + + CAF_PDM_InitField( &m_maxIterations, "Iterations", 10000, "Max Iterations" ); + CAF_PDM_InitField( &m_maxClusters, "MaxClusters", 5, "Max Clusters" ); + + m_minimumVolume = cvf::UNDEFINED_DOUBLE; + m_maximumVolume = cvf::UNDEFINED_DOUBLE; + + m_minimumPressure = cvf::UNDEFINED_DOUBLE; + m_maximumPressure = cvf::UNDEFINED_DOUBLE; + + m_minimumPermeability = cvf::UNDEFINED_DOUBLE; + m_maximumPermeability = cvf::UNDEFINED_DOUBLE; + + m_minimumTransmissibility = cvf::UNDEFINED_DOUBLE; + m_maximumTransmissibility = cvf::UNDEFINED_DOUBLE; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimWellTargetCandidatesGenerator::~RimWellTargetCandidatesGenerator() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellTargetCandidatesGenerator::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) +{ + updateAllBoundaries(); + + generateCandidates(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList RimWellTargetCandidatesGenerator::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) +{ + QList options; + + if ( fieldNeedingOptions == &m_timeStep ) + { + auto ensemble = firstAncestorOrThisOfType(); + if ( ensemble && !ensemble->cases().empty() ) + { + RimEclipseCase* eclipseCase = ensemble->cases().front(); + + RimTools::timeStepsForCase( eclipseCase, &options ); + } + } + + return options; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellTargetCandidatesGenerator::updateAllBoundaries() +{ + auto ensemble = firstAncestorOrThisOfType(); + if ( !ensemble ) return; + + if ( ensemble->cases().empty() ) return; + + RimEclipseCase* eclipseCase = ensemble->cases().front(); + + int timeStepIdx = m_timeStep(); + + auto updateBoundaryValues = + []( auto resultsData, const std::vector& addresses, size_t timeStepIdx ) -> std::pair + { + double globalMin = std::numeric_limits::max(); + double globalMax = -std::numeric_limits::max(); + for ( auto address : addresses ) + { + double currentMinimum; + double currentMaximum; + resultsData->ensureKnownResultLoaded( address ); + resultsData->minMaxCellScalarValues( address, timeStepIdx, currentMinimum, currentMaximum ); + globalMin = std::min( globalMin, currentMinimum ); + globalMax = std::max( globalMax, currentMaximum ); + } + return { globalMin, globalMax }; + }; + + auto resultsData = eclipseCase->results( RiaDefines::PorosityModelType::MATRIX_MODEL ); + std::tie( m_minimumPressure, m_maximumPressure ) = + updateBoundaryValues( resultsData, { RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "PRESSURE" ) }, timeStepIdx ); + + std::vector volume = + RigWellTargetCandidatesGenerator::getVolumeVector( *resultsData, m_volumeType(), m_volumesType(), m_volumeResultType(), timeStepIdx ); + if ( !volume.empty() ) + { + const auto [min, max] = std::minmax_element( volume.begin(), volume.end() ); + m_minimumVolume = *min; + m_maximumVolume = *max; + } + + std::tie( m_minimumPermeability, m_maximumPermeability ) = + updateBoundaryValues( resultsData, + { RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "PERMX" ), + RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "PERMY" ), + RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "PERMZ" ) }, + 0 ); + + std::tie( m_minimumTransmissibility, m_maximumTransmissibility ) = + updateBoundaryValues( resultsData, + { RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "TRANX" ), + RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "TRANY" ), + RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "TRANZ" ) }, + 0 ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellTargetCandidatesGenerator::defineEditorAttribute( const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute ) + +{ + if ( field == &m_volume && m_minimumVolume != cvf::UNDEFINED_DOUBLE && m_maximumVolume != cvf::UNDEFINED_DOUBLE ) + { + if ( auto doubleAttributes = dynamic_cast( attribute ) ) + { + doubleAttributes->m_minimum = m_minimumVolume; + doubleAttributes->m_maximum = m_maximumVolume; + doubleAttributes->m_decimals = 3; + } + } + + if ( field == &m_pressure && m_minimumPressure != cvf::UNDEFINED_DOUBLE && m_maximumPressure != cvf::UNDEFINED_DOUBLE ) + { + if ( auto doubleAttributes = dynamic_cast( attribute ) ) + { + doubleAttributes->m_minimum = m_minimumPressure; + doubleAttributes->m_maximum = m_maximumPressure; + doubleAttributes->m_decimals = 3; + } + } + + if ( field == &m_permeability && m_minimumPermeability != cvf::UNDEFINED_DOUBLE && m_maximumPermeability != cvf::UNDEFINED_DOUBLE ) + { + if ( auto doubleAttributes = dynamic_cast( attribute ) ) + { + doubleAttributes->m_minimum = m_minimumPermeability; + doubleAttributes->m_maximum = m_maximumPermeability; + doubleAttributes->m_decimals = 3; + } + } + + if ( field == &m_transmissibility && m_minimumTransmissibility != cvf::UNDEFINED_DOUBLE && m_maximumTransmissibility != cvf::UNDEFINED_DOUBLE ) + { + if ( auto doubleAttributes = dynamic_cast( attribute ) ) + { + doubleAttributes->m_minimum = m_minimumTransmissibility; + doubleAttributes->m_maximum = m_maximumTransmissibility; + doubleAttributes->m_decimals = 3; + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellTargetCandidatesGenerator::generateCandidates() +{ + auto ensemble = firstAncestorOrThisOfType(); + if ( !ensemble ) return; + + if ( ensemble->cases().empty() ) return; + + RimEclipseCase* eclipseCase = ensemble->cases().front(); + + RigWellTargetCandidatesGenerator::ClusteringLimits limits; + limits.volume = m_volume; + limits.permeability = m_permeability; + limits.pressure = m_pressure; + limits.transmissibility = m_transmissibility; + limits.maxClusters = m_maxClusters; + limits.maxIterations = m_maxIterations; + + RigWellTargetCandidatesGenerator::generateCandidates( eclipseCase, m_timeStep(), m_volumeType(), m_volumesType(), m_volumeResultType(), limits ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellTargetCandidatesGenerator::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) +{ + PdmObject::defineUiOrdering( uiConfigName, uiOrdering ); + + if ( m_minimumVolume == cvf::UNDEFINED_DOUBLE || m_maximumVolume == cvf::UNDEFINED_DOUBLE ) + { + updateAllBoundaries(); + } +} diff --git a/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.h b/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.h new file mode 100644 index 0000000000..cab46dff41 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.h @@ -0,0 +1,74 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "cafAppEnum.h" +#include "cafPdmField.h" +#include "cafPdmObject.h" + +#include "RigWellTargetCandidatesGenerator.h" + +//================================================================================================== +/// +/// +//================================================================================================== +class RimWellTargetCandidatesGenerator : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + RimWellTargetCandidatesGenerator(); + ~RimWellTargetCandidatesGenerator() override; + +protected: + void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; + void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + +private: + void generateCandidates(); + void updateAllBoundaries(); + + caf::PdmField m_timeStep; + + caf::PdmField> m_volumeType; + caf::PdmField> m_volumeResultType; + caf::PdmField> m_volumesType; + + caf::PdmField m_volume; + caf::PdmField m_pressure; + caf::PdmField m_permeability; + caf::PdmField m_transmissibility; + + caf::PdmField m_maxIterations; + caf::PdmField m_maxClusters; + + double m_minimumVolume; + double m_maximumVolume; + + double m_minimumPressure; + double m_maximumPressure; + + double m_minimumPermeability; + double m_maximumPermeability; + + double m_minimumTransmissibility; + double m_maximumTransmissibility; +}; diff --git a/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake b/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake index c6f90aafa8..574795281c 100644 --- a/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake +++ b/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake @@ -101,6 +101,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RigReservoirBuilder.h ${CMAKE_CURRENT_LIST_DIR}/RigVfpTables.h ${CMAKE_CURRENT_LIST_DIR}/RigOsduWellLogData.h + ${CMAKE_CURRENT_LIST_DIR}/RigWellTargetCandidatesGenerator.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -200,6 +201,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RigReservoirBuilder.cpp ${CMAKE_CURRENT_LIST_DIR}/RigVfpTables.cpp ${CMAKE_CURRENT_LIST_DIR}/RigOsduWellLogData.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigWellTargetCandidatesGenerator.cpp ) list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigPorvSoilSgasResultCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigPorvSoilSgasResultCalculator.cpp index 09710e0d13..579f4814d6 100644 --- a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigPorvSoilSgasResultCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigPorvSoilSgasResultCalculator.cpp @@ -101,7 +101,7 @@ void RigPorvSoilSgasResultCalculator::calculateSum( const RigEclipseResultAddres void RigPorvSoilSgasResultCalculator::calculate( const RigEclipseResultAddress& in1Addr, const RigEclipseResultAddress& in2Addr, const RigEclipseResultAddress& outAddr, - std::function op ) + std::function operation ) { size_t in1Idx = m_resultsData->findOrLoadKnownScalarResult( in1Addr ); size_t in2Idx = m_resultsData->findOrLoadKnownScalarResult( in2Addr ); @@ -132,7 +132,7 @@ void RigPorvSoilSgasResultCalculator::calculate( const RigEclipseResultAddress& { size_t idx1 = res1ActiveOnly ? resultIndex : nativeResvCellIndex; size_t idx2 = res2ActiveOnly ? resultIndex : nativeResvCellIndex; - outResults[resultIndex] = op( in1Results[idx1], in2Results[idx2] ); + outResults[resultIndex] = operation( in1Results[idx1], in2Results[idx2] ); } } } diff --git a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigPorvSoilSgasResultCalculator.h b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigPorvSoilSgasResultCalculator.h index 134e44a652..7be14ad53c 100644 --- a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigPorvSoilSgasResultCalculator.h +++ b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigPorvSoilSgasResultCalculator.h @@ -45,5 +45,5 @@ private: void calculate( const RigEclipseResultAddress& in1Addr, const RigEclipseResultAddress& in2Addr, const RigEclipseResultAddress& outAddr, - std::function op ); + std::function operation ); }; diff --git a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp index 379983c996..699df7819c 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp @@ -1565,7 +1565,7 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResult( const RigEclipseResu //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -size_t RigCaseCellResultsData::findOrLoadKnownScalarResultByResultTypeOrder( const RigEclipseResultAddress& resVarAddr, +size_t RigCaseCellResultsData::findOrLoadKnownScalarResultByResultTypeOrder( const RigEclipseResultAddress& resVarAddr, const std::vector& resultCategorySearchOrder ) { std::set otherResultTypesToSearch = { RiaDefines::ResultCatType::STATIC_NATIVE, diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellTargetCandidatesGenerator.cpp b/ApplicationLibCode/ReservoirDataModel/RigWellTargetCandidatesGenerator.cpp new file mode 100644 index 0000000000..24baaeaaa5 --- /dev/null +++ b/ApplicationLibCode/ReservoirDataModel/RigWellTargetCandidatesGenerator.cpp @@ -0,0 +1,603 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "RigWellTargetCandidatesGenerator.h" + +#include "RiaLogging.h" +#include "RiaPorosityModel.h" +#include "RiaResultNames.h" +#include "RiaWeightedMeanCalculator.h" + +#include "RigActiveCellInfo.h" +#include "RigCaseCellResultsData.h" +#include "RigEclipseResultAddress.h" +#include "RigMainGrid.h" + +#include "RimEclipseCase.h" +#include "RimEclipseCaseEnsemble.h" +#include "RimEclipseView.h" +#include "RimProject.h" +#include "RimPropertyFilterCollection.h" +#include "RimTools.h" + +#include "cafVecIjk.h" + +#include "cvfMath.h" +#include "cvfStructGrid.h" + +#include +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigWellTargetCandidatesGenerator::generateCandidates( RimEclipseCase* eclipseCase, + size_t timeStepIdx, + VolumeType volumeType, + VolumesType volumesType, + VolumeResultType volumeResultType, + const ClusteringLimits& limits ) +{ + auto activeCellCount = getActiveCellCount( eclipseCase ); + if ( !activeCellCount ) + { + RiaLogging::error( "No active cells found" ); + return; + } + + auto resultsData = eclipseCase->results( RiaDefines::PorosityModelType::MATRIX_MODEL ); + if ( !resultsData ) return; + + std::vector volume = getVolumeVector( *resultsData, volumeType, volumesType, volumeResultType, timeStepIdx ); + if ( volume.empty() ) + { + RiaLogging::error( "Unable to produce volume vector." ); + return; + } + + RigEclipseResultAddress pressureAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "PRESSURE" ); + resultsData->ensureKnownResultLoaded( pressureAddress ); + const std::vector& pressure = resultsData->cellScalarResults( pressureAddress, timeStepIdx ); + + RigEclipseResultAddress permeabilityXAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "PERMX" ); + resultsData->ensureKnownResultLoaded( permeabilityXAddress ); + const std::vector& permeabilityX = resultsData->cellScalarResults( permeabilityXAddress, 0 ); + + RigEclipseResultAddress permeabilityYAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "PERMY" ); + resultsData->ensureKnownResultLoaded( permeabilityYAddress ); + const std::vector& permeabilityY = resultsData->cellScalarResults( permeabilityYAddress, 0 ); + + RigEclipseResultAddress permeabilityZAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "PERMZ" ); + resultsData->ensureKnownResultLoaded( permeabilityZAddress ); + const std::vector& permeabilityZ = resultsData->cellScalarResults( permeabilityZAddress, 0 ); + + RigEclipseResultAddress transmissibilityXAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "TRANX" ); + resultsData->ensureKnownResultLoaded( transmissibilityXAddress ); + const std::vector& transmissibilityX = resultsData->cellScalarResults( transmissibilityXAddress, 0 ); + + RigEclipseResultAddress transmissibilityYAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "TRANY" ); + resultsData->ensureKnownResultLoaded( transmissibilityYAddress ); + const std::vector& transmissibilityY = resultsData->cellScalarResults( transmissibilityYAddress, 0 ); + + RigEclipseResultAddress transmissibilityZAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "TRANZ" ); + resultsData->ensureKnownResultLoaded( transmissibilityZAddress ); + const std::vector& transmissibilityZ = resultsData->cellScalarResults( transmissibilityZAddress, 0 ); + + std::vector clusters( activeCellCount.value(), 0 ); + auto start = std::chrono::high_resolution_clock::now(); + int numClusters = limits.maxClusters; + int maxIterations = limits.maxIterations; + int numClustersFound = 0; + for ( int clusterId = 1; clusterId <= numClusters; clusterId++ ) + { + std::optional startCell = findStartCell( eclipseCase, + timeStepIdx, + limits, + volume, + pressure, + permeabilityX, + permeabilityY, + permeabilityZ, + transmissibilityX, + transmissibilityY, + transmissibilityZ, + clusters ); + + if ( startCell.has_value() ) + { + RiaLogging::info( QString( "Cluster %1 start cell: [%2 %3 %4] " ) + .arg( clusterId ) + .arg( startCell->i() + 1 ) + .arg( startCell->j() + 1 ) + .arg( startCell->k() + 1 ) ); + + growCluster( eclipseCase, + startCell.value(), + limits, + volume, + pressure, + permeabilityX, + permeabilityY, + permeabilityZ, + transmissibilityX, + transmissibilityY, + transmissibilityZ, + clusters, + clusterId, + timeStepIdx, + maxIterations ); + numClustersFound++; + } + else + { + RiaLogging::error( "No suitable starting cell found" ); + break; + } + } + + RiaLogging::info( QString( "Found %1 clusters." ).arg( numClustersFound ) ); + + auto finish = std::chrono::high_resolution_clock::now(); + + auto milliseconds = std::chrono::duration_cast( finish - start ); + RiaLogging::info( QString( "Time spent: %1 ms" ).arg( milliseconds.count() ) ); + + QString resultName = "CLUSTERS_NUM"; + createResultVector( *eclipseCase, resultName, clusters ); + + // Update views and property filters + RimProject* proj = RimProject::current(); + proj->scheduleCreateDisplayModelAndRedrawAllViews(); + for ( auto view : eclipseCase->reservoirViews() ) + { + if ( auto eclipseView = dynamic_cast( view ) ) + { + eclipseView->scheduleReservoirGridGeometryRegen(); + eclipseView->propertyFilterCollection()->updateConnectedEditors(); + } + } + + std::vector statistics = + generateStatistics( eclipseCase, pressure, permeabilityX, permeabilityY, permeabilityZ, numClustersFound, timeStepIdx, resultName ); + for ( auto s : statistics ) + { + RiaLogging::info( QString( "Cluster #%1 Statistics" ).arg( s.id ) ); + RiaLogging::info( QString( "Number of cells: %1" ).arg( s.numCells ) ); + RiaLogging::info( QString( "Total PORV*SOIL: %1" ).arg( s.totalPorvSoil ) ); + RiaLogging::info( QString( "Total PORV*SGAS: %1" ).arg( s.totalPorvSgas ) ); + RiaLogging::info( QString( "Total PORV*(SOIL+SGAS): %1" ).arg( s.totalPorvSoilAndSgas ) ); + RiaLogging::info( QString( "Total FIPOIL: %1" ).arg( s.totalFipOil ) ); + RiaLogging::info( QString( "Total FIPGAS: %1" ).arg( s.totalFipGas ) ); + RiaLogging::info( QString( "Average Permeability: %1" ).arg( s.permeability ) ); + RiaLogging::info( QString( "Average Pressure: %1" ).arg( s.pressure ) ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::optional RigWellTargetCandidatesGenerator::findStartCell( RimEclipseCase* eclipseCase, + size_t timeStepIdx, + const ClusteringLimits& limits, + const std::vector& volume, + const std::vector& pressure, + const std::vector& permeabilityX, + const std::vector& permeabilityY, + const std::vector& permeabilityZ, + const std::vector& transmissibilityX, + const std::vector& transmissibilityY, + const std::vector& transmissibilityZ, + const std::vector& clusters ) +{ + auto resultsData = eclipseCase->results( RiaDefines::PorosityModelType::MATRIX_MODEL ); + if ( !resultsData ) + { + RiaLogging::error( "No results data found for eclipse case" ); + return {}; + } + + size_t startCell = std::numeric_limits::max(); + double maxVolume = -std::numeric_limits::max(); + const size_t numReservoirCells = resultsData->activeCellInfo()->reservoirCellCount(); + for ( size_t reservoirCellIdx = 0; reservoirCellIdx < numReservoirCells; reservoirCellIdx++ ) + { + size_t resultIndex = resultsData->activeCellInfo()->cellResultIndex( reservoirCellIdx ); + if ( resultIndex != cvf::UNDEFINED_SIZE_T && clusters[resultIndex] == 0 ) + { + const double cellVolume = volume[resultIndex]; + const double cellPressure = pressure[resultIndex]; + + const double cellPermeabiltyX = permeabilityX[resultIndex]; + const double cellPermeabiltyY = permeabilityY[resultIndex]; + const double cellPermeabiltyZ = permeabilityZ[resultIndex]; + const bool permeabilityValidInAnyDirection = ( cellPermeabiltyX >= limits.permeability || cellPermeabiltyY >= limits.permeability || + cellPermeabiltyZ >= limits.permeability ); + + if ( cellVolume > maxVolume && cellVolume >= limits.volume && cellPressure >= limits.pressure && permeabilityValidInAnyDirection ) + { + maxVolume = cellVolume; + startCell = reservoirCellIdx; + } + } + } + + if ( startCell == std::numeric_limits::max() ) return {}; + + return eclipseCase->mainGrid()->ijkFromCellIndex( startCell ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigWellTargetCandidatesGenerator::growCluster( RimEclipseCase* eclipseCase, + const caf::VecIjk& startCell, + const ClusteringLimits& limits, + const std::vector& volume, + const std::vector& pressure, + const std::vector& permeabilityX, + const std::vector& permeabilityY, + const std::vector& permeabilityZ, + const std::vector& transmissibilityX, + const std::vector& transmissibilityY, + const std::vector& transmissibilityZ, + std::vector& clusters, + int clusterId, + size_t timeStepIdx, + int maxIterations ) +{ + auto resultsData = eclipseCase->results( RiaDefines::PorosityModelType::MATRIX_MODEL ); + + // Initially only the start cell is found + size_t reservoirCellIdx = eclipseCase->mainGrid()->cellIndexFromIJK( startCell.i(), startCell.j(), startCell.k() ); + std::vector foundCells = { reservoirCellIdx }; + assignClusterIdToCells( *resultsData->activeCellInfo(), foundCells, clusters, clusterId ); + + for ( int i = 0; i < maxIterations; i++ ) + { + foundCells = findCandidates( *eclipseCase, + foundCells, + limits, + volume, + pressure, + permeabilityX, + permeabilityY, + permeabilityZ, + transmissibilityX, + transmissibilityY, + transmissibilityZ, + clusters ); + if ( foundCells.empty() ) break; + assignClusterIdToCells( *resultsData->activeCellInfo(), foundCells, clusters, clusterId ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigWellTargetCandidatesGenerator::findCandidates( const RimEclipseCase& eclipseCase, + const std::vector& previousCells, + const ClusteringLimits& limits, + const std::vector& volume, + const std::vector& pressure, + const std::vector& permeabilityX, + const std::vector& permeabilityY, + const std::vector& permeabilityZ, + const std::vector& transmissibilityX, + const std::vector& transmissibilityY, + const std::vector& transmissibilityZ, + std::vector& clusters ) +{ + std::vector candidates; + auto resultsData = eclipseCase.results( RiaDefines::PorosityModelType::MATRIX_MODEL ); + + for ( size_t cellIdx : previousCells ) + { + std::vector faces = { + cvf::StructGridInterface::FaceType::POS_I, + cvf::StructGridInterface::FaceType::NEG_I, + cvf::StructGridInterface::FaceType::POS_J, + cvf::StructGridInterface::FaceType::NEG_J, + cvf::StructGridInterface::FaceType::POS_K, + cvf::StructGridInterface::FaceType::NEG_K, + }; + + size_t resultIndex = resultsData->activeCellInfo()->cellResultIndex( cellIdx ); + + for ( cvf::StructGridInterface::FaceType face : faces ) + { + const RigCell& nativeCell = eclipseCase.mainGrid()->globalCellArray()[cellIdx]; + RigGridBase* grid = nativeCell.hostGrid(); + + size_t gridLocalNativeCellIndex = nativeCell.gridLocalCellIndex(); + + size_t i, j, k, gridLocalNeighborCellIdx; + + grid->ijkFromCellIndex( gridLocalNativeCellIndex, &i, &j, &k ); + + if ( grid->cellIJKNeighbor( i, j, k, face, &gridLocalNeighborCellIdx ) ) + { + size_t neighborResvCellIdx = grid->reservoirCellIndex( gridLocalNeighborCellIdx ); + size_t neighborResultIndex = resultsData->activeCellInfo()->cellResultIndex( neighborResvCellIdx ); + if ( neighborResultIndex != cvf::UNDEFINED_SIZE_T && clusters[neighborResultIndex] == 0 ) + { + double permeability = getValueForFace( permeabilityX, permeabilityY, permeabilityZ, face, neighborResultIndex ); + double transmissibility = getTransmissibilityValueForFace( transmissibilityX, + transmissibilityY, + transmissibilityZ, + face, + resultIndex, + neighborResultIndex ); + if ( volume[neighborResultIndex] > limits.volume && pressure[neighborResultIndex] > limits.pressure && + permeability > limits.permeability && transmissibility > limits.transmissibility ) + { + candidates.push_back( neighborResvCellIdx ); + clusters[neighborResultIndex] = -1; + } + } + } + } + } + + return candidates; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigWellTargetCandidatesGenerator::assignClusterIdToCells( const RigActiveCellInfo& activeCellInfo, + const std::vector& cells, + std::vector& clusters, + int clusterId ) +{ + for ( size_t reservoirCellIdx : cells ) + { + size_t resultIndex = activeCellInfo.cellResultIndex( reservoirCellIdx ); + if ( resultIndex != cvf::UNDEFINED_SIZE_T ) clusters[resultIndex] = clusterId; + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigWellTargetCandidatesGenerator::createResultVector( RimEclipseCase& eclipseCase, + const QString& resultName, + const std::vector& clusterIds ) +{ + RigEclipseResultAddress resultAddress( RiaDefines::ResultCatType::GENERATED, resultName ); + + auto resultsData = eclipseCase.results( RiaDefines::PorosityModelType::MATRIX_MODEL ); + + resultsData->addStaticScalarResult( RiaDefines::ResultCatType::GENERATED, resultName, false, clusterIds.size() ); + + std::vector* resultVector = resultsData->modifiableCellScalarResult( resultAddress, 0 ); + resultVector->resize( clusterIds.size(), std::numeric_limits::infinity() ); + + std::fill( resultVector->begin(), resultVector->end(), std::numeric_limits::infinity() ); + + for ( size_t idx = 0; idx < clusterIds.size(); idx++ ) + { + if ( clusterIds[idx] > 0 ) + { + resultVector->at( idx ) = clusterIds[idx]; + } + } + + resultsData->recalculateStatistics( resultAddress ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::optional RigWellTargetCandidatesGenerator::getActiveCellCount( RimEclipseCase* eclipseCase ) +{ + auto resultsData = eclipseCase->results( RiaDefines::PorosityModelType::MATRIX_MODEL ); + if ( !resultsData ) return {}; + + return resultsData->activeCellInfo()->reservoirActiveCellCount(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigWellTargetCandidatesGenerator::getValueForFace( const std::vector& x, + const std::vector& y, + const std::vector& z, + cvf::StructGridInterface::FaceType face, + size_t resultIndex ) +{ + if ( face == cvf::StructGridInterface::FaceType::POS_I || face == cvf::StructGridInterface::FaceType::NEG_I ) return x[resultIndex]; + if ( face == cvf::StructGridInterface::FaceType::POS_J || face == cvf::StructGridInterface::FaceType::NEG_J ) return y[resultIndex]; + if ( face == cvf::StructGridInterface::FaceType::POS_K || face == cvf::StructGridInterface::FaceType::NEG_K ) return z[resultIndex]; + return std::numeric_limits::infinity(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigWellTargetCandidatesGenerator::getTransmissibilityValueForFace( const std::vector& x, + const std::vector& y, + const std::vector& z, + cvf::StructGridInterface::FaceType face, + size_t resultIndex, + size_t neighborResultIndex ) +{ + // For negative directions (NEG_I, NEG_J, NEG_K) use the value from the neighbor cell + bool isPos = face == cvf::StructGridInterface::FaceType::POS_I || face == cvf::StructGridInterface::FaceType::POS_J || + face == cvf::StructGridInterface::FaceType::POS_K; + size_t index = isPos ? resultIndex : neighborResultIndex; + return getValueForFace( x, y, z, face, index ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigWellTargetCandidatesGenerator::getVolumeVector( RigCaseCellResultsData& resultsData, + VolumeType volumeType, + VolumesType volumesType, + VolumeResultType volumeResultType, + size_t timeStepIdx ) +{ + auto loadVectorByName = []( RigCaseCellResultsData& resultsData, const QString& resultName, size_t timeStepIdx ) -> std::vector + { + RigEclipseResultAddress address( RiaDefines::ResultCatType::DYNAMIC_NATIVE, resultName ); + if ( !resultsData.ensureKnownResultLoaded( address ) ) return {}; + return resultsData.cellScalarResults( address, timeStepIdx ); + }; + + auto getOilVectorName = []( VolumesType volumesType ) -> QString + { + switch ( volumesType ) + { + case VolumesType::COMPUTED_VOLUMES: + return RiaResultNames::riPorvSoil(); + case VolumesType::RESERVOIR_VOLUMES: + return "RFIPOIL"; + case VolumesType::SURFACE_VOLUMES: + return "SFIPOIL"; + default: + { + CAF_ASSERT( false ); + return ""; + } + } + }; + + auto getGasVectorName = []( VolumesType volumesType ) -> QString + { + switch ( volumesType ) + { + case VolumesType::COMPUTED_VOLUMES: + return RiaResultNames::riPorvSgas(); + case VolumesType::RESERVOIR_VOLUMES: + return "RFIPGAS"; + case VolumesType::SURFACE_VOLUMES: + return "SFIPGAS"; + default: + { + CAF_ASSERT( false ); + return ""; + } + } + }; + + std::vector volume; + + if ( volumeType == VolumeType::OIL ) + { + volume = loadVectorByName( resultsData, getOilVectorName( volumesType ), timeStepIdx ); + } + else if ( volumeType == VolumeType::GAS ) + { + volume = loadVectorByName( resultsData, getGasVectorName( volumesType ), timeStepIdx ); + } + else if ( volumeType == VolumeType::HYDROCARBON ) + { + std::vector oilVolume = loadVectorByName( resultsData, getOilVectorName( volumesType ), timeStepIdx ); + std::vector gasVolume = loadVectorByName( resultsData, getGasVectorName( volumesType ), timeStepIdx ); + if ( oilVolume.empty() || gasVolume.empty() || oilVolume.size() != gasVolume.size() ) return volume; + + volume.resize( oilVolume.size(), std::numeric_limits::infinity() ); + for ( size_t i = 0; i < oilVolume.size(); i++ ) + { + volume[i] = oilVolume[i] + gasVolume[i]; + } + } + + return volume; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector + RigWellTargetCandidatesGenerator::generateStatistics( RimEclipseCase* eclipseCase, + const std::vector& pressure, + const std::vector& permeabilityX, + const std::vector& permeabilityY, + const std::vector& permeabilityZ, + int numClustersFound, + size_t timeStepIdx, + const QString& clusterResultName ) +{ + std::vector statistics( numClustersFound ); + + auto resultsData = eclipseCase->results( RiaDefines::PorosityModelType::MATRIX_MODEL ); + if ( !resultsData ) return statistics; + + RigEclipseResultAddress porvAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "PORV" ); + resultsData->ensureKnownResultLoaded( porvAddress ); + const std::vector& porv = resultsData->cellScalarResults( porvAddress, 0 ); + + RigEclipseResultAddress porvSoilAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::riPorvSoil() ); + resultsData->ensureKnownResultLoaded( porvSoilAddress ); + const std::vector& porvSoil = resultsData->cellScalarResults( porvSoilAddress, timeStepIdx ); + + RigEclipseResultAddress porvSgasAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::riPorvSgas() ); + resultsData->ensureKnownResultLoaded( porvSgasAddress ); + const std::vector& porvSgas = resultsData->cellScalarResults( porvSgasAddress, timeStepIdx ); + + RigEclipseResultAddress porvSoilAndSgasAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::riPorvSoilSgas() ); + resultsData->ensureKnownResultLoaded( porvSoilAndSgasAddress ); + const std::vector& porvSoilAndSgas = resultsData->cellScalarResults( porvSoilAndSgasAddress, timeStepIdx ); + + RigEclipseResultAddress fipOilAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "FIPOIL" ); + resultsData->ensureKnownResultLoaded( fipOilAddress ); + const std::vector& fipOil = resultsData->cellScalarResults( fipOilAddress, timeStepIdx ); + + RigEclipseResultAddress fipGasAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "FIPGAS" ); + resultsData->ensureKnownResultLoaded( fipGasAddress ); + const std::vector& fipGas = resultsData->cellScalarResults( fipGasAddress, timeStepIdx ); + + RigEclipseResultAddress clusterAddress( RiaDefines::ResultCatType::GENERATED, clusterResultName ); + resultsData->ensureKnownResultLoaded( clusterAddress ); + const std::vector& clusterIds = resultsData->cellScalarResults( clusterAddress, 0 ); + + std::vector> permeabilityCalculators( numClustersFound ); + std::vector> pressureCalculators( numClustersFound ); + + for ( size_t idx = 0; idx < clusterIds.size(); idx++ ) + { + if ( !std::isinf( clusterIds[idx] ) && static_cast( clusterIds[idx] ) > 0 ) + { + size_t i = clusterIds[idx] - 1; + if ( i < static_cast( numClustersFound ) ) + { + statistics[i].id = clusterIds[idx]; + statistics[i].numCells++; + statistics[i].totalPorvSoil += porvSoil[idx]; + statistics[i].totalPorvSgas += porvSgas[idx]; + statistics[i].totalPorvSoilAndSgas += porvSoilAndSgas[idx]; + statistics[i].totalFipOil += fipOil[idx]; + statistics[i].totalFipGas += fipGas[idx]; + + double meanPermeability = ( permeabilityX[idx] + permeabilityY[idx] + permeabilityZ[idx] ) / 3.0; + permeabilityCalculators[i].addValueAndWeight( meanPermeability, porv[idx] ); + + pressureCalculators[i].addValueAndWeight( pressure[idx], porv[idx] ); + } + } + } + + for ( int i = 0; i < numClustersFound; i++ ) + { + statistics[i].permeability = permeabilityCalculators[i].weightedMean(); + statistics[i].pressure = pressureCalculators[i].weightedMean(); + } + + return statistics; +} diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellTargetCandidatesGenerator.h b/ApplicationLibCode/ReservoirDataModel/RigWellTargetCandidatesGenerator.h new file mode 100644 index 0000000000..0f93e9b875 --- /dev/null +++ b/ApplicationLibCode/ReservoirDataModel/RigWellTargetCandidatesGenerator.h @@ -0,0 +1,180 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "cafVecIjk.h" + +#include "cvfStructGrid.h" + +#include + +class RigActiveCellInfo; +class RigCaseCellResultsData; +class RimEclipseCase; +//================================================================================================== +/// +/// +//================================================================================================== +class RigWellTargetCandidatesGenerator +{ +public: + enum class VolumeType + { + OIL, + GAS, + HYDROCARBON + }; + + enum class VolumeResultType + { + MOBILE, + TOTAL + }; + + enum class VolumesType + { + RESERVOIR_VOLUMES, + SURFACE_VOLUMES, + COMPUTED_VOLUMES + }; + + struct ClusteringLimits + { + double volume; + double permeability; + double pressure; + double transmissibility; + int maxClusters; + int maxIterations; + }; + + static void generateCandidates( RimEclipseCase* eclipseCase, + size_t timeStepIdx, + VolumeType volumeType, + VolumesType volumesType, + VolumeResultType volumeResultType, + const ClusteringLimits& limits ); + + static std::vector getVolumeVector( RigCaseCellResultsData& resultsData, + VolumeType volumeType, + VolumesType volumesType, + VolumeResultType volumeResultType, + size_t timeStepIdx ); + + class ClusterStatistics + { + public: + ClusterStatistics() + : id( -1 ) + , numCells( 0 ) + , totalPorvSoil( 0.0 ) + , totalPorvSgas( 0.0 ) + , totalPorvSoilAndSgas( 0.0 ) + , totalFipOil( 0.0 ) + , totalFipGas( 0.0 ) + , permeability( 0.0 ) + , pressure( 0.0 ) + { + } + + int id; + size_t numCells; + double totalPorvSoil; + double totalPorvSgas; + double totalPorvSoilAndSgas; + double totalFipOil; + double totalFipGas; + double permeability; + double pressure; + }; + +private: + static std::optional findStartCell( RimEclipseCase* eclipseCase, + size_t timeStepIdx, + const ClusteringLimits& limits, + const std::vector& volume, + const std::vector& pressure, + const std::vector& permeabilityX, + const std::vector& permeabilityY, + const std::vector& permeabilityZ, + const std::vector& transmissibilityX, + const std::vector& transmissibilityY, + const std::vector& transmissibilityZ, + const std::vector& clusters ); + + static void growCluster( RimEclipseCase* eclipseCase, + const caf::VecIjk& startCell, + const ClusteringLimits& limits, + const std::vector& volume, + const std::vector& pressure, + const std::vector& permeabilityX, + const std::vector& permeabilityY, + const std::vector& permeabilityZ, + const std::vector& transmissibilityX, + const std::vector& transmissibilityY, + const std::vector& transmissibilityZ, + std::vector& clusters, + int clusterId, + size_t timeStepIdx, + int maxIterations ); + + static std::vector findCandidates( const RimEclipseCase& eclipseCase, + const std::vector& previousCells, + const ClusteringLimits& limits, + const std::vector& volume, + const std::vector& pressure, + const std::vector& permeabilityX, + const std::vector& permeabilityY, + const std::vector& permeabilityZ, + const std::vector& transmissibilityX, + const std::vector& transmissibilityY, + const std::vector& transmissibilityZ, + std::vector& clusters ); + + static void assignClusterIdToCells( const RigActiveCellInfo& activeCellInfo, + const std::vector& cells, + std::vector& clusters, + int clusterId ); + + static std::optional getActiveCellCount( RimEclipseCase* eclipseCase ); + + static void createResultVector( RimEclipseCase& eclipseCase, const QString& resultName, const std::vector& clusterIds ); + + static double getValueForFace( const std::vector& x, + const std::vector& y, + const std::vector& z, + cvf::StructGridInterface::FaceType face, + size_t resultIndex ); + + static double getTransmissibilityValueForFace( const std::vector& x, + const std::vector& y, + const std::vector& z, + cvf::StructGridInterface::FaceType face, + size_t resultIndex, + size_t neighborResultIndex ); + + static std::vector generateStatistics( RimEclipseCase* eclipseCase, + const std::vector& pressure, + const std::vector& permeabilityX, + const std::vector& permeabilityY, + const std::vector& permeabilityZ, + int numClustersFound, + size_t timeStepIdx, + const QString& clusterResultName ); +}; From ba9b66d75e57a441465fd2a5cf0e432739c1e9c7 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 2 Oct 2024 09:47:06 +0200 Subject: [PATCH 007/160] Qt6: update to changed name of QButtonGroup signal. Changed names from buttonClicked to idClicked. --- .../UserInterface/RiuRelativePermeabilityPlotPanel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp b/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp index f6a5924f8a..61fe537330 100644 --- a/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp +++ b/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp @@ -150,7 +150,7 @@ RiuRelativePermeabilityPlotPanel::RiuRelativePermeabilityPlotPanel( QWidget* par setLayout( mainLayout ); - connect( m_selectedCurvesButtonGroup, SIGNAL( buttonClicked( int ) ), SLOT( slotButtonInButtonGroupClicked( int ) ) ); + connect( m_selectedCurvesButtonGroup, SIGNAL( idClicked( int ) ), SLOT( slotButtonInButtonGroupClicked( int ) ) ); connect( m_logarithmicScaleKrAxisCheckBox, SIGNAL( stateChanged( int ) ), SLOT( slotSomeCheckBoxStateChanged( int ) ) ); connect( m_showUnscaledCheckBox, SIGNAL( stateChanged( int ) ), SLOT( slotSomeCheckBoxStateChanged( int ) ) ); connect( m_fixedXAxisCheckBox, SIGNAL( stateChanged( int ) ), SLOT( slotSomeCheckBoxStateChanged( int ) ) ); From f031a81803395d636b987fa79c46f2b7e9bd08ff Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 1 Oct 2024 12:08:26 +0200 Subject: [PATCH 008/160] #11731 Detect when a group box have the same name as an existing group box Detect when a group box have the same name as an existing group box. This is not currently supported, and leads to dangling group boxes in the Property Editor. Trigger assert and crash when the situation appears. --- .../cafPdmUiFormLayoutObjectEditor.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiFormLayoutObjectEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiFormLayoutObjectEditor.cpp index 67748340a1..02731853f1 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiFormLayoutObjectEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiFormLayoutObjectEditor.cpp @@ -348,6 +348,17 @@ QMinimizePanel* caf::PdmUiFormLayoutObjectEditor::findOrCreateGroupBox( QWidget* if ( it == m_groupBoxes.end() ) { + auto newBoxIt = m_newGroupBoxes.find( groupBoxKey ); + if ( newBoxIt != m_newGroupBoxes.end() ) + { + // This error happens when the same group is added to the same parent multiple times + // https://github.com/OPM/ResInsight/issues/11731 + // Suggested approach: Make sure that all objects and groups in PdmUiOrdering have unique names. + + auto message = "Detected duplicate group box with keyword: " + groupBoxKey; + CAF_ASSERT( false && message.toStdString().data() ); + } + groupBox = new QMinimizePanel( parent ); groupBox->enableFrame( group->enableFrame() ); groupBox->setTitle( group->uiName( uiConfigName ) ); From f43ecd5e92656c8b2d663a5e69c8731895dc975c Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 1 Oct 2024 12:09:36 +0200 Subject: [PATCH 009/160] #11731 Remove creation of same groups twice in RimWellLogExtractionCurve --- .../ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp index a6e65d7221..0a74cd7e78 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp @@ -1044,7 +1044,6 @@ void RimWellLogExtractionCurve::defineUiOrdering( QString uiConfigName, caf::Pdm { curveDataGroup->add( &m_wellPath ); curveDataGroup->add( &m_refWellPath ); - RimWellLogCurve::defineUiOrdering( uiConfigName, uiOrdering ); } else { @@ -1062,7 +1061,6 @@ void RimWellLogExtractionCurve::defineUiOrdering( QString uiConfigName, caf::Pdm curveDataGroup->add( &m_geomPartId ); curveDataGroup->add( &m_wellPath ); curveDataGroup->add( &m_refWellPath ); - RimWellLogCurve::defineUiOrdering( uiConfigName, uiOrdering ); m_geomResultDefinition->uiOrdering( uiConfigName, *curveDataGroup ); } From e7a082ac2945cadcc659fc147267d976b9d0dc83 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 1 Oct 2024 14:11:56 +0200 Subject: [PATCH 010/160] Regression Test: Find relevant objects and show them in Property Editor --- .../Application/Tools/RiaRegressionTest.cpp | 2 + .../Application/Tools/RiaRegressionTest.h | 1 + .../Tools/RiaRegressionTestRunner.cpp | 84 +++++++++++++++++++ .../Tools/RiaRegressionTestRunner.h | 2 + 4 files changed, 89 insertions(+) diff --git a/ApplicationLibCode/Application/Tools/RiaRegressionTest.cpp b/ApplicationLibCode/Application/Tools/RiaRegressionTest.cpp index 230786ac79..b5259dccbf 100644 --- a/ApplicationLibCode/Application/Tools/RiaRegressionTest.cpp +++ b/ApplicationLibCode/Application/Tools/RiaRegressionTest.cpp @@ -82,6 +82,8 @@ RiaRegressionTest::RiaRegressionTest() CAF_PDM_InitField( &appendTestsAfterTestFilter, "appendTestsAfterTestFilter", false, "Append All Tests After Test Filter" ); CAF_PDM_InitField( &invalidateExternalFilePaths, "invalidateExternalFilePaths", false, "Invalidate External File Paths" ); + CAF_PDM_InitField( &activateObjectsInPropertyEditor, "activateObjectsInPropertyEditor", false, "Activate Objects In Property Editor" ); + CAF_PDM_InitFieldNoDefault( &overridePlotEngine, "forcePlotEngine", "Force Plot Engine" ); CAF_PDM_InitField( &exportSnapshots3dViews, "exportSnapshots3dViews", true, "Export Snapshots 3D Views" ); diff --git a/ApplicationLibCode/Application/Tools/RiaRegressionTest.h b/ApplicationLibCode/Application/Tools/RiaRegressionTest.h index 4b70fa397a..f16593ef4c 100644 --- a/ApplicationLibCode/Application/Tools/RiaRegressionTest.h +++ b/ApplicationLibCode/Application/Tools/RiaRegressionTest.h @@ -52,6 +52,7 @@ public: caf::PdmField openReportInBrowser; caf::PdmField appendTestsAfterTestFilter; caf::PdmField invalidateExternalFilePaths; + caf::PdmField activateObjectsInPropertyEditor; caf::PdmField exportSnapshots3dViews; caf::PdmField exportSnapshotsPlots; diff --git a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp index a90982ae88..13a2581a26 100644 --- a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp +++ b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp @@ -32,8 +32,14 @@ #include "Rim3dView.h" #include "RimCase.h" +#include "RimEclipseCaseCollection.h" +#include "RimEclipseResultAddress.h" +#include "RimFaultInView.h" #include "RimMainPlotCollection.h" +#include "RimOilField.h" #include "RimProject.h" +#include "RimSimWellInView.h" +#include "RimSummaryCaseMainCollection.h" #include "RiuDockWidgetTools.h" #include "RiuMainWindow.h" @@ -47,6 +53,7 @@ #include "DockManager.h" #include "cafMemoryInspector.h" +#include "cafPdmUiTreeView.h" #include "cafUtils.h" #include @@ -255,6 +262,11 @@ void RiaRegressionTestRunner::runRegressionTest() uint64_t usedMemoryBeforeClose = caf::MemoryInspector::getApplicationPhysicalMemoryUsageMiB(); + if ( regressionTestConfig.activateObjectsInPropertyEditor ) + { + RiaRegressionTestRunner::selectObjectsInProject(); + } + app->closeProject(); QApplication::processEvents(); @@ -632,6 +644,78 @@ QFileInfoList RiaRegressionTestRunner::subDirectoriesForTestExecution( const QDi return foldersMatchingTestFilter; } +//-------------------------------------------------------------------------------------------------- +/// Find relevant object to show in property editor. Loop through all objects in project and select them, this will activate the Property +/// Editor. Avoid RimSummaryCaseMainCollection, as this container contains all the summary addresses, and can potentially contain extremely +/// many objects +//-------------------------------------------------------------------------------------------------- +void RiaRegressionTestRunner::selectObjectsInProject() +{ + auto project = RimProject::current(); + if ( !project ) return; + + std::vector baseObjects; + + auto oilField = project->activeOilField(); + + std::vector fields = oilField->fields(); + for ( auto f : fields ) + { + std::vector childObjects = f->children(); + for ( auto childObject : childObjects ) + { + // Skip RimSummaryCaseMainCollection, as this container contains all the summary addresses, and can potentially contain extemely + // many objects + if ( dynamic_cast( childObject ) != nullptr ) + { + continue; + } + + caf::PdmObject* pdmObjectChild = dynamic_cast( childObject ); + if ( pdmObjectChild ) + { + baseObjects.push_back( pdmObjectChild ); + } + } + } + + baseObjects.push_back( project->mainPlotCollection() ); + + std::vector allObjects; + for ( auto baseObj : baseObjects ) + { + auto objectsForSelection = baseObj->descendantsIncludingThisOfType(); + + allObjects.insert( allObjects.end(), objectsForSelection.begin(), objectsForSelection.end() ); + } + + QApplication::processEvents( QEventLoop::ExcludeUserInputEvents ); + + auto mainWindow = RiuMainWindow::instance(); + auto plotMainWindow = RiuPlotMainWindow::instance(); + + for ( auto obj : allObjects ) + { + if ( dynamic_cast( obj ) ) continue; + if ( dynamic_cast( obj ) ) continue; + if ( dynamic_cast( obj ) ) continue; + + if ( auto treeView = mainWindow->getTreeViewWithItem( obj ) ) + { + treeView->selectItems( { obj } ); + + QApplication::processEvents( QEventLoop::ExcludeUserInputEvents ); + } + + if ( auto treeView = plotMainWindow->getTreeViewWithItem( obj ) ) + { + treeView->selectItems( { obj } ); + + QApplication::processEvents( QEventLoop::ExcludeUserInputEvents ); + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.h b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.h index cf10faa09b..7ae23b2ec7 100644 --- a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.h +++ b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.h @@ -70,6 +70,8 @@ private: static QString diff2htmlHeaderText( const QString& testRootPath ); QFileInfoList subDirectoriesForTestExecution( const QDir& directory ); + static void selectObjectsInProject(); + private: QString m_rootPath; QStringList m_testFilter; From eca17ab92ed09dd168b200e86e04c5b89b4890c7 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 2 Oct 2024 09:35:21 +0200 Subject: [PATCH 011/160] #11737 Set Unknown as the default type for CONFAC RFT segment results are accessed using a category, either Annulus, Device, Tubing or Unknown. Set the category for CONFAC to Unknown. --- .../WellLogCommands/RicNewRftSegmentWellLogPlotFeature.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewRftSegmentWellLogPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicNewRftSegmentWellLogPlotFeature.cpp index a63a82e1ce..44088e39f7 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewRftSegmentWellLogPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewRftSegmentWellLogPlotFeature.cpp @@ -261,7 +261,7 @@ void RicNewRftSegmentWellLogPlotFeature::appendConnectionFactorTrack( RimWellLog // Connection factor data can be found in the tubing, device and annulus branches. // Search for data ordered by annulus, device and tubing. - RiaDefines::RftBranchType branchType = RiaDefines::RftBranchType::RFT_ANNULUS; + RiaDefines::RftBranchType branchType = RiaDefines::RftBranchType::RFT_UNKNOWN; bool foundData = false; if ( RicWellLogTools::hasData( resultName, wellName, branchType, summaryCase ) ) { From aabe7b064d3910e0a99d2196c8989ae6fb776010 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 2 Oct 2024 09:37:33 +0200 Subject: [PATCH 012/160] #11735 Use static well path geometry if no simulation well data is available Crash when creating intersection on a simulation well no well data is present at time step --- .../ReservoirDataModel/RigMswCenterLineCalculator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApplicationLibCode/ReservoirDataModel/RigMswCenterLineCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/RigMswCenterLineCalculator.cpp index b5bc81933c..e1f2dde911 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigMswCenterLineCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigMswCenterLineCalculator.cpp @@ -74,7 +74,7 @@ std::vector { const RigWellResultFrame* wellFramePtr = nullptr; - if ( timeStepIndex < 0 ) + if ( timeStepIndex < 0 || !wellResults->hasWellResult( timeStepIndex ) ) { wellFramePtr = wellResults->staticWellResultFrame(); } From 7362b6a357310ff40e9f2dff6ab40f988d765be5 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 2 Oct 2024 10:46:13 +0200 Subject: [PATCH 013/160] Bump to 2024.09.2-dev.01 --- ResInsightVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index 0896fdd773..349675818f 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -1,7 +1,7 @@ set(RESINSIGHT_MAJOR_VERSION 2024) set(RESINSIGHT_MINOR_VERSION 09) -set(RESINSIGHT_PATCH_VERSION 1) +set(RESINSIGHT_PATCH_VERSION 2) # Opional text with no restrictions set(RESINSIGHT_VERSION_TEXT "-dev") From 4e97672e1da58774c5a501f902b837ab243db2fc Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Thu, 3 Oct 2024 16:11:51 +0200 Subject: [PATCH 014/160] Fix incorrect opengl viewport size on Windows if scaling != 100%. To be replaced by proper fix later. --- ApplicationExeCode/RiaMain.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ApplicationExeCode/RiaMain.cpp b/ApplicationExeCode/RiaMain.cpp index da1e71c972..3bf3906178 100644 --- a/ApplicationExeCode/RiaMain.cpp +++ b/ApplicationExeCode/RiaMain.cpp @@ -77,6 +77,13 @@ int main( int argc, char* argv[] ) } #endif +#ifdef WIN32 + // Temporary workaround for incorrect scaling of opengl viewport on windows with dpi scaling != 100% + // Reverts scaling behaviour to Qt5 style + // Should be replaced by proper scaling of x and y coordinates in caf::Viewer + qputenv( "QT_ENABLE_HIGHDPI_SCALING", "0" ); +#endif + // The Qt::AA_ShareOpenGLContexts setting is needed when we have multiple viz widgets in flight // and we have a setup where these widgets belong to different top-level windows, or end up // belonging to different top-level windows through re-parenting. From 226ad989316e2120879cb17b78e9f89ef33ac3c5 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 4 Oct 2024 12:38:46 +0200 Subject: [PATCH 015/160] Add vcpkg.json used to build OpenSSL3 --- scripts/additional-packages/readme.md | 17 +++++++++++++++++ scripts/additional-packages/vcpkg.json | 6 ++++++ 2 files changed, 23 insertions(+) create mode 100644 scripts/additional-packages/readme.md create mode 100644 scripts/additional-packages/vcpkg.json diff --git a/scripts/additional-packages/readme.md b/scripts/additional-packages/readme.md new file mode 100644 index 0000000000..02561a573a --- /dev/null +++ b/scripts/additional-packages/readme.md @@ -0,0 +1,17 @@ +# Workflow to build and distribute OpenSSL 3 + +From Qt 6.5, OpenSSL 3 is used for authentication workflows. On RHEL8 the only available system package is OpenSSL 1.1. The authentication framwork in Qt (in a ResInsight build used by install/plugins/tls/libqopensslbackend.so) requires OpenSSL3. This document describes how to build OpenSSL3 using vcpkg and bundle required dynamic libraries in the install package of ResInsight. When running ResInsight without these libraries, the following error message is displayed: + + qt.tlsbackend.ossl: Incompatible version of OpenSSL (built with OpenSSL >= 3.x, runtime version is < 3.x) + qt.network.ssl: No functional TLS backend was found + +1. Build and install ResInsight +2. Build a dynamic version of OpenSSL 3 using vcpkg. In the /build folder, execute the following: + + ../ThirdParty/vcpkg/vcpkg install --triplet x64-linux-dynamic --x-manifest-root=../scripts/additional-packages --x-install-root=./vcpkg_installed + + Make sure that the libraries `libcrypto.so/libssl.so` are installed in `/build/vcpkg_installed/lib64` +3. Copy `libcrypto.so/libssl.so` to the `/lib64` folder in the install package for ResInsight +4. Successful install of these libraries will show the text "Use of SSL is available and supported" in the About dialog in ResInsight. + +https://learn.microsoft.com/en-us/vcpkg/commands/common-options#manifest-root diff --git a/scripts/additional-packages/vcpkg.json b/scripts/additional-packages/vcpkg.json new file mode 100644 index 0000000000..95b8d93037 --- /dev/null +++ b/scripts/additional-packages/vcpkg.json @@ -0,0 +1,6 @@ +{ + "_description":"This file is used to build OpenSSL 3 on platforms where this is missing", + "dependencies": [ + "openssl" + ] +} From 8d828fdc84b0341243fd74bce4a33b50e1f0c4db Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 4 Oct 2024 12:39:17 +0200 Subject: [PATCH 016/160] Disable Octave build temporarily --- Octave/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Octave/CMakeLists.txt b/Octave/CMakeLists.txt index 48f509f694..df9592eefe 100644 --- a/Octave/CMakeLists.txt +++ b/Octave/CMakeLists.txt @@ -22,7 +22,7 @@ else() set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::OpenGL Qt5::Widgets Qt5::Network) endif() -add_subdirectory(OctavePlugin) +# Disable build of Octave awaiting a fix for Qt6 add_subdirectory(OctavePlugin) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") set(CPACK_GENERATOR TGZ) From a04d41b043dab3a431c5124539b9eb424d21434f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 4 Oct 2024 13:32:53 +0200 Subject: [PATCH 017/160] Use description as key in vcpkg.json --- scripts/additional-packages/vcpkg.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/additional-packages/vcpkg.json b/scripts/additional-packages/vcpkg.json index 95b8d93037..9cd89b2809 100644 --- a/scripts/additional-packages/vcpkg.json +++ b/scripts/additional-packages/vcpkg.json @@ -1,5 +1,5 @@ { - "_description":"This file is used to build OpenSSL 3 on platforms where this is missing", + "description":"This file is used to build OpenSSL 3 on platforms where this is missing", "dependencies": [ "openssl" ] From 835cf4a53c7a8b5e15228ea60b1925f401190cab Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 2 Oct 2024 11:03:10 +0200 Subject: [PATCH 018/160] Qt6: Fix QMouseEvent.x() and .y() deprecation. --- .../RicBoxManipulatorEventHandler.cpp | 2 +- .../RicPointTangentManipulator.cpp | 5 +++-- ApplicationLibCode/UserInterface/RiuViewer.cpp | 4 ++-- .../UserInterface/RiuWellLogTrack.cpp | 4 ++-- Fwk/AppFwk/CommonCode/cafMouseState.cpp | 10 ++++++---- Fwk/AppFwk/cafViewer/cafCadNavigation.cpp | 6 +++--- Fwk/AppFwk/cafViewer/cafCeetronNavigation.cpp | 10 +++++----- .../cafViewer/cafCeetronPlusNavigation.cpp | 16 ++++++++-------- .../cafViewer/cafTrackBallBasedNavigation.cpp | 12 ++++++------ Fwk/VizFwk/LibGuiQt/cvfqtMouseState.cpp | 8 ++++---- 10 files changed, 40 insertions(+), 37 deletions(-) diff --git a/ApplicationLibCode/Commands/IntersectionBoxCommands/RicBoxManipulatorEventHandler.cpp b/ApplicationLibCode/Commands/IntersectionBoxCommands/RicBoxManipulatorEventHandler.cpp index 0623e5185a..578479fbaa 100644 --- a/ApplicationLibCode/Commands/IntersectionBoxCommands/RicBoxManipulatorEventHandler.cpp +++ b/ApplicationLibCode/Commands/IntersectionBoxCommands/RicBoxManipulatorEventHandler.cpp @@ -137,7 +137,7 @@ bool RicBoxManipulatorEventHandler::eventFilter( QObject* obj, QEvent* inputEven QMouseEvent* mouseEvent = static_cast( inputEvent ); cvf::ref rayIS = - viewer->rayIntersectSpecFromWindowCoordinates( mouseEvent->pos().x(), mouseEvent->pos().y() ); + viewer->rayIntersectSpecFromWindowCoordinates( mouseEvent->position().x(), mouseEvent->position().y() ); if ( rayIS.notNull() ) { diff --git a/ApplicationLibCode/Commands/WellPathCommands/PointTangentManipulator/RicPointTangentManipulator.cpp b/ApplicationLibCode/Commands/WellPathCommands/PointTangentManipulator/RicPointTangentManipulator.cpp index 9e2648285c..8e1b0f56d0 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/PointTangentManipulator/RicPointTangentManipulator.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/PointTangentManipulator/RicPointTangentManipulator.cpp @@ -128,8 +128,9 @@ bool RicPointTangentManipulator::eventFilter( QObject* obj, QEvent* inputEvent ) { auto* mouseEvent = static_cast( inputEvent ); - cvf::ref rayIs = - m_viewer->rayIntersectSpecFromWindowCoordinates( mouseEvent->pos().x(), mouseEvent->pos().y(), m_isDraggingInComparisonView ); + cvf::ref rayIs = m_viewer->rayIntersectSpecFromWindowCoordinates( mouseEvent->position().x(), + mouseEvent->position().y(), + m_isDraggingInComparisonView ); if ( !rayIs.isNull() && rayIs->ray() ) { diff --git a/ApplicationLibCode/UserInterface/RiuViewer.cpp b/ApplicationLibCode/UserInterface/RiuViewer.cpp index 9f4810a832..1b5ef641f0 100644 --- a/ApplicationLibCode/UserInterface/RiuViewer.cpp +++ b/ApplicationLibCode/UserInterface/RiuViewer.cpp @@ -1076,8 +1076,8 @@ void RiuViewer::mouseMoveEvent( QMouseEvent* mouseEvent ) RimViewLinker* viewLinker = m_rimView->assosiatedViewLinker(); if ( viewLinker ) { - int translatedMousePosX = mouseEvent->pos().x(); - int translatedMousePosY = height() - mouseEvent->pos().y(); + int translatedMousePosX = mouseEvent->position().x(); + int translatedMousePosY = height() - mouseEvent->position().y(); cvf::Vec3d displayCoord( 0, 0, 0 ); if ( mainCamera()->unproject( cvf::Vec3d( static_cast( translatedMousePosX ), static_cast( translatedMousePosY ), 0 ), diff --git a/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp b/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp index ddbf344884..6de9beacac 100644 --- a/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp +++ b/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp @@ -139,11 +139,11 @@ void RiuWellLogTrack::onMouseMoveEvent( QMouseEvent* mouseEvent ) double depth = 0.0; if ( depthTrackPlot->depthOrientation() == RiaDefines::Orientation::HORIZONTAL ) { - depth = axisMap.invTransform( mouseEvent->pos().x() ); + depth = axisMap.invTransform( mouseEvent->position().x() ); } else { - depth = axisMap.invTransform( mouseEvent->pos().y() ); + depth = axisMap.invTransform( mouseEvent->position().y() ); } depthTrackPlot->setDepthMarkerPosition( depth ); diff --git a/Fwk/AppFwk/CommonCode/cafMouseState.cpp b/Fwk/AppFwk/CommonCode/cafMouseState.cpp index 53348763e2..0f6b1982ad 100644 --- a/Fwk/AppFwk/CommonCode/cafMouseState.cpp +++ b/Fwk/AppFwk/CommonCode/cafMouseState.cpp @@ -91,8 +91,8 @@ void QtMouseState::updateFromMouseEvent( QMouseEvent* event ) if ( numMouseButtonsInState( m_mouseButtonState ) == 1 ) { m_cleanButtonPressButton = buttonPressed; - m_cleanButtonPressPosX = event->x(); - m_cleanButtonPressPosY = event->y(); + m_cleanButtonPressPosX = event->position().x(); + m_cleanButtonPressPosY = event->position().y(); } } @@ -109,8 +109,10 @@ void QtMouseState::updateFromMouseEvent( QMouseEvent* event ) m_cleanButtonPressPosY != cvf::UNDEFINED_INT ) { // We have a candidate, check if movement is within tolerance - if ( cvf::Math::abs( double( ( m_cleanButtonPressPosX - event->x() ) ) ) <= m_cleanButtonClickTolerance && - cvf::Math::abs( double( ( m_cleanButtonPressPosY - event->y() ) ) ) <= m_cleanButtonClickTolerance ) + if ( cvf::Math::abs( double( ( m_cleanButtonPressPosX - event->position().x() ) ) ) <= + m_cleanButtonClickTolerance && + cvf::Math::abs( double( ( m_cleanButtonPressPosY - event->position().y() ) ) ) <= + m_cleanButtonClickTolerance ) { m_cleanButtonClickButton = buttonReleased; } diff --git a/Fwk/AppFwk/cafViewer/cafCadNavigation.cpp b/Fwk/AppFwk/cafViewer/cafCadNavigation.cpp index 416e13ea97..9ea86459e4 100644 --- a/Fwk/AppFwk/cafViewer/cafCadNavigation.cpp +++ b/Fwk/AppFwk/cafViewer/cafCadNavigation.cpp @@ -72,11 +72,11 @@ bool caf::CadNavigation::handleInputEvent( QInputEvent* inputEvent ) QMouseEvent* me = static_cast( inputEvent ); int translatedMousePosX, translatedMousePosY; - cvfEventPos( me->x(), me->y(), &translatedMousePosX, &translatedMousePosY ); + cvfEventPos( me->position().x(), me->position().y(), &translatedMousePosX, &translatedMousePosY ); if ( me->button() == Qt::MiddleButton && me->modifiers() == Qt::NoModifier && isRotationEnabled() ) { - this->pickAndSetPointOfInterest( me->x(), me->y() ); + this->pickAndSetPointOfInterest( me->position().x(), me->position().y() ); m_trackball->startNavigation( cvf::ManipulatorTrackball::ROTATE, translatedMousePosX, translatedMousePosY ); m_roationSensitivityCalculator.init( me ); @@ -120,7 +120,7 @@ bool caf::CadNavigation::handleInputEvent( QInputEvent* inputEvent ) QMouseEvent* me = static_cast( inputEvent ); int translatedMousePosX, translatedMousePosY; - cvfEventPos( me->x(), me->y(), &translatedMousePosX, &translatedMousePosY ); + cvfEventPos( me->position().x(), me->position().y(), &translatedMousePosX, &translatedMousePosY ); if ( m_isNavigating ) { diff --git a/Fwk/AppFwk/cafViewer/cafCeetronNavigation.cpp b/Fwk/AppFwk/cafViewer/cafCeetronNavigation.cpp index e511934184..42d385e7c3 100644 --- a/Fwk/AppFwk/cafViewer/cafCeetronNavigation.cpp +++ b/Fwk/AppFwk/cafViewer/cafCeetronNavigation.cpp @@ -141,8 +141,8 @@ void caf::CeetronNavigation::mouseMoveEvent( QMouseEvent* event ) { if ( !m_viewer->canRender() ) return; initializeRotationCenter(); - int posX = event->x(); - int posY = m_viewer->height() - event->y(); + int posX = event->position().x(); + int posY = m_viewer->height() - event->position().y(); ManipulatorTrackball::NavigationType navType = getNavigationTypeFromMouseButtons( event->buttons() ); if ( navType != m_trackball->activeNavigation() ) @@ -166,8 +166,8 @@ void caf::CeetronNavigation::mousePressEvent( QMouseEvent* event ) { if ( !m_viewer->canRender() ) return; initializeRotationCenter(); - int posX = event->x(); - int posY = m_viewer->height() - event->y(); + int posX = event->position().x(); + int posY = m_viewer->height() - event->position().y(); ManipulatorTrackball::NavigationType navType = getNavigationTypeFromMouseButtons( event->buttons() ); m_trackball->startNavigation( navType, posX, posY ); @@ -183,7 +183,7 @@ void caf::CeetronNavigation::mouseReleaseEvent( QMouseEvent* event ) if ( !m_viewer->canRender() ) return; initializeRotationCenter(); ManipulatorTrackball::NavigationType navType = getNavigationTypeFromMouseButtons( event->buttons() ); - m_trackball->startNavigation( navType, event->x(), event->y() ); + m_trackball->startNavigation( navType, event->position().x(), event->position().y() ); setCursorFromCurrentState(); } diff --git a/Fwk/AppFwk/cafViewer/cafCeetronPlusNavigation.cpp b/Fwk/AppFwk/cafViewer/cafCeetronPlusNavigation.cpp index b55c1f72de..6165014011 100644 --- a/Fwk/AppFwk/cafViewer/cafCeetronPlusNavigation.cpp +++ b/Fwk/AppFwk/cafViewer/cafCeetronPlusNavigation.cpp @@ -75,11 +75,11 @@ bool caf::CeetronPlusNavigation::handleInputEvent( QInputEvent* inputEvent ) QMouseEvent* me = static_cast( inputEvent ); int translatedMousePosX, translatedMousePosY; - cvfEventPos( me->x(), me->y(), &translatedMousePosX, &translatedMousePosY ); + cvfEventPos( me->position().x(), me->position().y(), &translatedMousePosX, &translatedMousePosY ); if ( me->button() == Qt::RightButton && isRotationEnabled() ) { - this->pickAndSetPointOfInterest( me->x(), me->y() ); + this->pickAndSetPointOfInterest( me->position().x(), me->position().y() ); m_trackball->startNavigation( cvf::ManipulatorTrackball::ROTATE, translatedMousePosX, translatedMousePosY ); m_roationSensitivityCalculator.init( me ); @@ -103,8 +103,8 @@ bool caf::CeetronPlusNavigation::handleInputEvent( QInputEvent* inputEvent ) if ( me->modifiers() == Qt::NoModifier ) { QMouseEvent* we = static_cast( inputEvent ); - m_lastPosX = we->x(); - m_lastPosY = we->y(); + m_lastPosX = we->position().x(); + m_lastPosY = we->position().y(); m_zoomRay = createZoomRay( translatedMousePosX, translatedMousePosY ); @@ -150,16 +150,16 @@ bool caf::CeetronPlusNavigation::handleInputEvent( QInputEvent* inputEvent ) QMouseEvent* me = static_cast( inputEvent ); int translatedMousePosX, translatedMousePosY; - cvfEventPos( me->x(), me->y(), &translatedMousePosX, &translatedMousePosY ); + cvfEventPos( me->position().x(), me->position().y(), &translatedMousePosX, &translatedMousePosY ); if ( m_isNavigating ) { if ( m_isZooming ) { - int delta = 3 * ( m_lastPosY - me->y() ); + int delta = 3 * ( m_lastPosY - me->position().y() ); this->zoomAlongRay( m_zoomRay.p(), delta ); - m_lastPosX = me->x(); - m_lastPosY = me->y(); + m_lastPosX = me->position().x(); + m_lastPosY = me->position().y(); } else { diff --git a/Fwk/AppFwk/cafViewer/cafTrackBallBasedNavigation.cpp b/Fwk/AppFwk/cafViewer/cafTrackBallBasedNavigation.cpp index 125133c225..50fc023bad 100644 --- a/Fwk/AppFwk/cafViewer/cafTrackBallBasedNavigation.cpp +++ b/Fwk/AppFwk/cafViewer/cafTrackBallBasedNavigation.cpp @@ -332,8 +332,8 @@ bool caf::TrackBallBasedNavigation::shouldRaytraceForNewPoiDuringWheelZoom( int //-------------------------------------------------------------------------------------------------- void caf::RotationSensitivityCalculator::init( QMouseEvent* eventAtRotationStart ) { - m_lastPosX = eventAtRotationStart->x(); - m_lastPosY = eventAtRotationStart->y(); + m_lastPosX = eventAtRotationStart->position().x(); + m_lastPosY = eventAtRotationStart->position().y(); m_lastTime = eventAtRotationStart->timestamp(); } @@ -353,8 +353,8 @@ double caf::RotationSensitivityCalculator::calculateSensitivity( QMouseEvent* ev unsigned long timeSinceLast = presentTime - m_lastTime; if ( timeSinceLast == 0 ) timeSinceLast = 1; // one millisecond - int deltaX = eventWhenRotating->x() - m_lastPosX; - int deltaY = eventWhenRotating->y() - m_lastPosY; + int deltaX = eventWhenRotating->position().x() - m_lastPosX; + int deltaY = eventWhenRotating->position().y() - m_lastPosY; cvf::Vec2d mouseVelocity( deltaX, deltaY ); mouseVelocity /= 1.0e-3 * timeSinceLast; @@ -367,8 +367,8 @@ double caf::RotationSensitivityCalculator::calculateSensitivity( QMouseEvent* ev if ( mouseVelocityLengthCorr < slowLimit ) sensitivity = mouseVelocityLengthCorr * mouseVelocityLengthCorr / ( slowLimit * slowLimit ); - m_lastPosX = eventWhenRotating->x(); - m_lastPosY = eventWhenRotating->y(); + m_lastPosX = eventWhenRotating->position().x(); + m_lastPosY = eventWhenRotating->position().y(); m_lastTime = eventWhenRotating->timestamp(); m_lastMouseVelocityLenght = 0.8 * mouseVelocityLength + 0.2 * m_lastMouseVelocityLenght; } diff --git a/Fwk/VizFwk/LibGuiQt/cvfqtMouseState.cpp b/Fwk/VizFwk/LibGuiQt/cvfqtMouseState.cpp index cc28ad140b..06cd98ca6c 100644 --- a/Fwk/VizFwk/LibGuiQt/cvfqtMouseState.cpp +++ b/Fwk/VizFwk/LibGuiQt/cvfqtMouseState.cpp @@ -96,8 +96,8 @@ void MouseState::updateFromMouseEvent(QMouseEvent* event) if (numMouseButtonsInState(m_mouseButtonState) == 1) { m_cleanButtonPressButton = buttonPressed; - m_cleanButtonPressPosX = event->x(); - m_cleanButtonPressPosY = event->y(); + m_cleanButtonPressPosX = event->position().x(); + m_cleanButtonPressPosY = event->pos().y(); } } @@ -115,8 +115,8 @@ void MouseState::updateFromMouseEvent(QMouseEvent* event) m_cleanButtonPressPosY != cvf::UNDEFINED_INT) { // We have a candidate, check if movement is within tolerance - if (cvf::Math::abs(double((m_cleanButtonPressPosX - event->x()))) <= m_cleanButtonClickTolerance && - cvf::Math::abs(double((m_cleanButtonPressPosY - event->y()))) <= m_cleanButtonClickTolerance) + if (cvf::Math::abs(double((m_cleanButtonPressPosX - event->position().x()))) <= m_cleanButtonClickTolerance && + cvf::Math::abs(double((m_cleanButtonPressPosY - event->pos().y()))) <= m_cleanButtonClickTolerance) { m_cleanButtonClickButton = buttonReleased; } From 58656f900b66f2c1fa7143aeda54432b66bafe21 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 2 Oct 2024 11:08:45 +0200 Subject: [PATCH 019/160] Qt6: string-related deprecations. --- Fwk/AppFwk/cafPdmScripting/cafPdmPythonGenerator.cpp | 2 +- Fwk/VizFwk/LibGuiQt/cvfqtUtils.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Fwk/AppFwk/cafPdmScripting/cafPdmPythonGenerator.cpp b/Fwk/AppFwk/cafPdmScripting/cafPdmPythonGenerator.cpp index 230361f774..a1f2773def 100644 --- a/Fwk/AppFwk/cafPdmScripting/cafPdmPythonGenerator.cpp +++ b/Fwk/AppFwk/cafPdmScripting/cafPdmPythonGenerator.cpp @@ -277,7 +277,7 @@ QString caf::PdmPythonGenerator::generate( PdmObjectFactory* factory, std::vecto QString snake_method_name = camelToSnakeCase( methodName ); - if ( classMethodsGenerated[classKeyword][snake_method_name].count() ) continue; + if ( classMethodsGenerated[classKeyword][snake_method_name].length() ) continue; QStringList inputArgumentStrings; QStringList outputArgumentStrings; diff --git a/Fwk/VizFwk/LibGuiQt/cvfqtUtils.cpp b/Fwk/VizFwk/LibGuiQt/cvfqtUtils.cpp index 7c5fa10735..9ec41e04ad 100644 --- a/Fwk/VizFwk/LibGuiQt/cvfqtUtils.cpp +++ b/Fwk/VizFwk/LibGuiQt/cvfqtUtils.cpp @@ -66,13 +66,13 @@ QString Utils::toQString(const cvf::String& cvfString) if (sizeof(wchar_t) == 2) { - const unsigned short* strPtr = reinterpret_cast(cvfString.c_str()); + const char16_t* strPtr = reinterpret_cast(cvfString.c_str()); return QString::fromUtf16(strPtr); } else if (sizeof(wchar_t) == 4) { - const unsigned int* strPtr = reinterpret_cast(cvfString.c_str()); + const char32_t* strPtr = reinterpret_cast(cvfString.c_str()); return QString::fromUcs4(strPtr); } From bf1c7f4b04724208ed47ba06926b23f7bb3ab974 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 2 Oct 2024 11:09:06 +0200 Subject: [PATCH 020/160] Qt6: Fix deprecated QVariant::type() calls. Use recommended QMetaData::type().id() instead. --- .../cafPdmUiCore/cafInternalPdmUiFieldCapability.inl | 10 +++++----- .../cafPdmUiCore/cafPdmUiFieldSpecialization.h | 2 +- .../cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.h | 2 +- .../cafPdmUiActionPushButtonEditor.cpp | 2 +- .../cafUserInterface/cafPdmUiFieldEditorHelper.cpp | 2 +- Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp | 8 ++++---- .../cafUserInterface/cafPdmUiPushButtonEditor.cpp | 4 ++-- .../cafUserInterface/cafPdmUiTableViewQModel.cpp | 6 +++--- Fwk/AppFwk/cafUserInterface/cafPdmUiToolBarEditor.cpp | 2 +- .../cafUserInterface/cafPdmUiTreeSelectionQModel.cpp | 4 ++-- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmUiFieldCapability.inl b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmUiFieldCapability.inl index edab75f8d3..e09e972b5a 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmUiFieldCapability.inl +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmUiFieldCapability.inl @@ -24,7 +24,7 @@ void PdmFieldUiCap::setValueFromUiEditor( const QVariant& uiValue, bo if ( !m_optionEntryCache.empty() ) { // This has an option based GUI, the uiValue is only indexes into the m_optionEntryCache - if ( uiValue.type() == QVariant::UInt ) + if ( uiValue.metaType().id() == QMetaType::UInt ) { uint optionIndex = uiValue.toUInt(); CAF_ASSERT( optionIndex < static_cast( m_optionEntryCache.size() ) ); @@ -35,7 +35,7 @@ void PdmFieldUiCap::setValueFromUiEditor( const QVariant& uiValue, bo PdmUiFieldSpecialization::setFromVariant( optionVariantValue, fieldValue ); m_field->setValue( fieldValue ); } - else if ( uiValue.type() == QVariant::List ) + else if ( uiValue.metaType().id() == QMetaType::QVariantList ) { QList selectedIndexes = uiValue.toList(); QList valuesToSetInField; @@ -48,7 +48,7 @@ void PdmFieldUiCap::setValueFromUiEditor( const QVariant& uiValue, bo } else { - if ( selectedIndexes.front().type() == QVariant::UInt ) + if ( selectedIndexes.front().metaType().id() == QMetaType::UInt ) { for ( int i = 0; i < selectedIndexes.size(); ++i ) { @@ -132,7 +132,7 @@ QVariant PdmFieldUiCap::uiValue() const PdmOptionItemInfo::findValues( m_optionEntryCache, uiBasedQVariant, indexesToFoundOptions ); - if ( uiBasedQVariant.type() == QVariant::List ) + if ( uiBasedQVariant.metaType().id() == QMetaType::QVariantList ) { if ( isAutoAddingOptionFromValue() && indexesToFoundOptions.size() != static_cast( uiBasedQVariant.toList().size() ) ) @@ -217,7 +217,7 @@ QList PdmFieldUiCap::valueOptions() const if ( !foundAllFieldValues ) { - if ( uiBasedQVariant.type() != QVariant::List ) // Single value field + if ( uiBasedQVariant.metaType().id() != QMetaType::QVariantList ) // Single value field { if ( !uiBasedQVariant.toString().isEmpty() ) { diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldSpecialization.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldSpecialization.h index 126133effc..0a4a4100a8 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldSpecialization.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldSpecialization.h @@ -45,7 +45,7 @@ public: /// This is needed for the lookup regarding OptionValues static bool isDataElementEqual( const QVariant& variantValue, const QVariant& variantValue2 ) { - if ( variantValue.type() == QVariant::UserType ) + if ( variantValue.typeId() > QMetaType::User ) { return ( variantValue.value() == variantValue2.value() ); } diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.h index 07d757ceab..9fdb143340 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.h @@ -180,7 +180,7 @@ bool PdmOptionItemInfo::findValues( const QList& optionList, // Find this fieldvalue in the optionlist if present // First handle lists/arrays of values - if ( fieldValue.type() == QVariant::List ) + if ( fieldValue.metaType().id() == QMetaType::QVariantList ) { QList valuesSelectedInField = fieldValue.toList(); diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiActionPushButtonEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiActionPushButtonEditor.cpp index 2b692f5e32..129d7dd5f4 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiActionPushButtonEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiActionPushButtonEditor.cpp @@ -81,7 +81,7 @@ void PdmUiActionPushButtonEditor::configureAndUpdateUi( const QString& uiConfigN QVariant variantFieldValue = uiField()->uiValue(); - if ( variantFieldValue.type() == QVariant::Bool ) + if ( variantFieldValue.metaType().id() == QMetaType::Bool ) { m_pushButton->setChecked( uiField()->uiValue().toBool() ); } diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiFieldEditorHelper.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiFieldEditorHelper.cpp index 1d9614bed0..2e43d71723 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiFieldEditorHelper.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiFieldEditorHelper.cpp @@ -79,7 +79,7 @@ caf::PdmUiFieldEditorHandle* caf::PdmUiFieldEditorHelper::createFieldEditorForFi // https://github.com/OPM/ResInsight/issues/10483 fieldTypeName = caf::PdmUiListEditor::uiEditorTypeName(); } - else if ( field->toUiBasedQVariant().type() != QVariant::List ) + else if ( field->toUiBasedQVariant().metaType().id() != QMetaType::QVariantList ) { // Handle a single value field with valueOptions: Make a combobox diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp index c9bb4147d9..28b063300c 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp @@ -196,7 +196,7 @@ void PdmUiListEditor::configureAndUpdateUi( const QString& uiConfigName ) strListModel->setStringList( texts ); QVariant fieldValue = uiField()->uiValue(); - if ( fieldValue.type() == QVariant::Int || fieldValue.type() == QVariant::UInt ) + if ( fieldValue.metaType().id() == QMetaType::Int || fieldValue.metaType().id() == QMetaType::UInt ) { int col = 0; int row = uiField()->uiValue().toInt(); @@ -217,7 +217,7 @@ void PdmUiListEditor::configureAndUpdateUi( const QString& uiConfigName ) m_listView->selectionModel()->blockSignals( false ); } - else if ( fieldValue.type() == QVariant::List ) + else if ( fieldValue.metaType().id() == QMetaType::QVariantList ) { QList valuesSelectedInField = fieldValue.toList(); QItemSelection selection; @@ -307,7 +307,7 @@ void PdmUiListEditor::slotSelectionChanged( const QItemSelection& selected, cons m_isScrollToItemAllowed = false; QVariant fieldValue = uiField()->uiValue(); - if ( fieldValue.type() == QVariant::Int || fieldValue.type() == QVariant::UInt ) + if ( fieldValue.metaType().id() == QMetaType::Int || fieldValue.metaType().id() == QMetaType::UInt ) { // NOTE : Workaround for update issue seen on RHEL6 with Qt 4.6.2 // An invalid call to setSelection() from QAbstractItemView::keyPressEvent() causes the stepping using arrow @@ -327,7 +327,7 @@ void PdmUiListEditor::slotSelectionChanged( const QItemSelection& selected, cons } } } - else if ( fieldValue.type() == QVariant::List ) + else if ( fieldValue.metaType().id() == QMetaType::QVariantList ) { QModelIndexList idxList = m_listView->selectionModel()->selectedIndexes(); diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.cpp index 9667434ab4..091eaa7727 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.cpp @@ -86,7 +86,7 @@ void PdmUiPushButtonEditor::configureAndUpdateUi( const QString& uiConfigName ) } else { - if ( variantFieldValue.type() == QVariant::Bool ) + if ( variantFieldValue.metaType().id() == QMetaType::Bool ) { m_pushButton->setText( variantFieldValue.toBool() ? "On" : "Off" ); } @@ -103,7 +103,7 @@ void PdmUiPushButtonEditor::configureAndUpdateUi( const QString& uiConfigName ) m_buttonLayout->setAlignment( m_pushButton, Qt::AlignRight ); } - if ( variantFieldValue.type() == QVariant::Bool ) + if ( variantFieldValue.metaType().id() == QMetaType::Bool ) { m_pushButton->setChecked( uiField()->uiValue().toBool() ); } diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewQModel.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewQModel.cpp index 0814e67c08..2771d72a44 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewQModel.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewQModel.cpp @@ -208,7 +208,7 @@ QVariant PdmUiTableViewQModel::data( const QModelIndex& index, int role /*= Qt:: if ( uiFieldHandle ) { QVariant fieldValue = uiFieldHandle->uiValue(); - if ( fieldValue.type() == QVariant::List ) + if ( fieldValue.metaType().id() == QMetaType::QVariantList ) { QString displayText; QList valuesSelectedInField = fieldValue.toList(); @@ -621,7 +621,7 @@ bool PdmUiTableViewQModel::isRepresentingBoolean( const QModelIndex& index ) con } QVariant val = fieldHandle->uiCapability()->uiValue(); - if ( val.type() == QVariant::Bool ) + if ( val.metaType().id() == QMetaType::Bool ) { return true; } @@ -794,7 +794,7 @@ void TableViewPushButton::slotPressed() if ( m_fieldHandle ) { QVariant val = m_fieldHandle->uiValue(); - if ( val.type() == QVariant::Bool ) + if ( val.metaType().id() == QMetaType::Bool ) { bool currentValue = val.toBool(); caf::PdmUiCommandSystemProxy::instance()->setUiValueToField( m_fieldHandle, !currentValue ); diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiToolBarEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiToolBarEditor.cpp index 12e53d396c..ad8ee18965 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiToolBarEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiToolBarEditor.cpp @@ -146,7 +146,7 @@ void PdmUiToolBarEditor::configureAndUpdateUi( const QString& uiConfigName ) bool addSpace = false; if ( uiFieldHandle ) { - if ( uiFieldHandle->uiValue().type() == QVariant::Bool ) + if ( uiFieldHandle->uiValue().metaType().id() == QMetaType::Bool ) { QString editorTypeName = caf::PdmUiToolButtonEditor::uiEditorTypeName(); diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionQModel.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionQModel.cpp index c5f005cf77..a153339a93 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionQModel.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionQModel.cpp @@ -632,7 +632,7 @@ void caf::PdmUiTreeSelectionQModel::recursiveNotifyChildren( const QModelIndex& //-------------------------------------------------------------------------------------------------- bool caf::PdmUiTreeSelectionQModel::isSingleValueField( const QVariant& fieldValue ) { - if ( fieldValue.type() == QVariant::Int || fieldValue.type() == QVariant::UInt ) + if ( fieldValue.metaType().id() == QMetaType::Int || fieldValue.metaType().id() == QMetaType::UInt ) { return true; } @@ -645,7 +645,7 @@ bool caf::PdmUiTreeSelectionQModel::isSingleValueField( const QVariant& fieldVal //-------------------------------------------------------------------------------------------------- bool caf::PdmUiTreeSelectionQModel::isMultipleValueField( const QVariant& fieldValue ) { - if ( fieldValue.type() == QVariant::List ) + if ( fieldValue.metaType().id() == QMetaType::QVariantList ) { return true; } From 3797aa8211637598c83bce9c3f9f014eb5466003 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 2 Oct 2024 12:34:24 +0200 Subject: [PATCH 021/160] Qt6: Fix usage of deprecated QApplication::fontMetrics() --- .../cafPdmUiCore/cafQShortenedLabel.cpp | 10 +++++----- Fwk/AppFwk/cafUserInterface/cafPdmUiColorEditor.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafQShortenedLabel.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafQShortenedLabel.cpp index 9230fae456..a32ebb70ad 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafQShortenedLabel.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafQShortenedLabel.cpp @@ -79,7 +79,7 @@ QSize QShortenedLabel::minimumSizeHint() const { const int minimumNumberOfCharacters = 10; - QFontMetrics fontMetrics = QApplication::fontMetrics(); + QFontMetrics fontMetrics( QApplication::font() ); QString fullLabelText = fullText(); QString shortenedText = fullLabelText.left( minimumNumberOfCharacters ); int minimumWidth = fontMetrics.horizontalAdvance( shortenedText ); @@ -118,8 +118,8 @@ QSize QShortenedLabel::minimumSizeHint() const //-------------------------------------------------------------------------------------------------- QSize QShortenedLabel::sizeHint() const { - QFontMetrics fontMetrics = QApplication::fontMetrics(); - QString labelText = fullText(); + QFontMetrics fontMetrics( QApplication::font() ); + QString labelText = fullText(); QStringList labelLines = labelText.split( "\n" ); int maxLineWidth = 0; @@ -147,8 +147,8 @@ void QShortenedLabel::resizeEvent( QResizeEvent* event ) //-------------------------------------------------------------------------------------------------- void caf::QShortenedLabel::resizeText( QSize paintSize ) { - QString labelText = fullText(); - QFontMetrics fontMetrics = QApplication::fontMetrics(); + QString labelText = fullText(); + QFontMetrics fontMetrics( QApplication::font() ); QStringList labelLines = labelText.split( "\n" ); int maxLineWidth = 0; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiColorEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiColorEditor.cpp index f8adaf40b0..34f46ec044 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiColorEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiColorEditor.cpp @@ -153,7 +153,7 @@ QWidget* PdmUiColorEditor::createEditorWidget( QWidget* parent ) m_colorPreviewLabel->setText( QLatin1String( "..." ) ); m_colorPreviewLabel->setAlignment( Qt::AlignCenter ); - QFontMetrics fontMetrics = QApplication::fontMetrics(); + QFontMetrics fontMetrics( QApplication::font() ); buttonLayout->addWidget( m_colorPreviewLabel ); m_colorSelectionButton->setMinimumWidth( fontMetrics.boundingRect( m_colorPreviewLabel->text() ).width() + 15 ); From d01ef325fa23232dffd8c02de4a357df44799e6d Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 4 Oct 2024 13:35:40 +0200 Subject: [PATCH 022/160] GA: Remove Qt5 builds for AppFwkUnitTest jobs. --- .github/workflows/AppFwkUnitTest.yml | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/.github/workflows/AppFwkUnitTest.yml b/.github/workflows/AppFwkUnitTest.yml index 18bfd30b83..3dfe618303 100644 --- a/.github/workflows/AppFwkUnitTest.yml +++ b/.github/workflows/AppFwkUnitTest.yml @@ -8,12 +8,10 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest] - qtver: [5.12.12, 6.5.3] + qtver: [6.5.3] include: - qtver: 6.5.3 build_flags: -DCEE_USE_QT6=ON -DCEE_USE_QT5=OFF - - qtver: 5.12.12 - build_flags: -DCEE_USE_QT6=OFF -DCEE_USE_QT5=ON steps: - name: Checkout uses: actions/checkout@v4 @@ -57,20 +55,6 @@ jobs: cd cmakebuild cmake --install . --prefix ${{github.workspace}}/cmakebuild/install - - name: Run Unit Tests Qt5 - if: matrix.qtver == '5.12.12' - shell: bash - run: | - cmakebuild/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/cafPdmCore_UnitTests - cmakebuild/cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests/cafPdmXml_UnitTests - cmakebuild/cafProjectDataModel/cafProjectDataModel_UnitTests/cafProjectDataModel_UnitTests - cmakebuild/cafPdmScripting/cafPdmScripting_UnitTests/cafPdmScripting_UnitTests - - - name: Run Unit Tests Windows Qt5 (does not work on Linux) - if: (contains( matrix.os, 'windows') && (matrix.qtver == '5.12.12')) - shell: bash - run: cmakebuild/cafUserInterface/cafUserInterface_UnitTests/cafUserInterface_UnitTests - - name: Run Unit Tests Qt6 if: matrix.qtver == '6.5.3' shell: bash @@ -79,9 +63,8 @@ jobs: cmakebuild/install/bin/cafPdmXml_UnitTests cmakebuild/install/bin/cafProjectDataModel_UnitTests cmakebuild/install/bin/cafPdmScripting_UnitTests - + - name: Run Unit Tests Windows Qt6 (does not work on Linux) if: (contains( matrix.os, 'windows') && (matrix.qtver == '6.5.3')) shell: bash run: cmakebuild/install/bin/cafUserInterface_UnitTests - \ No newline at end of file From b9448c24305762c3ec8fefb8a5d0b769b163e305 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 4 Oct 2024 15:28:42 +0200 Subject: [PATCH 023/160] Additional Openssl adjustments --- ApplicationExeCode/CMakeLists.txt | 17 +++++++++++++++++ CMakeLists.txt | 2 +- scripts/additional-packages/readme.md | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ApplicationExeCode/CMakeLists.txt b/ApplicationExeCode/CMakeLists.txt index df72302909..0bb3c2991a 100644 --- a/ApplicationExeCode/CMakeLists.txt +++ b/ApplicationExeCode/CMakeLists.txt @@ -496,6 +496,23 @@ else(RESINSIGHT_PRIVATE_INSTALL) ) endif(RESINSIGHT_PRIVATE_INSTALL) +# ############################################################################## +# Optional install of OpensSSL 3 for required platforms like RHEL8 +# ############################################################################## + +set(CUSTOM_OPENSSL_FILES libcrypto.so libcrypto.so.3 libssl.so libssl.so.3) +foreach(file ${CUSTOM_OPENSSL_FILES}) + if(EXISTS + "${CMAKE_BINARY_DIR}/vcpkg_installed_custom/x64-linux-dynamic/lib/${file}" + ) + install( + FILES + ${CMAKE_BINARY_DIR}/vcpkg_installed_custom/x64-linux-dynamic/lib/${file} + DESTINATION lib64 + ) + endif() +endforeach() + # ############################################################################## # Installation packaging # ############################################################################## diff --git a/CMakeLists.txt b/CMakeLists.txt index 2cfbdd7fa0..3eb05d323c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1066,7 +1066,7 @@ else(RESINSIGHT_USE_EXTERNAL_OCTAVE_PLUGINS) if(OCTAVE_MKOCTFILE) message(STATUS "Adding OctavePlugin library") - add_subdirectory(Octave/OctavePlugin) + # add_subdirectory(Octave/OctavePlugin) else(OCTAVE_MKOCTFILE) message( STATUS "Could not find OCTAVE_MKOCTFILE, skipping OctavePlugin library" diff --git a/scripts/additional-packages/readme.md b/scripts/additional-packages/readme.md index 02561a573a..6c96c37cd8 100644 --- a/scripts/additional-packages/readme.md +++ b/scripts/additional-packages/readme.md @@ -8,7 +8,7 @@ From Qt 6.5, OpenSSL 3 is used for authentication workflows. On RHEL8 the only a 1. Build and install ResInsight 2. Build a dynamic version of OpenSSL 3 using vcpkg. In the /build folder, execute the following: - ../ThirdParty/vcpkg/vcpkg install --triplet x64-linux-dynamic --x-manifest-root=../scripts/additional-packages --x-install-root=./vcpkg_installed + ../ThirdParty/vcpkg/vcpkg install --triplet x64-linux-dynamic --x-manifest-root=../scripts/additional-packages --x-install-root=./vcpkg_installed_custom Make sure that the libraries `libcrypto.so/libssl.so` are installed in `/build/vcpkg_installed/lib64` 3. Copy `libcrypto.so/libssl.so` to the `/lib64` folder in the install package for ResInsight From f67d736c05800954837653f74ed16a1c4cbe8c57 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 4 Oct 2024 15:44:12 +0200 Subject: [PATCH 024/160] Bump to dev.02 --- ResInsightVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index 349675818f..2494de961b 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -11,7 +11,7 @@ set(RESINSIGHT_VERSION_TEXT "-dev") # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -set(RESINSIGHT_DEV_VERSION ".01") +set(RESINSIGHT_DEV_VERSION ".02") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") From c75990551a9958f86334bb3044cae939701549f6 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 4 Oct 2024 15:32:04 +0200 Subject: [PATCH 025/160] #11746 Simplify layout to silence warning from Qt. Fixes #11746 --- .../ProjectDataModel/Cloud/RimCloudDataSourceCollection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Cloud/RimCloudDataSourceCollection.cpp b/ApplicationLibCode/ProjectDataModel/Cloud/RimCloudDataSourceCollection.cpp index 5f1c7874c0..be75fcb18d 100644 --- a/ApplicationLibCode/ProjectDataModel/Cloud/RimCloudDataSourceCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Cloud/RimCloudDataSourceCollection.cpp @@ -190,8 +190,8 @@ void RimCloudDataSourceCollection::defineUiOrdering( QString uiConfigName, caf:: uiOrdering.add( &m_sumoCaseId, layout ); uiOrdering.add( &m_sumoEnsembleNames, layout ); - uiOrdering.add( &m_addDataSources, { .totalColumnSpan = 2, .leftLabelColumnSpan = 1 } ); - uiOrdering.add( &m_addEnsembles, { .newRow = false, .totalColumnSpan = 1, .leftLabelColumnSpan = 0 } ); + uiOrdering.add( &m_addDataSources, layout ); + uiOrdering.add( &m_addEnsembles, layout ); } //-------------------------------------------------------------------------------------------------- From ca4a7b900015a5c189d9ba8a645fd12e8c473e41 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 7 Oct 2024 10:16:48 +0200 Subject: [PATCH 026/160] Remove obsolete code related to Qt5 * Remove bundling of openssl1.1 * Remove obsolete compile flags * Remove use of obsolete RimCommandObject * Use QColor::isValidColorName QColor::isValidColor is deprecated in Qt 6.6, QColor::isValidColorName was introduced in 6.4 * Make sure debug DLLs are copied when required * Remove Qt5 from AppFwk * Remove obsolete copy of Qt DLLs --- ApplicationExeCode/CMakeLists.txt | 11 +- .../Application/RiaApplication.cpp | 89 ----- .../Application/RiaApplication.h | 7 - .../Application/RiaGuiApplication.cpp | 4 - .../Application/RiaGuiApplication.h | 1 - .../Tools/RiaRegressionTestRunner.cpp | 3 - ApplicationLibCode/CMakeLists.txt | 7 - ApplicationLibCode/Commands/CMakeLists.txt | 7 - .../FileInterface/RifColorLegendData.cpp | 6 +- .../ProjectDataModel/CMakeLists_files.cmake | 2 - .../ProjectDataModel/RimCommandObject.cpp | 318 ------------------ .../ProjectDataModel/RimCommandObject.h | 108 ------ .../ProjectDataModel/RimProject.cpp | 5 - .../ProjectDataModel/RimProject.h | 3 - .../UserInterface/RiuMainWindow.cpp | 43 --- .../UserInterface/RiuMainWindow.h | 3 - CMakeLists.txt | 34 +- Fwk/AppFwk/CommonCode/CMakeLists.txt | 24 +- Fwk/AppFwk/cafAnimControl/CMakeLists.txt | 24 +- Fwk/AppFwk/cafCommand/CMakeLists.txt | 24 +- Fwk/AppFwk/cafCommandFeatures/CMakeLists.txt | 24 +- Fwk/AppFwk/cafDataLoader/CMakeLists.txt | 23 +- Fwk/AppFwk/cafPdmCvf/CMakeLists.txt | 23 +- .../cafPdmCvf_UnitTests/CMakeLists.txt | 59 +--- .../cafPdmScripting_UnitTests/CMakeLists.txt | 52 +-- Fwk/AppFwk/cafProjectDataModel/CMakeLists.txt | 24 +- .../cafPdmCore/CMakeLists.txt | 23 +- .../cafPdmCore_UnitTests/CMakeLists.txt | 43 +-- .../cafPdmUiCore/CMakeLists.txt | 25 +- .../cafPdmUiCore/cafIconProvider.cpp | 6 +- .../cafPdmXml/CMakeLists.txt | 24 +- .../cafPdmXml_UnitTests/CMakeLists.txt | 54 +-- .../CMakeLists.txt | 51 +-- .../cafTestApplication/CMakeLists.txt | 77 ++--- .../cafTestCvfApplication/CMakeLists.txt | 23 +- Fwk/AppFwk/cafUserInterface/CMakeLists.txt | 24 +- .../cafUserInterface_UnitTests/CMakeLists.txt | 49 +-- Fwk/AppFwk/cafViewer/CMakeLists.txt | 26 +- Fwk/AppFwk/cafVizExtensions/CMakeLists.txt | 30 +- Fwk/CMakeLists.txt | 9 - 40 files changed, 198 insertions(+), 1194 deletions(-) delete mode 100644 ApplicationLibCode/ProjectDataModel/RimCommandObject.cpp delete mode 100644 ApplicationLibCode/ProjectDataModel/RimCommandObject.h diff --git a/ApplicationExeCode/CMakeLists.txt b/ApplicationExeCode/CMakeLists.txt index 0bb3c2991a..adaa483bf2 100644 --- a/ApplicationExeCode/CMakeLists.txt +++ b/ApplicationExeCode/CMakeLists.txt @@ -197,13 +197,6 @@ if(MSVC) set(BUILD_FLAGS_FOR_MSVC "/wd4190 /wd4100 /wd4127 /wd4245 /wd4005") - if(CMAKE_CXX_COMPILER_VERSION LESS_EQUAL 19.14) - # The following warning is generated over 800 times from a qwt header only - # using VS2015 Disabling temporarily warning C4505 'function' : unreferenced - # local function has been removed - set(BUILD_FLAGS_FOR_MSVC "${BUILD_FLAGS_FOR_MSVC} /wd4505") - endif() - message(STATUS "BUILD_FLAGS_FOR_MSVC ${BUILD_FLAGS_FOR_MSVC}") set_target_properties( ResInsight PROPERTIES COMPILE_FLAGS ${BUILD_FLAGS_FOR_MSVC} @@ -444,8 +437,8 @@ if(RESINSIGHT_PRIVATE_INSTALL) add_custom_command( TARGET ResInsight POST_BUILD - COMMAND ${WINDEPLOYQT_EXECUTABLE} $ --release - --no-translations + COMMAND ${WINDEPLOYQT_EXECUTABLE} $ + "$,--debug,--release>" --no-translations COMMENT "Running windeployqt to deploy Qt dependencies to the build folder, required by install()" ) diff --git a/ApplicationLibCode/Application/RiaApplication.cpp b/ApplicationLibCode/Application/RiaApplication.cpp index 205e8209c1..a6dc82d4c3 100644 --- a/ApplicationLibCode/Application/RiaApplication.cpp +++ b/ApplicationLibCode/Application/RiaApplication.cpp @@ -48,7 +48,6 @@ #include "Rim2dIntersectionViewCollection.h" #include "RimCellFilterCollection.h" -#include "RimCommandObject.h" #include "RimCommandRouter.h" #include "RimCompletionTemplateCollection.h" #include "RimEclipseCaseCollection.h" @@ -789,18 +788,6 @@ bool RiaApplication::loadProject( const QString& projectFileName, ProjectLoadAct // Default behavior for scripts is to use current active view for data read/write onProjectOpened(); - // Loop over command objects and execute them - for ( size_t i = 0; i < m_project->commandObjects.size(); i++ ) - { - m_commandQueue.push_back( m_project->commandObjects[i] ); - } - - // Lock the command queue - m_commandQueueLock.lock(); - - // Execute command objects, and release the mutex when the queue is empty - executeCommandObjects(); - // Recalculate the results from grid property calculations. // Has to be done late since the results are filtered by view cell visibility for ( auto gridCalculation : m_project->gridCalculationCollection()->sortedGridCalculations() ) @@ -883,7 +870,6 @@ void RiaApplication::closeProject() onProjectBeingClosed(); m_project->close(); - m_commandQueue.clear(); RiaWellNameComparer::clearCache(); @@ -1383,81 +1369,6 @@ void RiaApplication::executeCommandFile( const QString& commandFile ) RicfCommandFileExecutor::instance()->executeCommands( in ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiaApplication::addCommandObject( RimCommandObject* commandObject ) -{ - m_commandQueue.push_back( commandObject ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiaApplication::executeCommandObjects() -{ - { - auto currentCommandQueue = m_commandQueue; - for ( auto command : currentCommandQueue ) - { - if ( !command->isAsyncronous() ) - { - command->redo(); - m_commandQueue.remove( command ); - } - } - } - - if ( !m_commandQueue.empty() ) - { - auto it = m_commandQueue.begin(); - if ( it->notNull() ) - { - RimCommandObject* first = *it; - first->redo(); - } - m_commandQueue.pop_front(); - } - else - { - // Unlock the command queue lock when the command queue is empty - // Required to lock the mutex before unlocking to avoid undefined behavior - m_commandQueueLock.tryLock(); - m_commandQueueLock.unlock(); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiaApplication::waitUntilCommandObjectsHasBeenProcessed() -{ - auto start = std::chrono::system_clock::now(); - const double timeoutThreshold = 5.0; - - // Wait until all command objects have completed - bool mutexLockedSuccessfully = m_commandQueueLock.tryLock(); - - while ( !mutexLockedSuccessfully ) - { - invokeProcessEvents(); - - mutexLockedSuccessfully = m_commandQueueLock.tryLock(); - - std::chrono::duration elapsed_seconds = std::chrono::system_clock::now() - start; - if ( timeoutThreshold < elapsed_seconds.count() ) - { - // This can happen if the octave plugins fails to execute during regression testing. - - RiaLogging::warning( - QString( "Timeout waiting for command objects to complete, timeout set to %1 seconds." ).arg( timeoutThreshold ) ); - break; - } - } - - m_commandQueueLock.unlock(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaApplication.h b/ApplicationLibCode/Application/RiaApplication.h index 5d9d046c2e..2246705003 100644 --- a/ApplicationLibCode/Application/RiaApplication.h +++ b/ApplicationLibCode/Application/RiaApplication.h @@ -49,7 +49,6 @@ class RiaSocketServer; class RigEclipseCaseData; -class RimCommandObject; class RimCommandRouter; class RimEclipseCase; class RimEclipseView; @@ -180,9 +179,6 @@ public: QVariant cacheDataObject( const QString& key ) const; void executeCommandFile( const QString& commandFile ); - void addCommandObject( RimCommandObject* commandObject ); - void executeCommandObjects(); - void waitUntilCommandObjectsHasBeenProcessed(); const QString startDir() const; void setStartDir( const QString& startDir ); @@ -253,9 +249,6 @@ protected: QString m_commandLineHelpText; QMap m_sessionCache; // Session cache used to store username/passwords per session - std::list> m_commandQueue; - QMutex m_commandQueueLock; - bool m_runningWorkerProcess; private: diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index 83edacb759..02c08654ca 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -50,7 +50,6 @@ #include "RimAnnotationCollection.h" #include "RimAnnotationInViewCollection.h" #include "RimAnnotationTextAppearance.h" -#include "RimCommandObject.h" #include "RimEclipseCaseCollection.h" #include "RimEclipseView.h" #include "RimFlowPlotCollection.h" @@ -1574,9 +1573,6 @@ void RiaGuiApplication::slotWorkerProcessFinished( int exitCode, QProcess::ExitS } m_workerProcess = nullptr; - // Always make sure the command objects are executed before any return statement - executeCommandObjects(); - // Either the work process crashed or was aborted by the user if ( exitStatus == QProcess::CrashExit ) { diff --git a/ApplicationLibCode/Application/RiaGuiApplication.h b/ApplicationLibCode/Application/RiaGuiApplication.h index 2e293d380b..7d4a97a58f 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.h +++ b/ApplicationLibCode/Application/RiaGuiApplication.h @@ -43,7 +43,6 @@ class RiaSocketServer; class RigEclipseCaseData; -class RimCommandObject; class RimEclipseCase; class RimEclipseView; class RimGridView; diff --git a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp index 13a2581a26..3ba8b88b48 100644 --- a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp +++ b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp @@ -240,9 +240,6 @@ void RiaRegressionTestRunner::runRegressionTest() app->loadProject( testCaseFolder.filePath( projectFileName ), RiaApplication::ProjectLoadAction::PLA_NONE, projectModifier.p() ); - // Wait until all command objects have completed - app->waitUntilCommandObjectsHasBeenProcessed(); - QString fullPathGeneratedFolder = testCaseFolder.absoluteFilePath( generatedFolderName ); if ( regressionTestConfig.exportSnapshots3dViews ) { diff --git a/ApplicationLibCode/CMakeLists.txt b/ApplicationLibCode/CMakeLists.txt index 5ba4d90f68..796f5a5ccd 100644 --- a/ApplicationLibCode/CMakeLists.txt +++ b/ApplicationLibCode/CMakeLists.txt @@ -277,13 +277,6 @@ if(MSVC) message(STATUS "CMAKE_CXX_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION}") - if(CMAKE_CXX_COMPILER_VERSION LESS_EQUAL 19.14) - # The following warning is generated over 800 times from a qwt header only - # using VS2015 Disabling temporarily warning C4505 'function' : unreferenced - # local function has been removed - set(BUILD_FLAGS_FOR_MSVC "${BUILD_FLAGS_FOR_MSVC} /wd4505") - endif() - if(CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 19.38) # https://github.com/OPM/ResInsight/issues/10844 set(BUILD_FLAGS_FOR_MSVC "${BUILD_FLAGS_FOR_MSVC} /wd4996") diff --git a/ApplicationLibCode/Commands/CMakeLists.txt b/ApplicationLibCode/Commands/CMakeLists.txt index b4ae51064e..b497b2adba 100644 --- a/ApplicationLibCode/Commands/CMakeLists.txt +++ b/ApplicationLibCode/Commands/CMakeLists.txt @@ -123,13 +123,6 @@ if(MSVC) set(BUILD_FLAGS_FOR_MSVC "/W3 /wd4190 /wd4100 /wd4127") - if(CMAKE_CXX_COMPILER_VERSION LESS_EQUAL 19.14) - # The following warning is generated over 800 times from a qwt header only - # using VS2015 Disabling temporarily warning C4505 'function' : unreferenced - # local function has been removed - set(BUILD_FLAGS_FOR_MSVC "${BUILD_FLAGS_FOR_MSVC} /wd4505") - endif() - if(CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 19.38) # https://github.com/OPM/ResInsight/issues/10844 set(BUILD_FLAGS_FOR_MSVC "${BUILD_FLAGS_FOR_MSVC} /wd4996") diff --git a/ApplicationLibCode/FileInterface/RifColorLegendData.cpp b/ApplicationLibCode/FileInterface/RifColorLegendData.cpp index 6e3d4d24aa..4713c43bd8 100644 --- a/ApplicationLibCode/FileInterface/RifColorLegendData.cpp +++ b/ApplicationLibCode/FileInterface/RifColorLegendData.cpp @@ -88,7 +88,7 @@ cvf::ref RifColorLegendData::readLyrFormationNameFile( const // extract last word which may contain formation color QString colorWord = RiaTextStringTools::splitSkipEmptyParts( numberString ).last(); - if ( QColor::isValidColor( colorWord ) ) numberString.remove( colorWord ); // remove color if present as last word on line + if ( QColor::isValidColorName( colorWord ) ) numberString.remove( colorWord ); // remove color if present as last word on line // extract words containing formation number(s) QStringList numberWords = RiaTextStringTools::splitSkipEmptyParts( numberString, QRegExp( "-" ) ); @@ -110,7 +110,7 @@ cvf::ref RifColorLegendData::readLyrFormationNameFile( const startK = tmp < endK ? tmp : endK; endK = tmp > endK ? tmp : endK; - if ( QColor::isValidColor( colorWord ) ) // formation color present at end of line + if ( QColor::isValidColorName( colorWord ) ) // formation color present at end of line { cvf::Color3f formationColor; @@ -133,7 +133,7 @@ cvf::ref RifColorLegendData::readLyrFormationNameFile( const continue; } - if ( QColor::isValidColor( colorWord ) ) // formation color present at end of line + if ( QColor::isValidColorName( colorWord ) ) // formation color present at end of line { cvf::Color3f formationColor; diff --git a/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake index 617e3b95fb..1ebf9cddf8 100644 --- a/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake @@ -30,7 +30,6 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RimReservoirCellResultsStorage.h ${CMAKE_CURRENT_LIST_DIR}/RimEclipseStatisticsCaseEvaluator.h ${CMAKE_CURRENT_LIST_DIR}/RimMimeData.h - ${CMAKE_CURRENT_LIST_DIR}/RimCommandObject.h ${CMAKE_CURRENT_LIST_DIR}/RimTools.h ${CMAKE_CURRENT_LIST_DIR}/RimFormationNames.h ${CMAKE_CURRENT_LIST_DIR}/RimFormationNamesCollection.h @@ -168,7 +167,6 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimReservoirCellResultsStorage.cpp ${CMAKE_CURRENT_LIST_DIR}/RimEclipseStatisticsCaseEvaluator.cpp ${CMAKE_CURRENT_LIST_DIR}/RimMimeData.cpp - ${CMAKE_CURRENT_LIST_DIR}/RimCommandObject.cpp ${CMAKE_CURRENT_LIST_DIR}/RimTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RimFormationNames.cpp ${CMAKE_CURRENT_LIST_DIR}/RimFormationNamesCollection.cpp diff --git a/ApplicationLibCode/ProjectDataModel/RimCommandObject.cpp b/ApplicationLibCode/ProjectDataModel/RimCommandObject.cpp deleted file mode 100644 index d6fc849771..0000000000 --- a/ApplicationLibCode/ProjectDataModel/RimCommandObject.cpp +++ /dev/null @@ -1,318 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2011- Statoil ASA -// Copyright (C) 2013- Ceetron Solutions AS -// Copyright (C) 2011-2012 Ceetron AS -// -// 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 "RimCommandObject.h" - -#include "RiaApplication.h" -#include "RimCalcScript.h" -#include "RimEclipseStatisticsCase.h" -#include "RimProject.h" - -#include "cafPdmObjectGroup.h" -#include "cafPdmUiPushButtonEditor.h" -#include "cafPdmUiTextEditor.h" -#include "cafPdmValueField.h" - -#include - -CAF_PDM_SOURCE_INIT( RimCommandObject, "RimCommandObject" ); -CAF_PDM_SOURCE_INIT( RimCommandExecuteScript, "RimCommandExecuteScript" ); -CAF_PDM_SOURCE_INIT( RimCommandIssueFieldChanged, "RimCommandIssueFieldChanged" ); - -//------------------------------------------------------------------------------------------------ -/// -//-------------------------------------------------------------------------------------------------- -RimCommandObject::RimCommandObject() -{ -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimCommandObject::~RimCommandObject() -{ -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimCommandExecuteScript::RimCommandExecuteScript() -{ - CAF_PDM_InitFieldNoDefault( &name, "Name", "Name" ); - - CAF_PDM_InitField( &scriptText, "ScriptText", QString(), "Script Text" ); - scriptText.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() ); - - CAF_PDM_InitField( &isEnabled, "IsEnabled", true, "Enabled " ); - - CAF_PDM_InitField( &execute, "Execute", true, "Execute" ); - caf::PdmUiPushButtonEditor::configureEditorLabelHidden( &execute ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimCommandExecuteScript::~RimCommandExecuteScript() -{ -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimCommandExecuteScript::redo() -{ - if ( !isEnabled ) return; - - RiaApplication* app = RiaApplication::instance(); - QString octavePath = app->octavePath(); - if ( !octavePath.isEmpty() ) - { - QStringList arguments = app->octaveArguments(); - - arguments.append( "--eval" ); - arguments << scriptText(); - - RiaApplication::instance()->launchProcess( octavePath, arguments, app->octaveProcessEnvironment() ); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimCommandExecuteScript::undo() -{ -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimCommandExecuteScript::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) -{ - caf::PdmUiTextEditorAttribute* myAttr = dynamic_cast( attribute ); - if ( myAttr ) - { - myAttr->showSaveButton = true; - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -caf::PdmFieldHandle* RimCommandExecuteScript::userDescriptionField() -{ - return &name; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimCommandExecuteScript::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) -{ - if ( &execute == changedField ) - { - RiaApplication* app = RiaApplication::instance(); - app->addCommandObject( this ); - app->executeCommandObjects(); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RimCommandExecuteScript::isAsyncronous() -{ - return true; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimCommandFactory::createCommandObjects( const caf::PdmObjectGroup& selectedObjects, std::vector* commandObjects ) -{ - for ( size_t i = 0; i < selectedObjects.objects.size(); i++ ) - { - caf::PdmObjectHandle* pdmObject = selectedObjects.objects[i]; - - if ( dynamic_cast( pdmObject ) ) - { - RimCalcScript* calcScript = dynamic_cast( pdmObject ); - - QFile file( calcScript->absoluteFileName ); - if ( file.open( QIODevice::ReadOnly | QIODevice::Text ) ) - { - QTextStream in( &file ); - QByteArray byteArray = file.readAll(); - QString scriptText( byteArray ); - - RimCommandExecuteScript* command = new RimCommandExecuteScript; - command->scriptText = scriptText; - - commandObjects->push_back( command ); - } - } - else if ( dynamic_cast( pdmObject ) ) - { - RimEclipseStatisticsCase* statisticsCase = dynamic_cast( pdmObject ); - - RimCommandIssueFieldChanged* command = new RimCommandIssueFieldChanged; - command->objectName = statisticsCase->uiName(); - command->fieldName = statisticsCase->m_calculateEditCommand.keyword(); - command->fieldValueToApply = "true"; - - commandObjects->push_back( command ); - } - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimCommandIssueFieldChanged::RimCommandIssueFieldChanged() -{ - CAF_PDM_InitFieldNoDefault( &commandName, "CommandName", "CommandName" ); - - CAF_PDM_InitField( &objectName, "ObjectName", QString(), "ObjectName" ); - CAF_PDM_InitField( &fieldName, "FieldName", QString(), "FieldName" ); - CAF_PDM_InitField( &fieldValueToApply, "FieldValueToApply", QString(), "FieldValueToApply" ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimCommandIssueFieldChanged::~RimCommandIssueFieldChanged() -{ -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimCommandIssueFieldChanged::redo() -{ - RiaApplication* app = RiaApplication::instance(); - PdmObject* project = app->project(); - - caf::PdmObjectHandle* pdmObject = findObjectByName( project, objectName ); - - if ( pdmObject ) - { - caf::PdmFieldHandle* fieldHandle = findFieldByKeyword( pdmObject, fieldName ); - - if ( fieldHandle && fieldHandle->uiCapability() ) - { - caf::PdmValueField* valueField = dynamic_cast( fieldHandle ); - CVF_ASSERT( valueField ); - - QVariant oldValue = valueField->toQVariant(); - QVariant newValue( fieldValueToApply ); - - valueField->setFromQVariant( newValue ); - - caf::PdmUiFieldHandle* uiFieldHandle = fieldHandle->uiCapability(); - uiFieldHandle->notifyFieldChanged( oldValue, newValue ); - } - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimCommandIssueFieldChanged::undo() -{ -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -caf::PdmFieldHandle* RimCommandIssueFieldChanged::userDescriptionField() -{ - return &commandName; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimCommandIssueFieldChanged::childObjects( caf::PdmObject* pdmObject, std::vector& children ) -{ - if ( !pdmObject ) return; - - std::vector fields = pdmObject->fields(); - - size_t fIdx; - for ( fIdx = 0; fIdx < fields.size(); ++fIdx ) - { - if ( fields[fIdx] ) - { - auto other = fields[fIdx]->children(); - children.insert( children.end(), other.begin(), other.end() ); - } - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -caf::PdmObjectHandle* RimCommandIssueFieldChanged::findObjectByName( caf::PdmObjectHandle* pdmObject, const QString& name ) -{ - std::vector fields = pdmObject->fields(); - - caf::PdmUiObjectHandle* uiObjectHandle = uiObj( pdmObject ); - - if ( uiObjectHandle && uiObjectHandle->uiName() == name ) - { - return pdmObject; - } - - for ( size_t fIdx = 0; fIdx < fields.size(); fIdx++ ) - { - if ( fields[fIdx] ) - { - std::vector children = fields[fIdx]->children(); - - for ( size_t cIdx = 0; cIdx < children.size(); cIdx++ ) - { - PdmObjectHandle* candidateObj = findObjectByName( children[cIdx], name ); - if ( candidateObj ) - { - return candidateObj; - } - } - } - } - - return nullptr; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -caf::PdmFieldHandle* RimCommandIssueFieldChanged::findFieldByKeyword( caf::PdmObjectHandle* pdmObject, const QString& keywordName ) -{ - std::vector fields = pdmObject->fields(); - - for ( size_t fIdx = 0; fIdx < fields.size(); fIdx++ ) - { - if ( fields[fIdx] && fields[fIdx]->keyword() == keywordName ) - { - return fields[fIdx]; - } - } - - return nullptr; -} diff --git a/ApplicationLibCode/ProjectDataModel/RimCommandObject.h b/ApplicationLibCode/ProjectDataModel/RimCommandObject.h deleted file mode 100644 index f9d4bedcb0..0000000000 --- a/ApplicationLibCode/ProjectDataModel/RimCommandObject.h +++ /dev/null @@ -1,108 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2011- Statoil ASA -// Copyright (C) 2013- Ceetron Solutions AS -// Copyright (C) 2011-2012 Ceetron AS -// -// 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 "cafPdmObject.h" -#include "cafPdmObjectGroup.h" - -#include "cvfObject.h" - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -class RimCommandObject : public caf::PdmObject -{ - CAF_PDM_HEADER_INIT; - -public: - RimCommandObject(); - ~RimCommandObject() override; - - virtual bool isAsyncronous() { return false; }; - - virtual void redo(){}; - virtual void undo(){}; -}; - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -class RimCommandExecuteScript : public RimCommandObject -{ - CAF_PDM_HEADER_INIT; - -public: - RimCommandExecuteScript(); - ~RimCommandExecuteScript() override; - - caf::PdmField name; - caf::PdmField isEnabled; - caf::PdmField execute; - caf::PdmField scriptText; - - void redo() override; - void undo() override; - - void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; - - caf::PdmFieldHandle* userDescriptionField() override; - - void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - - bool isAsyncronous() override; -}; - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -class RimCommandIssueFieldChanged : public RimCommandObject -{ - CAF_PDM_HEADER_INIT; - -public: - RimCommandIssueFieldChanged(); - ~RimCommandIssueFieldChanged() override; - - caf::PdmField commandName; - caf::PdmField objectName; - caf::PdmField fieldName; - caf::PdmField fieldValueToApply; - - void redo() override; - void undo() override; - - caf::PdmFieldHandle* userDescriptionField() override; - -private: - void childObjects( caf::PdmObject* pdmObject, std::vector& children ); - caf::PdmObjectHandle* findObjectByName( caf::PdmObjectHandle* root, const QString& name ); - caf::PdmFieldHandle* findFieldByKeyword( caf::PdmObjectHandle* pdmObject, const QString& fieldName ); -}; - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -class RimCommandFactory -{ -public: - static void createCommandObjects( const caf::PdmObjectGroup& selectedObjects, std::vector* commandObjects ); -}; diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index 6144efaefe..c2a6f89685 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -45,7 +45,6 @@ #include "RimCase.h" #include "RimCaseCollection.h" #include "RimColorLegendCollection.h" -#include "RimCommandObject.h" #include "RimCompletionTemplateCollection.h" #include "RimContextCommandBuilder.h" #include "RimCorrelationPlotCollection.h" @@ -172,8 +171,6 @@ RimProject::RimProject() CAF_PDM_InitFieldNoDefault( &gridCalculationCollection, "GridCalculationCollection", "Grid Calculation Collection" ); gridCalculationCollection = new RimGridCalculationCollection; - CAF_PDM_InitFieldNoDefault( &commandObjects, "CommandObjects", "Command Objects" ); - CAF_PDM_InitFieldNoDefault( &multiSnapshotDefinitions, "MultiSnapshotDefinitions", "Multi Snapshot Definitions" ); CAF_PDM_InitFieldNoDefault( &mainWindowTreeViewStates, "TreeViewStates", "" ); @@ -267,8 +264,6 @@ void RimProject::close() casesObsolete.deleteChildren(); caseGroupsObsolete.deleteChildren(); - commandObjects.deleteChildren(); - multiSnapshotDefinitions.deleteChildren(); m_dialogData->clearProjectSpecificData(); diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.h b/ApplicationLibCode/ProjectDataModel/RimProject.h index 77998ebb52..92b414698f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.h +++ b/ApplicationLibCode/ProjectDataModel/RimProject.h @@ -43,8 +43,6 @@ class RimPolylinesAnnotation; class RimSummaryCalculationCollection; class RimSummaryCalculation; class RimCase; -class RimCommandObject; -class RimCommandObject; class RimDialogData; class RimEclipseCase; class RimGeoMechCase; @@ -101,7 +99,6 @@ public: caf::PdmChildField viewLinkerCollection; caf::PdmChildField calculationCollection; caf::PdmChildField gridCalculationCollection; - caf::PdmChildArrayField commandObjects; RimMainPlotCollection* mainPlotCollection() const; diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index 511f776eb9..59fcdc9b7e 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -32,7 +32,6 @@ #include "Rim2dIntersectionView.h" #include "Rim3dView.h" #include "RimCellEdgeColors.h" -#include "RimCommandObject.h" #include "RimEclipseCase.h" #include "RimEclipseCellColors.h" #include "RimEclipseContourMapView.h" @@ -358,7 +357,6 @@ void RiuMainWindow::createActions() m_snapshotAllViewsToFile = new QAction( QIcon( ":/SnapShotSaveViews.svg" ), "Snapshot All Views To File", this ); - m_createCommandObject = new QAction( "Create Command Object", this ); m_showRegressionTestDialog = new QAction( "Regression Test Dialog", this ); m_executePaintEventPerformanceTest = new QAction( "&Paint Event Performance Test", this ); @@ -370,7 +368,6 @@ void RiuMainWindow::createActions() connect( m_snapshotAllViewsToFile, SIGNAL( triggered() ), SLOT( slotSnapshotAllViewsToFile() ) ); - connect( m_createCommandObject, SIGNAL( triggered() ), SLOT( slotCreateCommandObject() ) ); connect( m_showRegressionTestDialog, SIGNAL( triggered() ), SLOT( slotShowRegressionTestDialog() ) ); connect( m_executePaintEventPerformanceTest, SIGNAL( triggered() ), SLOT( slotExecutePaintEventPerformanceTest() ) ); @@ -532,8 +529,6 @@ void RiuMainWindow::createMenus() testMenu->addAction( m_mockModelCustomizedAction ); testMenu->addAction( m_mockInputModelAction ); testMenu->addSeparator(); - testMenu->addAction( m_createCommandObject ); - testMenu->addSeparator(); testMenu->addAction( m_showRegressionTestDialog ); testMenu->addAction( m_executePaintEventPerformanceTest ); testMenu->addAction( cmdFeatureMgr->action( "RicRunCommandFileFeature" ) ); @@ -1928,44 +1923,6 @@ void RiuMainWindow::selectedCases( std::vector& cases ) caf::SelectionManager::instance()->objectsByType( &cases ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuMainWindow::slotCreateCommandObject() -{ - RiaApplication* app = RiaApplication::instance(); - if ( !app->project() ) return; - - caf::PdmUiTreeView* projectTree = dynamic_cast( sender() ); - if ( !projectTree ) return; - - std::vector selectedUiItems; - projectTree->selectedUiItems( selectedUiItems ); - - caf::PdmObjectGroup selectedObjects; - for ( auto* selectedUiItem : selectedUiItems ) - { - caf::PdmUiObjectHandle* uiObj = dynamic_cast( selectedUiItem ); - if ( uiObj ) - { - selectedObjects.addObject( uiObj->objectHandle() ); - } - } - - if ( !selectedObjects.objects.empty() ) - { - std::vector commandObjects; - RimCommandFactory::createCommandObjects( selectedObjects, &commandObjects ); - - for ( auto* commandObject : commandObjects ) - { - app->project()->commandObjects.push_back( commandObject ); - } - - app->project()->updateConnectedEditors(); - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.h b/ApplicationLibCode/UserInterface/RiuMainWindow.h index c2e48906a7..ae7a6baad3 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.h @@ -173,7 +173,6 @@ private: QAction* m_snapshotAllViewsToFile; - QAction* m_createCommandObject; QAction* m_showRegressionTestDialog; QAction* m_executePaintEventPerformanceTest; @@ -235,8 +234,6 @@ private slots: // Debug slots void slotSnapshotAllViewsToFile(); - void slotCreateCommandObject(); - void slotShowRegressionTestDialog(); void slotExecutePaintEventPerformanceTest(); diff --git a/CMakeLists.txt b/CMakeLists.txt index 3eb05d323c..f95a22a662 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,11 +10,9 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) set(VIZ_MODULES_FOLDER_NAME Fwk/VizFwk) -# !!! For now, we force Qt to version 5 +message(STATUS "Set CEE_USE_QT6 to ON") set(CEE_USE_QT5 OFF) -message(STATUS "Forcing setting of CEE_USE_QT6 to ON") set(CEE_USE_QT6 ON) -message(STATUS "CEE_USE_QT6=${CEE_USE_QT6}") cmake_policy(SET CMP0020 NEW) if(POLICY CMP0077) @@ -1079,36 +1077,6 @@ install(TARGETS extract-projectfile-versions DESTINATION ${RESINSIGHT_INSTALL_FOLDER} ) -# ############################################################################## -# Add OpenSSL 1.1.1 libraries The OpenSSL libraries are needed for the -# NetworkAuth module in Qt 5 Installed by adding openssl-windows in vcpkg.json -# Required to use fully specified path to the dlls, as it is not trivial to find -# the path. OpenSSL 3 is installed and used by other modules -# ############################################################################## - -if(MSVC) - FetchContent_Declare( - openssl_1_1_1 - URL https://github.com/CeetronSolutions/resinsight-dependencies/releases/download/2024.05/openssl_1_1_1.zip - ) - FetchContent_Populate(openssl_1_1_1) - - set(FILE_PATH_LIBCRYPTO_1_1 - "${openssl_1_1_1_SOURCE_DIR}/libcrypto-1_1-x64.dll" - ) - set(FILE_PATH_LIBOPENSSL_1_1 "${openssl_1_1_1_SOURCE_DIR}/libssl-1_1-x64.dll") - - message(STATUS "FILE_PATH_LIBCRYPTO_1_1: ${FILE_PATH_LIBCRYPTO_1_1}") - message(STATUS "FILE_PATH_LIBOPENSSL_1_1: ${FILE_PATH_LIBOPENSSL_1_1}") - - install( - FILES ${FILE_PATH_LIBCRYPTO_1_1} ${FILE_PATH_LIBOPENSSL_1_1} - DESTINATION ${RESINSIGHT_INSTALL_FOLDER} - OPTIONAL - ) - -endif() # MSVC - # ############################################################################## # Visual Studio : Create the ruleset file to be used by Static Code Analysis # https://stackoverflow.com/questions/75031903/how-to-enable-static-analysis-with-custom-ruleset-in-msvc-via-cmakelists-txt diff --git a/Fwk/AppFwk/CommonCode/CMakeLists.txt b/Fwk/AppFwk/CommonCode/CMakeLists.txt index 0bf5a214e8..1f9e198804 100644 --- a/Fwk/AppFwk/CommonCode/CMakeLists.txt +++ b/Fwk/AppFwk/CommonCode/CMakeLists.txt @@ -14,23 +14,13 @@ find_package(OpenGL) # These headers need to go through Qt's MOC compiler set(MOC_HEADER_FILES cafMessagePanel.h) -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets OpenGL - ) - set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets OpenGL - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL) - qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES}) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets OpenGL +) +set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL) +qt_standard_project_setup() add_library( ${PROJECT_NAME} diff --git a/Fwk/AppFwk/cafAnimControl/CMakeLists.txt b/Fwk/AppFwk/cafAnimControl/CMakeLists.txt index c8dc1fc27d..7d10739f2c 100644 --- a/Fwk/AppFwk/cafAnimControl/CMakeLists.txt +++ b/Fwk/AppFwk/cafAnimControl/CMakeLists.txt @@ -11,23 +11,13 @@ set(MOC_HEADER_FILES cafFrameAnimationControl.h cafAnimationToolBar.h cafPopupMenuButton.h ) -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets) - qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES}) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets +) +set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) +qt_standard_project_setup() # NOTE! Resources in this subfolder appends to the variable QRC_FILES in parent # scope CMakeList.txt in the application folder (parent scope) must use the diff --git a/Fwk/AppFwk/cafCommand/CMakeLists.txt b/Fwk/AppFwk/cafCommand/CMakeLists.txt index f6900a07ab..e68a3c2f27 100644 --- a/Fwk/AppFwk/cafCommand/CMakeLists.txt +++ b/Fwk/AppFwk/cafCommand/CMakeLists.txt @@ -10,23 +10,13 @@ endif() set(MOC_HEADER_FILES cafCmdFeature.h cafCmdFeatureManager.h) # Qt -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets) - qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES}) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets +) +set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) +qt_standard_project_setup() set(PROJECT_FILES cafCmdExecCommandManager.cpp diff --git a/Fwk/AppFwk/cafCommandFeatures/CMakeLists.txt b/Fwk/AppFwk/cafCommandFeatures/CMakeLists.txt index 090e820da6..3396102b5f 100644 --- a/Fwk/AppFwk/cafCommandFeatures/CMakeLists.txt +++ b/Fwk/AppFwk/cafCommandFeatures/CMakeLists.txt @@ -10,23 +10,13 @@ endif() set(MOC_HEADER_FILES) # Qt -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets) - qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES}) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets +) +set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) +qt_standard_project_setup() set(PROJECT_FILES # Default features diff --git a/Fwk/AppFwk/cafDataLoader/CMakeLists.txt b/Fwk/AppFwk/cafDataLoader/CMakeLists.txt index 28a736c7e8..e3473b1873 100644 --- a/Fwk/AppFwk/cafDataLoader/CMakeLists.txt +++ b/Fwk/AppFwk/cafDataLoader/CMakeLists.txt @@ -7,22 +7,13 @@ if(CAF_ENABLE_UNITY_BUILD) endif() # Qt -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets +) +set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) +qt_standard_project_setup() set(PROJECT_FILES cafDataLoader.h cafDataLoader.cpp cafDataLoadTask.h cafDataLoadTask.cpp diff --git a/Fwk/AppFwk/cafPdmCvf/CMakeLists.txt b/Fwk/AppFwk/cafPdmCvf/CMakeLists.txt index 61c2954cdc..b800f4591a 100644 --- a/Fwk/AppFwk/cafPdmCvf/CMakeLists.txt +++ b/Fwk/AppFwk/cafPdmCvf/CMakeLists.txt @@ -6,23 +6,12 @@ if(CAF_ENABLE_UNITY_BUILD) set(CMAKE_UNITY_BUILD true) endif() -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets) - qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES}) - qt5_add_resources(QRC_FILES_CPP ${QRC_FILES}) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets +) +set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) add_library( ${PROJECT_NAME} diff --git a/Fwk/AppFwk/cafPdmCvf/cafPdmCvf_UnitTests/CMakeLists.txt b/Fwk/AppFwk/cafPdmCvf/cafPdmCvf_UnitTests/CMakeLists.txt index acc5691ffa..e1d2701318 100644 --- a/Fwk/AppFwk/cafPdmCvf/cafPdmCvf_UnitTests/CMakeLists.txt +++ b/Fwk/AppFwk/cafPdmCvf/cafPdmCvf_UnitTests/CMakeLists.txt @@ -1,20 +1,9 @@ -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core - ) - set(QT_LIBRARIES Qt6::Core) -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core - ) - set(QT_LIBRARIES Qt5::Core) - qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES}) - qt5_add_resources(QRC_FILES_CPP ${QRC_FILES}) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core +) +set(QT_LIBRARIES Qt6::Core) project(cafPdmCvf_UnitTests) @@ -31,44 +20,8 @@ set(PROJECT_FILES # add the executable add_executable(${PROJECT_NAME} ${PROJECT_FILES}) -if(Qt5Core_FOUND) - set(QT_LIBRARIES Qt5::Core) -endif() - source_group("" FILES ${PROJECT_FILES}) target_link_libraries( ${PROJECT_NAME} cafPdmCore cafPdmXml LibCore cafPdmCvf ${QT_LIBRARIES} ) - -# Copy Qt Dlls -if(Qt5Core_FOUND) - foreach(qtlib ${QT_LIBRARIES}) - add_custom_command( - TARGET ${PROJECT_NAME} - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different $ - $ - ) - endforeach(qtlib) - # Copy Qt Dlls -else() - # Copy Qt Dlls - if(MSVC) - set(QTLIBLIST QtCore) - foreach(qtlib ${QTLIBLIST}) - - # Debug - execute_process( - COMMAND cmake -E copy_if_different ${QT_BINARY_DIR}/${qtlib}d4.dll - ${CMAKE_BINARY_DIR}/Debug/${qtlib}d4.dll - ) - - # Release - execute_process( - COMMAND cmake -E copy_if_different ${QT_BINARY_DIR}/${qtlib}4.dll - ${CMAKE_BINARY_DIR}/Release/${qtlib}4.dll - ) - endforeach(qtlib) - endif(MSVC) -endif(Qt5Core_FOUND) diff --git a/Fwk/AppFwk/cafPdmScripting/cafPdmScripting_UnitTests/CMakeLists.txt b/Fwk/AppFwk/cafPdmScripting/cafPdmScripting_UnitTests/CMakeLists.txt index 3af7bad1c3..20ce6e346b 100644 --- a/Fwk/AppFwk/cafPdmScripting/cafPdmScripting_UnitTests/CMakeLists.txt +++ b/Fwk/AppFwk/cafPdmScripting/cafPdmScripting_UnitTests/CMakeLists.txt @@ -1,20 +1,11 @@ project(cafPdmScripting_UnitTests) -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets - ) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Xml Gui - ) - set(QT_LIBRARIES Qt5::Core Qt5::Xml Qt5::Gui) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets +) +qt_standard_project_setup() if(MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11)) # VS 2017 : Disable warnings from from gtest code, using deprecated code @@ -29,11 +20,7 @@ set(PROJECT_FILES cafPdmScripting_UnitTests.cpp gtest/gtest-all.cpp cafPdmScriptingBasicTest.cpp cafPdmFieldSerializationTest.cpp ) -if(CEE_USE_QT6) - qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES}) -else() - add_executable(${PROJECT_NAME} ${PROJECT_FILES}) -endif(CEE_USE_QT6) +qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES}) if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") target_compile_options( @@ -47,29 +34,14 @@ target_link_libraries( source_group("" FILES ${PROJECT_FILES}) -# Copy Qt Dlls -if(Qt5Core_FOUND) - foreach(qtlib ${QT_LIBRARIES}) - add_custom_command( - TARGET ${PROJECT_NAME} - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different $ - $ - ) - endforeach(qtlib) -endif(Qt5Core_FOUND) - -# Install install( TARGETS ${PROJECT_NAME} BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) -if(CEE_USE_QT6) - qt_generate_deploy_app_script( - TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script - NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS - ) - install(SCRIPT ${deploy_script}) -endif(CEE_USE_QT6) +qt_generate_deploy_app_script( + TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script + NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS +) +install(SCRIPT ${deploy_script}) diff --git a/Fwk/AppFwk/cafProjectDataModel/CMakeLists.txt b/Fwk/AppFwk/cafProjectDataModel/CMakeLists.txt index 42100ff574..c85916f470 100644 --- a/Fwk/AppFwk/cafProjectDataModel/CMakeLists.txt +++ b/Fwk/AppFwk/cafProjectDataModel/CMakeLists.txt @@ -6,23 +6,13 @@ if(CAF_ENABLE_UNITY_BUILD) set(CMAKE_UNITY_BUILD true) endif() -# Qt -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets +) +set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) +qt_standard_project_setup() set(PROJECT_FILES cafFactory.h diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/CMakeLists.txt b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/CMakeLists.txt index b33de76ebe..7416c8ae41 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/CMakeLists.txt +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/CMakeLists.txt @@ -6,22 +6,13 @@ if(CAF_ENABLE_UNITY_BUILD) set(CMAKE_UNITY_BUILD true) endif() -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core - ) - set(QT_LIBRARIES Qt6::Core) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core - ) - set(QT_LIBRARIES Qt5::Core) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core +) +set(QT_LIBRARIES Qt6::Core) +qt_standard_project_setup() set(PROJECT_FILES cafAssert.h diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/CMakeLists.txt b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/CMakeLists.txt index 0b6a4b059b..02252476d0 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/CMakeLists.txt +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/CMakeLists.txt @@ -3,21 +3,12 @@ cmake_minimum_required(VERSION 3.15) project(cafPdmCore_UnitTests) # Qt -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Widgets Gui - ) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt5::Core Qt5::Widgets Qt5::Gui) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Widgets Gui +) +qt_standard_project_setup() if(MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11)) # VS 2017 : Disable warnings from from gtest code, using deprecated code @@ -43,11 +34,7 @@ set(PROJECT_FILES TestObj.h ) -if(CEE_USE_QT6) - qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES}) -else() - add_executable(${PROJECT_NAME} ${PROJECT_FILES}) -endif(CEE_USE_QT6) +qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES}) if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") @@ -59,10 +46,6 @@ endif() source_group("" FILES ${PROJECT_FILES}) -if(Qt5Core_FOUND) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets) -endif() - target_link_libraries( ${PROJECT_NAME} PRIVATE cafPdmCore ${QT_LIBRARIES} ${THREAD_LIBRARY} ) @@ -84,10 +67,8 @@ install( RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) -if(CEE_USE_QT6) - qt_generate_deploy_app_script( - TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script - NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS - ) - install(SCRIPT ${deploy_script}) -endif(CEE_USE_QT6) +qt_generate_deploy_app_script( + TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script + NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS +) +install(SCRIPT ${deploy_script}) diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/CMakeLists.txt b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/CMakeLists.txt index c686570d1f..72e9dea4a3 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/CMakeLists.txt +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/CMakeLists.txt @@ -11,24 +11,13 @@ set(MOC_HEADER_FILES cafPdmUiEditorHandle.h cafPdmUiFieldEditorHandle.h cafPdmUiSelection3dEditorVisualizer.h cafQShortenedLabel.h ) -# Qt -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets) - qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES}) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets +) +set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) +qt_standard_project_setup() set(PROJECT_FILES cafInternalPdmFieldTypeSpecializations.h diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafIconProvider.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafIconProvider.cpp index 3648b65dab..08aa84b5ae 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafIconProvider.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafIconProvider.cpp @@ -162,7 +162,7 @@ std::unique_ptr IconProvider::icon( const QSize& size ) const bool validIcon = false; if ( !m_backgroundColorStrings.empty() ) { - if ( m_backgroundColorStrings.size() == 1u && QColor::isValidColor( m_backgroundColorStrings.front() ) ) + if ( m_backgroundColorStrings.size() == 1u && QColor::isValidColorName( m_backgroundColorStrings.front() ) ) { pixmap.fill( QColor( m_backgroundColorStrings.front() ) ); validIcon = true; @@ -176,7 +176,7 @@ std::unique_ptr IconProvider::icon( const QSize& size ) const QLinearGradient gradient( QPointF( 0.0f, 0.0f ), QPoint( size.width(), 0.0f ) ); for ( size_t i = 0; i < m_backgroundColorStrings.size(); ++i ) { - if ( !QColor::isValidColor( m_backgroundColorStrings[i] ) ) + if ( !QColor::isValidColorName( m_backgroundColorStrings[i] ) ) { validIcon = false; break; @@ -303,7 +303,7 @@ bool IconProvider::backgroundColorsAreValid() const bool validBackgroundColors = true; for ( QString colorName : m_backgroundColorStrings ) { - if ( !QColor::isValidColor( colorName ) ) + if ( !QColor::isValidColorName( colorName ) ) { validBackgroundColors = false; break; diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/CMakeLists.txt b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/CMakeLists.txt index de12c881f7..885ca2cf2e 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/CMakeLists.txt +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/CMakeLists.txt @@ -6,23 +6,13 @@ if(CAF_ENABLE_UNITY_BUILD) set(CMAKE_UNITY_BUILD true) endif() -# Qt -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Xml - ) - set(QT_LIBRARIES Qt6::Core Qt6::Xml) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Xml - ) - set(QT_LIBRARIES Qt5::Core Qt5::Xml) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Xml +) +set(QT_LIBRARIES Qt6::Core Qt6::Xml) +qt_standard_project_setup() set(PROJECT_FILES cafInternalPdmFieldIoHelper.cpp diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests/CMakeLists.txt b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests/CMakeLists.txt index 974509c4ef..3d5ece722d 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests/CMakeLists.txt +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests/CMakeLists.txt @@ -2,22 +2,13 @@ cmake_minimum_required(VERSION 3.15) project(cafPdmXml_UnitTests) -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Xml - ) - set(QT_LIBRARIES Qt6::Core Qt6::Xml) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Xml - ) - set(QT_LIBRARIES Qt5::Core Qt5::Xml) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Xml +) +set(QT_LIBRARIES Qt6::Core Qt6::Xml) +qt_standard_project_setup() if(MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11)) # VS 2017 : Disable warnings from from gtest code, using deprecated code @@ -34,11 +25,7 @@ set(PROJECT_FILES cafPdmPtrArrayTest.cpp ) -if(CEE_USE_QT6) - qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES}) -else() - add_executable(${PROJECT_NAME} ${PROJECT_FILES}) -endif(CEE_USE_QT6) +qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES}) source_group("" FILES ${PROJECT_FILES}) @@ -46,29 +33,14 @@ target_link_libraries( ${PROJECT_NAME} PRIVATE cafPdmXml ${QT_LIBRARIES} ${THREAD_LIBRARY} ) -# Copy Qt Dlls -if(Qt5Core_FOUND) - foreach(qtlib ${QT_LIBRARIES}) - add_custom_command( - TARGET ${PROJECT_NAME} - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different $ - $ - ) - endforeach(qtlib) -endif(Qt5Core_FOUND) - -# Install install( TARGETS ${PROJECT_NAME} BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) -if(CEE_USE_QT6) - qt_generate_deploy_app_script( - TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script - NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS - ) - install(SCRIPT ${deploy_script}) -endif(CEE_USE_QT6) +qt_generate_deploy_app_script( + TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script + NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS +) +install(SCRIPT ${deploy_script}) diff --git a/Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/CMakeLists.txt b/Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/CMakeLists.txt index 768ca2b7c1..8b86a7abcd 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/CMakeLists.txt +++ b/Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/CMakeLists.txt @@ -2,22 +2,12 @@ cmake_minimum_required(VERSION 3.15) project(cafProjectDataModel_UnitTests) -# Qt -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Widgets - ) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Xml Gui - ) - set(QT_LIBRARIES Qt5::Core Qt5::Xml Qt5::Gui) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Widgets +) +qt_standard_project_setup() if(MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11)) # VS 2017 : Disable warnings from from gtest code, using deprecated code @@ -38,11 +28,7 @@ set(PROJECT_FILES gtest/gtest-all.cpp ) -if(CEE_USE_QT6) - qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES}) -else() - add_executable(${PROJECT_NAME} ${PROJECT_FILES}) -endif(CEE_USE_QT6) +qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES}) if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") target_compile_options( @@ -57,27 +43,14 @@ target_link_libraries( source_group("" FILES ${PROJECT_FILES}) -# Copy Qt Dlls -foreach(qtlib ${QT_LIBRARIES}) - add_custom_command( - TARGET ${PROJECT_NAME} - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different $ - $ - ) -endforeach(qtlib) - -# Install install( TARGETS ${PROJECT_NAME} BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) -if(CEE_USE_QT6) - qt_generate_deploy_app_script( - TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script - NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS - ) - install(SCRIPT ${deploy_script}) -endif(CEE_USE_QT6) +qt_generate_deploy_app_script( + TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script + NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS +) +install(SCRIPT ${deploy_script}) diff --git a/Fwk/AppFwk/cafTests/cafTestApplication/CMakeLists.txt b/Fwk/AppFwk/cafTests/cafTestApplication/CMakeLists.txt index 872198ae96..d134adef6b 100644 --- a/Fwk/AppFwk/cafTests/cafTestApplication/CMakeLists.txt +++ b/Fwk/AppFwk/cafTests/cafTestApplication/CMakeLists.txt @@ -16,24 +16,13 @@ set(MOC_HEADER_FILES MainWindow.h WidgetLayoutTest.h CustomObjectEditor.h set(QRC_FILES ${QRC_FILES} textedit.qrc) message("QRC_FILES: ${QRC_FILES}") -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets OpenGL Svg - ) - set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL Qt6::Svg) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets OpenGL - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL) - qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES}) - qt5_add_resources(QRC_FILES_CPP ${QRC_FILES}) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets OpenGL Svg +) +set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL Qt6::Svg) +qt_standard_project_setup() option(USE_COMMAND_FRAMEWORK "Use Caf Command Framework" ON) @@ -60,28 +49,11 @@ set(PROJECT_FILES LineEditAndPushButtons.cpp ) -if(CEE_USE_QT6) - qt_add_executable( - ${PROJECT_NAME} - ${PROJECT_FILES} - ${MOC_SOURCE_FILES} - ${QRC_FILES} - $ # Needed for cmake version < 3.12. - # Remove - # when we can use target_link_libraries with OBJECT libraries - ) -else() - add_executable( - ${PROJECT_NAME} - ${PROJECT_FILES} - ${MOC_SOURCE_FILES} - ${QRC_FILES_CPP} - $ # Needed for cmake version < 3.12. - # Remove when we can use - # target_link_libraries with OBJECT - # libraries - ) -endif(CEE_USE_QT6) +qt_add_executable( + ${PROJECT_NAME} ${PROJECT_FILES} ${MOC_SOURCE_FILES} ${QRC_FILES} + $ # Needed for cmake version < 3.12. Remove + # when we can use target_link_libraries with OBJECT libraries +) set(TAP_LINK_LIBRARIES cafUserInterface) @@ -122,19 +94,16 @@ install( RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) -if(CEE_USE_QT6) - qt_generate_deploy_app_script( - TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script - NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS - ) - install(SCRIPT ${deploy_script}) +qt_generate_deploy_app_script( + TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script + NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS +) +install(SCRIPT ${deploy_script}) - if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - set(CPACK_GENERATOR TGZ) - elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows") - set(CPACK_GENERATOR ZIP) - endif() +if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + set(CPACK_GENERATOR TGZ) +elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows") + set(CPACK_GENERATOR ZIP) +endif() - include(CPack) - -endif(CEE_USE_QT6) +include(CPack) diff --git a/Fwk/AppFwk/cafTests/cafTestCvfApplication/CMakeLists.txt b/Fwk/AppFwk/cafTests/cafTestCvfApplication/CMakeLists.txt index 48ca8821f1..e040960bfc 100644 --- a/Fwk/AppFwk/cafTests/cafTestCvfApplication/CMakeLists.txt +++ b/Fwk/AppFwk/cafTests/cafTestCvfApplication/CMakeLists.txt @@ -8,23 +8,12 @@ set(MOC_HEADER_FILES MainWindow.h WidgetLayoutTest.h) # Resource file set(QRC_FILES textedit.qrc) -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets OpenGL Svg - ) - set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL Qt6::Svg) -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets OpenGL - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL) - qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES}) - qt5_add_resources(QRC_FILES_CPP ${QRC_FILES}) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets OpenGL Svg +) +set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL Qt6::Svg) option(USE_COMMAND_FRAMEWORK "Use Caf Command Framework" ON) diff --git a/Fwk/AppFwk/cafUserInterface/CMakeLists.txt b/Fwk/AppFwk/cafUserInterface/CMakeLists.txt index 06453f27ec..ae7afa59d9 100644 --- a/Fwk/AppFwk/cafUserInterface/CMakeLists.txt +++ b/Fwk/AppFwk/cafUserInterface/CMakeLists.txt @@ -55,23 +55,13 @@ set(MOC_HEADER_FILES cafPdmUiValueRangeEditor.h ) -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets Svg - ) - set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Svg) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets Svg - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Svg) - qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES}) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets Svg +) +set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Svg) +qt_standard_project_setup() set(PROJECT_FILES # field editors diff --git a/Fwk/AppFwk/cafUserInterface/cafUserInterface_UnitTests/CMakeLists.txt b/Fwk/AppFwk/cafUserInterface/cafUserInterface_UnitTests/CMakeLists.txt index 352c64f868..52cd936e95 100644 --- a/Fwk/AppFwk/cafUserInterface/cafUserInterface_UnitTests/CMakeLists.txt +++ b/Fwk/AppFwk/cafUserInterface/cafUserInterface_UnitTests/CMakeLists.txt @@ -3,21 +3,12 @@ cmake_minimum_required(VERSION 3.15) project(cafUserInterface_UnitTests) # Qt -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets Svg - ) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets OpenGL - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::OpenGL) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets Svg +) +qt_standard_project_setup() include_directories(${CMAKE_CURRENT_SOURCE_DIR} # required for gtest-all.cpp ) @@ -26,11 +17,7 @@ set(PROJECT_FILES cafUserInterface_UnitTests.cpp cafPdmUiTreeViewModelTest.cpp cafPdmUiTreeSelectionQModelTest.cpp gtest/gtest-all.cpp ) -if(CEE_USE_QT6) - qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES}) -else() - add_executable(${PROJECT_NAME} ${PROJECT_FILES}) -endif(CEE_USE_QT6) +qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES}) source_group("" FILES ${PROJECT_FILES}) @@ -38,16 +25,6 @@ target_link_libraries( ${PROJECT_NAME} PRIVATE cafUserInterface ${QT_LIBRARIES} ${THREAD_LIBRARY} ) -# Copy Qt Dlls -foreach(qtlib ${QT_LIBRARIES}) - add_custom_command( - TARGET ${PROJECT_NAME} - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different $ - $ - ) -endforeach(qtlib) - # Install install( TARGETS ${PROJECT_NAME} @@ -55,10 +32,8 @@ install( RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) -if(CEE_USE_QT6) - qt_generate_deploy_app_script( - TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script - NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS - ) - install(SCRIPT ${deploy_script}) -endif(CEE_USE_QT6) +qt_generate_deploy_app_script( + TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script + NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS +) +install(SCRIPT ${deploy_script}) diff --git a/Fwk/AppFwk/cafViewer/CMakeLists.txt b/Fwk/AppFwk/cafViewer/CMakeLists.txt index a3f0d1f83a..95aeb8093e 100644 --- a/Fwk/AppFwk/cafViewer/CMakeLists.txt +++ b/Fwk/AppFwk/cafViewer/CMakeLists.txt @@ -11,25 +11,13 @@ endif() # These headers need to go through Qt's MOC compiler set(MOC_HEADER_FILES cafViewer.h) -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets OpenGL - ) - set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets OpenGL - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL) - qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES}) - - set(QT5_OPENGL_FILES cafOpenGLWidget.cpp cafOpenGLWidget.h) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets OpenGL +) +set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL) +qt_standard_project_setup() add_library( ${PROJECT_NAME} diff --git a/Fwk/AppFwk/cafVizExtensions/CMakeLists.txt b/Fwk/AppFwk/cafVizExtensions/CMakeLists.txt index bc552e2022..3135539089 100644 --- a/Fwk/AppFwk/cafVizExtensions/CMakeLists.txt +++ b/Fwk/AppFwk/cafVizExtensions/CMakeLists.txt @@ -10,26 +10,16 @@ endif() find_package(OpenGL) # Qt -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets OpenGL - ) - set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL) - qt_standard_project_setup() - set_property( - SOURCE cafTransparentWBRenderConfiguration.cpp PROPERTY SKIP_AUTOMOC ON - ) -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets OpenGL - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL) - qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES}) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets OpenGL +) +set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL) +qt_standard_project_setup() +set_property( + SOURCE cafTransparentWBRenderConfiguration.cpp PROPERTY SKIP_AUTOMOC ON +) add_library( ${PROJECT_NAME} diff --git a/Fwk/CMakeLists.txt b/Fwk/CMakeLists.txt index bb17d9c9ea..e6ccecd21c 100644 --- a/Fwk/CMakeLists.txt +++ b/Fwk/CMakeLists.txt @@ -32,7 +32,6 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNO_DEBUG") endif() -if(CEE_USE_QT6) find_package( Qt6 COMPONENTS @@ -40,14 +39,6 @@ if(CEE_USE_QT6) ) set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::OpenGL Qt6::Widgets) qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui OpenGL Widgets - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::OpenGL Qt5::Widgets) -endif() # Libraries add_subdirectory(AppFwk/cafProjectDataModel/cafPdmCore) From 0330c3cacdff4dcaab2b18e9c2f52583c0a08114 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 10 Oct 2024 09:20:37 +0200 Subject: [PATCH 027/160] #11761 Add special parsing of SLAVES keyword as the default parsing fails --- ApplicationLibCode/ProjectDataModel/RiaOpmParserTools.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/ProjectDataModel/RiaOpmParserTools.cpp b/ApplicationLibCode/ProjectDataModel/RiaOpmParserTools.cpp index e05f7e8ec0..ef6589d363 100644 --- a/ApplicationLibCode/ProjectDataModel/RiaOpmParserTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/RiaOpmParserTools.cpp @@ -32,6 +32,7 @@ #include "opm/input/eclipse/Parser/ParserKeywords/G.hpp" #include "opm/input/eclipse/Parser/ParserKeywords/I.hpp" #include "opm/input/eclipse/Parser/ParserKeywords/P.hpp" +#include "opm/input/eclipse/Parser/ParserKeywords/S.hpp" #include "opm/input/eclipse/Parser/ParserKeywords/T.hpp" #include "opm/input/eclipse/Parser/ParserKeywords/V.hpp" #include "opm/input/eclipse/Parser/ParserKeywords/W.hpp" @@ -107,7 +108,8 @@ std::pair, std::vector> extract Opm::ParserKeywords::INCLUDE(), Opm::ParserKeywords::TUNING(), Opm::ParserKeywords::GRUPTREE(), - Opm::ParserKeywords::WELSPECS() }; + Opm::ParserKeywords::WELSPECS(), + Opm::ParserKeywords::SLAVES() }; for ( const auto& kw : parserKeywords ) { parser.addParserKeyword( kw ); From 4719090b5ff76b2aaaf926448c0fd41dba267329 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Sun, 13 Oct 2024 13:28:28 +0200 Subject: [PATCH 028/160] Define long names for summary vectors in JSON files --- ApplicationExeCode/RiaMain.cpp | 2 + .../Resources/ApplicationLibCode.qrc | 6 + .../keyword-description/keywords_6x.json | 1458 ++++ .../keyword-description/keywords_eclipse.json | 6682 +++++++++++++++++ .../Application/Tools/CMakeLists_files.cmake | 2 + .../Tools/RiaQuantityInfoTools.cpp | 131 + .../Application/Tools/RiaQuantityInfoTools.h | 29 + ApplicationLibCode/CMakeLists.txt | 5 +- ApplicationLibCode/UnitTests/main.cpp | 2 + .../RiuSummaryQuantityNameInfoProvider.cpp | 2143 +----- .../RiuSummaryQuantityNameInfoProvider.h | 6 +- 11 files changed, 8337 insertions(+), 2129 deletions(-) create mode 100644 ApplicationLibCode/Application/Resources/ApplicationLibCode.qrc create mode 100644 ApplicationLibCode/Application/Resources/keyword-description/keywords_6x.json create mode 100644 ApplicationLibCode/Application/Resources/keyword-description/keywords_eclipse.json create mode 100644 ApplicationLibCode/Application/Tools/RiaQuantityInfoTools.cpp create mode 100644 ApplicationLibCode/Application/Tools/RiaQuantityInfoTools.h diff --git a/ApplicationExeCode/RiaMain.cpp b/ApplicationExeCode/RiaMain.cpp index 3bf3906178..66ddd7eba3 100644 --- a/ApplicationExeCode/RiaMain.cpp +++ b/ApplicationExeCode/RiaMain.cpp @@ -19,6 +19,7 @@ #include "RiaArgumentParser.h" #include "RiaMainTools.h" #include "RiaPreferences.h" +#include "RiaQuantityInfoTools.h" #ifdef ENABLE_GRPC #include "RiaGrpcConsoleApplication.h" @@ -92,6 +93,7 @@ int main( int argc, char* argv[] ) // Create feature manager before the application object is created RiaMainTools::initializeSingletons(); + RiaQuantityInfoTools::initializeSummaryKeywords(); // https://www.w3.org/wiki/CSS/Properties/color/keywords caf::UiAppearanceSettings::instance()->setAutoValueEditorColor( "moccasin" ); diff --git a/ApplicationLibCode/Application/Resources/ApplicationLibCode.qrc b/ApplicationLibCode/Application/Resources/ApplicationLibCode.qrc new file mode 100644 index 0000000000..c9a38eec7f --- /dev/null +++ b/ApplicationLibCode/Application/Resources/ApplicationLibCode.qrc @@ -0,0 +1,6 @@ + + + keyword-description/keywords_eclipse.json + keyword-description/keywords_6x.json + + diff --git a/ApplicationLibCode/Application/Resources/keyword-description/keywords_6x.json b/ApplicationLibCode/Application/Resources/keyword-description/keywords_6x.json new file mode 100644 index 0000000000..654a3be371 --- /dev/null +++ b/ApplicationLibCode/Application/Resources/keyword-description/keywords_6x.json @@ -0,0 +1,1458 @@ +{ + "BAPIF": { + "category": "SUMMARY_BLOCK", + "description": "Oil API (Fracture)" + }, + "BAPIM": { + "category": "SUMMARY_BLOCK", + "description": "Oil API (Matrix)" + }, + "BAPIM-1": { + "category": "SUMMARY_BLOCK", + "description": "Oil API (Matrix -1)" + }, + "BAPIM2": { + "category": "SUMMARY_BLOCK", + "description": "Oil API (Matrix 2)" + }, + "BAPIM3": { + "category": "SUMMARY_BLOCK", + "description": "Oil API (Matrix 3)" + }, + "BAPIM4": { + "category": "SUMMARY_BLOCK", + "description": "Oil API (Matrix 4)" + }, + "BCCPF": { + "category": "SUMMARY_BLOCK", + "description": "Pore Volume Compressibility (Fracture)" + }, + "BCCPM": { + "category": "SUMMARY_BLOCK", + "description": "Pore Volume Compressibility (Matrix)" + }, + "BCCPM-1": { + "category": "SUMMARY_BLOCK", + "description": "Pore Volume Compressibility (Matrix -1)" + }, + "BCCPM2": { + "category": "SUMMARY_BLOCK", + "description": "Pore Volume Compressibility (Matrix 2)" + }, + "BCCPM3": { + "category": "SUMMARY_BLOCK", + "description": "Pore Volume Compressibility (Matrix 3)" + }, + "BCCPM4": { + "category": "SUMMARY_BLOCK", + "description": "Pore Volume Compressibility (Matrix 4)" + }, + "BDENGASF": { + "category": "SUMMARY_BLOCK", + "description": "Gas Density (Fracture)" + }, + "BDENGASM": { + "category": "SUMMARY_BLOCK", + "description": "Gas Density (Matrix)" + }, + "BDENGASM-1": { + "category": "SUMMARY_BLOCK", + "description": "Gas Density (Matrix -1)" + }, + "BDENGASM2": { + "category": "SUMMARY_BLOCK", + "description": "Gas Density (Matrix 2)" + }, + "BDENGASM3": { + "category": "SUMMARY_BLOCK", + "description": "Gas Density (Matrix 3)" + }, + "BDENGASM4": { + "category": "SUMMARY_BLOCK", + "description": "Gas Density (Matrix 4)" + }, + "BDENOILF": { + "category": "SUMMARY_BLOCK", + "description": "Oil Density (Fracture)" + }, + "BDENOILM": { + "category": "SUMMARY_BLOCK", + "description": "Oil Density (Matrix)" + }, + "BDENOILM-1": { + "category": "SUMMARY_BLOCK", + "description": "Oil Density (Matrix -1)" + }, + "BDENOILM2": { + "category": "SUMMARY_BLOCK", + "description": "Oil Density (Matrix 2)" + }, + "BDENOILM3": { + "category": "SUMMARY_BLOCK", + "description": "Oil Density (Matrix 3)" + }, + "BDENOILM4": { + "category": "SUMMARY_BLOCK", + "description": "Oil Density (Matrix 4)" + }, + "BDENWATF": { + "category": "SUMMARY_BLOCK", + "description": "Water Density (Fracture)" + }, + "BDENWATM": { + "category": "SUMMARY_BLOCK", + "description": "Water Density (Matrix)" + }, + "BDENWATM-1": { + "category": "SUMMARY_BLOCK", + "description": "Water Density (Matrix -1)" + }, + "BDENWATM2": { + "category": "SUMMARY_BLOCK", + "description": "Water Density (Matrix 2)" + }, + "BDENWATM3": { + "category": "SUMMARY_BLOCK", + "description": "Water Density (Matrix 3)" + }, + "BDENWATM4": { + "category": "SUMMARY_BLOCK", + "description": "Water Density (Matrix 4)" + }, + "BDPF": { + "category": "SUMMARY_BLOCK", + "description": "Change in Pressure Since Initial State (Fracture)" + }, + "BDPM": { + "category": "SUMMARY_BLOCK", + "description": "Change in Pressure Since Initial State (Matrix)" + }, + "BDPM-1": { + "category": "SUMMARY_BLOCK", + "description": "Change in Pressure Since Initial State (Matrix -1)" + }, + "BDPM2": { + "category": "SUMMARY_BLOCK", + "description": "Change in Pressure Since Initial State (Matrix 2)" + }, + "BDPM3": { + "category": "SUMMARY_BLOCK", + "description": "Change in Pressure Since Initial State (Matrix 3)" + }, + "BDPM4": { + "category": "SUMMARY_BLOCK", + "description": "Change in Pressure Since Initial State (Matrix 4)" + }, + "BDYNBRSTF": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Breaking Stress (Fracture)" + }, + "BDYNBRSTM": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Breaking Stress (Matrix)" + }, + "BDYNBRSTM-1": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Breaking Stress (Matrix -1)" + }, + "BDYNBRSTM2": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Breaking Stress (Matrix 2)" + }, + "BDYNBRSTM3": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Breaking Stress (Matrix 3)" + }, + "BDYNBRSTM4": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Breaking Stress (Matrix 4)" + }, + "BDYNKXF": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Permeability in X-Direction (Fracture)" + }, + "BDYNKXM": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Permeability in X-Direction (Matrix)" + }, + "BDYNKXM-1": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Permeability in X-Direction (Matrix -1)" + }, + "BDYNKXM2": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Permeability in X-Direction (Matrix 2)" + }, + "BDYNKXM3": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Permeability in X-Direction (Matrix 3)" + }, + "BDYNKXM4": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Permeability in X-Direction (Matrix 4)" + }, + "BDYNKYF": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Permeability in Y-Direction (Fracture)" + }, + "BDYNKYM": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Permeability in Y-Direction (Matrix)" + }, + "BDYNKYM-1": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Permeability in Y-Direction (Matrix -1)" + }, + "BDYNKYM2": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Permeability in Y-Direction (Matrix 2)" + }, + "BDYNKYM3": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Permeability in Y-Direction (Matrix 3)" + }, + "BDYNKYM4": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Permeability in Y-Direction (Matrix 4)" + }, + "BDYNKZF": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Permeability in Z-Direction (Fracture)" + }, + "BDYNKZM": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Permeability in Z-Direction (Matrix)" + }, + "BDYNKZM-1": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Permeability in Z-Direction (Matrix -1)" + }, + "BDYNKZM2": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Permeability in Z-Direction (Matrix 2)" + }, + "BDYNKZM3": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Permeability in Z-Direction (Matrix 3)" + }, + "BDYNKZM4": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Permeability in Z-Direction (Matrix 4)" + }, + "BDYNPVF": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Pore Volume (Fracture)" + }, + "BDYNPVM": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Pore Volume (Matrix)" + }, + "BDYNPVM-1": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Pore Volume (Matrix -1)" + }, + "BDYNPVM2": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Pore Volume (Matrix 2)" + }, + "BDYNPVM3": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Pore Volume (Matrix 3)" + }, + "BDYNPVM4": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Pore Volume (Matrix 4)" + }, + "BDYNSIGF": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Sigma Permeability (Fracture)" + }, + "BDYNSIGM": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Sigma Permeability (Matrix)" + }, + "BDYNSIGM-1": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Sigma Permeability (Matrix -1)" + }, + "BDYNSIGM2": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Sigma Permeability (Matrix 2)" + }, + "BDYNSIGM3": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Sigma Permeability (Matrix 3)" + }, + "BDYNSIGM4": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Sigma Permeability (Matrix 4)" + }, + "BKRGASF": { + "category": "SUMMARY_BLOCK", + "description": "Gas Relative Permeability (Fracture)" + }, + "BKRGASM": { + "category": "SUMMARY_BLOCK", + "description": "Gas Relative Permeability (Matrix)" + }, + "BKRGASM-1": { + "category": "SUMMARY_BLOCK", + "description": "Gas Relative Permeability (Matrix -1)" + }, + "BKRGASM2": { + "category": "SUMMARY_BLOCK", + "description": "Gas Relative Permeability (Matrix 2)" + }, + "BKRGASM3": { + "category": "SUMMARY_BLOCK", + "description": "Gas Relative Permeability (Matrix 3)" + }, + "BKRGASM4": { + "category": "SUMMARY_BLOCK", + "description": "Gas Relative Permeability (Matrix 4)" + }, + "BKROILF": { + "category": "SUMMARY_BLOCK", + "description": "Oil Relative Permeability (Fracture)" + }, + "BKROILM": { + "category": "SUMMARY_BLOCK", + "description": "Oil Relative Permeability (Matrix)" + }, + "BKROILM-1": { + "category": "SUMMARY_BLOCK", + "description": "Oil Relative Permeability (Matrix -1)" + }, + "BKROILM2": { + "category": "SUMMARY_BLOCK", + "description": "Oil Relative Permeability (Matrix 2)" + }, + "BKROILM3": { + "category": "SUMMARY_BLOCK", + "description": "Oil Relative Permeability (Matrix 3)" + }, + "BKROILM4": { + "category": "SUMMARY_BLOCK", + "description": "Oil Relative Permeability (Matrix 4)" + }, + "BKRWATF": { + "category": "SUMMARY_BLOCK", + "description": "Water Relative Permeability (Fracture)" + }, + "BKRWATM": { + "category": "SUMMARY_BLOCK", + "description": "Water Relative Permeability (Matrix)" + }, + "BKRWATM-1": { + "category": "SUMMARY_BLOCK", + "description": "Water Relative Permeability (Matrix -1)" + }, + "BKRWATM2": { + "category": "SUMMARY_BLOCK", + "description": "Water Relative Permeability (Matrix 2)" + }, + "BKRWATM3": { + "category": "SUMMARY_BLOCK", + "description": "Water Relative Permeability (Matrix 3)" + }, + "BKRWATM4": { + "category": "SUMMARY_BLOCK", + "description": "Water Relative Permeability (Matrix 4)" + }, + "BPCOGF": { + "category": "SUMMARY_BLOCK", + "description": "Oil-Gas Capillary Pressure (Fracture)" + }, + "BPCOGM": { + "category": "SUMMARY_BLOCK", + "description": "Oil-Gas Capillary Pressure (Matrix)" + }, + "BPCOGM-1": { + "category": "SUMMARY_BLOCK", + "description": "Oil-Gas Capillary Pressure (Matrix -1)" + }, + "BPCOGM2": { + "category": "SUMMARY_BLOCK", + "description": "Oil-Gas Capillary Pressure (Matrix 2)" + }, + "BPCOGM3": { + "category": "SUMMARY_BLOCK", + "description": "Oil-Gas Capillary Pressure (Matrix 3)" + }, + "BPCOGM4": { + "category": "SUMMARY_BLOCK", + "description": "Oil-Gas Capillary Pressure (Matrix 4)" + }, + "BPCOILF": { + "category": "SUMMARY_BLOCK", + "description": "Oil Capillary Pressure (Fracture)" + }, + "BPCOILM": { + "category": "SUMMARY_BLOCK", + "description": "Oil Capillary Pressure (Matrix)" + }, + "BPCOILM-1": { + "category": "SUMMARY_BLOCK", + "description": "Oil Capillary Pressure (Matrix -1)" + }, + "BPCOILM2": { + "category": "SUMMARY_BLOCK", + "description": "Oil Capillary Pressure (Matrix 2)" + }, + "BPCOILM3": { + "category": "SUMMARY_BLOCK", + "description": "Oil Capillary Pressure (Matrix 3)" + }, + "BPCOILM4": { + "category": "SUMMARY_BLOCK", + "description": "Oil Capillary Pressure (Matrix 4)" + }, + "BPCOWF": { + "category": "SUMMARY_BLOCK", + "description": "Oil-Water Capillary Pressure (Fracture)" + }, + "BPCOWM": { + "category": "SUMMARY_BLOCK", + "description": "Oil-Water Capillary Pressure (Matrix)" + }, + "BPCOWM-1": { + "category": "SUMMARY_BLOCK", + "description": "Oil-Water Capillary Pressure (Matrix -1)" + }, + "BPCOWM2": { + "category": "SUMMARY_BLOCK", + "description": "Oil-Water Capillary Pressure (Matrix 2)" + }, + "BPCOWM3": { + "category": "SUMMARY_BLOCK", + "description": "Oil-Water Capillary Pressure (Matrix 3)" + }, + "BPCOWM4": { + "category": "SUMMARY_BLOCK", + "description": "Oil-Water Capillary Pressure (Matrix 4)" + }, + "BPCWATF": { + "category": "SUMMARY_BLOCK", + "description": "Water Capillary Pressure (Fracture)" + }, + "BPCWATM": { + "category": "SUMMARY_BLOCK", + "description": "Water Capillary Pressure (Matrix)" + }, + "BPCWATM-1": { + "category": "SUMMARY_BLOCK", + "description": "Water Capillary Pressure (Matrix -1)" + }, + "BPCWATM2": { + "category": "SUMMARY_BLOCK", + "description": "Water Capillary Pressure (Matrix 2)" + }, + "BPCWATM3": { + "category": "SUMMARY_BLOCK", + "description": "Water Capillary Pressure (Matrix 3)" + }, + "BPCWATM4": { + "category": "SUMMARY_BLOCK", + "description": "Water Capillary Pressure (Matrix 4)" + }, + "BPMODHYSF": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Pmod Hysteresis Curve Type (1/2/3=B/S/P) (Fracture)" + }, + "BPMODHYSM": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Pmod Hysteresis Curve Type (1/2/3=B/S/P) (Matrix)" + }, + "BPMODHYSM-1": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Pmod Hysteresis Curve Type (1/2/3=B/S/P) (Matrix -1)" + }, + "BPMODHYSM2": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Pmod Hysteresis Curve Type (1/2/3=B/S/P) (Matrix 2)" + }, + "BPMODHYSM3": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Pmod Hysteresis Curve Type (1/2/3=B/S/P) (Matrix 3)" + }, + "BPMODHYSM4": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic Pmod Hysteresis Curve Type (1/2/3=B/S/P) (Matrix 4)" + }, + "BPRF": { + "category": "SUMMARY_BLOCK", + "description": "Pressure (Fracture)" + }, + "BPRM": { + "category": "SUMMARY_BLOCK", + "description": "Pressure (Matrix)" + }, + "BPRM-1": { + "category": "SUMMARY_BLOCK", + "description": "Pressure (Matrix -1)" + }, + "BPRM2": { + "category": "SUMMARY_BLOCK", + "description": "Pressure (Matrix 2)" + }, + "BPRM3": { + "category": "SUMMARY_BLOCK", + "description": "Pressure (Matrix 3)" + }, + "BPRM4": { + "category": "SUMMARY_BLOCK", + "description": "Pressure (Matrix 4)" + }, + "BRSF": { + "category": "SUMMARY_BLOCK", + "description": "Gas Rs (Fracture)" + }, + "BRSM": { + "category": "SUMMARY_BLOCK", + "description": "Gas Rs (Matrix)" + }, + "BRSM-1": { + "category": "SUMMARY_BLOCK", + "description": "Gas Rs (Matrix -1)" + }, + "BRSM2": { + "category": "SUMMARY_BLOCK", + "description": "Gas Rs (Matrix 2)" + }, + "BRSM3": { + "category": "SUMMARY_BLOCK", + "description": "Gas Rs (Matrix 3)" + }, + "BRSM4": { + "category": "SUMMARY_BLOCK", + "description": "Gas Rs (Matrix 4)" + }, + "BRVF": { + "category": "SUMMARY_BLOCK", + "description": "Gas Rv (Fracture)" + }, + "BRVM": { + "category": "SUMMARY_BLOCK", + "description": "Gas Rv (Matrix)" + }, + "BRVM-1": { + "category": "SUMMARY_BLOCK", + "description": "Gas Rv (Matrix -1)" + }, + "BRVM2": { + "category": "SUMMARY_BLOCK", + "description": "Gas Rv (Matrix 2)" + }, + "BRVM3": { + "category": "SUMMARY_BLOCK", + "description": "Gas Rv (Matrix 3)" + }, + "BRVM4": { + "category": "SUMMARY_BLOCK", + "description": "Gas Rv (Matrix 4)" + }, + "BSGASF": { + "category": "SUMMARY_BLOCK", + "description": "Gas Saturation (Fracture)" + }, + "BSGASM": { + "category": "SUMMARY_BLOCK", + "description": "Gas Saturation (Matrix)" + }, + "BSGASM-1": { + "category": "SUMMARY_BLOCK", + "description": "Gas Saturation (Matrix -1)" + }, + "BSGASM2": { + "category": "SUMMARY_BLOCK", + "description": "Gas Saturation (Matrix 2)" + }, + "BSGASM3": { + "category": "SUMMARY_BLOCK", + "description": "Gas Saturation (Matrix 3)" + }, + "BSGASM4": { + "category": "SUMMARY_BLOCK", + "description": "Gas Saturation (Matrix 4)" + }, + "BSOILF": { + "category": "SUMMARY_BLOCK", + "description": "Oil Saturation (Fracture)" + }, + "BSOILM": { + "category": "SUMMARY_BLOCK", + "description": "Oil Saturation (Matrix)" + }, + "BSOILM-1": { + "category": "SUMMARY_BLOCK", + "description": "Oil Saturation (Matrix -1)" + }, + "BSOILM2": { + "category": "SUMMARY_BLOCK", + "description": "Oil Saturation (Matrix 2)" + }, + "BSOILM3": { + "category": "SUMMARY_BLOCK", + "description": "Oil Saturation (Matrix 3)" + }, + "BSOILM4": { + "category": "SUMMARY_BLOCK", + "description": "Oil Saturation (Matrix 4)" + }, + "BSRVSTATF": { + "category": "SUMMARY_BLOCK", + "description": "Srv Status (1/2/3=Stim/Sigprop/Propprop) (Fracture)" + }, + "BSRVSTATM": { + "category": "SUMMARY_BLOCK", + "description": "Srv Status (1/2/3=Stim/Sigprop/Propprop) (Matrix)" + }, + "BSRVSTATM-1": { + "category": "SUMMARY_BLOCK", + "description": "Srv Status (1/2/3=Stim/Sigprop/Propprop) (Matrix -1)" + }, + "BSRVSTATM2": { + "category": "SUMMARY_BLOCK", + "description": "Srv Status (1/2/3=Stim/Sigprop/Propprop) (Matrix 2)" + }, + "BSRVSTATM3": { + "category": "SUMMARY_BLOCK", + "description": "Srv Status (1/2/3=Stim/Sigprop/Propprop) (Matrix 3)" + }, + "BSRVSTATM4": { + "category": "SUMMARY_BLOCK", + "description": "Srv Status (1/2/3=Stim/Sigprop/Propprop) (Matrix 4)" + }, + "BSTRAINF": { + "category": "SUMMARY_BLOCK", + "description": "Volumetric Strain (Fracture)" + }, + "BSTRAINM": { + "category": "SUMMARY_BLOCK", + "description": "Volumetric Strain (Matrix)" + }, + "BSTRAINM-1": { + "category": "SUMMARY_BLOCK", + "description": "Volumetric Strain (Matrix -1)" + }, + "BSTRAINM2": { + "category": "SUMMARY_BLOCK", + "description": "Volumetric Strain (Matrix 2)" + }, + "BSTRAINM3": { + "category": "SUMMARY_BLOCK", + "description": "Volumetric Strain (Matrix 3)" + }, + "BSTRAINM4": { + "category": "SUMMARY_BLOCK", + "description": "Volumetric Strain (Matrix 4)" + }, + "BSTRESSAF": { + "category": "SUMMARY_BLOCK", + "description": "Mean Normal Stress Idealised Analytic Solution (Fracture)" + }, + "BSTRESSAM": { + "category": "SUMMARY_BLOCK", + "description": "Mean Normal Stress Idealised Analytic Solution (Matrix)" + }, + "BSTRESSAM-1": { + "category": "SUMMARY_BLOCK", + "description": "Mean Normal Stress Idealised Analytic Solution (Matrix -1)" + }, + "BSTRESSAM2": { + "category": "SUMMARY_BLOCK", + "description": "Mean Normal Stress Idealised Analytic Solution (Matrix 2)" + }, + "BSTRESSAM3": { + "category": "SUMMARY_BLOCK", + "description": "Mean Normal Stress Idealised Analytic Solution (Matrix 3)" + }, + "BSTRESSAM4": { + "category": "SUMMARY_BLOCK", + "description": "Mean Normal Stress Idealised Analytic Solution (Matrix 4)" + }, + "BSTRESSF": { + "category": "SUMMARY_BLOCK", + "description": "Mean Normal Stress (Fracture)" + }, + "BSTRESSM": { + "category": "SUMMARY_BLOCK", + "description": "Mean Normal Stress (Matrix)" + }, + "BSTRESSM-1": { + "category": "SUMMARY_BLOCK", + "description": "Mean Normal Stress (Matrix -1)" + }, + "BSTRESSM2": { + "category": "SUMMARY_BLOCK", + "description": "Mean Normal Stress (Matrix 2)" + }, + "BSTRESSM3": { + "category": "SUMMARY_BLOCK", + "description": "Mean Normal Stress (Matrix 3)" + }, + "BSTRESSM4": { + "category": "SUMMARY_BLOCK", + "description": "Mean Normal Stress (Matrix 4)" + }, + "BSTRESSNF": { + "category": "SUMMARY_BLOCK", + "description": "Net Stress (Fracture)" + }, + "BSTRESSNM": { + "category": "SUMMARY_BLOCK", + "description": "Net Stress (Matrix)" + }, + "BSTRESSNM-1": { + "category": "SUMMARY_BLOCK", + "description": "Net Stress (Matrix -1)" + }, + "BSTRESSNM2": { + "category": "SUMMARY_BLOCK", + "description": "Net Stress (Matrix 2)" + }, + "BSTRESSNM3": { + "category": "SUMMARY_BLOCK", + "description": "Net Stress (Matrix 3)" + }, + "BSTRESSNM4": { + "category": "SUMMARY_BLOCK", + "description": "Net Stress (Matrix 4)" + }, + "BSWATF": { + "category": "SUMMARY_BLOCK", + "description": "Water Saturation (Fracture)" + }, + "BSWATM": { + "category": "SUMMARY_BLOCK", + "description": "Water Saturation (Matrix)" + }, + "BSWATM-1": { + "category": "SUMMARY_BLOCK", + "description": "Water Saturation (Matrix -1)" + }, + "BSWATM2": { + "category": "SUMMARY_BLOCK", + "description": "Water Saturation (Matrix 2)" + }, + "BSWATM3": { + "category": "SUMMARY_BLOCK", + "description": "Water Saturation (Matrix 3)" + }, + "BSWATM4": { + "category": "SUMMARY_BLOCK", + "description": "Water Saturation (Matrix 4)" + }, + "BVISCGASF": { + "category": "SUMMARY_BLOCK", + "description": "Gas Viscosity (Fracture)" + }, + "BVISCGASM": { + "category": "SUMMARY_BLOCK", + "description": "Gas Viscosity (Matrix)" + }, + "BVISCGASM-1": { + "category": "SUMMARY_BLOCK", + "description": "Gas Viscosity (Matrix -1)" + }, + "BVISCGASM2": { + "category": "SUMMARY_BLOCK", + "description": "Gas Viscosity (Matrix 2)" + }, + "BVISCGASM3": { + "category": "SUMMARY_BLOCK", + "description": "Gas Viscosity (Matrix 3)" + }, + "BVISCGASM4": { + "category": "SUMMARY_BLOCK", + "description": "Gas Viscosity (Matrix 4)" + }, + "BVISCOILF": { + "category": "SUMMARY_BLOCK", + "description": "Oil Viscosity (Fracture)" + }, + "BVISCOILM": { + "category": "SUMMARY_BLOCK", + "description": "Oil Viscosity (Matrix)" + }, + "BVISCOILM-1": { + "category": "SUMMARY_BLOCK", + "description": "Oil Viscosity (Matrix -1)" + }, + "BVISCOILM2": { + "category": "SUMMARY_BLOCK", + "description": "Oil Viscosity (Matrix 2)" + }, + "BVISCOILM3": { + "category": "SUMMARY_BLOCK", + "description": "Oil Viscosity (Matrix 3)" + }, + "BVISCOILM4": { + "category": "SUMMARY_BLOCK", + "description": "Oil Viscosity (Matrix 4)" + }, + "BVISCWATF": { + "category": "SUMMARY_BLOCK", + "description": "Water Viscosity (Fracture)" + }, + "BVISCWATM": { + "category": "SUMMARY_BLOCK", + "description": "Water Viscosity (Matrix)" + }, + "BVISCWATM-1": { + "category": "SUMMARY_BLOCK", + "description": "Water Viscosity (Matrix -1)" + }, + "BVISCWATM2": { + "category": "SUMMARY_BLOCK", + "description": "Water Viscosity (Matrix 2)" + }, + "BVISCWATM3": { + "category": "SUMMARY_BLOCK", + "description": "Water Viscosity (Matrix 3)" + }, + "BVISCWATM4": { + "category": "SUMMARY_BLOCK", + "description": "Water Viscosity (Matrix 4)" + }, + "BX0F": { + "category": "SUMMARY_BLOCK", + "description": "Liquid Phase Mole Fraction (Component 0) (Fracture)" + }, + "BX0M": { + "category": "SUMMARY_BLOCK", + "description": "Liquid Phase Mole Fraction (Component 0) (Matrix)" + }, + "BX0M-1": { + "category": "SUMMARY_BLOCK", + "description": "Liquid Phase Mole Fraction (Component 0) (Matrix -1)" + }, + "BX0M2": { + "category": "SUMMARY_BLOCK", + "description": "Liquid Phase Mole Fraction (Component 0) (Matrix 2)" + }, + "BX0M3": { + "category": "SUMMARY_BLOCK", + "description": "Liquid Phase Mole Fraction (Component 0) (Matrix 3)" + }, + "BX0M4": { + "category": "SUMMARY_BLOCK", + "description": "Liquid Phase Mole Fraction (Component 0) (Matrix 4)" + }, + "BX1F": { + "category": "SUMMARY_BLOCK", + "description": "Liquid Phase Mole Fraction (Component 1) (Fracture)" + }, + "BX1M": { + "category": "SUMMARY_BLOCK", + "description": "Liquid Phase Mole Fraction (Component 1) (Matrix)" + }, + "BX1M-1": { + "category": "SUMMARY_BLOCK", + "description": "Liquid Phase Mole Fraction (Component 1) (Matrix -1)" + }, + "BX1M2": { + "category": "SUMMARY_BLOCK", + "description": "Liquid Phase Mole Fraction (Component 1) (Matrix 2)" + }, + "BX1M3": { + "category": "SUMMARY_BLOCK", + "description": "Liquid Phase Mole Fraction (Component 1) (Matrix 3)" + }, + "BX1M4": { + "category": "SUMMARY_BLOCK", + "description": "Liquid Phase Mole Fraction (Component 1) (Matrix 4)" + }, + "BX2F": { + "category": "SUMMARY_BLOCK", + "description": "Liquid Phase Mole Fraction (Component 2) (Fracture)" + }, + "BX2M": { + "category": "SUMMARY_BLOCK", + "description": "Liquid Phase Mole Fraction (Component 2) (Matrix)" + }, + "BX2M-1": { + "category": "SUMMARY_BLOCK", + "description": "Liquid Phase Mole Fraction (Component 2) (Matrix -1)" + }, + "BX2M2": { + "category": "SUMMARY_BLOCK", + "description": "Liquid Phase Mole Fraction (Component 2) (Matrix 2)" + }, + "BX2M3": { + "category": "SUMMARY_BLOCK", + "description": "Liquid Phase Mole Fraction (Component 2) (Matrix 3)" + }, + "BX2M4": { + "category": "SUMMARY_BLOCK", + "description": "Liquid Phase Mole Fraction (Component 2) (Matrix 4)" + }, + "BY0F": { + "category": "SUMMARY_BLOCK", + "description": "Vapor Phase Mole Fraction (Component 0) (Fracture)" + }, + "BY0M": { + "category": "SUMMARY_BLOCK", + "description": "Vapor Phase Mole Fraction (Component 0) (Matrix)" + }, + "BY0M-1": { + "category": "SUMMARY_BLOCK", + "description": "Vapor Phase Mole Fraction (Component 0) (Matrix -1)" + }, + "BY0M2": { + "category": "SUMMARY_BLOCK", + "description": "Vapor Phase Mole Fraction (Component 0) (Matrix 2)" + }, + "BY0M3": { + "category": "SUMMARY_BLOCK", + "description": "Vapor Phase Mole Fraction (Component 0) (Matrix 3)" + }, + "BY0M4": { + "category": "SUMMARY_BLOCK", + "description": "Vapor Phase Mole Fraction (Component 0) (Matrix 4)" + }, + "BY1F": { + "category": "SUMMARY_BLOCK", + "description": "Vapor Phase Mole Fraction (Component 1) (Fracture)" + }, + "BY1M": { + "category": "SUMMARY_BLOCK", + "description": "Vapor Phase Mole Fraction (Component 1) (Matrix)" + }, + "BY1M-1": { + "category": "SUMMARY_BLOCK", + "description": "Vapor Phase Mole Fraction (Component 1) (Matrix -1)" + }, + "BY1M2": { + "category": "SUMMARY_BLOCK", + "description": "Vapor Phase Mole Fraction (Component 1) (Matrix 2)" + }, + "BY1M3": { + "category": "SUMMARY_BLOCK", + "description": "Vapor Phase Mole Fraction (Component 1) (Matrix 3)" + }, + "BY1M4": { + "category": "SUMMARY_BLOCK", + "description": "Vapor Phase Mole Fraction (Component 1) (Matrix 4)" + }, + "BY2F": { + "category": "SUMMARY_BLOCK", + "description": "Vapor Phase Mole Fraction (Component 2) (Fracture)" + }, + "BY2M": { + "category": "SUMMARY_BLOCK", + "description": "Vapor Phase Mole Fraction (Component 2) (Matrix)" + }, + "BY2M-1": { + "category": "SUMMARY_BLOCK", + "description": "Vapor Phase Mole Fraction (Component 2) (Matrix -1)" + }, + "BY2M2": { + "category": "SUMMARY_BLOCK", + "description": "Vapor Phase Mole Fraction (Component 2) (Matrix 2)" + }, + "BY2M3": { + "category": "SUMMARY_BLOCK", + "description": "Vapor Phase Mole Fraction (Component 2) (Matrix 3)" + }, + "BY2M4": { + "category": "SUMMARY_BLOCK", + "description": "Vapor Phase Mole Fraction (Component 2) (Matrix 4)" + }, + "BZ0F": { + "category": "SUMMARY_BLOCK", + "description": "Total Mole Fraction (Component 0) (Fracture)" + }, + "BZ0M": { + "category": "SUMMARY_BLOCK", + "description": "Total Mole Fraction (Component 0) (Matrix)" + }, + "BZ0M-1": { + "category": "SUMMARY_BLOCK", + "description": "Total Mole Fraction (Component 0) (Matrix -1)" + }, + "BZ0M2": { + "category": "SUMMARY_BLOCK", + "description": "Total Mole Fraction (Component 0) (Matrix 2)" + }, + "BZ0M3": { + "category": "SUMMARY_BLOCK", + "description": "Total Mole Fraction (Component 0) (Matrix 3)" + }, + "BZ0M4": { + "category": "SUMMARY_BLOCK", + "description": "Total Mole Fraction (Component 0) (Matrix 4)" + }, + "BZ1F": { + "category": "SUMMARY_BLOCK", + "description": "Total Mole Fraction (Component 1) (Fracture)" + }, + "BZ1M": { + "category": "SUMMARY_BLOCK", + "description": "Total Mole Fraction (Component 1) (Matrix)" + }, + "BZ1M-1": { + "category": "SUMMARY_BLOCK", + "description": "Total Mole Fraction (Component 1) (Matrix -1)" + }, + "BZ1M2": { + "category": "SUMMARY_BLOCK", + "description": "Total Mole Fraction (Component 1) (Matrix 2)" + }, + "BZ1M3": { + "category": "SUMMARY_BLOCK", + "description": "Total Mole Fraction (Component 1) (Matrix 3)" + }, + "BZ1M4": { + "category": "SUMMARY_BLOCK", + "description": "Total Mole Fraction (Component 1) (Matrix 4)" + }, + "BZ2F": { + "category": "SUMMARY_BLOCK", + "description": "Total Mole Fraction (Component 2) (Fracture)" + }, + "BZ2M": { + "category": "SUMMARY_BLOCK", + "description": "Total Mole Fraction (Component 2) (Matrix)" + }, + "BZ2M-1": { + "category": "SUMMARY_BLOCK", + "description": "Total Mole Fraction (Component 2) (Matrix -1)" + }, + "BZ2M2": { + "category": "SUMMARY_BLOCK", + "description": "Total Mole Fraction (Component 2) (Matrix 2)" + }, + "BZ2M3": { + "category": "SUMMARY_BLOCK", + "description": "Total Mole Fraction (Component 2) (Matrix 3)" + }, + "BZ2M4": { + "category": "SUMMARY_BLOCK", + "description": "Total Mole Fraction (Component 2) (Matrix 4)" + }, + "CFGAS": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Gas Flow Rate" + }, + "CPDIAM": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Perforation Diameter" + }, + "FDG": { + "category": "SUMMARY_FIELD", + "description": "Gas in Place Difference from Initial Conditions" + }, + "FDO": { + "category": "SUMMARY_FIELD", + "description": "Oil in Place Difference from Initial Conditions" + }, + "FDW": { + "category": "SUMMARY_FIELD", + "description": "Water in Place Difference from Initial Conditions" + }, + "FGIP": { + "category": "SUMMARY_FIELD", + "description": "Gas in Place" + }, + "FLIR": { + "category": "SUMMARY_FIELD", + "description": "Liquid Injection Rate" + }, + "FLIRH": { + "category": "SUMMARY_FIELD", + "description": "Liquid Injection Rate History" + }, + "FLIT": { + "category": "SUMMARY_FIELD", + "description": "Liquid Injection Total" + }, + "FMBG": { + "category": "SUMMARY_FIELD", + "description": "Gas Phase Material Balance Error" + }, + "FMBO": { + "category": "SUMMARY_FIELD", + "description": "Oil Phase Material Balance Error" + }, + "FMBW": { + "category": "SUMMARY_FIELD", + "description": "Water Phase Material Balance Error" + }, + "FMSTR": { + "category": "SUMMARY_FIELD", + "description": "Average Mean Stress" + }, + "FMWIR": { + "category": "SUMMARY_FIELD", + "description": "Number of Injecting Wells" + }, + "FMWSH": { + "category": "SUMMARY_FIELD", + "description": "Number of Stopped Wells" + }, + "FMWST": { + "category": "SUMMARY_FIELD", + "description": "Number of Shut Wells" + }, + "FOIP": { + "category": "SUMMARY_FIELD", + "description": "Oil in Place" + }, + "FWIP": { + "category": "SUMMARY_FIELD", + "description": "Water in Place" + }, + "GLIR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Liquid Injection Rate" + }, + "GLIRH": { + "category": "SUMMARY_WELL_GROUP", + "description": "Liquid Injection Rate History" + }, + "GLIT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Liquid Injection Total" + }, + "INFLOW0": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Inflow Rate (Component 0)" + }, + "INFLOW1": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Inflow Rate (Component 1)" + }, + "INFLOW2": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Inflow Rate (Component 2)" + }, + "MEMORYTS": { + "category": "SUMMARY_MISC", + "description": "Maximum Current Memory Usage Across Processors" + }, + "MLINEART": { + "category": "SUMMARY_MISC", + "description": "Number of Tracer Linear Iterations at the Current Time-Step" + }, + "MSDEPTH": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Depth of Well Completion" + }, + "MSUMCHOP": { + "category": "SUMMARY_MISC", + "description": "Total Number of Time-Step Chops" + }, + "MSUMLINT": { + "category": "SUMMARY_MISC", + "description": "Total Number of Tracer Linear Iterations" + }, + "NGIR": { + "category": "SUMMARY_NETWORK", + "description": "Gas Injection Rate" + }, + "NGIRH": { + "category": "SUMMARY_NETWORK", + "description": "Gas Injection Rate History" + }, + "NGIT": { + "category": "SUMMARY_NETWORK", + "description": "Gas Injection Total" + }, + "NGOR": { + "category": "SUMMARY_NETWORK", + "description": "Gas Oil Ratio" + }, + "NGORH": { + "category": "SUMMARY_NETWORK", + "description": "Gas Oil Ratio History" + }, + "NGPR": { + "category": "SUMMARY_NETWORK", + "description": "Gas Production Rate" + }, + "NGPRH": { + "category": "SUMMARY_NETWORK", + "description": "Gas Production History" + }, + "NGPT": { + "category": "SUMMARY_NETWORK", + "description": "Gas Production Total" + }, + "NLINEARS": { + "category": "SUMMARY_MISC", + "description": "Average Linear Iterations per Newton Iteration" + }, + "NLIR": { + "category": "SUMMARY_NETWORK", + "description": "Liquid Injection Rate" + }, + "NLIRH": { + "category": "SUMMARY_NETWORK", + "description": "Liquid Injection Rate History" + }, + "NLIT": { + "category": "SUMMARY_NETWORK", + "description": "Liquid Injection Total" + }, + "NLPR": { + "category": "SUMMARY_NETWORK", + "description": "Liquid Production Rate" + }, + "NLPRH": { + "category": "SUMMARY_NETWORK", + "description": "Liquid Production Rate History" + }, + "NLPT": { + "category": "SUMMARY_NETWORK", + "description": "Liquid Production Total" + }, + "NOIR": { + "category": "SUMMARY_NETWORK", + "description": "Oil Injection Rate" + }, + "NOIRH": { + "category": "SUMMARY_NETWORK", + "description": "Oil Injection Rate History" + }, + "NOIT": { + "category": "SUMMARY_NETWORK", + "description": "Oil Injection Total" + }, + "NOPR": { + "category": "SUMMARY_NETWORK", + "description": "Oil Production Rate" + }, + "NOPRH": { + "category": "SUMMARY_NETWORK", + "description": "Oil Production Rate History" + }, + "NOPT": { + "category": "SUMMARY_NETWORK", + "description": "Oil Production Total" + }, + "NWCT": { + "category": "SUMMARY_NETWORK", + "description": "Water Cut" + }, + "NWCTH": { + "category": "SUMMARY_NETWORK", + "description": "Water Cut History" + }, + "NWIR": { + "category": "SUMMARY_NETWORK", + "description": "Water Injection Rate" + }, + "NWIRH": { + "category": "SUMMARY_NETWORK", + "description": "Water Injection Rate History" + }, + "NWIT": { + "category": "SUMMARY_NETWORK", + "description": "Water Injection Total" + }, + "NWPR": { + "category": "SUMMARY_NETWORK", + "description": "Water Production Rate" + }, + "NWPRH": { + "category": "SUMMARY_NETWORK", + "description": "Water Production Rate History" + }, + "NWPT": { + "category": "SUMMARY_NETWORK", + "description": "Water Production Total" + }, + "RDG": { + "category": "SUMMARY_REGION", + "description": "Gas in Place Difference from Initial Conditions" + }, + "RDO": { + "category": "SUMMARY_REGION", + "description": "Oil in Place Difference from Initial Conditions" + }, + "RDW": { + "category": "SUMMARY_REGION", + "description": "Water in Place Difference from Initial Conditions" + }, + "RGIP": { + "category": "SUMMARY_REGION", + "description": "Gas in Place" + }, + "RGIR": { + "category": "SUMMARY_REGION", + "description": "Gas Injection Rate" + }, + "RGIT": { + "category": "SUMMARY_REGION", + "description": "Gas Injection Total" + }, + "RGPR": { + "category": "SUMMARY_REGION", + "description": "Gas Production Rate" + }, + "RGPT": { + "category": "SUMMARY_REGION", + "description": "Gas Production Total" + }, + "RLIR": { + "category": "SUMMARY_REGION", + "description": "Liquid Injection Rate" + }, + "RLIT": { + "category": "SUMMARY_REGION", + "description": "Liquid Injection Total" + }, + "RLPR": { + "category": "SUMMARY_REGION", + "description": "Liquid Production Rate" + }, + "RLPT": { + "category": "SUMMARY_REGION", + "description": "Liquid Production Total" + }, + "RMSTR": { + "category": "SUMMARY_REGION", + "description": "Averaged Mean Normal Stress" + }, + "ROIP": { + "category": "SUMMARY_REGION", + "description": "Oil in Place" + }, + "ROIR": { + "category": "SUMMARY_REGION", + "description": "Oil Injection Rate" + }, + "ROIT": { + "category": "SUMMARY_REGION", + "description": "Oil Injection Total" + }, + "ROPR": { + "category": "SUMMARY_REGION", + "description": "Oil Production Rate" + }, + "ROPT": { + "category": "SUMMARY_REGION", + "description": "Oil Production Total" + }, + "RPR": { + "category": "SUMMARY_REGION", + "description": "Averaged Pressure" + }, + "RPRP": { + "category": "SUMMARY_REGION", + "description": "Averaged Pore-Volume Weighted Pressure" + }, + "RWIP": { + "category": "SUMMARY_REGION", + "description": "Water in Place" + }, + "RWIR": { + "category": "SUMMARY_REGION", + "description": "Water Injection Rate" + }, + "RWIT": { + "category": "SUMMARY_REGION", + "description": "Water Injection Total" + }, + "RWPR": { + "category": "SUMMARY_REGION", + "description": "Water Production Rate" + }, + "RWPT": { + "category": "SUMMARY_REGION", + "description": "Water Production Total" + }, + "TNREPT": { + "category": "SUMMARY_MISC", + "description": "Total Number of Report Steps" + }, + "TS": { + "category": "SUMMARY_MISC", + "description": "Current Time-Step Number" + }, + "TSCHOPS": { + "category": "SUMMARY_MISC", + "description": "Number of Time Step Chops at Current Time Step" + }, + "WADEN": { + "category": "SUMMARY_WELL", + "description": "Average Density" + }, + "WCNTL": { + "category": "SUMMARY_WELL", + "description": "Control Mode" + }, + "WLIR": { + "category": "SUMMARY_WELL", + "description": "Liquid Injection Rate" + }, + "WLIRH": { + "category": "SUMMARY_WELL", + "description": "Liquid Injection Rate History" + }, + "WLIT": { + "category": "SUMMARY_WELL", + "description": "Liquid Injection Total" + }, + "WLPV": { + "category": "SUMMARY_WELL", + "description": "Liquid Production Volume" + }, + "WSBULKV": { + "category": "SUMMARY_WELL", + "description": "Stimulated Bulk Volume Associated with SRV" + }, + "WSBVPROP": { + "category": "SUMMARY_WELL", + "description": "Stimulated Propped Bulk Volume Associated with SRV" + }, + "WSBVUNPR": { + "category": "SUMMARY_WELL", + "description": "Stimulated Unpropped Bulk Volume Associated with SRV" + }, + "WSMFSA": { + "category": "SUMMARY_WELL", + "description": "Stimulated Surface Area Associated with SRV" + }, + "WSMFSAP": { + "category": "SUMMARY_WELL", + "description": "Stimulated Propped Surface Area Associated with SRV" + }, + "WSMFSAU": { + "category": "SUMMARY_WELL", + "description": "Stimulated Unpropped Surface Area Associated with SRV" + }, + "WSPORVF": { + "category": "SUMMARY_WELL", + "description": "Stimulated Pore Volume Associated with SRV (Fracture)" + }, + "WSPORVM": { + "category": "SUMMARY_WELL", + "description": "Stimulated Pore Volume Associated with SRV (Matrix)" + }, + "WTIC": { + "category": "SUMMARY_WELL", + "description": "Well Tracer Injection Concentration" + }, + "WTIR": { + "category": "SUMMARY_WELL", + "description": "Well Tracer Injection Rate" + }, + "WTIT": { + "category": "SUMMARY_WELL", + "description": "Well Tracer Cumulative Injection" + }, + "WTPC": { + "category": "SUMMARY_WELL", + "description": "Well Tracer Production Concentration" + }, + "WTPR": { + "category": "SUMMARY_WELL", + "description": "Well Tracer Production Rate" + }, + "WTPT": { + "category": "SUMMARY_WELL", + "description": "Well Tracer Cumulative Production" + } +} diff --git a/ApplicationLibCode/Application/Resources/keyword-description/keywords_eclipse.json b/ApplicationLibCode/Application/Resources/keyword-description/keywords_eclipse.json new file mode 100644 index 0000000000..4bc4902c6f --- /dev/null +++ b/ApplicationLibCode/Application/Resources/keyword-description/keywords_eclipse.json @@ -0,0 +1,6682 @@ +{ + "AACMR": { + "category": "SUMMARY_AQUIFER", + "description": "Aquifer component molar influx rate" + }, + "AACMT": { + "category": "SUMMARY_AQUIFER", + "description": "Aquifer component molar influx totals" + }, + "AAQENTH": { + "category": "SUMMARY_AQUIFER", + "description": "Aquifer molar enthalpy" + }, + "AAQER": { + "category": "SUMMARY_AQUIFER", + "description": "Aquifer thermal energy influx rate" + }, + "AAQET": { + "category": "SUMMARY_AQUIFER", + "description": "Cumulative aquifer thermal energy influx" + }, + "AAQP": { + "category": "SUMMARY_AQUIFER", + "description": "Aquifer pressure" + }, + "AAQPD": { + "category": "SUMMARY_AQUIFER", + "description": "Aquifer dimensionless pressure" + }, + "AAQR": { + "category": "SUMMARY_AQUIFER", + "description": "Aquifer influx rate" + }, + "AAQRG": { + "category": "SUMMARY_AQUIFER", + "description": "Aquifer influx rate" + }, + "AAQT": { + "category": "SUMMARY_AQUIFER", + "description": "Cumulative aquifer influx" + }, + "AAQTD": { + "category": "SUMMARY_AQUIFER", + "description": "Aquifer dimensionless time" + }, + "AAQTEMP": { + "category": "SUMMARY_AQUIFER", + "description": "Aquifer temperature" + }, + "AAQTG": { + "category": "SUMMARY_AQUIFER", + "description": "Cumulative aquifer influx" + }, + "ALQR": { + "category": "SUMMARY_AQUIFER", + "description": "Aquifer influx rate" + }, + "ALQRG": { + "category": "SUMMARY_AQUIFER", + "description": "Aquifer influx rate" + }, + "ALQT": { + "category": "SUMMARY_AQUIFER", + "description": "Cumulative aquifer influx" + }, + "ALQTG": { + "category": "SUMMARY_AQUIFER", + "description": "Cumulative aquifer influx" + }, + "ANQP": { + "category": "SUMMARY_AQUIFER", + "description": "Aquifer pressure" + }, + "ANQR": { + "category": "SUMMARY_AQUIFER", + "description": "Aquifer influx rate" + }, + "ANQT": { + "category": "SUMMARY_AQUIFER", + "description": "Cumulative aquifer influx" + }, + "BAMF": { + "category": "SUMMARY_BLOCK", + "description": "Component aqueous mole fraction" + }, + "BAPI": { + "category": "SUMMARY_BLOCK", + "description": "Oil API" + }, + "BCABnnn": { + "category": "SUMMARY_BLOCK", + "description": "Adsorbed polymer by highest temperature band at which RRF was calculated" + }, + "BCAD": { + "category": "SUMMARY_BLOCK", + "description": "Polymer Adsorption concentration" + }, + "BCCN": { + "category": "SUMMARY_BLOCK", + "description": "Polymer Concentration" + }, + "BCDCA": { + "category": "SUMMARY_BLOCK", + "description": "Polymer thermal degradation adsorbed degradation rate" + }, + "BCDCP": { + "category": "SUMMARY_BLOCK", + "description": "Polymer thermal degradation solution degradation rate" + }, + "BCDCR": { + "category": "SUMMARY_BLOCK", + "description": "Polymer thermal degradation - total degradation rate" + }, + "BCDCS": { + "category": "SUMMARY_BLOCK", + "description": "Polymer thermal degradation - total mass degraded in previous timestep" + }, + "BCGC": { + "category": "SUMMARY_BLOCK", + "description": "Bulk Coal Gas Concentration" + }, + "BCIP": { + "category": "SUMMARY_BLOCK", + "description": "Polymer In Solution" + }, + "BCSC": { + "category": "SUMMARY_BLOCK", + "description": "Bulk Coal Solvent Concentration" + }, + "BCTRA_X": { + "category": "SUMMARY_BLOCK", + "description": "Tracer concentration interpolated at a defined coordinate" + }, + "BEMVIS": { + "category": "SUMMARY_BLOCK", + "description": "Effective mixture" + }, + "BEPVIS": { + "category": "SUMMARY_BLOCK", + "description": "Effective polymer solution viscosity" + }, + "BESALPLY": { + "category": "SUMMARY_BLOCK", + "description": "Effective Salinity with respect to Polymer" + }, + "BESALSUR": { + "category": "SUMMARY_BLOCK", + "description": "Effective Salinity with respect to Surfactant" + }, + "BESVIS": { + "category": "SUMMARY_BLOCK", + "description": "Effective water viscosity due to surfactant concentration" + }, + "BEWKR": { + "category": "SUMMARY_BLOCK", + "description": "Water effective relative permeability due to polymer" + }, + "BEWV_POL": { + "category": "SUMMARY_BLOCK", + "description": "Effective water viscosity" + }, + "BEWV_SAL": { + "category": "SUMMARY_BLOCK", + "description": "Effective water viscosity due to salt concentration" + }, + "BEWV_SUR": { + "category": "SUMMARY_BLOCK", + "description": "Effective water viscosity due to surfactant concentration" + }, + "BFLOW0I": { + "category": "SUMMARY_BLOCK", + "description": "Inter-block water flow rate in the positive I direction multiplied by the corresponding shear multiplier" + }, + "BFLOW0J": { + "category": "SUMMARY_BLOCK", + "description": "Inter-block water flow rate in the positive J direction multiplied by the corresponding shear multiplier" + }, + "BFLOW0K": { + "category": "SUMMARY_BLOCK", + "description": "Inter-block water flow rate in the positive K direction multiplied by the corresponding shear multiplier" + }, + "BFMISC": { + "category": "SUMMARY_BLOCK", + "description": "Miscibility Factor" + }, + "BFOAM": { + "category": "SUMMARY_BLOCK", + "description": "Surfactant concentration" + }, + "BFOAMCNM": { + "category": "SUMMARY_BLOCK", + "description": "Capillary number" + }, + "BFOAMMOB": { + "category": "SUMMARY_BLOCK", + "description": "Gas mobility factor" + }, + "BGI": { + "category": "SUMMARY_BLOCK", + "description": "Block Gi value" + }, + "BGKR": { + "category": "SUMMARY_BLOCK", + "description": "Gas relative permeability" + }, + "BGKRI": { + "category": "SUMMARY_BLOCK", + "description": "Gas relative permeability in the I direction" + }, + "BGKRJ": { + "category": "SUMMARY_BLOCK", + "description": "Gas relative permeability in the J direction" + }, + "BGKRK": { + "category": "SUMMARY_BLOCK", + "description": "Gas relative permeability in the K direction" + }, + "BGKRR": { + "category": "SUMMARY_BLOCK", + "description": "Gas relative permeability in the R" + }, + "BGKRT": { + "category": "SUMMARY_BLOCK", + "description": "Gas relative permeability in the T" + }, + "BGKRX": { + "category": "SUMMARY_BLOCK", + "description": "Gas relative permeability in the X direction" + }, + "BGKRY": { + "category": "SUMMARY_BLOCK", + "description": "Gas relative permeability in the Y direction" + }, + "BGKRZ": { + "category": "SUMMARY_BLOCK", + "description": "Gas relative permeability in the Z direction" + }, + "BGPC": { + "category": "SUMMARY_BLOCK", + "description": "Gas-Oil capillary pressure" + }, + "BGPR": { + "category": "SUMMARY_BLOCK", + "description": "Gas phase Pressure" + }, + "BGPV": { + "category": "SUMMARY_BLOCK", + "description": "Pore Volume containing Gas" + }, + "BGSHY": { + "category": "SUMMARY_BLOCK", + "description": "Departure saturation from drainage to imbibition for gas capillary pressure hysteresis" + }, + "BGSTRP": { + "category": "SUMMARY_BLOCK", + "description": "Trapped gas critical saturation for gas capillary pressure hysteresis" + }, + "BGTPD": { + "category": "SUMMARY_BLOCK", + "description": "Dynamic trapped gas saturation" + }, + "BGTRP": { + "category": "SUMMARY_BLOCK", + "description": "Trapped gas saturation" + }, + "BHD": { + "category": "SUMMARY_BLOCK", + "description": "Hydraulic head" + }, + "BHDF": { + "category": "SUMMARY_BLOCK", + "description": "Hydraulic head at fresh water conditions" + }, + "BHDF_X": { + "category": "SUMMARY_BLOCK", + "description": "Hydraulic head at fresh water conditions interpolated at a defined coordinate" + }, + "BHD_X": { + "category": "SUMMARY_BLOCK", + "description": "Hydraulic head interpolated at a defined coordinate" + }, + "BHPV": { + "category": "SUMMARY_BLOCK", + "description": "Pore Volume containing Hydrocarbon" + }, + "BIFTGO": { + "category": "SUMMARY_BLOCK", + "description": "Gas-oil interfacial tension" + }, + "BIFTGW": { + "category": "SUMMARY_BLOCK", + "description": "Gas-water interfacial tension" + }, + "BIFTOG": { + "category": "SUMMARY_BLOCK", + "description": "Oil-gas interfacial tension" + }, + "BIFTOW": { + "category": "SUMMARY_BLOCK", + "description": "Oil-water interfacial tension" + }, + "BIFTWG": { + "category": "SUMMARY_BLOCK", + "description": "Water-gas interfacial tension" + }, + "BIFTWO": { + "category": "SUMMARY_BLOCK", + "description": "Water-oil interfacial tension" + }, + "BJV": { + "category": "SUMMARY_BLOCK", + "description": "In" + }, + "BKRG": { + "category": "SUMMARY_BLOCK", + "description": "Gas relative permeability" + }, + "BKRGO": { + "category": "SUMMARY_BLOCK", + "description": "Two-phase gas relative permeability to oil" + }, + "BKRGOE": { + "category": "SUMMARY_BLOCK", + "description": "Equivalent relative permeability to gas for gas-oil system" + }, + "BKRGOT": { + "category": "SUMMARY_BLOCK", + "description": "Opposite saturation direction turning point relative permeability to gas for gas-oil system" + }, + "BKRGW": { + "category": "SUMMARY_BLOCK", + "description": "Two-phase gas relative permeability to water" + }, + "BKRGWE": { + "category": "SUMMARY_BLOCK", + "description": "Equivalent relative permeability to gas for gas-water system" + }, + "BKRGWT": { + "category": "SUMMARY_BLOCK", + "description": "Opposite saturation direction turning point relative permeability to gas for gas-water system" + }, + "BKRO": { + "category": "SUMMARY_BLOCK", + "description": "Oil relative permeability" + }, + "BKROG": { + "category": "SUMMARY_BLOCK", + "description": "Two-phase oil relative permeability to gas" + }, + "BKROGT": { + "category": "SUMMARY_BLOCK", + "description": "Opposite saturation direction turning point relative permeability to oil for oil-gas system" + }, + "BKROW": { + "category": "SUMMARY_BLOCK", + "description": "Two-phase oil relative permeability to water" + }, + "BKROWT": { + "category": "SUMMARY_BLOCK", + "description": "Opposite saturation direction turning point relative permeability to oil for oil-water system" + }, + "BKRW": { + "category": "SUMMARY_BLOCK", + "description": "Water relative permeability" + }, + "BKRWG": { + "category": "SUMMARY_BLOCK", + "description": "Two-phase water relative permeability to gas" + }, + "BKRWGE": { + "category": "SUMMARY_BLOCK", + "description": "Equivalent relative permeability to water for water-gas system" + }, + "BKRWGT": { + "category": "SUMMARY_BLOCK", + "description": "Opposite saturation direction turning point relative permeability to water for water-gas system" + }, + "BKRWO": { + "category": "SUMMARY_BLOCK", + "description": "Two-phase water relative permeability to oil" + }, + "BKRWOT": { + "category": "SUMMARY_BLOCK", + "description": "Opposite saturation direction turning point relative permeability to water for water-oil system" + }, + "BMLSC": { + "category": "SUMMARY_BLOCK", + "description": "Hydrocarbon molar density" + }, + "BMLST": { + "category": "SUMMARY_BLOCK", + "description": "Total hydrocarbon molar density" + }, + "BMWAT": { + "category": "SUMMARY_BLOCK", + "description": "Water molar density" + }, + "BNIP": { + "category": "SUMMARY_BLOCK", + "description": "Solvent In Place" + }, + "BNKR": { + "category": "SUMMARY_BLOCK", + "description": "Solvent relative permeability" + }, + "BNSAT": { + "category": "SUMMARY_BLOCK", + "description": "Solvent SATuration" + }, + "BOKR": { + "category": "SUMMARY_BLOCK", + "description": "Oil relative permeability" + }, + "BOKRI": { + "category": "SUMMARY_BLOCK", + "description": "Oil relative permeability in the I direction" + }, + "BOKRJ": { + "category": "SUMMARY_BLOCK", + "description": "Oil relative permeability in the J direction" + }, + "BOKRK": { + "category": "SUMMARY_BLOCK", + "description": "Oil relative permeability in the K direction" + }, + "BOKRR": { + "category": "SUMMARY_BLOCK", + "description": "Oil relative permeability in the R" + }, + "BOKRT": { + "category": "SUMMARY_BLOCK", + "description": "Oil relative permeability in the T" + }, + "BOKRX": { + "category": "SUMMARY_BLOCK", + "description": "Oil relative permeability in the X direction" + }, + "BOKRY": { + "category": "SUMMARY_BLOCK", + "description": "Oil relative permeability in the Y direction" + }, + "BOKRZ": { + "category": "SUMMARY_BLOCK", + "description": "Oil relative permeability in the Z direction" + }, + "BOPV": { + "category": "SUMMARY_BLOCK", + "description": "Pore Volume containing Oil" + }, + "BPBUB": { + "category": "SUMMARY_BLOCK", + "description": "Bubble point pressure" + }, + "BPCG": { + "category": "SUMMARY_BLOCK", + "description": "Gas Capillary Pressures" + }, + "BPCGOR": { + "category": "SUMMARY_BLOCK", + "description": "Representative gas-oil capillary pressure" + }, + "BPCGWR": { + "category": "SUMMARY_BLOCK", + "description": "Representative gas-water capillary pressure" + }, + "BPCO": { + "category": "SUMMARY_BLOCK", + "description": "Oil Capillary Pressures" + }, + "BPCOGR": { + "category": "SUMMARY_BLOCK", + "description": "Representative oil-gas capillary pressure" + }, + "BPCOWR": { + "category": "SUMMARY_BLOCK", + "description": "Representative oil-water capillary pressure" + }, + "BPCW": { + "category": "SUMMARY_BLOCK", + "description": "Water Capillary Pressures" + }, + "BPCWGR": { + "category": "SUMMARY_BLOCK", + "description": "Representative water-gas capillary pressure" + }, + "BPCWOR": { + "category": "SUMMARY_BLOCK", + "description": "Representative water-oil capillary pressure" + }, + "BPDEW": { + "category": "SUMMARY_BLOCK", + "description": "Dew point pressure" + }, + "BPERMMDX": { + "category": "SUMMARY_BLOCK", + "description": "Directional Transmissibility Multipliers in the X direction, associated with rock compaction" + }, + "BPERMMDY": { + "category": "SUMMARY_BLOCK", + "description": "Directional Transmissibility Multipliers in the Y direction, associated with rock compaction" + }, + "BPERMMDZ": { + "category": "SUMMARY_BLOCK", + "description": "Directional Transmissibility Multipliers in the Z direction, associated with rock compaction" + }, + "BPERMMOD": { + "category": "SUMMARY_BLOCK", + "description": "Transmissibility Multiplier associated with rock compaction" + }, + "BPORV": { + "category": "SUMMARY_BLOCK", + "description": "Cell Pore Volumes at Reference conditions" + }, + "BPORVMOD": { + "category": "SUMMARY_BLOCK", + "description": "Pore Volume Multiplier associated with rock compaction" + }, + "BPPC": { + "category": "SUMMARY_BLOCK", + "description": "Initial Contact Corrected Potential" + }, + "BPR": { + "category": "SUMMARY_BLOCK", + "description": "Oil phase Pressure" + }, + "BPRESSUR": { + "category": "SUMMARY_BLOCK", + "description": "Oil phase Pressure" + }, + "BPR_X": { + "category": "SUMMARY_BLOCK", + "description": "Pressure interpolated at a defined coordinate" + }, + "BPSAT": { + "category": "SUMMARY_BLOCK", + "description": "Saturation Pressures" + }, + "BPSHLZI": { + "category": "SUMMARY_BLOCK", + "description": "Viscosity multiplier due to sheared water flow in the positive I direction" + }, + "BPSHLZJ": { + "category": "SUMMARY_BLOCK", + "description": "Viscosity multiplier due to sheared water flow in the positive J direction" + }, + "BPSHLZK": { + "category": "SUMMARY_BLOCK", + "description": "Viscosity multiplier due to sheared water flow in the positive K direction" + }, + "BREAC": { + "category": "SUMMARY_BLOCK", + "description": "Reaction rate. The reaction number is given as a component index" + }, + "BRK": { + "category": "SUMMARY_BLOCK", + "description": "Water relative permeability reduction factor due to polymer" + }, + "BROMLS": { + "category": "SUMMARY_BLOCK", + "description": "Residual oil moles/ reservoir volume" + }, + "BRPV": { + "category": "SUMMARY_BLOCK", + "description": "Pore Volume at Reservoir conditions" + }, + "BRS": { + "category": "SUMMARY_BLOCK", + "description": "Gas-oil ratio" + }, + "BRSSAT": { + "category": "SUMMARY_BLOCK", + "description": "Saturated gas-oil ratio" + }, + "BRTM": { + "category": "SUMMARY_BLOCK", + "description": "Transmissibility Multiplier associated with rock compaction" + }, + "BRV": { + "category": "SUMMARY_BLOCK", + "description": "Oil-gas ratio" + }, + "BRVSAT": { + "category": "SUMMARY_BLOCK", + "description": "Saturated oil-gas ratio" + }, + "BSCN": { + "category": "SUMMARY_BLOCK", + "description": "Salt Cell Concentration" + }, + "BSCN_X": { + "category": "SUMMARY_BLOCK", + "description": "Brine concentration interpolated at a defined coordinate" + }, + "BSHWVISI": { + "category": "SUMMARY_BLOCK", + "description": "Shear viscosity of the water/polymer solution due to shear thinning/thickening in the positive I direction" + }, + "BSHWVISJ": { + "category": "SUMMARY_BLOCK", + "description": "Shear viscosity of the water/polymer solution due to shear thinning/thickening in the positive J direction" + }, + "BSHWVISK": { + "category": "SUMMARY_BLOCK", + "description": "Shear viscosity of the water/polymer solution due to shear thinning/thickening in the positive K direction" + }, + "BSIGMMOD": { + "category": "SUMMARY_BLOCK", + "description": "Dual Porosity Sigma Multiplier associated with rock compaction" + }, + "BSIP": { + "category": "SUMMARY_BLOCK", + "description": "Salt In Place" + }, + "BSMF": { + "category": "SUMMARY_BLOCK", + "description": "CO2STORE with SOLID option only Solid hydrocarbon component mole fraction" + }, + "BSRTW0I": { + "category": "SUMMARY_BLOCK", + "description": "Water shear rate in the positive I direction prior to shear effects" + }, + "BSRTW0J": { + "category": "SUMMARY_BLOCK", + "description": "Water shear rate in the positive J direction prior to shear effects" + }, + "BSRTW0K": { + "category": "SUMMARY_BLOCK", + "description": "Water shear rate in the positive K direction prior to shear effects" + }, + "BSRTWI": { + "category": "SUMMARY_BLOCK", + "description": "Water shear rate in the positive I direction following shear effects" + }, + "BSRTWJ": { + "category": "SUMMARY_BLOCK", + "description": "Water shear rate in the positive J direction following shear effects" + }, + "BSRTWK": { + "category": "SUMMARY_BLOCK", + "description": "Water shear rate in the positive K direction following shear effects" + }, + "BSTATE": { + "category": "SUMMARY_BLOCK", + "description": "Gas-oil state indicator" + }, + "BSTEN": { + "category": "SUMMARY_BLOCK", + "description": "Surface Tension" + }, + "BSURF": { + "category": "SUMMARY_BLOCK", + "description": "Concentration in solution" + }, + "BSURFCNM": { + "category": "SUMMARY_BLOCK", + "description": "Log" + }, + "BSURFST": { + "category": "SUMMARY_BLOCK", + "description": "Surface tension" + }, + "BTADS": { + "category": "SUMMARY_BLOCK", + "description": "Tracer Adsorption" + }, + "BTADSALK": { + "category": "SUMMARY_BLOCK", + "description": "Adsorption" + }, + "BTADSFOA": { + "category": "SUMMARY_BLOCK", + "description": "Adsorption" + }, + "BTADSUR": { + "category": "SUMMARY_BLOCK", + "description": "Adsorption" + }, + "BTCASUR": { + "category": "SUMMARY_BLOCK", + "description": "Log" + }, + "BTCN": { + "category": "SUMMARY_BLOCK", + "description": "Tracer Concentration" + }, + "BTCN#": { + "category": "SUMMARY_BLOCK", + "description": "Tracer concentration in phase # (1,2,3,...)" + }, + "BTCNF": { + "category": "SUMMARY_BLOCK", + "description": "Tracer Concentration" + }, + "BTCNFALK": { + "category": "SUMMARY_BLOCK", + "description": "Concentration" + }, + "BTCNFANI": { + "category": "SUMMARY_BLOCK", + "description": "Anion Flowing Concentration" + }, + "BTCNFCAT": { + "category": "SUMMARY_BLOCK", + "description": "Cation Flowing Concentration" + }, + "BTCNFFOA": { + "category": "SUMMARY_BLOCK", + "description": "Concentration" + }, + "BTCNFHEA": { + "category": "SUMMARY_BLOCK", + "description": "Block Temperature" + }, + "BTCNFSUR": { + "category": "SUMMARY_BLOCK", + "description": "Concentration" + }, + "BTCNMFOA": { + "category": "SUMMARY_BLOCK", + "description": "Capillary number" + }, + "BTCNS": { + "category": "SUMMARY_BLOCK", + "description": "Tracer Concentration" + }, + "BTDCY": { + "category": "SUMMARY_BLOCK", + "description": "Decayed tracer" + }, + "BTDCYFOA": { + "category": "SUMMARY_BLOCK", + "description": "Decayed tracer" + }, + "BTHLFFOA": { + "category": "SUMMARY_BLOCK", + "description": "Decay Half life" + }, + "BTIP#": { + "category": "SUMMARY_BLOCK", + "description": "Tracer In Place in phase # (1,2,3,...)" + }, + "BTIPF": { + "category": "SUMMARY_BLOCK", + "description": "Tracer In Place" + }, + "BTIPS": { + "category": "SUMMARY_BLOCK", + "description": "Tracer In Place" + }, + "BTIPT": { + "category": "SUMMARY_BLOCK", + "description": "Tracer In Place" + }, + "BTIPTFOA": { + "category": "SUMMARY_BLOCK", + "description": "In Solution" + }, + "BTIPTHEA": { + "category": "SUMMARY_BLOCK", + "description": "Difference in Energy in place between current and initial time" + }, + "BTIPTSUR": { + "category": "SUMMARY_BLOCK", + "description": "In Solution" + }, + "BTMOBFOA": { + "category": "SUMMARY_BLOCK", + "description": "Gas mobility factor" + }, + "BTPADALK": { + "category": "SUMMARY_BLOCK", + "description": "Polymer adsorption multiplier" + }, + "BTRADCAT": { + "category": "SUMMARY_BLOCK", + "description": "Cation Rock Associated Concentration" + }, + "BTSADALK": { + "category": "SUMMARY_BLOCK", + "description": "Surfactant adsorption multiplier" + }, + "BTSADCAT": { + "category": "SUMMARY_BLOCK", + "description": "Cation Surfactant Associated Concentration" + }, + "BTSTMALK": { + "category": "SUMMARY_BLOCK", + "description": "Surface tension multiplier" + }, + "BTSTSUR": { + "category": "SUMMARY_BLOCK", + "description": "Surface tension" + }, + "BVELW0I": { + "category": "SUMMARY_BLOCK", + "description": "Water velocity in the positive I direction multiplied by the corresponding shear multiplier" + }, + "BVELW0J": { + "category": "SUMMARY_BLOCK", + "description": "Water velocity in the positive J direction multiplied by the corresponding shear multiplier" + }, + "BVELW0K": { + "category": "SUMMARY_BLOCK", + "description": "Water velocity in the positive K direction multiplied by the corresponding shear multiplier" + }, + "BVMF": { + "category": "SUMMARY_BLOCK", + "description": "Vapor mole fraction" + }, + "BVPOLY": { + "category": "SUMMARY_BLOCK", + "description": "Effective polymer solution viscosity" + }, + "BWKR": { + "category": "SUMMARY_BLOCK", + "description": "Water relative permeability" + }, + "BWKRI": { + "category": "SUMMARY_BLOCK", + "description": "Water relative permeability in the I direction" + }, + "BWKRJ": { + "category": "SUMMARY_BLOCK", + "description": "Water relative permeability in the J direction" + }, + "BWKRK": { + "category": "SUMMARY_BLOCK", + "description": "Water relative permeability in the K direction" + }, + "BWKRR": { + "category": "SUMMARY_BLOCK", + "description": "Water relative permeability in the R" + }, + "BWKRT": { + "category": "SUMMARY_BLOCK", + "description": "Water relative permeability in the T" + }, + "BWKRX": { + "category": "SUMMARY_BLOCK", + "description": "Water relative permeability in the X direction" + }, + "BWKRY": { + "category": "SUMMARY_BLOCK", + "description": "Water relative permeability in the Y direction" + }, + "BWKRZ": { + "category": "SUMMARY_BLOCK", + "description": "Water relative permeability in the Z direction" + }, + "BWPC": { + "category": "SUMMARY_BLOCK", + "description": "Water-Oil capillary pressure" + }, + "BWPR": { + "category": "SUMMARY_BLOCK", + "description": "Water phase Pressure" + }, + "BWPV": { + "category": "SUMMARY_BLOCK", + "description": "Pore Volume containing Water" + }, + "BWSHY": { + "category": "SUMMARY_BLOCK", + "description": "Departure saturation from drainage to imbibition for water capillary pressure hysteresis" + }, + "BWSMA": { + "category": "SUMMARY_BLOCK", + "description": "Maximum wetting saturation for water capillary pressure hysteresis" + }, + "BXMF": { + "category": "SUMMARY_BLOCK", + "description": "Liquid hydrocarbon component mole fraction" + }, + "BYMF": { + "category": "SUMMARY_BLOCK", + "description": "Vapor hydrocarbon component mole fraction / vapor steam" + }, + "CAMF": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Component aqueous mole fraction, from producing completions" + }, + "CAPI": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Oil API" + }, + "CCFR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Polymer Flow Rate" + }, + "CCIC": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Polymer Injection Concentration" + }, + "CCIR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Polymer Injection Rate" + }, + "CCIT": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Polymer Injection Total" + }, + "CCPC": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Polymer Production Concentration" + }, + "CCPR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Polymer Production Rate" + }, + "CCPT": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Polymer Production Total" + }, + "CDBF": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Blocking factor for generalized pseudo-pressure method" + }, + "CDFAC": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "D-factor for flow dependent skin factor" + }, + "CDSF": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "PI multiplicative factor due to scale damage" + }, + "CDSM": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Current mass of scale deposited" + }, + "CDSML": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Current mass of scale deposited per unit perforation length" + }, + "CGFR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Gas Flow Rate" + }, + "CGFRF": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Free Gas Flow Rate" + }, + "CGFRL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Gas Flow Rate" + }, + "CGFRS": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Solution Gas Flow Rate" + }, + "CGFRU": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Sum of connection gas flow rates upstream of, and including, this connection" + }, + "CGIR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Gas Injection Rate" + }, + "CGIRL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Gas Injection Rate" + }, + "CGIT": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Gas Injection Total" + }, + "CGITL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Gas Injection Total" + }, + "CGLR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Gas-Liquid Ratio" + }, + "CGLRL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Gas-Liquid Ratio" + }, + "CGOR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Gas-Oil Ratio" + }, + "CGORL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Gas-Oil Ratio" + }, + "CGPI": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Gas Potential Injection rate" + }, + "CGPP": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Gas Potential Production rate" + }, + "CGPPTN": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Generalized pseudo-pressure table update counter" + }, + "CGPPTS": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Generalized pseudo-pressure table update status" + }, + "CGPR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Gas Production Rate " + }, + "CGPRL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Gas Flow Rate" + }, + "CGPT": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Gas Production Total" + }, + "CGPTF": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Free Gas Production Total" + }, + "CGPTL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Gas Production Total" + }, + "CGPTS": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Solution Gas Production Total" + }, + "CGQ": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Gas Quality" + }, + "CKFR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Hydrocarbon Component" + }, + "CKFRL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Hydrocarbon Component" + }, + "CKFT": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Hydrocarbon Component" + }, + "CKFTL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Hydrocarbon Component" + }, + "CLFR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Liquid Flow Rate" + }, + "CLFRL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Liquid Flow Rate" + }, + "CLPT": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Liquid Production Total" + }, + "CLPTL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Liquid Production Total" + }, + "CNFR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Solvent Flow Rate" + }, + "CNIT": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Solvent Injection Total" + }, + "CNPT": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Solvent Production Total" + }, + "COFR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Oil Flow Rate" + }, + "COFRF": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Free Oil Flow Rate" + }, + "COFRL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Oil Flow Rate" + }, + "COFRS": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Solution oil flow rate" + }, + "COFRU": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Sum of connection oil flow rates upstream of, and including, this connection" + }, + "COGR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Oil-Gas Ratio" + }, + "COGRL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Oil-Gas Ratio" + }, + "COIT": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Oil Injection Total" + }, + "COITL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Oil Injection Total" + }, + "COPI": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Oil Potential Injection rate" + }, + "COPP": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Oil Potential Production rate" + }, + "COPR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Oil Production Rate" + }, + "COPRL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Oil Flow Rate" + }, + "COPT": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Oil Production Total" + }, + "COPTF": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Free Oil Production Total" + }, + "COPTL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Oil Production Total" + }, + "COPTS": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Solution Oil Production Total" + }, + "CPI": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Productivity Index of well's preferred phase" + }, + "CPR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Connection Pressure" + }, + "CPRL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Average Connection Pressure in completion" + }, + "CPU": { + "category": "SUMMARY_MISC", + "description": "CPU" + }, + "CRREXCH": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Exchange flux at current time" + }, + "CRRINJT": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Connection cumulative water injection" + }, + "CRRPROT": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Connection cumulative water production" + }, + "CSFR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Salt Flow Rate" + }, + "CSIC": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Salt Injection Concentration" + }, + "CSIR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Salt Injection Rate" + }, + "CSIT": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Salt Injection Total" + }, + "CSPC": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Salt Production Concentration" + }, + "CSPR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Salt Production Rate" + }, + "CSPT": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Salt Production Total" + }, + "CTFAC": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Connection Transmissibility Factor" + }, + "CTFR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Tracer Flow Rate" + }, + "CTFRALK": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Flow Rate" + }, + "CTFRANI": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Anion Flow Rate" + }, + "CTFRCAT": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Cation Flow Rate" + }, + "CTFRFOA": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Flow Rate" + }, + "CTFRSUR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Flow Rate" + }, + "CTIC": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Tracer Injection Concentration" + }, + "CTICF": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Tracer Injection Concentration" + }, + "CTICS": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Tracer Injection Concentration" + }, + "CTIR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Tracer Injection Rate" + }, + "CTIRF": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Tracer Injection Rate" + }, + "CTIRS": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Tracer Injection Rate" + }, + "CTIT": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Tracer Injection Total" + }, + "CTITALK": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Injection Total" + }, + "CTITANI": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Anion Injection Total" + }, + "CTITCAT": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Cation Injection Total" + }, + "CTITF": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Tracer Injection Total" + }, + "CTITFOA": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Injection Total" + }, + "CTITS": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Tracer Injection Total" + }, + "CTITSUR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Injection Total" + }, + "CTPC": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Tracer Production Concentration" + }, + "CTPCF": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Tracer Production" + }, + "CTPCS": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Tracer Production" + }, + "CTPR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Tracer Production Rate" + }, + "CTPRF": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Tracer Production Rate" + }, + "CTPRS": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Tracer Production Rate" + }, + "CTPT": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Tracer Production Total" + }, + "CTPTALK": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Production Total" + }, + "CTPTANI": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Anion Production Total" + }, + "CTPTCAT": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Cation Production Total" + }, + "CTPTF": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Tracer Production Total" + }, + "CTPTFOA": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Production Total" + }, + "CTPTS": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Tracer Production Total" + }, + "CTPTSUR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Production Total" + }, + "CU": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "User-defined connection quantity" + }, + "CVFR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Reservoir" + }, + "CVFRL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Reservoir" + }, + "CVIR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Res Volume Injection Rate" + }, + "CVIRL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Res Volume Injection Flow Rate" + }, + "CVIT": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Res Volume Injection Total" + }, + "CVITL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Res Volume Injection Total" + }, + "CVPR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Res Volume Production Rate" + }, + "CVPRL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Res Volume Production Flow Rate" + }, + "CVPT": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Res Volume Production Total" + }, + "CVPTL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Res Volume Production Total" + }, + "CWCT": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Water Cut" + }, + "CWCTL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Water Cut" + }, + "CWFR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Water Flow Rate" + }, + "CWFRL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Water Flow Rate" + }, + "CWFRU": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Sum of connection water flow rates upstream of, and including, this connection" + }, + "CWGR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Water-Gas Ratio" + }, + "CWGRL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Water-Gas Ratio" + }, + "CWIR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Water Injection Rate" + }, + "CWIRL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Water Injection Rate" + }, + "CWIT": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Water Injection Total" + }, + "CWITL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Water Injection Total" + }, + "CWPI": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Water Potential Injection rate" + }, + "CWPP": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Water Potential Production rate" + }, + "CWPR": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Water Production Rate" + }, + "CWPRL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Water Flow Rate" + }, + "CWPT": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Water Production Total" + }, + "CWPTL": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Water Production Total" + }, + "CZMF": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "Total Mole Fraction" + }, + "DATE": { + "category": "SUMMARY_MISC", + "description": "Date" + }, + "DAY": { + "category": "SUMMARY_MISC", + "description": "Day" + }, + "ELAPSED": { + "category": "SUMMARY_MISC", + "description": "Elapsed time in seconds" + }, + "FAMF": { + "category": "SUMMARY_FIELD", + "description": "Component aqueous mole fraction, from producing completions" + }, + "FAMR": { + "category": "SUMMARY_FIELD", + "description": "Make-up gas rate" + }, + "FAMT": { + "category": "SUMMARY_FIELD", + "description": "Make-up gas total" + }, + "FAPI": { + "category": "SUMMARY_FIELD", + "description": "Oil API" + }, + "FAQER": { + "category": "SUMMARY_FIELD", + "description": "Aquifer thermal energy influx rate" + }, + "FAQET": { + "category": "SUMMARY_FIELD", + "description": "Cumulative aquifer thermal energy influx" + }, + "FAQR": { + "category": "SUMMARY_FIELD", + "description": "Aquifer influx rate" + }, + "FAQRG": { + "category": "SUMMARY_FIELD", + "description": "Aquifer influx rate" + }, + "FAQT": { + "category": "SUMMARY_FIELD", + "description": "Cumulative aquifer influx" + }, + "FAQTG": { + "category": "SUMMARY_FIELD", + "description": "Cumulative aquifer influx" + }, + "FCAD": { + "category": "SUMMARY_FIELD", + "description": "Polymer Adsorption total" + }, + "FCGC": { + "category": "SUMMARY_FIELD", + "description": "Bulk Coal Gas Concentration" + }, + "FCGMR": { + "category": "SUMMARY_FIELD", + "description": "Hydrocarbon component" + }, + "FCGMRG": { + "category": "SUMMARY_FIELD", + "description": "Hydrocarbon component molar rates in the gas phase" + }, + "FCGMRn": { + "category": "SUMMARY_FIELD", + "description": "Hydrocarbon component molar rates in the gas phase for nth separator stage" + }, + "FCGMT": { + "category": "SUMMARY_FIELD", + "description": "Hydrocarbon component" + }, + "FCGRn": { + "category": "SUMMARY_FIELD", + "description": "Hydrocarbon component molar rates in the gas phase for nth separator stage" + }, + "FCHIP": { + "category": "SUMMARY_FIELD", + "description": "Component Hydrocarbon as Wet Gas" + }, + "FCHMR": { + "category": "SUMMARY_FIELD", + "description": "Hydrocarbon Component" + }, + "FCHMT": { + "category": "SUMMARY_FIELD", + "description": "Hydrocarbon Component" + }, + "FCIC": { + "category": "SUMMARY_FIELD", + "description": "Polymer Injection Concentration" + }, + "FCIP": { + "category": "SUMMARY_FIELD", + "description": "Polymer In Solution" + }, + "FCIR": { + "category": "SUMMARY_FIELD", + "description": "Polymer Injection Rate" + }, + "FCIT": { + "category": "SUMMARY_FIELD", + "description": "Polymer Injection Total" + }, + "FCMIP": { + "category": "SUMMARY_FIELD", + "description": "Component Hydrocarbon as Moles" + }, + "FCMIR": { + "category": "SUMMARY_FIELD", + "description": "Hydrocarbon Component Molar Injection Rates" + }, + "FCMIT": { + "category": "SUMMARY_FIELD", + "description": "Hydrocarbon Component Molar Injection Totals" + }, + "FCMPR": { + "category": "SUMMARY_FIELD", + "description": "Hydrocarbon Component Molar Production Rates" + }, + "FCMPT": { + "category": "SUMMARY_FIELD", + "description": "Hydrocarbon Component" + }, + "FCNMR": { + "category": "SUMMARY_FIELD", + "description": "Hydrocarbon component molar rates in the NGL phase" + }, + "FCNMRG": { + "category": "SUMMARY_FIELD", + "description": "Hydrocarbon component molar rates in the NGL phase" + }, + "FCNWR": { + "category": "SUMMARY_FIELD", + "description": "Hydrocarbon component mass rates in the NGL phase" + }, + "FCOMR": { + "category": "SUMMARY_FIELD", + "description": "Hydrocarbon component" + }, + "FCOMRG": { + "category": "SUMMARY_FIELD", + "description": "Hydrocarbon component" + }, + "FCOMRn": { + "category": "SUMMARY_FIELD", + "description": "Hydrocarbon component" + }, + "FCOMT": { + "category": "SUMMARY_FIELD", + "description": "Hydrocarbon component" + }, + "FCORn": { + "category": "SUMMARY_FIELD", + "description": "Hydrocarbon component" + }, + "FCPC": { + "category": "SUMMARY_FIELD", + "description": "Polymer Production Concentration" + }, + "FCPR": { + "category": "SUMMARY_FIELD", + "description": "Polymer Production Rate" + }, + "FCPT": { + "category": "SUMMARY_FIELD", + "description": "Polymer Production Total" + }, + "FCSC": { + "category": "SUMMARY_FIELD", + "description": "Bulk Coal Solvent Concentration" + }, + "FCWGIR": { + "category": "SUMMARY_FIELD", + "description": "Hydrocarbon Component Wet Gas Injection Rate" + }, + "FCWGIT": { + "category": "SUMMARY_FIELD", + "description": "Hydrocarbon Component Wet Gas Injection Total" + }, + "FCWGPR": { + "category": "SUMMARY_FIELD", + "description": "Hydrocarbon Component Wet Gas Production Rate" + }, + "FCWGPT": { + "category": "SUMMARY_FIELD", + "description": "Hydrocarbon Component Wet Gas Production Total" + }, + "FEDC": { + "category": "SUMMARY_FIELD", + "description": "Energy Delivery Capacity" + }, + "FEDCQ": { + "category": "SUMMARY_FIELD", + "description": "Energy DCQ" + }, + "FEGR": { + "category": "SUMMARY_FIELD", + "description": "Export Gas Rate" + }, + "FEGT": { + "category": "SUMMARY_FIELD", + "description": "Export Gas Total" + }, + "FEMF": { + "category": "SUMMARY_FIELD", + "description": "Export Gas Mole Fraction" + }, + "FEOMF": { + "category": "SUMMARY_FIELD", + "description": "Export Oil Mole Fraction" + }, + "FEOR": { + "category": "SUMMARY_FIELD", + "description": "Export Oil Rate" + }, + "FEOT": { + "category": "SUMMARY_FIELD", + "description": "Export Oil Total" + }, + "FEPR": { + "category": "SUMMARY_FIELD", + "description": "Energy Production Rate" + }, + "FEPT": { + "category": "SUMMARY_FIELD", + "description": "Energy Production Total" + }, + "FESR": { + "category": "SUMMARY_FIELD", + "description": "Energy Sales Rate" + }, + "FEST": { + "category": "SUMMARY_FIELD", + "description": "Energy Sales Total" + }, + "FEXGR": { + "category": "SUMMARY_FIELD", + "description": "Excess Gas Rate" + }, + "FEXGT": { + "category": "SUMMARY_FIELD", + "description": "Excess Gas Total" + }, + "FFGR": { + "category": "SUMMARY_FIELD", + "description": "Fuel Gas Rate, at and below this group" + }, + "FFGT": { + "category": "SUMMARY_FIELD", + "description": "Fuel Gas cumulative Total, at and below this group" + }, + "FFMF": { + "category": "SUMMARY_FIELD", + "description": "Fuel Gas Mole Fraction" + }, + "FGCR": { + "category": "SUMMARY_FIELD", + "description": "Gas Consumption Rate, at and below this group" + }, + "FGCT": { + "category": "SUMMARY_FIELD", + "description": "Gas Consumption Total, at and below this group" + }, + "FGCV": { + "category": "SUMMARY_FIELD", + "description": "Gas Calorific Value" + }, + "FGDC": { + "category": "SUMMARY_FIELD", + "description": "Gas Delivery Capacity" + }, + "FGDCQ": { + "category": "SUMMARY_FIELD", + "description": "Field/Group Gas DCQ" + }, + "FGDN": { + "category": "SUMMARY_FIELD", + "description": "Gas Density at Surface Conditions" + }, + "FGIMR": { + "category": "SUMMARY_FIELD", + "description": "Gas Import Rate, at and below this group" + }, + "FGIMT": { + "category": "SUMMARY_FIELD", + "description": "Gas Import Total, at and below this group" + }, + "FGIR": { + "category": "SUMMARY_FIELD", + "description": "Gas Injection Rate" + }, + "FGIRH": { + "category": "SUMMARY_FIELD", + "description": "Gas Injection Rate History" + }, + "FGIRT": { + "category": "SUMMARY_FIELD", + "description": "Gas Injection Rate Target/Limit" + }, + "FGIT": { + "category": "SUMMARY_FIELD", + "description": "Gas Injection Total" + }, + "FGITH": { + "category": "SUMMARY_FIELD", + "description": "Gas Injection Total History" + }, + "FGLIR": { + "category": "SUMMARY_FIELD", + "description": "Gas Lift Injection Rate" + }, + "FGLIT": { + "category": "SUMMARY_FIELD", + "description": "Gas Lift Injection Total" + }, + "FGLR": { + "category": "SUMMARY_FIELD", + "description": "Gas-Liquid Ratio" + }, + "FGLRH": { + "category": "SUMMARY_FIELD", + "description": "Gas-Liquid Ratio History" + }, + "FGMR": { + "category": "SUMMARY_FIELD", + "description": "Gas Mass Rate" + }, + "FGMT": { + "category": "SUMMARY_FIELD", + "description": "Gas Mass Total" + }, + "FGOR": { + "category": "SUMMARY_FIELD", + "description": "Gas-Oil Ratio" + }, + "FGORH": { + "category": "SUMMARY_FIELD", + "description": "Gas-Oil Ratio History" + }, + "FGPI": { + "category": "SUMMARY_FIELD", + "description": "Gas Potential Injection rate" + }, + "FGPI2": { + "category": "SUMMARY_FIELD", + "description": "Gas Potential Injection rate" + }, + "FGPP": { + "category": "SUMMARY_FIELD", + "description": "Gas Potential Production rate" + }, + "FGPP2": { + "category": "SUMMARY_FIELD", + "description": "Gas Potential Production rate" + }, + "FGPPF": { + "category": "SUMMARY_FIELD", + "description": "Free Gas Potential Production rate" + }, + "FGPPF2": { + "category": "SUMMARY_FIELD", + "description": "Free Gas Potential Production rate" + }, + "FGPPS": { + "category": "SUMMARY_FIELD", + "description": "Solution" + }, + "FGPPS2": { + "category": "SUMMARY_FIELD", + "description": "Solution" + }, + "FGPR": { + "category": "SUMMARY_FIELD", + "description": "Gas Production Rate" + }, + "FGPR1": { + "category": "SUMMARY_FIELD", + "description": "Gas Production Rate above GOC" + }, + "FGPR2": { + "category": "SUMMARY_FIELD", + "description": "Gas Production Rate below GOC" + }, + "FGPRA": { + "category": "SUMMARY_FIELD", + "description": "Gas Production Rate above" + }, + "FGPRB": { + "category": "SUMMARY_FIELD", + "description": "Gas Production Rate below" + }, + "FGPRF": { + "category": "SUMMARY_FIELD", + "description": "Free Gas Production Rate" + }, + "FGPRG": { + "category": "SUMMARY_FIELD", + "description": "Gas production rate" + }, + "FGPRH": { + "category": "SUMMARY_FIELD", + "description": "Gas Production Rate History" + }, + "FGPRS": { + "category": "SUMMARY_FIELD", + "description": "Solution Gas Production Rate" + }, + "FGPRT": { + "category": "SUMMARY_FIELD", + "description": "Gas Production Rate Target/Limit" + }, + "FGPT": { + "category": "SUMMARY_FIELD", + "description": "Gas Production Total" + }, + "FGPT1": { + "category": "SUMMARY_FIELD", + "description": "Gas Production Total above GOC" + }, + "FGPT2": { + "category": "SUMMARY_FIELD", + "description": "Gas Production Total below GOC" + }, + "FGPTA": { + "category": "SUMMARY_FIELD", + "description": "Gas Production Total above" + }, + "FGPTB": { + "category": "SUMMARY_FIELD", + "description": "Gas Production Total below" + }, + "FGPTF": { + "category": "SUMMARY_FIELD", + "description": "Free Gas Production Total" + }, + "FGPTH": { + "category": "SUMMARY_FIELD", + "description": "Gas Production Total History" + }, + "FGPTS": { + "category": "SUMMARY_FIELD", + "description": "Solution Gas Production Total" + }, + "FGPV": { + "category": "SUMMARY_FIELD", + "description": "Pore Volume containing Gas" + }, + "FGQ": { + "category": "SUMMARY_FIELD", + "description": "Gas Quality" + }, + "FGSPR": { + "category": "SUMMARY_FIELD", + "description": "Target sustainable rate for most recent sustainable capacity test for gas" + }, + "FGSR": { + "category": "SUMMARY_FIELD", + "description": "Sales Gas Rate" + }, + "FGSRL": { + "category": "SUMMARY_FIELD", + "description": "Maximum tested rate sustained for the test period during the most recent sustainable capacity test for gas" + }, + "FGSRU": { + "category": "SUMMARY_FIELD", + "description": "Minimum tested rate not sustained for the test period during the most recent sustainable capacity test for gas" + }, + "FGSSP": { + "category": "SUMMARY_FIELD", + "description": "Period for which target sustainable rate could be maintained for the most recent sustainable capacity test for gas" + }, + "FGST": { + "category": "SUMMARY_FIELD", + "description": "Sales Gas Total" + }, + "FGSTP": { + "category": "SUMMARY_FIELD", + "description": "Test period for the most recent sustainable capacity test for gas" + }, + "FGVIR": { + "category": "SUMMARY_FIELD", + "description": "Gas Voidage Injection Rate" + }, + "FGVIT": { + "category": "SUMMARY_FIELD", + "description": "Gas Voidage Injection Total" + }, + "FGVPR": { + "category": "SUMMARY_FIELD", + "description": "Gas Voidage Production Rate" + }, + "FGVPT": { + "category": "SUMMARY_FIELD", + "description": "Gas Voidage Production Total" + }, + "FGnPR": { + "category": "SUMMARY_FIELD", + "description": "nth separator stage gas rate" + }, + "FGnPT": { + "category": "SUMMARY_FIELD", + "description": "nth separator stage gas total" + }, + "FHMIR": { + "category": "SUMMARY_FIELD", + "description": "Hydrocarbon Molar Injection Rate" + }, + "FHMIT": { + "category": "SUMMARY_FIELD", + "description": "Hydrocarbon Molar Injection Total" + }, + "FHMPR": { + "category": "SUMMARY_FIELD", + "description": "Hydrocarbon Molar Production Rate" + }, + "FHMPT": { + "category": "SUMMARY_FIELD", + "description": "Hydrocarbon Molar Production Total" + }, + "FHPV": { + "category": "SUMMARY_FIELD", + "description": "Pore Volume containing Hydrocarbon" + }, + "FLPR": { + "category": "SUMMARY_FIELD", + "description": "Liquid Production Rate" + }, + "FLPRH": { + "category": "SUMMARY_FIELD", + "description": "Liquid Production Rate History" + }, + "FLPRT": { + "category": "SUMMARY_FIELD", + "description": "Liquid Production Rate Target/Limit" + }, + "FLPT": { + "category": "SUMMARY_FIELD", + "description": "Liquid Production Total" + }, + "FLPTH": { + "category": "SUMMARY_FIELD", + "description": "Liquid Production Total History" + }, + "FMCTG": { + "category": "SUMMARY_FIELD", + "description": "Mode of Control for group Gas Injection" + }, + "FMCTP": { + "category": "SUMMARY_FIELD", + "description": "Mode of Control for group Production" + }, + "FMCTW": { + "category": "SUMMARY_FIELD", + "description": "Mode of Control for group Water Injection" + }, + "FMIR": { + "category": "SUMMARY_FIELD", + "description": "Methane Injection Rate" + }, + "FMIT": { + "category": "SUMMARY_FIELD", + "description": "Methane Injection Total" + }, + "FMPR": { + "category": "SUMMARY_FIELD", + "description": "Methane Production Rate" + }, + "FMPT": { + "category": "SUMMARY_FIELD", + "description": "Methane Production Total" + }, + "FMUF": { + "category": "SUMMARY_FIELD", + "description": "Make-up fraction" + }, + "FMWDR": { + "category": "SUMMARY_FIELD", + "description": "Number of drilling events this timestep" + }, + "FMWDT": { + "category": "SUMMARY_FIELD", + "description": "Number of drilling events in total" + }, + "FMWIA": { + "category": "SUMMARY_FIELD", + "description": "Number of abandoned injection wells" + }, + "FMWIG": { + "category": "SUMMARY_FIELD", + "description": "Number of injectors on group control" + }, + "FMWIN": { + "category": "SUMMARY_FIELD", + "description": "Number of injection wells currently flowing" + }, + "FMWIP": { + "category": "SUMMARY_FIELD", + "description": "Number of injectors on pressure control" + }, + "FMWIS": { + "category": "SUMMARY_FIELD", + "description": "Number of injectors on own surface rate limit control" + }, + "FMWIT": { + "category": "SUMMARY_FIELD", + "description": "Total number of injection wells" + }, + "FMWIU": { + "category": "SUMMARY_FIELD", + "description": "Number of unused injection wells" + }, + "FMWIV": { + "category": "SUMMARY_FIELD", + "description": "Number of injectors on own reservoir volume rate limit control" + }, + "FMWPA": { + "category": "SUMMARY_FIELD", + "description": "Number of abandoned production wells" + }, + "FMWPG": { + "category": "SUMMARY_FIELD", + "description": "Number of producers on group control" + }, + "FMWPL": { + "category": "SUMMARY_FIELD", + "description": "Number of producers using artificial lift" + }, + "FMWPO": { + "category": "SUMMARY_FIELD", + "description": "Number of producers controlled by own oil rate limit" + }, + "FMWPP": { + "category": "SUMMARY_FIELD", + "description": "Number of producers on pressure control" + }, + "FMWPR": { + "category": "SUMMARY_FIELD", + "description": "Number of production wells currently flowing" + }, + "FMWPS": { + "category": "SUMMARY_FIELD", + "description": "Number of producers on own surface rate limit control" + }, + "FMWPT": { + "category": "SUMMARY_FIELD", + "description": "Total number of production wells" + }, + "FMWPU": { + "category": "SUMMARY_FIELD", + "description": "Number of unused production wells" + }, + "FMWPV": { + "category": "SUMMARY_FIELD", + "description": "Number of producers on own reservoir volume rate limit control" + }, + "FMWWO": { + "category": "SUMMARY_FIELD", + "description": "Number of workover events this timestep" + }, + "FMWWT": { + "category": "SUMMARY_FIELD", + "description": "Number of workover events in total" + }, + "FNIP": { + "category": "SUMMARY_FIELD", + "description": "Solvent In Place" + }, + "FNIR": { + "category": "SUMMARY_FIELD", + "description": "Solvent Injection Rate" + }, + "FNIT": { + "category": "SUMMARY_FIELD", + "description": "Solvent Injection Total" + }, + "FNLPR": { + "category": "SUMMARY_FIELD", + "description": "NGL Production Rate" + }, + "FNLPRG": { + "category": "SUMMARY_FIELD", + "description": "NGL production rate" + }, + "FNLPRH": { + "category": "SUMMARY_FIELD", + "description": "NGL Production Rate History" + }, + "FNLPT": { + "category": "SUMMARY_FIELD", + "description": "NGL Production Total" + }, + "FNLPTH": { + "category": "SUMMARY_FIELD", + "description": "NGL Production Total History" + }, + "FNPR": { + "category": "SUMMARY_FIELD", + "description": "Solvent Production Rate" + }, + "FNPT": { + "category": "SUMMARY_FIELD", + "description": "Solvent Production Total" + }, + "FNQR": { + "category": "SUMMARY_FIELD", + "description": "Aquifer influx rate" + }, + "FNQT": { + "category": "SUMMARY_FIELD", + "description": "Cumulative aquifer influx" + }, + "FODN": { + "category": "SUMMARY_FIELD", + "description": "Oil Density at Surface Conditions" + }, + "FOE": { + "category": "SUMMARY_FIELD", + "description": "(OIP(initial) - OIP(now)) / OIP(initial)" + }, + "FOEIG": { + "category": "SUMMARY_FIELD", + "description": "(OIP(initial) - OIP(now)) / Initial Mobile Oil with respect to Gas" + }, + "FOEIW": { + "category": "SUMMARY_FIELD", + "description": "(OIP(initial) - OIP(now)) / Initial Mobile Oil with respect to Water" + }, + "FOEW": { + "category": "SUMMARY_FIELD", + "description": "Oil Production from Wells / OIP(initial)" + }, + "FOEWG": { + "category": "SUMMARY_FIELD", + "description": "Oil Production from Wells / Initial Mobile Oil with respect to Gas" + }, + "FOEWW": { + "category": "SUMMARY_FIELD", + "description": "Oil Production from Wells / Initial Mobile Oil with respect to Water" + }, + "FOGR": { + "category": "SUMMARY_FIELD", + "description": "Oil-Gas Ratio" + }, + "FOGRH": { + "category": "SUMMARY_FIELD", + "description": "Oil-Gas Ratio History" + }, + "FOIR": { + "category": "SUMMARY_FIELD", + "description": "Oil Injection Rate" + }, + "FOIRH": { + "category": "SUMMARY_FIELD", + "description": "Oil Injection Rate History" + }, + "FOIRT": { + "category": "SUMMARY_FIELD", + "description": "Oil Injection Rate Target/Limit" + }, + "FOIT": { + "category": "SUMMARY_FIELD", + "description": "Oil Injection Total" + }, + "FOITH": { + "category": "SUMMARY_FIELD", + "description": "Oil Injection Total History" + }, + "FOMR": { + "category": "SUMMARY_FIELD", + "description": "Oil Mass Rate" + }, + "FOMT": { + "category": "SUMMARY_FIELD", + "description": "Oil Mass Total" + }, + "FOPI": { + "category": "SUMMARY_FIELD", + "description": "Oil Potential Injection rate" + }, + "FOPI2": { + "category": "SUMMARY_FIELD", + "description": "Oil Potential Injection rate" + }, + "FOPP": { + "category": "SUMMARY_FIELD", + "description": "Oil Potential Production rate" + }, + "FOPP2": { + "category": "SUMMARY_FIELD", + "description": "Oil Potential Production rate" + }, + "FOPR": { + "category": "SUMMARY_FIELD", + "description": "Oil Production Rate" + }, + "FOPR1": { + "category": "SUMMARY_FIELD", + "description": "Oil Production Rate above GOC" + }, + "FOPR2": { + "category": "SUMMARY_FIELD", + "description": "Oil Production Rate below GOC" + }, + "FOPRA": { + "category": "SUMMARY_FIELD", + "description": "Oil Production Rate above GOC" + }, + "FOPRB": { + "category": "SUMMARY_FIELD", + "description": "Oil Production Rate below GOC" + }, + "FOPRF": { + "category": "SUMMARY_FIELD", + "description": "Free Oil Production Rate" + }, + "FOPRG": { + "category": "SUMMARY_FIELD", + "description": "Oil production rate" + }, + "FOPRH": { + "category": "SUMMARY_FIELD", + "description": "Oil Production Rate History" + }, + "FOPRS": { + "category": "SUMMARY_FIELD", + "description": "Solution Oil Production Rate" + }, + "FOPRT": { + "category": "SUMMARY_FIELD", + "description": "Oil Production Rate Target/Limit" + }, + "FOPT": { + "category": "SUMMARY_FIELD", + "description": "Oil Production Total" + }, + "FOPT1": { + "category": "SUMMARY_FIELD", + "description": "Oil Production Total above GOC" + }, + "FOPT2": { + "category": "SUMMARY_FIELD", + "description": "Oil Production Total below GOC" + }, + "FOPTA": { + "category": "SUMMARY_FIELD", + "description": "Oil Production Total above GOC" + }, + "FOPTB": { + "category": "SUMMARY_FIELD", + "description": "Oil Production Total below GOC" + }, + "FOPTF": { + "category": "SUMMARY_FIELD", + "description": "Free Oil Production Total" + }, + "FOPTH": { + "category": "SUMMARY_FIELD", + "description": "Oil Production Total History" + }, + "FOPTS": { + "category": "SUMMARY_FIELD", + "description": "Solution Oil Production Total" + }, + "FOPV": { + "category": "SUMMARY_FIELD", + "description": "Pore Volume containing Oil" + }, + "FORFE": { + "category": "SUMMARY_FIELD", + "description": "Fraction of total oil produced by oil expansion" + }, + "FORFF": { + "category": "SUMMARY_FIELD", + "description": "Fraction of total oil produced by free gas influx" + }, + "FORFG": { + "category": "SUMMARY_FIELD", + "description": "Fraction of total oil produced by gas influx" + }, + "FORFR": { + "category": "SUMMARY_FIELD", + "description": "Fraction of total oil produced by rock compaction" + }, + "FORFS": { + "category": "SUMMARY_FIELD", + "description": "Fraction of total oil produced by solution gas" + }, + "FORFW": { + "category": "SUMMARY_FIELD", + "description": "Fraction of total oil produced by water influx" + }, + "FORFX": { + "category": "SUMMARY_FIELD", + "description": "Fraction of total oil produced by 'traced' water influx" + }, + "FORFY": { + "category": "SUMMARY_FIELD", + "description": "Fraction of total oil produced by other water influx" + }, + "FORME": { + "category": "SUMMARY_FIELD", + "description": "Total stock tank oil produced by oil expansion" + }, + "FORMF": { + "category": "SUMMARY_FIELD", + "description": "Total stock tank oil produced by free gas influx" + }, + "FORMG": { + "category": "SUMMARY_FIELD", + "description": "Total stock tank oil produced by gas influx" + }, + "FORMR": { + "category": "SUMMARY_FIELD", + "description": "Total stock tank oil produced by rock compaction" + }, + "FORMS": { + "category": "SUMMARY_FIELD", + "description": "Total stock tank oil produced by solution gas" + }, + "FORMW": { + "category": "SUMMARY_FIELD", + "description": "Total stock tank oil produced by water influx" + }, + "FORMX": { + "category": "SUMMARY_FIELD", + "description": "Total stock tank oil produced by 'traced' water influx" + }, + "FORMY": { + "category": "SUMMARY_FIELD", + "description": "Total stock tank oil produced by other water influx" + }, + "FOSPR": { + "category": "SUMMARY_FIELD", + "description": "Target sustainable rate for most recent sustainable capacity test for oil" + }, + "FOSRL": { + "category": "SUMMARY_FIELD", + "description": "Maximum tested rate sustained for the test period during the most recent sustainable capacity test for oil" + }, + "FOSRU": { + "category": "SUMMARY_FIELD", + "description": "Minimum tested rate not sustained for the test period during the most recent sustainable capacity test for oil" + }, + "FOSSP": { + "category": "SUMMARY_FIELD", + "description": "Period for which target sustainable rate could be maintained for the most recent sustainable capacity test for oil" + }, + "FOSTP": { + "category": "SUMMARY_FIELD", + "description": "Test period for the most recent sustainable capacity test for oil" + }, + "FOVIR": { + "category": "SUMMARY_FIELD", + "description": "Oil Voidage Injection Rate" + }, + "FOVIT": { + "category": "SUMMARY_FIELD", + "description": "Oil Voidage Injection Total" + }, + "FOVPR": { + "category": "SUMMARY_FIELD", + "description": "Oil Voidage Production Rate" + }, + "FOVPT": { + "category": "SUMMARY_FIELD", + "description": "Oil Voidage Production Total" + }, + "FOnPR": { + "category": "SUMMARY_FIELD", + "description": "nth separator stage oil rate" + }, + "FOnPT": { + "category": "SUMMARY_FIELD", + "description": "nth separator stage oil total" + }, + "FPPC": { + "category": "SUMMARY_FIELD", + "description": "Initial Contact Corrected Potential" + }, + "FPR": { + "category": "SUMMARY_FIELD", + "description": "Pressure average value" + }, + "FPRGZ": { + "category": "SUMMARY_FIELD", + "description": "P/Z" + }, + "FPRH": { + "category": "SUMMARY_FIELD", + "description": "Pressure average value" + }, + "FPRP": { + "category": "SUMMARY_FIELD", + "description": "Pressure average value" + }, + "FREAC": { + "category": "SUMMARY_FIELD", + "description": "Reaction rate. The reaction number is given as a component index" + }, + "FREAT": { + "category": "SUMMARY_FIELD", + "description": "Reaction total. The reaction number is given as a component index" + }, + "FRGR": { + "category": "SUMMARY_FIELD", + "description": "Re-injection Gas Rate" + }, + "FRGT": { + "category": "SUMMARY_FIELD", + "description": "Re-injection Gas Total" + }, + "FRPV": { + "category": "SUMMARY_FIELD", + "description": "Pore Volume at Reservoir conditions" + }, + "FRS": { + "category": "SUMMARY_FIELD", + "description": "Gas-oil ratio" + }, + "FRTM": { + "category": "SUMMARY_FIELD", + "description": "Transmissibility Multiplier associated with rock compaction" + }, + "FRV": { + "category": "SUMMARY_FIELD", + "description": "Oil-gas ratio" + }, + "FSGR": { + "category": "SUMMARY_FIELD", + "description": "Sales Gas Rate" + }, + "FSGT": { + "category": "SUMMARY_FIELD", + "description": "Sales Gas Total" + }, + "FSIC": { + "category": "SUMMARY_FIELD", + "description": "Salt Injection Concentration" + }, + "FSIP": { + "category": "SUMMARY_FIELD", + "description": "Salt In Place" + }, + "FSIR": { + "category": "SUMMARY_FIELD", + "description": "Salt Injection Rate" + }, + "FSIT": { + "category": "SUMMARY_FIELD", + "description": "Salt Injection Total" + }, + "FSMF": { + "category": "SUMMARY_FIELD", + "description": "Sales Gas Mole Fraction" + }, + "FSPC": { + "category": "SUMMARY_FIELD", + "description": "Salt Production Concentration" + }, + "FSPR": { + "category": "SUMMARY_FIELD", + "description": "Salt Production Rate" + }, + "FSPT": { + "category": "SUMMARY_FIELD", + "description": "Salt Production Total" + }, + "FTADS": { + "category": "SUMMARY_FIELD", + "description": "Tracer Adsorption total" + }, + "FTADSFOA": { + "category": "SUMMARY_FIELD", + "description": "Adsorption total" + }, + "FTADSUR": { + "category": "SUMMARY_FIELD", + "description": "Adsorption total" + }, + "FTCM": { + "category": "SUMMARY_FIELD", + "description": "Tracer Carrier molar Rate" + }, + "FTDCY": { + "category": "SUMMARY_FIELD", + "description": "Decayed tracer" + }, + "FTDCYFOA": { + "category": "SUMMARY_FIELD", + "description": "Decayed tracer" + }, + "FTIC": { + "category": "SUMMARY_FIELD", + "description": "Tracer Injection Concentration" + }, + "FTICF": { + "category": "SUMMARY_FIELD", + "description": "Tracer Injection Concentration" + }, + "FTICHEA": { + "category": "SUMMARY_FIELD", + "description": "Injection Temperature" + }, + "FTICS": { + "category": "SUMMARY_FIELD", + "description": "Tracer Injection Concentration" + }, + "FTIP#": { + "category": "SUMMARY_FIELD", + "description": " Tracer In Place in phase # (1,2,3,...)" + }, + "FTIPF": { + "category": "SUMMARY_FIELD", + "description": "Tracer In Place" + }, + "FTIPS": { + "category": "SUMMARY_FIELD", + "description": "Tracer In Place" + }, + "FTIPT": { + "category": "SUMMARY_FIELD", + "description": "Tracer In Place" + }, + "FTIPTFOA": { + "category": "SUMMARY_FIELD", + "description": "In Solution" + }, + "FTIPTHEA": { + "category": "SUMMARY_FIELD", + "description": "Difference in Energy in place between current and initial time" + }, + "FTIPTSUR": { + "category": "SUMMARY_FIELD", + "description": "In Solution" + }, + "FTIR": { + "category": "SUMMARY_FIELD", + "description": "Tracer Injection Rate" + }, + "FTIRALK": { + "category": "SUMMARY_FIELD", + "description": "Injection Rate" + }, + "FTIRF": { + "category": "SUMMARY_FIELD", + "description": "Tracer Injection Rate" + }, + "FTIRFOA": { + "category": "SUMMARY_FIELD", + "description": "Injection Rate" + }, + "FTIRHEA": { + "category": "SUMMARY_FIELD", + "description": "Energy flows" + }, + "FTIRS": { + "category": "SUMMARY_FIELD", + "description": "Tracer Injection Rate" + }, + "FTIRSUR": { + "category": "SUMMARY_FIELD", + "description": "Injection Rate" + }, + "FTIT": { + "category": "SUMMARY_FIELD", + "description": "Tracer Injection Total" + }, + "FTITALK": { + "category": "SUMMARY_FIELD", + "description": "Injection Total" + }, + "FTITF": { + "category": "SUMMARY_FIELD", + "description": "Tracer Injection Total" + }, + "FTITFOA": { + "category": "SUMMARY_FIELD", + "description": "Injection Total" + }, + "FTITHEA": { + "category": "SUMMARY_FIELD", + "description": "Energy Injection Total" + }, + "FTITS": { + "category": "SUMMARY_FIELD", + "description": "Tracer Injection Total" + }, + "FTITSUR": { + "category": "SUMMARY_FIELD", + "description": "Injection Total" + }, + "FTLM": { + "category": "SUMMARY_FIELD", + "description": "Traced mass liquid total" + }, + "FTMF": { + "category": "SUMMARY_FIELD", + "description": "Traced molar fraction" + }, + "FTML": { + "category": "SUMMARY_FIELD", + "description": "Traced mass liquid rate" + }, + "FTMOBFOA": { + "category": "SUMMARY_FIELD", + "description": "Gas mobility factor" + }, + "FTMR": { + "category": "SUMMARY_FIELD", + "description": "Traced mass Rate" + }, + "FTMT": { + "category": "SUMMARY_FIELD", + "description": "Traced mass Total" + }, + "FTMV": { + "category": "SUMMARY_FIELD", + "description": "Traced mass vapor rate" + }, + "FTPC": { + "category": "SUMMARY_FIELD", + "description": "Tracer Production Concentration" + }, + "FTPCF": { + "category": "SUMMARY_FIELD", + "description": "Tracer Production" + }, + "FTPCHEA": { + "category": "SUMMARY_FIELD", + "description": "Production Temperature" + }, + "FTPCS": { + "category": "SUMMARY_FIELD", + "description": "Tracer Production" + }, + "FTPR": { + "category": "SUMMARY_FIELD", + "description": "Tracer Production Rate" + }, + "FTPRALK": { + "category": "SUMMARY_FIELD", + "description": "Production Rate" + }, + "FTPRF": { + "category": "SUMMARY_FIELD", + "description": "Tracer Production Rate" + }, + "FTPRFOA": { + "category": "SUMMARY_FIELD", + "description": "Production Rate" + }, + "FTPRHEA": { + "category": "SUMMARY_FIELD", + "description": "Energy flows" + }, + "FTPRS": { + "category": "SUMMARY_FIELD", + "description": "Tracer Production Rate" + }, + "FTPRSUR": { + "category": "SUMMARY_FIELD", + "description": "Production Rate" + }, + "FTPT": { + "category": "SUMMARY_FIELD", + "description": "Tracer Production Total" + }, + "FTPTALK": { + "category": "SUMMARY_FIELD", + "description": "Production Total" + }, + "FTPTF": { + "category": "SUMMARY_FIELD", + "description": "Tracer Production Total" + }, + "FTPTFOA": { + "category": "SUMMARY_FIELD", + "description": "Production Total" + }, + "FTPTHEA": { + "category": "SUMMARY_FIELD", + "description": "Energy Production Total" + }, + "FTPTS": { + "category": "SUMMARY_FIELD", + "description": "Tracer Production Total" + }, + "FTPTSUR": { + "category": "SUMMARY_FIELD", + "description": "Production Total" + }, + "FTQR": { + "category": "SUMMARY_FIELD", + "description": "Traced molar Rate" + }, + "FTTL": { + "category": "SUMMARY_FIELD", + "description": "Traced liquid volume total" + }, + "FTTV": { + "category": "SUMMARY_FIELD", + "description": "Traced vapor volume total" + }, + "FTVL": { + "category": "SUMMARY_FIELD", + "description": "Traced liquid volume rate" + }, + "FTVM": { + "category": "SUMMARY_FIELD", + "description": "Traced mass vapor total" + }, + "FTVV": { + "category": "SUMMARY_FIELD", + "description": "Traced vapor volume rate" + }, + "FU": { + "category": "SUMMARY_FIELD", + "description": "User-defined field quantity" + }, + "FVIR": { + "category": "SUMMARY_FIELD", + "description": "Res Volume Injection Rate" + }, + "FVIRT": { + "category": "SUMMARY_FIELD", + "description": "Res Volume Injection Rate Target/Limit" + }, + "FVIT": { + "category": "SUMMARY_FIELD", + "description": "Res Volume Injection Total" + }, + "FVPR": { + "category": "SUMMARY_FIELD", + "description": "Res Volume Production Rate" + }, + "FVPRT": { + "category": "SUMMARY_FIELD", + "description": "Res Volume Production Rate Target/Limit" + }, + "FVPT": { + "category": "SUMMARY_FIELD", + "description": "Res Volume Production Total" + }, + "FWCT": { + "category": "SUMMARY_FIELD", + "description": "Water Cut" + }, + "FWCTH": { + "category": "SUMMARY_FIELD", + "description": "Water Cut History" + }, + "FWGIR": { + "category": "SUMMARY_FIELD", + "description": "Wet Gas Injection Rate" + }, + "FWGIT": { + "category": "SUMMARY_FIELD", + "description": "Wet Gas Injection Total" + }, + "FWGPR": { + "category": "SUMMARY_FIELD", + "description": "Wet Gas Production Rate" + }, + "FWGPRH": { + "category": "SUMMARY_FIELD", + "description": "Wet Gas Production Rate History" + }, + "FWGPT": { + "category": "SUMMARY_FIELD", + "description": "Wet Gas Production Total" + }, + "FWGR": { + "category": "SUMMARY_FIELD", + "description": "Water-Gas Ratio" + }, + "FWGRH": { + "category": "SUMMARY_FIELD", + "description": "Water-Gas Ratio History" + }, + "FWIR": { + "category": "SUMMARY_FIELD", + "description": "Water Injection Rate" + }, + "FWIRH": { + "category": "SUMMARY_FIELD", + "description": "Water Injection Rate History" + }, + "FWIRT": { + "category": "SUMMARY_FIELD", + "description": "Water Injection Rate Target/Limit" + }, + "FWIT": { + "category": "SUMMARY_FIELD", + "description": "Water Injection Total" + }, + "FWITH": { + "category": "SUMMARY_FIELD", + "description": "Water Injection Total History" + }, + "FWMIR": { + "category": "SUMMARY_FIELD", + "description": "Water component molar injection rate" + }, + "FWMIT": { + "category": "SUMMARY_FIELD", + "description": "Water component molar injection total" + }, + "FWMPR": { + "category": "SUMMARY_FIELD", + "description": "Water component molar production rate" + }, + "FWMPT": { + "category": "SUMMARY_FIELD", + "description": "Water component molar production total" + }, + "FWMR": { + "category": "SUMMARY_FIELD", + "description": "Water Mass Rate" + }, + "FWMT": { + "category": "SUMMARY_FIELD", + "description": "Water Mass Total" + }, + "FWPI": { + "category": "SUMMARY_FIELD", + "description": "Water Potential Injection rate" + }, + "FWPI2": { + "category": "SUMMARY_FIELD", + "description": "Water Potential Injection rate" + }, + "FWPIR": { + "category": "SUMMARY_FIELD", + "description": "Ratio of produced water to injected water (percentage)" + }, + "FWPP": { + "category": "SUMMARY_FIELD", + "description": "Water Potential Production rate" + }, + "FWPP2": { + "category": "SUMMARY_FIELD", + "description": "Water Potential Production rate" + }, + "FWPR": { + "category": "SUMMARY_FIELD", + "description": "Water Production Rate" + }, + "FWPRH": { + "category": "SUMMARY_FIELD", + "description": "Water Production Rate History" + }, + "FWPRT": { + "category": "SUMMARY_FIELD", + "description": "Water Production Rate Target/Limit" + }, + "FWPT": { + "category": "SUMMARY_FIELD", + "description": "Water Production Total" + }, + "FWPTH": { + "category": "SUMMARY_FIELD", + "description": "Water Production Total History" + }, + "FWPV": { + "category": "SUMMARY_FIELD", + "description": "Pore Volume containing Water" + }, + "FWSPR": { + "category": "SUMMARY_FIELD", + "description": "Target sustainable rate for most recent sustainable capacity test for water" + }, + "FWSRL": { + "category": "SUMMARY_FIELD", + "description": "Maximum tested rate sustained for the test period during the most recent sustainable capacity test for water" + }, + "FWSRU": { + "category": "SUMMARY_FIELD", + "description": "Minimum tested rate not sustained for the test period during the most recent sustainable capacity test for water" + }, + "FWSSP": { + "category": "SUMMARY_FIELD", + "description": "Period for which target sustainable rate could be maintained for the most recent sustainable capacity test for water" + }, + "FWSTP": { + "category": "SUMMARY_FIELD", + "description": "Test period for the most recent sustainable capacity test for water" + }, + "FWVIR": { + "category": "SUMMARY_FIELD", + "description": "Water Voidage Injection Rate" + }, + "FWVIT": { + "category": "SUMMARY_FIELD", + "description": "Water Voidage Injection Total" + }, + "FWVPR": { + "category": "SUMMARY_FIELD", + "description": "Water Voidage Production Rate" + }, + "FWVPT": { + "category": "SUMMARY_FIELD", + "description": "Water Voidage Production Total" + }, + "FXMF": { + "category": "SUMMARY_FIELD", + "description": "Liquid Mole Fraction" + }, + "FXMFG": { + "category": "SUMMARY_FIELD", + "description": "Liquid mole fraction" + }, + "FXMFn": { + "category": "SUMMARY_FIELD", + "description": "Liquid Mole Fraction for nth separator stage" + }, + "FYMF": { + "category": "SUMMARY_FIELD", + "description": "Vapor Mole Fraction" + }, + "FYMFG": { + "category": "SUMMARY_FIELD", + "description": "Vapor mole fraction" + }, + "FYMFn": { + "category": "SUMMARY_FIELD", + "description": "Vapor Mole Fraction for nth separator stage" + }, + "FZMF": { + "category": "SUMMARY_FIELD", + "description": "Total Mole Fraction" + }, + "GALQ": { + "category": "SUMMARY_WELL_GROUP", + "description": "ALQ in the group's or node's outlet branch in the production network" + }, + "GAMF": { + "category": "SUMMARY_WELL_GROUP", + "description": "Component aqueous mole fraction, from producing completions" + }, + "GAMR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Make-up gas rate" + }, + "GAMT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Make-up gas total" + }, + "GAPI": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil API" + }, + "GCGMR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Hydrocarbon component" + }, + "GCGMRG": { + "category": "SUMMARY_WELL_GROUP", + "description": "Hydrocarbon component molar rates in the gas phase" + }, + "GCGMRn": { + "category": "SUMMARY_WELL_GROUP", + "description": "Hydrocarbon component molar rates in the gas phase for nth separator stage" + }, + "GCGMT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Hydrocarbon component" + }, + "GCGRn": { + "category": "SUMMARY_WELL_GROUP", + "description": "Hydrocarbon component molar rates in the gas phase for nth separator stage" + }, + "GCHMR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Hydrocarbon Component" + }, + "GCHMT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Hydrocarbon Component" + }, + "GCIC": { + "category": "SUMMARY_WELL_GROUP", + "description": "Polymer Injection Concentration" + }, + "GCIR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Polymer Injection Rate" + }, + "GCIT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Polymer Injection Total" + }, + "GCMIR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Hydrocarbon Component Molar Injection Rates" + }, + "GCMIT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Hydrocarbon Component Molar Injection Totals" + }, + "GCMPR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Hydrocarbon Component Molar Production Rates" + }, + "GCMPT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Hydrocarbon Component" + }, + "GCNMR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Hydrocarbon component molar rates in the NGL phase" + }, + "GCNMRG": { + "category": "SUMMARY_WELL_GROUP", + "description": "Hydrocarbon component molar rates in the NGL phase" + }, + "GCNWR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Hydrocarbon component mass rates in the NGL phase" + }, + "GCOMR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Hydrocarbon component" + }, + "GCOMRG": { + "category": "SUMMARY_WELL_GROUP", + "description": "Hydrocarbon component" + }, + "GCOMRn": { + "category": "SUMMARY_WELL_GROUP", + "description": "Hydrocarbon component" + }, + "GCOMT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Hydrocarbon component" + }, + "GCORn": { + "category": "SUMMARY_WELL_GROUP", + "description": "Hydrocarbon component" + }, + "GCPC": { + "category": "SUMMARY_WELL_GROUP", + "description": "Polymer Production Concentration" + }, + "GCPR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Polymer Production Rate" + }, + "GCPT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Polymer Production Total" + }, + "GCWGIR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Hydrocarbon Component Wet Gas Injection Rate" + }, + "GCWGIT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Hydrocarbon Component Wet Gas Injection Total" + }, + "GCWGPR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Hydrocarbon Component Wet Gas Production Rate" + }, + "GCWGPT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Hydrocarbon Component Wet Gas Production Total" + }, + "GEDC": { + "category": "SUMMARY_WELL_GROUP", + "description": "Energy Delivery Capacity" + }, + "GEDCQ": { + "category": "SUMMARY_WELL_GROUP", + "description": "Energy DCQ" + }, + "GEFF": { + "category": "SUMMARY_WELL_GROUP", + "description": "Efficiency Factor" + }, + "GEGR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Export Gas Rate" + }, + "GEGT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Export Gas Total" + }, + "GEMF": { + "category": "SUMMARY_WELL_GROUP", + "description": "Export Gas Mole Fraction" + }, + "GEOMF": { + "category": "SUMMARY_WELL_GROUP", + "description": "Export Oil Mole Fraction" + }, + "GEOR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Export Oil Rate" + }, + "GEOT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Export Oil Total" + }, + "GEPR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Energy Production Rate" + }, + "GEPT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Energy Production Total" + }, + "GESR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Energy Sales Rate" + }, + "GEST": { + "category": "SUMMARY_WELL_GROUP", + "description": "Energy Sales Total" + }, + "GEXGR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Excess Gas Rate" + }, + "GEXGT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Excess Gas Total" + }, + "GFGR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Fuel Gas Rate, at and below this group" + }, + "GFGT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Fuel Gas cumulative Total, at and below this group" + }, + "GFMF": { + "category": "SUMMARY_WELL_GROUP", + "description": "Fuel Gas Mole Fraction" + }, + "GGCR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Consumption Rate, at and below this group" + }, + "GGCT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Consumption Total, at and below this group" + }, + "GGCV": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Calorific Value" + }, + "GGDC": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Delivery Capacity" + }, + "GGDCQ": { + "category": "SUMMARY_WELL_GROUP", + "description": "Field/Group Gas DCQ" + }, + "GGDN": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Density at Surface Conditions" + }, + "GGIGR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Injection Guide Rate" + }, + "GGIMR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Import Rate, at and below this group" + }, + "GGIMT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Import Total, at and below this group" + }, + "GGIR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Injection Rate" + }, + "GGIRH": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Injection Rate History" + }, + "GGIRL": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Injection Rate Target/Limit" + }, + "GGIRNB": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas flow rate along the group's or node's inlet branch in the gas injection network" + }, + "GGIRT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Injection Rate Target/Limit" + }, + "GGIT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Injection Total" + }, + "GGITH": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Injection Total History" + }, + "GGLIR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Lift Injection Rate" + }, + "GGLIT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Lift Injection Total" + }, + "GGLR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas-Liquid Ratio" + }, + "GGLRH": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas-Liquid Ratio History" + }, + "GGMNR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Group or node minimum gas rate as specified with GNETDP in the production network" + }, + "GGMR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Mass Rate" + }, + "GGMT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Mass Total" + }, + "GGMXR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Group or node maximum gas rate as specified with GNETDP in the production network" + }, + "GGOR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas-Oil Ratio" + }, + "GGORH": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas-Oil Ratio History" + }, + "GGPGR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Production Guide Rate" + }, + "GGPI": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Potential Injection rate" + }, + "GGPI2": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Potential Injection rate" + }, + "GGPP": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Potential Production rate" + }, + "GGPP2": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Potential Production rate" + }, + "GGPPF": { + "category": "SUMMARY_WELL_GROUP", + "description": "Free Gas Potential Production rate" + }, + "GGPPF2": { + "category": "SUMMARY_WELL_GROUP", + "description": "Free Gas Potential Production rate" + }, + "GGPPS": { + "category": "SUMMARY_WELL_GROUP", + "description": "Solution" + }, + "GGPPS2": { + "category": "SUMMARY_WELL_GROUP", + "description": "Solution" + }, + "GGPR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Production Rate" + }, + "GGPR1": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Production Rate above GOC" + }, + "GGPR2": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Production Rate below GOC" + }, + "GGPRA": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Production Rate above" + }, + "GGPRB": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Production Rate below" + }, + "GGPRF": { + "category": "SUMMARY_WELL_GROUP", + "description": "Free Gas Production Rate" + }, + "GGPRG": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas production rate" + }, + "GGPRH": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Production Rate History" + }, + "GGPRL": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Production Rate Target/Limit" + }, + "GGPRNB": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas flow rate along the group's or node's outlet branch in the production network" + }, + "GGPRNBFP": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas flow rate along Group's or node's outlet branch in network, from end of First Pass" + }, + "GGPRS": { + "category": "SUMMARY_WELL_GROUP", + "description": "Solution Gas Production Rate" + }, + "GGPRT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Production Rate Target/Limit" + }, + "GGPT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Production Total" + }, + "GGPT1": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Production Total above GOC" + }, + "GGPT2": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Production Total below GOC" + }, + "GGPTA": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Production Total above" + }, + "GGPTB": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Production Total below" + }, + "GGPTF": { + "category": "SUMMARY_WELL_GROUP", + "description": "Free Gas Production Total" + }, + "GGPTH": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Production Total History" + }, + "GGPTS": { + "category": "SUMMARY_WELL_GROUP", + "description": "Solution Gas Production Total" + }, + "GGQ": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Quality" + }, + "GGSPR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Target sustainable rate for most recent sustainable capacity test for gas" + }, + "GGSR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Sales Gas Rate" + }, + "GGSRL": { + "category": "SUMMARY_WELL_GROUP", + "description": "Maximum tested rate sustained for the test period during the most recent sustainable capacity test for gas" + }, + "GGSRU": { + "category": "SUMMARY_WELL_GROUP", + "description": "Minimum tested rate not sustained for the test period during the most recent sustainable capacity test for gas" + }, + "GGSSP": { + "category": "SUMMARY_WELL_GROUP", + "description": "Period for which target sustainable rate could be maintained for the most recent sustainable capacity test for gas" + }, + "GGST": { + "category": "SUMMARY_WELL_GROUP", + "description": "Sales Gas Total" + }, + "GGSTP": { + "category": "SUMMARY_WELL_GROUP", + "description": "Test period for the most recent sustainable capacity test for gas" + }, + "GGVIR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Voidage Injection Rate" + }, + "GGVIT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Voidage Injection Total" + }, + "GGVPR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Voidage Production Rate" + }, + "GGVPT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Gas Voidage Production Total" + }, + "GGnPR": { + "category": "SUMMARY_WELL_GROUP", + "description": "nth separator stage gas rate" + }, + "GGnPT": { + "category": "SUMMARY_WELL_GROUP", + "description": "nth separator stage gas total" + }, + "GHMIR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Hydrocarbon Molar Injection Rate" + }, + "GHMIT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Hydrocarbon Molar Injection Total" + }, + "GHMPR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Hydrocarbon Molar Production Rate" + }, + "GHMPT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Hydrocarbon Molar Production Total" + }, + "GLMNR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Group or node minimum liquid rate as specified with GNETDP in the production network" + }, + "GLMXR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Group or node maximum liquid rate as specified with GNETDP in the production network" + }, + "GLPR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Liquid Production Rate" + }, + "GLPRH": { + "category": "SUMMARY_WELL_GROUP", + "description": "Liquid Production Rate History" + }, + "GLPRL": { + "category": "SUMMARY_WELL_GROUP", + "description": "Liquid Production Rate Target/Limit" + }, + "GLPRNB": { + "category": "SUMMARY_WELL_GROUP", + "description": "Liquid flow rate along the group's or node's outlet branch in the production network" + }, + "GLPRT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Liquid Production Rate Target/Limit" + }, + "GLPT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Liquid Production Total" + }, + "GLPTH": { + "category": "SUMMARY_WELL_GROUP", + "description": "Liquid Production Total History" + }, + "GMCPL": { + "category": "SUMMARY_WELL_GROUP", + "description": "Group Multi-level Compressor Level" + }, + "GMCTG": { + "category": "SUMMARY_WELL_GROUP", + "description": "Mode of Control for group Gas Injection" + }, + "GMCTP": { + "category": "SUMMARY_WELL_GROUP", + "description": "Mode of Control for group Production" + }, + "GMCTW": { + "category": "SUMMARY_WELL_GROUP", + "description": "Mode of Control for group Water Injection" + }, + "GMIR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Methane Injection Rate" + }, + "GMIT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Methane Injection Total" + }, + "GMNP": { + "category": "SUMMARY_WELL_GROUP", + "description": "Group or node minimum pressure as specified with GNETDP in the production network" + }, + "GMPR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Methane Production Rate" + }, + "GMPT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Methane Production Total" + }, + "GMUF": { + "category": "SUMMARY_WELL_GROUP", + "description": "Make-up fraction" + }, + "GMWDR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Number of drilling events this timestep" + }, + "GMWDT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Number of drilling events in total" + }, + "GMWIA": { + "category": "SUMMARY_WELL_GROUP", + "description": "Number of abandoned injection wells" + }, + "GMWIG": { + "category": "SUMMARY_WELL_GROUP", + "description": "Number of injectors on group control" + }, + "GMWIN": { + "category": "SUMMARY_WELL_GROUP", + "description": "Number of injection wells currently flowing" + }, + "GMWIP": { + "category": "SUMMARY_WELL_GROUP", + "description": "Number of injectors on pressure control" + }, + "GMWIS": { + "category": "SUMMARY_WELL_GROUP", + "description": "Number of injectors on own surface rate limit control" + }, + "GMWIT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Total number of injection wells" + }, + "GMWIU": { + "category": "SUMMARY_WELL_GROUP", + "description": "Number of unused injection wells" + }, + "GMWIV": { + "category": "SUMMARY_WELL_GROUP", + "description": "Number of injectors on own reservoir volume rate limit control" + }, + "GMWPA": { + "category": "SUMMARY_WELL_GROUP", + "description": "Number of abandoned production wells" + }, + "GMWPG": { + "category": "SUMMARY_WELL_GROUP", + "description": "Number of producers on group control" + }, + "GMWPL": { + "category": "SUMMARY_WELL_GROUP", + "description": "Number of producers using artificial lift" + }, + "GMWPO": { + "category": "SUMMARY_WELL_GROUP", + "description": "Number of producers controlled by own oil rate limit" + }, + "GMWPP": { + "category": "SUMMARY_WELL_GROUP", + "description": "Number of producers on pressure control" + }, + "GMWPR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Number of production wells currently flowing" + }, + "GMWPS": { + "category": "SUMMARY_WELL_GROUP", + "description": "Number of producers on own surface rate limit control" + }, + "GMWPT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Total number of production wells" + }, + "GMWPU": { + "category": "SUMMARY_WELL_GROUP", + "description": "Number of unused production wells" + }, + "GMWPV": { + "category": "SUMMARY_WELL_GROUP", + "description": "Number of producers on own reservoir volume rate limit control" + }, + "GMWWO": { + "category": "SUMMARY_WELL_GROUP", + "description": "Number of workover events this timestep" + }, + "GMWWT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Number of workover events in total" + }, + "GMXP": { + "category": "SUMMARY_WELL_GROUP", + "description": "Group or node maximum pressure as specified with GNETDP in the production network" + }, + "GNIR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Solvent Injection Rate" + }, + "GNIT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Solvent Injection Total" + }, + "GNLPR": { + "category": "SUMMARY_WELL_GROUP", + "description": "NGL Production Rate" + }, + "GNLPRG": { + "category": "SUMMARY_WELL_GROUP", + "description": "NGL production rate" + }, + "GNLPRH": { + "category": "SUMMARY_WELL_GROUP", + "description": "NGL Production Rate History" + }, + "GNLPT": { + "category": "SUMMARY_WELL_GROUP", + "description": "NGL Production Total" + }, + "GNLPTH": { + "category": "SUMMARY_WELL_GROUP", + "description": "NGL Production Total History" + }, + "GNPR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Solvent Production Rate" + }, + "GNPT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Solvent Production Total" + }, + "GODN": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Density at Surface Conditions" + }, + "GOGR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil-Gas Ratio" + }, + "GOGRH": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil-Gas Ratio History" + }, + "GOIGR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Injection Guide Rate" + }, + "GOIR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Injection Rate" + }, + "GOIRH": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Injection Rate History" + }, + "GOIRL": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Injection Rate Target/Limit" + }, + "GOIRT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Injection Rate Target/Limit" + }, + "GOIT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Injection Total" + }, + "GOITH": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Injection Total History" + }, + "GOMNR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Group or node minimum oil rate as specified with GNETDP in the production network" + }, + "GOMR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Mass Rate" + }, + "GOMT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Mass Total" + }, + "GOMXR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Group or node maximum oil rate as specified with GNETDP in the production network" + }, + "GOPGR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Production Guide Rate" + }, + "GOPI": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Potential Injection rate" + }, + "GOPI2": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Potential Injection rate" + }, + "GOPP": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Potential Production rate" + }, + "GOPP2": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Potential Production rate" + }, + "GOPR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Production Rate" + }, + "GOPR1": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Production Rate above GOC" + }, + "GOPR2": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Production Rate below GOC" + }, + "GOPRA": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Production Rate above GOC" + }, + "GOPRB": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Production Rate below GOC" + }, + "GOPRF": { + "category": "SUMMARY_WELL_GROUP", + "description": "Free Oil Production Rate" + }, + "GOPRG": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil production rate" + }, + "GOPRH": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Production Rate History" + }, + "GOPRL": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Production Rate Target/Limit" + }, + "GOPRNB": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil flow rate along the group's or node's outlet branch in the production network" + }, + "GOPRS": { + "category": "SUMMARY_WELL_GROUP", + "description": "Solution Oil Production Rate" + }, + "GOPRT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Production Rate Target/Limit" + }, + "GOPT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Production Total" + }, + "GOPT1": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Production Total above GOC" + }, + "GOPT2": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Production Total below GOC" + }, + "GOPTA": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Production Total above GOC" + }, + "GOPTB": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Production Total below GOC" + }, + "GOPTF": { + "category": "SUMMARY_WELL_GROUP", + "description": "Free Oil Production Total" + }, + "GOPTH": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Production Total History" + }, + "GOPTS": { + "category": "SUMMARY_WELL_GROUP", + "description": "Solution Oil Production Total" + }, + "GOSPR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Target sustainable rate for most recent sustainable capacity test for oil" + }, + "GOSRL": { + "category": "SUMMARY_WELL_GROUP", + "description": "Maximum tested rate sustained for the test period during the most recent sustainable capacity test for oil" + }, + "GOSRU": { + "category": "SUMMARY_WELL_GROUP", + "description": "Minimum tested rate not sustained for the test period during the most recent sustainable capacity test for oil" + }, + "GOSSP": { + "category": "SUMMARY_WELL_GROUP", + "description": "Period for which target sustainable rate could be maintained for the most recent sustainable capacity test for oil" + }, + "GOSTP": { + "category": "SUMMARY_WELL_GROUP", + "description": "Test period for the most recent sustainable capacity test for oil" + }, + "GOVIR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Voidage Injection Rate" + }, + "GOVIT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Voidage Injection Total" + }, + "GOVPR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Voidage Production Rate" + }, + "GOVPT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Oil Voidage Production Total" + }, + "GOnPR": { + "category": "SUMMARY_WELL_GROUP", + "description": "nth separator stage oil rate" + }, + "GOnPT": { + "category": "SUMMARY_WELL_GROUP", + "description": "nth separator stage oil total" + }, + "GPR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Group nodal Pressure in network" + }, + "GPRB": { + "category": "SUMMARY_WELL_GROUP", + "description": "Pressure drop along the group's or node's outlet branch in the production network" + }, + "GPRBG": { + "category": "SUMMARY_WELL_GROUP", + "description": "Pressure drop along the group's or node's inlet branch in the gas injection network" + }, + "GPRBW": { + "category": "SUMMARY_WELL_GROUP", + "description": "Pressure drop along the group's or node's inlet branch in the water injection network" + }, + "GPRDC": { + "category": "SUMMARY_WELL_GROUP", + "description": "Group Pressure at Delivery Capacity" + }, + "GPRDEC": { + "category": "SUMMARY_WELL_GROUP", + "description": "Group or node pressure decrement as specified with GNETDP in the production network" + }, + "GPRFP": { + "category": "SUMMARY_WELL_GROUP", + "description": "Group or node Pressure in network from end of First Pass" + }, + "GPRG": { + "category": "SUMMARY_WELL_GROUP", + "description": "Group or node Pressure in the gas injection network" + }, + "GPRINC": { + "category": "SUMMARY_WELL_GROUP", + "description": "Group or node pressure increment as specified with GNETDP in the production network" + }, + "GPRW": { + "category": "SUMMARY_WELL_GROUP", + "description": "Group or node Pressure in the water injection network" + }, + "GRGR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Re-injection Gas Rate" + }, + "GRGT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Re-injection Gas Total" + }, + "GSGR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Sales Gas Rate" + }, + "GSGT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Sales Gas Total" + }, + "GSIC": { + "category": "SUMMARY_WELL_GROUP", + "description": "Salt Injection Concentration" + }, + "GSIR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Salt Injection Rate" + }, + "GSIT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Salt Injection Total" + }, + "GSMF": { + "category": "SUMMARY_WELL_GROUP", + "description": "Sales Gas Mole Fraction" + }, + "GSPC": { + "category": "SUMMARY_WELL_GROUP", + "description": "Salt Production Concentration" + }, + "GSPR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Salt Production Rate" + }, + "GSPT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Salt Production Total" + }, + "GTCM": { + "category": "SUMMARY_WELL_GROUP", + "description": "Tracer Carrier molar Rate" + }, + "GTIC": { + "category": "SUMMARY_WELL_GROUP", + "description": "Tracer Injection Concentration" + }, + "GTICF": { + "category": "SUMMARY_WELL_GROUP", + "description": "Tracer Injection Concentration" + }, + "GTICHEA": { + "category": "SUMMARY_WELL_GROUP", + "description": "Injection Temperature" + }, + "GTICS": { + "category": "SUMMARY_WELL_GROUP", + "description": "Tracer Injection Concentration" + }, + "GTIR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Tracer Injection Rate" + }, + "GTIRALK": { + "category": "SUMMARY_WELL_GROUP", + "description": "Injection Rate" + }, + "GTIRANI": { + "category": "SUMMARY_FIELD", + "description": "Anion Injection Rate" + }, + "GTIRCAT": { + "category": "SUMMARY_FIELD", + "description": "Cation Injection Rate" + }, + "GTIRF": { + "category": "SUMMARY_WELL_GROUP", + "description": "Tracer Injection Rate" + }, + "GTIRFOA": { + "category": "SUMMARY_WELL_GROUP", + "description": "Injection Rate" + }, + "GTIRHEA": { + "category": "SUMMARY_WELL_GROUP", + "description": "Energy flows" + }, + "GTIRS": { + "category": "SUMMARY_WELL_GROUP", + "description": "Tracer Injection Rate" + }, + "GTIRSUR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Injection Rate" + }, + "GTIT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Tracer Injection Total" + }, + "GTITALK": { + "category": "SUMMARY_WELL_GROUP", + "description": "Injection Total" + }, + "GTITANI": { + "category": "SUMMARY_FIELD", + "description": "Anion Injection Total" + }, + "GTITCAT": { + "category": "SUMMARY_FIELD", + "description": "Cation Injection Total" + }, + "GTITF": { + "category": "SUMMARY_WELL_GROUP", + "description": "Tracer Injection Total" + }, + "GTITFOA": { + "category": "SUMMARY_WELL_GROUP", + "description": "Injection Total" + }, + "GTITHEA": { + "category": "SUMMARY_WELL_GROUP", + "description": "Energy Injection Total" + }, + "GTITS": { + "category": "SUMMARY_WELL_GROUP", + "description": "Tracer Injection Total" + }, + "GTITSUR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Injection Total" + }, + "GTLM": { + "category": "SUMMARY_WELL_GROUP", + "description": "Traced mass liquid total" + }, + "GTMF": { + "category": "SUMMARY_WELL_GROUP", + "description": "Traced molar fraction" + }, + "GTML": { + "category": "SUMMARY_WELL_GROUP", + "description": "Traced mass liquid rate" + }, + "GTMR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Traced mass Rate" + }, + "GTMT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Traced mass Total" + }, + "GTMV": { + "category": "SUMMARY_WELL_GROUP", + "description": "Traced mass vapor rate" + }, + "GTPC": { + "category": "SUMMARY_WELL_GROUP", + "description": "Tracer Production Concentration" + }, + "GTPCF": { + "category": "SUMMARY_WELL_GROUP", + "description": "Tracer Production" + }, + "GTPCHEA": { + "category": "SUMMARY_WELL_GROUP", + "description": "Production Temperature" + }, + "GTPCS": { + "category": "SUMMARY_WELL_GROUP", + "description": "Tracer Production" + }, + "GTPR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Tracer Production Rate" + }, + "GTPRALK": { + "category": "SUMMARY_WELL_GROUP", + "description": "Production Rate" + }, + "GTPRANI": { + "category": "SUMMARY_FIELD", + "description": "Anion Production Rate" + }, + "GTPRCAT": { + "category": "SUMMARY_FIELD", + "description": "Cation Production Rate" + }, + "GTPRF": { + "category": "SUMMARY_WELL_GROUP", + "description": "Tracer Production Rate" + }, + "GTPRFOA": { + "category": "SUMMARY_WELL_GROUP", + "description": "Production Rate" + }, + "GTPRHEA": { + "category": "SUMMARY_WELL_GROUP", + "description": "Energy flows" + }, + "GTPRS": { + "category": "SUMMARY_WELL_GROUP", + "description": "Tracer Production Rate" + }, + "GTPRSUR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Production Rate" + }, + "GTPT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Tracer Production Total" + }, + "GTPTALK": { + "category": "SUMMARY_WELL_GROUP", + "description": "Production Total" + }, + "GTPTANI": { + "category": "SUMMARY_FIELD", + "description": "Anion Production Total" + }, + "GTPTCAT": { + "category": "SUMMARY_FIELD", + "description": "Cation Production Total" + }, + "GTPTF": { + "category": "SUMMARY_WELL_GROUP", + "description": "Tracer Production Total" + }, + "GTPTFOA": { + "category": "SUMMARY_WELL_GROUP", + "description": "Production Total" + }, + "GTPTHEA": { + "category": "SUMMARY_WELL_GROUP", + "description": "Energy Production Total" + }, + "GTPTS": { + "category": "SUMMARY_WELL_GROUP", + "description": "Tracer Production Total" + }, + "GTPTSUR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Production Total" + }, + "GTQR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Traced molar Rate" + }, + "GTTL": { + "category": "SUMMARY_WELL_GROUP", + "description": "Traced liquid volume total" + }, + "GTTV": { + "category": "SUMMARY_WELL_GROUP", + "description": "Traced vapor volume total" + }, + "GTVL": { + "category": "SUMMARY_WELL_GROUP", + "description": "Traced liquid volume rate" + }, + "GTVM": { + "category": "SUMMARY_WELL_GROUP", + "description": "Traced mass vapor total" + }, + "GTVV": { + "category": "SUMMARY_WELL_GROUP", + "description": "Traced vapor volume rate" + }, + "GU": { + "category": "SUMMARY_WELL_GROUP", + "description": "User-defined group quantity" + }, + "GVIR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Res Volume Injection Rate" + }, + "GVIRL": { + "category": "SUMMARY_WELL_GROUP", + "description": "Res Volume Injection Rate Target/Limit" + }, + "GVIRT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Res Volume Injection Rate Target/Limit" + }, + "GVIT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Res Volume Injection Total" + }, + "GVPGR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Res Volume Production Guide Rate" + }, + "GVPR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Res Volume Production Rate" + }, + "GVPRL": { + "category": "SUMMARY_WELL_GROUP", + "description": "Res Volume Production Rate Target/Limit" + }, + "GVPRT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Res Volume Production Rate Target/Limit" + }, + "GVPT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Res Volume Production Total" + }, + "GWCT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water Cut" + }, + "GWCTH": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water Cut History" + }, + "GWGIR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Wet Gas Injection Rate" + }, + "GWGIT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Wet Gas Injection Total" + }, + "GWGPR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Wet Gas Production Rate" + }, + "GWGPRH": { + "category": "SUMMARY_WELL_GROUP", + "description": "Wet Gas Production Rate History" + }, + "GWGPT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Wet Gas Production Total" + }, + "GWGR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water-Gas Ratio" + }, + "GWGRH": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water-Gas Ratio History" + }, + "GWIGR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water Injection Guide Rate" + }, + "GWIR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water Injection Rate" + }, + "GWIRH": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water Injection Rate History" + }, + "GWIRL": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water Injection Rate Target/Limit" + }, + "GWIRNB": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water flow rate along the group's or node's inlet branch in the water injection network" + }, + "GWIRT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water Injection Rate Target/Limit" + }, + "GWIT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water Injection Total" + }, + "GWITH": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water Injection Total History" + }, + "GWMIR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water component molar injection rate" + }, + "GWMIT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water component molar injection total" + }, + "GWMNR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Group or node minimum water rate as specified with GNETDP in the production network" + }, + "GWMPR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water component molar production rate" + }, + "GWMPT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water component molar production total" + }, + "GWMR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water Mass Rate" + }, + "GWMT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water Mass Total" + }, + "GWMXR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Group or node maximum water rate as specified with GNETDP in the production network" + }, + "GWPGR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water Production Guide Rate" + }, + "GWPI": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water Potential Injection rate" + }, + "GWPI2": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water Potential Injection rate" + }, + "GWPIR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Ratio of produced water to injected water (percentage)" + }, + "GWPP": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water Potential Production rate" + }, + "GWPP2": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water Potential Production rate" + }, + "GWPR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water Production Rate" + }, + "GWPRH": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water Production Rate History" + }, + "GWPRL": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water Production Rate Target/Limit" + }, + "GWPRNB": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water flow rate along the group's or node's outlet branch in the production network" + }, + "GWPRT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water Production Rate Target/Limit" + }, + "GWPT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water Production Total" + }, + "GWPTH": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water Production Total History" + }, + "GWSPR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Target sustainable rate for most recent sustainable capacity test for water" + }, + "GWSRL": { + "category": "SUMMARY_WELL_GROUP", + "description": "Maximum tested rate sustained for the test period during the most recent sustainable capacity test for water" + }, + "GWSRU": { + "category": "SUMMARY_WELL_GROUP", + "description": "Minimum tested rate not sustained for the test period during the most recent sustainable capacity test for water" + }, + "GWSSP": { + "category": "SUMMARY_WELL_GROUP", + "description": "Period for which target sustainable rate could be maintained for the most recent sustainable capacity test for water" + }, + "GWSTP": { + "category": "SUMMARY_WELL_GROUP", + "description": "Test period for the most recent sustainable capacity test for water" + }, + "GWVIR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water Voidage Injection Rate" + }, + "GWVIT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water Voidage Injection Total" + }, + "GWVPR": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water Voidage Production Rate" + }, + "GWVPT": { + "category": "SUMMARY_WELL_GROUP", + "description": "Water Voidage Production Total" + }, + "GXMF": { + "category": "SUMMARY_WELL_GROUP", + "description": "Liquid Mole Fraction" + }, + "GXMFG": { + "category": "SUMMARY_WELL_GROUP", + "description": "Liquid mole fraction" + }, + "GXMFn": { + "category": "SUMMARY_WELL_GROUP", + "description": "Liquid Mole Fraction for nth separator stage" + }, + "GYMF": { + "category": "SUMMARY_WELL_GROUP", + "description": "Vapor Mole Fraction" + }, + "GYMFG": { + "category": "SUMMARY_WELL_GROUP", + "description": "Vapor mole fraction" + }, + "GYMFn": { + "category": "SUMMARY_WELL_GROUP", + "description": "Vapor Mole Fraction for nth separator stage" + }, + "GZMF": { + "category": "SUMMARY_WELL_GROUP", + "description": "Total Mole Fraction" + }, + "LBCTRA_X": { + "category": "SUMMARY_BLOCK", + "description": "Tracer concentration interpolated at a defined coordinate within a local grid" + }, + "LBHDF_X": { + "category": "SUMMARY_BLOCK", + "description": "Hydraulic head at freshwater conditions interpolated at a defined coordinate within a local grid" + }, + "LBHD_X": { + "category": "SUMMARY_BLOCK", + "description": "Hydraulic head interpolated at a defined coordinate within a local grid" + }, + "LBPR_X": { + "category": "SUMMARY_BLOCK", + "description": "Pressure interpolated at a defined coordinate within a local grid" + }, + "LBSCN_X": { + "category": "SUMMARY_BLOCK", + "description": "Brine concentration interpolated at a defined coordinate within a local grid" + }, + "LCGFRU": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "As CGFRU but for local grids" + }, + "LCOFRU": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "As COFRU but for local grids" + }, + "LCWFRU": { + "category": "SUMMARY_WELL_COMPLETION", + "description": "As CWFRU but for local grids" + }, + "MLINEARS": { + "category": "SUMMARY_MISC", + "description": "Number linear iterations for each timestep" + }, + "MONTH": { + "category": "SUMMARY_MISC", + "description": "Month" + }, + "MSUMLINS": { + "category": "SUMMARY_MISC", + "description": "Total number of linear iterations since the start of the run" + }, + "MSUMNEWT": { + "category": "SUMMARY_MISC", + "description": "Total number of Newton iterations since the start of the run" + }, + "NBAKFL": { + "category": "SUMMARY_MISC", + "description": "Number of calls to scalar fallback routines" + }, + "NBYTOT": { + "category": "SUMMARY_MISC", + "description": "Peak usage of dynamically allocated memory" + }, + "NCPRLINS": { + "category": "SUMMARY_MISC", + "description": "Average number of pressure iterations" + }, + "NEWTFL": { + "category": "SUMMARY_MISC", + "description": "Cumulative average Newton iterations" + }, + "NEWTON": { + "category": "SUMMARY_MISC", + "description": "Number of Newton iterations used for each timestep" + }, + "NGOPAS": { + "category": "SUMMARY_WELL", + "description": "Number of iterations to converge DCQ in first pass" + }, + "NLINEARP": { + "category": "SUMMARY_MISC", + "description": "Average number of pressure iterations" + }, + "NLINEARS": { + "category": "SUMMARY_MISC", + "description": "Average number of linear iterations" + }, + "NLINSMAX": { + "category": "SUMMARY_MISC", + "description": "Actual maximum number of linear iterations" + }, + "NLINSMIN": { + "category": "SUMMARY_MISC", + "description": "Actual minimum number of linear iterations" + }, + "NLRESMAX": { + "category": "SUMMARY_MISC", + "description": "Maximum element of the non-linear residual" + }, + "NLRESSUM": { + "category": "SUMMARY_MISC", + "description": "Sum of the non-linear residual" + }, + "NMESSAGE": { + "category": "SUMMARY_MISC", + "description": "Requests a set of message data vectors for the run" + }, + "NNUMFL": { + "category": "SUMMARY_MISC", + "description": "Total number of two phase flash calculations performed" + }, + "NNUMST": { + "category": "SUMMARY_MISC", + "description": "Total number of stability tests performed" + }, + "NTS": { + "category": "SUMMARY_MISC", + "description": "Number of timesteps taken" + }, + "NTSECL": { + "category": "SUMMARY_MISC", + "description": "Number of energy density solution converged last" + }, + "NTSMCL": { + "category": "SUMMARY_MISC", + "description": "Number of molar density solution converged last" + }, + "NTSPCL": { + "category": "SUMMARY_MISC", + "description": "Number of pressure solution converged last" + }, + "PSSPR": { + "category": "SUMMARY_FIELD", + "description": "Log of the pressure change per unit time" + }, + "PSSSC": { + "category": "SUMMARY_FIELD", + "description": "Log of the salt concentration change per unit time" + }, + "PSSSG": { + "category": "SUMMARY_FIELD", + "description": "Log of the gas saturation change per unit time" + }, + "PSSSO": { + "category": "SUMMARY_FIELD", + "description": "Log of the oil saturation change per unit time" + }, + "PSSSW": { + "category": "SUMMARY_FIELD", + "description": "Log of the water saturation change per unit time" + }, + "RAPI": { + "category": "SUMMARY_REGION", + "description": "Oil API" + }, + "RCAD": { + "category": "SUMMARY_REGION", + "description": "Polymer Adsorption total" + }, + "RCFT": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Polymer inter-region Flow Total" + }, + "RCGC": { + "category": "SUMMARY_REGION", + "description": "Bulk Coal Gas Concentration" + }, + "RCIP": { + "category": "SUMMARY_REGION", + "description": "Polymer In Solution" + }, + "RCSC": { + "category": "SUMMARY_REGION", + "description": "Bulk Coal Solvent Concentration" + }, + "RGFR": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Inter-region gas flow rate" + }, + "RGFR+": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Inter-region gas flow rate" + }, + "RGFR-": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Inter-region gas flow rate" + }, + "RGFT": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Inter-region gas flow total)" + }, + "RGFT+": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Inter-region gas flow total" + }, + "RGFT-": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Inter-region gas flow total" + }, + "RGFTG": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Inter-region gas flow total" + }, + "RGFTL": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Inter-region gas flow total" + }, + "RGPV": { + "category": "SUMMARY_REGION", + "description": "Pore Volume containing Gas" + }, + "RHPV": { + "category": "SUMMARY_REGION", + "description": "Pore Volume containing Hydrocarbon" + }, + "RNFT": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Solvent inter-region Flow" + }, + "RNIP": { + "category": "SUMMARY_REGION", + "description": "Solvent In Place" + }, + "ROE": { + "category": "SUMMARY_REGION", + "description": "(OIP(initial) - OIP(now)) / OIP(initial)" + }, + "ROEIG": { + "category": "SUMMARY_REGION", + "description": "(OIP(initial) - OIP(now)) / Initial Mobile Oil with respect to Gas" + }, + "ROEIW": { + "category": "SUMMARY_REGION", + "description": "(OIP(initial) - OIP(now)) / Initial Mobile Oil with respect to Water" + }, + "ROEW": { + "category": "SUMMARY_REGION", + "description": "Oil Production from Wells / OIP(initial)" + }, + "ROEWG": { + "category": "SUMMARY_REGION", + "description": "Oil Production from Wells / Initial Mobile Oil with respect to Gas" + }, + "ROEWW": { + "category": "SUMMARY_REGION", + "description": "Oil Production from Wells / Initial Mobile Oil with respect to Water" + }, + "ROFR": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Inter-region oil flow rate" + }, + "ROFR+": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Inter-region oil flow rate" + }, + "ROFR-": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Inter-region oil flow rate" + }, + "ROFT": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Inter-region oil flow total" + }, + "ROFT+": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Inter-region oil flow total" + }, + "ROFT-": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Inter-region oil flow total" + }, + "ROFTG": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Inter-region oil flow total" + }, + "ROFTL": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Inter-region oil flow total" + }, + "ROPV": { + "category": "SUMMARY_REGION", + "description": "Pore Volume containing Oil" + }, + "RORFE": { + "category": "SUMMARY_REGION", + "description": "Fraction of total oil produced by oil expansion" + }, + "RORFF": { + "category": "SUMMARY_REGION", + "description": "Fraction of total oil produced by free gas influx" + }, + "RORFG": { + "category": "SUMMARY_REGION", + "description": "Fraction of total oil produced by gas influx" + }, + "RORFR": { + "category": "SUMMARY_REGION", + "description": "Fraction of total oil produced by rock compaction" + }, + "RORFS": { + "category": "SUMMARY_REGION", + "description": "Fraction of total oil produced by solution gas" + }, + "RORFW": { + "category": "SUMMARY_REGION", + "description": "Fraction of total oil produced by water influx" + }, + "RORFX": { + "category": "SUMMARY_REGION", + "description": "Fraction of total oil produced by 'traced' water influx" + }, + "RORFY": { + "category": "SUMMARY_REGION", + "description": "Fraction of total oil produced by other water influx" + }, + "RORME": { + "category": "SUMMARY_REGION", + "description": "Total stock tank oil produced by oil expansion" + }, + "RORMF": { + "category": "SUMMARY_REGION", + "description": "Total stock tank oil produced by free gas influx" + }, + "RORMG": { + "category": "SUMMARY_REGION", + "description": "Total stock tank oil produced by gas influx" + }, + "RORMR": { + "category": "SUMMARY_REGION", + "description": "Total stock tank oil produced by rock compaction" + }, + "RORMS": { + "category": "SUMMARY_REGION", + "description": "Total stock tank oil produced by solution gas" + }, + "RORMW": { + "category": "SUMMARY_REGION", + "description": "Total stock tank oil produced by water influx" + }, + "RORMX": { + "category": "SUMMARY_REGION", + "description": "Total stock tank oil produced by 'traced' water influx" + }, + "RORMY": { + "category": "SUMMARY_REGION", + "description": "Total stock tank oil produced by other water influx" + }, + "RPPC": { + "category": "SUMMARY_REGION", + "description": "Initial Contact Corrected Potential" + }, + "RPR": { + "category": "SUMMARY_REGION", + "description": "Pressure average value" + }, + "RPRGZ": { + "category": "SUMMARY_REGION", + "description": "P/Z" + }, + "RPRH": { + "category": "SUMMARY_REGION", + "description": "Pressure average value" + }, + "RPRP": { + "category": "SUMMARY_REGION", + "description": "Pressure average value" + }, + "RRPV": { + "category": "SUMMARY_REGION", + "description": "Pore Volume at Reservoir conditions" + }, + "RRS": { + "category": "SUMMARY_REGION", + "description": "Gas-oil ratio" + }, + "RRTM": { + "category": "SUMMARY_REGION", + "description": "Transmissibility Multiplier associated with rock compaction" + }, + "RRV": { + "category": "SUMMARY_REGION", + "description": "Oil-gas ratio" + }, + "RSFT": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Salt inter-region Flow Total" + }, + "RSIP": { + "category": "SUMMARY_REGION", + "description": "Salt In Place" + }, + "RTADS": { + "category": "SUMMARY_REGION", + "description": "Tracer Adsorption total" + }, + "RTADSFOA": { + "category": "SUMMARY_REGION", + "description": "Adsorption total" + }, + "RTADSUR": { + "category": "SUMMARY_REGION", + "description": "Adsorption total" + }, + "RTDCY": { + "category": "SUMMARY_REGION", + "description": "Decayed tracer" + }, + "RTDCYFOA": { + "category": "SUMMARY_REGION", + "description": "Decayed tracer" + }, + "RTFT#": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Tracer inter-region Flow in phase # (1,2,3,...)" + }, + "RTFTF": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Tracer inter-region Flow Total" + }, + "RTFTS": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Tracer inter-region Flow Total" + }, + "RTFTT": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Tracer inter-region Flow Total" + }, + "RTFTTFOA": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Inter-region Flow Total" + }, + "RTFTTSUR": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Inter-region Flow Total" + }, + "RTIP#": { + "category": "SUMMARY_REGION", + "description": "Tracer In Place in phase # (1,2,3,...)" + }, + "RTIPF": { + "category": "SUMMARY_REGION", + "description": "Tracer In Place" + }, + "RTIPS": { + "category": "SUMMARY_REGION", + "description": "Tracer In Place" + }, + "RTIPT": { + "category": "SUMMARY_REGION", + "description": "Tracer In Place" + }, + "RTIPTFOA": { + "category": "SUMMARY_REGION", + "description": "In Solution" + }, + "RTIPTHEA": { + "category": "SUMMARY_REGION", + "description": "Difference in Energy in place between current and initial time" + }, + "RTIPTSUR": { + "category": "SUMMARY_REGION", + "description": "In Solution" + }, + "RTMOBFOA": { + "category": "SUMMARY_REGION", + "description": "Gas mobility factor" + }, + "RU": { + "category": "SUMMARY_REGION", + "description": "User-defined region quantity" + }, + "RWFR": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Inter-region water flow rate" + }, + "RWFR+": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Inter-region water flow rate" + }, + "RWFR-": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Inter-region water flow rate" + }, + "RWFT": { + "category": "SUMMARY_REGION_2_REGION", + "description": "Inter-region water flow total" + }, + "RWPV": { + "category": "SUMMARY_REGION", + "description": "Pore Volume containing Water" + }, + "SALQ": { + "category": "SUMMARY_SEGMENT", + "description": "Artificial lift quantity for segment" + }, + "SAPI": { + "category": "SUMMARY_SEGMENT", + "description": "Segment API value" + }, + "SCCN": { + "category": "SUMMARY_SEGMENT", + "description": "Segment polymer concentration" + }, + "SCFR": { + "category": "SUMMARY_SEGMENT", + "description": "Segment polymer flow rate" + }, + "SCSA": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Cross Sectional Area" + }, + "SCVPR": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Calorific Value Production Rate" + }, + "SCWGFR": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Component Flow Rate as Wet Gas" + }, + "SDENM": { + "category": "SUMMARY_SEGMENT", + "description": "Segment fluid mixture density" + }, + "SEMVIS": { + "category": "SUMMARY_SEGMENT", + "description": "Segment effective mixture viscosity" + }, + "SENE": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Energy Density" + }, + "SFD": { + "category": "SUMMARY_SEGMENT", + "description": "Segment diameter for Karst Conduit Calcite Dissolution" + }, + "SFOPN": { + "category": "SUMMARY_SEGMENT", + "description": "Setting of segment" + }, + "SGFR": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Gas Flow Rate" + }, + "SGFRF": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Free Gas Flow Rate" + }, + "SGFRS": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Solution Gas Flow Rate" + }, + "SGFV": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Gas Flow Velocity" + }, + "SGHF": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Gas Holdup Fraction" + }, + "SGIMR": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Gas Import Rate" + }, + "SGIMT": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Gas Import Total" + }, + "SGLPP": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Gas-Liquid Profile Parameter, C0" + }, + "SGLVD": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Gas-Liquid Drift Velocity, Vd" + }, + "SGOR": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Gas Oil Ratio" + }, + "SGQ": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Gas Quality" + }, + "SGRMR": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Gas Removal Rate" + }, + "SGRMT": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Gas Removal Total" + }, + "SGVIS": { + "category": "SUMMARY_SEGMENT", + "description": "Segment gas viscosity" + }, + "SHFR": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Enthalpy Flow Rate" + }, + "SHIMR": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Enthalpy Import Rate" + }, + "SHIMT": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Enthalpy Import Total" + }, + "SHRMR": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Enthalpy Removal Rate" + }, + "SHRMT": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Enthalpy Removal Total" + }, + "SKFR": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Component Flow Rate" + }, + "SOFR": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Oil Flow Rate" + }, + "SOFRF": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Free Oil Flow Rate" + }, + "SOFRS": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Solution Oil Flow Rate" + }, + "SOFV": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Oil Flow Velocity" + }, + "SOGR": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Oil Gas Ratio" + }, + "SOHF": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Oil Holdup Fraction" + }, + "SOIMR": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Oil Import Rate" + }, + "SOIMT": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Oil Import Total" + }, + "SORMR": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Oil Removal Rate" + }, + "SORMT": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Oil Removal Total" + }, + "SOVIS": { + "category": "SUMMARY_SEGMENT", + "description": "Segment oil viscosity" + }, + "SOWPP": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Oil-Water Profile Parameter, C0" + }, + "SOWVD": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Oil-Water Drift Velocity, Vd" + }, + "SPPOW": { + "category": "SUMMARY_SEGMENT", + "description": "Working power of a pull through pump" + }, + "SPR": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Pressure" + }, + "SPRD": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Pressure Drop" + }, + "SPRDA": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Pressure drop due to Acceleration head" + }, + "SPRDF": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Pressure Drop component due to Friction" + }, + "SPRDH": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Pressure Drop component due to Hydrostatic head" + }, + "SPRDM": { + "category": "SUMMARY_SEGMENT", + "description": "Segment frictional Pressure Drop Multiplier" + }, + "SPSAT": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Psat" + }, + "SRBQR": { + "category": "SUMMARY_SEGMENT", + "description": "Branch flow at current time" + }, + "SRBQT": { + "category": "SUMMARY_SEGMENT", + "description": "Branch cumulative flow" + }, + "SRRAREA": { + "category": "SUMMARY_SEGMENT", + "description": "Reach area at current time" + }, + "SRRDEPTH": { + "category": "SUMMARY_SEGMENT", + "description": "Reach depth at current time" + }, + "SRREXCH": { + "category": "SUMMARY_SEGMENT", + "description": "Exchange flux at current time" + }, + "SRRFLOW": { + "category": "SUMMARY_SEGMENT", + "description": "Reach flux through cross-sectional area at current time" + }, + "SRRFRODE": { + "category": "SUMMARY_SEGMENT", + "description": "Reach Froude number at current time" + }, + "SRRHEAD": { + "category": "SUMMARY_SEGMENT", + "description": "Reach hydraulic head at current time" + }, + "SRRQR": { + "category": "SUMMARY_SEGMENT", + "description": "Reach flow at current time" + }, + "SRRQT": { + "category": "SUMMARY_SEGMENT", + "description": "Reach cumulative flow" + }, + "SRSFC": { + "category": "SUMMARY_SEGMENT", + "description": "Reach brine concentration" + }, + "SRSFR": { + "category": "SUMMARY_SEGMENT", + "description": "Reach brine flow rate through connections" + }, + "SRTFC": { + "category": "SUMMARY_SEGMENT", + "description": "Reach tracer concentration" + }, + "SRTFR": { + "category": "SUMMARY_SEGMENT", + "description": "Reach tracer flow rate" + }, + "SRTQR": { + "category": "SUMMARY_SEGMENT", + "description": "River total flow at current time" + }, + "SRTQT": { + "category": "SUMMARY_SEGMENT", + "description": "River total cumulative flow" + }, + "SSCN": { + "category": "SUMMARY_SEGMENT", + "description": "Segment brine concentration" + }, + "SSFR": { + "category": "SUMMARY_SEGMENT", + "description": "Segment brine flow rate" + }, + "SSQU": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Steam Quality" + }, + "SSTR": { + "category": "SUMMARY_SEGMENT", + "description": "Strength of ICD on segment" + }, + "STEM": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Temperature" + }, + "STEPTYPE": { + "category": "SUMMARY_MISC", + "description": "Step type" + }, + "STFC": { + "category": "SUMMARY_SEGMENT", + "description": "Segment tracer concentration" + }, + "STFR": { + "category": "SUMMARY_SEGMENT", + "description": "Segment tracer flow rate" + }, + "SU": { + "category": "SUMMARY_SEGMENT", + "description": "User-defined segment quantity" + }, + "SWCT": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Water Cut" + }, + "SWFR": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Water Flow Rate" + }, + "SWFV": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Water Flow Velocity" + }, + "SWGR": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Water Gas Ratio" + }, + "SWHF": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Water Holdup Fraction" + }, + "SWIMR": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Water Import Rate" + }, + "SWIMT": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Water Import Total" + }, + "SWRMR": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Water Removal Rate" + }, + "SWRMT": { + "category": "SUMMARY_SEGMENT", + "description": "Segment Water Removal Total" + }, + "SWVIS": { + "category": "SUMMARY_SEGMENT", + "description": "Segment water viscosity" + }, + "TCPU": { + "category": "SUMMARY_MISC", + "description": "TCPU" + }, + "TCPUDAY": { + "category": "SUMMARY_MISC", + "description": "TCPUDAY" + }, + "TCPUTS": { + "category": "SUMMARY_MISC", + "description": "TCPUTS" + }, + "TELAPLIN": { + "category": "SUMMARY_MISC", + "description": "TELAPLIN" + }, + "TIME": { + "category": "SUMMARY_MISC", + "description": "Time" + }, + "TIMESTEP": { + "category": "SUMMARY_MISC", + "description": "Time step" + }, + "TIMESTRY": { + "category": "SUMMARY_MISC", + "description": "TIMESTRY" + }, + "WALQ": { + "category": "SUMMARY_WELL", + "description": "Well Artificial Lift Quantity" + }, + "WAMF": { + "category": "SUMMARY_WELL", + "description": "Component aqueous mole fraction, from producing completions" + }, + "WAPI": { + "category": "SUMMARY_WELL", + "description": "Oil API" + }, + "WBGLR": { + "category": "SUMMARY_WELL", + "description": "Bottom hole Gas-Liquid Ratio" + }, + "WBHP": { + "category": "SUMMARY_WELL", + "description": "Bottom Hole Pressure" + }, + "WBHPFP": { + "category": "SUMMARY_WELL", + "description": "Well Bottom Hole Pressure from end of First Pass" + }, + "WBHPH": { + "category": "SUMMARY_WELL", + "description": "Bottom Hole Pressure History" + }, + "WBHPT": { + "category": "SUMMARY_WELL", + "description": "Bottom Hole Pressure Target/Limit" + }, + "WBHWCn": { + "category": "SUMMARY_WELL", + "description": "Derivative of well BHP with respect to parameter n" + }, + "WBP": { + "category": "SUMMARY_WELL", + "description": "One-point Pressure Average" + }, + "WBP4": { + "category": "SUMMARY_WELL", + "description": "Four-point Pressure Average" + }, + "WBP5": { + "category": "SUMMARY_WELL", + "description": "Five-point Pressure Average" + }, + "WBP9": { + "category": "SUMMARY_WELL", + "description": "Nine-point Pressure Average" + }, + "WCGIR": { + "category": "SUMMARY_WELL", + "description": "Hydrocarbon Component Gas Injection Rate" + }, + "WCGMR": { + "category": "SUMMARY_WELL", + "description": "Hydrocarbon component" + }, + "WCGMRn": { + "category": "SUMMARY_WELL", + "description": "Hydrocarbon component molar rates in the gas phase for nth separator stage" + }, + "WCGMT": { + "category": "SUMMARY_WELL", + "description": "Hydrocarbon component" + }, + "WCGPR": { + "category": "SUMMARY_WELL", + "description": "Hydrocarbon Component Gas Production Rate" + }, + "WCGRn": { + "category": "SUMMARY_WELL", + "description": "Hydrocarbon component molar rates in the gas phase for nth separator stage" + }, + "WCHMR": { + "category": "SUMMARY_WELL", + "description": "Hydrocarbon Component" + }, + "WCHMT": { + "category": "SUMMARY_WELL", + "description": "Hydrocarbon Component" + }, + "WCIC": { + "category": "SUMMARY_WELL", + "description": "Polymer Injection Concentration" + }, + "WCIR": { + "category": "SUMMARY_WELL", + "description": "Polymer Injection Rate" + }, + "WCIT": { + "category": "SUMMARY_WELL", + "description": "Polymer Injection Total" + }, + "WCMIR": { + "category": "SUMMARY_WELL", + "description": "Hydrocarbon Component Molar Injection Rates" + }, + "WCMIT": { + "category": "SUMMARY_WELL", + "description": "Hydrocarbon Component Molar Injection Totals" + }, + "WCMPR": { + "category": "SUMMARY_WELL", + "description": "Hydrocarbon Component Molar Production Rates" + }, + "WCMPT": { + "category": "SUMMARY_WELL", + "description": "Hydrocarbon Component" + }, + "WCNMR": { + "category": "SUMMARY_WELL", + "description": "Hydrocarbon component molar rates in the NGL phase" + }, + "WCNWR": { + "category": "SUMMARY_WELL", + "description": "Hydrocarbon component mass rates in the NGL phase" + }, + "WCOMR": { + "category": "SUMMARY_WELL", + "description": "Hydrocarbon component" + }, + "WCOMRn": { + "category": "SUMMARY_WELL", + "description": "Hydrocarbon component" + }, + "WCOMT": { + "category": "SUMMARY_WELL", + "description": "Hydrocarbon component" + }, + "WCOPR": { + "category": "SUMMARY_WELL", + "description": "Hydrocarbon Component Oil Production Rate" + }, + "WCORn": { + "category": "SUMMARY_WELL", + "description": "Hydrocarbon component" + }, + "WCPC": { + "category": "SUMMARY_WELL", + "description": "Polymer Production Concentration" + }, + "WCPR": { + "category": "SUMMARY_WELL", + "description": "Polymer Production Rate" + }, + "WCPT": { + "category": "SUMMARY_WELL", + "description": "Polymer Production Total" + }, + "WCWGIR": { + "category": "SUMMARY_WELL", + "description": "Hydrocarbon Component Wet Gas Injection Rate" + }, + "WCWGIT": { + "category": "SUMMARY_WELL", + "description": "Hydrocarbon Component Wet Gas Injection Total" + }, + "WCWGPR": { + "category": "SUMMARY_WELL", + "description": "Hydrocarbon Component Wet Gas Production Rate" + }, + "WCWGPT": { + "category": "SUMMARY_WELL", + "description": "Hydrocarbon Component Wet Gas Production Total" + }, + "WDRPR": { + "category": "SUMMARY_WELL", + "description": "Well drilling priority" + }, + "WEDC": { + "category": "SUMMARY_WELL", + "description": "Energy Delivery Capacity" + }, + "WEFF": { + "category": "SUMMARY_WELL", + "description": "Efficiency Factor" + }, + "WEFFG": { + "category": "SUMMARY_WELL", + "description": "Product of efficiency factors of the well and all its superior groups" + }, + "WEPR": { + "category": "SUMMARY_WELL", + "description": "Energy Production Rate" + }, + "WEPT": { + "category": "SUMMARY_WELL", + "description": "Energy Production Total" + }, + "WGCV": { + "category": "SUMMARY_WELL", + "description": "Gas Calorific Value" + }, + "WGDC": { + "category": "SUMMARY_WELL", + "description": "Gas Delivery Capacity" + }, + "WGDN": { + "category": "SUMMARY_WELL", + "description": "Gas Density at Surface Conditions" + }, + "WGFRL": { + "category": "SUMMARY_WELL", + "description": "Gas Flow Rate" + }, + "WGFWCn": { + "category": "SUMMARY_WELL", + "description": "Derivative of well gas flow rate with respect to parameter n" + }, + "WGIGR": { + "category": "SUMMARY_WELL", + "description": "Gas Injection Guide Rate" + }, + "WGIP": { + "category": "SUMMARY_WELL", + "description": "Gas Potential Injection rate" + }, + "WGIP2": { + "category": "SUMMARY_WELL", + "description": "Gas Potential Injection rate" + }, + "WGIR": { + "category": "SUMMARY_WELL", + "description": "Gas Injection Rate" + }, + "WGIRH": { + "category": "SUMMARY_WELL", + "description": "Gas Injection Rate History" + }, + "WGIRL": { + "category": "SUMMARY_WELL", + "description": "Gas Injection Rate" + }, + "WGIRT": { + "category": "SUMMARY_WELL", + "description": "Gas Injection Rate Target/Limit" + }, + "WGIT": { + "category": "SUMMARY_WELL", + "description": "Gas Injection Total" + }, + "WGITH": { + "category": "SUMMARY_WELL", + "description": "Gas Injection Total History" + }, + "WGITL": { + "category": "SUMMARY_WELL", + "description": "Gas Injection Total" + }, + "WGLIR": { + "category": "SUMMARY_WELL", + "description": "Gas Lift Injection Rate" + }, + "WGLIT": { + "category": "SUMMARY_WELL", + "description": "Gas Lift Injection Total" + }, + "WGLR": { + "category": "SUMMARY_WELL", + "description": "Gas-Liquid Ratio" + }, + "WGLRH": { + "category": "SUMMARY_WELL", + "description": "Gas-Liquid Ratio History" + }, + "WGLRL": { + "category": "SUMMARY_WELL", + "description": "Gas-Liquid Ratio" + }, + "WGMR": { + "category": "SUMMARY_WELL", + "description": "Gas Mass Rate" + }, + "WGMT": { + "category": "SUMMARY_WELL", + "description": "Gas Mass Total" + }, + "WGOR": { + "category": "SUMMARY_WELL", + "description": "Gas-Oil Ratio" + }, + "WGORH": { + "category": "SUMMARY_WELL", + "description": "Gas-Oil Ratio History" + }, + "WGORL": { + "category": "SUMMARY_WELL", + "description": "Gas-Oil Ratio" + }, + "WGPGR": { + "category": "SUMMARY_WELL", + "description": "Gas Production Guide Rate" + }, + "WGPI": { + "category": "SUMMARY_WELL", + "description": "Gas Potential Injection rate" + }, + "WGPI2": { + "category": "SUMMARY_WELL", + "description": "Gas Potential Injection rate" + }, + "WGPP": { + "category": "SUMMARY_WELL", + "description": "Gas Potential Production rate" + }, + "WGPP2": { + "category": "SUMMARY_WELL", + "description": "Gas Potential Production rate" + }, + "WGPPF": { + "category": "SUMMARY_WELL", + "description": "Free Gas Potential Production rate" + }, + "WGPPF2": { + "category": "SUMMARY_WELL", + "description": "Free Gas Potential Production rate" + }, + "WGPPS": { + "category": "SUMMARY_WELL", + "description": "Solution" + }, + "WGPPS2": { + "category": "SUMMARY_WELL", + "description": "Solution" + }, + "WGPR": { + "category": "SUMMARY_WELL", + "description": "Gas Production Rate" + }, + "WGPR1": { + "category": "SUMMARY_WELL", + "description": "Gas Production Rate above GOC" + }, + "WGPR2": { + "category": "SUMMARY_WELL", + "description": "Gas Production Rate below GOC" + }, + "WGPRA": { + "category": "SUMMARY_WELL", + "description": "Gas Production Rate above" + }, + "WGPRB": { + "category": "SUMMARY_WELL", + "description": "Gas Production Rate below" + }, + "WGPRF": { + "category": "SUMMARY_WELL", + "description": "Free Gas Production Rate" + }, + "WGPRFP": { + "category": "SUMMARY_WELL", + "description": "Well Gas Production Rate from end of First Pass" + }, + "WGPRH": { + "category": "SUMMARY_WELL", + "description": "Gas Production Rate History" + }, + "WGPRL": { + "category": "SUMMARY_WELL", + "description": "Gas Flow Rate" + }, + "WGPRS": { + "category": "SUMMARY_WELL", + "description": "Solution Gas Production Rate" + }, + "WGPRT": { + "category": "SUMMARY_WELL", + "description": "Gas Production Rate Target/Limit" + }, + "WGPT": { + "category": "SUMMARY_WELL", + "description": "Gas Production Total" + }, + "WGPT1": { + "category": "SUMMARY_WELL", + "description": "Gas Production Total above GOC" + }, + "WGPT2": { + "category": "SUMMARY_WELL", + "description": "Gas Production Total below GOC" + }, + "WGPTA": { + "category": "SUMMARY_WELL", + "description": "Gas Production Total above" + }, + "WGPTB": { + "category": "SUMMARY_WELL", + "description": "Gas Production Total below" + }, + "WGPTF": { + "category": "SUMMARY_WELL", + "description": "Free Gas Production Total" + }, + "WGPTH": { + "category": "SUMMARY_WELL", + "description": "Gas Production Total History" + }, + "WGPTL": { + "category": "SUMMARY_WELL", + "description": "Gas Production Total" + }, + "WGPTS": { + "category": "SUMMARY_WELL", + "description": "Solution Gas Production Total" + }, + "WGQ": { + "category": "SUMMARY_WELL", + "description": "Gas Quality" + }, + "WGVIR": { + "category": "SUMMARY_WELL", + "description": "Gas Voidage Injection Rate" + }, + "WGVIT": { + "category": "SUMMARY_WELL", + "description": "Gas Voidage Injection Total" + }, + "WGVPR": { + "category": "SUMMARY_WELL", + "description": "Gas Voidage Production Rate" + }, + "WGVPT": { + "category": "SUMMARY_WELL", + "description": "Gas Voidage Production Total" + }, + "WGnPR": { + "category": "SUMMARY_WELL", + "description": "nth separator stage gas rate" + }, + "WGnPT": { + "category": "SUMMARY_WELL", + "description": "nth separator stage gas total" + }, + "WHD": { + "category": "SUMMARY_WELL", + "description": "Hydraulic head in well based on the reference depth given in HYDRHEAD and the well's reference depth" + }, + "WHDF": { + "category": "SUMMARY_WELL", + "description": "Hydraulic head in well based on the reference depth given in HYDRHEAD and the well's reference depth calculated at freshwater conditions" + }, + "WHMIR": { + "category": "SUMMARY_WELL", + "description": "Hydrocarbon Molar Injection Rate" + }, + "WHMIT": { + "category": "SUMMARY_WELL", + "description": "Hydrocarbon Molar Injection Total" + }, + "WHMPR": { + "category": "SUMMARY_WELL", + "description": "Hydrocarbon Molar Production Rate" + }, + "WHMPT": { + "category": "SUMMARY_WELL", + "description": "Hydrocarbon Molar Production Total" + }, + "WLFRL": { + "category": "SUMMARY_WELL", + "description": "Liquid Flow Rate" + }, + "WLPR": { + "category": "SUMMARY_WELL", + "description": "Liquid Production Rate" + }, + "WLPRH": { + "category": "SUMMARY_WELL", + "description": "Liquid Production Rate History" + }, + "WLPRT": { + "category": "SUMMARY_WELL", + "description": "Liquid Production Rate Target/Limit" + }, + "WLPT": { + "category": "SUMMARY_WELL", + "description": "Liquid Production Total" + }, + "WLPTH": { + "category": "SUMMARY_WELL", + "description": "Liquid Production Total History" + }, + "WLPTL": { + "category": "SUMMARY_WELL", + "description": "Liquid Production Total" + }, + "WMCON": { + "category": "SUMMARY_WELL", + "description": "The number of connections capable of flowing in the well" + }, + "WMCTL": { + "category": "SUMMARY_WELL", + "description": "Mode of Control" + }, + "WMIR": { + "category": "SUMMARY_WELL", + "description": "Methane Injection Rate" + }, + "WMIT": { + "category": "SUMMARY_WELL", + "description": "Methane Injection Total" + }, + "WMMW": { + "category": "SUMMARY_WELL", + "description": "Mean molecular weight of wellstream" + }, + "WMPR": { + "category": "SUMMARY_WELL", + "description": "Methane Production Rate" + }, + "WMPT": { + "category": "SUMMARY_WELL", + "description": "Methane Production Total" + }, + "WMUF": { + "category": "SUMMARY_WELL", + "description": "Make-up fraction" + }, + "WMVFP": { + "category": "SUMMARY_WELL", + "description": "VFP table number used by the well" + }, + "WNIR": { + "category": "SUMMARY_WELL", + "description": "Solvent Injection Rate" + }, + "WNIT": { + "category": "SUMMARY_WELL", + "description": "Solvent Injection Total" + }, + "WNLPR": { + "category": "SUMMARY_WELL", + "description": "NGL Production Rate" + }, + "WNLPRH": { + "category": "SUMMARY_WELL", + "description": "NGL Production Rate History" + }, + "WNLPRT": { + "category": "SUMMARY_WELL", + "description": "NGL Production Rate Target" + }, + "WNLPT": { + "category": "SUMMARY_WELL", + "description": "NGL Production Total" + }, + "WNLPTH": { + "category": "SUMMARY_WELL", + "description": "NGL Production Total History" + }, + "WNPR": { + "category": "SUMMARY_WELL", + "description": "Solvent Production Rate" + }, + "WNPT": { + "category": "SUMMARY_WELL", + "description": "Solvent Production Total" + }, + "WODN": { + "category": "SUMMARY_WELL", + "description": "Oil Density at Surface Conditions" + }, + "WOFRL": { + "category": "SUMMARY_WELL", + "description": "Oil Flow Rate" + }, + "WOFWCn": { + "category": "SUMMARY_WELL", + "description": "Derivative of well oil flow rate with respect to parameter n" + }, + "WOGLR": { + "category": "SUMMARY_WELL", + "description": "Well Oil Gas Lift Ratio" + }, + "WOGR": { + "category": "SUMMARY_WELL", + "description": "Oil-Gas Ratio" + }, + "WOGRH": { + "category": "SUMMARY_WELL", + "description": "Oil-Gas Ratio History" + }, + "WOGRL": { + "category": "SUMMARY_WELL", + "description": "Oil-Gas Ratio" + }, + "WOIGR": { + "category": "SUMMARY_WELL", + "description": "Oil Injection Guide Rate" + }, + "WOIR": { + "category": "SUMMARY_WELL", + "description": "Oil Injection Rate" + }, + "WOIRH": { + "category": "SUMMARY_WELL", + "description": "Oil Injection Rate History" + }, + "WOIRT": { + "category": "SUMMARY_WELL", + "description": "Oil Injection Rate Target/Limit" + }, + "WOIT": { + "category": "SUMMARY_WELL", + "description": "Oil Injection Total" + }, + "WOITH": { + "category": "SUMMARY_WELL", + "description": "Oil Injection Total History" + }, + "WOITL": { + "category": "SUMMARY_WELL", + "description": "Oil Injection Total" + }, + "WOMR": { + "category": "SUMMARY_WELL", + "description": "Oil Mass Rate" + }, + "WOMT": { + "category": "SUMMARY_WELL", + "description": "Oil Mass Total" + }, + "WOPGR": { + "category": "SUMMARY_WELL", + "description": "Oil Production Guide Rate" + }, + "WOPI": { + "category": "SUMMARY_WELL", + "description": "Oil Potential Injection rate" + }, + "WOPI2": { + "category": "SUMMARY_WELL", + "description": "Oil Potential Injection rate" + }, + "WOPP": { + "category": "SUMMARY_WELL", + "description": "Oil Potential Production rate" + }, + "WOPP2": { + "category": "SUMMARY_WELL", + "description": "Oil Potential Production rate" + }, + "WOPR": { + "category": "SUMMARY_WELL", + "description": "Oil Production Rate" + }, + "WOPR1": { + "category": "SUMMARY_WELL", + "description": "Oil Production Rate above GOC" + }, + "WOPR2": { + "category": "SUMMARY_WELL", + "description": "Oil Production Rate below GOC" + }, + "WOPRA": { + "category": "SUMMARY_WELL", + "description": "Oil Production Rate above GOC" + }, + "WOPRB": { + "category": "SUMMARY_WELL", + "description": "Oil Production Rate below GOC" + }, + "WOPRF": { + "category": "SUMMARY_WELL", + "description": "Free Oil Production Rate" + }, + "WOPRH": { + "category": "SUMMARY_WELL", + "description": "Oil Production Rate History" + }, + "WOPRL": { + "category": "SUMMARY_WELL", + "description": "Oil Flow Rate" + }, + "WOPRS": { + "category": "SUMMARY_WELL", + "description": "Solution Oil Production Rate" + }, + "WOPRT": { + "category": "SUMMARY_WELL", + "description": "Oil Production Rate Target/Limit" + }, + "WOPT": { + "category": "SUMMARY_WELL", + "description": "Oil Production Total" + }, + "WOPT1": { + "category": "SUMMARY_WELL", + "description": "Oil Production Total above GOC" + }, + "WOPT2": { + "category": "SUMMARY_WELL", + "description": "Oil Production Total below GOC" + }, + "WOPTA": { + "category": "SUMMARY_WELL", + "description": "Oil Production Total above GOC" + }, + "WOPTB": { + "category": "SUMMARY_WELL", + "description": "Oil Production Total below GOC" + }, + "WOPTF": { + "category": "SUMMARY_WELL", + "description": "Free Oil Production Total" + }, + "WOPTH": { + "category": "SUMMARY_WELL", + "description": "Oil Production Total History" + }, + "WOPTL": { + "category": "SUMMARY_WELL", + "description": "Oil Production Total" + }, + "WOPTS": { + "category": "SUMMARY_WELL", + "description": "Solution Oil Production Total" + }, + "WOVIR": { + "category": "SUMMARY_WELL", + "description": "Oil Voidage Injection Rate" + }, + "WOVIT": { + "category": "SUMMARY_WELL", + "description": "Oil Voidage Injection Total" + }, + "WOVPR": { + "category": "SUMMARY_WELL", + "description": "Oil Voidage Production Rate" + }, + "WOVPT": { + "category": "SUMMARY_WELL", + "description": "Oil Voidage Production Total" + }, + "WOnPR": { + "category": "SUMMARY_WELL", + "description": "nth separator stage oil rate" + }, + "WOnPT": { + "category": "SUMMARY_WELL", + "description": "nth separator stage oil total" + }, + "WPI": { + "category": "SUMMARY_WELL", + "description": "Productivity Index of well's preferred phase" + }, + "WPI1": { + "category": "SUMMARY_WELL", + "description": "Productivity Index based on the value of WBP" + }, + "WPI4": { + "category": "SUMMARY_WELL", + "description": "Productivity Index based on the value of WBP4" + }, + "WPI5": { + "category": "SUMMARY_WELL", + "description": "Productivity Index based on the value of WBP5" + }, + "WPI9": { + "category": "SUMMARY_WELL", + "description": "Productivity Index based on the value of WBP9" + }, + "WPIG": { + "category": "SUMMARY_WELL", + "description": "Gas phase PI" + }, + "WPIL": { + "category": "SUMMARY_WELL", + "description": "Liquid phase PI" + }, + "WPIO": { + "category": "SUMMARY_WELL", + "description": "Oil phase PI" + }, + "WPIW": { + "category": "SUMMARY_WELL", + "description": "Water phase PI" + }, + "WPWE0": { + "category": "SUMMARY_WELL", + "description": "Well drilled indicator" + }, + "WPWE1": { + "category": "SUMMARY_WELL", + "description": "Connections opened indicator" + }, + "WPWE2": { + "category": "SUMMARY_WELL", + "description": "Connections closed indicator" + }, + "WPWE3": { + "category": "SUMMARY_WELL", + "description": "Connections closed to bottom indicator" + }, + "WPWE4": { + "category": "SUMMARY_WELL", + "description": "Well stopped indicator" + }, + "WPWE5": { + "category": "SUMMARY_WELL", + "description": "Injector to producer indicator" + }, + "WPWE6": { + "category": "SUMMARY_WELL", + "description": "Producer to injector indicator" + }, + "WPWE7": { + "category": "SUMMARY_WELL", + "description": "Well shut indicator" + }, + "WPWEM": { + "category": "SUMMARY_WELL", + "description": "WELEVNT output mnemonic" + }, + "WSIC": { + "category": "SUMMARY_WELL", + "description": "Salt Injection Concentration" + }, + "WSIR": { + "category": "SUMMARY_WELL", + "description": "Salt Injection Rate" + }, + "WSIT": { + "category": "SUMMARY_WELL", + "description": "Salt Injection Total" + }, + "WSPC": { + "category": "SUMMARY_WELL", + "description": "Salt Production Concentration" + }, + "WSPR": { + "category": "SUMMARY_WELL", + "description": "Salt Production Rate" + }, + "WSPT": { + "category": "SUMMARY_WELL", + "description": "Salt Production Total" + }, + "WSTAT": { + "category": "SUMMARY_WELL", + "description": "Well State Indicator" + }, + "WTCM": { + "category": "SUMMARY_WELL", + "description": "Tracer Carrier molar Rate" + }, + "WTHP": { + "category": "SUMMARY_WELL", + "description": "Tubing Head Pressure" + }, + "WTHPFP": { + "category": "SUMMARY_WELL", + "description": "Well Tubing Head Pressure from end of First Pass" + }, + "WTHPH": { + "category": "SUMMARY_WELL", + "description": "Tubing Head Pressure History" + }, + "WTHT": { + "category": "SUMMARY_WELL", + "description": "Tubing Head Temperature" + }, + "WTIC": { + "category": "SUMMARY_WELL", + "description": "Tracer Injection Concentration" + }, + "WTICF": { + "category": "SUMMARY_WELL", + "description": "Tracer Injection Concentration" + }, + "WTICHEA": { + "category": "SUMMARY_WELL", + "description": "Injection Temperature" + }, + "WTICS": { + "category": "SUMMARY_WELL", + "description": "Tracer Injection Concentration" + }, + "WTIR": { + "category": "SUMMARY_WELL", + "description": "Tracer Injection Rate" + }, + "WTIRALK": { + "category": "SUMMARY_WELL", + "description": "Injection Rate" + }, + "WTIRANI": { + "category": "SUMMARY_WELL", + "description": "Anion Injection Rate" + }, + "WTIRCAT": { + "category": "SUMMARY_WELL", + "description": "Cation Injection Rate" + }, + "WTIRF": { + "category": "SUMMARY_WELL", + "description": "Tracer Injection Rate" + }, + "WTIRFOA": { + "category": "SUMMARY_WELL", + "description": "Injection Rate" + }, + "WTIRHEA": { + "category": "SUMMARY_WELL", + "description": "Energy flows" + }, + "WTIRS": { + "category": "SUMMARY_WELL", + "description": "Tracer Injection Rate" + }, + "WTIRSUR": { + "category": "SUMMARY_WELL", + "description": "Injection Rate" + }, + "WTIT": { + "category": "SUMMARY_WELL", + "description": "Tracer Injection Total" + }, + "WTITALK": { + "category": "SUMMARY_WELL", + "description": "Injection Total" + }, + "WTITANI": { + "category": "SUMMARY_WELL", + "description": "Anion Injection Total" + }, + "WTITCAT": { + "category": "SUMMARY_WELL", + "description": "Cation Injection Total" + }, + "WTITF": { + "category": "SUMMARY_WELL", + "description": "Tracer Injection Total" + }, + "WTITFOA": { + "category": "SUMMARY_WELL", + "description": "Injection Total" + }, + "WTITHEA": { + "category": "SUMMARY_WELL", + "description": "Energy Injection Total" + }, + "WTITS": { + "category": "SUMMARY_WELL", + "description": "Tracer Injection Total" + }, + "WTITSUR": { + "category": "SUMMARY_WELL", + "description": "Injection Total" + }, + "WTLM": { + "category": "SUMMARY_WELL", + "description": "Traced mass liquid total" + }, + "WTMF": { + "category": "SUMMARY_WELL", + "description": "Traced molar fraction" + }, + "WTML": { + "category": "SUMMARY_WELL", + "description": "Traced mass liquid rate" + }, + "WTMR": { + "category": "SUMMARY_WELL", + "description": "Traced mass Rate" + }, + "WTMT": { + "category": "SUMMARY_WELL", + "description": "Traced mass Total" + }, + "WTMV": { + "category": "SUMMARY_WELL", + "description": "Traced mass vapor rate" + }, + "WTPC": { + "category": "SUMMARY_WELL", + "description": "Tracer Production Concentration" + }, + "WTPCF": { + "category": "SUMMARY_WELL", + "description": "Tracer Production" + }, + "WTPCHEA": { + "category": "SUMMARY_WELL", + "description": "Production Temperature" + }, + "WTPCS": { + "category": "SUMMARY_WELL", + "description": "Tracer Production" + }, + "WTPR": { + "category": "SUMMARY_WELL", + "description": "Tracer Production Rate" + }, + "WTPRALK": { + "category": "SUMMARY_WELL", + "description": "Production Rate" + }, + "WTPRANI": { + "category": "SUMMARY_WELL", + "description": "Anion Production Rate" + }, + "WTPRCAT": { + "category": "SUMMARY_WELL", + "description": "Cation Production Rate" + }, + "WTPRF": { + "category": "SUMMARY_WELL", + "description": "Tracer Production Rate" + }, + "WTPRFOA": { + "category": "SUMMARY_WELL", + "description": "Production Rate" + }, + "WTPRHEA": { + "category": "SUMMARY_WELL", + "description": "Energy flows" + }, + "WTPRS": { + "category": "SUMMARY_WELL", + "description": "Tracer Production Rate" + }, + "WTPRSUR": { + "category": "SUMMARY_WELL", + "description": "Production Rate" + }, + "WTPT": { + "category": "SUMMARY_WELL", + "description": "Tracer Production Total" + }, + "WTPTALK": { + "category": "SUMMARY_WELL", + "description": "Production Total" + }, + "WTPTANI": { + "category": "SUMMARY_WELL", + "description": "Anion Production Total" + }, + "WTPTCAT": { + "category": "SUMMARY_WELL", + "description": "Cation Production Total" + }, + "WTPTF": { + "category": "SUMMARY_WELL", + "description": "Tracer Production Total" + }, + "WTPTFOA": { + "category": "SUMMARY_WELL", + "description": "Production Total" + }, + "WTPTHEA": { + "category": "SUMMARY_WELL", + "description": "Energy Production Total" + }, + "WTPTS": { + "category": "SUMMARY_WELL", + "description": "Tracer Production Total" + }, + "WTPTSUR": { + "category": "SUMMARY_WELL", + "description": "Production Total" + }, + "WTQR": { + "category": "SUMMARY_WELL", + "description": "Traced molar Rate" + }, + "WTTL": { + "category": "SUMMARY_WELL", + "description": "Traced liquid volume total" + }, + "WTTV": { + "category": "SUMMARY_WELL", + "description": "Traced vapor volume total" + }, + "WTVL": { + "category": "SUMMARY_WELL", + "description": "Traced liquid volume rate" + }, + "WTVM": { + "category": "SUMMARY_WELL", + "description": "Traced mass vapor total" + }, + "WTVV": { + "category": "SUMMARY_WELL", + "description": "Traced vapor volume rate" + }, + "WU": { + "category": "SUMMARY_WELL", + "description": "User-defined well quantity" + }, + "WVFRL": { + "category": "SUMMARY_WELL", + "description": "Res Volume Flow Rate" + }, + "WVIR": { + "category": "SUMMARY_WELL", + "description": "Res Volume Injection Rate" + }, + "WVIRL": { + "category": "SUMMARY_WELL", + "description": "Res Volume Injection Flow Rate" + }, + "WVIRT": { + "category": "SUMMARY_WELL", + "description": "Res Volume Injection Rate Target/Limit" + }, + "WVIT": { + "category": "SUMMARY_WELL", + "description": "Res Volume Injection Total" + }, + "WVITL": { + "category": "SUMMARY_WELL", + "description": "Res Volume Injection Total" + }, + "WVPGR": { + "category": "SUMMARY_WELL", + "description": "Res Volume Production Guide Rate" + }, + "WVPR": { + "category": "SUMMARY_WELL", + "description": "Res Volume Production Rate" + }, + "WVPRL": { + "category": "SUMMARY_WELL", + "description": "Res Volume Production Flow Rate" + }, + "WVPRT": { + "category": "SUMMARY_WELL", + "description": "Res Volume Production Rate Target/Limit" + }, + "WVPT": { + "category": "SUMMARY_WELL", + "description": "Res Volume Production Total" + }, + "WVPTL": { + "category": "SUMMARY_WELL", + "description": "Res Volume Production Total" + }, + "WWCT": { + "category": "SUMMARY_WELL", + "description": "Water Cut" + }, + "WWCTH": { + "category": "SUMMARY_WELL", + "description": "Water Cut History" + }, + "WWCTL": { + "category": "SUMMARY_WELL", + "description": "Water Cut" + }, + "WWFRL": { + "category": "SUMMARY_WELL", + "description": "Water Flow Rate" + }, + "WWFWCn": { + "category": "SUMMARY_WELL", + "description": "Derivative of water flow rate with respect to parameter n" + }, + "WWGIR": { + "category": "SUMMARY_WELL", + "description": "Wet Gas Injection Rate" + }, + "WWGIT": { + "category": "SUMMARY_WELL", + "description": "Wet Gas Injection Total" + }, + "WWGPR": { + "category": "SUMMARY_WELL", + "description": "Wet Gas Production Rate" + }, + "WWGPRH": { + "category": "SUMMARY_WELL", + "description": "Wet Gas Production Rate History" + }, + "WWGPT": { + "category": "SUMMARY_WELL", + "description": "Wet Gas Production Total" + }, + "WWGR": { + "category": "SUMMARY_WELL", + "description": "Water-Gas Ratio" + }, + "WWGRH": { + "category": "SUMMARY_WELL", + "description": "Water-Gas Ratio History" + }, + "WWGRL": { + "category": "SUMMARY_WELL", + "description": "Water-Gas Ratio" + }, + "WWIGR": { + "category": "SUMMARY_WELL", + "description": "Water Injection Guide Rate" + }, + "WWIP": { + "category": "SUMMARY_WELL", + "description": "Water Potential Injection rate" + }, + "WWIP2": { + "category": "SUMMARY_WELL", + "description": "Water Potential Injection rate" + }, + "WWIR": { + "category": "SUMMARY_WELL", + "description": "Water Injection Rate" + }, + "WWIRH": { + "category": "SUMMARY_WELL", + "description": "Water Injection Rate History" + }, + "WWIRL": { + "category": "SUMMARY_WELL", + "description": "Water Injection Rate" + }, + "WWIRT": { + "category": "SUMMARY_WELL", + "description": "Water Injection Rate Target/Limit" + }, + "WWIT": { + "category": "SUMMARY_WELL", + "description": "Water Injection Total" + }, + "WWITH": { + "category": "SUMMARY_WELL", + "description": "Water Injection Total History" + }, + "WWITL": { + "category": "SUMMARY_WELL", + "description": "Water Injection Total" + }, + "WWMIR": { + "category": "SUMMARY_WELL", + "description": "Water component molar injection rate" + }, + "WWMIT": { + "category": "SUMMARY_WELL", + "description": "Water component molar injection total" + }, + "WWMPR": { + "category": "SUMMARY_WELL", + "description": "Water component molar production rate" + }, + "WWMPT": { + "category": "SUMMARY_WELL", + "description": "Water component molar production total" + }, + "WWMR": { + "category": "SUMMARY_WELL", + "description": "Water Mass Rate" + }, + "WWMT": { + "category": "SUMMARY_WELL", + "description": "Water Mass Total" + }, + "WWPGR": { + "category": "SUMMARY_WELL", + "description": "Water Production Guide Rate" + }, + "WWPI": { + "category": "SUMMARY_WELL", + "description": "Water Potential Injection rate" + }, + "WWPI2": { + "category": "SUMMARY_WELL", + "description": "Water Potential Injection rate" + }, + "WWPIR": { + "category": "SUMMARY_WELL", + "description": "Ratio of produced water to injected water (percentage)" + }, + "WWPP": { + "category": "SUMMARY_WELL", + "description": "Water Potential Production rate" + }, + "WWPP2": { + "category": "SUMMARY_WELL", + "description": "Water Potential Production rate" + }, + "WWPR": { + "category": "SUMMARY_WELL", + "description": "Water Production Rate" + }, + "WWPRH": { + "category": "SUMMARY_WELL", + "description": "Water Production Rate History" + }, + "WWPRL": { + "category": "SUMMARY_WELL", + "description": "Water Flow Rate" + }, + "WWPRT": { + "category": "SUMMARY_WELL", + "description": "Water Production Rate Target/Limit" + }, + "WWPT": { + "category": "SUMMARY_WELL", + "description": "Water Production Total" + }, + "WWPTH": { + "category": "SUMMARY_WELL", + "description": "Water Production Total History" + }, + "WWPTL": { + "category": "SUMMARY_WELL", + "description": "Water Production Total" + }, + "WWVIR": { + "category": "SUMMARY_WELL", + "description": "Water Voidage Injection Rate" + }, + "WWVIT": { + "category": "SUMMARY_WELL", + "description": "Water Voidage Injection Total" + }, + "WWVPR": { + "category": "SUMMARY_WELL", + "description": "Water Voidage Production Rate" + }, + "WWVPT": { + "category": "SUMMARY_WELL", + "description": "Water Voidage Production Total" + }, + "WXMF": { + "category": "SUMMARY_WELL", + "description": "Liquid Mole Fraction" + }, + "WXMFn": { + "category": "SUMMARY_WELL", + "description": "Liquid Mole Fraction for nth separator stage" + }, + "WYMF": { + "category": "SUMMARY_WELL", + "description": "Vapor Mole Fraction" + }, + "WYMFn": { + "category": "SUMMARY_WELL", + "description": "Vapor Mole Fraction for nth separator stage" + }, + "WZMF": { + "category": "SUMMARY_WELL", + "description": "Total Mole Fraction" + }, + "YEAR": { + "category": "SUMMARY_MISC", + "description": "Year" + }, + "YEARS": { + "category": "SUMMARY_MISC", + "description": "Years" + } +} diff --git a/ApplicationLibCode/Application/Tools/CMakeLists_files.cmake b/ApplicationLibCode/Application/Tools/CMakeLists_files.cmake index 94101bebfe..60bedd8f48 100644 --- a/ApplicationLibCode/Application/Tools/CMakeLists_files.cmake +++ b/ApplicationLibCode/Application/Tools/CMakeLists_files.cmake @@ -55,6 +55,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaRegressionTextTools.h ${CMAKE_CURRENT_LIST_DIR}/RiaFileLogger.h ${CMAKE_CURRENT_LIST_DIR}/RiaProjectBackupTools.h + ${CMAKE_CURRENT_LIST_DIR}/RiaQuantityInfoTools.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -107,6 +108,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaRegressionTextTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaFileLogger.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaProjectBackupTools.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiaQuantityInfoTools.cpp ) list(APPEND CODE_SOURCE_FILES ${SOURCE_GROUP_SOURCE_FILES}) diff --git a/ApplicationLibCode/Application/Tools/RiaQuantityInfoTools.cpp b/ApplicationLibCode/Application/Tools/RiaQuantityInfoTools.cpp new file mode 100644 index 0000000000..d3ebef33b8 --- /dev/null +++ b/ApplicationLibCode/Application/Tools/RiaQuantityInfoTools.cpp @@ -0,0 +1,131 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024 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 "RiaQuantityInfoTools.h" + +#include "RiaLogging.h" + +#include "RiuSummaryQuantityNameInfoProvider.h" + +#include +#include +#include +#include +#include + +#include + +namespace RiaQuantityInfoTools +{ +namespace internal +{ + //-------------------------------------------------------------------------------------------------- + /// + //-------------------------------------------------------------------------------------------------- + void writeToFile( const QString& filename, const std::unordered_map>& map ) + { + QJsonObject jsonObj; + + for ( const auto& item : map ) + { + QJsonObject itemObj; + itemObj["category"] = QString::fromStdString( item.second.first ); + itemObj["description"] = QString::fromStdString( item.second.second ); + jsonObj[QString::fromStdString( item.first )] = itemObj; + } + + QJsonDocument jsonDoc( jsonObj ); + QFile file( filename ); + if ( !file.open( QIODevice::WriteOnly ) ) + { + RiaLogging::error( "Couldn't open file : " + filename ); + return; + } + file.write( jsonDoc.toJson() ); + } + + //-------------------------------------------------------------------------------------------------- + /// + //-------------------------------------------------------------------------------------------------- + std::unordered_map> importFromFile( const QString& filename ) + { + QFile file( filename ); + if ( !file.open( QIODevice::ReadOnly | QIODevice::Text ) ) + { + RiaLogging::error( "Couldn't open file : " + filename ); + return {}; + } + + QByteArray data = file.readAll(); + QJsonDocument jsonDoc( QJsonDocument::fromJson( data ) ); + + if ( !jsonDoc.isObject() ) + { + RiaLogging::error( "Invalid JSON format in : " + filename ); + return {}; + } + + std::unordered_map> map; + + QJsonObject jsonObj = jsonDoc.object(); + for ( auto it = jsonObj.begin(); it != jsonObj.end(); ++it ) + { + auto key = it.key().toStdString(); + QJsonObject value = it.value().toObject(); + + auto category = value["category"].toString().toStdString(); + auto description = value["description"].toString().toStdString(); + + map.insert( { key, { category, description } } ); + } + + return map; + } + + //-------------------------------------------------------------------------------------------------- + /// + //-------------------------------------------------------------------------------------------------- + void importKeywords( const QString& keywordEclipseFilePath, const QString& keyword6XFilePath ) + { + auto quantityInfos = internal::importFromFile( keywordEclipseFilePath ); + auto info6x = internal::importFromFile( keyword6XFilePath ); + + for ( const auto& other : info6x ) + { + if ( !quantityInfos.contains( other.first ) ) + { + quantityInfos.insert( other ); + } + } + + RiuSummaryQuantityNameInfoProvider::instance()->setQuantityInfos( quantityInfos ); + } + +} // namespace internal +} // namespace RiaQuantityInfoTools + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaQuantityInfoTools::initializeSummaryKeywords() +{ + QString keywordEclipseFilePath = ":keywords/keyword-description/keywords_eclipse.json"; + QString keyword6XFilePath = ":keywords/keyword-description/keywords_6x.json"; + + RiaQuantityInfoTools::internal::importKeywords( keywordEclipseFilePath, keyword6XFilePath ); +} diff --git a/ApplicationLibCode/Application/Tools/RiaQuantityInfoTools.h b/ApplicationLibCode/Application/Tools/RiaQuantityInfoTools.h new file mode 100644 index 0000000000..25088c7fd6 --- /dev/null +++ b/ApplicationLibCode/Application/Tools/RiaQuantityInfoTools.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024 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 + +//================================================================================================== +// +//================================================================================================== +namespace RiaQuantityInfoTools +{ +void initializeSummaryKeywords(); +} // namespace RiaQuantityInfoTools diff --git a/ApplicationLibCode/CMakeLists.txt b/ApplicationLibCode/CMakeLists.txt index 796f5a5ccd..d243e3b398 100644 --- a/ApplicationLibCode/CMakeLists.txt +++ b/ApplicationLibCode/CMakeLists.txt @@ -220,8 +220,10 @@ endif() # ############################################################################## source_group("ModelVisualization" FILES ${MODEL_VISUALIZATION_FILES}) +qt_add_resources(QRC_FILES Application/Resources/ApplicationLibCode.qrc) + list(APPEND ALL_SOURCE_FILES ${CPP_SOURCES} ${MOC_SOURCE_FILES} - ${FORM_FILES_CPP} + ${FORM_FILES_CPP} ${QRC_FILES} ) add_library(${PROJECT_NAME} OBJECT ${ALL_SOURCE_FILES}) @@ -389,6 +391,7 @@ set(UNITY_EXCLUDE_FILES qrc_cafAnimControl.cpp qrc_ResInsight.cpp qrc_cafCommandFeatures.cpp + qrc_ApplicationLibCode.cpp # Exclude files including opm-common ProjectDataModel/RimVfpTableExtractor.cpp ProjectDataModel/RimVfpPlot.cpp diff --git a/ApplicationLibCode/UnitTests/main.cpp b/ApplicationLibCode/UnitTests/main.cpp index ac87d86c3a..d244af9bfd 100644 --- a/ApplicationLibCode/UnitTests/main.cpp +++ b/ApplicationLibCode/UnitTests/main.cpp @@ -19,6 +19,7 @@ #include "gtest/gtest.h" #include "RiaConsoleApplication.h" +#include "RiaQuantityInfoTools.h" #include "RiaRegressionTestRunner.h" #include @@ -30,6 +31,7 @@ int main( int argc, char** argv ) { // Create feature manager before the application object is created RiaRegressionTestRunner::createSingleton(); + RiaQuantityInfoTools::initializeSummaryKeywords(); RiaApplication* app = new RiaConsoleApplication( argc, argv ); app->initialize(); diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp index b30d7e3e70..b366d29267 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp @@ -20,6 +20,8 @@ #include "RifEclipseSummaryAddress.h" +#include "cafAppEnum.h" + #include #include @@ -190,2147 +192,36 @@ std::string RiuSummaryQuantityNameInfoProvider::longNameFromVectorName( const st : vectorName; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuSummaryQuantityNameInfoProvider::setQuantityInfos( const std::unordered_map>& infos ) +{ + for ( const auto& [key, content] : infos ) + { + m_summaryToDescMap.insert( { key, { enumFromString( content.first ), content.second } } ); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RiuSummaryQuantityNameInfoProvider::RiuSummaryQuantityNameInfoProvider() { - m_summaryToDescMap = createInfoForEclipseKeywords(); - - auto infoFor6x = createInfoFor6xKeywords(); - for ( const auto& other : infoFor6x ) - { - if ( m_summaryToDescMap.count( other.first ) == 0 ) - { - m_summaryToDescMap.insert( other ); - } - } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::unordered_map - RiuSummaryQuantityNameInfoProvider::createInfoForEclipseKeywords() +std::string RiuSummaryQuantityNameInfoProvider::stringFromEnum( RifEclipseSummaryAddressDefines::SummaryCategory category ) { - using A = RifEclipseSummaryAddressDefines::SummaryCategory; - - std::unordered_map info; - - info.insert( { "FOPR", { A::SUMMARY_FIELD, "Oil Production Rate" } } ); - info.insert( { "FOPRA", { A::SUMMARY_FIELD, "Oil Production Rate above GOC" } } ); - info.insert( { "FOPRB", { A::SUMMARY_FIELD, "Oil Production Rate below GOC" } } ); - info.insert( { "FOPTA", { A::SUMMARY_FIELD, "Oil Production Total above GOC" } } ); - info.insert( { "FOPTB", { A::SUMMARY_FIELD, "Oil Production Total below GOC" } } ); - info.insert( { "FOPR1", { A::SUMMARY_FIELD, "Oil Production Rate above GOC" } } ); - info.insert( { "FOPR2", { A::SUMMARY_FIELD, "Oil Production Rate below GOC" } } ); - info.insert( { "FOPT1", { A::SUMMARY_FIELD, "Oil Production Total above GOC" } } ); - info.insert( { "FOPT2", { A::SUMMARY_FIELD, "Oil Production Total below GOC" } } ); - info.insert( { "FOMR", { A::SUMMARY_FIELD, "Oil Mass Rate" } } ); - info.insert( { "FOMT", { A::SUMMARY_FIELD, "Oil Mass Total" } } ); - info.insert( { "FODN", { A::SUMMARY_FIELD, "Oil Density at Surface Conditions" } } ); - info.insert( { "FOPRH", { A::SUMMARY_FIELD, "Oil Production Rate History" } } ); - info.insert( { "FOPRT", { A::SUMMARY_FIELD, "Oil Production Rate Target/Limit" } } ); - info.insert( { "FOPRF", { A::SUMMARY_FIELD, "Free Oil Production Rate" } } ); - info.insert( { "FOPRS", { A::SUMMARY_FIELD, "Solution Oil Production Rate" } } ); - info.insert( { "FOPT", { A::SUMMARY_FIELD, "Oil Production Total" } } ); - info.insert( { "FOPTH", { A::SUMMARY_FIELD, "Oil Production Total History" } } ); - info.insert( { "FOPTF", { A::SUMMARY_FIELD, "Free Oil Production Total" } } ); - info.insert( { "FOPTS", { A::SUMMARY_FIELD, "Solution Oil Production Total" } } ); - info.insert( { "FOIR", { A::SUMMARY_FIELD, "Oil Injection Rate" } } ); - info.insert( { "FOIRH", { A::SUMMARY_FIELD, "Oil Injection Rate History" } } ); - info.insert( { "FOIRT", { A::SUMMARY_FIELD, "Oil Injection Rate Target/Limit" } } ); - info.insert( { "FOIT", { A::SUMMARY_FIELD, "Oil Injection Total" } } ); - info.insert( { "FOITH", { A::SUMMARY_FIELD, "Oil Injection Total History" } } ); - info.insert( { "FOPP", { A::SUMMARY_FIELD, "Oil Potential Production rate" } } ); - info.insert( { "FOPP2", { A::SUMMARY_FIELD, "Oil Potential Production rate" } } ); - info.insert( { "FOPI", { A::SUMMARY_FIELD, "Oil Potential Injection rate" } } ); - info.insert( { "FOPI2", { A::SUMMARY_FIELD, "Oil Potential Injection rate" } } ); - info.insert( { "FOVPR", { A::SUMMARY_FIELD, "Oil Voidage Production Rate" } } ); - info.insert( { "FOVPT", { A::SUMMARY_FIELD, "Oil Voidage Production Total" } } ); - info.insert( { "FOVIR", { A::SUMMARY_FIELD, "Oil Voidage Injection Rate" } } ); - info.insert( { "FOVIT", { A::SUMMARY_FIELD, "Oil Voidage Injection Total" } } ); - info.insert( { "FOnPR", { A::SUMMARY_FIELD, "nth separator stage oil rate" } } ); - info.insert( { "FOnPT", { A::SUMMARY_FIELD, "nth separator stage oil total" } } ); - info.insert( { "FEOR", { A::SUMMARY_FIELD, "Export Oil Rate" } } ); - info.insert( { "FEOT", { A::SUMMARY_FIELD, "Export Oil Total" } } ); - info.insert( { "FEOMF", { A::SUMMARY_FIELD, "Export Oil Mole Fraction" } } ); - info.insert( { "FWPR", { A::SUMMARY_FIELD, "Water Production Rate" } } ); - info.insert( { "FWMR", { A::SUMMARY_FIELD, "Water Mass Rate" } } ); - info.insert( { "FWMT", { A::SUMMARY_FIELD, "Water Mass Total" } } ); - info.insert( { "FWPRH", { A::SUMMARY_FIELD, "Water Production Rate History" } } ); - info.insert( { "FWPRT", { A::SUMMARY_FIELD, "Water Production Rate Target/Limit" } } ); - info.insert( { "FWPT", { A::SUMMARY_FIELD, "Water Production Total" } } ); - info.insert( { "FWPTH", { A::SUMMARY_FIELD, "Water Production Total History" } } ); - info.insert( { "FWIR", { A::SUMMARY_FIELD, "Water Injection Rate" } } ); - info.insert( { "FWIRH", { A::SUMMARY_FIELD, "Water Injection Rate History" } } ); - info.insert( { "FWIRT", { A::SUMMARY_FIELD, "Water Injection Rate Target/Limit" } } ); - info.insert( { "FWIT", { A::SUMMARY_FIELD, "Water Injection Total" } } ); - info.insert( { "FWITH", { A::SUMMARY_FIELD, "Water Injection Total History" } } ); - info.insert( { "FWPP", { A::SUMMARY_FIELD, "Water Potential Production rate" } } ); - info.insert( { "FWPP2", { A::SUMMARY_FIELD, "Water Potential Production rate" } } ); - info.insert( { "FWPI", { A::SUMMARY_FIELD, "Water Potential Injection rate" } } ); - info.insert( { "FWPI2", { A::SUMMARY_FIELD, "Water Potential Injection rate" } } ); - info.insert( { "FWVPR", { A::SUMMARY_FIELD, "Water Voidage Production Rate" } } ); - info.insert( { "FWVPT", { A::SUMMARY_FIELD, "Water Voidage Production Total" } } ); - info.insert( { "FWVIR", { A::SUMMARY_FIELD, "Water Voidage Injection Rate" } } ); - info.insert( { "FWVIT", { A::SUMMARY_FIELD, "Water Voidage Injection Total" } } ); - info.insert( { "FWPIR", { A::SUMMARY_FIELD, "Ratio of produced water to injected water (percentage)" } } ); - info.insert( { "FWMPR", { A::SUMMARY_FIELD, "Water component molar production rate" } } ); - info.insert( { "FWMPT", { A::SUMMARY_FIELD, "Water component molar production total" } } ); - info.insert( { "FWMIR", { A::SUMMARY_FIELD, "Water component molar injection rate" } } ); - info.insert( { "FWMIT", { A::SUMMARY_FIELD, "Water component molar injection total" } } ); - info.insert( { "FGPR", { A::SUMMARY_FIELD, "Gas Production Rate" } } ); - info.insert( { "FGPRA", { A::SUMMARY_FIELD, "Gas Production Rate above" } } ); - info.insert( { "FGPRB", { A::SUMMARY_FIELD, "Gas Production Rate below" } } ); - info.insert( { "FGPTA", { A::SUMMARY_FIELD, "Gas Production Total above" } } ); - info.insert( { "FGPTB", { A::SUMMARY_FIELD, "Gas Production Total below" } } ); - info.insert( { "FGPR1", { A::SUMMARY_FIELD, "Gas Production Rate above GOC" } } ); - info.insert( { "FGPR2", { A::SUMMARY_FIELD, "Gas Production Rate below GOC" } } ); - info.insert( { "FGPT1", { A::SUMMARY_FIELD, "Gas Production Total above GOC" } } ); - info.insert( { "FGPT2", { A::SUMMARY_FIELD, "Gas Production Total below GOC" } } ); - info.insert( { "FGMR", { A::SUMMARY_FIELD, "Gas Mass Rate" } } ); - info.insert( { "FGMT", { A::SUMMARY_FIELD, "Gas Mass Total" } } ); - info.insert( { "FGDN", { A::SUMMARY_FIELD, "Gas Density at Surface Conditions" } } ); - info.insert( { "FGPRH", { A::SUMMARY_FIELD, "Gas Production Rate History" } } ); - info.insert( { "FGPRT", { A::SUMMARY_FIELD, "Gas Production Rate Target/Limit" } } ); - info.insert( { "FGPRF", { A::SUMMARY_FIELD, "Free Gas Production Rate" } } ); - info.insert( { "FGPRS", { A::SUMMARY_FIELD, "Solution Gas Production Rate" } } ); - info.insert( { "FGPT", { A::SUMMARY_FIELD, "Gas Production Total" } } ); - info.insert( { "FGPTH", { A::SUMMARY_FIELD, "Gas Production Total History" } } ); - info.insert( { "FGPTF", { A::SUMMARY_FIELD, "Free Gas Production Total" } } ); - info.insert( { "FGPTS", { A::SUMMARY_FIELD, "Solution Gas Production Total" } } ); - info.insert( { "FGIR", { A::SUMMARY_FIELD, "Gas Injection Rate" } } ); - info.insert( { "FGIRH", { A::SUMMARY_FIELD, "Gas Injection Rate History" } } ); - info.insert( { "FGIRT", { A::SUMMARY_FIELD, "Gas Injection Rate Target/Limit" } } ); - info.insert( { "FGIT", { A::SUMMARY_FIELD, "Gas Injection Total" } } ); - info.insert( { "FGITH", { A::SUMMARY_FIELD, "Gas Injection Total History" } } ); - info.insert( { "FGPP", { A::SUMMARY_FIELD, "Gas Potential Production rate" } } ); - info.insert( { "FGPP2", { A::SUMMARY_FIELD, "Gas Potential Production rate" } } ); - info.insert( { "FGPPS", { A::SUMMARY_FIELD, "Solution" } } ); - info.insert( { "FGPPS2", { A::SUMMARY_FIELD, "Solution" } } ); - info.insert( { "FGPPF", { A::SUMMARY_FIELD, "Free Gas Potential Production rate" } } ); - info.insert( { "FGPPF2", { A::SUMMARY_FIELD, "Free Gas Potential Production rate" } } ); - info.insert( { "FGPI", { A::SUMMARY_FIELD, "Gas Potential Injection rate" } } ); - info.insert( { "FGPI2", { A::SUMMARY_FIELD, "Gas Potential Injection rate" } } ); - info.insert( { "FSGR", { A::SUMMARY_FIELD, "Sales Gas Rate" } } ); - info.insert( { "FGSR", { A::SUMMARY_FIELD, "Sales Gas Rate" } } ); - info.insert( { "FSGT", { A::SUMMARY_FIELD, "Sales Gas Total" } } ); - info.insert( { "FGST", { A::SUMMARY_FIELD, "Sales Gas Total" } } ); - info.insert( { "FSMF", { A::SUMMARY_FIELD, "Sales Gas Mole Fraction" } } ); - info.insert( { "FFGR", { A::SUMMARY_FIELD, "Fuel Gas Rate, at and below this group" } } ); - info.insert( { "FFGT", { A::SUMMARY_FIELD, "Fuel Gas cumulative Total, at and below this group" } } ); - info.insert( { "FFMF", { A::SUMMARY_FIELD, "Fuel Gas Mole Fraction" } } ); - info.insert( { "FGCR", { A::SUMMARY_FIELD, "Gas Consumption Rate, at and below this group" } } ); - info.insert( { "FGCT", { A::SUMMARY_FIELD, "Gas Consumption Total, at and below this group" } } ); - info.insert( { "FGIMR", { A::SUMMARY_FIELD, "Gas Import Rate, at and below this group" } } ); - info.insert( { "FGIMT", { A::SUMMARY_FIELD, "Gas Import Total, at and below this group" } } ); - info.insert( { "FGLIR", { A::SUMMARY_FIELD, "Gas Lift Injection Rate" } } ); - info.insert( { "FGLIT", { A::SUMMARY_FIELD, "Gas Lift Injection Total" } } ); - info.insert( { "FWGPR", { A::SUMMARY_FIELD, "Wet Gas Production Rate" } } ); - info.insert( { "FWGPT", { A::SUMMARY_FIELD, "Wet Gas Production Total" } } ); - info.insert( { "FWGPRH", { A::SUMMARY_FIELD, "Wet Gas Production Rate History" } } ); - info.insert( { "FWGIR", { A::SUMMARY_FIELD, "Wet Gas Injection Rate" } } ); - info.insert( { "FWGIT", { A::SUMMARY_FIELD, "Wet Gas Injection Total" } } ); - info.insert( { "FEGR", { A::SUMMARY_FIELD, "Export Gas Rate" } } ); - info.insert( { "FEGT", { A::SUMMARY_FIELD, "Export Gas Total" } } ); - info.insert( { "FEMF", { A::SUMMARY_FIELD, "Export Gas Mole Fraction" } } ); - info.insert( { "FEXGR", { A::SUMMARY_FIELD, "Excess Gas Rate" } } ); - info.insert( { "FEXGT", { A::SUMMARY_FIELD, "Excess Gas Total" } } ); - info.insert( { "FRGR", { A::SUMMARY_FIELD, "Re-injection Gas Rate" } } ); - info.insert( { "FRGT", { A::SUMMARY_FIELD, "Re-injection Gas Total" } } ); - info.insert( { "FGnPR", { A::SUMMARY_FIELD, "nth separator stage gas rate" } } ); - info.insert( { "FGnPT", { A::SUMMARY_FIELD, "nth separator stage gas total" } } ); - info.insert( { "FGVPR", { A::SUMMARY_FIELD, "Gas Voidage Production Rate" } } ); - info.insert( { "FGVPT", { A::SUMMARY_FIELD, "Gas Voidage Production Total" } } ); - info.insert( { "FGVIR", { A::SUMMARY_FIELD, "Gas Voidage Injection Rate" } } ); - info.insert( { "FGVIT", { A::SUMMARY_FIELD, "Gas Voidage Injection Total" } } ); - info.insert( { "FGQ", { A::SUMMARY_FIELD, "Gas Quality" } } ); - info.insert( { "FLPR", { A::SUMMARY_FIELD, "Liquid Production Rate" } } ); - info.insert( { "FLPRH", { A::SUMMARY_FIELD, "Liquid Production Rate History" } } ); - info.insert( { "FLPRT", { A::SUMMARY_FIELD, "Liquid Production Rate Target/Limit" } } ); - info.insert( { "FLPT", { A::SUMMARY_FIELD, "Liquid Production Total" } } ); - info.insert( { "FLPTH", { A::SUMMARY_FIELD, "Liquid Production Total History" } } ); - info.insert( { "FVPR", { A::SUMMARY_FIELD, "Res Volume Production Rate" } } ); - info.insert( { "FVPRT", { A::SUMMARY_FIELD, "Res Volume Production Rate Target/Limit" } } ); - info.insert( { "FVPT", { A::SUMMARY_FIELD, "Res Volume Production Total" } } ); - info.insert( { "FVIR", { A::SUMMARY_FIELD, "Res Volume Injection Rate" } } ); - info.insert( { "FVIRT", { A::SUMMARY_FIELD, "Res Volume Injection Rate Target/Limit" } } ); - info.insert( { "FVIT", { A::SUMMARY_FIELD, "Res Volume Injection Total" } } ); - info.insert( { "FWCT", { A::SUMMARY_FIELD, "Water Cut" } } ); - info.insert( { "FWCTH", { A::SUMMARY_FIELD, "Water Cut History" } } ); - info.insert( { "FGOR", { A::SUMMARY_FIELD, "Gas-Oil Ratio" } } ); - info.insert( { "FGORH", { A::SUMMARY_FIELD, "Gas-Oil Ratio History" } } ); - info.insert( { "FOGR", { A::SUMMARY_FIELD, "Oil-Gas Ratio" } } ); - info.insert( { "FOGRH", { A::SUMMARY_FIELD, "Oil-Gas Ratio History" } } ); - info.insert( { "FWGR", { A::SUMMARY_FIELD, "Water-Gas Ratio" } } ); - info.insert( { "FWGRH", { A::SUMMARY_FIELD, "Water-Gas Ratio History" } } ); - info.insert( { "FGLR", { A::SUMMARY_FIELD, "Gas-Liquid Ratio" } } ); - info.insert( { "FGLRH", { A::SUMMARY_FIELD, "Gas-Liquid Ratio History" } } ); - info.insert( { "FMCTP", { A::SUMMARY_FIELD, "Mode of Control for group Production" } } ); - info.insert( { "FMCTW", { A::SUMMARY_FIELD, "Mode of Control for group Water Injection" } } ); - info.insert( { "FMCTG", { A::SUMMARY_FIELD, "Mode of Control for group Gas Injection" } } ); - info.insert( { "FMWPT", { A::SUMMARY_FIELD, "Total number of production wells" } } ); - info.insert( { "FMWPR", { A::SUMMARY_FIELD, "Number of production wells currently flowing" } } ); - info.insert( { "FMWPA", { A::SUMMARY_FIELD, "Number of abandoned production wells" } } ); - info.insert( { "FMWPU", { A::SUMMARY_FIELD, "Number of unused production wells" } } ); - info.insert( { "FMWPG", { A::SUMMARY_FIELD, "Number of producers on group control" } } ); - info.insert( { "FMWPO", { A::SUMMARY_FIELD, "Number of producers controlled by own oil rate limit" } } ); - info.insert( { "FMWPS", { A::SUMMARY_FIELD, "Number of producers on own surface rate limit control" } } ); - info.insert( { "FMWPV", { A::SUMMARY_FIELD, "Number of producers on own reservoir volume rate limit control" } } ); - info.insert( { "FMWPP", { A::SUMMARY_FIELD, "Number of producers on pressure control" } } ); - info.insert( { "FMWPL", { A::SUMMARY_FIELD, "Number of producers using artificial lift" } } ); - info.insert( { "FMWIT", { A::SUMMARY_FIELD, "Total number of injection wells" } } ); - info.insert( { "FMWIN", { A::SUMMARY_FIELD, "Number of injection wells currently flowing" } } ); - info.insert( { "FMWIA", { A::SUMMARY_FIELD, "Number of abandoned injection wells" } } ); - info.insert( { "FMWIU", { A::SUMMARY_FIELD, "Number of unused injection wells" } } ); - info.insert( { "FMWIG", { A::SUMMARY_FIELD, "Number of injectors on group control" } } ); - info.insert( { "FMWIS", { A::SUMMARY_FIELD, "Number of injectors on own surface rate limit control" } } ); - info.insert( { "FMWIV", { A::SUMMARY_FIELD, "Number of injectors on own reservoir volume rate limit control" } } ); - info.insert( { "FMWIP", { A::SUMMARY_FIELD, "Number of injectors on pressure control" } } ); - info.insert( { "FMWDR", { A::SUMMARY_FIELD, "Number of drilling events this timestep" } } ); - info.insert( { "FMWDT", { A::SUMMARY_FIELD, "Number of drilling events in total" } } ); - info.insert( { "FMWWO", { A::SUMMARY_FIELD, "Number of workover events this timestep" } } ); - info.insert( { "FMWWT", { A::SUMMARY_FIELD, "Number of workover events in total" } } ); - info.insert( { "FEPR", { A::SUMMARY_FIELD, "Energy Production Rate" } } ); - info.insert( { "FEPT", { A::SUMMARY_FIELD, "Energy Production Total" } } ); - info.insert( { "FNLPR", { A::SUMMARY_FIELD, "NGL Production Rate" } } ); - info.insert( { "FNLPT", { A::SUMMARY_FIELD, "NGL Production Total" } } ); - info.insert( { "FNLPRH", { A::SUMMARY_FIELD, "NGL Production Rate History" } } ); - info.insert( { "FNLPTH", { A::SUMMARY_FIELD, "NGL Production Total History" } } ); - info.insert( { "FAMF", { A::SUMMARY_FIELD, "Component aqueous mole fraction, from producing completions" } } ); - info.insert( { "FXMF", { A::SUMMARY_FIELD, "Liquid Mole Fraction" } } ); - info.insert( { "FYMF", { A::SUMMARY_FIELD, "Vapor Mole Fraction" } } ); - info.insert( { "FXMFn", { A::SUMMARY_FIELD, "Liquid Mole Fraction for nth separator stage" } } ); - info.insert( { "FYMFn", { A::SUMMARY_FIELD, "Vapor Mole Fraction for nth separator stage" } } ); - info.insert( { "FZMF", { A::SUMMARY_FIELD, "Total Mole Fraction" } } ); - info.insert( { "FCMPR", { A::SUMMARY_FIELD, "Hydrocarbon Component Molar Production Rates" } } ); - info.insert( { "FCMPT", { A::SUMMARY_FIELD, "Hydrocarbon Component" } } ); - info.insert( { "FCMIR", { A::SUMMARY_FIELD, "Hydrocarbon Component Molar Injection Rates" } } ); - info.insert( { "FCMIT", { A::SUMMARY_FIELD, "Hydrocarbon Component Molar Injection Totals" } } ); - info.insert( { "FHMIR", { A::SUMMARY_FIELD, "Hydrocarbon Molar Injection Rate" } } ); - info.insert( { "FHMIT", { A::SUMMARY_FIELD, "Hydrocarbon Molar Injection Total" } } ); - info.insert( { "FHMPR", { A::SUMMARY_FIELD, "Hydrocarbon Molar Production Rate" } } ); - info.insert( { "FHMPT", { A::SUMMARY_FIELD, "Hydrocarbon Molar Production Total" } } ); - info.insert( { "FCHMR", { A::SUMMARY_FIELD, "Hydrocarbon Component" } } ); - info.insert( { "FCHMT", { A::SUMMARY_FIELD, "Hydrocarbon Component" } } ); - info.insert( { "FCWGPR", { A::SUMMARY_FIELD, "Hydrocarbon Component Wet Gas Production Rate" } } ); - info.insert( { "FCWGPT", { A::SUMMARY_FIELD, "Hydrocarbon Component Wet Gas Production Total" } } ); - info.insert( { "FCWGIR", { A::SUMMARY_FIELD, "Hydrocarbon Component Wet Gas Injection Rate" } } ); - info.insert( { "FCWGIT", { A::SUMMARY_FIELD, "Hydrocarbon Component Wet Gas Injection Total" } } ); - info.insert( { "FCGMR", { A::SUMMARY_FIELD, "Hydrocarbon component" } } ); - info.insert( { "FCGMT", { A::SUMMARY_FIELD, "Hydrocarbon component" } } ); - info.insert( { "FCOMR", { A::SUMMARY_FIELD, "Hydrocarbon component" } } ); - info.insert( { "FCOMT", { A::SUMMARY_FIELD, "Hydrocarbon component" } } ); - info.insert( { "FCNMR", { A::SUMMARY_FIELD, "Hydrocarbon component molar rates in the NGL phase" } } ); - info.insert( { "FCNWR", { A::SUMMARY_FIELD, "Hydrocarbon component mass rates in the NGL phase" } } ); - info.insert( { "FCGMRn", { A::SUMMARY_FIELD, "Hydrocarbon component molar rates in the gas phase for nth separator stage" } } ); - info.insert( { "FCGRn", { A::SUMMARY_FIELD, "Hydrocarbon component molar rates in the gas phase for nth separator stage" } } ); - info.insert( { "FCOMRn", { A::SUMMARY_FIELD, "Hydrocarbon component" } } ); - info.insert( { "FCORn", { A::SUMMARY_FIELD, "Hydrocarbon component" } } ); - info.insert( { "FMUF", { A::SUMMARY_FIELD, "Make-up fraction" } } ); - info.insert( { "FAMR", { A::SUMMARY_FIELD, "Make-up gas rate" } } ); - info.insert( { "FAMT", { A::SUMMARY_FIELD, "Make-up gas total" } } ); - info.insert( { "FGSPR", { A::SUMMARY_FIELD, "Target sustainable rate for most recent sustainable capacity test for gas" } } ); - info.insert( { "FGSRL", - { A::SUMMARY_FIELD, - "Maximum tested rate sustained for the test period during the most recent " - "sustainable capacity test for gas" } } ); - info.insert( { "FGSRU", - { A::SUMMARY_FIELD, - "Minimum tested rate not sustained for the test period during the most recent " - "sustainable capacity test for gas" } } ); - info.insert( { "FGSSP", - { A::SUMMARY_FIELD, - "Period for which target sustainable rate could be maintained for the most recent " - "sustainable capacity test for gas" } } ); - info.insert( { "FGSTP", { A::SUMMARY_FIELD, "Test period for the most recent sustainable capacity test for gas" } } ); - info.insert( { "FOSPR", { A::SUMMARY_FIELD, "Target sustainable rate for most recent sustainable capacity test for oil" } } ); - info.insert( { "FOSRL", - { A::SUMMARY_FIELD, - "Maximum tested rate sustained for the test period during the most recent " - "sustainable capacity test for oil" } } ); - info.insert( { "FOSRU", - { A::SUMMARY_FIELD, - "Minimum tested rate not sustained for the test period during the most recent " - "sustainable capacity test for oil" } } ); - info.insert( { "FOSSP", - { A::SUMMARY_FIELD, - "Period for which target sustainable rate could be maintained for the most recent " - "sustainable capacity test for oil" } } ); - info.insert( { "FOSTP", { A::SUMMARY_FIELD, "Test period for the most recent sustainable capacity test for oil" } } ); - info.insert( { "FWSPR", { A::SUMMARY_FIELD, "Target sustainable rate for most recent sustainable capacity test for water" } } ); - info.insert( { "FWSRL", - { A::SUMMARY_FIELD, - "Maximum tested rate sustained for the test period during the most recent " - "sustainable capacity test for water" } } ); - info.insert( { "FWSRU", - { A::SUMMARY_FIELD, - "Minimum tested rate not sustained for the test period during the most recent " - "sustainable capacity test for water" } } ); - info.insert( { "FWSSP", - { A::SUMMARY_FIELD, - "Period for which target sustainable rate could be maintained for the most recent " - "sustainable capacity test " - "for water" } } ); - info.insert( { "FWSTP", { A::SUMMARY_FIELD, "Test period for the most recent sustainable capacity test for water" } } ); - info.insert( { "FGPRG", { A::SUMMARY_FIELD, "Gas production rate" } } ); - info.insert( { "FOPRG", { A::SUMMARY_FIELD, "Oil production rate" } } ); - info.insert( { "FNLPRG", { A::SUMMARY_FIELD, "NGL production rate" } } ); - info.insert( { "FXMFG", { A::SUMMARY_FIELD, "Liquid mole fraction" } } ); - info.insert( { "FYMFG", { A::SUMMARY_FIELD, "Vapor mole fraction" } } ); - info.insert( { "FCOMRG", { A::SUMMARY_FIELD, "Hydrocarbon component" } } ); - info.insert( { "FCGMRG", { A::SUMMARY_FIELD, "Hydrocarbon component molar rates in the gas phase" } } ); - info.insert( { "FCNMRG", { A::SUMMARY_FIELD, "Hydrocarbon component molar rates in the NGL phase" } } ); - info.insert( { "FPR", { A::SUMMARY_FIELD, "Pressure average value" } } ); - info.insert( { "FPRH", { A::SUMMARY_FIELD, "Pressure average value" } } ); - info.insert( { "FPRP", { A::SUMMARY_FIELD, "Pressure average value" } } ); - info.insert( { "FPRGZ", { A::SUMMARY_FIELD, "P/Z" } } ); - info.insert( { "FRS", { A::SUMMARY_FIELD, "Gas-oil ratio" } } ); - info.insert( { "FRV", { A::SUMMARY_FIELD, "Oil-gas ratio" } } ); - info.insert( { "FCHIP", { A::SUMMARY_FIELD, "Component Hydrocarbon as Wet Gas" } } ); - info.insert( { "FCMIP", { A::SUMMARY_FIELD, "Component Hydrocarbon as Moles" } } ); - info.insert( { "FPPC", { A::SUMMARY_FIELD, "Initial Contact Corrected Potential" } } ); - info.insert( { "FREAC", { A::SUMMARY_FIELD, "Reaction rate. The reaction number is given as a component index" } } ); - info.insert( { "FREAT", { A::SUMMARY_FIELD, "Reaction total. The reaction number is given as a component index" } } ); - info.insert( { "FRPV", { A::SUMMARY_FIELD, "Pore Volume at Reservoir conditions" } } ); - info.insert( { "FOPV", { A::SUMMARY_FIELD, "Pore Volume containing Oil" } } ); - info.insert( { "FWPV", { A::SUMMARY_FIELD, "Pore Volume containing Water" } } ); - info.insert( { "FGPV", { A::SUMMARY_FIELD, "Pore Volume containing Gas" } } ); - info.insert( { "FHPV", { A::SUMMARY_FIELD, "Pore Volume containing Hydrocarbon" } } ); - info.insert( { "FRTM", { A::SUMMARY_FIELD, "Transmissibility Multiplier associated with rock compaction" } } ); - info.insert( { "FOE", { A::SUMMARY_FIELD, "(OIP(initial) - OIP(now)) / OIP(initial)" } } ); - info.insert( { "FOEW", { A::SUMMARY_FIELD, "Oil Production from Wells / OIP(initial)" } } ); - info.insert( { "FOEIW", { A::SUMMARY_FIELD, "(OIP(initial) - OIP(now)) / Initial Mobile Oil with respect to Water" } } ); - info.insert( { "FOEWW", { A::SUMMARY_FIELD, "Oil Production from Wells / Initial Mobile Oil with respect to Water" } } ); - info.insert( { "FOEIG", { A::SUMMARY_FIELD, "(OIP(initial) - OIP(now)) / Initial Mobile Oil with respect to Gas" } } ); - info.insert( { "FOEWG", { A::SUMMARY_FIELD, "Oil Production from Wells / Initial Mobile Oil with respect to Gas" } } ); - info.insert( { "FORMR", { A::SUMMARY_FIELD, "Total stock tank oil produced by rock compaction" } } ); - info.insert( { "FORMW", { A::SUMMARY_FIELD, "Total stock tank oil produced by water influx" } } ); - info.insert( { "FORMG", { A::SUMMARY_FIELD, "Total stock tank oil produced by gas influx" } } ); - info.insert( { "FORME", { A::SUMMARY_FIELD, "Total stock tank oil produced by oil expansion" } } ); - info.insert( { "FORMS", { A::SUMMARY_FIELD, "Total stock tank oil produced by solution gas" } } ); - info.insert( { "FORMF", { A::SUMMARY_FIELD, "Total stock tank oil produced by free gas influx" } } ); - info.insert( { "FORMX", { A::SUMMARY_FIELD, "Total stock tank oil produced by 'traced' water influx" } } ); - info.insert( { "FORMY", { A::SUMMARY_FIELD, "Total stock tank oil produced by other water influx" } } ); - info.insert( { "FORFR", { A::SUMMARY_FIELD, "Fraction of total oil produced by rock compaction" } } ); - info.insert( { "FORFW", { A::SUMMARY_FIELD, "Fraction of total oil produced by water influx" } } ); - info.insert( { "FORFG", { A::SUMMARY_FIELD, "Fraction of total oil produced by gas influx" } } ); - info.insert( { "FORFE", { A::SUMMARY_FIELD, "Fraction of total oil produced by oil expansion" } } ); - info.insert( { "FORFS", { A::SUMMARY_FIELD, "Fraction of total oil produced by solution gas" } } ); - info.insert( { "FORFF", { A::SUMMARY_FIELD, "Fraction of total oil produced by free gas influx" } } ); - info.insert( { "FORFX", { A::SUMMARY_FIELD, "Fraction of total oil produced by 'traced' water influx" } } ); - info.insert( { "FORFY", { A::SUMMARY_FIELD, "Fraction of total oil produced by other water influx" } } ); - info.insert( { "FAQR", { A::SUMMARY_FIELD, "Aquifer influx rate" } } ); - info.insert( { "FAQT", { A::SUMMARY_FIELD, "Cumulative aquifer influx" } } ); - info.insert( { "FAQRG", { A::SUMMARY_FIELD, "Aquifer influx rate" } } ); - info.insert( { "FAQTG", { A::SUMMARY_FIELD, "Cumulative aquifer influx" } } ); - info.insert( { "FAQER", { A::SUMMARY_FIELD, "Aquifer thermal energy influx rate" } } ); - info.insert( { "FAQET", { A::SUMMARY_FIELD, "Cumulative aquifer thermal energy influx" } } ); - info.insert( { "FNQR", { A::SUMMARY_FIELD, "Aquifer influx rate" } } ); - info.insert( { "FNQT", { A::SUMMARY_FIELD, "Cumulative aquifer influx" } } ); - info.insert( { "FTPR", { A::SUMMARY_FIELD, "Tracer Production Rate" } } ); - info.insert( { "FTPT", { A::SUMMARY_FIELD, "Tracer Production Total" } } ); - info.insert( { "FTPC", { A::SUMMARY_FIELD, "Tracer Production Concentration" } } ); - info.insert( { "FTIR", { A::SUMMARY_FIELD, "Tracer Injection Rate" } } ); - info.insert( { "FTIT", { A::SUMMARY_FIELD, "Tracer Injection Total" } } ); - info.insert( { "FTIC", { A::SUMMARY_FIELD, "Tracer Injection Concentration" } } ); - info.insert( { "FTMR", { A::SUMMARY_FIELD, "Traced mass Rate" } } ); - info.insert( { "FTMT", { A::SUMMARY_FIELD, "Traced mass Total" } } ); - info.insert( { "FTQR", { A::SUMMARY_FIELD, "Traced molar Rate" } } ); - info.insert( { "FTCM", { A::SUMMARY_FIELD, "Tracer Carrier molar Rate" } } ); - info.insert( { "FTMF", { A::SUMMARY_FIELD, "Traced molar fraction" } } ); - info.insert( { "FTVL", { A::SUMMARY_FIELD, "Traced liquid volume rate" } } ); - info.insert( { "FTVV", { A::SUMMARY_FIELD, "Traced vapor volume rate" } } ); - info.insert( { "FTTL", { A::SUMMARY_FIELD, "Traced liquid volume total" } } ); - info.insert( { "FTTV", { A::SUMMARY_FIELD, "Traced vapor volume total" } } ); - info.insert( { "FTML", { A::SUMMARY_FIELD, "Traced mass liquid rate" } } ); - info.insert( { "FTMV", { A::SUMMARY_FIELD, "Traced mass vapor rate" } } ); - info.insert( { "FTLM", { A::SUMMARY_FIELD, "Traced mass liquid total" } } ); - info.insert( { "FTVM", { A::SUMMARY_FIELD, "Traced mass vapor total" } } ); - info.insert( { "FTIPT", { A::SUMMARY_FIELD, "Tracer In Place" } } ); - info.insert( { "FTIPF", { A::SUMMARY_FIELD, "Tracer In Place" } } ); - info.insert( { "FTIPS", { A::SUMMARY_FIELD, "Tracer In Place" } } ); - info.insert( { "FAPI", { A::SUMMARY_FIELD, "Oil API" } } ); - info.insert( { "FSPR", { A::SUMMARY_FIELD, "Salt Production Rate" } } ); - info.insert( { "FSPT", { A::SUMMARY_FIELD, "Salt Production Total" } } ); - info.insert( { "FSIR", { A::SUMMARY_FIELD, "Salt Injection Rate" } } ); - info.insert( { "FSIT", { A::SUMMARY_FIELD, "Salt Injection Total" } } ); - info.insert( { "FSPC", { A::SUMMARY_FIELD, "Salt Production Concentration" } } ); - info.insert( { "FSIC", { A::SUMMARY_FIELD, "Salt Injection Concentration" } } ); - info.insert( { "FSIP", { A::SUMMARY_FIELD, "Salt In Place" } } ); - info.insert( { "GTPRANI", { A::SUMMARY_FIELD, "Anion Production Rate" } } ); - info.insert( { "GTPTANI", { A::SUMMARY_FIELD, "Anion Production Total" } } ); - info.insert( { "GTIRANI", { A::SUMMARY_FIELD, "Anion Injection Rate" } } ); - info.insert( { "GTITANI", { A::SUMMARY_FIELD, "Anion Injection Total" } } ); - info.insert( { "GTPRCAT", { A::SUMMARY_FIELD, "Cation Production Rate" } } ); - info.insert( { "GTPTCAT", { A::SUMMARY_FIELD, "Cation Production Total" } } ); - info.insert( { "GTIRCAT", { A::SUMMARY_FIELD, "Cation Injection Rate" } } ); - info.insert( { "GTITCAT", { A::SUMMARY_FIELD, "Cation Injection Total" } } ); - info.insert( { "FTPCHEA", { A::SUMMARY_FIELD, "Production Temperature" } } ); - info.insert( { "FTICHEA", { A::SUMMARY_FIELD, "Injection Temperature" } } ); - info.insert( { "FTPRHEA", { A::SUMMARY_FIELD, "Energy flows" } } ); - info.insert( { "FTPTHEA", { A::SUMMARY_FIELD, "Energy Production Total" } } ); - info.insert( { "FTIRHEA", { A::SUMMARY_FIELD, "Energy flows" } } ); - info.insert( { "FTITHEA", { A::SUMMARY_FIELD, "Energy Injection Total" } } ); - info.insert( { "FTIPTHEA", { A::SUMMARY_FIELD, "Difference in Energy in place between current and initial time" } } ); - info.insert( { "FTPR", { A::SUMMARY_FIELD, "Tracer Production Rate" } } ); - info.insert( { "FTPT", { A::SUMMARY_FIELD, "Tracer Production Total" } } ); - info.insert( { "FTPC", { A::SUMMARY_FIELD, "Tracer Production Concentration" } } ); - info.insert( { "FTIR", { A::SUMMARY_FIELD, "Tracer Injection Rate" } } ); - info.insert( { "FTIT", { A::SUMMARY_FIELD, "Tracer Injection Total" } } ); - info.insert( { "FTIC", { A::SUMMARY_FIELD, "Tracer Injection Concentration" } } ); - info.insert( { "FTIPT", { A::SUMMARY_FIELD, "Tracer In Place" } } ); - info.insert( { "FTIPF", { A::SUMMARY_FIELD, "Tracer In Place" } } ); - info.insert( { "FTIPS", { A::SUMMARY_FIELD, "Tracer In Place" } } ); - info.insert( { "FTIP#", { A::SUMMARY_FIELD, " Tracer In Place in phase # (1,2,3,...)" } } ); - info.insert( { "FTADS", { A::SUMMARY_FIELD, "Tracer Adsorption total" } } ); - info.insert( { "FTDCY", { A::SUMMARY_FIELD, "Decayed tracer" } } ); - info.insert( { "FTIRF", { A::SUMMARY_FIELD, "Tracer Injection Rate" } } ); - info.insert( { "FTIRS", { A::SUMMARY_FIELD, "Tracer Injection Rate" } } ); - info.insert( { "FTPRF", { A::SUMMARY_FIELD, "Tracer Production Rate" } } ); - info.insert( { "FTPRS", { A::SUMMARY_FIELD, "Tracer Production Rate" } } ); - info.insert( { "FTITF", { A::SUMMARY_FIELD, "Tracer Injection Total" } } ); - info.insert( { "FTITS", { A::SUMMARY_FIELD, "Tracer Injection Total" } } ); - info.insert( { "FTPTF", { A::SUMMARY_FIELD, "Tracer Production Total" } } ); - info.insert( { "FTPTS", { A::SUMMARY_FIELD, "Tracer Production Total" } } ); - info.insert( { "FTICF", { A::SUMMARY_FIELD, "Tracer Injection Concentration" } } ); - info.insert( { "FTICS", { A::SUMMARY_FIELD, "Tracer Injection Concentration" } } ); - info.insert( { "FTPCF", { A::SUMMARY_FIELD, "Tracer Production" } } ); - info.insert( { "FTPCS", { A::SUMMARY_FIELD, "Tracer Production" } } ); - info.insert( { "FMPR", { A::SUMMARY_FIELD, "Methane Production Rate" } } ); - info.insert( { "FMPT", { A::SUMMARY_FIELD, "Methane Production Total" } } ); - info.insert( { "FMIR", { A::SUMMARY_FIELD, "Methane Injection Rate" } } ); - info.insert( { "FMIT", { A::SUMMARY_FIELD, "Methane Injection Total" } } ); - info.insert( { "FCGC", { A::SUMMARY_FIELD, "Bulk Coal Gas Concentration" } } ); - info.insert( { "FCSC", { A::SUMMARY_FIELD, "Bulk Coal Solvent Concentration" } } ); - info.insert( { "FTPRFOA", { A::SUMMARY_FIELD, "Production Rate" } } ); - info.insert( { "FTPTFOA", { A::SUMMARY_FIELD, "Production Total" } } ); - info.insert( { "FTIRFOA", { A::SUMMARY_FIELD, "Injection Rate" } } ); - info.insert( { "FTITFOA", { A::SUMMARY_FIELD, "Injection Total" } } ); - info.insert( { "FTIPTFOA", { A::SUMMARY_FIELD, "In Solution" } } ); - info.insert( { "FTADSFOA", { A::SUMMARY_FIELD, "Adsorption total" } } ); - info.insert( { "FTDCYFOA", { A::SUMMARY_FIELD, "Decayed tracer" } } ); - info.insert( { "FTMOBFOA", { A::SUMMARY_FIELD, "Gas mobility factor" } } ); - info.insert( { "FTPRFOA", { A::SUMMARY_FIELD, "Production Rate" } } ); - info.insert( { "FTPTFOA", { A::SUMMARY_FIELD, "Production Total" } } ); - info.insert( { "FTIRFOA", { A::SUMMARY_FIELD, "Injection Rate" } } ); - info.insert( { "FTITFOA", { A::SUMMARY_FIELD, "Injection Total" } } ); - info.insert( { "FTIPTFOA", { A::SUMMARY_FIELD, "In Solution" } } ); - info.insert( { "FTADSFOA", { A::SUMMARY_FIELD, "Adsorption total" } } ); - info.insert( { "FTDCYFOA", { A::SUMMARY_FIELD, "Decayed tracer" } } ); - info.insert( { "FTMOBFOA", { A::SUMMARY_FIELD, "Gas mobility factor" } } ); - info.insert( { "FSGR", { A::SUMMARY_FIELD, "Sales Gas Rate" } } ); - info.insert( { "FGSR", { A::SUMMARY_FIELD, "Sales Gas Rate" } } ); - info.insert( { "FSGT", { A::SUMMARY_FIELD, "Sales Gas Total" } } ); - info.insert( { "FGST", { A::SUMMARY_FIELD, "Sales Gas Total" } } ); - info.insert( { "FGDC", { A::SUMMARY_FIELD, "Gas Delivery Capacity" } } ); - info.insert( { "FGDCQ", { A::SUMMARY_FIELD, "Field/Group Gas DCQ" } } ); - info.insert( { "FGCR", { A::SUMMARY_FIELD, "Gas consumption rate, at and below this group" } } ); - info.insert( { "FGCT", { A::SUMMARY_FIELD, "Gas consumption cumulative total, at and below this group" } } ); - info.insert( { "FFGR", { A::SUMMARY_FIELD, "Fuel Gas rate, at and below this group" } } ); - info.insert( { "FFGT", { A::SUMMARY_FIELD, "Fuel Gas cumulative total, at and below this group" } } ); - info.insert( { "FGIMR", { A::SUMMARY_FIELD, "Gas import rate, at and below this group" } } ); - info.insert( { "FGIMT", { A::SUMMARY_FIELD, "Gas import cumulative total, at and below this group" } } ); - info.insert( { "FGLIR", { A::SUMMARY_FIELD, "Gas Lift Injection Rate" } } ); - info.insert( { "FGCV", { A::SUMMARY_FIELD, "Gas Calorific Value" } } ); - info.insert( { "FGQ", { A::SUMMARY_FIELD, "Gas molar Quality" } } ); - info.insert( { "FEPR", { A::SUMMARY_FIELD, "Energy Production Rate" } } ); - info.insert( { "FEPT", { A::SUMMARY_FIELD, "Energy Production Total" } } ); - info.insert( { "FESR", { A::SUMMARY_FIELD, "Energy Sales Rate" } } ); - info.insert( { "FEST", { A::SUMMARY_FIELD, "Energy Sales Total" } } ); - info.insert( { "FEDC", { A::SUMMARY_FIELD, "Energy Delivery Capacity" } } ); - info.insert( { "FEDCQ", { A::SUMMARY_FIELD, "Energy DCQ" } } ); - info.insert( { "FCPR", { A::SUMMARY_FIELD, "Polymer Production Rate" } } ); - info.insert( { "FCPC", { A::SUMMARY_FIELD, "Polymer Production Concentration" } } ); - info.insert( { "FCPT", { A::SUMMARY_FIELD, "Polymer Production Total" } } ); - info.insert( { "FCIR", { A::SUMMARY_FIELD, "Polymer Injection Rate" } } ); - info.insert( { "FCIC", { A::SUMMARY_FIELD, "Polymer Injection Concentration" } } ); - info.insert( { "FCIT", { A::SUMMARY_FIELD, "Polymer Injection Total" } } ); - info.insert( { "FCIP", { A::SUMMARY_FIELD, "Polymer In Solution" } } ); - info.insert( { "FCAD", { A::SUMMARY_FIELD, "Polymer Adsorption total" } } ); - info.insert( { "FSPR", { A::SUMMARY_FIELD, "Salt Production Rate" } } ); - info.insert( { "FSPT", { A::SUMMARY_FIELD, "Salt Production Total" } } ); - info.insert( { "FSIR", { A::SUMMARY_FIELD, "Salt Injection Rate" } } ); - info.insert( { "FSIT", { A::SUMMARY_FIELD, "Salt Injection Total" } } ); - info.insert( { "FSIP", { A::SUMMARY_FIELD, "Salt In Place" } } ); - info.insert( { "PSSPR", { A::SUMMARY_FIELD, "Log of the pressure change per unit time" } } ); - info.insert( { "PSSSO", { A::SUMMARY_FIELD, "Log of the oil saturation change per unit time" } } ); - info.insert( { "PSSSW", { A::SUMMARY_FIELD, "Log of the water saturation change per unit time" } } ); - info.insert( { "PSSSG", { A::SUMMARY_FIELD, "Log of the gas saturation change per unit time" } } ); - info.insert( { "PSSSC", { A::SUMMARY_FIELD, "Log of the salt concentration change per unit time" } } ); - info.insert( { "FNPR", { A::SUMMARY_FIELD, "Solvent Production Rate" } } ); - info.insert( { "FNPT", { A::SUMMARY_FIELD, "Solvent Production Total" } } ); - info.insert( { "FNIR", { A::SUMMARY_FIELD, "Solvent Injection Rate" } } ); - info.insert( { "FNIT", { A::SUMMARY_FIELD, "Solvent Injection Total" } } ); - info.insert( { "FNIP", { A::SUMMARY_FIELD, "Solvent In Place" } } ); - info.insert( { "FTPRSUR", { A::SUMMARY_FIELD, "Production Rate" } } ); - info.insert( { "FTPTSUR", { A::SUMMARY_FIELD, "Production Total" } } ); - info.insert( { "FTIRSUR", { A::SUMMARY_FIELD, "Injection Rate" } } ); - info.insert( { "FTITSUR", { A::SUMMARY_FIELD, "Injection Total" } } ); - info.insert( { "FTIPTSUR", { A::SUMMARY_FIELD, "In Solution" } } ); - info.insert( { "FTADSUR", { A::SUMMARY_FIELD, "Adsorption total" } } ); - info.insert( { "FTPRALK", { A::SUMMARY_FIELD, "Production Rate" } } ); - info.insert( { "FTPTALK", { A::SUMMARY_FIELD, "Production Total" } } ); - info.insert( { "FTIRALK", { A::SUMMARY_FIELD, "Injection Rate" } } ); - info.insert( { "FTITALK", { A::SUMMARY_FIELD, "Injection Total" } } ); - info.insert( { "FU", { A::SUMMARY_FIELD, "User-defined field quantity" } } ); - - info.insert( { "GOPR", { A::SUMMARY_GROUP, "Oil Production Rate" } } ); - info.insert( { "GOPRA", { A::SUMMARY_GROUP, "Oil Production Rate above GOC" } } ); - info.insert( { "GOPRB", { A::SUMMARY_GROUP, "Oil Production Rate below GOC" } } ); - info.insert( { "GOPTA", { A::SUMMARY_GROUP, "Oil Production Total above GOC" } } ); - info.insert( { "GOPTB", { A::SUMMARY_GROUP, "Oil Production Total below GOC" } } ); - info.insert( { "GOPR1", { A::SUMMARY_GROUP, "Oil Production Rate above GOC" } } ); - info.insert( { "GOPR2", { A::SUMMARY_GROUP, "Oil Production Rate below GOC" } } ); - info.insert( { "GOPT1", { A::SUMMARY_GROUP, "Oil Production Total above GOC" } } ); - info.insert( { "GOPT2", { A::SUMMARY_GROUP, "Oil Production Total below GOC" } } ); - info.insert( { "GOMR", { A::SUMMARY_GROUP, "Oil Mass Rate" } } ); - info.insert( { "GOMT", { A::SUMMARY_GROUP, "Oil Mass Total" } } ); - info.insert( { "GODN", { A::SUMMARY_GROUP, "Oil Density at Surface Conditions" } } ); - info.insert( { "GOPRH", { A::SUMMARY_GROUP, "Oil Production Rate History" } } ); - info.insert( { "GOPRT", { A::SUMMARY_GROUP, "Oil Production Rate Target/Limit" } } ); - info.insert( { "GOPRL", { A::SUMMARY_GROUP, "Oil Production Rate Target/Limit" } } ); - info.insert( { "GOPRF", { A::SUMMARY_GROUP, "Free Oil Production Rate" } } ); - info.insert( { "GOPRS", { A::SUMMARY_GROUP, "Solution Oil Production Rate" } } ); - info.insert( { "GOPT", { A::SUMMARY_GROUP, "Oil Production Total" } } ); - info.insert( { "GOPTH", { A::SUMMARY_GROUP, "Oil Production Total History" } } ); - info.insert( { "GOPTF", { A::SUMMARY_GROUP, "Free Oil Production Total" } } ); - info.insert( { "GOPTS", { A::SUMMARY_GROUP, "Solution Oil Production Total" } } ); - info.insert( { "GOIR", { A::SUMMARY_GROUP, "Oil Injection Rate" } } ); - info.insert( { "GOIRH", { A::SUMMARY_GROUP, "Oil Injection Rate History" } } ); - info.insert( { "GOIRT", { A::SUMMARY_GROUP, "Oil Injection Rate Target/Limit" } } ); - info.insert( { "GOIRL", { A::SUMMARY_GROUP, "Oil Injection Rate Target/Limit" } } ); - info.insert( { "GOIT", { A::SUMMARY_GROUP, "Oil Injection Total" } } ); - info.insert( { "GOITH", { A::SUMMARY_GROUP, "Oil Injection Total History" } } ); - info.insert( { "GOPP", { A::SUMMARY_GROUP, "Oil Potential Production rate" } } ); - info.insert( { "GOPP2", { A::SUMMARY_GROUP, "Oil Potential Production rate" } } ); - info.insert( { "GOPI", { A::SUMMARY_GROUP, "Oil Potential Injection rate" } } ); - info.insert( { "GOPI2", { A::SUMMARY_GROUP, "Oil Potential Injection rate" } } ); - info.insert( { "GOPGR", { A::SUMMARY_GROUP, "Oil Production Guide Rate" } } ); - info.insert( { "GOIGR", { A::SUMMARY_GROUP, "Oil Injection Guide Rate" } } ); - info.insert( { "GOVPR", { A::SUMMARY_GROUP, "Oil Voidage Production Rate" } } ); - info.insert( { "GOVPT", { A::SUMMARY_GROUP, "Oil Voidage Production Total" } } ); - info.insert( { "GOVIR", { A::SUMMARY_GROUP, "Oil Voidage Injection Rate" } } ); - info.insert( { "GOVIT", { A::SUMMARY_GROUP, "Oil Voidage Injection Total" } } ); - info.insert( { "GOnPR", { A::SUMMARY_GROUP, "nth separator stage oil rate" } } ); - info.insert( { "GOnPT", { A::SUMMARY_GROUP, "nth separator stage oil total" } } ); - info.insert( { "GEOR", { A::SUMMARY_GROUP, "Export Oil Rate" } } ); - info.insert( { "GEOT", { A::SUMMARY_GROUP, "Export Oil Total" } } ); - info.insert( { "GEOMF", { A::SUMMARY_GROUP, "Export Oil Mole Fraction" } } ); - info.insert( { "GWPR", { A::SUMMARY_GROUP, "Water Production Rate" } } ); - info.insert( { "GWMR", { A::SUMMARY_GROUP, "Water Mass Rate" } } ); - info.insert( { "GWMT", { A::SUMMARY_GROUP, "Water Mass Total" } } ); - info.insert( { "GWPRH", { A::SUMMARY_GROUP, "Water Production Rate History" } } ); - info.insert( { "GWPRT", { A::SUMMARY_GROUP, "Water Production Rate Target/Limit" } } ); - info.insert( { "GWPRL", { A::SUMMARY_GROUP, "Water Production Rate Target/Limit" } } ); - info.insert( { "GWPT", { A::SUMMARY_GROUP, "Water Production Total" } } ); - info.insert( { "GWPTH", { A::SUMMARY_GROUP, "Water Production Total History" } } ); - info.insert( { "GWIR", { A::SUMMARY_GROUP, "Water Injection Rate" } } ); - info.insert( { "GWIRH", { A::SUMMARY_GROUP, "Water Injection Rate History" } } ); - info.insert( { "GWIRT", { A::SUMMARY_GROUP, "Water Injection Rate Target/Limit" } } ); - info.insert( { "GWIRL", { A::SUMMARY_GROUP, "Water Injection Rate Target/Limit" } } ); - info.insert( { "GWIT", { A::SUMMARY_GROUP, "Water Injection Total" } } ); - info.insert( { "GWITH", { A::SUMMARY_GROUP, "Water Injection Total History" } } ); - info.insert( { "GWPP", { A::SUMMARY_GROUP, "Water Potential Production rate" } } ); - info.insert( { "GWPP2", { A::SUMMARY_GROUP, "Water Potential Production rate" } } ); - info.insert( { "GWPI", { A::SUMMARY_GROUP, "Water Potential Injection rate" } } ); - info.insert( { "GWPI2", { A::SUMMARY_GROUP, "Water Potential Injection rate" } } ); - info.insert( { "GWPGR", { A::SUMMARY_GROUP, "Water Production Guide Rate" } } ); - info.insert( { "GWIGR", { A::SUMMARY_GROUP, "Water Injection Guide Rate" } } ); - info.insert( { "GWVPR", { A::SUMMARY_GROUP, "Water Voidage Production Rate" } } ); - info.insert( { "GWVPT", { A::SUMMARY_GROUP, "Water Voidage Production Total" } } ); - info.insert( { "GWVIR", { A::SUMMARY_GROUP, "Water Voidage Injection Rate" } } ); - info.insert( { "GWVIT", { A::SUMMARY_GROUP, "Water Voidage Injection Total" } } ); - info.insert( { "GWPIR", { A::SUMMARY_GROUP, "Ratio of produced water to injected water (percentage)" } } ); - info.insert( { "GWMPR", { A::SUMMARY_GROUP, "Water component molar production rate" } } ); - info.insert( { "GWMPT", { A::SUMMARY_GROUP, "Water component molar production total" } } ); - info.insert( { "GWMIR", { A::SUMMARY_GROUP, "Water component molar injection rate" } } ); - info.insert( { "GWMIT", { A::SUMMARY_GROUP, "Water component molar injection total" } } ); - info.insert( { "GGPR", { A::SUMMARY_GROUP, "Gas Production Rate" } } ); - info.insert( { "GGPRA", { A::SUMMARY_GROUP, "Gas Production Rate above" } } ); - info.insert( { "GGPRB", { A::SUMMARY_GROUP, "Gas Production Rate below" } } ); - info.insert( { "GGPTA", { A::SUMMARY_GROUP, "Gas Production Total above" } } ); - info.insert( { "GGPTB", { A::SUMMARY_GROUP, "Gas Production Total below" } } ); - info.insert( { "GGPR1", { A::SUMMARY_GROUP, "Gas Production Rate above GOC" } } ); - info.insert( { "GGPR2", { A::SUMMARY_GROUP, "Gas Production Rate below GOC" } } ); - info.insert( { "GGPT1", { A::SUMMARY_GROUP, "Gas Production Total above GOC" } } ); - info.insert( { "GGPT2", { A::SUMMARY_GROUP, "Gas Production Total below GOC" } } ); - info.insert( { "GGMR", { A::SUMMARY_GROUP, "Gas Mass Rate" } } ); - info.insert( { "GGMT", { A::SUMMARY_GROUP, "Gas Mass Total" } } ); - info.insert( { "GGDN", { A::SUMMARY_GROUP, "Gas Density at Surface Conditions" } } ); - info.insert( { "GGPRH", { A::SUMMARY_GROUP, "Gas Production Rate History" } } ); - info.insert( { "GGPRT", { A::SUMMARY_GROUP, "Gas Production Rate Target/Limit" } } ); - info.insert( { "GGPRL", { A::SUMMARY_GROUP, "Gas Production Rate Target/Limit" } } ); - info.insert( { "GGPRF", { A::SUMMARY_GROUP, "Free Gas Production Rate" } } ); - info.insert( { "GGPRS", { A::SUMMARY_GROUP, "Solution Gas Production Rate" } } ); - info.insert( { "GGPT", { A::SUMMARY_GROUP, "Gas Production Total" } } ); - info.insert( { "GGPTH", { A::SUMMARY_GROUP, "Gas Production Total History" } } ); - info.insert( { "GGPTF", { A::SUMMARY_GROUP, "Free Gas Production Total" } } ); - info.insert( { "GGPTS", { A::SUMMARY_GROUP, "Solution Gas Production Total" } } ); - info.insert( { "GGIR", { A::SUMMARY_GROUP, "Gas Injection Rate" } } ); - info.insert( { "GGIRH", { A::SUMMARY_GROUP, "Gas Injection Rate History" } } ); - info.insert( { "GGIRT", { A::SUMMARY_GROUP, "Gas Injection Rate Target/Limit" } } ); - info.insert( { "GGIRL", { A::SUMMARY_GROUP, "Gas Injection Rate Target/Limit" } } ); - info.insert( { "GGIT", { A::SUMMARY_GROUP, "Gas Injection Total" } } ); - info.insert( { "GGITH", { A::SUMMARY_GROUP, "Gas Injection Total History" } } ); - info.insert( { "GGPP", { A::SUMMARY_GROUP, "Gas Potential Production rate" } } ); - info.insert( { "GGPP2", { A::SUMMARY_GROUP, "Gas Potential Production rate" } } ); - info.insert( { "GGPPS", { A::SUMMARY_GROUP, "Solution" } } ); - info.insert( { "GGPPS2", { A::SUMMARY_GROUP, "Solution" } } ); - info.insert( { "GGPPF", { A::SUMMARY_GROUP, "Free Gas Potential Production rate" } } ); - info.insert( { "GGPPF2", { A::SUMMARY_GROUP, "Free Gas Potential Production rate" } } ); - info.insert( { "GGPI", { A::SUMMARY_GROUP, "Gas Potential Injection rate" } } ); - info.insert( { "GGPI2", { A::SUMMARY_GROUP, "Gas Potential Injection rate" } } ); - info.insert( { "GGPGR", { A::SUMMARY_GROUP, "Gas Production Guide Rate" } } ); - info.insert( { "GGIGR", { A::SUMMARY_GROUP, "Gas Injection Guide Rate" } } ); - info.insert( { "GSGR", { A::SUMMARY_GROUP, "Sales Gas Rate" } } ); - info.insert( { "GGSR", { A::SUMMARY_GROUP, "Sales Gas Rate" } } ); - info.insert( { "GSGT", { A::SUMMARY_GROUP, "Sales Gas Total" } } ); - info.insert( { "GGST", { A::SUMMARY_GROUP, "Sales Gas Total" } } ); - info.insert( { "GSMF", { A::SUMMARY_GROUP, "Sales Gas Mole Fraction" } } ); - info.insert( { "GFGR", { A::SUMMARY_GROUP, "Fuel Gas Rate, at and below this group" } } ); - info.insert( { "GFGT", { A::SUMMARY_GROUP, "Fuel Gas cumulative Total, at and below this group" } } ); - info.insert( { "GFMF", { A::SUMMARY_GROUP, "Fuel Gas Mole Fraction" } } ); - info.insert( { "GGCR", { A::SUMMARY_GROUP, "Gas Consumption Rate, at and below this group" } } ); - info.insert( { "GGCT", { A::SUMMARY_GROUP, "Gas Consumption Total, at and below this group" } } ); - info.insert( { "GGIMR", { A::SUMMARY_GROUP, "Gas Import Rate, at and below this group" } } ); - info.insert( { "GGIMT", { A::SUMMARY_GROUP, "Gas Import Total, at and below this group" } } ); - info.insert( { "GGLIR", { A::SUMMARY_GROUP, "Gas Lift Injection Rate" } } ); - info.insert( { "GGLIT", { A::SUMMARY_GROUP, "Gas Lift Injection Total" } } ); - info.insert( { "GWGPR", { A::SUMMARY_GROUP, "Wet Gas Production Rate" } } ); - info.insert( { "GWGPT", { A::SUMMARY_GROUP, "Wet Gas Production Total" } } ); - info.insert( { "GWGPRH", { A::SUMMARY_GROUP, "Wet Gas Production Rate History" } } ); - info.insert( { "GWGIR", { A::SUMMARY_GROUP, "Wet Gas Injection Rate" } } ); - info.insert( { "GWGIT", { A::SUMMARY_GROUP, "Wet Gas Injection Total" } } ); - info.insert( { "GEGR", { A::SUMMARY_GROUP, "Export Gas Rate" } } ); - info.insert( { "GEGT", { A::SUMMARY_GROUP, "Export Gas Total" } } ); - info.insert( { "GEMF", { A::SUMMARY_GROUP, "Export Gas Mole Fraction" } } ); - info.insert( { "GEXGR", { A::SUMMARY_GROUP, "Excess Gas Rate" } } ); - info.insert( { "GEXGT", { A::SUMMARY_GROUP, "Excess Gas Total" } } ); - info.insert( { "GRGR", { A::SUMMARY_GROUP, "Re-injection Gas Rate" } } ); - info.insert( { "GRGT", { A::SUMMARY_GROUP, "Re-injection Gas Total" } } ); - info.insert( { "GGnPR", { A::SUMMARY_GROUP, "nth separator stage gas rate" } } ); - info.insert( { "GGnPT", { A::SUMMARY_GROUP, "nth separator stage gas total" } } ); - info.insert( { "GGVPR", { A::SUMMARY_GROUP, "Gas Voidage Production Rate" } } ); - info.insert( { "GGVPT", { A::SUMMARY_GROUP, "Gas Voidage Production Total" } } ); - info.insert( { "GGVIR", { A::SUMMARY_GROUP, "Gas Voidage Injection Rate" } } ); - info.insert( { "GGVIT", { A::SUMMARY_GROUP, "Gas Voidage Injection Total" } } ); - info.insert( { "GGQ", { A::SUMMARY_GROUP, "Gas Quality" } } ); - info.insert( { "GLPR", { A::SUMMARY_GROUP, "Liquid Production Rate" } } ); - info.insert( { "GLPRH", { A::SUMMARY_GROUP, "Liquid Production Rate History" } } ); - info.insert( { "GLPRT", { A::SUMMARY_GROUP, "Liquid Production Rate Target/Limit" } } ); - info.insert( { "GLPRL", { A::SUMMARY_GROUP, "Liquid Production Rate Target/Limit" } } ); - info.insert( { "GLPT", { A::SUMMARY_GROUP, "Liquid Production Total" } } ); - info.insert( { "GLPTH", { A::SUMMARY_GROUP, "Liquid Production Total History" } } ); - info.insert( { "GVPR", { A::SUMMARY_GROUP, "Res Volume Production Rate" } } ); - info.insert( { "GVPRT", { A::SUMMARY_GROUP, "Res Volume Production Rate Target/Limit" } } ); - info.insert( { "GVPRL", { A::SUMMARY_GROUP, "Res Volume Production Rate Target/Limit" } } ); - info.insert( { "GVPT", { A::SUMMARY_GROUP, "Res Volume Production Total" } } ); - info.insert( { "GVPGR", { A::SUMMARY_GROUP, "Res Volume Production Guide Rate" } } ); - info.insert( { "GVIR", { A::SUMMARY_GROUP, "Res Volume Injection Rate" } } ); - info.insert( { "GVIRT", { A::SUMMARY_GROUP, "Res Volume Injection Rate Target/Limit" } } ); - info.insert( { "GVIRL", { A::SUMMARY_GROUP, "Res Volume Injection Rate Target/Limit" } } ); - info.insert( { "GVIT", { A::SUMMARY_GROUP, "Res Volume Injection Total" } } ); - info.insert( { "GWCT", { A::SUMMARY_GROUP, "Water Cut" } } ); - info.insert( { "GWCTH", { A::SUMMARY_GROUP, "Water Cut History" } } ); - info.insert( { "GGOR", { A::SUMMARY_GROUP, "Gas-Oil Ratio" } } ); - info.insert( { "GGORH", { A::SUMMARY_GROUP, "Gas-Oil Ratio History" } } ); - info.insert( { "GOGR", { A::SUMMARY_GROUP, "Oil-Gas Ratio" } } ); - info.insert( { "GOGRH", { A::SUMMARY_GROUP, "Oil-Gas Ratio History" } } ); - info.insert( { "GWGR", { A::SUMMARY_GROUP, "Water-Gas Ratio" } } ); - info.insert( { "GWGRH", { A::SUMMARY_GROUP, "Water-Gas Ratio History" } } ); - info.insert( { "GGLR", { A::SUMMARY_GROUP, "Gas-Liquid Ratio" } } ); - info.insert( { "GGLRH", { A::SUMMARY_GROUP, "Gas-Liquid Ratio History" } } ); - info.insert( { "GMCTP", { A::SUMMARY_GROUP, "Mode of Control for group Production" } } ); - info.insert( { "GMCTW", { A::SUMMARY_GROUP, "Mode of Control for group Water Injection" } } ); - info.insert( { "GMCTG", { A::SUMMARY_GROUP, "Mode of Control for group Gas Injection" } } ); - info.insert( { "GMWPT", { A::SUMMARY_GROUP, "Total number of production wells" } } ); - info.insert( { "GMWPR", { A::SUMMARY_GROUP, "Number of production wells currently flowing" } } ); - info.insert( { "GMWPA", { A::SUMMARY_GROUP, "Number of abandoned production wells" } } ); - info.insert( { "GMWPU", { A::SUMMARY_GROUP, "Number of unused production wells" } } ); - info.insert( { "GMWPG", { A::SUMMARY_GROUP, "Number of producers on group control" } } ); - info.insert( { "GMWPO", { A::SUMMARY_GROUP, "Number of producers controlled by own oil rate limit" } } ); - info.insert( { "GMWPS", { A::SUMMARY_GROUP, "Number of producers on own surface rate limit control" } } ); - info.insert( { "GMWPV", { A::SUMMARY_GROUP, "Number of producers on own reservoir volume rate limit control" } } ); - info.insert( { "GMWPP", { A::SUMMARY_GROUP, "Number of producers on pressure control" } } ); - info.insert( { "GMWPL", { A::SUMMARY_GROUP, "Number of producers using artificial lift" } } ); - info.insert( { "GMWIT", { A::SUMMARY_GROUP, "Total number of injection wells" } } ); - info.insert( { "GMWIN", { A::SUMMARY_GROUP, "Number of injection wells currently flowing" } } ); - info.insert( { "GMWIA", { A::SUMMARY_GROUP, "Number of abandoned injection wells" } } ); - info.insert( { "GMWIU", { A::SUMMARY_GROUP, "Number of unused injection wells" } } ); - info.insert( { "GMWIG", { A::SUMMARY_GROUP, "Number of injectors on group control" } } ); - info.insert( { "GMWIS", { A::SUMMARY_GROUP, "Number of injectors on own surface rate limit control" } } ); - info.insert( { "GMWIV", { A::SUMMARY_GROUP, "Number of injectors on own reservoir volume rate limit control" } } ); - info.insert( { "GMWIP", { A::SUMMARY_GROUP, "Number of injectors on pressure control" } } ); - info.insert( { "GMWDR", { A::SUMMARY_GROUP, "Number of drilling events this timestep" } } ); - info.insert( { "GMWDT", { A::SUMMARY_GROUP, "Number of drilling events in total" } } ); - info.insert( { "GMWWO", { A::SUMMARY_GROUP, "Number of workover events this timestep" } } ); - info.insert( { "GMWWT", { A::SUMMARY_GROUP, "Number of workover events in total" } } ); - info.insert( { "GEPR", { A::SUMMARY_GROUP, "Energy Production Rate" } } ); - info.insert( { "GEPT", { A::SUMMARY_GROUP, "Energy Production Total" } } ); - info.insert( { "GEFF", { A::SUMMARY_GROUP, "Efficiency Factor" } } ); - info.insert( { "GNLPR", { A::SUMMARY_GROUP, "NGL Production Rate" } } ); - info.insert( { "GNLPT", { A::SUMMARY_GROUP, "NGL Production Total" } } ); - info.insert( { "GNLPRH", { A::SUMMARY_GROUP, "NGL Production Rate History" } } ); - info.insert( { "GNLPTH", { A::SUMMARY_GROUP, "NGL Production Total History" } } ); - info.insert( { "GAMF", { A::SUMMARY_GROUP, "Component aqueous mole fraction, from producing completions" } } ); - info.insert( { "GXMF", { A::SUMMARY_GROUP, "Liquid Mole Fraction" } } ); - info.insert( { "GYMF", { A::SUMMARY_GROUP, "Vapor Mole Fraction" } } ); - info.insert( { "GXMFn", { A::SUMMARY_GROUP, "Liquid Mole Fraction for nth separator stage" } } ); - info.insert( { "GYMFn", { A::SUMMARY_GROUP, "Vapor Mole Fraction for nth separator stage" } } ); - info.insert( { "GZMF", { A::SUMMARY_GROUP, "Total Mole Fraction" } } ); - info.insert( { "GCMPR", { A::SUMMARY_GROUP, "Hydrocarbon Component Molar Production Rates" } } ); - info.insert( { "GCMPT", { A::SUMMARY_GROUP, "Hydrocarbon Component" } } ); - info.insert( { "GCMIR", { A::SUMMARY_GROUP, "Hydrocarbon Component Molar Injection Rates" } } ); - info.insert( { "GCMIT", { A::SUMMARY_GROUP, "Hydrocarbon Component Molar Injection Totals" } } ); - info.insert( { "GHMIR", { A::SUMMARY_GROUP, "Hydrocarbon Molar Injection Rate" } } ); - info.insert( { "GHMIT", { A::SUMMARY_GROUP, "Hydrocarbon Molar Injection Total" } } ); - info.insert( { "GHMPR", { A::SUMMARY_GROUP, "Hydrocarbon Molar Production Rate" } } ); - info.insert( { "GHMPT", { A::SUMMARY_GROUP, "Hydrocarbon Molar Production Total" } } ); - info.insert( { "GCHMR", { A::SUMMARY_GROUP, "Hydrocarbon Component" } } ); - info.insert( { "GCHMT", { A::SUMMARY_GROUP, "Hydrocarbon Component" } } ); - info.insert( { "GCWGPR", { A::SUMMARY_GROUP, "Hydrocarbon Component Wet Gas Production Rate" } } ); - info.insert( { "GCWGPT", { A::SUMMARY_GROUP, "Hydrocarbon Component Wet Gas Production Total" } } ); - info.insert( { "GCWGIR", { A::SUMMARY_GROUP, "Hydrocarbon Component Wet Gas Injection Rate" } } ); - info.insert( { "GCWGIT", { A::SUMMARY_GROUP, "Hydrocarbon Component Wet Gas Injection Total" } } ); - info.insert( { "GCGMR", { A::SUMMARY_GROUP, "Hydrocarbon component" } } ); - info.insert( { "GCGMT", { A::SUMMARY_GROUP, "Hydrocarbon component" } } ); - info.insert( { "GCOMR", { A::SUMMARY_GROUP, "Hydrocarbon component" } } ); - info.insert( { "GCOMT", { A::SUMMARY_GROUP, "Hydrocarbon component" } } ); - info.insert( { "GCNMR", { A::SUMMARY_GROUP, "Hydrocarbon component molar rates in the NGL phase" } } ); - info.insert( { "GCNWR", { A::SUMMARY_GROUP, "Hydrocarbon component mass rates in the NGL phase" } } ); - info.insert( { "GCGMRn", { A::SUMMARY_GROUP, "Hydrocarbon component molar rates in the gas phase for nth separator stage" } } ); - info.insert( { "GCGRn", { A::SUMMARY_GROUP, "Hydrocarbon component molar rates in the gas phase for nth separator stage" } } ); - info.insert( { "GCOMRn", { A::SUMMARY_GROUP, "Hydrocarbon component" } } ); - info.insert( { "GCORn", { A::SUMMARY_GROUP, "Hydrocarbon component" } } ); - info.insert( { "GMUF", { A::SUMMARY_GROUP, "Make-up fraction" } } ); - info.insert( { "GAMR", { A::SUMMARY_GROUP, "Make-up gas rate" } } ); - info.insert( { "GAMT", { A::SUMMARY_GROUP, "Make-up gas total" } } ); - info.insert( { "GGSPR", { A::SUMMARY_GROUP, "Target sustainable rate for most recent sustainable capacity test for gas" } } ); - info.insert( { "GGSRL", - { A::SUMMARY_GROUP, - "Maximum tested rate sustained for the test period during the most recent sustainable " - "capacity test for gas" } } ); - info.insert( { "GGSRU", - { A::SUMMARY_GROUP, - "Minimum tested rate not sustained for the test period during the most recent " - "sustainable capacity test for " - "gas" } } ); - info.insert( { "GGSSP", - { A::SUMMARY_GROUP, - "Period for which target sustainable rate could be maintained for the most recent " - "sustainable capacity test " - "for gas" } } ); - info.insert( { "GGSTP", { A::SUMMARY_GROUP, "Test period for the most recent sustainable capacity test for gas" } } ); - info.insert( { "GOSPR", { A::SUMMARY_GROUP, "Target sustainable rate for most recent sustainable capacity test for oil" } } ); - info.insert( { "GOSRL", - { A::SUMMARY_GROUP, - "Maximum tested rate sustained for the test period during the most recent sustainable " - "capacity test for oil" } } ); - info.insert( { "GOSRU", - { A::SUMMARY_GROUP, - "Minimum tested rate not sustained for the test period during the most recent " - "sustainable capacity test for " - "oil" } } ); - info.insert( { "GOSSP", - { A::SUMMARY_GROUP, - "Period for which target sustainable rate could be maintained for the most recent " - "sustainable capacity test " - "for oil" } } ); - info.insert( { "GOSTP", { A::SUMMARY_GROUP, "Test period for the most recent sustainable capacity test for oil" } } ); - info.insert( { "GWSPR", { A::SUMMARY_GROUP, "Target sustainable rate for most recent sustainable capacity test for water" } } ); - info.insert( { "GWSRL", - { A::SUMMARY_GROUP, - "Maximum tested rate sustained for the test period during the most recent sustainable " - "capacity test for water" } } ); - info.insert( { "GWSRU", - { A::SUMMARY_GROUP, - "Minimum tested rate not sustained for the test period during the most recent " - "sustainable capacity test for " - "water" } } ); - info.insert( { "GWSSP", - { A::SUMMARY_GROUP, - "Period for which target sustainable rate could be maintained for the most recent " - "sustainable capacity test " - "for water" } } ); - info.insert( { "GWSTP", { A::SUMMARY_GROUP, "Test period for the most recent sustainable capacity test for water" } } ); - info.insert( { "GGPRG", { A::SUMMARY_GROUP, "Gas production rate" } } ); - info.insert( { "GOPRG", { A::SUMMARY_GROUP, "Oil production rate" } } ); - info.insert( { "GNLPRG", { A::SUMMARY_GROUP, "NGL production rate" } } ); - info.insert( { "GXMFG", { A::SUMMARY_GROUP, "Liquid mole fraction" } } ); - info.insert( { "GYMFG", { A::SUMMARY_GROUP, "Vapor mole fraction" } } ); - info.insert( { "GCOMRG", { A::SUMMARY_GROUP, "Hydrocarbon component" } } ); - info.insert( { "GCGMRG", { A::SUMMARY_GROUP, "Hydrocarbon component molar rates in the gas phase" } } ); - info.insert( { "GCNMRG", { A::SUMMARY_GROUP, "Hydrocarbon component molar rates in the NGL phase" } } ); - info.insert( { "GTPR", { A::SUMMARY_GROUP, "Tracer Production Rate" } } ); - info.insert( { "GTPT", { A::SUMMARY_GROUP, "Tracer Production Total" } } ); - info.insert( { "GTPC", { A::SUMMARY_GROUP, "Tracer Production Concentration" } } ); - info.insert( { "GTIR", { A::SUMMARY_GROUP, "Tracer Injection Rate" } } ); - info.insert( { "GTIT", { A::SUMMARY_GROUP, "Tracer Injection Total" } } ); - info.insert( { "GTIC", { A::SUMMARY_GROUP, "Tracer Injection Concentration" } } ); - info.insert( { "GTMR", { A::SUMMARY_GROUP, "Traced mass Rate" } } ); - info.insert( { "GTMT", { A::SUMMARY_GROUP, "Traced mass Total" } } ); - info.insert( { "GTQR", { A::SUMMARY_GROUP, "Traced molar Rate" } } ); - info.insert( { "GTCM", { A::SUMMARY_GROUP, "Tracer Carrier molar Rate" } } ); - info.insert( { "GTMF", { A::SUMMARY_GROUP, "Traced molar fraction" } } ); - info.insert( { "GTVL", { A::SUMMARY_GROUP, "Traced liquid volume rate" } } ); - info.insert( { "GTVV", { A::SUMMARY_GROUP, "Traced vapor volume rate" } } ); - info.insert( { "GTTL", { A::SUMMARY_GROUP, "Traced liquid volume total" } } ); - info.insert( { "GTTV", { A::SUMMARY_GROUP, "Traced vapor volume total" } } ); - info.insert( { "GTML", { A::SUMMARY_GROUP, "Traced mass liquid rate" } } ); - info.insert( { "GTMV", { A::SUMMARY_GROUP, "Traced mass vapor rate" } } ); - info.insert( { "GTLM", { A::SUMMARY_GROUP, "Traced mass liquid total" } } ); - info.insert( { "GTVM", { A::SUMMARY_GROUP, "Traced mass vapor total" } } ); - info.insert( { "GAPI", { A::SUMMARY_GROUP, "Oil API" } } ); - info.insert( { "GSPR", { A::SUMMARY_GROUP, "Salt Production Rate" } } ); - info.insert( { "GSPT", { A::SUMMARY_GROUP, "Salt Production Total" } } ); - info.insert( { "GSIR", { A::SUMMARY_GROUP, "Salt Injection Rate" } } ); - info.insert( { "GSIT", { A::SUMMARY_GROUP, "Salt Injection Total" } } ); - info.insert( { "GSPC", { A::SUMMARY_GROUP, "Salt Production Concentration" } } ); - info.insert( { "GSIC", { A::SUMMARY_GROUP, "Salt Injection Concentration" } } ); - info.insert( { "WTPRANI", { A::SUMMARY_WELL, "Anion Production Rate" } } ); - info.insert( { "WTPTANI", { A::SUMMARY_WELL, "Anion Production Total" } } ); - info.insert( { "WTIRANI", { A::SUMMARY_WELL, "Anion Injection Rate" } } ); - info.insert( { "WTITANI", { A::SUMMARY_WELL, "Anion Injection Total" } } ); - info.insert( { "WTPRCAT", { A::SUMMARY_WELL, "Cation Production Rate" } } ); - info.insert( { "WTPTCAT", { A::SUMMARY_WELL, "Cation Production Total" } } ); - info.insert( { "WTIRCAT", { A::SUMMARY_WELL, "Cation Injection Rate" } } ); - info.insert( { "WTITCAT", { A::SUMMARY_WELL, "Cation Injection Total" } } ); - info.insert( { "GTPCHEA", { A::SUMMARY_GROUP, "Production Temperature" } } ); - info.insert( { "GTICHEA", { A::SUMMARY_GROUP, "Injection Temperature" } } ); - info.insert( { "GTPRHEA", { A::SUMMARY_GROUP, "Energy flows" } } ); - info.insert( { "GTPTHEA", { A::SUMMARY_GROUP, "Energy Production Total" } } ); - info.insert( { "GTIRHEA", { A::SUMMARY_GROUP, "Energy flows" } } ); - info.insert( { "GTITHEA", { A::SUMMARY_GROUP, "Energy Injection Total" } } ); - info.insert( { "GTPR", { A::SUMMARY_GROUP, "Tracer Production Rate" } } ); - info.insert( { "GTPT", { A::SUMMARY_GROUP, "Tracer Production Total" } } ); - info.insert( { "GTPC", { A::SUMMARY_GROUP, "Tracer Production Concentration" } } ); - info.insert( { "GTIR", { A::SUMMARY_GROUP, "Tracer Injection Rate" } } ); - info.insert( { "GTIT", { A::SUMMARY_GROUP, "Tracer Injection Total" } } ); - info.insert( { "GTIC", { A::SUMMARY_GROUP, "Tracer Injection Concentration" } } ); - info.insert( { "GTIRF", { A::SUMMARY_GROUP, "Tracer Injection Rate" } } ); - info.insert( { "GTIRS", { A::SUMMARY_GROUP, "Tracer Injection Rate" } } ); - info.insert( { "GTPRF", { A::SUMMARY_GROUP, "Tracer Production Rate" } } ); - info.insert( { "GTPRS", { A::SUMMARY_GROUP, "Tracer Production Rate" } } ); - info.insert( { "GTITF", { A::SUMMARY_GROUP, "Tracer Injection Total" } } ); - info.insert( { "GTITS", { A::SUMMARY_GROUP, "Tracer Injection Total" } } ); - info.insert( { "GTPTF", { A::SUMMARY_GROUP, "Tracer Production Total" } } ); - info.insert( { "GTPTS", { A::SUMMARY_GROUP, "Tracer Production Total" } } ); - info.insert( { "GTICF", { A::SUMMARY_GROUP, "Tracer Injection Concentration" } } ); - info.insert( { "GTICS", { A::SUMMARY_GROUP, "Tracer Injection Concentration" } } ); - info.insert( { "GTPCF", { A::SUMMARY_GROUP, "Tracer Production" } } ); - info.insert( { "GTPCS", { A::SUMMARY_GROUP, "Tracer Production" } } ); - info.insert( { "GMPR", { A::SUMMARY_GROUP, "Methane Production Rate" } } ); - info.insert( { "GMPT", { A::SUMMARY_GROUP, "Methane Production Total" } } ); - info.insert( { "GMIR", { A::SUMMARY_GROUP, "Methane Injection Rate" } } ); - info.insert( { "GMIT", { A::SUMMARY_GROUP, "Methane Injection Total" } } ); - info.insert( { "GTPRFOA", { A::SUMMARY_GROUP, "Production Rate" } } ); - info.insert( { "GTPTFOA", { A::SUMMARY_GROUP, "Production Total" } } ); - info.insert( { "GTIRFOA", { A::SUMMARY_GROUP, "Injection Rate" } } ); - info.insert( { "GTITFOA", { A::SUMMARY_GROUP, "Injection Total" } } ); - info.insert( { "GSGR", { A::SUMMARY_GROUP, "Sales Gas Rate" } } ); - info.insert( { "GGSR", { A::SUMMARY_GROUP, "Sales Gas Rate" } } ); - info.insert( { "GSGT", { A::SUMMARY_GROUP, "Sales Gas Total" } } ); - info.insert( { "GGST", { A::SUMMARY_GROUP, "Sales Gas Total" } } ); - info.insert( { "GGDC", { A::SUMMARY_GROUP, "Gas Delivery Capacity" } } ); - info.insert( { "GGDCQ", { A::SUMMARY_GROUP, "Field/Group Gas DCQ" } } ); - info.insert( { "GMCPL", { A::SUMMARY_GROUP, "Group Multi-level Compressor Level" } } ); - info.insert( { "GPR", { A::SUMMARY_GROUP, "Group nodal Pressure in network" } } ); - info.insert( { "GPRDC", { A::SUMMARY_GROUP, "Group Pressure at Delivery Capacity" } } ); - info.insert( { "GGCR", { A::SUMMARY_GROUP, "Gas consumption rate, at and below this group" } } ); - info.insert( { "GGCT", { A::SUMMARY_GROUP, "Gas consumption cumulative total, at and below this group" } } ); - info.insert( { "GFGR", { A::SUMMARY_GROUP, "Fuel Gas rate, at and below this group" } } ); - info.insert( { "GFGT", { A::SUMMARY_GROUP, "Fuel Gas cumulative total, at and below this group" } } ); - info.insert( { "GGIMR", { A::SUMMARY_GROUP, "Gas import rate, at and below this group" } } ); - info.insert( { "GGIMT", { A::SUMMARY_GROUP, "Gas import cumulative total, at and below this group" } } ); - info.insert( { "GPRFP", { A::SUMMARY_GROUP, "Group or node Pressure in network from end of First Pass" } } ); - info.insert( - { "GGPRNBFP", { A::SUMMARY_GROUP, "Gas flow rate along Group's or node's outlet branch in network, from end of First Pass" } } ); - info.insert( { "GGLIR", { A::SUMMARY_GROUP, "Gas Lift Injection Rate" } } ); - info.insert( { "GGCV", { A::SUMMARY_GROUP, "Gas Calorific Value" } } ); - info.insert( { "GGQ", { A::SUMMARY_GROUP, "Gas molar Quality" } } ); - info.insert( { "GEPR", { A::SUMMARY_GROUP, "Energy Production Rate" } } ); - info.insert( { "GEPT", { A::SUMMARY_GROUP, "Energy Production Total" } } ); - info.insert( { "GESR", { A::SUMMARY_GROUP, "Energy Sales Rate" } } ); - info.insert( { "GEST", { A::SUMMARY_GROUP, "Energy Sales Total" } } ); - info.insert( { "GEDC", { A::SUMMARY_GROUP, "Energy Delivery Capacity" } } ); - info.insert( { "GEDCQ", { A::SUMMARY_GROUP, "Energy DCQ" } } ); - info.insert( { "GPR", { A::SUMMARY_GROUP, "Group or node Pressure in the production network" } } ); - info.insert( { "GPRG", { A::SUMMARY_GROUP, "Group or node Pressure in the gas injection network" } } ); - info.insert( { "GPRW", { A::SUMMARY_GROUP, "Group or node Pressure in the water injection network" } } ); - info.insert( { "GPRB", { A::SUMMARY_GROUP, "Pressure drop along the group's or node's outlet branch in the production network" } } ); - info.insert( { "GPRBG", { A::SUMMARY_GROUP, "Pressure drop along the group's or node's inlet branch in the gas injection network" } } ); - info.insert( { "GPRBW", { A::SUMMARY_GROUP, "Pressure drop along the group's or node's inlet branch in the water injection network" } } ); - info.insert( { "GALQ", { A::SUMMARY_GROUP, "ALQ in the group's or node's outlet branch in the production network" } } ); - info.insert( { "GOPRNB", { A::SUMMARY_GROUP, "Oil flow rate along the group's or node's outlet branch in the production network" } } ); - info.insert( { "GWPRNB", { A::SUMMARY_GROUP, "Water flow rate along the group's or node's outlet branch in the production network" } } ); - info.insert( { "GGPRNB", { A::SUMMARY_GROUP, "Gas flow rate along the group's or node's outlet branch in the production network" } } ); - info.insert( { "GLPRNB", { A::SUMMARY_GROUP, "Liquid flow rate along the group's or node's outlet branch in the production network" } } ); - info.insert( { "GWIRNB", { A::SUMMARY_GROUP, "Water flow rate along the group's or node's inlet branch in the water injection network" } } ); - info.insert( { "GGIRNB", { A::SUMMARY_GROUP, "Gas flow rate along the group's or node's inlet branch in the gas injection network" } } ); - info.insert( { "GOMNR", { A::SUMMARY_GROUP, "Group or node minimum oil rate as specified with GNETDP in the production network" } } ); - info.insert( { "GGMNR", { A::SUMMARY_GROUP, "Group or node minimum gas rate as specified with GNETDP in the production network" } } ); - info.insert( { "GWMNR", { A::SUMMARY_GROUP, "Group or node minimum water rate as specified with GNETDP in the production network" } } ); - info.insert( { "GLMNR", { A::SUMMARY_GROUP, "Group or node minimum liquid rate as specified with GNETDP in the production network" } } ); - info.insert( { "GOMXR", { A::SUMMARY_GROUP, "Group or node maximum oil rate as specified with GNETDP in the production network" } } ); - info.insert( { "GGMXR", { A::SUMMARY_GROUP, "Group or node maximum gas rate as specified with GNETDP in the production network" } } ); - info.insert( { "GWMXR", { A::SUMMARY_GROUP, "Group or node maximum water rate as specified with GNETDP in the production network" } } ); - info.insert( { "GLMXR", { A::SUMMARY_GROUP, "Group or node maximum liquid rate as specified with GNETDP in the production network" } } ); - info.insert( { "GMNP", { A::SUMMARY_GROUP, "Group or node minimum pressure as specified with GNETDP in the production network" } } ); - info.insert( { "GMXP", { A::SUMMARY_GROUP, "Group or node maximum pressure as specified with GNETDP in the production network" } } ); - info.insert( { "GPRINC", { A::SUMMARY_GROUP, "Group or node pressure increment as specified with GNETDP in the production network" } } ); - info.insert( { "GPRDEC", { A::SUMMARY_GROUP, "Group or node pressure decrement as specified with GNETDP in the production network" } } ); - info.insert( { "GCPR", { A::SUMMARY_GROUP, "Polymer Production Rate" } } ); - info.insert( { "GCPC", { A::SUMMARY_GROUP, "Polymer Production Concentration" } } ); - info.insert( { "GCPT", { A::SUMMARY_GROUP, "Polymer Production Total" } } ); - info.insert( { "GCIR", { A::SUMMARY_GROUP, "Polymer Injection Rate" } } ); - info.insert( { "GCIC", { A::SUMMARY_GROUP, "Polymer Injection Concentration" } } ); - info.insert( { "GCIT", { A::SUMMARY_GROUP, "Polymer Injection Total" } } ); - info.insert( { "GSPR", { A::SUMMARY_GROUP, "Salt Production Rate" } } ); - info.insert( { "GSPT", { A::SUMMARY_GROUP, "Salt Production Total" } } ); - info.insert( { "GSIR", { A::SUMMARY_GROUP, "Salt Injection Rate" } } ); - info.insert( { "GSIT", { A::SUMMARY_GROUP, "Salt Injection Total" } } ); - info.insert( { "GOPRL", { A::SUMMARY_GROUP, "Group Oil Production Rate Target" } } ); - info.insert( { "GOIRL", { A::SUMMARY_GROUP, "Group Oil Injection Rate Target" } } ); - info.insert( { "GWPRL", { A::SUMMARY_GROUP, "Group Water Production Rate Target" } } ); - info.insert( { "GWIRL", { A::SUMMARY_GROUP, "Group Water Injection Rate Target" } } ); - info.insert( { "GGPRL", { A::SUMMARY_GROUP, "Group Gas Production Rate Target" } } ); - info.insert( { "GGIRL", { A::SUMMARY_GROUP, "Group Gas Injection Rate Target" } } ); - info.insert( { "GLPRL", { A::SUMMARY_GROUP, "Group Liquid Production Rate Target" } } ); - info.insert( { "GVPRL", { A::SUMMARY_GROUP, "Group reservoir Volume Production Rate Target" } } ); - info.insert( { "GVIRL", { A::SUMMARY_GROUP, "Group reservoir Volume Injection Rate Target" } } ); - info.insert( { "GNPR", { A::SUMMARY_GROUP, "Solvent Production Rate" } } ); - info.insert( { "GNPT", { A::SUMMARY_GROUP, "Solvent Production Total" } } ); - info.insert( { "GNIR", { A::SUMMARY_GROUP, "Solvent Injection Rate" } } ); - info.insert( { "GNIT", { A::SUMMARY_GROUP, "Solvent Injection Total" } } ); - info.insert( { "GTPRSUR", { A::SUMMARY_GROUP, "Production Rate" } } ); - info.insert( { "GTPTSUR", { A::SUMMARY_GROUP, "Production Total" } } ); - info.insert( { "GTIRSUR", { A::SUMMARY_GROUP, "Injection Rate" } } ); - info.insert( { "GTITSUR", { A::SUMMARY_GROUP, "Injection Total" } } ); - info.insert( { "GTPRALK", { A::SUMMARY_GROUP, "Production Rate" } } ); - info.insert( { "GTPTALK", { A::SUMMARY_GROUP, "Production Total" } } ); - info.insert( { "GTIRALK", { A::SUMMARY_GROUP, "Injection Rate" } } ); - info.insert( { "GTITALK", { A::SUMMARY_GROUP, "Injection Total" } } ); - info.insert( { "GU", { A::SUMMARY_GROUP, "User-defined group quantity" } } ); - - info.insert( { "WOPR", { A::SUMMARY_WELL, "Oil Production Rate" } } ); - info.insert( { "WOPRA", { A::SUMMARY_WELL, "Oil Production Rate above GOC" } } ); - info.insert( { "WOPRB", { A::SUMMARY_WELL, "Oil Production Rate below GOC" } } ); - info.insert( { "WOPTA", { A::SUMMARY_WELL, "Oil Production Total above GOC" } } ); - info.insert( { "WOPTB", { A::SUMMARY_WELL, "Oil Production Total below GOC" } } ); - info.insert( { "WOPR1", { A::SUMMARY_WELL, "Oil Production Rate above GOC" } } ); - info.insert( { "WOPR2", { A::SUMMARY_WELL, "Oil Production Rate below GOC" } } ); - info.insert( { "WOPT1", { A::SUMMARY_WELL, "Oil Production Total above GOC" } } ); - info.insert( { "WOPT2", { A::SUMMARY_WELL, "Oil Production Total below GOC" } } ); - info.insert( { "WOMR", { A::SUMMARY_WELL, "Oil Mass Rate" } } ); - info.insert( { "WOMT", { A::SUMMARY_WELL, "Oil Mass Total" } } ); - info.insert( { "WODN", { A::SUMMARY_WELL, "Oil Density at Surface Conditions" } } ); - info.insert( { "WOPRH", { A::SUMMARY_WELL, "Oil Production Rate History" } } ); - info.insert( { "WOPRT", { A::SUMMARY_WELL, "Oil Production Rate Target/Limit" } } ); - info.insert( { "WOPRF", { A::SUMMARY_WELL, "Free Oil Production Rate" } } ); - info.insert( { "WOPRS", { A::SUMMARY_WELL, "Solution Oil Production Rate" } } ); - info.insert( { "WOPT", { A::SUMMARY_WELL, "Oil Production Total" } } ); - info.insert( { "WOPTH", { A::SUMMARY_WELL, "Oil Production Total History" } } ); - info.insert( { "WOPTF", { A::SUMMARY_WELL, "Free Oil Production Total" } } ); - info.insert( { "WOPTS", { A::SUMMARY_WELL, "Solution Oil Production Total" } } ); - info.insert( { "WOIR", { A::SUMMARY_WELL, "Oil Injection Rate" } } ); - info.insert( { "WOIRH", { A::SUMMARY_WELL, "Oil Injection Rate History" } } ); - info.insert( { "WOIRT", { A::SUMMARY_WELL, "Oil Injection Rate Target/Limit" } } ); - info.insert( { "WOIT", { A::SUMMARY_WELL, "Oil Injection Total" } } ); - info.insert( { "WOITH", { A::SUMMARY_WELL, "Oil Injection Total History" } } ); - info.insert( { "WOPP", { A::SUMMARY_WELL, "Oil Potential Production rate" } } ); - info.insert( { "WOPP2", { A::SUMMARY_WELL, "Oil Potential Production rate" } } ); - info.insert( { "WOPI", { A::SUMMARY_WELL, "Oil Potential Injection rate" } } ); - info.insert( { "WOPI2", { A::SUMMARY_WELL, "Oil Potential Injection rate" } } ); - info.insert( { "WOPGR", { A::SUMMARY_WELL, "Oil Production Guide Rate" } } ); - info.insert( { "WOIGR", { A::SUMMARY_WELL, "Oil Injection Guide Rate" } } ); - info.insert( { "WOVPR", { A::SUMMARY_WELL, "Oil Voidage Production Rate" } } ); - info.insert( { "WOVPT", { A::SUMMARY_WELL, "Oil Voidage Production Total" } } ); - info.insert( { "WOVIR", { A::SUMMARY_WELL, "Oil Voidage Injection Rate" } } ); - info.insert( { "WOVIT", { A::SUMMARY_WELL, "Oil Voidage Injection Total" } } ); - info.insert( { "WOnPR", { A::SUMMARY_WELL, "nth separator stage oil rate" } } ); - info.insert( { "WOnPT", { A::SUMMARY_WELL, "nth separator stage oil total" } } ); - info.insert( { "WWPR", { A::SUMMARY_WELL, "Water Production Rate" } } ); - info.insert( { "WWMR", { A::SUMMARY_WELL, "Water Mass Rate" } } ); - info.insert( { "WWMT", { A::SUMMARY_WELL, "Water Mass Total" } } ); - info.insert( { "WWPRH", { A::SUMMARY_WELL, "Water Production Rate History" } } ); - info.insert( { "WWPRT", { A::SUMMARY_WELL, "Water Production Rate Target/Limit" } } ); - info.insert( { "WWPT", { A::SUMMARY_WELL, "Water Production Total" } } ); - info.insert( { "WWPTH", { A::SUMMARY_WELL, "Water Production Total History" } } ); - info.insert( { "WWIR", { A::SUMMARY_WELL, "Water Injection Rate" } } ); - info.insert( { "WWIRH", { A::SUMMARY_WELL, "Water Injection Rate History" } } ); - info.insert( { "WWIRT", { A::SUMMARY_WELL, "Water Injection Rate Target/Limit" } } ); - info.insert( { "WWIT", { A::SUMMARY_WELL, "Water Injection Total" } } ); - info.insert( { "WWITH", { A::SUMMARY_WELL, "Water Injection Total History" } } ); - info.insert( { "WWPP", { A::SUMMARY_WELL, "Water Potential Production rate" } } ); - info.insert( { "WWPP2", { A::SUMMARY_WELL, "Water Potential Production rate" } } ); - info.insert( { "WWPI", { A::SUMMARY_WELL, "Water Potential Injection rate" } } ); - info.insert( { "WWIP", { A::SUMMARY_WELL, "Water Potential Injection rate" } } ); - info.insert( { "WWPI2", { A::SUMMARY_WELL, "Water Potential Injection rate" } } ); - info.insert( { "WWIP2", { A::SUMMARY_WELL, "Water Potential Injection rate" } } ); - info.insert( { "WWPGR", { A::SUMMARY_WELL, "Water Production Guide Rate" } } ); - info.insert( { "WWIGR", { A::SUMMARY_WELL, "Water Injection Guide Rate" } } ); - info.insert( { "WWVPR", { A::SUMMARY_WELL, "Water Voidage Production Rate" } } ); - info.insert( { "WWVPT", { A::SUMMARY_WELL, "Water Voidage Production Total" } } ); - info.insert( { "WWVIR", { A::SUMMARY_WELL, "Water Voidage Injection Rate" } } ); - info.insert( { "WWVIT", { A::SUMMARY_WELL, "Water Voidage Injection Total" } } ); - info.insert( { "WWPIR", { A::SUMMARY_WELL, "Ratio of produced water to injected water (percentage)" } } ); - info.insert( { "WWMPR", { A::SUMMARY_WELL, "Water component molar production rate" } } ); - info.insert( { "WWMPT", { A::SUMMARY_WELL, "Water component molar production total" } } ); - info.insert( { "WWMIR", { A::SUMMARY_WELL, "Water component molar injection rate" } } ); - info.insert( { "WWMIT", { A::SUMMARY_WELL, "Water component molar injection total" } } ); - info.insert( { "WGPR", { A::SUMMARY_WELL, "Gas Production Rate" } } ); - info.insert( { "WGPRA", { A::SUMMARY_WELL, "Gas Production Rate above" } } ); - info.insert( { "WGPRB", { A::SUMMARY_WELL, "Gas Production Rate below" } } ); - info.insert( { "WGPTA", { A::SUMMARY_WELL, "Gas Production Total above" } } ); - info.insert( { "WGPTB", { A::SUMMARY_WELL, "Gas Production Total below" } } ); - info.insert( { "WGPR1", { A::SUMMARY_WELL, "Gas Production Rate above GOC" } } ); - info.insert( { "WGPR2", { A::SUMMARY_WELL, "Gas Production Rate below GOC" } } ); - info.insert( { "WGPT1", { A::SUMMARY_WELL, "Gas Production Total above GOC" } } ); - info.insert( { "WGPT2", { A::SUMMARY_WELL, "Gas Production Total below GOC" } } ); - info.insert( { "WGMR", { A::SUMMARY_WELL, "Gas Mass Rate" } } ); - info.insert( { "WGMT", { A::SUMMARY_WELL, "Gas Mass Total" } } ); - info.insert( { "WGDN", { A::SUMMARY_WELL, "Gas Density at Surface Conditions" } } ); - info.insert( { "WGPRH", { A::SUMMARY_WELL, "Gas Production Rate History" } } ); - info.insert( { "WGPRT", { A::SUMMARY_WELL, "Gas Production Rate Target/Limit" } } ); - info.insert( { "WGPRF", { A::SUMMARY_WELL, "Free Gas Production Rate" } } ); - info.insert( { "WGPRS", { A::SUMMARY_WELL, "Solution Gas Production Rate" } } ); - info.insert( { "WGPT", { A::SUMMARY_WELL, "Gas Production Total" } } ); - info.insert( { "WGPTH", { A::SUMMARY_WELL, "Gas Production Total History" } } ); - info.insert( { "WGPTF", { A::SUMMARY_WELL, "Free Gas Production Total" } } ); - info.insert( { "WGPTS", { A::SUMMARY_WELL, "Solution Gas Production Total" } } ); - info.insert( { "WGIR", { A::SUMMARY_WELL, "Gas Injection Rate" } } ); - info.insert( { "WGIRH", { A::SUMMARY_WELL, "Gas Injection Rate History" } } ); - info.insert( { "WGIRT", { A::SUMMARY_WELL, "Gas Injection Rate Target/Limit" } } ); - info.insert( { "WGIT", { A::SUMMARY_WELL, "Gas Injection Total" } } ); - info.insert( { "WGITH", { A::SUMMARY_WELL, "Gas Injection Total History" } } ); - info.insert( { "WGPP", { A::SUMMARY_WELL, "Gas Potential Production rate" } } ); - info.insert( { "WGPP2", { A::SUMMARY_WELL, "Gas Potential Production rate" } } ); - info.insert( { "WGPPS", { A::SUMMARY_WELL, "Solution" } } ); - info.insert( { "WGPPS2", { A::SUMMARY_WELL, "Solution" } } ); - info.insert( { "WGPPF", { A::SUMMARY_WELL, "Free Gas Potential Production rate" } } ); - info.insert( { "WGPPF2", { A::SUMMARY_WELL, "Free Gas Potential Production rate" } } ); - info.insert( { "WGPI", { A::SUMMARY_WELL, "Gas Potential Injection rate" } } ); - info.insert( { "WGIP", { A::SUMMARY_WELL, "Gas Potential Injection rate" } } ); - info.insert( { "WGPI2", { A::SUMMARY_WELL, "Gas Potential Injection rate" } } ); - info.insert( { "WGIP2", { A::SUMMARY_WELL, "Gas Potential Injection rate" } } ); - info.insert( { "WGPGR", { A::SUMMARY_WELL, "Gas Production Guide Rate" } } ); - info.insert( { "WGIGR", { A::SUMMARY_WELL, "Gas Injection Guide Rate" } } ); - info.insert( { "WGLIR", { A::SUMMARY_WELL, "Gas Lift Injection Rate" } } ); - info.insert( { "WGLIT", { A::SUMMARY_WELL, "Gas Lift Injection Total" } } ); - info.insert( { "WWGPR", { A::SUMMARY_WELL, "Wet Gas Production Rate" } } ); - info.insert( { "WWGPT", { A::SUMMARY_WELL, "Wet Gas Production Total" } } ); - info.insert( { "WWGPRH", { A::SUMMARY_WELL, "Wet Gas Production Rate History" } } ); - info.insert( { "WWGIR", { A::SUMMARY_WELL, "Wet Gas Injection Rate" } } ); - info.insert( { "WWGIT", { A::SUMMARY_WELL, "Wet Gas Injection Total" } } ); - info.insert( { "WGnPR", { A::SUMMARY_WELL, "nth separator stage gas rate" } } ); - info.insert( { "WGnPT", { A::SUMMARY_WELL, "nth separator stage gas total" } } ); - info.insert( { "WGVPR", { A::SUMMARY_WELL, "Gas Voidage Production Rate" } } ); - info.insert( { "WGVPT", { A::SUMMARY_WELL, "Gas Voidage Production Total" } } ); - info.insert( { "WGVIR", { A::SUMMARY_WELL, "Gas Voidage Injection Rate" } } ); - info.insert( { "WGVIT", { A::SUMMARY_WELL, "Gas Voidage Injection Total" } } ); - info.insert( { "WGQ", { A::SUMMARY_WELL, "Gas Quality" } } ); - info.insert( { "WLPR", { A::SUMMARY_WELL, "Liquid Production Rate" } } ); - info.insert( { "WLPRH", { A::SUMMARY_WELL, "Liquid Production Rate History" } } ); - info.insert( { "WLPRT", { A::SUMMARY_WELL, "Liquid Production Rate Target/Limit" } } ); - info.insert( { "WLPT", { A::SUMMARY_WELL, "Liquid Production Total" } } ); - info.insert( { "WLPTH", { A::SUMMARY_WELL, "Liquid Production Total History" } } ); - info.insert( { "WVPR", { A::SUMMARY_WELL, "Res Volume Production Rate" } } ); - info.insert( { "WVPRT", { A::SUMMARY_WELL, "Res Volume Production Rate Target/Limit" } } ); - info.insert( { "WVPT", { A::SUMMARY_WELL, "Res Volume Production Total" } } ); - info.insert( { "WVPGR", { A::SUMMARY_WELL, "Res Volume Production Guide Rate" } } ); - info.insert( { "WVIR", { A::SUMMARY_WELL, "Res Volume Injection Rate" } } ); - info.insert( { "WVIRT", { A::SUMMARY_WELL, "Res Volume Injection Rate Target/Limit" } } ); - info.insert( { "WVIT", { A::SUMMARY_WELL, "Res Volume Injection Total" } } ); - info.insert( { "WWCT", { A::SUMMARY_WELL, "Water Cut" } } ); - info.insert( { "WWCTH", { A::SUMMARY_WELL, "Water Cut History" } } ); - info.insert( { "WGOR", { A::SUMMARY_WELL, "Gas-Oil Ratio" } } ); - info.insert( { "WGORH", { A::SUMMARY_WELL, "Gas-Oil Ratio History" } } ); - info.insert( { "WOGR", { A::SUMMARY_WELL, "Oil-Gas Ratio" } } ); - info.insert( { "WOGRH", { A::SUMMARY_WELL, "Oil-Gas Ratio History" } } ); - info.insert( { "WWGR", { A::SUMMARY_WELL, "Water-Gas Ratio" } } ); - info.insert( { "WWGRH", { A::SUMMARY_WELL, "Water-Gas Ratio History" } } ); - info.insert( { "WGLR", { A::SUMMARY_WELL, "Gas-Liquid Ratio" } } ); - info.insert( { "WGLRH", { A::SUMMARY_WELL, "Gas-Liquid Ratio History" } } ); - info.insert( { "WBGLR", { A::SUMMARY_WELL, "Bottom hole Gas-Liquid Ratio" } } ); - info.insert( { "WBHP", { A::SUMMARY_WELL, "Bottom Hole Pressure" } } ); - info.insert( { "WBHPH", { A::SUMMARY_WELL, "Bottom Hole Pressure History" } } ); - info.insert( { "WBHPT", { A::SUMMARY_WELL, "Bottom Hole Pressure Target/Limit" } } ); - info.insert( { "WTHP", { A::SUMMARY_WELL, "Tubing Head Pressure" } } ); - info.insert( { "WTHPH", { A::SUMMARY_WELL, "Tubing Head Pressure History" } } ); - info.insert( { "WPI", { A::SUMMARY_WELL, "Productivity Index of well's preferred phase" } } ); - info.insert( { "WPIO", { A::SUMMARY_WELL, "Oil phase PI" } } ); - info.insert( { "WPIG", { A::SUMMARY_WELL, "Gas phase PI" } } ); - info.insert( { "WPIW", { A::SUMMARY_WELL, "Water phase PI" } } ); - info.insert( { "WPIL", { A::SUMMARY_WELL, "Liquid phase PI" } } ); - info.insert( { "WBP", { A::SUMMARY_WELL, "One-point Pressure Average" } } ); - info.insert( { "WBP4", { A::SUMMARY_WELL, "Four-point Pressure Average" } } ); - info.insert( { "WBP5", { A::SUMMARY_WELL, "Five-point Pressure Average" } } ); - info.insert( { "WBP9", { A::SUMMARY_WELL, "Nine-point Pressure Average" } } ); - info.insert( { "WPI1", { A::SUMMARY_WELL, "Productivity Index based on the value of WBP" } } ); - info.insert( { "WPI4", { A::SUMMARY_WELL, "Productivity Index based on the value of WBP4" } } ); - info.insert( { "WPI5", { A::SUMMARY_WELL, "Productivity Index based on the value of WBP5" } } ); - info.insert( { "WPI9", { A::SUMMARY_WELL, "Productivity Index based on the value of WBP9" } } ); - info.insert( { "WHD", - { A::SUMMARY_WELL, - "Hydraulic head in well based on the reference depth given in HYDRHEAD and the well's reference " - "depth" } } ); - info.insert( { "WHDF", - { A::SUMMARY_WELL, - "Hydraulic head in well based on the reference depth given in HYDRHEAD and the well's reference depth " - "calculated at freshwater conditions" } } ); - info.insert( { "WSTAT", { A::SUMMARY_WELL, "Well State Indicator" } } ); - info.insert( { "WMCTL", { A::SUMMARY_WELL, "Mode of Control" } } ); - info.insert( { "WMCON", { A::SUMMARY_WELL, "The number of connections capable of flowing in the well" } } ); - info.insert( { "WEPR", { A::SUMMARY_WELL, "Energy Production Rate" } } ); - info.insert( { "WEPT", { A::SUMMARY_WELL, "Energy Production Total" } } ); - info.insert( { "WEFF", { A::SUMMARY_WELL, "Efficiency Factor" } } ); - info.insert( { "WEFFG", { A::SUMMARY_WELL, "Product of efficiency factors of the well and all its superior groups" } } ); - info.insert( { "WALQ", { A::SUMMARY_WELL, "Well Artificial Lift Quantity" } } ); - info.insert( { "WMVFP", { A::SUMMARY_WELL, "VFP table number used by the well" } } ); - info.insert( { "WNLPR", { A::SUMMARY_WELL, "NGL Production Rate" } } ); - info.insert( { "WNLPT", { A::SUMMARY_WELL, "NGL Production Total" } } ); - info.insert( { "WNLPRH", { A::SUMMARY_WELL, "NGL Production Rate History" } } ); - info.insert( { "WNLPTH", { A::SUMMARY_WELL, "NGL Production Total History" } } ); - info.insert( { "WNLPRT", { A::SUMMARY_WELL, "NGL Production Rate Target" } } ); - info.insert( { "WAMF", { A::SUMMARY_WELL, "Component aqueous mole fraction, from producing completions" } } ); - info.insert( { "WXMF", { A::SUMMARY_WELL, "Liquid Mole Fraction" } } ); - info.insert( { "WYMF", { A::SUMMARY_WELL, "Vapor Mole Fraction" } } ); - info.insert( { "WXMFn", { A::SUMMARY_WELL, "Liquid Mole Fraction for nth separator stage" } } ); - info.insert( { "WYMFn", { A::SUMMARY_WELL, "Vapor Mole Fraction for nth separator stage" } } ); - info.insert( { "WZMF", { A::SUMMARY_WELL, "Total Mole Fraction" } } ); - info.insert( { "WCMPR", { A::SUMMARY_WELL, "Hydrocarbon Component Molar Production Rates" } } ); - info.insert( { "WCMPT", { A::SUMMARY_WELL, "Hydrocarbon Component" } } ); - info.insert( { "WCMIR", { A::SUMMARY_WELL, "Hydrocarbon Component Molar Injection Rates" } } ); - info.insert( { "WCMIT", { A::SUMMARY_WELL, "Hydrocarbon Component Molar Injection Totals" } } ); - info.insert( { "WCGIR", { A::SUMMARY_WELL, "Hydrocarbon Component Gas Injection Rate" } } ); - info.insert( { "WCGPR", { A::SUMMARY_WELL, "Hydrocarbon Component Gas Production Rate" } } ); - info.insert( { "WCOPR", { A::SUMMARY_WELL, "Hydrocarbon Component Oil Production Rate" } } ); - info.insert( { "WHMIR", { A::SUMMARY_WELL, "Hydrocarbon Molar Injection Rate" } } ); - info.insert( { "WHMIT", { A::SUMMARY_WELL, "Hydrocarbon Molar Injection Total" } } ); - info.insert( { "WHMPR", { A::SUMMARY_WELL, "Hydrocarbon Molar Production Rate" } } ); - info.insert( { "WHMPT", { A::SUMMARY_WELL, "Hydrocarbon Molar Production Total" } } ); - info.insert( { "WCHMR", { A::SUMMARY_WELL, "Hydrocarbon Component" } } ); - info.insert( { "WCHMT", { A::SUMMARY_WELL, "Hydrocarbon Component" } } ); - info.insert( { "WCWGPR", { A::SUMMARY_WELL, "Hydrocarbon Component Wet Gas Production Rate" } } ); - info.insert( { "WCWGPT", { A::SUMMARY_WELL, "Hydrocarbon Component Wet Gas Production Total" } } ); - info.insert( { "WCWGIR", { A::SUMMARY_WELL, "Hydrocarbon Component Wet Gas Injection Rate" } } ); - info.insert( { "WCWGIT", { A::SUMMARY_WELL, "Hydrocarbon Component Wet Gas Injection Total" } } ); - info.insert( { "WCGMR", { A::SUMMARY_WELL, "Hydrocarbon component" } } ); - info.insert( { "WCGMT", { A::SUMMARY_WELL, "Hydrocarbon component" } } ); - info.insert( { "WCOMR", { A::SUMMARY_WELL, "Hydrocarbon component" } } ); - info.insert( { "WCOMT", { A::SUMMARY_WELL, "Hydrocarbon component" } } ); - info.insert( { "WCNMR", { A::SUMMARY_WELL, "Hydrocarbon component molar rates in the NGL phase" } } ); - info.insert( { "WCNWR", { A::SUMMARY_WELL, "Hydrocarbon component mass rates in the NGL phase" } } ); - info.insert( { "WCGMRn", { A::SUMMARY_WELL, "Hydrocarbon component molar rates in the gas phase for nth separator stage" } } ); - info.insert( { "WCGRn", { A::SUMMARY_WELL, "Hydrocarbon component molar rates in the gas phase for nth separator stage" } } ); - info.insert( { "WCOMRn", { A::SUMMARY_WELL, "Hydrocarbon component" } } ); - info.insert( { "WCORn", { A::SUMMARY_WELL, "Hydrocarbon component" } } ); - info.insert( { "WMUF", { A::SUMMARY_WELL, "Make-up fraction" } } ); - info.insert( { "WTHT", { A::SUMMARY_WELL, "Tubing Head Temperature" } } ); - info.insert( { "WMMW", { A::SUMMARY_WELL, "Mean molecular weight of wellstream" } } ); - info.insert( { "WPWE0", { A::SUMMARY_WELL, "Well drilled indicator" } } ); - info.insert( { "WPWE1", { A::SUMMARY_WELL, "Connections opened indicator" } } ); - info.insert( { "WPWE2", { A::SUMMARY_WELL, "Connections closed indicator" } } ); - info.insert( { "WPWE3", { A::SUMMARY_WELL, "Connections closed to bottom indicator" } } ); - info.insert( { "WPWE4", { A::SUMMARY_WELL, "Well stopped indicator" } } ); - info.insert( { "WPWE5", { A::SUMMARY_WELL, "Injector to producer indicator" } } ); - info.insert( { "WPWE6", { A::SUMMARY_WELL, "Producer to injector indicator" } } ); - info.insert( { "WPWE7", { A::SUMMARY_WELL, "Well shut indicator" } } ); - info.insert( { "WPWEM", { A::SUMMARY_WELL, "WELEVNT output mnemonic" } } ); - info.insert( { "WDRPR", { A::SUMMARY_WELL, "Well drilling priority" } } ); - info.insert( { "WBHWCn", { A::SUMMARY_WELL, "Derivative of well BHP with respect to parameter n" } } ); - info.insert( { "WGFWCn", { A::SUMMARY_WELL, "Derivative of well gas flow rate with respect to parameter n" } } ); - info.insert( { "WOFWCn", { A::SUMMARY_WELL, "Derivative of well oil flow rate with respect to parameter n" } } ); - info.insert( { "WWFWCn", { A::SUMMARY_WELL, "Derivative of water flow rate with respect to parameter n" } } ); - info.insert( { "WTPR", { A::SUMMARY_WELL, "Tracer Production Rate" } } ); - info.insert( { "WTPT", { A::SUMMARY_WELL, "Tracer Production Total" } } ); - info.insert( { "WTPC", { A::SUMMARY_WELL, "Tracer Production Concentration" } } ); - info.insert( { "WTIR", { A::SUMMARY_WELL, "Tracer Injection Rate" } } ); - info.insert( { "WTIT", { A::SUMMARY_WELL, "Tracer Injection Total" } } ); - info.insert( { "WTIC", { A::SUMMARY_WELL, "Tracer Injection Concentration" } } ); - info.insert( { "WTMR", { A::SUMMARY_WELL, "Traced mass Rate" } } ); - info.insert( { "WTMT", { A::SUMMARY_WELL, "Traced mass Total" } } ); - info.insert( { "WTQR", { A::SUMMARY_WELL, "Traced molar Rate" } } ); - info.insert( { "WTCM", { A::SUMMARY_WELL, "Tracer Carrier molar Rate" } } ); - info.insert( { "WTMF", { A::SUMMARY_WELL, "Traced molar fraction" } } ); - info.insert( { "WTVL", { A::SUMMARY_WELL, "Traced liquid volume rate" } } ); - info.insert( { "WTVV", { A::SUMMARY_WELL, "Traced vapor volume rate" } } ); - info.insert( { "WTTL", { A::SUMMARY_WELL, "Traced liquid volume total" } } ); - info.insert( { "WTTV", { A::SUMMARY_WELL, "Traced vapor volume total" } } ); - info.insert( { "WTML", { A::SUMMARY_WELL, "Traced mass liquid rate" } } ); - info.insert( { "WTMV", { A::SUMMARY_WELL, "Traced mass vapor rate" } } ); - info.insert( { "WTLM", { A::SUMMARY_WELL, "Traced mass liquid total" } } ); - info.insert( { "WTVM", { A::SUMMARY_WELL, "Traced mass vapor total" } } ); - info.insert( { "WAPI", { A::SUMMARY_WELL, "Oil API" } } ); - info.insert( { "WSPR", { A::SUMMARY_WELL, "Salt Production Rate" } } ); - info.insert( { "WSPT", { A::SUMMARY_WELL, "Salt Production Total" } } ); - info.insert( { "WSIR", { A::SUMMARY_WELL, "Salt Injection Rate" } } ); - info.insert( { "WSIT", { A::SUMMARY_WELL, "Salt Injection Total" } } ); - info.insert( { "WSPC", { A::SUMMARY_WELL, "Salt Production Concentration" } } ); - info.insert( { "WSIC", { A::SUMMARY_WELL, "Salt Injection Concentration" } } ); - info.insert( { "WTPCHEA", { A::SUMMARY_WELL, "Production Temperature" } } ); - info.insert( { "WTICHEA", { A::SUMMARY_WELL, "Injection Temperature" } } ); - info.insert( { "WTPRHEA", { A::SUMMARY_WELL, "Energy flows" } } ); - info.insert( { "WTPTHEA", { A::SUMMARY_WELL, "Energy Production Total" } } ); - info.insert( { "WTIRHEA", { A::SUMMARY_WELL, "Energy flows" } } ); - info.insert( { "WTITHEA", { A::SUMMARY_WELL, "Energy Injection Total" } } ); - info.insert( { "WTPR", { A::SUMMARY_WELL, "Tracer Production Rate" } } ); - info.insert( { "WTPT", { A::SUMMARY_WELL, "Tracer Production Total" } } ); - info.insert( { "WTPC", { A::SUMMARY_WELL, "Tracer Production Concentration" } } ); - info.insert( { "WTIR", { A::SUMMARY_WELL, "Tracer Injection Rate" } } ); - info.insert( { "WTIT", { A::SUMMARY_WELL, "Tracer Injection Total" } } ); - info.insert( { "WTIC", { A::SUMMARY_WELL, "Tracer Injection Concentration" } } ); - info.insert( { "WTIRF", { A::SUMMARY_WELL, "Tracer Injection Rate" } } ); - info.insert( { "WTIRS", { A::SUMMARY_WELL, "Tracer Injection Rate" } } ); - info.insert( { "WTPRF", { A::SUMMARY_WELL, "Tracer Production Rate" } } ); - info.insert( { "WTPRS", { A::SUMMARY_WELL, "Tracer Production Rate" } } ); - info.insert( { "WTITF", { A::SUMMARY_WELL, "Tracer Injection Total" } } ); - info.insert( { "WTITS", { A::SUMMARY_WELL, "Tracer Injection Total" } } ); - info.insert( { "WTPTF", { A::SUMMARY_WELL, "Tracer Production Total" } } ); - info.insert( { "WTPTS", { A::SUMMARY_WELL, "Tracer Production Total" } } ); - info.insert( { "WTICF", { A::SUMMARY_WELL, "Tracer Injection Concentration" } } ); - info.insert( { "WTICS", { A::SUMMARY_WELL, "Tracer Injection Concentration" } } ); - info.insert( { "WTPCF", { A::SUMMARY_WELL, "Tracer Production" } } ); - info.insert( { "WTPCS", { A::SUMMARY_WELL, "Tracer Production" } } ); - info.insert( { "WMPR", { A::SUMMARY_WELL, "Methane Production Rate" } } ); - info.insert( { "WMPT", { A::SUMMARY_WELL, "Methane Production Total" } } ); - info.insert( { "WMIR", { A::SUMMARY_WELL, "Methane Injection Rate" } } ); - info.insert( { "WMIT", { A::SUMMARY_WELL, "Methane Injection Total" } } ); - info.insert( { "WTPRFOA", { A::SUMMARY_WELL, "Production Rate" } } ); - info.insert( { "WTPTFOA", { A::SUMMARY_WELL, "Production Total" } } ); - info.insert( { "WTIRFOA", { A::SUMMARY_WELL, "Injection Rate" } } ); - info.insert( { "WTITFOA", { A::SUMMARY_WELL, "Injection Total" } } ); - info.insert( { "WGDC", { A::SUMMARY_WELL, "Gas Delivery Capacity" } } ); - info.insert( { "NGOPAS", { A::SUMMARY_WELL, "Number of iterations to converge DCQ in first pass" } } ); - info.insert( { "WGPRFP", { A::SUMMARY_WELL, "Well Gas Production Rate from end of First Pass" } } ); - info.insert( { "WTHPFP", { A::SUMMARY_WELL, "Well Tubing Head Pressure from end of First Pass" } } ); - info.insert( { "WBHPFP", { A::SUMMARY_WELL, "Well Bottom Hole Pressure from end of First Pass" } } ); - info.insert( { "WGLIR", { A::SUMMARY_WELL, "Gas Lift Injection Rate" } } ); - info.insert( { "WOGLR", { A::SUMMARY_WELL, "Well Oil Gas Lift Ratio" } } ); - info.insert( { "WGCV", { A::SUMMARY_WELL, "Gas Calorific Value" } } ); - info.insert( { "WGQ", { A::SUMMARY_WELL, "Gas molar Quality" } } ); - info.insert( { "WEPR", { A::SUMMARY_WELL, "Energy Production Rate" } } ); - info.insert( { "WEPT", { A::SUMMARY_WELL, "Energy Production Total" } } ); - info.insert( { "WEDC", { A::SUMMARY_WELL, "Energy Delivery Capacity" } } ); - info.insert( { "WCPR", { A::SUMMARY_WELL, "Polymer Production Rate" } } ); - info.insert( { "WCPC", { A::SUMMARY_WELL, "Polymer Production Concentration" } } ); - info.insert( { "WCPT", { A::SUMMARY_WELL, "Polymer Production Total" } } ); - info.insert( { "WCIR", { A::SUMMARY_WELL, "Polymer Injection Rate" } } ); - info.insert( { "WCIC", { A::SUMMARY_WELL, "Polymer Injection Concentration" } } ); - info.insert( { "WCIT", { A::SUMMARY_WELL, "Polymer Injection Total" } } ); - info.insert( { "WSPR", { A::SUMMARY_WELL, "Salt Production Rate" } } ); - info.insert( { "WSPT", { A::SUMMARY_WELL, "Salt Production Total" } } ); - info.insert( { "WSIR", { A::SUMMARY_WELL, "Salt Injection Rate" } } ); - info.insert( { "WSIT", { A::SUMMARY_WELL, "Salt Injection Total" } } ); - info.insert( { "WNPR", { A::SUMMARY_WELL, "Solvent Production Rate" } } ); - info.insert( { "WNPT", { A::SUMMARY_WELL, "Solvent Production Total" } } ); - info.insert( { "WNIR", { A::SUMMARY_WELL, "Solvent Injection Rate" } } ); - info.insert( { "WNIT", { A::SUMMARY_WELL, "Solvent Injection Total" } } ); - info.insert( { "WTPRSUR", { A::SUMMARY_WELL, "Production Rate" } } ); - info.insert( { "WTPTSUR", { A::SUMMARY_WELL, "Production Total" } } ); - info.insert( { "WTIRSUR", { A::SUMMARY_WELL, "Injection Rate" } } ); - info.insert( { "WTITSUR", { A::SUMMARY_WELL, "Injection Total" } } ); - info.insert( { "WTPRALK", { A::SUMMARY_WELL, "Production Rate" } } ); - info.insert( { "WTPTALK", { A::SUMMARY_WELL, "Production Total" } } ); - info.insert( { "WTIRALK", { A::SUMMARY_WELL, "Injection Rate" } } ); - info.insert( { "WTITALK", { A::SUMMARY_WELL, "Injection Total" } } ); - info.insert( { "WOFRL", { A::SUMMARY_WELL, "Oil Flow Rate" } } ); - info.insert( { "WOPRL", { A::SUMMARY_WELL, "Oil Flow Rate" } } ); - info.insert( { "WOPTL", { A::SUMMARY_WELL, "Oil Production Total" } } ); - info.insert( { "WOITL", { A::SUMMARY_WELL, "Oil Injection Total" } } ); - info.insert( { "WWFRL", { A::SUMMARY_WELL, "Water Flow Rate" } } ); - info.insert( { "WWPRL", { A::SUMMARY_WELL, "Water Flow Rate" } } ); - info.insert( { "WWPTL", { A::SUMMARY_WELL, "Water Production Total" } } ); - info.insert( { "WWIRL", { A::SUMMARY_WELL, "Water Injection Rate" } } ); - info.insert( { "WWITL", { A::SUMMARY_WELL, "Water Injection Total" } } ); - info.insert( { "WGFRL", { A::SUMMARY_WELL, "Gas Flow Rate" } } ); - info.insert( { "WGPRL", { A::SUMMARY_WELL, "Gas Flow Rate" } } ); - info.insert( { "WGPTL", { A::SUMMARY_WELL, "Gas Production Total" } } ); - info.insert( { "WGIRL", { A::SUMMARY_WELL, "Gas Injection Rate" } } ); - info.insert( { "WGITL", { A::SUMMARY_WELL, "Gas Injection Total" } } ); - info.insert( { "WLFRL", { A::SUMMARY_WELL, "Liquid Flow Rate" } } ); - info.insert( { "WLPTL", { A::SUMMARY_WELL, "Liquid Production Total" } } ); - info.insert( { "WVFRL", { A::SUMMARY_WELL, "Res Volume Flow Rate" } } ); - info.insert( { "WVPRL", { A::SUMMARY_WELL, "Res Volume Production Flow Rate" } } ); - info.insert( { "WVIRL", { A::SUMMARY_WELL, "Res Volume Injection Flow Rate" } } ); - info.insert( { "WVPTL", { A::SUMMARY_WELL, "Res Volume Production Total" } } ); - info.insert( { "WVITL", { A::SUMMARY_WELL, "Res Volume Injection Total" } } ); - info.insert( { "WWCTL", { A::SUMMARY_WELL, "Water Cut" } } ); - info.insert( { "WGORL", { A::SUMMARY_WELL, "Gas-Oil Ratio" } } ); - info.insert( { "WOGRL", { A::SUMMARY_WELL, "Oil-Gas Ratio" } } ); - info.insert( { "WWGRL", { A::SUMMARY_WELL, "Water-Gas Ratio" } } ); - info.insert( { "WGLRL", { A::SUMMARY_WELL, "Gas-Liquid Ratio" } } ); - - info.insert( { "WU", { A::SUMMARY_WELL, "User-defined well quantity" } } ); - - // Future CONNECTION vectors - info.insert( { "COFR", { A::SUMMARY_WELL_COMPLETION, "Oil Flow Rate" } } ); - info.insert( { "COFRF", { A::SUMMARY_WELL_COMPLETION, "Free Oil Flow Rate" } } ); - info.insert( { "COFRS", { A::SUMMARY_WELL_COMPLETION, "Solution oil flow rate" } } ); - info.insert( { "COFRU", { A::SUMMARY_WELL_COMPLETION, "Sum of connection oil flow rates upstream of, and including, this connection" } } ); - info.insert( { "COPR", { A::SUMMARY_WELL_COMPLETION, "Oil Production Rate" } } ); - info.insert( { "COPT", { A::SUMMARY_WELL_COMPLETION, "Oil Production Total" } } ); - info.insert( { "COPTF", { A::SUMMARY_WELL_COMPLETION, "Free Oil Production Total" } } ); - info.insert( { "COPTS", { A::SUMMARY_WELL_COMPLETION, "Solution Oil Production Total" } } ); - info.insert( { "COIT", { A::SUMMARY_WELL_COMPLETION, "Oil Injection Total" } } ); - info.insert( { "COPP", { A::SUMMARY_WELL_COMPLETION, "Oil Potential Production rate" } } ); - info.insert( { "COPI", { A::SUMMARY_WELL_COMPLETION, "Oil Potential Injection rate" } } ); - info.insert( { "CWFR", { A::SUMMARY_WELL_COMPLETION, "Water Flow Rate" } } ); - info.insert( { "CWFRU", { A::SUMMARY_WELL_COMPLETION, "Sum of connection water flow rates upstream of, and including, this connection" } } ); - info.insert( { "CWPR", { A::SUMMARY_WELL_COMPLETION, "Water Production Rate" } } ); - info.insert( { "CWPT", { A::SUMMARY_WELL_COMPLETION, "Water Production Total" } } ); - info.insert( { "CWIR", { A::SUMMARY_WELL_COMPLETION, "Water Injection Rate" } } ); - info.insert( { "CWIT", { A::SUMMARY_WELL_COMPLETION, "Water Injection Total" } } ); - info.insert( { "CWPP", { A::SUMMARY_WELL_COMPLETION, "Water Potential Production rate" } } ); - info.insert( { "CWPI", { A::SUMMARY_WELL_COMPLETION, "Water Potential Injection rate" } } ); - info.insert( { "CGFR", { A::SUMMARY_WELL_COMPLETION, "Gas Flow Rate" } } ); - info.insert( { "CGFRF", { A::SUMMARY_WELL_COMPLETION, "Free Gas Flow Rate" } } ); - info.insert( { "CGFRS", { A::SUMMARY_WELL_COMPLETION, "Solution Gas Flow Rate" } } ); - info.insert( { "CGFRU", { A::SUMMARY_WELL_COMPLETION, "Sum of connection gas flow rates upstream of, and including, this connection" } } ); - info.insert( { "CGPR", { A::SUMMARY_WELL_COMPLETION, "Gas Production Rate " } } ); - info.insert( { "CGPT", { A::SUMMARY_WELL_COMPLETION, "Gas Production Total" } } ); - info.insert( { "CGPTF", { A::SUMMARY_WELL_COMPLETION, "Free Gas Production Total" } } ); - info.insert( { "CGPTS", { A::SUMMARY_WELL_COMPLETION, "Solution Gas Production Total" } } ); - info.insert( { "CGIR", { A::SUMMARY_WELL_COMPLETION, "Gas Injection Rate" } } ); - info.insert( { "CGIT", { A::SUMMARY_WELL_COMPLETION, "Gas Injection Total" } } ); - info.insert( { "CGPP", { A::SUMMARY_WELL_COMPLETION, "Gas Potential Production rate" } } ); - info.insert( { "CGPI", { A::SUMMARY_WELL_COMPLETION, "Gas Potential Injection rate" } } ); - info.insert( { "CGQ", { A::SUMMARY_WELL_COMPLETION, "Gas Quality" } } ); - info.insert( { "CLFR", { A::SUMMARY_WELL_COMPLETION, "Liquid Flow Rate" } } ); - info.insert( { "CLPT", { A::SUMMARY_WELL_COMPLETION, "Liquid Production Total" } } ); - info.insert( { "CVFR", { A::SUMMARY_WELL_COMPLETION, "Reservoir" } } ); - info.insert( { "CVPR", { A::SUMMARY_WELL_COMPLETION, "Res Volume Production Rate" } } ); - info.insert( { "CVPT", { A::SUMMARY_WELL_COMPLETION, "Res Volume Production Total" } } ); - info.insert( { "CVIR", { A::SUMMARY_WELL_COMPLETION, "Res Volume Injection Rate" } } ); - info.insert( { "CVIT", { A::SUMMARY_WELL_COMPLETION, "Res Volume Injection Total" } } ); - info.insert( { "CWCT", { A::SUMMARY_WELL_COMPLETION, "Water Cut" } } ); - info.insert( { "CGOR", { A::SUMMARY_WELL_COMPLETION, "Gas-Oil Ratio" } } ); - info.insert( { "COGR", { A::SUMMARY_WELL_COMPLETION, "Oil-Gas Ratio" } } ); - info.insert( { "CWGR", { A::SUMMARY_WELL_COMPLETION, "Water-Gas Ratio" } } ); - info.insert( { "CGLR", { A::SUMMARY_WELL_COMPLETION, "Gas-Liquid Ratio" } } ); - info.insert( { "CPR", { A::SUMMARY_WELL_COMPLETION, "Connection Pressure" } } ); - info.insert( { "CPI", { A::SUMMARY_WELL_COMPLETION, "Productivity Index of well's preferred phase" } } ); - info.insert( { "CTFAC", { A::SUMMARY_WELL_COMPLETION, "Connection Transmissibility Factor" } } ); - info.insert( { "CDBF", { A::SUMMARY_WELL_COMPLETION, "Blocking factor for generalized pseudo-pressure method" } } ); - info.insert( { "CGPPTN", { A::SUMMARY_WELL_COMPLETION, "Generalized pseudo-pressure table update counter" } } ); - info.insert( { "CGPPTS", { A::SUMMARY_WELL_COMPLETION, "Generalized pseudo-pressure table update status" } } ); - info.insert( { "CDSM", { A::SUMMARY_WELL_COMPLETION, "Current mass of scale deposited" } } ); - info.insert( { "CDSML", { A::SUMMARY_WELL_COMPLETION, "Current mass of scale deposited per unit perforation length" } } ); - info.insert( { "CDSF", { A::SUMMARY_WELL_COMPLETION, "PI multiplicative factor due to scale damage" } } ); - info.insert( { "CAMF", { A::SUMMARY_WELL_COMPLETION, "Component aqueous mole fraction, from producing completions" } } ); - info.insert( { "CZMF", { A::SUMMARY_WELL_COMPLETION, "Total Mole Fraction" } } ); - info.insert( { "CKFR", { A::SUMMARY_WELL_COMPLETION, "Hydrocarbon Component" } } ); - info.insert( { "CKFT", { A::SUMMARY_WELL_COMPLETION, "Hydrocarbon Component" } } ); - info.insert( { "CDFAC", { A::SUMMARY_WELL_COMPLETION, "D-factor for flow dependent skin factor" } } ); - info.insert( { "CTFR", { A::SUMMARY_WELL_COMPLETION, "Tracer Flow Rate" } } ); - info.insert( { "CTPR", { A::SUMMARY_WELL_COMPLETION, "Tracer Production Rate" } } ); - info.insert( { "CTPT", { A::SUMMARY_WELL_COMPLETION, "Tracer Production Total" } } ); - info.insert( { "CTPC", { A::SUMMARY_WELL_COMPLETION, "Tracer Production Concentration" } } ); - info.insert( { "CTIR", { A::SUMMARY_WELL_COMPLETION, "Tracer Injection Rate" } } ); - info.insert( { "CTIT", { A::SUMMARY_WELL_COMPLETION, "Tracer Injection Total" } } ); - info.insert( { "CTIC", { A::SUMMARY_WELL_COMPLETION, "Tracer Injection Concentration" } } ); - info.insert( { "CAPI", { A::SUMMARY_WELL_COMPLETION, "Oil API" } } ); - info.insert( { "CSFR", { A::SUMMARY_WELL_COMPLETION, "Salt Flow Rate" } } ); - info.insert( { "CSPR", { A::SUMMARY_WELL_COMPLETION, "Salt Production Rate" } } ); - info.insert( { "CSPT", { A::SUMMARY_WELL_COMPLETION, "Salt Production Total" } } ); - info.insert( { "CSIR", { A::SUMMARY_WELL_COMPLETION, "Salt Injection Rate" } } ); - info.insert( { "CSIT", { A::SUMMARY_WELL_COMPLETION, "Salt Injection Total" } } ); - info.insert( { "CSPC", { A::SUMMARY_WELL_COMPLETION, "Salt Production Concentration" } } ); - info.insert( { "CSIC", { A::SUMMARY_WELL_COMPLETION, "Salt Injection Concentration" } } ); - info.insert( { "CTFRANI", { A::SUMMARY_WELL_COMPLETION, "Anion Flow Rate" } } ); - info.insert( { "CTPTANI", { A::SUMMARY_WELL_COMPLETION, "Anion Production Total" } } ); - info.insert( { "CTITANI", { A::SUMMARY_WELL_COMPLETION, "Anion Injection Total" } } ); - info.insert( { "CTFRCAT", { A::SUMMARY_WELL_COMPLETION, "Cation Flow Rate" } } ); - info.insert( { "CTPTCAT", { A::SUMMARY_WELL_COMPLETION, "Cation Production Total" } } ); - info.insert( { "CTITCAT", { A::SUMMARY_WELL_COMPLETION, "Cation Injection Total" } } ); - info.insert( { "CTFR", { A::SUMMARY_WELL_COMPLETION, "Tracer Flow Rate" } } ); - info.insert( { "CTPR", { A::SUMMARY_WELL_COMPLETION, "Tracer Production Rate" } } ); - info.insert( { "CTPT", { A::SUMMARY_WELL_COMPLETION, "Tracer Production Total" } } ); - info.insert( { "CTPC", { A::SUMMARY_WELL_COMPLETION, "Tracer Production Concentration" } } ); - info.insert( { "CTIR", { A::SUMMARY_WELL_COMPLETION, "Tracer Injection Rate" } } ); - info.insert( { "CTIT", { A::SUMMARY_WELL_COMPLETION, "Tracer Injection Total" } } ); - info.insert( { "CTIC", { A::SUMMARY_WELL_COMPLETION, "Tracer Injection Concentration" } } ); - info.insert( { "CTIRF", { A::SUMMARY_WELL_COMPLETION, "Tracer Injection Rate" } } ); - info.insert( { "CTIRS", { A::SUMMARY_WELL_COMPLETION, "Tracer Injection Rate" } } ); - info.insert( { "CTPRF", { A::SUMMARY_WELL_COMPLETION, "Tracer Production Rate" } } ); - info.insert( { "CTPRS", { A::SUMMARY_WELL_COMPLETION, "Tracer Production Rate" } } ); - info.insert( { "CTITF", { A::SUMMARY_WELL_COMPLETION, "Tracer Injection Total" } } ); - info.insert( { "CTITS", { A::SUMMARY_WELL_COMPLETION, "Tracer Injection Total" } } ); - info.insert( { "CTPTF", { A::SUMMARY_WELL_COMPLETION, "Tracer Production Total" } } ); - info.insert( { "CTPTS", { A::SUMMARY_WELL_COMPLETION, "Tracer Production Total" } } ); - info.insert( { "CTICF", { A::SUMMARY_WELL_COMPLETION, "Tracer Injection Concentration" } } ); - info.insert( { "CTICS", { A::SUMMARY_WELL_COMPLETION, "Tracer Injection Concentration" } } ); - info.insert( { "CTPCF", { A::SUMMARY_WELL_COMPLETION, "Tracer Production" } } ); - info.insert( { "CTPCS", { A::SUMMARY_WELL_COMPLETION, "Tracer Production" } } ); - info.insert( { "CTFRFOA", { A::SUMMARY_WELL_COMPLETION, "Flow Rate" } } ); - info.insert( { "CTPTFOA", { A::SUMMARY_WELL_COMPLETION, "Production Total" } } ); - info.insert( { "CTITFOA", { A::SUMMARY_WELL_COMPLETION, "Injection Total" } } ); - info.insert( { "CRREXCH", { A::SUMMARY_WELL_COMPLETION, "Exchange flux at current time" } } ); - info.insert( { "CRRPROT", { A::SUMMARY_WELL_COMPLETION, "Connection cumulative water production" } } ); - info.insert( { "CRRINJT", { A::SUMMARY_WELL_COMPLETION, "Connection cumulative water injection" } } ); - info.insert( { "CCFR", { A::SUMMARY_WELL_COMPLETION, "Polymer Flow Rate" } } ); - info.insert( { "CCPR", { A::SUMMARY_WELL_COMPLETION, "Polymer Production Rate" } } ); - info.insert( { "CCPC", { A::SUMMARY_WELL_COMPLETION, "Polymer Production Concentration" } } ); - info.insert( { "CCPT", { A::SUMMARY_WELL_COMPLETION, "Polymer Production Total" } } ); - info.insert( { "CCIR", { A::SUMMARY_WELL_COMPLETION, "Polymer Injection Rate" } } ); - info.insert( { "CCIC", { A::SUMMARY_WELL_COMPLETION, "Polymer Injection Concentration" } } ); - info.insert( { "CCIT", { A::SUMMARY_WELL_COMPLETION, "Polymer Injection Total" } } ); - info.insert( { "CSFR", { A::SUMMARY_WELL_COMPLETION, "Salt Flow Rate" } } ); - info.insert( { "CSPR", { A::SUMMARY_WELL_COMPLETION, "Salt Production Rate" } } ); - info.insert( { "CSPT", { A::SUMMARY_WELL_COMPLETION, "Salt Production Total" } } ); - info.insert( { "CSIR", { A::SUMMARY_WELL_COMPLETION, "Salt Injection Rate" } } ); - info.insert( { "CSIT", { A::SUMMARY_WELL_COMPLETION, "Salt Injection Total" } } ); - info.insert( { "CNFR", { A::SUMMARY_WELL_COMPLETION, "Solvent Flow Rate" } } ); - info.insert( { "CNPT", { A::SUMMARY_WELL_COMPLETION, "Solvent Production Total" } } ); - info.insert( { "CNIT", { A::SUMMARY_WELL_COMPLETION, "Solvent Injection Total" } } ); - info.insert( { "CTFRSUR", { A::SUMMARY_WELL_COMPLETION, "Flow Rate" } } ); - info.insert( { "CTPTSUR", { A::SUMMARY_WELL_COMPLETION, "Production Total" } } ); - info.insert( { "CTITSUR", { A::SUMMARY_WELL_COMPLETION, "Injection Total" } } ); - info.insert( { "CTFRALK", { A::SUMMARY_WELL_COMPLETION, "Flow Rate" } } ); - info.insert( { "CTPTALK", { A::SUMMARY_WELL_COMPLETION, "Production Total" } } ); - info.insert( { "CTITALK", { A::SUMMARY_WELL_COMPLETION, "Injection Total" } } ); - info.insert( { "COFRU", { A::SUMMARY_WELL_COMPLETION, "Sum of connection oil flow rates upstream of, and including, this connection" } } ); - info.insert( { "CWFRU", { A::SUMMARY_WELL_COMPLETION, "Sum of connection water flow rates upstream of, and including, this connection" } } ); - info.insert( { "CGFRU", { A::SUMMARY_WELL_COMPLETION, "Sum of connection gas flow rates upstream of, and including, this connection" } } ); - info.insert( { "LCOFRU", { A::SUMMARY_WELL_COMPLETION, "As COFRU but for local grids" } } ); - info.insert( { "LCWFRU", { A::SUMMARY_WELL_COMPLETION, "As CWFRU but for local grids" } } ); - info.insert( { "LCGFRU", { A::SUMMARY_WELL_COMPLETION, "As CGFRU but for local grids" } } ); - info.insert( { "CU", { A::SUMMARY_WELL_COMPLETION, "User-defined connection quantity" } } ); - - info.insert( { "COFRL", { A::SUMMARY_WELL_COMPLETION, "Oil Flow Rate" } } ); - info.insert( { "COPRL", { A::SUMMARY_WELL_COMPLETION, "Oil Flow Rate" } } ); - info.insert( { "COPTL", { A::SUMMARY_WELL_COMPLETION, "Oil Production Total" } } ); - info.insert( { "COITL", { A::SUMMARY_WELL_COMPLETION, "Oil Injection Total" } } ); - info.insert( { "CWFRL", { A::SUMMARY_WELL_COMPLETION, "Water Flow Rate" } } ); - info.insert( { "CWPRL", { A::SUMMARY_WELL_COMPLETION, "Water Flow Rate" } } ); - info.insert( { "CWPTL", { A::SUMMARY_WELL_COMPLETION, "Water Production Total" } } ); - info.insert( { "CWIRL", { A::SUMMARY_WELL_COMPLETION, "Water Injection Rate" } } ); - info.insert( { "CWITL", { A::SUMMARY_WELL_COMPLETION, "Water Injection Total" } } ); - info.insert( { "CGFRL", { A::SUMMARY_WELL_COMPLETION, "Gas Flow Rate" } } ); - info.insert( { "CGPRL", { A::SUMMARY_WELL_COMPLETION, "Gas Flow Rate" } } ); - info.insert( { "CGPTL", { A::SUMMARY_WELL_COMPLETION, "Gas Production Total" } } ); - info.insert( { "CGIRL", { A::SUMMARY_WELL_COMPLETION, "Gas Injection Rate" } } ); - info.insert( { "CGITL", { A::SUMMARY_WELL_COMPLETION, "Gas Injection Total" } } ); - info.insert( { "CLFRL", { A::SUMMARY_WELL_COMPLETION, "Liquid Flow Rate" } } ); - info.insert( { "CLPTL", { A::SUMMARY_WELL_COMPLETION, "Liquid Production Total" } } ); - info.insert( { "CVFRL", { A::SUMMARY_WELL_COMPLETION, "Reservoir" } } ); - info.insert( { "CVPRL", { A::SUMMARY_WELL_COMPLETION, "Res Volume Production Flow Rate" } } ); - info.insert( { "CVIRL", { A::SUMMARY_WELL_COMPLETION, "Res Volume Injection Flow Rate" } } ); - info.insert( { "CVPTL", { A::SUMMARY_WELL_COMPLETION, "Res Volume Production Total" } } ); - info.insert( { "CVITL", { A::SUMMARY_WELL_COMPLETION, "Res Volume Injection Total" } } ); - info.insert( { "CWCTL", { A::SUMMARY_WELL_COMPLETION, "Water Cut" } } ); - info.insert( { "CGORL", { A::SUMMARY_WELL_COMPLETION, "Gas-Oil Ratio" } } ); - info.insert( { "COGRL", { A::SUMMARY_WELL_COMPLETION, "Oil-Gas Ratio" } } ); - info.insert( { "CWGRL", { A::SUMMARY_WELL_COMPLETION, "Water-Gas Ratio" } } ); - info.insert( { "CGLRL", { A::SUMMARY_WELL_COMPLETION, "Gas-Liquid Ratio" } } ); - info.insert( { "CPRL", { A::SUMMARY_WELL_COMPLETION, "Average Connection Pressure in completion" } } ); - info.insert( { "CKFRL", { A::SUMMARY_WELL_COMPLETION, "Hydrocarbon Component" } } ); - info.insert( { "CKFTL", { A::SUMMARY_WELL_COMPLETION, "Hydrocarbon Component" } } ); - - info.insert( { "RPR", { A::SUMMARY_REGION, "Pressure average value" } } ); - info.insert( { "RPRH", { A::SUMMARY_REGION, "Pressure average value" } } ); - info.insert( { "RPRP", { A::SUMMARY_REGION, "Pressure average value" } } ); - info.insert( { "RPRGZ", { A::SUMMARY_REGION, "P/Z" } } ); - info.insert( { "RRS", { A::SUMMARY_REGION, "Gas-oil ratio" } } ); - info.insert( { "RRV", { A::SUMMARY_REGION, "Oil-gas ratio" } } ); - info.insert( { "RPPC", { A::SUMMARY_REGION, "Initial Contact Corrected Potential" } } ); - info.insert( { "RRPV", { A::SUMMARY_REGION, "Pore Volume at Reservoir conditions" } } ); - info.insert( { "ROPV", { A::SUMMARY_REGION, "Pore Volume containing Oil" } } ); - info.insert( { "RWPV", { A::SUMMARY_REGION, "Pore Volume containing Water" } } ); - info.insert( { "RGPV", { A::SUMMARY_REGION, "Pore Volume containing Gas" } } ); - info.insert( { "RHPV", { A::SUMMARY_REGION, "Pore Volume containing Hydrocarbon" } } ); - info.insert( { "RRTM", { A::SUMMARY_REGION, "Transmissibility Multiplier associated with rock compaction" } } ); - info.insert( { "ROE", { A::SUMMARY_REGION, "(OIP(initial) - OIP(now)) / OIP(initial)" } } ); - info.insert( { "ROEW", { A::SUMMARY_REGION, "Oil Production from Wells / OIP(initial)" } } ); - info.insert( { "ROEIW", { A::SUMMARY_REGION, "(OIP(initial) - OIP(now)) / Initial Mobile Oil with respect to Water" } } ); - info.insert( { "ROEWW", { A::SUMMARY_REGION, "Oil Production from Wells / Initial Mobile Oil with respect to Water" } } ); - info.insert( { "ROEIG", { A::SUMMARY_REGION, "(OIP(initial) - OIP(now)) / Initial Mobile Oil with respect to Gas" } } ); - info.insert( { "ROEWG", { A::SUMMARY_REGION, "Oil Production from Wells / Initial Mobile Oil with respect to Gas" } } ); - info.insert( { "RORMR", { A::SUMMARY_REGION, "Total stock tank oil produced by rock compaction" } } ); - info.insert( { "RORMW", { A::SUMMARY_REGION, "Total stock tank oil produced by water influx" } } ); - info.insert( { "RORMG", { A::SUMMARY_REGION, "Total stock tank oil produced by gas influx" } } ); - info.insert( { "RORME", { A::SUMMARY_REGION, "Total stock tank oil produced by oil expansion" } } ); - info.insert( { "RORMS", { A::SUMMARY_REGION, "Total stock tank oil produced by solution gas" } } ); - info.insert( { "RORMF", { A::SUMMARY_REGION, "Total stock tank oil produced by free gas influx" } } ); - info.insert( { "RORMX", { A::SUMMARY_REGION, "Total stock tank oil produced by 'traced' water influx" } } ); - info.insert( { "RORMY", { A::SUMMARY_REGION, "Total stock tank oil produced by other water influx" } } ); - info.insert( { "RORFR", { A::SUMMARY_REGION, "Fraction of total oil produced by rock compaction" } } ); - info.insert( { "RORFW", { A::SUMMARY_REGION, "Fraction of total oil produced by water influx" } } ); - info.insert( { "RORFG", { A::SUMMARY_REGION, "Fraction of total oil produced by gas influx" } } ); - info.insert( { "RORFE", { A::SUMMARY_REGION, "Fraction of total oil produced by oil expansion" } } ); - info.insert( { "RORFS", { A::SUMMARY_REGION, "Fraction of total oil produced by solution gas" } } ); - info.insert( { "RORFF", { A::SUMMARY_REGION, "Fraction of total oil produced by free gas influx" } } ); - info.insert( { "RORFX", { A::SUMMARY_REGION, "Fraction of total oil produced by 'traced' water influx" } } ); - info.insert( { "RORFY", { A::SUMMARY_REGION, "Fraction of total oil produced by other water influx" } } ); - info.insert( { "RTIPT", { A::SUMMARY_REGION, "Tracer In Place" } } ); - info.insert( { "RTIPF", { A::SUMMARY_REGION, "Tracer In Place" } } ); - info.insert( { "RTIPS", { A::SUMMARY_REGION, "Tracer In Place" } } ); - info.insert( { "RAPI", { A::SUMMARY_REGION, "Oil API" } } ); - info.insert( { "RSIP", { A::SUMMARY_REGION, "Salt In Place" } } ); - info.insert( { "RTIPTHEA", { A::SUMMARY_REGION, "Difference in Energy in place between current and initial time" } } ); - info.insert( { "RTIPT", { A::SUMMARY_REGION, "Tracer In Place" } } ); - info.insert( { "RTIPF", { A::SUMMARY_REGION, "Tracer In Place" } } ); - info.insert( { "RTIPS", { A::SUMMARY_REGION, "Tracer In Place" } } ); - info.insert( { "RTIP#", { A::SUMMARY_REGION, "Tracer In Place in phase # (1,2,3,...)" } } ); - info.insert( { "RTADS", { A::SUMMARY_REGION, "Tracer Adsorption total" } } ); - info.insert( { "RTDCY", { A::SUMMARY_REGION, "Decayed tracer" } } ); - info.insert( { "RCGC", { A::SUMMARY_REGION, "Bulk Coal Gas Concentration" } } ); - info.insert( { "RCSC", { A::SUMMARY_REGION, "Bulk Coal Solvent Concentration" } } ); - info.insert( { "RTIPTFOA", { A::SUMMARY_REGION, "In Solution" } } ); - info.insert( { "RTADSFOA", { A::SUMMARY_REGION, "Adsorption total" } } ); - info.insert( { "RTDCYFOA", { A::SUMMARY_REGION, "Decayed tracer" } } ); - info.insert( { "RTMOBFOA", { A::SUMMARY_REGION, "Gas mobility factor" } } ); - info.insert( { "RCIP", { A::SUMMARY_REGION, "Polymer In Solution" } } ); - info.insert( { "RCAD", { A::SUMMARY_REGION, "Polymer Adsorption total" } } ); - info.insert( { "RSIP", { A::SUMMARY_REGION, "Salt In Place" } } ); - info.insert( { "RNIP", { A::SUMMARY_REGION, "Solvent In Place" } } ); - info.insert( { "RTIPTSUR", { A::SUMMARY_REGION, "In Solution" } } ); - info.insert( { "RTADSUR", { A::SUMMARY_REGION, "Adsorption total" } } ); - info.insert( { "RU", { A::SUMMARY_REGION, "User-defined region quantity" } } ); - - info.insert( { "ROFR", { A::SUMMARY_REGION_2_REGION, "Inter-region oil flow rate" } } ); - info.insert( { "ROFR+", { A::SUMMARY_REGION_2_REGION, "Inter-region oil flow rate" } } ); - info.insert( { "ROFR-", { A::SUMMARY_REGION_2_REGION, "Inter-region oil flow rate" } } ); - info.insert( { "ROFT", { A::SUMMARY_REGION_2_REGION, "Inter-region oil flow total" } } ); - info.insert( { "ROFT+", { A::SUMMARY_REGION_2_REGION, "Inter-region oil flow total" } } ); - info.insert( { "ROFT-", { A::SUMMARY_REGION_2_REGION, "Inter-region oil flow total" } } ); - info.insert( { "ROFTL", { A::SUMMARY_REGION_2_REGION, "Inter-region oil flow total" } } ); - info.insert( { "ROFTG", { A::SUMMARY_REGION_2_REGION, "Inter-region oil flow total" } } ); - info.insert( { "RGFR", { A::SUMMARY_REGION_2_REGION, "Inter-region gas flow rate" } } ); - info.insert( { "RGFR+", { A::SUMMARY_REGION_2_REGION, "Inter-region gas flow rate" } } ); - info.insert( { "RGFR-", { A::SUMMARY_REGION_2_REGION, "Inter-region gas flow rate" } } ); - info.insert( { "RGFT", { A::SUMMARY_REGION_2_REGION, "Inter-region gas flow total)" } } ); - info.insert( { "RGFT+", { A::SUMMARY_REGION_2_REGION, "Inter-region gas flow total" } } ); - info.insert( { "RGFT-", { A::SUMMARY_REGION_2_REGION, "Inter-region gas flow total" } } ); - info.insert( { "RGFTL", { A::SUMMARY_REGION_2_REGION, "Inter-region gas flow total" } } ); - info.insert( { "RGFTG", { A::SUMMARY_REGION_2_REGION, "Inter-region gas flow total" } } ); - info.insert( { "RWFR", { A::SUMMARY_REGION_2_REGION, "Inter-region water flow rate" } } ); - info.insert( { "RWFR+", { A::SUMMARY_REGION_2_REGION, "Inter-region water flow rate" } } ); - info.insert( { "RWFR-", { A::SUMMARY_REGION_2_REGION, "Inter-region water flow rate" } } ); - info.insert( { "RWFT", { A::SUMMARY_REGION_2_REGION, "Inter-region water flow total" } } ); - info.insert( { "RTFTF", { A::SUMMARY_REGION_2_REGION, "Tracer inter-region Flow Total" } } ); - info.insert( { "RTFTS", { A::SUMMARY_REGION_2_REGION, "Tracer inter-region Flow Total" } } ); - info.insert( { "RTFTT", { A::SUMMARY_REGION_2_REGION, "Tracer inter-region Flow Total" } } ); - info.insert( { "RSFT", { A::SUMMARY_REGION_2_REGION, "Salt inter-region Flow Total" } } ); - info.insert( { "RTFTT", { A::SUMMARY_REGION_2_REGION, "Tracer inter-region Flow" } } ); - info.insert( { "RTFTF", { A::SUMMARY_REGION_2_REGION, "Tracer inter-region Flow" } } ); - info.insert( { "RTFTS", { A::SUMMARY_REGION_2_REGION, "Tracer inter-region Flow" } } ); - info.insert( { "RTFT#", { A::SUMMARY_REGION_2_REGION, "Tracer inter-region Flow in phase # (1,2,3,...)" } } ); - info.insert( { "RTFTTFOA", { A::SUMMARY_REGION_2_REGION, "Inter-region Flow Total" } } ); - info.insert( { "RCFT", { A::SUMMARY_REGION_2_REGION, "Polymer inter-region Flow Total" } } ); - info.insert( { "RSFT", { A::SUMMARY_REGION_2_REGION, "Salt inter-region Flow Total" } } ); - info.insert( { "RNFT", { A::SUMMARY_REGION_2_REGION, "Solvent inter-region Flow" } } ); - info.insert( { "RTFTTSUR", { A::SUMMARY_REGION_2_REGION, "Inter-region Flow Total" } } ); - - info.insert( { "BPR", { A::SUMMARY_BLOCK, "Oil phase Pressure" } } ); - info.insert( { "BPRESSUR", { A::SUMMARY_BLOCK, "Oil phase Pressure" } } ); - info.insert( { "BWPR", { A::SUMMARY_BLOCK, "Water phase Pressure" } } ); - info.insert( { "BGPR", { A::SUMMARY_BLOCK, "Gas phase Pressure" } } ); - info.insert( { "BRS", { A::SUMMARY_BLOCK, "Gas-oil ratio" } } ); - info.insert( { "BRV", { A::SUMMARY_BLOCK, "Oil-gas ratio" } } ); - info.insert( { "BPBUB", { A::SUMMARY_BLOCK, "Bubble point pressure" } } ); - info.insert( { "BPDEW", { A::SUMMARY_BLOCK, "Dew point pressure" } } ); - info.insert( { "BRSSAT", { A::SUMMARY_BLOCK, "Saturated gas-oil ratio" } } ); - info.insert( { "BRVSAT", { A::SUMMARY_BLOCK, "Saturated oil-gas ratio" } } ); - info.insert( { "BSTATE", { A::SUMMARY_BLOCK, "Gas-oil state indicator" } } ); - info.insert( { "BPPC", { A::SUMMARY_BLOCK, "Initial Contact Corrected Potential" } } ); - info.insert( { "BOKR", { A::SUMMARY_BLOCK, "Oil relative permeability" } } ); - info.insert( { "BWKR", { A::SUMMARY_BLOCK, "Water relative permeability" } } ); - info.insert( { "BGKR", { A::SUMMARY_BLOCK, "Gas relative permeability" } } ); - info.insert( { "BKRO", { A::SUMMARY_BLOCK, "Oil relative permeability" } } ); - info.insert( { "BKROG", { A::SUMMARY_BLOCK, "Two-phase oil relative permeability to gas" } } ); - info.insert( { "BKROW", { A::SUMMARY_BLOCK, "Two-phase oil relative permeability to water" } } ); - info.insert( { "BKRG", { A::SUMMARY_BLOCK, "Gas relative permeability" } } ); - info.insert( { "BKRGO", { A::SUMMARY_BLOCK, "Two-phase gas relative permeability to oil" } } ); - info.insert( { "BKRGW", { A::SUMMARY_BLOCK, "Two-phase gas relative permeability to water" } } ); - info.insert( { "BKRW", { A::SUMMARY_BLOCK, "Water relative permeability" } } ); - info.insert( { "BKRWG", { A::SUMMARY_BLOCK, "Two-phase water relative permeability to gas" } } ); - info.insert( { "BKRWO", { A::SUMMARY_BLOCK, "Two-phase water relative permeability to oil" } } ); - info.insert( { "BRK", { A::SUMMARY_BLOCK, "Water relative permeability reduction factor due to polymer" } } ); - info.insert( { "BEWKR", { A::SUMMARY_BLOCK, "Water effective relative permeability due to polymer" } } ); - info.insert( { "BWPC", { A::SUMMARY_BLOCK, "Water-Oil capillary pressure" } } ); - info.insert( { "BGPC", { A::SUMMARY_BLOCK, "Gas-Oil capillary pressure" } } ); - info.insert( { "BPCO", { A::SUMMARY_BLOCK, "Oil Capillary Pressures" } } ); - info.insert( { "BPCG", { A::SUMMARY_BLOCK, "Gas Capillary Pressures" } } ); - info.insert( { "BPCW", { A::SUMMARY_BLOCK, "Water Capillary Pressures" } } ); - info.insert( { "BGTRP", { A::SUMMARY_BLOCK, "Trapped gas saturation" } } ); - info.insert( { "BGTPD", { A::SUMMARY_BLOCK, "Dynamic trapped gas saturation" } } ); - info.insert( { "BGSHY", { A::SUMMARY_BLOCK, "Departure saturation from drainage to imbibition for gas capillary pressure hysteresis" } } ); - info.insert( { "BGSTRP", { A::SUMMARY_BLOCK, "Trapped gas critical saturation for gas capillary pressure hysteresis" } } ); - info.insert( { "BWSHY", { A::SUMMARY_BLOCK, "Departure saturation from drainage to imbibition for water capillary pressure hysteresis" } } ); - info.insert( { "BWSMA", { A::SUMMARY_BLOCK, "Maximum wetting saturation for water capillary pressure hysteresis" } } ); - info.insert( { "BMLSC", { A::SUMMARY_BLOCK, "Hydrocarbon molar density" } } ); - info.insert( { "BMLST", { A::SUMMARY_BLOCK, "Total hydrocarbon molar density" } } ); - info.insert( { "BMWAT", { A::SUMMARY_BLOCK, "Water molar density" } } ); - info.insert( { "BROMLS", { A::SUMMARY_BLOCK, "Residual oil moles/ reservoir volume" } } ); - info.insert( { "BJV", { A::SUMMARY_BLOCK, "In" } } ); - info.insert( { "BVMF", { A::SUMMARY_BLOCK, "Vapor mole fraction" } } ); - info.insert( { "BPSAT", { A::SUMMARY_BLOCK, "Saturation Pressures" } } ); - info.insert( { "BAMF", { A::SUMMARY_BLOCK, "Component aqueous mole fraction" } } ); - info.insert( { "BXMF", { A::SUMMARY_BLOCK, "Liquid hydrocarbon component mole fraction" } } ); - info.insert( { "BYMF", { A::SUMMARY_BLOCK, "Vapor hydrocarbon component mole fraction / vapor steam" } } ); - info.insert( { "BSMF", { A::SUMMARY_BLOCK, "CO2STORE with SOLID option only Solid hydrocarbon component mole fraction" } } ); - info.insert( { "BSTEN", { A::SUMMARY_BLOCK, "Surface Tension" } } ); - info.insert( { "BFMISC", { A::SUMMARY_BLOCK, "Miscibility Factor" } } ); - info.insert( { "BREAC", { A::SUMMARY_BLOCK, "Reaction rate. The reaction number is given as a component index" } } ); - info.insert( { "BHD", { A::SUMMARY_BLOCK, "Hydraulic head" } } ); - info.insert( { "BHDF", { A::SUMMARY_BLOCK, "Hydraulic head at fresh water conditions" } } ); - info.insert( { "BPR_X", { A::SUMMARY_BLOCK, "Pressure interpolated at a defined coordinate" } } ); - info.insert( { "BHD_X", { A::SUMMARY_BLOCK, "Hydraulic head interpolated at a defined coordinate" } } ); - info.insert( { "BHDF_X", { A::SUMMARY_BLOCK, "Hydraulic head at fresh water conditions interpolated at a defined coordinate" } } ); - info.insert( { "BSCN_X", { A::SUMMARY_BLOCK, "Brine concentration interpolated at a defined coordinate" } } ); - info.insert( { "BCTRA_X", { A::SUMMARY_BLOCK, "Tracer concentration interpolated at a defined coordinate" } } ); - info.insert( { "LBPR_X", { A::SUMMARY_BLOCK, "Pressure interpolated at a defined coordinate within a local grid" } } ); - info.insert( { "LBHD_X", { A::SUMMARY_BLOCK, "Hydraulic head interpolated at a defined coordinate within a local grid" } } ); - info.insert( { "LBHDF_X", - { A::SUMMARY_BLOCK, "Hydraulic head at freshwater conditions interpolated at a defined coordinate within a local grid" } } ); - info.insert( { "LBSCN_X", { A::SUMMARY_BLOCK, "Brine concentration interpolated at a defined coordinate within a local grid" } } ); - info.insert( { "LBCTRA_X", { A::SUMMARY_BLOCK, "Tracer concentration interpolated at a defined coordinate within a local grid" } } ); - info.insert( { "BOKRX", { A::SUMMARY_BLOCK, "Oil relative permeability in the X direction" } } ); - info.insert( { "BOKRX", { A::SUMMARY_BLOCK, "- Oil relative permeability in the -X direction" } } ); - info.insert( { "BOKRY", { A::SUMMARY_BLOCK, "Oil relative permeability in the Y direction" } } ); - info.insert( { "BOKRY", { A::SUMMARY_BLOCK, "- Oil relative permeability in the -Y direction" } } ); - info.insert( { "BOKRZ", { A::SUMMARY_BLOCK, "Oil relative permeability in the Z direction" } } ); - info.insert( { "BOKRZ", { A::SUMMARY_BLOCK, "- Oil relative permeability in the -Z direction" } } ); - info.insert( { "BWKRX", { A::SUMMARY_BLOCK, "Water relative permeability in the X direction" } } ); - info.insert( { "BWKRX", { A::SUMMARY_BLOCK, "- Water relative permeability in the -X direction" } } ); - info.insert( { "BWKRY", { A::SUMMARY_BLOCK, "Water relative permeability in the Y direction" } } ); - info.insert( { "BWKRY", { A::SUMMARY_BLOCK, "- Water relative permeability in the -Y direction" } } ); - info.insert( { "BWKRZ", { A::SUMMARY_BLOCK, "Water relative permeability in the Z direction" } } ); - info.insert( { "BWKRZ", { A::SUMMARY_BLOCK, "- Water relative permeability in the -Z direction" } } ); - info.insert( { "BGKRX", { A::SUMMARY_BLOCK, "Gas relative permeability in the X direction" } } ); - info.insert( { "BGKRX", { A::SUMMARY_BLOCK, "- Gas relative permeability in the -X direction" } } ); - info.insert( { "BGKRY", { A::SUMMARY_BLOCK, "Gas relative permeability in the Y direction" } } ); - info.insert( { "BGKRY", { A::SUMMARY_BLOCK, "- Gas relative permeability in the -Y direction" } } ); - info.insert( { "BGKRZ", { A::SUMMARY_BLOCK, "Gas relative permeability in the Z direction" } } ); - info.insert( { "BGKRZ", { A::SUMMARY_BLOCK, "- Gas relative permeability in the -Z direction" } } ); - info.insert( { "BOKRI", { A::SUMMARY_BLOCK, "Oil relative permeability in the I direction" } } ); - info.insert( { "BOKRI", { A::SUMMARY_BLOCK, "- Oil relative permeability in the -I direction" } } ); - info.insert( { "BOKRJ", { A::SUMMARY_BLOCK, "Oil relative permeability in the J direction" } } ); - info.insert( { "BOKRJ", { A::SUMMARY_BLOCK, "- Oil relative permeability in the -J direction" } } ); - info.insert( { "BOKRK", { A::SUMMARY_BLOCK, "Oil relative permeability in the K direction" } } ); - info.insert( { "BOKRK", { A::SUMMARY_BLOCK, "- Oil relative permeability in the -K direction" } } ); - info.insert( { "BWKRI", { A::SUMMARY_BLOCK, "Water relative permeability in the I direction" } } ); - info.insert( { "BWKRI", { A::SUMMARY_BLOCK, "- Water relative permeability in the -I direction" } } ); - info.insert( { "BWKRJ", { A::SUMMARY_BLOCK, "Water relative permeability in the J direction" } } ); - info.insert( { "BWKRJ", { A::SUMMARY_BLOCK, "- Water relative permeability in the -J direction" } } ); - info.insert( { "BWKRK", { A::SUMMARY_BLOCK, "Water relative permeability in the K direction" } } ); - info.insert( { "BWKRK", { A::SUMMARY_BLOCK, "- Water relative permeability in the -K direction" } } ); - info.insert( { "BGKRI", { A::SUMMARY_BLOCK, "Gas relative permeability in the I direction" } } ); - info.insert( { "BGKRI", { A::SUMMARY_BLOCK, "- Gas relative permeability in the -I direction" } } ); - info.insert( { "BGKRJ", { A::SUMMARY_BLOCK, "Gas relative permeability in the J direction" } } ); - info.insert( { "BGKRJ", { A::SUMMARY_BLOCK, "- Gas relative permeability in the -J direction" } } ); - info.insert( { "BGKRK", { A::SUMMARY_BLOCK, "Gas relative permeability in the K direction" } } ); - info.insert( { "BGKRK", { A::SUMMARY_BLOCK, "- Gas relative permeability in the -K direction" } } ); - info.insert( { "BOKRR", { A::SUMMARY_BLOCK, "Oil relative permeability in the R" } } ); - info.insert( { "BOKRR", { A::SUMMARY_BLOCK, "- Oil relative permeability in the -R" } } ); - info.insert( { "BOKRT", { A::SUMMARY_BLOCK, "Oil relative permeability in the T" } } ); - info.insert( { "BOKRT", { A::SUMMARY_BLOCK, "- Oil relative permeability in the -T" } } ); - info.insert( { "BWKRR", { A::SUMMARY_BLOCK, "Water relative permeability in the R" } } ); - info.insert( { "BWKRR", { A::SUMMARY_BLOCK, "- Water relative permeability in the -R" } } ); - info.insert( { "BWKRT", { A::SUMMARY_BLOCK, "Water relative permeability in the T" } } ); - info.insert( { "BWKRT", { A::SUMMARY_BLOCK, "- Water relative permeability in the -T" } } ); - info.insert( { "BGKRR", { A::SUMMARY_BLOCK, "Gas relative permeability in the R" } } ); - info.insert( { "BGKRR", { A::SUMMARY_BLOCK, "- Gas relative permeability in the -R" } } ); - info.insert( { "BGKRT", { A::SUMMARY_BLOCK, "Gas relative permeability in the T" } } ); - info.insert( { "BGKRT", { A::SUMMARY_BLOCK, "- Gas relative permeability in the -T" } } ); - info.insert( { "BRPV", { A::SUMMARY_BLOCK, "Pore Volume at Reservoir conditions" } } ); - info.insert( { "BPORV", { A::SUMMARY_BLOCK, "Cell Pore Volumes at Reference conditions" } } ); - info.insert( { "BOPV", { A::SUMMARY_BLOCK, "Pore Volume containing Oil" } } ); - info.insert( { "BWPV", { A::SUMMARY_BLOCK, "Pore Volume containing Water" } } ); - info.insert( { "BGPV", { A::SUMMARY_BLOCK, "Pore Volume containing Gas" } } ); - info.insert( { "BHPV", { A::SUMMARY_BLOCK, "Pore Volume containing Hydrocarbon" } } ); - info.insert( { "BRTM", { A::SUMMARY_BLOCK, "Transmissibility Multiplier associated with rock compaction" } } ); - info.insert( { "BPERMMOD", { A::SUMMARY_BLOCK, "Transmissibility Multiplier associated with rock compaction" } } ); - info.insert( { "BPERMMDX", - { A::SUMMARY_BLOCK, "Directional Transmissibility Multipliers in the X direction, associated with rock compaction" } } ); - info.insert( { "BPERMMDY", - { A::SUMMARY_BLOCK, "Directional Transmissibility Multipliers in the Y direction, associated with rock compaction" } } ); - info.insert( { "BPERMMDZ", - { A::SUMMARY_BLOCK, "Directional Transmissibility Multipliers in the Z direction, associated with rock compaction" } } ); - info.insert( { "BPORVMOD", { A::SUMMARY_BLOCK, "Pore Volume Multiplier associated with rock compaction" } } ); - info.insert( { "BSIGMMOD", { A::SUMMARY_BLOCK, "Dual Porosity Sigma Multiplier associated with rock compaction" } } ); - info.insert( { "BTCNF", { A::SUMMARY_BLOCK, "Tracer Concentration" } } ); - info.insert( { "BTCNS", { A::SUMMARY_BLOCK, "Tracer Concentration" } } ); - info.insert( { "BTCN", { A::SUMMARY_BLOCK, "Tracer Concentration" } } ); - info.insert( { "BTIPT", { A::SUMMARY_BLOCK, "Tracer In Place" } } ); - info.insert( { "BTIPF", { A::SUMMARY_BLOCK, "Tracer In Place" } } ); - info.insert( { "BTIPS", { A::SUMMARY_BLOCK, "Tracer In Place" } } ); - info.insert( { "BAPI", { A::SUMMARY_BLOCK, "Oil API" } } ); - info.insert( { "BSCN", { A::SUMMARY_BLOCK, "Salt Cell Concentration" } } ); - info.insert( { "BSIP", { A::SUMMARY_BLOCK, "Salt In Place" } } ); - info.insert( { "BEWV_SAL", { A::SUMMARY_BLOCK, "Effective water viscosity due to salt concentration" } } ); - info.insert( { "BTCNFANI", { A::SUMMARY_BLOCK, "Anion Flowing Concentration" } } ); - info.insert( { "BTCNFCAT", { A::SUMMARY_BLOCK, "Cation Flowing Concentration" } } ); - info.insert( { "BTRADCAT", { A::SUMMARY_BLOCK, "Cation Rock Associated Concentration" } } ); - info.insert( { "BTSADCAT", { A::SUMMARY_BLOCK, "Cation Surfactant Associated Concentration" } } ); - info.insert( { "BESALSUR", { A::SUMMARY_BLOCK, "Effective Salinity with respect to Surfactant" } } ); - info.insert( { "BESALPLY", { A::SUMMARY_BLOCK, "Effective Salinity with respect to Polymer" } } ); - info.insert( { "BTCNFHEA", { A::SUMMARY_BLOCK, "Block Temperature" } } ); - info.insert( { "BTIPTHEA", { A::SUMMARY_BLOCK, "Difference in Energy in place between current and initial time" } } ); - info.insert( { "BTCNF", { A::SUMMARY_BLOCK, "Tracer Concentration" } } ); - info.insert( { "BTCNS", { A::SUMMARY_BLOCK, "Tracer Concentration" } } ); - info.insert( { "BTCN#", { A::SUMMARY_BLOCK, "Tracer concentration in phase # (1,2,3,...)" } } ); - info.insert( { "BTIPT", { A::SUMMARY_BLOCK, "Tracer In Place" } } ); - info.insert( { "BTIPF", { A::SUMMARY_BLOCK, "Tracer In Place" } } ); - info.insert( { "BTIPS", { A::SUMMARY_BLOCK, "Tracer In Place" } } ); - info.insert( { "BTIP#", { A::SUMMARY_BLOCK, "Tracer In Place in phase # (1,2,3,...)" } } ); - info.insert( { "BTADS", { A::SUMMARY_BLOCK, "Tracer Adsorption" } } ); - info.insert( { "BTDCY", { A::SUMMARY_BLOCK, "Decayed tracer" } } ); - info.insert( { "BCGC", { A::SUMMARY_BLOCK, "Bulk Coal Gas Concentration" } } ); - info.insert( { "BCSC", { A::SUMMARY_BLOCK, "Bulk Coal Solvent Concentration" } } ); - info.insert( { "BTCNFFOA", { A::SUMMARY_BLOCK, "Concentration" } } ); - info.insert( { "BFOAM", { A::SUMMARY_BLOCK, "Surfactant concentration" } } ); - info.insert( { "BTCNMFOA", { A::SUMMARY_BLOCK, "Capillary number" } } ); - info.insert( { "BFOAMCNM", { A::SUMMARY_BLOCK, "Capillary number" } } ); - info.insert( { "BTIPTFOA", { A::SUMMARY_BLOCK, "In Solution" } } ); - info.insert( { "BTADSFOA", { A::SUMMARY_BLOCK, "Adsorption" } } ); - info.insert( { "BTDCYFOA", { A::SUMMARY_BLOCK, "Decayed tracer" } } ); - info.insert( { "BTMOBFOA", { A::SUMMARY_BLOCK, "Gas mobility factor" } } ); - info.insert( { "BFOAMMOB", { A::SUMMARY_BLOCK, "Gas mobility factor" } } ); - info.insert( { "BTHLFFOA", { A::SUMMARY_BLOCK, "Decay Half life" } } ); - info.insert( { "BGI", { A::SUMMARY_BLOCK, "Block Gi value" } } ); - info.insert( { "BCCN", { A::SUMMARY_BLOCK, "Polymer Concentration" } } ); - info.insert( { "BCIP", { A::SUMMARY_BLOCK, "Polymer In Solution" } } ); - info.insert( { "BEPVIS", { A::SUMMARY_BLOCK, "Effective polymer solution viscosity" } } ); - info.insert( { "BVPOLY", { A::SUMMARY_BLOCK, "Effective polymer solution viscosity" } } ); - info.insert( { "BEMVIS", { A::SUMMARY_BLOCK, "Effective mixture" } } ); - info.insert( { "BEWV_POL", { A::SUMMARY_BLOCK, "Effective water viscosity" } } ); - info.insert( { "BCAD", { A::SUMMARY_BLOCK, "Polymer Adsorption concentration" } } ); - info.insert( { "BCDCS", { A::SUMMARY_BLOCK, "Polymer thermal degradation - total mass degraded in previous timestep" } } ); - info.insert( { "BCDCR", { A::SUMMARY_BLOCK, "Polymer thermal degradation - total degradation rate" } } ); - info.insert( { "BCDCP", { A::SUMMARY_BLOCK, "Polymer thermal degradation solution degradation rate" } } ); - info.insert( { "BCDCA", { A::SUMMARY_BLOCK, "Polymer thermal degradation adsorbed degradation rate" } } ); - info.insert( { "BCABnnn", { A::SUMMARY_BLOCK, "Adsorbed polymer by highest temperature band at which RRF was calculated" } } ); - info.insert( { "BSCN", { A::SUMMARY_BLOCK, "Salt Cell Concentration" } } ); - info.insert( { "BSIP", { A::SUMMARY_BLOCK, "Salt In Place" } } ); - info.insert( { "BFLOW0I", - { A::SUMMARY_BLOCK, - "Inter-block water flow rate in the positive I direction multiplied by the " - "corresponding shear multiplier" } } ); - info.insert( { "BFLOW0J", - { A::SUMMARY_BLOCK, - "Inter-block water flow rate in the positive J direction multiplied by the " - "corresponding shear multiplier" } } ); - info.insert( { "BFLOW0K", - { A::SUMMARY_BLOCK, - "Inter-block water flow rate in the positive K direction multiplied by the " - "corresponding shear multiplier" } } ); - info.insert( { "BVELW0I", - { A::SUMMARY_BLOCK, "Water velocity in the positive I direction multiplied by the corresponding shear multiplier" } } ); - info.insert( { "BVELW0J", - { A::SUMMARY_BLOCK, "Water velocity in the positive J direction multiplied by the corresponding shear multiplier" } } ); - info.insert( { "BVELW0K", - { A::SUMMARY_BLOCK, "Water velocity in the positive K direction multiplied by the corresponding shear multiplier" } } ); - info.insert( { "BPSHLZI", { A::SUMMARY_BLOCK, "Viscosity multiplier due to sheared water flow in the positive I direction" } } ); - info.insert( { "BPSHLZJ", { A::SUMMARY_BLOCK, "Viscosity multiplier due to sheared water flow in the positive J direction" } } ); - info.insert( { "BPSHLZK", { A::SUMMARY_BLOCK, "Viscosity multiplier due to sheared water flow in the positive K direction" } } ); - info.insert( { "BSRTW0I", { A::SUMMARY_BLOCK, "Water shear rate in the positive I direction prior to shear effects" } } ); - info.insert( { "BSRTW0J", { A::SUMMARY_BLOCK, "Water shear rate in the positive J direction prior to shear effects" } } ); - info.insert( { "BSRTW0K", { A::SUMMARY_BLOCK, "Water shear rate in the positive K direction prior to shear effects" } } ); - info.insert( { "BSRTWI", { A::SUMMARY_BLOCK, "Water shear rate in the positive I direction following shear effects" } } ); - info.insert( { "BSRTWJ", { A::SUMMARY_BLOCK, "Water shear rate in the positive J direction following shear effects" } } ); - info.insert( { "BSRTWK", { A::SUMMARY_BLOCK, "Water shear rate in the positive K direction following shear effects" } } ); - info.insert( { "BSHWVISI", - { A::SUMMARY_BLOCK, - "Shear viscosity of the water/polymer solution due to shear thinning/thickening in " - "the positive I direction" } } ); - info.insert( { "BSHWVISJ", - { A::SUMMARY_BLOCK, - "Shear viscosity of the water/polymer solution due to shear thinning/thickening in " - "the positive J direction" } } ); - info.insert( { "BSHWVISK", - { A::SUMMARY_BLOCK, - "Shear viscosity of the water/polymer solution due to shear thinning/thickening in " - "the positive K direction" } } ); - info.insert( { "BNSAT", { A::SUMMARY_BLOCK, "Solvent SATuration" } } ); - info.insert( { "BNIP", { A::SUMMARY_BLOCK, "Solvent In Place" } } ); - info.insert( { "BNKR", { A::SUMMARY_BLOCK, "Solvent relative permeability" } } ); - info.insert( { "BTCNFSUR", { A::SUMMARY_BLOCK, "Concentration" } } ); - info.insert( { "BSURF", { A::SUMMARY_BLOCK, "Concentration in solution" } } ); - info.insert( { "BTIPTSUR", { A::SUMMARY_BLOCK, "In Solution" } } ); - info.insert( { "BTADSUR", { A::SUMMARY_BLOCK, "Adsorption" } } ); - info.insert( { "BTCASUR", { A::SUMMARY_BLOCK, "Log" } } ); - info.insert( { "BSURFCNM", { A::SUMMARY_BLOCK, "Log" } } ); - info.insert( { "BTSTSUR", { A::SUMMARY_BLOCK, "Surface tension" } } ); - info.insert( { "BSURFST", { A::SUMMARY_BLOCK, "Surface tension" } } ); - info.insert( { "BEWV_SUR", { A::SUMMARY_BLOCK, "Effective water viscosity due to surfactant concentration" } } ); - info.insert( { "BESVIS", { A::SUMMARY_BLOCK, "Effective water viscosity due to surfactant concentration" } } ); - info.insert( { "BTCNFALK", { A::SUMMARY_BLOCK, "Concentration" } } ); - info.insert( { "BTADSALK", { A::SUMMARY_BLOCK, "Adsorption" } } ); - info.insert( { "BTSTMALK", { A::SUMMARY_BLOCK, "Surface tension multiplier" } } ); - info.insert( { "BTSADALK", { A::SUMMARY_BLOCK, "Surfactant adsorption multiplier" } } ); - info.insert( { "BTPADALK", { A::SUMMARY_BLOCK, "Polymer adsorption multiplier" } } ); - info.insert( { "BKRGOE", { A::SUMMARY_BLOCK, "Equivalent relative permeability to gas for gas-oil system" } } ); - info.insert( { "BKRGWE", { A::SUMMARY_BLOCK, "Equivalent relative permeability to gas for gas-water system" } } ); - info.insert( { "BKRWGE", { A::SUMMARY_BLOCK, "Equivalent relative permeability to water for water-gas system" } } ); - info.insert( { "BKROWT", - { A::SUMMARY_BLOCK, "Opposite saturation direction turning point relative permeability to oil for oil-water system" } } ); - info.insert( { "BKRWOT", - { A::SUMMARY_BLOCK, "Opposite saturation direction turning point relative permeability to water for water-oil system" } } ); - info.insert( - { "BKROGT", { A::SUMMARY_BLOCK, "Opposite saturation direction turning point relative permeability to oil for oil-gas system" } } ); - info.insert( - { "BKRGOT", { A::SUMMARY_BLOCK, "Opposite saturation direction turning point relative permeability to gas for gas-oil system" } } ); - info.insert( { "BKRGWT", - { A::SUMMARY_BLOCK, "Opposite saturation direction turning point relative permeability to gas for gas-water system" } } ); - info.insert( { "BKRWGT", - { A::SUMMARY_BLOCK, "Opposite saturation direction turning point relative permeability to water for water-gas system" } } ); - info.insert( { "BIFTOW", { A::SUMMARY_BLOCK, "Oil-water interfacial tension" } } ); - info.insert( { "BIFTWO", { A::SUMMARY_BLOCK, "Water-oil interfacial tension" } } ); - info.insert( { "BIFTOG", { A::SUMMARY_BLOCK, "Oil-gas interfacial tension" } } ); - info.insert( { "BIFTGO", { A::SUMMARY_BLOCK, "Gas-oil interfacial tension" } } ); - info.insert( { "BIFTGW", { A::SUMMARY_BLOCK, "Gas-water interfacial tension" } } ); - info.insert( { "BIFTWG", { A::SUMMARY_BLOCK, "Water-gas interfacial tension" } } ); - info.insert( { "BPCOWR", { A::SUMMARY_BLOCK, "Representative oil-water capillary pressure" } } ); - info.insert( { "BPCWOR", { A::SUMMARY_BLOCK, "Representative water-oil capillary pressure" } } ); - info.insert( { "BPCOGR", { A::SUMMARY_BLOCK, "Representative oil-gas capillary pressure" } } ); - info.insert( { "BPCGOR", { A::SUMMARY_BLOCK, "Representative gas-oil capillary pressure" } } ); - info.insert( { "BPCGWR", { A::SUMMARY_BLOCK, "Representative gas-water capillary pressure" } } ); - info.insert( { "BPCWGR", { A::SUMMARY_BLOCK, "Representative water-gas capillary pressure" } } ); - - info.insert( { "SOFR", { A::SUMMARY_WELL_SEGMENT, "Segment Oil Flow Rate" } } ); - info.insert( { "SOFRF", { A::SUMMARY_WELL_SEGMENT, "Segment Free Oil Flow Rate" } } ); - info.insert( { "SOFRS", { A::SUMMARY_WELL_SEGMENT, "Segment Solution Oil Flow Rate" } } ); - info.insert( { "SWFR", { A::SUMMARY_WELL_SEGMENT, "Segment Water Flow Rate" } } ); - info.insert( { "SGFR", { A::SUMMARY_WELL_SEGMENT, "Segment Gas Flow Rate" } } ); - info.insert( { "SGFRF", { A::SUMMARY_WELL_SEGMENT, "Segment Free Gas Flow Rate" } } ); - info.insert( { "SGFRS", { A::SUMMARY_WELL_SEGMENT, "Segment Solution Gas Flow Rate" } } ); - info.insert( { "SKFR", { A::SUMMARY_WELL_SEGMENT, "Segment Component Flow Rate" } } ); - info.insert( { "SCWGFR", { A::SUMMARY_WELL_SEGMENT, "Segment Component Flow Rate as Wet Gas" } } ); - info.insert( { "SHFR", { A::SUMMARY_WELL_SEGMENT, "Segment Enthalpy Flow Rate" } } ); - info.insert( { "SWCT", { A::SUMMARY_WELL_SEGMENT, "Segment Water Cut" } } ); - info.insert( { "SGOR", { A::SUMMARY_WELL_SEGMENT, "Segment Gas Oil Ratio" } } ); - info.insert( { "SOGR", { A::SUMMARY_WELL_SEGMENT, "Segment Oil Gas Ratio" } } ); - info.insert( { "SWGR", { A::SUMMARY_WELL_SEGMENT, "Segment Water Gas Ratio" } } ); - info.insert( { "SPR", { A::SUMMARY_WELL_SEGMENT, "Segment Pressure" } } ); - info.insert( { "SPRD", { A::SUMMARY_WELL_SEGMENT, "Segment Pressure Drop" } } ); - info.insert( { "SPRDF", { A::SUMMARY_WELL_SEGMENT, "Segment Pressure Drop component due to Friction" } } ); - info.insert( { "SPRDH", { A::SUMMARY_WELL_SEGMENT, "Segment Pressure Drop component due to Hydrostatic head" } } ); - info.insert( { "SPRDA", { A::SUMMARY_WELL_SEGMENT, "Segment Pressure drop due to Acceleration head" } } ); - info.insert( { "SPRDM", { A::SUMMARY_WELL_SEGMENT, "Segment frictional Pressure Drop Multiplier" } } ); - info.insert( { "SPPOW", { A::SUMMARY_WELL_SEGMENT, "Working power of a pull through pump" } } ); - info.insert( { "SOFV", { A::SUMMARY_WELL_SEGMENT, "Segment Oil Flow Velocity" } } ); - info.insert( { "SWFV", { A::SUMMARY_WELL_SEGMENT, "Segment Water Flow Velocity" } } ); - info.insert( { "SGFV", { A::SUMMARY_WELL_SEGMENT, "Segment Gas Flow Velocity" } } ); - info.insert( { "SOHF", { A::SUMMARY_WELL_SEGMENT, "Segment Oil Holdup Fraction" } } ); - info.insert( { "SWHF", { A::SUMMARY_WELL_SEGMENT, "Segment Water Holdup Fraction" } } ); - info.insert( { "SGHF", { A::SUMMARY_WELL_SEGMENT, "Segment Gas Holdup Fraction" } } ); - info.insert( { "SDENM", { A::SUMMARY_WELL_SEGMENT, "Segment fluid mixture density" } } ); - info.insert( { "SOVIS", { A::SUMMARY_WELL_SEGMENT, "Segment oil viscosity" } } ); - info.insert( { "SWVIS", { A::SUMMARY_WELL_SEGMENT, "Segment water viscosity" } } ); - info.insert( { "SGVIS", { A::SUMMARY_WELL_SEGMENT, "Segment gas viscosity" } } ); - info.insert( { "SEMVIS", { A::SUMMARY_WELL_SEGMENT, "Segment effective mixture viscosity" } } ); - info.insert( { "SGLPP", { A::SUMMARY_WELL_SEGMENT, "Segment Gas-Liquid Profile Parameter, C0" } } ); - info.insert( { "SGLVD", { A::SUMMARY_WELL_SEGMENT, "Segment Gas-Liquid Drift Velocity, Vd" } } ); - info.insert( { "SOWPP", { A::SUMMARY_WELL_SEGMENT, "Segment Oil-Water Profile Parameter, C0" } } ); - info.insert( { "SOWVD", { A::SUMMARY_WELL_SEGMENT, "Segment Oil-Water Drift Velocity, Vd" } } ); - info.insert( { "SOIMR", { A::SUMMARY_WELL_SEGMENT, "Segment Oil Import Rate" } } ); - info.insert( { "SGIMR", { A::SUMMARY_WELL_SEGMENT, "Segment Gas Import Rate" } } ); - info.insert( { "SWIMR", { A::SUMMARY_WELL_SEGMENT, "Segment Water Import Rate" } } ); - info.insert( { "SHIMR", { A::SUMMARY_WELL_SEGMENT, "Segment Enthalpy Import Rate" } } ); - info.insert( { "SORMR", { A::SUMMARY_WELL_SEGMENT, "Segment Oil Removal Rate" } } ); - info.insert( { "SGRMR", { A::SUMMARY_WELL_SEGMENT, "Segment Gas Removal Rate" } } ); - info.insert( { "SWRMR", { A::SUMMARY_WELL_SEGMENT, "Segment Water Removal Rate" } } ); - info.insert( { "SHRMR", { A::SUMMARY_WELL_SEGMENT, "Segment Enthalpy Removal Rate" } } ); - info.insert( { "SOIMT", { A::SUMMARY_WELL_SEGMENT, "Segment Oil Import Total" } } ); - info.insert( { "SGIMT", { A::SUMMARY_WELL_SEGMENT, "Segment Gas Import Total" } } ); - info.insert( { "SWIMT", { A::SUMMARY_WELL_SEGMENT, "Segment Water Import Total" } } ); - info.insert( { "SHIMT", { A::SUMMARY_WELL_SEGMENT, "Segment Enthalpy Import Total" } } ); - info.insert( { "SORMT", { A::SUMMARY_WELL_SEGMENT, "Segment Oil Removal Total" } } ); - info.insert( { "SGRMT", { A::SUMMARY_WELL_SEGMENT, "Segment Gas Removal Total" } } ); - info.insert( { "SWRMT", { A::SUMMARY_WELL_SEGMENT, "Segment Water Removal Total" } } ); - info.insert( { "SHRMT", { A::SUMMARY_WELL_SEGMENT, "Segment Enthalpy Removal Total" } } ); - info.insert( { "SAPI", { A::SUMMARY_WELL_SEGMENT, "Segment API value" } } ); - info.insert( { "SCFR", { A::SUMMARY_WELL_SEGMENT, "Segment polymer flow rate" } } ); - info.insert( { "SCCN", { A::SUMMARY_WELL_SEGMENT, "Segment polymer concentration" } } ); - info.insert( { "SSFR", { A::SUMMARY_WELL_SEGMENT, "Segment brine flow rate" } } ); - info.insert( { "SSCN", { A::SUMMARY_WELL_SEGMENT, "Segment brine concentration" } } ); - info.insert( { "STFR", { A::SUMMARY_WELL_SEGMENT, "Segment tracer flow rate" } } ); - info.insert( { "STFC", { A::SUMMARY_WELL_SEGMENT, "Segment tracer concentration" } } ); - info.insert( { "SFD", { A::SUMMARY_WELL_SEGMENT, "Segment diameter for Karst Conduit Calcite Dissolution" } } ); - info.insert( { "SPSAT", { A::SUMMARY_WELL_SEGMENT, "Segment Psat" } } ); - info.insert( { "STEM", { A::SUMMARY_WELL_SEGMENT, "Segment Temperature" } } ); - info.insert( { "SENE", { A::SUMMARY_WELL_SEGMENT, "Segment Energy Density" } } ); - info.insert( { "SSQU", { A::SUMMARY_WELL_SEGMENT, "Segment Steam Quality" } } ); - info.insert( { "SCVPR", { A::SUMMARY_WELL_SEGMENT, "Segment Calorific Value Production Rate" } } ); - info.insert( { "SGQ", { A::SUMMARY_WELL_SEGMENT, "Segment Gas Quality" } } ); - info.insert( { "SCSA", { A::SUMMARY_WELL_SEGMENT, "Segment Cross Sectional Area" } } ); - info.insert( { "SSTR", { A::SUMMARY_WELL_SEGMENT, "Strength of ICD on segment" } } ); - info.insert( { "SFOPN", { A::SUMMARY_WELL_SEGMENT, "Setting of segment" } } ); - info.insert( { "SALQ", { A::SUMMARY_WELL_SEGMENT, "Artificial lift quantity for segment" } } ); - info.insert( { "SRRQR", { A::SUMMARY_WELL_SEGMENT, "Reach flow at current time" } } ); - info.insert( { "SRRQT", { A::SUMMARY_WELL_SEGMENT, "Reach cumulative flow" } } ); - info.insert( { "SRBQR", { A::SUMMARY_WELL_SEGMENT, "Branch flow at current time" } } ); - info.insert( { "SRBQT", { A::SUMMARY_WELL_SEGMENT, "Branch cumulative flow" } } ); - info.insert( { "SRTQR", { A::SUMMARY_WELL_SEGMENT, "River total flow at current time" } } ); - info.insert( { "SRTQT", { A::SUMMARY_WELL_SEGMENT, "River total cumulative flow" } } ); - info.insert( { "SRRFLOW", { A::SUMMARY_WELL_SEGMENT, "Reach flux through cross-sectional area at current time" } } ); - info.insert( { "SRRAREA", { A::SUMMARY_WELL_SEGMENT, "Reach area at current time" } } ); - info.insert( { "SRRDEPTH", { A::SUMMARY_WELL_SEGMENT, "Reach depth at current time" } } ); - info.insert( { "SRREXCH", { A::SUMMARY_WELL_SEGMENT, "Exchange flux at current time" } } ); - info.insert( { "SRRFRODE", { A::SUMMARY_WELL_SEGMENT, "Reach Froude number at current time" } } ); - info.insert( { "SRRHEAD", { A::SUMMARY_WELL_SEGMENT, "Reach hydraulic head at current time" } } ); - info.insert( { "SRTFR", { A::SUMMARY_WELL_SEGMENT, "Reach tracer flow rate" } } ); - info.insert( { "SRTFC", { A::SUMMARY_WELL_SEGMENT, "Reach tracer concentration" } } ); - info.insert( { "SRSFR", { A::SUMMARY_WELL_SEGMENT, "Reach brine flow rate through connections" } } ); - info.insert( { "SRSFC", { A::SUMMARY_WELL_SEGMENT, "Reach brine concentration" } } ); - info.insert( { "SU", { A::SUMMARY_WELL_SEGMENT, "User-defined segment quantity" } } ); - - info.insert( { "AAQR", { A::SUMMARY_AQUIFER, "Aquifer influx rate" } } ); - info.insert( { "ALQR", { A::SUMMARY_AQUIFER, "Aquifer influx rate" } } ); - info.insert( { "AAQT", { A::SUMMARY_AQUIFER, "Cumulative aquifer influx" } } ); - info.insert( { "ALQT", { A::SUMMARY_AQUIFER, "Cumulative aquifer influx" } } ); - info.insert( { "AAQRG", { A::SUMMARY_AQUIFER, "Aquifer influx rate" } } ); - info.insert( { "ALQRG", { A::SUMMARY_AQUIFER, "Aquifer influx rate" } } ); - info.insert( { "AAQTG", { A::SUMMARY_AQUIFER, "Cumulative aquifer influx" } } ); - info.insert( { "ALQTG", { A::SUMMARY_AQUIFER, "Cumulative aquifer influx" } } ); - info.insert( { "AACMR", { A::SUMMARY_AQUIFER, "Aquifer component molar influx rate" } } ); - info.insert( { "AACMT", { A::SUMMARY_AQUIFER, "Aquifer component molar influx totals" } } ); - info.insert( { "AAQP", { A::SUMMARY_AQUIFER, "Aquifer pressure" } } ); - info.insert( { "AAQER", { A::SUMMARY_AQUIFER, "Aquifer thermal energy influx rate" } } ); - info.insert( { "AAQET", { A::SUMMARY_AQUIFER, "Cumulative aquifer thermal energy influx" } } ); - info.insert( { "AAQTEMP", { A::SUMMARY_AQUIFER, "Aquifer temperature" } } ); - info.insert( { "AAQENTH", { A::SUMMARY_AQUIFER, "Aquifer molar enthalpy" } } ); - info.insert( { "AAQTD", { A::SUMMARY_AQUIFER, "Aquifer dimensionless time" } } ); - info.insert( { "AAQPD", { A::SUMMARY_AQUIFER, "Aquifer dimensionless pressure" } } ); - info.insert( { "ANQR", { A::SUMMARY_AQUIFER, "Aquifer influx rate" } } ); - info.insert( { "ANQT", { A::SUMMARY_AQUIFER, "Cumulative aquifer influx" } } ); - info.insert( { "ANQP", { A::SUMMARY_AQUIFER, "Aquifer pressure" } } ); - - info.insert( { "CPU", { A::SUMMARY_MISC, "CPU" } } ); - info.insert( { "DATE", { A::SUMMARY_MISC, "Date" } } ); - info.insert( { "DAY", { A::SUMMARY_MISC, "Day" } } ); - info.insert( { "ELAPSED", { A::SUMMARY_MISC, "Elapsed time in seconds" } } ); - info.insert( { "MLINEARS", { A::SUMMARY_MISC, "Number linear iterations for each timestep" } } ); - info.insert( { "MONTH", { A::SUMMARY_MISC, "Month" } } ); - info.insert( { "MSUMLINS", { A::SUMMARY_MISC, "Total number of linear iterations since the start of the run" } } ); - info.insert( { "MSUMNEWT", { A::SUMMARY_MISC, "Total number of Newton iterations since the start of the run" } } ); - info.insert( { "NBAKFL", { A::SUMMARY_MISC, "Number of calls to scalar fallback routines" } } ); - info.insert( { "NBYTOT", { A::SUMMARY_MISC, "Peak usage of dynamically allocated memory" } } ); - info.insert( { "NCPRLINS", { A::SUMMARY_MISC, "Average number of pressure iterations" } } ); - info.insert( { "NEWTFL", { A::SUMMARY_MISC, "Cumulative average Newton iterations" } } ); - info.insert( { "NEWTON", { A::SUMMARY_MISC, "Number of Newton iterations used for each timestep" } } ); - info.insert( { "NLINEARP", { A::SUMMARY_MISC, "Average number of pressure iterations" } } ); - info.insert( { "NLINEARS", { A::SUMMARY_MISC, "Average number of linear iterations" } } ); - info.insert( { "NLINSMAX", { A::SUMMARY_MISC, "Actual maximum number of linear iterations" } } ); - info.insert( { "NLINSMIN", { A::SUMMARY_MISC, "Actual minimum number of linear iterations" } } ); - info.insert( { "NLRESMAX", { A::SUMMARY_MISC, "Maximum element of the non-linear residual" } } ); - info.insert( { "NLRESSUM", { A::SUMMARY_MISC, "Sum of the non-linear residual" } } ); - info.insert( { "NMESSAGE", { A::SUMMARY_MISC, "Requests a set of message data vectors for the run" } } ); - info.insert( { "NNUMFL", { A::SUMMARY_MISC, "Total number of two phase flash calculations performed" } } ); - info.insert( { "NNUMST", { A::SUMMARY_MISC, "Total number of stability tests performed" } } ); - info.insert( { "NTS", { A::SUMMARY_MISC, "Number of timesteps taken" } } ); - info.insert( { "NTSECL", { A::SUMMARY_MISC, "Number of energy density solution converged last" } } ); - info.insert( { "NTSMCL", { A::SUMMARY_MISC, "Number of molar density solution converged last" } } ); - info.insert( { "NTSPCL", { A::SUMMARY_MISC, "Number of pressure solution converged last" } } ); - info.insert( { "STEPTYPE", { A::SUMMARY_MISC, "Step type" } } ); - info.insert( { "TCPU", { A::SUMMARY_MISC, "TCPU" } } ); - info.insert( { "TCPUDAY", { A::SUMMARY_MISC, "TCPUDAY" } } ); - info.insert( { "TCPUTS", { A::SUMMARY_MISC, "TCPUTS" } } ); - info.insert( { "TELAPLIN", { A::SUMMARY_MISC, "TELAPLIN" } } ); - info.insert( { "TIME", { A::SUMMARY_MISC, "Time" } } ); - info.insert( { "TIMESTEP", { A::SUMMARY_MISC, "Time step" } } ); - info.insert( { "TIMESTRY", { A::SUMMARY_MISC, "TIMESTRY" } } ); - info.insert( { "YEAR", { A::SUMMARY_MISC, "Year" } } ); - info.insert( { "YEARS", { A::SUMMARY_MISC, "Years" } } ); - - return info; + return caf::AppEnum::text( category ).toStdString(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::unordered_map - RiuSummaryQuantityNameInfoProvider::createInfoFor6xKeywords() +RifEclipseSummaryAddressDefines::SummaryCategory RiuSummaryQuantityNameInfoProvider::enumFromString( const std::string& category ) { - using A = RifEclipseSummaryAddressDefines::SummaryCategory; - - std::unordered_map info; - - int nporo = 6; - for ( int iporo = 0; iporo < nporo; ++iporo ) - { - std::string suffix; - std::string descadd; - if ( iporo == 1 ) - { - suffix = "F"; - descadd = " (Fracture)"; - } - else if ( iporo == 2 ) - { - suffix = "M"; - descadd = " (Matrix)"; - } - else - { - std::stringstream ss; - ss << iporo - 1; - suffix = "M" + ss.str(); - descadd = " (Matrix " + ss.str() + ")"; - } - - info.insert( { "BAPI" + suffix, { A::SUMMARY_BLOCK, "Oil API" + descadd } } ); - info.insert( { "BCCP" + suffix, { A::SUMMARY_BLOCK, "Pore Volume Compressibility" + descadd } } ); - info.insert( { "BDENGAS" + suffix, { A::SUMMARY_BLOCK, "Gas Density" + descadd } } ); - info.insert( { "BDENOIL" + suffix, { A::SUMMARY_BLOCK, "Oil Density" + descadd } } ); - info.insert( { "BDENWAT" + suffix, { A::SUMMARY_BLOCK, "Water Density" + descadd } } ); - info.insert( { "BDP" + suffix, { A::SUMMARY_BLOCK, "Change in Pressure Since Initial State" + descadd } } ); - info.insert( { "BDYNBRST" + suffix, { A::SUMMARY_BLOCK, "Dynamic Breaking Stress" + descadd } } ); - info.insert( { "BDYNKX" + suffix, { A::SUMMARY_BLOCK, "Dynamic Permeability in X-Direction" + descadd } } ); - info.insert( { "BDYNKY" + suffix, { A::SUMMARY_BLOCK, "Dynamic Permeability in Y-Direction" + descadd } } ); - info.insert( { "BDYNKZ" + suffix, { A::SUMMARY_BLOCK, "Dynamic Permeability in Z-Direction" + descadd } } ); - info.insert( { "BDYNPV" + suffix, { A::SUMMARY_BLOCK, "Dynamic Pore Volume" + descadd } } ); - info.insert( { "BDYNSIG" + suffix, { A::SUMMARY_BLOCK, "Dynamic Sigma Permeability" + descadd } } ); - info.insert( { "BKRGAS" + suffix, { A::SUMMARY_BLOCK, "Gas Relative Permeability" + descadd } } ); - info.insert( { "BKROIL" + suffix, { A::SUMMARY_BLOCK, "Oil Relative Permeability" + descadd } } ); - info.insert( { "BKRWAT" + suffix, { A::SUMMARY_BLOCK, "Water Relative Permeability" + descadd } } ); - info.insert( { "BPCOG" + suffix, { A::SUMMARY_BLOCK, "Oil-Gas Capillary Pressure" + descadd } } ); - info.insert( { "BPCOIL" + suffix, { A::SUMMARY_BLOCK, "Oil Capillary Pressure" + descadd } } ); - info.insert( { "BPCOW" + suffix, { A::SUMMARY_BLOCK, "Oil-Water Capillary Pressure" + descadd } } ); - info.insert( { "BPCWAT" + suffix, { A::SUMMARY_BLOCK, "Water Capillary Pressure" + descadd } } ); - info.insert( { "BPMODHYS" + suffix, { A::SUMMARY_BLOCK, "Dynamic Pmod Hysteresis Curve Type (1/2/3=B/S/P)" + descadd } } ); - info.insert( { "BPR" + suffix, { A::SUMMARY_BLOCK, "Pressure" + descadd } } ); - info.insert( { "BRS" + suffix, { A::SUMMARY_BLOCK, "Gas Rs" + descadd } } ); - info.insert( { "BRV" + suffix, { A::SUMMARY_BLOCK, "Gas Rv" + descadd } } ); - info.insert( { "BSGAS" + suffix, { A::SUMMARY_BLOCK, "Gas Saturation" + descadd } } ); - info.insert( { "BSOIL" + suffix, { A::SUMMARY_BLOCK, "Oil Saturation" + descadd } } ); - info.insert( { "BSWAT" + suffix, { A::SUMMARY_BLOCK, "Water Saturation" + descadd } } ); - info.insert( { "BSRVSTAT" + suffix, { A::SUMMARY_BLOCK, "Srv Status (1/2/3=Stim/Sigprop/Propprop)" + descadd } } ); - info.insert( { "BSTRAIN" + suffix, { A::SUMMARY_BLOCK, "Volumetric Strain" + descadd } } ); - info.insert( { "BSTRESS" + suffix, { A::SUMMARY_BLOCK, "Mean Normal Stress" + descadd } } ); - info.insert( { "BSTRESSA" + suffix, { A::SUMMARY_BLOCK, "Mean Normal Stress Idealised Analytic Solution" + descadd } } ); - info.insert( { "BSTRESSN" + suffix, { A::SUMMARY_BLOCK, "Net Stress" + descadd } } ); - info.insert( { "BVISCGAS" + suffix, { A::SUMMARY_BLOCK, "Gas Viscosity" + descadd } } ); - info.insert( { "BVISCOIL" + suffix, { A::SUMMARY_BLOCK, "Oil Viscosity" + descadd } } ); - info.insert( { "BVISCWAT" + suffix, { A::SUMMARY_BLOCK, "Water Viscosity" + descadd } } ); - info.insert( { "BX0" + suffix, { A::SUMMARY_BLOCK, "Liquid Phase Mole Fraction (Component 0)" + descadd } } ); - info.insert( { "BX1" + suffix, { A::SUMMARY_BLOCK, "Liquid Phase Mole Fraction (Component 1)" + descadd } } ); - info.insert( { "BX2" + suffix, { A::SUMMARY_BLOCK, "Liquid Phase Mole Fraction (Component 2)" + descadd } } ); - info.insert( { "BY0" + suffix, { A::SUMMARY_BLOCK, "Vapor Phase Mole Fraction (Component 0)" + descadd } } ); - info.insert( { "BY1" + suffix, { A::SUMMARY_BLOCK, "Vapor Phase Mole Fraction (Component 1)" + descadd } } ); - info.insert( { "BY2" + suffix, { A::SUMMARY_BLOCK, "Vapor Phase Mole Fraction (Component 2)" + descadd } } ); - info.insert( { "BZ0" + suffix, { A::SUMMARY_BLOCK, "Total Mole Fraction (Component 0)" + descadd } } ); - info.insert( { "BZ1" + suffix, { A::SUMMARY_BLOCK, "Total Mole Fraction (Component 1)" + descadd } } ); - info.insert( { "BZ2" + suffix, { A::SUMMARY_BLOCK, "Total Mole Fraction (Component 2)" + descadd } } ); - } - - info.insert( { "FDG", { A::SUMMARY_FIELD, "Gas in Place Difference from Initial Conditions" } } ); - info.insert( { "FDO", { A::SUMMARY_FIELD, "Oil in Place Difference from Initial Conditions" } } ); - info.insert( { "FDW", { A::SUMMARY_FIELD, "Water in Place Difference from Initial Conditions" } } ); - info.insert( { "FLIR", { A::SUMMARY_FIELD, "Liquid Injection Rate" } } ); - info.insert( { "FLIRH", { A::SUMMARY_FIELD, "Liquid Injection Rate History" } } ); - info.insert( { "FLIT", { A::SUMMARY_FIELD, "Liquid Injection Total" } } ); - info.insert( { "FMBG", { A::SUMMARY_FIELD, "Gas Phase Material Balance Error" } } ); - info.insert( { "FMBO", { A::SUMMARY_FIELD, "Oil Phase Material Balance Error" } } ); - info.insert( { "FMBW", { A::SUMMARY_FIELD, "Water Phase Material Balance Error" } } ); - info.insert( { "FMSTR", { A::SUMMARY_FIELD, "Average Mean Stress" } } ); - info.insert( { "FMWIR", { A::SUMMARY_FIELD, "Number of Injecting Wells" } } ); - info.insert( { "FMWSH", { A::SUMMARY_FIELD, "Number of Stopped Wells" } } ); - info.insert( { "FMWST", { A::SUMMARY_FIELD, "Number of Shut Wells" } } ); - info.insert( { "FGIP", { A::SUMMARY_FIELD, "Gas in Place" } } ); - info.insert( { "FOIP", { A::SUMMARY_FIELD, "Oil in Place" } } ); - info.insert( { "FWIP", { A::SUMMARY_FIELD, "Water in Place" } } ); - - info.insert( { "RDG", { A::SUMMARY_REGION, "Gas in Place Difference from Initial Conditions" } } ); - info.insert( { "RDO", { A::SUMMARY_REGION, "Oil in Place Difference from Initial Conditions" } } ); - info.insert( { "RDW", { A::SUMMARY_REGION, "Water in Place Difference from Initial Conditions" } } ); - info.insert( { "RGIP", { A::SUMMARY_REGION, "Gas in Place" } } ); - info.insert( { "RGIR", { A::SUMMARY_REGION, "Gas Injection Rate" } } ); - info.insert( { "RGIT", { A::SUMMARY_REGION, "Gas Injection Total" } } ); - info.insert( { "RGPR", { A::SUMMARY_REGION, "Gas Production Rate" } } ); - info.insert( { "RGPT", { A::SUMMARY_REGION, "Gas Production Total" } } ); - info.insert( { "RLIR", { A::SUMMARY_REGION, "Liquid Injection Rate" } } ); - info.insert( { "RLIT", { A::SUMMARY_REGION, "Liquid Injection Total" } } ); - info.insert( { "RLPR", { A::SUMMARY_REGION, "Liquid Production Rate" } } ); - info.insert( { "RLPT", { A::SUMMARY_REGION, "Liquid Production Total" } } ); - info.insert( { "RMSTR", { A::SUMMARY_REGION, "Averaged Mean Normal Stress" } } ); - info.insert( { "ROIP", { A::SUMMARY_REGION, "Oil in Place" } } ); - info.insert( { "ROIR", { A::SUMMARY_REGION, "Oil Injection Rate" } } ); - info.insert( { "ROIT", { A::SUMMARY_REGION, "Oil Injection Total" } } ); - info.insert( { "ROPR", { A::SUMMARY_REGION, "Oil Production Rate" } } ); - info.insert( { "ROPT", { A::SUMMARY_REGION, "Oil Production Total" } } ); - info.insert( { "RPRP", { A::SUMMARY_REGION, "Averaged Pore-Volume Weighted Pressure" } } ); - info.insert( { "RPR", { A::SUMMARY_REGION, "Averaged Pressure" } } ); - info.insert( { "RWIP", { A::SUMMARY_REGION, "Water in Place" } } ); - info.insert( { "RWIR", { A::SUMMARY_REGION, "Water Injection Rate" } } ); - info.insert( { "RWIT", { A::SUMMARY_REGION, "Water Injection Total" } } ); - info.insert( { "RWPR", { A::SUMMARY_REGION, "Water Production Rate" } } ); - info.insert( { "RWPT", { A::SUMMARY_REGION, "Water Production Total" } } ); - - info.insert( { "WADEN", { A::SUMMARY_WELL, "Average Density" } } ); - info.insert( { "WCNTL", { A::SUMMARY_WELL, "Control Mode" } } ); - info.insert( { "WLIR", { A::SUMMARY_WELL, "Liquid Injection Rate" } } ); - info.insert( { "WLIRH", { A::SUMMARY_WELL, "Liquid Injection Rate History" } } ); - info.insert( { "WLIT", { A::SUMMARY_WELL, "Liquid Injection Total" } } ); - info.insert( { "WLPV", { A::SUMMARY_WELL, "Liquid Production Volume" } } ); - info.insert( { "WSBULKV", { A::SUMMARY_WELL, "Stimulated Bulk Volume Associated with SRV" } } ); - info.insert( { "WSBVPROP", { A::SUMMARY_WELL, "Stimulated Propped Bulk Volume Associated with SRV" } } ); - info.insert( { "WSBVUNPR", { A::SUMMARY_WELL, "Stimulated Unpropped Bulk Volume Associated with SRV" } } ); - info.insert( { "WSMFSA", { A::SUMMARY_WELL, "Stimulated Surface Area Associated with SRV" } } ); - info.insert( { "WSMFSAP", { A::SUMMARY_WELL, "Stimulated Propped Surface Area Associated with SRV" } } ); - info.insert( { "WSMFSAU", { A::SUMMARY_WELL, "Stimulated Unpropped Surface Area Associated with SRV" } } ); - info.insert( { "WSPORVF", { A::SUMMARY_WELL, "Stimulated Pore Volume Associated with SRV (Fracture)" } } ); - info.insert( { "WSPORVM", { A::SUMMARY_WELL, "Stimulated Pore Volume Associated with SRV (Matrix)" } } ); - - info.insert( { "WTIC", { A::SUMMARY_WELL, "Well Tracer Injection Concentration" } } ); - info.insert( { "WTIR", { A::SUMMARY_WELL, "Well Tracer Injection Rate" } } ); - info.insert( { "WTIT", { A::SUMMARY_WELL, "Well Tracer Cumulative Injection" } } ); - info.insert( { "WTPC", { A::SUMMARY_WELL, "Well Tracer Production Concentration" } } ); - info.insert( { "WTPR", { A::SUMMARY_WELL, "Well Tracer Production Rate" } } ); - info.insert( { "WTPT", { A::SUMMARY_WELL, "Well Tracer Cumulative Production" } } ); - - info.insert( { "GLIR", { A::SUMMARY_GROUP, "Liquid Injection Rate" } } ); - info.insert( { "GLIRH", { A::SUMMARY_GROUP, "Liquid Injection Rate History" } } ); - info.insert( { "GLIT", { A::SUMMARY_GROUP, "Liquid Injection Total" } } ); - - info.insert( { "CPDIAM", { A::SUMMARY_WELL_COMPLETION, "Perforation Diameter" } } ); - info.insert( { "MSDEPTH", { A::SUMMARY_WELL_COMPLETION, "Depth of Well Completion" } } ); - info.insert( { "CFGAS", { A::SUMMARY_WELL_COMPLETION, "Gas Flow Rate" } } ); - info.insert( { "INFLOW0", { A::SUMMARY_WELL_COMPLETION, "Inflow Rate (Component 0)" } } ); - info.insert( { "INFLOW1", { A::SUMMARY_WELL_COMPLETION, "Inflow Rate (Component 1)" } } ); - info.insert( { "INFLOW2", { A::SUMMARY_WELL_COMPLETION, "Inflow Rate (Component 2)" } } ); - - info.insert( { "NGIR", { A::SUMMARY_NETWORK, "Gas Injection Rate" } } ); - info.insert( { "NGIRH", { A::SUMMARY_NETWORK, "Gas Injection Rate History" } } ); - info.insert( { "NGIT", { A::SUMMARY_NETWORK, "Gas Injection Total" } } ); - info.insert( { "NGOR", { A::SUMMARY_NETWORK, "Gas Oil Ratio" } } ); - info.insert( { "NGORH", { A::SUMMARY_NETWORK, "Gas Oil Ratio History" } } ); - info.insert( { "NGPR", { A::SUMMARY_NETWORK, "Gas Production Rate" } } ); - info.insert( { "NGPRH", { A::SUMMARY_NETWORK, "Gas Production History" } } ); - info.insert( { "NGPT", { A::SUMMARY_NETWORK, "Gas Production Total" } } ); - info.insert( { "NLIR", { A::SUMMARY_NETWORK, "Liquid Injection Rate" } } ); - info.insert( { "NLIRH", { A::SUMMARY_NETWORK, "Liquid Injection Rate History" } } ); - info.insert( { "NLIT", { A::SUMMARY_NETWORK, "Liquid Injection Total" } } ); - info.insert( { "NLPR", { A::SUMMARY_NETWORK, "Liquid Production Rate" } } ); - info.insert( { "NLPRH", { A::SUMMARY_NETWORK, "Liquid Production Rate History" } } ); - info.insert( { "NLPT", { A::SUMMARY_NETWORK, "Liquid Production Total" } } ); - info.insert( { "NOIR", { A::SUMMARY_NETWORK, "Oil Injection Rate" } } ); - info.insert( { "NOIRH", { A::SUMMARY_NETWORK, "Oil Injection Rate History" } } ); - info.insert( { "NOIT", { A::SUMMARY_NETWORK, "Oil Injection Total" } } ); - info.insert( { "NOPR", { A::SUMMARY_NETWORK, "Oil Production Rate" } } ); - info.insert( { "NOPRH", { A::SUMMARY_NETWORK, "Oil Production Rate History" } } ); - info.insert( { "NOPT", { A::SUMMARY_NETWORK, "Oil Production Total" } } ); - info.insert( { "NWCT", { A::SUMMARY_NETWORK, "Water Cut" } } ); - info.insert( { "NWCTH", { A::SUMMARY_NETWORK, "Water Cut History" } } ); - info.insert( { "NWIR", { A::SUMMARY_NETWORK, "Water Injection Rate" } } ); - info.insert( { "NWIRH", { A::SUMMARY_NETWORK, "Water Injection Rate History" } } ); - info.insert( { "NWIT", { A::SUMMARY_NETWORK, "Water Injection Total" } } ); - info.insert( { "NWPR", { A::SUMMARY_NETWORK, "Water Production Rate" } } ); - info.insert( { "NWPRH", { A::SUMMARY_NETWORK, "Water Production Rate History" } } ); - info.insert( { "NWPT", { A::SUMMARY_NETWORK, "Water Production Total" } } ); - - info.insert( { "NLINEARS", { A::SUMMARY_MISC, "Average Linear Iterations per Newton Iteration" } } ); - info.insert( { "MLINEART", { A::SUMMARY_MISC, "Number of Tracer Linear Iterations at the Current Time-Step" } } ); - info.insert( { "MSUMCHOP", { A::SUMMARY_MISC, "Total Number of Time-Step Chops" } } ); - info.insert( { "MSUMLINT", { A::SUMMARY_MISC, "Total Number of Tracer Linear Iterations" } } ); - info.insert( { "TS", { A::SUMMARY_MISC, "Current Time-Step Number" } } ); - info.insert( { "TNREPT", { A::SUMMARY_MISC, "Total Number of Report Steps" } } ); - info.insert( { "MEMORYTS", { A::SUMMARY_MISC, "Maximum Current Memory Usage Across Processors" } } ); - info.insert( { "TSCHOPS", { A::SUMMARY_MISC, "Number of Time Step Chops at Current Time Step" } } ); - - return info; + return caf::AppEnum::fromText( QString::fromStdString( category ) ); } diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.h b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.h index 843caaba13..902f11535f 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.h +++ b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.h @@ -35,6 +35,8 @@ public: std::string longNameFromVectorName( const std::string& vectorName, bool returnVectorNameIfNotFound = false ) const; + void setQuantityInfos( const std::unordered_map>& infos ); + private: class RiuSummaryQuantityInfo { @@ -59,8 +61,8 @@ private: RiuSummaryQuantityInfo quantityInfo( const std::string& vectorName, bool exactMatch = false ) const; RifEclipseSummaryAddressDefines::SummaryCategory categoryFromVectorName( const std::string& vectorName, bool exactMatch = false ) const; - static std::unordered_map createInfoForEclipseKeywords(); - static std::unordered_map createInfoFor6xKeywords(); + static std::string stringFromEnum( RifEclipseSummaryAddressDefines::SummaryCategory category ); + static RifEclipseSummaryAddressDefines::SummaryCategory enumFromString( const std::string& category ); private: std::unordered_map m_summaryToDescMap; From 8d42b321d35e24b17d2df3a506a96a7ade851b00 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Sun, 13 Oct 2024 14:31:46 +0200 Subject: [PATCH 029/160] Use copy_if_different to avoid build errors --- ApplicationLibCode/UnitTests/CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/UnitTests/CMakeLists.txt b/ApplicationLibCode/UnitTests/CMakeLists.txt index e34298c1ba..eeaf6cd846 100644 --- a/ApplicationLibCode/UnitTests/CMakeLists.txt +++ b/ApplicationLibCode/UnitTests/CMakeLists.txt @@ -210,8 +210,10 @@ if(MSVC) add_custom_command( TARGET ResInsight-tests POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy $ - $ + COMMAND + ${CMAKE_COMMAND} -E copy_if_different + $ + $ COMMAND_EXPAND_LISTS ) From 709ec7378e71793066cbc7ab0801fb3983fef6b5 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 14 Oct 2024 09:08:47 +0200 Subject: [PATCH 030/160] #11768 Show current time step in result plot --- .../RiuFlowCharacteristicsPlot.cpp | 1 - .../RiuFlowCharacteristicsPlot.h | 1 - .../UserInterface/RiuResultQwtPlot.cpp | 37 ++++++++++++++++--- .../UserInterface/RiuResultQwtPlot.h | 4 +- .../RiuSelectionChangedHandler.cpp | 5 +++ 5 files changed, 39 insertions(+), 9 deletions(-) diff --git a/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.cpp b/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.cpp index 4d0dc9efb4..a6a4c88f84 100644 --- a/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.cpp @@ -31,7 +31,6 @@ #include "RiuQwtPlotWheelZoomer.h" #include "RiuQwtPlotZoomer.h" #include "RiuQwtSymbol.h" -#include "RiuResultQwtPlot.h" #include "cvfColor3.h" diff --git a/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.h b/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.h index df1018b9ff..2bb56e5c25 100644 --- a/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.h +++ b/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.h @@ -27,7 +27,6 @@ class RimFlowCharacteristicsPlot; class RiuNightchartsWidget; -class RiuResultQwtPlot; class RiuQwtPlotCurve; class QLabel; diff --git a/ApplicationLibCode/UserInterface/RiuResultQwtPlot.cpp b/ApplicationLibCode/UserInterface/RiuResultQwtPlot.cpp index aafd930867..36f8b78997 100644 --- a/ApplicationLibCode/UserInterface/RiuResultQwtPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuResultQwtPlot.cpp @@ -42,7 +42,9 @@ #include "qwt_plot_curve.h" #include "qwt_plot_grid.h" #include "qwt_plot_layout.h" +#include "qwt_plot_marker.h" #include "qwt_scale_engine.h" +#include "qwt_text.h" #include #include @@ -80,7 +82,7 @@ void RiuResultQwtPlot::addCurve( const RimCase* rimCase, return; } - RiuQwtPlotCurve* plotCurve = new RiuQwtPlotCurve( nullptr, "Curve 1" ); + auto plotCurve = new RiuQwtPlotCurve( nullptr, "Curve 1" ); plotCurve->setSamplesFromDatesAndYValues( dateTimes, timeHistoryValues, false ); plotCurve->setTitle( curveName ); @@ -88,7 +90,7 @@ void RiuResultQwtPlot::addCurve( const RimCase* rimCase, plotCurve->setPen( QPen( QColor( curveColor.rByte(), curveColor.gByte(), curveColor.bByte() ) ) ); plotCurve->attach( this ); - m_plotCurves.push_back( plotCurve ); + m_plotItems.push_back( plotCurve ); setAxisScale( QwtAxis::XTop, QwtDate::toDouble( dateTimes.front() ), QwtDate::toDouble( dateTimes.back() ) ); applyFontSizes( false ); @@ -124,18 +126,41 @@ void RiuResultQwtPlot::addCurve( const RimCase* rimCase, addCurve( rimCase, curveName, curveColor, dateTimes, timeHistoryValues ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuResultQwtPlot::showTimeStep( const QDateTime& dateTime ) +{ + if ( !dateTime.isValid() ) return; + + auto lineMarker = new QwtPlotMarker; + + QPen pen; + pen.setStyle( Qt::DashLine ); + lineMarker->setLinePen( pen ); + + lineMarker->setXValue( QwtDate::toDouble( dateTime ) ); + lineMarker->setLineStyle( QwtPlotMarker::VLine ); + lineMarker->setLabel( QString( "Time Step" ) ); + lineMarker->setLabelAlignment( Qt::AlignTop | Qt::AlignRight ); + lineMarker->setLabelOrientation( Qt::Vertical ); + lineMarker->attach( this ); + + m_plotItems.push_back( lineMarker ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RiuResultQwtPlot::deleteAllCurves() { - for ( size_t i = 0; i < m_plotCurves.size(); i++ ) + for ( size_t i = 0; i < m_plotItems.size(); i++ ) { - m_plotCurves[i]->detach(); - delete m_plotCurves[i]; + m_plotItems[i]->detach(); + delete m_plotItems[i]; } - m_plotCurves.clear(); + m_plotItems.clear(); m_caseNames.clear(); m_curveNames.clear(); diff --git a/ApplicationLibCode/UserInterface/RiuResultQwtPlot.h b/ApplicationLibCode/UserInterface/RiuResultQwtPlot.h index e6f346b9d2..9a9c4e241f 100644 --- a/ApplicationLibCode/UserInterface/RiuResultQwtPlot.h +++ b/ApplicationLibCode/UserInterface/RiuResultQwtPlot.h @@ -58,6 +58,8 @@ public: const std::vector& frameTimes, const std::vector& timeHistoryValues ); + void showTimeStep( const QDateTime& dateTime ); + void deleteAllCurves(); protected: @@ -74,7 +76,7 @@ private slots: void slotCurrentPlotDataInTextDialog(); private: - std::vector m_plotCurves; + std::vector m_plotItems; std::map m_caseNames; std::map> m_timeSteps; diff --git a/ApplicationLibCode/UserInterface/RiuSelectionChangedHandler.cpp b/ApplicationLibCode/UserInterface/RiuSelectionChangedHandler.cpp index baa220bac9..243e91b800 100644 --- a/ApplicationLibCode/UserInterface/RiuSelectionChangedHandler.cpp +++ b/ApplicationLibCode/UserInterface/RiuSelectionChangedHandler.cpp @@ -188,6 +188,11 @@ void RiuSelectionChangedHandler::addResultCurveFromSelectionItem( const RiuEclip eclipseSelectionItem->m_color, timeStepDates, timeHistoryValues ); + + if ( eclipseSelectionItem->m_timestepIdx < timeStepDates.size() ) + { + RiuMainWindow::instance()->resultPlot()->showTimeStep( timeStepDates[eclipseSelectionItem->m_timestepIdx] ); + } } } From 360024c4bc371c8e645837b5429e9c2892483a06 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 11 Oct 2024 14:28:56 +0200 Subject: [PATCH 031/160] Make sure the insertWidget function inserts at the correct index Insert the first widget at index 1 causes crash in Qt6 --- .../SummaryPlotCommands/RicSummaryPlotEditorWidgetCreator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorWidgetCreator.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorWidgetCreator.cpp index 602c66c27b..fc46dd7cf4 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorWidgetCreator.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorWidgetCreator.cpp @@ -114,7 +114,7 @@ void RicSummaryPlotEditorWidgetCreator::recursivelyConfigureAndUpdateTopLevelUiO QMinimizePanel* curveGroup = getOrCreateCurveTreeGroup(); m_lowerLeftLayout->insertWidget( 2, curveGroup, 1 ); m_lowerLeftLayout->addStretch( 0 ); - m_lowerRightLayout->insertWidget( 1, getOrCreatePlotWidget() ); + m_lowerRightLayout->insertWidget( 0, getOrCreatePlotWidget() ); // Fields at bottom of dialog configureAndUpdateFields( 1, m_bottomFieldLayout, topLevelUiItems, uiConfigName ); From eeb5f297c28de6560b80e4b354b50b381495569a Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 14 Oct 2024 09:37:41 +0200 Subject: [PATCH 032/160] Bump to 2024.09.2-dev.03 --- ResInsightVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index 2494de961b..abbd13ab5a 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -11,7 +11,7 @@ set(RESINSIGHT_VERSION_TEXT "-dev") # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -set(RESINSIGHT_DEV_VERSION ".02") +set(RESINSIGHT_DEV_VERSION ".03") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") From 2fe432b43d688f58df262de32593c38c6093ef4a Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Tue, 15 Oct 2024 00:34:51 +0200 Subject: [PATCH 033/160] Make sure launching external processes works after switch to qt6 --- .../RicRunFaultReactModelingFeature.cpp | 2 +- .../RicRunWellIntegrityAnalysisFeature.cpp | 2 +- .../RicImportSeismicFeature.cpp | 2 +- .../ProcessControl/RimProcess.cpp | 64 ++++++++++++------- .../ProcessControl/RimProcess.h | 5 +- 5 files changed, 49 insertions(+), 26 deletions(-) diff --git a/ApplicationLibCode/Commands/GeoMechCommands/RicRunFaultReactModelingFeature.cpp b/ApplicationLibCode/Commands/GeoMechCommands/RicRunFaultReactModelingFeature.cpp index f989e847fd..87b449dee7 100644 --- a/ApplicationLibCode/Commands/GeoMechCommands/RicRunFaultReactModelingFeature.cpp +++ b/ApplicationLibCode/Commands/GeoMechCommands/RicRunFaultReactModelingFeature.cpp @@ -94,7 +94,7 @@ void RicRunFaultReactModelingFeature::onActionTriggered( bool isChecked ) RimProcess process; process.setCommand( command ); - process.setParameters( parameters ); + process.addParameters( parameters ); if ( !process.execute() ) { diff --git a/ApplicationLibCode/Commands/GeoMechCommands/RicRunWellIntegrityAnalysisFeature.cpp b/ApplicationLibCode/Commands/GeoMechCommands/RicRunWellIntegrityAnalysisFeature.cpp index 7f97e2ea08..a8c974c356 100644 --- a/ApplicationLibCode/Commands/GeoMechCommands/RicRunWellIntegrityAnalysisFeature.cpp +++ b/ApplicationLibCode/Commands/GeoMechCommands/RicRunWellIntegrityAnalysisFeature.cpp @@ -107,7 +107,7 @@ void RicRunWellIntegrityAnalysisFeature::onActionTriggered( bool isChecked ) RimProcess process; process.setCommand( command ); - process.setParameters( parameters ); + process.addParameters( parameters ); if ( !process.execute() ) { diff --git a/ApplicationLibCode/Commands/SeismicCommands/RicImportSeismicFeature.cpp b/ApplicationLibCode/Commands/SeismicCommands/RicImportSeismicFeature.cpp index 5a6e56bea0..da7a610467 100644 --- a/ApplicationLibCode/Commands/SeismicCommands/RicImportSeismicFeature.cpp +++ b/ApplicationLibCode/Commands/SeismicCommands/RicImportSeismicFeature.cpp @@ -174,7 +174,7 @@ bool RicImportSeismicFeature::runSEGYConversion( RimSEGYConvertOptions* options } process.setCommand( command ); - process.setParameters( parameters ); + process.addParameters( parameters ); bool showStdOut = false; bool showStdErr = true; diff --git a/ApplicationLibCode/ProjectDataModel/ProcessControl/RimProcess.cpp b/ApplicationLibCode/ProjectDataModel/ProcessControl/RimProcess.cpp index 770b6f3684..ac37b69776 100644 --- a/ApplicationLibCode/ProjectDataModel/ProcessControl/RimProcess.cpp +++ b/ApplicationLibCode/ProjectDataModel/ProcessControl/RimProcess.cpp @@ -27,14 +27,6 @@ #include #include -// Disable deprecation warning for QProcess::start() -#ifdef _MSC_VER -#pragma warning( disable : 4996 ) -#endif -#ifdef __GNUC__ -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif - CAF_PDM_SOURCE_INIT( RimProcess, "RimProcess" ); int RimProcess::m_nextProcessId = 1; @@ -83,9 +75,8 @@ void RimProcess::addParameter( QString paramStr ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimProcess::setParameters( QStringList parameterList ) +void RimProcess::addParameters( QStringList parameterList ) { - m_arguments.clear(); for ( int i = 0; i < parameterList.size(); i++ ) { addParameter( parameterList[i] ); @@ -97,7 +88,16 @@ void RimProcess::setParameters( QStringList parameterList ) //-------------------------------------------------------------------------------------------------- void RimProcess::setCommand( QString cmdStr ) { - m_command = cmdStr; + m_command = cmdStr.trimmed(); + + QString shell = optionalCommandInterpreter(); + if ( shell.isEmpty() ) return; + + QString preParam = optionalPreParameters(); + if ( !preParam.isEmpty() ) m_arguments.append( preParam ); + + m_arguments.append( cmdStr.trimmed() ); + m_command = shell; } //-------------------------------------------------------------------------------------------------- @@ -156,7 +156,8 @@ bool RimProcess::execute( bool enableStdOut, bool enableStdErr ) } proc->setProcessEnvironment( env ); - proc->start( cmd ); + proc->start( m_command, m_arguments ); + auto error = proc->errorString(); if ( proc->waitForStarted( -1 ) ) { while ( !proc->waitForFinished( 500 ) ) @@ -167,7 +168,7 @@ bool RimProcess::execute( bool enableStdOut, bool enableStdErr ) } else { - RiaLogging::error( QString( "Failed to start process %1." ).arg( m_id ) ); + RiaLogging::error( QString( "Failed to start process %1. %2." ).arg( m_id ).arg( error ) ); } proc->deleteLater(); @@ -182,31 +183,50 @@ QString RimProcess::optionalCommandInterpreter() const { if ( m_command.value().isNull() ) return ""; - if ( m_command.value().endsWith( ".cmd", Qt::CaseInsensitive ) || m_command.value().endsWith( ".bat", Qt::CaseInsensitive ) ) + if ( isWindowsBatchFile() ) { - return "cmd.exe /c "; + return "cmd.exe"; } if ( m_command.value().endsWith( ".sh", Qt::CaseInsensitive ) ) { - return "bash "; + return "bash"; } if ( m_command.value().endsWith( ".csh", Qt::CaseInsensitive ) ) { - return "csh "; + return "csh"; } return ""; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimProcess::optionalPreParameters() const +{ + if ( m_command.value().isNull() ) return ""; + + if ( isWindowsBatchFile() ) + { + return "/c"; + } + + return ""; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimProcess::isWindowsBatchFile() const +{ + return ( m_command.value().endsWith( ".cmd", Qt::CaseInsensitive ) || m_command.value().endsWith( ".bat", Qt::CaseInsensitive ) ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- QString RimProcess::commandLine() const { - QString cmdline; - - cmdline += optionalCommandInterpreter(); - - cmdline += handleSpaces( m_command ); + QString cmdline = handleSpaces( m_command ); for ( int i = 0; i < m_arguments.size(); i++ ) { diff --git a/ApplicationLibCode/ProjectDataModel/ProcessControl/RimProcess.h b/ApplicationLibCode/ProjectDataModel/ProcessControl/RimProcess.h index 67ef910e8d..979f8b7050 100644 --- a/ApplicationLibCode/ProjectDataModel/ProcessControl/RimProcess.h +++ b/ApplicationLibCode/ProjectDataModel/ProcessControl/RimProcess.h @@ -40,7 +40,7 @@ public: void setDescription( QString desc ); void setCommand( QString cmdStr ); void addParameter( QString paramStr ); - void setParameters( QStringList parameterList ); + void addParameters( QStringList parameterList ); void addEnvironmentVariable( QString name, QString value ); @@ -57,8 +57,11 @@ protected: private: QString optionalCommandInterpreter() const; + QString optionalPreParameters() const; QString handleSpaces( QString argument ) const; + bool isWindowsBatchFile() const; + caf::PdmField m_command; QStringList m_arguments; caf::PdmField m_description; From 828a41bdfa2b8ae1da5725df457748b038ae69ee Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 15 Oct 2024 16:05:00 +0200 Subject: [PATCH 034/160] Bump to 2024.09.2-dev.04 --- ResInsightVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index abbd13ab5a..f87566a20e 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -11,7 +11,7 @@ set(RESINSIGHT_VERSION_TEXT "-dev") # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -set(RESINSIGHT_DEV_VERSION ".03") +set(RESINSIGHT_DEV_VERSION ".04") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") From 383c7e071de7fd5d726eecc27bd567c1e10e7e26 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 16 Oct 2024 09:27:09 +0200 Subject: [PATCH 035/160] Merge in latest changes from main (#11782) Merge main into dev after release of 2024.9.1 Includes changes to build related to conflicting Python requirements ortools is used in the Komodo environment. This environment is not compatible with libprotoc 27 and newer. Use pinning to limit version of libprotoc<27. Add dependency on typing_extensions --- .github/workflows/ResInsightWithCache.yml | 2 +- GrpcInterface/Python/build-requirements.txt | 8 ++++++++ GrpcInterface/Python/setup.py.cmake | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 GrpcInterface/Python/build-requirements.txt diff --git a/.github/workflows/ResInsightWithCache.yml b/.github/workflows/ResInsightWithCache.yml index 964c0ba1fd..082d96bb20 100644 --- a/.github/workflows/ResInsightWithCache.yml +++ b/.github/workflows/ResInsightWithCache.yml @@ -94,7 +94,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r GrpcInterface/Python/dev-requirements.txt + pip install -r GrpcInterface/Python/build-requirements.txt - name: Use CMake uses: lukka/get-cmake@latest diff --git a/GrpcInterface/Python/build-requirements.txt b/GrpcInterface/Python/build-requirements.txt new file mode 100644 index 0000000000..6f830264f8 --- /dev/null +++ b/GrpcInterface/Python/build-requirements.txt @@ -0,0 +1,8 @@ +grpcio +grpcio-tools<1.64 # to make sure we use libprotoc 26.1, to display version info use 'python -m grpc_tools.protoc --version' +protobuf>=5.26.1,<5.27 # use same requirements as ortools https://github.com/google/or-tools/blob/stable/ortools/python/setup.py.in +wheel +typing-extensions +pytest +setuptools>=70.0.0 # not directly required, pinned by Snyk to avoid a vulnerability +packaging>=22.0 # https://github.com/pypa/setuptools/issues/4483 \ No newline at end of file diff --git a/GrpcInterface/Python/setup.py.cmake b/GrpcInterface/Python/setup.py.cmake index a82135abbb..bd5f49adf5 100644 --- a/GrpcInterface/Python/setup.py.cmake +++ b/GrpcInterface/Python/setup.py.cmake @@ -6,7 +6,7 @@ with open('README.md') as f: with open('LICENSE') as f: license = f.read() -RIPS_DIST_VERSION = '2' +RIPS_DIST_VERSION = '3' setup( name='rips', @@ -19,6 +19,6 @@ setup( license=license, packages=['rips'], package_data={'rips': ['py.typed', '*.py', 'generated/*.py', 'PythonExamples/*.py', 'tests/*.py']}, - install_requires=['grpcio', 'protobuf', 'wheel'], + install_requires=['grpcio', 'protobuf', 'wheel', 'typing_extensions'], python_requires='>=3.8', ) From 23cf3fef3abe9610b65f3cbecd3162c6b968c281 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 15 Oct 2024 08:29:40 +0200 Subject: [PATCH 036/160] Call closeProject before quit to ensure a clean shutdown --- .../Commands/ApplicationCommands/RicExitApplicationFeature.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicExitApplicationFeature.cpp b/ApplicationLibCode/Commands/ApplicationCommands/RicExitApplicationFeature.cpp index 274c6a55e3..340568fecc 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicExitApplicationFeature.cpp +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicExitApplicationFeature.cpp @@ -66,6 +66,7 @@ void RicExitApplicationFeature::onActionTriggered( bool isChecked ) // This was required after moving to Qt6, causing the application not to shut down properly, and ghost processes remains after a forced // shutdown. The slot onLastWindowClosed() configured in RiaGuiApplication::RiaGuiApplication is never called. Testing with // processEvents() had no effect. + app->closeProject(); app->quit(); } From 2619f1a33af691757ebfbee6dd421d3e33b82b4f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 15 Oct 2024 08:35:15 +0200 Subject: [PATCH 037/160] #11771 Highlight all curves for a realization when picking When selecting a single curve in an ensemble, select and highlight all curves connected to this realization. --- .../Summary/RimSummaryEnsembleTools.cpp | 71 ++++++++++++++++++- .../Summary/RimSummaryEnsembleTools.h | 4 ++ .../UserInterface/RiuQwtPlotWidget.cpp | 71 ++++++++++++------- .../UserInterface/RiuQwtPlotWidget.h | 9 +-- 4 files changed, 124 insertions(+), 31 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.cpp index 79aa1734fa..e9c829d0da 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.cpp @@ -23,7 +23,11 @@ #include "RigEnsembleParameter.h" +#include "RimEnsembleCurveSet.h" #include "RimSummaryCase.h" +#include "RimSummaryCurve.h" +#include "RimSummaryMultiPlot.h" +#include "RimSummaryMultiPlotCollection.h" //-------------------------------------------------------------------------------------------------- /// @@ -300,7 +304,7 @@ size_t RimSummaryEnsembleTools::calculateEnsembleParametersIntersectionHash( con size_t commonAddressCount = 0; - // Find common addess count + // Find common address count for ( const auto sumCase : summaryCases ) { const auto reader = sumCase->summaryReader(); @@ -323,3 +327,68 @@ size_t RimSummaryEnsembleTools::calculateEnsembleParametersIntersectionHash( con return commonAddressCount; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryEnsembleTools::highlightCurvesForSameRealization( RimPlotCurve* sourceCurve ) +{ + auto sourceSummaryCurve = dynamic_cast( sourceCurve ); + if ( !sourceSummaryCurve ) return; + + auto ensembleCurveSet = sourceSummaryCurve->firstAncestorOfType(); + if ( !ensembleCurveSet ) return; + + auto summaryPlotColl = RiaSummaryTools::summaryMultiPlotCollection(); + + for ( auto multiPlot : summaryPlotColl->multiPlots() ) + { + for ( auto plot : multiPlot->summaryPlots() ) + { + auto plotWidget = dynamic_cast( plot->plotWidget() ); + if ( !plotWidget ) continue; + + auto summaryCurves = plot->summaryAndEnsembleCurves(); + + std::vector curvesForSameRealization; + + for ( auto curve : summaryCurves ) + { + if ( sourceSummaryCurve->summaryCaseY() == curve->summaryCaseY() ) + { + curvesForSameRealization.push_back( curve ); + } + } + + if ( !curvesForSameRealization.empty() ) + { + bool updateCurveOrder = false; + plotWidget->resetPlotItemHighlighting( updateCurveOrder ); + + std::set realizationCurvesSet( curvesForSameRealization.begin(), curvesForSameRealization.end() ); + plotWidget->highlightCurvesUpdateOrder( realizationCurvesSet ); + plotWidget->replot(); + } + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryEnsembleTools::resetHighlightAllPlots() +{ + auto summaryPlotColl = RiaSummaryTools::summaryMultiPlotCollection(); + + for ( auto multiPlot : summaryPlotColl->multiPlots() ) + { + for ( auto plot : multiPlot->summaryPlots() ) + { + if ( auto plotWidget = dynamic_cast( plot->plotWidget() ) ) + { + plotWidget->resetPlotItemHighlighting(); + plotWidget->replot(); + } + } + } +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.h index 9439ad74a4..37843a6a8f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.h @@ -24,6 +24,7 @@ #include class RimSummaryCase; +class RimPlotCurve; class RigEnsembleParameter; namespace RimSummaryEnsembleTools @@ -37,4 +38,7 @@ std::vector createVariationSortedEnsembleParameters( const size_t calculateEnsembleParametersIntersectionHash( const std::vector& summaryCases ); +void highlightCurvesForSameRealization( RimPlotCurve* sourceCurve ); +void resetHighlightAllPlots(); + } // namespace RimSummaryEnsembleTools diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp index edee3ec0ad..fed3552ddd 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp @@ -28,6 +28,7 @@ #include "RimPlot.h" #include "RimPlotCurve.h" +#include "RimSummaryEnsembleTools.h" #include "RiuDraggableOverlayFrame.h" #include "RiuGuiTheme.h" @@ -934,14 +935,24 @@ void RiuQwtPlotWidget::selectClosestPlotItem( const QPoint& pos, bool toggleItem { bool updateCurveOrder = false; resetPlotItemHighlighting( updateCurveOrder ); - std::set plotItems = { closestItem }; - highlightPlotItems( plotItems ); + if ( auto curve = dynamic_cast( closestItem ) ) + { + RimSummaryEnsembleTools::highlightCurvesForSameRealization( curve->ownerRimCurve() ); + } + else + { + // Currently used from the matrix plot to highlight the selected cell in the matrix plot, see + // RimCorrelationMatrixPlot::createMatrix() + highlightPlotShapeItems( { closestItem } ); + } + auto plotItem = std::make_shared( closestItem ); emit plotItemSelected( plotItem, toggleItemInSelection, distanceFromClick < 10 ? closestCurvePoint : -1 ); } else { - resetPlotItemHighlighting(); + RimSummaryEnsembleTools::resetHighlightAllPlots(); + emit plotSelected( toggleItemInSelection ); } @@ -968,10 +979,9 @@ void RiuQwtPlotWidget::replot() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::highlightPlotItems( const std::set& closestItems ) +void RiuQwtPlotWidget::highlightCurvesUpdateOrder( const std::set& curves ) { - highlightPlotCurves( closestItems ); - highlightPlotShapeItems( closestItems ); + highlightPlotCurves( curves ); updateCurveOrder(); } @@ -979,7 +989,7 @@ void RiuQwtPlotWidget::highlightPlotItems( const std::set& c //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::highlightPlotCurves( const std::set& closestItems ) +void RiuQwtPlotWidget::highlightPlotCurves( const std::set& curves ) { if ( !m_plotDefinition || !m_plotDefinition->isCurveHighlightSupported() ) { @@ -990,10 +1000,12 @@ void RiuQwtPlotWidget::highlightPlotCurves( const std::set& for ( QwtPlotItem* plotItem : plotItemList ) { auto* riuPlotCurve = dynamic_cast( plotItem ); - auto pdmObject = m_plotDefinition->findPdmObjectFromPlotCurve( riuPlotCurve ); + if ( !riuPlotCurve ) continue; + + auto currentRimPlotCurve = riuPlotCurve->ownerRimCurve(); // Do not modify curve objects with no associated Rim object, as the Rim object is used to restore color after highlight manipulation - if ( !pdmObject ) continue; + if ( !currentRimPlotCurve ) continue; auto* plotCurve = dynamic_cast( plotItem ); if ( plotCurve ) @@ -1014,7 +1026,7 @@ void RiuQwtPlotWidget::highlightPlotCurves( const std::set& } double zValue = plotCurve->z(); - if ( closestItems.count( plotCurve ) > 0 ) + if ( curves.count( currentRimPlotCurve ) > 0 ) { auto highlightColor = curveColor; @@ -1101,14 +1113,12 @@ void RiuQwtPlotWidget::resetPlotCurveHighlighting() const auto& plotItemList = m_plot->itemList(); for ( QwtPlotItem* plotItem : plotItemList ) { - if ( auto* plotCurve = dynamic_cast( plotItem ) ) + if ( auto* riuPlotCurve = dynamic_cast( plotItem ) ) { - auto* riuPlotCurve = dynamic_cast( plotItem ); - - if ( auto rimPlotCurve = dynamic_cast( m_plotDefinition->findPdmObjectFromPlotCurve( riuPlotCurve ) ) ) + if ( auto rimPlotCurve = riuPlotCurve->ownerRimCurve() ) { rimPlotCurve->updateCurveAppearance(); - double zValue = m_originalZValues[plotCurve]; + double zValue = m_originalZValues[riuPlotCurve]; riuPlotCurve->setZ( zValue ); continue; } @@ -1172,23 +1182,27 @@ void RiuQwtPlotWidget::resetPlotAxisHighlighting() //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::highlightPlotItemsForQwtAxis( QwtAxisId axisId ) { - std::set plotItems; - auto plotItemList = m_plot->itemList(); + std::set curves; + + auto plotItemList = m_plot->itemList(); for ( QwtPlotItem* plotItem : plotItemList ) { - auto* plotCurve = dynamic_cast( plotItem ); - if ( plotCurve ) + auto* qwtPlotCurve = dynamic_cast( plotItem ); + if ( qwtPlotCurve ) { - QwtAxisId xAxis = plotCurve->xAxis(); - QwtAxisId yAxis = plotCurve->yAxis(); + QwtAxisId xAxis = qwtPlotCurve->xAxis(); + QwtAxisId yAxis = qwtPlotCurve->yAxis(); if ( xAxis == axisId || yAxis == axisId ) { - plotItems.insert( plotItem ); + if ( auto curve = qwtPlotCurve->ownerRimCurve() ) + { + curves.insert( curve ); + } } } } - highlightPlotItems( plotItems ); + highlightCurvesUpdateOrder( curves ); } //-------------------------------------------------------------------------------------------------- @@ -1550,9 +1564,14 @@ void RiuQwtPlotWidget::highlightPlotItem( const QwtPlotItem* plotItem ) bool refreshCurveOrder = false; resetPlotItemHighlighting( refreshCurveOrder ); - std::set items; - items.insert( plotItem ); - highlightPlotItems( items ); + if ( auto curve = dynamic_cast( const_cast( plotItem ) ) ) + { + highlightCurvesUpdateOrder( { curve->ownerRimCurve() } ); + } + else + { + highlightPlotShapeItems( { plotItem } ); + } replot(); } diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h index 5f34909a0c..728445cbdc 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h @@ -165,6 +165,10 @@ public: QwtAxisId toQwtPlotAxis( RiuPlotAxis axis ) const; void highlightPlotItem( const QwtPlotItem* plotItem ); + void highlightCurvesUpdateOrder( const std::set& curves ); + void resetPlotItemHighlighting( bool doUpdateCurveOrder = true ); + + void replot() override; public slots: void onLegendClicked( const QVariant& itemInfo, int index ); @@ -202,14 +206,11 @@ protected: private: void selectClosestPlotItem( const QPoint& pos, bool toggleItemInSelection = false ); static int defaultMinimumWidth(); - void replot() override; void highlightPlotAxes( QwtAxisId axisIdX, QwtAxisId axisIdY ); void highlightPlotItemsForQwtAxis( QwtAxisId axisId ); - void highlightPlotItems( const std::set& closestItems ); - void highlightPlotCurves( const std::set& closestItems ); + void highlightPlotCurves( const std::set& curves ); void highlightPlotShapeItems( const std::set& closestItems ); - void resetPlotItemHighlighting( bool doUpdateCurveOrder = true ); void resetPlotCurveHighlighting(); void resetPlotShapeItemHighlighting(); void resetPlotAxisHighlighting(); From 42d700ff7d96a73aed414d96e79781889106898b Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 15 Oct 2024 08:36:04 +0200 Subject: [PATCH 038/160] Remove unused code --- .../Flow/RimWellDistributionPlot.cpp | 9 ---- .../Flow/RimWellDistributionPlot.h | 23 +++++----- .../GridCrossPlots/RimGridCrossPlot.cpp | 18 -------- .../GridCrossPlots/RimGridCrossPlot.h | 7 ++- .../ProjectDataModel/RimPlot.cpp | 8 ---- ApplicationLibCode/ProjectDataModel/RimPlot.h | 3 +- .../Summary/RimSummaryPlot.cpp | 45 ------------------- .../ProjectDataModel/Summary/RimSummaryPlot.h | 2 - .../WellLog/RimWellLogTrack.cpp | 16 ------- .../WellLog/RimWellLogTrack.h | 2 - 10 files changed, 15 insertions(+), 118 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp index 7a63e0c8c3..005e2f657f 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp @@ -203,15 +203,6 @@ void RimWellDistributionPlot::detachAllCurves() // cvf::Trace::show("RimWellDistributionPlot::detachAllCurves()"); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -caf::PdmObject* RimWellDistributionPlot::findPdmObjectFromPlotCurve( const RiuPlotCurve* /*curve*/ ) const -{ - // cvf::Trace::show("RimWellDistributionPlot::findPdmObjectFromQwtCurve()"); - return nullptr; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.h b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.h index 463ff8bd8a..6bcc6b6613 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.h @@ -49,18 +49,17 @@ public: RiaDefines::PhaseType phase() const; // RimPlot implementations - RiuPlotWidget* plotWidget() override; - void setAutoScaleXEnabled( bool enabled ) override; - void setAutoScaleYEnabled( bool enabled ) override; - void updateAxes() override; - void updateLegend() override; - void updatePlotWidgetFromAxisRanges() override; - void updateAxisRangesFromPlotWidget() override; - QString asciiDataForPlotExport() const override; - void reattachAllCurves() override; - void detachAllCurves() override; - caf::PdmObject* findPdmObjectFromPlotCurve( const RiuPlotCurve* curve ) const override; - void onAxisSelected( RiuPlotAxis axis, bool toggle ) override; + RiuPlotWidget* plotWidget() override; + void setAutoScaleXEnabled( bool enabled ) override; + void setAutoScaleYEnabled( bool enabled ) override; + void updateAxes() override; + void updateLegend() override; + void updatePlotWidgetFromAxisRanges() override; + void updateAxisRangesFromPlotWidget() override; + QString asciiDataForPlotExport() const override; + void reattachAllCurves() override; + void detachAllCurves() override; + void onAxisSelected( RiuPlotAxis axis, bool toggle ) override; // RimPlotWindow implementations QString description() const override; diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp index 96a5d3c709..81e3dd0d71 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp @@ -340,24 +340,6 @@ void RimGridCrossPlot::setAutoScaleYEnabled( bool enabled ) m_yAxisProperties->setAutoZoom( enabled ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -caf::PdmObject* RimGridCrossPlot::findPdmObjectFromPlotCurve( const RiuPlotCurve* plotCurve ) const -{ - for ( auto dataSet : m_crossPlotDataSets ) - { - for ( auto curve : dataSet->curves() ) - { - if ( curve->isSameCurve( plotCurve ) ) - { - return curve; - } - } - } - return nullptr; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.h b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.h index 78415a6417..131c3cb368 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.h +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.h @@ -102,10 +102,9 @@ public: void updatePlotWidgetFromAxisRanges() override; void updateAxisRangesFromPlotWidget() override; - void setAutoScaleXEnabled( bool enabled ) override; - void setAutoScaleYEnabled( bool enabled ) override; - caf::PdmObject* findPdmObjectFromPlotCurve( const RiuPlotCurve* curve ) const override; - void onAxisSelected( RiuPlotAxis axis, bool toggle ) override; + void setAutoScaleXEnabled( bool enabled ) override; + void setAutoScaleYEnabled( bool enabled ) override; + void onAxisSelected( RiuPlotAxis axis, bool toggle ) override; bool isDeletable() const override; bool isCurveHighlightSupported() const override; diff --git a/ApplicationLibCode/ProjectDataModel/RimPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimPlot.cpp index c352604e8b..b65ab2ea2e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlot.cpp @@ -263,14 +263,6 @@ void RimPlot::updateAxisRangesFromPlotWidget() { } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -caf::PdmObject* RimPlot::findPdmObjectFromPlotCurve( const RiuPlotCurve* curve ) const -{ - return nullptr; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlot.h b/ApplicationLibCode/ProjectDataModel/RimPlot.h index 19ce220fa9..250d06ec6b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlot.h @@ -99,8 +99,7 @@ public: virtual void updatePlotWidgetFromAxisRanges(); virtual void updateAxisRangesFromPlotWidget(); - virtual caf::PdmObject* findPdmObjectFromPlotCurve( const RiuPlotCurve* curve ) const; - virtual void handleDroppedObjects( const std::vector& objects ); + virtual void handleDroppedObjects( const std::vector& objects ); virtual std::vector visibleCurvesForLegend(); virtual bool isCurveHighlightSupported() const; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index f84b9f1791..5b8d8d3cfa 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -368,51 +368,6 @@ QString RimSummaryPlot::asciiDataForSummaryPlotExport( RiaDefines::DateTimePerio return text; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -caf::PdmObject* RimSummaryPlot::findPdmObjectFromPlotCurve( const RiuPlotCurve* plotCurve ) const -{ - for ( RimGridTimeHistoryCurve* curve : m_gridTimeHistoryCurves ) - { - if ( curve->isSameCurve( plotCurve ) ) - { - return curve; - } - } - - for ( RimAsciiDataCurve* curve : m_asciiDataCurves ) - { - if ( curve->isSameCurve( plotCurve ) ) - { - return curve; - } - } - - if ( m_summaryCurveCollection ) - { - RimSummaryCurve* foundCurve = m_summaryCurveCollection->findRimCurveFromPlotCurve( plotCurve ); - - if ( foundCurve ) - { - m_summaryCurveCollection->setCurrentSummaryCurve( foundCurve ); - - return foundCurve; - } - } - - if ( m_ensembleCurveSetCollection ) - { - RimSummaryCurve* foundCurve = m_ensembleCurveSetCollection->findRimCurveFromPlotCurve( plotCurve ); - - if ( foundCurve ) - { - return foundCurve; - } - } - return nullptr; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index c5b9b845ba..2c8962f73e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -185,8 +185,6 @@ public: void updatePlotWidgetFromAxisRanges() override; void updateAxisRangesFromPlotWidget() override; - caf::PdmObject* findPdmObjectFromPlotCurve( const RiuPlotCurve* curve ) const override; - void onAxisSelected( RiuPlotAxis axis, bool toggle ) override; static constexpr int precision() diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp index 2dc922f73d..f9eb46b2f6 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp @@ -1994,22 +1994,6 @@ void RimWellLogTrack::zoomAll() if ( plot ) plot->zoomAll(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -caf::PdmObject* RimWellLogTrack::findPdmObjectFromPlotCurve( const RiuPlotCurve* curve ) const -{ - for ( size_t idx = 0; idx < m_curves.size(); idx++ ) - { - if ( m_curves[idx]->isSameCurve( curve ) ) - { - return m_curves[idx]; - } - } - - return nullptr; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h index 4ab1a6009e..b8ec4c4ae4 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h @@ -188,8 +188,6 @@ public: RimWellPath* wellPathAttributeSource() const; - caf::PdmObject* findPdmObjectFromPlotCurve( const RiuPlotCurve* curve ) const override; - void setLogarithmicScale( bool enable ); bool isLogarithmicScale() const; From 4fd9edc7a5d62c5603fb2190ef24ebd5e4f407bb Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 15 Oct 2024 08:53:07 +0200 Subject: [PATCH 039/160] Select realization in Data Sources when clicking on curve --- .../Summary/RimSummaryEnsembleTools.cpp | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.cpp index e9c829d0da..95e71469b7 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.cpp @@ -18,6 +18,8 @@ #include "RimSummaryEnsembleTools.h" +#include "RiaSummaryTools.h" + #include "RifReaderRftInterface.h" #include "RifSummaryReaderInterface.h" @@ -28,6 +30,11 @@ #include "RimSummaryCurve.h" #include "RimSummaryMultiPlot.h" #include "RimSummaryMultiPlotCollection.h" +#include "RimSummaryPlot.h" + +#include "RiuPlotMainWindow.h" + +#include "cafPdmUiTreeView.h" //-------------------------------------------------------------------------------------------------- /// @@ -339,6 +346,18 @@ void RimSummaryEnsembleTools::highlightCurvesForSameRealization( RimPlotCurve* s auto ensembleCurveSet = sourceSummaryCurve->firstAncestorOfType(); if ( !ensembleCurveSet ) return; + auto sourceCase = sourceSummaryCurve->summaryCaseY(); + if ( !sourceCase ) return; + + // Select the realization object in Data Sources Tree view + if ( auto mainWindow = RiuPlotMainWindow::instance() ) + { + if ( auto treeView = mainWindow->getTreeViewWithItem( sourceCase ) ) + { + treeView->selectAsCurrentItem( sourceCase ); + } + } + auto summaryPlotColl = RiaSummaryTools::summaryMultiPlotCollection(); for ( auto multiPlot : summaryPlotColl->multiPlots() ) @@ -354,7 +373,7 @@ void RimSummaryEnsembleTools::highlightCurvesForSameRealization( RimPlotCurve* s for ( auto curve : summaryCurves ) { - if ( sourceSummaryCurve->summaryCaseY() == curve->summaryCaseY() ) + if ( sourceCase == curve->summaryCaseY() ) { curvesForSameRealization.push_back( curve ); } From da321830a75b8a8c265371d5fae78b7d9aa7ebd2 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 16 Oct 2024 11:00:50 +0200 Subject: [PATCH 040/160] Janitor: Fix some minor GUI issues Use appendMenu instead of context command builder Remove case name from import grid feature Fix shortcut for feature --- ...reatePlotFromTemplateByShortcutFeature.cpp | 2 +- ...cImportGridModelFromSummaryCaseFeature.cpp | 5 --- .../RimContextCommandBuilder.cpp | 24 ------------ .../Summary/RimObservedSummaryData.cpp | 9 +++++ .../Summary/RimObservedSummaryData.h | 2 + .../Summary/RimSummaryCase.cpp | 37 +++++++++++++++++++ .../ProjectDataModel/Summary/RimSummaryCase.h | 2 + 7 files changed, 51 insertions(+), 30 deletions(-) diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreatePlotFromTemplateByShortcutFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreatePlotFromTemplateByShortcutFeature.cpp index 48592c1ec9..f1b89657b1 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreatePlotFromTemplateByShortcutFeature.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreatePlotFromTemplateByShortcutFeature.cpp @@ -71,7 +71,7 @@ void RicCreatePlotFromTemplateByShortcutFeature::setupActionLook( QAction* actio actionToSetup->setText( "Create Plot from Last Used Template" ); actionToSetup->setIcon( QIcon( ":/plot-template-standard.svg" ) ); - QKeySequence keySeq( Qt::CTRL, Qt::Key_T ); + QKeySequence keySeq( Qt::CTRL | Qt::Key_T ); applyShortcutWithHintToAction( actionToSetup, keySeq ); } diff --git a/ApplicationLibCode/Commands/RicImportGridModelFromSummaryCaseFeature.cpp b/ApplicationLibCode/Commands/RicImportGridModelFromSummaryCaseFeature.cpp index 3cb9abbd5c..61050ccadc 100644 --- a/ApplicationLibCode/Commands/RicImportGridModelFromSummaryCaseFeature.cpp +++ b/ApplicationLibCode/Commands/RicImportGridModelFromSummaryCaseFeature.cpp @@ -63,10 +63,5 @@ void RicImportGridModelFromSummaryCaseFeature::setupActionLook( QAction* actionT txt = "Import Grid Model"; } - if ( !summaryCaseName.isEmpty() ) - { - txt += QString( " for '%1'" ).arg( summaryCaseName ); - } - actionToSetup->setText( txt ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index 927648c78b..29a049de41 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -790,30 +790,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicConvertGroupToEnsembleFeature"; menuBuilder.addSeparator(); } - else if ( dynamic_cast( firstUiItem ) ) - { - menuBuilder << "RicShowDataSourcesForRealization"; - menuBuilder.addSeparator(); - - menuBuilder.subMenuStart( "Import" ); - menuBuilder << "RicImportSummaryCaseFeature"; - menuBuilder << "RicImportSummaryCasesFeature"; - menuBuilder << "RicImportSummaryGroupFeature"; - menuBuilder << "RicImportEnsembleFeature"; - menuBuilder.subMenuEnd(); - menuBuilder.addSeparator(); - menuBuilder << "RicNewSummaryMultiPlotFeature"; - menuBuilder << "RicOpenSummaryPlotEditorFeature"; - menuBuilder << "RicAppendSummaryCurvesForSummaryCasesFeature"; - menuBuilder << "RicAppendSummaryPlotsForSummaryCasesFeature"; - menuBuilder.addSeparator(); - menuBuilder << "RicImportGridModelFromSummaryCaseFeature"; - - if ( !dynamic_cast( firstUiItem ) ) - { - menuBuilder << "RicShowSummaryCurveCalculatorFeature"; - } - } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicAddWellLogToPlotFeature"; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.cpp index f744982437..0ba56df7ec 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.cpp @@ -110,6 +110,15 @@ QString RimObservedSummaryData::customWellName() const return ""; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimObservedSummaryData::appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const +{ + // Do not show curve calculator for observed data + RimSummaryCase::appendMenuItems( menuBuilder, false ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.h b/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.h index fc6b28603f..0f236c1814 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.h @@ -46,6 +46,8 @@ public: protected: QString customWellName() const; + void appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const override; + private: QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp index a933d94079..053da9e37d 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp @@ -27,6 +27,7 @@ #include "RimSummaryAddressCollection.h" #include "RimSummaryEnsemble.h" +#include "cafCmdFeatureMenuBuilder.h" #include "cafPdmFieldScriptingCapability.h" #include "cafPdmUiCheckBoxEditor.h" #include "cafPdmUiTreeOrdering.h" @@ -224,6 +225,42 @@ void RimSummaryCase::buildChildNodes() m_dataVectorFolders->updateFolderStructure( addresses, m_caseId ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCase::appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const +{ + appendMenuItems( menuBuilder, true ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCase::appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder, bool showCurveCalculator ) const +{ + menuBuilder << "RicShowDataSourcesForRealization"; + menuBuilder.addSeparator(); + + menuBuilder.subMenuStart( "Import" ); + menuBuilder << "RicImportSummaryCaseFeature"; + menuBuilder << "RicImportSummaryCasesFeature"; + menuBuilder << "RicImportSummaryGroupFeature"; + menuBuilder << "RicImportEnsembleFeature"; + menuBuilder.subMenuEnd(); + menuBuilder.addSeparator(); + menuBuilder << "RicNewSummaryMultiPlotFeature"; + menuBuilder << "RicOpenSummaryPlotEditorFeature"; + menuBuilder << "RicAppendSummaryCurvesForSummaryCasesFeature"; + menuBuilder << "RicAppendSummaryPlotsForSummaryCasesFeature"; + menuBuilder.addSeparator(); + menuBuilder << "RicImportGridModelFromSummaryCaseFeature"; + + if ( showCurveCalculator ) + { + menuBuilder << "RicShowSummaryCurveCalculatorFeature"; + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h index a01a47b24c..a3e5a1f5de 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h @@ -100,6 +100,8 @@ protected: virtual QString caseName() const = 0; void initAfterRead() override; + void appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const override; + void appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder, bool showCurveCalculator ) const; private: void buildChildNodes(); From a8d56417f6f9482c501f951046abf9319d7b0e79 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 16 Oct 2024 14:59:24 +0200 Subject: [PATCH 041/160] Refactor: Extract RigContourMapGrid object. --- .../RimGeoMechContourMapProjection.cpp | 37 +-- .../RimContourMapProjection.cpp | 209 +++---------- .../RimContourMapProjection.h | 21 +- .../RimEclipseContourMapProjection.cpp | 18 +- .../RimEclipseContourMapProjection.h | 1 + .../ReservoirDataModel/CMakeLists_files.cmake | 2 + .../ReservoirDataModel/RigContourMapGrid.cpp | 295 ++++++++++++++++++ .../ReservoirDataModel/RigContourMapGrid.h | 75 +++++ 8 files changed, 439 insertions(+), 219 deletions(-) create mode 100644 ApplicationLibCode/ReservoirDataModel/RigContourMapGrid.cpp create mode 100644 ApplicationLibCode/ReservoirDataModel/RigContourMapGrid.h diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp index 5e8d3946b8..a338b84b15 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp @@ -23,6 +23,7 @@ #include "RiaWeightedMeanCalculator.h" #include "RigCellGeometryTools.h" +#include "RigContourMapGrid.h" #include "RigFemAddressDefines.h" #include "RigFemPart.h" #include "RigFemPartCollection.h" @@ -236,14 +237,15 @@ void RimGeoMechContourMapProjection::updateGridInformation() m_kLayers = m_femPartGrid->cellCountK(); m_femPart->ensureIntersectionSearchTreeIsBuilt(); - m_gridBoundingBox = geoMechCase->activeCellsBoundingBox(); + cvf::BoundingBox gridBoundingBox = geoMechCase->activeCellsBoundingBox(); + cvf::BoundingBox expandedBoundingBox; if ( m_limitToPorePressureRegions ) { auto [stepIdx, frameIdx] = view()->currentStepAndDataFrame(); - m_expandedBoundingBox = calculateExpandedPorBarBBox( stepIdx, frameIdx ); - if ( !m_expandedBoundingBox.isValid() ) + expandedBoundingBox = calculateExpandedPorBarBBox( stepIdx, frameIdx ); + if ( !expandedBoundingBox.isValid() ) { m_limitToPorePressureRegions = false; } @@ -251,26 +253,19 @@ void RimGeoMechContourMapProjection::updateGridInformation() if ( !m_limitToPorePressureRegions ) { - m_expandedBoundingBox = m_gridBoundingBox; + expandedBoundingBox = gridBoundingBox; } - cvf::Vec3d minExpandedPoint = m_expandedBoundingBox.min() - cvf::Vec3d( gridEdgeOffset(), gridEdgeOffset(), 0.0 ); - cvf::Vec3d maxExpandedPoint = m_expandedBoundingBox.max() + cvf::Vec3d( gridEdgeOffset(), gridEdgeOffset(), 0.0 ); + cvf::Vec3d minExpandedPoint = expandedBoundingBox.min() - cvf::Vec3d( gridEdgeOffset(), gridEdgeOffset(), 0.0 ); + cvf::Vec3d maxExpandedPoint = expandedBoundingBox.max() + cvf::Vec3d( gridEdgeOffset(), gridEdgeOffset(), 0.0 ); if ( m_limitToPorePressureRegions && !m_applyPPRegionLimitVertically ) { - minExpandedPoint.z() = m_gridBoundingBox.min().z(); - maxExpandedPoint.z() = m_gridBoundingBox.max().z(); + minExpandedPoint.z() = gridBoundingBox.min().z(); + maxExpandedPoint.z() = gridBoundingBox.max().z(); } - m_expandedBoundingBox = cvf::BoundingBox( minExpandedPoint, maxExpandedPoint ); + expandedBoundingBox = cvf::BoundingBox( minExpandedPoint, maxExpandedPoint ); - m_mapSize = calculateMapSize(); - - // 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() * sampleSpacing(); - maxPoint.y() = minPoint.y() + m_mapSize.y() * sampleSpacing(); - m_expandedBoundingBox = cvf::BoundingBox( minPoint, maxPoint ); + m_contourMapGrid = std::make_unique( gridBoundingBox, expandedBoundingBox, sampleSpacing() ); } //-------------------------------------------------------------------------------------------------- @@ -298,11 +293,11 @@ std::vector RimGeoMechContourMapProjection::getMapCellVisibility() cvf::BoundingBox validResBoundingBox; for ( size_t cellIndex = 0; cellIndex < cellResults.size(); ++cellIndex ) { - cvf::Vec2ui ij = ijFromCellIndex( cellIndex ); + cvf::Vec2ui ij = m_contourMapGrid->ijFromCellIndex( cellIndex ); if ( cellResults[cellIndex] != std::numeric_limits::infinity() ) { distanceImage[ij.x()][ij.y()] = 1u; - validResBoundingBox.add( cvf::Vec3d( cellCenterPosition( ij.x(), ij.y() ), 0.0 ) ); + validResBoundingBox.add( cvf::Vec3d( m_contourMapGrid->cellCenterPosition( ij.x(), ij.y() ), 0.0 ) ); } else { @@ -322,7 +317,7 @@ std::vector RimGeoMechContourMapProjection::getMapCellVisibility() { if ( !mapCellVisibility[cellIndex] ) { - cvf::Vec2ui ij = ijFromCellIndex( cellIndex ); + cvf::Vec2ui ij = m_contourMapGrid->ijFromCellIndex( cellIndex ); if ( distanceImage[ij.x()][ij.y()] < cellPadding * cellPadding ) { mapCellVisibility[cellIndex] = true; @@ -412,7 +407,7 @@ std::vector RimGeoMechContourMapProjection::generateResultsFromAddress( { if ( mapCellVisibility.empty() || mapCellVisibility[index] ) { - cvf::Vec2ui ij = ijFromCellIndex( index ); + cvf::Vec2ui ij = m_contourMapGrid->ijFromCellIndex( index ); aggregatedResults[index] = calculateValueInMapCell( ij.x(), ij.y(), resultValues ); } } diff --git a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp index 793286a413..18e27b50c9 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp @@ -24,6 +24,7 @@ #include "RiaWeightedMeanCalculator.h" #include "RigCellGeometryTools.h" +#include "RigContourMapGrid.h" #include "RigHexIntersectionTools.h" #include "RimCase.h" @@ -75,7 +76,6 @@ CAF_PDM_ABSTRACT_SOURCE_INIT( RimContourMapProjection, "RimContourMapProjection" //-------------------------------------------------------------------------------------------------- RimContourMapProjection::RimContourMapProjection() : m_pickPoint( cvf::Vec2d::UNDEFINED ) - , m_mapSize( cvf::Vec2ui( 0u, 0u ) ) , m_currentResultTimestep( -1 ) , m_minResultAllTimeSteps( std::numeric_limits::infinity() ) , m_maxResultAllTimeSteps( -std::numeric_limits::infinity() ) @@ -166,8 +166,8 @@ std::vector RimContourMapProjection::generatePickPointPolygon() { #ifndef NDEBUG cvf::Vec2d cellDiagonal( sampleSpacing() * 0.5, sampleSpacing() * 0.5 ); - cvf::Vec2ui pickedCell = ijFromLocalPos( m_pickPoint ); - cvf::Vec2d cellCenter = cellCenterPosition( pickedCell.x(), pickedCell.y() ); + cvf::Vec2ui pickedCell = m_contourMapGrid->ijFromLocalPos( m_pickPoint ); + cvf::Vec2d cellCenter = m_contourMapGrid->cellCenterPosition( pickedCell.x(), pickedCell.y() ); cvf::Vec2d cellCorner = cellCenter - cellDiagonal; points.push_back( cvf::Vec3d( cellCorner, 0.0 ) ); points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( sampleSpacing(), 0.0 ), 0.0 ) ); @@ -326,7 +326,7 @@ double RimContourMapProjection::sumAllValues() const //-------------------------------------------------------------------------------------------------- cvf::Vec2ui RimContourMapProjection::numberOfElementsIJ() const { - return m_mapSize; + return m_contourMapGrid->numberOfElementsIJ(); } //-------------------------------------------------------------------------------------------------- @@ -334,10 +334,7 @@ cvf::Vec2ui RimContourMapProjection::numberOfElementsIJ() const //-------------------------------------------------------------------------------------------------- cvf::Vec2ui RimContourMapProjection::numberOfVerticesIJ() const { - cvf::Vec2ui mapSize = numberOfElementsIJ(); - mapSize.x() += 1u; - mapSize.y() += 1u; - return mapSize; + return m_contourMapGrid->numberOfVerticesIJ(); } //-------------------------------------------------------------------------------------------------- @@ -354,7 +351,7 @@ bool RimContourMapProjection::isColumnResult() const //-------------------------------------------------------------------------------------------------- double RimContourMapProjection::valueAtVertex( uint i, uint j ) const { - size_t index = vertexIndexFromIJ( i, j ); + size_t index = m_contourMapGrid->vertexIndexFromIJ( i, j ); if ( index < numberOfVertices() ) { return m_aggregatedVertexResults.at( index ); @@ -367,7 +364,7 @@ double RimContourMapProjection::valueAtVertex( uint i, uint j ) const //-------------------------------------------------------------------------------------------------- uint RimContourMapProjection::numberOfCells() const { - return m_mapSize.x() * m_mapSize.y(); + return m_contourMapGrid->numberOfCells(); } //-------------------------------------------------------------------------------------------------- @@ -378,7 +375,7 @@ uint RimContourMapProjection::numberOfValidCells() const uint validCount = 0u; for ( uint i = 0; i < numberOfCells(); ++i ) { - cvf::Vec2ui ij = ijFromCellIndex( i ); + cvf::Vec2ui ij = m_contourMapGrid->ijFromCellIndex( i ); if ( hasResultInCell( ij.x(), ij.y() ) ) { validCount++; @@ -404,9 +401,10 @@ bool RimContourMapProjection::checkForMapIntersection( const cvf::Vec3d& domainP CVF_TIGHT_ASSERT( contourMapPoint ); CVF_TIGHT_ASSERT( valueAtPoint ); - cvf::Vec3d mapPos3d = domainPoint3d - m_expandedBoundingBox.min(); - cvf::Vec2d mapPos2d( mapPos3d.x(), mapPos3d.y() ); - cvf::Vec2d gridorigin( m_expandedBoundingBox.min().x(), m_expandedBoundingBox.min().y() ); + const cvf::Vec3d& minPoint = m_contourMapGrid->expandedBoundingBox().min(); + cvf::Vec3d mapPos3d = domainPoint3d - minPoint; + cvf::Vec2d mapPos2d( mapPos3d.x(), mapPos3d.y() ); + cvf::Vec2d gridorigin( minPoint.x(), minPoint.y() ); double value = interpolateValue( mapPos2d ); if ( value != std::numeric_limits::infinity() ) @@ -424,7 +422,7 @@ bool RimContourMapProjection::checkForMapIntersection( const cvf::Vec3d& domainP //-------------------------------------------------------------------------------------------------- void RimContourMapProjection::setPickPoint( cvf::Vec2d globalPickPoint ) { - m_pickPoint = globalPickPoint - origin2d(); + m_pickPoint = globalPickPoint - m_contourMapGrid->origin2d(); } //-------------------------------------------------------------------------------------------------- @@ -432,7 +430,7 @@ void RimContourMapProjection::setPickPoint( cvf::Vec2d globalPickPoint ) //-------------------------------------------------------------------------------------------------- cvf::Vec3d RimContourMapProjection::origin3d() const { - return m_expandedBoundingBox.min(); + return m_contourMapGrid->expandedBoundingBox().min(); } //-------------------------------------------------------------------------------------------------- @@ -774,9 +772,9 @@ std::vector>> RimContourMapProjection::gen #pragma omp parallel for for ( int index = 0; index < nCells; ++index ) { - cvf::Vec2ui ij = ijFromCellIndex( index ); + cvf::Vec2ui ij = m_contourMapGrid->ijFromCellIndex( index ); - cvf::Vec2d globalPos = cellCenterPosition( ij.x(), ij.y() ) + origin2d(); + cvf::Vec2d globalPos = m_contourMapGrid->cellCenterPosition( ij.x(), ij.y() ) + m_contourMapGrid->origin2d(); projected3dGridIndices[index] = cellRayIntersectionAndResults( globalPos, weightingResultValues ); } } @@ -785,9 +783,9 @@ std::vector>> RimContourMapProjection::gen #pragma omp parallel for for ( int index = 0; index < nCells; ++index ) { - cvf::Vec2ui ij = ijFromCellIndex( index ); + cvf::Vec2ui ij = m_contourMapGrid->ijFromCellIndex( index ); - cvf::Vec2d globalPos = cellCenterPosition( ij.x(), ij.y() ) + origin2d(); + cvf::Vec2d globalPos = m_contourMapGrid->cellCenterPosition( ij.x(), ij.y() ) + m_contourMapGrid->origin2d(); projected3dGridIndices[index] = cellOverlapVolumesAndResults( globalPos, weightingResultValues ); } } @@ -808,7 +806,7 @@ void RimContourMapProjection::generateVertexResults() #pragma omp parallel for for ( int index = 0; index < static_cast( nVertices ); ++index ) { - cvf::Vec2ui ij = ijFromVertexIndex( index ); + cvf::Vec2ui ij = m_contourMapGrid->ijFromVertexIndex( index ); m_aggregatedVertexResults[index] = calculateValueAtVertex( ij.x(), ij.y() ); } } @@ -818,7 +816,7 @@ void RimContourMapProjection::generateVertexResults() //-------------------------------------------------------------------------------------------------- void RimContourMapProjection::generateTrianglesWithVertexValues() { - std::vector vertices = generateVertices(); + std::vector vertices = m_contourMapGrid->generateVertices(); cvf::Vec2ui patchSize = numberOfVerticesIJ(); cvf::ref faceList = new cvf::UIntArray; @@ -1045,29 +1043,6 @@ void RimContourMapProjection::generateTrianglesWithVertexValues() m_trianglesWithVertexValues = finalTriangles; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector RimContourMapProjection::generateVertices() const -{ - size_t nVertices = numberOfVertices(); - std::vector vertices( nVertices, cvf::Vec3d::ZERO ); - -#pragma omp parallel for - for ( int index = 0; index < static_cast( nVertices ); ++index ) - { - cvf::Vec2ui ij = ijFromVertexIndex( index ); - cvf::Vec2d mapPos = cellCenterPosition( ij.x(), ij.y() ); - // Shift away from sample point to vertex - mapPos.x() -= sampleSpacing() * 0.5; - mapPos.y() -= sampleSpacing() * 0.5; - - cvf::Vec3d vertexPos( mapPos, 0.0 ); - vertices[index] = vertexPos; - } - return vertices; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1301,18 +1276,19 @@ double RimContourMapProjection::sumTriangleAreas( const std::vector& std::vector RimContourMapProjection::cellOverlapVolumesAndResults( const cvf::Vec2d& globalPos2d, const std::vector& weightingResultValues ) const { - cvf::Vec3d top2dElementCentroid( globalPos2d, m_expandedBoundingBox.max().z() ); - cvf::Vec3d bottom2dElementCentroid( globalPos2d, m_expandedBoundingBox.min().z() ); - cvf::Vec3d planarDiagonalVector( 0.5 * sampleSpacing(), 0.5 * sampleSpacing(), 0.0 ); - cvf::Vec3d topNECorner = top2dElementCentroid + planarDiagonalVector; - cvf::Vec3d bottomSWCorner = bottom2dElementCentroid - planarDiagonalVector; + const cvf::BoundingBox& expandedBoundingBox = m_contourMapGrid->expandedBoundingBox(); + cvf::Vec3d top2dElementCentroid( globalPos2d, expandedBoundingBox.max().z() ); + cvf::Vec3d bottom2dElementCentroid( globalPos2d, expandedBoundingBox.min().z() ); + cvf::Vec3d planarDiagonalVector( 0.5 * sampleSpacing(), 0.5 * sampleSpacing(), 0.0 ); + cvf::Vec3d topNECorner = top2dElementCentroid + planarDiagonalVector; + cvf::Vec3d bottomSWCorner = bottom2dElementCentroid - planarDiagonalVector; cvf::BoundingBox bbox2dElement( bottomSWCorner, topNECorner ); std::vector> matchingVisibleCellsAndWeight; // Bounding box has been expanded, so 2d element may be outside actual 3d grid - if ( !bbox2dElement.intersects( m_gridBoundingBox ) ) + if ( !bbox2dElement.intersects( m_contourMapGrid->originalBoundingBox() ) ) { return matchingVisibleCellsAndWeight; } @@ -1362,11 +1338,13 @@ std::vector { std::vector> matchingVisibleCellsAndWeight; - cvf::Vec3d highestPoint( globalPos2d, m_expandedBoundingBox.max().z() ); - cvf::Vec3d lowestPoint( globalPos2d, m_expandedBoundingBox.min().z() ); + const cvf::BoundingBox& expandedBoundingBox = m_contourMapGrid->expandedBoundingBox(); + + cvf::Vec3d highestPoint( globalPos2d, expandedBoundingBox.max().z() ); + cvf::Vec3d lowestPoint( globalPos2d, expandedBoundingBox.min().z() ); // Bounding box has been expanded, so ray may be outside actual 3d grid - if ( !m_gridBoundingBox.contains( highestPoint ) ) + if ( !m_contourMapGrid->originalBoundingBox().contains( highestPoint ) ) { return matchingVisibleCellsAndWeight; } @@ -1441,8 +1419,8 @@ bool RimContourMapProjection::isStraightSummationResult( ResultAggregationEnum a //-------------------------------------------------------------------------------------------------- double RimContourMapProjection::interpolateValue( const cvf::Vec2d& gridPos2d ) const { - cvf::Vec2ui cellContainingPoint = ijFromLocalPos( gridPos2d ); - cvf::Vec2d cellCenter = cellCenterPosition( cellContainingPoint.x(), cellContainingPoint.y() ); + cvf::Vec2ui cellContainingPoint = m_contourMapGrid->ijFromLocalPos( gridPos2d ); + cvf::Vec2d cellCenter = m_contourMapGrid->cellCenterPosition( cellContainingPoint.x(), cellContainingPoint.y() ); std::array x; x[0] = cvf::Vec3d( cellCenter + cvf::Vec2d( -sampleSpacing() * 0.5, -sampleSpacing() * 0.5 ), 0.0 ); @@ -1494,7 +1472,7 @@ double RimContourMapProjection::interpolateValue( const cvf::Vec2d& gridPos2d ) //-------------------------------------------------------------------------------------------------- double RimContourMapProjection::valueInCell( uint i, uint j ) const { - size_t index = cellIndexFromIJ( i, j ); + size_t index = m_contourMapGrid->cellIndexFromIJ( i, j ); if ( index < numberOfCells() ) { return m_aggregatedResults.at( index ); @@ -1520,8 +1498,8 @@ double RimContourMapProjection::calculateValueAtVertex( uint vi, uint vj ) const if ( vi > 0u ) averageIs.push_back( vi - 1 ); if ( vj > 0u ) averageJs.push_back( vj - 1 ); - if ( vi < m_mapSize.x() ) averageIs.push_back( vi ); - if ( vj < m_mapSize.y() ) averageJs.push_back( vj ); + if ( vi < m_contourMapGrid->mapSize().x() ) averageIs.push_back( vi ); + if ( vj < m_contourMapGrid->mapSize().y() ) averageJs.push_back( vj ); RiaWeightedMeanCalculator calc; for ( uint j : averageJs ) @@ -1546,7 +1524,7 @@ double RimContourMapProjection::calculateValueAtVertex( uint vi, uint vj ) const //-------------------------------------------------------------------------------------------------- std::vector> RimContourMapProjection::cellsAtIJ( uint i, uint j ) const { - size_t cellIndex = cellIndexFromIJ( i, j ); + size_t cellIndex = m_contourMapGrid->cellIndexFromIJ( i, j ); if ( cellIndex < m_projected3dGridIndices.size() ) { return m_projected3dGridIndices[cellIndex]; @@ -1554,96 +1532,12 @@ std::vector> RimContourMapProjection::cellsAtIJ( uint return std::vector>(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -size_t RimContourMapProjection::cellIndexFromIJ( uint i, uint j ) const -{ - CVF_ASSERT( i < m_mapSize.x() ); - CVF_ASSERT( j < m_mapSize.y() ); - - return i + j * m_mapSize.x(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -size_t RimContourMapProjection::vertexIndexFromIJ( uint i, uint j ) const -{ - return i + j * ( m_mapSize.x() + 1 ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -cvf::Vec2ui RimContourMapProjection::ijFromVertexIndex( size_t gridIndex ) const -{ - cvf::Vec2ui gridSize = numberOfVerticesIJ(); - - uint quotientX = static_cast( gridIndex ) / gridSize.x(); - uint remainderX = static_cast( gridIndex ) % gridSize.x(); - - return cvf::Vec2ui( remainderX, quotientX ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -cvf::Vec2ui RimContourMapProjection::ijFromCellIndex( size_t cellIndex ) const -{ - CVF_TIGHT_ASSERT( cellIndex < numberOfCells() ); - - uint quotientX = static_cast( cellIndex ) / m_mapSize.x(); - uint remainderX = static_cast( cellIndex ) % m_mapSize.x(); - - return cvf::Vec2ui( remainderX, quotientX ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -cvf::Vec2ui RimContourMapProjection::ijFromLocalPos( const cvf::Vec2d& localPos2d ) const -{ - uint i = localPos2d.x() / sampleSpacing(); - uint j = localPos2d.y() / sampleSpacing(); - return cvf::Vec2ui( i, j ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -cvf::Vec2d RimContourMapProjection::cellCenterPosition( uint i, uint j ) const -{ - cvf::Vec3d gridExtent = m_expandedBoundingBox.extent(); - cvf::Vec2d cellCorner = cvf::Vec2d( ( i * gridExtent.x() ) / ( m_mapSize.x() ), ( j * gridExtent.y() ) / ( m_mapSize.y() ) ); - - return cellCorner + cvf::Vec2d( sampleSpacing() * 0.5, sampleSpacing() * 0.5 ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -cvf::Vec2d RimContourMapProjection::origin2d() const -{ - return cvf::Vec2d( m_expandedBoundingBox.min().x(), m_expandedBoundingBox.min().y() ); -} - //-------------------------------------------------------------------------------------------------- /// Vertex positions in local coordinates (add origin2d.x() for UTM x) //-------------------------------------------------------------------------------------------------- std::vector RimContourMapProjection::xVertexPositions() const { - double gridExtent = m_expandedBoundingBox.extent().x(); - - cvf::Vec2ui gridSize = numberOfVerticesIJ(); - std::vector positions; - positions.reserve( gridSize.x() ); - for ( uint i = 0; i < gridSize.x(); ++i ) - { - positions.push_back( ( i * gridExtent ) / ( gridSize.x() - 1 ) ); - } - - return positions; + return m_contourMapGrid->xVertexPositions(); } //-------------------------------------------------------------------------------------------------- @@ -1651,30 +1545,7 @@ std::vector RimContourMapProjection::xVertexPositions() const //-------------------------------------------------------------------------------------------------- std::vector RimContourMapProjection::yVertexPositions() const { - double gridExtent = m_expandedBoundingBox.extent().y(); - - cvf::Vec2ui gridSize = numberOfVerticesIJ(); - std::vector positions; - positions.reserve( gridSize.y() ); - for ( uint j = 0; j < gridSize.y(); ++j ) - { - positions.push_back( ( j * gridExtent ) / ( gridSize.y() - 1 ) ); - } - - return positions; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -cvf::Vec2ui RimContourMapProjection::calculateMapSize() const -{ - cvf::Vec3d gridExtent = m_expandedBoundingBox.extent(); - - uint projectionSizeX = static_cast( std::ceil( gridExtent.x() / sampleSpacing() ) ); - uint projectionSizeY = static_cast( std::ceil( gridExtent.y() / sampleSpacing() ) ); - - return cvf::Vec2ui( projectionSizeX, projectionSizeY ); + return m_contourMapGrid->yVertexPositions(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h index a0872066e5..c490291ece 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h +++ b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h @@ -33,6 +33,7 @@ #include "cvfString.h" #include "cvfVector2.h" +class RigContourMapGrid; class RimGridView; class RimRegularLegendConfig; @@ -165,10 +166,9 @@ protected: bool mapCellVisibilityNeedsUpdating(); std::vector>> generateGridMapping(); - void generateVertexResults(); - void generateTrianglesWithVertexValues(); - std::vector generateVertices() const; - void generateContourPolygons(); + void generateVertexResults(); + void generateTrianglesWithVertexValues(); + void generateContourPolygons(); ContourPolygons createContourPolygonsFromLineSegments( caf::ContourLines::ListOfLineSegments& unorderedLineSegments, double contourValue ); void smoothContourPolygons( ContourPolygons* contourPolygons, bool favourExpansion ); void clipContourPolygons( ContourPolygons* contourPolygons, const ContourPolygons* clipBy ); @@ -191,15 +191,7 @@ protected: // Cell index and position conversion std::vector cellsAtIJ( uint i, uint j ) const; - size_t cellIndexFromIJ( uint i, uint j ) const; - size_t vertexIndexFromIJ( uint i, uint j ) const; - cvf::Vec2ui ijFromVertexIndex( size_t gridIndex ) const; - cvf::Vec2ui ijFromCellIndex( size_t mapIndex ) const; - cvf::Vec2ui ijFromLocalPos( const cvf::Vec2d& localPos2d ) const; - cvf::Vec2d cellCenterPosition( uint i, uint j ) const; - cvf::Vec2d origin2d() const; - cvf::Vec2ui calculateMapSize() const; double gridEdgeOffset() const; virtual void updateAfterResultGeneration( int timeStep ) = 0; @@ -225,9 +217,6 @@ protected: std::vector>> m_projected3dGridIndices; cvf::Vec2d m_pickPoint; - cvf::Vec2ui m_mapSize; - cvf::BoundingBox m_expandedBoundingBox; - cvf::BoundingBox m_gridBoundingBox; std::vector m_contourPolygons; std::vector m_contourLevelCumulativeAreas; std::vector m_trianglesWithVertexValues; @@ -236,4 +225,6 @@ protected: double m_minResultAllTimeSteps; double m_maxResultAllTimeSteps; + + std::unique_ptr m_contourMapGrid; }; diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp index 5fd2902241..8b615f1cb5 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp @@ -26,6 +26,7 @@ #include "RigCaseCellResultsData.h" #include "RigCell.h" #include "RigCellGeometryTools.h" +#include "RigContourMapGrid.h" #include "RigEclipseCaseData.h" #include "RigEclipseResultAddress.h" #include "RigHexIntersectionTools.h" @@ -238,7 +239,7 @@ std::vector RimEclipseContourMapProjection::generateResults( int timeSte #pragma omp parallel for for ( int index = 0; index < static_cast( nCells ); ++index ) { - cvf::Vec2ui ij = ijFromCellIndex( index ); + cvf::Vec2ui ij = m_contourMapGrid->ijFromCellIndex( index ); aggregatedResults[index] = calculateValueInMapCell( ij.x(), ij.y(), gridResultValues ); } } @@ -343,19 +344,8 @@ void RimEclipseContourMapProjection::updateGridInformation() m_activeCellInfo = eclipseCase->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL ); m_kLayers = m_mainGrid->cellCountK(); - m_gridBoundingBox = eclipseCase->activeCellsBoundingBox(); - cvf::Vec3d minExpandedPoint = m_gridBoundingBox.min() - cvf::Vec3d( gridEdgeOffset(), gridEdgeOffset(), 0.0 ); - cvf::Vec3d maxExpandedPoint = m_gridBoundingBox.max() + cvf::Vec3d( gridEdgeOffset(), gridEdgeOffset(), 0.0 ); - m_expandedBoundingBox = cvf::BoundingBox( minExpandedPoint, maxExpandedPoint ); - - m_mapSize = calculateMapSize(); - - // 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() * sampleSpacing(); - maxPoint.y() = minPoint.y() + m_mapSize.y() * sampleSpacing(); - m_expandedBoundingBox = cvf::BoundingBox( minPoint, maxPoint ); + cvf::BoundingBox gridBoundingBox = eclipseCase->activeCellsBoundingBox(); + m_contourMapGrid = std::make_unique( gridBoundingBox, sampleSpacing() ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.h b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.h index f3f1250a3b..4ec2333813 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.h +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.h @@ -32,6 +32,7 @@ class RigActiveCellInfo; class RigMainGrid; +class RigContourMapGrid; class RigResultAccessor; class RimEclipseContourMapView; class RimEclipseCase; diff --git a/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake b/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake index 574795281c..be2bd970b6 100644 --- a/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake +++ b/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake @@ -102,6 +102,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RigVfpTables.h ${CMAKE_CURRENT_LIST_DIR}/RigOsduWellLogData.h ${CMAKE_CURRENT_LIST_DIR}/RigWellTargetCandidatesGenerator.h + ${CMAKE_CURRENT_LIST_DIR}/RigContourMapGrid.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -202,6 +203,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RigVfpTables.cpp ${CMAKE_CURRENT_LIST_DIR}/RigOsduWellLogData.cpp ${CMAKE_CURRENT_LIST_DIR}/RigWellTargetCandidatesGenerator.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigContourMapGrid.cpp ) list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/ReservoirDataModel/RigContourMapGrid.cpp b/ApplicationLibCode/ReservoirDataModel/RigContourMapGrid.cpp new file mode 100644 index 0000000000..c66502d478 --- /dev/null +++ b/ApplicationLibCode/ReservoirDataModel/RigContourMapGrid.cpp @@ -0,0 +1,295 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "RigContourMapGrid.h" + +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigContourMapGrid::RigContourMapGrid( const cvf::BoundingBox& originalBoundingBox, double sampleSpacing ) + : m_sampleSpacing( sampleSpacing ) + , m_mapSize( cvf::Vec2ui( 0u, 0u ) ) + , m_originalBoundingBox( originalBoundingBox ) +{ + cvf::Vec3d minExpandedPoint = originalBoundingBox.min() - cvf::Vec3d( gridEdgeOffset(), gridEdgeOffset(), 0.0 ); + cvf::Vec3d maxExpandedPoint = originalBoundingBox.max() + cvf::Vec3d( gridEdgeOffset(), gridEdgeOffset(), 0.0 ); + m_expandedBoundingBox = cvf::BoundingBox( minExpandedPoint, maxExpandedPoint ); + + m_mapSize = calculateMapSize( m_expandedBoundingBox.extent(), sampleSpacing ); + + // Re-jig max point to be an exact multiple of cell size + m_expandedBoundingBox = makeMaxPointMultipleOfCellSize( m_expandedBoundingBox, m_mapSize, sampleSpacing ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigContourMapGrid::RigContourMapGrid( const cvf::BoundingBox& originalBoundingBox, const cvf::BoundingBox& expandedBoundingBox, double sampleSpacing ) + : m_sampleSpacing( sampleSpacing ) + , m_mapSize( cvf::Vec2ui( 0u, 0u ) ) + , m_originalBoundingBox( originalBoundingBox ) + , m_expandedBoundingBox( expandedBoundingBox ) +{ + m_mapSize = calculateMapSize( m_expandedBoundingBox.extent(), sampleSpacing ); + + // Re-jig max point to be an exact multiple of cell size + m_expandedBoundingBox = makeMaxPointMultipleOfCellSize( m_expandedBoundingBox, m_mapSize, sampleSpacing ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigContourMapGrid::sampleSpacing() const +{ + return m_sampleSpacing; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::Vec2ui RigContourMapGrid::numberOfElementsIJ() const +{ + return m_mapSize; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::Vec2ui RigContourMapGrid::numberOfVerticesIJ() const +{ + cvf::Vec2ui mapSize = numberOfElementsIJ(); + mapSize.x() += 1u; + mapSize.y() += 1u; + return mapSize; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +uint RigContourMapGrid::numberOfCells() const +{ + return m_mapSize.x() * m_mapSize.y(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +size_t RigContourMapGrid::numberOfVertices() const +{ + cvf::Vec2ui gridSize = numberOfVerticesIJ(); + return static_cast( gridSize.x() ) * static_cast( gridSize.y() ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::Vec3d RigContourMapGrid::origin3d() const +{ + return m_expandedBoundingBox.min(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigContourMapGrid::generateVertices() const +{ + size_t nVertices = numberOfVertices(); + std::vector vertices( nVertices, cvf::Vec3d::ZERO ); + +#pragma omp parallel for + for ( int index = 0; index < static_cast( nVertices ); ++index ) + { + cvf::Vec2ui ij = ijFromVertexIndex( index ); + cvf::Vec2d mapPos = cellCenterPosition( ij.x(), ij.y() ); + // Shift away from sample point to vertex + mapPos.x() -= sampleSpacing() * 0.5; + mapPos.y() -= sampleSpacing() * 0.5; + + cvf::Vec3d vertexPos( mapPos, 0.0 ); + vertices[index] = vertexPos; + } + return vertices; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::Vec2ui RigContourMapGrid::ijFromVertexIndex( size_t gridIndex ) const +{ + cvf::Vec2ui gridSize = numberOfVerticesIJ(); + + uint quotientX = static_cast( gridIndex ) / gridSize.x(); + uint remainderX = static_cast( gridIndex ) % gridSize.x(); + + return cvf::Vec2ui( remainderX, quotientX ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +size_t RigContourMapGrid::cellIndexFromIJ( uint i, uint j ) const +{ + CVF_ASSERT( i < m_mapSize.x() ); + CVF_ASSERT( j < m_mapSize.y() ); + + return i + j * m_mapSize.x(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::Vec2ui RigContourMapGrid::ijFromCellIndex( size_t cellIndex ) const +{ + CVF_TIGHT_ASSERT( cellIndex < numberOfCells() ); + + uint quotientX = static_cast( cellIndex ) / m_mapSize.x(); + uint remainderX = static_cast( cellIndex ) % m_mapSize.x(); + + return cvf::Vec2ui( remainderX, quotientX ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::Vec2ui RigContourMapGrid::ijFromLocalPos( const cvf::Vec2d& localPos2d ) const +{ + uint i = localPos2d.x() / sampleSpacing(); + uint j = localPos2d.y() / sampleSpacing(); + return cvf::Vec2ui( i, j ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::Vec2d RigContourMapGrid::cellCenterPosition( uint i, uint j ) const +{ + cvf::Vec3d gridExtent = m_expandedBoundingBox.extent(); + cvf::Vec2d cellCorner = cvf::Vec2d( ( i * gridExtent.x() ) / ( m_mapSize.x() ), ( j * gridExtent.y() ) / ( m_mapSize.y() ) ); + + return cellCorner + cvf::Vec2d( sampleSpacing() * 0.5, sampleSpacing() * 0.5 ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::Vec2d RigContourMapGrid::origin2d() const +{ + return cvf::Vec2d( m_expandedBoundingBox.min().x(), m_expandedBoundingBox.min().y() ); +} + +//-------------------------------------------------------------------------------------------------- +/// Vertex positions in local coordinates (add origin2d.x() for UTM x) +//-------------------------------------------------------------------------------------------------- +std::vector RigContourMapGrid::xVertexPositions() const +{ + double gridExtent = m_expandedBoundingBox.extent().x(); + + cvf::Vec2ui gridSize = numberOfVerticesIJ(); + std::vector positions; + positions.reserve( gridSize.x() ); + for ( uint i = 0; i < gridSize.x(); ++i ) + { + positions.push_back( ( i * gridExtent ) / ( gridSize.x() - 1 ) ); + } + + return positions; +} + +//-------------------------------------------------------------------------------------------------- +/// Vertex positions in local coordinates (add origin2d.y() for UTM y) +//-------------------------------------------------------------------------------------------------- +std::vector RigContourMapGrid::yVertexPositions() const +{ + double gridExtent = m_expandedBoundingBox.extent().y(); + + cvf::Vec2ui gridSize = numberOfVerticesIJ(); + std::vector positions; + positions.reserve( gridSize.y() ); + for ( uint j = 0; j < gridSize.y(); ++j ) + { + positions.push_back( ( j * gridExtent ) / ( gridSize.y() - 1 ) ); + } + + return positions; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigContourMapGrid::gridEdgeOffset() const +{ + return sampleSpacing() * 2.0; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const cvf::BoundingBox& RigContourMapGrid::expandedBoundingBox() const +{ + return m_expandedBoundingBox; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const cvf::BoundingBox& RigContourMapGrid::originalBoundingBox() const +{ + return m_originalBoundingBox; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const cvf::Vec2ui& RigContourMapGrid::mapSize() const +{ + return m_mapSize; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +size_t RigContourMapGrid::vertexIndexFromIJ( uint i, uint j ) const +{ + return i + j * ( m_mapSize.x() + 1 ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::Vec2ui RigContourMapGrid::calculateMapSize( const cvf::Vec3d& gridExtent, double sampleSpacing ) +{ + uint projectionSizeX = static_cast( std::ceil( gridExtent.x() / sampleSpacing ) ); + uint projectionSizeY = static_cast( std::ceil( gridExtent.y() / sampleSpacing ) ); + + return cvf::Vec2ui( projectionSizeX, projectionSizeY ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::BoundingBox + RigContourMapGrid::makeMaxPointMultipleOfCellSize( const cvf::BoundingBox& boundingBox, const cvf::Vec2ui& mapSize, double sampleSpacing ) +{ + cvf::Vec3d minPoint = boundingBox.min(); + cvf::Vec3d maxPoint = boundingBox.max(); + maxPoint.x() = minPoint.x() + mapSize.x() * sampleSpacing; + maxPoint.y() = minPoint.y() + mapSize.y() * sampleSpacing; + return cvf::BoundingBox( minPoint, maxPoint ); +} diff --git a/ApplicationLibCode/ReservoirDataModel/RigContourMapGrid.h b/ApplicationLibCode/ReservoirDataModel/RigContourMapGrid.h new file mode 100644 index 0000000000..4027c5f38c --- /dev/null +++ b/ApplicationLibCode/ReservoirDataModel/RigContourMapGrid.h @@ -0,0 +1,75 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "cvfBoundingBox.h" +#include "cvfVector2.h" + +//================================================================================================== +/// +/// +//================================================================================================== +class RigContourMapGrid +{ +public: + RigContourMapGrid( const cvf::BoundingBox& originalBoundingBox, double sampleSpacing ); + RigContourMapGrid( const cvf::BoundingBox& originalBoundingBox, const cvf::BoundingBox& expandedBoundingBox, double sampleSpacing ); + + double sampleSpacing() const; + + cvf::Vec2ui numberOfElementsIJ() const; + cvf::Vec2ui numberOfVerticesIJ() const; + + uint numberOfCells() const; + uint numberOfValidCells() const; + size_t numberOfVertices() const; + + cvf::Vec3d origin3d() const; + + std::vector xVertexPositions() const; + std::vector yVertexPositions() const; + + std::vector generateVertices() const; + + // Cell index and position conversion + size_t cellIndexFromIJ( uint i, uint j ) const; + size_t vertexIndexFromIJ( uint i, uint j ) const; + cvf::Vec2ui ijFromVertexIndex( size_t gridIndex ) const; + cvf::Vec2ui ijFromCellIndex( size_t mapIndex ) const; + cvf::Vec2ui ijFromLocalPos( const cvf::Vec2d& localPos2d ) const; + cvf::Vec2d cellCenterPosition( uint i, uint j ) const; + cvf::Vec2d origin2d() const; + + double gridEdgeOffset() const; + + const cvf::BoundingBox& expandedBoundingBox() const; + const cvf::BoundingBox& originalBoundingBox() const; + const cvf::Vec2ui& mapSize() const; + +private: + static cvf::Vec2ui calculateMapSize( const cvf::Vec3d& extent, double sampleSpacing ); + + static cvf::BoundingBox + makeMaxPointMultipleOfCellSize( const cvf::BoundingBox& boundingBox, const cvf::Vec2ui& mapSize, double sampleSpacing ); + + double m_sampleSpacing; + cvf::Vec2ui m_mapSize; + cvf::BoundingBox m_expandedBoundingBox; + cvf::BoundingBox m_originalBoundingBox; +}; From 4c3fb3cc4729f0c6c186e94d71f85c914d565df5 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 16 Oct 2024 15:24:38 +0200 Subject: [PATCH 042/160] Janitor: clean up includes. --- .../GeoMech/RimGeoMechContourMapProjection.cpp | 9 +-------- .../ProjectDataModel/RimContourMapProjection.cpp | 2 -- .../ProjectDataModel/RimContourMapProjection.h | 5 ----- .../RimEclipseContourMapProjection.cpp | 16 ---------------- .../RimEclipseContourMapProjection.h | 4 ---- 5 files changed, 1 insertion(+), 35 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp index a338b84b15..f848136237 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp @@ -18,8 +18,6 @@ #include "RimGeoMechContourMapProjection.h" #include "RiaImageTools.h" -#include "RiaWeightedGeometricMeanCalculator.h" -#include "RiaWeightedHarmonicMeanCalculator.h" #include "RiaWeightedMeanCalculator.h" #include "RigCellGeometryTools.h" @@ -36,7 +34,7 @@ #include "RimGeoMechCase.h" #include "RimGeoMechCellColors.h" #include "RimGeoMechContourMapView.h" -#include "RimGeoMechPropertyFilterCollection.h" +#include "RimPropertyFilterCollection.h" #include "RimRegularLegendConfig.h" #include "RivFemElmVisibilityCalculator.h" @@ -44,14 +42,9 @@ #include "cafPdmUiDoubleSliderEditor.h" #include "cvfArray.h" -#include "cvfCellRange.h" -#include "cvfGeometryTools.h" -#include "cvfGeometryUtils.h" -#include "cvfScalarMapper.h" #include "cvfStructGridGeometryGenerator.h" #include "cvfVector3.h" -#include #include #include diff --git a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp index 18e27b50c9..ea8ac4270a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp @@ -25,7 +25,6 @@ #include "RigCellGeometryTools.h" #include "RigContourMapGrid.h" -#include "RigHexIntersectionTools.h" #include "RimCase.h" #include "RimGridView.h" @@ -39,7 +38,6 @@ #include "cafProgressInfo.h" #include "cvfArray.h" -#include "cvfCellRange.h" #include "cvfGeometryTools.h" #include "cvfGeometryUtils.h" #include "cvfScalarMapper.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h index c490291ece..868cfdfc63 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h +++ b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h @@ -21,16 +21,11 @@ #include "RimCheckableNamedObject.h" #include "cafContourLines.h" -#include "cafDisplayCoordTransform.h" -#include "cafPdmChildField.h" #include "cafPdmField.h" #include "cafPdmObject.h" -#include "cafPdmProxyValueField.h" #include "cvfArray.h" #include "cvfBoundingBox.h" -#include "cvfGeometryBuilderFaceList.h" -#include "cvfString.h" #include "cvfVector2.h" class RigContourMapGrid; diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp index 8b615f1cb5..a88a854a3e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp @@ -18,10 +18,6 @@ #include "RimEclipseContourMapProjection.h" -#include "RiaWeightedGeometricMeanCalculator.h" -#include "RiaWeightedHarmonicMeanCalculator.h" -#include "RiaWeightedMeanCalculator.h" - #include "RigActiveCellInfo.h" #include "RigCaseCellResultsData.h" #include "RigCell.h" @@ -39,18 +35,6 @@ #include "RimEclipseResultDefinition.h" #include "RimEclipseView.h" #include "RimRegularLegendConfig.h" -#include "RimTextAnnotation.h" - -#include "cafContourLines.h" -#include "cafPdmUiDoubleSliderEditor.h" -#include "cafPdmUiTreeOrdering.h" - -#include "cvfArray.h" -#include "cvfCellRange.h" -#include "cvfGeometryTools.h" -#include "cvfGeometryUtils.h" -#include "cvfScalarMapper.h" -#include "cvfStructGridGeometryGenerator.h" #include diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.h b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.h index 4ec2333813..0a5b975ee9 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.h +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.h @@ -20,15 +20,11 @@ #include "RimContourMapProjection.h" -#include "cafDisplayCoordTransform.h" #include "cafPdmChildField.h" #include "cafPdmField.h" #include "cafPdmObject.h" #include "cvfBoundingBox.h" -#include "cvfGeometryBuilderFaceList.h" -#include "cvfString.h" -#include "cvfVector2.h" class RigActiveCellInfo; class RigMainGrid; From c636a80fe2d6150c34e7853432cdf042788a74f7 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 16 Oct 2024 16:08:42 +0200 Subject: [PATCH 043/160] Refactor: simplify conditionals. --- .../RimContourMapProjection.cpp | 72 ++++++------------- 1 file changed, 23 insertions(+), 49 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp index ea8ac4270a..e7a39e9889 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp @@ -161,26 +161,24 @@ std::vector RimContourMapProjection::generatePickPointPolygon() if ( !m_pickPoint.isUndefined() ) { - { #ifndef NDEBUG - cvf::Vec2d cellDiagonal( sampleSpacing() * 0.5, sampleSpacing() * 0.5 ); - cvf::Vec2ui pickedCell = m_contourMapGrid->ijFromLocalPos( m_pickPoint ); - cvf::Vec2d cellCenter = m_contourMapGrid->cellCenterPosition( pickedCell.x(), pickedCell.y() ); - cvf::Vec2d cellCorner = cellCenter - cellDiagonal; - points.push_back( cvf::Vec3d( cellCorner, 0.0 ) ); - points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( sampleSpacing(), 0.0 ), 0.0 ) ); - points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( sampleSpacing(), 0.0 ), 0.0 ) ); - points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( sampleSpacing(), sampleSpacing() ), 0.0 ) ); - points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( sampleSpacing(), sampleSpacing() ), 0.0 ) ); - points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( 0.0, sampleSpacing() ), 0.0 ) ); - points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( 0.0, sampleSpacing() ), 0.0 ) ); - points.push_back( cvf::Vec3d( cellCorner, 0.0 ) ); + cvf::Vec2d cellDiagonal( sampleSpacing() * 0.5, sampleSpacing() * 0.5 ); + cvf::Vec2ui pickedCell = m_contourMapGrid->ijFromLocalPos( m_pickPoint ); + cvf::Vec2d cellCenter = m_contourMapGrid->cellCenterPosition( pickedCell.x(), pickedCell.y() ); + cvf::Vec2d cellCorner = cellCenter - cellDiagonal; + points.push_back( cvf::Vec3d( cellCorner, 0.0 ) ); + points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( sampleSpacing(), 0.0 ), 0.0 ) ); + points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( sampleSpacing(), 0.0 ), 0.0 ) ); + points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( sampleSpacing(), sampleSpacing() ), 0.0 ) ); + points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( sampleSpacing(), sampleSpacing() ), 0.0 ) ); + points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( 0.0, sampleSpacing() ), 0.0 ) ); + points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( 0.0, sampleSpacing() ), 0.0 ) ); + points.push_back( cvf::Vec3d( cellCorner, 0.0 ) ); #endif - points.push_back( cvf::Vec3d( m_pickPoint - cvf::Vec2d( 0.5 * sampleSpacing(), 0.0 ), 0.0 ) ); - points.push_back( cvf::Vec3d( m_pickPoint + cvf::Vec2d( 0.5 * sampleSpacing(), 0.0 ), 0.0 ) ); - points.push_back( cvf::Vec3d( m_pickPoint - cvf::Vec2d( 0.0, 0.5 * sampleSpacing() ), 0.0 ) ); - points.push_back( cvf::Vec3d( m_pickPoint + cvf::Vec2d( 0.0, 0.5 * sampleSpacing() ), 0.0 ) ); - } + points.push_back( cvf::Vec3d( m_pickPoint - cvf::Vec2d( 0.5 * sampleSpacing(), 0.0 ), 0.0 ) ); + points.push_back( cvf::Vec3d( m_pickPoint + cvf::Vec2d( 0.5 * sampleSpacing(), 0.0 ), 0.0 ) ); + points.push_back( cvf::Vec3d( m_pickPoint - cvf::Vec2d( 0.0, 0.5 * sampleSpacing() ), 0.0 ) ); + points.push_back( cvf::Vec3d( m_pickPoint + cvf::Vec2d( 0.0, 0.5 * sampleSpacing() ), 0.0 ) ); } return points; } @@ -256,10 +254,7 @@ QString RimContourMapProjection::resultAggregationText() const QString RimContourMapProjection::caseName() const { RimCase* rimCase = baseView()->ownerCase(); - if ( !rimCase ) - { - return QString(); - } + if ( !rimCase ) return QString(); return rimCase->caseUserDescription(); } @@ -270,10 +265,7 @@ QString RimContourMapProjection::caseName() const QString RimContourMapProjection::currentTimeStepName() const { RimCase* rimCase = baseView()->ownerCase(); - if ( !rimCase || m_currentResultTimestep == -1 ) - { - return QString(); - } + if ( !rimCase || m_currentResultTimestep == -1 ) return QString(); return rimCase->timeStepName( m_currentResultTimestep ); } @@ -576,15 +568,10 @@ double RimContourMapProjection::calculateValueInMapCell( uint i, uint j, const s //-------------------------------------------------------------------------------------------------- bool RimContourMapProjection::gridMappingNeedsUpdating() const { - if ( m_projected3dGridIndices.size() != numberOfCells() ) - { - return true; - } + if ( m_projected3dGridIndices.size() != numberOfCells() ) return true; + + if ( m_cellGridIdxVisibility.isNull() ) return true; - if ( m_cellGridIdxVisibility.isNull() ) - { - return true; - } cvf::ref currentVisibility = getCellVisibility(); CVF_ASSERT( currentVisibility->size() == m_cellGridIdxVisibility->size() ); @@ -601,21 +588,8 @@ bool RimContourMapProjection::gridMappingNeedsUpdating() const //-------------------------------------------------------------------------------------------------- bool RimContourMapProjection::resultsNeedsUpdating( int timeStep ) const { - if ( m_aggregatedResults.size() != numberOfCells() ) - { - return true; - } - - if ( m_aggregatedVertexResults.size() != numberOfVertices() ) - { - return true; - } - - if ( timeStep != m_currentResultTimestep ) - { - return true; - } - return false; + return ( m_aggregatedResults.size() != numberOfCells() || m_aggregatedVertexResults.size() != numberOfVertices() || + timeStep != m_currentResultTimestep ); } //-------------------------------------------------------------------------------------------------- From ebc805ab652304b0ca9b20b12ad213860eadf383 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Thu, 17 Oct 2024 09:19:52 +0200 Subject: [PATCH 044/160] Refactor: Extractor contour polygon tools. --- .../RivContourMapProjectionPartMgr.cpp | 47 +---- .../RivContourMapProjectionPartMgr.h | 7 +- .../RimContourMapProjection.cpp | 135 +------------ .../RimContourMapProjection.h | 18 +- .../ReservoirDataModel/CMakeLists_files.cmake | 2 + .../RigContourPolygonsTools.cpp | 188 ++++++++++++++++++ .../RigContourPolygonsTools.h | 53 +++++ 7 files changed, 268 insertions(+), 182 deletions(-) create mode 100644 ApplicationLibCode/ReservoirDataModel/RigContourPolygonsTools.cpp create mode 100644 ApplicationLibCode/ReservoirDataModel/RigContourPolygonsTools.h diff --git a/ApplicationLibCode/ModelVisualization/RivContourMapProjectionPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivContourMapProjectionPartMgr.cpp index 62f31799fb..7bd447aa74 100644 --- a/ApplicationLibCode/ModelVisualization/RivContourMapProjectionPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivContourMapProjectionPartMgr.cpp @@ -4,6 +4,7 @@ #include "RiaFontCache.h" #include "RiaWeightedMeanCalculator.h" #include "RigCellGeometryTools.h" +#include "RigContourPolygonsTools.h" #include "RivMeshLinesSourceInfo.h" #include "RivPartPriority.h" #include "RivScalarMapperUtils.h" @@ -409,7 +410,7 @@ std::vector> std::vector tickValues; mapper->majorTickValues( &tickValues ); - const RimContourMapProjection::ContourPolygons* previousLevel = nullptr; + const RigContourPolygonsTools::ContourPolygons* previousLevel = nullptr; for ( int64_t i = (int64_t)m_contourLinePolygons.size() - 1; i > 0; --i ) { cvf::Color3f backgroundColor( mapper->mapToColor( tickValues[i] ) ); @@ -435,7 +436,9 @@ std::vector> const cvf::Vec3d& localVertex2 = m_contourLinePolygons[i][j].vertices[nextVertex]; cvf::Vec3d lineCenter = ( localVertex1 + localVertex2 ) * 0.5; - if ( previousLevel && lineOverlapsWithPreviousContourLevel( lineCenter, previousLevel ) ) + double tolerance = 1.0e-2 * m_contourMapProjection->sampleSpacing(); + + if ( previousLevel && lineOverlapsWithPreviousContourLevel( lineCenter, *previousLevel, tolerance ) ) { continue; } @@ -557,41 +560,9 @@ cvf::ref //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RivContourMapProjectionPartMgr::lineOverlapsWithPreviousContourLevel( const cvf::Vec3d& lineCenter, - const RimContourMapProjection::ContourPolygons* previousLevel ) const +bool RivContourMapProjectionPartMgr::lineOverlapsWithPreviousContourLevel( const cvf::Vec3d& lineCenter, + const RigContourPolygonsTools::ContourPolygons& previousLevel, + double tolerance ) { - const int64_t jump = 50; - CVF_ASSERT( previousLevel ); - double tolerance = 1.0e-2 * m_contourMapProjection->sampleSpacing(); - for ( const RimContourMapProjection::ContourPolygon& edgePolygon : *previousLevel ) - { - std::pair closestIndex( 0, std::numeric_limits::infinity() ); - for ( int64_t i = 0; i < (int64_t)edgePolygon.vertices.size(); i += jump ) - { - const cvf::Vec3d& edgeVertex1 = edgePolygon.vertices[i]; - const cvf::Vec3d& edgeVertex2 = edgePolygon.vertices[( i + 1 ) % edgePolygon.vertices.size()]; - double dist1 = cvf::GeometryTools::linePointSquareDist( edgeVertex1, edgeVertex2, lineCenter ); - if ( dist1 < tolerance ) - { - return true; - } - if ( dist1 < closestIndex.second ) - { - closestIndex = std::make_pair( i, dist1 ); - } - } - for ( int64_t i = std::max( (int64_t)1, closestIndex.first - jump + 1 ); - i < std::min( (int64_t)edgePolygon.vertices.size(), closestIndex.first + jump ); - ++i ) - { - const cvf::Vec3d& edgeVertex1 = edgePolygon.vertices[i]; - const cvf::Vec3d& edgeVertex2 = edgePolygon.vertices[( i + 1 ) % edgePolygon.vertices.size()]; - double dist1 = cvf::GeometryTools::linePointSquareDist( edgeVertex1, edgeVertex2, lineCenter ); - if ( dist1 < tolerance ) - { - return true; - } - } - } - return false; + return RigContourPolygonsTools::lineOverlapsWithContourPolygons( lineCenter, previousLevel, tolerance ); } diff --git a/ApplicationLibCode/ModelVisualization/RivContourMapProjectionPartMgr.h b/ApplicationLibCode/ModelVisualization/RivContourMapProjectionPartMgr.h index 70c651cfbc..fe5c45b76e 100644 --- a/ApplicationLibCode/ModelVisualization/RivContourMapProjectionPartMgr.h +++ b/ApplicationLibCode/ModelVisualization/RivContourMapProjectionPartMgr.h @@ -18,7 +18,7 @@ #pragma once -#include "RimEclipseContourMapProjection.h" +#include "RimContourMapProjection.h" #include "cafDisplayCoordTransform.h" #include "cafPdmPointer.h" @@ -59,8 +59,9 @@ private: const caf::DisplayCoordTransform* displayCoordTransform, std::vector>* labelBBoxes ) const; cvf::ref createPickPointVisDrawable( const caf::DisplayCoordTransform* displayCoordTransform ) const; - bool lineOverlapsWithPreviousContourLevel( const cvf::Vec3d& lineCenter, - const RimContourMapProjection::ContourPolygons* previousLevel ) const; + static bool lineOverlapsWithPreviousContourLevel( const cvf::Vec3d& lineCenter, + const RimContourMapProjection::ContourPolygons& previousLevel, + double tolerance ); private: caf::PdmPointer m_contourMapProjection; diff --git a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp index e7a39e9889..8a514febf0 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp @@ -1061,18 +1061,21 @@ void RimContourMapProjection::generateContourPolygons() caf::ContourLines::create( m_aggregatedVertexResults, xVertexPositions(), yVertexPositions(), contourLevels ); contourPolygons = std::vector( unorderedLineSegmentsPerLevel.size() ); + const double areaThreshold = 1.5 * ( sampleSpacing() * sampleSpacing() ) / ( sampleSpacingFactor() * sampleSpacingFactor() ); #pragma omp parallel for for ( int i = 0; i < (int)unorderedLineSegmentsPerLevel.size(); ++i ) { - contourPolygons[i] = createContourPolygonsFromLineSegments( unorderedLineSegmentsPerLevel[i], contourLevels[i] ); + contourPolygons[i] = RigContourPolygonsTools::createContourPolygonsFromLineSegments( unorderedLineSegmentsPerLevel[i], + contourLevels[i], + areaThreshold ); if ( m_smoothContourLines() ) { - smoothContourPolygons( &contourPolygons[i], true ); + RigContourPolygonsTools::smoothContourPolygons( contourPolygons[i], true, sampleSpacing() ); } - for ( ContourPolygon& polygon : contourPolygons[i] ) + for ( RigContourPolygonsTools::ContourPolygon& polygon : contourPolygons[i] ) { RigCellGeometryTools::simplifyPolygon( &polygon.vertices, simplifyEpsilon ); } @@ -1086,7 +1089,7 @@ void RimContourMapProjection::generateContourPolygons() { for ( size_t i = 1; i < contourPolygons.size(); ++i ) { - clipContourPolygons(&contourPolygons[i], &contourPolygons[i - 1] ); + RigContourPolygonsTools::clipContourPolygons(&contourPolygons[i], &contourPolygons[i - 1] ); } } */ @@ -1094,7 +1097,7 @@ void RimContourMapProjection::generateContourPolygons() m_contourLevelCumulativeAreas.resize( contourPolygons.size(), 0.0 ); for ( int64_t i = (int64_t)contourPolygons.size() - 1; i >= 0; --i ) { - double levelOuterArea = sumPolygonArea( contourPolygons[i] ); + double levelOuterArea = RigContourPolygonsTools::sumPolygonArea( contourPolygons[i] ); m_contourLevelCumulativeAreas[i] = levelOuterArea; } } @@ -1103,128 +1106,6 @@ void RimContourMapProjection::generateContourPolygons() m_contourPolygons = contourPolygons; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimContourMapProjection::ContourPolygons - RimContourMapProjection::createContourPolygonsFromLineSegments( caf::ContourLines::ListOfLineSegments& unorderedLineSegments, - double contourValue ) -{ - const double areaThreshold = 1.5 * ( sampleSpacing() * sampleSpacing() ) / ( sampleSpacingFactor() * sampleSpacingFactor() ); - - ContourPolygons contourPolygons; - - std::vector> polygons; - RigCellGeometryTools::createPolygonFromLineSegments( unorderedLineSegments, polygons, 1.0e-8 ); - for ( size_t j = 0; j < polygons.size(); ++j ) - { - double signedArea = cvf::GeometryTools::signedAreaPlanarPolygon( cvf::Vec3d::Z_AXIS, polygons[j] ); - ContourPolygon contourPolygon; - contourPolygon.value = contourValue; - if ( signedArea < 0.0 ) - { - contourPolygon.vertices.insert( contourPolygon.vertices.end(), polygons[j].rbegin(), polygons[j].rend() ); - } - else - { - contourPolygon.vertices = polygons[j]; - } - - contourPolygon.area = cvf::GeometryTools::signedAreaPlanarPolygon( cvf::Vec3d::Z_AXIS, contourPolygon.vertices ); - if ( contourPolygon.area > areaThreshold ) - { - for ( const cvf::Vec3d& vertex : contourPolygon.vertices ) - { - contourPolygon.bbox.add( vertex ); - } - contourPolygons.push_back( contourPolygon ); - } - } - return contourPolygons; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimContourMapProjection::smoothContourPolygons( ContourPolygons* contourPolygons, bool favourExpansion ) -{ - CVF_ASSERT( contourPolygons ); - for ( size_t i = 0; i < contourPolygons->size(); ++i ) - { - ContourPolygon& polygon = contourPolygons->at( i ); - - for ( size_t n = 0; n < 20; ++n ) - { - std::vector newVertices; - newVertices.resize( polygon.vertices.size() ); - double maxChange = 0.0; - for ( size_t j = 0; j < polygon.vertices.size(); ++j ) - { - cvf::Vec3d vm1 = polygon.vertices.back(); - cvf::Vec3d v = polygon.vertices[j]; - cvf::Vec3d vp1 = polygon.vertices.front(); - if ( j > 0u ) - { - vm1 = polygon.vertices[j - 1]; - } - if ( j < polygon.vertices.size() - 1 ) - { - vp1 = polygon.vertices[j + 1]; - } - // Only expand. - cvf::Vec3d modifiedVertex = 0.5 * ( v + 0.5 * ( vm1 + vp1 ) ); - cvf::Vec3d delta = modifiedVertex - v; - cvf::Vec3d tangent3d = vp1 - vm1; - cvf::Vec2d tangent2d( tangent3d.x(), tangent3d.y() ); - cvf::Vec3d norm3d( tangent2d.getNormalized().perpendicularVector() ); - if ( delta * norm3d > 0 && favourExpansion ) - { - // Normal is always inwards facing so a positive dot product means inward movement - // Favour expansion rather than contraction by only contracting by a fraction. - // The fraction is empirically found to give a decent result. - modifiedVertex = v + 0.2 * delta; - } - newVertices[j] = modifiedVertex; - maxChange = std::max( maxChange, ( modifiedVertex - v ).length() ); - } - polygon.vertices.swap( newVertices ); - if ( maxChange < sampleSpacing() * 1.0e-2 ) break; - } - } -} - -void RimContourMapProjection::clipContourPolygons( ContourPolygons* contourPolygons, const ContourPolygons* clipBy ) -{ - CVF_ASSERT( clipBy ); - for ( size_t i = 0; i < contourPolygons->size(); ++i ) - { - ContourPolygon& polygon = contourPolygons->at( i ); - for ( size_t j = 0; j < clipBy->size(); ++j ) - { - std::vector> intersections = - RigCellGeometryTools::intersectionWithPolygon( polygon.vertices, clipBy->at( j ).vertices ); - if ( !intersections.empty() ) - { - polygon.vertices = intersections.front(); - polygon.area = std::abs( cvf::GeometryTools::signedAreaPlanarPolygon( cvf::Vec3d::Z_AXIS, polygon.vertices ) ); - } - } - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -double RimContourMapProjection::sumPolygonArea( const ContourPolygons& contourPolygons ) -{ - double sumArea = 0.0; - for ( const ContourPolygon& polygon : contourPolygons ) - { - sumArea += polygon.area; - } - return sumArea; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h index 868cfdfc63..08ae48c18b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h +++ b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h @@ -20,7 +20,8 @@ #include "RimCheckableNamedObject.h" -#include "cafContourLines.h" +#include "RigContourPolygonsTools.h" + #include "cafPdmField.h" #include "cafPdmObject.h" @@ -43,14 +44,6 @@ class RimContourMapProjection : public RimCheckableNamedObject public: using CellIndexAndResult = std::pair; - struct ContourPolygon - { - std::vector vertices; - double value; - double area; - cvf::BoundingBox bbox; - }; - enum ResultAggregationEnum { RESULTS_TOP_VALUE, @@ -66,7 +59,7 @@ public: RESULTS_HC_COLUMN }; using ResultAggregation = caf::AppEnum; - using ContourPolygons = std::vector; + using ContourPolygons = std::vector; RimContourMapProjection(); ~RimContourMapProjection() override; @@ -164,10 +157,7 @@ protected: void generateVertexResults(); void generateTrianglesWithVertexValues(); void generateContourPolygons(); - ContourPolygons createContourPolygonsFromLineSegments( caf::ContourLines::ListOfLineSegments& unorderedLineSegments, double contourValue ); - void smoothContourPolygons( ContourPolygons* contourPolygons, bool favourExpansion ); - void clipContourPolygons( ContourPolygons* contourPolygons, const ContourPolygons* clipBy ); - static double sumPolygonArea( const ContourPolygons& contourPolygons ); + static double sumTriangleAreas( const std::vector& triangles ); std::vector cellOverlapVolumesAndResults( const cvf::Vec2d& globalPos2d, diff --git a/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake b/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake index be2bd970b6..8e9b8bd8cd 100644 --- a/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake +++ b/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake @@ -103,6 +103,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RigOsduWellLogData.h ${CMAKE_CURRENT_LIST_DIR}/RigWellTargetCandidatesGenerator.h ${CMAKE_CURRENT_LIST_DIR}/RigContourMapGrid.h + ${CMAKE_CURRENT_LIST_DIR}/RigContourPolygonsTools.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -204,6 +205,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RigOsduWellLogData.cpp ${CMAKE_CURRENT_LIST_DIR}/RigWellTargetCandidatesGenerator.cpp ${CMAKE_CURRENT_LIST_DIR}/RigContourMapGrid.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigContourPolygonsTools.cpp ) list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/ReservoirDataModel/RigContourPolygonsTools.cpp b/ApplicationLibCode/ReservoirDataModel/RigContourPolygonsTools.cpp new file mode 100644 index 0000000000..e859c873d7 --- /dev/null +++ b/ApplicationLibCode/ReservoirDataModel/RigContourPolygonsTools.cpp @@ -0,0 +1,188 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "RigContourPolygonsTools.h" + +#include "RigCellGeometryTools.h" + +#include "cafContourLines.h" + +#include "cvfGeometryTools.h" + +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigContourPolygonsTools::ContourPolygons + RigContourPolygonsTools::createContourPolygonsFromLineSegments( caf::ContourLines::ListOfLineSegments& unorderedLineSegments, + double contourValue, + double areaThreshold ) +{ + ContourPolygons contourPolygons; + + std::vector> polygons; + RigCellGeometryTools::createPolygonFromLineSegments( unorderedLineSegments, polygons, 1.0e-8 ); + for ( size_t j = 0; j < polygons.size(); ++j ) + { + double signedArea = cvf::GeometryTools::signedAreaPlanarPolygon( cvf::Vec3d::Z_AXIS, polygons[j] ); + ContourPolygon contourPolygon; + contourPolygon.value = contourValue; + if ( signedArea < 0.0 ) + { + contourPolygon.vertices.insert( contourPolygon.vertices.end(), polygons[j].rbegin(), polygons[j].rend() ); + } + else + { + contourPolygon.vertices = polygons[j]; + } + + contourPolygon.area = cvf::GeometryTools::signedAreaPlanarPolygon( cvf::Vec3d::Z_AXIS, contourPolygon.vertices ); + if ( contourPolygon.area > areaThreshold ) + { + for ( const cvf::Vec3d& vertex : contourPolygon.vertices ) + { + contourPolygon.bbox.add( vertex ); + } + contourPolygons.push_back( contourPolygon ); + } + } + return contourPolygons; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigContourPolygonsTools::smoothContourPolygons( ContourPolygons& contourPolygons, bool favourExpansion, double sampleSpacing ) +{ + for ( RigContourPolygonsTools::ContourPolygon& polygon : contourPolygons ) + { + for ( size_t n = 0; n < 20; ++n ) + { + std::vector newVertices; + newVertices.resize( polygon.vertices.size() ); + double maxChange = 0.0; + for ( size_t j = 0; j < polygon.vertices.size(); ++j ) + { + cvf::Vec3d vm1 = polygon.vertices.back(); + cvf::Vec3d v = polygon.vertices[j]; + cvf::Vec3d vp1 = polygon.vertices.front(); + if ( j > 0u ) + { + vm1 = polygon.vertices[j - 1]; + } + if ( j < polygon.vertices.size() - 1 ) + { + vp1 = polygon.vertices[j + 1]; + } + // Only expand. + cvf::Vec3d modifiedVertex = 0.5 * ( v + 0.5 * ( vm1 + vp1 ) ); + cvf::Vec3d delta = modifiedVertex - v; + cvf::Vec3d tangent3d = vp1 - vm1; + cvf::Vec2d tangent2d( tangent3d.x(), tangent3d.y() ); + cvf::Vec3d norm3d( tangent2d.getNormalized().perpendicularVector() ); + if ( delta * norm3d > 0 && favourExpansion ) + { + // Normal is always inwards facing so a positive dot product means inward movement + // Favour expansion rather than contraction by only contracting by a fraction. + // The fraction is empirically found to give a decent result. + modifiedVertex = v + 0.2 * delta; + } + newVertices[j] = modifiedVertex; + maxChange = std::max( maxChange, ( modifiedVertex - v ).length() ); + } + polygon.vertices.swap( newVertices ); + if ( maxChange < sampleSpacing * 1.0e-2 ) break; + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigContourPolygonsTools::clipContourPolygons( ContourPolygons& contourPolygons, const ContourPolygons& clipBy ) +{ + for ( RigContourPolygonsTools::ContourPolygon& polygon : contourPolygons ) + { + for ( const RigContourPolygonsTools::ContourPolygon& clipPolygon : contourPolygons ) + { + std::vector> intersections = + RigCellGeometryTools::intersectionWithPolygon( polygon.vertices, clipPolygon.vertices ); + if ( !intersections.empty() ) + { + polygon.vertices = intersections.front(); + polygon.area = std::abs( cvf::GeometryTools::signedAreaPlanarPolygon( cvf::Vec3d::Z_AXIS, polygon.vertices ) ); + } + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigContourPolygonsTools::sumPolygonArea( const ContourPolygons& contourPolygons ) +{ + double sumArea = 0.0; + for ( const ContourPolygon& polygon : contourPolygons ) + { + sumArea += polygon.area; + } + return sumArea; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RigContourPolygonsTools::lineOverlapsWithContourPolygons( const cvf::Vec3d& lineCenter, + const RigContourPolygonsTools::ContourPolygons& contourPolygons, + double tolerance ) +{ + const int64_t jump = 50; + for ( const RigContourPolygonsTools::ContourPolygon& edgePolygon : contourPolygons ) + { + std::pair closestIndex( 0, std::numeric_limits::infinity() ); + for ( int64_t i = 0; i < (int64_t)edgePolygon.vertices.size(); i += jump ) + { + const cvf::Vec3d& edgeVertex1 = edgePolygon.vertices[i]; + const cvf::Vec3d& edgeVertex2 = edgePolygon.vertices[( i + 1 ) % edgePolygon.vertices.size()]; + double dist1 = cvf::GeometryTools::linePointSquareDist( edgeVertex1, edgeVertex2, lineCenter ); + if ( dist1 < tolerance ) + { + return true; + } + if ( dist1 < closestIndex.second ) + { + closestIndex = std::make_pair( i, dist1 ); + } + } + + for ( int64_t i = std::max( (int64_t)1, closestIndex.first - jump + 1 ); + i < std::min( (int64_t)edgePolygon.vertices.size(), closestIndex.first + jump ); + ++i ) + { + const cvf::Vec3d& edgeVertex1 = edgePolygon.vertices[i]; + const cvf::Vec3d& edgeVertex2 = edgePolygon.vertices[( i + 1 ) % edgePolygon.vertices.size()]; + double dist1 = cvf::GeometryTools::linePointSquareDist( edgeVertex1, edgeVertex2, lineCenter ); + if ( dist1 < tolerance ) + { + return true; + } + } + } + return false; +} diff --git a/ApplicationLibCode/ReservoirDataModel/RigContourPolygonsTools.h b/ApplicationLibCode/ReservoirDataModel/RigContourPolygonsTools.h new file mode 100644 index 0000000000..c767dcd47a --- /dev/null +++ b/ApplicationLibCode/ReservoirDataModel/RigContourPolygonsTools.h @@ -0,0 +1,53 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "cafContourLines.h" + +#include "cvfBoundingBox.h" + +class RigContourMapGrid; +class RimGridView; +class RimRegularLegendConfig; + +//================================================================================================== +/// +/// +//================================================================================================== +class RigContourPolygonsTools +{ +public: + struct ContourPolygon + { + std::vector vertices; + double value; + double area; + cvf::BoundingBox bbox; + }; + + using ContourPolygons = std::vector; + + static ContourPolygons createContourPolygonsFromLineSegments( caf::ContourLines::ListOfLineSegments& unorderedLineSegments, + double contourValue, + double areaThreshold ); + static void smoothContourPolygons( ContourPolygons& contourPolygons, bool favourExpansion, double sampleSpacing ); + static void clipContourPolygons( ContourPolygons& contourPolygons, const ContourPolygons& clipBy ); + static double sumPolygonArea( const ContourPolygons& contourPolygons ); + static bool lineOverlapsWithContourPolygons( const cvf::Vec3d& lineCenter, const ContourPolygons& contourPolygons, double tolerance ); +}; From 205b29de3c2a8c2c9e38531bf44d1186f304c539 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 18 Oct 2024 13:17:09 +0200 Subject: [PATCH 045/160] Bump to dev.05 --- ResInsightVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index f87566a20e..9657cf5c2a 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -11,7 +11,7 @@ set(RESINSIGHT_VERSION_TEXT "-dev") # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -set(RESINSIGHT_DEV_VERSION ".04") +set(RESINSIGHT_DEV_VERSION ".05") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") From 04799e044e81ab4a60f6c975352bbe65a67051ca Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Sun, 20 Oct 2024 14:22:32 +0200 Subject: [PATCH 046/160] Fix missing prefix seen in unity builds --- .../ReservoirDataModel/RigContourMapGrid.cpp | 6 ++++-- .../ReservoirDataModel/RigContourMapGrid.h | 14 ++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/ApplicationLibCode/ReservoirDataModel/RigContourMapGrid.cpp b/ApplicationLibCode/ReservoirDataModel/RigContourMapGrid.cpp index c66502d478..3c250c9eba 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigContourMapGrid.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigContourMapGrid.cpp @@ -20,6 +20,8 @@ #include +using namespace cvf; + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -170,8 +172,8 @@ cvf::Vec2ui RigContourMapGrid::ijFromCellIndex( size_t cellIndex ) const //-------------------------------------------------------------------------------------------------- cvf::Vec2ui RigContourMapGrid::ijFromLocalPos( const cvf::Vec2d& localPos2d ) const { - uint i = localPos2d.x() / sampleSpacing(); - uint j = localPos2d.y() / sampleSpacing(); + uint i = static_cast( localPos2d.x() / sampleSpacing() ); + uint j = static_cast( localPos2d.y() / sampleSpacing() ); return cvf::Vec2ui( i, j ); } diff --git a/ApplicationLibCode/ReservoirDataModel/RigContourMapGrid.h b/ApplicationLibCode/ReservoirDataModel/RigContourMapGrid.h index 4027c5f38c..89cc155d50 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigContourMapGrid.h +++ b/ApplicationLibCode/ReservoirDataModel/RigContourMapGrid.h @@ -21,6 +21,8 @@ #include "cvfBoundingBox.h" #include "cvfVector2.h" +using namespace cvf; + //================================================================================================== /// /// @@ -36,9 +38,9 @@ public: cvf::Vec2ui numberOfElementsIJ() const; cvf::Vec2ui numberOfVerticesIJ() const; - uint numberOfCells() const; - uint numberOfValidCells() const; - size_t numberOfVertices() const; + cvf::uint numberOfCells() const; + cvf::uint numberOfValidCells() const; + size_t numberOfVertices() const; cvf::Vec3d origin3d() const; @@ -48,12 +50,12 @@ public: std::vector generateVertices() const; // Cell index and position conversion - size_t cellIndexFromIJ( uint i, uint j ) const; - size_t vertexIndexFromIJ( uint i, uint j ) const; + size_t cellIndexFromIJ( cvf::uint i, cvf::uint j ) const; + size_t vertexIndexFromIJ( cvf::uint i, cvf::uint j ) const; cvf::Vec2ui ijFromVertexIndex( size_t gridIndex ) const; cvf::Vec2ui ijFromCellIndex( size_t mapIndex ) const; cvf::Vec2ui ijFromLocalPos( const cvf::Vec2d& localPos2d ) const; - cvf::Vec2d cellCenterPosition( uint i, uint j ) const; + cvf::Vec2d cellCenterPosition( cvf::uint i, cvf::uint j ) const; cvf::Vec2d origin2d() const; double gridEdgeOffset() const; From 77c789a179cb59c12f813680cfeacf71559e5ab7 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Sun, 20 Oct 2024 14:24:22 +0200 Subject: [PATCH 047/160] Improve performance when creating multiple plots --- .../RiaPlotWindowRedrawScheduler.cpp | 22 ++++++++++++++ .../RiaPlotWindowRedrawScheduler.h | 4 +++ ...RicAppendSummaryPlotsForObjectsFeature.cpp | 29 +++++++++++++++++-- 3 files changed, 53 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp index 1f4e955dba..5133e6f579 100644 --- a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp +++ b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp @@ -146,11 +146,33 @@ void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaPlotWindowRedrawScheduler::blockScheduledUpdatesAndReplots() +{ + m_blockScheduledUpdatesAndReplots = true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaPlotWindowRedrawScheduler::unblockScheduledUpdatesAndReplots() +{ + m_blockScheduledUpdatesAndReplots = false; + startTimer( 0 ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RiaPlotWindowRedrawScheduler::slotUpdateAndReplotScheduledItemsWhenReady() { + if ( m_blockScheduledUpdatesAndReplots ) + { + return; + } + if ( caf::ProgressState::isActive() ) { startTimer( 100 ); diff --git a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.h b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.h index e07a6c8d2d..0b540c261f 100644 --- a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.h +++ b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.h @@ -48,6 +48,9 @@ public: void clearAllScheduledUpdates(); void performScheduledUpdatesAndReplots(); + void blockScheduledUpdatesAndReplots(); + void unblockScheduledUpdatesAndReplots(); + private slots: void slotUpdateAndReplotScheduledItemsWhenReady(); @@ -64,4 +67,5 @@ private: std::set> m_plotWidgetsToReplot; QScopedPointer m_plotWindowUpdateTimer; + bool m_blockScheduledUpdatesAndReplots = false; }; diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp index 6baa1de7bd..9139b82ca0 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp @@ -20,6 +20,7 @@ #include "RiaGuiApplication.h" #include "RiaLogging.h" +#include "RiaPlotWindowRedrawScheduler.h" #include "RiaStdStringTools.h" #include "RiaSummaryAddressAnalyzer.h" #include "RiaSummaryTools.h" @@ -68,6 +69,9 @@ void RicAppendSummaryPlotsForObjectsFeature::appendPlots( RimSummaryMultiPlot* caf::ProgressInfo info( sumAddressCollections.size(), "Appending plots..." ); + summaryMultiPlot->startBatchAddOperation(); + RiaPlotWindowRedrawScheduler::instance()->blockScheduledUpdatesAndReplots(); + for ( auto summaryAdrCollection : sumAddressCollections ) { auto duplicatedPlots = RicSummaryPlotBuilder::duplicateSummaryPlots( plotsForOneInstance ); @@ -108,11 +112,16 @@ void RicAppendSummaryPlotsForObjectsFeature::appendPlots( RimSummaryMultiPlot* summaryMultiPlot->addPlot( duplicatedPlot ); duplicatedPlot->resolveReferencesRecursively(); } - - duplicatedPlot->loadDataAndUpdate(); } + info.incrementProgress(); } + summaryMultiPlot->endBatchAddOperation(); + + RiaPlotWindowRedrawScheduler::instance()->clearAllScheduledUpdates(); + RiaPlotWindowRedrawScheduler::instance()->unblockScheduledUpdatesAndReplots(); + + summaryMultiPlot->loadDataAndUpdate(); summaryMultiPlot->updatePlotTitles(); } @@ -273,6 +282,13 @@ bool RicAppendSummaryPlotsForObjectsFeature::isSelectionCompatibleWithPlot( cons errorText = "Source plot must contain at least one region to be able to duplicate a selection of regions"; } } + else if ( selectionType == RimSummaryAddressCollection::CollectionContentType::NETWORK ) + { + if ( analyzer.networkNames().empty() ) + { + errorText = "Source plot must contain at least one network to be able to duplicate a selection of networks"; + } + } if ( !errorText.isEmpty() ) { @@ -294,6 +310,7 @@ std::vector std::string wellNameToMatch; std::string groupNameToMatch; + std::string networkNameToMatch; int regionToMatch = -1; int caseIdToMatch = -1; int ensembleIdToMatch = -1; @@ -317,6 +334,10 @@ std::vector { if ( !myAnalyser.regionNumbers().empty() ) regionToMatch = *( myAnalyser.regionNumbers().begin() ); } + else if ( objectType == RimSummaryAddressCollection::CollectionContentType::NETWORK ) + { + if ( !myAnalyser.networkNames().empty() ) networkNameToMatch = *( myAnalyser.networkNames().begin() ); + } else if ( objectType == RimSummaryAddressCollection::CollectionContentType::SUMMARY_CASE ) { if ( !sourcePlots.empty() ) @@ -368,6 +389,10 @@ std::vector { isMatching = true; } + else if ( !networkNameToMatch.empty() && a.networkName() == networkNameToMatch ) + { + isMatching = true; + } else if ( regionToMatch != -1 && a.regionNumber() == regionToMatch ) { isMatching = true; From 2aaea1e6dba38b06e55ea292ede95d1394c7d8a9 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Sun, 20 Oct 2024 14:25:00 +0200 Subject: [PATCH 048/160] Fix crash when curve data is missing --- .../ProjectDataModel/Summary/RimSummaryMultiPlot.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 8006475053..92afd9b93c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -1172,10 +1172,11 @@ void RimSummaryMultiPlot::updatePlotVisibility() { for ( auto curve : plot->summaryAndEnsembleCurves() ) { - auto address = curve->valuesY(); - auto maxValue = std::max_element( address.begin(), address.end() ); + auto values = curve->valuesY(); + if ( values.empty() ) continue; - if ( *maxValue > limit ) return true; + auto maxValue = std::max_element( values.begin(), values.end() ); + if ( maxValue != values.end() && ( *maxValue > limit ) ) return true; } return false; From c3d60869bd34ecf9bf58cd436d4d3dec31ccabb1 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Sun, 20 Oct 2024 14:26:54 +0200 Subject: [PATCH 049/160] Improve support for network vectors Show all text if summary address contains multiple : for network addresses Consolidate replace of tokens in summary address --- .../Application/RiaSummaryCurveDefinition.cpp | 33 ++++------ .../RifEclipseSummaryAddress.cpp | 15 ++++- .../Summary/RimSummaryAddressCollection.cpp | 49 ++++++++++++++ .../Summary/RimSummaryAddressCollection.h | 4 ++ .../Summary/RimSummaryAddressModifier.cpp | 66 +++++++++++++++---- .../Summary/RimSummaryAddressModifier.h | 15 +++-- 6 files changed, 138 insertions(+), 44 deletions(-) diff --git a/ApplicationLibCode/Application/RiaSummaryCurveDefinition.cpp b/ApplicationLibCode/Application/RiaSummaryCurveDefinition.cpp index 274c2973d7..bceae459e1 100644 --- a/ApplicationLibCode/Application/RiaSummaryCurveDefinition.cpp +++ b/ApplicationLibCode/Application/RiaSummaryCurveDefinition.cpp @@ -22,6 +22,7 @@ #include "RifSummaryReaderInterface.h" +#include "RimSummaryAddressModifier.h" #include "RimSummaryCase.h" #include "RimSummaryEnsemble.h" @@ -175,29 +176,19 @@ void RiaSummaryCurveDefinition::setIdentifierText( SummaryCategory category, con { if ( RifEclipseSummaryAddress::isDependentOnWellName( category ) ) { - m_summaryAddressY.setWellName( name ); - m_summaryAddressX.setWellName( name ); + m_summaryAddressX = + RimSummaryAddressModifier::replaceTokenForCategory( m_summaryAddressX, + name, + RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_WELL ); + m_summaryAddressY = + RimSummaryAddressModifier::replaceTokenForCategory( m_summaryAddressY, + name, + RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_WELL ); } - - int id = RiaStdStringTools::toInt( name ); - - switch ( category ) + else { - case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_AQUIFER: - m_summaryAddressY.setAquiferNumber( id ); - m_summaryAddressX.setAquiferNumber( id ); - break; - case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_REGION: - case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_REGION_2_REGION: - m_summaryAddressY.setRegion( id ); - m_summaryAddressX.setRegion( id ); - break; - case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_GROUP: - m_summaryAddressY.setGroupName( name ); - m_summaryAddressX.setGroupName( name ); - break; - default: - break; + m_summaryAddressX = RimSummaryAddressModifier::replaceTokenForCategory( m_summaryAddressX, name, m_summaryAddressX.category() ); + m_summaryAddressY = RimSummaryAddressModifier::replaceTokenForCategory( m_summaryAddressY, name, m_summaryAddressY.category() ); } } diff --git a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp index 1f3dcc0a34..224620949e 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp @@ -1034,8 +1034,19 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromTokens( const std::vector break; case SummaryCategory::SUMMARY_NETWORK: - return networkAddress( vectorName, token1 ); - break; + { + auto aggregated = token1; + if ( !token2.empty() ) + { + // Network name can contain more than one token. Concatenate tokens using : as separator + // https://github.com/OPM/ResInsight/issues/11785 + aggregated += ":"; + aggregated += token2; + } + + return networkAddress( vectorName, aggregated ); + } + break; case SummaryCategory::SUMMARY_MISC: return miscAddress( vectorName ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp index b35beca11e..3ee7a48258 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp @@ -59,6 +59,55 @@ void caf::AppEnum::setUp() CAF_PDM_SOURCE_INIT( RimSummaryAddressCollection, "RimSummaryAddressCollection" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RifEclipseSummaryAddressDefines::SummaryCategory RimSummaryAddressCollection::contentTypeToSummaryCategory( CollectionContentType contentType ) +{ + switch ( contentType ) + { + case CollectionContentType::WELL: + return SummaryCategory::SUMMARY_WELL; + case CollectionContentType::GROUP: + return SummaryCategory::SUMMARY_GROUP; + case CollectionContentType::REGION: + return SummaryCategory::SUMMARY_REGION; + case CollectionContentType::FIELD: + return SummaryCategory::SUMMARY_FIELD; + case CollectionContentType::MISC: + return SummaryCategory::SUMMARY_MISC; + case CollectionContentType::AQUIFER: + return SummaryCategory::SUMMARY_AQUIFER; + case CollectionContentType::NETWORK: + return SummaryCategory::SUMMARY_NETWORK; + case CollectionContentType::REGION_2_REGION: + return SummaryCategory::SUMMARY_REGION_2_REGION; + case CollectionContentType::WELL_COMPLETION: + return SummaryCategory::SUMMARY_WELL_COMPLETION; + case CollectionContentType::WELL_LGR: + return SummaryCategory::SUMMARY_WELL_LGR; + case CollectionContentType::WELL_COMPLETION_LGR: + return SummaryCategory::SUMMARY_WELL_COMPLETION_LGR; + case CollectionContentType::WELL_SEGMENT: + return SummaryCategory::SUMMARY_WELL_SEGMENT; + case CollectionContentType::BLOCK: + return SummaryCategory::SUMMARY_BLOCK; + case CollectionContentType::BLOCK_LGR: + return SummaryCategory::SUMMARY_BLOCK_LGR; + case CollectionContentType::IMPORTED: + return SummaryCategory::SUMMARY_IMPORTED; + case CollectionContentType::CALCULATED: + case CollectionContentType::NOT_DEFINED: + case CollectionContentType::WELL_FOLDER: + case CollectionContentType::GROUP_FOLDER: + case CollectionContentType::REGION_FOLDER: + case CollectionContentType::NETWORK_FOLDER: + case CollectionContentType::SUMMARY_CASE: + default: + return SummaryCategory::SUMMARY_INVALID; + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h index 274b923dda..ee54ad5301 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h @@ -19,6 +19,8 @@ #include "RimNamedObject.h" +#include "RifEclipseSummaryAddressDefines.h" + #include "cafPdmChildArrayField.h" #include @@ -59,6 +61,8 @@ public: IMPORTED }; + static RifEclipseSummaryAddressDefines::SummaryCategory contentTypeToSummaryCategory( CollectionContentType contentType ); + public: RimSummaryAddressCollection(); ~RimSummaryAddressCollection() override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressModifier.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressModifier.cpp index 039f807072..235e16314c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressModifier.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressModifier.cpp @@ -30,28 +30,32 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseSummaryAddress RimSummaryAddressModifier::replaceObjectName( const RifEclipseSummaryAddress& sourceAdr, - std::string objectName, - RimSummaryAddressCollection::CollectionContentType contentType ) +RifEclipseSummaryAddress RimSummaryAddressModifier::replaceTokenForCategory( const RifEclipseSummaryAddress& sourceAdr, + const std::string& token, + RifEclipseSummaryAddressDefines::SummaryCategory contentType ) { auto adr = sourceAdr; - if ( contentType == RimSummaryAddressCollection::CollectionContentType::WELL ) + if ( contentType == RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_WELL ) { - adr.setWellName( objectName ); + adr.setWellName( token ); } - else if ( contentType == RimSummaryAddressCollection::CollectionContentType::GROUP ) + else if ( contentType == RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_GROUP ) { - adr.setGroupName( objectName ); + adr.setGroupName( token ); } - else if ( contentType == RimSummaryAddressCollection::CollectionContentType::REGION ) + else if ( contentType == RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_NETWORK ) { - int intValue = RiaStdStringTools::toInt( objectName ); - if ( intValue == -1 ) + adr.setNetworkName( token ); + } + else if ( contentType == RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_REGION ) + { + int intValue = -1; + if ( !RiaStdStringTools::toInt( token, intValue ) ) { QString errorText = QString( "Failed to convert region text to region integer value " "for region text : %1" ) - .arg( QString::fromStdString( objectName ) ); + .arg( QString::fromStdString( token ) ); RiaLogging::error( errorText ); } @@ -60,6 +64,38 @@ RifEclipseSummaryAddress RimSummaryAddressModifier::replaceObjectName( const Rif adr.setRegion( intValue ); } } + else if ( contentType == RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_REGION_2_REGION ) + { + int intValue = -1; + if ( !RiaStdStringTools::toInt( token, intValue ) ) + { + QString errorText = QString( "Failed to convert region text to region integer value " + "for region text : %1" ) + .arg( QString::fromStdString( token ) ); + + RiaLogging::error( errorText ); + } + else + { + adr.setRegion2( intValue ); + } + } + else if ( contentType == RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_AQUIFER ) + { + int intValue = -1; + if ( !RiaStdStringTools::toInt( token, intValue ) ) + { + QString errorText = QString( "Failed to convert aquifer text to aquifer integer value " + "for aquifer text : %1" ) + .arg( QString::fromStdString( token ) ); + + RiaLogging::error( errorText ); + } + else + { + adr.setAquiferNumber( intValue ); + } + } return adr; } @@ -151,18 +187,20 @@ void RimSummaryAddressModifier::updateAddressesByObjectName( const std::vector Date: Mon, 21 Oct 2024 12:52:42 +0200 Subject: [PATCH 050/160] Move Show Disks from Visibility group into Disk group --- .../ProjectDataModel/RimSimWellInViewCollection.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp index cf14080a43..93e085a1cb 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp @@ -151,7 +151,6 @@ RimSimWellInViewCollection::RimSimWellInViewCollection() CAF_PDM_InitFieldNoDefault( &m_showWellLabel, "ShowWellLabelTristate", "Label" ); CAF_PDM_InitFieldNoDefault( &m_showWellPipe, "ShowWellPipe", "Pipe" ); CAF_PDM_InitFieldNoDefault( &m_showWellSpheres, "ShowWellSpheres", "Spheres" ); - CAF_PDM_InitFieldNoDefault( &m_showWellDisks, "ShowWellDisks", "Disks" ); m_showWellHead.uiCapability()->setUiEditorTypeName( caf::PdmUiCheckBoxTristateEditor::uiEditorTypeName() ); m_showWellHead.xmlCapability()->disableIO(); @@ -165,9 +164,6 @@ RimSimWellInViewCollection::RimSimWellInViewCollection() m_showWellSpheres.uiCapability()->setUiEditorTypeName( caf::PdmUiCheckBoxTristateEditor::uiEditorTypeName() ); m_showWellSpheres.xmlCapability()->disableIO(); - m_showWellDisks.uiCapability()->setUiEditorTypeName( caf::PdmUiCheckBoxTristateEditor::uiEditorTypeName() ); - m_showWellDisks.xmlCapability()->disableIO(); - // Scaling CAF_PDM_InitField( &wellHeadScaleFactor, "WellHeadScale", 1.0, "Well Head Scale" ); CAF_PDM_InitField( &wellHeadPositionScaleFactor, "WellHeadPositionScaleFactor", 0.1, "Well Head Position Scale" ); @@ -213,6 +209,10 @@ RimSimWellInViewCollection::RimSimWellInViewCollection() CAF_PDM_InitField( &m_showWellValves, "ShowWellValvesTristate", true, "Valves" ); + CAF_PDM_InitFieldNoDefault( &m_showWellDisks, "ShowWellDisks", "Show Disks" ); + m_showWellDisks.uiCapability()->setUiEditorTypeName( caf::PdmUiCheckBoxTristateEditor::uiEditorTypeName() ); + m_showWellDisks.xmlCapability()->disableIO(); + CAF_PDM_InitFieldNoDefault( &m_wellDiskSummaryCase, "WellDiskSummaryCase", "Summary Case" ); CAF_PDM_InitField( &m_wellDiskQuantity, "WellDiskQuantity", QString( "WOPT" ), "Disk Quantity" ); @@ -623,7 +623,6 @@ void RimSimWellInViewCollection::defineUiOrdering( QString uiConfigName, caf::Pd appearanceGroup->add( &m_showWellHead ); appearanceGroup->add( &m_showWellPipe ); appearanceGroup->add( &m_showWellSpheres ); - appearanceGroup->add( &m_showWellDisks ); appearanceGroup->add( &m_showWellCommunicationLines ); appearanceGroup->add( &m_showWellValves ); @@ -665,6 +664,7 @@ void RimSimWellInViewCollection::defineUiOrdering( QString uiConfigName, caf::Pd { caf::PdmUiGroup* wellDiskGroup = uiOrdering.addNewGroup( "Disks" ); + wellDiskGroup->add( &m_showWellDisks ); if ( !m_wellDiskSummaryCase() ) { From b0d967ff40ed3f82183566d04ca8069526219e4c Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 21 Oct 2024 14:08:15 +0200 Subject: [PATCH 051/160] Preparations for quick access features * Add tool button editor with callback support * Guard null pointer usage * Allow proxy field with no getter * Remove duplicated code --- .../cafPdmCore/cafPdmProxyValueField.h | 3 +- .../cafPdmCore/cafPdmReferenceHelper.cpp | 29 ++--- .../cafPdmCore/cafPdmReferenceHelper.h | 2 - Fwk/AppFwk/cafUserInterface/CMakeLists.txt | 3 + .../cafPdmUiPushButtonEditor.cpp | 8 +- .../cafPdmUiToolButtonCallbackEditor.cpp | 102 ++++++++++++++++++ .../cafPdmUiToolButtonCallbackEditor.h | 87 +++++++++++++++ 7 files changed, 205 insertions(+), 29 deletions(-) create mode 100644 Fwk/AppFwk/cafUserInterface/cafPdmUiToolButtonCallbackEditor.cpp create mode 100644 Fwk/AppFwk/cafUserInterface/cafPdmUiToolButtonCallbackEditor.h diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmProxyValueField.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmProxyValueField.h index ba76be2b59..fff51ad7ee 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmProxyValueField.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmProxyValueField.h @@ -74,7 +74,8 @@ public: } DataType value() const { - CAF_ASSERT( m_valueGetter ); + if ( !m_valueGetter ) return DataType(); + return m_valueGetter->getValue(); } diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmReferenceHelper.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmReferenceHelper.cpp index 1b5f0d9f58..c2f6aec6bf 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmReferenceHelper.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmReferenceHelper.cpp @@ -96,26 +96,6 @@ PdmObjectHandle* PdmReferenceHelper::objectFromReference( PdmObjectHandle* root, return objectFromReferenceStringList( root, decodedReference ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -PdmFieldHandle* PdmReferenceHelper::findField( PdmObjectHandle* object, const QString& fieldKeyword ) -{ - if ( object == nullptr ) return nullptr; - - std::vector fields = object->fields(); - - for ( size_t i = 0; i < fields.size(); i++ ) - { - if ( fields[i]->keyword() == fieldKeyword ) - { - return fields[i]; - } - } - - return nullptr; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -194,7 +174,9 @@ PdmFieldHandle* PdmReferenceHelper::fieldFromReference( PdmObjectHandle* root, c decodedReference.pop_front(); PdmObjectHandle* parentObject = objectFromReferenceStringList( root, decodedReference ); - return findField( parentObject, fieldKeyword ); + if ( !parentObject ) return nullptr; + + return parentObject->findField( fieldKeyword ); } //-------------------------------------------------------------------------------------------------- @@ -209,9 +191,10 @@ PdmObjectHandle* PdmReferenceHelper::objectFromReferenceStringList( PdmObjectHan int i = 0; while ( i < reference.size() ) { - QString fieldKeyword = reference.at( i++ ); + if ( !currentObject ) return nullptr; - PdmFieldHandle* fieldHandle = findField( currentObject, fieldKeyword ); + QString fieldKeyword = reference.at( i++ ); + auto fieldHandle = currentObject->findField( fieldKeyword ); if ( !fieldHandle ) { return nullptr; diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmReferenceHelper.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmReferenceHelper.h index 50ce298a44..24aef773df 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmReferenceHelper.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmReferenceHelper.h @@ -60,8 +60,6 @@ public: private: static QStringList referenceFromRootToObjectAsStringList( PdmObjectHandle* root, PdmObjectHandle* obj ); static PdmObjectHandle* objectFromReferenceStringList( PdmObjectHandle* root, const QStringList& reference ); - - static PdmFieldHandle* findField( PdmObjectHandle* object, const QString& fieldKeyword ); }; } // end namespace caf diff --git a/Fwk/AppFwk/cafUserInterface/CMakeLists.txt b/Fwk/AppFwk/cafUserInterface/CMakeLists.txt index ae7afa59d9..fc64500a6b 100644 --- a/Fwk/AppFwk/cafUserInterface/CMakeLists.txt +++ b/Fwk/AppFwk/cafUserInterface/CMakeLists.txt @@ -37,6 +37,7 @@ set(MOC_HEADER_FILES cafPdmUiTableViewQModel.h cafPdmUiTextEditor.h cafPdmUiToolButtonEditor.h + cafPdmUiToolButtonCallbackEditor.h cafPdmUiTreeView.h cafPdmUiTreeViewQModel.h cafPdmUiTreeViewEditor.h @@ -100,6 +101,8 @@ set(PROJECT_FILES cafPdmUiToolBarEditor.h cafPdmUiToolButtonEditor.cpp cafPdmUiToolButtonEditor.h + cafPdmUiToolButtonCallbackEditor.cpp + cafPdmUiToolButtonCallbackEditor.h cafPdmUiTreeSelectionEditor.h cafPdmUiTreeSelectionEditor.cpp cafPdmUiTreeSelectionQModel.h diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.cpp index 091eaa7727..6c889f3534 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.cpp @@ -57,10 +57,12 @@ CAF_PDM_UI_FIELD_EDITOR_SOURCE_INIT( PdmUiPushButtonEditor ); //-------------------------------------------------------------------------------------------------- void PdmUiPushButtonEditor::configureAndUpdateUi( const QString& uiConfigName ) { - CAF_ASSERT( !m_pushButton.isNull() ); - CAF_ASSERT( !m_label.isNull() ); + if ( !m_pushButton ) return; - PdmUiFieldEditorHandle::updateLabelFromField( m_label, uiConfigName ); + if ( m_label ) + { + PdmUiFieldEditorHandle::updateLabelFromField( m_label, uiConfigName ); + } m_pushButton->setCheckable( true ); m_pushButton->setEnabled( !uiField()->isUiReadOnly( uiConfigName ) ); diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiToolButtonCallbackEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiToolButtonCallbackEditor.cpp new file mode 100644 index 0000000000..380a7799b3 --- /dev/null +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiToolButtonCallbackEditor.cpp @@ -0,0 +1,102 @@ +//################################################################################################## +// +// Custom Visualization Core library +// Copyright (C) 2014 Ceetron Solutions AS +// +// This library may be used under the terms of either the GNU General Public License or +// the GNU Lesser General Public License as follows: +// +// GNU General Public License Usage +// This library 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. +// +// This library 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. +// +// GNU Lesser General Public License Usage +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This library 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 Lesser General Public License at <> +// for more details. +// +//################################################################################################## + +#include "cafPdmUiToolButtonCallbackEditor.h" + +#include "cafPdmFieldHandle.h" +#include "cafPdmObjectHandle.h" +#include "cafPdmUiFieldHandle.h" +#include "cafPdmUiObjectHandle.h" + +namespace caf +{ +CAF_PDM_UI_FIELD_EDITOR_SOURCE_INIT( PdmUiToolButtonCallbackEditor ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void PdmUiToolButtonCallbackEditor::configureAndUpdateUi( const QString& uiConfigName ) +{ + CAF_ASSERT( !m_toolButton.isNull() ); + + if ( auto ic = uiField()->uiIcon( uiConfigName ) ) + { + m_toolButton->setIcon( *ic ); + } + + QString buttonText = uiField()->uiName( uiConfigName ); + m_toolButton->setText( buttonText ); + + m_toolButton->setEnabled( !uiField()->isUiReadOnly( uiConfigName ) ); + m_toolButton->setToolTip( uiField()->uiToolTip( uiConfigName ) ); + + if ( auto pdmUiOjectHandle = uiObj( uiField()->fieldHandle()->ownerObject() ) ) + { + pdmUiOjectHandle->editorAttribute( uiField()->fieldHandle(), uiConfigName, &m_attributes ); + } + m_toolButton->setCheckable( false ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QWidget* PdmUiToolButtonCallbackEditor::createEditorWidget( QWidget* parent ) +{ + m_toolButton = new QToolButton( parent ); + connect( m_toolButton, SIGNAL( clicked( bool ) ), this, SLOT( slotClicked( bool ) ) ); + return m_toolButton; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QWidget* PdmUiToolButtonCallbackEditor::createLabelWidget( QWidget* parent ) +{ + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void PdmUiToolButtonCallbackEditor::slotClicked( bool checked ) +{ + if ( m_attributes.m_onClickedCallback ) + { + m_attributes.m_onClickedCallback(); + } +} + +} // end namespace caf diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiToolButtonCallbackEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiToolButtonCallbackEditor.h new file mode 100644 index 0000000000..95275077d8 --- /dev/null +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiToolButtonCallbackEditor.h @@ -0,0 +1,87 @@ +//################################################################################################## +// +// Custom Visualization Core library +// Copyright (C) 2014 Ceetron Solutions AS +// +// This library may be used under the terms of either the GNU General Public License or +// the GNU Lesser General Public License as follows: +// +// GNU General Public License Usage +// This library 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. +// +// This library 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. +// +// GNU Lesser General Public License Usage +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This library 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 Lesser General Public License at <> +// for more details. +// +//################################################################################################## + +#pragma once + +#include "cafPdmUiFieldEditorHandle.h" + +#include +#include +#include + +#include + +namespace caf +{ +class PdmUiToolButtonCallbackEditorAttribute : public PdmUiEditorAttribute +{ +public: + PdmUiToolButtonCallbackEditorAttribute() {} + + // Usage: + // In the class having a proxyfield connected to a bool + // In defineEditorAttributes: + // attr->setCallback( std::bind( &MyClass::myFunctionToBeCalled, this ) ); + // + void setCallback( std::function callback ) { m_onClickedCallback = callback; } + +public: + std::function m_onClickedCallback; +}; + +class PdmUiToolButtonCallbackEditor : public PdmUiFieldEditorHandle +{ + Q_OBJECT + CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; + +public: + PdmUiToolButtonCallbackEditor() {} + ~PdmUiToolButtonCallbackEditor() override {} + +protected: + QWidget* createEditorWidget( QWidget* parent ) override; + QWidget* createLabelWidget( QWidget* parent ) override; + void configureAndUpdateUi( const QString& uiConfigName ) override; + +protected slots: + void slotClicked( bool checked ); + +private: + QPointer m_toolButton; + PdmUiToolButtonCallbackEditorAttribute m_attributes; +}; + +} // end namespace caf From 4ff5aaf381e716e1cc7dcb85b89025f266fcb35b Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 18 Oct 2024 14:25:04 +0200 Subject: [PATCH 052/160] Add quick access data model objects --- .../Application/CMakeLists_files.cmake | 2 + .../Application/RiaQuickAccessScheduler.cpp | 58 ++++ .../Application/RiaQuickAccessScheduler.h | 33 ++ ApplicationLibCode/CMakeLists.txt | 1 + .../QuickAccess/CMakeLists_files.cmake | 18 ++ .../QuickAccess/RimFieldQuickAccess.cpp | 178 +++++++++++ .../QuickAccess/RimFieldQuickAccess.h | 63 ++++ .../QuickAccess/RimFieldQuickAccessGroup.cpp | 156 ++++++++++ .../QuickAccess/RimFieldQuickAccessGroup.h | 62 ++++ .../RimFieldQuickAccessInterface.h | 36 +++ .../QuickAccess/RimFieldReference.cpp | 196 ++++++++++++ .../QuickAccess/RimFieldReference.h | 62 ++++ .../QuickAccess/RimQuickAccessCollection.cpp | 285 ++++++++++++++++++ .../QuickAccess/RimQuickAccessCollection.h | 60 ++++ .../ProjectDataModel/RimProject.cpp | 13 +- .../ProjectDataModel/RimProject.h | 6 +- 16 files changed, 1227 insertions(+), 2 deletions(-) create mode 100644 ApplicationLibCode/Application/RiaQuickAccessScheduler.cpp create mode 100644 ApplicationLibCode/Application/RiaQuickAccessScheduler.h create mode 100644 ApplicationLibCode/ProjectDataModel/QuickAccess/CMakeLists_files.cmake create mode 100644 ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccess.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccess.h create mode 100644 ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccessGroup.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccessGroup.h create mode 100644 ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccessInterface.h create mode 100644 ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldReference.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldReference.h create mode 100644 ApplicationLibCode/ProjectDataModel/QuickAccess/RimQuickAccessCollection.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/QuickAccess/RimQuickAccessCollection.h diff --git a/ApplicationLibCode/Application/CMakeLists_files.cmake b/ApplicationLibCode/Application/CMakeLists_files.cmake index ea2ea6c50d..3fdac472c4 100644 --- a/ApplicationLibCode/Application/CMakeLists_files.cmake +++ b/ApplicationLibCode/Application/CMakeLists_files.cmake @@ -40,6 +40,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaCloudDefines.h ${CMAKE_CURRENT_LIST_DIR}/RiaWellFlowDefines.h ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveAddress.h + ${CMAKE_CURRENT_LIST_DIR}/RiaQuickAccessScheduler.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -84,6 +85,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaCloudDefines.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaWellFlowDefines.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveAddress.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiaQuickAccessScheduler.cpp ) list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/Application/RiaQuickAccessScheduler.cpp b/ApplicationLibCode/Application/RiaQuickAccessScheduler.cpp new file mode 100644 index 0000000000..4ead48ed00 --- /dev/null +++ b/ApplicationLibCode/Application/RiaQuickAccessScheduler.cpp @@ -0,0 +1,58 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- 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 "RiaQuickAccessScheduler.h" + +#include "QuickAccess/RimQuickAccessCollection.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaQuickAccessScheduler::RiaQuickAccessScheduler() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaQuickAccessScheduler* RiaQuickAccessScheduler::instance() +{ + static RiaQuickAccessScheduler theInstance; + + return &theInstance; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaQuickAccessScheduler::scheduleDisplayModelUpdateAndRedraw() +{ + startTimer( 0 ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaQuickAccessScheduler::performScheduledUpdates() +{ + auto quickColl = RimQuickAccessCollection::instance(); + if ( quickColl ) + { + quickColl->updateAllRequiredEditors(); + } +} diff --git a/ApplicationLibCode/Application/RiaQuickAccessScheduler.h b/ApplicationLibCode/Application/RiaQuickAccessScheduler.h new file mode 100644 index 0000000000..22cccd4eb4 --- /dev/null +++ b/ApplicationLibCode/Application/RiaQuickAccessScheduler.h @@ -0,0 +1,33 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- 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 "RiaScheduler.h" + +class RiaQuickAccessScheduler : public RiaScheduler +{ +public: + RiaQuickAccessScheduler(); + + static RiaQuickAccessScheduler* instance(); + + void scheduleDisplayModelUpdateAndRedraw(); + + void performScheduledUpdates() override; +}; diff --git a/ApplicationLibCode/CMakeLists.txt b/ApplicationLibCode/CMakeLists.txt index d243e3b398..3172fe9010 100644 --- a/ApplicationLibCode/CMakeLists.txt +++ b/ApplicationLibCode/CMakeLists.txt @@ -128,6 +128,7 @@ list( ProjectDataModelCommands/CMakeLists_files.cmake ProjectDataModelCommands/CommandRouter/CMakeLists_files.cmake ProjectDataModel/VerticalFlowPerformance/CMakeLists_files.cmake + ProjectDataModel/QuickAccess/CMakeLists_files.cmake GeoMech/GeoMechVisualization/CMakeLists_files.cmake ModelVisualization/CMakeLists_files.cmake ModelVisualization/Faults/CMakeLists_files.cmake diff --git a/ApplicationLibCode/ProjectDataModel/QuickAccess/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/QuickAccess/CMakeLists_files.cmake new file mode 100644 index 0000000000..2599c59cda --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/QuickAccess/CMakeLists_files.cmake @@ -0,0 +1,18 @@ +set(SOURCE_GROUP_HEADER_FILES + ${CMAKE_CURRENT_LIST_DIR}/RimFieldQuickAccess.h + ${CMAKE_CURRENT_LIST_DIR}/RimFieldQuickAccessGroup.h + ${CMAKE_CURRENT_LIST_DIR}/RimFieldQuickAccessInterface.h + ${CMAKE_CURRENT_LIST_DIR}/RimFieldReference.h + ${CMAKE_CURRENT_LIST_DIR}/RimQuickAccessCollection.h +) + +set(SOURCE_GROUP_SOURCE_FILES + ${CMAKE_CURRENT_LIST_DIR}/RimFieldQuickAccess.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimFieldQuickAccessGroup.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimFieldReference.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimQuickAccessCollection.cpp +) + +list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) + +list(APPEND CODE_SOURCE_FILES ${SOURCE_GROUP_SOURCE_FILES}) diff --git a/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccess.cpp b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccess.cpp new file mode 100644 index 0000000000..0a3f10a46c --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccess.cpp @@ -0,0 +1,178 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "RimFieldQuickAccess.h" + +#include "RiaQuickAccessScheduler.h" + +#include "RimFieldReference.h" + +#include "Riu3DMainWindowTools.h" + +#include "cafPdmUiToolButtonCallbackEditor.h" + +CAF_PDM_SOURCE_INIT( RimFieldQuickAccess, "RimFieldQuickAccess" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimFieldQuickAccess::RimFieldQuickAccess() +{ + CAF_PDM_InitObject( "Quick Access" ); + + CAF_PDM_InitFieldNoDefault( &m_fieldReference, "FieldReference", "FieldReference" ); + m_fieldReference = new RimFieldReference(); + + CAF_PDM_InitFieldNoDefault( &m_selectObjectButton, "SelectObject", "...", ":/Bullet.png", "Select Object in Property Editor" ); + m_selectObjectButton.uiCapability()->setUiEditorTypeName( caf::PdmUiToolButtonCallbackEditor::uiEditorTypeName() ); + m_selectObjectButton.xmlCapability()->disableIO(); + + CAF_PDM_InitFieldNoDefault( &m_removeItemButton, "RemoveItem", "...", ":/pin.svg", "Remove Quick Access" ); + m_removeItemButton.uiCapability()->setUiEditorTypeName( caf::PdmUiToolButtonCallbackEditor::uiEditorTypeName() ); + m_removeItemButton.xmlCapability()->disableIO(); + + m_markedForRemoval = false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFieldQuickAccess::setField( caf::PdmFieldHandle* field ) +{ + if ( !m_fieldReference() ) return; + + m_fieldReference->setField( field ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFieldQuickAccess::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) +{ + if ( m_fieldReference() && m_fieldReference()->field() ) + { + uiOrdering.add( m_fieldReference()->field() ); + uiOrdering.add( &m_selectObjectButton, { .newRow = false } ); + uiOrdering.add( &m_removeItemButton, { .newRow = false } ); + } + + uiOrdering.skipRemainingFields(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFieldQuickAccess::onSelectObjectButton() +{ + if ( m_fieldReference() ) + { + if ( auto pdmObj = dynamic_cast( m_fieldReference->object() ) ) + { + Riu3DMainWindowTools::selectAsCurrentItem( pdmObj ); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFieldQuickAccess::onRemoveObjectButton() +{ + m_markedForRemoval = true; + + RiaQuickAccessScheduler::instance()->scheduleDisplayModelUpdateAndRedraw(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFieldQuickAccess::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) +{ + if ( field == &m_selectObjectButton ) + { + if ( auto attr = dynamic_cast( attribute ) ) + { + attr->setCallback( std::bind( &RimFieldQuickAccess::onSelectObjectButton, this ) ); + } + } + else if ( field == &m_removeItemButton ) + { + if ( auto attr = dynamic_cast( attribute ) ) + { + attr->setCallback( std::bind( &RimFieldQuickAccess::onRemoveObjectButton, this ) ); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +caf::PdmFieldHandle* RimFieldQuickAccess::field() const +{ + if ( !m_fieldReference() ) return nullptr; + + return m_fieldReference->field(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimFieldQuickAccess::markedForRemoval() const +{ + return m_markedForRemoval; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFieldQuickAccess::onSel() +{ + if ( m_fieldReference() ) + { + if ( auto pdmObj = dynamic_cast( m_fieldReference->object() ) ) + { + Riu3DMainWindowTools::selectAsCurrentItem( pdmObj ); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFieldQuickAccess::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) +{ + if ( changedField == &m_selectObjectButton ) + { + m_selectObjectButton = false; + + if ( m_fieldReference() ) + { + if ( auto pdmObj = dynamic_cast( m_fieldReference->object() ) ) + { + Riu3DMainWindowTools::selectAsCurrentItem( pdmObj ); + } + } + } + + if ( changedField == &m_removeItemButton ) + { + m_removeItemButton = false; + + m_markedForRemoval = true; + } +} diff --git a/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccess.h b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccess.h new file mode 100644 index 0000000000..133e93ff1b --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccess.h @@ -0,0 +1,63 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "RimNamedObject.h" + +#include "cafPdmChildField.h" +#include "cafPdmField.h" +#include "cafPdmObject.h" +#include "cafPdmProxyValueField.h" + +class RimFieldReference; + +//================================================================================================== +/// +/// +//================================================================================================== +class RimFieldQuickAccess : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + RimFieldQuickAccess(); + + void setField( caf::PdmFieldHandle* field ); + caf::PdmFieldHandle* field() const; + + bool markedForRemoval() const; + + void onSel(); + +private: + void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; + + void onSelectObjectButton(); + void onRemoveObjectButton(); + +private: + caf::PdmChildField m_fieldReference; + + caf::PdmProxyValueField m_selectObjectButton; + caf::PdmProxyValueField m_removeItemButton; + + bool m_markedForRemoval; +}; diff --git a/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccessGroup.cpp b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccessGroup.cpp new file mode 100644 index 0000000000..507f79c778 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccessGroup.cpp @@ -0,0 +1,156 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "RimFieldQuickAccessGroup.h" + +#include "RiaLogging.h" + +CAF_PDM_SOURCE_INIT( RimFieldQuickAccessGroup, "RimFieldQuickAccessGroup" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimFieldQuickAccessGroup::RimFieldQuickAccessGroup() +{ + CAF_PDM_InitObject( "Quick Access Group" ); + + CAF_PDM_InitFieldNoDefault( &m_fieldQuickAccess, "FieldReferences", "Field References" ); + CAF_PDM_InitFieldNoDefault( &m_ownerView, "OwnerView", "Owner View" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimGridView* RimFieldQuickAccessGroup::ownerView() const +{ + return m_ownerView; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFieldQuickAccessGroup::setOwnerView( RimGridView* viewObject ) +{ + m_ownerView = viewObject; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFieldQuickAccessGroup::addFields( const std::vector& fields ) +{ + if ( !m_ownerView ) return; + + for ( auto field : fields ) + { + if ( findField( field ) ) continue; + + addField( field ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFieldQuickAccessGroup::addField( caf::PdmFieldHandle* field ) +{ + if ( !field ) return; + if ( !m_ownerView ) return; + + if ( !isOwnerViewMatching( field ) ) return; + + auto fieldReference = new RimFieldQuickAccess(); + fieldReference->setField( field ); + + addFieldQuickAccess( fieldReference ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimFieldQuickAccessGroup::fieldQuickAccesses() const +{ + return m_fieldQuickAccess.childrenByType(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +caf::PdmObjectHandle* RimFieldQuickAccessGroup::groupOwner() const +{ + for ( auto f : m_fieldQuickAccess ) + { + if ( f && f->field() ) + { + return f->field()->ownerObject(); + } + } + + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFieldQuickAccessGroup::removeFieldQuickAccess( RimFieldQuickAccess* fieldQuickAccess ) +{ + m_fieldQuickAccess.removeChild( fieldQuickAccess ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFieldQuickAccessGroup::addFieldQuickAccess( RimFieldQuickAccess* fieldQuickAccess ) +{ + if ( !fieldQuickAccess ) return; + + m_fieldQuickAccess.push_back( fieldQuickAccess ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimFieldQuickAccessGroup::findField( const caf::PdmFieldHandle* field ) const +{ + for ( auto fieldRef : m_fieldQuickAccess ) + { + if ( field == fieldRef->field() ) + { + return true; + } + } + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimFieldQuickAccessGroup::isOwnerViewMatching( caf::PdmFieldHandle* field ) +{ + if ( !field || !field->ownerObject() ) return false; + auto parentView = field->ownerObject()->firstAncestorOrThisOfType(); + + if ( parentView != m_ownerView ) + { + RiaLogging::debug( "Field does not belong to the owner view" ); + return false; + } + + return true; +} diff --git a/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccessGroup.h b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccessGroup.h new file mode 100644 index 0000000000..ee9bcc4e64 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccessGroup.h @@ -0,0 +1,62 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "RimNamedObject.h" + +#include "cafPdmChildArrayField.h" +#include "cafPdmField.h" +#include "cafPdmObject.h" +#include "cafPdmPtrField.h" + +class RimGridView; +class RimFieldQuickAccess; + +//================================================================================================== +/// +/// +//================================================================================================== +class RimFieldQuickAccessGroup : public RimNamedObject +{ + CAF_PDM_HEADER_INIT; + +public: + RimFieldQuickAccessGroup(); + + RimGridView* ownerView() const; + void setOwnerView( RimGridView* owner ); + + void addFields( const std::vector& fields ); + void addField( caf::PdmFieldHandle* field ); + + std::vector fieldQuickAccesses() const; + caf::PdmObjectHandle* groupOwner() const; + + void removeFieldQuickAccess( RimFieldQuickAccess* fieldQuickAccess ); + +private: + void addFieldQuickAccess( RimFieldQuickAccess* fieldQuickAccess ); + bool findField( const caf::PdmFieldHandle* field ) const; + + bool isOwnerViewMatching( caf::PdmFieldHandle* field ); + +private: + caf::PdmChildArrayField m_fieldQuickAccess; + caf::PdmPtrField m_ownerView; +}; diff --git a/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccessInterface.h b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccessInterface.h new file mode 100644 index 0000000000..86e5dc1834 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccessInterface.h @@ -0,0 +1,36 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 +#include + +#include + +namespace caf +{ +class PdmFieldHandle; +class PdmUiOrdering; +}; // namespace caf + +class RimFieldQuickAccessInterface +{ +public: + virtual std::map> quickAccessFields() = 0; +}; diff --git a/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldReference.cpp b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldReference.cpp new file mode 100644 index 0000000000..4493216d55 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldReference.cpp @@ -0,0 +1,196 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "RimFieldReference.h" + +CAF_PDM_SOURCE_INIT( RimFieldReference, "RimFieldReference" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimFieldReference::RimFieldReference() +{ + CAF_PDM_InitFieldNoDefault( &m_object, "Object", "Object" ); + CAF_PDM_InitFieldNoDefault( &m_fieldKeyword, "FieldKeyword", "Field Keyword" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFieldReference::setObject( caf::PdmObject* object ) +{ + m_object = object; + + auto keywordAndNames = RimFieldReference::fieldKeywordAndNames( object ); + if ( !keywordAndNames.empty() ) + { + m_fieldKeyword = keywordAndNames[0].first; + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFieldReference::setField( caf::PdmFieldHandle* field ) +{ + if ( !field ) return; + + auto ownerObject = dynamic_cast( field->ownerObject() ); + if ( !ownerObject ) return; + + setField( ownerObject, field->keyword() ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector> RimFieldReference::fieldKeywordAndNames( caf::PdmObject* object ) +{ + std::vector> names; + + if ( object ) + { + // Get the fields for the current uiOrdering. Calling object->fields() will not work as it will return all fields. + caf::PdmUiOrdering uiOrdering; + object->uiOrdering( "", uiOrdering ); + + std::vector fields; + for ( auto item : uiOrdering.uiItems() ) + { + findFieldsRecursively( item, fields ); + } + + for ( auto item : fields ) + { + if ( auto field = dynamic_cast( item ) ) + { + auto text = field->keyword(); + + if ( auto uiCapability = field->uiCapability() ) + { + text = uiCapability->uiName(); + } + + names.push_back( { field->keyword(), text } ); + } + } + } + + return names; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFieldReference::findFieldsRecursively( caf::PdmUiItem* object, std::vector& fields ) +{ + if ( auto uiFieldHandle = dynamic_cast( object ) ) + { + if ( uiFieldHandle->fieldHandle() ) fields.push_back( uiFieldHandle->fieldHandle() ); + } + + if ( auto group = dynamic_cast( object ) ) + { + for ( auto child : group->uiItems() ) + { + findFieldsRecursively( child, fields ); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFieldReference::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) +{ + uiOrdering.add( &m_object ); + uiOrdering.add( &m_fieldKeyword ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList RimFieldReference::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) +{ + QList options; + + if ( fieldNeedingOptions == &m_fieldKeyword ) + { + auto keywordAndNames = RimFieldReference::fieldKeywordAndNames( m_object ); + for ( const auto& [keyword, name] : keywordAndNames ) + { + options.push_back( caf::PdmOptionItemInfo( name, keyword ) ); + } + } + else if ( fieldNeedingOptions == &m_object ) + { + if ( m_objectsForSelection.empty() ) + { + if ( m_object ) + { + QString text = m_object()->uiName(); + options.push_back( caf::PdmOptionItemInfo( text, m_object ) ); + } + } + else + { + for ( auto obj : m_objectsForSelection ) + { + QString text = obj->uiName(); + options.push_back( caf::PdmOptionItemInfo( text, obj ) ); + } + } + } + + return options; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +caf::PdmFieldHandle* RimFieldReference::field() const +{ + if ( !m_object() ) return nullptr; + + return m_object->findField( m_fieldKeyword() ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +caf::PdmObject* RimFieldReference::object() const +{ + return m_object; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFieldReference::setObjectsForSelection( const std::vector& objectsForSelection ) +{ + m_objectsForSelection = objectsForSelection; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFieldReference::setField( caf::PdmObject* object, const QString& fieldName ) +{ + m_object = object; + m_fieldKeyword = fieldName; +} diff --git a/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldReference.h b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldReference.h new file mode 100644 index 0000000000..1cd5946781 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldReference.h @@ -0,0 +1,62 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "cafPdmObject.h" +#include "cafPdmPtrField.h" + +//================================================================================================== +/// +/// This class is used to store a reference to a field in a PdmObject, and is similar to caf::PdmPtrField that is +/// used for a non-owning reference to an object. Consider creating a caf::PdmPtrField instead of this class. +/// +/// Investigate if PdmFieldCapability::attributes can be used to store the field name for a caf::PdmPtrField +/// +//================================================================================================== +class RimFieldReference : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + RimFieldReference(); + + void setObject( caf::PdmObject* object ); + + void setField( caf::PdmFieldHandle* field ); + caf::PdmFieldHandle* field() const; + + caf::PdmObject* object() const; + void setObjectsForSelection( const std::vector& objectsForSelection ); + +private: + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; + + void setField( caf::PdmObject* object, const QString& fieldName ); + + static std::vector> fieldKeywordAndNames( caf::PdmObject* object ); + static void findFieldsRecursively( caf::PdmUiItem* object, std::vector& fields ); + +private: + caf::PdmPtrField m_object; + caf::PdmField m_fieldKeyword; + + std::vector m_objectsForSelection; +}; diff --git a/ApplicationLibCode/ProjectDataModel/QuickAccess/RimQuickAccessCollection.cpp b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimQuickAccessCollection.cpp new file mode 100644 index 0000000000..bbd0aa4606 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimQuickAccessCollection.cpp @@ -0,0 +1,285 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "RimQuickAccessCollection.h" + +#include "RiaApplication.h" + +#include "RimFieldQuickAccess.h" +#include "RimFieldQuickAccessInterface.h" +#include "RimFieldReference.h" +#include "RimGridView.h" +#include "RimProject.h" + +#include "cafAssert.h" + +CAF_PDM_SOURCE_INIT( RimQuickAccessCollection, "RimQuickAccessCollection" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimQuickAccessCollection::RimQuickAccessCollection() +{ + CAF_PDM_InitObject( "Field Reference Collection" ); + + CAF_PDM_InitFieldNoDefault( &m_fieldQuickAccesGroups, "FieldReferencesGroup", "Field References Group" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimQuickAccessCollection* RimQuickAccessCollection::instance() +{ + auto proj = RimProject::current(); + CAF_ASSERT( proj && "RimProject is nullptr when trying to access RimQuickAccessCollection::instance()" ); + + return proj->pinnedFieldCollection(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimQuickAccessCollection::addQuickAccessFieldsRecursively( caf::PdmObjectHandle* object ) +{ + if ( object == nullptr ) return; + addQuickAccessFields( object ); + + for ( auto field : object->fields() ) + { + if ( !field ) continue; + + for ( auto childObject : field->children() ) + { + addQuickAccessFieldsRecursively( childObject ); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimQuickAccessCollection::addQuickAccessFields( caf::PdmObjectHandle* object ) +{ + if ( !object ) return; + + if ( auto quickInterface = dynamic_cast( object ) ) + { + for ( const auto& [groupName, fields] : quickInterface->quickAccessFields() ) + { + if ( auto group = findOrCreateGroup( object, groupName ) ) + { + group->addFields( fields ); + } + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimQuickAccessCollection::addQuickAccessField( const RimFieldReference& fieldReference ) +{ + auto object = fieldReference.object(); + auto field = fieldReference.field(); + if ( object && field ) + { + if ( auto group = findOrCreateGroup( object, "" ) ) + { + group->addField( field ); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimQuickAccessCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) +{ + auto activeView = RiaApplication::instance()->activeGridView(); + if ( !activeView ) return; + + deleteMarkedObjects(); + + std::vector groupsForView; + + for ( auto group : m_fieldQuickAccesGroups ) + { + if ( group->ownerView() == activeView ) + { + updateGroupName( group ); + groupsForView.push_back( group ); + } + } + + for ( auto group : groupsForView ) + { + auto name = group->name(); + if ( name.isEmpty() ) name = defaultGroupName(); + + // Make sure the name of the group is unique in the UI ordering. This is a requirement for the UI ordering, as the groups are + // identified by name. + auto uiName = name; + caf::PdmUiGroup* uiGroup = uiOrdering.findGroup( uiName ); + int index = 1; + while ( uiGroup ) + { + uiName = "(" + QString::number( index++ ) + ") " + name; + uiGroup = uiOrdering.findGroup( uiName ); + } + + uiGroup = uiOrdering.addNewGroup( uiName ); + + for ( auto quickAccess : group->fieldQuickAccesses() ) + { + quickAccess->uiOrdering( uiConfigName, *uiGroup ); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimQuickAccessCollection::deleteMarkedObjects() +{ + // Delete marked objects and objects pointing to fields that are no longer valid + { + std::set toBeDeleted; + + for ( auto group : m_fieldQuickAccesGroups.childrenByType() ) + { + for ( auto quickAccess : group->fieldQuickAccesses() ) + { + if ( quickAccess->markedForRemoval() || !quickAccess->field() ) + { + toBeDeleted.insert( quickAccess ); + } + } + } + + for ( auto quickAccess : toBeDeleted ) + { + for ( auto group : m_fieldQuickAccesGroups ) + { + group->removeFieldQuickAccess( quickAccess ); + } + + delete quickAccess; + } + } + + // Delete groups with no quick access fields + { + std::set toBeDeleted; + for ( auto group : m_fieldQuickAccesGroups.childrenByType() ) + { + if ( group->fieldQuickAccesses().empty() ) + { + toBeDeleted.insert( group ); + } + } + + for ( auto group : toBeDeleted ) + { + m_fieldQuickAccesGroups.removeChild( group ); + delete group; + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimFieldQuickAccessGroup* RimQuickAccessCollection::findOrCreateGroup( caf::PdmObjectHandle* object, const QString& groupName ) +{ + if ( !object ) return nullptr; + + auto parentView = object->firstAncestorOrThisOfType(); + if ( !parentView ) return nullptr; + + for ( auto group : m_fieldQuickAccesGroups ) + { + if ( !group ) continue; + + if ( groupName.isEmpty() && group->name().isEmpty() && group->ownerView() == parentView ) + { + // If group name is empty, we assume that this is the default group for the view + return group; + } + + if ( group->groupOwner() == object ) return group; + } + + auto group = new RimFieldQuickAccessGroup(); + group->setName( groupName ); + group->setOwnerView( parentView ); + m_fieldQuickAccesGroups.push_back( group ); + + return group; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimQuickAccessCollection::updateGroupName( RimFieldQuickAccessGroup* quickAccessGroup ) +{ + if ( !quickAccessGroup ) return; + + caf::PdmObjectHandle* commonOwnerObject = nullptr; + caf::PdmFieldHandle* firstFieldInQuickAccess = nullptr; + + for ( auto quickAccess : quickAccessGroup->fieldQuickAccesses() ) + { + if ( !quickAccess || !quickAccess->field() || !quickAccess->field()->ownerObject() ) continue; + + if ( !firstFieldInQuickAccess ) firstFieldInQuickAccess = quickAccess->field(); + + auto ownerToField = quickAccess->field()->ownerObject(); + if ( !commonOwnerObject ) + { + commonOwnerObject = ownerToField; + } + else + { + if ( commonOwnerObject != ownerToField ) return; + } + } + + if ( auto fieldInterface = dynamic_cast( commonOwnerObject ) ) + { + auto ownerFields = fieldInterface->quickAccessFields(); + for ( const auto& [groupName, fields] : ownerFields ) + { + for ( auto field : fields ) + { + if ( field == firstFieldInQuickAccess ) + { + quickAccessGroup->setName( groupName ); + return; + } + } + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimQuickAccessCollection::defaultGroupName() +{ + return "Quick Access for View"; +} diff --git a/ApplicationLibCode/ProjectDataModel/QuickAccess/RimQuickAccessCollection.h b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimQuickAccessCollection.h new file mode 100644 index 0000000000..19b85c74db --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimQuickAccessCollection.h @@ -0,0 +1,60 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "cafPdmChildArrayField.h" +#include "cafPdmField.h" +#include "cafPdmObject.h" +#include "cafPdmPtrArrayField.h" + +class RimFieldQuickAccess; +class RimFieldQuickAccessGroup; +class RimFieldReference; + +//================================================================================================== +/// +/// +//================================================================================================== +class RimQuickAccessCollection : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + RimQuickAccessCollection(); + + static RimQuickAccessCollection* instance(); + + void addQuickAccessFieldsRecursively( caf::PdmObjectHandle* object ); + void addQuickAccessFields( caf::PdmObjectHandle* object ); + + void addQuickAccessField( const RimFieldReference& fieldReference ); + +private: + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + + RimFieldQuickAccessGroup* findOrCreateGroup( caf::PdmObjectHandle* object, const QString& groupName ); + + void deleteMarkedObjects(); + + static void updateGroupName( RimFieldQuickAccessGroup* group ); + static QString defaultGroupName(); + +private: + caf::PdmChildArrayField m_fieldQuickAccesGroups; +}; diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index c2a6f89685..084e723e6b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -37,6 +37,7 @@ #include "Cloud/RimCloudDataSourceCollection.h" #include "PlotTemplates/RimPlotTemplateFolderItem.h" #include "Polygons/RimPolygonCollection.h" +#include "QuickAccess/RimQuickAccessCollection.h" #include "RimAdvancedSnapshotExportDefinition.h" #include "RimAnalysisPlotCollection.h" #include "RimAnnotationCollection.h" @@ -161,6 +162,7 @@ RimProject::RimProject() scriptCollection.xmlCapability()->disableIO(); CAF_PDM_InitFieldNoDefault( &m_mainPlotCollection, "MainPlotCollection", "Plots" ); + CAF_PDM_InitFieldNoDefault( &m_pinnedFieldCollection, "PinnedFieldCollection", "PinnedFieldCollection" ); CAF_PDM_InitFieldNoDefault( &viewLinkerCollection, "LinkedViews", "Linked Views", ":/LinkView.svg" ); viewLinkerCollection = new RimViewLinkerCollection; @@ -221,7 +223,8 @@ RimProject::RimProject() scriptCollection->uiCapability()->setUiName( "Scripts" ); scriptCollection->uiCapability()->setUiIconFromResourceString( ":/octave.png" ); - m_mainPlotCollection = new RimMainPlotCollection(); + m_mainPlotCollection = new RimMainPlotCollection(); + m_pinnedFieldCollection = new RimQuickAccessCollection(); CAF_PDM_InitFieldNoDefault( &m_plotTemplateTopFolder, "PlotTemplateCollection", "Plot Templates" ); m_plotTemplateTopFolder = new RimPlotTemplateFolderItem(); @@ -352,6 +355,14 @@ void RimProject::updatesAfterProjectFileIsRead() if ( m_subWindowsTiledPlotWindow_OBSOLETE ) m_subWindowsTileModePlotWindow = RiaDefines::WindowTileMode::DEFAULT; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimQuickAccessCollection* RimProject::pinnedFieldCollection() const +{ + return m_pinnedFieldCollection(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.h b/ApplicationLibCode/ProjectDataModel/RimProject.h index 92b414698f..06cc3dcda7 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.h +++ b/ApplicationLibCode/ProjectDataModel/RimProject.h @@ -71,6 +71,7 @@ class RimValveTemplate; class RimCompletionTemplateCollection; class RimPlotTemplateFolderItem; class RimGridCalculationCollection; +class RimQuickAccessCollection; namespace caf { @@ -190,6 +191,8 @@ public: void updatesAfterProjectFileIsRead(); + RimQuickAccessCollection* pinnedFieldCollection() const; + protected: void initAfterRead() override; void setupBeforeSave() override; @@ -202,7 +205,8 @@ private: QString updatedFilePathFromPathId( QString filePath, RiaVariableMapper* pathListMapper = nullptr ) const; private: - caf::PdmChildField m_mainPlotCollection; + caf::PdmChildField m_mainPlotCollection; + caf::PdmChildField m_pinnedFieldCollection; caf::PdmField m_globalPathList; caf::PdmField m_projectFileVersionString; From 2e305bd762e4df59fb575cc6d6f3bdbd640decad Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 18 Oct 2024 14:41:19 +0200 Subject: [PATCH 053/160] Add quick access dock widget --- ApplicationExeCode/Resources/ResInsight.qrc | 1 + ApplicationExeCode/Resources/pin.svg | 4 +++ .../Application/RiaApplication.cpp | 8 +++++- .../UserInterface/RiuDockWidgetTools.cpp | 18 +++++++++++++ .../UserInterface/RiuDockWidgetTools.h | 2 ++ .../UserInterface/RiuMainWindow.cpp | 25 +++++++++++++++++++ .../UserInterface/RiuMainWindow.h | 1 + 7 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 ApplicationExeCode/Resources/pin.svg diff --git a/ApplicationExeCode/Resources/ResInsight.qrc b/ApplicationExeCode/Resources/ResInsight.qrc index efe7e9278b..87939b1318 100644 --- a/ApplicationExeCode/Resources/ResInsight.qrc +++ b/ApplicationExeCode/Resources/ResInsight.qrc @@ -290,6 +290,7 @@ cloud-and-server.svg Cloud.svg CloudBlobs.svg + pin.svg fs_CellFace.glsl diff --git a/ApplicationExeCode/Resources/pin.svg b/ApplicationExeCode/Resources/pin.svg new file mode 100644 index 0000000000..d18608c5c9 --- /dev/null +++ b/ApplicationExeCode/Resources/pin.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/ApplicationLibCode/Application/RiaApplication.cpp b/ApplicationLibCode/Application/RiaApplication.cpp index a6dc82d4c3..13339fda27 100644 --- a/ApplicationLibCode/Application/RiaApplication.cpp +++ b/ApplicationLibCode/Application/RiaApplication.cpp @@ -45,7 +45,7 @@ #include "PlotTemplates/RimPlotTemplateFolderItem.h" #include "Polygons/RimPolygonCollection.h" - +#include "QuickAccess/RimQuickAccessCollection.h" #include "Rim2dIntersectionViewCollection.h" #include "RimCellFilterCollection.h" #include "RimCommandRouter.h" @@ -515,6 +515,12 @@ bool RiaApplication::loadProject( const QString& projectFileName, ProjectLoadAct m_project->resolveReferencesRecursively(); m_project->initAfterReadRecursively(); + if ( RimProject::current()->isProjectFileVersionEqualOrOlderThan( "2024.09.2" ) ) + { + // Traverse objects recursively and add quick access fields for old projects + RimQuickAccessCollection::instance()->addQuickAccessFieldsRecursively( m_project.get() ); + } + // Migrate all RimGridCases to RimFileSummaryCase RimGridSummaryCase_obsolete::convertGridCasesToSummaryFileCases( m_project.get() ); diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp index af8c8d3314..3a3a477b53 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp @@ -139,6 +139,14 @@ QString RiuDockWidgetTools::mainWindowUndoStackName() return "dockUndoStack_mainWindow"; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiuDockWidgetTools::mainWindowQuickAccessName() +{ + return "dockQuickAccess_mainWindow"; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -147,6 +155,14 @@ QString RiuDockWidgetTools::plotMainWindowPlotManagerName() return "dockSummaryPlotManager"; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiuDockWidgetTools::plotWindowQuickAccessName() +{ + return "dockQuickAccess_plotWindow"; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -383,6 +399,8 @@ QIcon RiuDockWidgetTools::dockIcon( const QString dockWidgetName ) return QIcon( ":/graph.svg" ); else if ( dockWidgetName == plotMainWindowCloudTreeName() ) return QIcon( ":/Cloud.svg" ); + else if ( dockWidgetName == plotWindowQuickAccessName() || dockWidgetName == mainWindowQuickAccessName() ) + return QIcon( ":/pin.svg" ); return QIcon( ":/view.svg" ); } diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h index 40e8d95e89..55423cac9c 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h @@ -58,6 +58,7 @@ public: static QString mainWindowMessagesName(); static QString mainWindowMohrsCirclePlotName(); static QString mainWindowUndoStackName(); + static QString mainWindowQuickAccessName(); static QString mainWindowProjectTreeName(); static QString mainWindowDataSourceTreeName(); @@ -74,6 +75,7 @@ public: static QString plotMainWindowMessagesName(); static QString plotMainWindowUndoStackName(); static QString plotMainWindowPlotManagerName(); + static QString plotWindowQuickAccessName(); static QString dockState3DEclipseName(); static QString dockState3DGeoMechName(); diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index 59fcdc9b7e..d1d8de2057 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -29,6 +29,7 @@ #include "RicGridCalculatorDialog.h" +#include "QuickAccess/RimQuickAccessCollection.h" #include "Rim2dIntersectionView.h" #include "Rim3dView.h" #include "RimCellEdgeColors.h" @@ -188,6 +189,11 @@ RiuMainWindow::~RiuMainWindow() { m_pdmUiPropertyView->showProperties( nullptr ); } + + if ( m_quickAccessView ) + { + m_quickAccessView->showProperties( nullptr ); + } } //-------------------------------------------------------------------------------------------------- @@ -239,6 +245,8 @@ void RiuMainWindow::initializeGuiNewProjectLoaded() m_pdmUiPropertyView->currentObject()->uiCapability()->updateConnectedEditors(); } + m_quickAccessView->showProperties( RimQuickAccessCollection::instance() ); + if ( statusBar() && !RiaRegressionTestRunner::instance()->isRunningRegressionTests() ) { statusBar()->showMessage( "Ready ..." ); @@ -295,6 +303,11 @@ void RiuMainWindow::cleanupGuiCaseClose() m_pdmUiPropertyView->showProperties( nullptr ); } + if ( m_quickAccessView ) + { + m_quickAccessView->showProperties( nullptr ); + } + for ( auto& additionalProjectView : m_additionalProjectViews ) { RiuProjectAndPropertyView* projPropView = dynamic_cast( additionalProjectView->widget() ); @@ -808,6 +821,15 @@ void RiuMainWindow::createDockPanels() dockManager()->addDockWidget( ads::DockWidgetArea::BottomDockWidgetArea, dockWidget, leftArea ); } + { + auto dockWidget = + RiuDockWidgetTools::createDockWidget( "Quick Access", RiuDockWidgetTools::mainWindowQuickAccessName(), dockManager() ); + + m_quickAccessView = new caf::PdmUiPropertyView( dockWidget ); + dockWidget->setWidget( m_quickAccessView ); + dockManager()->addDockWidget( ads::DockWidgetArea::BottomDockWidgetArea, dockWidget, leftArea ); + } + #ifdef USE_ODB_API { auto dockWidget = @@ -1534,6 +1556,9 @@ void RiuMainWindow::selectedObjectsChanged() projectTree->treeView()->setFocus(); } } + + // The update of quick access view is depending on active view, and must be done after the active view is set + m_quickAccessView->showProperties( RimQuickAccessCollection::instance() ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.h b/ApplicationLibCode/UserInterface/RiuMainWindow.h index ae7a6baad3..9cba9dca15 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.h @@ -261,6 +261,7 @@ public: private: caf::PdmObject* m_pdmRoot; caf::PdmUiPropertyView* m_pdmUiPropertyView; + caf::PdmUiPropertyView* m_quickAccessView; QComboBox* m_scaleFactor; From 2befcf64173922f190178fa3b215bced9cafe511 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 18 Oct 2024 14:50:10 +0200 Subject: [PATCH 054/160] Create quick access objects when opening project and some objects Create quick access for Eclipse view, IJK slice filters and property filters Create quick access objects for existing projects automatically --- ApplicationLibCode/Commands/CMakeLists.txt | 1 + .../RicEclipsePropertyFilterFeatureImpl.cpp | 8 ++- .../ToolCommands/CMakeLists_files.cmake | 10 +++ .../RicAddFieldToQuickAccessFeature.cpp | 64 +++++++++++++++++++ .../RicAddFieldToQuickAccessFeature.h | 33 ++++++++++ .../CellFilters/RimCellFilterCollection.cpp | 4 ++ .../CellFilters/RimCellRangeFilter.cpp | 15 +++++ .../CellFilters/RimCellRangeFilter.h | 5 +- .../CellFilters/RimEclipsePropertyFilter.cpp | 19 +++++- .../CellFilters/RimEclipsePropertyFilter.h | 5 +- .../QuickAccess/RimQuickAccessCollection.cpp | 1 + .../RimContextCommandBuilder.cpp | 2 + .../ProjectDataModel/RimEclipseView.cpp | 11 ++++ .../ProjectDataModel/RimEclipseView.h | 9 ++- .../RimEclipseViewCollection.cpp | 3 + 15 files changed, 182 insertions(+), 8 deletions(-) create mode 100644 ApplicationLibCode/Commands/ToolCommands/CMakeLists_files.cmake create mode 100644 ApplicationLibCode/Commands/ToolCommands/RicAddFieldToQuickAccessFeature.cpp create mode 100644 ApplicationLibCode/Commands/ToolCommands/RicAddFieldToQuickAccessFeature.h diff --git a/ApplicationLibCode/Commands/CMakeLists.txt b/ApplicationLibCode/Commands/CMakeLists.txt index b497b2adba..6fc000c3ff 100644 --- a/ApplicationLibCode/Commands/CMakeLists.txt +++ b/ApplicationLibCode/Commands/CMakeLists.txt @@ -59,6 +59,7 @@ set(COMMAND_REFERENCED_CMAKE_FILES PlotBuilderCommands/CMakeLists_files.cmake PolygonCommands/CMakeLists_files.cmake Sumo/CMakeLists_files.cmake + ToolCommands/CMakeLists_files.cmake ) # Include source file lists from *.cmake files diff --git a/ApplicationLibCode/Commands/EclipseCommands/RicEclipsePropertyFilterFeatureImpl.cpp b/ApplicationLibCode/Commands/EclipseCommands/RicEclipsePropertyFilterFeatureImpl.cpp index c12684f88e..14a6694c57 100644 --- a/ApplicationLibCode/Commands/EclipseCommands/RicEclipsePropertyFilterFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/EclipseCommands/RicEclipsePropertyFilterFeatureImpl.cpp @@ -21,6 +21,7 @@ #include "RiaResultNames.h" +#include "QuickAccess/RimQuickAccessCollection.h" #include "RimEclipseCellColors.h" #include "RimEclipsePropertyFilter.h" #include "RimEclipsePropertyFilterCollection.h" @@ -28,9 +29,10 @@ #include "RimEclipseView.h" #include "RimViewController.h" +#include "Riu3DMainWindowTools.h" + #include "cafSelectionManager.h" -#include "Riu3DMainWindowTools.h" #include "cvfAssert.h" //-------------------------------------------------------------------------------------------------- @@ -64,6 +66,8 @@ void RicEclipsePropertyFilterFeatureImpl::addPropertyFilter( RimEclipsePropertyF propertyFilterCollection->propertyFiltersField().push_back( propertyFilter ); setDefaults( propertyFilter ); + RimQuickAccessCollection::instance()->addQuickAccessFields( propertyFilter ); + propertyFilterCollection->reservoirView()->scheduleGeometryRegen( PROPERTY_FILTERED ); propertyFilterCollection->reservoirView()->scheduleCreateDisplayModelAndRedraw(); @@ -82,6 +86,8 @@ void RicEclipsePropertyFilterFeatureImpl::insertPropertyFilter( RimEclipseProper propertyFilterCollection->propertyFiltersField().insertAt( static_cast( index ), propertyFilter ); setDefaults( propertyFilter ); + RimQuickAccessCollection::instance()->addQuickAccessFields( propertyFilter ); + propertyFilterCollection->reservoirView()->scheduleGeometryRegen( PROPERTY_FILTERED ); propertyFilterCollection->reservoirView()->scheduleCreateDisplayModelAndRedraw(); diff --git a/ApplicationLibCode/Commands/ToolCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/ToolCommands/CMakeLists_files.cmake new file mode 100644 index 0000000000..a5427aa404 --- /dev/null +++ b/ApplicationLibCode/Commands/ToolCommands/CMakeLists_files.cmake @@ -0,0 +1,10 @@ +set(SOURCE_GROUP_HEADER_FILES + ${CMAKE_CURRENT_LIST_DIR}/RicAddFieldToQuickAccessFeature.h +) + +set(SOURCE_GROUP_SOURCE_FILES + ${CMAKE_CURRENT_LIST_DIR}/RicAddFieldToQuickAccessFeature.cpp +) + +list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) +list(APPEND COMMAND_CODE_SOURCE_FILES ${SOURCE_GROUP_SOURCE_FILES}) diff --git a/ApplicationLibCode/Commands/ToolCommands/RicAddFieldToQuickAccessFeature.cpp b/ApplicationLibCode/Commands/ToolCommands/RicAddFieldToQuickAccessFeature.cpp new file mode 100644 index 0000000000..1f701e83ce --- /dev/null +++ b/ApplicationLibCode/Commands/ToolCommands/RicAddFieldToQuickAccessFeature.cpp @@ -0,0 +1,64 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "RicAddFieldToQuickAccessFeature.h" + +#include "QuickAccess/RimFieldReference.h" +#include "QuickAccess/RimQuickAccessCollection.h" + +#include "Riu3DMainWindowTools.h" + +#include "cafPdmUiPropertyViewDialog.h" +#include "cafSelectionManagerTools.h" + +#include + +CAF_CMD_SOURCE_INIT( RicAddFieldToQuickAccessFeature, "RicAddFieldToQuickAccessFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicAddFieldToQuickAccessFeature::onActionTriggered( bool isChecked ) +{ + auto objects = caf::selectedObjectsByType(); + if ( objects.empty() ) return; + + auto firstObject = objects.front(); + if ( !firstObject ) return; + + RimFieldReference fieldRef; + fieldRef.setObject( firstObject ); + + caf::PdmUiPropertyViewDialog propertyDialog( Riu3DMainWindowTools::mainWindowWidget(), &fieldRef, "Select Field for Quick Access", "" ); + propertyDialog.setWindowIcon( QIcon( ":/pin.svg" ) ); + + if ( propertyDialog.exec() == QDialog::Accepted ) + { + RimQuickAccessCollection::instance()->addQuickAccessField( fieldRef ); + RimQuickAccessCollection::instance()->updateAllRequiredEditors(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicAddFieldToQuickAccessFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Add Field To Quick Access" ); + actionToSetup->setIcon( QIcon( ":/pin.svg" ) ); +} diff --git a/ApplicationLibCode/Commands/ToolCommands/RicAddFieldToQuickAccessFeature.h b/ApplicationLibCode/Commands/ToolCommands/RicAddFieldToQuickAccessFeature.h new file mode 100644 index 0000000000..ddccd0a272 --- /dev/null +++ b/ApplicationLibCode/Commands/ToolCommands/RicAddFieldToQuickAccessFeature.h @@ -0,0 +1,33 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "cafCmdFeature.h" + +//================================================================================================== +/// +//================================================================================================== +class RicAddFieldToQuickAccessFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterCollection.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterCollection.cpp index ba1333b91e..276baac65b 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterCollection.cpp @@ -18,6 +18,7 @@ #include "RimCellFilterCollection.h" +#include "QuickAccess/RimQuickAccessCollection.h" #include "Rim3dView.h" #include "RimCase.h" #include "RimCellFilter.h" @@ -426,6 +427,9 @@ RimCellRangeFilter* RimCellFilterCollection::addNewCellRangeFilter( RimCase* src addFilter( pFilter ); pFilter->setGridIndex( gridIndex ); pFilter->setDefaultValues( sliceDirection, defaultSlice ); + + RimQuickAccessCollection::instance()->addQuickAccessFields( pFilter ); + onFilterUpdated( pFilter ); return pFilter; } diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellRangeFilter.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellRangeFilter.cpp index 079b5a33e6..54ffd2e879 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellRangeFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellRangeFilter.cpp @@ -23,6 +23,7 @@ #include "RiaApplication.h" #include "RigActiveCellInfo.h" #include "RigReservoirGridTools.h" + #include "Rim3dView.h" #include "RimCase.h" #include "RimTools.h" @@ -168,6 +169,20 @@ void RimCellRangeFilter::computeAndSetValidValues() updateIconState(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::map> RimCellRangeFilter::quickAccessFields() +{ + std::map> fields; + + if ( cellCountI == 1 ) fields[""].push_back( &startIndexI ); + if ( cellCountJ == 1 ) fields[""].push_back( &startIndexJ ); + if ( cellCountK == 1 ) fields[""].push_back( &startIndexK ); + + return fields; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellRangeFilter.h b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellRangeFilter.h index 5557169ff5..54207bed41 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellRangeFilter.h +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellRangeFilter.h @@ -20,6 +20,7 @@ #pragma once +#include "QuickAccess/RimFieldQuickAccessInterface.h" #include "RimCellFilter.h" #include "cafPdmFieldCvfVec3d.h" @@ -39,7 +40,7 @@ class StructGridInterface; /// /// //================================================================================================== -class RimCellRangeFilter : public RimCellFilter +class RimCellRangeFilter : public RimCellFilter, public RimFieldQuickAccessInterface { CAF_PDM_HEADER_INIT; @@ -59,6 +60,8 @@ public: void updateCompundFilter( cvf::CellRangeFilter* cellRangeFilter, int gridIndex ) override; + std::map> quickAccessFields() override; + protected: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilter.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilter.cpp index 81d2479bfe..d11da52660 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilter.cpp @@ -192,8 +192,8 @@ void RimEclipsePropertyFilter::setToDefaultValues() computeResultValueRange(); - m_lowerBound = m_minimumResultValue; - m_upperBound = m_maximumResultValue; + m_lowerBound.setValueWithFieldChanged( m_minimumResultValue ); + m_upperBound.setValueWithFieldChanged( m_maximumResultValue ); m_selectedCategoryValues = m_categoryValues; m_useCategorySelection = true; @@ -247,6 +247,21 @@ void RimEclipsePropertyFilter::defineUiOrdering( QString uiConfigName, caf::PdmU updateRangeLabel(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::map> RimEclipsePropertyFilter::quickAccessFields() +{ + std::map> fields; + + auto name = "Property Filter : " + m_resultDefinition->resultVariableUiName(); + + fields[name].push_back( &m_lowerBound ); + fields[name].push_back( &m_upperBound ); + + return fields; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilter.h b/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilter.h index 2027acfa72..18e88bb3f1 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilter.h +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilter.h @@ -20,6 +20,7 @@ #pragma once +#include "QuickAccess/RimFieldQuickAccessInterface.h" #include "RimPropertyFilter.h" #include "cafPdmChildField.h" @@ -31,7 +32,7 @@ class RimEclipseResultDefinition; /// /// //================================================================================================== -class RimEclipsePropertyFilter : public RimPropertyFilter +class RimEclipsePropertyFilter : public RimPropertyFilter, public RimFieldQuickAccessInterface { CAF_PDM_HEADER_INIT; @@ -56,6 +57,8 @@ public: void updateUiFieldsFromActiveResult(); + std::map> quickAccessFields() override; + private: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override; diff --git a/ApplicationLibCode/ProjectDataModel/QuickAccess/RimQuickAccessCollection.cpp b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimQuickAccessCollection.cpp index bbd0aa4606..174a8186fb 100644 --- a/ApplicationLibCode/ProjectDataModel/QuickAccess/RimQuickAccessCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimQuickAccessCollection.cpp @@ -21,6 +21,7 @@ #include "RiaApplication.h" #include "RimFieldQuickAccess.h" +#include "RimFieldQuickAccessGroup.h" #include "RimFieldQuickAccessInterface.h" #include "RimFieldReference.h" #include "RimGridView.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index 29a049de41..78d82cbf86 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -1101,6 +1101,8 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicPasteAsciiDataCurveFeature"; menuBuilder << "RicPasteSummaryCaseFeature"; menuBuilder.addSeparator(); + menuBuilder << "RicAddFieldToQuickAccessFeature"; + menuBuilder.addSeparator(); menuBuilder << "RicCopyReferencesToClipboardFeature"; menuBuilder << "RicLinkViewFeature"; diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp index db56d9b746..1d3a94a9cc 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp @@ -1756,6 +1756,17 @@ std::vector RimEclipseView::additionalResultsForResultI return m_additionalResultsForResultInfo()->additionalResultAddresses(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::map> RimEclipseView::quickAccessFields() +{ + std::map> fields; + fields[""].push_back( &m_eclipseCase ); + + return fields; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseView.h b/ApplicationLibCode/ProjectDataModel/RimEclipseView.h index 71d30ffa7d..7f43f8c095 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseView.h +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseView.h @@ -20,6 +20,9 @@ #pragma once +#include "QuickAccess/RimFieldQuickAccessInterface.h" +#include "RimGridView.h" + #include "cafAppEnum.h" #include "cafPdmChildField.h" #include "cafPdmField.h" @@ -34,8 +37,6 @@ #include "cafPdmFieldCvfColor.h" #include "cafPdmFieldCvfMat4d.h" -#include "RimGridView.h" - class RigActiveCellInfo; class RigCaseCellResultsData; class RigGridBase; @@ -83,7 +84,7 @@ class OverlayItem; /// /// //================================================================================================== -class RimEclipseView : public RimGridView +class RimEclipseView : public RimGridView, public RimFieldQuickAccessInterface { CAF_PDM_HEADER_INIT; @@ -174,6 +175,8 @@ public: std::vector additionalResultsForResultInfo() const; + std::map> quickAccessFields() override; + protected: void initAfterRead() override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseViewCollection.cpp index 967e0c5443..4acdf4caf2 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseViewCollection.cpp @@ -23,6 +23,7 @@ #include "RigCaseCellResultsData.h" +#include "QuickAccess/RimQuickAccessCollection.h" #include "Rim3dView.h" #include "RimCase.h" #include "RimCellEdgeColors.h" @@ -109,6 +110,8 @@ RimEclipseView* RimEclipseViewCollection::addView( RimEclipseCase* eclipseCase ) m_views.push_back( view ); + RimQuickAccessCollection::instance()->addQuickAccessFields( view ); + view->loadDataAndUpdate(); updateConnectedEditors(); From eee00ee508b206f4c389c96506bd313eea841c28 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 18 Oct 2024 15:40:48 +0200 Subject: [PATCH 055/160] Update default dock state for Quick Access --- .../UserInterface/RiuDockWidgetTools.cpp | 56 ++++++++++--------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp index 3a3a477b53..0f779277ef 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp @@ -438,33 +438,35 @@ QByteArray RiuDockWidgetTools::defaultEclipseDockState() // start paste static const char stateData[] = - { '\x00', '\x00', '\x06', '\x46', '\x78', '\xda', '\x95', '\x55', '\xcb', '\x4e', '\xc3', '\x30', '\x10', '\xbc', '\xf3', '\x15', - '\x56', '\xee', '\xd0', '\xe6', '\x01', '\xf4', '\x90', '\x16', '\xa1', '\x14', '\x04', '\x87', '\x42', '\x69', '\x5a', '\x7a', - '\x44', '\x26', '\x59', '\x8a', '\xc1', '\xb1', '\xab', '\xf5', '\xb6', '\x3c', '\xc4', '\xc7', '\xe3', '\x3e', '\x14', '\xa9', - '\xc5', '\x69', '\xc8', '\x21', '\x8a', '\xbd', '\x9e', '\xf1', '\xce', '\xac', '\xd7', '\x49', '\x7c', '\xf1', '\x59', '\x48', - '\xb6', '\x04', '\x34', '\x42', '\xab', '\xae', '\xe7', '\x9f', '\xb4', '\x3d', '\x06', '\x2a', '\xd3', '\xb9', '\x50', '\xb3', - '\xae', '\x37', '\x19', '\x5f', '\x1f', '\x77', '\xbc', '\x8b', '\x5e', '\xfc', '\x40', '\x97', '\xf9', '\x92', '\xab', '\x0c', - '\xf2', '\xbe', '\xce', '\xde', '\xed', '\x5a', '\xfa', '\x65', '\x08', '\x0a', '\xf6', '\x58', '\x12', '\x3d', '\x36', '\x31', - '\x80', '\xe5', '\x3c', '\xf4', '\x58', '\xa2', '\x15', '\x71', '\xa1', '\x6c', '\x64', '\xbd', '\x9c', '\x80', '\x22', '\xe4', - '\x72', '\x2a', '\xf2', '\x19', '\x50', '\xd7', '\xcb', '\xed', '\x3e', '\x61', '\x7f', '\x2a', '\x54', '\xae', '\x3f', '\x9e', - '\x0a', '\x8b', '\xdb', '\x0c', '\xbd', '\x5e', '\x5c', '\xf2', '\xd8', '\xb5', '\xd4', '\x9c', '\xd6', '\x42', '\xda', '\x36', - '\x9e', '\xce', '\xa5', '\x20', '\xb2', '\xe1', '\x7b', '\x14', '\x76', '\x2f', '\xbb', '\xb2', '\x4a', '\xf4', '\xb3', '\x4a', - '\xb4', '\x50', '\x76', '\xc7', '\xa0', '\x12', '\x73', '\xbc', '\x83', '\xb9', '\x44', '\xe0', '\x6c', '\xcc', '\x9f', '\xcd', - '\x46', '\xe5', '\x02', '\x11', '\xd4', '\x56', '\xd0', '\x10', '\xf5', '\x1b', '\x64', '\x34', '\x46', '\x80', '\x5d', '\x4d', - '\x1b', '\xd5', '\xec', '\x8e', '\x17', '\x70', '\x10', '\xc9', '\x12', '\xa9', '\x0d', '\xe4', '\x2b', '\xc1', '\x2d', '\x07', - '\xab', '\xcf', '\x89', '\xa7', '\x7a', '\x81', '\x19', '\x34', '\x24', '\xa6', '\x19', '\x8a', '\x39', '\x99', '\xc3', '\xac', - '\xd6', '\xca', '\xd9', '\x8e', '\x3f', '\xff', '\xaf', '\xbf', '\x39', '\x20', '\x7d', '\x5d', '\xe5', '\x82', '\x34', '\xd6', - '\x5b', '\xac', '\x00', '\x3b', '\xd3', '\xa6', '\xe2', '\x1b', '\x4c', '\xef', '\x3c', '\x0a', '\xd9', '\x69', '\xfb', '\x9c', - '\xc5', '\xad', '\xcd', '\xdc', '\xbe', '\xb7', '\x47', '\xd2', '\xf8', '\x70', '\xf6', '\xc5', '\xbb', '\xba', '\xc5', '\xb6', - '\x08', '\x9f', '\xad', '\xb1', '\x0e', '\x03', '\x4e', '\x82', '\x53', '\x7a', '\x4d', '\x67', '\x85', '\x87', '\x85', '\x8d', - '\xc0', '\x2c', '\x24', '\xdd', '\xaa', '\x17', '\x5d', '\x53', '\x51', '\x37', '\xb0', '\xee', '\x10', '\xcf', '\x9c', '\xe9', - '\x86', '\x52', '\xd3', '\xbf', '\xd2', '\xed', '\x03', '\xeb', '\x5a', '\x14', '\xe6', '\xf4', '\xda', '\x90', '\x33', '\xd0', - '\xaf', '\x68', '\x12', '\x81', '\x99', '\x84', '\x4a', '\xa6', '\xef', '\x64', '\x8e', '\x40', '\x0e', '\x01', '\x8b', '\x86', - '\xf9', '\x86', '\xcb', '\xa6', '\xae', '\x52', '\x10', '\xe6', '\x46', '\x18', '\x6a', '\x52', '\xf7', '\x60', '\xaf', '\xee', - '\x03', '\x30', '\x86', '\xcf', '\xc0', '\xd4', '\x54', '\xdd', '\x05', '\xab', '\xf3', '\x83', '\x3a', '\xb3', '\xac', '\x81', - '\x56', '\x0d', '\x6e', '\x5a', '\xd4', '\x69', '\x33', '\xdf', '\x8f', '\x02', '\x16', '\x75', '\x2a', '\xae', '\xdb', '\x3a', - '\xd2', '\x09', '\x4e', '\x59', '\x64', '\x9f', '\x6a', '\x44', '\x14', '\x86', '\x2c', '\xf0', '\x03', '\xdf', '\x09', '\x69', - '\x95', '\x5f', '\x63', '\x3b', '\xae', '\xf8', '\x0b', '\xf4', '\x8e', '\x7e', '\x01', '\xe9', '\x95', '\x27', '\x97' }; + { '\x00', '\x00', '\x06', '\xfe', '\x78', '\xda', '\x95', '\x55', '\xc1', '\x4e', '\xe3', '\x30', '\x10', '\xbd', '\xf3', '\x15', + '\x56', '\xee', '\xd0', '\x3a', '\x49', '\x4b', '\x90', '\xda', '\xa2', '\xaa', '\x05', '\xb1', '\x87', '\xee', '\xb6', '\xa4', + '\x2c', '\x47', '\xe4', '\x75', '\x66', '\x8b', '\xc1', '\xb1', '\xab', '\xb1', '\xd3', '\x05', '\xc4', '\xc7', '\xe3', '\xb4', + '\xa8', '\xab', '\x82', '\x93', '\x34', '\xa7', '\xd8', '\xe3', '\xf7', '\x3c', '\xf3', '\x9e', '\x27', '\xf6', '\xe0', '\xf2', + '\x25', '\x97', '\x64', '\x03', '\x68', '\x84', '\x56', '\xc3', '\x80', '\x9e', '\x75', '\x03', '\x02', '\x8a', '\xeb', '\x4c', + '\xa8', '\xd5', '\x30', '\xb8', '\x5b', '\x5e', '\x9f', '\x26', '\xc1', '\xe5', '\x68', '\xb0', '\xb0', '\xe3', '\x6c', '\xc3', + '\x14', '\x87', '\x6c', '\xaa', '\xf9', '\xb3', '\x5b', '\x4b', '\x5f', '\x8d', '\x85', '\x9c', '\xfc', '\xde', '\x13', '\x03', + '\x72', '\x67', '\x00', '\xf7', '\xf3', '\x28', '\x20', '\x13', '\xad', '\x2c', '\x13', '\xca', '\x45', '\xb6', '\xcb', '\x13', + '\x50', '\x16', '\x99', '\xbc', '\x17', '\xd9', '\x0a', '\xec', '\x30', '\xc8', '\xdc', '\x3e', '\xd1', '\xf4', '\x5e', '\xa8', + '\x4c', '\xff', '\x7b', '\xc8', '\x1d', '\x6e', '\x37', '\x0c', '\x46', '\x83', '\x3d', '\x8f', '\x5c', '\x4b', '\xcd', '\xec', + '\xb6', '\x90', '\xae', '\x8b', '\xa7', '\x6b', '\x29', '\xac', '\x75', '\xe1', '\x5f', '\x28', '\xdc', '\x5e', '\x6e', '\xa5', + '\x4c', '\xf4', '\x5e', '\x26', '\x2a', '\x94', '\xdb', '\x31', '\xac', '\xc4', '\x9c', '\x1e', '\x60', '\xc6', '\x08', '\x8c', + '\x2c', '\xd9', '\x1f', '\xb3', '\xab', '\xb2', '\x40', '\x04', '\xf5', '\x59', '\xd0', '\x1c', '\xf5', '\x13', '\x70', '\xbb', + '\x44', '\x80', '\xc3', '\x9a', '\x76', '\x55', '\x93', '\x9f', '\x2c', '\x87', '\x5a', '\x24', '\x99', '\x48', '\x6d', '\x20', + '\x2b', '\x0b', '\xee', '\x78', '\x58', '\x53', '\x66', '\x59', '\xaa', '\x0b', '\xe4', '\xd0', '\x92', '\x98', '\x72', '\x14', + '\x6b', '\x6b', '\xea', '\x59', '\x9d', '\x52', '\xd9', '\x81', '\x3e', '\xfa', '\x5d', '\xdf', '\x1a', '\xd0', '\xbe', '\x5e', + '\x65', '\xc2', '\x6a', '\x6c', '\x96', '\x58', '\x01', '\xf6', '\xa6', '\x4d', '\xc5', '\x1b', '\x98', '\xd1', '\x79', '\xbf', + '\x4b', '\x7a', '\xf4', '\x82', '\x0c', '\x3a', '\xbb', '\xb9', '\xfb', '\x7e', '\x1e', '\xc9', '\x71', '\x87', '\x73', '\xcc', + '\x21', '\xd7', '\x08', '\xf4', '\x75', '\x94', '\x6b', '\x23', '\xb6', '\xda', '\x62', '\x3d', '\x22', '\xbd', '\x84', '\x96', + '\xae', '\x2e', '\x0a', '\xc1', '\x9f', '\xc7', '\x9c', '\x83', '\x31', '\x0d', '\x96', '\x56', '\x20', '\x6b', '\xfc', '\xa4', + '\xfd', '\xe4', '\x9c', '\xc4', '\x51', '\xb7', '\x85', '\xa1', '\xff', '\xcd', '\x8a', '\xea', '\xcd', '\xba', '\x05', '\x53', + '\x48', '\xfb', '\x43', '\xfd', '\xd5', '\x0d', '\x65', '\xfb', '\x81', '\x4d', '\x36', '\xf5', '\xbd', '\xe9', '\xe6', '\x52', + '\xdb', '\xa3', '\xd2', '\x7d', '\x05', '\x36', '\xfd', '\x5a', '\xb0', '\xb6', '\x8f', '\x2d', '\x39', '\x33', '\xfd', '\x88', + '\x66', '\x22', '\x90', '\x4b', '\xa8', '\x64', '\x52', '\x2f', '\xf3', '\x16', '\xe4', '\x1c', '\x30', '\x6f', '\x99', '\x6f', + '\xbe', '\x69', '\xab', '\x2a', '\x05', '\x61', '\x6e', '\x84', '\xb1', '\x6d', '\x7c', '\x0f', '\xbf', '\xf8', '\x3e', '\x73', + '\xdd', '\xc6', '\x56', '\xd0', '\xd4', '\x9b', '\x3e', '\x58', '\x93', '\x1e', '\xd4', '\x65', '\x2b', '\xcf', '\xb4', '\x6a', + '\x71', '\x43', '\xc4', '\x09', '\x25', '\x94', '\xc6', '\x11', '\x89', '\x93', '\xc4', '\xdf', '\xd5', '\xdb', '\x48', '\xd2', + '\x8b', '\x49', '\x1c', '\xf6', '\x6a', '\x10', '\x71', '\x14', '\x91', '\x90', '\x86', '\xa1', '\x17', '\xd2', '\xd9', '\xbf', + '\x22', '\x6e', '\x5c', '\xf1', '\x7a', '\x8d', '\x4e', '\x3e', '\x00', '\xdb', '\xd5', '\x66', '\x08' }; // end paste From 95b2f2bbd1e81027a596ab00abacb5799df27d34 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Sat, 19 Oct 2024 13:05:35 +0200 Subject: [PATCH 056/160] Add icons --- .../Resources/NavigationProperty.svg | 15 +++ ApplicationExeCode/Resources/ResInsight.qrc | 6 ++ ApplicationExeCode/Resources/Select.svg | 13 +++ ApplicationExeCode/Resources/arrow-swap.svg | 1 + ApplicationExeCode/Resources/inspect.svg | 1 + ApplicationExeCode/Resources/pin.svg | 5 +- .../Resources/pinned-remove.svg | 91 +++++++++++++++++++ ApplicationExeCode/Resources/pinned.svg | 1 + .../QuickAccess/RimFieldQuickAccess.cpp | 4 +- .../QuickAccess/RimFieldQuickAccessGroup.cpp | 2 + .../UserInterface/RiuDockWidgetTools.cpp | 2 +- 11 files changed, 134 insertions(+), 7 deletions(-) create mode 100644 ApplicationExeCode/Resources/NavigationProperty.svg create mode 100644 ApplicationExeCode/Resources/Select.svg create mode 100644 ApplicationExeCode/Resources/arrow-swap.svg create mode 100644 ApplicationExeCode/Resources/inspect.svg create mode 100644 ApplicationExeCode/Resources/pinned-remove.svg create mode 100644 ApplicationExeCode/Resources/pinned.svg diff --git a/ApplicationExeCode/Resources/NavigationProperty.svg b/ApplicationExeCode/Resources/NavigationProperty.svg new file mode 100644 index 0000000000..a8930352b4 --- /dev/null +++ b/ApplicationExeCode/Resources/NavigationProperty.svg @@ -0,0 +1,15 @@ + + + + + IconLightNavigationProperty + + + + + + + + + + diff --git a/ApplicationExeCode/Resources/ResInsight.qrc b/ApplicationExeCode/Resources/ResInsight.qrc index 87939b1318..4a6a82ebc0 100644 --- a/ApplicationExeCode/Resources/ResInsight.qrc +++ b/ApplicationExeCode/Resources/ResInsight.qrc @@ -290,7 +290,13 @@ cloud-and-server.svg Cloud.svg CloudBlobs.svg + arrow-swap.svg + inspect.svg pin.svg + pinned.svg + pinned-remove.svg + Select.svg + NavigationProperty.svg fs_CellFace.glsl diff --git a/ApplicationExeCode/Resources/Select.svg b/ApplicationExeCode/Resources/Select.svg new file mode 100644 index 0000000000..73eec55876 --- /dev/null +++ b/ApplicationExeCode/Resources/Select.svg @@ -0,0 +1,13 @@ + + + + + IconLightSelect + + + + + + + + diff --git a/ApplicationExeCode/Resources/arrow-swap.svg b/ApplicationExeCode/Resources/arrow-swap.svg new file mode 100644 index 0000000000..6496412119 --- /dev/null +++ b/ApplicationExeCode/Resources/arrow-swap.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ApplicationExeCode/Resources/inspect.svg b/ApplicationExeCode/Resources/inspect.svg new file mode 100644 index 0000000000..2de8bfb0c3 --- /dev/null +++ b/ApplicationExeCode/Resources/inspect.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ApplicationExeCode/Resources/pin.svg b/ApplicationExeCode/Resources/pin.svg index d18608c5c9..e0a644ad5d 100644 --- a/ApplicationExeCode/Resources/pin.svg +++ b/ApplicationExeCode/Resources/pin.svg @@ -1,4 +1 @@ - - - - \ No newline at end of file + \ No newline at end of file diff --git a/ApplicationExeCode/Resources/pinned-remove.svg b/ApplicationExeCode/Resources/pinned-remove.svg new file mode 100644 index 0000000000..6ffaa4c5bf --- /dev/null +++ b/ApplicationExeCode/Resources/pinned-remove.svg @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + diff --git a/ApplicationExeCode/Resources/pinned.svg b/ApplicationExeCode/Resources/pinned.svg new file mode 100644 index 0000000000..f3ef8f8942 --- /dev/null +++ b/ApplicationExeCode/Resources/pinned.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccess.cpp b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccess.cpp index 0a3f10a46c..ef4a798b88 100644 --- a/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccess.cpp +++ b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccess.cpp @@ -38,11 +38,11 @@ RimFieldQuickAccess::RimFieldQuickAccess() CAF_PDM_InitFieldNoDefault( &m_fieldReference, "FieldReference", "FieldReference" ); m_fieldReference = new RimFieldReference(); - CAF_PDM_InitFieldNoDefault( &m_selectObjectButton, "SelectObject", "...", ":/Bullet.png", "Select Object in Property Editor" ); + CAF_PDM_InitFieldNoDefault( &m_selectObjectButton, "SelectObject", "...", ":/Select.svg", "Select Object in Property Editor" ); m_selectObjectButton.uiCapability()->setUiEditorTypeName( caf::PdmUiToolButtonCallbackEditor::uiEditorTypeName() ); m_selectObjectButton.xmlCapability()->disableIO(); - CAF_PDM_InitFieldNoDefault( &m_removeItemButton, "RemoveItem", "...", ":/pin.svg", "Remove Quick Access" ); + CAF_PDM_InitFieldNoDefault( &m_removeItemButton, "RemoveItem", "...", ":/pinned-remove.svg", "Remove Quick Access" ); m_removeItemButton.uiCapability()->setUiEditorTypeName( caf::PdmUiToolButtonCallbackEditor::uiEditorTypeName() ); m_removeItemButton.xmlCapability()->disableIO(); diff --git a/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccessGroup.cpp b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccessGroup.cpp index 507f79c778..cacf324709 100644 --- a/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccessGroup.cpp +++ b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccessGroup.cpp @@ -17,6 +17,8 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RimFieldQuickAccessGroup.h" +#include "RimFieldQuickAccess.h" +#include "RimGridView.h" #include "RiaLogging.h" diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp index 0f779277ef..ae9adcaeb9 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp @@ -400,7 +400,7 @@ QIcon RiuDockWidgetTools::dockIcon( const QString dockWidgetName ) else if ( dockWidgetName == plotMainWindowCloudTreeName() ) return QIcon( ":/Cloud.svg" ); else if ( dockWidgetName == plotWindowQuickAccessName() || dockWidgetName == mainWindowQuickAccessName() ) - return QIcon( ":/pin.svg" ); + return QIcon( ":/pinned.svg" ); return QIcon( ":/view.svg" ); } From df091336e0f60600d0241c268859bc44b3a35ea4 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 21 Oct 2024 14:40:25 +0200 Subject: [PATCH 057/160] Move summary tools into separate folder --- .../Application/CMakeLists_files.cmake | 6 ---- .../Application/RiaGuiApplication.cpp | 2 +- .../Application/Tools/CMakeLists_files.cmake | 6 ---- .../Tools/RiaEnsembleNameTools.cpp | 2 +- .../Application/Tools/RiaEnsembleNameTools.h | 2 +- .../Tools/Summary/CMakeLists_files.cmake | 23 ++++++++++++ .../RiaSummaryAddressAnalyzer.cpp | 4 +-- .../{ => Summary}/RiaSummaryAddressAnalyzer.h | 2 +- .../Summary/RiaSummaryAddressModifier.cpp} | 36 +++++++++---------- .../Summary/RiaSummaryAddressModifier.h} | 2 +- .../Summary}/RiaSummaryCurveAddress.cpp | 0 .../Summary}/RiaSummaryCurveAddress.h | 0 .../Summary}/RiaSummaryCurveDefinition.cpp | 11 +++--- .../Summary}/RiaSummaryCurveDefinition.h | 0 .../{ => Tools/Summary}/RiaSummaryDefines.cpp | 1 + .../{ => Tools/Summary}/RiaSummaryDefines.h | 0 .../{ => Summary}/RiaSummaryStringTools.cpp | 4 +-- .../{ => Summary}/RiaSummaryStringTools.h | 0 .../Tools/{ => Summary}/RiaSummaryTools.cpp | 2 +- .../Tools/{ => Summary}/RiaSummaryTools.h | 0 ApplicationLibCode/CMakeLists.txt | 1 + .../RicExportFractureCompletionsImpl.cpp | 2 +- .../RicPlotProductionRateFeature.cpp | 2 +- ...RicAppendSummaryPlotsForObjectsFeature.cpp | 16 ++++----- ...wSummaryMultiPlotFromDataVectorFeature.cpp | 2 +- ...RicNewSummaryPlotFromDataVectorFeature.cpp | 2 +- .../RicSummaryPlotBuilder.cpp | 4 +-- .../RicSaveMultiPlotTemplateFeature.cpp | 4 +-- .../RicSelectCaseOrEnsembleUi.cpp | 2 +- .../RicSelectPlotTemplateUi.cpp | 2 +- .../RicSummaryPlotTemplateTools.cpp | 4 +-- .../Commands/RicCloseObservedDataFeature.cpp | 2 +- .../Commands/RicCloseSummaryCaseFeature.cpp | 2 +- .../RicCreateSummaryCaseCollectionFeature.cpp | 2 +- .../RicDeleteSummaryCaseCollectionFeature.cpp | 2 +- .../Commands/RicImportEnsembleFeature.cpp | 4 +-- .../Commands/RicImportEnsembleFeature.h | 2 +- .../RicImportEnsembleSurfaceFeature.cpp | 2 +- .../Commands/RicImportSummaryCasesFeature.cpp | 2 +- .../Commands/RicImportSummaryCasesFeature.h | 2 +- .../Commands/RicImportSummaryGroupFeature.cpp | 2 +- .../Commands/RicRecursiveFileSearchDialog.h | 2 +- .../Commands/RicReloadSummaryCaseFeature.cpp | 2 +- .../Commands/RicReplaceCaseFeature.cpp | 2 +- .../Commands/RicReplaceSummaryCaseFeature.cpp | 2 +- .../RicCreateCrossPlotFeature.cpp | 2 +- .../RicCreateDeclineCurvesFeature.cpp | 2 +- ...icCreateRegressionAnalysisCurveFeature.cpp | 2 +- .../RicDuplicateSummaryCurveFeature.cpp | 2 +- .../RicDuplicateSummaryPlotFeature.cpp | 2 +- .../RicDuplicateSummaryTableFeature.cpp | 2 +- .../RicEditSummaryPlotFeature.cpp | 2 +- .../RicNewDefaultSummaryPlotFeature.cpp | 2 +- .../RicNewGridTimeHistoryCurveFeature.cpp | 2 +- .../RicNewSummaryCrossPlotCurveFeature.cpp | 2 +- .../RicNewSummaryCurveFeature.cpp | 2 +- .../RicNewSummaryEnsembleCurveSetFeature.cpp | 2 +- .../RicNewSummaryTableFeature.cpp | 2 +- .../RicOpenSummaryPlotEditorFeature.cpp | 2 +- .../RicPasteEnsembleCurveSetFeature.cpp | 2 +- .../RicPasteSummaryCurveFeature.cpp | 2 +- .../RicPasteSummaryMultiPlotFeature.cpp | 2 +- .../RicSelectSummaryPlotUI.cpp | 2 +- .../RicSummaryCurveCalculatorUi.cpp | 2 +- .../RicSummaryPlotEditorUi.cpp | 2 +- .../RicSummaryPlotFeatureImpl.cpp | 2 +- .../RicNewRftSegmentWellLogPlotFeature.cpp | 2 +- .../FileInterface/RifEclipseSummaryTools.cpp | 2 +- .../RifSummaryCaseRestartSelector.h | 2 +- .../AnalysisPlots/RimAnalysisPlot.cpp | 2 +- .../RimAnalysisPlotCollection.cpp | 2 +- .../RimAnalysisPlotDataEntry.cpp | 2 +- .../Cloud/RimCloudDataSourceCollection.cpp | 2 +- .../RimAbstractCorrelationPlot.cpp | 2 +- .../RimCorrelationMatrixPlot.cpp | 2 +- .../RimCorrelationMatrixPlot.h | 2 +- .../CorrelationPlots/RimCorrelationPlot.h | 2 +- .../RimCorrelationPlotCollection.cpp | 2 +- .../RimCorrelationReportPlot.cpp | 2 +- .../ProjectDataModel/Flow/RimWellRftPlot.cpp | 2 +- .../RimCustomObjectiveFunctionWeight.cpp | 2 +- .../RimMainPlotCollection.cpp | 2 +- .../ProjectDataModel/RimReloadCaseTools.cpp | 2 +- .../RimSimWellInViewTools.cpp | 2 +- .../RimSummaryCalculation.cpp | 4 +-- .../RimSummaryCalculationCollection.cpp | 2 +- .../RimSummaryCalculationVariable.cpp | 4 +-- .../Summary/CMakeLists_files.cmake | 2 -- .../RimEnsembleCrossPlotStatisticsCase.cpp | 2 +- .../Summary/RimEnsembleCurveFilter.cpp | 2 +- .../Summary/RimEnsembleCurveSet.cpp | 4 +-- .../Summary/RimEnsembleCurveSet.h | 4 +-- .../Summary/RimEnsembleStatisticsCase.cpp | 2 +- .../Summary/RimGridSummaryCase.cpp | 2 +- .../ProjectDataModel/Summary/RimRftCase.cpp | 2 +- .../Summary/RimSummaryAddress.cpp | 2 +- .../Summary/RimSummaryAddressCollection.cpp | 2 +- .../Summary/RimSummaryAddressSelector.cpp | 4 +-- .../Summary/RimSummaryCaseMainCollection.cpp | 2 +- .../Summary/RimSummaryCurve.cpp | 6 ++-- .../Summary/RimSummaryCurve.h | 4 +-- .../RimSummaryCurveAppearanceCalculator.cpp | 2 +- .../Summary/RimSummaryCurveCollection.h | 2 +- .../Summary/RimSummaryCurvesData.cpp | 4 +-- .../Summary/RimSummaryDataSourceStepping.cpp | 2 +- .../Summary/RimSummaryDeclineCurve.cpp | 2 +- .../Summary/RimSummaryEnsemble.cpp | 2 +- .../Summary/RimSummaryEnsembleTools.cpp | 2 +- .../Summary/RimSummaryMultiPlot.cpp | 16 ++++----- .../Summary/RimSummaryPlot.cpp | 17 +++------ .../Summary/RimSummaryPlotAxisFormatter.cpp | 2 +- .../Summary/RimSummaryPlotManager.cpp | 4 +-- .../Summary/RimSummaryPlotNameHelper.cpp | 1 - .../Summary/RimSummaryPlotNameHelper.h | 2 +- .../Summary/RimSummaryPlotSourceStepping.cpp | 8 ++--- .../Summary/RimSummaryTable.cpp | 2 +- .../Summary/Sumo/RimSummaryEnsembleSumo.cpp | 4 +-- .../WellLog/RimRftTopologyCurve.cpp | 2 +- .../RimWellLogCurveCommonDataSource.cpp | 2 +- .../WellLog/RimWellLogRftCurve.cpp | 2 +- .../RimcSummaryCase.cpp | 2 +- .../RiaSummaryAddressAnalyzer-Test.cpp | 2 +- .../UnitTests/RiaSummaryStringTools-Test.cpp | 2 +- .../UserInterface/RiuPlotMainWindow.cpp | 2 +- .../RiuSummaryVectorSelectionDialog.cpp | 2 +- .../RiuSummaryVectorSelectionUi.cpp | 4 +-- 126 files changed, 198 insertions(+), 196 deletions(-) create mode 100644 ApplicationLibCode/Application/Tools/Summary/CMakeLists_files.cmake rename ApplicationLibCode/Application/Tools/{ => Summary}/RiaSummaryAddressAnalyzer.cpp (99%) rename ApplicationLibCode/Application/Tools/{ => Summary}/RiaSummaryAddressAnalyzer.h (99%) rename ApplicationLibCode/{ProjectDataModel/Summary/RimSummaryAddressModifier.cpp => Application/Tools/Summary/RiaSummaryAddressModifier.cpp} (88%) rename ApplicationLibCode/{ProjectDataModel/Summary/RimSummaryAddressModifier.h => Application/Tools/Summary/RiaSummaryAddressModifier.h} (98%) rename ApplicationLibCode/Application/{ => Tools/Summary}/RiaSummaryCurveAddress.cpp (100%) rename ApplicationLibCode/Application/{ => Tools/Summary}/RiaSummaryCurveAddress.h (100%) rename ApplicationLibCode/Application/{ => Tools/Summary}/RiaSummaryCurveDefinition.cpp (97%) rename ApplicationLibCode/Application/{ => Tools/Summary}/RiaSummaryCurveDefinition.h (100%) rename ApplicationLibCode/Application/{ => Tools/Summary}/RiaSummaryDefines.cpp (99%) rename ApplicationLibCode/Application/{ => Tools/Summary}/RiaSummaryDefines.h (100%) rename ApplicationLibCode/Application/Tools/{ => Summary}/RiaSummaryStringTools.cpp (99%) rename ApplicationLibCode/Application/Tools/{ => Summary}/RiaSummaryStringTools.h (100%) rename ApplicationLibCode/Application/Tools/{ => Summary}/RiaSummaryTools.cpp (99%) rename ApplicationLibCode/Application/Tools/{ => Summary}/RiaSummaryTools.h (100%) diff --git a/ApplicationLibCode/Application/CMakeLists_files.cmake b/ApplicationLibCode/Application/CMakeLists_files.cmake index 3fdac472c4..cea6b41726 100644 --- a/ApplicationLibCode/Application/CMakeLists_files.cmake +++ b/ApplicationLibCode/Application/CMakeLists_files.cmake @@ -13,7 +13,6 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaPreferencesOsdu.h ${CMAKE_CURRENT_LIST_DIR}/RiaPreferencesSumo.h ${CMAKE_CURRENT_LIST_DIR}/RiaPorosityModel.h - ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveDefinition.h ${CMAKE_CURRENT_LIST_DIR}/RiaCurveSetDefinition.h ${CMAKE_CURRENT_LIST_DIR}/RiaRftPltCurveDefinition.h ${CMAKE_CURRENT_LIST_DIR}/RiaViewRedrawScheduler.h @@ -34,12 +33,10 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaPlotCollectionScheduler.h ${CMAKE_CURRENT_LIST_DIR}/RiaScheduler.h ${CMAKE_CURRENT_LIST_DIR}/RiaSeismicDefines.h - ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryDefines.h ${CMAKE_CURRENT_LIST_DIR}/RiaLasDefines.h ${CMAKE_CURRENT_LIST_DIR}/RiaOsduDefines.h ${CMAKE_CURRENT_LIST_DIR}/RiaCloudDefines.h ${CMAKE_CURRENT_LIST_DIR}/RiaWellFlowDefines.h - ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveAddress.h ${CMAKE_CURRENT_LIST_DIR}/RiaQuickAccessScheduler.h ) @@ -58,7 +55,6 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaPreferencesOsdu.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaPreferencesSumo.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaPorosityModel.cpp - ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveDefinition.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaCurveSetDefinition.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaRftPltCurveDefinition.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaViewRedrawScheduler.cpp @@ -78,13 +74,11 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaDateTimeDefines.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaPlotCollectionScheduler.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaScheduler.cpp - ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryDefines.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaSeismicDefines.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaLasDefines.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaOsduDefines.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaCloudDefines.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaWellFlowDefines.cpp - ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveAddress.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaQuickAccessScheduler.cpp ) diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index 02c08654ca..3826a8042b 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -35,9 +35,9 @@ #include "RiaProjectModifier.h" #include "RiaRegressionTestRunner.h" #include "RiaSocketServer.h" -#include "RiaSummaryTools.h" #include "RiaVersionInfo.h" #include "RiaViewRedrawScheduler.h" +#include "Summary/RiaSummaryTools.h" #include "ExportCommands/RicSnapshotAllPlotsToFileFeature.h" #include "ExportCommands/RicSnapshotAllViewsToFileFeature.h" diff --git a/ApplicationLibCode/Application/Tools/CMakeLists_files.cmake b/ApplicationLibCode/Application/Tools/CMakeLists_files.cmake index 60bedd8f48..cf7d37a4c4 100644 --- a/ApplicationLibCode/Application/Tools/CMakeLists_files.cmake +++ b/ApplicationLibCode/Application/Tools/CMakeLists_files.cmake @@ -12,11 +12,9 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaRegressionTest.h ${CMAKE_CURRENT_LIST_DIR}/RiaImportEclipseCaseTools.h ${CMAKE_CURRENT_LIST_DIR}/RiaQDateTimeTools.h - ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryTools.h ${CMAKE_CURRENT_LIST_DIR}/RiaWellNameComparer.h ${CMAKE_CURRENT_LIST_DIR}/RiaStdStringTools.h ${CMAKE_CURRENT_LIST_DIR}/RiaInterpolationTools.h - ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryAddressAnalyzer.h ${CMAKE_CURRENT_LIST_DIR}/RiaSimWellBranchTools.h ${CMAKE_CURRENT_LIST_DIR}/RiaProjectFileTools.h ${CMAKE_CURRENT_LIST_DIR}/RiaStringEncodingTools.h @@ -48,7 +46,6 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaValidRegExpValidator.h ${CMAKE_CURRENT_LIST_DIR}/RiaVec3Tools.h ${CMAKE_CURRENT_LIST_DIR}/RiaEnsembleNameTools.h - ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryStringTools.h ${CMAKE_CURRENT_LIST_DIR}/RiaNetworkTools.h ${CMAKE_CURRENT_LIST_DIR}/RiaOpenMPTools.h ${CMAKE_CURRENT_LIST_DIR}/RiaNumericalTools.h @@ -72,11 +69,9 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaRegressionTest.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaImportEclipseCaseTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaQDateTimeTools.cpp - ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaWellNameComparer.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaStdStringTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaInterpolationTools.cpp - ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryAddressAnalyzer.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaSimWellBranchTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaProjectFileTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaStringEncodingTools.cpp @@ -101,7 +96,6 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaValidRegExpValidator.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaEnsembleNameTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaVec3Tools.cpp - ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryStringTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaNetworkTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaOpenMPTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaNumericalTools.cpp diff --git a/ApplicationLibCode/Application/Tools/RiaEnsembleNameTools.cpp b/ApplicationLibCode/Application/Tools/RiaEnsembleNameTools.cpp index 5d17195a1c..e6281293d8 100644 --- a/ApplicationLibCode/Application/Tools/RiaEnsembleNameTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaEnsembleNameTools.cpp @@ -19,8 +19,8 @@ #include "RiaEnsembleNameTools.h" #include "RiaFilePathTools.h" -#include "RiaSummaryDefines.h" #include "RiaTextStringTools.h" +#include "Summary/RiaSummaryDefines.h" #include "RimCaseDisplayNameTools.h" #include "RimProject.h" diff --git a/ApplicationLibCode/Application/Tools/RiaEnsembleNameTools.h b/ApplicationLibCode/Application/Tools/RiaEnsembleNameTools.h index 4717d80504..f74fc9a246 100644 --- a/ApplicationLibCode/Application/Tools/RiaEnsembleNameTools.h +++ b/ApplicationLibCode/Application/Tools/RiaEnsembleNameTools.h @@ -23,7 +23,7 @@ #include #include -#include "RiaSummaryDefines.h" +#include "Summary/RiaSummaryDefines.h" class RimSummaryCase; diff --git a/ApplicationLibCode/Application/Tools/Summary/CMakeLists_files.cmake b/ApplicationLibCode/Application/Tools/Summary/CMakeLists_files.cmake new file mode 100644 index 0000000000..07642502cf --- /dev/null +++ b/ApplicationLibCode/Application/Tools/Summary/CMakeLists_files.cmake @@ -0,0 +1,23 @@ +set(SOURCE_GROUP_HEADER_FILES + ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryAddressAnalyzer.h + ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryAddressModifier.h + ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveAddress.h + ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveDefinition.h + ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryDefines.h + ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryStringTools.h + ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryTools.h +) + +set(SOURCE_GROUP_SOURCE_FILES + ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryAddressAnalyzer.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryAddressModifier.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveAddress.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveDefinition.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryDefines.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryStringTools.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryTools.cpp +) + +list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) + +list(APPEND CODE_SOURCE_FILES ${SOURCE_GROUP_SOURCE_FILES}) diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryAddressAnalyzer.cpp similarity index 99% rename from ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp rename to ApplicationLibCode/Application/Tools/Summary/RiaSummaryAddressAnalyzer.cpp index 5969e00b50..7e3a1a2ab2 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp +++ b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryAddressAnalyzer.cpp @@ -16,10 +16,10 @@ // ///////////////////////////////////////////////////////////////////////////////// -#include "RiaSummaryAddressAnalyzer.h" +#include "Summary/RiaSummaryAddressAnalyzer.h" #include "RiaStdStringTools.h" -#include "RiaSummaryCurveDefinition.h" +#include "Summary/RiaSummaryCurveDefinition.h" #include "RimSummaryCurve.h" #include "RimSummaryCurveCollection.h" diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.h b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryAddressAnalyzer.h similarity index 99% rename from ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.h rename to ApplicationLibCode/Application/Tools/Summary/RiaSummaryAddressAnalyzer.h index 342d2a178b..3e768d147c 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.h +++ b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryAddressAnalyzer.h @@ -18,8 +18,8 @@ #pragma once -#include "RiaSummaryCurveAddress.h" #include "RifEclipseSummaryAddress.h" +#include "Summary/RiaSummaryCurveAddress.h" #include #include diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressModifier.cpp b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryAddressModifier.cpp similarity index 88% rename from ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressModifier.cpp rename to ApplicationLibCode/Application/Tools/Summary/RiaSummaryAddressModifier.cpp index 235e16314c..7d848d655f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressModifier.cpp +++ b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryAddressModifier.cpp @@ -16,7 +16,7 @@ // ///////////////////////////////////////////////////////////////////////////////// -#include "RimSummaryAddressModifier.h" +#include "RiaSummaryAddressModifier.h" #include "RiaLogging.h" #include "RiaStdStringTools.h" @@ -30,7 +30,7 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseSummaryAddress RimSummaryAddressModifier::replaceTokenForCategory( const RifEclipseSummaryAddress& sourceAdr, +RifEclipseSummaryAddress RiaSummaryAddressModifier::replaceTokenForCategory( const RifEclipseSummaryAddress& sourceAdr, const std::string& token, RifEclipseSummaryAddressDefines::SummaryCategory contentType ) { @@ -103,7 +103,7 @@ RifEclipseSummaryAddress RimSummaryAddressModifier::replaceTokenForCategory( con //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RimSummaryAddressModifier::curveAddresses( const std::vector& curveAddressProviders ) +std::vector RiaSummaryAddressModifier::curveAddresses( const std::vector& curveAddressProviders ) { std::vector addresses; @@ -112,7 +112,7 @@ std::vector RimSummaryAddressModifier::curveAddresses( c std::visit( [&addresses]( auto&& arg ) { - auto curveAdr = RimSummaryAddressModifier::curveAddress( arg ); + auto curveAdr = RiaSummaryAddressModifier::curveAddress( arg ); addresses.push_back( curveAdr ); }, provider ); @@ -124,7 +124,7 @@ std::vector RimSummaryAddressModifier::curveAddresses( c //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryAddressModifier::applyAddressesToCurveAddressProviders( const std::vector& curveAddressProviders, +void RiaSummaryAddressModifier::applyAddressesToCurveAddressProviders( const std::vector& curveAddressProviders, const std::vector& addresses ) { if ( curveAddressProviders.size() != addresses.size() ) return; @@ -134,14 +134,14 @@ void RimSummaryAddressModifier::applyAddressesToCurveAddressProviders( const std auto provider = curveAddressProviders[i]; const auto& address = addresses[i]; - std::visit( [address]( auto&& arg ) { RimSummaryAddressModifier::setCurveAddress( arg, address ); }, provider ); + std::visit( [address]( auto&& arg ) { RiaSummaryAddressModifier::setCurveAddress( arg, address ); }, provider ); }; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RimSummaryAddressModifier::createAddressProviders( RimSummaryPlot* summaryPlot ) +std::vector RiaSummaryAddressModifier::createAddressProviders( RimSummaryPlot* summaryPlot ) { std::vector providers; @@ -161,7 +161,7 @@ std::vector RimSummaryAddressMo //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RimSummaryAddressModifier::allSummaryAddressesY( RimSummaryPlot* summaryPlot ) +std::vector RiaSummaryAddressModifier::allSummaryAddressesY( RimSummaryPlot* summaryPlot ) { std::vector addresses; @@ -171,7 +171,7 @@ std::vector RimSummaryAddressModifier::allSummaryAddre std::visit( [&addresses]( auto&& arg ) { - auto curveAdr = RimSummaryAddressModifier::curveAddress( arg ); + auto curveAdr = RiaSummaryAddressModifier::curveAddress( arg ); addresses.push_back( curveAdr.summaryAddressY() ); }, provider ); @@ -183,7 +183,7 @@ std::vector RimSummaryAddressModifier::allSummaryAddre //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryAddressModifier::updateAddressesByObjectName( const std::vector& curveAddressProviders, +void RiaSummaryAddressModifier::updateAddressesByObjectName( const std::vector& curveAddressProviders, const std::string& objectName, RimSummaryAddressCollection::CollectionContentType contentType ) { @@ -194,15 +194,15 @@ void RimSummaryAddressModifier::updateAddressesByObjectName( const std::vectorcurveAddress(); @@ -220,7 +220,7 @@ RiaSummaryCurveAddress RimSummaryAddressModifier::curveAddress( RimEnsembleCurve //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiaSummaryCurveAddress RimSummaryAddressModifier::curveAddress( RimSummaryCurve* curve ) +RiaSummaryCurveAddress RiaSummaryAddressModifier::curveAddress( RimSummaryCurve* curve ) { if ( curve == nullptr ) return RiaSummaryCurveAddress( RifEclipseSummaryAddress() ); return curve->curveAddress(); @@ -229,7 +229,7 @@ RiaSummaryCurveAddress RimSummaryAddressModifier::curveAddress( RimSummaryCurve* //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryAddressModifier::setCurveAddress( RimEnsembleCurveSet* curveSet, const RiaSummaryCurveAddress& curveAdr ) +void RiaSummaryAddressModifier::setCurveAddress( RimEnsembleCurveSet* curveSet, const RiaSummaryCurveAddress& curveAdr ) { if ( curveSet ) { @@ -240,7 +240,7 @@ void RimSummaryAddressModifier::setCurveAddress( RimEnsembleCurveSet* curveSet, //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryAddressModifier::setCurveAddress( RimSummaryCurve* curve, const RiaSummaryCurveAddress& curveAdr ) +void RiaSummaryAddressModifier::setCurveAddress( RimSummaryCurve* curve, const RiaSummaryCurveAddress& curveAdr ) { if ( curve ) { diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressModifier.h b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryAddressModifier.h similarity index 98% rename from ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressModifier.h rename to ApplicationLibCode/Application/Tools/Summary/RiaSummaryAddressModifier.h index 96672b3313..1be62459ba 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressModifier.h +++ b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryAddressModifier.h @@ -32,7 +32,7 @@ class RiaSummaryCurveAddress; //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -class RimSummaryAddressModifier +class RiaSummaryAddressModifier { public: // Define a variant for summary curves and ensemble curve set. This way we can treat them as similar object without a diff --git a/ApplicationLibCode/Application/RiaSummaryCurveAddress.cpp b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryCurveAddress.cpp similarity index 100% rename from ApplicationLibCode/Application/RiaSummaryCurveAddress.cpp rename to ApplicationLibCode/Application/Tools/Summary/RiaSummaryCurveAddress.cpp diff --git a/ApplicationLibCode/Application/RiaSummaryCurveAddress.h b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryCurveAddress.h similarity index 100% rename from ApplicationLibCode/Application/RiaSummaryCurveAddress.h rename to ApplicationLibCode/Application/Tools/Summary/RiaSummaryCurveAddress.h diff --git a/ApplicationLibCode/Application/RiaSummaryCurveDefinition.cpp b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryCurveDefinition.cpp similarity index 97% rename from ApplicationLibCode/Application/RiaSummaryCurveDefinition.cpp rename to ApplicationLibCode/Application/Tools/Summary/RiaSummaryCurveDefinition.cpp index bceae459e1..f2d5b1a4a4 100644 --- a/ApplicationLibCode/Application/RiaSummaryCurveDefinition.cpp +++ b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryCurveDefinition.cpp @@ -17,12 +17,13 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RiaSummaryCurveDefinition.h" + #include "RiaStdStringTools.h" +#include "RiaSummaryAddressModifier.h" #include "RiaSummaryCurveAddress.h" #include "RifSummaryReaderInterface.h" -#include "RimSummaryAddressModifier.h" #include "RimSummaryCase.h" #include "RimSummaryEnsemble.h" @@ -177,18 +178,18 @@ void RiaSummaryCurveDefinition::setIdentifierText( SummaryCategory category, con if ( RifEclipseSummaryAddress::isDependentOnWellName( category ) ) { m_summaryAddressX = - RimSummaryAddressModifier::replaceTokenForCategory( m_summaryAddressX, + RiaSummaryAddressModifier::replaceTokenForCategory( m_summaryAddressX, name, RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_WELL ); m_summaryAddressY = - RimSummaryAddressModifier::replaceTokenForCategory( m_summaryAddressY, + RiaSummaryAddressModifier::replaceTokenForCategory( m_summaryAddressY, name, RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_WELL ); } else { - m_summaryAddressX = RimSummaryAddressModifier::replaceTokenForCategory( m_summaryAddressX, name, m_summaryAddressX.category() ); - m_summaryAddressY = RimSummaryAddressModifier::replaceTokenForCategory( m_summaryAddressY, name, m_summaryAddressY.category() ); + m_summaryAddressX = RiaSummaryAddressModifier::replaceTokenForCategory( m_summaryAddressX, name, m_summaryAddressX.category() ); + m_summaryAddressY = RiaSummaryAddressModifier::replaceTokenForCategory( m_summaryAddressY, name, m_summaryAddressY.category() ); } } diff --git a/ApplicationLibCode/Application/RiaSummaryCurveDefinition.h b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryCurveDefinition.h similarity index 100% rename from ApplicationLibCode/Application/RiaSummaryCurveDefinition.h rename to ApplicationLibCode/Application/Tools/Summary/RiaSummaryCurveDefinition.h diff --git a/ApplicationLibCode/Application/RiaSummaryDefines.cpp b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryDefines.cpp similarity index 99% rename from ApplicationLibCode/Application/RiaSummaryDefines.cpp rename to ApplicationLibCode/Application/Tools/Summary/RiaSummaryDefines.cpp index 3ef5bac537..f4a68d48d7 100644 --- a/ApplicationLibCode/Application/RiaSummaryDefines.cpp +++ b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryDefines.cpp @@ -17,6 +17,7 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RiaSummaryDefines.h" + #include "cafAppEnum.h" namespace caf diff --git a/ApplicationLibCode/Application/RiaSummaryDefines.h b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryDefines.h similarity index 100% rename from ApplicationLibCode/Application/RiaSummaryDefines.h rename to ApplicationLibCode/Application/Tools/Summary/RiaSummaryDefines.h diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.cpp b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryStringTools.cpp similarity index 99% rename from ApplicationLibCode/Application/Tools/RiaSummaryStringTools.cpp rename to ApplicationLibCode/Application/Tools/Summary/RiaSummaryStringTools.cpp index f4aebecbbf..b81c0dbdf7 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.cpp +++ b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryStringTools.cpp @@ -16,12 +16,12 @@ // ///////////////////////////////////////////////////////////////////////////////// -#include "RiaSummaryStringTools.h" +#include "Summary/RiaSummaryStringTools.h" #include "RiaLogging.h" #include "RiaStdStringTools.h" -#include "RiaSummaryTools.h" #include "RiaTextStringTools.h" +#include "Summary/RiaSummaryTools.h" #include "RifEclipseSummaryAddress.h" #include "RifReaderEclipseSummary.h" diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.h b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryStringTools.h similarity index 100% rename from ApplicationLibCode/Application/Tools/RiaSummaryStringTools.h rename to ApplicationLibCode/Application/Tools/Summary/RiaSummaryStringTools.h diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryTools.cpp similarity index 99% rename from ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp rename to ApplicationLibCode/Application/Tools/Summary/RiaSummaryTools.cpp index d6081ba623..a86718a8e7 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp +++ b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryTools.cpp @@ -16,7 +16,7 @@ // ///////////////////////////////////////////////////////////////////////////////// -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RiaFilePathTools.h" #include "RiaTimeHistoryCurveResampler.h" diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryTools.h b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryTools.h similarity index 100% rename from ApplicationLibCode/Application/Tools/RiaSummaryTools.h rename to ApplicationLibCode/Application/Tools/Summary/RiaSummaryTools.h diff --git a/ApplicationLibCode/CMakeLists.txt b/ApplicationLibCode/CMakeLists.txt index 3172fe9010..bd2c1cdb61 100644 --- a/ApplicationLibCode/CMakeLists.txt +++ b/ApplicationLibCode/CMakeLists.txt @@ -91,6 +91,7 @@ list( Application/Tools/CMakeLists_files.cmake Application/Tools/WellPathTools/CMakeLists_files.cmake Application/Tools/Cloud/CMakeLists_files.cmake + Application/Tools/Summary/CMakeLists_files.cmake ReservoirDataModel/CMakeLists_files.cmake ReservoirDataModel/CMakeLists_filesNotToUnitTest.cmake ReservoirDataModel/Completions/CMakeLists_files.cmake diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp index 09338e0413..64d71ffe5f 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp @@ -23,8 +23,8 @@ #include "RiaEclipseUnitTools.h" #include "RiaLogging.h" #include "RiaQDateTimeTools.h" -#include "RiaSummaryTools.h" #include "RigEclipseResultAddress.h" +#include "Summary/RiaSummaryTools.h" #include "RimEclipseCase.h" #include "RimEclipseResultCase.h" diff --git a/ApplicationLibCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp b/ApplicationLibCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp index ece5018956..afdbf172ca 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp +++ b/ApplicationLibCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp @@ -27,7 +27,6 @@ #include "RigSimWellData.h" -#include "RiaSummaryTools.h" #include "Rim3dView.h" #include "RimEclipseResultCase.h" #include "RimMainPlotCollection.h" @@ -41,6 +40,7 @@ #include "RimSummaryCurveAppearanceCalculator.h" #include "RimSummaryMultiPlot.h" #include "RimSummaryPlot.h" +#include "Summary/RiaSummaryTools.h" #include "RiuPlotMainWindow.h" diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp index 9139b82ca0..2de36126f8 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp @@ -22,14 +22,14 @@ #include "RiaLogging.h" #include "RiaPlotWindowRedrawScheduler.h" #include "RiaStdStringTools.h" -#include "RiaSummaryAddressAnalyzer.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryAddressAnalyzer.h" +#include "Summary/RiaSummaryAddressModifier.h" +#include "Summary/RiaSummaryTools.h" #include "RicSummaryPlotBuilder.h" #include "RimEnsembleCurveSet.h" #include "RimSummaryAddressCollection.h" -#include "RimSummaryAddressModifier.h" #include "RimSummaryCase.h" #include "RimSummaryCurve.h" #include "RimSummaryEnsemble.h" @@ -106,8 +106,8 @@ void RicAppendSummaryPlotsForObjectsFeature::appendPlots( RimSummaryMultiPlot* { const auto objectName = summaryAdrCollection->name().toStdString(); auto contentType = summaryAdrCollection->contentType(); - auto curveProviders = RimSummaryAddressModifier::createAddressProviders( duplicatedPlot ); - RimSummaryAddressModifier::updateAddressesByObjectName( curveProviders, objectName, contentType ); + auto curveProviders = RiaSummaryAddressModifier::createAddressProviders( duplicatedPlot ); + RiaSummaryAddressModifier::updateAddressesByObjectName( curveProviders, objectName, contentType ); summaryMultiPlot->addPlot( duplicatedPlot ); duplicatedPlot->resolveReferencesRecursively(); @@ -255,7 +255,7 @@ bool RicAppendSummaryPlotsForObjectsFeature::isSelectionCompatibleWithPlot( cons for ( auto plot : plotsForObjectType ) { - auto addresses = RimSummaryAddressModifier::allSummaryAddressesY( plot ); + auto addresses = RiaSummaryAddressModifier::allSummaryAddressesY( plot ); analyzer.appendAddresses( addresses ); } } @@ -318,7 +318,7 @@ std::vector RiaSummaryAddressAnalyzer myAnalyser; for ( auto sourcePlot : sourcePlots ) { - auto addresses = RimSummaryAddressModifier::allSummaryAddressesY( sourcePlot ); + auto addresses = RiaSummaryAddressModifier::allSummaryAddressesY( sourcePlot ); myAnalyser.appendAddresses( addresses ); } @@ -377,7 +377,7 @@ std::vector } else { - auto addresses = RimSummaryAddressModifier::allSummaryAddressesY( sourcePlot ); + auto addresses = RiaSummaryAddressModifier::allSummaryAddressesY( sourcePlot ); for ( const auto& a : addresses ) { diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.cpp index fbc977952b..9eded29ba4 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.cpp @@ -19,7 +19,7 @@ #include "RicNewSummaryMultiPlotFromDataVectorFeature.h" #include "RiaPreferencesSummary.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RimSummaryAddress.h" #include "RimSummaryCase.h" diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromDataVectorFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromDataVectorFeature.cpp index 3ef03ffa15..2fb9719f53 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromDataVectorFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromDataVectorFeature.cpp @@ -18,9 +18,9 @@ #include "RicNewSummaryPlotFromDataVectorFeature.h" -#include "RiaSummaryTools.h" #include "RimSummaryAddress.h" #include "RimSummaryPlot.h" +#include "Summary/RiaSummaryTools.h" #include "RicSummaryPlotBuilder.h" diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp index a9987e40c4..9fc7f26961 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp @@ -23,8 +23,8 @@ #include "SummaryPlotCommands/RicSummaryPlotFeatureImpl.h" #include "RiaPreferencesSummary.h" -#include "RiaSummaryAddressAnalyzer.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryAddressAnalyzer.h" +#include "Summary/RiaSummaryTools.h" #include "RifEclipseSummaryAddress.h" #include "RifReaderEclipseSummary.h" diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp index ea8e05bd59..b9e011a3f4 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp @@ -25,8 +25,8 @@ #include "RiaGuiApplication.h" #include "RiaLogging.h" #include "RiaPreferences.h" -#include "RiaSummaryAddressAnalyzer.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryAddressAnalyzer.h" +#include "Summary/RiaSummaryTools.h" #include "RimEnsembleCurveSet.h" #include "RimEnsembleCurveSetCollection.h" diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectCaseOrEnsembleUi.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectCaseOrEnsembleUi.cpp index d36ebdc3b3..388ff96b2b 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectCaseOrEnsembleUi.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectCaseOrEnsembleUi.cpp @@ -18,7 +18,7 @@ #include "RicSelectCaseOrEnsembleUi.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RimProject.h" #include "RimSummaryCase.h" diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectPlotTemplateUi.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectPlotTemplateUi.cpp index 9b1a6c3dd0..bda61c3d45 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectPlotTemplateUi.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectPlotTemplateUi.cpp @@ -18,7 +18,7 @@ #include "RicSelectPlotTemplateUi.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "PlotTemplates/RimPlotTemplateFileItem.h" #include "PlotTemplates/RimPlotTemplateFolderItem.h" diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp index ceba810a69..b9adb4a22d 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp @@ -21,8 +21,8 @@ #include "RiaGuiApplication.h" #include "RiaLogging.h" #include "RiaPreferences.h" -#include "RiaSummaryAddressAnalyzer.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryAddressAnalyzer.h" +#include "Summary/RiaSummaryTools.h" #include "PlotBuilderCommands/RicSummaryPlotBuilder.h" #include "RicSelectPlotTemplateUi.h" diff --git a/ApplicationLibCode/Commands/RicCloseObservedDataFeature.cpp b/ApplicationLibCode/Commands/RicCloseObservedDataFeature.cpp index 07ec3410a0..be58b42565 100644 --- a/ApplicationLibCode/Commands/RicCloseObservedDataFeature.cpp +++ b/ApplicationLibCode/Commands/RicCloseObservedDataFeature.cpp @@ -18,7 +18,7 @@ #include "RicCloseObservedDataFeature.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RimMainPlotCollection.h" #include "RimObservedDataCollection.h" diff --git a/ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.cpp b/ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.cpp index 3262200f88..999bd53b30 100644 --- a/ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.cpp +++ b/ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.cpp @@ -19,7 +19,7 @@ #include "RicCloseSummaryCaseFeature.h" #include "RiaGuiApplication.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RicDeleteItemFeature.h" diff --git a/ApplicationLibCode/Commands/RicCreateSummaryCaseCollectionFeature.cpp b/ApplicationLibCode/Commands/RicCreateSummaryCaseCollectionFeature.cpp index 99f442abec..3d6b9f87d5 100644 --- a/ApplicationLibCode/Commands/RicCreateSummaryCaseCollectionFeature.cpp +++ b/ApplicationLibCode/Commands/RicCreateSummaryCaseCollectionFeature.cpp @@ -18,7 +18,7 @@ #include "RicCreateSummaryCaseCollectionFeature.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RimSummaryCase.h" #include "RimSummaryCaseMainCollection.h" diff --git a/ApplicationLibCode/Commands/RicDeleteSummaryCaseCollectionFeature.cpp b/ApplicationLibCode/Commands/RicDeleteSummaryCaseCollectionFeature.cpp index fd2c009441..542205f6b3 100644 --- a/ApplicationLibCode/Commands/RicDeleteSummaryCaseCollectionFeature.cpp +++ b/ApplicationLibCode/Commands/RicDeleteSummaryCaseCollectionFeature.cpp @@ -18,7 +18,7 @@ #include "RicDeleteSummaryCaseCollectionFeature.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RimDerivedEnsembleCaseCollection.h" #include "RimMainPlotCollection.h" diff --git a/ApplicationLibCode/Commands/RicImportEnsembleFeature.cpp b/ApplicationLibCode/Commands/RicImportEnsembleFeature.cpp index 9abdf5c8f8..ede38aff0e 100644 --- a/ApplicationLibCode/Commands/RicImportEnsembleFeature.cpp +++ b/ApplicationLibCode/Commands/RicImportEnsembleFeature.cpp @@ -22,9 +22,9 @@ #include "RiaEnsembleNameTools.h" #include "RiaFilePathTools.h" #include "RiaPreferences.h" -#include "RiaSummaryDefines.h" -#include "RiaSummaryTools.h" #include "RiaTextStringTools.h" +#include "Summary/RiaSummaryDefines.h" +#include "Summary/RiaSummaryTools.h" #include "RicCreateSummaryCaseCollectionFeature.h" #include "RicImportSummaryCasesFeature.h" diff --git a/ApplicationLibCode/Commands/RicImportEnsembleFeature.h b/ApplicationLibCode/Commands/RicImportEnsembleFeature.h index 6deb3a09da..705e7253da 100644 --- a/ApplicationLibCode/Commands/RicImportEnsembleFeature.h +++ b/ApplicationLibCode/Commands/RicImportEnsembleFeature.h @@ -19,7 +19,7 @@ #pragma once #include "RiaEnsembleNameTools.h" -#include "RiaSummaryDefines.h" +#include "Summary/RiaSummaryDefines.h" #include "cafCmdFeature.h" diff --git a/ApplicationLibCode/Commands/RicImportEnsembleSurfaceFeature.cpp b/ApplicationLibCode/Commands/RicImportEnsembleSurfaceFeature.cpp index 22cc3633d9..1809c4e648 100644 --- a/ApplicationLibCode/Commands/RicImportEnsembleSurfaceFeature.cpp +++ b/ApplicationLibCode/Commands/RicImportEnsembleSurfaceFeature.cpp @@ -22,7 +22,7 @@ #include "RiaEnsembleNameTools.h" #include "RiaFilePathTools.h" #include "RiaLogging.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RicImportEnsembleFeature.h" #include "RicRecursiveFileSearchDialog.h" diff --git a/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp b/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp index a383ab297c..c96148522d 100644 --- a/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp +++ b/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp @@ -18,7 +18,7 @@ #include "RicImportSummaryCasesFeature.h" -#include "RiaSummaryDefines.h" +#include "Summary/RiaSummaryDefines.h" #include "SummaryPlotCommands/RicNewSummaryCurveFeature.h" #include "RiaGuiApplication.h" diff --git a/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.h b/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.h index 6cd9568e72..706fb35198 100644 --- a/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.h +++ b/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.h @@ -19,7 +19,7 @@ #pragma once #include "RiaEnsembleNameTools.h" -#include "RiaSummaryDefines.h" +#include "Summary/RiaSummaryDefines.h" #include "RicRecursiveFileSearchDialog.h" #include "cafCmdFeature.h" diff --git a/ApplicationLibCode/Commands/RicImportSummaryGroupFeature.cpp b/ApplicationLibCode/Commands/RicImportSummaryGroupFeature.cpp index cbf578ac30..cc79629f6c 100644 --- a/ApplicationLibCode/Commands/RicImportSummaryGroupFeature.cpp +++ b/ApplicationLibCode/Commands/RicImportSummaryGroupFeature.cpp @@ -21,9 +21,9 @@ #include "RiaGuiApplication.h" #include "RiaPreferences.h" -#include "RiaSummaryDefines.h" #include "RicCreateSummaryCaseCollectionFeature.h" #include "RicImportSummaryCasesFeature.h" +#include "Summary/RiaSummaryDefines.h" #include "RifSummaryCaseRestartSelector.h" diff --git a/ApplicationLibCode/Commands/RicRecursiveFileSearchDialog.h b/ApplicationLibCode/Commands/RicRecursiveFileSearchDialog.h index c36283d3e5..98ead09e78 100644 --- a/ApplicationLibCode/Commands/RicRecursiveFileSearchDialog.h +++ b/ApplicationLibCode/Commands/RicRecursiveFileSearchDialog.h @@ -23,7 +23,7 @@ #include "cafPdmPointer.h" #include "RiaEnsembleNameTools.h" -#include "RiaSummaryDefines.h" +#include "Summary/RiaSummaryDefines.h" #include diff --git a/ApplicationLibCode/Commands/RicReloadSummaryCaseFeature.cpp b/ApplicationLibCode/Commands/RicReloadSummaryCaseFeature.cpp index 8ec73873a4..ea8a7405f1 100644 --- a/ApplicationLibCode/Commands/RicReloadSummaryCaseFeature.cpp +++ b/ApplicationLibCode/Commands/RicReloadSummaryCaseFeature.cpp @@ -19,7 +19,7 @@ #include "RicReloadSummaryCaseFeature.h" #include "RiaLogging.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RimObservedDataCollection.h" #include "RimObservedSummaryData.h" diff --git a/ApplicationLibCode/Commands/RicReplaceCaseFeature.cpp b/ApplicationLibCode/Commands/RicReplaceCaseFeature.cpp index 0384407d82..9305474ea6 100644 --- a/ApplicationLibCode/Commands/RicReplaceCaseFeature.cpp +++ b/ApplicationLibCode/Commands/RicReplaceCaseFeature.cpp @@ -21,7 +21,7 @@ #include "RiaEclipseFileNameTools.h" #include "RiaGuiApplication.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RicImportGeneralDataFeature.h" diff --git a/ApplicationLibCode/Commands/RicReplaceSummaryCaseFeature.cpp b/ApplicationLibCode/Commands/RicReplaceSummaryCaseFeature.cpp index a6203ac131..5e43fb80a5 100644 --- a/ApplicationLibCode/Commands/RicReplaceSummaryCaseFeature.cpp +++ b/ApplicationLibCode/Commands/RicReplaceSummaryCaseFeature.cpp @@ -20,7 +20,7 @@ #include "RiaEclipseFileNameTools.h" #include "RiaLogging.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RicImportGeneralDataFeature.h" diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicCreateCrossPlotFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicCreateCrossPlotFeature.cpp index 23390366d4..a19dd39b3c 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicCreateCrossPlotFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicCreateCrossPlotFeature.cpp @@ -21,7 +21,7 @@ #include "PlotBuilderCommands/RicSummaryPlotBuilder.h" #include "RiaPreferencesSummary.h" -#include "RiaSummaryCurveAddress.h" +#include "Summary/RiaSummaryCurveAddress.h" #include "RifEclipseSummaryAddress.h" diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicCreateDeclineCurvesFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicCreateDeclineCurvesFeature.cpp index b3bb98390e..09051a9671 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicCreateDeclineCurvesFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicCreateDeclineCurvesFeature.cpp @@ -18,7 +18,7 @@ #include "RicCreateDeclineCurvesFeature.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RimSummaryCurve.h" #include "RimSummaryDeclineCurve.h" diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicCreateRegressionAnalysisCurveFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicCreateRegressionAnalysisCurveFeature.cpp index 071bdafbd1..82243b2b37 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicCreateRegressionAnalysisCurveFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicCreateRegressionAnalysisCurveFeature.cpp @@ -20,7 +20,7 @@ #include "RiaColorTables.h" #include "RiaColorTools.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RimEnsembleCurveSet.h" #include "RimSummaryCurve.h" diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryCurveFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryCurveFeature.cpp index d180d32614..5f63d8b2fa 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryCurveFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryCurveFeature.cpp @@ -18,7 +18,7 @@ #include "RicDuplicateSummaryCurveFeature.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RicPasteSummaryCurveFeature.h" diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryPlotFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryPlotFeature.cpp index 6e36310b2d..968982f661 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryPlotFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryPlotFeature.cpp @@ -18,7 +18,7 @@ #include "RicDuplicateSummaryPlotFeature.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RicPasteSummaryPlotFeature.h" diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryTableFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryTableFeature.cpp index 3e0418cd36..408e53d6c0 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryTableFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryTableFeature.cpp @@ -18,7 +18,7 @@ #include "RicDuplicateSummaryTableFeature.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RimMainPlotCollection.h" #include "RimSummaryTable.h" diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryPlotFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryPlotFeature.cpp index 434f7d23bd..836936fe36 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryPlotFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryPlotFeature.cpp @@ -19,7 +19,7 @@ #include "RicEditSummaryPlotFeature.h" #include "RiaGuiApplication.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RicSummaryPlotEditorDialog.h" #include "RicSummaryPlotEditorUi.h" diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDefaultSummaryPlotFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDefaultSummaryPlotFeature.cpp index b45f88f08e..6117722c16 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDefaultSummaryPlotFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDefaultSummaryPlotFeature.cpp @@ -18,7 +18,7 @@ #include "RicNewDefaultSummaryPlotFeature.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "PlotBuilderCommands/RicSummaryPlotBuilder.h" #include "RicEditSummaryPlotFeature.h" diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewGridTimeHistoryCurveFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewGridTimeHistoryCurveFeature.cpp index 3931f466ae..8fef4758e8 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewGridTimeHistoryCurveFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewGridTimeHistoryCurveFeature.cpp @@ -19,7 +19,7 @@ #include "RicNewGridTimeHistoryCurveFeature.h" #include "RiaGuiApplication.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RigFemResultAddress.h" diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCrossPlotCurveFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCrossPlotCurveFeature.cpp index d65be85ead..338265fd48 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCrossPlotCurveFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCrossPlotCurveFeature.cpp @@ -19,7 +19,7 @@ #include "RicNewSummaryCrossPlotCurveFeature.h" #include "RiaGuiApplication.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RimMainPlotCollection.h" #include "RimOilField.h" diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.cpp index 8735093130..68d2577f43 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.cpp @@ -21,7 +21,6 @@ #include "RiaColorTables.h" #include "RiaGuiApplication.h" -#include "RiaSummaryTools.h" #include "RimMainPlotCollection.h" #include "RimObservedDataCollection.h" #include "RimObservedSummaryData.h" @@ -31,6 +30,7 @@ #include "RimSummaryCurve.h" #include "RimSummaryCurveCollection.h" #include "RimSummaryPlot.h" +#include "Summary/RiaSummaryTools.h" #include "RiuPlotMainWindow.h" diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp index 6cb2809bdb..a40db01370 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp @@ -21,8 +21,8 @@ #include "RiaColorTables.h" #include "RiaGuiApplication.h" #include "RiaPreferencesSummary.h" -#include "RiaSummaryTools.h" #include "RiaTextStringTools.h" +#include "Summary/RiaSummaryTools.h" #include "RimEnsembleCurveFilter.h" #include "RimEnsembleCurveFilterCollection.h" diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryTableFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryTableFeature.cpp index cb2921b18e..65f7024ad0 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryTableFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryTableFeature.cpp @@ -18,7 +18,7 @@ #include "RicNewSummaryTableFeature.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RimMainPlotCollection.h" #include "RimSummaryAddress.h" diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.cpp index 74c96d4d34..1c85824712 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.cpp @@ -18,7 +18,7 @@ #include "RicOpenSummaryPlotEditorFeature.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RicEditSummaryPlotFeature.h" #include "RicNewSummaryEnsembleCurveSetFeature.h" diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteEnsembleCurveSetFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteEnsembleCurveSetFeature.cpp index 07c68a21a0..72cb7135a0 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteEnsembleCurveSetFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteEnsembleCurveSetFeature.cpp @@ -18,7 +18,7 @@ #include "RicPasteEnsembleCurveSetFeature.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "OperationsUsingObjReferences/RicPasteFeatureImpl.h" diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp index 474abf2353..0c167d88bc 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp @@ -18,7 +18,7 @@ #include "RicPasteSummaryCurveFeature.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "OperationsUsingObjReferences/RicPasteFeatureImpl.h" diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryMultiPlotFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryMultiPlotFeature.cpp index fd6512cce0..0a255f28c7 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryMultiPlotFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryMultiPlotFeature.cpp @@ -21,9 +21,9 @@ #include "OperationsUsingObjReferences/RicPasteFeatureImpl.h" #include "PlotBuilderCommands/RicSummaryPlotBuilder.h" -#include "RiaSummaryTools.h" #include "RimSummaryMultiPlot.h" #include "RimSummaryMultiPlotCollection.h" +#include "Summary/RiaSummaryTools.h" #include "cafPdmDefaultObjectFactory.h" #include "cafPdmObjectGroup.h" diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSelectSummaryPlotUI.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSelectSummaryPlotUI.cpp index fc4d75445f..ba088bb3c9 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSelectSummaryPlotUI.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSelectSummaryPlotUI.cpp @@ -18,7 +18,7 @@ #include "RicSelectSummaryPlotUI.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RimEclipseResultCase.h" #include "RimEclipseView.h" diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorUi.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorUi.cpp index cfe135d6ba..2eda642886 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorUi.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorUi.cpp @@ -18,7 +18,7 @@ #include "RicSummaryCurveCalculatorUi.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RimProject.h" #include "RimSummaryCalculationCollection.h" diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp index 64b434d21a..30e27ce8ae 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp @@ -21,7 +21,7 @@ #include "RiaColorTables.h" #include "RiaCurveSetDefinition.h" #include "RiaGuiApplication.h" -#include "RiaSummaryCurveDefinition.h" +#include "Summary/RiaSummaryCurveDefinition.h" #include "RiuSummaryCurveDefinitionKeywords.h" diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp index 1dc62e353a..28b9ebc588 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp @@ -26,8 +26,8 @@ #include "RiaImportEclipseCaseTools.h" #include "RiaLogging.h" #include "RiaPreferencesSummary.h" -#include "RiaSummaryStringTools.h" #include "RiaTextStringTools.h" +#include "Summary/RiaSummaryStringTools.h" #include "PlotBuilderCommands/RicSummaryPlotBuilder.h" #include "RicCreateSummaryCaseCollectionFeature.h" diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewRftSegmentWellLogPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicNewRftSegmentWellLogPlotFeature.cpp index 44088e39f7..b725692e51 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewRftSegmentWellLogPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewRftSegmentWellLogPlotFeature.cpp @@ -27,7 +27,7 @@ #include "RiaLogging.h" #include "RiaPlotWindowRedrawScheduler.h" #include "RiaRftDefines.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RifReaderOpmRft.h" diff --git a/ApplicationLibCode/FileInterface/RifEclipseSummaryTools.cpp b/ApplicationLibCode/FileInterface/RifEclipseSummaryTools.cpp index 7f0857de6a..27c7fcb94e 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseSummaryTools.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseSummaryTools.cpp @@ -20,8 +20,8 @@ #include "RiaFilePathTools.h" #include "RiaStringEncodingTools.h" -#include "RiaSummaryAddressAnalyzer.h" #include "RifSummaryReaderInterface.h" +#include "Summary/RiaSummaryAddressAnalyzer.h" #include "cafAppEnum.h" diff --git a/ApplicationLibCode/FileInterface/RifSummaryCaseRestartSelector.h b/ApplicationLibCode/FileInterface/RifSummaryCaseRestartSelector.h index 618de29fd9..647378e0e1 100644 --- a/ApplicationLibCode/FileInterface/RifSummaryCaseRestartSelector.h +++ b/ApplicationLibCode/FileInterface/RifSummaryCaseRestartSelector.h @@ -18,7 +18,7 @@ #pragma once -#include "RiaSummaryDefines.h" +#include "Summary/RiaSummaryDefines.h" #include "RicSummaryCaseRestartDialog.h" diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp index cdc24d2212..6a03aaded0 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp @@ -22,8 +22,8 @@ #include "RiaPlotDefines.h" #include "RiaPreferences.h" #include "RiaQDateTimeTools.h" -#include "RiaSummaryCurveDefinition.h" #include "RiaTextStringTools.h" +#include "Summary/RiaSummaryCurveDefinition.h" #include "RifSummaryReaderInterface.h" diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotCollection.cpp index 5a9cf7c8fa..832209c43c 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotCollection.cpp @@ -18,7 +18,7 @@ #include "RimAnalysisPlotCollection.h" -#include "RiaSummaryCurveDefinition.h" +#include "Summary/RiaSummaryCurveDefinition.h" #include "RimAnalysisPlot.h" #include "RimPlotDataFilterCollection.h" diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotDataEntry.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotDataEntry.cpp index bd05815aa3..b5ad302d5a 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotDataEntry.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotDataEntry.cpp @@ -18,7 +18,7 @@ #include "RimAnalysisPlotDataEntry.h" -#include "RiaSummaryCurveDefinition.h" +#include "Summary/RiaSummaryCurveDefinition.h" #include "RifEclipseSummaryAddress.h" #include "RimSummaryEnsemble.h" diff --git a/ApplicationLibCode/ProjectDataModel/Cloud/RimCloudDataSourceCollection.cpp b/ApplicationLibCode/ProjectDataModel/Cloud/RimCloudDataSourceCollection.cpp index be75fcb18d..16004c7a50 100644 --- a/ApplicationLibCode/ProjectDataModel/Cloud/RimCloudDataSourceCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Cloud/RimCloudDataSourceCollection.cpp @@ -19,7 +19,7 @@ #include "RimCloudDataSourceCollection.h" #include "RiaApplication.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "PlotBuilderCommands/RicSummaryPlotBuilder.h" diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp index 0f33aa3fb1..fdf4ba84fa 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp @@ -20,7 +20,7 @@ #include "RiaPreferences.h" #include "RiaQDateTimeTools.h" -#include "RiaSummaryCurveDefinition.h" +#include "Summary/RiaSummaryCurveDefinition.h" #include "RifSummaryReaderInterface.h" diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp index b117efff40..41f04c0d88 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp @@ -22,7 +22,7 @@ #include "RiaPreferences.h" #include "RiaQDateTimeTools.h" #include "RiaStatisticsTools.h" -#include "RiaSummaryCurveDefinition.h" +#include "Summary/RiaSummaryCurveDefinition.h" #include "RifCsvDataTableFormatter.h" #include "RifSummaryReaderInterface.h" diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.h b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.h index fd713e11d6..27f1899ad0 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.h +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.h @@ -21,7 +21,7 @@ #include "RimAbstractCorrelationPlot.h" #include "RiaCurveDataTools.h" -#include "RiaSummaryCurveDefinition.h" +#include "Summary/RiaSummaryCurveDefinition.h" #include "cafAppEnum.h" diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.h b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.h index ed6e77016b..cb585c95af 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.h +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.h @@ -18,7 +18,7 @@ #pragma once -#include "RiaSummaryCurveDefinition.h" // use of caf::Signal requires this include +#include "Summary/RiaSummaryCurveDefinition.h" // use of caf::Signal requires this include #include "RimAbstractCorrelationPlot.h" diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlotCollection.cpp index f48fe20ad4..08dd6cff9a 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlotCollection.cpp @@ -18,7 +18,7 @@ #include "RimCorrelationPlotCollection.h" -#include "RiaSummaryCurveDefinition.h" +#include "Summary/RiaSummaryCurveDefinition.h" #include "RimCorrelationMatrixPlot.h" #include "RimCorrelationPlot.h" diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp index a8a616510d..256c0c9a90 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp @@ -19,7 +19,7 @@ #include "RiaPreferences.h" #include "RiaQDateTimeTools.h" -#include "RiaSummaryCurveDefinition.h" +#include "Summary/RiaSummaryCurveDefinition.h" #include "RimCorrelationMatrixPlot.h" #include "RimCorrelationPlot.h" diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp index 44bcb8bb6e..d7192ca5aa 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp @@ -22,7 +22,7 @@ #include "RiaColorTools.h" #include "RiaPlotDefines.h" #include "RiaSimWellBranchTools.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RifReaderEclipseRft.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionWeight.cpp b/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionWeight.cpp index 94fbc1884e..6c4019944f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionWeight.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionWeight.cpp @@ -19,7 +19,7 @@ #include "RimCustomObjectiveFunctionWeight.h" #include "RiaStdStringTools.h" -#include "RiaSummaryCurveDefinition.h" +#include "Summary/RiaSummaryCurveDefinition.h" #include "RimCustomObjectiveFunction.h" #include "RimEnsembleCurveSet.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp index d5d928f0ce..faa0b63244 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp @@ -20,7 +20,7 @@ #include "RimMainPlotCollection.h" #include "RiaPlotCollectionScheduler.h" -#include "RiaSummaryDefines.h" +#include "Summary/RiaSummaryDefines.h" #include "PlotBuilderCommands/RicSummaryPlotBuilder.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimReloadCaseTools.cpp b/ApplicationLibCode/ProjectDataModel/RimReloadCaseTools.cpp index d06bdd22b1..83f979a4fb 100644 --- a/ApplicationLibCode/ProjectDataModel/RimReloadCaseTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimReloadCaseTools.cpp @@ -23,7 +23,7 @@ #include "RiaImportEclipseCaseTools.h" #include "RiaLogging.h" #include "RiaPreferencesGrid.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "ApplicationCommands/RicShowMainWindowFeature.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewTools.cpp b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewTools.cpp index 557fc7a057..a2d81c4f18 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewTools.cpp @@ -19,7 +19,7 @@ #include "RimSimWellInViewTools.h" #include "RiaLogging.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RifEclipseSummaryAddress.h" #include "RifSummaryReaderInterface.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp index 08ba9fcf96..ae35be37e4 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp @@ -22,8 +22,8 @@ #include "RiaCurveMerger.h" #include "RiaLogging.h" -#include "RiaSummaryCurveDefinition.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryCurveDefinition.h" +#include "Summary/RiaSummaryTools.h" #include "RifSummaryReaderInterface.h" #include "RimDataSourceSteppingTools.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationCollection.cpp index f8b9092129..054c3cfc3e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationCollection.cpp @@ -18,7 +18,7 @@ #include "RimSummaryCalculationCollection.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RifSummaryReaderInterface.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.cpp b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.cpp index e0bb8bc853..6382536341 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.cpp @@ -19,8 +19,8 @@ #include "RimSummaryCalculationVariable.h" #include "RiaApplication.h" -#include "RiaSummaryCurveDefinition.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryCurveDefinition.h" +#include "Summary/RiaSummaryTools.h" #include "RifEclipseSummaryAddressQMetaType.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake index 9fc85d5fe1..92edcfa4e2 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake @@ -44,7 +44,6 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RimSummaryMultiPlotCollection.h ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotControls.h ${CMAKE_CURRENT_LIST_DIR}/RimEnsembleCurveInfoTextProvider.h - ${CMAKE_CURRENT_LIST_DIR}/RimSummaryAddressModifier.h ${CMAKE_CURRENT_LIST_DIR}/RimRftCase.h ${CMAKE_CURRENT_LIST_DIR}/RimCsvSummaryCase.h ${CMAKE_CURRENT_LIST_DIR}/RimSummaryTable.h @@ -103,7 +102,6 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimSummaryMultiPlotCollection.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotControls.cpp ${CMAKE_CURRENT_LIST_DIR}/RimEnsembleCurveInfoTextProvider.cpp - ${CMAKE_CURRENT_LIST_DIR}/RimSummaryAddressModifier.cpp ${CMAKE_CURRENT_LIST_DIR}/RimRftCase.cpp ${CMAKE_CURRENT_LIST_DIR}/RimCsvSummaryCase.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSummaryTable.cpp diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCrossPlotStatisticsCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCrossPlotStatisticsCase.cpp index fdeb533540..a867726aae 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCrossPlotStatisticsCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCrossPlotStatisticsCase.cpp @@ -19,8 +19,8 @@ #include "RimEnsembleCrossPlotStatisticsCase.h" #include "RiaLogging.h" -#include "RiaSummaryTools.h" #include "RiaTimeHistoryCurveResampler.h" +#include "Summary/RiaSummaryTools.h" #include "RifEclipseSummaryAddressDefines.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp index 9766c399de..5eb3e07283 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp @@ -20,7 +20,7 @@ #include "RiaCurveDataTools.h" #include "RiaStdStringTools.h" -#include "RiaSummaryCurveDefinition.h" +#include "Summary/RiaSummaryCurveDefinition.h" #include "RimCustomObjectiveFunction.h" #include "RimCustomObjectiveFunctionCollection.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index 43b11fb23e..711e598bda 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -23,9 +23,9 @@ #include "RiaPreferences.h" #include "RiaQDateTimeTools.h" #include "RiaResultNames.h" -#include "RiaSummaryAddressAnalyzer.h" -#include "RiaSummaryCurveDefinition.h" #include "RiaTimeTTools.h" +#include "Summary/RiaSummaryAddressAnalyzer.h" +#include "Summary/RiaSummaryCurveDefinition.h" #include "RimSummaryCalculationCollection.h" #include "SummaryPlotCommands/RicSummaryPlotEditorUi.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h index fc6639a258..a5b63c8b46 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h @@ -24,8 +24,8 @@ #include "RiaDateTimeDefines.h" #include "RiaPlotDefines.h" -#include "RiaSummaryCurveAddress.h" -#include "RiaSummaryDefines.h" +#include "Summary/RiaSummaryCurveAddress.h" +#include "Summary/RiaSummaryDefines.h" #include "RimEnsembleCrossPlotStatisticsCase.h" #include "RimEnsembleCurveSetColorManager.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp index ee8416675a..c24ccc446c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp @@ -19,8 +19,8 @@ #include "RimEnsembleStatisticsCase.h" #include "RiaCurveMerger.h" -#include "RiaSummaryTools.h" #include "RiaTimeHistoryCurveResampler.h" +#include "Summary/RiaSummaryTools.h" #include "RigStatisticsMath.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimGridSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimGridSummaryCase.cpp index d5c2111306..a710393246 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimGridSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimGridSummaryCase.cpp @@ -18,7 +18,7 @@ #include "RimGridSummaryCase.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RicfCommandObject.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimRftCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimRftCase.cpp index c271bfdeb2..fde3dcab5e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimRftCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimRftCase.cpp @@ -18,7 +18,7 @@ #include "RimRftCase.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RimMainPlotCollection.h" #include "RimSummaryCase.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp index b8d67a5c4d..19f5cc8bd8 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp @@ -18,7 +18,7 @@ #include "RimSummaryAddress.h" -#include "RiaSummaryDefines.h" +#include "Summary/RiaSummaryDefines.h" #include diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp index 3ee7a48258..9df123f0dc 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp @@ -18,7 +18,7 @@ #include "RimSummaryAddressCollection.h" -#include "RiaSummaryDefines.h" +#include "Summary/RiaSummaryDefines.h" #include "RifEclipseSummaryAddress.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressSelector.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressSelector.cpp index 29a0f6c7db..1ec2735d8e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressSelector.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressSelector.cpp @@ -19,8 +19,8 @@ #include "RimSummaryAddressSelector.h" #include "RiaResultNames.h" -#include "RiaSummaryCurveDefinition.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryCurveDefinition.h" +#include "Summary/RiaSummaryTools.h" #include "RifSummaryReaderInterface.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp index edeecd0f0b..0c179280be 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp @@ -21,7 +21,7 @@ #include "RiaEclipseFileNameTools.h" #include "RiaLogging.h" #include "RiaPreferencesSummary.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RifCaseRealizationParametersReader.h" #include "RifEclipseSummaryTools.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index 579e535995..8ffed8c081 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -26,9 +26,9 @@ #include "RiaPreferencesSummary.h" #include "RiaQDateTimeTools.h" #include "RiaResultNames.h" -#include "RiaSummaryCurveDefinition.h" -#include "RiaSummaryDefines.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryCurveDefinition.h" +#include "Summary/RiaSummaryDefines.h" +#include "Summary/RiaSummaryTools.h" #include "RimEclipseResultCase.h" #include "RimEnsembleCurveSet.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h index 4dd28e7b32..e866199726 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h @@ -26,8 +26,8 @@ #include "RiaDateTimeDefines.h" #include "RiaDefines.h" -#include "RiaSummaryCurveAddress.h" -#include "RiaSummaryDefines.h" +#include "Summary/RiaSummaryCurveAddress.h" +#include "Summary/RiaSummaryDefines.h" #include "RifEclipseSummaryAddressDefines.h" #include "RifEclipseSummaryAddressQMetaType.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp index 24d92c02ab..adb58c0d92 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp @@ -21,7 +21,7 @@ #include "RiaColorTables.h" #include "RiaColorTools.h" #include "RiaPreferencesSummary.h" -#include "RiaSummaryCurveDefinition.h" +#include "Summary/RiaSummaryCurveDefinition.h" #include "RiuQwtPlotCurve.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.h index 64711ef739..1190f1902e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.h @@ -18,8 +18,8 @@ #pragma once -#include "RiaSummaryDefines.h" #include "RimSummaryPlotSourceStepping.h" +#include "Summary/RiaSummaryDefines.h" #include "cafPdmChildArrayField.h" #include "cafPdmChildField.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurvesData.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurvesData.cpp index 75a465542e..4467d1299c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurvesData.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurvesData.cpp @@ -19,9 +19,9 @@ #include "RimSummaryCurvesData.h" #include "RiaGuiApplication.h" -#include "RiaSummaryCurveDefinition.h" -#include "RiaSummaryTools.h" #include "RiaTimeHistoryCurveResampler.h" +#include "Summary/RiaSummaryCurveDefinition.h" +#include "Summary/RiaSummaryTools.h" #include "RimAsciiDataCurve.h" #include "RimGridTimeHistoryCurve.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryDataSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryDataSourceStepping.cpp index acd6981484..ec1e5833b2 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryDataSourceStepping.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryDataSourceStepping.cpp @@ -18,7 +18,7 @@ #include "RimSummaryDataSourceStepping.h" -#include "RiaSummaryDefines.h" +#include "Summary/RiaSummaryDefines.h" #include "cafAppEnum.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryDeclineCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryDeclineCurve.cpp index a2f3281494..c6e65a98ed 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryDeclineCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryDeclineCurve.cpp @@ -19,8 +19,8 @@ #include "RimSummaryDeclineCurve.h" #include "RiaQDateTimeTools.h" -#include "RiaSummaryTools.h" #include "RiaTimeTTools.h" +#include "Summary/RiaSummaryTools.h" #include "RigDeclineCurveCalculator.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsemble.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsemble.cpp index 047ad81e70..2521d9ac6f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsemble.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsemble.cpp @@ -22,7 +22,7 @@ #include "RiaFieldHandleTools.h" #include "RiaLogging.h" #include "RiaStatisticsTools.h" -#include "RiaSummaryAddressAnalyzer.h" +#include "Summary/RiaSummaryAddressAnalyzer.h" #include "RifSummaryReaderInterface.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.cpp index 95e71469b7..e1a107334a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.cpp @@ -18,7 +18,7 @@ #include "RimSummaryEnsembleTools.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RifReaderRftInterface.h" #include "RifSummaryReaderInterface.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 92afd9b93c..e73f05834d 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -21,8 +21,9 @@ #include "RiaApplication.h" #include "RiaNumericalTools.h" #include "RiaPlotDefines.h" -#include "RiaSummaryAddressAnalyzer.h" -#include "RiaSummaryStringTools.h" +#include "Summary/RiaSummaryAddressAnalyzer.h" +#include "Summary/RiaSummaryAddressModifier.h" +#include "Summary/RiaSummaryStringTools.h" #include "PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.h" #include "PlotBuilderCommands/RicAppendSummaryPlotsForSummaryAddressesFeature.h" @@ -42,7 +43,6 @@ #include "RimPlotAxisProperties.h" #include "RimSummaryAddress.h" #include "RimSummaryAddressCollection.h" -#include "RimSummaryAddressModifier.h" #include "RimSummaryCase.h" #include "RimSummaryCurve.h" #include "RimSummaryEnsemble.h" @@ -791,7 +791,7 @@ void RimSummaryMultiPlot::setDefaultRangeAggregationSteppingDimension() for ( auto p : summaryPlots() ) { - auto addresses = RimSummaryAddressModifier::allSummaryAddressesY( p ); + auto addresses = RiaSummaryAddressModifier::allSummaryAddressesY( p ); analyzer.appendAddresses( addresses ); } @@ -1261,7 +1261,7 @@ void RimSummaryMultiPlot::analyzePlotsAndAdjustAppearanceSettings() for ( auto p : summaryPlots() ) { - auto addresses = RimSummaryAddressModifier::allSummaryAddressesY( p ); + auto addresses = RiaSummaryAddressModifier::allSummaryAddressesY( p ); analyzer.appendAddresses( addresses ); } @@ -1545,15 +1545,15 @@ void RimSummaryMultiPlot::appendSubPlotByStepping( int direction ) { std::vector newCurveAdrs; - auto curveAddressProviders = RimSummaryAddressModifier::createAddressProviders( newPlot ); - for ( const auto& adr : RimSummaryAddressModifier::curveAddresses( curveAddressProviders ) ) + auto curveAddressProviders = RiaSummaryAddressModifier::createAddressProviders( newPlot ); + for ( const auto& adr : RiaSummaryAddressModifier::curveAddresses( curveAddressProviders ) ) { const auto adrX = m_sourceStepping()->stepAddress( adr.summaryAddressX(), direction ); const auto adrY = m_sourceStepping()->stepAddress( adr.summaryAddressY(), direction ); newCurveAdrs.push_back( RiaSummaryCurveAddress( adrX, adrY ) ); } - RimSummaryAddressModifier::applyAddressesToCurveAddressProviders( curveAddressProviders, newCurveAdrs ); + RiaSummaryAddressModifier::applyAddressesToCurveAddressProviders( curveAddressProviders, newCurveAdrs ); } } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 5b8d8d3cfa..0525422367 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -21,29 +21,21 @@ #include "RiaColorTables.h" #include "RiaColorTools.h" #include "RiaDefines.h" -#include "RiaFieldHandleTools.h" #include "RiaLogging.h" #include "RiaPlotDefines.h" #include "RiaPreferences.h" #include "RiaPreferencesSummary.h" #include "RiaRegressionTestRunner.h" #include "RiaStdStringTools.h" -#include "RiaSummaryAddressAnalyzer.h" -#include "RiaSummaryCurveDefinition.h" -#include "RiaSummaryDefines.h" -#include "RiaSummaryTools.h" -#include "RiaTimeHistoryCurveResampler.h" +#include "Summary/RiaSummaryCurveDefinition.h" +#include "Summary/RiaSummaryDefines.h" +#include "Summary/RiaSummaryTools.h" #include "RifEclipseSummaryAddressDefines.h" -#include "RifReaderEclipseSummary.h" - -#include "RicfCommandObject.h" #include "PlotBuilderCommands/RicSummaryPlotBuilder.h" #include "SummaryPlotCommands/RicSummaryPlotEditorUi.h" -#include "PlotTemplates/RimPlotTemplateFileItem.h" -#include "PlotTemplates/RimPlotTemplateFolderItem.h" #include "RimAsciiDataCurve.h" #include "RimEnsembleCurveSet.h" #include "RimEnsembleCurveSetCollection.h" @@ -70,7 +62,6 @@ #include "RiuQwtPlotCurve.h" #include "RiuQwtPlotItem.h" #include "RiuSummaryQwtPlot.h" -#include "RiuTreeViewEventFilter.h" #ifdef USE_QTCHARTS #include "RiuSummaryQtChartsPlot.h" @@ -79,7 +70,7 @@ #include "cvfColor3.h" #include "cafPdmFieldScriptingCapability.h" -#include "cafPdmUiCheckBoxEditor.h" +#include "cafPdmObjectScriptingCapability.h" #include "cafPdmUiTreeOrdering.h" #include "cafSelectionManager.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp index 50fa6dea60..84ce16d034 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp @@ -20,7 +20,7 @@ #include "RiaDefines.h" #include "RiaNumberFormat.h" -#include "RiaSummaryCurveDefinition.h" +#include "Summary/RiaSummaryCurveDefinition.h" #include "RifSummaryReaderInterface.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp index acf616aff4..8572c593ca 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp @@ -20,9 +20,9 @@ #include "RiaStdStringTools.h" #include "RiaStringListSerializer.h" -#include "RiaSummaryStringTools.h" -#include "RiaSummaryTools.h" #include "RiaTextStringTools.h" +#include "Summary/RiaSummaryStringTools.h" +#include "Summary/RiaSummaryTools.h" #include "RifReaderEclipseSummary.h" #include "RifSummaryReaderInterface.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.cpp index 12583cb217..03dccca25a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.cpp @@ -18,7 +18,6 @@ #include "RimSummaryPlotNameHelper.h" -#include "RiaSummaryAddressAnalyzer.h" #include "RifEclipseSummaryAddress.h" #include "RimObjectiveFunctionTools.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.h index f5936f6990..6ea4c419df 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.h @@ -19,6 +19,7 @@ #pragma once #include "RimSummaryNameHelper.h" +#include "Summary/RiaSummaryAddressAnalyzer.h" #include "cafPdmPointer.h" @@ -31,7 +32,6 @@ class RimSummaryCurve; class RimSummaryCase; class RimSummaryEnsemble; -class RiaSummaryAddressAnalyzer; class RifEclipseSummaryAddress; class RiaSummaryCurveAddress; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index 0a6bbcee57..dcb7023069 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -21,14 +21,14 @@ #include "RiaEnsembleNameTools.h" #include "RiaGuiApplication.h" #include "RiaStdStringTools.h" -#include "RiaSummaryAddressAnalyzer.h" -#include "RiaSummaryCurveDefinition.h" +#include "Summary/RiaSummaryAddressAnalyzer.h" +#include "Summary/RiaSummaryAddressModifier.h" +#include "Summary/RiaSummaryCurveDefinition.h" #include "RimDataSourceSteppingTools.h" #include "RimEnsembleCurveSet.h" #include "RimEnsembleCurveSetCollection.h" #include "RimProject.h" -#include "RimSummaryAddressModifier.h" #include "RimSummaryCase.h" #include "RimSummaryCaseMainCollection.h" #include "RimSummaryCurve.h" @@ -1473,7 +1473,7 @@ std::vector RimSummaryPlotSourceStepping::plotsMatchingStepSettings( s } else { - auto addresses = RimSummaryAddressModifier::allSummaryAddressesY( plot ); + auto addresses = RiaSummaryAddressModifier::allSummaryAddressesY( plot ); for ( const auto& a : addresses ) { diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTable.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTable.cpp index 8be3c547ba..f7953de22d 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTable.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTable.cpp @@ -21,8 +21,8 @@ #include "RiaPreferences.h" #include "RiaQDateTimeTools.h" #include "RiaStdStringTools.h" -#include "RiaSummaryTools.h" #include "RiaTimeHistoryCurveResampler.h" +#include "Summary/RiaSummaryTools.h" #include "RifSummaryReaderInterface.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/Sumo/RimSummaryEnsembleSumo.cpp b/ApplicationLibCode/ProjectDataModel/Summary/Sumo/RimSummaryEnsembleSumo.cpp index d3a7b6e605..7ed4d8b412 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/Sumo/RimSummaryEnsembleSumo.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/Sumo/RimSummaryEnsembleSumo.cpp @@ -20,9 +20,9 @@ #include "RiaApplication.h" #include "RiaLogging.h" -#include "RiaSummaryDefines.h" -#include "RiaSummaryTools.h" #include "RiaTimeTTools.h" +#include "Summary/RiaSummaryDefines.h" +#include "Summary/RiaSummaryTools.h" #include "RifArrowTools.h" #include "RifByteArrayArrowRandomAccessFile.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTopologyCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTopologyCurve.cpp index 4a039eaf0c..6e9f5c0b56 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTopologyCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTopologyCurve.cpp @@ -20,7 +20,7 @@ #include "RiaColorTables.h" #include "RiaColorTools.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RifReaderOpmRft.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp index 2e1459b887..4f68e3d818 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp @@ -19,7 +19,7 @@ #include "RimWellLogCurveCommonDataSource.h" #include "RiaSimWellBranchTools.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RifReaderOpmRft.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp index 1f0144a0fd..fc4db95530 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp @@ -28,8 +28,8 @@ #include "RiaRftDefines.h" #include "RiaSimWellBranchTools.h" #include "RiaStatisticsTools.h" -#include "RiaSummaryTools.h" #include "RiaTextStringTools.h" +#include "Summary/RiaSummaryTools.h" #include "RifEclipseRftAddress.h" #include "RifReaderEclipseRft.h" diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryCase.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryCase.cpp index 4365293243..be1e83071a 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryCase.cpp @@ -18,7 +18,7 @@ #include "RimcSummaryCase.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "RifSummaryReaderInterface.h" diff --git a/ApplicationLibCode/UnitTests/RiaSummaryAddressAnalyzer-Test.cpp b/ApplicationLibCode/UnitTests/RiaSummaryAddressAnalyzer-Test.cpp index fd18dac23c..e055072514 100644 --- a/ApplicationLibCode/UnitTests/RiaSummaryAddressAnalyzer-Test.cpp +++ b/ApplicationLibCode/UnitTests/RiaSummaryAddressAnalyzer-Test.cpp @@ -1,6 +1,6 @@ #include "gtest/gtest.h" -#include "RiaSummaryAddressAnalyzer.h" +#include "Summary/RiaSummaryAddressAnalyzer.h" //-------------------------------------------------------------------------------------------------- /// diff --git a/ApplicationLibCode/UnitTests/RiaSummaryStringTools-Test.cpp b/ApplicationLibCode/UnitTests/RiaSummaryStringTools-Test.cpp index 9735fa2404..7e1db68e43 100644 --- a/ApplicationLibCode/UnitTests/RiaSummaryStringTools-Test.cpp +++ b/ApplicationLibCode/UnitTests/RiaSummaryStringTools-Test.cpp @@ -1,6 +1,6 @@ #include "gtest/gtest.h" -#include "RiaSummaryStringTools.h" +#include "Summary/RiaSummaryStringTools.h" #include #include diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index c86f8cf2d7..358edcb4d0 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -24,7 +24,7 @@ #include "RiaPreferences.h" #include "RiaPreferencesSystem.h" #include "RiaRegressionTestRunner.h" -#include "RiaSummaryTools.h" +#include "Summary/RiaSummaryTools.h" #include "PlotBuilderCommands/RicSummaryPlotBuilder.h" diff --git a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionDialog.cpp b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionDialog.cpp index 48bf71bb0d..a148efc309 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionDialog.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionDialog.cpp @@ -18,7 +18,7 @@ #include "RiuSummaryVectorSelectionDialog.h" -#include "RiaSummaryCurveDefinition.h" +#include "Summary/RiaSummaryCurveDefinition.h" #include "RimSummaryEnsemble.h" diff --git a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp index 95361d00cc..9b2f22a91c 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp @@ -21,8 +21,8 @@ #include "RiaCurveSetDefinition.h" #include "RiaOptionItemFactory.h" #include "RiaStdStringTools.h" -#include "RiaSummaryCurveDefinition.h" -#include "RiaSummaryDefines.h" +#include "Summary/RiaSummaryCurveDefinition.h" +#include "Summary/RiaSummaryDefines.h" #include "RifEclipseSummaryAddress.h" #include "RifReaderEclipseSummary.h" From da4d4c66b15eff430b405f38d010f849a01554cf Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 21 Oct 2024 13:50:17 +0200 Subject: [PATCH 058/160] #11798 Use type definition from ClipperLib to avoid overflow When converting a cvf::Vec3d to an integer vector, the platform int type was used as an intermediate variable. This caused overflow for large double values. --- .../ReservoirDataModel/RigCellGeometryTools.cpp | 7 ++++--- ApplicationLibCode/UnitTests/RigCellGeometryTools-Test.cpp | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ApplicationLibCode/ReservoirDataModel/RigCellGeometryTools.cpp b/ApplicationLibCode/ReservoirDataModel/RigCellGeometryTools.cpp index 3c078d9188..0f36b5cbb8 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigCellGeometryTools.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigCellGeometryTools.cpp @@ -407,9 +407,10 @@ double clipperConversionFactor = 10000; // For transform to clipper int ClipperLib::IntPoint toClipperPoint( const cvf::Vec3d& cvfPoint ) { - int xInt = cvfPoint.x() * clipperConversionFactor; - int yInt = cvfPoint.y() * clipperConversionFactor; - int zInt = cvfPoint.z() * clipperConversionFactor; + ClipperLib::cInt xInt = cvfPoint.x() * clipperConversionFactor; + ClipperLib::cInt yInt = cvfPoint.y() * clipperConversionFactor; + ClipperLib::cInt zInt = cvfPoint.z() * clipperConversionFactor; + return ClipperLib::IntPoint( xInt, yInt, zInt ); } diff --git a/ApplicationLibCode/UnitTests/RigCellGeometryTools-Test.cpp b/ApplicationLibCode/UnitTests/RigCellGeometryTools-Test.cpp index 9a88034e67..67c5789bb7 100644 --- a/ApplicationLibCode/UnitTests/RigCellGeometryTools-Test.cpp +++ b/ApplicationLibCode/UnitTests/RigCellGeometryTools-Test.cpp @@ -566,9 +566,9 @@ double clipperConversionFactor2 = 10000; // For transform to clipper int ClipperLib::IntPoint toClipperEdgePoint( const cvf::Vec3d& cvfPoint ) { - int xInt = cvfPoint.x() * clipperConversionFactor2; - int yInt = cvfPoint.y() * clipperConversionFactor2; - int zInt = cvfPoint.z(); + ClipperLib::cInt xInt = cvfPoint.x() * clipperConversionFactor2; + ClipperLib::cInt yInt = cvfPoint.y() * clipperConversionFactor2; + ClipperLib::cInt zInt = cvfPoint.z(); return ClipperLib::IntPoint( xInt, yInt, zInt ); } From ac961508758fadfd88e5e138614b112f26991920 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 22 Oct 2024 18:02:36 +0200 Subject: [PATCH 059/160] Bump to dev.06 --- ResInsightVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index 9657cf5c2a..e725a8ab07 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -11,7 +11,7 @@ set(RESINSIGHT_VERSION_TEXT "-dev") # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -set(RESINSIGHT_DEV_VERSION ".05") +set(RESINSIGHT_DEV_VERSION ".06") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") From 581b2689288604b2770e017bdc5c9dd720e42c6d Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 22 Oct 2024 16:24:11 +0200 Subject: [PATCH 060/160] Use hash of input do control if calculation is required Add hash functions Add serial number to SummaryReaderInterface Add hash for RimSummaryCase Use hash based on input parameters to control caching of data in RimEnsembleStatisticsCase::calculate and RimEnsembleCurveSet::appendOptionItemsForSummaryAddresses --- .../Application/Tools/CMakeLists_files.cmake | 1 + .../Application/Tools/RiaHashTools.h | 90 +++++++++++++++++++ .../RifSummaryReaderInterface.cpp | 19 ++++ .../FileInterface/RifSummaryReaderInterface.h | 8 ++ .../Summary/RimEnsembleCurveSet.cpp | 42 ++++++--- .../Summary/RimEnsembleCurveSet.h | 5 +- .../Summary/RimEnsembleStatisticsCase.cpp | 6 ++ .../Summary/RimEnsembleStatisticsCase.h | 1 + .../Summary/RimSummaryCase.cpp | 9 ++ .../ProjectDataModel/Summary/RimSummaryCase.h | 25 ++++++ 10 files changed, 191 insertions(+), 15 deletions(-) create mode 100644 ApplicationLibCode/Application/Tools/RiaHashTools.h diff --git a/ApplicationLibCode/Application/Tools/CMakeLists_files.cmake b/ApplicationLibCode/Application/Tools/CMakeLists_files.cmake index cf7d37a4c4..8907e2e8b0 100644 --- a/ApplicationLibCode/Application/Tools/CMakeLists_files.cmake +++ b/ApplicationLibCode/Application/Tools/CMakeLists_files.cmake @@ -53,6 +53,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaFileLogger.h ${CMAKE_CURRENT_LIST_DIR}/RiaProjectBackupTools.h ${CMAKE_CURRENT_LIST_DIR}/RiaQuantityInfoTools.h + ${CMAKE_CURRENT_LIST_DIR}/RiaHashTools.h ) set(SOURCE_GROUP_SOURCE_FILES diff --git a/ApplicationLibCode/Application/Tools/RiaHashTools.h b/ApplicationLibCode/Application/Tools/RiaHashTools.h new file mode 100644 index 0000000000..8a50f80ed3 --- /dev/null +++ b/ApplicationLibCode/Application/Tools/RiaHashTools.h @@ -0,0 +1,90 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 +#include +#include + +//================================================================================================== +// +// +// +//================================================================================================== +namespace RiaHashTools +{ +//-------------------------------------------------------------------------------------------------- +/// Variadic template function to combine multiple parameters into a single hash +//-------------------------------------------------------------------------------------------------- +template +void combineHash( size_t& seed, const T& value ) +{ + // Based on https://www.boost.org/doc/libs/1_84_0/libs/container_hash/doc/html/hash.html#notes_hash_combine + seed ^= std::hash()( value ) + 0x9e3779b9 + ( seed << 6 ) + ( seed >> 2 ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +template +void combineHash( size_t& seed, const T& value, const Rest&... rest ) +{ + combineHash( seed, value ); + ( combineHash( seed, rest ), ... ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +template +void combineHash( size_t& seed, const Range& range, const Rest&... rest ) +{ + for ( const auto& elem : range ) + { + combineHash( seed, elem ); + } + ( combineHash( seed, rest ), ... ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +template +size_t hash( const Args&... args ) +{ + size_t seed = 0; + combineHash( seed, args... ); + return seed; +} + +//-------------------------------------------------------------------------------------------------- +/// Generic hash function for any range +//-------------------------------------------------------------------------------------------------- +template +size_t hash( const Range& range ) +{ + size_t seed = 0; + for ( const auto& elem : range ) + { + combineHash( seed, elem ); + } + return seed; +} + +}; // namespace RiaHashTools diff --git a/ApplicationLibCode/FileInterface/RifSummaryReaderInterface.cpp b/ApplicationLibCode/FileInterface/RifSummaryReaderInterface.cpp index 01ee289adb..51c9be4541 100644 --- a/ApplicationLibCode/FileInterface/RifSummaryReaderInterface.cpp +++ b/ApplicationLibCode/FileInterface/RifSummaryReaderInterface.cpp @@ -22,6 +22,8 @@ #include +int RifSummaryReaderInterface::m_nextSerialNumber = 0; + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -56,6 +58,23 @@ void RifSummaryReaderInterface::buildMetaData() { } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RifSummaryReaderInterface::serialNumber() const +{ + return m_serialNumber; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RifSummaryReaderInterface::RifSummaryReaderInterface() +{ +#pragma omp critical + m_serialNumber = m_nextSerialNumber++; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/FileInterface/RifSummaryReaderInterface.h b/ApplicationLibCode/FileInterface/RifSummaryReaderInterface.h index efdd2973c6..2f86ae86af 100644 --- a/ApplicationLibCode/FileInterface/RifSummaryReaderInterface.h +++ b/ApplicationLibCode/FileInterface/RifSummaryReaderInterface.h @@ -37,6 +37,8 @@ class QDateTime; class RifSummaryReaderInterface : public cvf::Object { public: + RifSummaryReaderInterface(); + bool hasAddress( const RifEclipseSummaryAddress& resultAddress ) const; const std::set& allResultAddresses() const; @@ -53,7 +55,13 @@ public: virtual void buildMetaData(); + int serialNumber() const; + protected: std::set m_allResultAddresses; // Result and error addresses std::set m_allErrorAddresses; // Error addresses + +private: + static int m_nextSerialNumber; + int m_serialNumber; }; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index 711e598bda..bec4c2309e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -20,6 +20,7 @@ #include "RiaColorTools.h" #include "RiaGuiApplication.h" +#include "RiaHashTools.h" #include "RiaPreferences.h" #include "RiaQDateTimeTools.h" #include "RiaResultNames.h" @@ -116,6 +117,7 @@ CAF_PDM_SOURCE_INIT( RimEnsembleCurveSet, "RimEnsembleCurveSet" ); //-------------------------------------------------------------------------------------------------- RimEnsembleCurveSet::RimEnsembleCurveSet() : filterChanged( this ) + , m_hash( 0 ) { CAF_PDM_InitObject( "Ensemble Curve Set", ":/EnsembleCurveSet16x16.png" ); @@ -1664,26 +1666,38 @@ void RimEnsembleCurveSet::appendOptionItemsForSummaryAddresses( QList addrSet; - for ( RimSummaryCase* summaryCase : summaryCaseGroup->allSummaryCases() ) + auto allSummaryCases = summaryCaseGroup->allSummaryCases(); + auto hash = RiaHashTools::hash( allSummaryCases ); + if ( hash != m_hash ) { - RifSummaryReaderInterface* reader = summaryCase->summaryReader(); - const std::set& addrs = reader ? reader->allResultAddresses() : std::set(); + m_hash = hash; - for ( auto& addr : addrs ) + std::set addressesForEnsemble; + for ( RimSummaryCase* summaryCase : allSummaryCases ) { - addrSet.insert( addr ); + if ( !summaryCase ) continue; + + if ( auto reader = summaryCase->summaryReader() ) + { + const auto& addrs = reader->allResultAddresses(); + addressesForEnsemble.insert( addrs.begin(), addrs.end() ); + } } + + m_cachedAddressOptions.clear(); + + for ( const auto& addr : addressesForEnsemble ) + { + std::string name = addr.uiText(); + QString s = QString::fromStdString( name ); + m_cachedAddressOptions.push_back( caf::PdmOptionItemInfo( s, QVariant::fromValue( addr ) ) ); + } + + m_cachedAddressOptions.push_front( + caf::PdmOptionItemInfo( RiaResultNames::undefinedResultName(), QVariant::fromValue( RifEclipseSummaryAddress() ) ) ); } - for ( auto& addr : addrSet ) - { - std::string name = addr.uiText(); - QString s = QString::fromStdString( name ); - options->push_back( caf::PdmOptionItemInfo( s, QVariant::fromValue( addr ) ) ); - } - - options->push_front( caf::PdmOptionItemInfo( RiaResultNames::undefinedResultName(), QVariant::fromValue( RifEclipseSummaryAddress() ) ) ); + options->append( m_cachedAddressOptions ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h index a5b63c8b46..755b838686 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h @@ -180,7 +180,7 @@ public: void appendColorGroup( caf::PdmUiOrdering& uiOrdering ); - static void appendOptionItemsForSummaryAddresses( QList* options, RimSummaryEnsemble* summaryCaseGroup ); + void appendOptionItemsForSummaryAddresses( QList* options, RimSummaryEnsemble* summaryCaseGroup ); const RimEnsembleCurveFilterCollection* curveFilters() const; @@ -317,4 +317,7 @@ private: bool m_disableStatisticCurves; bool m_isCurveSetFiltered; + + QList m_cachedAddressOptions; + size_t m_hash; }; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp index c24ccc446c..ed7e53a7ad 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp @@ -19,6 +19,7 @@ #include "RimEnsembleStatisticsCase.h" #include "RiaCurveMerger.h" +#include "RiaHashTools.h" #include "RiaTimeHistoryCurveResampler.h" #include "Summary/RiaSummaryTools.h" @@ -129,6 +130,11 @@ void RimEnsembleStatisticsCase::calculate( const std::vector& s const RifEclipseSummaryAddress& inputAddress, bool includeIncompleteCurves ) { + auto hash = RiaHashTools::hash( summaryCases, inputAddress.toEclipseTextAddress(), includeIncompleteCurves ); + if ( hash == m_hash ) return; + + m_hash = hash; + clearData(); if ( !inputAddress.isValid() ) return; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.h index 9b3fcc518f..ba819986cb 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.h @@ -64,4 +64,5 @@ private: std::vector m_meanData; caf::PdmPointer m_firstSummaryCase; + size_t m_hash = 0; }; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp index 053da9e37d..4551c80df3 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp @@ -225,6 +225,15 @@ void RimSummaryCase::buildChildNodes() m_dataVectorFolders->updateFolderStructure( addresses, m_caseId ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RimSummaryCase::serialNumber() +{ + auto reader = summaryReader(); + return reader ? reader->serialNumber() : -1; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h index a3e5a1f5de..4ee7c6c1e0 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h @@ -18,6 +18,9 @@ #pragma once #include "RiaDefines.h" + +#include "RiaHashTools.h" + #include "RigCaseRealizationParameters.h" #include "RimCaseDisplayNameTools.h" @@ -105,6 +108,7 @@ protected: private: void buildChildNodes(); + int serialNumber(); protected: caf::PdmField m_displayName; @@ -123,4 +127,25 @@ protected: caf::PdmField m_useAutoShortName_OBSOLETE; static const QString DEFAULT_DISPLAY_NAME; + + friend struct std::hash; +}; + +// Custom specialization of std::hash injected in namespace std +// NB! Note that this is a specialization of std::hash for a pointer type +template <> +struct std::hash +{ + std::size_t operator()( RimSummaryCase* s ) const noexcept + { + if ( !s ) return 0; + + auto serialNumber = s->serialNumber(); + if ( serialNumber != -1 ) + { + return RiaHashTools::hash( serialNumber ); + } + + return RiaHashTools::hash( s->summaryHeaderFilename().toStdString() ); + } }; From fd0ebd989b9824e55041689c6cd3bec84b9a0ca2 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 23 Oct 2024 09:18:21 +0200 Subject: [PATCH 061/160] Improve performance when computing interpolated values Use OpenMP when computing interpolated values for a curve. Use std::lower_bound to quickly find a relevant start index, avoids starting from 0 each time. --- .../Application/Tools/RiaCurveMerger.inl | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/Application/Tools/RiaCurveMerger.inl b/ApplicationLibCode/Application/Tools/RiaCurveMerger.inl index d15ef00e57..d0e9fe06fd 100644 --- a/ApplicationLibCode/Application/Tools/RiaCurveMerger.inl +++ b/ApplicationLibCode/Application/Tools/RiaCurveMerger.inl @@ -154,12 +154,14 @@ void RiaCurveMerger::computeInterpolatedValues( bool includeValuesFr std::vector& curveValues = m_interpolatedValuesForAllCurves[curveIdx]; curveValues.resize( dataValueCount ); - for ( size_t valueIndex = 0; valueIndex < dataValueCount; valueIndex++ ) +#pragma omp parallel for + for ( int valueIndex = 0; valueIndex < static_cast( dataValueCount ); valueIndex++ ) { double interpolValue = interpolatedYValue( m_allXValues[valueIndex], m_originalValues[curveIdx].first, m_originalValues[curveIdx].second ); if ( !RiaCurveDataTools::isValidValue( interpolValue, false ) ) { +#pragma omp critical accumulatedValidValues[valueIndex] = HUGE_VAL; } @@ -235,11 +237,21 @@ double RiaCurveMerger::interpolatedYValue( const XValueType& const std::vector& xValues, const std::vector& yValues ) { + if ( xValues.empty() ) return HUGE_VAL; if ( yValues.size() != xValues.size() ) return HUGE_VAL; const bool removeInterpolatedValues = false; - for ( size_t firstI = 0; firstI < xValues.size(); firstI++ ) + // Use lower_bound to find the first element that is not less than the interpolation value using a threshold that is larger than the + // threshold used in XComparator::equals + XValueType threshold = 1.0e-6 * xValues.back(); + auto it = std::lower_bound( xValues.begin(), xValues.end(), interpolationXValue - threshold ); + if ( it == xValues.end() ) return HUGE_VAL; + + size_t startIndex = it - xValues.begin(); + if ( startIndex > 0 ) startIndex--; + + for ( size_t firstI = startIndex; firstI < xValues.size(); firstI++ ) { if ( XComparator::equals( xValues.at( firstI ), interpolationXValue ) ) { From 2cdb388a0db1c924c62735da4dc09ab83e6d5dac Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 23 Oct 2024 11:57:29 +0200 Subject: [PATCH 062/160] Bump to dev.07 --- ResInsightVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index e725a8ab07..17dfdeae58 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -11,7 +11,7 @@ set(RESINSIGHT_VERSION_TEXT "-dev") # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -set(RESINSIGHT_DEV_VERSION ".06") +set(RESINSIGHT_DEV_VERSION ".07") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") From 293e19d8200a37bb47206b0076a5b2a8ca0baf85 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Thu, 17 Oct 2024 14:29:59 +0200 Subject: [PATCH 063/160] Refactor: make contour map calculation easier to reuse. --- .../RimGeoMechContourMapProjection.cpp | 12 +- .../RimContourMapProjection.cpp | 336 ++------------ .../RimContourMapProjection.h | 60 +-- .../RimEclipseContourMapProjection.cpp | 14 +- .../ReservoirDataModel/CMakeLists_files.cmake | 2 + .../RigContourMapCalculator.cpp | 410 ++++++++++++++++++ .../RigContourMapCalculator.h | 98 +++++ 7 files changed, 574 insertions(+), 358 deletions(-) create mode 100644 ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.cpp create mode 100644 ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.h diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp index f848136237..8821377cd1 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp @@ -21,6 +21,7 @@ #include "RiaWeightedMeanCalculator.h" #include "RigCellGeometryTools.h" +#include "RigContourMapCalculator.h" #include "RigContourMapGrid.h" #include "RigFemAddressDefines.h" #include "RigFemPart.h" @@ -611,10 +612,15 @@ QList RimGeoMechContourMapProjection::calculateValueOpti if ( fieldNeedingOptions == &m_resultAggregation ) { - std::vector validOptions = - { RESULTS_TOP_VALUE, RESULTS_MEAN_VALUE, RESULTS_GEOM_VALUE, RESULTS_HARM_VALUE, RESULTS_MIN_VALUE, RESULTS_MAX_VALUE, RESULTS_SUM }; + std::vector validOptions = { RigContourMapCalculator::RESULTS_TOP_VALUE, + RigContourMapCalculator::RESULTS_MEAN_VALUE, + RigContourMapCalculator::RESULTS_GEOM_VALUE, + RigContourMapCalculator::RESULTS_HARM_VALUE, + RigContourMapCalculator::RESULTS_MIN_VALUE, + RigContourMapCalculator::RESULTS_MAX_VALUE, + RigContourMapCalculator::RESULTS_SUM }; - for ( ResultAggregationEnum option : validOptions ) + for ( RigContourMapCalculator::ResultAggregationEnum option : validOptions ) { options.push_back( caf::PdmOptionItemInfo( ResultAggregation::uiText( option ), option ) ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp index 8a514febf0..d95a581789 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp @@ -19,11 +19,10 @@ #include "RimContourMapProjection.h" #include "RiaOpenMPTools.h" -#include "RiaWeightedGeometricMeanCalculator.h" -#include "RiaWeightedHarmonicMeanCalculator.h" #include "RiaWeightedMeanCalculator.h" #include "RigCellGeometryTools.h" +#include "RigContourMapCalculator.h" #include "RigContourMapGrid.h" #include "RimCase.h" @@ -50,21 +49,21 @@ namespace caf template <> void RimContourMapProjection::ResultAggregation::setUp() { - addItem( RimContourMapProjection::RESULTS_OIL_COLUMN, "OIL_COLUMN", "Oil Column" ); - addItem( RimContourMapProjection::RESULTS_GAS_COLUMN, "GAS_COLUMN", "Gas Column" ); - addItem( RimContourMapProjection::RESULTS_HC_COLUMN, "HC_COLUMN", "Hydrocarbon Column" ); + addItem( RigContourMapCalculator::RESULTS_OIL_COLUMN, "OIL_COLUMN", "Oil Column" ); + addItem( RigContourMapCalculator::RESULTS_GAS_COLUMN, "GAS_COLUMN", "Gas Column" ); + addItem( RigContourMapCalculator::RESULTS_HC_COLUMN, "HC_COLUMN", "Hydrocarbon Column" ); - addItem( RimContourMapProjection::RESULTS_MEAN_VALUE, "MEAN_VALUE", "Arithmetic Mean" ); - addItem( RimContourMapProjection::RESULTS_HARM_VALUE, "HARM_VALUE", "Harmonic Mean" ); - addItem( RimContourMapProjection::RESULTS_GEOM_VALUE, "GEOM_VALUE", "Geometric Mean" ); - addItem( RimContourMapProjection::RESULTS_VOLUME_SUM, "VOLUME_SUM", "Volume Weighted Sum" ); - addItem( RimContourMapProjection::RESULTS_SUM, "SUM", "Sum" ); + addItem( RigContourMapCalculator::RESULTS_MEAN_VALUE, "MEAN_VALUE", "Arithmetic Mean" ); + addItem( RigContourMapCalculator::RESULTS_HARM_VALUE, "HARM_VALUE", "Harmonic Mean" ); + addItem( RigContourMapCalculator::RESULTS_GEOM_VALUE, "GEOM_VALUE", "Geometric Mean" ); + addItem( RigContourMapCalculator::RESULTS_VOLUME_SUM, "VOLUME_SUM", "Volume Weighted Sum" ); + addItem( RigContourMapCalculator::RESULTS_SUM, "SUM", "Sum" ); - addItem( RimContourMapProjection::RESULTS_TOP_VALUE, "TOP_VALUE", "Top Value" ); - addItem( RimContourMapProjection::RESULTS_MIN_VALUE, "MIN_VALUE", "Min Value" ); - addItem( RimContourMapProjection::RESULTS_MAX_VALUE, "MAX_VALUE", "Max Value" ); + addItem( RigContourMapCalculator::RESULTS_TOP_VALUE, "TOP_VALUE", "Top Value" ); + addItem( RigContourMapCalculator::RESULTS_MIN_VALUE, "MIN_VALUE", "Min Value" ); + addItem( RigContourMapCalculator::RESULTS_MAX_VALUE, "MAX_VALUE", "Max Value" ); - setDefault( RimContourMapProjection::RESULTS_MEAN_VALUE ); + setDefault( RigContourMapCalculator::RESULTS_MEAN_VALUE ); } } // namespace caf CAF_PDM_ABSTRACT_SOURCE_INIT( RimContourMapProjection, "RimContourMapProjection" ); @@ -115,7 +114,12 @@ void RimContourMapProjection::generateResultsIfNecessary( int timeStep ) clearResults(); clearTimeStepRange(); - if ( gridMappingNeedsUpdating() ) m_projected3dGridIndices = generateGridMapping(); + m_cellGridIdxVisibility = getCellVisibility(); + + if ( gridMappingNeedsUpdating() ) + { + m_projected3dGridIndices = RigContourMapCalculator::generateGridMapping( *this, *m_contourMapGrid ); + } progress.setProgress( 20 ); m_mapCellVisibility = getMapCellVisibility(); progress.setProgress( 30 ); @@ -332,8 +336,7 @@ cvf::Vec2ui RimContourMapProjection::numberOfVerticesIJ() const //-------------------------------------------------------------------------------------------------- bool RimContourMapProjection::isColumnResult() const { - return m_resultAggregation() == RESULTS_OIL_COLUMN || m_resultAggregation() == RESULTS_GAS_COLUMN || - m_resultAggregation() == RESULTS_HC_COLUMN; + return RigContourMapCalculator::isColumnResult( m_resultAggregation() ); } //-------------------------------------------------------------------------------------------------- @@ -437,130 +440,7 @@ size_t RimContourMapProjection::gridResultIndex( size_t globalCellIdx ) const double RimContourMapProjection::calculateValueInMapCell( uint i, uint j, const std::vector& gridCellValues ) const { const std::vector>& matchingCells = cellsAtIJ( i, j ); - if ( !matchingCells.empty() ) - { - switch ( m_resultAggregation() ) - { - case RESULTS_TOP_VALUE: - { - for ( auto [cellIdx, weight] : matchingCells ) - { - double cellValue = gridCellValues[gridResultIndex( cellIdx )]; - if ( std::abs( cellValue ) != std::numeric_limits::infinity() ) - { - return cellValue; - } - } - return std::numeric_limits::infinity(); - } - case RESULTS_MEAN_VALUE: - { - RiaWeightedMeanCalculator calculator; - for ( auto [cellIdx, weight] : matchingCells ) - { - double cellValue = gridCellValues[gridResultIndex( cellIdx )]; - if ( std::abs( cellValue ) != std::numeric_limits::infinity() ) - { - calculator.addValueAndWeight( cellValue, weight ); - } - } - if ( calculator.validAggregatedWeight() ) - { - return calculator.weightedMean(); - } - return std::numeric_limits::infinity(); - } - case RESULTS_GEOM_VALUE: - { - RiaWeightedGeometricMeanCalculator calculator; - for ( auto [cellIdx, weight] : matchingCells ) - { - double cellValue = gridCellValues[gridResultIndex( cellIdx )]; - if ( std::abs( cellValue ) != std::numeric_limits::infinity() ) - { - if ( cellValue < 1.0e-8 ) - { - return 0.0; - } - calculator.addValueAndWeight( cellValue, weight ); - } - } - if ( calculator.validAggregatedWeight() ) - { - return calculator.weightedMean(); - } - return std::numeric_limits::infinity(); - } - case RESULTS_HARM_VALUE: - { - RiaWeightedHarmonicMeanCalculator calculator; - for ( auto [cellIdx, weight] : matchingCells ) - { - double cellValue = gridCellValues[gridResultIndex( cellIdx )]; - if ( std::fabs( cellValue ) < 1.0e-8 ) - { - return 0.0; - } - if ( std::abs( cellValue ) != std::numeric_limits::infinity() ) - { - calculator.addValueAndWeight( cellValue, weight ); - } - } - if ( calculator.validAggregatedWeight() ) - { - return calculator.weightedMean(); - } - return std::numeric_limits::infinity(); - } - case RESULTS_MAX_VALUE: - { - double maxValue = -std::numeric_limits::infinity(); - for ( auto [cellIdx, weight] : matchingCells ) - { - double cellValue = gridCellValues[gridResultIndex( cellIdx )]; - if ( std::abs( cellValue ) != std::numeric_limits::infinity() ) - { - maxValue = std::max( maxValue, cellValue ); - } - } - if ( maxValue == -std::numeric_limits::infinity() ) - { - maxValue = std::numeric_limits::infinity(); - } - return maxValue; - } - case RESULTS_MIN_VALUE: - { - double minValue = std::numeric_limits::infinity(); - for ( auto [cellIdx, weight] : matchingCells ) - { - double cellValue = gridCellValues[gridResultIndex( cellIdx )]; - minValue = std::min( minValue, cellValue ); - } - return minValue; - } - case RESULTS_VOLUME_SUM: - case RESULTS_SUM: - case RESULTS_OIL_COLUMN: - case RESULTS_GAS_COLUMN: - case RESULTS_HC_COLUMN: - { - double sum = 0.0; - for ( auto [cellIdx, weight] : matchingCells ) - { - double cellValue = gridCellValues[gridResultIndex( cellIdx )]; - if ( std::abs( cellValue ) != std::numeric_limits::infinity() ) - { - sum += cellValue * weight; - } - } - return sum; - } - default: - CVF_TIGHT_ASSERT( false ); - } - } - return std::numeric_limits::infinity(); + return RigContourMapCalculator::calculateValueInMapCell( *this, matchingCells, gridCellValues, m_resultAggregation() ); } //-------------------------------------------------------------------------------------------------- @@ -727,44 +607,6 @@ bool RimContourMapProjection::mapCellVisibilityNeedsUpdating() return !( mapCellVisiblity == m_mapCellVisibility ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector>> RimContourMapProjection::generateGridMapping() -{ - m_cellGridIdxVisibility = getCellVisibility(); - - int nCells = numberOfCells(); - std::vector>> projected3dGridIndices( nCells ); - - std::vector weightingResultValues = retrieveParameterWeights(); - - if ( isStraightSummationResult() ) - { -#pragma omp parallel for - for ( int index = 0; index < nCells; ++index ) - { - cvf::Vec2ui ij = m_contourMapGrid->ijFromCellIndex( index ); - - cvf::Vec2d globalPos = m_contourMapGrid->cellCenterPosition( ij.x(), ij.y() ) + m_contourMapGrid->origin2d(); - projected3dGridIndices[index] = cellRayIntersectionAndResults( globalPos, weightingResultValues ); - } - } - else - { -#pragma omp parallel for - for ( int index = 0; index < nCells; ++index ) - { - cvf::Vec2ui ij = m_contourMapGrid->ijFromCellIndex( index ); - - cvf::Vec2d globalPos = m_contourMapGrid->cellCenterPosition( ij.x(), ij.y() ) + m_contourMapGrid->origin2d(); - projected3dGridIndices[index] = cellOverlapVolumesAndResults( globalPos, weightingResultValues ); - } - } - - return projected3dGridIndices; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1123,131 +965,12 @@ double RimContourMapProjection::sumTriangleAreas( const std::vector& return sumArea; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector - RimContourMapProjection::cellOverlapVolumesAndResults( const cvf::Vec2d& globalPos2d, const std::vector& weightingResultValues ) const -{ - const cvf::BoundingBox& expandedBoundingBox = m_contourMapGrid->expandedBoundingBox(); - cvf::Vec3d top2dElementCentroid( globalPos2d, expandedBoundingBox.max().z() ); - cvf::Vec3d bottom2dElementCentroid( globalPos2d, expandedBoundingBox.min().z() ); - cvf::Vec3d planarDiagonalVector( 0.5 * sampleSpacing(), 0.5 * sampleSpacing(), 0.0 ); - cvf::Vec3d topNECorner = top2dElementCentroid + planarDiagonalVector; - cvf::Vec3d bottomSWCorner = bottom2dElementCentroid - planarDiagonalVector; - - cvf::BoundingBox bbox2dElement( bottomSWCorner, topNECorner ); - - std::vector> matchingVisibleCellsAndWeight; - - // Bounding box has been expanded, so 2d element may be outside actual 3d grid - if ( !bbox2dElement.intersects( m_contourMapGrid->originalBoundingBox() ) ) - { - return matchingVisibleCellsAndWeight; - } - - std::vector allCellIndices = findIntersectingCells( bbox2dElement ); - - std::vector> kLayerCellIndexVector; - kLayerCellIndexVector.resize( kLayers() ); - - if ( kLayerCellIndexVector.empty() ) - { - return matchingVisibleCellsAndWeight; - } - - for ( size_t globalCellIdx : allCellIndices ) - { - if ( ( *m_cellGridIdxVisibility )[globalCellIdx] ) - { - kLayerCellIndexVector[kLayer( globalCellIdx )].push_back( globalCellIdx ); - } - } - - for ( const auto& kLayerIndices : kLayerCellIndexVector ) - { - for ( size_t globalCellIdx : kLayerIndices ) - { - double overlapVolume = calculateOverlapVolume( globalCellIdx, bbox2dElement ); - if ( overlapVolume > 0.0 ) - { - double weight = overlapVolume * getParameterWeightForCell( gridResultIndex( globalCellIdx ), weightingResultValues ); - if ( weight > 0.0 ) - { - matchingVisibleCellsAndWeight.push_back( std::make_pair( globalCellIdx, weight ) ); - } - } - } - } - - return matchingVisibleCellsAndWeight; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector - RimContourMapProjection::cellRayIntersectionAndResults( const cvf::Vec2d& globalPos2d, const std::vector& weightingResultValues ) const -{ - std::vector> matchingVisibleCellsAndWeight; - - const cvf::BoundingBox& expandedBoundingBox = m_contourMapGrid->expandedBoundingBox(); - - cvf::Vec3d highestPoint( globalPos2d, expandedBoundingBox.max().z() ); - cvf::Vec3d lowestPoint( globalPos2d, expandedBoundingBox.min().z() ); - - // Bounding box has been expanded, so ray may be outside actual 3d grid - if ( !m_contourMapGrid->originalBoundingBox().contains( highestPoint ) ) - { - return matchingVisibleCellsAndWeight; - } - - cvf::BoundingBox rayBBox; - rayBBox.add( highestPoint ); - rayBBox.add( lowestPoint ); - - std::vector allCellIndices = findIntersectingCells( rayBBox ); - - std::map> kLayerIndexMap; - - for ( size_t globalCellIdx : allCellIndices ) - { - if ( ( *m_cellGridIdxVisibility )[globalCellIdx] ) - { - kLayerIndexMap[kLayer( globalCellIdx )].push_back( globalCellIdx ); - } - } - - for ( const auto& kLayerIndexPair : kLayerIndexMap ) - { - double weightSumThisKLayer = 0.0; - std::vector> cellsAndWeightsThisLayer; - for ( size_t globalCellIdx : kLayerIndexPair.second ) - { - double lengthInCell = calculateRayLengthInCell( globalCellIdx, highestPoint, lowestPoint ); - if ( lengthInCell > 0.0 ) - { - cellsAndWeightsThisLayer.push_back( std::make_pair( globalCellIdx, lengthInCell ) ); - weightSumThisKLayer += lengthInCell; - } - } - for ( auto& cellWeightPair : cellsAndWeightsThisLayer ) - { - cellWeightPair.second /= weightSumThisKLayer; - matchingVisibleCellsAndWeight.push_back( cellWeightPair ); - } - } - - return matchingVisibleCellsAndWeight; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- bool RimContourMapProjection::isMeanResult() const { - return m_resultAggregation() == RESULTS_MEAN_VALUE || m_resultAggregation() == RESULTS_HARM_VALUE || - m_resultAggregation() == RESULTS_GEOM_VALUE; + return RigContourMapCalculator::isMeanResult( m_resultAggregation() ); } //-------------------------------------------------------------------------------------------------- @@ -1255,16 +978,7 @@ bool RimContourMapProjection::isMeanResult() const //-------------------------------------------------------------------------------------------------- bool RimContourMapProjection::isStraightSummationResult() const { - return isStraightSummationResult( m_resultAggregation() ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RimContourMapProjection::isStraightSummationResult( ResultAggregationEnum aggregationType ) -{ - return aggregationType == RESULTS_OIL_COLUMN || aggregationType == RESULTS_GAS_COLUMN || aggregationType == RESULTS_HC_COLUMN || - aggregationType == RESULTS_SUM; + return RigContourMapCalculator::isStraightSummationResult( m_resultAggregation() ); } //-------------------------------------------------------------------------------------------------- @@ -1416,8 +1130,8 @@ void RimContourMapProjection::fieldChangedByUi( const caf::PdmFieldHandle* chang { if ( changedField == &m_resultAggregation ) { - ResultAggregation previousAggregation = static_cast( oldValue.toInt() ); - if ( isStraightSummationResult( previousAggregation ) != isStraightSummationResult() ) + ResultAggregation previousAggregation = static_cast( oldValue.toInt() ); + if ( RigContourMapCalculator::isStraightSummationResult( previousAggregation ) != isStraightSummationResult() ) { clearGridMapping(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h index 08ae48c18b..9ecc867255 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h +++ b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h @@ -20,6 +20,7 @@ #include "RimCheckableNamedObject.h" +#include "RigContourMapCalculator.h" #include "RigContourPolygonsTools.h" #include "cafPdmField.h" @@ -44,21 +45,7 @@ class RimContourMapProjection : public RimCheckableNamedObject public: using CellIndexAndResult = std::pair; - enum ResultAggregationEnum - { - RESULTS_TOP_VALUE, - RESULTS_MEAN_VALUE, - RESULTS_GEOM_VALUE, - RESULTS_HARM_VALUE, - RESULTS_MIN_VALUE, - RESULTS_MAX_VALUE, - RESULTS_VOLUME_SUM, - RESULTS_SUM, - RESULTS_OIL_COLUMN, - RESULTS_GAS_COLUMN, - RESULTS_HC_COLUMN - }; - using ResultAggregation = caf::AppEnum; + using ResultAggregation = caf::AppEnum; using ContourPolygons = std::vector; RimContourMapProjection(); @@ -95,6 +82,8 @@ public: cvf::Vec2ui numberOfVerticesIJ() const; bool isColumnResult() const; + bool isMeanResult() const; + bool isStraightSummationResult() const; double valueAtVertex( uint i, uint j ) const; @@ -114,14 +103,11 @@ public: virtual RimRegularLegendConfig* legendConfig() const = 0; virtual void updateLegend() = 0; -protected: - // Protected virtual methods to be overridden by Eclipse and Geo-mechanical contour map implementations - virtual void updateGridInformation() = 0; - virtual std::vector retrieveParameterWeights() = 0; - virtual std::vector generateResults( int timeStep ) = 0; - virtual bool resultVariableChanged() const = 0; - virtual void clearResultVariable() = 0; - virtual RimGridView* baseView() const = 0; + // Use this function to get the result index into grid cell results. The index will differ if we have active cells + virtual size_t gridResultIndex( size_t globalCellIdx ) const; + + virtual std::vector retrieveParameterWeights() = 0; + virtual size_t kLayer( size_t globalCellIdx ) const = 0; virtual size_t kLayers() const = 0; virtual std::vector findIntersectingCells( const cvf::BoundingBox& bbox ) const = 0; @@ -129,8 +115,15 @@ protected: virtual double calculateRayLengthInCell( size_t globalCellIdx, const cvf::Vec3d& highestPoint, const cvf::Vec3d& lowestPoint ) const = 0; virtual double getParameterWeightForCell( size_t globalCellIdx, const std::vector& parameterWeights ) const = 0; - // Use this function to get the result index into grid cell results. The index will differ if we have active cells - virtual size_t gridResultIndex( size_t globalCellIdx ) const; + virtual cvf::ref getCellVisibility() const; + +protected: + // Protected virtual methods to be overridden by Eclipse and Geo-mechanical contour map implementations + virtual void updateGridInformation() = 0; + virtual std::vector generateResults( int timeStep ) = 0; + virtual bool resultVariableChanged() const = 0; + virtual void clearResultVariable() = 0; + virtual RimGridView* baseView() const = 0; double calculateValueInMapCell( uint i, uint j, const std::vector& gridCellValues ) const; @@ -149,10 +142,10 @@ protected: virtual std::pair minmaxValuesAllTimeSteps(); - virtual cvf::ref getCellVisibility() const; - virtual std::vector getMapCellVisibility(); - bool mapCellVisibilityNeedsUpdating(); - std::vector>> generateGridMapping(); + virtual std::vector getMapCellVisibility(); + bool mapCellVisibilityNeedsUpdating(); + static std::vector>> generateGridMapping( RimContourMapProjection& contourMapProjection, + const RigContourMapGrid& contourMapGrid ); void generateVertexResults(); void generateTrianglesWithVertexValues(); @@ -160,15 +153,6 @@ protected: static double sumTriangleAreas( const std::vector& triangles ); - std::vector cellOverlapVolumesAndResults( const cvf::Vec2d& globalPos2d, - const std::vector& weightingResultValues ) const; - std::vector cellRayIntersectionAndResults( const cvf::Vec2d& globalPos2d, - const std::vector& weightingResultValues ) const; - - bool isMeanResult() const; - bool isStraightSummationResult() const; - static bool isStraightSummationResult( ResultAggregationEnum aggregationType ); - double interpolateValue( const cvf::Vec2d& gridPosition2d ) const; double valueInCell( uint i, uint j ) const; bool hasResultInCell( uint i, uint j ) const; diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp index a88a854a3e..71d76103c8 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp @@ -22,6 +22,7 @@ #include "RigCaseCellResultsData.h" #include "RigCell.h" #include "RigCellGeometryTools.h" +#include "RigContourMapCalculator.h" #include "RigContourMapGrid.h" #include "RigEclipseCaseData.h" #include "RigEclipseResultAddress.h" @@ -115,8 +116,7 @@ void RimEclipseContourMapProjection::updateLegend() legendConfig()->setAutomaticRanges( minValAllTimeSteps, maxValAllTimeSteps, minVal, maxVal ); - if ( m_resultAggregation() == RESULTS_OIL_COLUMN || m_resultAggregation() == RESULTS_GAS_COLUMN || - m_resultAggregation() == RESULTS_HC_COLUMN ) + if ( isColumnResult() ) { legendConfig()->setTitle( QString( "Map Projection\n%1" ).arg( m_resultAggregation().uiText() ) ); } @@ -188,12 +188,14 @@ std::vector RimEclipseContourMapProjection::generateResults( int timeSte gridCellResult->ensureKnownResultLoaded( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "PORO" ) ); gridCellResult->ensureKnownResultLoaded( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "NTG" ) ); gridCellResult->ensureKnownResultLoaded( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "DZ" ) ); - if ( m_resultAggregation == RESULTS_OIL_COLUMN || m_resultAggregation == RESULTS_HC_COLUMN ) + if ( m_resultAggregation == RigContourMapCalculator::RESULTS_OIL_COLUMN || + m_resultAggregation == RigContourMapCalculator::RESULTS_HC_COLUMN ) { gridCellResult->ensureKnownResultLoaded( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::soil() ) ); } - if ( m_resultAggregation == RESULTS_GAS_COLUMN || m_resultAggregation == RESULTS_HC_COLUMN ) + if ( m_resultAggregation == RigContourMapCalculator::RESULTS_GAS_COLUMN || + m_resultAggregation == RigContourMapCalculator::RESULTS_HC_COLUMN ) { gridCellResult->ensureKnownResultLoaded( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::sgas() ) ); @@ -284,7 +286,7 @@ std::vector RimEclipseContourMapProjection::calculateColumnResult( Resul std::vector resultValues( poroResults.size(), 0.0 ); - if ( resultAggregation == RESULTS_OIL_COLUMN || resultAggregation == RESULTS_HC_COLUMN ) + if ( resultAggregation == RigContourMapCalculator::RESULTS_OIL_COLUMN || resultAggregation == RigContourMapCalculator::RESULTS_HC_COLUMN ) { const std::vector& soilResults = resultData->cellScalarResults( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::soil() ), @@ -295,7 +297,7 @@ std::vector RimEclipseContourMapProjection::calculateColumnResult( Resul } } - if ( resultAggregation == RESULTS_GAS_COLUMN || resultAggregation == RESULTS_HC_COLUMN ) + if ( resultAggregation == RigContourMapCalculator::RESULTS_GAS_COLUMN || resultAggregation == RigContourMapCalculator::RESULTS_HC_COLUMN ) { bool hasGasResult = resultData->hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::sgas() ) ); diff --git a/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake b/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake index 8e9b8bd8cd..fa554796a4 100644 --- a/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake +++ b/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake @@ -104,6 +104,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RigWellTargetCandidatesGenerator.h ${CMAKE_CURRENT_LIST_DIR}/RigContourMapGrid.h ${CMAKE_CURRENT_LIST_DIR}/RigContourPolygonsTools.h + ${CMAKE_CURRENT_LIST_DIR}/RigContourMapCalculator.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -206,6 +207,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RigWellTargetCandidatesGenerator.cpp ${CMAKE_CURRENT_LIST_DIR}/RigContourMapGrid.cpp ${CMAKE_CURRENT_LIST_DIR}/RigContourPolygonsTools.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigContourMapCalculator.cpp ) list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.cpp new file mode 100644 index 0000000000..d7a55db529 --- /dev/null +++ b/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.cpp @@ -0,0 +1,410 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- 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 "RigContourMapCalculator.h" + +#include "RiaWeightedGeometricMeanCalculator.h" +#include "RiaWeightedHarmonicMeanCalculator.h" +#include "RiaWeightedMeanCalculator.h" + +#include "RigContourMapGrid.h" + +#include "RimCase.h" +#include "RimContourMapProjection.h" + +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigContourMapCalculator::calculateValueInMapCell( const RimContourMapProjection& contourMapProjection, + const std::vector>& matchingCells, + const std::vector& gridCellValues, + ResultAggregationEnum resultAggregation ) +{ + if ( matchingCells.empty() ) return std::numeric_limits::infinity(); + + switch ( resultAggregation ) + { + case RESULTS_TOP_VALUE: + return calculateTopValue( contourMapProjection, matchingCells, gridCellValues ); + case RESULTS_MEAN_VALUE: + return calculateMeanValue( contourMapProjection, matchingCells, gridCellValues ); + case RESULTS_GEOM_VALUE: + return calculateGeometricMeanValue( contourMapProjection, matchingCells, gridCellValues ); + case RESULTS_HARM_VALUE: + return calculateHarmonicMeanValue( contourMapProjection, matchingCells, gridCellValues ); + case RESULTS_MAX_VALUE: + return calculateMaxValue( contourMapProjection, matchingCells, gridCellValues ); + case RESULTS_MIN_VALUE: + return calculateMinValue( contourMapProjection, matchingCells, gridCellValues ); + case RESULTS_VOLUME_SUM: + case RESULTS_SUM: + case RESULTS_OIL_COLUMN: + case RESULTS_GAS_COLUMN: + case RESULTS_HC_COLUMN: + return calculateSum( contourMapProjection, matchingCells, gridCellValues ); + default: + { + CVF_TIGHT_ASSERT( false ); + return std::numeric_limits::infinity(); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigContourMapCalculator::calculateTopValue( const RimContourMapProjection& contourMapProjection, + const std::vector>& matchingCells, + const std::vector& gridCellValues ) +{ + for ( auto [cellIdx, weight] : matchingCells ) + { + double cellValue = gridCellValues[contourMapProjection.gridResultIndex( cellIdx )]; + if ( std::abs( cellValue ) != std::numeric_limits::infinity() ) + { + return cellValue; + } + } + return std::numeric_limits::infinity(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigContourMapCalculator::calculateMeanValue( const RimContourMapProjection& contourMapProjection, + const std::vector>& matchingCells, + const std::vector& gridCellValues ) +{ + RiaWeightedMeanCalculator calculator; + for ( auto [cellIdx, weight] : matchingCells ) + { + double cellValue = gridCellValues[contourMapProjection.gridResultIndex( cellIdx )]; + if ( std::abs( cellValue ) != std::numeric_limits::infinity() ) + { + calculator.addValueAndWeight( cellValue, weight ); + } + } + if ( calculator.validAggregatedWeight() ) + { + return calculator.weightedMean(); + } + return std::numeric_limits::infinity(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigContourMapCalculator::calculateGeometricMeanValue( const RimContourMapProjection& contourMapProjection, + const std::vector>& matchingCells, + const std::vector& gridCellValues ) +{ + RiaWeightedGeometricMeanCalculator calculator; + for ( auto [cellIdx, weight] : matchingCells ) + { + double cellValue = gridCellValues[contourMapProjection.gridResultIndex( cellIdx )]; + if ( std::abs( cellValue ) != std::numeric_limits::infinity() ) + { + if ( cellValue < 1.0e-8 ) + { + return 0.0; + } + calculator.addValueAndWeight( cellValue, weight ); + } + } + if ( calculator.validAggregatedWeight() ) + { + return calculator.weightedMean(); + } + return std::numeric_limits::infinity(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigContourMapCalculator::calculateHarmonicMeanValue( const RimContourMapProjection& contourMapProjection, + const std::vector>& matchingCells, + const std::vector& gridCellValues ) +{ + RiaWeightedHarmonicMeanCalculator calculator; + for ( auto [cellIdx, weight] : matchingCells ) + { + double cellValue = gridCellValues[contourMapProjection.gridResultIndex( cellIdx )]; + if ( std::fabs( cellValue ) < 1.0e-8 ) + { + return 0.0; + } + if ( std::abs( cellValue ) != std::numeric_limits::infinity() ) + { + calculator.addValueAndWeight( cellValue, weight ); + } + } + if ( calculator.validAggregatedWeight() ) + { + return calculator.weightedMean(); + } + return std::numeric_limits::infinity(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigContourMapCalculator::calculateMaxValue( const RimContourMapProjection& contourMapProjection, + const std::vector>& matchingCells, + const std::vector& gridCellValues ) +{ + double maxValue = -std::numeric_limits::infinity(); + for ( auto [cellIdx, weight] : matchingCells ) + { + double cellValue = gridCellValues[contourMapProjection.gridResultIndex( cellIdx )]; + if ( std::abs( cellValue ) != std::numeric_limits::infinity() ) + { + maxValue = std::max( maxValue, cellValue ); + } + } + if ( maxValue == -std::numeric_limits::infinity() ) + { + maxValue = std::numeric_limits::infinity(); + } + return maxValue; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigContourMapCalculator::calculateMinValue( const RimContourMapProjection& contourMapProjection, + const std::vector>& matchingCells, + const std::vector& gridCellValues ) +{ + double minValue = std::numeric_limits::infinity(); + for ( auto [cellIdx, weight] : matchingCells ) + { + double cellValue = gridCellValues[contourMapProjection.gridResultIndex( cellIdx )]; + minValue = std::min( minValue, cellValue ); + } + return minValue; +} + +double RigContourMapCalculator::calculateSum( const RimContourMapProjection& contourMapProjection, + const std::vector>& matchingCells, + const std::vector& gridCellValues ) +{ + double sum = 0.0; + for ( auto [cellIdx, weight] : matchingCells ) + { + double cellValue = gridCellValues[contourMapProjection.gridResultIndex( cellIdx )]; + if ( std::abs( cellValue ) != std::numeric_limits::infinity() ) + { + sum += cellValue * weight; + } + } + return sum; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector>> + RigContourMapCalculator::generateGridMapping( RimContourMapProjection& contourMapProjection, const RigContourMapGrid& contourMapGrid ) +{ + int nCells = contourMapGrid.numberOfCells(); + std::vector>> projected3dGridIndices( nCells ); + + std::vector weightingResultValues = contourMapProjection.retrieveParameterWeights(); + + if ( contourMapProjection.isStraightSummationResult() ) + { +#pragma omp parallel for + for ( int index = 0; index < nCells; ++index ) + { + cvf::Vec2ui ij = contourMapGrid.ijFromCellIndex( index ); + + cvf::Vec2d globalPos = contourMapGrid.cellCenterPosition( ij.x(), ij.y() ) + contourMapGrid.origin2d(); + projected3dGridIndices[index] = + cellRayIntersectionAndResults( contourMapProjection, contourMapGrid, globalPos, weightingResultValues ); + } + } + else + { +#pragma omp parallel for + for ( int index = 0; index < nCells; ++index ) + { + cvf::Vec2ui ij = contourMapGrid.ijFromCellIndex( index ); + + cvf::Vec2d globalPos = contourMapGrid.cellCenterPosition( ij.x(), ij.y() ) + contourMapGrid.origin2d(); + projected3dGridIndices[index] = + cellOverlapVolumesAndResults( contourMapProjection, contourMapGrid, globalPos, weightingResultValues ); + } + } + + return projected3dGridIndices; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector + RigContourMapCalculator::cellOverlapVolumesAndResults( const RimContourMapProjection& contourMapProjection, + const RigContourMapGrid& contourMapGrid, + const cvf::Vec2d& globalPos2d, + const std::vector& weightingResultValues ) +{ + const cvf::BoundingBox& expandedBoundingBox = contourMapGrid.expandedBoundingBox(); + cvf::Vec3d top2dElementCentroid( globalPos2d, expandedBoundingBox.max().z() ); + cvf::Vec3d bottom2dElementCentroid( globalPos2d, expandedBoundingBox.min().z() ); + cvf::Vec3d planarDiagonalVector( 0.5 * contourMapGrid.sampleSpacing(), 0.5 * contourMapGrid.sampleSpacing(), 0.0 ); + cvf::Vec3d topNECorner = top2dElementCentroid + planarDiagonalVector; + cvf::Vec3d bottomSWCorner = bottom2dElementCentroid - planarDiagonalVector; + + cvf::BoundingBox bbox2dElement( bottomSWCorner, topNECorner ); + + std::vector> matchingVisibleCellsAndWeight; + + // Bounding box has been expanded, so 2d element may be outside actual 3d grid + if ( !bbox2dElement.intersects( contourMapGrid.originalBoundingBox() ) ) + { + return matchingVisibleCellsAndWeight; + } + + std::vector allCellIndices = contourMapProjection.findIntersectingCells( bbox2dElement ); + + std::vector> kLayerCellIndexVector; + kLayerCellIndexVector.resize( contourMapProjection.kLayers() ); + + if ( kLayerCellIndexVector.empty() ) + { + return matchingVisibleCellsAndWeight; + } + + auto cellGridIdxVisibility = contourMapProjection.getCellVisibility(); + for ( size_t globalCellIdx : allCellIndices ) + { + if ( ( *cellGridIdxVisibility )[globalCellIdx] ) + { + kLayerCellIndexVector[contourMapProjection.kLayer( globalCellIdx )].push_back( globalCellIdx ); + } + } + + for ( const auto& kLayerIndices : kLayerCellIndexVector ) + { + for ( size_t globalCellIdx : kLayerIndices ) + { + double overlapVolume = contourMapProjection.calculateOverlapVolume( globalCellIdx, bbox2dElement ); + if ( overlapVolume > 0.0 ) + { + double weight = + overlapVolume * contourMapProjection.getParameterWeightForCell( contourMapProjection.gridResultIndex( globalCellIdx ), + weightingResultValues ); + if ( weight > 0.0 ) + { + matchingVisibleCellsAndWeight.push_back( std::make_pair( globalCellIdx, weight ) ); + } + } + } + } + + return matchingVisibleCellsAndWeight; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector + RigContourMapCalculator::cellRayIntersectionAndResults( const RimContourMapProjection& contourMapProjection, + const RigContourMapGrid& contourMapGrid, + const cvf::Vec2d& globalPos2d, + const std::vector& weightingResultValues ) +{ + std::vector> matchingVisibleCellsAndWeight; + + const cvf::BoundingBox& expandedBoundingBox = contourMapGrid.expandedBoundingBox(); + + cvf::Vec3d highestPoint( globalPos2d, expandedBoundingBox.max().z() ); + cvf::Vec3d lowestPoint( globalPos2d, expandedBoundingBox.min().z() ); + + // Bounding box has been expanded, so ray may be outside actual 3d grid + if ( !contourMapGrid.originalBoundingBox().contains( highestPoint ) ) + { + return matchingVisibleCellsAndWeight; + } + + cvf::BoundingBox rayBBox; + rayBBox.add( highestPoint ); + rayBBox.add( lowestPoint ); + + std::vector allCellIndices = contourMapProjection.findIntersectingCells( rayBBox ); + + std::map> kLayerIndexMap; + + auto cellGridIdxVisibility = contourMapProjection.getCellVisibility(); + for ( size_t globalCellIdx : allCellIndices ) + { + if ( ( *cellGridIdxVisibility )[globalCellIdx] ) + { + kLayerIndexMap[contourMapProjection.kLayer( globalCellIdx )].push_back( globalCellIdx ); + } + } + + for ( const auto& kLayerIndexPair : kLayerIndexMap ) + { + double weightSumThisKLayer = 0.0; + std::vector> cellsAndWeightsThisLayer; + for ( size_t globalCellIdx : kLayerIndexPair.second ) + { + double lengthInCell = contourMapProjection.calculateRayLengthInCell( globalCellIdx, highestPoint, lowestPoint ); + if ( lengthInCell > 0.0 ) + { + cellsAndWeightsThisLayer.push_back( std::make_pair( globalCellIdx, lengthInCell ) ); + weightSumThisKLayer += lengthInCell; + } + } + for ( auto& cellWeightPair : cellsAndWeightsThisLayer ) + { + cellWeightPair.second /= weightSumThisKLayer; + matchingVisibleCellsAndWeight.push_back( cellWeightPair ); + } + } + + return matchingVisibleCellsAndWeight; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RigContourMapCalculator::isColumnResult( ResultAggregationEnum aggregationType ) +{ + return aggregationType == RESULTS_OIL_COLUMN || aggregationType == RESULTS_GAS_COLUMN || aggregationType == RESULTS_HC_COLUMN; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RigContourMapCalculator::isMeanResult( ResultAggregationEnum aggregationType ) +{ + return aggregationType == RESULTS_MEAN_VALUE || aggregationType == RESULTS_HARM_VALUE || aggregationType == RESULTS_GEOM_VALUE; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RigContourMapCalculator::isStraightSummationResult( ResultAggregationEnum aggregationType ) +{ + return aggregationType == RESULTS_OIL_COLUMN || aggregationType == RESULTS_GAS_COLUMN || aggregationType == RESULTS_HC_COLUMN || + aggregationType == RESULTS_SUM; +} diff --git a/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.h b/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.h new file mode 100644 index 0000000000..19257c1f56 --- /dev/null +++ b/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.h @@ -0,0 +1,98 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- 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 "cvfVector2.h" + +#include +#include + +class RigContourMapGrid; +class RimContourMapProjection; + +//================================================================================================== +/// +/// +//================================================================================================== +class RigContourMapCalculator +{ +public: + using CellIndexAndResult = std::pair; + + enum ResultAggregationEnum + { + RESULTS_TOP_VALUE, + RESULTS_MEAN_VALUE, + RESULTS_GEOM_VALUE, + RESULTS_HARM_VALUE, + RESULTS_MIN_VALUE, + RESULTS_MAX_VALUE, + RESULTS_VOLUME_SUM, + RESULTS_SUM, + RESULTS_OIL_COLUMN, + RESULTS_GAS_COLUMN, + RESULTS_HC_COLUMN + }; + + static std::vector>> generateGridMapping( RimContourMapProjection& contourMapProjection, + const RigContourMapGrid& contourMapGrid ); + + static double calculateValueInMapCell( const RimContourMapProjection& contourMapProjection, + const std::vector>& matchingCells, + const std::vector& gridCellValues, + ResultAggregationEnum resultAggregation ); + + static std::vector cellOverlapVolumesAndResults( const RimContourMapProjection& contourMapProjection, + const RigContourMapGrid& contourMapGrid, + const cvf::Vec2d& globalPos2d, + const std::vector& weightingResultValues ); + + static std::vector cellRayIntersectionAndResults( const RimContourMapProjection& contourMapProjection, + const RigContourMapGrid& contourMapGrid, + const cvf::Vec2d& globalPos2d, + const std::vector& weightingResultValues ); + + static bool isColumnResult( ResultAggregationEnum aggregationType ); + static bool isMeanResult( ResultAggregationEnum aggregationType ); + static bool isStraightSummationResult( ResultAggregationEnum aggregationType ); + +private: + static double calculateTopValue( const RimContourMapProjection& contourMapProjection, + const std::vector>& matchingCells, + const std::vector& gridCellValues ); + static double calculateMeanValue( const RimContourMapProjection& contourMapProjection, + const std::vector>& matchingCells, + const std::vector& gridCellValues ); + + static double calculateGeometricMeanValue( const RimContourMapProjection& contourMapProjection, + const std::vector>& matchingCells, + const std::vector& gridCellValues ); + static double calculateHarmonicMeanValue( const RimContourMapProjection& contourMapProjection, + const std::vector>& matchingCells, + const std::vector& gridCellValues ); + static double calculateMaxValue( const RimContourMapProjection& contourMapProjection, + const std::vector>& matchingCells, + const std::vector& gridCellValues ); + static double calculateMinValue( const RimContourMapProjection& contourMapProjection, + const std::vector>& matchingCells, + const std::vector& gridCellValues ); + static double calculateSum( const RimContourMapProjection& contourMapProjection, + const std::vector>& matchingCells, + const std::vector& gridCellValues ); +}; From c795eccf0b7f8526fbff26a1caaf8db5c7a54106 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 21 Oct 2024 09:29:18 +0200 Subject: [PATCH 064/160] Align the search expression with sumo explorer --- .../Tools/Cloud/RiaSumoConnector.cpp | 201 +++++++++++------- 1 file changed, 123 insertions(+), 78 deletions(-) diff --git a/ApplicationLibCode/Application/Tools/Cloud/RiaSumoConnector.cpp b/ApplicationLibCode/Application/Tools/Cloud/RiaSumoConnector.cpp index 278d5ba6af..1749252556 100644 --- a/ApplicationLibCode/Application/Tools/Cloud/RiaSumoConnector.cpp +++ b/ApplicationLibCode/Application/Tools/Cloud/RiaSumoConnector.cpp @@ -172,27 +172,68 @@ void RiaSumoConnector::requestEnsembleByCasesId( const SumoCaseId& caseId ) { requestTokenBlocking(); + // See the following file for query definition + // https://github.com/equinor/fmu-sumo/blob/main/src/fmu/sumo/explorer/objects/case.py + QString payloadTemplate = R"( -{ - "query": { - "bool": { - "filter": [ - {"term":{"_sumo.parent_object.keyword":"%1"}} - ] - } - }, - "aggs": { - "aggs_columns": { - "terms": { "field": "fmu.iteration.name.keyword", "size": 5 } - } - }, - "track_total_hits":true, - "size":20, - "from":0, - "_source": false -} - + { + "query": { + "term": { + "fmu.case.uuid.keyword": "%1" + } + }, + "aggs": { + "iteration_uuids": { + "terms": { + "field": "fmu.iteration.uuid.keyword", + "size": 100 + } + }, + "iteration_names": { + "terms": { + "field": "fmu.iteration.name.keyword", + "size": 100 + } + }, + "data_types": { + "terms": { + "field": "class.keyword", + "size": 100 + } + }, + "iterations": { + "terms": { + "field": "fmu.iteration.uuid.keyword", + "size": 100 + }, + "aggs": { + "iteration_name": { + "terms": { + "field": "fmu.iteration.name.keyword", + "size": 100 + } + }, + "numreal": { + "cardinality": { + "field": "fmu.realization.id" + } + }, + "maxreal": { + "max": { + "field": "fmu.realization.id" + } + }, + "minreal": { + "min": { + "field": "fmu.realization.id" + } + } + } + } + }, + "size": 0 + } )"; QNetworkRequest m_networkRequest; @@ -214,6 +255,45 @@ void RiaSumoConnector::requestEnsembleByCasesId( const SumoCaseId& caseId ) } ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaSumoConnector::parseEnsembleNames( QNetworkReply* reply, const SumoCaseId& caseId ) +{ + // See the following file for parsing of the reply + // https://github.com/equinor/fmu-sumo/blob/main/src/fmu/sumo/explorer/objects/case.py + + QByteArray result = reply->readAll(); + reply->deleteLater(); + + if ( reply->error() == QNetworkReply::NoError ) + { + m_ensembleNames.clear(); + + QJsonDocument doc = QJsonDocument::fromJson( result ); + QJsonObject jsonObj = doc.object(); + QJsonObject aggregationsObject = jsonObj["aggregations"].toObject(); + QJsonObject aggregationColumnsObject = aggregationsObject["iteration_names"].toObject(); + + QJsonArray bucketsArray = aggregationColumnsObject["buckets"].toArray(); + foreach ( const QJsonValue& bucket, bucketsArray ) + { + QJsonObject bucketObj = bucket.toObject(); + auto ensembleName = bucketObj["key"].toString(); + + m_ensembleNames.push_back( { caseId, ensembleName } ); + } + + RiaLogging::debug( QString( "Ensemble count : %1" ).arg( m_ensembleNames.size() ) ); + } + else + { + RiaLogging::error( QString( "Request ensemble names failed: : '%s'" ).arg( reply->errorString() ) ); + } + + emit ensembleNamesFinished(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -720,42 +800,12 @@ void RiaSumoConnector::parseAssets( QNetworkReply* reply ) RiaLogging::info( QString( "Asset: %1" ).arg( a.name ) ); } } - emit assetsFinished(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiaSumoConnector::parseEnsembleNames( QNetworkReply* reply, const SumoCaseId& caseId ) -{ - QByteArray result = reply->readAll(); - reply->deleteLater(); - - if ( reply->error() == QNetworkReply::NoError ) + else { - m_ensembleNames.clear(); - - QJsonDocument doc = QJsonDocument::fromJson( result ); - QJsonObject jsonObj = doc.object(); - auto keys_1 = jsonObj.keys(); - - auto aggregationsObject = jsonObj["aggregations"].toObject(); - - QJsonObject aggregationColumnsObject = aggregationsObject["aggs_columns"].toObject(); - auto keys_2 = aggregationColumnsObject.keys(); - - QJsonArray bucketsArray = aggregationColumnsObject["buckets"].toArray(); - foreach ( const QJsonValue& bucket, bucketsArray ) - { - QJsonObject bucketObj = bucket.toObject(); - auto keys_3 = bucketObj.keys(); - - auto ensembleName = bucketObj["key"].toString(); - m_ensembleNames.push_back( { caseId, ensembleName } ); - } + RiaLogging::error( QString( "Request assets failed: : '%s'" ).arg( reply->errorString() ) ); } - emit ensembleNamesFinished(); + emit assetsFinished(); } //-------------------------------------------------------------------------------------------------- @@ -768,33 +818,31 @@ void RiaSumoConnector::parseCases( QNetworkReply* reply ) if ( reply->error() == QNetworkReply::NoError ) { - QJsonDocument doc = QJsonDocument::fromJson( result ); - QJsonObject jsonObj = doc.object(); - QJsonObject rootHits = jsonObj["hits"].toObject(); - - QJsonArray hitsObjects = rootHits["hits"].toArray(); + QJsonDocument doc = QJsonDocument::fromJson( result ); + QJsonObject jsonObj = doc.object(); + QJsonObject rootHits = jsonObj["hits"].toObject(); + QJsonArray hitsObjects = rootHits["hits"].toArray(); m_cases.clear(); foreach ( const QJsonValue& value, hitsObjects ) { QJsonObject resultObj = value.toObject(); - auto keys_1 = resultObj.keys(); - - QJsonObject sourceObj = resultObj["_source"].toObject(); - auto sourceKeys = sourceObj.keys(); - - QJsonObject fmuObj = sourceObj["fmu"].toObject(); - auto fmuObjKeys = fmuObj.keys(); - - QJsonObject fmuCase = fmuObj["case"].toObject(); - auto fmuCaseKeys = fmuCase.keys(); + QJsonObject sourceObj = resultObj["_source"].toObject(); + QJsonObject fmuObj = sourceObj["fmu"].toObject(); + QJsonObject fmuCase = fmuObj["case"].toObject(); QString id = resultObj["_id"].toString(); QString kind = ""; QString fieldName = fmuCase["name"].toString(); m_cases.push_back( SumoCase{ SumoCaseId( id ), kind, fieldName } ); } + + RiaLogging::debug( QString( "Case count : %1" ).arg( m_cases.size() ) ); + } + else + { + RiaLogging::error( QString( "Request cases failed: : '%s'" ).arg( reply->errorString() ) ); } emit casesFinished(); @@ -825,6 +873,10 @@ void RiaSumoConnector::parseVectorNames( QNetworkReply* reply, const SumoCaseId& } } } + else + { + RiaLogging::error( QString( "Request vector names failed: : '%s'" ).arg( reply->errorString() ) ); + } emit vectorNamesFinished(); } @@ -846,10 +898,8 @@ void RiaSumoConnector::parseRealizationNumbers( QNetworkReply* reply, const Sumo for ( const auto& hit : hits ) { QJsonObject resultObj = hit.toObject(); - auto keys_1 = resultObj.keys(); - - auto val = resultObj.value( "key" ); - auto intValue = val.toInt(); + auto val = resultObj.value( "key" ); + auto intValue = val.toInt(); auto realizationId = QString::number( intValue ); m_realizationIds.push_back( realizationId ); @@ -884,13 +934,8 @@ void RiaSumoConnector::parseBlobIds( QNetworkReply* reply, foreach ( const QJsonValue& value, hitsObjects ) { QJsonObject resultObj = value.toObject(); - auto keys_1 = resultObj.keys(); - - QJsonObject sourceObj = resultObj["_source"].toObject(); - auto sourceKeys = sourceObj.keys(); - - QJsonObject fmuObj = sourceObj["_sumo"].toObject(); - auto fmuObjKeys = fmuObj.keys(); + QJsonObject sourceObj = resultObj["_source"].toObject(); + QJsonObject fmuObj = sourceObj["_sumo"].toObject(); auto blobName = fmuObj["blob_name"].toString(); m_blobUrl.push_back( blobName ); From a9ea615bf02e9fbe7790458bf184d06c7279ddf5 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 23 Oct 2024 15:45:33 +0200 Subject: [PATCH 065/160] Add support for increase of serial number when data is assigned to a SUMO case --- .../FileInterface/RifSummaryReaderInterface.cpp | 10 +++++++++- .../FileInterface/RifSummaryReaderInterface.h | 2 ++ .../Summary/Sumo/RimSummaryCaseSumo.cpp | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/FileInterface/RifSummaryReaderInterface.cpp b/ApplicationLibCode/FileInterface/RifSummaryReaderInterface.cpp index 51c9be4541..5abb2280e1 100644 --- a/ApplicationLibCode/FileInterface/RifSummaryReaderInterface.cpp +++ b/ApplicationLibCode/FileInterface/RifSummaryReaderInterface.cpp @@ -69,12 +69,20 @@ int RifSummaryReaderInterface::serialNumber() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifSummaryReaderInterface::RifSummaryReaderInterface() +void RifSummaryReaderInterface::increaseSerialNumber() { #pragma omp critical m_serialNumber = m_nextSerialNumber++; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RifSummaryReaderInterface::RifSummaryReaderInterface() +{ + increaseSerialNumber(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/FileInterface/RifSummaryReaderInterface.h b/ApplicationLibCode/FileInterface/RifSummaryReaderInterface.h index 2f86ae86af..cee40c9d22 100644 --- a/ApplicationLibCode/FileInterface/RifSummaryReaderInterface.h +++ b/ApplicationLibCode/FileInterface/RifSummaryReaderInterface.h @@ -58,6 +58,8 @@ public: int serialNumber() const; protected: + void increaseSerialNumber(); + std::set m_allResultAddresses; // Result and error addresses std::set m_allErrorAddresses; // Error addresses diff --git a/ApplicationLibCode/ProjectDataModel/Summary/Sumo/RimSummaryCaseSumo.cpp b/ApplicationLibCode/ProjectDataModel/Summary/Sumo/RimSummaryCaseSumo.cpp index 9676dbacb0..6220ea82db 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/Sumo/RimSummaryCaseSumo.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/Sumo/RimSummaryCaseSumo.cpp @@ -124,6 +124,8 @@ void RimSummaryCaseSumo::setValues( const std::vector& timeSteps, { m_timeSteps = timeSteps; m_values[resultAddress] = values; + + increaseSerialNumber(); } //-------------------------------------------------------------------------------------------------- From 1f2b180ab79d8e9bbb2c6d054d0a0348e09002b3 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 24 Oct 2024 11:40:17 +0200 Subject: [PATCH 066/160] #11812 Multi-segment RFT plot: Make sure reservoir Pressure is plotted --- .../WellLog/RimWellLogRftCurve.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp index fc4db95530..3d5cea4982 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp @@ -1130,12 +1130,12 @@ std::vector RimWellLogRftCurve::tvDepthValues() if ( m_rftDataType() == RftDataType::RFT_SEGMENT_DATA ) { - if ( RiaDefines::isSegmentConnectionResult( m_segmentResultName ) ) + if ( RiaDefines::isSegmentResult( m_segmentResultName ) ) { depthAddress = RifEclipseRftAddress::createBranchSegmentAddress( m_wellName(), m_timeStep, - RiaDefines::segmentConnectionTvdDepthResultName(), + RiaDefines::segmentTvdDepthResultName(), segmentBranchIndex(), m_segmentBranchType() ); } @@ -1143,7 +1143,7 @@ std::vector RimWellLogRftCurve::tvDepthValues() { depthAddress = RifEclipseRftAddress::createBranchSegmentAddress( m_wellName(), m_timeStep, - RiaDefines::segmentTvdDepthResultName(), + RiaDefines::segmentConnectionTvdDepthResultName(), segmentBranchIndex(), m_segmentBranchType() ); } @@ -1165,13 +1165,13 @@ std::vector RimWellLogRftCurve::measuredDepthValues( QString& prefixText { prefixText = "SEGMENT/"; - if ( RiaDefines::isSegmentConnectionResult( m_segmentResultName() ) ) + if ( RiaDefines::isSegmentResult( m_segmentResultName() ) ) { - return RimRftTools::segmentConnectionMdValues( opmRftReader, m_wellName(), m_timeStep, segmentBranchIndex(), m_segmentBranchType() ); + // Always use segment end MD values for segment data, as the curve is plotted as step left + return RimRftTools::segmentEndMdValues( opmRftReader, m_wellName(), m_timeStep, segmentBranchIndex(), m_segmentBranchType() ); } - // Always use segment end MD values for segment data, as the curve is plotted as step left - return RimRftTools::segmentEndMdValues( opmRftReader, m_wellName(), m_timeStep, segmentBranchIndex(), m_segmentBranchType() ); + return RimRftTools::segmentConnectionMdValues( opmRftReader, m_wellName(), m_timeStep, segmentBranchIndex(), m_segmentBranchType() ); } return {}; From 47413ede45ed9f24f253ecb945e99ea155106403 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 25 Oct 2024 08:39:50 +0200 Subject: [PATCH 067/160] Add example for linux CMakeUserPresets --- CMakeUserPresets-example.json | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/CMakeUserPresets-example.json b/CMakeUserPresets-example.json index efb7750448..560b53e553 100644 --- a/CMakeUserPresets-example.json +++ b/CMakeUserPresets-example.json @@ -40,6 +40,29 @@ "description": "Target Windows (64-bit) with the Visual Studio development environment. (Release)", "inherits": "windows-base", "cacheVariables": { "CMAKE_BUILD_TYPE": "Release" } + }, + { + "name": "linux-base", + "hidden": false, + "displayName": "Linux Base", + "inherits": "ninja", + "architecture": { + "value": "x64", + "strategy": "external" + }, + "cacheVariables": { + "VCPKG_TARGET_TRIPLET": "x64-linux-release", + "RESINSIGHT_ENABLE_UNITY_BUILD": true, + "RESINSIGHT_ENABLE_GRPC": false, + "CMAKE_PREFIX_PATH": "/home/builder/qt/6.6.3/gcc_64/lib/cmake" + } + }, + { + "name": "x64-release", + "displayName": "x64 Release", + "description": "Linux Release", + "inherits": "linux-base", + "cacheVariables": { "CMAKE_BUILD_TYPE": "Release" } } ] } \ No newline at end of file From bb047e82d33db4af60d0811f4d305c9288958e43 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 28 Oct 2024 08:59:33 +0100 Subject: [PATCH 068/160] #11827 Use FetchContent_MakeAvailable FetchContent_Populate() is deprecated --- CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f95a22a662..9d87519208 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -162,7 +162,7 @@ if(RESINSIGHT_DOWNLOAD_ODB_FROM_SERVER) ) endif() - FetchContent_Populate(odb-library-from-server) + FetchContent_MakeAvailable(odb-library-from-server) set(RESINSIGHT_ODB_API_DIR ${odb-library-from-server_SOURCE_DIR}) endif() @@ -405,7 +405,7 @@ else() ) endif() -FetchContent_Populate(openvds) +FetchContent_MakeAvailable(openvds) set(RESINSIGHT_OPENVDS_API_DIR ${openvds_SOURCE_DIR}) message(STATUS "Using OpenVDS api from : ${RESINSIGHT_OPENVDS_API_DIR}") @@ -434,7 +434,7 @@ if(MSVC) hdf-external-lib URL https://github.com/CeetronSolutions/resinsight-dependencies/releases/download/2023.04/HDF_Group.zip ) - FetchContent_Populate(hdf-external-lib) + FetchContent_MakeAvailable(hdf-external-lib) set(RESINSIGHT_HDF5_DIR ${hdf-external-lib_SOURCE_DIR}/HDF5/1.8.18) endif() @@ -490,7 +490,7 @@ if((NOT RESINSIGHT_BUILD_LIBS_FROM_SOURCE) AND MSVC) ri-dependencies URL https://github.com/CeetronSolutions/resinsight-dependencies/releases/latest/download/custom-opm-common.zip ) - FetchContent_Populate(ri-dependencies) + FetchContent_MakeAvailable(ri-dependencies) add_library(custom-opm-common STATIC IMPORTED) set_target_properties( @@ -1052,7 +1052,7 @@ if(RESINSIGHT_USE_EXTERNAL_OCTAVE_PLUGINS) URL https://github.com/CeetronSolutions/resinsight-dependencies/releases/latest/download/OctavePlugins-0.1.1-Linux.tar.gz ) - FetchContent_Populate(external-octave_plugins) + FetchContent_MakeAvailable(external-octave_plugins) file(GLOB FILE_AND_SYMLINKS ${external-octave_plugins_SOURCE_DIR}/*.oct) install( From 2814b920559c65df48fe39e02287cb3b48ad2897 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 28 Oct 2024 13:09:18 +0100 Subject: [PATCH 069/160] Qt6: Adjustments (#11804) * Qt6: Avoid insertWidget, use addWidget In Qt6, the insertWidget function checks if the index parameter is valid based on current widgets present in the layout. This is error prone, and use addWidget to avoid manual counting of index. * Disable use of Qt keyword foreach * Replace use of QRegExp with QRegularExpression Replace use of QRegExp with QRegularExpression Remove dependency on qt5compat module Simplify an expression based on review * Remove Qt5 ifdefs * Guard access out of bounds seen in debug build * Avoid reuse of string variable * Disconnect all signals from the QOpenGLContext The call stack when this assert happens indicates that there are more signals to be disconnected from the object. Crash is fixed by disconnecting all signals. Assert seen in debug build: ASSERT failure in caf::Viewer: "Called object is not of the correct type (class destructor may have already run)", file C:\Qt\6.6.3\msvc2019_64\include\QtCore/qobjectdefs_impl.h, line 130 * Fix issue related to delete of a linked view Guard null pointer use in view linker. Remove complicated cleanup in destructor in Rim3dVew. --- .../Application/RiaPreferences.cpp | 1 - .../Tools/Cloud/RiaSumoConnector.cpp | 6 +-- .../Application/Tools/RiaQDateTimeTools.cpp | 4 -- .../Application/Tools/RiaTextStringTools.cpp | 23 ++++----- .../Application/Tools/RiaTextStringTools.h | 6 +-- .../Tools/RiaValidRegExpValidator.cpp | 8 +-- .../Tools/RiaValidRegExpValidator.h | 3 +- .../Tools/Summary/RiaSummaryStringTools.cpp | 23 +++++---- ApplicationLibCode/CMakeLists.txt | 2 - .../Commands/RicCalculatorWidgetCreator.cpp | 4 +- .../RicSummaryPlotEditorWidgetCreator.cpp | 12 ++--- .../RifCaseRealizationParametersReader.cpp | 26 +++++----- .../RifCaseRealizationParametersReader.h | 1 + .../FileInterface/RifColorLegendData.cpp | 2 +- .../FileInterface/RifCsvUserDataParser.cpp | 18 ++++--- .../RifEclipseInputFileTools.cpp | 46 ++++++++--------- .../RifEclipseSummaryAddress.cpp | 15 +++--- .../FileInterface/RifFileParseTools.cpp | 10 +--- .../FileInterface/RifFileParseTools.h | 4 +- .../RifPerforationIntervalReader.cpp | 2 +- .../FileInterface/RifPolygonReader.cpp | 2 +- .../FileInterface/RifWellPathImporter.cpp | 2 +- .../RimPolylinesFromFileAnnotation.cpp | 2 +- .../RimWellPathCompletionSettings.cpp | 5 +- .../RimWellPathCompletionSettings.h | 4 +- .../ProjectDataModel/Rim3dView.cpp | 44 ---------------- .../ProjectDataModel/RimViewLinker.cpp | 2 + .../Summary/RimSummaryPlotManager.cpp | 2 +- .../WellPath/RimWellPathCollection.cpp | 9 ++-- .../RigReservoirBuilderMock.cpp | 10 ++-- .../UnitTests/RiaMedianCalculator-Test.h | 0 ...ifCaseRealizationParametersReader-Test.cpp | 2 +- .../RifEclipseInputFileTools-Test.cpp | 18 +++---- .../RifTextDataTableFormatter-Test.cpp | 6 +-- .../UserInterface/RiuGuiTheme.cpp | 50 ++++++++++--------- .../UserInterface/RiuQtChartsPlotWidget.cpp | 11 ++-- ...RiuSummaryVectorSelectionWidgetCreator.cpp | 4 +- .../UserInterface/RiuTextDialog.cpp | 4 -- CMakeLists.txt | 14 ++---- .../cafPdmCore/cafNotificationCenter.cpp | 6 +-- .../cafPdmCore/cafPdmReferenceHelper.cpp | 8 +-- .../cafProjectDataModel/cafPdmUiCore/caf.cpp | 14 +----- .../cafPdmUiCore/cafFontTools.cpp | 22 -------- .../cafUserInterface/cafAboutDialog.cpp | 46 ----------------- .../cafUserInterface/cafMemoryInspector.cpp | 9 +--- .../cafPdmUiComboBoxEditor.cpp | 6 +-- .../cafUserInterface/cafPdmUiLineEditor.cpp | 2 +- .../cafUserInterface/cafPdmUiPropertyView.cpp | 2 +- .../cafPdmUiTreeSelectionEditor.cpp | 4 -- .../cafPdmUniqueIdValidator.cpp | 2 +- .../cafQTreeViewStateSerializer.cpp | 2 +- Fwk/AppFwk/cafViewer/cafCadNavigation.cpp | 5 -- Fwk/AppFwk/cafViewer/cafCeetronNavigation.cpp | 6 +-- .../cafViewer/cafCeetronPlusNavigation.cpp | 5 -- Fwk/VizFwk/LibGuiQt/cvfqtOpenGLWidget.cpp | 9 ++-- Fwk/VizFwk/LibGuiQt/cvfqtUtils.cpp | 4 +- Fwk/VizFwk/TestApps/Qt/QtMinimal/QMWidget.cpp | 10 ---- .../TestApps/Qt/QtMultiView/QMVWidget.cpp | 10 ---- .../QtTestBenchOpenGLWidget/QTBVizWidget.cpp | 10 ---- 59 files changed, 196 insertions(+), 393 deletions(-) delete mode 100644 ApplicationLibCode/UnitTests/RiaMedianCalculator-Test.h diff --git a/ApplicationLibCode/Application/RiaPreferences.cpp b/ApplicationLibCode/Application/RiaPreferences.cpp index ff64446bc2..a592fd4e8d 100644 --- a/ApplicationLibCode/Application/RiaPreferences.cpp +++ b/ApplicationLibCode/Application/RiaPreferences.cpp @@ -47,7 +47,6 @@ #include #include #include -#include #include #include diff --git a/ApplicationLibCode/Application/Tools/Cloud/RiaSumoConnector.cpp b/ApplicationLibCode/Application/Tools/Cloud/RiaSumoConnector.cpp index 1749252556..3bef749e9c 100644 --- a/ApplicationLibCode/Application/Tools/Cloud/RiaSumoConnector.cpp +++ b/ApplicationLibCode/Application/Tools/Cloud/RiaSumoConnector.cpp @@ -276,7 +276,7 @@ void RiaSumoConnector::parseEnsembleNames( QNetworkReply* reply, const SumoCaseI QJsonObject aggregationColumnsObject = aggregationsObject["iteration_names"].toObject(); QJsonArray bucketsArray = aggregationColumnsObject["buckets"].toArray(); - foreach ( const QJsonValue& bucket, bucketsArray ) + for ( const QJsonValue& bucket : bucketsArray ) { QJsonObject bucketObj = bucket.toObject(); auto ensembleName = bucketObj["key"].toString(); @@ -825,7 +825,7 @@ void RiaSumoConnector::parseCases( QNetworkReply* reply ) m_cases.clear(); - foreach ( const QJsonValue& value, hitsObjects ) + for ( const QJsonValue& value : hitsObjects ) { QJsonObject resultObj = value.toObject(); QJsonObject sourceObj = resultObj["_source"].toObject(); @@ -931,7 +931,7 @@ void RiaSumoConnector::parseBlobIds( QNetworkReply* reply, QJsonObject rootHits = jsonObj["hits"].toObject(); QJsonArray hitsObjects = rootHits["hits"].toArray(); - foreach ( const QJsonValue& value, hitsObjects ) + for ( const QJsonValue& value : hitsObjects ) { QJsonObject resultObj = value.toObject(); QJsonObject sourceObj = resultObj["_source"].toObject(); diff --git a/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.cpp b/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.cpp index f9bb01ef86..897c962cad 100644 --- a/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.cpp @@ -203,11 +203,7 @@ QDateTime RiaQDateTimeTools::subtractPeriod( const QDateTime& dt, RiaDefines::Da //-------------------------------------------------------------------------------------------------- QDateTime RiaQDateTimeTools::createDateTime( const QDate& date, Qt::TimeSpec timeSpec /*= Qt::LocalTime*/ ) { -#if QT_VERSION >= QT_VERSION_CHECK( 5, 14, 0 ) return date.startOfDay( timeSpec ); -#else - return QDateTime( date, QTime( 0, 0 ), timeSpec ); -#endif } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/Tools/RiaTextStringTools.cpp b/ApplicationLibCode/Application/Tools/RiaTextStringTools.cpp index 11058d2073..5612ddbc2c 100644 --- a/ApplicationLibCode/Application/Tools/RiaTextStringTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaTextStringTools.cpp @@ -133,6 +133,15 @@ QStringList RiaTextStringTools::splitSkipEmptyParts( const QString& text, const return splitString( text, sep, skipEmptyParts ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QStringList RiaTextStringTools::splitSkipEmptyParts( const QString& text, const QRegularExpression& regularExpression ) +{ + bool skipEmptyParts = true; + return splitString( text, regularExpression, skipEmptyParts ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -144,9 +153,9 @@ QStringList RiaTextStringTools::splitString( const QString& text, const QString& //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QStringList RiaTextStringTools::splitString( const QString& text, const QRegExp& regExp, bool skipEmptyParts ) +QStringList RiaTextStringTools::splitString( const QString& text, const QRegularExpression& regularExpression, bool skipEmptyParts ) { - return regExp.splitString( text, skipEmptyParts ? Qt::SkipEmptyParts : Qt::KeepEmptyParts ); + return text.split( regularExpression, skipEmptyParts ? Qt::SkipEmptyParts : Qt::KeepEmptyParts ); } //-------------------------------------------------------------------------------------------------- @@ -197,16 +206,6 @@ bool RiaTextStringTools::isNumber( const QString& text, const QString& decimalPo return RiaStdStringTools::isNumber( stdString, decimalChar ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QStringList RiaTextStringTools::splitSkipEmptyParts( const QString& text, const QRegExp& regExp ) -{ - bool skipEmptyParts = true; - - return splitString( text, regExp, skipEmptyParts ); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/Tools/RiaTextStringTools.h b/ApplicationLibCode/Application/Tools/RiaTextStringTools.h index 34710045f9..5c4b1ee9a2 100644 --- a/ApplicationLibCode/Application/Tools/RiaTextStringTools.h +++ b/ApplicationLibCode/Application/Tools/RiaTextStringTools.h @@ -18,7 +18,7 @@ #pragma once -#include +#include #include #include @@ -36,10 +36,10 @@ QString commonSuffix( const QStringList& stringList ); QString trimNonAlphaNumericCharacters( const QString& s ); QStringList splitSkipEmptyParts( const QString& text, const QString& sep = " " ); -QStringList splitSkipEmptyParts( const QString& text, const QRegExp& regExp ); +QStringList splitSkipEmptyParts( const QString& text, const QRegularExpression& regularExpression ); QStringList splitString( const QString& text, const QString& sep, bool skipEmptyParts ); -QStringList splitString( const QString& text, const QRegExp& regExp, bool skipEmptyParts ); +QStringList splitString( const QString& text, const QRegularExpression& regularExpression, bool skipEmptyParts ); QString replaceTemplateTextWithValues( const QString& templateText, const std::map& valueMap ); bool isTextEqual( QStringView text, QStringView compareText ); diff --git a/ApplicationLibCode/Application/Tools/RiaValidRegExpValidator.cpp b/ApplicationLibCode/Application/Tools/RiaValidRegExpValidator.cpp index d7e1b64eed..40c4a4dff2 100644 --- a/ApplicationLibCode/Application/Tools/RiaValidRegExpValidator.cpp +++ b/ApplicationLibCode/Application/Tools/RiaValidRegExpValidator.cpp @@ -41,8 +41,10 @@ bool RiaValidRegExpValidator::isValidCharacter( const QChar& character ) //-------------------------------------------------------------------------------------------------- QValidator::State RiaValidRegExpValidator::validate( QString& inputString, int& position ) const { - QRegExp inputRe( inputString, Qt::CaseInsensitive, QRegExp::Wildcard ); - if ( inputRe.isValid() ) // A valid wildcard pattern is always acceptable + QString regexPattern = QRegularExpression::wildcardToRegularExpression( inputString ); + QRegularExpression regex( regexPattern, QRegularExpression::CaseInsensitiveOption ); + + if ( regex.isValid() ) { return QValidator::Acceptable; } @@ -70,4 +72,4 @@ QValidator::State RiaValidRegExpValidator::validate( QString& inputString, int& void RiaValidRegExpValidator::fixup( QString& inputString ) const { inputString = m_defaultPattern; -} \ No newline at end of file +} diff --git a/ApplicationLibCode/Application/Tools/RiaValidRegExpValidator.h b/ApplicationLibCode/Application/Tools/RiaValidRegExpValidator.h index 62ee01aa80..997c4bb393 100644 --- a/ApplicationLibCode/Application/Tools/RiaValidRegExpValidator.h +++ b/ApplicationLibCode/Application/Tools/RiaValidRegExpValidator.h @@ -17,7 +17,6 @@ ///////////////////////////////////////////////////////////////////////////////// #pragma once -#include #include #include @@ -36,4 +35,4 @@ public: private: QString m_defaultPattern; -}; \ No newline at end of file +}; diff --git a/ApplicationLibCode/Application/Tools/Summary/RiaSummaryStringTools.cpp b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryStringTools.cpp index b81c0dbdf7..7d1f0a57d0 100644 --- a/ApplicationLibCode/Application/Tools/Summary/RiaSummaryStringTools.cpp +++ b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryStringTools.cpp @@ -121,11 +121,12 @@ void RiaSummaryStringTools::splitUsingDataSourceNames( const QStringList& filter bool foundDataSource = false; - QRegExp searcher( pureDataSourceCandidate, Qt::CaseInsensitive, QRegExp::WildcardUnix ); + QString regexPattern = QRegularExpression::wildcardToRegularExpression( pureDataSourceCandidate ); + QRegularExpression searcher( regexPattern, QRegularExpression::CaseInsensitiveOption ); for ( const auto& ds : dataSourceNames ) { - if ( !foundDataSource && searcher.exactMatch( ds ) ) + if ( !foundDataSource && searcher.match( ds ).hasMatch() ) { dataSourceFilters.push_back( s ); foundDataSource = true; @@ -166,13 +167,14 @@ std::pair, std::vector> for ( const auto& dsFilter : dataSourceFilters ) { - QString searchString = dsFilter.left( dsFilter.indexOf( ':' ) ); - QRegExp searcher( searchString, Qt::CaseInsensitive, QRegExp::WildcardUnix ); + QString searchString = dsFilter.left( dsFilter.indexOf( ':' ) ); + QString regexPattern = QRegularExpression::wildcardToRegularExpression( searchString ); + QRegularExpression searcher( regexPattern, QRegularExpression::CaseInsensitiveOption ); for ( const auto& ensemble : allEnsembles ) { auto ensembleName = ensemble->name(); - if ( searcher.exactMatch( ensembleName ) ) + if ( searcher.match( ensembleName ).hasMatch() ) { if ( searchString == dsFilter ) { @@ -184,13 +186,14 @@ std::pair, std::vector> { // Match on subset of realisations in ensemble - QString realizationSearchString = dsFilter.right( dsFilter.size() - dsFilter.indexOf( ':' ) - 1 ); - QRegExp realizationSearcher( realizationSearchString, Qt::CaseInsensitive, QRegExp::WildcardUnix ); + QString realizationSearchString = dsFilter.right( dsFilter.size() - dsFilter.indexOf( ':' ) - 1 ); + QString regexPattern = QRegularExpression::wildcardToRegularExpression( realizationSearchString ); + QRegularExpression realizationSearcher( regexPattern, QRegularExpression::CaseInsensitiveOption ); for ( const auto& summaryCase : ensemble->allSummaryCases() ) { auto realizationName = summaryCase->displayCaseName(); - if ( realizationSearcher.exactMatch( realizationName ) ) + if ( realizationSearcher.match( realizationName ).hasMatch() ) { matchingSummaryCases.push_back( summaryCase ); } @@ -202,7 +205,7 @@ std::pair, std::vector> for ( const auto& summaryCase : allSummaryCases ) { auto summaryCaseName = summaryCase->displayCaseName(); - if ( searcher.exactMatch( summaryCaseName ) ) + if ( searcher.match( summaryCaseName ).hasMatch() ) { matchingSummaryCases.push_back( summaryCase ); } @@ -217,7 +220,7 @@ std::pair, std::vector> //-------------------------------------------------------------------------------------------------- QStringList RiaSummaryStringTools::splitIntoWords( const QString& text ) { - return RiaTextStringTools::splitSkipEmptyParts( text, QRegExp( "\\s+" ) ); + return RiaTextStringTools::splitSkipEmptyParts( text ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CMakeLists.txt b/ApplicationLibCode/CMakeLists.txt index bd2c1cdb61..e76de70324 100644 --- a/ApplicationLibCode/CMakeLists.txt +++ b/ApplicationLibCode/CMakeLists.txt @@ -36,7 +36,6 @@ find_package( PrintSupport Svg Sql - Core5Compat OPTIONAL_COMPONENTS Charts ) set(QT_LIBRARIES @@ -51,7 +50,6 @@ set(QT_LIBRARIES Qt6::PrintSupport Qt6::Svg Qt6::Sql - Qt6::Core5Compat Qt6::Charts ) qt_standard_project_setup() diff --git a/ApplicationLibCode/Commands/RicCalculatorWidgetCreator.cpp b/ApplicationLibCode/Commands/RicCalculatorWidgetCreator.cpp index 67436ada78..4b85800c38 100644 --- a/ApplicationLibCode/Commands/RicCalculatorWidgetCreator.cpp +++ b/ApplicationLibCode/Commands/RicCalculatorWidgetCreator.cpp @@ -152,8 +152,8 @@ QWidget* RicCalculatorWidgetCreator::createWidget( QWidget* parent ) rowSplitter->setContentsMargins( 0, 0, 0, 0 ); rowSplitter->setHandleWidth( 6 ); rowSplitter->setStyleSheet( "QSplitter::handle { image: url(:/SplitterV.png); }" ); - rowSplitter->insertWidget( 0, firstRowLeftFrame ); - rowSplitter->insertWidget( 1, firstRowRightFrame ); + rowSplitter->addWidget( firstRowLeftFrame ); + rowSplitter->addWidget( firstRowRightFrame ); rowSplitter->setSizes( QList() << 1 << 1 ); firstRowLayout->addWidget( rowSplitter ); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorWidgetCreator.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorWidgetCreator.cpp index fc46dd7cf4..09ef5657e4 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorWidgetCreator.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorWidgetCreator.cpp @@ -105,16 +105,16 @@ void RicSummaryPlotEditorWidgetCreator::recursivelyConfigureAndUpdateTopLevelUiO caf::PdmUiGroup* appearanceGroup = findGroupByKeyword( topLevelUiItems, RiuSummaryCurveDefinitionKeywords::appearance(), uiConfigName ); auto appearanceGroupBox = createGroupBoxWithContent( appearanceGroup, uiConfigName ); - m_lowerLeftLayout->insertWidget( 0, appearanceGroupBox ); + m_lowerLeftLayout->addWidget( appearanceGroupBox ); caf::PdmUiGroup* nameConfigGroup = findGroupByKeyword( topLevelUiItems, RiuSummaryCurveDefinitionKeywords::nameConfig(), uiConfigName ); auto nameConfigGroupBox = createGroupBoxWithContent( nameConfigGroup, uiConfigName ); - m_lowerLeftLayout->insertWidget( 1, nameConfigGroupBox ); + m_lowerLeftLayout->addWidget( nameConfigGroupBox ); QMinimizePanel* curveGroup = getOrCreateCurveTreeGroup(); - m_lowerLeftLayout->insertWidget( 2, curveGroup, 1 ); + m_lowerLeftLayout->addWidget( curveGroup, 1 ); m_lowerLeftLayout->addStretch( 0 ); - m_lowerRightLayout->insertWidget( 0, getOrCreatePlotWidget() ); + m_lowerRightLayout->addWidget( getOrCreatePlotWidget() ); // Fields at bottom of dialog configureAndUpdateFields( 1, m_bottomFieldLayout, topLevelUiItems, uiConfigName ); @@ -155,8 +155,8 @@ QWidget* RicSummaryPlotEditorWidgetCreator::createWidget( QWidget* parent ) m_firstColumnSplitter->setHandleWidth( 6 ); m_firstColumnSplitter->setStyleSheet( "QSplitter::handle { image: url(:/SplitterH.png); }" ); - m_firstColumnSplitter->insertWidget( 0, firstRowFrame ); - m_firstColumnSplitter->insertWidget( 1, secondRowFrame ); + m_firstColumnSplitter->addWidget( firstRowFrame ); + m_firstColumnSplitter->addWidget( secondRowFrame ); const int firstRowPixelHeight = 500; const int secondRowPixelHeight = 300; diff --git a/ApplicationLibCode/FileInterface/RifCaseRealizationParametersReader.cpp b/ApplicationLibCode/FileInterface/RifCaseRealizationParametersReader.cpp index ba945f1cd2..c5156b8fcd 100644 --- a/ApplicationLibCode/FileInterface/RifCaseRealizationParametersReader.cpp +++ b/ApplicationLibCode/FileInterface/RifCaseRealizationParametersReader.cpp @@ -121,7 +121,7 @@ void RifCaseRealizationParametersReader::parse() QString line = dataStream.readLine(); lineNo++; - QStringList cols = RifFileParseTools::splitLineAndTrim( line, QRegExp( "[ \t]" ), true ); + QStringList cols = RifFileParseTools::splitLineAndTrim( line, QRegularExpression( "[ \t]" ), true ); if ( cols.size() != 2 ) { @@ -287,22 +287,22 @@ int RifCaseRealizationParametersFileLocator::realizationNumber( const QString& m QDir dir( modelPath ); QString absolutePath = dir.absolutePath(); + return realizationNumberFromFullPath( absolutePath ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RifCaseRealizationParametersFileLocator::realizationNumberFromFullPath( const QString& path ) +{ int resultIndex = -1; - // Use parenthesis to indicate capture of sub string - QString pattern = "(realization-\\d+)"; + QRegularExpression pattern( "realization-(\\d+)", QRegularExpression::CaseInsensitiveOption ); + QRegularExpressionMatch match = pattern.match( path ); - QRegExp regexp( pattern, Qt::CaseInsensitive ); - if ( regexp.indexIn( absolutePath ) ) + if ( match.hasMatch() ) { - QString tempText = regexp.cap( 1 ); - - QRegExp rx( "(\\d+)" ); // Find number - int digitPos = rx.indexIn( tempText ); - if ( digitPos > -1 ) - { - resultIndex = rx.cap( 0 ).toInt(); - } + resultIndex = match.captured( 1 ).toInt(); } return resultIndex; diff --git a/ApplicationLibCode/FileInterface/RifCaseRealizationParametersReader.h b/ApplicationLibCode/FileInterface/RifCaseRealizationParametersReader.h index 231a3fa6f1..8dc6302d6c 100644 --- a/ApplicationLibCode/FileInterface/RifCaseRealizationParametersReader.h +++ b/ApplicationLibCode/FileInterface/RifCaseRealizationParametersReader.h @@ -94,4 +94,5 @@ class RifCaseRealizationParametersFileLocator public: static QString locate( const QString& modelPath ); static int realizationNumber( const QString& modelPath ); + static int realizationNumberFromFullPath( const QString& path ); }; diff --git a/ApplicationLibCode/FileInterface/RifColorLegendData.cpp b/ApplicationLibCode/FileInterface/RifColorLegendData.cpp index 4713c43bd8..e6957f3fb2 100644 --- a/ApplicationLibCode/FileInterface/RifColorLegendData.cpp +++ b/ApplicationLibCode/FileInterface/RifColorLegendData.cpp @@ -91,7 +91,7 @@ cvf::ref RifColorLegendData::readLyrFormationNameFile( const if ( QColor::isValidColorName( colorWord ) ) numberString.remove( colorWord ); // remove color if present as last word on line // extract words containing formation number(s) - QStringList numberWords = RiaTextStringTools::splitSkipEmptyParts( numberString, QRegExp( "-" ) ); + QStringList numberWords = RiaTextStringTools::splitSkipEmptyParts( numberString, QRegularExpression( "-" ) ); if ( numberWords.size() == 2 ) // formation range with or without color at end of line { diff --git a/ApplicationLibCode/FileInterface/RifCsvUserDataParser.cpp b/ApplicationLibCode/FileInterface/RifCsvUserDataParser.cpp index 048ae252ad..8f2250ffd3 100644 --- a/ApplicationLibCode/FileInterface/RifCsvUserDataParser.cpp +++ b/ApplicationLibCode/FileInterface/RifCsvUserDataParser.cpp @@ -392,11 +392,12 @@ bool RifCsvUserDataParser::parseColumnInfo( QTextStream* // "VECTOR_NAME [unit]" { // "VECTORNAME (unit)" ==> "(unit)" - QRegExp exp( "[[]([^]]+)[]]" ); - if ( exp.indexIn( colName ) >= 0 ) + QRegularExpression exp( R"(\[([^\]]+)\])" ); + QRegularExpressionMatch match = exp.match( colName ); + if ( match.hasMatch() ) { - QString fullCapture = exp.cap( 0 ); - QString unitCapture = exp.cap( 1 ); + QString fullCapture = match.captured( 0 ); + QString unitCapture = match.captured( 1 ); unit = unitCapture; colName = RiaTextStringTools::trimAndRemoveDoubleSpaces( colName.remove( fullCapture ) ); @@ -405,11 +406,12 @@ bool RifCsvUserDataParser::parseColumnInfo( QTextStream* { // "VECTOR_NAME [unit]" ==> "[unit]" - QRegExp exp( "[(]([^)]+)[)]" ); - if ( exp.indexIn( colName ) >= 0 ) + QRegularExpression exp( R"(\(([^)]+)\))" ); + QRegularExpressionMatch match = exp.match( colName ); + if ( match.hasMatch() ) { - QString fullCapture = exp.cap( 0 ); - QString unitCapture = exp.cap( 1 ); + QString fullCapture = match.captured( 0 ); + QString unitCapture = match.captured( 1 ); unit = unitCapture; colName = RiaTextStringTools::trimAndRemoveDoubleSpaces( colName.remove( fullCapture ) ); diff --git a/ApplicationLibCode/FileInterface/RifEclipseInputFileTools.cpp b/ApplicationLibCode/FileInterface/RifEclipseInputFileTools.cpp index c13e4e6060..13d151f24d 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseInputFileTools.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseInputFileTools.cpp @@ -1419,31 +1419,31 @@ void RifEclipseInputFileTools::readKeywordDataContent( QFile& data, qint64 fileP QString line = data.readLine(); line = line.trimmed(); - if ( line.startsWith( "--", Qt::CaseInsensitive ) ) - { - // Skip comment lines - continue; - } - else if ( line.startsWith( "/", Qt::CaseInsensitive ) ) - { - // Detected end of keyword data section - return; - } - else if ( line.startsWith( editKeyword, Qt::CaseInsensitive ) ) - { - // End parsing when edit keyword is detected - isStopParsingKeywordDetected = true; - - return; - } - else if ( line[0].isLetter() ) - { - // If a letter is starting the line, this is a new keyword - return; - } - if ( !line.isEmpty() ) { + if ( line.startsWith( "--", Qt::CaseInsensitive ) ) + { + // Skip comment lines + continue; + } + else if ( line.startsWith( "/", Qt::CaseInsensitive ) ) + { + // Detected end of keyword data section + return; + } + else if ( line.startsWith( editKeyword, Qt::CaseInsensitive ) ) + { + // End parsing when edit keyword is detected + isStopParsingKeywordDetected = true; + + return; + } + else if ( line[0].isLetter() ) + { + // If a letter is starting the line, this is a new keyword + return; + } + textContent.push_back( line ); } diff --git a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp index 224620949e..bdb0131efd 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp @@ -24,7 +24,6 @@ #include "RifEclEclipseSummary.h" #include "RiuSummaryQuantityNameInfoProvider.h" -#include #include #include @@ -190,8 +189,7 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromEclipseTextAddressParseEr if ( tokens.size() > 1 ) { - auto firstToken = RiaStdStringTools::trimString( tokens[0] ); - firstToken = RiaStdStringTools::toUpper( firstToken ); + auto firstToken = RiaStdStringTools::toUpper( RiaStdStringTools::trimString( tokens[0] ) ); if ( ( firstToken == "ER" ) || ( firstToken == "ERR" ) || ( firstToken == "ERROR" ) ) { @@ -783,9 +781,10 @@ bool RifEclipseSummaryAddress::isUiTextMatchingFilterText( const QString& filter if ( filterString.isEmpty() ) return true; if ( filterString.trimmed() == "*" ) return !value.empty(); - QRegExp searcher( filterString, Qt::CaseInsensitive, QRegExp::WildcardUnix ); - QString qstrValue = QString::fromStdString( value ); - return searcher.exactMatch( qstrValue ); + QString pattern = QRegularExpression::wildcardToRegularExpression( filterString ); + QRegularExpression searcher( pattern, QRegularExpression::CaseInsensitiveOption ); + QString qstrValue = QString::fromStdString( value ); + return searcher.match( qstrValue ).hasMatch(); } //-------------------------------------------------------------------------------------------------- @@ -1226,7 +1225,7 @@ std::string RifEclipseSummaryAddress::blockAsString() const //-------------------------------------------------------------------------------------------------- std::tuple RifEclipseSummaryAddress::ijkTupleFromUiText( const std::string& s ) { - auto ijk = RiaTextStringTools::splitSkipEmptyParts( QString::fromStdString( s ).trimmed(), QRegExp( "[,]" ) ); + auto ijk = RiaTextStringTools::splitSkipEmptyParts( QString::fromStdString( s ).trimmed(), QRegularExpression( "[,]" ) ); if ( ijk.size() != 3 ) return std::make_tuple( -1, -1, -1 ); @@ -1248,7 +1247,7 @@ std::string RifEclipseSummaryAddress::formatUiTextRegionToRegion() const //-------------------------------------------------------------------------------------------------- std::pair RifEclipseSummaryAddress::regionToRegionPairFromUiText( const std::string& s ) { - auto r2r = RiaTextStringTools::splitSkipEmptyParts( QString::fromStdString( s ).trimmed(), QRegExp( "[-]" ) ); + auto r2r = RiaTextStringTools::splitSkipEmptyParts( QString::fromStdString( s ).trimmed(), QRegularExpression( "[-]" ) ); if ( r2r.size() != 2 ) return std::make_pair( -1, -1 ); diff --git a/ApplicationLibCode/FileInterface/RifFileParseTools.cpp b/ApplicationLibCode/FileInterface/RifFileParseTools.cpp index 963e45b2dc..64dbdc702f 100644 --- a/ApplicationLibCode/FileInterface/RifFileParseTools.cpp +++ b/ApplicationLibCode/FileInterface/RifFileParseTools.cpp @@ -19,14 +19,6 @@ #include "RifFileParseTools.h" #include "RiaTextStringTools.h" -// Disable deprecation warning for QString::SkipEmptyParts -#ifdef _MSC_VER -#pragma warning( disable : 4996 ) -#endif -#ifdef __GNUC__ -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -43,7 +35,7 @@ QStringList RifFileParseTools::splitLineAndTrim( const QString& line, const QStr //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QStringList RifFileParseTools::splitLineAndTrim( const QString& line, const QRegExp& regexp, bool skipEmptyParts ) +QStringList RifFileParseTools::splitLineAndTrim( const QString& line, const QRegularExpression& regexp, bool skipEmptyParts ) { auto cols = RiaTextStringTools::splitString( line.trimmed(), regexp, skipEmptyParts ); for ( QString& col : cols ) diff --git a/ApplicationLibCode/FileInterface/RifFileParseTools.h b/ApplicationLibCode/FileInterface/RifFileParseTools.h index 378d005b74..3008497398 100644 --- a/ApplicationLibCode/FileInterface/RifFileParseTools.h +++ b/ApplicationLibCode/FileInterface/RifFileParseTools.h @@ -18,7 +18,7 @@ #pragma once -#include +#include #include #include @@ -29,7 +29,7 @@ class RifFileParseTools { public: static QStringList splitLineAndTrim( const QString& line, const QString& separator, bool skipEmptyParts = false ); - static QStringList splitLineAndTrim( const QString& line, const QRegExp& regexp, bool skipEmptyParts = false ); + static QStringList splitLineAndTrim( const QString& line, const QRegularExpression& regexp, bool skipEmptyParts = false ); }; //================================================================================================== diff --git a/ApplicationLibCode/FileInterface/RifPerforationIntervalReader.cpp b/ApplicationLibCode/FileInterface/RifPerforationIntervalReader.cpp index ef8d568474..0b40a14dd3 100644 --- a/ApplicationLibCode/FileInterface/RifPerforationIntervalReader.cpp +++ b/ApplicationLibCode/FileInterface/RifPerforationIntervalReader.cpp @@ -32,7 +32,7 @@ std::map> RifPerforationIntervalRea { std::map> perforationIntervals; - foreach ( QString filePath, filePaths ) + for ( const QString& filePath : filePaths ) { readFileIntoMap( filePath, &perforationIntervals ); } diff --git a/ApplicationLibCode/FileInterface/RifPolygonReader.cpp b/ApplicationLibCode/FileInterface/RifPolygonReader.cpp index 5b1a652e5d..a5ed3905c7 100644 --- a/ApplicationLibCode/FileInterface/RifPolygonReader.cpp +++ b/ApplicationLibCode/FileInterface/RifPolygonReader.cpp @@ -79,7 +79,7 @@ std::vector> RifPolygonReader::parseText( const QString& QStringList commentLineSegs = line.split( "#" ); if ( commentLineSegs.empty() ) continue; // Empty line - QStringList lineSegs = RiaTextStringTools::splitSkipEmptyParts( commentLineSegs[0], QRegExp( "\\s+" ) ); + QStringList lineSegs = RiaTextStringTools::splitSkipEmptyParts( commentLineSegs[0], QRegularExpression( "\\s+" ) ); if ( lineSegs.empty() ) continue; // No data diff --git a/ApplicationLibCode/FileInterface/RifWellPathImporter.cpp b/ApplicationLibCode/FileInterface/RifWellPathImporter.cpp index 80d6c595ac..c18ccf9fef 100644 --- a/ApplicationLibCode/FileInterface/RifWellPathImporter.cpp +++ b/ApplicationLibCode/FileInterface/RifWellPathImporter.cpp @@ -161,7 +161,7 @@ RifWellPathImporter::WellData RifWellPathImporter::readJsonWellData( const QStri wellData.m_wellPathGeometry->setDatumElevation( datumElevation ); wellData.m_name = jsonMap["name"].toString(); - foreach ( QVariant point, pathList ) + for ( const QVariant& point : pathList ) { QMap coordinateMap = point.toMap(); cvf::Vec3d vec3d( coordinateMap["east"].toDouble(), diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesFromFileAnnotation.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesFromFileAnnotation.cpp index ca7a0c6efc..56f18ea3b4 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesFromFileAnnotation.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesFromFileAnnotation.cpp @@ -91,7 +91,7 @@ void RimPolylinesFromFileAnnotation::readPolyLinesFile( QString* errorMessage ) QStringList commentLineSegs = line.split( "#" ); if ( commentLineSegs.empty() ) continue; // Empty line - QStringList lineSegs = RiaTextStringTools::splitSkipEmptyParts( commentLineSegs[0], QRegExp( "\\s+" ) ); + QStringList lineSegs = RiaTextStringTools::splitSkipEmptyParts( commentLineSegs[0], QRegularExpression( "\\s+" ) ); if ( lineSegs.empty() ) continue; // No data diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.cpp index 38e292d358..332c42ce57 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.cpp @@ -264,10 +264,9 @@ QString RimWellPathCompletionSettings::fluidInPlaceRegionForExport() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QRegExp RimWellPathCompletionSettings::wellNameForExportRegExp() +QRegularExpression RimWellPathCompletionSettings::wellNameForExportRegExp() { - QRegExp rx( "[\\w\\-\\_]{1,8}" ); - return rx; + return QRegularExpression( "[\\w\\-\\_]{1,8}" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.h b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.h index b5866fe875..876492a576 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.h @@ -22,7 +22,7 @@ #include "cafPdmObject.h" #include "cafPdmProxyValueField.h" -#include +#include class RimMswCompletionParameters; class RimWellPathCompletionsLegacy; @@ -84,7 +84,7 @@ public: QString hydrostaticDensityForExport() const; QString fluidInPlaceRegionForExport() const; - static QRegExp wellNameForExportRegExp(); + static QRegularExpression wellNameForExportRegExp(); RimMswCompletionParameters* mswCompletionParameters() const; diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp index 9aa90a641f..00d27d02ab 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp @@ -21,20 +21,16 @@ #include "RiaApplication.h" #include "RiaFieldHandleTools.h" -#include "RiaGuiApplication.h" #include "RiaOptionItemFactory.h" #include "RiaPreferences.h" #include "RiaPreferencesSystem.h" #include "RiaViewRedrawScheduler.h" -#include "RicfCommandObject.h" - #include "Rim2dIntersectionView.h" #include "Rim3dWellLogCurve.h" #include "RimAnnotationCollection.h" #include "RimAnnotationInViewCollection.h" #include "RimCase.h" -#include "RimCellFilterCollection.h" #include "RimGridView.h" #include "RimLegendConfig.h" #include "RimMainPlotCollection.h" @@ -45,7 +41,6 @@ #include "RimTools.h" #include "RimViewController.h" #include "RimViewLinker.h" -#include "RimViewLinkerCollection.h" #include "RimViewManipulator.h" #include "RimViewNameConfig.h" #include "RimWellPathCollection.h" @@ -63,7 +58,6 @@ #include "cafPdmFieldScriptingCapability.h" #include "cafPdmFieldScriptingCapabilityCvfColor3.h" #include "cafPdmUiComboBoxEditor.h" - #include "cvfCamera.h" #include "cvfModelBasicList.h" #include "cvfPart.h" @@ -190,44 +184,6 @@ Rim3dView::Rim3dView() //-------------------------------------------------------------------------------------------------- Rim3dView::~Rim3dView() { - // When a 3d view is destructed, make sure that all other views using this as a comparison view is reset and - // redrawn. A crash was seen for test case - // "\ResInsight-regression-test\ProjectFiles\ProjectFilesSmallTests\TestCase_CoViz-Simple" when a view used as - // comparison view was deleted. - - if ( auto proj = RimProject::current() ) - { - for ( auto v : proj->allViews() ) - { - if ( v->activeComparisonView() == this ) - { - v->setComparisonView( nullptr ); - v->scheduleCreateDisplayModelAndRedraw(); - } - } - - if ( this->isMasterView() ) - { - RimViewLinker* viewLinker = this->assosiatedViewLinker(); - viewLinker->setMasterView( nullptr ); - - delete proj->viewLinkerCollection->viewLinker(); - proj->viewLinkerCollection->viewLinker = nullptr; - - proj->uiCapability()->updateConnectedEditors(); - } - - RimViewController* vController = this->viewController(); - if ( vController ) - { - vController->setManagedView( nullptr ); - vController->ownerViewLinker()->removeViewController( vController ); - delete vController; - - proj->uiCapability()->updateConnectedEditors(); - } - } - if ( RiaApplication::instance()->activeReservoirView() == this ) { RiaApplication::instance()->setActiveReservoirView( nullptr ); diff --git a/ApplicationLibCode/ProjectDataModel/RimViewLinker.cpp b/ApplicationLibCode/ProjectDataModel/RimViewLinker.cpp index a9e45617b6..f5c806a41f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewLinker.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewLinker.cpp @@ -518,6 +518,8 @@ void RimViewLinker::updateCursorPosition( const Rim3dView* sourceView, const cvf for ( Rim3dView* destinationView : viewsToUpdate ) { + if ( !destinationView ) continue; + if ( destinationView == sourceView ) continue; if ( destinationView != m_masterView ) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp index 8572c593ca..a13716691f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp @@ -500,7 +500,7 @@ std::set RimSummaryPlotManager::filteredAddresses() if ( nativeAddresses.empty() ) return {}; - QStringList allCurveAddressFilters = RiaTextStringTools::splitSkipEmptyParts( m_filterText(), QRegExp( "\\s+" ) ); + QStringList allCurveAddressFilters = RiaTextStringTools::splitSkipEmptyParts( m_filterText(), QRegularExpression( "\\s+" ) ); return RiaSummaryStringTools::computeFilteredAddresses( allCurveAddressFilters, nativeAddresses, m_includeDiffCurves ); } diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp index c6c69e8db8..09bd3f4ef9 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp @@ -397,7 +397,7 @@ std::vector RimWellPathCollection::addWellLogs( const QStrin std::vector logFileInfos; - foreach ( QString filePath, filePaths ) + for ( const QString& filePath : filePaths ) { QString errorMessage; RimWellLogLasFile* logFileInfo = RimWellLogLasFile::readWellLogFile( filePath, &errorMessage ); @@ -943,13 +943,14 @@ std::map> { std::map> rootWells; - QString multiLateralWellPathPattern = RiaPreferences::current()->multiLateralWellNamePattern(); - QRegExp re( multiLateralWellPathPattern, Qt::CaseInsensitive, QRegExp::Wildcard ); + QString multiLateralWellPathPattern = RiaPreferences::current()->multiLateralWellNamePattern(); + QString regexPattern = QRegularExpression::wildcardToRegularExpression( multiLateralWellPathPattern ); + QRegularExpression re( regexPattern, QRegularExpression::CaseInsensitiveOption ); for ( auto wellPath : sourceWellPaths ) { QString name = wellPath->name(); - if ( re.exactMatch( name ) ) + if ( re.match( name ).hasMatch() ) { int indexOfLateralStart = name.indexOf( 'Y' ); if ( indexOfLateralStart > 0 ) diff --git a/ApplicationLibCode/ReservoirDataModel/RigReservoirBuilderMock.cpp b/ApplicationLibCode/ReservoirDataModel/RigReservoirBuilderMock.cpp index 6897c90bf8..222a9ddd03 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigReservoirBuilderMock.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigReservoirBuilderMock.cpp @@ -29,7 +29,7 @@ #include "RigWellResultFrame.h" #include "RigWellResultPoint.h" -#include +#include /* rand example: guess the number */ #include @@ -147,11 +147,11 @@ bool RigReservoirBuilderMock::dynamicResult( RigEclipseCaseData* eclipseCase, co { int resultIndex = 1; - QRegExp rx( "[0-9]{1,2}" ); // Find number 0-99 - int digitPos = rx.indexIn( result ); - if ( digitPos > -1 ) + QRegularExpression rx( "[0-9]{1,2}" ); // Find number 0-99 + QRegularExpressionMatch match = rx.match( result ); + if ( match.hasMatch() ) { - resultIndex = rx.cap( 0 ).toInt() + 1; + resultIndex = match.captured( 0 ).toInt() + 1; } double scaleValue = 1.0 + resultIndex * 0.1; diff --git a/ApplicationLibCode/UnitTests/RiaMedianCalculator-Test.h b/ApplicationLibCode/UnitTests/RiaMedianCalculator-Test.h deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ApplicationLibCode/UnitTests/RifCaseRealizationParametersReader-Test.cpp b/ApplicationLibCode/UnitTests/RifCaseRealizationParametersReader-Test.cpp index 660544b3d2..d6b212aa86 100644 --- a/ApplicationLibCode/UnitTests/RifCaseRealizationParametersReader-Test.cpp +++ b/ApplicationLibCode/UnitTests/RifCaseRealizationParametersReader-Test.cpp @@ -70,7 +70,7 @@ TEST( RifCaseRealizationParametersReaderTest, FindRealizationNumber ) QString filePath = "d:/gitroot-ceesol/ResInsight-regression-test/ModelData/ensemble_reek_with_params/realization-" "7/iter-0/eclipse/model/3_R001_REEK-7.SMSPEC"; - int realisationNumber = RifCaseRealizationParametersFileLocator::realizationNumber( filePath ); + int realisationNumber = RifCaseRealizationParametersFileLocator::realizationNumberFromFullPath( filePath ); EXPECT_EQ( 7, realisationNumber ); } diff --git a/ApplicationLibCode/UnitTests/RifEclipseInputFileTools-Test.cpp b/ApplicationLibCode/UnitTests/RifEclipseInputFileTools-Test.cpp index 4fc7da0395..60f16ea6c2 100644 --- a/ApplicationLibCode/UnitTests/RifEclipseInputFileTools-Test.cpp +++ b/ApplicationLibCode/UnitTests/RifEclipseInputFileTools-Test.cpp @@ -25,7 +25,7 @@ TEST( RifEclipseInputFileToolsTest, FaultFaces ) << "i+"; cvf::StructGridInterface::FaceEnum faceType; - foreach ( QString text, faceTexts ) + for ( const QString& text : faceTexts ) { faceType = RifEclipseInputFileTools::faceEnumFromText( text ); EXPECT_EQ( cvf::StructGridInterface::POS_I, faceType ); @@ -40,7 +40,7 @@ TEST( RifEclipseInputFileToolsTest, FaultFaces ) << "i-"; cvf::StructGridInterface::FaceEnum faceType; - foreach ( QString text, faceTexts ) + for ( const QString& text : faceTexts ) { faceType = RifEclipseInputFileTools::faceEnumFromText( text ); EXPECT_EQ( cvf::StructGridInterface::NEG_I, faceType ); @@ -59,7 +59,7 @@ TEST( RifEclipseInputFileToolsTest, FaultFaces ) << "j+"; cvf::StructGridInterface::FaceEnum faceType; - foreach ( QString text, faceTexts ) + for ( const QString& text : faceTexts ) { faceType = RifEclipseInputFileTools::faceEnumFromText( text ); EXPECT_EQ( cvf::StructGridInterface::POS_J, faceType ); @@ -74,7 +74,7 @@ TEST( RifEclipseInputFileToolsTest, FaultFaces ) << "j-"; cvf::StructGridInterface::FaceEnum faceType; - foreach ( QString text, faceTexts ) + for ( const QString& text : faceTexts ) { faceType = RifEclipseInputFileTools::faceEnumFromText( text ); EXPECT_EQ( cvf::StructGridInterface::NEG_J, faceType ); @@ -93,7 +93,7 @@ TEST( RifEclipseInputFileToolsTest, FaultFaces ) << "k+"; cvf::StructGridInterface::FaceEnum faceType; - foreach ( QString text, faceTexts ) + for ( const QString& text : faceTexts ) { faceType = RifEclipseInputFileTools::faceEnumFromText( text ); EXPECT_EQ( cvf::StructGridInterface::POS_K, faceType ); @@ -108,7 +108,7 @@ TEST( RifEclipseInputFileToolsTest, FaultFaces ) << "k-"; cvf::StructGridInterface::FaceEnum faceType; - foreach ( QString text, faceTexts ) + for ( const QString& text : faceTexts ) { faceType = RifEclipseInputFileTools::faceEnumFromText( text ); EXPECT_EQ( cvf::StructGridInterface::NEG_K, faceType ); @@ -124,7 +124,7 @@ TEST( RifEclipseInputFileToolsTest, FaultFaces ) << " y /"; cvf::StructGridInterface::FaceEnum faceType; - foreach ( QString text, faceTexts ) + for ( const QString& text : faceTexts ) { faceType = RifEclipseInputFileTools::faceEnumFromText( text ); EXPECT_NE( cvf::StructGridInterface::NO_FACE, faceType ); @@ -139,7 +139,7 @@ TEST( RifEclipseInputFileToolsTest, FaultFaces ) << " +k- "; cvf::StructGridInterface::FaceEnum faceType; - foreach ( QString text, faceTexts ) + for ( const QString& text : faceTexts ) { faceType = RifEclipseInputFileTools::faceEnumFromText( text ); EXPECT_EQ( cvf::StructGridInterface::NO_FACE, faceType ); @@ -155,7 +155,7 @@ TEST( RifEclipseInputFileToolsTest, FaultFaces ) << " i+ "; cvf::StructGridInterface::FaceEnum faceType; - foreach ( QString text, faceTexts ) + for ( const QString& text : faceTexts ) { faceType = RifEclipseInputFileTools::faceEnumFromText( text ); EXPECT_EQ( cvf::StructGridInterface::POS_I, faceType ); diff --git a/ApplicationLibCode/UnitTests/RifTextDataTableFormatter-Test.cpp b/ApplicationLibCode/UnitTests/RifTextDataTableFormatter-Test.cpp index 5eadf20be0..dcc55d286a 100644 --- a/ApplicationLibCode/UnitTests/RifTextDataTableFormatter-Test.cpp +++ b/ApplicationLibCode/UnitTests/RifTextDataTableFormatter-Test.cpp @@ -108,7 +108,7 @@ TEST( RifTextDataTableFormatter, LongLine ) formatter.rowCompleted(); formatter.tableCompleted(); - QStringList tableLines = RiaTextStringTools::splitSkipEmptyParts( tableText, QRegExp( "[\r\n]" ) ); + QStringList tableLines = RiaTextStringTools::splitSkipEmptyParts( tableText, QRegularExpression( "[\r\n]" ) ); for ( QString line : tableLines ) { std::cout << QString( "Line: \"%1\"" ).arg( line ).toStdString() << std::endl; @@ -155,7 +155,7 @@ TEST( RifTextDataTableFormatter, LongLine132 ) formatter.rowCompleted(); formatter.tableCompleted(); - QStringList tableLines = RiaTextStringTools::splitSkipEmptyParts( tableText, QRegExp( "[\r\n]" ) ); + QStringList tableLines = RiaTextStringTools::splitSkipEmptyParts( tableText, QRegularExpression( "[\r\n]" ) ); for ( QString line : tableLines ) { std::cout << QString( "Line: \"%1\"" ).arg( line ).toStdString() << std::endl; @@ -202,7 +202,7 @@ TEST( RifTextDataTableFormatter, LongLine133 ) formatter.rowCompleted(); formatter.tableCompleted(); - QStringList tableLines = RiaTextStringTools::splitSkipEmptyParts( tableText, QRegExp( "[\r\n]" ) ); + QStringList tableLines = RiaTextStringTools::splitSkipEmptyParts( tableText, QRegularExpression( "[\r\n]" ) ); for ( QString line : tableLines ) { std::cout << QString( "Line: \"%1\"" ).arg( line ).toStdString() << std::endl; diff --git a/ApplicationLibCode/UserInterface/RiuGuiTheme.cpp b/ApplicationLibCode/UserInterface/RiuGuiTheme.cpp index 4f7fb46b2c..76bc1087a8 100644 --- a/ApplicationLibCode/UserInterface/RiuGuiTheme.cpp +++ b/ApplicationLibCode/UserInterface/RiuGuiTheme.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -57,8 +56,8 @@ QMap RiuGuiTheme: "\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ), []( QRegularExpressionMatch& match ) { - QRegExp plotNameRegExp( match.captured( "plotName" ) ); - QRegExp itemNameRegExp( match.captured( "itemName" ) ); + QRegularExpression plotNameRegExp = QRegularExpression::fromWildcard( match.captured( "plotName" ) ); + QRegularExpression itemNameRegExp = QRegularExpression::fromWildcard( match.captured( "itemName" ) ); QRegularExpression lineColorRegExp( "line-color:\\s*([#0-9a-zA-Z]+)" ); QString lineColor = lineColorRegExp.match( match.captured( "properties" ) ).captured( 1 ); @@ -84,13 +83,13 @@ QMap RiuGuiTheme: { for ( QwtPlot* plotWidget : widget->findChildren() ) { - if ( plotNameRegExp.exactMatch( plotWidget->property( "qss-class" ).toString() ) ) + if ( plotNameRegExp.match( plotWidget->property( "qss-class" ).toString() ).hasMatch() ) { for ( QwtPlotItem* item : plotWidget->itemList() ) { if ( QwtPlotCurve* curve = dynamic_cast( item ) ) { - if ( itemNameRegExp.exactMatch( item->title().text() ) || match.captured( "itemName" ) == "*" ) + if ( itemNameRegExp.match( item->title().text() ).hasMatch() || match.captured( "itemName" ) == "*" ) { QPen pen = curve->pen(); pen.setColor( QColor( lineColor ) ); @@ -117,8 +116,8 @@ QMap RiuGuiTheme: "\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ), []( QRegularExpressionMatch& match ) { - QRegExp plotNameRegExp( match.captured( "plotName" ) ); - QRegExp itemNameRegExp( match.captured( "itemName" ) ); + QRegularExpression plotNameRegExp = QRegularExpression::fromWildcard( match.captured( "plotName" ) ); + QRegularExpression itemNameRegExp = QRegularExpression::fromWildcard( match.captured( "itemName" ) ); QRegularExpression colorRegExp( "color:\\s*([#0-9a-zA-Z]+)" ); QString color = colorRegExp.match( match.captured( "properties" ) ).captured( 1 ); const QWidgetList topLevelWidgets = QApplication::topLevelWidgets(); @@ -131,13 +130,14 @@ QMap RiuGuiTheme: { for ( QwtPlot* plotWidget : widget->findChildren() ) { - if ( plotNameRegExp.exactMatch( plotWidget->property( "qss-class" ).toString() ) || match.captured( "plotName" ) == "*" ) + if ( plotNameRegExp.match( plotWidget->property( "qss-class" ).toString() ).hasMatch() || + match.captured( "plotName" ) == "*" ) { for ( QwtPlotItem* item : plotWidget->itemList() ) { if ( QwtPlotGrid* grid = dynamic_cast( item ) ) { - if ( itemNameRegExp.exactMatch( item->title().text() ) || match.captured( "itemName" ) == "*" ) + if ( itemNameRegExp.match( item->title().text() ).hasMatch() || match.captured( "itemName" ) == "*" ) { QPen pen = grid->majorPen(); pen.setColor( QColor( color ) ); @@ -155,8 +155,8 @@ QMap RiuGuiTheme: "\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ), []( QRegularExpressionMatch& match ) { - QRegExp plotNameRegExp( match.captured( "plotName" ) ); - QRegExp itemNameRegExp( match.captured( "itemName" ) ); + QRegularExpression plotNameRegExp = QRegularExpression::fromWildcard( match.captured( "plotName" ) ); + QRegularExpression itemNameRegExp = QRegularExpression::fromWildcard( match.captured( "itemName" ) ); QRegularExpression colorRegExp( "text-color:\\s*([#0-9a-zA-Z]+)" ); QString color = colorRegExp.match( match.captured( "properties" ) ).captured( 1 ); const QWidgetList topLevelWidgets = QApplication::topLevelWidgets(); @@ -169,7 +169,8 @@ QMap RiuGuiTheme: { for ( QwtPlot* plotWidget : widget->findChildren() ) { - if ( plotNameRegExp.exactMatch( plotWidget->property( "qss-class" ).toString() ) || match.captured( "plotName" ) == "*" ) + if ( plotNameRegExp.match( plotWidget->property( "qss-class" ).toString() ).hasMatch() || + match.captured( "plotName" ) == "*" ) { for ( QwtLegendLabel* label : plotWidget->findChildren() ) { @@ -189,8 +190,8 @@ QMap RiuGuiTheme: "\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ), []( QRegularExpressionMatch& match ) { - QRegExp plotNameRegExp( match.captured( "plotName" ) ); - QRegExp itemNameRegExp( match.captured( "itemName" ) ); + QRegularExpression plotNameRegExp = QRegularExpression::fromWildcard( match.captured( "plotName" ) ); + QRegularExpression itemNameRegExp = QRegularExpression::fromWildcard( match.captured( "itemName" ) ); QRegularExpression colorRegExp( "color:\\s*([#0-9a-zA-Z]+)" ); QString color = colorRegExp.match( match.captured( "properties" ) ).captured( 1 ); QRegularExpression textColorRegExp( "text-color:\\s*([#0-9a-zA-Z]+)" ); @@ -214,7 +215,8 @@ QMap RiuGuiTheme: { for ( QwtPlot* plotWidget : widget->findChildren() ) { - if ( plotNameRegExp.exactMatch( plotWidget->property( "qss-class" ).toString() ) || match.captured( "plotName" ) == "*" ) + if ( plotNameRegExp.match( plotWidget->property( "qss-class" ).toString() ).hasMatch() || + match.captured( "plotName" ) == "*" ) { for ( QwtPlotItem* item : plotWidget->itemList() ) { @@ -222,7 +224,7 @@ QMap RiuGuiTheme: { if ( marker->symbol() == nullptr || marker->symbol()->style() == QwtSymbol::NoSymbol ) { - if ( itemNameRegExp.exactMatch( item->title().text() ) || match.captured( "itemName" ) == "*" ) + if ( itemNameRegExp.match( item->title().text() ).hasMatch() || match.captured( "itemName" ) == "*" ) { QPen pen = marker->linePen(); pen.setColor( QColor( color ) ); @@ -243,8 +245,8 @@ QMap RiuGuiTheme: "\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ), []( QRegularExpressionMatch& match ) { - QRegExp plotNameRegExp( match.captured( "plotName" ) ); - QRegExp itemNameRegExp( match.captured( "itemName" ) ); + QRegularExpression plotNameRegExp = QRegularExpression::fromWildcard( match.captured( "plotName" ) ); + QRegularExpression itemNameRegExp = QRegularExpression::fromWildcard( match.captured( "itemName" ) ); QRegularExpression colorRegExp( "color:\\s*([#0-9a-zA-Z]+)" ); QString color = colorRegExp.match( match.captured( "properties" ) ).captured( 1 ); QRegularExpression textColorRegExp( "text-color:\\s*([#0-9a-zA-Z]+)" ); @@ -268,7 +270,8 @@ QMap RiuGuiTheme: { for ( QwtPlot* plotWidget : widget->findChildren() ) { - if ( plotNameRegExp.exactMatch( plotWidget->property( "qss-class" ).toString() ) || match.captured( "plotName" ) == "*" ) + if ( plotNameRegExp.match( plotWidget->property( "qss-class" ).toString() ).hasMatch() || + match.captured( "plotName" ) == "*" ) { for ( QwtPlotItem* item : plotWidget->itemList() ) { @@ -276,7 +279,7 @@ QMap RiuGuiTheme: { if ( marker->symbol() && marker->symbol()->style() != QwtSymbol::NoSymbol ) { - if ( itemNameRegExp.exactMatch( item->title().text() ) || match.captured( "itemName" ) == "*" ) + if ( itemNameRegExp.match( item->title().text() ).hasMatch() || match.captured( "itemName" ) == "*" ) { QPen pen = marker->symbol()->pen(); pen.setColor( QColor( color ) ); @@ -299,8 +302,8 @@ QMap RiuGuiTheme: "\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ), []( QRegularExpressionMatch& match ) { - QRegExp plotNameRegExp( match.captured( "plotName" ) ); - QRegExp itemNameRegExp( match.captured( "itemName" ) ); + QRegularExpression plotNameRegExp = QRegularExpression::fromWildcard( match.captured( "plotName" ) ); + QRegularExpression itemNameRegExp = QRegularExpression::fromWildcard( match.captured( "itemName" ) ); QRegularExpression textColorRegExp( "text-color:\\s*([#a-zA-Z0-9]+)" ); QString textColor = textColorRegExp.match( match.captured( "properties" ) ).captured( 1 ); @@ -314,7 +317,8 @@ QMap RiuGuiTheme: { for ( QwtPlot* plotWidget : widget->findChildren() ) { - if ( plotNameRegExp.exactMatch( plotWidget->property( "qss-class" ).toString() ) || match.captured( "plotName" ) == "*" ) + if ( plotNameRegExp.match( plotWidget->property( "qss-class" ).toString() ).hasMatch() || + match.captured( "plotName" ) == "*" ) { QWidget* canvas = plotWidget->canvas(); if ( canvas ) diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp index 566a720f5e..ff98639628 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp @@ -433,12 +433,11 @@ void RiuQtChartsPlotWidget::setAutoTickIntervalCounts( RiuPlotAxis axis, int max //-------------------------------------------------------------------------------------------------- double RiuQtChartsPlotWidget::majorTickInterval( RiuPlotAxis axis ) const { -#if QT_VERSION >= QT_VERSION_CHECK( 5, 12, 0 ) - // QValueAxis::tickInterval was introduced in 5.12 - QAbstractAxis* ax = plotAxis( axis ); - QValueAxis* valueAxis = dynamic_cast( ax ); - if ( valueAxis ) return valueAxis->tickInterval(); -#endif + if ( QValueAxis* valueAxis = dynamic_cast( plotAxis( axis ) ) ) + { + return valueAxis->tickInterval(); + } + return 0.0; } diff --git a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionWidgetCreator.cpp b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionWidgetCreator.cpp index beafa7a200..8ceefe88c5 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionWidgetCreator.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionWidgetCreator.cpp @@ -129,8 +129,8 @@ QWidget* RiuSummaryVectorSelectionWidgetCreator::createWidget( QWidget* parent ) rowSplitter->setContentsMargins( 0, 0, 0, 0 ); rowSplitter->setHandleWidth( 6 ); rowSplitter->setStyleSheet( "QSplitter::handle { image: url(:/SplitterV.png); }" ); - rowSplitter->insertWidget( 0, firstRowLeftFrame ); - rowSplitter->insertWidget( 1, firstRowRightFrame ); + rowSplitter->addWidget( firstRowLeftFrame ); + rowSplitter->addWidget( firstRowRightFrame ); rowSplitter->setSizes( QList() << 1 << 1 ); firstRowLayout->addWidget( rowSplitter ); diff --git a/ApplicationLibCode/UserInterface/RiuTextDialog.cpp b/ApplicationLibCode/UserInterface/RiuTextDialog.cpp index 7829f4e18d..fa22df1378 100644 --- a/ApplicationLibCode/UserInterface/RiuTextDialog.cpp +++ b/ApplicationLibCode/UserInterface/RiuTextDialog.cpp @@ -211,11 +211,7 @@ RiuTabbedTextDialog::RiuTabbedTextDialog( RiuTabbedTextProvider* textProvider, Q textEdit->setContextMenuPolicy( Qt::NoContextMenu ); auto fontWidth = QFontMetrics( font ).boundingRect( "m" ).width(); -#if QT_VERSION >= QT_VERSION_CHECK( 5, 10, 0 ) textEdit->setTabStopDistance( fontWidth * 4 ); -#else - textEdit->setTabStopWidth( fontWidth * 4 ); -#endif m_tabWidget->addTab( textEdit, tabTitle ); } diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d87519208..3a4dc75f1f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -550,19 +550,15 @@ find_package( Network Widgets Charts - Core5Compat ) -set(QT_LIBRARIES - Qt6::Core - Qt6::Gui - Qt6::OpenGL - Qt6::Network - Qt6::Widgets - Qt6::Charts - Qt6::Core5Compat +set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::OpenGL Qt6::Network Qt6::Widgets + Qt6::Charts ) qt_standard_project_setup() +# Disable use of foreach +add_definitions(-DQT_NO_FOREACH) + # Open GL find_package(OpenGL) diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafNotificationCenter.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafNotificationCenter.cpp index 67cb44948d..3bc29528df 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafNotificationCenter.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafNotificationCenter.cpp @@ -72,7 +72,7 @@ void NotificationCenter::notifyObserversOfDataChange( caf::PdmObjectHandle* item { CAF_ASSERT( itemThatChanged ); - foreach ( DataModelObserver* o, m_observers ) + for ( DataModelObserver* o : m_observers ) { o->handleModelNotification( itemThatChanged ); } @@ -83,7 +83,7 @@ void NotificationCenter::notifyObserversOfDataChange( caf::PdmObjectHandle* item //-------------------------------------------------------------------------------------------------- void NotificationCenter::notifyObservers() { - foreach ( DataModelObserver* o, m_observers ) + for ( DataModelObserver* o : m_observers ) { o->handleModelNotification( nullptr ); } @@ -94,7 +94,7 @@ void NotificationCenter::notifyObservers() //-------------------------------------------------------------------------------------------------- void NotificationCenter::notifyObserversOfSelectionChange() { - foreach ( DataModelObserver* o, m_observers ) + for ( DataModelObserver* o : m_observers ) { o->handleModelSelectionChange(); } diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmReferenceHelper.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmReferenceHelper.cpp index c2f6aec6bf..681f65ba84 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmReferenceHelper.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmReferenceHelper.cpp @@ -311,13 +311,7 @@ PdmObjectHandle* PdmReferenceHelper::objectFromFieldReference( PdmFieldHandle* f if ( reference.isEmpty() ) return nullptr; if ( reference.trimmed().isEmpty() ) return nullptr; -#if ( QT_VERSION < QT_VERSION_CHECK( 5, 14, 0 ) ) - auto SkipEmptyParts = QString::SkipEmptyParts; -#else - auto SkipEmptyParts = Qt::SkipEmptyParts; -#endif - - QStringList decodedReference = reference.split( QRegularExpression( "\\s+" ), SkipEmptyParts ); + QStringList decodedReference = reference.split( QRegularExpression( "\\s+" ), Qt::SkipEmptyParts ); PdmObjectHandle* lastCommonAnchestor = fromField->ownerObject(); CAF_ASSERT( lastCommonAnchestor ); diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/caf.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/caf.cpp index 63544caf05..e34e8430b4 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/caf.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/caf.cpp @@ -46,12 +46,8 @@ namespace caf //-------------------------------------------------------------------------------------------------- QLocale norwegianLocale() { -#if QT_VERSION >= QT_VERSION_CHECK( 5, 15, 0 ) return QLocale::NorwegianBokmal; -#else - return QLocale::Norwegian; -#endif -} // namespace caf::norwegianLocale() +} //-------------------------------------------------------------------------------------------------- /// @@ -59,11 +55,7 @@ QLocale norwegianLocale() QTextStream& endl( QTextStream& s ) { // https: // github.com/qt/qtbase/blob/dev/src/corelib/serialization/qtextstream.cpp#L2845 -#if QT_VERSION >= QT_VERSION_CHECK( 5, 15, 0 ) return s << QLatin1Char( '\n' ) << Qt::flush; -#else - return s << QLatin1Char( '\n' ) << flush; -#endif } //-------------------------------------------------------------------------------------------------- @@ -71,11 +63,7 @@ QTextStream& endl( QTextStream& s ) //-------------------------------------------------------------------------------------------------- QPointF position( QWheelEvent* wheelEvent ) { -#if QT_VERSION >= QT_VERSION_CHECK( 5, 15, 0 ) return wheelEvent->position(); -#else - return wheelEvent->pos(); -#endif } } // namespace caf diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafFontTools.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafFontTools.cpp index 12e8d251de..93d935f62a 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafFontTools.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafFontTools.cpp @@ -41,10 +41,6 @@ #include -#if ( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) ) -#include -#endif - #include namespace caf @@ -95,15 +91,6 @@ int FontTools::absolutePointSize( FontSize normalPointSize, RelativeSize relativ //-------------------------------------------------------------------------------------------------- int FontTools::pointSizeToPixelSize( int pointSize ) { -#if ( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) ) - auto app = dynamic_cast( QCoreApplication::instance() ); - if ( app ) - { - int dpi = app->desktop()->logicalDpiX(); - double inches = pointSize / 72.0; - return static_cast( std::ceil( inches * dpi ) ); - } -#endif return pointSize; } @@ -120,15 +107,6 @@ int FontTools::pointSizeToPixelSize( FontSize pointSize ) //-------------------------------------------------------------------------------------------------- int FontTools::pixelSizeToPointSize( int pixelSize ) { -#if ( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) ) - auto app = dynamic_cast( QCoreApplication::instance() ); - if ( app ) - { - int dpi = app->desktop()->logicalDpiX(); - double inches = pixelSize / dpi; - return static_cast( std::ceil( inches * 72.0 ) ); - } -#endif return pixelSize; } diff --git a/Fwk/AppFwk/cafUserInterface/cafAboutDialog.cpp b/Fwk/AppFwk/cafUserInterface/cafAboutDialog.cpp index 982b0e3de3..9b6d248219 100644 --- a/Fwk/AppFwk/cafUserInterface/cafAboutDialog.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafAboutDialog.cpp @@ -42,10 +42,6 @@ #include #include -#if ( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) ) -#include -#endif - namespace caf { //================================================================================================== @@ -302,48 +298,6 @@ QString AboutDialog::versionStringForcurrentOpenGLContext() { QString versionString( "OpenGL " ); -#if ( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) ) - QGLFormat::OpenGLVersionFlags flags = QGLFormat::openGLVersionFlags(); - - if ( flags & QGLFormat::OpenGL_Version_4_0 ) - versionString += "4.0"; - else if ( flags & QGLFormat::OpenGL_Version_3_3 ) - versionString += "3.3"; - else if ( flags & QGLFormat::OpenGL_Version_3_2 ) - versionString += "3.2"; - else if ( flags & QGLFormat::OpenGL_Version_3_1 ) - versionString += "3.1"; - else if ( flags & QGLFormat::OpenGL_Version_3_0 ) - versionString += "3.0"; - else if ( flags & QGLFormat::OpenGL_ES_Version_2_0 ) - versionString += "ES_Version 2.0"; - else if ( flags & QGLFormat::OpenGL_ES_CommonLite_Version_1_1 ) - versionString += "ES_CommonLite_Version 1.1"; - else if ( flags & QGLFormat::OpenGL_ES_Common_Version_1_1 ) - versionString += "ES_Common_Version 1.1"; - else if ( flags & QGLFormat::OpenGL_ES_CommonLite_Version_1_0 ) - versionString += "ES_CommonLite_Version 1.0"; - else if ( flags & QGLFormat::OpenGL_ES_Common_Version_1_0 ) - versionString += "ES_Common_Version 1.0"; - else if ( flags & QGLFormat::OpenGL_Version_2_1 ) - versionString += "2.1"; - else if ( flags & QGLFormat::OpenGL_Version_2_0 ) - versionString += "2.0"; - else if ( flags & QGLFormat::OpenGL_Version_1_5 ) - versionString += "1.5"; - else if ( flags & QGLFormat::OpenGL_Version_1_4 ) - versionString += "1.4"; - else if ( flags & QGLFormat::OpenGL_Version_1_3 ) - versionString += "1.3"; - else if ( flags & QGLFormat::OpenGL_Version_1_2 ) - versionString += "1.2"; - else if ( flags & QGLFormat::OpenGL_Version_1_1 ) - versionString += "1.1"; - else if ( flags & QGLFormat::OpenGL_Version_None ) - versionString += "None"; - else - versionString += "Unknown"; -#endif return versionString; } diff --git a/Fwk/AppFwk/cafUserInterface/cafMemoryInspector.cpp b/Fwk/AppFwk/cafUserInterface/cafMemoryInspector.cpp index 686a75e0c0..7213efcf8a 100644 --- a/Fwk/AppFwk/cafUserInterface/cafMemoryInspector.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafMemoryInspector.cpp @@ -25,11 +25,6 @@ #ifdef __linux__ -#if ( QT_VERSION < QT_VERSION_CHECK( 5, 14, 0 ) ) - auto SkipEmptyParts = QString::SkipEmptyParts; -#else - auto SkipEmptyParts = Qt::SkipEmptyParts; -#endif //-------------------------------------------------------------------------------------------------- /// Read bytes of memory of different types for current process from /proc/self/statm @@ -47,7 +42,7 @@ std::map readProcessBytesLinux() if (procSelfStatus.open(QIODevice::ReadOnly | QIODevice::Text)) { QString line(procSelfStatus.readLine(256)); - QStringList lineWords = line.split(QRegularExpression("\\s+"), SkipEmptyParts); + QStringList lineWords = line.split(QRegularExpression("\\s+"), Qt::SkipEmptyParts); quantities["VmSize"] = static_cast(lineWords[0].toLongLong() * pageSize); quantities["RSS"] = static_cast(lineWords[1].toLongLong() * pageSize); quantities["Shared"] = static_cast(lineWords[2].toLongLong() * pageSize); @@ -75,7 +70,7 @@ std::map readMemInfoLinuxMiB() if (lineLength > 0) { QString line = QString::fromLatin1(buf, lineLength); - QStringList words = line.split(QRegularExpression(":*\\s+"), SkipEmptyParts); + QStringList words = line.split(QRegularExpression(":*\\s+"), Qt::SkipEmptyParts); if (words.size() > 1) { bool ok = true; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp index 428674510e..b4b04b74fb 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp @@ -191,8 +191,8 @@ void PdmUiComboBoxEditor::configureAndUpdateUi( const QString& uiConfigName ) m_nextItemButton->setToolTip( "Next" ); } - m_layout->insertWidget( 1, m_previousItemButton ); - m_layout->insertWidget( 2, m_nextItemButton ); + m_layout->addWidget( m_previousItemButton ); + m_layout->addWidget( m_nextItemButton ); { QIcon toolButtonIcon; @@ -283,7 +283,7 @@ void PdmUiComboBoxEditor::configureAndUpdateUi( const QString& uiConfigName ) QString tooltipText = uiField()->isAutoValueEnabled() ? UiAppearanceSettings::globaleValueButtonText() : UiAppearanceSettings::localValueButtonText(); m_autoValueToolButton->setToolTip( tooltipText ); - m_layout->insertWidget( 3, m_autoValueToolButton ); + m_layout->addWidget( m_autoValueToolButton ); m_autoValueToolButton->show(); } else diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.cpp index c8259369c0..e41572017f 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.cpp @@ -172,7 +172,7 @@ void PdmUiLineEditor::configureAndUpdateUi( const QString& uiConfigName ) : UiAppearanceSettings::localValueButtonText(); m_autoValueToolButton->setToolTip( tooltipText ); - m_layout->insertWidget( 1, m_autoValueToolButton ); + m_layout->addWidget( m_autoValueToolButton ); m_autoValueToolButton->show(); } else diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyView.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyView.cpp index 42cb5dc353..2f1e25060e 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyView.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyView.cpp @@ -194,7 +194,7 @@ void PdmUiPropertyView::showProperties( PdmObjectHandle* object ) CAF_ASSERT( propertyWidget ); - this->m_placeHolderLayout->insertWidget( 0, propertyWidget ); + this->m_placeHolderLayout->addWidget( propertyWidget ); // Add stretch to make sure the property widget is not stretched this->m_placeHolderLayout->insertStretch( -1, 1 ); diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp index c2bc9df8f3..14db565afe 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp @@ -620,11 +620,7 @@ void PdmUiTreeSelectionEditor::slotInvertCheckedStateOfAll() //-------------------------------------------------------------------------------------------------- void PdmUiTreeSelectionEditor::setCheckedStateForIntegerItemsMatchingFilter() { -#if ( QT_VERSION < QT_VERSION_CHECK( 5, 14, 0 ) ) - auto SkipEmptyParts = QString::SkipEmptyParts; -#else auto SkipEmptyParts = Qt::SkipEmptyParts; -#endif std::set filterValues; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUniqueIdValidator.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUniqueIdValidator.cpp index 37d34c0838..ad56887ee0 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUniqueIdValidator.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUniqueIdValidator.cpp @@ -88,7 +88,7 @@ QValidator::State PdmUniqueIdValidator::validate( QString& currentString, int& ) if ( m_usedIds.find( currentValue ) != m_usedIds.end() ) { - foreach ( QWidget* widget, QApplication::topLevelWidgets() ) + for ( QWidget* widget : QApplication::topLevelWidgets() ) { if ( widget->inherits( "QMainWindow" ) ) { diff --git a/Fwk/AppFwk/cafUserInterface/cafQTreeViewStateSerializer.cpp b/Fwk/AppFwk/cafUserInterface/cafQTreeViewStateSerializer.cpp index ffb85c02e2..cf84146039 100644 --- a/Fwk/AppFwk/cafUserInterface/cafQTreeViewStateSerializer.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafQTreeViewStateSerializer.cpp @@ -107,7 +107,7 @@ QModelIndex caf::QTreeViewStateSerializer::getModelIndexFromString( QAbstractIte QModelIndex mi; - foreach ( QString modelIndexString, modelIndexStringList ) + for ( const QString& modelIndexString : modelIndexStringList ) { QStringList items = modelIndexString.split( " " ); diff --git a/Fwk/AppFwk/cafViewer/cafCadNavigation.cpp b/Fwk/AppFwk/cafViewer/cafCadNavigation.cpp index 9ea86459e4..35388de11e 100644 --- a/Fwk/AppFwk/cafViewer/cafCadNavigation.cpp +++ b/Fwk/AppFwk/cafViewer/cafCadNavigation.cpp @@ -144,12 +144,7 @@ bool caf::CadNavigation::handleInputEvent( QInputEvent* inputEvent ) { QWheelEvent* we = static_cast( inputEvent ); -#if ( QT_VERSION < QT_VERSION_CHECK( 5, 15, 0 ) ) - QPoint cursorPosition = we->pos(); -#else QPoint cursorPosition = we->position().toPoint(); -#endif - updatePointOfInterestDuringZoomIfNecessary( cursorPosition.x(), cursorPosition.y() ); if ( m_isRotCenterInitialized ) diff --git a/Fwk/AppFwk/cafViewer/cafCeetronNavigation.cpp b/Fwk/AppFwk/cafViewer/cafCeetronNavigation.cpp index 42d385e7c3..7fced56000 100644 --- a/Fwk/AppFwk/cafViewer/cafCeetronNavigation.cpp +++ b/Fwk/AppFwk/cafViewer/cafCeetronNavigation.cpp @@ -202,12 +202,8 @@ void caf::CeetronNavigation::wheelEvent( QWheelEvent* event ) int navDelta = vpHeight / 5; if ( event->angleDelta().y() < 0 ) navDelta *= -1; -#if ( QT_VERSION < QT_VERSION_CHECK( 5, 15, 0 ) ) - QPoint cursorPosition = event->pos(); -#else QPoint cursorPosition = event->position().toPoint(); -#endif - int posY = m_viewer->height() - cursorPosition.y(); + int posY = m_viewer->height() - cursorPosition.y(); m_trackball->startNavigation( ManipulatorTrackball::WALK, cursorPosition.x(), posY ); diff --git a/Fwk/AppFwk/cafViewer/cafCeetronPlusNavigation.cpp b/Fwk/AppFwk/cafViewer/cafCeetronPlusNavigation.cpp index 6165014011..7120e46a6b 100644 --- a/Fwk/AppFwk/cafViewer/cafCeetronPlusNavigation.cpp +++ b/Fwk/AppFwk/cafViewer/cafCeetronPlusNavigation.cpp @@ -185,12 +185,7 @@ bool caf::CeetronPlusNavigation::handleInputEvent( QInputEvent* inputEvent ) { QWheelEvent* we = static_cast( inputEvent ); -#if ( QT_VERSION < QT_VERSION_CHECK( 5, 15, 0 ) ) - QPoint cursorPosition = we->pos(); -#else QPoint cursorPosition = we->position().toPoint(); -#endif - updatePointOfInterestDuringZoomIfNecessary( cursorPosition.x(), cursorPosition.y() ); if ( m_isRotCenterInitialized ) diff --git a/Fwk/VizFwk/LibGuiQt/cvfqtOpenGLWidget.cpp b/Fwk/VizFwk/LibGuiQt/cvfqtOpenGLWidget.cpp index 7de4e4c06e..21a1b37432 100644 --- a/Fwk/VizFwk/LibGuiQt/cvfqtOpenGLWidget.cpp +++ b/Fwk/VizFwk/LibGuiQt/cvfqtOpenGLWidget.cpp @@ -146,12 +146,11 @@ OpenGLWidget::~OpenGLWidget() if (m_initializationState == IS_INITIALIZED) { - // Make sure we disconnect from the aboutToBeDestroyed signal since after this destructor has been - // called, our object is dangling and the call to the slot will cause a crash - QOpenGLContext* myQtOpenGLContext = context(); - if (myQtOpenGLContext) + if (QOpenGLContext* myQtOpenGLContext = context()) { - disconnect(myQtOpenGLContext, &QOpenGLContext::aboutToBeDestroyed, this, &OpenGLWidget::qtOpenGLContextAboutToBeDestroyed); + // Make sure we disconnect from the all signals since after this destructor has been + // called, our object is dangling and the call to any of the slots will cause a crash + myQtOpenGLContext->disconnect(); } } diff --git a/Fwk/VizFwk/LibGuiQt/cvfqtUtils.cpp b/Fwk/VizFwk/LibGuiQt/cvfqtUtils.cpp index 9ec41e04ad..3b4063525f 100644 --- a/Fwk/VizFwk/LibGuiQt/cvfqtUtils.cpp +++ b/Fwk/VizFwk/LibGuiQt/cvfqtUtils.cpp @@ -119,7 +119,7 @@ std::vector Utils::toStringVector(const QStringList& stringList) { std::vector strVec; - foreach (QString s, stringList) + for (const QString& s : stringList) { strVec.push_back(toString(s)); } @@ -136,7 +136,7 @@ QStringList Utils::toQStringList(const std::vector& stringVector) { QStringList strList; - foreach (cvf::String s, stringVector) + for (const cvf::String& s : stringVector) { strList.push_back(toQString(s)); } diff --git a/Fwk/VizFwk/TestApps/Qt/QtMinimal/QMWidget.cpp b/Fwk/VizFwk/TestApps/Qt/QtMinimal/QMWidget.cpp index 72996cea2f..87f2b0ad4b 100644 --- a/Fwk/VizFwk/TestApps/Qt/QtMinimal/QMWidget.cpp +++ b/Fwk/VizFwk/TestApps/Qt/QtMinimal/QMWidget.cpp @@ -145,13 +145,8 @@ void QMWidget::mouseMoveEvent(QMouseEvent* event) if (m_renderSequence.isNull()) return; Qt::MouseButtons mouseBn = event->buttons(); -#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) const int posX = event->position().toPoint().x(); const int posY = height() - event->position().toPoint().y(); -#else - const int posX = event->x(); - const int posY = height() - event->y(); -#endif cvf::ManipulatorTrackball::NavigationType navType = cvf::ManipulatorTrackball::NONE; if (mouseBn == Qt::LeftButton) @@ -186,13 +181,8 @@ void QMWidget::mousePressEvent(QMouseEvent* event) { if (m_renderSequence.isNull()) return; -#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) const int posX = event->position().toPoint().x(); const int posY = height() - event->position().toPoint().y(); -#else - const int posX = event->x(); - const int posY = height() - event->y(); -#endif if (event->buttons() == Qt::LeftButton && event->modifiers() == Qt::ControlModifier) diff --git a/Fwk/VizFwk/TestApps/Qt/QtMultiView/QMVWidget.cpp b/Fwk/VizFwk/TestApps/Qt/QtMultiView/QMVWidget.cpp index fb8e6ba51c..f7ef57e6db 100644 --- a/Fwk/VizFwk/TestApps/Qt/QtMultiView/QMVWidget.cpp +++ b/Fwk/VizFwk/TestApps/Qt/QtMultiView/QMVWidget.cpp @@ -172,13 +172,8 @@ void QMVWidget::mouseMoveEvent(QMouseEvent* event) if (m_renderSequence.isNull()) return; Qt::MouseButtons mouseBn = event->buttons(); -#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) const int posX = event->position().toPoint().x(); const int posY = height() - event->position().toPoint().y(); -#else - const int posX = event->x(); - const int posY = height() - event->y(); -#endif cvf::ManipulatorTrackball::NavigationType navType = cvf::ManipulatorTrackball::NONE; if (mouseBn == Qt::LeftButton) @@ -214,13 +209,8 @@ void QMVWidget::mousePressEvent(QMouseEvent* event) { if (m_renderSequence.isNull()) return; -#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) const int posX = event->position().toPoint().x(); const int posY = height() - event->position().toPoint().y(); -#else - const int posX = event->x(); - const int posY = height() - event->y(); -#endif if (event->buttons() == Qt::LeftButton && event->modifiers() == Qt::ControlModifier) { diff --git a/Fwk/VizFwk/TestApps/Qt/QtTestBenchOpenGLWidget/QTBVizWidget.cpp b/Fwk/VizFwk/TestApps/Qt/QtTestBenchOpenGLWidget/QTBVizWidget.cpp index 7edf1cfc5e..e1769f45f2 100644 --- a/Fwk/VizFwk/TestApps/Qt/QtTestBenchOpenGLWidget/QTBVizWidget.cpp +++ b/Fwk/VizFwk/TestApps/Qt/QtTestBenchOpenGLWidget/QTBVizWidget.cpp @@ -245,13 +245,8 @@ void QTBVizWidget::mouseMoveEvent(QMouseEvent* event) if (m_renderSequence.isNull()) return; Qt::MouseButtons mouseBn = event->buttons(); -#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) const int posX = event->position().toPoint().x(); const int posY = height() - event->position().toPoint().y(); -#else - const int posX = event->x(); - const int posY = height() - event->y(); -#endif cvf::ManipulatorTrackball::NavigationType navType = cvf::ManipulatorTrackball::NONE; if (mouseBn == Qt::LeftButton) @@ -286,13 +281,8 @@ void QTBVizWidget::mousePressEvent(QMouseEvent* event) { if (m_renderSequence.isNull()) return; -#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) const int posX = event->position().toPoint().x(); const int posY = height() - event->position().toPoint().y(); -#else - const int posX = event->x(); - const int posY = height() - event->y(); -#endif if (event->buttons() == Qt::LeftButton && event->modifiers() == Qt::ControlModifier) { From 4f921b62b6560645b589a50927b540f7d1182f49 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 29 Oct 2024 10:29:29 +0100 Subject: [PATCH 070/160] Remove misleading and confusing error message --- .../ReservoirDataModel/RigStimPlanFractureDefinition.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/ApplicationLibCode/ReservoirDataModel/RigStimPlanFractureDefinition.cpp b/ApplicationLibCode/ReservoirDataModel/RigStimPlanFractureDefinition.cpp index 747a432a17..44b93c3587 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigStimPlanFractureDefinition.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigStimPlanFractureDefinition.cpp @@ -681,8 +681,6 @@ const std::vector>& } } - RiaLogging::error( "Requested parameter does not exists in stimPlan data" ); - static std::vector> emptyVector; return emptyVector; } From 924687b11e21414c63b49d399e9d40eb05728647 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 29 Oct 2024 14:13:28 +0100 Subject: [PATCH 071/160] Remove qt5compat --- .github/workflows/ResInsightWithCache.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ResInsightWithCache.yml b/.github/workflows/ResInsightWithCache.yml index 082d96bb20..6b5355bb37 100644 --- a/.github/workflows/ResInsightWithCache.yml +++ b/.github/workflows/ResInsightWithCache.yml @@ -183,7 +183,7 @@ jobs: version: ${{ matrix.config.qt-version }} dir: "${{ github.workspace }}/Qt/" cache: true - modules: "qtnetworkauth qtcharts qt5compat" + modules: "qtnetworkauth qtcharts" - name: Export GitHub Actions cache environment variables uses: actions/github-script@v7 From 95365ad5d0ed3ea3aa5f8f8f1368c1f5b179747e Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 29 Oct 2024 14:06:58 +0100 Subject: [PATCH 072/160] Add timing support to logger --- .../Application/Tools/RiaLogging.cpp | 26 ++++++++++++++++++- .../Application/Tools/RiaLogging.h | 7 ++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/Application/Tools/RiaLogging.cpp b/ApplicationLibCode/Application/Tools/RiaLogging.cpp index 014dcfc281..5e271f1403 100644 --- a/ApplicationLibCode/Application/Tools/RiaLogging.cpp +++ b/ApplicationLibCode/Application/Tools/RiaLogging.cpp @@ -169,7 +169,8 @@ void RiaDefaultConsoleLogger::writeToConsole( const std::string& str ) // //================================================================================================== -std::vector> RiaLogging::sm_logger; +std::vector> RiaLogging::sm_logger; +std::chrono::time_point RiaLogging::sm_startTime; //-------------------------------------------------------------------------------------------------- /// @@ -276,6 +277,29 @@ void RiaLogging::errorInMessageBox( QWidget* parent, const QString& title, const RiaLogging::error( text ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaLogging::resetTimer( const QString& message ) +{ + sm_startTime = std::chrono::high_resolution_clock::now(); + + if ( !message.isEmpty() ) RiaLogging::debug( message ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaLogging::logTimeElapsed( const QString& message ) +{ + auto end = std::chrono::high_resolution_clock::now(); + + auto duration = std::chrono::duration_cast( end - sm_startTime ); + auto text = message + QString( " (duration : %1 milliseconds)" ).arg( duration.count() ); + + RiaLogging::debug( text ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/Tools/RiaLogging.h b/ApplicationLibCode/Application/Tools/RiaLogging.h index c0e8e5bf1b..768c206640 100644 --- a/ApplicationLibCode/Application/Tools/RiaLogging.h +++ b/ApplicationLibCode/Application/Tools/RiaLogging.h @@ -18,6 +18,7 @@ #pragma once +#include #include #include #include @@ -72,8 +73,12 @@ public: static void errorInMessageBox( QWidget* parent, const QString& title, const QString& text ); + static void resetTimer( const QString& message ); + static void logTimeElapsed( const QString& message ); + private: - static std::vector> sm_logger; + static std::vector> sm_logger; + static std::chrono::time_point sm_startTime; }; //================================================================================================== From 69878f54d34b912653c3f0b7e4c4c1f3f41d5691 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Tue, 22 Oct 2024 02:48:57 +0200 Subject: [PATCH 073/160] Work in progress --- .../Application/RiaPreferencesGrid.cpp | 8 +- .../RifReaderOpmCommonActive.cpp | 258 +++++++++++++++--- .../FileInterface/RifReaderOpmCommonActive.h | 7 +- .../ReservoirDataModel/RigActiveCellGrid.h | 7 +- 4 files changed, 237 insertions(+), 43 deletions(-) diff --git a/ApplicationLibCode/Application/RiaPreferencesGrid.cpp b/ApplicationLibCode/Application/RiaPreferencesGrid.cpp index 9bf0e8b270..a075cc8bfb 100644 --- a/ApplicationLibCode/Application/RiaPreferencesGrid.cpp +++ b/ApplicationLibCode/Application/RiaPreferencesGrid.cpp @@ -137,9 +137,8 @@ void RiaPreferencesGrid::appendItems( caf::PdmUiOrdering& uiOrdering ) auto resdataGrp = uiOrdering.addNewGroup( "ResData Reader Settings" ); resdataGrp->add( &m_useResultIndexFile ); - // TODO: Disabled for the 2024.09 release, enable after release - // auto opmcGrp = uiOrdering.addNewGroup( "OPM Common Reader Settings" ); - // opmcGrp->add( &m_onlyLoadActiveCells ); + auto opmcGrp = uiOrdering.addNewGroup( "OPM Common Reader Settings" ); + opmcGrp->add( &m_onlyLoadActiveCells ); const bool setFaultImportSettingsReadOnly = !importFaults(); @@ -264,8 +263,7 @@ bool RiaPreferencesGrid::autoComputeDepthRelatedProperties() const //-------------------------------------------------------------------------------------------------- bool RiaPreferencesGrid::onlyLoadActiveCells() const { - return false; - // return m_onlyLoadActiveCells; + return m_onlyLoadActiveCells; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/FileInterface/RifReaderOpmCommonActive.cpp b/ApplicationLibCode/FileInterface/RifReaderOpmCommonActive.cpp index 6807d44fc7..a68a123e7d 100644 --- a/ApplicationLibCode/FileInterface/RifReaderOpmCommonActive.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderOpmCommonActive.cpp @@ -75,40 +75,106 @@ bool RifReaderOpmCommonActive::importGrid( RigMainGrid* /* mainGrid*/, RigEclips else if ( gridUnitStr.starts_with( 'C' ) ) m_gridUnit = 3; + auto totalCellCount = opmGrid.totalNumberOfCells(); + auto totalNativeCellCount = opmGrid.totalActiveCells() + 1; // add one inactive cell used as placeholder for all inactive cells auto globalMatrixActiveSize = opmGrid.activeCells(); auto globalFractureActiveSize = opmGrid.activeFracCells(); + const auto& lgr_names = opmGrid.list_of_lgrs(); m_gridNames.clear(); m_gridNames.push_back( "global" ); + m_gridNames.insert( m_gridNames.end(), lgr_names.begin(), lgr_names.end() ); + const auto& lgr_parent_names = opmGrid.list_of_lgr_parents(); + const int numLGRs = (int)lgr_names.size(); - std::vector lgrGrids; // lgrs not supported here for now + std::vector lgrGrids; + + // init LGR grids + for ( int lgrIdx = 0; lgrIdx < numLGRs; lgrIdx++ ) + { + lgrGrids.emplace_back( Opm::EclIO::EGrid( m_gridFileName, lgr_names[lgrIdx] ) ); + RigLocalGrid* localGrid = new RigLocalGrid( activeGrid ); + + const auto& lgrDims = lgrGrids[lgrIdx].dimension(); + localGrid->setGridPointDimensions( cvf::Vec3st( lgrDims[0] + 1, lgrDims[1] + 1, lgrDims[2] + 1 ) ); + localGrid->setGridId( lgrIdx + 1 ); + localGrid->setGridName( lgr_names[lgrIdx] ); + localGrid->setIndexToGlobalStartOfCells( totalCellCount ); + activeGrid->addLocalGrid( localGrid ); + + totalCellCount += lgrGrids[lgrIdx].totalNumberOfCells(); + totalNativeCellCount += lgrGrids[lgrIdx].totalActiveCells() + 1; + } // active cell information { auto task = progInfo.task( "Getting Active Cell Information", 1 ); + for ( int lgrIdx = 0; lgrIdx < numLGRs; lgrIdx++ ) + { + globalMatrixActiveSize += lgrGrids[lgrIdx].activeCells(); + globalFractureActiveSize += lgrGrids[lgrIdx].activeFracCells(); + } + // in case init file and grid file disagrees with number of active cells, read extra porv information from init file to correct this if ( !verifyActiveCellInfo( globalMatrixActiveSize, globalFractureActiveSize ) ) { updateActiveCellInfo( eclipseCaseData, opmGrid, lgrGrids, activeGrid ); } - activeGrid->transferActiveInformation( eclipseCaseData, - opmGrid.totalActiveCells(), - opmGrid.activeCells(), - opmGrid.activeFracCells(), - opmGrid.active_indexes(), - opmGrid.active_frac_indexes() ); + size_t anInactiveCellIndex = activeGrid->transferActiveInformation( 0, + eclipseCaseData, + opmGrid.totalActiveCells(), + opmGrid.activeCells(), + opmGrid.activeFracCells(), + opmGrid.active_indexes(), + opmGrid.active_frac_indexes(), + 0 ); + + for ( int lgrIdx = 0; lgrIdx < numLGRs; lgrIdx++ ) + { + activeGrid->transferActiveInformation( lgrIdx + 1, + eclipseCaseData, + lgrGrids[lgrIdx].totalActiveCells(), + lgrGrids[lgrIdx].activeCells(), + lgrGrids[lgrIdx].activeFracCells(), + lgrGrids[lgrIdx].active_indexes(), + lgrGrids[lgrIdx].active_frac_indexes(), + anInactiveCellIndex ); + } + + eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL )->computeDerivedData(); + eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::FRACTURE_MODEL )->computeDerivedData(); } // grid geometry { - RiaLogging::info( QString( "Loading %0 active of %1 total cells." ) + RiaLogging::info( QString( "Loading %0 active of %1 total cells in main grid." ) .arg( QString::fromStdString( RiaStdStringTools::formatThousandGrouping( opmGrid.totalActiveCells() ) ) ) .arg( QString::fromStdString( RiaStdStringTools::formatThousandGrouping( opmGrid.totalNumberOfCells() ) ) ) ); auto task = progInfo.task( "Loading Active Cell Main Grid Geometry", 1 ); - transferActiveGeometry( opmGrid, activeGrid, eclipseCaseData ); + transferActiveGeometry( opmGrid, opmGrid, activeGrid, activeGrid, eclipseCaseData ); + + bool hasParentInfo = ( lgr_parent_names.size() >= (size_t)numLGRs ); + + auto task = progInfo.task( "Loading Active Cell LGR Grid Geometry ", 1 ); + + for ( int lgrIdx = 0; lgrIdx < numLGRs; lgrIdx++ ) + { + RiaLogging::info( + QString( "Loading %0 active of %1 total cells in LGR grid %2." ) + .arg( QString::fromStdString( RiaStdStringTools::formatThousandGrouping( lgrGrids[lgrIdx].totalActiveCells() ) ) ) + .arg( QString::fromStdString( RiaStdStringTools::formatThousandGrouping( lgrGrids[lgrIdx].totalNumberOfCells() ) ) ) + .arg( lgrIdx + 1 ) ); + + RigGridBase* parentGrid = hasParentInfo ? activeGrid->gridByName( lgr_parent_names[lgrIdx] ) : activeGrid; + + RigLocalGrid* localGrid = static_cast( activeGrid->gridById( lgrIdx + 1 ) ); + localGrid->setParentGrid( parentGrid ); + + transferActiveGeometry( opmGrid, lgrGrids[lgrIdx], activeGrid, localGrid, eclipseCaseData ); + } } activeGrid->initAllSubGridsParentGridPointer(); @@ -149,51 +215,148 @@ bool RifReaderOpmCommonActive::importGrid( RigMainGrid* /* mainGrid*/, RigEclips return true; } +// +////-------------------------------------------------------------------------------------------------- +///// +////-------------------------------------------------------------------------------------------------- +// void RifReaderOpmCommonActive::transferActiveGeometry( Opm::EclIO::EGrid& opmMainGrid, +// RigActiveCellGrid* activeGrid, +// RigEclipseCaseData* eclipseCaseData ) +//{ +// int cellCount = opmMainGrid.totalActiveCells(); +// +// RigCell defaultCell; +// defaultCell.setHostGrid( activeGrid ); +// for ( size_t i = 0; i < 8; i++ ) +// defaultCell.cornerIndices()[i] = 0; +// +// activeGrid->reservoirCells().resize( cellCount + 1, defaultCell ); +// activeGrid->reservoirCells()[cellCount].setInvalid( true ); +// +// activeGrid->nodes().resize( ( cellCount + 1 ) * 8, cvf::Vec3d( 0, 0, 0 ) ); +// +// auto& riNodes = activeGrid->nodes(); +// +// opmMainGrid.loadData(); +// opmMainGrid.load_grid_data(); +// +// const bool isRadialGrid = opmMainGrid.is_radial(); +// const auto& activeMatIndexes = opmMainGrid.active_indexes(); +// const auto& activeFracIndexes = opmMainGrid.active_frac_indexes(); +// +// // Compute the center of the LGR radial grid cells for each K layer +// auto radialGridCenterTopLayerOpm = isRadialGrid +// ? RifOpmRadialGridTools::computeXyCenterForTopOfCells( opmMainGrid, opmMainGrid, activeGrid ) +// : std::map>(); +// +// const bool invalidateLongPyramidCells = invalidateLongThinCells(); +// +// // use same mapping as resdata +// const size_t cellMappingECLRi[8] = { 0, 1, 3, 2, 4, 5, 7, 6 }; +// +// #pragma omp parallel for +// for ( int opmCellIndex = 0; opmCellIndex < static_cast( opmMainGrid.totalNumberOfCells() ); opmCellIndex++ ) +// { +// if ( ( activeMatIndexes[opmCellIndex] < 0 ) && ( activeFracIndexes[opmCellIndex] < 0 ) ) continue; +// +// auto opmIJK = opmMainGrid.ijk_from_global_index( opmCellIndex ); +// +// double xCenterCoordOpm = 0.0; +// double yCenterCoordOpm = 0.0; +// +// if ( isRadialGrid && radialGridCenterTopLayerOpm.contains( opmIJK[2] ) ) +// { +// const auto& [xCenter, yCenter] = radialGridCenterTopLayerOpm[opmIJK[2]]; +// xCenterCoordOpm = xCenter; +// yCenterCoordOpm = yCenter; +// } +// +// auto nativeIndex = activeGrid->cellIndexFromIJK( opmIJK[0], opmIJK[1], opmIJK[2] ); +// RigCell& cell = activeGrid->nativeCell( nativeIndex ); +// // auto globalIndex = activeGrid->nativeCellIndexToGlobal( nativeIndex ); +// cell.setGridLocalCellIndex( nativeIndex ); +// cell.setParentCellIndex( cvf::UNDEFINED_SIZE_T ); +// +// // corner coordinates +// std::array opmX{}; +// std::array opmY{}; +// std::array opmZ{}; +// opmMainGrid.getCellCorners( opmCellIndex, opmX, opmY, opmZ ); +// +// // Each cell has 8 nodes, use active cell index and multiply to find first node index for cell +// auto riNodeStartIndex = nativeIndex * 8; +// +// for ( size_t opmNodeIndex = 0; opmNodeIndex < 8; opmNodeIndex++ ) +// { +// auto riCornerIndex = cellMappingECLRi[opmNodeIndex]; +// size_t riNodeIndex = riNodeStartIndex + riCornerIndex; +// +// auto& riNode = riNodes[riNodeIndex]; +// riNode.x() = opmX[opmNodeIndex] + xCenterCoordOpm; +// riNode.y() = opmY[opmNodeIndex] + yCenterCoordOpm; +// riNode.z() = -opmZ[opmNodeIndex]; +// +// cell.cornerIndices()[riCornerIndex] = riNodeIndex; +// } +// +// if ( invalidateLongPyramidCells ) +// { +// cell.setInvalid( cell.isLongPyramidCell() ); +// } +// } +// +// if ( riNodes.size() > 1 ) riNodes[riNodes.size() - 1] = riNodes[0]; +// } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RifReaderOpmCommonActive::transferActiveGeometry( Opm::EclIO::EGrid& opmMainGrid, + Opm::EclIO::EGrid& opmGrid, RigActiveCellGrid* activeGrid, + RigGridBase* localGrid, RigEclipseCaseData* eclipseCaseData ) { - int cellCount = opmMainGrid.totalActiveCells(); + int cellCount = opmGrid.totalActiveCells(); + size_t cellStartIndex = activeGrid->reservoirCells().size(); + size_t nodeStartIndex = activeGrid->nodes().size(); + + const bool invalidateLongPyramidCells = invalidateLongThinCells(); RigCell defaultCell; - defaultCell.setHostGrid( activeGrid ); + defaultCell.setHostGrid( localGrid ); for ( size_t i = 0; i < 8; i++ ) defaultCell.cornerIndices()[i] = 0; - activeGrid->globalCellArray().resize( cellCount + 1, defaultCell ); - activeGrid->globalCellArray()[cellCount].setInvalid( true ); - - activeGrid->nodes().resize( ( cellCount + 1 ) * 8, cvf::Vec3d( 0, 0, 0 ) ); + const auto newCellCount = cellStartIndex + cellCount + 1; + activeGrid->reservoirCells().resize( newCellCount, defaultCell ); + activeGrid->reservoirCells()[newCellCount - 1].setInvalid( true ); + activeGrid->nodes().resize( (newCellCount)*8, cvf::Vec3d( 0, 0, 0 ) ); auto& riNodes = activeGrid->nodes(); - opmMainGrid.loadData(); - opmMainGrid.load_grid_data(); + opmGrid.loadData(); + opmGrid.load_grid_data(); - const bool isRadialGrid = opmMainGrid.is_radial(); - const auto& activeMatIndexes = opmMainGrid.active_indexes(); - const auto& activeFracIndexes = opmMainGrid.active_frac_indexes(); + const bool isRadialGrid = opmGrid.is_radial(); + const auto& activeMatIndexes = opmGrid.active_indexes(); + const auto& activeFracIndexes = opmGrid.active_frac_indexes(); + const auto& gridDimension = opmGrid.dimension(); + const auto& hostCellGlobalIndices = opmGrid.hostCellsGlobalIndex(); // Compute the center of the LGR radial grid cells for each K layer - auto radialGridCenterTopLayerOpm = isRadialGrid - ? RifOpmRadialGridTools::computeXyCenterForTopOfCells( opmMainGrid, opmMainGrid, activeGrid ) - : std::map>(); - - const bool invalidateLongPyramidCells = invalidateLongThinCells(); + auto radialGridCenterTopLayerOpm = isRadialGrid ? RifOpmRadialGridTools::computeXyCenterForTopOfCells( opmMainGrid, opmGrid, localGrid ) + : std::map>(); // use same mapping as resdata const size_t cellMappingECLRi[8] = { 0, 1, 3, 2, 4, 5, 7, 6 }; #pragma omp parallel for - for ( int opmCellIndex = 0; opmCellIndex < static_cast( opmMainGrid.totalNumberOfCells() ); opmCellIndex++ ) + for ( int opmCellIndex = 0; opmCellIndex < static_cast( opmGrid.totalNumberOfCells() ); opmCellIndex++ ) { if ( ( activeMatIndexes[opmCellIndex] < 0 ) && ( activeFracIndexes[opmCellIndex] < 0 ) ) continue; - auto opmIJK = opmMainGrid.ijk_from_global_index( opmCellIndex ); + auto opmIJK = opmGrid.ijk_from_global_index( opmCellIndex ); double xCenterCoordOpm = 0.0; double yCenterCoordOpm = 0.0; @@ -205,19 +368,28 @@ void RifReaderOpmCommonActive::transferActiveGeometry( Opm::EclIO::EGrid& opmMa yCenterCoordOpm = yCenter; } - auto riReservoirIndex = activeGrid->cellIndexFromIJK( opmIJK[0], opmIJK[1], opmIJK[2] ); - RigCell& cell = activeGrid->globalCellArray()[riReservoirIndex]; - cell.setGridLocalCellIndex( riReservoirIndex ); - cell.setParentCellIndex( cvf::UNDEFINED_SIZE_T ); + auto nativeIndex = activeGrid->cellIndexFromIJK( opmIJK[0], opmIJK[1], opmIJK[2] ); + RigCell& cell = activeGrid->nativeCell( cellStartIndex + nativeIndex ); + cell.setGridLocalCellIndex( nativeIndex ); + + // parent cell index + if ( ( hostCellGlobalIndices.size() > (size_t)opmCellIndex ) && hostCellGlobalIndices[opmCellIndex] >= 0 ) + { + cell.setParentCellIndex( hostCellGlobalIndices[opmCellIndex] ); + } + else + { + cell.setParentCellIndex( cvf::UNDEFINED_SIZE_T ); + } // corner coordinates std::array opmX{}; std::array opmY{}; std::array opmZ{}; - opmMainGrid.getCellCorners( opmCellIndex, opmX, opmY, opmZ ); + opmGrid.getCellCorners( opmCellIndex, opmX, opmY, opmZ ); - // Each cell has 8 nodes, use reservoir cell index and multiply to find first node index for cell - auto riNodeStartIndex = riReservoirIndex * 8; + // Each cell has 8 nodes, use active cell index and multiply to find first node index for cell + auto riNodeStartIndex = nodeStartIndex + nativeIndex * 8; for ( size_t opmNodeIndex = 0; opmNodeIndex < 8; opmNodeIndex++ ) { @@ -230,6 +402,22 @@ void RifReaderOpmCommonActive::transferActiveGeometry( Opm::EclIO::EGrid& opmMa riNode.z() = -opmZ[opmNodeIndex]; cell.cornerIndices()[riCornerIndex] = riNodeIndex; + + // First grid dimension is radius, check if cell are at the outer-most slice + if ( isRadialGrid && !hostCellGlobalIndices.empty() && ( gridDimension[0] - 1 == opmIJK[0] ) ) + { + auto hostCellIndex = hostCellGlobalIndices[opmCellIndex]; + + RifOpmRadialGridTools::lockToHostPillars( riNode, + opmMainGrid, + opmGrid, + opmIJK, + hostCellIndex, + opmCellIndex, + opmNodeIndex, + xCenterCoordOpm, + yCenterCoordOpm ); + } } if ( invalidateLongPyramidCells ) @@ -237,4 +425,6 @@ void RifReaderOpmCommonActive::transferActiveGeometry( Opm::EclIO::EGrid& opmMa cell.setInvalid( cell.isLongPyramidCell() ); } } + + if ( riNodes.size() > 1 ) riNodes[riNodes.size() - 1] = riNodes[0]; } diff --git a/ApplicationLibCode/FileInterface/RifReaderOpmCommonActive.h b/ApplicationLibCode/FileInterface/RifReaderOpmCommonActive.h index 99a2d3224c..748f6c457e 100644 --- a/ApplicationLibCode/FileInterface/RifReaderOpmCommonActive.h +++ b/ApplicationLibCode/FileInterface/RifReaderOpmCommonActive.h @@ -34,5 +34,10 @@ public: protected: bool importGrid( RigMainGrid* mainGrid, RigEclipseCaseData* caseData ) override; - void transferActiveGeometry( Opm::EclIO::EGrid& opmMainGrid, RigActiveCellGrid* riMainGrid, RigEclipseCaseData* caseData ); + + void transferActiveGeometry( Opm::EclIO::EGrid& opmMainGrid, + Opm::EclIO::EGrid& opmGrid, + RigActiveCellGrid* activeGrid, + RigGridBase* localGrid, + RigEclipseCaseData* eclipseCaseData ); }; diff --git a/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h b/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h index da0e124a2c..c1fda83d89 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h +++ b/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h @@ -45,7 +45,8 @@ public: size_t cellCount() const override; private: - std::vector m_globalToActiveMap; - std::vector m_activeToGlobalMap; - RigCell m_invalidCell; + std::vector m_globalToActiveMap; + std::vector m_activeToGlobalMap; + RigCell m_invalidCell; + std::map m_cells; }; From 88118ee4e18d06dfe7651a75629a76d15c287536 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Wed, 23 Oct 2024 20:43:08 +0200 Subject: [PATCH 074/160] Privatize grid cell array --- .../RicWellPathExportMswCompletionsImpl.cpp | 2 +- .../Commands/RicCreateTemporaryLgrFeature.cpp | 10 +- .../RifEclipseOutputFileTools.cpp | 2 +- .../FileInterface/RifReaderEclipseOutput.cpp | 8 +- .../FileInterface/RifReaderOpmCommon.cpp | 8 +- .../RifReaderOpmCommonActive.cpp | 81 +++--- .../FileInterface/RifRoffFileTools.cpp | 8 +- .../RivEclipseIntersectionGrid.cpp | 4 +- .../RivElementVectorResultPartMgr.cpp | 36 +-- .../RivNNCGeometryGenerator.cpp | 14 +- .../Completions/RimFractureContainment.cpp | 6 +- .../Rim3dOverlayInfoConfig.cpp | 3 +- .../RimEclipseContourMapProjection.cpp | 6 +- .../RimEclipseStatisticsCaseEvaluator.cpp | 2 +- .../ProjectDataModel/RimEclipseView.cpp | 4 +- .../RimIdenticalGridCaseGroup.cpp | 4 +- ...StimPlanCellTransmissibilityCalculator.cpp | 5 +- .../RigCellVolumeResultCalculator.cpp | 4 +- .../RigFaultDistanceResultCalculator.cpp | 11 +- .../RigIndexIjkResultCalculator.cpp | 7 +- .../RigOilVolumeResultCalculator.cpp | 2 +- .../RigPorvSoilSgasResultCalculator.cpp | 2 +- .../ReservoirDataModel/RigActiveCellGrid.cpp | 254 ++++++++++-------- .../ReservoirDataModel/RigActiveCellGrid.h | 40 +-- .../RigCaseCellResultsData.cpp | 28 +- .../RigCaseToCaseCellMapper.cpp | 4 +- .../RigCaseToCaseCellMapperTools.cpp | 2 +- .../RigCaseToCaseRangeFilterMapper.cpp | 4 +- .../RigCellFaceGeometryTools.cpp | 4 +- .../RigEclipseWellLogExtractor.cpp | 4 +- .../ReservoirDataModel/RigGridBase.cpp | 6 +- .../ReservoirDataModel/RigMainGrid.cpp | 45 ++-- .../ReservoirDataModel/RigMainGrid.h | 9 +- .../ReservoirDataModel/RigNNCData.cpp | 4 +- ...igNumberOfFloodedPoreVolumesCalculator.cpp | 4 +- .../RigReservoirBuilder.cpp | 12 +- .../RigReservoirBuilderMock.cpp | 14 +- .../RigStimPlanModelTools.cpp | 4 +- .../RigWellTargetCandidatesGenerator.cpp | 19 +- .../SocketInterface/RiaCaseInfoCommands.cpp | 15 +- .../SocketInterface/RiaGeometryCommands.cpp | 6 +- .../SocketInterface/RiaNNCCommands.cpp | 4 +- .../RiaPropertyDataCommands.cpp | 2 +- .../UnitTests/RigWellLogExtractor-Test.cpp | 5 +- .../UserInterface/RiuResultTextBuilder.cpp | 10 +- .../UserInterface/RiuViewerCommands.cpp | 2 +- GrpcInterface/RiaGrpcCaseService.cpp | 8 +- GrpcInterface/RiaGrpcNNCPropertiesService.cpp | 4 +- GrpcInterface/RiaGrpcPropertiesService.cpp | 2 +- 49 files changed, 418 insertions(+), 326 deletions(-) diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp index 1374c10f8c..3886b7bc3a 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp @@ -694,7 +694,7 @@ void RicWellPathExportMswCompletionsImpl::generateFishbonesMswExportInfo( const for ( auto intersectionIndex : indices ) { auto intersection = filteredIntersections[intersectionIndex]; - if ( intersection.globCellIndex >= mainGrid->globalCellArray().size() ) continue; + if ( intersection.globCellIndex >= mainGrid->totalCellCount() ) continue; size_t localGridCellIndex = 0u; const RigGridBase* localGrid = diff --git a/ApplicationLibCode/Commands/RicCreateTemporaryLgrFeature.cpp b/ApplicationLibCode/Commands/RicCreateTemporaryLgrFeature.cpp index b8ddfe58c2..1c9a376eca 100644 --- a/ApplicationLibCode/Commands/RicCreateTemporaryLgrFeature.cpp +++ b/ApplicationLibCode/Commands/RicCreateTemporaryLgrFeature.cpp @@ -190,7 +190,7 @@ void RicCreateTemporaryLgrFeature::setupActionLook( QAction* actionToSetup ) void RicCreateTemporaryLgrFeature::createLgr( const LgrInfo& lgrInfo, RigMainGrid* mainGrid ) { int lgrId = lgrInfo.id; - size_t totalCellCount = mainGrid->globalCellArray().size(); + size_t totalCellCount = mainGrid->totalCellCount(); size_t lgrCellCount = lgrInfo.cellCount(); // Create local grid and set properties @@ -203,14 +203,14 @@ void RicCreateTemporaryLgrFeature::createLgr( const LgrInfo& lgrInfo, RigMainGri localGrid->setGridPointDimensions( cvf::Vec3st( lgrInfo.sizes.i() + 1, lgrInfo.sizes.j() + 1, lgrInfo.sizes.k() + 1 ) ); mainGrid->addLocalGrid( localGrid ); - size_t cellStartIndex = mainGrid->globalCellArray().size(); + size_t cellStartIndex = mainGrid->totalCellCount(); size_t nodeStartIndex = mainGrid->nodes().size(); // Resize global cell and node arrays { RigCell defaultCell; defaultCell.setHostGrid( localGrid ); - mainGrid->globalCellArray().resize( cellStartIndex + lgrCellCount, defaultCell ); + mainGrid->reservoirCells().resize( cellStartIndex + lgrCellCount, defaultCell ); mainGrid->nodes().resize( nodeStartIndex + lgrCellCount * 8, cvf::Vec3d( 0, 0, 0 ) ); } @@ -231,10 +231,10 @@ void RicCreateTemporaryLgrFeature::createLgr( const LgrInfo& lgrInfo, RigMainGri size_t mainI = lgrInfo.mainGridStartCell.i() + lgrI / lgrSizePerMainCell.i(); size_t mainCellIndex = mainGrid->cellIndexFromIJK( mainI, mainJ, mainK ); - auto& mainGridCell = mainGrid->globalCellArray()[mainCellIndex]; + auto& mainGridCell = mainGrid->cell( mainCellIndex ); mainGridCell.setSubGrid( localGrid ); - RigCell& cell = mainGrid->globalCellArray()[cellStartIndex + gridLocalCellIndex]; + RigCell& cell = mainGrid->cell( cellStartIndex + gridLocalCellIndex ); cell.setGridLocalCellIndex( gridLocalCellIndex ); cell.setParentCellIndex( mainCellIndex ); diff --git a/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp b/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp index fe49ffb81d..94aa48d653 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp @@ -668,7 +668,7 @@ bool RifEclipseOutputFileTools::assignActiveCellData( std::vectormainGrid()->globalCellArray().size() != reservoirCellCount ) + if ( eclipseCaseData->mainGrid()->reservoirCells().size() != reservoirCellCount ) { return false; } diff --git a/ApplicationLibCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationLibCode/FileInterface/RifReaderEclipseOutput.cpp index 5f69945f3a..c31c4ef443 100644 --- a/ApplicationLibCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderEclipseOutput.cpp @@ -161,12 +161,12 @@ bool RifReaderEclipseOutput::transferGridCellData( RigMainGrid* mainGrid CVF_ASSERT( activeCellInfo && fractureActiveCellInfo ); int cellCount = ecl_grid_get_global_size( localEclGrid ); - size_t cellStartIndex = mainGrid->globalCellArray().size(); + size_t cellStartIndex = mainGrid->reservoirCells().size(); size_t nodeStartIndex = mainGrid->nodes().size(); RigCell defaultCell; defaultCell.setHostGrid( localGrid ); - mainGrid->globalCellArray().resize( cellStartIndex + cellCount, defaultCell ); + mainGrid->reservoirCells().resize( cellStartIndex + cellCount, defaultCell ); mainGrid->nodes().resize( nodeStartIndex + cellCount * 8, cvf::Vec3d( 0, 0, 0 ) ); @@ -175,7 +175,7 @@ bool RifReaderEclipseOutput::transferGridCellData( RigMainGrid* mainGrid #pragma omp parallel for for ( int gridLocalCellIndex = 0; gridLocalCellIndex < cellCount; ++gridLocalCellIndex ) { - RigCell& cell = mainGrid->globalCellArray()[cellStartIndex + gridLocalCellIndex]; + RigCell& cell = mainGrid->cell( cellStartIndex + gridLocalCellIndex ); cell.setGridLocalCellIndex( gridLocalCellIndex ); @@ -303,7 +303,7 @@ bool RifReaderEclipseOutput::transferGeometry( const ecl_grid_type* mainEclGrid, // Reserve room for the cells and nodes and fill them with data - mainGrid->globalCellArray().reserve( totalCellCount ); + mainGrid->reservoirCells().reserve( totalCellCount ); mainGrid->nodes().reserve( 8 * totalCellCount ); caf::ProgressInfo progInfo( 3 + numLGRs, "" ); diff --git a/ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp b/ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp index dd9ba7c4c9..b8b1b106f5 100644 --- a/ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp @@ -197,7 +197,7 @@ bool RifReaderOpmCommon::importGrid( RigMainGrid* mainGrid, RigEclipseCaseData* activeCellInfo->setReservoirCellCount( totalCellCount ); fractureActiveCellInfo->setReservoirCellCount( totalCellCount ); - mainGrid->globalCellArray().reserve( (size_t)totalCellCount ); + mainGrid->reservoirCells().reserve( (size_t)totalCellCount ); mainGrid->nodes().reserve( (size_t)totalCellCount * 8 ); activeCellInfo->setGridCount( 1 + numLGRs ); @@ -411,7 +411,7 @@ void RifReaderOpmCommon::transferGeometry( Opm::EclIO::EGrid& opmMainGrid, RigEclipseCaseData* eclipseCaseData ) { int cellCount = opmGrid.totalNumberOfCells(); - size_t cellStartIndex = mainGrid->globalCellArray().size(); + size_t cellStartIndex = mainGrid->reservoirCells().size(); size_t nodeStartIndex = mainGrid->nodes().size(); const bool invalidateLongPyramidCells = invalidateLongThinCells(); @@ -419,7 +419,7 @@ void RifReaderOpmCommon::transferGeometry( Opm::EclIO::EGrid& opmMainGrid, RigCell defaultCell; defaultCell.setHostGrid( localGrid ); - mainGrid->globalCellArray().resize( cellStartIndex + cellCount, defaultCell ); + mainGrid->reservoirCells().resize( cellStartIndex + cellCount, defaultCell ); mainGrid->nodes().resize( nodeStartIndex + cellCount * 8, cvf::Vec3d( 0, 0, 0 ) ); @@ -456,7 +456,7 @@ void RifReaderOpmCommon::transferGeometry( Opm::EclIO::EGrid& opmMainGrid, } auto riReservoirIndex = localGrid->cellIndexFromIJK( opmIJK[0], opmIJK[1], opmIJK[2] ); - RigCell& cell = mainGrid->globalCellArray()[cellStartIndex + riReservoirIndex]; + RigCell& cell = mainGrid->cell( cellStartIndex + riReservoirIndex ); cell.setGridLocalCellIndex( riReservoirIndex ); // parent cell index diff --git a/ApplicationLibCode/FileInterface/RifReaderOpmCommonActive.cpp b/ApplicationLibCode/FileInterface/RifReaderOpmCommonActive.cpp index a68a123e7d..e0dcd10436 100644 --- a/ApplicationLibCode/FileInterface/RifReaderOpmCommonActive.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderOpmCommonActive.cpp @@ -99,15 +99,25 @@ bool RifReaderOpmCommonActive::importGrid( RigMainGrid* /* mainGrid*/, RigEclips localGrid->setGridPointDimensions( cvf::Vec3st( lgrDims[0] + 1, lgrDims[1] + 1, lgrDims[2] + 1 ) ); localGrid->setGridId( lgrIdx + 1 ); localGrid->setGridName( lgr_names[lgrIdx] ); - localGrid->setIndexToGlobalStartOfCells( totalCellCount ); + localGrid->setIndexToStartOfCells( totalCellCount ); activeGrid->addLocalGrid( localGrid ); totalCellCount += lgrGrids[lgrIdx].totalNumberOfCells(); totalNativeCellCount += lgrGrids[lgrIdx].totalActiveCells() + 1; } + activeGrid->setTotalCellCount( totalCellCount ); + // active cell information { + RigActiveCellInfo* activeCellInfo = eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL ); + RigActiveCellInfo* fractureActiveCellInfo = eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::FRACTURE_MODEL ); + + activeCellInfo->setReservoirCellCount( totalCellCount ); + fractureActiveCellInfo->setReservoirCellCount( totalCellCount ); + activeCellInfo->setGridCount( 1 + numLGRs ); + fractureActiveCellInfo->setGridCount( 1 + numLGRs ); + auto task = progInfo.task( "Getting Active Cell Information", 1 ); for ( int lgrIdx = 0; lgrIdx < numLGRs; lgrIdx++ ) @@ -122,29 +132,28 @@ bool RifReaderOpmCommonActive::importGrid( RigMainGrid* /* mainGrid*/, RigEclips updateActiveCellInfo( eclipseCaseData, opmGrid, lgrGrids, activeGrid ); } - size_t anInactiveCellIndex = activeGrid->transferActiveInformation( 0, - eclipseCaseData, - opmGrid.totalActiveCells(), - opmGrid.activeCells(), - opmGrid.activeFracCells(), - opmGrid.active_indexes(), - opmGrid.active_frac_indexes(), - 0 ); + globalMatrixActiveSize = opmGrid.activeCells(); + globalFractureActiveSize = opmGrid.activeFracCells(); + + activeCellInfo->setGridActiveCellCounts( 0, globalMatrixActiveSize ); + fractureActiveCellInfo->setGridActiveCellCounts( 0, globalFractureActiveSize ); + + transferActiveCells( opmGrid, 0, eclipseCaseData, 0, 0 ); + size_t cellCount = opmGrid.totalNumberOfCells(); for ( int lgrIdx = 0; lgrIdx < numLGRs; lgrIdx++ ) { - activeGrid->transferActiveInformation( lgrIdx + 1, - eclipseCaseData, - lgrGrids[lgrIdx].totalActiveCells(), - lgrGrids[lgrIdx].activeCells(), - lgrGrids[lgrIdx].activeFracCells(), - lgrGrids[lgrIdx].active_indexes(), - lgrGrids[lgrIdx].active_frac_indexes(), - anInactiveCellIndex ); + auto& lgrGrid = lgrGrids[lgrIdx]; + transferActiveCells( lgrGrid, cellCount, eclipseCaseData, globalMatrixActiveSize, globalFractureActiveSize ); + cellCount += lgrGrid.totalNumberOfCells(); + globalMatrixActiveSize += lgrGrid.activeCells(); + globalFractureActiveSize += lgrGrid.activeFracCells(); + activeCellInfo->setGridActiveCellCounts( lgrIdx + 1, lgrGrid.activeCells() ); + fractureActiveCellInfo->setGridActiveCellCounts( lgrIdx + 1, lgrGrid.activeFracCells() ); } - eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL )->computeDerivedData(); - eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::FRACTURE_MODEL )->computeDerivedData(); + activeCellInfo->computeDerivedData(); + fractureActiveCellInfo->computeDerivedData(); } // grid geometry @@ -158,7 +167,7 @@ bool RifReaderOpmCommonActive::importGrid( RigMainGrid* /* mainGrid*/, RigEclips bool hasParentInfo = ( lgr_parent_names.size() >= (size_t)numLGRs ); - auto task = progInfo.task( "Loading Active Cell LGR Grid Geometry ", 1 ); + auto task2 = progInfo.task( "Loading Active Cell LGR Grid Geometry ", 1 ); for ( int lgrIdx = 0; lgrIdx < numLGRs; lgrIdx++ ) { @@ -328,12 +337,11 @@ void RifReaderOpmCommonActive::transferActiveGeometry( Opm::EclIO::EGrid& opmMa for ( size_t i = 0; i < 8; i++ ) defaultCell.cornerIndices()[i] = 0; - const auto newCellCount = cellStartIndex + cellCount + 1; - activeGrid->reservoirCells().resize( newCellCount, defaultCell ); - activeGrid->reservoirCells()[newCellCount - 1].setInvalid( true ); - activeGrid->nodes().resize( (newCellCount)*8, cvf::Vec3d( 0, 0, 0 ) ); + const auto newNodeCount = nodeStartIndex + 8 * cellCount; + activeGrid->nodes().resize( newNodeCount, cvf::Vec3d( 0, 0, 0 ) ); auto& riNodes = activeGrid->nodes(); + auto& riCells = activeGrid->nativeCells(); opmGrid.loadData(); opmGrid.load_grid_data(); @@ -351,6 +359,20 @@ void RifReaderOpmCommonActive::transferActiveGeometry( Opm::EclIO::EGrid& opmMa // use same mapping as resdata const size_t cellMappingECLRi[8] = { 0, 1, 3, 2, 4, 5, 7, 6 }; + std::map activeCellMap; + int nativeIdx = 0; + + // non-parallell loop to set up and initialize things so that we can run in parallell later + for ( int opmCellIndex = 0; opmCellIndex < static_cast( opmGrid.totalNumberOfCells() ); opmCellIndex++ ) + { + if ( ( activeMatIndexes[opmCellIndex] < 0 ) && ( activeFracIndexes[opmCellIndex] < 0 ) ) continue; + + auto opmIJK = opmGrid.ijk_from_global_index( opmCellIndex ); + auto localIndex = localGrid->cellIndexFromIJK( opmIJK[0], opmIJK[1], opmIJK[2] ); + riCells[cellStartIndex + localIndex] = defaultCell; + activeCellMap[opmCellIndex] = nativeIdx++; + } + #pragma omp parallel for for ( int opmCellIndex = 0; opmCellIndex < static_cast( opmGrid.totalNumberOfCells() ); opmCellIndex++ ) { @@ -368,9 +390,9 @@ void RifReaderOpmCommonActive::transferActiveGeometry( Opm::EclIO::EGrid& opmMa yCenterCoordOpm = yCenter; } - auto nativeIndex = activeGrid->cellIndexFromIJK( opmIJK[0], opmIJK[1], opmIJK[2] ); - RigCell& cell = activeGrid->nativeCell( cellStartIndex + nativeIndex ); - cell.setGridLocalCellIndex( nativeIndex ); + auto localIndex = localGrid->cellIndexFromIJK( opmIJK[0], opmIJK[1], opmIJK[2] ); + RigCell& cell = riCells[cellStartIndex + localIndex]; + cell.setGridLocalCellIndex( localIndex ); // parent cell index if ( ( hostCellGlobalIndices.size() > (size_t)opmCellIndex ) && hostCellGlobalIndices[opmCellIndex] >= 0 ) @@ -389,7 +411,8 @@ void RifReaderOpmCommonActive::transferActiveGeometry( Opm::EclIO::EGrid& opmMa opmGrid.getCellCorners( opmCellIndex, opmX, opmY, opmZ ); // Each cell has 8 nodes, use active cell index and multiply to find first node index for cell - auto riNodeStartIndex = nodeStartIndex + nativeIndex * 8; + auto localNodeIndex = activeCellMap[opmCellIndex] * 8; + auto riNodeStartIndex = nodeStartIndex + localNodeIndex; for ( size_t opmNodeIndex = 0; opmNodeIndex < 8; opmNodeIndex++ ) { @@ -425,6 +448,4 @@ void RifReaderOpmCommonActive::transferActiveGeometry( Opm::EclIO::EGrid& opmMa cell.setInvalid( cell.isLongPyramidCell() ); } } - - if ( riNodes.size() > 1 ) riNodes[riNodes.size() - 1] = riNodes[0]; } diff --git a/ApplicationLibCode/FileInterface/RifRoffFileTools.cpp b/ApplicationLibCode/FileInterface/RifRoffFileTools.cpp index 624e80f5bb..249225ba3c 100644 --- a/ApplicationLibCode/FileInterface/RifRoffFileTools.cpp +++ b/ApplicationLibCode/FileInterface/RifRoffFileTools.cpp @@ -188,19 +188,19 @@ bool RifRoffFileTools::openGridFile( const QString& fileName, RigEclipseCaseData fractureActiveCellInfo->setReservoirCellCount( totalCellCount ); // Reserve room for the cells and nodes and fill them with data - mainGrid->globalCellArray().reserve( totalCellCount ); + mainGrid->reservoirCells().reserve( totalCellCount ); mainGrid->nodes().reserve( 8 * totalCellCount ); int progTicks = 100; caf::ProgressInfo progInfo( progTicks, "" ); int cellCount = static_cast( totalCellCount ); - size_t cellStartIndex = mainGrid->globalCellArray().size(); + size_t cellStartIndex = mainGrid->reservoirCells().size(); size_t nodeStartIndex = mainGrid->nodes().size(); RigCell defaultCell; defaultCell.setHostGrid( mainGrid ); - mainGrid->globalCellArray().resize( cellStartIndex + cellCount, defaultCell ); + mainGrid->reservoirCells().resize( cellStartIndex + cellCount, defaultCell ); mainGrid->nodes().resize( nodeStartIndex + static_cast( cellCount ) * 8, cvf::Vec3d( 0, 0, 0 ) ); @@ -220,7 +220,7 @@ bool RifRoffFileTools::openGridFile( const QString& fileName, RigEclipseCaseData #pragma omp for for ( int gridLocalCellIndex = 0; gridLocalCellIndex < cellCount; ++gridLocalCellIndex ) { - RigCell& cell = mainGrid->globalCellArray()[cellStartIndex + gridLocalCellIndex]; + RigCell& cell = mainGrid->cell( cellStartIndex + gridLocalCellIndex ); cell.setGridLocalCellIndex( gridLocalCellIndex ); diff --git a/ApplicationLibCode/ModelVisualization/Intersections/RivEclipseIntersectionGrid.cpp b/ApplicationLibCode/ModelVisualization/Intersections/RivEclipseIntersectionGrid.cpp index 04c9d8ebed..84dc54deb2 100644 --- a/ApplicationLibCode/ModelVisualization/Intersections/RivEclipseIntersectionGrid.cpp +++ b/ApplicationLibCode/ModelVisualization/Intersections/RivEclipseIntersectionGrid.cpp @@ -66,7 +66,7 @@ bool RivEclipseIntersectionGrid::useCell( size_t cellIndex ) const if ( m_intervalTool.isNumberIncluded( k ) ) { - const RigCell& cell = m_mainGrid->globalCellArray()[cellIndex]; + const RigCell& cell = m_mainGrid->cell( cellIndex ); if ( m_showInactiveCells ) return !cell.isInvalid() && ( cell.subGrid() == nullptr ); else @@ -88,7 +88,7 @@ void RivEclipseIntersectionGrid::cellCornerVertices( size_t cellIndex, cvf::Vec3 //-------------------------------------------------------------------------------------------------- void RivEclipseIntersectionGrid::cellCornerIndices( size_t cellIndex, size_t cornerIndices[8] ) const { - const std::array& cornerIndicesSource = m_mainGrid->globalCellArray()[cellIndex].cornerIndices(); + const std::array& cornerIndicesSource = m_mainGrid->cell( cellIndex ).cornerIndices(); for ( size_t i = 0; i < 8; i++ ) { diff --git a/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp index 7fe212b818..6d1ae6347f 100644 --- a/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp @@ -150,24 +150,25 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode RigActiveCellInfo* activeCellInfo = eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL ); - const std::vector& cells = eclipseCase->mainGrid()->globalCellArray(); + const auto mainGrid = eclipseCase->mainGrid(); - auto getFaceCenterAndNormal = [cells, arrowScaling, displayCordXf]( size_t globalCellIdx, - cvf::StructGridInterface::FaceType faceType, - cvf::Vec3d& faceCenter, - cvf::Vec3d& faceNormal ) + auto getFaceCenterAndNormal = [arrowScaling, displayCordXf, mainGrid]( size_t globalCellIdx, + cvf::StructGridInterface::FaceType faceType, + cvf::Vec3d& faceCenter, + cvf::Vec3d& faceNormal ) { - faceCenter = displayCordXf->transformToDisplayCoord( cells[globalCellIdx].faceCenter( faceType ) ); - cvf::Vec3d cellCenter = displayCordXf->transformToDisplayCoord( cells[globalCellIdx].center() ); + faceCenter = displayCordXf->transformToDisplayCoord( mainGrid->cell( globalCellIdx ).faceCenter( faceType ) ); + cvf::Vec3d cellCenter = displayCordXf->transformToDisplayCoord( mainGrid->cell( globalCellIdx ).center() ); faceNormal = ( faceCenter - cellCenter ).getNormalized() * arrowScaling; }; if ( !resultAddresses.empty() && !directions.empty() ) { #pragma omp parallel for - for ( int gcIdx = 0; gcIdx < static_cast( cells.size() ); ++gcIdx ) + for ( int gcIdx = 0; gcIdx < static_cast( mainGrid->totalCellCount() ); ++gcIdx ) { - if ( !cells[gcIdx].isInvalid() && activeCellInfo->isActive( gcIdx ) ) + auto& cell = mainGrid->cell( gcIdx ); + if ( !cell.isInvalid() && activeCellInfo->isActive( gcIdx ) ) { size_t resultIdx = activeCellInfo->cellResultIndex( gcIdx ); if ( result->vectorView() == RimElementVectorResult::VectorView::PER_FACE ) @@ -198,7 +199,7 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode tensorVisualizations.push_back( ElementVectorResultVisualization( faceCenter, faceNormal, resultValue, - std::cbrt( cells[gcIdx].volume() / 3.0 ), + std::cbrt( cell.volume() / 3.0 ), centerArrow ) ); } } @@ -233,10 +234,10 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode #pragma omp critical( critical_section_RivElementVectorResultPartMgr_add_2 ) tensorVisualizations.push_back( - ElementVectorResultVisualization( displayCordXf->transformToDisplayCoord( cells[gcIdx].center() ), + ElementVectorResultVisualization( displayCordXf->transformToDisplayCoord( cell.center() ), aggregatedVector, aggregatedResult.length(), - std::cbrt( cells[gcIdx].volume() / 3.0 ), + std::cbrt( cell.volume() / 3.0 ), centerArrow ) ); } } @@ -300,11 +301,12 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode } #pragma omp critical( critical_section_RivElementVectorResultPartMgr_add_nnc ) - tensorVisualizations.push_back( ElementVectorResultVisualization( displayCordXf->transformToDisplayCoord( connCenter ), - connNormal, - resultValue, - std::cbrt( cells[conn.c1GlobIdx()].volume() / 3.0 ), - centerArrow ) ); + tensorVisualizations.push_back( + ElementVectorResultVisualization( displayCordXf->transformToDisplayCoord( connCenter ), + connNormal, + resultValue, + std::cbrt( mainGrid->cell( conn.c1GlobIdx() ).volume() / 3.0 ), + centerArrow ) ); } } } diff --git a/ApplicationLibCode/ModelVisualization/RivNNCGeometryGenerator.cpp b/ApplicationLibCode/ModelVisualization/RivNNCGeometryGenerator.cpp index 8dd25a6999..e4fb7a8f82 100644 --- a/ApplicationLibCode/ModelVisualization/RivNNCGeometryGenerator.cpp +++ b/ApplicationLibCode/ModelVisualization/RivNNCGeometryGenerator.cpp @@ -77,11 +77,11 @@ void RivNNCGeometryGenerator::computeArrays() const cvf::Vec3f offset( m_offset ); long long numConnections = static_cast( m_nncIndexes.empty() ? m_nncData->allConnections().size() : m_nncIndexes.size() ); - bool isVisibilityCalcActive = m_cellVisibility.notNull() && m_grid.notNull(); - std::vector* allCells = nullptr; + bool isVisibilityCalcActive = m_cellVisibility.notNull() && m_grid.notNull(); + RigMainGrid* mainGrid = nullptr; if ( isVisibilityCalcActive ) { - allCells = &( m_grid->mainGrid()->globalCellArray() ); + mainGrid = m_grid->mainGrid(); } #pragma omp parallel for ordered @@ -104,15 +104,15 @@ void RivNNCGeometryGenerator::computeArrays() bool cell1Visible = false; bool cell2Visible = false; - if ( ( *allCells )[conn.c1GlobIdx()].hostGrid() == m_grid.p() ) + if ( mainGrid->cell( conn.c1GlobIdx() ).hostGrid() == m_grid.p() ) { - size_t cell1GridLocalIdx = ( *allCells )[conn.c1GlobIdx()].gridLocalCellIndex(); + size_t cell1GridLocalIdx = mainGrid->cell( conn.c1GlobIdx() ).gridLocalCellIndex(); cell1Visible = ( *m_cellVisibility )[cell1GridLocalIdx]; } - if ( ( *allCells )[conn.c2GlobIdx()].hostGrid() == m_grid.p() ) + if ( mainGrid->cell( conn.c2GlobIdx() ).hostGrid() == m_grid.p() ) { - size_t cell2GridLocalIdx = ( *allCells )[conn.c2GlobIdx()].gridLocalCellIndex(); + size_t cell2GridLocalIdx = mainGrid->cell( conn.c2GlobIdx() ).gridLocalCellIndex(); cell2Visible = ( *m_cellVisibility )[cell2GridLocalIdx]; } diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureContainment.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureContainment.cpp index 9301801c52..4a1277ee84 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureContainment.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureContainment.cpp @@ -93,9 +93,11 @@ bool RimFractureContainment::isEclipseCellOpenForFlow( const RigMainGrid* m { CVF_ASSERT( mainGrid ); - if ( globalCellIndex >= mainGrid->globalCellArray().size() ) return false; + if ( globalCellIndex >= mainGrid->totalCellCount() ) return false; + + auto& cell = mainGrid->cell( globalCellIndex ); + if ( cell.isInvalid() ) return false; - auto cell = mainGrid->globalCellArray()[globalCellIndex]; auto mainGridCellIndex = cell.mainGridCellIndex(); size_t i, j, k; diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp index 7a3c08ed59..7c201ab607 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp @@ -332,8 +332,7 @@ QString Rim3dOverlayInfoConfig::caseInfoText( RimEclipseView* eclipseView ) } else if ( eclipseView->mainGrid() ) { - QString totCellCount = - localeWithSpaceAsGroupSeparator.toString( static_cast( eclipseView->mainGrid()->globalCellArray().size() ) ); + QString totCellCount = localeWithSpaceAsGroupSeparator.toString( static_cast( eclipseView->mainGrid()->totalCellCount() ) ); size_t mxActCellCount = eclipseView->eclipseCase()->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL )->reservoirActiveCellCount(); diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp index 71d76103c8..4346ab9c18 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp @@ -389,7 +389,7 @@ std::vector RimEclipseContourMapProjection::findIntersectingCells( const //-------------------------------------------------------------------------------------------------- size_t RimEclipseContourMapProjection::kLayer( size_t globalCellIdx ) const { - const RigCell& cell = m_mainGrid->globalCellArray()[globalCellIdx]; + const RigCell& cell = m_mainGrid->cell( globalCellIdx ); size_t mainGridCellIdx = cell.mainGridCellIndex(); size_t i, j, k; m_mainGrid->ijkFromCellIndex( mainGridCellIdx, &i, &j, &k ); @@ -411,7 +411,7 @@ double RimEclipseContourMapProjection::calculateOverlapVolume( size_t globalCell { std::array hexCorners; - const RigCell& cell = m_mainGrid->globalCellArray()[globalCellIdx]; + const RigCell& cell = m_mainGrid->cell( globalCellIdx ); size_t localCellIdx = cell.gridLocalCellIndex(); RigGridBase* localGrid = cell.hostGrid(); @@ -437,7 +437,7 @@ double RimEclipseContourMapProjection::calculateRayLengthInCell( size_t { std::array hexCorners; - RigCell cell = m_mainGrid->globalCellArray()[globalCellIdx]; + RigCell cell = m_mainGrid->cell( globalCellIdx ); size_t localCellIdx = cell.gridLocalCellIndex(); RigGridBase* localGrid = cell.hostGrid(); diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCaseEvaluator.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCaseEvaluator.cpp index 23339631e6..bee9035cfd 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCaseEvaluator.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCaseEvaluator.cpp @@ -401,7 +401,7 @@ RimEclipseStatisticsCaseEvaluator::RimEclipseStatisticsCaseEvaluator( const std: { if ( !sourceCases.empty() ) { - m_reservoirCellCount = sourceCases[0]->eclipseCaseData()->mainGrid()->globalCellArray().size(); + m_reservoirCellCount = sourceCases[0]->eclipseCaseData()->mainGrid()->totalCellCount(); } CVF_ASSERT( m_destinationCase ); diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp index 1d3a94a9cc..85adec918a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp @@ -2345,7 +2345,7 @@ void RimEclipseView::setOverridePropertyFilterCollection( RimEclipsePropertyFilt //-------------------------------------------------------------------------------------------------- void RimEclipseView::calculateCurrentTotalCellVisibility( cvf::UByteArray* totalVisibility, int timeStep ) { - size_t cellCount = mainGrid()->globalCellArray().size(); + size_t cellCount = mainGrid()->totalCellCount(); totalVisibility->resize( cellCount ); totalVisibility->setAll( false ); @@ -2376,7 +2376,7 @@ void RimEclipseView::calculateCellVisibility( cvf::UByteArray* visibility, std:: { if ( !mainGrid() ) return; - size_t cellCount = mainGrid()->globalCellArray().size(); + size_t cellCount = mainGrid()->totalCellCount(); visibility->resize( cellCount ); visibility->setAll( false ); diff --git a/ApplicationLibCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp b/ApplicationLibCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp index 8fce6f1add..b945e5f3e4 100644 --- a/ApplicationLibCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp @@ -267,8 +267,8 @@ void RimIdenticalGridCaseGroup::computeUnionOfActiveCells() return; } - m_unionOfMatrixActiveCells->setReservoirCellCount( m_mainGrid->globalCellArray().size() ); - m_unionOfFractureActiveCells->setReservoirCellCount( m_mainGrid->globalCellArray().size() ); + m_unionOfMatrixActiveCells->setReservoirCellCount( m_mainGrid->totalCellCount() ); + m_unionOfFractureActiveCells->setReservoirCellCount( m_mainGrid->totalCellCount() ); m_unionOfMatrixActiveCells->setGridCount( m_mainGrid->gridCount() ); m_unionOfFractureActiveCells->setGridCount( m_mainGrid->gridCount() ); diff --git a/ApplicationLibCode/ReservoirDataModel/Completions/RigEclipseToStimPlanCellTransmissibilityCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/Completions/RigEclipseToStimPlanCellTransmissibilityCalculator.cpp index e4a6fc7742..499e6eb14a 100644 --- a/ApplicationLibCode/ReservoirDataModel/Completions/RigEclipseToStimPlanCellTransmissibilityCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/Completions/RigEclipseToStimPlanCellTransmissibilityCalculator.cpp @@ -276,7 +276,7 @@ void RigEclipseToStimPlanCellTransmissibilityCalculator::calculateStimPlanCellsM { // Use main grid cell to evaluate if a cell is active or not. // All cells in temporary grids are active - const RigCell& cell = mainGrid->globalCellArray()[reservoirCellIndex]; + const RigCell& cell = mainGrid->cell( reservoirCellIndex ); size_t mainGridReservoirIndex = cell.mainGridCellIndex(); if ( !activeCellInfo->isActive( mainGridReservoirIndex ) ) @@ -358,7 +358,8 @@ std::vector std::vector cellIndicesToLeafCells; for ( const size_t& index : cellIndices ) { - const RigCell& cell = mainGrid->globalCellArray()[index]; + const RigCell& cell = mainGrid->cell( index ); + if ( cell.isInvalid() ) continue; if ( !cell.subGrid() ) { cellIndicesToLeafCells.push_back( index ); diff --git a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigCellVolumeResultCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigCellVolumeResultCalculator.cpp index 99ba1fcbb2..9880ee2982 100644 --- a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigCellVolumeResultCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigCellVolumeResultCalculator.cpp @@ -73,13 +73,13 @@ void RigCellVolumeResultCalculator::calculate( const RigEclipseResultAddress& re cellVolumeResults.resize( cellResultCount, std::numeric_limits::infinity() ); #pragma omp parallel for - for ( int nativeResvCellIndex = 0; nativeResvCellIndex < static_cast( m_resultsData->m_ownerMainGrid->globalCellArray().size() ); + for ( int nativeResvCellIndex = 0; nativeResvCellIndex < static_cast( m_resultsData->m_ownerMainGrid->totalCellCount() ); nativeResvCellIndex++ ) { size_t resultIndex = m_resultsData->activeCellInfo()->cellResultIndex( nativeResvCellIndex ); if ( resultIndex != cvf::UNDEFINED_SIZE_T ) { - const RigCell& cell = m_resultsData->m_ownerMainGrid->globalCellArray()[nativeResvCellIndex]; + const RigCell& cell = m_resultsData->m_ownerMainGrid->cell( nativeResvCellIndex ); if ( !cell.subGrid() ) { cellVolumeResults[resultIndex] = cell.volume(); diff --git a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigFaultDistanceResultCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigFaultDistanceResultCalculator.cpp index dda128be9d..3d7aa28b64 100644 --- a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigFaultDistanceResultCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigFaultDistanceResultCalculator.cpp @@ -78,9 +78,8 @@ void RigFaultDistanceResultCalculator::calculate( const RigEclipseResultAddress& if ( !shouldCompute ) return; - const std::vector& globalCellArray = m_resultsData->m_ownerMainGrid->globalCellArray(); - - long long numCells = static_cast( globalCellArray.size() ); + const auto mainGrid = m_resultsData->m_ownerMainGrid; + long long numCells = static_cast( mainGrid->totalCellCount() ); std::vector faceTypes = cvf::StructGridInterface::validFaceTypes(); @@ -90,7 +89,8 @@ void RigFaultDistanceResultCalculator::calculate( const RigEclipseResultAddress& { if ( m_resultsData->activeCellInfo()->isActive( cellIdx ) ) { - const RigCell& cell = globalCellArray[cellIdx]; + const RigCell& cell = mainGrid->cell( cellIdx ); + if ( cell.isInvalid() ) continue; for ( auto faceType : faceTypes ) { if ( m_resultsData->m_ownerMainGrid->findFaultFromCellIndexAndCellFace( cellIdx, faceType ) ) @@ -124,7 +124,8 @@ void RigFaultDistanceResultCalculator::calculate( const RigEclipseResultAddress& #pragma omp parallel for for ( long long cellIdx = 0; cellIdx < numCells; cellIdx++ ) { - const RigCell& cell = globalCellArray[cellIdx]; + const RigCell& cell = mainGrid->cell( cellIdx ); + if ( cell.isInvalid() ) continue; size_t resultIndex = cellIdx; if ( resultIndex == cvf::UNDEFINED_SIZE_T || !m_resultsData->activeCellInfo()->isActive( cellIdx ) ) continue; diff --git a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigIndexIjkResultCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigIndexIjkResultCalculator.cpp index 149acb395f..76b3650ce9 100644 --- a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigIndexIjkResultCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigIndexIjkResultCalculator.cpp @@ -98,12 +98,13 @@ void RigIndexIjkResultCalculator::calculate( const RigEclipseResultAddress& resV if ( !( computeIndexI || computeIndexJ || computeIndexK ) ) return; - const std::vector& globalCellArray = m_resultsData->m_ownerMainGrid->globalCellArray(); - long long numCells = static_cast( globalCellArray.size() ); + const auto mainGrid = m_resultsData->m_ownerMainGrid; + long long numCells = static_cast( mainGrid->totalCellCount() ); + #pragma omp parallel for for ( long long cellIdx = 0; cellIdx < numCells; cellIdx++ ) { - const RigCell& cell = globalCellArray[cellIdx]; + const RigCell& cell = mainGrid->cell( cellIdx ); size_t resultIndex = cellIdx; if ( resultIndex == cvf::UNDEFINED_SIZE_T ) continue; diff --git a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigOilVolumeResultCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigOilVolumeResultCalculator.cpp index 676104b3e3..1797755221 100644 --- a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigOilVolumeResultCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigOilVolumeResultCalculator.cpp @@ -74,7 +74,7 @@ void RigOilVolumeResultCalculator::calculate( const RigEclipseResultAddress& res oilVolumeResults.resize( cellResultCount, 0u ); #pragma omp parallel for - for ( int nativeResvCellIndex = 0; nativeResvCellIndex < static_cast( m_resultsData->m_ownerMainGrid->globalCellArray().size() ); + for ( int nativeResvCellIndex = 0; nativeResvCellIndex < static_cast( m_resultsData->m_ownerMainGrid->totalCellCount() ); nativeResvCellIndex++ ) { size_t resultIndex = m_resultsData->activeCellInfo()->cellResultIndex( nativeResvCellIndex ); diff --git a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigPorvSoilSgasResultCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigPorvSoilSgasResultCalculator.cpp index 579f4814d6..64895f8284 100644 --- a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigPorvSoilSgasResultCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigPorvSoilSgasResultCalculator.cpp @@ -124,7 +124,7 @@ void RigPorvSoilSgasResultCalculator::calculate( const RigEclipseResultAddress& bool res2ActiveOnly = in2Results.size() == activeCellCount; #pragma omp parallel for - for ( int nativeResvCellIndex = 0; nativeResvCellIndex < static_cast( m_resultsData->m_ownerMainGrid->globalCellArray().size() ); + for ( int nativeResvCellIndex = 0; nativeResvCellIndex < static_cast( m_resultsData->m_ownerMainGrid->totalCellCount() ); nativeResvCellIndex++ ) { size_t resultIndex = m_resultsData->activeCellInfo()->cellResultIndex( nativeResvCellIndex ); diff --git a/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.cpp b/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.cpp index f1c7e36617..8148c1ed06 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.cpp @@ -26,6 +26,10 @@ //-------------------------------------------------------------------------------------------------- RigActiveCellGrid::RigActiveCellGrid() { + m_invalidCell.setInvalid( true ); + for ( size_t i = 0; i < 8; i++ ) + m_invalidCell.cornerIndices()[i] = 0; + m_invalidCell.setHostGrid( this ); } //-------------------------------------------------------------------------------------------------- @@ -35,116 +39,129 @@ RigActiveCellGrid::~RigActiveCellGrid() { } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RigActiveCellGrid::transferActiveInformation( RigEclipseCaseData* eclipseCaseData, - size_t totalActiveCells, - size_t matrixActiveCells, - size_t fractureActiveCells, - const std::vector& activeMatrixIndexes, - const std::vector& activeFracIndexes ) -{ - const auto totalCells = activeMatrixIndexes.size(); +////-------------------------------------------------------------------------------------------------- +///// +////-------------------------------------------------------------------------------------------------- +// size_t RigActiveCellGrid::transferActiveInformation( int gridIndex, +// RigEclipseCaseData* eclipseCaseData, +// size_t totalActiveCells, +// size_t matrixActiveCells, +// size_t fractureActiveCells, +// const std::vector& activeMatrixIndexes, +// const std::vector& activeFracIndexes, +// size_t inactiveCellIndex ) +//{ +// if ( gridIndex == 0 ) +// { +// m_globalToNativeMap.clear(); +// inactiveCellIndex = 0; +// } +// +// const auto totalCells = activeMatrixIndexes.size(); +// +// const auto cellStartIndex = m_globalToNativeMap.size(); +// +// m_globalToNativeMap.resize( cellStartIndex + totalCells ); +// size_t activeCells = cellStartIndex; +// size_t anInactiveCellIdx = inactiveCellIndex; +// +// for ( size_t i = 0; i < totalCells; i++ ) +// { +// const auto globalCellIndex = cellStartIndex + i; +// if ( ( activeMatrixIndexes[i] < 0 ) && ( activeFracIndexes[i] < 0 ) ) +// { +// m_globalToNativeMap[globalCellIndex] = totalActiveCells; +// anInactiveCellIdx = globalCellIndex; +// continue; +// } +// m_nativeToGlobalMap.push_back( globalCellIndex ); +// m_globalToNativeMap[i] = activeCells++; +// } +// m_nativeToGlobalMap.push_back( anInactiveCellIdx ); +// +// RigActiveCellInfo* activeCellInfo = eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL ); +// RigActiveCellInfo* fractureActiveCellInfo = eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::FRACTURE_MODEL ); +// +// activeCellInfo->setReservoirCellCount( activeCellInfo->reservoirCellCount() + totalActiveCells + 1 ); +// fractureActiveCellInfo->setReservoirCellCount( fractureActiveCellInfo->reservoirCellCount() + totalActiveCells + 1 ); +// +// activeCellInfo->setGridCount( gridIndex + 1 ); +// fractureActiveCellInfo->setGridCount( gridIndex + 1 ); +// +// activeCellInfo->setGridActiveCellCounts( gridIndex, matrixActiveCells ); +// fractureActiveCellInfo->setGridActiveCellCounts( gridIndex, fractureActiveCells ); +// +// // TODO - update indexes here +// +// #pragma omp parallel for +// for ( int opmCellIndex = 0; opmCellIndex < (int)totalCells; opmCellIndex++ ) +// { +// auto activeCellIndex = m_globalToNativeMap[cellStartIndex + opmCellIndex]; +// +// // active cell index +// int matrixActiveIndex = activeMatrixIndexes[opmCellIndex]; +// if ( matrixActiveIndex != -1 ) +// { +// activeCellInfo->setCellResultIndex( activeCellIndex, matrixActiveIndex ); +// } +// +// int fractureActiveIndex = activeFracIndexes[opmCellIndex]; +// if ( fractureActiveIndex != -1 ) +// { +// fractureActiveCellInfo->setCellResultIndex( activeCellIndex, fractureActiveIndex ); +// } +// } +// +// return anInactiveCellIdx; +// } - m_globalToActiveMap.resize( totalCells ); - size_t activeCells = 0; - size_t anInactiveCellIdx = 0; - - for ( size_t i = 0; i < totalCells; i++ ) - { - if ( ( activeMatrixIndexes[i] < 0 ) && ( activeFracIndexes[i] < 0 ) ) - { - m_globalToActiveMap[i] = totalActiveCells; - anInactiveCellIdx = i; - continue; - } - m_activeToGlobalMap.push_back( i ); - m_globalToActiveMap[i] = activeCells++; - } - m_activeToGlobalMap.push_back( anInactiveCellIdx ); - - RigActiveCellInfo* activeCellInfo = eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL ); - RigActiveCellInfo* fractureActiveCellInfo = eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::FRACTURE_MODEL ); - - activeCellInfo->setReservoirCellCount( totalActiveCells + 1 ); - fractureActiveCellInfo->setReservoirCellCount( totalActiveCells + 1 ); - - activeCellInfo->setGridCount( 1 ); - fractureActiveCellInfo->setGridCount( 1 ); - - activeCellInfo->setGridActiveCellCounts( 0, matrixActiveCells ); - fractureActiveCellInfo->setGridActiveCellCounts( 0, fractureActiveCells ); - -#pragma omp parallel for - for ( int opmCellIndex = 0; opmCellIndex < (int)totalCells; opmCellIndex++ ) - { - auto activeCellIndex = m_globalToActiveMap[opmCellIndex]; - - // active cell index - int matrixActiveIndex = activeMatrixIndexes[opmCellIndex]; - if ( matrixActiveIndex != -1 ) - { - activeCellInfo->setCellResultIndex( activeCellIndex, matrixActiveIndex ); - } - - int fractureActiveIndex = activeFracIndexes[opmCellIndex]; - if ( fractureActiveIndex != -1 ) - { - fractureActiveCellInfo->setCellResultIndex( activeCellIndex, fractureActiveIndex ); - } - } - - activeCellInfo->computeDerivedData(); - fractureActiveCellInfo->computeDerivedData(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -size_t RigActiveCellGrid::cellIndexFromIJK( size_t i, size_t j, size_t k ) const -{ - auto index = RigGridBase::cellIndexFromIJK( i, j, k ); - return m_globalToActiveMap[index]; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -size_t RigActiveCellGrid::cellIndexFromIJKUnguarded( size_t i, size_t j, size_t k ) const -{ - auto index = RigGridBase::cellIndexFromIJKUnguarded( i, j, k ); - return m_globalToActiveMap[index]; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RigActiveCellGrid::ijkFromCellIndex( size_t cellIndex, size_t* i, size_t* j, size_t* k ) const -{ - if ( cellIndex >= m_activeToGlobalMap.size() ) - { - return false; - } - auto index = m_activeToGlobalMap[cellIndex]; - return RigGridBase::ijkFromCellIndex( index, i, j, k ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RigActiveCellGrid::ijkFromCellIndexUnguarded( size_t cellIndex, size_t* i, size_t* j, size_t* k ) const -{ - auto index = m_activeToGlobalMap[cellIndex]; - RigGridBase::ijkFromCellIndexUnguarded( index, i, j, k ); -} +////-------------------------------------------------------------------------------------------------- +///// +////-------------------------------------------------------------------------------------------------- +// size_t RigActiveCellGrid::cellIndexFromIJK( size_t i, size_t j, size_t k ) const +//{ +// auto index = RigGridBase::cellIndexFromIJK( i, j, k ); +// return m_globalToActiveMap[index]; +// } +// +////-------------------------------------------------------------------------------------------------- +///// +////-------------------------------------------------------------------------------------------------- +// size_t RigActiveCellGrid::cellIndexFromIJKUnguarded( size_t i, size_t j, size_t k ) const +//{ +// auto index = RigGridBase::cellIndexFromIJKUnguarded( i, j, k ); +// return m_globalToActiveMap[index]; +// } +// +////-------------------------------------------------------------------------------------------------- +///// +////-------------------------------------------------------------------------------------------------- +// bool RigActiveCellGrid::ijkFromCellIndex( size_t cellIndex, size_t* i, size_t* j, size_t* k ) const +//{ +// if ( cellIndex >= m_activeToGlobalMap.size() ) +// { +// return false; +// } +// auto index = m_activeToGlobalMap[cellIndex]; +// return RigGridBase::ijkFromCellIndex( index, i, j, k ); +// } +// +////-------------------------------------------------------------------------------------------------- +///// +////-------------------------------------------------------------------------------------------------- +// void RigActiveCellGrid::ijkFromCellIndexUnguarded( size_t cellIndex, size_t* i, size_t* j, size_t* k ) const +//{ +// auto index = m_activeToGlobalMap[cellIndex]; +// RigGridBase::ijkFromCellIndexUnguarded( index, i, j, k ); +// } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RigCell& RigActiveCellGrid::cell( size_t gridLocalCellIndex ) { - return m_cells[gridLocalCellIndex]; + if ( m_nativeCells.contains( gridLocalCellIndex ) ) return m_nativeCells[gridLocalCellIndex]; + return m_invalidCell; } //-------------------------------------------------------------------------------------------------- @@ -152,13 +169,38 @@ RigCell& RigActiveCellGrid::cell( size_t gridLocalCellIndex ) //-------------------------------------------------------------------------------------------------- const RigCell& RigActiveCellGrid::cell( size_t gridLocalCellIndex ) const { - return m_cells[gridLocalCellIndex]; + if ( m_nativeCells.contains( gridLocalCellIndex ) ) return m_nativeCells.at( gridLocalCellIndex ); + return m_invalidCell; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -size_t RigActiveCellGrid::cellCount() const +std::map& RigActiveCellGrid::nativeCells() { - return m_cells.size(); + return m_nativeCells; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const std::map& RigActiveCellGrid::nativeCells() const +{ + return m_nativeCells; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +size_t RigActiveCellGrid::totalCellCount() const +{ + return m_totalCellCount; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigActiveCellGrid::setTotalCellCount( size_t totalCellCount ) +{ + m_totalCellCount = totalCellCount; } diff --git a/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h b/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h index c1fda83d89..26ad0464e0 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h +++ b/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h @@ -28,25 +28,35 @@ public: RigActiveCellGrid(); ~RigActiveCellGrid() override; - void transferActiveInformation( RigEclipseCaseData* eclipseCaseData, - size_t totalActiveCells, - size_t matrixActiveCells, - size_t fractureActiveCells, - const std::vector& activeMatrixIndexes, - const std::vector& activeFracIndexes ); + // size_t transferActiveInformation( int gridIndex, + // RigEclipseCaseData* eclipseCaseData, + // size_t totalActiveCells, + // size_t matrixActiveCells, + // size_t fractureActiveCells, + // const std::vector& activeMatrixIndexes, + // const std::vector& activeFracIndexes, + // size_t inactiveCellIndex ); - size_t cellIndexFromIJK( size_t i, size_t j, size_t k ) const override; - size_t cellIndexFromIJKUnguarded( size_t i, size_t j, size_t k ) const override; - bool ijkFromCellIndex( size_t cellIndex, size_t* i, size_t* j, size_t* k ) const override; - void ijkFromCellIndexUnguarded( size_t cellIndex, size_t* i, size_t* j, size_t* k ) const override; + // size_t cellIndexFromIJK( size_t i, size_t j, size_t k ) const override; + // size_t cellIndexFromIJKUnguarded( size_t i, size_t j, size_t k ) const override; + // bool ijkFromCellIndex( size_t cellIndex, size_t* i, size_t* j, size_t* k ) const override; + // void ijkFromCellIndexUnguarded( size_t cellIndex, size_t* i, size_t* j, size_t* k ) const override; RigCell& cell( size_t gridLocalCellIndex ) override; const RigCell& cell( size_t gridLocalCellIndex ) const override; - size_t cellCount() const override; + // size_t cellCount() const override; + + size_t totalCellCount() const override; + +public: // only for use by file readers! + std::map& nativeCells(); + const std::map& nativeCells() const; + void setTotalCellCount( size_t totalCellCount ); private: - std::vector m_globalToActiveMap; - std::vector m_activeToGlobalMap; - RigCell m_invalidCell; - std::map m_cells; + // std::vector m_globalToNativeMap; + // std::vector m_nativeToGlobalMap; + size_t m_totalCellCount; + RigCell m_invalidCell; + std::map m_nativeCells; }; diff --git a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp index 699df7819c..9dcd532981 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp @@ -514,7 +514,7 @@ bool RigCaseCellResultsData::isUsingGlobalActiveIndex( const RigEclipseResultAdd if ( m_cellScalarResults[scalarResultIndex].empty() ) return true; size_t firstTimeStepResultValueCount = m_cellScalarResults[scalarResultIndex][0].size(); - return firstTimeStepResultValueCount != m_ownerMainGrid->globalCellArray().size(); + return firstTimeStepResultValueCount != m_ownerMainGrid->totalCellCount(); } //-------------------------------------------------------------------------------------------------- @@ -1895,9 +1895,9 @@ void RigCaseCellResultsData::computeDepthRelatedResults() } #pragma omp parallel for - for ( long cellIdx = 0; cellIdx < static_cast( m_ownerMainGrid->globalCellArray().size() ); cellIdx++ ) + for ( long cellIdx = 0; cellIdx < static_cast( m_ownerMainGrid->totalCellCount() ); cellIdx++ ) { - const RigCell& cell = m_ownerMainGrid->globalCellArray()[cellIdx]; + const RigCell& cell = m_ownerMainGrid->cell( cellIdx ); size_t resultIndex = activeCellInfo()->cellResultIndex( cellIdx ); if ( resultIndex == cvf::UNDEFINED_SIZE_T ) continue; @@ -2160,14 +2160,14 @@ void RigCaseCellResultsData::computeRiTransComponent( const QString& riTransComp const std::vector& nodes = m_ownerMainGrid->nodes(); bool isFaceNormalsOutwards = m_ownerMainGrid->isFaceNormalsOutwards(); - for ( size_t nativeResvCellIndex = 0; nativeResvCellIndex < m_ownerMainGrid->globalCellArray().size(); nativeResvCellIndex++ ) + for ( size_t nativeResvCellIndex = 0; nativeResvCellIndex < m_ownerMainGrid->totalCellCount(); nativeResvCellIndex++ ) { // Do nothing if we are only dealing with active cells, and this cell is not active: size_t tranResIdx = ( *riTranIdxFunc )( activeCellInfo, nativeResvCellIndex ); if ( tranResIdx == cvf::UNDEFINED_SIZE_T ) continue; - const RigCell& nativeCell = m_ownerMainGrid->globalCellArray()[nativeResvCellIndex]; + const RigCell& nativeCell = m_ownerMainGrid->cell( nativeResvCellIndex ); RigGridBase* grid = nativeCell.hostGrid(); size_t gridLocalNativeCellIndex = nativeCell.gridLocalCellIndex(); @@ -2179,7 +2179,7 @@ void RigCaseCellResultsData::computeRiTransComponent( const QString& riTransComp if ( grid->cellIJKNeighbor( i, j, k, faceId, &gridLocalNeighborCellIdx ) ) { size_t neighborResvCellIdx = grid->reservoirCellIndex( gridLocalNeighborCellIdx ); - const RigCell& neighborCell = m_ownerMainGrid->globalCellArray()[neighborResvCellIdx]; + const RigCell& neighborCell = m_ownerMainGrid->cell( neighborResvCellIdx ); // Do nothing if neighbor cell has no results size_t neighborCellPermResIdx = ( *permIdxFunc )( activeCellInfo, neighborResvCellIdx ); @@ -2351,8 +2351,8 @@ void RigCaseCellResultsData::computeNncCombRiTrans() size_t neighborCellPermResIdx = ( *permIdxFunc )( activeCellInfo, neighborResvCellIdx ); if ( neighborCellPermResIdx == cvf::UNDEFINED_SIZE_T ) continue; - const RigCell& nativeCell = m_ownerMainGrid->globalCellArray()[nativeResvCellIndex]; - const RigCell& neighborCell = m_ownerMainGrid->globalCellArray()[neighborResvCellIdx]; + const RigCell& nativeCell = m_ownerMainGrid->cell( nativeResvCellIndex ); + const RigCell& neighborCell = m_ownerMainGrid->cell( neighborResvCellIdx ); // Connection geometry @@ -2595,14 +2595,14 @@ void RigCaseCellResultsData::computeRiTRANSbyAreaComponent( const QString& riTra const RigActiveCellInfo* activeCellInfo = this->activeCellInfo(); const std::vector& nodes = m_ownerMainGrid->nodes(); - for ( size_t nativeResvCellIndex = 0; nativeResvCellIndex < m_ownerMainGrid->globalCellArray().size(); nativeResvCellIndex++ ) + for ( size_t nativeResvCellIndex = 0; nativeResvCellIndex < m_ownerMainGrid->totalCellCount(); nativeResvCellIndex++ ) { // Do nothing if we are only dealing with active cells, and this cell is not active: size_t nativeCellResValIdx = ( *resValIdxFunc )( activeCellInfo, nativeResvCellIndex ); if ( nativeCellResValIdx == cvf::UNDEFINED_SIZE_T ) continue; - const RigCell& nativeCell = m_ownerMainGrid->globalCellArray()[nativeResvCellIndex]; + const RigCell& nativeCell = m_ownerMainGrid->cell( nativeResvCellIndex ); RigGridBase* grid = nativeCell.hostGrid(); size_t gridLocalNativeCellIndex = nativeCell.gridLocalCellIndex(); @@ -2614,7 +2614,7 @@ void RigCaseCellResultsData::computeRiTRANSbyAreaComponent( const QString& riTra if ( grid->cellIJKNeighbor( i, j, k, faceId, &gridLocalNeighborCellIdx ) ) { size_t neighborResvCellIdx = grid->reservoirCellIndex( gridLocalNeighborCellIdx ); - const RigCell& neighborCell = m_ownerMainGrid->globalCellArray()[neighborResvCellIdx]; + const RigCell& neighborCell = m_ownerMainGrid->cell( neighborResvCellIdx ); // Connection geometry @@ -2690,7 +2690,7 @@ void RigCaseCellResultsData::computeCompletionTypeForTimeStep( size_t timeStep ) std::vector& completionTypeResult = m_cellScalarResults[completionTypeResultIndex][timeStep]; - size_t resultValues = m_ownerMainGrid->globalCellArray().size(); + size_t resultValues = m_ownerMainGrid->totalCellCount(); if ( completionTypeResult.size() == resultValues ) { @@ -2831,7 +2831,7 @@ void RigCaseCellResultsData::setActiveFormationNames( RigFormationNames* activeF return; } - size_t totalGlobCellCount = m_ownerMainGrid->globalCellArray().size(); + size_t totalGlobCellCount = m_ownerMainGrid->totalCellCount(); addStaticScalarResult( RiaDefines::ResultCatType::FORMATION_NAMES, RiaResultNames::activeFormationNamesResultName(), false, totalGlobCellCount ); std::vector* fnData = modifiableCellScalarResult( RigEclipseResultAddress( RiaDefines::ResultCatType::FORMATION_NAMES, @@ -2867,7 +2867,7 @@ void RigCaseCellResultsData::setActiveFormationNames( RigFormationNames* activeF for ( size_t cIdx = localCellCount; cIdx < totalGlobCellCount; ++cIdx ) { - size_t mgrdCellIdx = m_ownerMainGrid->globalCellArray()[cIdx].mainGridCellIndex(); + size_t mgrdCellIdx = m_ownerMainGrid->cell( cIdx ).mainGridCellIndex(); size_t i( cvf::UNDEFINED_SIZE_T ), j( cvf::UNDEFINED_SIZE_T ), k( cvf::UNDEFINED_SIZE_T ); diff --git a/ApplicationLibCode/ReservoirDataModel/RigCaseToCaseCellMapper.cpp b/ApplicationLibCode/ReservoirDataModel/RigCaseToCaseCellMapper.cpp index 356651abce..dda55cbab5 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigCaseToCaseCellMapper.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigCaseToCaseCellMapper.cpp @@ -33,7 +33,7 @@ RigCaseToCaseCellMapper::RigCaseToCaseCellMapper( RigMainGrid* masterEclGrid, Ri , m_masterFemPart( nullptr ) , m_dependentFemPart( nullptr ) { - m_masterCellOrIntervalIndex.resize( dependentEclGrid->globalCellArray().size(), cvf::UNDEFINED_INT ); + m_masterCellOrIntervalIndex.resize( dependentEclGrid->totalCellCount(), cvf::UNDEFINED_INT ); } //-------------------------------------------------------------------------------------------------- @@ -45,7 +45,7 @@ RigCaseToCaseCellMapper::RigCaseToCaseCellMapper( RigFemPart* masterFemPart, Rig , m_masterFemPart( masterFemPart ) , m_dependentFemPart( nullptr ) { - m_masterCellOrIntervalIndex.resize( dependentEclGrid->globalCellArray().size(), cvf::UNDEFINED_INT ); + m_masterCellOrIntervalIndex.resize( dependentEclGrid->totalCellCount(), cvf::UNDEFINED_INT ); calculateEclToGeomCellMapping( dependentEclGrid, masterFemPart, false ); } diff --git a/ApplicationLibCode/ReservoirDataModel/RigCaseToCaseCellMapperTools.cpp b/ApplicationLibCode/ReservoirDataModel/RigCaseToCaseCellMapperTools.cpp index 7c334efb48..902895420f 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigCaseToCaseCellMapperTools.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigCaseToCaseCellMapperTools.cpp @@ -51,7 +51,7 @@ public: if ( offsetK > 0 && m_baseK == m_mainGrid->cellCountK() - 1 ) return nullptr; size_t gridLocalCellIndex = m_mainGrid->cellIndexFromIJK( m_baseI + offsetI, m_baseJ + offsetJ, m_baseK + offsetK ); - const RigCell& cell = m_mainGrid->globalCellArray()[gridLocalCellIndex]; + const RigCell& cell = m_mainGrid->cell( gridLocalCellIndex ); return &( cell.cornerIndices() ); } diff --git a/ApplicationLibCode/ReservoirDataModel/RigCaseToCaseRangeFilterMapper.cpp b/ApplicationLibCode/ReservoirDataModel/RigCaseToCaseRangeFilterMapper.cpp index f69eaa0933..cf123bddee 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigCaseToCaseRangeFilterMapper.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigCaseToCaseRangeFilterMapper.cpp @@ -373,7 +373,7 @@ RigCaseToCaseRangeFilterMapper::CellMatchType RigCaseToCaseRangeFilterMapper::fi size_t cellIdx = masterEclGrid->cellIndexFromIJK( ei, ej, ek ); - bool isCollapsedCell = masterEclGrid->globalCellArray()[cellIdx].isCollapsedCell(); + bool isCollapsedCell = masterEclGrid->cell( cellIdx ).isCollapsedCell(); cvf::Vec3d geoMechConvertedEclCell[8]; RigCaseToCaseCellMapperTools::estimatedFemCellFromEclCell( masterEclGrid, cellIdx, geoMechConvertedEclCell ); @@ -512,7 +512,7 @@ RigCaseToCaseRangeFilterMapper::CellMatchType RigCaseToCaseRangeFilterMapper::fi if ( globCellIdxToBestMatch != cvf::UNDEFINED_SIZE_T ) { masterEclGrid->ijkFromCellIndex( globCellIdxToBestMatch, ei, ej, ek ); - isCollapsedCell = masterEclGrid->globalCellArray()[globCellIdxToBestMatch].isCollapsedCell(); + isCollapsedCell = masterEclGrid->cell( globCellIdxToBestMatch ).isCollapsedCell(); } else { diff --git a/ApplicationLibCode/ReservoirDataModel/RigCellFaceGeometryTools.cpp b/ApplicationLibCode/ReservoirDataModel/RigCellFaceGeometryTools.cpp index e01fc78421..ab46f6fda0 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigCellFaceGeometryTools.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigCellFaceGeometryTools.cpp @@ -229,7 +229,7 @@ void RigCellFaceGeometryTools::extractConnectionsForFace( const RigFault::FaultF cvf::BoundingBox bb; std::array sourceFaceIndices; - mainGrid->globalCellArray()[sourceReservoirCellIndex].faceIndices( sourceCellFace, &sourceFaceIndices ); + mainGrid->cell( sourceReservoirCellIndex ).faceIndices( sourceCellFace, &sourceFaceIndices ); bb.add( mainGridNodes[sourceFaceIndices[0]] ); bb.add( mainGridNodes[sourceFaceIndices[1]] ); @@ -333,7 +333,7 @@ void RigCellFaceGeometryTools::extractConnectionsForFace( const RigFault::FaultF std::vector intersections; std::array candidateFaceIndices; - mainGrid->globalCellArray()[candidateCellIndex].faceIndices( candidateFace, &candidateFaceIndices ); + mainGrid->cell( candidateCellIndex ).faceIndices( candidateFace, &candidateFaceIndices ); bool foundOverlap = cvf::GeometryTools::calculateOverlapPolygonOfTwoQuads( &polygon, &intersections, diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseWellLogExtractor.cpp b/ApplicationLibCode/ReservoirDataModel/RigEclipseWellLogExtractor.cpp index 88d02f9312..9f74e09437 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigEclipseWellLogExtractor.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigEclipseWellLogExtractor.cpp @@ -77,7 +77,7 @@ void RigEclipseWellLogExtractor::calculateIntersection() cvf::Vec3d hexCorners[8]; for ( const auto& globalCellIndex : closeCellIndices ) { - const RigCell& cell = m_caseData->mainGrid()->globalCellArray()[globalCellIndex]; + const RigCell& cell = m_caseData->mainGrid()->cell( globalCellIndex ); if ( cell.isInvalid() || cell.subGrid() != nullptr ) continue; @@ -123,7 +123,7 @@ void RigEclipseWellLogExtractor::calculateIntersection() cvf::Vec3d hexCorners[8]; for ( const auto& globalCellIndex : closeCellIndices ) { - const RigCell& cell = m_caseData->mainGrid()->globalCellArray()[globalCellIndex]; + const RigCell& cell = m_caseData->mainGrid()->cell( globalCellIndex ); if ( cell.isInvalid() ) continue; diff --git a/ApplicationLibCode/ReservoirDataModel/RigGridBase.cpp b/ApplicationLibCode/ReservoirDataModel/RigGridBase.cpp index 19d88793b8..601633f735 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigGridBase.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigGridBase.cpp @@ -84,9 +84,9 @@ RigCell& RigGridBase::cell( size_t gridLocalCellIndex ) { CVF_ASSERT( m_mainGrid ); - CVF_ASSERT( m_indexToStartOfCells + gridLocalCellIndex < m_mainGrid->globalCellArray().size() ); + CVF_ASSERT( m_indexToStartOfCells + gridLocalCellIndex < m_mainGrid->reservoirCells().size() ); - return m_mainGrid->globalCellArray()[m_indexToStartOfCells + gridLocalCellIndex]; + return m_mainGrid->reservoirCells()[m_indexToStartOfCells + gridLocalCellIndex]; } //-------------------------------------------------------------------------------------------------- @@ -96,7 +96,7 @@ const RigCell& RigGridBase::cell( size_t gridLocalCellIndex ) const { CVF_ASSERT( m_mainGrid ); - return m_mainGrid->globalCellArray()[m_indexToStartOfCells + gridLocalCellIndex]; + return m_mainGrid->reservoirCells()[m_indexToStartOfCells + gridLocalCellIndex]; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ReservoirDataModel/RigMainGrid.cpp b/ApplicationLibCode/ReservoirDataModel/RigMainGrid.cpp index 62a351de75..b8fbf88406 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigMainGrid.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigMainGrid.cpp @@ -74,7 +74,15 @@ const std::vector& RigMainGrid::nodes() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector& RigMainGrid::globalCellArray() +size_t RigMainGrid::totalCellCount() const +{ + return m_cells.size(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector& RigMainGrid::reservoirCells() { return m_cells; } @@ -82,7 +90,7 @@ std::vector& RigMainGrid::globalCellArray() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -const std::vector& RigMainGrid::globalCellArray() const +const std::vector& RigMainGrid::reservoirCells() const { return m_cells; } @@ -92,9 +100,9 @@ const std::vector& RigMainGrid::globalCellArray() const //-------------------------------------------------------------------------------------------------- RigGridBase* RigMainGrid::gridAndGridLocalIdxFromGlobalCellIdx( size_t globalCellIdx, size_t* gridLocalCellIdx ) { - CVF_ASSERT( globalCellIdx < m_cells.size() ); + CVF_ASSERT( globalCellIdx < totalCellCount() ); - const RigCell& cell = m_cells[globalCellIdx]; + const RigCell& cell = this->cell( globalCellIdx ); RigGridBase* hostGrid = cell.hostGrid(); CVF_ASSERT( hostGrid ); @@ -111,9 +119,9 @@ RigGridBase* RigMainGrid::gridAndGridLocalIdxFromGlobalCellIdx( size_t globalCel //-------------------------------------------------------------------------------------------------- const RigGridBase* RigMainGrid::gridAndGridLocalIdxFromGlobalCellIdx( size_t globalCellIdx, size_t* gridLocalCellIdx ) const { - CVF_ASSERT( globalCellIdx < m_cells.size() ); + CVF_ASSERT( globalCellIdx < totalCellCount() ); - const RigCell& cell = m_cells[globalCellIdx]; + const RigCell& cell = this->cell( globalCellIdx ); const RigGridBase* hostGrid = cell.hostGrid(); CVF_ASSERT( hostGrid ); @@ -492,7 +500,7 @@ void RigMainGrid::calculateFaults( const RigActiveCellInfo* activeCellInfo ) return; } - m_faultsPrCellAcc = new RigFaultsPrCellAccumulator( m_cells.size() ); + m_faultsPrCellAcc = new RigFaultsPrCellAccumulator( totalCellCount() ); // Spread fault idx'es on the cells from the faults for ( size_t fIdx = 0; fIdx < m_faults.size(); ++fIdx ) @@ -517,7 +525,7 @@ void RigMainGrid::calculateFaults( const RigActiveCellInfo* activeCellInfo ) std::vector& unNamedFaultFaces = unNamedFault->faultFaces(); std::vector& unNamedFaultFacesInactive = unNamedFaultWithInactive->faultFaces(); - for ( int gcIdx = 0; gcIdx < static_cast( m_cells.size() ); ++gcIdx ) + for ( int gcIdx = 0; gcIdx < static_cast( totalCellCount() ); ++gcIdx ) { addUnNamedFaultFaces( gcIdx, activeCellInfo, @@ -542,7 +550,7 @@ void RigMainGrid::addUnNamedFaultFaces( int gcIdx, std::vector& unNamedFaultFacesInactive, RigFaultsPrCellAccumulator* faultsPrCellAcc ) const { - if ( m_cells[gcIdx].isInvalid() ) + if ( cell( gcIdx ).isInvalid() ) { return; } @@ -586,7 +594,7 @@ void RigMainGrid::addUnNamedFaultFaces( int gcIdx, } neighborReservoirCellIdx = hostGrid->reservoirCellIndex( neighborGridCellIdx ); - if ( m_cells[neighborReservoirCellIdx].isInvalid() ) + if ( cell( neighborReservoirCellIdx ).isInvalid() ) { continue; } @@ -596,9 +604,9 @@ void RigMainGrid::addUnNamedFaultFaces( int gcIdx, double tolerance = 1e-6; std::array faceIdxs; - m_cells[gcIdx].faceIndices( face, &faceIdxs ); + cell( gcIdx ).faceIndices( face, &faceIdxs ); std::array nbFaceIdxs; - m_cells[neighborReservoirCellIdx].faceIndices( StructGridInterface::oppositeFace( face ), &nbFaceIdxs ); + cell( neighborReservoirCellIdx ).faceIndices( StructGridInterface::oppositeFace( face ), &nbFaceIdxs ); bool sharedFaceVertices = true; if ( sharedFaceVertices && vxs[faceIdxs[0]].pointDistance( vxs[nbFaceIdxs[0]] ) > tolerance ) sharedFaceVertices = false; @@ -664,7 +672,7 @@ void RigMainGrid::distributeNNCsToFaults() if ( fIdx1 < 0 && fIdx2 < 0 ) { cvf::String lgrString( "Same Grid" ); - if ( m_cells[conn.c1GlobIdx()].hostGrid() != m_cells[conn.c2GlobIdx()].hostGrid() ) + if ( cell( conn.c1GlobIdx() ).hostGrid() != cell( conn.c2GlobIdx() ).hostGrid() ) { lgrString = "Different Grid"; } @@ -698,7 +706,7 @@ bool RigMainGrid::isFaceNormalsOutwards() const if ( !m_isFaceNormalsOutwardsComputed ) { std::vector reservoirCellIndices; - reservoirCellIndices.resize( cellCount() ); + reservoirCellIndices.resize( totalCellCount() ); std::iota( reservoirCellIndices.begin(), reservoirCellIndices.end(), 0 ); computeFaceNormalsDirection( reservoirCellIndices ); @@ -741,7 +749,7 @@ void RigMainGrid::computeFaceNormalsDirection( const std::vector& reserv for ( const auto& index : reservoirCellIndices ) { - const auto& cell = m_cells[index]; + const auto& cell = this->cell( index ); if ( !cell.isInvalid() ) { // Some cells can be very twisted and distorted. Use a volume criteria to find a reasonably regular cell. @@ -843,7 +851,7 @@ void RigMainGrid::buildCellSearchTree() { // build tree - size_t cellCount = m_cells.size(); + size_t cellCount = totalCellCount(); std::vector cellIndicesForBoundingBoxes; std::vector cellBoundingBoxes; @@ -862,9 +870,10 @@ void RigMainGrid::buildCellSearchTree() #pragma omp for for ( int cIdx = 0; cIdx < (int)cellCount; ++cIdx ) { - if ( m_cells[cIdx].isInvalid() ) continue; + auto& cell = this->cell( cIdx ); + if ( cell.isInvalid() ) continue; - const std::array& cellIndices = m_cells[cIdx].cornerIndices(); + const std::array& cellIndices = cell.cornerIndices(); cvf::BoundingBox cellBB; for ( size_t i : cellIndices ) diff --git a/ApplicationLibCode/ReservoirDataModel/RigMainGrid.h b/ApplicationLibCode/ReservoirDataModel/RigMainGrid.h index 821f7fde94..88ac93e79f 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigMainGrid.h +++ b/ApplicationLibCode/ReservoirDataModel/RigMainGrid.h @@ -43,12 +43,11 @@ public: RigMainGrid(); ~RigMainGrid() override; + virtual size_t totalCellCount() const; + std::vector& nodes(); const std::vector& nodes() const; - std::vector& globalCellArray(); - const std::vector& globalCellArray() const; - virtual RigGridBase* gridAndGridLocalIdxFromGlobalCellIdx( size_t globalCellIdx, size_t* gridLocalCellIdx ); virtual const RigGridBase* gridAndGridLocalIdxFromGlobalCellIdx( size_t globalCellIdx, size_t* gridLocalCellIdx ) const; @@ -114,6 +113,10 @@ public: bool isDualPorosity() const; void setDualPorosity( bool enable ); +public: // only for use by file readers! + std::vector& reservoirCells(); + const std::vector& reservoirCells() const; + protected: void initAllSubCellsMainGridCellIndex(); void buildCellSearchTree(); diff --git a/ApplicationLibCode/ReservoirDataModel/RigNNCData.cpp b/ApplicationLibCode/ReservoirDataModel/RigNNCData.cpp index ae361e7e0a..e03dddef46 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigNNCData.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigNNCData.cpp @@ -68,8 +68,8 @@ void RigNNCData::buildPolygonsForEclipseConnections() #pragma omp parallel for for ( int cnIdx = 0; cnIdx < static_cast( eclipseConnectionCount() ); ++cnIdx ) { - const RigCell& c1 = m_mainGrid->globalCellArray()[m_connections[cnIdx].c1GlobIdx()]; - const RigCell& c2 = m_mainGrid->globalCellArray()[m_connections[cnIdx].c2GlobIdx()]; + const RigCell& c1 = m_mainGrid->cell( m_connections[cnIdx].c1GlobIdx() ); + const RigCell& c2 = m_mainGrid->cell( m_connections[cnIdx].c2GlobIdx() ); std::vector connectionPolygon; std::vector connectionIntersections; diff --git a/ApplicationLibCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp index abbe9383c7..a31e6475e7 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp @@ -330,11 +330,11 @@ void RigNumberOfFloodedPoreVolumesCalculator::distributeNeighbourCellFlow( RigMa { RigActiveCellInfo* actCellInfo = caseToApply->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL ); - for ( size_t globalCellIndex = 0; globalCellIndex < mainGrid->globalCellArray().size(); globalCellIndex++ ) + for ( size_t globalCellIndex = 0; globalCellIndex < mainGrid->totalCellCount(); globalCellIndex++ ) { if ( !actCellInfo->isActive( globalCellIndex ) ) continue; - const RigCell& cell = mainGrid->globalCellArray()[globalCellIndex]; + const RigCell& cell = mainGrid->cell( globalCellIndex ); RigGridBase* hostGrid = cell.hostGrid(); size_t gridLocalCellIndex = cell.gridLocalCellIndex(); diff --git a/ApplicationLibCode/ReservoirDataModel/RigReservoirBuilder.cpp b/ApplicationLibCode/ReservoirDataModel/RigReservoirBuilder.cpp index 0fa052bb9e..2cd54ed601 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigReservoirBuilder.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigReservoirBuilder.cpp @@ -75,7 +75,7 @@ void RigReservoirBuilder::createGridsAndCells( RigEclipseCaseData* eclipseCase ) size_t mainGridCellCount = mainGridNodeCount / 8; // Must create cells in main grid here, as this information is used when creating LGRs - appendCells( 0, mainGridCellCount, eclipseCase->mainGrid(), eclipseCase->mainGrid()->globalCellArray() ); + appendCells( 0, mainGridCellCount, eclipseCase->mainGrid(), eclipseCase->mainGrid()->reservoirCells() ); size_t totalCellCount = mainGridCellCount; @@ -125,7 +125,7 @@ void RigReservoirBuilder::createGridsAndCells( RigEclipseCaseData* eclipseCase ) size_t cellIdx; for ( cellIdx = 0; cellIdx < mainGridIndicesWithSubGrid.size(); cellIdx++ ) { - RigCell& cell = eclipseCase->mainGrid()->globalCellArray()[mainGridIndicesWithSubGrid[cellIdx]]; + RigCell& cell = eclipseCase->mainGrid()->cell( mainGridIndicesWithSubGrid[cellIdx] ); std::array& indices = cell.cornerIndices(); int nodeIdx; @@ -141,7 +141,7 @@ void RigReservoirBuilder::createGridsAndCells( RigEclipseCaseData* eclipseCase ) appendNodes( bb.min(), bb.max(), lgrCellDimensions, mainGridNodes ); size_t subGridCellCount = ( mainGridNodes.size() / 8 ) - totalCellCount; - appendCells( totalCellCount * 8, subGridCellCount, localGrid, eclipseCase->mainGrid()->globalCellArray() ); + appendCells( totalCellCount * 8, subGridCellCount, localGrid, eclipseCase->mainGrid()->reservoirCells() ); totalCellCount += subGridCellCount; } @@ -149,14 +149,14 @@ void RigReservoirBuilder::createGridsAndCells( RigEclipseCaseData* eclipseCase ) // Set all cells active RigActiveCellInfo* activeCellInfo = eclipseCase->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL ); - activeCellInfo->setReservoirCellCount( eclipseCase->mainGrid()->globalCellArray().size() ); - for ( size_t i = 0; i < eclipseCase->mainGrid()->globalCellArray().size(); i++ ) + activeCellInfo->setReservoirCellCount( eclipseCase->mainGrid()->totalCellCount() ); + for ( size_t i = 0; i < eclipseCase->mainGrid()->totalCellCount(); i++ ) { activeCellInfo->setCellResultIndex( i, i ); } activeCellInfo->setGridCount( 1 ); - activeCellInfo->setGridActiveCellCounts( 0, eclipseCase->mainGrid()->globalCellArray().size() ); + activeCellInfo->setGridActiveCellCounts( 0, eclipseCase->mainGrid()->totalCellCount() ); activeCellInfo->computeDerivedData(); bool useOptimizedVersion = false; // workaround, optimized version causes assert in debug builds diff --git a/ApplicationLibCode/ReservoirDataModel/RigReservoirBuilderMock.cpp b/ApplicationLibCode/ReservoirDataModel/RigReservoirBuilderMock.cpp index 222a9ddd03..5a0d7f7d5d 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigReservoirBuilderMock.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigReservoirBuilderMock.cpp @@ -116,7 +116,7 @@ bool RigReservoirBuilderMock::inputProperty( RigEclipseCaseData* eclipseCase, co /* generate secret number: */ int iSecret = rand() % 20 + 1; - for ( k = 0; k < eclipseCase->mainGrid()->globalCellArray().size(); k++ ) + for ( k = 0; k < eclipseCase->mainGrid()->totalCellCount(); k++ ) { values->push_back( k * iSecret ); } @@ -129,12 +129,12 @@ bool RigReservoirBuilderMock::inputProperty( RigEclipseCaseData* eclipseCase, co //-------------------------------------------------------------------------------------------------- bool RigReservoirBuilderMock::staticResult( RigEclipseCaseData* eclipseCase, const QString& result, std::vector* values ) { - values->resize( eclipseCase->mainGrid()->globalCellArray().size() ); + values->resize( eclipseCase->mainGrid()->totalCellCount() ); #pragma omp parallel for - for ( long long k = 0; k < static_cast( eclipseCase->mainGrid()->globalCellArray().size() ); k++ ) + for ( long long k = 0; k < static_cast( eclipseCase->mainGrid()->totalCellCount() ); k++ ) { - values->at( k ) = ( k * 2 ) % eclipseCase->mainGrid()->globalCellArray().size(); + values->at( k ) = ( k * 2 ) % eclipseCase->mainGrid()->totalCellCount(); } return false; @@ -157,12 +157,12 @@ bool RigReservoirBuilderMock::dynamicResult( RigEclipseCaseData* eclipseCase, co double scaleValue = 1.0 + resultIndex * 0.1; double offsetValue = 100 * resultIndex; - values->resize( eclipseCase->mainGrid()->globalCellArray().size() ); + values->resize( eclipseCase->mainGrid()->totalCellCount() ); #pragma omp parallel for - for ( long long k = 0; k < static_cast( eclipseCase->mainGrid()->globalCellArray().size() ); k++ ) + for ( long long k = 0; k < static_cast( eclipseCase->mainGrid()->totalCellCount() ); k++ ) { - double val = offsetValue + scaleValue * ( ( stepIndex * 1000 + k ) % eclipseCase->mainGrid()->globalCellArray().size() ); + double val = offsetValue + scaleValue * ( ( stepIndex * 1000 + k ) % eclipseCase->mainGrid()->totalCellCount() ); values->at( k ) = val; } diff --git a/ApplicationLibCode/ReservoirDataModel/RigStimPlanModelTools.cpp b/ApplicationLibCode/ReservoirDataModel/RigStimPlanModelTools.cpp index 5c3f423a5b..e31fcfeb14 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigStimPlanModelTools.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigStimPlanModelTools.cpp @@ -62,7 +62,7 @@ cvf::Vec3d RigStimPlanModelTools::calculateTSTDirection( RigEclipseCaseData* ecl int numContributingCells = 0; for ( size_t globalCellIndex : closeCells ) { - const RigCell& cell = mainGrid->globalCellArray()[globalCellIndex]; + const RigCell& cell = mainGrid->cell( globalCellIndex ); if ( !cell.isInvalid() ) { @@ -128,7 +128,7 @@ std::tuple RigStimPlanModelTools::f shortestDistance = distance; barrierPosition = intersection.startPoint; - const RigCell& cell = mainGrid->globalCellArray()[intersection.globCellIndex]; + const RigCell& cell = mainGrid->cell( intersection.globCellIndex ); cvf::Vec3d faceNormal = cell.faceNormalWithAreaLength( intersection.intersectedCellFaceIn ); barrierDip = RigStimPlanModelTools::calculateFormationDip( faceNormal ); } diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellTargetCandidatesGenerator.cpp b/ApplicationLibCode/ReservoirDataModel/RigWellTargetCandidatesGenerator.cpp index 24baaeaaa5..e6354d1f9e 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigWellTargetCandidatesGenerator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigWellTargetCandidatesGenerator.cpp @@ -316,19 +316,18 @@ std::vector RigWellTargetCandidatesGenerator::findCandidates( const RimE cvf::StructGridInterface::FaceType::NEG_K, }; - size_t resultIndex = resultsData->activeCellInfo()->cellResultIndex( cellIdx ); + size_t resultIndex = resultsData->activeCellInfo()->cellResultIndex( cellIdx ); + const RigCell& nativeCell = eclipseCase.mainGrid()->cell( cellIdx ); + RigGridBase* grid = nativeCell.hostGrid(); + size_t gridLocalNativeCellIndex = nativeCell.gridLocalCellIndex(); + + size_t i, j, k; + + grid->ijkFromCellIndex( gridLocalNativeCellIndex, &i, &j, &k ); for ( cvf::StructGridInterface::FaceType face : faces ) { - const RigCell& nativeCell = eclipseCase.mainGrid()->globalCellArray()[cellIdx]; - RigGridBase* grid = nativeCell.hostGrid(); - - size_t gridLocalNativeCellIndex = nativeCell.gridLocalCellIndex(); - - size_t i, j, k, gridLocalNeighborCellIdx; - - grid->ijkFromCellIndex( gridLocalNativeCellIndex, &i, &j, &k ); - + size_t gridLocalNeighborCellIdx; if ( grid->cellIJKNeighbor( i, j, k, face, &gridLocalNeighborCellIdx ) ) { size_t neighborResvCellIdx = grid->reservoirCellIndex( gridLocalNeighborCellIdx ); diff --git a/ApplicationLibCode/SocketInterface/RiaCaseInfoCommands.cpp b/ApplicationLibCode/SocketInterface/RiaCaseInfoCommands.cpp index 2b7b272ec4..58863e51bf 100644 --- a/ApplicationLibCode/SocketInterface/RiaCaseInfoCommands.cpp +++ b/ApplicationLibCode/SocketInterface/RiaCaseInfoCommands.cpp @@ -189,7 +189,9 @@ public: hostCellK.reserve( numMatrixModelActiveCells ); globalCoarseningBoxIdx.reserve( numMatrixModelActiveCells ); - const std::vector& reservoirCells = reservoirCase->eclipseCaseData()->mainGrid()->globalCellArray(); + // const std::vector& reservoirCells = reservoirCase->eclipseCaseData()->mainGrid()->globalCellArray(); + + auto mainGrid = reservoirCase->eclipseCaseData()->mainGrid(); std::vector globalCoarseningBoxIndexStart; { @@ -206,13 +208,14 @@ public: } } - for ( size_t cIdx = 0; cIdx < reservoirCells.size(); ++cIdx ) + for ( size_t cIdx = 0; cIdx < mainGrid->totalCellCount(); ++cIdx ) { if ( actCellInfo->isActive( cIdx ) ) { - RigGridBase* grid = reservoirCells[cIdx].hostGrid(); + auto& cell = mainGrid->cell( cIdx ); + RigGridBase* grid = cell.hostGrid(); CVF_ASSERT( grid != nullptr ); - size_t cellIndex = reservoirCells[cIdx].gridLocalCellIndex(); + size_t cellIndex = cell.gridLocalCellIndex(); size_t i, j, k; grid->ijkFromCellIndex( cellIndex, &i, &j, &k ); @@ -229,7 +232,7 @@ public: } else { - size_t parentCellIdx = reservoirCells[cIdx].parentCellIndex(); + size_t parentCellIdx = cell.parentCellIndex(); parentGrid = ( static_cast( grid ) )->parentGrid(); CVF_ASSERT( parentGrid != nullptr ); parentGrid->ijkFromCellIndex( parentCellIdx, &pi, &pj, &pk ); @@ -245,7 +248,7 @@ public: hostCellJ.push_back( static_cast( pj + 1 ) ); // NB: 1-based index in Octave hostCellK.push_back( static_cast( pk + 1 ) ); // NB: 1-based index in Octave - size_t coarseningIdx = reservoirCells[cIdx].coarseningBoxIndex(); + size_t coarseningIdx = cell.coarseningBoxIndex(); if ( coarseningIdx != cvf::UNDEFINED_SIZE_T ) { size_t globalCoarseningIdx = globalCoarseningBoxIndexStart[grid->gridIndex()] + coarseningIdx; diff --git a/ApplicationLibCode/SocketInterface/RiaGeometryCommands.cpp b/ApplicationLibCode/SocketInterface/RiaGeometryCommands.cpp index 6d251c7439..eb14dec4e1 100644 --- a/ApplicationLibCode/SocketInterface/RiaGeometryCommands.cpp +++ b/ApplicationLibCode/SocketInterface/RiaGeometryCommands.cpp @@ -203,11 +203,11 @@ public: { quint64 valueIndex = 0; - for ( size_t reservoirCellIndex = 0; reservoirCellIndex < mainGrid->globalCellArray().size(); reservoirCellIndex++ ) + for ( size_t reservoirCellIndex = 0; reservoirCellIndex < mainGrid->totalCellCount(); reservoirCellIndex++ ) { if ( !actCellInfo->isActive( reservoirCellIndex ) ) continue; - cvf::Vec3d center = mainGrid->globalCellArray()[reservoirCellIndex].center(); + cvf::Vec3d center = mainGrid->cell( reservoirCellIndex ).center(); convertVec3dToPositiveDepth( ¢er ); @@ -377,7 +377,7 @@ public: quint64 valueIndex = 0; - for ( size_t reservoirCellIndex = 0; reservoirCellIndex < mainGrid->globalCellArray().size(); reservoirCellIndex++ ) + for ( size_t reservoirCellIndex = 0; reservoirCellIndex < mainGrid->totalCellCount(); reservoirCellIndex++ ) { if ( !actCellInfo->isActive( reservoirCellIndex ) ) continue; diff --git a/ApplicationLibCode/SocketInterface/RiaNNCCommands.cpp b/ApplicationLibCode/SocketInterface/RiaNNCCommands.cpp index b46b1d114b..8ec94b7898 100644 --- a/ApplicationLibCode/SocketInterface/RiaNNCCommands.cpp +++ b/ApplicationLibCode/SocketInterface/RiaNNCCommands.cpp @@ -73,8 +73,8 @@ public: { RigConnection connection = mainGrid->nncData()->allConnections()[i]; - const RigCell& cell1 = mainGrid->globalCellArray()[connection.c1GlobIdx()]; - const RigCell& cell2 = mainGrid->globalCellArray()[connection.c2GlobIdx()]; + const RigCell& cell1 = mainGrid->cell( connection.c1GlobIdx() ); + const RigCell& cell2 = mainGrid->cell( connection.c2GlobIdx() ); sendCellInfo( socketStream, cell1 ); sendCellInfo( socketStream, cell2 ); diff --git a/ApplicationLibCode/SocketInterface/RiaPropertyDataCommands.cpp b/ApplicationLibCode/SocketInterface/RiaPropertyDataCommands.cpp index 5f91a374d9..9aee4762ac 100644 --- a/ApplicationLibCode/SocketInterface/RiaPropertyDataCommands.cpp +++ b/ApplicationLibCode/SocketInterface/RiaPropertyDataCommands.cpp @@ -933,7 +933,7 @@ public: // The size of this array must match the test in RigCaseCellResultsData::isUsingGlobalActiveIndex(), // as it is used to determine if we have data for active cells or all cells // See RigCaseCellResultsData::isUsingGlobalActiveIndex() - size_t totalNumberOfCellsIncludingLgrCells = grid->mainGrid()->globalCellArray().size(); + size_t totalNumberOfCellsIncludingLgrCells = grid->mainGrid()->totalCellCount(); m_scalarResultsToAdd->at( tsId ).resize( totalNumberOfCellsIncludingLgrCells, HUGE_VAL ); } diff --git a/ApplicationLibCode/UnitTests/RigWellLogExtractor-Test.cpp b/ApplicationLibCode/UnitTests/RigWellLogExtractor-Test.cpp index 33a172addc..0182543f6e 100644 --- a/ApplicationLibCode/UnitTests/RigWellLogExtractor-Test.cpp +++ b/ApplicationLibCode/UnitTests/RigWellLogExtractor-Test.cpp @@ -45,10 +45,9 @@ TEST( RigEclipseWellLogExtractor, ShortWellPathInsideOneCell ) reservoir->mainGrid()->computeCachedData(); } - auto cells = reservoir->mainGrid()->globalCellArray(); - EXPECT_FALSE( cells.empty() ); + EXPECT_FALSE( reservoir->mainGrid()->totalCellCount() == 0 ); - auto firstCell = reservoir->mainGrid()->globalCellArray()[0]; + auto firstCell = reservoir->mainGrid()->cell( 0 ); auto center = firstCell.center(); cvf::ref wellPathGeometry = new RigWellPath; diff --git a/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp b/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp index 1b6108486f..646d0271bd 100644 --- a/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp +++ b/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp @@ -96,7 +96,7 @@ RiuResultTextBuilder::RiuResultTextBuilder( RimGridView* settings RigEclipseCaseData* caseData = eclipseCase->eclipseCaseData(); RigMainGrid* mainGrid = caseData->mainGrid(); - const RigCell& cell = caseData->mainGrid()->globalCellArray()[reservoirCellIndex]; + const RigCell& cell = caseData->mainGrid()->cell( reservoirCellIndex ); for ( size_t i = 0; i < mainGrid->gridCount(); i++ ) { @@ -922,8 +922,8 @@ QString RiuResultTextBuilder::nncDetails() // First cell of NNC { - CVF_ASSERT( conn.c1GlobIdx() < grid->globalCellArray().size() ); - const RigCell& cell = grid->globalCellArray()[conn.c1GlobIdx()]; + CVF_ASSERT( conn.c1GlobIdx() < grid->totalCellCount() ); + const RigCell& cell = grid->cell( conn.c1GlobIdx() ); RigGridBase* hostGrid = cell.hostGrid(); size_t gridLocalCellIndex = cell.gridLocalCellIndex(); @@ -944,8 +944,8 @@ QString RiuResultTextBuilder::nncDetails() // Second cell of NNC { - CVF_ASSERT( conn.c2GlobIdx() < grid->globalCellArray().size() ); - const RigCell& cell = grid->globalCellArray()[conn.c2GlobIdx()]; + CVF_ASSERT( conn.c2GlobIdx() < grid->totalCellCount() ); + const RigCell& cell = grid->cell( conn.c2GlobIdx() ); RigGridBase* hostGrid = cell.hostGrid(); size_t gridLocalCellIndex = cell.gridLocalCellIndex(); diff --git a/ApplicationLibCode/UserInterface/RiuViewerCommands.cpp b/ApplicationLibCode/UserInterface/RiuViewerCommands.cpp index aead16b7a8..b95584dbd0 100644 --- a/ApplicationLibCode/UserInterface/RiuViewerCommands.cpp +++ b/ApplicationLibCode/UserInterface/RiuViewerCommands.cpp @@ -1066,7 +1066,7 @@ void RiuViewerCommands::findCellAndGridIndex( Rim3dView* m if ( eclipseCase ) { - const RigCell& cell = eclipseCase->mainGrid()->globalCellArray()[globalCellIndex]; + const RigCell& cell = eclipseCase->mainGrid()->cell( globalCellIndex ); *cellIndex = cell.gridLocalCellIndex(); *gridIndex = cell.hostGrid()->gridIndex(); } diff --git a/GrpcInterface/RiaGrpcCaseService.cpp b/GrpcInterface/RiaGrpcCaseService.cpp index b671c91ce2..1a07f5f773 100644 --- a/GrpcInterface/RiaGrpcCaseService.cpp +++ b/GrpcInterface/RiaGrpcCaseService.cpp @@ -94,7 +94,7 @@ grpc::Status RiaActiveCellInfoStateHandler::init( const rips::CellInfoRequest* r //-------------------------------------------------------------------------------------------------- grpc::Status RiaActiveCellInfoStateHandler::assignNextActiveCellInfoData( rips::CellInfo* cellInfo ) { - const std::vector& reservoirCells = m_eclipseCase->eclipseCaseData()->mainGrid()->globalCellArray(); + const std::vector& reservoirCells = m_eclipseCase->eclipseCaseData()->mainGrid()->reservoirCells(); while ( m_currentCellIdx < reservoirCells.size() ) { @@ -182,7 +182,7 @@ RigActiveCellInfo* RiaActiveCellInfoStateHandler::activeCellInfo() const //-------------------------------------------------------------------------------------------------- const std::vector& RiaActiveCellInfoStateHandler::reservoirCells() const { - const std::vector& reservoirCells = m_eclipseCase->eclipseCaseData()->mainGrid()->globalCellArray(); + const std::vector& reservoirCells = m_eclipseCase->eclipseCaseData()->mainGrid()->reservoirCells(); return reservoirCells; } @@ -223,7 +223,7 @@ grpc::Status RiaActiveCellInfoStateHandler::assignReply( rips::CellInfoArray* re //-------------------------------------------------------------------------------------------------- grpc::Status RiaActiveCellInfoStateHandler::assignNextActiveCellCenter( rips::Vec3d* cellCenter ) { - const std::vector& reservoirCells = m_eclipseCase->eclipseCaseData()->mainGrid()->globalCellArray(); + const std::vector& reservoirCells = m_eclipseCase->eclipseCaseData()->mainGrid()->reservoirCells(); while ( m_currentCellIdx < reservoirCells.size() ) { @@ -288,7 +288,7 @@ grpc::Status RiaActiveCellInfoStateHandler::assignCellCentersReply( rips::CellCe //-------------------------------------------------------------------------------------------------- Status RiaActiveCellInfoStateHandler::assignNextActiveCellCorners( rips::CellCorners* cellCorners ) { - const std::vector& reservoirCells = m_eclipseCase->eclipseCaseData()->mainGrid()->globalCellArray(); + const std::vector& reservoirCells = m_eclipseCase->eclipseCaseData()->mainGrid()->reservoirCells(); while ( m_currentCellIdx < reservoirCells.size() ) { diff --git a/GrpcInterface/RiaGrpcNNCPropertiesService.cpp b/GrpcInterface/RiaGrpcNNCPropertiesService.cpp index ef9075635f..343c7e446e 100644 --- a/GrpcInterface/RiaGrpcNNCPropertiesService.cpp +++ b/GrpcInterface/RiaGrpcNNCPropertiesService.cpp @@ -100,8 +100,8 @@ grpc::Status RiaNNCConnectionsStateHandler::assignReply( rips::NNCConnections* r for ( ; indexInPackage < packageSize && m_currentIdx < connectionCount; ++indexInPackage ) { const RigConnection& connection = connections[m_currentIdx]; - const RigCell& cell1 = mainGrid->globalCellArray()[connection.c1GlobIdx()]; - const RigCell& cell2 = mainGrid->globalCellArray()[connection.c2GlobIdx()]; + const RigCell& cell1 = mainGrid->cell( connection.c1GlobIdx() ); + const RigCell& cell2 = mainGrid->cell( connection.c2GlobIdx() ); NNCConnection* nncConnection = reply->add_connections(); nncConnection->set_allocated_cell1( createConnectionVec3i( cell1 ) ); diff --git a/GrpcInterface/RiaGrpcPropertiesService.cpp b/GrpcInterface/RiaGrpcPropertiesService.cpp index 469ab22124..181d3b3dda 100644 --- a/GrpcInterface/RiaGrpcPropertiesService.cpp +++ b/GrpcInterface/RiaGrpcPropertiesService.cpp @@ -373,7 +373,7 @@ protected: auto resultValues = caseData->results( porosityModel )->modifiableCellScalarResult( resVarAddr, timeStepIndex ); if ( resultValues && resultValues->empty() && m_cellCount > 0 ) { - auto totalCellCount = caseData->mainGrid()->globalCellArray().size(); + auto totalCellCount = caseData->mainGrid()->totalCellCount(); resultValues->resize( totalCellCount ); } From 78d82acb417fe14767eaeb68fead9d65d45d3eb9 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Thu, 24 Oct 2024 01:35:44 +0200 Subject: [PATCH 075/160] Add specialiced active cell subgrids --- .../RifReaderOpmCommonActive.cpp | 5 +- .../ReservoirDataModel/CMakeLists_files.cmake | 2 + .../RigActiveCellLocalGrid.cpp | 47 +++++++++++++++++++ .../RigActiveCellLocalGrid.h | 36 ++++++++++++++ .../ReservoirDataModel/RigGridBase.h | 4 +- 5 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 ApplicationLibCode/ReservoirDataModel/RigActiveCellLocalGrid.cpp create mode 100644 ApplicationLibCode/ReservoirDataModel/RigActiveCellLocalGrid.h diff --git a/ApplicationLibCode/FileInterface/RifReaderOpmCommonActive.cpp b/ApplicationLibCode/FileInterface/RifReaderOpmCommonActive.cpp index e0dcd10436..b6890edea1 100644 --- a/ApplicationLibCode/FileInterface/RifReaderOpmCommonActive.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderOpmCommonActive.cpp @@ -25,6 +25,7 @@ #include "RigActiveCellGrid.h" #include "RigActiveCellInfo.h" +#include "RigActiveCellLocalGrid.h" #include "RigEclipseCaseData.h" #include "cafProgressInfo.h" @@ -93,7 +94,7 @@ bool RifReaderOpmCommonActive::importGrid( RigMainGrid* /* mainGrid*/, RigEclips for ( int lgrIdx = 0; lgrIdx < numLGRs; lgrIdx++ ) { lgrGrids.emplace_back( Opm::EclIO::EGrid( m_gridFileName, lgr_names[lgrIdx] ) ); - RigLocalGrid* localGrid = new RigLocalGrid( activeGrid ); + RigActiveCellLocalGrid* localGrid = new RigActiveCellLocalGrid( activeGrid ); const auto& lgrDims = lgrGrids[lgrIdx].dimension(); localGrid->setGridPointDimensions( cvf::Vec3st( lgrDims[0] + 1, lgrDims[1] + 1, lgrDims[2] + 1 ) ); @@ -179,7 +180,7 @@ bool RifReaderOpmCommonActive::importGrid( RigMainGrid* /* mainGrid*/, RigEclips RigGridBase* parentGrid = hasParentInfo ? activeGrid->gridByName( lgr_parent_names[lgrIdx] ) : activeGrid; - RigLocalGrid* localGrid = static_cast( activeGrid->gridById( lgrIdx + 1 ) ); + RigActiveCellLocalGrid* localGrid = static_cast( activeGrid->gridById( lgrIdx + 1 ) ); localGrid->setParentGrid( parentGrid ); transferActiveGeometry( opmGrid, lgrGrids[lgrIdx], activeGrid, localGrid, eclipseCaseData ); diff --git a/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake b/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake index fa554796a4..dc87350c32 100644 --- a/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake +++ b/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake @@ -23,6 +23,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RigLocalGrid.h ${CMAKE_CURRENT_LIST_DIR}/RigMainGrid.h ${CMAKE_CURRENT_LIST_DIR}/RigActiveCellGrid.h + ${CMAKE_CURRENT_LIST_DIR}/RigActiveCellLocalGrid.h ${CMAKE_CURRENT_LIST_DIR}/RigReservoirBuilderMock.h ${CMAKE_CURRENT_LIST_DIR}/RigCaseCellResultsData.h ${CMAKE_CURRENT_LIST_DIR}/RigSimWellData.h @@ -130,6 +131,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RigLocalGrid.cpp ${CMAKE_CURRENT_LIST_DIR}/RigMainGrid.cpp ${CMAKE_CURRENT_LIST_DIR}/RigActiveCellGrid.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigActiveCellLocalGrid.cpp ${CMAKE_CURRENT_LIST_DIR}/RigReservoirBuilderMock.cpp ${CMAKE_CURRENT_LIST_DIR}/RigCaseCellResultsData.cpp ${CMAKE_CURRENT_LIST_DIR}/RigSimWellData.cpp diff --git a/ApplicationLibCode/ReservoirDataModel/RigActiveCellLocalGrid.cpp b/ApplicationLibCode/ReservoirDataModel/RigActiveCellLocalGrid.cpp new file mode 100644 index 0000000000..6247a7d167 --- /dev/null +++ b/ApplicationLibCode/ReservoirDataModel/RigActiveCellLocalGrid.cpp @@ -0,0 +1,47 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024 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 "RigActiveCellLocalGrid.h" + +#include "RigActiveCellGrid.h" + +RigActiveCellLocalGrid::RigActiveCellLocalGrid( RigActiveCellGrid* mainGrid ) + : RigLocalGrid( mainGrid ) + , m_mainActiveGrid( mainGrid ) +{ +} + +RigActiveCellLocalGrid::~RigActiveCellLocalGrid() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigCell& RigActiveCellLocalGrid::cell( size_t gridLocalCellIndex ) +{ + return m_mainActiveGrid->cell( m_indexToStartOfCells + gridLocalCellIndex ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const RigCell& RigActiveCellLocalGrid::cell( size_t gridLocalCellIndex ) const +{ + return m_mainActiveGrid->cell( m_indexToStartOfCells + gridLocalCellIndex ); +} diff --git a/ApplicationLibCode/ReservoirDataModel/RigActiveCellLocalGrid.h b/ApplicationLibCode/ReservoirDataModel/RigActiveCellLocalGrid.h new file mode 100644 index 0000000000..d526c14e77 --- /dev/null +++ b/ApplicationLibCode/ReservoirDataModel/RigActiveCellLocalGrid.h @@ -0,0 +1,36 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024 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 "RigLocalGrid.h" + +class RigActiveCellGrid; + +class RigActiveCellLocalGrid : public RigLocalGrid +{ +public: + explicit RigActiveCellLocalGrid( RigActiveCellGrid* mainGrid ); + ~RigActiveCellLocalGrid() override; + + RigCell& cell( size_t gridLocalCellIndex ) override; + const RigCell& cell( size_t gridLocalCellIndex ) const override; + +private: + RigActiveCellGrid* m_mainActiveGrid; +}; diff --git a/ApplicationLibCode/ReservoirDataModel/RigGridBase.h b/ApplicationLibCode/ReservoirDataModel/RigGridBase.h index 3502e2b72a..631eef1b9b 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigGridBase.h +++ b/ApplicationLibCode/ReservoirDataModel/RigGridBase.h @@ -114,11 +114,13 @@ public: bool cellIJKNeighbor( size_t i, size_t j, size_t k, FaceType face, size_t* neighborCellIndex ) const override; void cellIJKNeighborUnguarded( size_t i, size_t j, size_t k, FaceType face, size_t* neighborCellIndex ) const; +protected: + size_t m_indexToStartOfCells; ///< Index into the global cell array stored in main-grid where this grids cells starts. + private: std::string m_gridName; cvf::Vec3st m_gridPointDimensions; cvf::Vec3st m_cellCount; - size_t m_indexToStartOfCells; ///< Index into the global cell array stored in main-grid where this grids cells starts. size_t m_gridIndex; ///< The LGR index of this grid. Starts with 1. Main grid has index 0. int m_gridId; ///< The LGR id of this grid. Main grid has id 0. RigMainGrid* m_mainGrid; From db66ec82def41a1a4e6d9b59f41dc3572bc89609 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Fri, 25 Oct 2024 03:09:24 +0200 Subject: [PATCH 076/160] Some clean up and fixes --- .../FileInterface/RifReaderEclipseWell.cpp | 4 +- .../FileInterface/RifReaderOpmCommon.cpp | 44 +++++++++---------- .../RifReaderOpmCommonActive.cpp | 19 ++++---- .../ReservoirDataModel/RigActiveCellGrid.cpp | 19 ++++++++ .../ReservoirDataModel/RigActiveCellGrid.h | 3 ++ .../RigCaseCellResultsData.cpp | 1 + .../ReservoirDataModel/RigCell.cpp | 1 + 7 files changed, 58 insertions(+), 33 deletions(-) diff --git a/ApplicationLibCode/FileInterface/RifReaderEclipseWell.cpp b/ApplicationLibCode/FileInterface/RifReaderEclipseWell.cpp index c6fa2e7212..cf7be960e2 100644 --- a/ApplicationLibCode/FileInterface/RifReaderEclipseWell.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderEclipseWell.cpp @@ -429,7 +429,9 @@ private: while ( gridIndex > 0 ) // is lgr { const RigCell& connectionCell = m_mainGrid->cellByGridAndGridLocalCellIdx( gridIndex, gridCellIndex ); - RigGridBase* hostGrid = connectionCell.hostGrid(); + if ( connectionCell.isInvalid() ) break; + + RigGridBase* hostGrid = connectionCell.hostGrid(); RigLocalGrid* lgrHost = static_cast( hostGrid ); gridIndex = lgrHost->parentGrid()->gridIndex(); diff --git a/ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp b/ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp index b8b1b106f5..799dfba243 100644 --- a/ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp @@ -147,9 +147,6 @@ bool RifReaderOpmCommon::importGrid( RigMainGrid* mainGrid, RigEclipseCaseData* Opm::EclIO::EGrid opmGrid( m_gridFileName ); - RigActiveCellInfo* activeCellInfo = eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL ); - RigActiveCellInfo* fractureActiveCellInfo = eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::FRACTURE_MODEL ); - const auto& dims = opmGrid.dimension(); mainGrid->setGridPointDimensions( cvf::Vec3st( dims[0] + 1, dims[1] + 1, dims[2] + 1 ) ); mainGrid->setGridName( "Main grid" ); @@ -184,26 +181,24 @@ bool RifReaderOpmCommon::importGrid( RigMainGrid* mainGrid, RigEclipseCaseData* const auto& lgrDims = lgrGrids[lgrIdx].dimension(); localGrid->setGridPointDimensions( cvf::Vec3st( lgrDims[0] + 1, lgrDims[1] + 1, lgrDims[2] + 1 ) ); - localGrid->setGridId( lgrIdx + 1 ); localGrid->setGridName( lgr_names[lgrIdx] ); - mainGrid->addLocalGrid( localGrid ); - localGrid->setIndexToStartOfCells( totalCellCount ); + mainGrid->addLocalGrid( localGrid ); totalCellCount += lgrGrids[lgrIdx].totalNumberOfCells(); } - activeCellInfo->setReservoirCellCount( totalCellCount ); - fractureActiveCellInfo->setReservoirCellCount( totalCellCount ); - - mainGrid->reservoirCells().reserve( (size_t)totalCellCount ); - mainGrid->nodes().reserve( (size_t)totalCellCount * 8 ); - - activeCellInfo->setGridCount( 1 + numLGRs ); - fractureActiveCellInfo->setGridCount( 1 + numLGRs ); - + // active cell information { + RigActiveCellInfo* activeCellInfo = eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL ); + RigActiveCellInfo* fractureActiveCellInfo = eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::FRACTURE_MODEL ); + + activeCellInfo->setReservoirCellCount( totalCellCount ); + fractureActiveCellInfo->setReservoirCellCount( totalCellCount ); + activeCellInfo->setGridCount( 1 + numLGRs ); + fractureActiveCellInfo->setGridCount( 1 + numLGRs ); + auto task = progInfo.task( "Getting Active Cell Information", 1 ); for ( int lgrIdx = 0; lgrIdx < numLGRs; lgrIdx++ ) @@ -242,23 +237,24 @@ bool RifReaderOpmCommon::importGrid( RigMainGrid* mainGrid, RigEclipseCaseData* fractureActiveCellInfo->computeDerivedData(); } + // grid geometry { auto task = progInfo.task( "Loading Main Grid Geometry", 1 ); transferGeometry( opmGrid, opmGrid, mainGrid, mainGrid, eclipseCaseData ); - } - bool hasParentInfo = ( lgr_parent_names.size() >= (size_t)numLGRs ); + bool hasParentInfo = ( lgr_parent_names.size() >= (size_t)numLGRs ); - auto task = progInfo.task( "Loading LGR Grid Geometry ", 1 ); + auto task2 = progInfo.task( "Loading LGR Grid Geometry ", 1 ); - for ( int lgrIdx = 0; lgrIdx < numLGRs; lgrIdx++ ) - { - RigGridBase* parentGrid = hasParentInfo ? mainGrid->gridByName( lgr_parent_names[lgrIdx] ) : mainGrid; + for ( int lgrIdx = 0; lgrIdx < numLGRs; lgrIdx++ ) + { + RigGridBase* parentGrid = hasParentInfo ? mainGrid->gridByName( lgr_parent_names[lgrIdx] ) : mainGrid; - RigLocalGrid* localGrid = static_cast( mainGrid->gridById( lgrIdx + 1 ) ); - localGrid->setParentGrid( parentGrid ); + RigLocalGrid* localGrid = static_cast( mainGrid->gridById( lgrIdx + 1 ) ); + localGrid->setParentGrid( parentGrid ); - transferGeometry( opmGrid, lgrGrids[lgrIdx], mainGrid, localGrid, eclipseCaseData ); + transferGeometry( opmGrid, lgrGrids[lgrIdx], mainGrid, localGrid, eclipseCaseData ); + } } mainGrid->initAllSubGridsParentGridPointer(); diff --git a/ApplicationLibCode/FileInterface/RifReaderOpmCommonActive.cpp b/ApplicationLibCode/FileInterface/RifReaderOpmCommonActive.cpp index b6890edea1..7c84b55778 100644 --- a/ApplicationLibCode/FileInterface/RifReaderOpmCommonActive.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderOpmCommonActive.cpp @@ -77,7 +77,7 @@ bool RifReaderOpmCommonActive::importGrid( RigMainGrid* /* mainGrid*/, RigEclips m_gridUnit = 3; auto totalCellCount = opmGrid.totalNumberOfCells(); - auto totalNativeCellCount = opmGrid.totalActiveCells() + 1; // add one inactive cell used as placeholder for all inactive cells + auto totalActiveCellCount = opmGrid.totalActiveCells(); auto globalMatrixActiveSize = opmGrid.activeCells(); auto globalFractureActiveSize = opmGrid.activeFracCells(); @@ -104,10 +104,10 @@ bool RifReaderOpmCommonActive::importGrid( RigMainGrid* /* mainGrid*/, RigEclips activeGrid->addLocalGrid( localGrid ); totalCellCount += lgrGrids[lgrIdx].totalNumberOfCells(); - totalNativeCellCount += lgrGrids[lgrIdx].totalActiveCells() + 1; + totalActiveCellCount += lgrGrids[lgrIdx].totalActiveCells(); } - activeGrid->setTotalCellCount( totalCellCount ); + activeGrid->setTotalActiveCellCount( totalActiveCellCount ); // active cell information { @@ -180,10 +180,12 @@ bool RifReaderOpmCommonActive::importGrid( RigMainGrid* /* mainGrid*/, RigEclips RigGridBase* parentGrid = hasParentInfo ? activeGrid->gridByName( lgr_parent_names[lgrIdx] ) : activeGrid; - RigActiveCellLocalGrid* localGrid = static_cast( activeGrid->gridById( lgrIdx + 1 ) ); - localGrid->setParentGrid( parentGrid ); - - transferActiveGeometry( opmGrid, lgrGrids[lgrIdx], activeGrid, localGrid, eclipseCaseData ); + RigActiveCellLocalGrid* localGrid = dynamic_cast( activeGrid->gridById( lgrIdx + 1 ) ); + if ( localGrid != nullptr ) + { + localGrid->setParentGrid( parentGrid ); + transferActiveGeometry( opmGrid, lgrGrids[lgrIdx], activeGrid, localGrid, eclipseCaseData ); + } } } @@ -328,7 +330,7 @@ void RifReaderOpmCommonActive::transferActiveGeometry( Opm::EclIO::EGrid& opmMa RigEclipseCaseData* eclipseCaseData ) { int cellCount = opmGrid.totalActiveCells(); - size_t cellStartIndex = activeGrid->reservoirCells().size(); + size_t cellStartIndex = activeGrid->totalCellCount(); size_t nodeStartIndex = activeGrid->nodes().size(); const bool invalidateLongPyramidCells = invalidateLongThinCells(); @@ -340,6 +342,7 @@ void RifReaderOpmCommonActive::transferActiveGeometry( Opm::EclIO::EGrid& opmMa const auto newNodeCount = nodeStartIndex + 8 * cellCount; activeGrid->nodes().resize( newNodeCount, cvf::Vec3d( 0, 0, 0 ) ); + activeGrid->setTotalCellCount( cellStartIndex + opmGrid.totalNumberOfCells() ); auto& riNodes = activeGrid->nodes(); auto& riCells = activeGrid->nativeCells(); diff --git a/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.cpp b/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.cpp index 8148c1ed06..0c5207c1d4 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.cpp @@ -25,11 +25,14 @@ /// //-------------------------------------------------------------------------------------------------- RigActiveCellGrid::RigActiveCellGrid() + : m_totalCellCount( 0 ) + , m_totalActiveCellCount( 0 ) { m_invalidCell.setInvalid( true ); for ( size_t i = 0; i < 8; i++ ) m_invalidCell.cornerIndices()[i] = 0; m_invalidCell.setHostGrid( this ); + m_invalidCell.setSubGrid( nullptr ); } //-------------------------------------------------------------------------------------------------- @@ -204,3 +207,19 @@ void RigActiveCellGrid::setTotalCellCount( size_t totalCellCount ) { m_totalCellCount = totalCellCount; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +size_t RigActiveCellGrid::totalActiveCellCount() const +{ + return m_totalActiveCellCount; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigActiveCellGrid::setTotalActiveCellCount( size_t totalActiveCellCount ) +{ + m_totalActiveCellCount = totalActiveCellCount; +} diff --git a/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h b/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h index 26ad0464e0..8b708c40e8 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h +++ b/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h @@ -47,16 +47,19 @@ public: // size_t cellCount() const override; size_t totalCellCount() const override; + size_t totalActiveCellCount() const; public: // only for use by file readers! std::map& nativeCells(); const std::map& nativeCells() const; void setTotalCellCount( size_t totalCellCount ); + void setTotalActiveCellCount( size_t totalActiveCellCount ); private: // std::vector m_globalToNativeMap; // std::vector m_nativeToGlobalMap; size_t m_totalCellCount; + size_t m_totalActiveCellCount; RigCell m_invalidCell; std::map m_nativeCells; }; diff --git a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp index 9dcd532981..e70c2c0b5d 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp @@ -1898,6 +1898,7 @@ void RigCaseCellResultsData::computeDepthRelatedResults() for ( long cellIdx = 0; cellIdx < static_cast( m_ownerMainGrid->totalCellCount() ); cellIdx++ ) { const RigCell& cell = m_ownerMainGrid->cell( cellIdx ); + if ( cell.isInvalid() ) continue; size_t resultIndex = activeCellInfo()->cellResultIndex( cellIdx ); if ( resultIndex == cvf::UNDEFINED_SIZE_T ) continue; diff --git a/ApplicationLibCode/ReservoirDataModel/RigCell.cpp b/ApplicationLibCode/ReservoirDataModel/RigCell.cpp index f249428c9f..e1ce163f91 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigCell.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigCell.cpp @@ -335,6 +335,7 @@ cvf::Vec3d RigCell::faceNormalWithAreaLength( cvf::StructGridInterface::FaceType //-------------------------------------------------------------------------------------------------- double RigCell::volume() const { + if ( m_isInvalid ) return 0.0; const std::vector& nodeCoords = m_hostGrid->mainGrid()->nodes(); std::array hexCorners; From f21d1545f81228c92ce4d4e4c3938437defb5d30 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Fri, 25 Oct 2024 17:14:21 +0200 Subject: [PATCH 077/160] Some cleanup --- .../RifReaderOpmCommonActive.cpp | 92 ------------- .../CellFilters/RimPolygonFilter.cpp | 2 +- .../RigIndexIjkResultCalculator.cpp | 1 + .../ReservoirDataModel/RigActiveCellGrid.cpp | 123 +----------------- .../ReservoirDataModel/RigActiveCellGrid.h | 17 --- .../ReservoirDataModel/RigGridBase.cpp | 6 +- .../RigWellTargetCandidatesGenerator.cpp | 28 ++-- .../SocketInterface/RiaCaseInfoCommands.cpp | 2 - 8 files changed, 25 insertions(+), 246 deletions(-) diff --git a/ApplicationLibCode/FileInterface/RifReaderOpmCommonActive.cpp b/ApplicationLibCode/FileInterface/RifReaderOpmCommonActive.cpp index 7c84b55778..6ee54d0227 100644 --- a/ApplicationLibCode/FileInterface/RifReaderOpmCommonActive.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderOpmCommonActive.cpp @@ -227,98 +227,6 @@ bool RifReaderOpmCommonActive::importGrid( RigMainGrid* /* mainGrid*/, RigEclips return true; } -// -////-------------------------------------------------------------------------------------------------- -///// -////-------------------------------------------------------------------------------------------------- -// void RifReaderOpmCommonActive::transferActiveGeometry( Opm::EclIO::EGrid& opmMainGrid, -// RigActiveCellGrid* activeGrid, -// RigEclipseCaseData* eclipseCaseData ) -//{ -// int cellCount = opmMainGrid.totalActiveCells(); -// -// RigCell defaultCell; -// defaultCell.setHostGrid( activeGrid ); -// for ( size_t i = 0; i < 8; i++ ) -// defaultCell.cornerIndices()[i] = 0; -// -// activeGrid->reservoirCells().resize( cellCount + 1, defaultCell ); -// activeGrid->reservoirCells()[cellCount].setInvalid( true ); -// -// activeGrid->nodes().resize( ( cellCount + 1 ) * 8, cvf::Vec3d( 0, 0, 0 ) ); -// -// auto& riNodes = activeGrid->nodes(); -// -// opmMainGrid.loadData(); -// opmMainGrid.load_grid_data(); -// -// const bool isRadialGrid = opmMainGrid.is_radial(); -// const auto& activeMatIndexes = opmMainGrid.active_indexes(); -// const auto& activeFracIndexes = opmMainGrid.active_frac_indexes(); -// -// // Compute the center of the LGR radial grid cells for each K layer -// auto radialGridCenterTopLayerOpm = isRadialGrid -// ? RifOpmRadialGridTools::computeXyCenterForTopOfCells( opmMainGrid, opmMainGrid, activeGrid ) -// : std::map>(); -// -// const bool invalidateLongPyramidCells = invalidateLongThinCells(); -// -// // use same mapping as resdata -// const size_t cellMappingECLRi[8] = { 0, 1, 3, 2, 4, 5, 7, 6 }; -// -// #pragma omp parallel for -// for ( int opmCellIndex = 0; opmCellIndex < static_cast( opmMainGrid.totalNumberOfCells() ); opmCellIndex++ ) -// { -// if ( ( activeMatIndexes[opmCellIndex] < 0 ) && ( activeFracIndexes[opmCellIndex] < 0 ) ) continue; -// -// auto opmIJK = opmMainGrid.ijk_from_global_index( opmCellIndex ); -// -// double xCenterCoordOpm = 0.0; -// double yCenterCoordOpm = 0.0; -// -// if ( isRadialGrid && radialGridCenterTopLayerOpm.contains( opmIJK[2] ) ) -// { -// const auto& [xCenter, yCenter] = radialGridCenterTopLayerOpm[opmIJK[2]]; -// xCenterCoordOpm = xCenter; -// yCenterCoordOpm = yCenter; -// } -// -// auto nativeIndex = activeGrid->cellIndexFromIJK( opmIJK[0], opmIJK[1], opmIJK[2] ); -// RigCell& cell = activeGrid->nativeCell( nativeIndex ); -// // auto globalIndex = activeGrid->nativeCellIndexToGlobal( nativeIndex ); -// cell.setGridLocalCellIndex( nativeIndex ); -// cell.setParentCellIndex( cvf::UNDEFINED_SIZE_T ); -// -// // corner coordinates -// std::array opmX{}; -// std::array opmY{}; -// std::array opmZ{}; -// opmMainGrid.getCellCorners( opmCellIndex, opmX, opmY, opmZ ); -// -// // Each cell has 8 nodes, use active cell index and multiply to find first node index for cell -// auto riNodeStartIndex = nativeIndex * 8; -// -// for ( size_t opmNodeIndex = 0; opmNodeIndex < 8; opmNodeIndex++ ) -// { -// auto riCornerIndex = cellMappingECLRi[opmNodeIndex]; -// size_t riNodeIndex = riNodeStartIndex + riCornerIndex; -// -// auto& riNode = riNodes[riNodeIndex]; -// riNode.x() = opmX[opmNodeIndex] + xCenterCoordOpm; -// riNode.y() = opmY[opmNodeIndex] + yCenterCoordOpm; -// riNode.z() = -opmZ[opmNodeIndex]; -// -// cell.cornerIndices()[riCornerIndex] = riNodeIndex; -// } -// -// if ( invalidateLongPyramidCells ) -// { -// cell.setInvalid( cell.isLongPyramidCell() ); -// } -// } -// -// if ( riNodes.size() > 1 ) riNodes[riNodes.size() - 1] = riNodes[0]; -// } //-------------------------------------------------------------------------------------------------- /// diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.cpp index 2a8461c411..23e8e6e0a1 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.cpp @@ -505,7 +505,7 @@ void RimPolygonFilter::updateCellsKIndexEclipse( const std::vector& { for ( size_t j = 0; j < grid->cellCountJ(); j++ ) { - size_t cellIdx = grid->cellIndexFromIJK( i, j, K ); + size_t cellIdx = grid->cellIndexFromIJKUnguarded( i, j, K ); const RigCell& cell = grid->cell( cellIdx ); // valid cell? if ( cell.isInvalid() ) continue; diff --git a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigIndexIjkResultCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigIndexIjkResultCalculator.cpp index 76b3650ce9..e93c0446b5 100644 --- a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigIndexIjkResultCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigIndexIjkResultCalculator.cpp @@ -105,6 +105,7 @@ void RigIndexIjkResultCalculator::calculate( const RigEclipseResultAddress& resV for ( long long cellIdx = 0; cellIdx < numCells; cellIdx++ ) { const RigCell& cell = mainGrid->cell( cellIdx ); + if ( cell.isInvalid() ) continue; size_t resultIndex = cellIdx; if ( resultIndex == cvf::UNDEFINED_SIZE_T ) continue; diff --git a/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.cpp b/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.cpp index 0c5207c1d4..90bcd24f94 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.cpp @@ -29,10 +29,13 @@ RigActiveCellGrid::RigActiveCellGrid() , m_totalActiveCellCount( 0 ) { m_invalidCell.setInvalid( true ); - for ( size_t i = 0; i < 8; i++ ) - m_invalidCell.cornerIndices()[i] = 0; m_invalidCell.setHostGrid( this ); m_invalidCell.setSubGrid( nullptr ); + + for ( size_t i = 0; i < 8; i++ ) + { + m_invalidCell.cornerIndices()[i] = 0; + } } //-------------------------------------------------------------------------------------------------- @@ -42,122 +45,6 @@ RigActiveCellGrid::~RigActiveCellGrid() { } -////-------------------------------------------------------------------------------------------------- -///// -////-------------------------------------------------------------------------------------------------- -// size_t RigActiveCellGrid::transferActiveInformation( int gridIndex, -// RigEclipseCaseData* eclipseCaseData, -// size_t totalActiveCells, -// size_t matrixActiveCells, -// size_t fractureActiveCells, -// const std::vector& activeMatrixIndexes, -// const std::vector& activeFracIndexes, -// size_t inactiveCellIndex ) -//{ -// if ( gridIndex == 0 ) -// { -// m_globalToNativeMap.clear(); -// inactiveCellIndex = 0; -// } -// -// const auto totalCells = activeMatrixIndexes.size(); -// -// const auto cellStartIndex = m_globalToNativeMap.size(); -// -// m_globalToNativeMap.resize( cellStartIndex + totalCells ); -// size_t activeCells = cellStartIndex; -// size_t anInactiveCellIdx = inactiveCellIndex; -// -// for ( size_t i = 0; i < totalCells; i++ ) -// { -// const auto globalCellIndex = cellStartIndex + i; -// if ( ( activeMatrixIndexes[i] < 0 ) && ( activeFracIndexes[i] < 0 ) ) -// { -// m_globalToNativeMap[globalCellIndex] = totalActiveCells; -// anInactiveCellIdx = globalCellIndex; -// continue; -// } -// m_nativeToGlobalMap.push_back( globalCellIndex ); -// m_globalToNativeMap[i] = activeCells++; -// } -// m_nativeToGlobalMap.push_back( anInactiveCellIdx ); -// -// RigActiveCellInfo* activeCellInfo = eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL ); -// RigActiveCellInfo* fractureActiveCellInfo = eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::FRACTURE_MODEL ); -// -// activeCellInfo->setReservoirCellCount( activeCellInfo->reservoirCellCount() + totalActiveCells + 1 ); -// fractureActiveCellInfo->setReservoirCellCount( fractureActiveCellInfo->reservoirCellCount() + totalActiveCells + 1 ); -// -// activeCellInfo->setGridCount( gridIndex + 1 ); -// fractureActiveCellInfo->setGridCount( gridIndex + 1 ); -// -// activeCellInfo->setGridActiveCellCounts( gridIndex, matrixActiveCells ); -// fractureActiveCellInfo->setGridActiveCellCounts( gridIndex, fractureActiveCells ); -// -// // TODO - update indexes here -// -// #pragma omp parallel for -// for ( int opmCellIndex = 0; opmCellIndex < (int)totalCells; opmCellIndex++ ) -// { -// auto activeCellIndex = m_globalToNativeMap[cellStartIndex + opmCellIndex]; -// -// // active cell index -// int matrixActiveIndex = activeMatrixIndexes[opmCellIndex]; -// if ( matrixActiveIndex != -1 ) -// { -// activeCellInfo->setCellResultIndex( activeCellIndex, matrixActiveIndex ); -// } -// -// int fractureActiveIndex = activeFracIndexes[opmCellIndex]; -// if ( fractureActiveIndex != -1 ) -// { -// fractureActiveCellInfo->setCellResultIndex( activeCellIndex, fractureActiveIndex ); -// } -// } -// -// return anInactiveCellIdx; -// } - -////-------------------------------------------------------------------------------------------------- -///// -////-------------------------------------------------------------------------------------------------- -// size_t RigActiveCellGrid::cellIndexFromIJK( size_t i, size_t j, size_t k ) const -//{ -// auto index = RigGridBase::cellIndexFromIJK( i, j, k ); -// return m_globalToActiveMap[index]; -// } -// -////-------------------------------------------------------------------------------------------------- -///// -////-------------------------------------------------------------------------------------------------- -// size_t RigActiveCellGrid::cellIndexFromIJKUnguarded( size_t i, size_t j, size_t k ) const -//{ -// auto index = RigGridBase::cellIndexFromIJKUnguarded( i, j, k ); -// return m_globalToActiveMap[index]; -// } -// -////-------------------------------------------------------------------------------------------------- -///// -////-------------------------------------------------------------------------------------------------- -// bool RigActiveCellGrid::ijkFromCellIndex( size_t cellIndex, size_t* i, size_t* j, size_t* k ) const -//{ -// if ( cellIndex >= m_activeToGlobalMap.size() ) -// { -// return false; -// } -// auto index = m_activeToGlobalMap[cellIndex]; -// return RigGridBase::ijkFromCellIndex( index, i, j, k ); -// } -// -////-------------------------------------------------------------------------------------------------- -///// -////-------------------------------------------------------------------------------------------------- -// void RigActiveCellGrid::ijkFromCellIndexUnguarded( size_t cellIndex, size_t* i, size_t* j, size_t* k ) const -//{ -// auto index = m_activeToGlobalMap[cellIndex]; -// RigGridBase::ijkFromCellIndexUnguarded( index, i, j, k ); -// } - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h b/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h index 8b708c40e8..47ba91ee2a 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h +++ b/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h @@ -28,23 +28,8 @@ public: RigActiveCellGrid(); ~RigActiveCellGrid() override; - // size_t transferActiveInformation( int gridIndex, - // RigEclipseCaseData* eclipseCaseData, - // size_t totalActiveCells, - // size_t matrixActiveCells, - // size_t fractureActiveCells, - // const std::vector& activeMatrixIndexes, - // const std::vector& activeFracIndexes, - // size_t inactiveCellIndex ); - - // size_t cellIndexFromIJK( size_t i, size_t j, size_t k ) const override; - // size_t cellIndexFromIJKUnguarded( size_t i, size_t j, size_t k ) const override; - // bool ijkFromCellIndex( size_t cellIndex, size_t* i, size_t* j, size_t* k ) const override; - // void ijkFromCellIndexUnguarded( size_t cellIndex, size_t* i, size_t* j, size_t* k ) const override; - RigCell& cell( size_t gridLocalCellIndex ) override; const RigCell& cell( size_t gridLocalCellIndex ) const override; - // size_t cellCount() const override; size_t totalCellCount() const override; size_t totalActiveCellCount() const; @@ -56,8 +41,6 @@ public: // only for use by file readers! void setTotalActiveCellCount( size_t totalActiveCellCount ); private: - // std::vector m_globalToNativeMap; - // std::vector m_nativeToGlobalMap; size_t m_totalCellCount; size_t m_totalActiveCellCount; RigCell m_invalidCell; diff --git a/ApplicationLibCode/ReservoirDataModel/RigGridBase.cpp b/ApplicationLibCode/ReservoirDataModel/RigGridBase.cpp index 601633f735..364094d93e 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigGridBase.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigGridBase.cpp @@ -82,9 +82,9 @@ std::string RigGridBase::gridName() const //-------------------------------------------------------------------------------------------------- RigCell& RigGridBase::cell( size_t gridLocalCellIndex ) { - CVF_ASSERT( m_mainGrid ); + CVF_TIGHT_ASSERT( m_mainGrid ); - CVF_ASSERT( m_indexToStartOfCells + gridLocalCellIndex < m_mainGrid->reservoirCells().size() ); + CVF_TIGHT_ASSERT( m_indexToStartOfCells + gridLocalCellIndex < m_mainGrid->reservoirCells().size() ); return m_mainGrid->reservoirCells()[m_indexToStartOfCells + gridLocalCellIndex]; } @@ -94,7 +94,7 @@ RigCell& RigGridBase::cell( size_t gridLocalCellIndex ) //-------------------------------------------------------------------------------------------------- const RigCell& RigGridBase::cell( size_t gridLocalCellIndex ) const { - CVF_ASSERT( m_mainGrid ); + CVF_TIGHT_ASSERT( m_mainGrid ); return m_mainGrid->reservoirCells()[m_indexToStartOfCells + gridLocalCellIndex]; } diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellTargetCandidatesGenerator.cpp b/ApplicationLibCode/ReservoirDataModel/RigWellTargetCandidatesGenerator.cpp index e6354d1f9e..718512f32f 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigWellTargetCandidatesGenerator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigWellTargetCandidatesGenerator.cpp @@ -305,25 +305,27 @@ std::vector RigWellTargetCandidatesGenerator::findCandidates( const RimE std::vector candidates; auto resultsData = eclipseCase.results( RiaDefines::PorosityModelType::MATRIX_MODEL ); + const std::vector faces = { + cvf::StructGridInterface::FaceType::POS_I, + cvf::StructGridInterface::FaceType::NEG_I, + cvf::StructGridInterface::FaceType::POS_J, + cvf::StructGridInterface::FaceType::NEG_J, + cvf::StructGridInterface::FaceType::POS_K, + cvf::StructGridInterface::FaceType::NEG_K, + }; + for ( size_t cellIdx : previousCells ) { - std::vector faces = { - cvf::StructGridInterface::FaceType::POS_I, - cvf::StructGridInterface::FaceType::NEG_I, - cvf::StructGridInterface::FaceType::POS_J, - cvf::StructGridInterface::FaceType::NEG_J, - cvf::StructGridInterface::FaceType::POS_K, - cvf::StructGridInterface::FaceType::NEG_K, - }; + const RigCell& cell = eclipseCase.mainGrid()->cell( cellIdx ); + if ( cell.isInvalid() ) continue; - size_t resultIndex = resultsData->activeCellInfo()->cellResultIndex( cellIdx ); - const RigCell& nativeCell = eclipseCase.mainGrid()->cell( cellIdx ); - RigGridBase* grid = nativeCell.hostGrid(); - size_t gridLocalNativeCellIndex = nativeCell.gridLocalCellIndex(); + RigGridBase* grid = cell.hostGrid(); + size_t gridLocalCellIndex = cell.gridLocalCellIndex(); + size_t resultIndex = resultsData->activeCellInfo()->cellResultIndex( cellIdx ); size_t i, j, k; - grid->ijkFromCellIndex( gridLocalNativeCellIndex, &i, &j, &k ); + grid->ijkFromCellIndex( gridLocalCellIndex, &i, &j, &k ); for ( cvf::StructGridInterface::FaceType face : faces ) { diff --git a/ApplicationLibCode/SocketInterface/RiaCaseInfoCommands.cpp b/ApplicationLibCode/SocketInterface/RiaCaseInfoCommands.cpp index 58863e51bf..d63b12557a 100644 --- a/ApplicationLibCode/SocketInterface/RiaCaseInfoCommands.cpp +++ b/ApplicationLibCode/SocketInterface/RiaCaseInfoCommands.cpp @@ -189,8 +189,6 @@ public: hostCellK.reserve( numMatrixModelActiveCells ); globalCoarseningBoxIdx.reserve( numMatrixModelActiveCells ); - // const std::vector& reservoirCells = reservoirCase->eclipseCaseData()->mainGrid()->globalCellArray(); - auto mainGrid = reservoirCase->eclipseCaseData()->mainGrid(); std::vector globalCoarseningBoxIndexStart; From f7ecd38592fd213b3406fa6b9a126d02ccd6abb7 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Fri, 25 Oct 2024 17:59:43 +0200 Subject: [PATCH 078/160] Add some friends to protect direct access to internal cell storage --- .../ReservoirDataModel/RigActiveCellGrid.h | 3 ++- ApplicationLibCode/ReservoirDataModel/RigMainGrid.h | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h b/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h index 47ba91ee2a..142b47e822 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h +++ b/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h @@ -34,7 +34,8 @@ public: size_t totalCellCount() const override; size_t totalActiveCellCount() const; -public: // only for use by file readers! +protected: // only for use by file readers! + friend class RifReaderOpmCommonActive; std::map& nativeCells(); const std::map& nativeCells() const; void setTotalCellCount( size_t totalCellCount ); diff --git a/ApplicationLibCode/ReservoirDataModel/RigMainGrid.h b/ApplicationLibCode/ReservoirDataModel/RigMainGrid.h index 88ac93e79f..a4e98184a3 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigMainGrid.h +++ b/ApplicationLibCode/ReservoirDataModel/RigMainGrid.h @@ -113,7 +113,16 @@ public: bool isDualPorosity() const; void setDualPorosity( bool enable ); -public: // only for use by file readers! +protected: // only for use by file readers and internal services. TODO: replace with a better API + friend class RigGridBase; + friend class RigReservoirBuilder; + friend class RifRoffFileTools; + friend class RifEclipseOutputFileTools; + friend class RifReaderEclipseOutput; + friend class RifReaderOpmCommon; + friend class RiaGrpcCaseService; + friend class RiaActiveCellInfoStateHandler; + friend class RicCreateTemporaryLgrFeature; std::vector& reservoirCells(); const std::vector& reservoirCells() const; From 8a2a1c218b39c86b8ecfad5d1d9faec5e481a198 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Tue, 29 Oct 2024 14:15:30 +0100 Subject: [PATCH 079/160] Some performance updates --- .../ReservoirDataModel/RigActiveCellGrid.cpp | 10 +++- .../ReservoirDataModel/RigGridBase.cpp | 56 +++++-------------- .../ReservoirDataModel/RigGridBase.h | 10 ++-- 3 files changed, 28 insertions(+), 48 deletions(-) diff --git a/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.cpp b/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.cpp index 90bcd24f94..7eb4054962 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.cpp @@ -50,7 +50,10 @@ RigActiveCellGrid::~RigActiveCellGrid() //-------------------------------------------------------------------------------------------------- RigCell& RigActiveCellGrid::cell( size_t gridLocalCellIndex ) { - if ( m_nativeCells.contains( gridLocalCellIndex ) ) return m_nativeCells[gridLocalCellIndex]; + if ( auto it = m_nativeCells.find( gridLocalCellIndex ); it != m_nativeCells.end() ) + { + return it->second; + } return m_invalidCell; } @@ -59,7 +62,10 @@ RigCell& RigActiveCellGrid::cell( size_t gridLocalCellIndex ) //-------------------------------------------------------------------------------------------------- const RigCell& RigActiveCellGrid::cell( size_t gridLocalCellIndex ) const { - if ( m_nativeCells.contains( gridLocalCellIndex ) ) return m_nativeCells.at( gridLocalCellIndex ); + if ( const auto it = m_nativeCells.find( gridLocalCellIndex ); it != m_nativeCells.end() ) + { + return it->second; + } return m_invalidCell; } diff --git a/ApplicationLibCode/ReservoirDataModel/RigGridBase.cpp b/ApplicationLibCode/ReservoirDataModel/RigGridBase.cpp index 364094d93e..8b87d9ccd9 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigGridBase.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigGridBase.cpp @@ -32,6 +32,8 @@ RigGridBase::RigGridBase( RigMainGrid* mainGrid ) : m_gridPointDimensions( 0, 0, 0 ) , m_indexToStartOfCells( 0 ) , m_mainGrid( mainGrid ) + , m_cellCountIJK( 0 ) + , m_cellCountIJ( 0 ) { if ( mainGrid == nullptr ) { @@ -59,6 +61,9 @@ void RigGridBase::setGridPointDimensions( const cvf::Vec3st& gridDimensions ) m_cellCount.x() = ( m_gridPointDimensions.x() > 0 ? m_gridPointDimensions.x() - 1 : 0 ); m_cellCount.y() = ( m_gridPointDimensions.y() > 0 ? m_gridPointDimensions.y() - 1 : 0 ); m_cellCount.z() = ( m_gridPointDimensions.z() > 0 ? m_gridPointDimensions.z() - 1 : 0 ); + + m_cellCountIJ = cellCountI() * cellCountJ(); + m_cellCountIJK = m_cellCountIJ * cellCountK(); } //-------------------------------------------------------------------------------------------------- @@ -78,12 +83,11 @@ std::string RigGridBase::gridName() const } //-------------------------------------------------------------------------------------------------- -/// Do we need this ? +/// //-------------------------------------------------------------------------------------------------- RigCell& RigGridBase::cell( size_t gridLocalCellIndex ) { CVF_TIGHT_ASSERT( m_mainGrid ); - CVF_TIGHT_ASSERT( m_indexToStartOfCells + gridLocalCellIndex < m_mainGrid->reservoirCells().size() ); return m_mainGrid->reservoirCells()[m_indexToStartOfCells + gridLocalCellIndex]; @@ -185,7 +189,7 @@ size_t RigGridBase::cellIndexFromIJK( size_t i, size_t j, size_t k ) const CVF_TIGHT_ASSERT( i != cvf::UNDEFINED_SIZE_T && j != cvf::UNDEFINED_SIZE_T && k != cvf::UNDEFINED_SIZE_T ); CVF_TIGHT_ASSERT( i < m_gridPointDimensions.x() && j < m_gridPointDimensions.y() && k < m_gridPointDimensions.z() ); - return i + j * cellCountI() + k * cellCountI() * cellCountJ(); + return i + j * m_cellCount.x() + k * m_cellCountIJ; } //-------------------------------------------------------------------------------------------------- @@ -193,7 +197,7 @@ size_t RigGridBase::cellIndexFromIJK( size_t i, size_t j, size_t k ) const //-------------------------------------------------------------------------------------------------- size_t RigGridBase::cellIndexFromIJKUnguarded( size_t i, size_t j, size_t k ) const { - return i + j * cellCountI() + k * cellCountI() * cellCountJ(); + return i + j * m_cellCount.x() + k * m_cellCountIJ; } //-------------------------------------------------------------------------------------------------- @@ -208,7 +212,7 @@ void RigGridBase::cellMinMaxCordinates( size_t cellIndex, cvf::Vec3d* minCoordin //-------------------------------------------------------------------------------------------------- bool RigGridBase::ijkFromCellIndex( size_t cellIndex, size_t* i, size_t* j, size_t* k ) const { - CVF_TIGHT_ASSERT( cellIndex < RigGridBase::cellCount() ); + CVF_TIGHT_ASSERT( cellIndex < m_cellCountIJK ); size_t index = cellIndex; @@ -217,8 +221,8 @@ bool RigGridBase::ijkFromCellIndex( size_t cellIndex, size_t* i, size_t* j, size return false; } - const size_t cellCountI = this->cellCountI(); - const size_t cellCountJ = this->cellCountJ(); + const size_t cellCountI = m_cellCount.x(); + const size_t cellCountJ = m_cellCount.y(); *i = index % cellCountI; index /= cellCountI; @@ -264,8 +268,8 @@ void RigGridBase::ijkFromCellIndexUnguarded( size_t cellIndex, size_t* i, size_t { size_t index = cellIndex; - const size_t cellCountI = this->cellCountI(); - const size_t cellCountJ = this->cellCountJ(); + const size_t cellCountI = m_cellCount.x(); + const size_t cellCountJ = m_cellCount.y(); *i = index % cellCountI; index /= cellCountI; @@ -334,7 +338,7 @@ cvf::Vec3d RigGridBase::maxCoordinate() const //-------------------------------------------------------------------------------------------------- bool RigGridBase::isCellValid( size_t i, size_t j, size_t k ) const { - if ( i >= cellCountI() || j >= cellCountJ() || k >= cellCountK() ) + if ( i >= m_cellCount.x() || j >= m_cellCount.y() || k >= m_cellCount.z() ) { return false; } @@ -519,38 +523,6 @@ cvf::BoundingBox RigGridBase::boundingBox() return m_boundingBox; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -size_t RigGridBase::cellCountI() const -{ - return m_cellCount.x(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -size_t RigGridBase::cellCountJ() const -{ - return m_cellCount.y(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -size_t RigGridBase::cellCountK() const -{ - return m_cellCount.z(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -size_t RigGridBase::cellCount() const -{ - return cellCountI() * cellCountJ() * cellCountK(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ReservoirDataModel/RigGridBase.h b/ApplicationLibCode/ReservoirDataModel/RigGridBase.h index 631eef1b9b..db5fb1da1c 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigGridBase.h +++ b/ApplicationLibCode/ReservoirDataModel/RigGridBase.h @@ -45,11 +45,11 @@ public: void setGridPointDimensions( const cvf::Vec3st& gridDimensions ); - size_t cellCountI() const override; - size_t cellCountJ() const override; - size_t cellCountK() const override; + size_t cellCountI() const override { return m_cellCount.x(); } + size_t cellCountJ() const override { return m_cellCount.y(); } + size_t cellCountK() const override { return m_cellCount.z(); } + virtual size_t cellCount() const { return m_cellCountIJK; } - virtual size_t cellCount() const; virtual RigCell& cell( size_t gridLocalCellIndex ); virtual const RigCell& cell( size_t gridLocalCellIndex ) const; @@ -116,6 +116,8 @@ public: protected: size_t m_indexToStartOfCells; ///< Index into the global cell array stored in main-grid where this grids cells starts. + size_t m_cellCountIJK; + size_t m_cellCountIJ; private: std::string m_gridName; From 2154c0ae3b7ea0a05cb3ecfecfcc83aefee250b5 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 29 Oct 2024 15:44:05 +0100 Subject: [PATCH 080/160] Use updated API for total cell count --- ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp b/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp index 94aa48d653..06a234a61f 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp @@ -668,7 +668,7 @@ bool RifEclipseOutputFileTools::assignActiveCellData( std::vectormainGrid()->reservoirCells().size() != reservoirCellCount ) + if ( eclipseCaseData->mainGrid()->totalCellCount() != reservoirCellCount ) { return false; } From 4468e89dedf2abb7ee492aaa3944574fc8e668b4 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Tue, 29 Oct 2024 18:02:05 +0100 Subject: [PATCH 081/160] Ignore empty branches and invalid cells --- .../RigMswCenterLineCalculator.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ApplicationLibCode/ReservoirDataModel/RigMswCenterLineCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/RigMswCenterLineCalculator.cpp index e1f2dde911..ca17c4b757 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigMswCenterLineCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigMswCenterLineCalculator.cpp @@ -148,8 +148,9 @@ std::vector const auto& [gridIndex, cellIndex] = gridAndCellIndices.front(); if ( gridIndex < eclipseCaseData->gridCount() && cellIndex < eclipseCaseData->grid( gridIndex )->cellCount() ) { - const RigCell& cell = eclipseCaseData->grid( gridIndex )->cell( cellIndex ); - cvf::Vec3d whStartPos = cell.faceCenter( cvf::StructGridInterface::NEG_K ); + const RigCell& cell = eclipseCaseData->grid( gridIndex )->cell( cellIndex ); + if ( cell.isInvalid() ) continue; + cvf::Vec3d whStartPos = cell.faceCenter( cvf::StructGridInterface::NEG_K ); // Add extra coordinate between cell face and cell center // to make sure the well pipe terminated in a segment parallel to z-axis @@ -209,9 +210,13 @@ std::vector } } - const auto simWellBranch = addCoordsAtCellFaceIntersectionsAndCreateBranch( cellCenterCoords, cellCenterResultPoints, eclipseCaseData ); + if ( !cellCenterCoords.empty() ) + { + const auto simWellBranch = + addCoordsAtCellFaceIntersectionsAndCreateBranch( cellCenterCoords, cellCenterResultPoints, eclipseCaseData ); - simWellBranches.emplace_back( simWellBranch ); + simWellBranches.emplace_back( simWellBranch ); + } } return simWellBranches; From 7677466d297864940436d6416c6d646c346c91bc Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 30 Oct 2024 09:56:57 +0100 Subject: [PATCH 082/160] Make sure plot create from Python is visible --- .../ProjectDataModelCommands/RimcSummaryPlotCollection.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryPlotCollection.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryPlotCollection.cpp index 8a750efd3e..d7d915fcd9 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryPlotCollection.cpp @@ -18,6 +18,7 @@ #include "RimcSummaryPlotCollection.h" +#include "PlotBuilderCommands/RicSummaryPlotBuilder.h" #include "SummaryPlotCommands/RicNewDefaultSummaryPlotFeature.h" #include "SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.h" #include "SummaryPlotCommands/RicSummaryPlotFeatureImpl.h" @@ -83,6 +84,7 @@ caf::PdmObjectHandle* RimcSummaryPlotCollection_newSummaryPlot::execute() if ( newPlot ) { newPlot->loadDataAndUpdate(); + RicSummaryPlotBuilder::createAndAppendSingleSummaryMultiPlot( newPlot ); } return newPlot; From 151128d82923f2430f08037fc00b5fc655a6406c Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 30 Oct 2024 13:58:04 +0100 Subject: [PATCH 083/160] Bump version to 2024.09.3-dev.02 --- ResInsightVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index 7f16a1fdf5..7950a4720f 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -11,7 +11,7 @@ set(RESINSIGHT_VERSION_TEXT "-dev") # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -set(RESINSIGHT_DEV_VERSION ".01") +set(RESINSIGHT_DEV_VERSION ".02") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") From da683bed9e4a173333aa5618b29bb89a4db492a8 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Wed, 30 Oct 2024 17:23:08 +0100 Subject: [PATCH 084/160] Move Rig well related things to subfolder and update include statements --- .../Application/Tools/RiaExtractionTools.cpp | 2 +- .../Application/Tools/RiaWellLogUnitTools.inl | 2 +- ApplicationLibCode/CMakeLists.txt | 1 + .../RicExportFishbonesLateralsFeature.cpp | 2 +- .../RicNewFishbonesSubsFeature.cpp | 2 +- .../RicNewStimPlanModelPlotFeature.cpp | 2 +- ...icExportCompletionsWellSegmentsFeature.cpp | 2 +- .../RicExportFractureCompletionsImpl.cpp | 6 +- ...sTransmissibilityCalculationFeatureImp.cpp | 6 +- .../RicMswExportInfo.cpp | 2 +- .../RicMswTableFormatterTools.cpp | 2 +- ...ellPathExportCompletionDataFeatureImpl.cpp | 8 +- .../RicWellPathExportMswCompletionsImpl.cpp | 6 +- .../RicCreateDepthAdjustedLasFilesFeature.cpp | 4 +- .../RicCreateDepthAdjustedLasFilesImpl.cpp | 4 +- .../ExportCommands/RicExportLgrFeature.cpp | 6 +- .../RicExportSelectedWellPathsFeature.cpp | 4 +- .../RicExportToLasFileFeature.cpp | 2 +- .../RicExportVisibleWellPathsFeature.cpp | 2 +- .../RicPlotProductionRateFeature.cpp | 2 +- .../RicShowContributingWellsFeatureImpl.cpp | 2 +- .../RicCreateMultipleFracturesUi.cpp | 6 +- .../RicNewWellPathFractureFeature.cpp | 2 +- .../RicWellPathsImportOsduFeature.cpp | 2 +- .../Commands/RicWellLogTools.cpp | 2 +- .../RicAddWellLogToPlotFeature.cpp | 2 +- .../WellLogCommands/RicNewPltPlotFeature.cpp | 2 +- .../RicNewRftWellLogPlotFeature.cpp | 2 +- .../RicNewWellBoreStabilityPlotFeature.cpp | 3 +- .../RicNewWellLogExtractionCurveFeature.cpp | 2 +- .../RicNewWellLogRftCurveFeature.cpp | 2 +- .../RicWellTarget3dEditor.cpp | 2 +- .../RicCreateMultipleWellPathLaterals.cpp | 2 +- .../RicCreateMultipleWellPathLateralsUi.cpp | 2 +- .../RicCreateWellTargetsPickEventHandler.cpp | 4 +- .../RicDuplicateWellPathFeature.cpp | 2 +- .../RicNewWellPathLateralAtDepthFeature.cpp | 3 +- .../RicNewWellPathLateralFeature.cpp | 3 +- .../RicPolylineTargetsPickEventHandler.cpp | 2 +- .../RicSetParentWellPathFeature.cpp | 2 +- .../FileInterface/RifOsduWellLogReader.h | 2 +- .../FileInterface/RifOsduWellPathReader.cpp | 2 +- .../FileInterface/RifReaderEclipseOutput.cpp | 6 +- .../FileInterface/RifReaderEclipseWell.cpp | 6 +- .../RifReaderEnsembleStatisticsRft.cpp | 4 +- .../FileInterface/RifReaderOpmCommon.cpp | 4 +- .../FileInterface/RifReaderRftInterface.cpp | 6 +- .../RifStimPlanModelDeviationFrkExporter.cpp | 2 +- .../RifStimPlanModelPerfsFrkExporter.cpp | 4 +- .../RifWellPathFormationReader.h | 2 +- .../RifWellPathFormationsImporter.h | 2 +- .../FileInterface/RifWellPathImporter.h | 2 +- ...FemPartResultCalculatorMudWeightWindow.cpp | 2 +- ...PartResultCalculatorShearSlipIndicator.cpp | 2 +- .../Riv3dWellLogCurveGeometryGenerator.cpp | 4 +- .../Riv3dWellLogDrawSurfaceGenerator.cpp | 4 +- .../RivCompletionTypeResultToTextureMapper.h | 2 +- .../RivDefaultResultToTextureMapper.h | 3 +- .../RivFishbonesSubsPartMgr.cpp | 2 +- .../RivResultToTextureMapper.h | 2 +- .../RivSimWellPipesPartMgr.cpp | 12 +- .../RivSimWellPipesPartMgr.h | 2 +- .../RivTernaryResultToTextureMapper.h | 2 +- .../RivTernaryTextureCoordsCreator.cpp | 2 +- .../RivTextureCoordsCreator.cpp | 2 +- .../RivWellConnectionFactorPartMgr.cpp | 6 +- .../RivWellConnectionsPartMgr.cpp | 4 +- .../ModelVisualization/RivWellDiskPartMgr.cpp | 4 +- .../RivWellFracturePartMgr.cpp | 2 +- .../ModelVisualization/RivWellHeadPartMgr.cpp | 4 +- .../ModelVisualization/RivWellPathPartMgr.cpp | 2 +- .../RivWellPathSourceInfo.cpp | 2 +- .../RivWellSpheresPartMgr.cpp | 6 +- .../Streamlines/RivStreamlinesPartMgr.cpp | 4 +- .../RimCompletionCellIntersectionCalc.cpp | 4 +- .../Completions/RimFishbones.cpp | 5 +- .../Completions/RimFishbonesCollection.cpp | 2 +- .../Completions/RimMeshFractureTemplate.cpp | 2 +- .../Completions/RimMultipleValveLocations.cpp | 2 +- .../Completions/RimPerforationCollection.cpp | 2 +- .../Completions/RimPerforationInterval.cpp | 2 +- .../Completions/RimSimWellFracture.cpp | 8 +- .../Completions/RimSimWellFracture.h | 3 +- .../RimThermalFractureTemplate.cpp | 2 +- .../Completions/RimWellPathFracture.cpp | 2 +- .../Completions/RimWellPathValve.cpp | 2 +- ...ltReactivationDataAccessorPorePressure.cpp | 4 +- ...RimFaultReactivationDataAccessorStress.cpp | 4 +- ...tReactivationDataAccessorStressEclipse.cpp | 4 +- ...tReactivationDataAccessorStressGeoMech.cpp | 4 +- ...ultReactivationDataAccessorTemperature.cpp | 4 +- ...ctivationDataAccessorWellLogExtraction.cpp | 6 +- .../Flow/RimFlowDiagSolution.cpp | 6 +- .../RimTofAccumulatedPhaseFractionsPlot.cpp | 2 +- .../Flow/RimTotalWellAllocationPlot.cpp | 2 +- .../Flow/RimWellAllocationOverTimePlot.cpp | 10 +- .../Flow/RimWellAllocationPlot.cpp | 10 +- .../Flow/RimWellAllocationTools.cpp | 2 +- .../Flow/RimWellConnectivityTable.cpp | 10 +- .../Flow/RimWellFlowRateCurve.cpp | 2 +- .../Flow/RimWellPlotTools.cpp | 2 +- .../ProjectDataModel/Flow/RimWellPltPlot.cpp | 14 +- .../GeoMech/RimGeoMechResultDefinition.cpp | 2 +- .../RimExtrudedCurveIntersection.cpp | 4 +- .../ProjectDataModel/RimDepthTrackPlot.cpp | 6 +- .../ProjectDataModel/RimEclipseCase.cpp | 4 +- .../RimEclipseStatisticsCase.cpp | 2 +- .../ProjectDataModel/RimEclipseView.cpp | 6 +- .../ProjectDataModel/RimPltPlotCollection.cpp | 4 +- .../ProjectDataModel/RimRftPlotCollection.cpp | 4 +- .../ProjectDataModel/RimSimWellInView.cpp | 10 +- .../ProjectDataModel/RimSimWellInView.h | 4 +- .../RimSimWellInViewCollection.cpp | 4 +- .../RimSimWellInViewTools.cpp | 4 +- .../ProjectDataModel/RimWbsParameters.h | 2 +- .../RimWellBoreStabilityPlot.h | 2 +- .../RimWellTargetCandidatesGenerator.cpp | 2 +- .../RimWellTargetCandidatesGenerator.h | 2 +- .../Seismic/RimSeismicSection.cpp | 2 +- .../StimPlanModel/RimStimPlanModel.cpp | 2 +- .../StimPlanModel/RimStimPlanModel.h | 2 +- ...StimPlanModelElasticPropertyCalculator.cpp | 6 +- .../RimStimPlanModelLayerCalculator.cpp | 4 +- .../RimStimPlanModelPressureCalculator.cpp | 4 +- .../RimStimPlanModelStressCalculator.cpp | 6 +- .../RimStimPlanModelWellLogCalculator.cpp | 6 +- .../RimStreamlineInViewCollection.cpp | 4 +- .../WellLog/Rim3dWellLogExtractionCurve.cpp | 11 +- .../WellLog/Rim3dWellLogFileCurve.cpp | 2 +- .../WellLog/Rim3dWellLogRftCurve.cpp | 2 +- .../WellLog/RimEnsembleWellLogCurveSet.cpp | 2 +- .../WellLog/RimEnsembleWellLogStatistics.cpp | 4 +- .../ProjectDataModel/WellLog/RimOsduWellLog.h | 2 +- .../WellLog/RimOsduWellLogDataLoader.cpp | 2 +- .../WellLog/RimRftTopologyCurve.cpp | 2 +- .../WellLog/RimWellLogCalculatedCurve.cpp | 2 +- .../WellLog/RimWellLogCsvFile.cpp | 2 +- .../WellLog/RimWellLogCsvFile.h | 2 +- .../WellLog/RimWellLogCurve.cpp | 2 +- .../WellLog/RimWellLogExtractionCurve.cpp | 16 +- .../WellLog/RimWellLogFileDataLoader.cpp | 2 +- .../WellLog/RimWellLogLasFile.cpp | 2 +- .../WellLog/RimWellLogLasFile.h | 3 +- .../WellLog/RimWellLogLasFileCurve.cpp | 6 +- .../WellLog/RimWellLogPlot.cpp | 4 +- .../WellLog/RimWellLogPlotCollection.cpp | 4 +- .../WellLog/RimWellLogRftCurve.cpp | 10 +- .../WellLog/RimWellLogTrack.cpp | 16 +- .../WellLog/RimWellLogTrack.h | 3 +- .../RimWellMeasurementCollection.cpp | 2 +- .../RimWellMeasurementCurve.cpp | 4 +- .../WellPath/RimFileWellPathDataLoader.cpp | 2 +- .../WellPath/RimModeledWellPath.cpp | 5 +- .../WellPath/RimModeledWellPathDataLoader.cpp | 2 +- .../WellPath/RimOsduWellPathDataLoader.cpp | 2 +- .../WellPath/RimWellIASettings.cpp | 8 +- .../ProjectDataModel/WellPath/RimWellPath.cpp | 2 +- .../WellPath/RimWellPathAttribute.cpp | 3 +- .../WellPath/RimWellPathCollection.cpp | 4 +- .../WellPath/RimWellPathCollection.h | 3 +- .../WellPath/RimWellPathGeometryDef.cpp | 2 +- .../WellPath/RimWellPathGroup.cpp | 3 +- .../WellPath/RimWellPathTarget.cpp | 2 +- .../WellPath/RimWellPathTieIn.cpp | 2 +- .../ReservoirDataModel/CMakeLists_files.cmake | 328 ++++++++---------- .../CMakeLists_filesNotToUnitTest.cmake | 10 - .../RigWellPathStimplanIntersector.cpp | 2 +- .../ReservoirDataModel/RigEclipseCaseData.cpp | 12 +- .../RigEclipseCaseDataTools.cpp | 2 +- .../ReservoirDataModel/RigLasFileExporter.cpp | 4 +- .../RigReservoirBuilderMock.cpp | 6 +- .../RigStimPlanModelTools.cpp | 6 +- .../RigSurfaceResampler.cpp | 2 +- .../Well/CMakeLists_files.cmake | 69 ++++ .../{ => Well}/RigAccWellFlowCalculator.cpp | 0 .../{ => Well}/RigAccWellFlowCalculator.h | 0 .../{ => Well}/RigEclipseWellLogExtractor.cpp | 0 .../{ => Well}/RigEclipseWellLogExtractor.h | 0 .../{ => Well}/RigFishbonesGeometry.cpp | 0 .../{ => Well}/RigFishbonesGeometry.h | 0 .../{ => Well}/RigGeoMechWellLogExtractor.cpp | 0 .../{ => Well}/RigGeoMechWellLogExtractor.h | 0 .../{ => Well}/RigMswCenterLineCalculator.cpp | 0 .../{ => Well}/RigMswCenterLineCalculator.h | 0 .../{ => Well}/RigOsduWellLogData.cpp | 0 .../{ => Well}/RigOsduWellLogData.h | 0 .../{ => Well}/RigPipeInCellEvaluator.h | 0 .../{ => Well}/RigSimWellData.cpp | 0 .../{ => Well}/RigSimWellData.h | 0 .../RigSimulationWellCenterLineCalculator.cpp | 0 .../RigSimulationWellCenterLineCalculator.h | 0 .../RigSimulationWellCoordsAndMD.cpp | 0 .../{ => Well}/RigSimulationWellCoordsAndMD.h | 0 .../{ => Well}/RigWellAllocationOverTime.cpp | 0 .../{ => Well}/RigWellAllocationOverTime.h | 0 .../{ => Well}/RigWellDiskData.cpp | 0 .../{ => Well}/RigWellDiskData.h | 0 .../{ => Well}/RigWellLogCsvFile.cpp | 0 .../{ => Well}/RigWellLogCsvFile.h | 0 .../{ => Well}/RigWellLogCurveData.cpp | 0 .../{ => Well}/RigWellLogCurveData.h | 0 .../{ => Well}/RigWellLogData.cpp | 0 .../{ => Well}/RigWellLogData.h | 0 .../{ => Well}/RigWellLogExtractionTools.h | 0 .../{ => Well}/RigWellLogExtractor.cpp | 0 .../{ => Well}/RigWellLogExtractor.h | 0 .../{ => Well}/RigWellLogIndexDepthOffset.cpp | 0 .../{ => Well}/RigWellLogIndexDepthOffset.h | 0 .../{ => Well}/RigWellLogLasFile.cpp | 0 .../{ => Well}/RigWellLogLasFile.h | 0 .../{ => Well}/RigWellPath.cpp | 0 .../{ => Well}/RigWellPath.h | 0 .../{ => Well}/RigWellPathFormations.cpp | 0 .../{ => Well}/RigWellPathFormations.h | 0 .../RigWellPathGeometryExporter.cpp | 0 .../{ => Well}/RigWellPathGeometryExporter.h | 0 .../{ => Well}/RigWellPathGeometryTools.cpp | 0 .../{ => Well}/RigWellPathGeometryTools.h | 0 .../RigWellPathIntersectionTools.cpp | 0 .../{ => Well}/RigWellPathIntersectionTools.h | 0 .../{ => Well}/RigWellResultBranch.cpp | 0 .../{ => Well}/RigWellResultBranch.h | 0 .../{ => Well}/RigWellResultFrame.cpp | 0 .../{ => Well}/RigWellResultFrame.h | 0 .../{ => Well}/RigWellResultPoint.cpp | 0 .../{ => Well}/RigWellResultPoint.h | 0 .../RigWellTargetCandidatesGenerator.cpp | 0 .../RigWellTargetCandidatesGenerator.h | 0 .../SocketInterface/RiaWellDataCommands.cpp | 6 +- .../UnitTests/RifOsduWellPathReader-Test.cpp | 2 +- .../UnitTests/RigWellLogCurveData-Test.cpp | 2 +- .../UnitTests/RigWellLogExtractor-Test.cpp | 4 +- .../RigWellPathGeometryExporter-Test.cpp | 5 +- .../RigWellPathGeometryTools-Test.cpp | 2 +- .../RigWellPathIntersectionTools-Test.cpp | 2 +- .../UserInterface/RiuResultTextBuilder.cpp | 6 +- .../UserInterface/RiuWellLogTrack.cpp | 2 +- .../RiuWellPathComponentPlotItem.cpp | 3 +- .../RiaGrpcSimulationWellService.cpp | 6 +- 239 files changed, 555 insertions(+), 526 deletions(-) create mode 100644 ApplicationLibCode/ReservoirDataModel/Well/CMakeLists_files.cmake rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigAccWellFlowCalculator.cpp (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigAccWellFlowCalculator.h (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigEclipseWellLogExtractor.cpp (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigEclipseWellLogExtractor.h (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigFishbonesGeometry.cpp (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigFishbonesGeometry.h (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigGeoMechWellLogExtractor.cpp (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigGeoMechWellLogExtractor.h (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigMswCenterLineCalculator.cpp (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigMswCenterLineCalculator.h (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigOsduWellLogData.cpp (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigOsduWellLogData.h (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigPipeInCellEvaluator.h (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigSimWellData.cpp (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigSimWellData.h (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigSimulationWellCenterLineCalculator.cpp (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigSimulationWellCenterLineCalculator.h (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigSimulationWellCoordsAndMD.cpp (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigSimulationWellCoordsAndMD.h (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellAllocationOverTime.cpp (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellAllocationOverTime.h (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellDiskData.cpp (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellDiskData.h (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellLogCsvFile.cpp (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellLogCsvFile.h (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellLogCurveData.cpp (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellLogCurveData.h (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellLogData.cpp (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellLogData.h (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellLogExtractionTools.h (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellLogExtractor.cpp (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellLogExtractor.h (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellLogIndexDepthOffset.cpp (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellLogIndexDepthOffset.h (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellLogLasFile.cpp (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellLogLasFile.h (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellPath.cpp (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellPath.h (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellPathFormations.cpp (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellPathFormations.h (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellPathGeometryExporter.cpp (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellPathGeometryExporter.h (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellPathGeometryTools.cpp (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellPathGeometryTools.h (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellPathIntersectionTools.cpp (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellPathIntersectionTools.h (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellResultBranch.cpp (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellResultBranch.h (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellResultFrame.cpp (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellResultFrame.h (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellResultPoint.cpp (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellResultPoint.h (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellTargetCandidatesGenerator.cpp (100%) rename ApplicationLibCode/ReservoirDataModel/{ => Well}/RigWellTargetCandidatesGenerator.h (100%) diff --git a/ApplicationLibCode/Application/Tools/RiaExtractionTools.cpp b/ApplicationLibCode/Application/Tools/RiaExtractionTools.cpp index 7e66cdb34d..b4988d52a8 100644 --- a/ApplicationLibCode/Application/Tools/RiaExtractionTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaExtractionTools.cpp @@ -20,7 +20,7 @@ #include "RiaSimWellBranchTools.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "RimEclipseCase.h" #include "RimMainPlotCollection.h" diff --git a/ApplicationLibCode/Application/Tools/RiaWellLogUnitTools.inl b/ApplicationLibCode/Application/Tools/RiaWellLogUnitTools.inl index 848a38fa4e..ee39d88dc2 100644 --- a/ApplicationLibCode/Application/Tools/RiaWellLogUnitTools.inl +++ b/ApplicationLibCode/Application/Tools/RiaWellLogUnitTools.inl @@ -16,7 +16,7 @@ // ///////////////////////////////////////////////////////////////////////////////// #include "RiaEclipseUnitTools.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "cafAssert.h" diff --git a/ApplicationLibCode/CMakeLists.txt b/ApplicationLibCode/CMakeLists.txt index e76de70324..c54a0ba788 100644 --- a/ApplicationLibCode/CMakeLists.txt +++ b/ApplicationLibCode/CMakeLists.txt @@ -95,6 +95,7 @@ list( ReservoirDataModel/Completions/CMakeLists_files.cmake ReservoirDataModel/ResultAccessors/CMakeLists_files.cmake ReservoirDataModel/ResultCalculators/CMakeLists_files.cmake + ReservoirDataModel/Well/CMakeLists_files.cmake FileInterface/CMakeLists_files.cmake ProjectDataModel/CMakeLists_files.cmake ProjectDataModel/AnalysisPlots/CMakeLists_files.cmake diff --git a/ApplicationLibCode/Commands/CompletionCommands/RicExportFishbonesLateralsFeature.cpp b/ApplicationLibCode/Commands/CompletionCommands/RicExportFishbonesLateralsFeature.cpp index 27c1b7b7ee..6bf4e255bc 100644 --- a/ApplicationLibCode/Commands/CompletionCommands/RicExportFishbonesLateralsFeature.cpp +++ b/ApplicationLibCode/Commands/CompletionCommands/RicExportFishbonesLateralsFeature.cpp @@ -23,7 +23,7 @@ #include "ExportCommands/RicExportSelectedWellPathsFeature.h" #include "ExportCommands/RicExportWellPathsUi.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "RimFishbones.h" #include "RimFishbonesCollection.h" diff --git a/ApplicationLibCode/Commands/CompletionCommands/RicNewFishbonesSubsFeature.cpp b/ApplicationLibCode/Commands/CompletionCommands/RicNewFishbonesSubsFeature.cpp index adade1a55e..48508927b9 100644 --- a/ApplicationLibCode/Commands/CompletionCommands/RicNewFishbonesSubsFeature.cpp +++ b/ApplicationLibCode/Commands/CompletionCommands/RicNewFishbonesSubsFeature.cpp @@ -23,7 +23,7 @@ #include "RiaApplication.h" #include "RiaLogging.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "Rim3dView.h" #include "RimFishbones.h" diff --git a/ApplicationLibCode/Commands/CompletionCommands/RicNewStimPlanModelPlotFeature.cpp b/ApplicationLibCode/Commands/CompletionCommands/RicNewStimPlanModelPlotFeature.cpp index bd16c33b13..d57b4e1bc9 100644 --- a/ApplicationLibCode/Commands/CompletionCommands/RicNewStimPlanModelPlotFeature.cpp +++ b/ApplicationLibCode/Commands/CompletionCommands/RicNewStimPlanModelPlotFeature.cpp @@ -27,7 +27,7 @@ #include "RimPlotCurveAppearance.h" #include "WellLogCommands/RicNewWellLogPlotFeatureImpl.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "RimColorLegend.h" #include "RimColorLegendCollection.h" diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicExportCompletionsWellSegmentsFeature.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/RicExportCompletionsWellSegmentsFeature.cpp index 8014266d2b..a0eeb845e0 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicExportCompletionsWellSegmentsFeature.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicExportCompletionsWellSegmentsFeature.cpp @@ -39,7 +39,7 @@ #include "RigEclipseCaseData.h" #include "RigMainGrid.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "Riu3DMainWindowTools.h" diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp index 64d71ffe5f..5fe2c9c0c8 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp @@ -57,12 +57,12 @@ #include "RigFractureTransmissibilityEquations.h" #include "RigMainGrid.h" #include "RigResultAccessorFactory.h" -#include "RigSimWellData.h" -#include "RigSimulationWellCoordsAndMD.h" #include "RigTransmissibilityCondenser.h" #include "RigTransmissibilityEquations.h" -#include "RigWellPath.h" #include "RigWellPathStimplanIntersector.h" +#include "Well/RigSimWellData.h" +#include "Well/RigSimulationWellCoordsAndMD.h" +#include "Well/RigWellPath.h" #include "cvfGeometryTools.h" #include "cvfPlane.h" diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp index 0b9727e335..7c87870b01 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp @@ -30,9 +30,9 @@ #include "RigCompletionData.h" #include "RigEclipseCaseData.h" #include "RigMainGrid.h" -#include "RigWellLogExtractor.h" -#include "RigWellPath.h" -#include "RigWellPathIntersectionTools.h" +#include "Well/RigWellLogExtractor.h" +#include "Well/RigWellPath.h" +#include "Well/RigWellPathIntersectionTools.h" #include "RimFishbones.h" #include "RimFishbonesCollection.h" diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicMswExportInfo.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/RicMswExportInfo.cpp index 19085c5aef..db3874d273 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicMswExportInfo.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicMswExportInfo.cpp @@ -24,7 +24,7 @@ #include "RimMswCompletionParameters.h" #include "RimWellPath.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include #include diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicMswTableFormatterTools.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/RicMswTableFormatterTools.cpp index b07193bbb9..a511d46d95 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicMswTableFormatterTools.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicMswTableFormatterTools.cpp @@ -25,7 +25,7 @@ #include "RifTextDataTableFormatter.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "RimMswCompletionParameters.h" #include "RimWellPath.h" // TODO: Consider adding wellnameforexport to RicMswExportInfo to avoid these includes diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp index 21293dbbc6..9788290fa4 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp @@ -47,10 +47,10 @@ #include "RigResultAccessorFactory.h" #include "RigTransmissibilityEquations.h" #include "RigVirtualPerforationTransmissibilities.h" -#include "RigWellLogExtractionTools.h" -#include "RigWellLogExtractor.h" -#include "RigWellPath.h" -#include "RigWellPathIntersectionTools.h" +#include "Well/RigWellLogExtractionTools.h" +#include "Well/RigWellLogExtractor.h" +#include "Well/RigWellPath.h" +#include "Well/RigWellPathIntersectionTools.h" #include "RimFileWellPath.h" #include "RimFishbones.h" diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp index 3886b7bc3a..87fbdb8146 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp @@ -34,9 +34,9 @@ #include "RigEclipseCaseData.h" #include "RigGridBase.h" #include "RigMainGrid.h" -#include "RigWellLogExtractor.h" -#include "RigWellPath.h" -#include "RigWellPathIntersectionTools.h" +#include "Well/RigWellLogExtractor.h" +#include "Well/RigWellPath.h" +#include "Well/RigWellPathIntersectionTools.h" #include "RimEclipseCase.h" #include "RimFishbones.h" diff --git a/ApplicationLibCode/Commands/ExportCommands/RicCreateDepthAdjustedLasFilesFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicCreateDepthAdjustedLasFilesFeature.cpp index 22608e7c04..ee5f7115f6 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicCreateDepthAdjustedLasFilesFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicCreateDepthAdjustedLasFilesFeature.cpp @@ -24,8 +24,8 @@ #include "RicCreateDepthAdjustedLasFilesUi.h" #include "RicExportFeatureImpl.h" -#include "RigEclipseWellLogExtractor.h" -#include "RigGeoMechWellLogExtractor.h" +#include "Well/RigEclipseWellLogExtractor.h" +#include "Well/RigGeoMechWellLogExtractor.h" #include "RimEclipseCase.h" #include "RimGeoMechCase.h" diff --git a/ApplicationLibCode/Commands/ExportCommands/RicCreateDepthAdjustedLasFilesImpl.cpp b/ApplicationLibCode/Commands/ExportCommands/RicCreateDepthAdjustedLasFilesImpl.cpp index 3e1c6fb469..f614b6474c 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicCreateDepthAdjustedLasFilesImpl.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicCreateDepthAdjustedLasFilesImpl.cpp @@ -26,9 +26,9 @@ #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" #include "RigEclipseResultAddress.h" -#include "RigEclipseWellLogExtractor.h" -#include "RigGeoMechWellLogExtractor.h" #include "RigResultAccessorFactory.h" +#include "Well/RigEclipseWellLogExtractor.h" +#include "Well/RigGeoMechWellLogExtractor.h" #include "RimEclipseCase.h" #include "RimGeoMechCase.h" diff --git a/ApplicationLibCode/Commands/ExportCommands/RicExportLgrFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicExportLgrFeature.cpp index ca79552d1d..09b3d1d6c4 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicExportLgrFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicExportLgrFeature.cpp @@ -31,9 +31,9 @@ #include "RigResultAccessor.h" #include "RigResultAccessorFactory.h" #include "RigVirtualPerforationTransmissibilities.h" -#include "RigWellLogExtractor.h" -#include "RigWellPath.h" -#include "RigWellPathIntersectionTools.h" +#include "Well/RigWellLogExtractor.h" +#include "Well/RigWellPath.h" +#include "Well/RigWellPathIntersectionTools.h" #include "RimDialogData.h" #include "RimEclipseCase.h" diff --git a/ApplicationLibCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.cpp index 452eb0d040..cb5b98b24a 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.cpp @@ -25,8 +25,8 @@ #include "RifTextDataTableFormatter.h" -#include "RigWellPath.h" -#include "RigWellPathGeometryExporter.h" +#include "Well/RigWellPath.h" +#include "Well/RigWellPathGeometryExporter.h" #include "RimDialogData.h" #include "RimModeledWellPath.h" diff --git a/ApplicationLibCode/Commands/ExportCommands/RicExportToLasFileFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicExportToLasFileFeature.cpp index 0993156c11..d26b11ecf8 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicExportToLasFileFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicExportToLasFileFeature.cpp @@ -26,7 +26,7 @@ #include "RiaApplication.h" #include "RigLasFileExporter.h" -#include "RigWellLogCurveData.h" +#include "Well/RigWellLogCurveData.h" #include "RimWellLogCurve.h" #include "RimWellLogPlot.h" diff --git a/ApplicationLibCode/Commands/ExportCommands/RicExportVisibleWellPathsFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicExportVisibleWellPathsFeature.cpp index 8ff9fffca6..34a24760f5 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicExportVisibleWellPathsFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicExportVisibleWellPathsFeature.cpp @@ -23,7 +23,7 @@ #include "CompletionExportCommands/RicExportCompletionsForVisibleWellPathsFeature.h" #include "RicExportSelectedWellPathsFeature.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "RimProject.h" #include "RimSummaryCaseMainCollection.h" diff --git a/ApplicationLibCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp b/ApplicationLibCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp index afdbf172ca..7f4fd82b81 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp +++ b/ApplicationLibCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp @@ -25,7 +25,7 @@ #include "RifEclipseSummaryAddress.h" #include "RifSummaryReaderInterface.h" -#include "RigSimWellData.h" +#include "Well/RigSimWellData.h" #include "Rim3dView.h" #include "RimEclipseResultCase.h" diff --git a/ApplicationLibCode/Commands/FlowCommands/RicShowContributingWellsFeatureImpl.cpp b/ApplicationLibCode/Commands/FlowCommands/RicShowContributingWellsFeatureImpl.cpp index 0de825b3dd..3d596e0113 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicShowContributingWellsFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/FlowCommands/RicShowContributingWellsFeatureImpl.cpp @@ -21,7 +21,7 @@ #include "RicSelectOrCreateViewFeatureImpl.h" #include "RigFlowDiagResultAddress.h" -#include "RigSimWellData.h" +#include "Well/RigSimWellData.h" #include "RimEclipseCellColors.h" #include "RimEclipsePropertyFilter.h" diff --git a/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesUi.cpp b/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesUi.cpp index f56ea64643..ab8198488f 100644 --- a/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesUi.cpp +++ b/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesUi.cpp @@ -22,9 +22,9 @@ #include "RigEclipseCaseData.h" #include "RigMainGrid.h" -#include "RigWellLogExtractor.h" -#include "RigWellPath.h" -#include "RigWellPathIntersectionTools.h" +#include "Well/RigWellLogExtractor.h" +#include "Well/RigWellPath.h" +#include "Well/RigWellPathIntersectionTools.h" #include "RimEclipseCase.h" #include "RimFractureTemplate.h" diff --git a/ApplicationLibCode/Commands/FractureCommands/RicNewWellPathFractureFeature.cpp b/ApplicationLibCode/Commands/FractureCommands/RicNewWellPathFractureFeature.cpp index e30b170a07..03f85d9437 100644 --- a/ApplicationLibCode/Commands/FractureCommands/RicNewWellPathFractureFeature.cpp +++ b/ApplicationLibCode/Commands/FractureCommands/RicNewWellPathFractureFeature.cpp @@ -23,7 +23,7 @@ #include "RicFractureNameGenerator.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "RimCase.h" #include "RimEclipseView.h" diff --git a/ApplicationLibCode/Commands/OsduImportCommands/RicWellPathsImportOsduFeature.cpp b/ApplicationLibCode/Commands/OsduImportCommands/RicWellPathsImportOsduFeature.cpp index 5c29c921d1..b28eb1a9fe 100644 --- a/ApplicationLibCode/Commands/OsduImportCommands/RicWellPathsImportOsduFeature.cpp +++ b/ApplicationLibCode/Commands/OsduImportCommands/RicWellPathsImportOsduFeature.cpp @@ -27,7 +27,7 @@ #include "RiaPreferences.h" #include "RiaPreferencesOsdu.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "RimFileWellPath.h" #include "RimOilField.h" diff --git a/ApplicationLibCode/Commands/RicWellLogTools.cpp b/ApplicationLibCode/Commands/RicWellLogTools.cpp index 28585e0611..194105b432 100644 --- a/ApplicationLibCode/Commands/RicWellLogTools.cpp +++ b/ApplicationLibCode/Commands/RicWellLogTools.cpp @@ -21,7 +21,7 @@ #include "RiaGuiApplication.h" #include "RigEclipseCaseData.h" -#include "RigWellLogCurveData.h" +#include "Well/RigWellLogCurveData.h" #include "Rim3dView.h" #include "RimCase.h" diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp index 67efb6ec3c..65a98d92f4 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp @@ -34,7 +34,7 @@ #include "RimWellPathCollection.h" #include "RiuPlotMainWindowTools.h" -#include "RigWellLogLasFile.h" +#include "Well/RigWellLogLasFile.h" #include "RiuQwtPlotWidget.h" diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewPltPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicNewPltPlotFeature.cpp index 5de141d281..cf49d1beb2 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewPltPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewPltPlotFeature.cpp @@ -24,7 +24,7 @@ #include "RicNewWellLogPlotFeatureImpl.h" #include "RicWellLogPlotCurveFeatureImpl.h" -#include "RigWellLogCurveData.h" +#include "Well/RigWellLogCurveData.h" #include "Rim3dView.h" #include "RimEclipseResultCase.h" diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewRftWellLogPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicNewRftWellLogPlotFeature.cpp index dc48f5ce2b..4943392cc5 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewRftWellLogPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewRftWellLogPlotFeature.cpp @@ -24,7 +24,7 @@ #include "RiaApplication.h" -#include "RigWellLogCurveData.h" +#include "Well/RigWellLogCurveData.h" #include "RimRftCase.h" #include "RimSummaryCase.h" diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.cpp index 3b9430c64f..1200960273 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.cpp @@ -29,7 +29,8 @@ #include "RigFemPartResultsCollection.h" #include "RigFemResultAddress.h" #include "RigGeoMechCaseData.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" + #include "RimGeoMechCase.h" #include "RimGeoMechView.h" #include "RimProject.h" diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogExtractionCurveFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogExtractionCurveFeature.cpp index 489560be33..ab0dded45c 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogExtractionCurveFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogExtractionCurveFeature.cpp @@ -25,7 +25,7 @@ #include "RiaApplication.h" -#include "RigWellLogCurveData.h" +#include "Well/RigWellLogCurveData.h" #include "Rim3dView.h" #include "RimGridView.h" diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogRftCurveFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogRftCurveFeature.cpp index 1188f1064e..700c603b98 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogRftCurveFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogRftCurveFeature.cpp @@ -26,7 +26,7 @@ #include "RimWellLogRftCurve.h" #include "RimWellLogTrack.h" -#include "RigWellLogCurveData.h" +#include "Well/RigWellLogCurveData.h" #include "RiuPlotMainWindow.h" diff --git a/ApplicationLibCode/Commands/WellPathCommands/PointTangentManipulator/RicWellTarget3dEditor.cpp b/ApplicationLibCode/Commands/WellPathCommands/PointTangentManipulator/RicWellTarget3dEditor.cpp index 471e5eeebb..82178a2947 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/PointTangentManipulator/RicWellTarget3dEditor.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/PointTangentManipulator/RicWellTarget3dEditor.cpp @@ -20,7 +20,7 @@ #include "RicPointTangentManipulator.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "Rim2dIntersectionView.h" #include "Rim3dView.h" diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicCreateMultipleWellPathLaterals.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicCreateMultipleWellPathLaterals.cpp index 5fcff88dfa..d899b58c94 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicCreateMultipleWellPathLaterals.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicCreateMultipleWellPathLaterals.cpp @@ -20,7 +20,7 @@ #include "RicNewWellPathLateralAtDepthFeature.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "RimModeledWellPath.h" #include "RimProject.h" diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicCreateMultipleWellPathLateralsUi.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicCreateMultipleWellPathLateralsUi.cpp index ceff7f3560..a3a5e81e84 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicCreateMultipleWellPathLateralsUi.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicCreateMultipleWellPathLateralsUi.cpp @@ -21,7 +21,7 @@ #include "RifTextDataTableFormatter.h" #include "RigMainGrid.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "RimModeledWellPath.h" #include "RimTools.h" diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicCreateWellTargetsPickEventHandler.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicCreateWellTargetsPickEventHandler.cpp index f864f55675..be61c9b264 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicCreateWellTargetsPickEventHandler.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicCreateWellTargetsPickEventHandler.cpp @@ -23,8 +23,8 @@ #include "RigFemPartGrid.h" #include "RigHexIntersectionTools.h" #include "RigMainGrid.h" -#include "RigWellPath.h" -#include "RigWellPathGeometryTools.h" +#include "Well/RigWellPath.h" +#include "Well/RigWellPathGeometryTools.h" #include "Rim3dView.h" #include "RimCase.h" diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicDuplicateWellPathFeature.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicDuplicateWellPathFeature.cpp index e2a9a0ef49..4d200bb220 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicDuplicateWellPathFeature.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicDuplicateWellPathFeature.cpp @@ -20,7 +20,7 @@ #include "RiaColorTables.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "RimModeledWellPath.h" #include "RimOilField.h" diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicNewWellPathLateralAtDepthFeature.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicNewWellPathLateralAtDepthFeature.cpp index 3d1f092ed1..93e3c3ef5f 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicNewWellPathLateralAtDepthFeature.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicNewWellPathLateralAtDepthFeature.cpp @@ -20,7 +20,8 @@ #include "WellPathCommands/RicWellPathsUnitSystemSettingsImpl.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" + #include "RimFishbones.h" #include "RimFishbonesCollection.h" #include "RimModeledWellPath.h" diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicNewWellPathLateralFeature.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicNewWellPathLateralFeature.cpp index 5b59bab64d..f73c4ea12e 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicNewWellPathLateralFeature.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicNewWellPathLateralFeature.cpp @@ -20,7 +20,8 @@ #include "RicNewWellPathLateralAtDepthFeature.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" + #include "RimWellPath.h" #include "cafSelectionManager.h" diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicPolylineTargetsPickEventHandler.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicPolylineTargetsPickEventHandler.cpp index 179ebb47fd..2b8622d8da 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicPolylineTargetsPickEventHandler.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicPolylineTargetsPickEventHandler.cpp @@ -20,7 +20,7 @@ #include "RiaOffshoreSphericalCoords.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "Rim3dView.h" #include "RimModeledWellPath.h" diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicSetParentWellPathFeature.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicSetParentWellPathFeature.cpp index a130320d9b..3b2a0df964 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicSetParentWellPathFeature.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicSetParentWellPathFeature.cpp @@ -18,7 +18,7 @@ #include "RicSetParentWellPathFeature.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "RimTools.h" #include "RimWellPath.h" diff --git a/ApplicationLibCode/FileInterface/RifOsduWellLogReader.h b/ApplicationLibCode/FileInterface/RifOsduWellLogReader.h index 2246a9cf58..3b1834a983 100644 --- a/ApplicationLibCode/FileInterface/RifOsduWellLogReader.h +++ b/ApplicationLibCode/FileInterface/RifOsduWellLogReader.h @@ -18,7 +18,7 @@ #pragma once -#include "RigOsduWellLogData.h" +#include "Well/RigOsduWellLogData.h" #include "cvfObject.h" diff --git a/ApplicationLibCode/FileInterface/RifOsduWellPathReader.cpp b/ApplicationLibCode/FileInterface/RifOsduWellPathReader.cpp index 69f2edb0b4..6b66a2d32f 100644 --- a/ApplicationLibCode/FileInterface/RifOsduWellPathReader.cpp +++ b/ApplicationLibCode/FileInterface/RifOsduWellPathReader.cpp @@ -35,7 +35,7 @@ #include "RifByteArrayArrowRandomAccessFile.h" #include "RifCsvUserDataParser.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "cvfObject.h" #include "cvfVector3.h" diff --git a/ApplicationLibCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationLibCode/FileInterface/RifReaderEclipseOutput.cpp index c31c4ef443..9d5ef9aaa7 100644 --- a/ApplicationLibCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderEclipseOutput.cpp @@ -44,9 +44,9 @@ #include "RigEquil.h" #include "RigMainGrid.h" #include "RigNNCData.h" -#include "RigSimWellData.h" -#include "RigWellResultFrame.h" -#include "RigWellResultPoint.h" +#include "Well/RigSimWellData.h" +#include "Well/RigWellResultFrame.h" +#include "Well/RigWellResultPoint.h" #include "cafProgressInfo.h" diff --git a/ApplicationLibCode/FileInterface/RifReaderEclipseWell.cpp b/ApplicationLibCode/FileInterface/RifReaderEclipseWell.cpp index cf7be960e2..18e2850b62 100644 --- a/ApplicationLibCode/FileInterface/RifReaderEclipseWell.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderEclipseWell.cpp @@ -26,9 +26,9 @@ #include "RigEclipseResultInfo.h" #include "RigGridBase.h" #include "RigMainGrid.h" -#include "RigSimWellData.h" -#include "RigWellResultFrame.h" -#include "RigWellResultPoint.h" +#include "Well/RigSimWellData.h" +#include "Well/RigWellResultFrame.h" +#include "Well/RigWellResultPoint.h" #include "cafProgressInfo.h" diff --git a/ApplicationLibCode/FileInterface/RifReaderEnsembleStatisticsRft.cpp b/ApplicationLibCode/FileInterface/RifReaderEnsembleStatisticsRft.cpp index b8fe39ecc1..379c3671c6 100644 --- a/ApplicationLibCode/FileInterface/RifReaderEnsembleStatisticsRft.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderEnsembleStatisticsRft.cpp @@ -20,9 +20,9 @@ #include "RiaExtractionTools.h" -#include "RigEclipseWellLogExtractor.h" #include "RigStatisticsMath.h" -#include "RigWellPath.h" +#include "Well/RigEclipseWellLogExtractor.h" +#include "Well/RigWellPath.h" #include "RimSummaryCase.h" #include "RimSummaryEnsemble.h" diff --git a/ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp b/ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp index 799dfba243..96309c0ef8 100644 --- a/ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp @@ -36,8 +36,8 @@ #include "RigEclipseResultInfo.h" #include "RigMainGrid.h" #include "RigNNCData.h" -#include "RigSimWellData.h" -#include "RigWellResultFrame.h" +#include "Well/RigSimWellData.h" +#include "Well/RigWellResultFrame.h" #include "cafProgressInfo.h" diff --git a/ApplicationLibCode/FileInterface/RifReaderRftInterface.cpp b/ApplicationLibCode/FileInterface/RifReaderRftInterface.cpp index b143877668..7586662807 100644 --- a/ApplicationLibCode/FileInterface/RifReaderRftInterface.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderRftInterface.cpp @@ -19,10 +19,10 @@ #include "RifReaderRftInterface.h" #include "RigEclipseCaseData.h" -#include "RigEclipseWellLogExtractor.h" #include "RigMainGrid.h" -#include "RigWellPath.h" -#include "RigWellPathGeometryTools.h" +#include "Well/RigEclipseWellLogExtractor.h" +#include "Well/RigWellPath.h" +#include "Well/RigWellPathGeometryTools.h" #include "cafVecIjk.h" diff --git a/ApplicationLibCode/FileInterface/RifStimPlanModelDeviationFrkExporter.cpp b/ApplicationLibCode/FileInterface/RifStimPlanModelDeviationFrkExporter.cpp index 826b162cd4..10d88d114e 100644 --- a/ApplicationLibCode/FileInterface/RifStimPlanModelDeviationFrkExporter.cpp +++ b/ApplicationLibCode/FileInterface/RifStimPlanModelDeviationFrkExporter.cpp @@ -23,7 +23,7 @@ #include "RimStimPlanModel.h" #include "RimWellPath.h" -#include "RigWellPathGeometryExporter.h" +#include "Well/RigWellPathGeometryExporter.h" #include #include diff --git a/ApplicationLibCode/FileInterface/RifStimPlanModelPerfsFrkExporter.cpp b/ApplicationLibCode/FileInterface/RifStimPlanModelPerfsFrkExporter.cpp index a4627f129a..8193d6a07f 100644 --- a/ApplicationLibCode/FileInterface/RifStimPlanModelPerfsFrkExporter.cpp +++ b/ApplicationLibCode/FileInterface/RifStimPlanModelPerfsFrkExporter.cpp @@ -24,8 +24,8 @@ #include "RimStimPlanModel.h" #include "RimWellPath.h" -#include "RigWellPath.h" -#include "RigWellPathGeometryTools.h" +#include "Well/RigWellPath.h" +#include "Well/RigWellPathGeometryTools.h" #include "caf.h" diff --git a/ApplicationLibCode/FileInterface/RifWellPathFormationReader.h b/ApplicationLibCode/FileInterface/RifWellPathFormationReader.h index 39e29c1ffc..71c9309896 100644 --- a/ApplicationLibCode/FileInterface/RifWellPathFormationReader.h +++ b/ApplicationLibCode/FileInterface/RifWellPathFormationReader.h @@ -18,7 +18,7 @@ #pragma once -#include "RigWellPathFormations.h" +#include "Well/RigWellPathFormations.h" #include #include diff --git a/ApplicationLibCode/FileInterface/RifWellPathFormationsImporter.h b/ApplicationLibCode/FileInterface/RifWellPathFormationsImporter.h index 788fe5f3ad..655de4f989 100644 --- a/ApplicationLibCode/FileInterface/RifWellPathFormationsImporter.h +++ b/ApplicationLibCode/FileInterface/RifWellPathFormationsImporter.h @@ -18,7 +18,7 @@ #pragma once -#include "RigWellPathFormations.h" +#include "Well/RigWellPathFormations.h" #include "cvfObject.h" diff --git a/ApplicationLibCode/FileInterface/RifWellPathImporter.h b/ApplicationLibCode/FileInterface/RifWellPathImporter.h index 9ecba0f384..90c20db81d 100644 --- a/ApplicationLibCode/FileInterface/RifWellPathImporter.h +++ b/ApplicationLibCode/FileInterface/RifWellPathImporter.h @@ -20,7 +20,7 @@ #pragma once -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "cvfObject.h" diff --git a/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPartResultCalculatorMudWeightWindow.cpp b/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPartResultCalculatorMudWeightWindow.cpp index 76907ad2e5..2486563bfe 100644 --- a/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPartResultCalculatorMudWeightWindow.cpp +++ b/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPartResultCalculatorMudWeightWindow.cpp @@ -26,7 +26,7 @@ #include "RigFemResultAddress.h" #include "RigFemScalarResultFrames.h" #include "RigGeoMechBoreHoleStressCalculator.h" -#include "RigGeoMechWellLogExtractor.h" +#include "Well/RigGeoMechWellLogExtractor.h" #include "RiaOffshoreSphericalCoords.h" diff --git a/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPartResultCalculatorShearSlipIndicator.cpp b/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPartResultCalculatorShearSlipIndicator.cpp index 74e3564586..839503ba84 100644 --- a/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPartResultCalculatorShearSlipIndicator.cpp +++ b/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPartResultCalculatorShearSlipIndicator.cpp @@ -25,7 +25,7 @@ #include "RigFemPartResultsCollection.h" #include "RigFemResultAddress.h" #include "RigFemScalarResultFrames.h" -#include "RigGeoMechWellLogExtractor.h" +#include "Well/RigGeoMechWellLogExtractor.h" #include "cafProgressInfo.h" diff --git a/ApplicationLibCode/ModelVisualization/Riv3dWellLogCurveGeometryGenerator.cpp b/ApplicationLibCode/ModelVisualization/Riv3dWellLogCurveGeometryGenerator.cpp index b2fc3e5764..50eaf2d4d0 100644 --- a/ApplicationLibCode/ModelVisualization/Riv3dWellLogCurveGeometryGenerator.cpp +++ b/ApplicationLibCode/ModelVisualization/Riv3dWellLogCurveGeometryGenerator.cpp @@ -19,8 +19,8 @@ #include "Riv3dWellLogCurveGeometryGenerator.h" #include "RiaCurveDataTools.h" -#include "RigWellPath.h" -#include "RigWellPathGeometryTools.h" +#include "Well/RigWellPath.h" +#include "Well/RigWellPathGeometryTools.h" #include "Rim3dWellLogCurve.h" #include "RimWellPath.h" diff --git a/ApplicationLibCode/ModelVisualization/Riv3dWellLogDrawSurfaceGenerator.cpp b/ApplicationLibCode/ModelVisualization/Riv3dWellLogDrawSurfaceGenerator.cpp index 99d02239fa..75bde49b03 100644 --- a/ApplicationLibCode/ModelVisualization/Riv3dWellLogDrawSurfaceGenerator.cpp +++ b/ApplicationLibCode/ModelVisualization/Riv3dWellLogDrawSurfaceGenerator.cpp @@ -21,8 +21,8 @@ #include "RimWellPath.h" #include "RimWellPathCollection.h" -#include "RigWellPath.h" -#include "RigWellPathGeometryTools.h" +#include "Well/RigWellPath.h" +#include "Well/RigWellPathGeometryTools.h" #include "cafDisplayCoordTransform.h" diff --git a/ApplicationLibCode/ModelVisualization/RivCompletionTypeResultToTextureMapper.h b/ApplicationLibCode/ModelVisualization/RivCompletionTypeResultToTextureMapper.h index 3ea5d0463b..f2ca3465cd 100644 --- a/ApplicationLibCode/ModelVisualization/RivCompletionTypeResultToTextureMapper.h +++ b/ApplicationLibCode/ModelVisualization/RivCompletionTypeResultToTextureMapper.h @@ -21,7 +21,7 @@ #include "RivResultToTextureMapper.h" -#include "RigPipeInCellEvaluator.h" +#include "Well/RigPipeInCellEvaluator.h" #include "cvfScalarMapper.h" #include "cvfVector2.h" diff --git a/ApplicationLibCode/ModelVisualization/RivDefaultResultToTextureMapper.h b/ApplicationLibCode/ModelVisualization/RivDefaultResultToTextureMapper.h index 0eb7763ac1..ddc5a8b2eb 100644 --- a/ApplicationLibCode/ModelVisualization/RivDefaultResultToTextureMapper.h +++ b/ApplicationLibCode/ModelVisualization/RivDefaultResultToTextureMapper.h @@ -19,7 +19,8 @@ #pragma once -#include "RigPipeInCellEvaluator.h" +#include "Well/RigPipeInCellEvaluator.h" + #include "RivResultToTextureMapper.h" #include "cvfScalarMapper.h" diff --git a/ApplicationLibCode/ModelVisualization/RivFishbonesSubsPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivFishbonesSubsPartMgr.cpp index fc7582cc5d..163ac34cd1 100644 --- a/ApplicationLibCode/ModelVisualization/RivFishbonesSubsPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivFishbonesSubsPartMgr.cpp @@ -18,7 +18,7 @@ #include "RivFishbonesSubsPartMgr.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "RimFishbones.h" #include "RimWellPath.h" diff --git a/ApplicationLibCode/ModelVisualization/RivResultToTextureMapper.h b/ApplicationLibCode/ModelVisualization/RivResultToTextureMapper.h index ea05b6ed2f..4ff02b7d4d 100644 --- a/ApplicationLibCode/ModelVisualization/RivResultToTextureMapper.h +++ b/ApplicationLibCode/ModelVisualization/RivResultToTextureMapper.h @@ -19,7 +19,7 @@ #pragma once -#include "RigPipeInCellEvaluator.h" +#include "Well/RigPipeInCellEvaluator.h" #include "cvfScalarMapper.h" #include "cvfVector2.h" diff --git a/ApplicationLibCode/ModelVisualization/RivSimWellPipesPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivSimWellPipesPartMgr.cpp index 9ec86ad276..aa0d1cdf5c 100644 --- a/ApplicationLibCode/ModelVisualization/RivSimWellPipesPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivSimWellPipesPartMgr.cpp @@ -24,13 +24,13 @@ #include "RiaExtractionTools.h" #include "RiaPreferences.h" -#include "RigEclipseWellLogExtractor.h" -#include "RigMswCenterLineCalculator.h" -#include "RigSimulationWellCenterLineCalculator.h" #include "RigVirtualPerforationTransmissibilities.h" -#include "RigWellLogExtractor.h" -#include "RigWellPath.h" -#include "RigWellResultFrame.h" +#include "Well/RigEclipseWellLogExtractor.h" +#include "Well/RigMswCenterLineCalculator.h" +#include "Well/RigSimulationWellCenterLineCalculator.h" +#include "Well/RigWellLogExtractor.h" +#include "Well/RigWellPath.h" +#include "Well/RigWellResultFrame.h" #include "Rim3dView.h" #include "RimCase.h" diff --git a/ApplicationLibCode/ModelVisualization/RivSimWellPipesPartMgr.h b/ApplicationLibCode/ModelVisualization/RivSimWellPipesPartMgr.h index 17e5f61406..6bc4ddd200 100644 --- a/ApplicationLibCode/ModelVisualization/RivSimWellPipesPartMgr.h +++ b/ApplicationLibCode/ModelVisualization/RivSimWellPipesPartMgr.h @@ -18,7 +18,7 @@ #pragma once -#include "RigSimWellData.h" +#include "Well/RigSimWellData.h" #include "cafPdmPointer.h" diff --git a/ApplicationLibCode/ModelVisualization/RivTernaryResultToTextureMapper.h b/ApplicationLibCode/ModelVisualization/RivTernaryResultToTextureMapper.h index 168523d50c..5a5857c87d 100644 --- a/ApplicationLibCode/ModelVisualization/RivTernaryResultToTextureMapper.h +++ b/ApplicationLibCode/ModelVisualization/RivTernaryResultToTextureMapper.h @@ -19,7 +19,7 @@ #pragma once -#include "RigPipeInCellEvaluator.h" +#include "Well/RigPipeInCellEvaluator.h" #include "RivTernaryScalarMapper.h" diff --git a/ApplicationLibCode/ModelVisualization/RivTernaryTextureCoordsCreator.cpp b/ApplicationLibCode/ModelVisualization/RivTernaryTextureCoordsCreator.cpp index 066e7278c7..59a39d1649 100644 --- a/ApplicationLibCode/ModelVisualization/RivTernaryTextureCoordsCreator.cpp +++ b/ApplicationLibCode/ModelVisualization/RivTernaryTextureCoordsCreator.cpp @@ -24,9 +24,9 @@ #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" #include "RigEclipseResultAddress.h" -#include "RigPipeInCellEvaluator.h" #include "RigResultAccessorFactory.h" #include "RigTernaryResultAccessor.h" +#include "Well/RigPipeInCellEvaluator.h" #include "RimEclipseCase.h" #include "RimEclipseResultDefinition.h" diff --git a/ApplicationLibCode/ModelVisualization/RivTextureCoordsCreator.cpp b/ApplicationLibCode/ModelVisualization/RivTextureCoordsCreator.cpp index 473bbb34c0..320dced778 100644 --- a/ApplicationLibCode/ModelVisualization/RivTextureCoordsCreator.cpp +++ b/ApplicationLibCode/ModelVisualization/RivTextureCoordsCreator.cpp @@ -21,8 +21,8 @@ #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" -#include "RigPipeInCellEvaluator.h" #include "RigResultAccessorFactory.h" +#include "Well/RigPipeInCellEvaluator.h" #include "RimEclipseCase.h" #include "RimEclipseCellColors.h" diff --git a/ApplicationLibCode/ModelVisualization/RivWellConnectionFactorPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivWellConnectionFactorPartMgr.cpp index dc69669e9a..bd72563ae0 100644 --- a/ApplicationLibCode/ModelVisualization/RivWellConnectionFactorPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivWellConnectionFactorPartMgr.cpp @@ -20,11 +20,11 @@ #include "RiaExtractionTools.h" -#include "RigEclipseWellLogExtractor.h" #include "RigMainGrid.h" #include "RigVirtualPerforationTransmissibilities.h" -#include "RigWellLogExtractor.h" -#include "RigWellPath.h" +#include "Well/RigEclipseWellLogExtractor.h" +#include "Well/RigWellLogExtractor.h" +#include "Well/RigWellPath.h" #include "RimEclipseCase.h" #include "RimEclipseView.h" diff --git a/ApplicationLibCode/ModelVisualization/RivWellConnectionsPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivWellConnectionsPartMgr.cpp index 965dbd81b7..27671e82f0 100644 --- a/ApplicationLibCode/ModelVisualization/RivWellConnectionsPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivWellConnectionsPartMgr.cpp @@ -27,8 +27,8 @@ #include "RigEclipseCaseData.h" #include "RigFlowDiagResults.h" #include "RigMainGrid.h" -#include "RigSimWellData.h" -#include "RigWellResultFrame.h" +#include "Well/RigSimWellData.h" +#include "Well/RigWellResultFrame.h" #include "cafDisplayCoordTransform.h" #include "cafEffectGenerator.h" diff --git a/ApplicationLibCode/ModelVisualization/RivWellDiskPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivWellDiskPartMgr.cpp index d89a3ea110..36414e16da 100644 --- a/ApplicationLibCode/ModelVisualization/RivWellDiskPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivWellDiskPartMgr.cpp @@ -23,8 +23,8 @@ #include "RigActiveCellInfo.h" #include "RigCell.h" -#include "RigSimWellData.h" -#include "RigWellResultFrame.h" +#include "Well/RigSimWellData.h" +#include "Well/RigWellResultFrame.h" #include "RimEclipseCase.h" #include "RimEclipseView.h" diff --git a/ApplicationLibCode/ModelVisualization/RivWellFracturePartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivWellFracturePartMgr.cpp index 2580c08c48..3dac06d863 100644 --- a/ApplicationLibCode/ModelVisualization/RivWellFracturePartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivWellFracturePartMgr.cpp @@ -24,7 +24,7 @@ #include "RigFractureGrid.h" #include "RigHexIntersectionTools.h" #include "RigMainGrid.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "RimCase.h" #include "RimEclipseCase.h" diff --git a/ApplicationLibCode/ModelVisualization/RivWellHeadPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivWellHeadPartMgr.cpp index dd911735fb..21237ff3e3 100644 --- a/ApplicationLibCode/ModelVisualization/RivWellHeadPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivWellHeadPartMgr.cpp @@ -26,8 +26,8 @@ #include "RigCell.h" #include "RigEclipseCaseData.h" #include "RigMainGrid.h" -#include "RigSimWellData.h" -#include "RigWellResultFrame.h" +#include "Well/RigSimWellData.h" +#include "Well/RigWellResultFrame.h" #include "RimEclipseCase.h" #include "RimEclipseView.h" diff --git a/ApplicationLibCode/ModelVisualization/RivWellPathPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivWellPathPartMgr.cpp index 97dfdaaf22..8ec0eefd76 100644 --- a/ApplicationLibCode/ModelVisualization/RivWellPathPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivWellPathPartMgr.cpp @@ -25,7 +25,7 @@ #include "RigEclipseCaseData.h" #include "RigMainGrid.h" #include "RigVirtualPerforationTransmissibilities.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "Rim3dWellLogCurveCollection.h" #include "RimEclipseCase.h" diff --git a/ApplicationLibCode/ModelVisualization/RivWellPathSourceInfo.cpp b/ApplicationLibCode/ModelVisualization/RivWellPathSourceInfo.cpp index 1cdb8652e9..8cafc6bd71 100644 --- a/ApplicationLibCode/ModelVisualization/RivWellPathSourceInfo.cpp +++ b/ApplicationLibCode/ModelVisualization/RivWellPathSourceInfo.cpp @@ -19,7 +19,7 @@ #include "RivWellPathSourceInfo.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "Rim3dView.h" #include "RimCase.h" diff --git a/ApplicationLibCode/ModelVisualization/RivWellSpheresPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivWellSpheresPartMgr.cpp index 9e04c755fb..8e8d937f21 100644 --- a/ApplicationLibCode/ModelVisualization/RivWellSpheresPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivWellSpheresPartMgr.cpp @@ -21,9 +21,9 @@ #include "RiaGuiApplication.h" #include "RigMainGrid.h" -#include "RigSimWellData.h" -#include "RigWellResultFrame.h" -#include "RigWellResultPoint.h" +#include "Well/RigSimWellData.h" +#include "Well/RigWellResultFrame.h" +#include "Well/RigWellResultPoint.h" #include "RimEclipseCase.h" #include "RimEclipseView.h" diff --git a/ApplicationLibCode/ModelVisualization/Streamlines/RivStreamlinesPartMgr.cpp b/ApplicationLibCode/ModelVisualization/Streamlines/RivStreamlinesPartMgr.cpp index 0fa3cb989d..064d60930c 100644 --- a/ApplicationLibCode/ModelVisualization/Streamlines/RivStreamlinesPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/Streamlines/RivStreamlinesPartMgr.cpp @@ -31,10 +31,10 @@ #include "RigCell.h" #include "RigEclipseCaseData.h" #include "RigMainGrid.h" -#include "RigSimulationWellCenterLineCalculator.h" #include "RigTracer.h" #include "RigTracerPoint.h" -#include "RigWellResultPoint.h" +#include "Well/RigSimulationWellCenterLineCalculator.h" +#include "Well/RigWellResultPoint.h" #include "RiuViewer.h" diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimCompletionCellIntersectionCalc.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimCompletionCellIntersectionCalc.cpp index 97e9c40a81..4ca8e476f9 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimCompletionCellIntersectionCalc.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimCompletionCellIntersectionCalc.cpp @@ -23,8 +23,8 @@ #include "RigCompletionData.h" #include "RigVirtualPerforationTransmissibilities.h" -#include "RigWellPath.h" -#include "RigWellPathIntersectionTools.h" +#include "Well/RigWellPath.h" +#include "Well/RigWellPathIntersectionTools.h" #include "RimEclipseCase.h" #include "RimOilField.h" diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFishbones.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimFishbones.cpp index 5e7bd42c9b..a056075c6a 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFishbones.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFishbones.cpp @@ -21,8 +21,9 @@ #include "RiaColorTables.h" #include "RiaEclipseUnitTools.h" -#include "RigFishbonesGeometry.h" -#include "RigWellPath.h" +#include "Well/RigFishbonesGeometry.h" +#include "Well/RigWellPath.h" + #include "RimFishbonesCollection.h" #include "RimFishbonesPipeProperties.h" #include "RimMultipleValveLocations.h" diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFishbonesCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimFishbonesCollection.cpp index 790a00bf0c..cb3782aff9 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFishbonesCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFishbonesCollection.cpp @@ -22,7 +22,7 @@ #include "RifWellPathImporter.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "RimFishbones.h" #include "RimProject.h" diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimMeshFractureTemplate.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimMeshFractureTemplate.cpp index 93d0767e34..17c438f600 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimMeshFractureTemplate.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimMeshFractureTemplate.cpp @@ -28,8 +28,8 @@ #include "RigFractureCell.h" #include "RigFractureGrid.h" #include "RigTransmissibilityEquations.h" -#include "RigWellPath.h" #include "RigWellPathStimplanIntersector.h" +#include "Well/RigWellPath.h" #include "RimEclipseView.h" #include "RimFracture.h" diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimMultipleValveLocations.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimMultipleValveLocations.cpp index 3408b530f1..f6105c9a28 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimMultipleValveLocations.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimMultipleValveLocations.cpp @@ -18,7 +18,7 @@ #include "RimMultipleValveLocations.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "RiaEclipseUnitTools.h" diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationCollection.cpp index 2a2c0483b4..dac47964aa 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationCollection.cpp @@ -27,7 +27,7 @@ #include "RimPerforationInterval.h" #include "RimProject.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "RifWellPathImporter.h" diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationInterval.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationInterval.cpp index b08a830bb3..e10a4e76af 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationInterval.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationInterval.cpp @@ -24,7 +24,7 @@ #include "RiaQDateTimeTools.h" #include "RigCaseCellResultsData.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "RimPerforationCollection.h" #include "RimProject.h" diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFracture.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFracture.cpp index c325b89c6f..c027cac759 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFracture.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFracture.cpp @@ -20,10 +20,10 @@ #include "RigCell.h" #include "RigMainGrid.h" -#include "RigSimWellData.h" -#include "RigSimulationWellCenterLineCalculator.h" -#include "RigWellPath.h" -#include "RigWellResultPoint.h" +#include "Well/RigSimWellData.h" +#include "Well/RigSimulationWellCenterLineCalculator.h" +#include "Well/RigWellPath.h" +#include "Well/RigWellResultPoint.h" #include "RimEclipseView.h" #include "RimEllipseFractureTemplate.h" diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFracture.h b/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFracture.h index 5e66c541c1..15ce4e70c7 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFracture.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFracture.h @@ -20,7 +20,8 @@ #include "RimFracture.h" -#include "RigSimulationWellCoordsAndMD.h" +#include "Well/RigSimulationWellCoordsAndMD.h" + #include "RimEllipseFractureTemplate.h" //================================================================================================== diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimThermalFractureTemplate.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimThermalFractureTemplate.cpp index 65fb1f04f2..95b9ca9b6c 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimThermalFractureTemplate.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimThermalFractureTemplate.cpp @@ -31,7 +31,7 @@ #include "RigFractureGrid.h" #include "RigThermalFractureDefinition.h" #include "RigThermalFractureResultUtil.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "RimEclipseView.h" #include "RimFracture.h" diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFracture.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFracture.cpp index 85911f9f0b..53cc738d07 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFracture.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFracture.cpp @@ -19,7 +19,7 @@ #include "RimWellPathFracture.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "RimEllipseFractureTemplate.h" #include "RimProject.h" diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathValve.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathValve.cpp index 9e8af72834..a660054522 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathValve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathValve.cpp @@ -24,7 +24,7 @@ #include "Riu3DMainWindowTools.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "RimMultipleValveLocations.h" #include "RimPerforationInterval.h" diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationDataAccessorPorePressure.cpp b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationDataAccessorPorePressure.cpp index c63b8c9607..40593259d4 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationDataAccessorPorePressure.cpp +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationDataAccessorPorePressure.cpp @@ -29,11 +29,11 @@ #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" #include "RigEclipseResultAddress.h" -#include "RigEclipseWellLogExtractor.h" #include "RigFaultReactivationModel.h" #include "RigMainGrid.h" #include "RigResultAccessorFactory.h" -#include "RigWellPath.h" +#include "Well/RigEclipseWellLogExtractor.h" +#include "Well/RigWellPath.h" #include #include diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationDataAccessorStress.cpp b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationDataAccessorStress.cpp index 4a899e1357..767505e916 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationDataAccessorStress.cpp +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationDataAccessorStress.cpp @@ -28,9 +28,9 @@ #include "RigFemResultAddress.h" #include "RigFemScalarResultFrames.h" #include "RigGeoMechCaseData.h" -#include "RigGeoMechWellLogExtractor.h" #include "RigGriddedPart3d.h" -#include "RigWellPath.h" +#include "Well/RigGeoMechWellLogExtractor.h" +#include "Well/RigWellPath.h" #include "RimFaultReactivationDataAccessorWellLogExtraction.h" #include "RimFaultReactivationEnums.h" diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationDataAccessorStressEclipse.cpp b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationDataAccessorStressEclipse.cpp index f7b3f2d026..4effea93ea 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationDataAccessorStressEclipse.cpp +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationDataAccessorStressEclipse.cpp @@ -25,12 +25,12 @@ #include "RigCaseCellResultsData.h" #include "RigEclipseResultAddress.h" -#include "RigEclipseWellLogExtractor.h" #include "RigFaultReactivationModel.h" #include "RigGriddedPart3d.h" #include "RigMainGrid.h" #include "RigResultAccessorFactory.h" -#include "RigWellPath.h" +#include "Well/RigEclipseWellLogExtractor.h" +#include "Well/RigWellPath.h" #include "RimEclipseCase.h" #include "RimFaultReactivationDataAccessorStress.h" diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationDataAccessorStressGeoMech.cpp b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationDataAccessorStressGeoMech.cpp index b804c7fce2..a7e2483961 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationDataAccessorStressGeoMech.cpp +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationDataAccessorStressGeoMech.cpp @@ -28,10 +28,10 @@ #include "RigFemResultAddress.h" #include "RigFemScalarResultFrames.h" #include "RigGeoMechCaseData.h" -#include "RigGeoMechWellLogExtractor.h" #include "RigGriddedPart3d.h" #include "RigResultAccessorFactory.h" -#include "RigWellPath.h" +#include "Well/RigGeoMechWellLogExtractor.h" +#include "Well/RigWellPath.h" #include "RimFaultReactivationDataAccessorStress.h" #include "RimFaultReactivationDataAccessorWellLogExtraction.h" diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationDataAccessorTemperature.cpp b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationDataAccessorTemperature.cpp index e647dfe84f..f6e3f407df 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationDataAccessorTemperature.cpp +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationDataAccessorTemperature.cpp @@ -26,10 +26,10 @@ #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" #include "RigEclipseResultAddress.h" -#include "RigEclipseWellLogExtractor.h" #include "RigMainGrid.h" #include "RigResultAccessorFactory.h" -#include "RigWellPath.h" +#include "Well/RigEclipseWellLogExtractor.h" +#include "Well/RigWellPath.h" #include "RimEclipseCase.h" #include "RimFaultReactivationDataAccessorWellLogExtraction.h" diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationDataAccessorWellLogExtraction.cpp b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationDataAccessorWellLogExtraction.cpp index a126f1087b..9c4235e166 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationDataAccessorWellLogExtraction.cpp +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationDataAccessorWellLogExtraction.cpp @@ -22,7 +22,6 @@ #include "RiaInterpolationTools.h" #include "RiaLogging.h" -#include "RigEclipseWellLogExtractor.h" #include "RigFaultReactivationModel.h" #include "RigFemAddressDefines.h" #include "RigFemPartCollection.h" @@ -30,10 +29,11 @@ #include "RigFemResultAddress.h" #include "RigFemScalarResultFrames.h" #include "RigGeoMechCaseData.h" -#include "RigGeoMechWellLogExtractor.h" #include "RigGriddedPart3d.h" #include "RigResultAccessorFactory.h" -#include "RigWellPath.h" +#include "Well/RigEclipseWellLogExtractor.h" +#include "Well/RigGeoMechWellLogExtractor.h" +#include "Well/RigWellPath.h" #include "RimFaultReactivationEnums.h" #include "RimFracture.h" diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagSolution.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagSolution.cpp index 721e3023a1..e0aad7de62 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagSolution.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagSolution.cpp @@ -23,9 +23,9 @@ #include "RigEclipseCaseData.h" #include "RigFlowDiagResults.h" #include "RigMainGrid.h" -#include "RigSimWellData.h" -#include "RigWellResultFrame.h" -#include "RigWellResultPoint.h" +#include "Well/RigSimWellData.h" +#include "Well/RigWellResultFrame.h" +#include "Well/RigWellResultPoint.h" #include "RimEclipseResultCase.h" #include "RimEclipseView.h" diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimTofAccumulatedPhaseFractionsPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimTofAccumulatedPhaseFractionsPlot.cpp index d1b9e0fd22..248910fb43 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimTofAccumulatedPhaseFractionsPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimTofAccumulatedPhaseFractionsPlot.cpp @@ -24,8 +24,8 @@ #include "RimSimWellInViewCollection.h" #include "RimWellAllocationPlot.h" -#include "RigSimWellData.h" #include "RigTofAccumulatedPhaseFractionsCalculator.h" +#include "Well/RigSimWellData.h" #include "RimProject.h" #include "RimWellLogPlot.h" diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimTotalWellAllocationPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimTotalWellAllocationPlot.cpp index 56432c6879..b629fa7c00 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimTotalWellAllocationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimTotalWellAllocationPlot.cpp @@ -23,7 +23,7 @@ #include "RimEclipseView.h" #include "RimSimWellInViewCollection.h" -#include "RigSimWellData.h" +#include "Well/RigSimWellData.h" #include "RimProject.h" #include "RimWellLogPlot.h" diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationOverTimePlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationOverTimePlot.cpp index 9d2669b88a..e0a57f0e39 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationOverTimePlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationOverTimePlot.cpp @@ -25,12 +25,12 @@ #include "RiaQDateTimeTools.h" #include "RiaStdStringTools.h" -#include "RigAccWellFlowCalculator.h" #include "RigEclipseCaseData.h" -#include "RigSimWellData.h" -#include "RigSimulationWellCenterLineCalculator.h" -#include "RigWellAllocationOverTime.h" -#include "RigWellResultPoint.h" +#include "Well/RigAccWellFlowCalculator.h" +#include "Well/RigSimWellData.h" +#include "Well/RigSimulationWellCenterLineCalculator.h" +#include "Well/RigWellAllocationOverTime.h" +#include "Well/RigWellResultPoint.h" #include "RimEclipseCaseTools.h" #include "RimEclipseCellColors.h" diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp index a35e8c677e..0a75f6d44d 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp @@ -24,15 +24,15 @@ #include "RiaPlotDefines.h" #include "RiaPreferences.h" -#include "RigAccWellFlowCalculator.h" #include "RigEclipseCaseData.h" #include "RigEclipseCaseDataTools.h" #include "RigFlowDiagResultAddress.h" #include "RigFlowDiagResults.h" -#include "RigSimWellData.h" -#include "RigSimulationWellCenterLineCalculator.h" -#include "RigSimulationWellCoordsAndMD.h" -#include "RigWellResultFrame.h" +#include "Well/RigAccWellFlowCalculator.h" +#include "Well/RigSimWellData.h" +#include "Well/RigSimulationWellCenterLineCalculator.h" +#include "Well/RigSimulationWellCoordsAndMD.h" +#include "Well/RigWellResultFrame.h" #include "RimEclipseCase.h" #include "RimEclipseCaseTools.h" diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationTools.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationTools.cpp index f729e0fbf3..32a9b5d71c 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationTools.cpp @@ -21,7 +21,7 @@ #include "RiaDefines.h" #include "RigFlowDiagResults.h" -#include "RigSimWellData.h" +#include "Well/RigSimWellData.h" #include "RimFlowDiagSolution.h" diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellConnectivityTable.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellConnectivityTable.cpp index ca6b6f4bdd..0d486d05fd 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellConnectivityTable.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellConnectivityTable.cpp @@ -23,12 +23,12 @@ #include "RiaStdStringTools.h" #include "RiaWellFlowDefines.h" -#include "RigAccWellFlowCalculator.h" #include "RigEclipseCaseData.h" -#include "RigSimWellData.h" -#include "RigSimulationWellCenterLineCalculator.h" -#include "RigWellAllocationOverTime.h" -#include "RigWellResultFrame.h" +#include "Well/RigAccWellFlowCalculator.h" +#include "Well/RigSimWellData.h" +#include "Well/RigSimulationWellCenterLineCalculator.h" +#include "Well/RigWellAllocationOverTime.h" +#include "Well/RigWellResultFrame.h" #include "RimEclipseCaseTools.h" #include "RimEclipseCellColors.h" diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp index b3f87e67f5..10b722f197 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp @@ -20,7 +20,7 @@ #include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h" -#include "RigWellLogCurveData.h" +#include "Well/RigWellLogCurveData.h" #include "RimWellAllocationPlot.h" #include "RimWellLogPlot.h" diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.cpp index 515c0d74b5..fe53d13c69 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.cpp @@ -23,7 +23,7 @@ #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" #include "RigEclipseResultAddress.h" -#include "RigSimWellData.h" +#include "Well/RigSimWellData.h" #include "RimEclipseCase.h" #include "RimEclipseResultCase.h" diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp index 089c1fdf8d..71cfe0b9d5 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp @@ -26,16 +26,16 @@ #include "RifReaderEclipseRft.h" -#include "RigAccWellFlowCalculator.h" #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" -#include "RigEclipseWellLogExtractor.h" #include "RigMainGrid.h" -#include "RigSimWellData.h" -#include "RigWellLogExtractor.h" -#include "RigWellPath.h" -#include "RigWellResultFrame.h" -#include "RigWellResultPoint.h" +#include "Well/RigAccWellFlowCalculator.h" +#include "Well/RigEclipseWellLogExtractor.h" +#include "Well/RigSimWellData.h" +#include "Well/RigWellLogExtractor.h" +#include "Well/RigWellPath.h" +#include "Well/RigWellResultFrame.h" +#include "Well/RigWellResultPoint.h" #include "RimDataSourceForRftPlt.h" #include "RimEclipseCase.h" diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechResultDefinition.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechResultDefinition.cpp index d0b485651c..816c1219e0 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechResultDefinition.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechResultDefinition.cpp @@ -34,7 +34,7 @@ #include "RigFormationNames.h" #include "RigGeoMechCaseData.h" #include "RigWbsParameter.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "Rim3dWellLogCurve.h" #include "RimGeoMechCase.h" diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp index b8cbb0d76f..35af5943b0 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp @@ -23,8 +23,8 @@ #include "RigMainGrid.h" #include "RigPolyLinesData.h" -#include "RigSimulationWellCenterLineCalculator.h" -#include "RigWellPath.h" +#include "Well/RigSimulationWellCenterLineCalculator.h" +#include "Well/RigWellPath.h" #include "Polygons/RimPolygon.h" #include "Polygons/RimPolygonCollection.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp index 9fb0c84135..90c384c879 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp @@ -24,11 +24,11 @@ #include "RiaPlotWindowRedrawScheduler.h" #include "RiaPreferences.h" #include "RiaQDateTimeTools.h" +#include "RiaResultNames.h" #include "RiaTextStringTools.h" -#include "RiaResultNames.h" -#include "RigWellLogCurveData.h" -#include "RigWellPath.h" +#include "Well/RigWellLogCurveData.h" +#include "Well/RigWellPath.h" #include "RimEclipseCase.h" #include "RimEclipseCaseCollection.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp index 17a4a85dc6..48ea3dc035 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp @@ -39,9 +39,9 @@ #include "RigGridManager.h" #include "RigMainGrid.h" #include "RigNNCData.h" -#include "RigSimWellData.h" #include "RigVirtualPerforationTransmissibilities.h" -#include "RigWellResultFrame.h" +#include "Well/RigSimWellData.h" +#include "Well/RigWellResultFrame.h" #include "Rim2dIntersectionViewCollection.h" #include "RimCaseCollection.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp index 5dc9974cbb..fcb48f1f76 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp @@ -29,7 +29,7 @@ #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" #include "RigEclipseResultAddress.h" -#include "RigSimWellData.h" +#include "Well/RigSimWellData.h" #include "RimCaseCollection.h" #include "RimEclipseCellColors.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp index 85adec918a..5ec6ff1489 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp @@ -37,10 +37,10 @@ #include "RigMainGrid.h" #include "RigResultAccessor.h" #include "RigResultAccessorFactory.h" -#include "RigSimWellData.h" #include "RigVirtualPerforationTransmissibilities.h" -#include "RigWellResultFrame.h" -#include "RigWellResultPoint.h" +#include "Well/RigSimWellData.h" +#include "Well/RigWellResultFrame.h" +#include "Well/RigWellResultPoint.h" #include "Polygons/RimPolygonInViewCollection.h" #include "Rim2dIntersectionView.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimPltPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimPltPlotCollection.cpp index 2d29e8a557..3f556ce1a4 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPltPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPltPlotCollection.cpp @@ -19,9 +19,9 @@ #include "RimPltPlotCollection.h" -#include "RigEclipseWellLogExtractor.h" #include "RigGeoMechCaseData.h" -#include "RigGeoMechWellLogExtractor.h" +#include "Well/RigEclipseWellLogExtractor.h" +#include "Well/RigGeoMechWellLogExtractor.h" #include "RimEclipseCase.h" #include "RimGeoMechCase.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimRftPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimRftPlotCollection.cpp index 12bf81457a..9713c3e80b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimRftPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimRftPlotCollection.cpp @@ -19,9 +19,9 @@ #include "RimRftPlotCollection.h" -#include "RigEclipseWellLogExtractor.h" #include "RigGeoMechCaseData.h" -#include "RigGeoMechWellLogExtractor.h" +#include "Well/RigEclipseWellLogExtractor.h" +#include "Well/RigGeoMechWellLogExtractor.h" #include "RimEclipseCase.h" #include "RimGeoMechCase.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimSimWellInView.cpp b/ApplicationLibCode/ProjectDataModel/RimSimWellInView.cpp index 7bf1c10071..ba0de2b820 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSimWellInView.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSimWellInView.cpp @@ -26,11 +26,11 @@ #include "RigCell.h" #include "RigEclipseCaseData.h" #include "RigMainGrid.h" -#include "RigMswCenterLineCalculator.h" -#include "RigSimWellData.h" -#include "RigSimulationWellCenterLineCalculator.h" -#include "RigWellResultFrame.h" -#include "RigWellResultPoint.h" +#include "Well/RigMswCenterLineCalculator.h" +#include "Well/RigSimWellData.h" +#include "Well/RigSimulationWellCenterLineCalculator.h" +#include "Well/RigWellResultFrame.h" +#include "Well/RigWellResultPoint.h" #include "Rim2dIntersectionView.h" #include "RimCellFilterCollection.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimSimWellInView.h b/ApplicationLibCode/ProjectDataModel/RimSimWellInView.h index ed8060a0dc..f8ad32b358 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSimWellInView.h +++ b/ApplicationLibCode/ProjectDataModel/RimSimWellInView.h @@ -22,8 +22,8 @@ #include "Rim3dPropertiesInterface.h" -#include "RigWellDiskData.h" -#include "RigWellResultBranch.h" +#include "Well/RigWellDiskData.h" +#include "Well/RigWellResultBranch.h" #include "cafAppEnum.h" #include "cafPdmChildField.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp index 93e085a1cb..45607ea5f5 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp @@ -24,8 +24,8 @@ #include "RiaPreferences.h" #include "RigEclipseCaseData.h" -#include "RigSimWellData.h" -#include "RigWellResultFrame.h" +#include "Well/RigSimWellData.h" +#include "Well/RigWellResultFrame.h" #include "RimEclipseCase.h" #include "RimEclipseContourMapView.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewTools.cpp b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewTools.cpp index a2d81c4f18..3226243622 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewTools.cpp @@ -24,8 +24,8 @@ #include "RifEclipseSummaryAddress.h" #include "RifSummaryReaderInterface.h" -#include "RigSimWellData.h" -#include "RigWellResultFrame.h" +#include "Well/RigSimWellData.h" +#include "Well/RigWellResultFrame.h" #include "Rim3dView.h" #include "RimEclipseResultCase.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimWbsParameters.h b/ApplicationLibCode/ProjectDataModel/RimWbsParameters.h index 4b169a75b0..588f121fd4 100644 --- a/ApplicationLibCode/ProjectDataModel/RimWbsParameters.h +++ b/ApplicationLibCode/ProjectDataModel/RimWbsParameters.h @@ -17,8 +17,8 @@ ///////////////////////////////////////////////////////////////////////////////// #pragma once -#include "RigGeoMechWellLogExtractor.h" #include "RigWbsParameter.h" +#include "Well/RigGeoMechWellLogExtractor.h" #include "cafPdmField.h" #include "cafPdmObject.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimWellBoreStabilityPlot.h b/ApplicationLibCode/ProjectDataModel/RimWellBoreStabilityPlot.h index c0afc1b465..82c459a5d8 100644 --- a/ApplicationLibCode/ProjectDataModel/RimWellBoreStabilityPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimWellBoreStabilityPlot.h @@ -19,8 +19,8 @@ #include "RimWellLogPlot.h" -#include "RigGeoMechWellLogExtractor.h" #include "RigWbsParameter.h" +#include "Well/RigGeoMechWellLogExtractor.h" #include "cafAppEnum.h" #include "cafPdmField.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.cpp b/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.cpp index abc6543295..fe4cdf04fb 100644 --- a/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.cpp @@ -24,7 +24,7 @@ #include "RigCaseCellResultsData.h" #include "RigEclipseResultAddress.h" -#include "RigWellTargetCandidatesGenerator.h" +#include "Well/RigWellTargetCandidatesGenerator.h" #include "RimEclipseCase.h" #include "RimEclipseCaseEnsemble.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.h b/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.h index cab46dff41..b9334226bf 100644 --- a/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.h +++ b/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.h @@ -22,7 +22,7 @@ #include "cafPdmField.h" #include "cafPdmObject.h" -#include "RigWellTargetCandidatesGenerator.h" +#include "Well/RigWellTargetCandidatesGenerator.h" //================================================================================================== /// diff --git a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicSection.cpp b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicSection.cpp index 6a34ebdf63..ec358e049d 100644 --- a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicSection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicSection.cpp @@ -34,7 +34,7 @@ #include "RigPolyLinesData.h" #include "RigTexturedSection.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "RivSeismicSectionPartMgr.h" diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp index 8e4c7b2303..ad84d360d3 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp @@ -28,7 +28,7 @@ #include "RigFault.h" #include "RigMainGrid.h" #include "RigStimPlanModelTools.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "Rim3dView.h" #include "RimAnnotationCollection.h" diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.h b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.h index e5cf804a1e..485cc3f88e 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.h +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.h @@ -25,7 +25,7 @@ #include "RimPerforationInterval.h" #include "RimWellPathComponentInterface.h" -#include "RigWellLogExtractor.h" +#include "Well/RigWellLogExtractor.h" #include "cafPdmChildField.h" #include "cafPdmFieldCvfVec3d.h" diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelElasticPropertyCalculator.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelElasticPropertyCalculator.cpp index add7d213b1..d7ddcd5f5b 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelElasticPropertyCalculator.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelElasticPropertyCalculator.cpp @@ -24,12 +24,12 @@ #include "RigEclipseCaseData.h" #include "RigEclipseResultAddress.h" -#include "RigEclipseWellLogExtractor.h" #include "RigElasticProperties.h" #include "RigResultAccessor.h" #include "RigResultAccessorFactory.h" -#include "RigWellLogCurveData.h" -#include "RigWellPath.h" +#include "Well/RigEclipseWellLogExtractor.h" +#include "Well/RigWellLogCurveData.h" +#include "Well/RigWellPath.h" #include "RimCase.h" #include "RimColorLegend.h" diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelLayerCalculator.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelLayerCalculator.cpp index 1577150fe2..71990ea77f 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelLayerCalculator.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelLayerCalculator.cpp @@ -23,10 +23,10 @@ #include "RigEclipseCaseData.h" #include "RigEclipseResultAddress.h" -#include "RigEclipseWellLogExtractor.h" #include "RigResultAccessor.h" #include "RigResultAccessorFactory.h" -#include "RigWellPath.h" +#include "Well/RigEclipseWellLogExtractor.h" +#include "Well/RigWellPath.h" #include "RimCase.h" #include "RimEclipseCase.h" diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPressureCalculator.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPressureCalculator.cpp index 3af3d4047c..99bb98dda3 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPressureCalculator.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPressureCalculator.cpp @@ -29,8 +29,8 @@ #include "RigGridBase.h" #include "RigMainGrid.h" #include "RigStatisticsMath.h" -#include "RigWellPath.h" -#include "RigWellPathGeometryTools.h" +#include "Well/RigWellPath.h" +#include "Well/RigWellPathGeometryTools.h" #include "RimEclipseCase.h" #include "RimModeledWellPath.h" diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelStressCalculator.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelStressCalculator.cpp index 6e82496157..2892a05789 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelStressCalculator.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelStressCalculator.cpp @@ -24,10 +24,10 @@ #include "RiaStimPlanModelDefines.h" #include "RigEclipseCaseData.h" -#include "RigEclipseWellLogExtractor.h" -#include "RigWellPath.h" +#include "Well/RigEclipseWellLogExtractor.h" +#include "Well/RigWellPath.h" +#include "Well/RigWellPathGeometryTools.h" -#include "RigWellPathGeometryTools.h" #include "RimCase.h" #include "RimEclipseCase.h" #include "RimModeledWellPath.h" diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelWellLogCalculator.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelWellLogCalculator.cpp index 056a3568b7..716da6223f 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelWellLogCalculator.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelWellLogCalculator.cpp @@ -26,12 +26,12 @@ #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" #include "RigEclipseResultAddress.h" -#include "RigEclipseWellLogExtractor.h" #include "RigMainGrid.h" #include "RigResultAccessor.h" #include "RigResultAccessorFactory.h" -#include "RigWellLogCurveData.h" -#include "RigWellPath.h" +#include "Well/RigEclipseWellLogExtractor.h" +#include "Well/RigWellLogCurveData.h" +#include "Well/RigWellPath.h" #include "RimCase.h" #include "RimEclipseCase.h" diff --git a/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineInViewCollection.cpp index c81e896588..2c0ba908fd 100644 --- a/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineInViewCollection.cpp @@ -26,9 +26,9 @@ #include "RigMainGrid.h" #include "RigResultAccessor.h" #include "RigResultAccessorFactory.h" -#include "RigSimWellData.h" #include "RigTracerPoint.h" -#include "RigWellResultFrame.h" +#include "Well/RigSimWellData.h" +#include "Well/RigWellResultFrame.h" #include "RimEclipseCase.h" #include "RimEclipseInputCase.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogExtractionCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogExtractionCurve.cpp index e8747eb43b..f30e6f2518 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogExtractionCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogExtractionCurve.cpp @@ -18,18 +18,19 @@ #include "Rim3dWellLogExtractionCurve.h" -#include "RigWellLogLasFile.h" - #include "RiaCurveDataTools.h" #include "RiaExtractionTools.h" + #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" -#include "RigEclipseWellLogExtractor.h" #include "RigFemPartResultsCollection.h" #include "RigGeoMechCaseData.h" -#include "RigGeoMechWellLogExtractor.h" #include "RigResultAccessorFactory.h" -#include "RigWellPath.h" +#include "Well/RigEclipseWellLogExtractor.h" +#include "Well/RigGeoMechWellLogExtractor.h" +#include "Well/RigWellLogLasFile.h" +#include "Well/RigWellPath.h" + #include "Rim3dView.h" #include "RimCase.h" #include "RimEclipseCase.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogFileCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogFileCurve.cpp index b82819472c..c7c74f484f 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogFileCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogFileCurve.cpp @@ -18,7 +18,7 @@ #include "Rim3dWellLogFileCurve.h" -#include "RigWellLogLasFile.h" +#include "Well/RigWellLogLasFile.h" #include "RimWellLogChannel.h" #include "RimWellLogLasFile.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.cpp index e40d151324..5f19c36730 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.cpp @@ -22,7 +22,7 @@ #include "RifReaderEclipseRft.h" -#include "RigWellLogCurveData.h" +#include "Well/RigWellLogCurveData.h" #include "RimEclipseResultCase.h" #include "RimRftTools.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.cpp index dcde97ec4e..890a869fc8 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.cpp @@ -47,7 +47,7 @@ #include "RimWellPath.h" #include "RigFormationNames.h" -#include "RigWellLogIndexDepthOffset.h" +#include "Well/RigWellLogIndexDepthOffset.h" #include "RiuAbstractLegendFrame.h" #include "RiuDraggableOverlayFrame.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogStatistics.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogStatistics.cpp index 34a98a2a5f..cbb9cd6367 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogStatistics.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogStatistics.cpp @@ -26,8 +26,8 @@ #include "RiaWellLogUnitTools.h" #include "RigStatisticsMath.h" -#include "RigWellLogIndexDepthOffset.h" -#include "RigWellLogLasFile.h" +#include "Well/RigWellLogIndexDepthOffset.h" +#include "Well/RigWellLogLasFile.h" #include "RimWellLogLasFile.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimOsduWellLog.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimOsduWellLog.h index 22494e074e..93c3ab92dd 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimOsduWellLog.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimOsduWellLog.h @@ -20,7 +20,7 @@ #include "RimWellLog.h" -#include "RigOsduWellLogData.h" +#include "Well/RigOsduWellLogData.h" #include "cafPdmChildArrayField.h" #include "cafPdmField.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimOsduWellLogDataLoader.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimOsduWellLogDataLoader.cpp index 8bc7352ac3..3bb4a97250 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimOsduWellLogDataLoader.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimOsduWellLogDataLoader.cpp @@ -26,7 +26,7 @@ #include "RifOsduWellLogReader.h" -#include "RigWellLogData.h" +#include "Well/RigWellLogData.h" #include "cafProgressInfo.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTopologyCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTopologyCurve.cpp index 6e9f5c0b56..f82d275841 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTopologyCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTopologyCurve.cpp @@ -24,7 +24,7 @@ #include "RifReaderOpmRft.h" -#include "RigWellLogCurveData.h" +#include "Well/RigWellLogCurveData.h" #include "RimDepthTrackPlot.h" #include "RimProject.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCalculatedCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCalculatedCurve.cpp index 6e90a6a27c..6007ea0045 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCalculatedCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCalculatedCurve.cpp @@ -21,7 +21,7 @@ #include "RiaDefines.h" #include "RiaLogging.h" -#include "RigWellLogCurveData.h" +#include "Well/RigWellLogCurveData.h" #include "RimMainPlotCollection.h" #include "RimOilField.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCsvFile.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCsvFile.cpp index b103ef8426..d50509d8e0 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCsvFile.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCsvFile.cpp @@ -21,7 +21,7 @@ #include "RiaFieldHandleTools.h" #include "RiaLogging.h" -#include "RigWellLogCsvFile.h" +#include "Well/RigWellLogCsvFile.h" #include "RimFileWellPath.h" #include "RimTools.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCsvFile.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCsvFile.h index aa38802b1e..8637ddc38a 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCsvFile.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCsvFile.h @@ -21,7 +21,7 @@ #include "RimWellLogFile.h" -#include "RigWellLogCsvFile.h" +#include "Well/RigWellLogCsvFile.h" #include "cafPdmField.h" #include "cafPdmObject.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp index 4c806449ca..d8f9e98317 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp @@ -23,7 +23,7 @@ #include "RiaCurveDataTools.h" #include "RiaPlotDefines.h" -#include "RigWellLogCurveData.h" +#include "Well/RigWellLogCurveData.h" #include "RimDepthTrackPlot.h" #include "RimMainPlotCollection.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp index 0a74cd7e78..ba028353c3 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp @@ -28,18 +28,18 @@ #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" #include "RigEclipseResultAddress.h" -#include "RigEclipseWellLogExtractor.h" #include "RigFemPartCollection.h" #include "RigFemPartResultsCollection.h" #include "RigGeoMechCaseData.h" -#include "RigGeoMechWellLogExtractor.h" #include "RigResultAccessorFactory.h" -#include "RigSimWellData.h" -#include "RigSimulationWellCenterLineCalculator.h" -#include "RigSimulationWellCoordsAndMD.h" -#include "RigWellLogCurveData.h" -#include "RigWellLogIndexDepthOffset.h" -#include "RigWellPath.h" +#include "Well/RigEclipseWellLogExtractor.h" +#include "Well/RigGeoMechWellLogExtractor.h" +#include "Well/RigSimWellData.h" +#include "Well/RigSimulationWellCenterLineCalculator.h" +#include "Well/RigSimulationWellCoordsAndMD.h" +#include "Well/RigWellLogCurveData.h" +#include "Well/RigWellLogIndexDepthOffset.h" +#include "Well/RigWellPath.h" #include "RimEclipseCase.h" #include "RimEclipseCellColors.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileDataLoader.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileDataLoader.cpp index dc9b482dd1..03d64301ca 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileDataLoader.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileDataLoader.cpp @@ -21,7 +21,7 @@ #include "RiaLogging.h" #include "RimWellLogFile.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "cafProgressInfo.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogLasFile.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogLasFile.cpp index 26d24bbd2e..ea602dccbd 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogLasFile.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogLasFile.cpp @@ -26,7 +26,7 @@ #include "RiaFieldHandleTools.h" #include "RiaQDateTimeTools.h" -#include "RigWellLogLasFile.h" +#include "Well/RigWellLogLasFile.h" #include "RimFileWellPath.h" #include "RimTools.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogLasFile.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogLasFile.h index e72a7a31a9..6b6d3b91fc 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogLasFile.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogLasFile.h @@ -21,7 +21,8 @@ #include "RimWellLogFile.h" -#include "RigWellLogLasFile.h" +#include "Well/RigWellLogLasFile.h" + #include "cafPdmChildArrayField.h" #include "cafPdmField.h" #include "cafPdmObject.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogLasFileCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogLasFileCurve.cpp index e421336445..4a0c2cdc47 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogLasFileCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogLasFileCurve.cpp @@ -24,9 +24,9 @@ #include "RiaQDateTimeTools.h" #include "RiaResultNames.h" -#include "RigWellLogCurveData.h" -#include "RigWellLogIndexDepthOffset.h" -#include "RigWellPath.h" +#include "Well/RigWellLogCurveData.h" +#include "Well/RigWellLogIndexDepthOffset.h" +#include "Well/RigWellPath.h" #include "RimProject.h" #include "RimTools.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogPlot.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogPlot.cpp index e49e5dd7c1..e975ee40a0 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogPlot.cpp @@ -19,8 +19,8 @@ #include "RimWellLogPlot.h" -#include "RigWellLogCurveData.h" -#include "RigWellPath.h" +#include "Well/RigWellLogCurveData.h" +#include "Well/RigWellPath.h" #include "RimEclipseCase.h" #include "RimGeoMechCase.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogPlotCollection.cpp index 0be0394586..156fa12101 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogPlotCollection.cpp @@ -23,9 +23,9 @@ #include "RiuPlotMainWindow.h" -#include "RigEclipseWellLogExtractor.h" #include "RigGeoMechCaseData.h" -#include "RigGeoMechWellLogExtractor.h" +#include "Well/RigEclipseWellLogExtractor.h" +#include "Well/RigGeoMechWellLogExtractor.h" #include "RimEclipseCase.h" #include "RimGeoMechCase.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp index 3d5cea4982..a9f699b15a 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp @@ -36,12 +36,12 @@ #include "RifReaderOpmRft.h" #include "RigEclipseCaseData.h" -#include "RigEclipseWellLogExtractor.h" #include "RigMainGrid.h" -#include "RigWellLogCurveData.h" -#include "RigWellPath.h" -#include "RigWellPathGeometryTools.h" -#include "RigWellPathIntersectionTools.h" +#include "Well/RigEclipseWellLogExtractor.h" +#include "Well/RigWellLogCurveData.h" +#include "Well/RigWellPath.h" +#include "Well/RigWellPathGeometryTools.h" +#include "Well/RigWellPathIntersectionTools.h" #include "RimDepthTrackPlot.h" #include "RimEclipseResultCase.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp index f9eb46b2f6..c6adb07a5e 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp @@ -30,20 +30,20 @@ #include "RigEclipseCaseData.h" #include "RigEclipseResultAddress.h" -#include "RigEclipseWellLogExtractor.h" #include "RigFemPartResultsCollection.h" #include "RigFemResultAddress.h" #include "RigFormationNames.h" #include "RigGeoMechCaseData.h" -#include "RigGeoMechWellLogExtractor.h" #include "RigResultAccessorFactory.h" -#include "RigSimWellData.h" -#include "RigSimulationWellCenterLineCalculator.h" -#include "RigSimulationWellCoordsAndMD.h" #include "RigStatisticsCalculator.h" -#include "RigWellLogCurveData.h" -#include "RigWellPath.h" -#include "RigWellPathFormations.h" +#include "Well/RigEclipseWellLogExtractor.h" +#include "Well/RigGeoMechWellLogExtractor.h" +#include "Well/RigSimWellData.h" +#include "Well/RigSimulationWellCenterLineCalculator.h" +#include "Well/RigSimulationWellCoordsAndMD.h" +#include "Well/RigWellLogCurveData.h" +#include "Well/RigWellPath.h" +#include "Well/RigWellPathFormations.h" #include "RimCase.h" #include "RimColorLegend.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h index b8ec4c4ae4..012a7d1774 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h @@ -22,7 +22,8 @@ #include "RimWellLogPlot.h" #include "RiaPlotDefines.h" -#include "RigWellPathFormations.h" + +#include "Well/RigWellPathFormations.h" #include "RimPlot.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCollection.cpp index f4bb1b8f01..47f4f8a4f6 100644 --- a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCollection.cpp @@ -17,7 +17,7 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RimWellMeasurementCollection.h" -#include "RigWellLogCurveData.h" +#include "Well/RigWellLogCurveData.h" #include "RimMainPlotCollection.h" #include "RimProject.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp index dbf9a38241..25cf7b11c5 100644 --- a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp @@ -18,8 +18,8 @@ #include "RimWellMeasurementCurve.h" -#include "RigWellLogCurveData.h" -#include "RigWellPath.h" +#include "Well/RigWellLogCurveData.h" +#include "Well/RigWellPath.h" #include "RimDepthTrackPlot.h" #include "RimProject.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimFileWellPathDataLoader.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimFileWellPathDataLoader.cpp index 2f3e14b61b..612e475bdb 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimFileWellPathDataLoader.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimFileWellPathDataLoader.cpp @@ -21,7 +21,7 @@ #include "RiaLogging.h" #include "RimFileWellPath.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "cafProgressInfo.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimModeledWellPath.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimModeledWellPath.cpp index 6666505159..f3ce605e38 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimModeledWellPath.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimModeledWellPath.cpp @@ -21,7 +21,9 @@ #include "RiaCompletionTypeCalculationScheduler.h" #include "RicfCommandObject.h" #include "RifTextDataTableFormatter.h" -#include "RigWellPath.h" + +#include "Well/RigWellPath.h" +#include "Well/RigWellPathGeometryTools.h" #include "RimExtrudedCurveIntersection.h" #include "RimPlotCurve.h" @@ -35,7 +37,6 @@ #include "RimWellPathTarget.h" #include "RimWellPathTieIn.h" -#include "RigWellPathGeometryTools.h" #include "cafPdmFieldScriptingCapability.h" #include "cafPdmUiDoubleValueEditor.h" #include "cafPdmUiTreeOrdering.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimModeledWellPathDataLoader.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimModeledWellPathDataLoader.cpp index 1520f2a8a0..0a6a340142 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimModeledWellPathDataLoader.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimModeledWellPathDataLoader.cpp @@ -20,7 +20,7 @@ #include "RimModeledWellPath.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" //-------------------------------------------------------------------------------------------------- /// diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimOsduWellPathDataLoader.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimOsduWellPathDataLoader.cpp index bacaae7dbb..848b84cd5c 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimOsduWellPathDataLoader.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimOsduWellPathDataLoader.cpp @@ -26,7 +26,7 @@ #include "RifOsduWellPathReader.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "cafProgressInfo.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp index 94f102236f..c11c12b491 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp @@ -21,9 +21,11 @@ #include "RiaApplication.h" #include "RiaPreferencesGeoMech.h" +#include "RifParameterXmlReader.h" + #include "RigFemAddressDefines.h" -#include "RigWellPath.h" -#include "RigWellPathGeometryTools.h" +#include "Well/RigWellPath.h" +#include "Well/RigWellPathGeometryTools.h" #include "RimDoubleParameter.h" #include "RimGenericParameter.h" @@ -37,8 +39,6 @@ #include "RimWellIAModelData.h" #include "RimWellPath.h" -#include "RifParameterXmlReader.h" - #include "cafPdmFieldCvfVec3d.h" #include "cafPdmFieldScriptingCapability.h" #include "cafPdmObjectScriptingCapability.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp index 98bad74ac8..837cb1c514 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp @@ -31,7 +31,7 @@ #include "RifWellPathFormationsImporter.h" #include "RifWellPathImporter.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "Rim3dWellLogCurve.h" #include "Rim3dWellLogCurveCollection.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttribute.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttribute.cpp index 1d8bfddab0..0747512e3a 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttribute.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttribute.cpp @@ -18,7 +18,8 @@ #include "RimWellPathAttribute.h" #include "RiaColorTables.h" -#include "RigWellPath.h" + +#include "Well/RigWellPath.h" #include "RimProject.h" #include "RimWellPath.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp index 09bd3f4ef9..d7c66afdfd 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp @@ -36,8 +36,8 @@ #include "RigEclipseCaseData.h" #include "RigMainGrid.h" -#include "RigOsduWellLogData.h" -#include "RigWellPath.h" +#include "Well/RigOsduWellLogData.h" +#include "Well/RigWellPath.h" #include "RimEclipseCase.h" #include "RimEclipseCaseCollection.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.h b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.h index a2de76456e..b6178ffb7f 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.h +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.h @@ -22,7 +22,8 @@ #include "RiaDefines.h" -#include "RigOsduWellLogData.h" +#include "Well/RigOsduWellLogData.h" + #include "cafAppEnum.h" #include "cafPdmChildArrayField.h" #include "cafPdmField.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp index fc0d2b2c92..4763184f2e 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp @@ -28,7 +28,7 @@ #include "RiaPolyArcLineSampler.h" #include "RiaSCurveCalculator.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "RimModeledWellPath.h" #include "RimProject.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGroup.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGroup.cpp index af8ca3c618..0be109e48a 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGroup.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGroup.cpp @@ -19,7 +19,8 @@ #include "RiaTextStringTools.h" #include "RiaWellNameComparer.h" -#include "RigWellPath.h" + +#include "Well/RigWellPath.h" #include "RimModeledWellPath.h" #include "RimWellPathCompletionSettings.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTarget.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTarget.cpp index 8331713055..f857bd6739 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTarget.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTarget.cpp @@ -20,7 +20,7 @@ #include "RiaOffshoreSphericalCoords.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "RimModeledWellPath.h" #include "RimProject.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTieIn.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTieIn.cpp index 6cf36935b1..75283d49f1 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTieIn.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTieIn.cpp @@ -18,7 +18,7 @@ #include "RimWellPathTieIn.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "RimFileWellPath.h" #include "RimModeledWellPath.h" diff --git a/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake b/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake index dc87350c32..7c6b11ec86 100644 --- a/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake +++ b/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake @@ -1,215 +1,171 @@ set(SOURCE_GROUP_HEADER_FILES - ${CMAKE_CURRENT_LIST_DIR}/RigActiveCellInfo.h - ${CMAKE_CURRENT_LIST_DIR}/RigCell.h - ${CMAKE_CURRENT_LIST_DIR}/RigEclipseCaseData.h - ${CMAKE_CURRENT_LIST_DIR}/RigEclipseCaseDataTools.h - ${CMAKE_CURRENT_LIST_DIR}/RigGridBase.h - ${CMAKE_CURRENT_LIST_DIR}/RigGridManager.h - ${CMAKE_CURRENT_LIST_DIR}/RigCellGeometryTools.h - ${CMAKE_CURRENT_LIST_DIR}/RigResultModifier.h - ${CMAKE_CURRENT_LIST_DIR}/RigResultModifierFactory.h - ${CMAKE_CURRENT_LIST_DIR}/RigFormationNames.h - ${CMAKE_CURRENT_LIST_DIR}/RigAllanDiagramData.h - ${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagResultAddress.h - ${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagResults.h - ${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagResultFrames.h - ${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagSolverInterface.h - ${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagInterfaceTools.h - ${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagStatCalc.h - ${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagVisibleCellsStatCalc.h - ${CMAKE_CURRENT_LIST_DIR}/RigAccWellFlowCalculator.h - ${CMAKE_CURRENT_LIST_DIR}/RigWellLogExtractor.h - ${CMAKE_CURRENT_LIST_DIR}/RigEclipseWellLogExtractor.h - ${CMAKE_CURRENT_LIST_DIR}/RigLocalGrid.h - ${CMAKE_CURRENT_LIST_DIR}/RigMainGrid.h - ${CMAKE_CURRENT_LIST_DIR}/RigActiveCellGrid.h - ${CMAKE_CURRENT_LIST_DIR}/RigActiveCellLocalGrid.h - ${CMAKE_CURRENT_LIST_DIR}/RigReservoirBuilderMock.h - ${CMAKE_CURRENT_LIST_DIR}/RigCaseCellResultsData.h - ${CMAKE_CURRENT_LIST_DIR}/RigSimWellData.h - ${CMAKE_CURRENT_LIST_DIR}/RigWellPath.h - ${CMAKE_CURRENT_LIST_DIR}/RigFault.h - ${CMAKE_CURRENT_LIST_DIR}/RigNNCData.h ${CMAKE_CURRENT_LIST_DIR}/cvfGeometryTools.h ${CMAKE_CURRENT_LIST_DIR}/cvfGeometryTools.inl - ${CMAKE_CURRENT_LIST_DIR}/RigPipeInCellEvaluator.h - ${CMAKE_CURRENT_LIST_DIR}/RigEclipseNativeStatCalc.h - ${CMAKE_CURRENT_LIST_DIR}/RigEclipseNativeVisibleCellsStatCalc.h - ${CMAKE_CURRENT_LIST_DIR}/RigEclipseMultiPropertyStatCalc.h - ${CMAKE_CURRENT_LIST_DIR}/RigWellLogCurveData.h - ${CMAKE_CURRENT_LIST_DIR}/RigWellLogExtractionTools.h - ${CMAKE_CURRENT_LIST_DIR}/RigHexIntersectionTools.h - ${CMAKE_CURRENT_LIST_DIR}/RigLasFileExporter.h - ${CMAKE_CURRENT_LIST_DIR}/RigSimulationWellCoordsAndMD.h - ${CMAKE_CURRENT_LIST_DIR}/RigFishbonesGeometry.h - ${CMAKE_CURRENT_LIST_DIR}/RigTesselatorTools.h - ${CMAKE_CURRENT_LIST_DIR}/RigCellGeometryTools.h - ${CMAKE_CURRENT_LIST_DIR}/RigWellPathIntersectionTools.h - ${CMAKE_CURRENT_LIST_DIR}/RigEclipseResultInfo.h - ${CMAKE_CURRENT_LIST_DIR}/RigEclipseResultAddress.h - ${CMAKE_CURRENT_LIST_DIR}/RigTofAccumulatedPhaseFractionsCalculator.h - ${CMAKE_CURRENT_LIST_DIR}/RigTofWellDistributionCalculator.h - ${CMAKE_CURRENT_LIST_DIR}/RigTransmissibilityEquations.h - ${CMAKE_CURRENT_LIST_DIR}/RigNumberOfFloodedPoreVolumesCalculator.h - ${CMAKE_CURRENT_LIST_DIR}/RigWeightedMeanCalc.h - ${CMAKE_CURRENT_LIST_DIR}/RigWellPathFormations.h - ${CMAKE_CURRENT_LIST_DIR}/RigStimPlanFractureDefinition.h - ${CMAKE_CURRENT_LIST_DIR}/RigThermalFractureDefinition.h - ${CMAKE_CURRENT_LIST_DIR}/RigThermalFractureResultUtil.h - ${CMAKE_CURRENT_LIST_DIR}/RigThermalFractureResult.h - ${CMAKE_CURRENT_LIST_DIR}/RigFractureGrid.h - ${CMAKE_CURRENT_LIST_DIR}/RigFractureCell.h - ${CMAKE_CURRENT_LIST_DIR}/RigConvexHull.h - ${CMAKE_CURRENT_LIST_DIR}/RigWellResultPoint.h - ${CMAKE_CURRENT_LIST_DIR}/RigWellPathGeometryTools.h - ${CMAKE_CURRENT_LIST_DIR}/RigWellPathGeometryExporter.h - ${CMAKE_CURRENT_LIST_DIR}/RigSurface.h - ${CMAKE_CURRENT_LIST_DIR}/RigCaseRealizationParameters.h - ${CMAKE_CURRENT_LIST_DIR}/RigGeoMechBoreHoleStressCalculator.h - ${CMAKE_CURRENT_LIST_DIR}/RigPolyLinesData.h - ${CMAKE_CURRENT_LIST_DIR}/RigCaseCellResultCalculator.h - ${CMAKE_CURRENT_LIST_DIR}/RigGridCrossPlotCurveGrouping.h - ${CMAKE_CURRENT_LIST_DIR}/RigEclipseCrossPlotDataExtractor.h - ${CMAKE_CURRENT_LIST_DIR}/RigEquil.h - ${CMAKE_CURRENT_LIST_DIR}/RigWbsParameter.h - ${CMAKE_CURRENT_LIST_DIR}/RigEclipseAllanFaultsStatCalc.h - ${CMAKE_CURRENT_LIST_DIR}/RigCellFaceGeometryTools.h - ${CMAKE_CURRENT_LIST_DIR}/RigNncConnection.h - ${CMAKE_CURRENT_LIST_DIR}/RigWellDiskData.h - ${CMAKE_CURRENT_LIST_DIR}/RigGocadData.h - ${CMAKE_CURRENT_LIST_DIR}/RigElasticProperties.h - ${CMAKE_CURRENT_LIST_DIR}/RigEnsembleFractureStatisticsCalculator.h - ${CMAKE_CURRENT_LIST_DIR}/RigHistogramData.h - ${CMAKE_CURRENT_LIST_DIR}/RigVisibleCategoriesCalculator.h - ${CMAKE_CURRENT_LIST_DIR}/RigTracerPoint.h - ${CMAKE_CURRENT_LIST_DIR}/RigTracer.h - ${CMAKE_CURRENT_LIST_DIR}/RigStimPlanModelTools.h - ${CMAKE_CURRENT_LIST_DIR}/RigSlice2D.h - ${CMAKE_CURRENT_LIST_DIR}/RigEnsembleParameter.h - ${CMAKE_CURRENT_LIST_DIR}/RigSurfaceResampler.h - ${CMAKE_CURRENT_LIST_DIR}/RigSurfaceStatisticsCalculator.h - ${CMAKE_CURRENT_LIST_DIR}/RigWellLogIndexDepthOffset.h - ${CMAKE_CURRENT_LIST_DIR}/RigTexturedSection.h - ${CMAKE_CURRENT_LIST_DIR}/RigPressureDepthData.h - ${CMAKE_CURRENT_LIST_DIR}/RigMswCenterLineCalculator.h + ${CMAKE_CURRENT_LIST_DIR}/RigActiveCellGrid.h + ${CMAKE_CURRENT_LIST_DIR}/RigActiveCellInfo.h + ${CMAKE_CURRENT_LIST_DIR}/RigActiveCellLocalGrid.h + ${CMAKE_CURRENT_LIST_DIR}/RigAllanDiagramData.h ${CMAKE_CURRENT_LIST_DIR}/RigBasicPlane.h - ${CMAKE_CURRENT_LIST_DIR}/RigGriddedPart3d.h - ${CMAKE_CURRENT_LIST_DIR}/RigFaultReactivationModel.h - ${CMAKE_CURRENT_LIST_DIR}/RigFaultReactivationModelGenerator.h - ${CMAKE_CURRENT_LIST_DIR}/RigWellAllocationOverTime.h - ${CMAKE_CURRENT_LIST_DIR}/RigWellResultBranch.h - ${CMAKE_CURRENT_LIST_DIR}/RigWellResultFrame.h - ${CMAKE_CURRENT_LIST_DIR}/RigReservoirBuilder.h - ${CMAKE_CURRENT_LIST_DIR}/RigVfpTables.h - ${CMAKE_CURRENT_LIST_DIR}/RigOsduWellLogData.h - ${CMAKE_CURRENT_LIST_DIR}/RigWellTargetCandidatesGenerator.h + ${CMAKE_CURRENT_LIST_DIR}/RigCaseCellResultCalculator.h + ${CMAKE_CURRENT_LIST_DIR}/RigCaseCellResultsData.h + ${CMAKE_CURRENT_LIST_DIR}/RigCaseRealizationParameters.h + ${CMAKE_CURRENT_LIST_DIR}/RigCell.h + ${CMAKE_CURRENT_LIST_DIR}/RigCellFaceGeometryTools.h + ${CMAKE_CURRENT_LIST_DIR}/RigCellGeometryTools.h + ${CMAKE_CURRENT_LIST_DIR}/RigCellGeometryTools.h + ${CMAKE_CURRENT_LIST_DIR}/RigContourMapCalculator.h ${CMAKE_CURRENT_LIST_DIR}/RigContourMapGrid.h ${CMAKE_CURRENT_LIST_DIR}/RigContourPolygonsTools.h - ${CMAKE_CURRENT_LIST_DIR}/RigContourMapCalculator.h + ${CMAKE_CURRENT_LIST_DIR}/RigConvexHull.h + ${CMAKE_CURRENT_LIST_DIR}/RigEclipseAllanFaultsStatCalc.h + ${CMAKE_CURRENT_LIST_DIR}/RigEclipseCaseData.h + ${CMAKE_CURRENT_LIST_DIR}/RigEclipseCaseDataTools.h + ${CMAKE_CURRENT_LIST_DIR}/RigEclipseCrossPlotDataExtractor.h + ${CMAKE_CURRENT_LIST_DIR}/RigEclipseMultiPropertyStatCalc.h + ${CMAKE_CURRENT_LIST_DIR}/RigEclipseNativeStatCalc.h + ${CMAKE_CURRENT_LIST_DIR}/RigEclipseNativeVisibleCellsStatCalc.h + ${CMAKE_CURRENT_LIST_DIR}/RigEclipseResultAddress.h + ${CMAKE_CURRENT_LIST_DIR}/RigEclipseResultInfo.h + ${CMAKE_CURRENT_LIST_DIR}/RigElasticProperties.h + ${CMAKE_CURRENT_LIST_DIR}/RigEnsembleFractureStatisticsCalculator.h + ${CMAKE_CURRENT_LIST_DIR}/RigEnsembleParameter.h + ${CMAKE_CURRENT_LIST_DIR}/RigEquil.h + ${CMAKE_CURRENT_LIST_DIR}/RigFault.h + ${CMAKE_CURRENT_LIST_DIR}/RigFaultReactivationModel.h + ${CMAKE_CURRENT_LIST_DIR}/RigFaultReactivationModelGenerator.h + ${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagInterfaceTools.h + ${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagResultAddress.h + ${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagResultFrames.h + ${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagResults.h + ${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagSolverInterface.h + ${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagStatCalc.h + ${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagVisibleCellsStatCalc.h + ${CMAKE_CURRENT_LIST_DIR}/RigFormationNames.h + ${CMAKE_CURRENT_LIST_DIR}/RigFractureCell.h + ${CMAKE_CURRENT_LIST_DIR}/RigFractureGrid.h + ${CMAKE_CURRENT_LIST_DIR}/RigGeoMechBoreHoleStressCalculator.h + ${CMAKE_CURRENT_LIST_DIR}/RigGocadData.h + ${CMAKE_CURRENT_LIST_DIR}/RigGridBase.h + ${CMAKE_CURRENT_LIST_DIR}/RigGridCrossPlotCurveGrouping.h + ${CMAKE_CURRENT_LIST_DIR}/RigGriddedPart3d.h + ${CMAKE_CURRENT_LIST_DIR}/RigGridManager.h + ${CMAKE_CURRENT_LIST_DIR}/RigHexIntersectionTools.h + ${CMAKE_CURRENT_LIST_DIR}/RigHistogramData.h + ${CMAKE_CURRENT_LIST_DIR}/RigLasFileExporter.h + ${CMAKE_CURRENT_LIST_DIR}/RigLocalGrid.h + ${CMAKE_CURRENT_LIST_DIR}/RigMainGrid.h + ${CMAKE_CURRENT_LIST_DIR}/RigNncConnection.h + ${CMAKE_CURRENT_LIST_DIR}/RigNNCData.h + ${CMAKE_CURRENT_LIST_DIR}/RigNumberOfFloodedPoreVolumesCalculator.h + ${CMAKE_CURRENT_LIST_DIR}/RigPolyLinesData.h + ${CMAKE_CURRENT_LIST_DIR}/RigPressureDepthData.h + ${CMAKE_CURRENT_LIST_DIR}/RigReservoirBuilder.h + ${CMAKE_CURRENT_LIST_DIR}/RigReservoirBuilderMock.h + ${CMAKE_CURRENT_LIST_DIR}/RigResultModifier.h + ${CMAKE_CURRENT_LIST_DIR}/RigResultModifierFactory.h + ${CMAKE_CURRENT_LIST_DIR}/RigSlice2D.h + ${CMAKE_CURRENT_LIST_DIR}/RigStimPlanFractureDefinition.h + ${CMAKE_CURRENT_LIST_DIR}/RigStimPlanModelTools.h + ${CMAKE_CURRENT_LIST_DIR}/RigSurface.h + ${CMAKE_CURRENT_LIST_DIR}/RigSurfaceResampler.h + ${CMAKE_CURRENT_LIST_DIR}/RigSurfaceStatisticsCalculator.h + ${CMAKE_CURRENT_LIST_DIR}/RigTesselatorTools.h + ${CMAKE_CURRENT_LIST_DIR}/RigTexturedSection.h + ${CMAKE_CURRENT_LIST_DIR}/RigThermalFractureDefinition.h + ${CMAKE_CURRENT_LIST_DIR}/RigThermalFractureResult.h + ${CMAKE_CURRENT_LIST_DIR}/RigThermalFractureResultUtil.h + ${CMAKE_CURRENT_LIST_DIR}/RigTofAccumulatedPhaseFractionsCalculator.h + ${CMAKE_CURRENT_LIST_DIR}/RigTofWellDistributionCalculator.h + ${CMAKE_CURRENT_LIST_DIR}/RigTracer.h + ${CMAKE_CURRENT_LIST_DIR}/RigTracerPoint.h + ${CMAKE_CURRENT_LIST_DIR}/RigTransmissibilityEquations.h + ${CMAKE_CURRENT_LIST_DIR}/RigVfpTables.h + ${CMAKE_CURRENT_LIST_DIR}/RigVisibleCategoriesCalculator.h + ${CMAKE_CURRENT_LIST_DIR}/RigWbsParameter.h + ${CMAKE_CURRENT_LIST_DIR}/RigWeightedMeanCalc.h ) set(SOURCE_GROUP_SOURCE_FILES + ${CMAKE_CURRENT_LIST_DIR}/cvfGeometryTools.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigActiveCellGrid.cpp ${CMAKE_CURRENT_LIST_DIR}/RigActiveCellInfo.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigActiveCellLocalGrid.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigAllanDiagramData.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigBasicPlane.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigCaseCellResultCalculator.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigCaseCellResultsData.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigCaseRealizationParameters.cpp ${CMAKE_CURRENT_LIST_DIR}/RigCell.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigCellFaceGeometryTools.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigCellGeometryTools.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigCellGeometryTools.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigContourMapCalculator.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigContourMapGrid.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigContourPolygonsTools.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigConvexHull.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigDeclineCurveCalculator.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigEclipseAllanFaultsStatCalc.cpp ${CMAKE_CURRENT_LIST_DIR}/RigEclipseCaseData.cpp ${CMAKE_CURRENT_LIST_DIR}/RigEclipseCaseDataTools.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigGridBase.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigGridManager.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigCellGeometryTools.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigResultModifierFactory.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigFormationNames.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigAllanDiagramData.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigEclipseCrossPlotDataExtractor.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigEclipseMultiPropertyStatCalc.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigEclipseNativeStatCalc.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigEclipseNativeVisibleCellsStatCalc.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigEclipseResultInfo.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigElasticProperties.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigEnsembleFractureStatisticsCalculator.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigEnsembleParameter.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigEquil.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigFault.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigFaultReactivationModel.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigFaultReactivationModelGenerator.cpp ${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagResultAddress.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagResults.cpp ${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagResultFrames.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagResults.cpp ${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagSolverInterface.cpp ${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagStatCalc.cpp ${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagVisibleCellsStatCalc.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigAccWellFlowCalculator.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigWellLogExtractor.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigEclipseWellLogExtractor.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigFormationNames.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigFractureCell.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigFractureGrid.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigGeoMechBoreHoleStressCalculator.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigGocadData.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigGridBase.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigGriddedPart3d.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigGridManager.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigHexIntersectionTools.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigHistogramData.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigLasFileExporter.cpp ${CMAKE_CURRENT_LIST_DIR}/RigLocalGrid.cpp ${CMAKE_CURRENT_LIST_DIR}/RigMainGrid.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigActiveCellGrid.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigActiveCellLocalGrid.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigReservoirBuilderMock.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigCaseCellResultsData.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigSimWellData.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigWellPath.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigFault.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigNNCData.cpp - ${CMAKE_CURRENT_LIST_DIR}/cvfGeometryTools.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigEclipseNativeStatCalc.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigEclipseNativeVisibleCellsStatCalc.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigEclipseMultiPropertyStatCalc.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigWellLogCurveData.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigHexIntersectionTools.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigLasFileExporter.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigSimulationWellCoordsAndMD.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigFishbonesGeometry.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigTesselatorTools.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigCellGeometryTools.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigWellPathIntersectionTools.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigEclipseResultInfo.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigTofAccumulatedPhaseFractionsCalculator.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigTofWellDistributionCalculator.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigTransmissibilityEquations.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigNumberOfFloodedPoreVolumesCalculator.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigWeightedMeanCalc.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigWellPathFormations.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigStimPlanFractureDefinition.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigThermalFractureDefinition.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigThermalFractureResultUtil.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigThermalFractureResult.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigFractureGrid.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigFractureCell.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigConvexHull.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigWellResultPoint.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigWellPathGeometryTools.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigWellPathGeometryExporter.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigSurface.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigCaseRealizationParameters.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigGeoMechBoreHoleStressCalculator.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigPolyLinesData.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigCaseCellResultCalculator.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigEclipseCrossPlotDataExtractor.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigEquil.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigWbsParameter.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigEclipseAllanFaultsStatCalc.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigCellFaceGeometryTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RigNncConnection.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigWellDiskData.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigGocadData.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigElasticProperties.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigEnsembleFractureStatisticsCalculator.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigHistogramData.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigVisibleCategoriesCalculator.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigTracerPoint.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigTracer.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigStimPlanModelTools.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigNNCData.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigNumberOfFloodedPoreVolumesCalculator.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigPolyLinesData.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigPressureDepthData.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigReservoirBuilder.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigReservoirBuilderMock.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigResultModifierFactory.cpp ${CMAKE_CURRENT_LIST_DIR}/RigSlice2D.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigEnsembleParameter.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigStimPlanFractureDefinition.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigStimPlanModelTools.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigSurface.cpp ${CMAKE_CURRENT_LIST_DIR}/RigSurfaceResampler.cpp ${CMAKE_CURRENT_LIST_DIR}/RigSurfaceStatisticsCalculator.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigWellLogIndexDepthOffset.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigTesselatorTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RigTexturedSection.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigPressureDepthData.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigMswCenterLineCalculator.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigBasicPlane.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigGriddedPart3d.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigFaultReactivationModel.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigFaultReactivationModelGenerator.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigWellAllocationOverTime.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigWellResultBranch.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigWellResultFrame.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigDeclineCurveCalculator.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigReservoirBuilder.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigThermalFractureDefinition.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigThermalFractureResult.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigThermalFractureResultUtil.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigTofAccumulatedPhaseFractionsCalculator.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigTofWellDistributionCalculator.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigTracer.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigTracerPoint.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigTransmissibilityEquations.cpp ${CMAKE_CURRENT_LIST_DIR}/RigVfpTables.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigOsduWellLogData.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigWellTargetCandidatesGenerator.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigContourMapGrid.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigContourPolygonsTools.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigContourMapCalculator.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigVisibleCategoriesCalculator.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigWbsParameter.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigWeightedMeanCalc.cpp ) list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/ReservoirDataModel/CMakeLists_filesNotToUnitTest.cmake b/ApplicationLibCode/ReservoirDataModel/CMakeLists_filesNotToUnitTest.cmake index 8863056320..a1b77ac296 100644 --- a/ApplicationLibCode/ReservoirDataModel/CMakeLists_filesNotToUnitTest.cmake +++ b/ApplicationLibCode/ReservoirDataModel/CMakeLists_filesNotToUnitTest.cmake @@ -1,24 +1,14 @@ set(SOURCE_GROUP_HEADER_FILES - ${CMAKE_CURRENT_LIST_DIR}/RigGeoMechWellLogExtractor.h ${CMAKE_CURRENT_LIST_DIR}/RigCaseToCaseCellMapper.h ${CMAKE_CURRENT_LIST_DIR}/RigCaseToCaseCellMapperTools.h ${CMAKE_CURRENT_LIST_DIR}/RigCaseToCaseRangeFilterMapper.h - ${CMAKE_CURRENT_LIST_DIR}/RigSimulationWellCenterLineCalculator.h - ${CMAKE_CURRENT_LIST_DIR}/RigWellLogData.h - ${CMAKE_CURRENT_LIST_DIR}/RigWellLogLasFile.h - ${CMAKE_CURRENT_LIST_DIR}/RigWellLogCsvFile.h ${CMAKE_CURRENT_LIST_DIR}/RigReservoirGridTools.h ) set(SOURCE_GROUP_SOURCE_FILES - ${CMAKE_CURRENT_LIST_DIR}/RigGeoMechWellLogExtractor.cpp ${CMAKE_CURRENT_LIST_DIR}/RigCaseToCaseCellMapper.cpp ${CMAKE_CURRENT_LIST_DIR}/RigCaseToCaseCellMapperTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RigCaseToCaseRangeFilterMapper.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigSimulationWellCenterLineCalculator.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigWellLogData.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigWellLogLasFile.cpp - ${CMAKE_CURRENT_LIST_DIR}/RigWellLogCsvFile.cpp ${CMAKE_CURRENT_LIST_DIR}/RigReservoirGridTools.cpp ) diff --git a/ApplicationLibCode/ReservoirDataModel/Completions/RigWellPathStimplanIntersector.cpp b/ApplicationLibCode/ReservoirDataModel/Completions/RigWellPathStimplanIntersector.cpp index 7f22c13242..0c85fc3245 100644 --- a/ApplicationLibCode/ReservoirDataModel/Completions/RigWellPathStimplanIntersector.cpp +++ b/ApplicationLibCode/ReservoirDataModel/Completions/RigWellPathStimplanIntersector.cpp @@ -21,7 +21,7 @@ #include "RigCellGeometryTools.h" #include "RigFractureCell.h" #include "RigFractureGrid.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "RimFracture.h" #include "RimFractureTemplate.h" diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseCaseData.cpp b/ApplicationLibCode/ReservoirDataModel/RigEclipseCaseData.cpp index 839d18da54..0b910fd60d 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigEclipseCaseData.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigEclipseCaseData.cpp @@ -29,13 +29,13 @@ #include "RigFormationNames.h" #include "RigMainGrid.h" #include "RigResultAccessorFactory.h" -#include "RigSimWellData.h" -#include "RigSimulationWellCenterLineCalculator.h" -#include "RigSimulationWellCoordsAndMD.h" #include "RigVirtualPerforationTransmissibilities.h" -#include "RigWellPath.h" -#include "RigWellResultFrame.h" -#include "RigWellResultPoint.h" +#include "Well/RigSimWellData.h" +#include "Well/RigSimulationWellCenterLineCalculator.h" +#include "Well/RigSimulationWellCoordsAndMD.h" +#include "Well/RigWellPath.h" +#include "Well/RigWellResultFrame.h" +#include "Well/RigWellResultPoint.h" #include diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseCaseDataTools.cpp b/ApplicationLibCode/ReservoirDataModel/RigEclipseCaseDataTools.cpp index 39716b03a9..3f4e7364a6 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigEclipseCaseDataTools.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigEclipseCaseDataTools.cpp @@ -20,7 +20,7 @@ #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" -#include "RigSimWellData.h" +#include "Well/RigSimWellData.h" //-------------------------------------------------------------------------------------------------- /// diff --git a/ApplicationLibCode/ReservoirDataModel/RigLasFileExporter.cpp b/ApplicationLibCode/ReservoirDataModel/RigLasFileExporter.cpp index 03b0a96e64..840814374f 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigLasFileExporter.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigLasFileExporter.cpp @@ -19,12 +19,12 @@ #include "RigLasFileExporter.h" #include "RiaDefines.h" -#include "RigWellLogCurveData.h" -#include "RigWellPath.h" #include "RimCase.h" #include "RimWellLogCurve.h" #include "RimWellLogExtractionCurve.h" #include "RimWellPath.h" +#include "Well/RigWellLogCurveData.h" +#include "Well/RigWellPath.h" #include "cafUtils.h" diff --git a/ApplicationLibCode/ReservoirDataModel/RigReservoirBuilderMock.cpp b/ApplicationLibCode/ReservoirDataModel/RigReservoirBuilderMock.cpp index 5a0d7f7d5d..34b440e358 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigReservoirBuilderMock.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigReservoirBuilderMock.cpp @@ -25,9 +25,9 @@ #include "RigEclipseCaseData.h" #include "RigMainGrid.h" #include "RigNNCData.h" -#include "RigSimWellData.h" -#include "RigWellResultFrame.h" -#include "RigWellResultPoint.h" +#include "Well/RigSimWellData.h" +#include "Well/RigWellResultFrame.h" +#include "Well/RigWellResultPoint.h" #include diff --git a/ApplicationLibCode/ReservoirDataModel/RigStimPlanModelTools.cpp b/ApplicationLibCode/ReservoirDataModel/RigStimPlanModelTools.cpp index e31fcfeb14..f358048f93 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigStimPlanModelTools.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigStimPlanModelTools.cpp @@ -24,9 +24,9 @@ #include "RigEclipseCaseData.h" #include "RigFault.h" #include "RigMainGrid.h" -#include "RigSimulationWellCoordsAndMD.h" -#include "RigWellLogExtractor.h" -#include "RigWellPathIntersectionTools.h" +#include "Well/RigSimulationWellCoordsAndMD.h" +#include "Well/RigWellLogExtractor.h" +#include "Well/RigWellPathIntersectionTools.h" #include "cvfBoundingBox.h" #include "cvfGeometryTools.h" diff --git a/ApplicationLibCode/ReservoirDataModel/RigSurfaceResampler.cpp b/ApplicationLibCode/ReservoirDataModel/RigSurfaceResampler.cpp index 896fceef9d..6d95531c1f 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigSurfaceResampler.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigSurfaceResampler.cpp @@ -17,7 +17,7 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RigSurfaceResampler.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "cvfGeometryTools.h" diff --git a/ApplicationLibCode/ReservoirDataModel/Well/CMakeLists_files.cmake b/ApplicationLibCode/ReservoirDataModel/Well/CMakeLists_files.cmake new file mode 100644 index 0000000000..0085e14890 --- /dev/null +++ b/ApplicationLibCode/ReservoirDataModel/Well/CMakeLists_files.cmake @@ -0,0 +1,69 @@ +set(SOURCE_GROUP_HEADER_FILES + ${CMAKE_CURRENT_LIST_DIR}/RigAccWellFlowCalculator.h + ${CMAKE_CURRENT_LIST_DIR}/RigEclipseWellLogExtractor.h + ${CMAKE_CURRENT_LIST_DIR}/RigFishbonesGeometry.h + ${CMAKE_CURRENT_LIST_DIR}/RigGeoMechWellLogExtractor.h + ${CMAKE_CURRENT_LIST_DIR}/RigMswCenterLineCalculator.h + ${CMAKE_CURRENT_LIST_DIR}/RigOsduWellLogData.h + ${CMAKE_CURRENT_LIST_DIR}/RigPipeInCellEvaluator.h + ${CMAKE_CURRENT_LIST_DIR}/RigSimulationWellCenterLineCalculator.h + ${CMAKE_CURRENT_LIST_DIR}/RigSimulationWellCoordsAndMD.h + ${CMAKE_CURRENT_LIST_DIR}/RigSimWellData.h + ${CMAKE_CURRENT_LIST_DIR}/RigWellAllocationOverTime.h + ${CMAKE_CURRENT_LIST_DIR}/RigWellDiskData.h + ${CMAKE_CURRENT_LIST_DIR}/RigWellLogCurveData.h + ${CMAKE_CURRENT_LIST_DIR}/RigWellLogExtractionTools.h + ${CMAKE_CURRENT_LIST_DIR}/RigWellLogExtractor.h + ${CMAKE_CURRENT_LIST_DIR}/RigWellLogIndexDepthOffset.h + ${CMAKE_CURRENT_LIST_DIR}/RigWellPath.h + ${CMAKE_CURRENT_LIST_DIR}/RigWellPathFormations.h + ${CMAKE_CURRENT_LIST_DIR}/RigWellPathGeometryExporter.h + ${CMAKE_CURRENT_LIST_DIR}/RigWellPathGeometryTools.h + ${CMAKE_CURRENT_LIST_DIR}/RigWellPathIntersectionTools.h + ${CMAKE_CURRENT_LIST_DIR}/RigWellResultBranch.h + ${CMAKE_CURRENT_LIST_DIR}/RigWellResultFrame.h + ${CMAKE_CURRENT_LIST_DIR}/RigWellResultPoint.h + ${CMAKE_CURRENT_LIST_DIR}/RigWellTargetCandidatesGenerator.h + ${CMAKE_CURRENT_LIST_DIR}/RigWellLogData.h + ${CMAKE_CURRENT_LIST_DIR}/RigWellLogLasFile.h + ${CMAKE_CURRENT_LIST_DIR}/RigWellLogCsvFile.h +) + +set(SOURCE_GROUP_SOURCE_FILES + ${CMAKE_CURRENT_LIST_DIR}/RigAccWellFlowCalculator.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigEclipseWellLogExtractor.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigFishbonesGeometry.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigGeoMechWellLogExtractor.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigMswCenterLineCalculator.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigOsduWellLogData.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigSimulationWellCenterLineCalculator.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigSimulationWellCoordsAndMD.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigSimWellData.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigWellAllocationOverTime.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigWellDiskData.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigWellLogCurveData.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigWellLogExtractor.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigWellLogIndexDepthOffset.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigWellPath.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigWellPathFormations.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigWellPathGeometryExporter.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigWellPathGeometryTools.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigWellPathIntersectionTools.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigWellResultBranch.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigWellResultFrame.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigWellResultPoint.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigWellTargetCandidatesGenerator.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigWellLogData.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigWellLogLasFile.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigWellLogCsvFile.cpp +) + +list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) + +list(APPEND CODE_SOURCE_FILES ${SOURCE_GROUP_SOURCE_FILES}) + +source_group( + "ReservoirDataModel" + FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} + ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake +) diff --git a/ApplicationLibCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigAccWellFlowCalculator.cpp similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp rename to ApplicationLibCode/ReservoirDataModel/Well/RigAccWellFlowCalculator.cpp diff --git a/ApplicationLibCode/ReservoirDataModel/RigAccWellFlowCalculator.h b/ApplicationLibCode/ReservoirDataModel/Well/RigAccWellFlowCalculator.h similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigAccWellFlowCalculator.h rename to ApplicationLibCode/ReservoirDataModel/Well/RigAccWellFlowCalculator.h diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseWellLogExtractor.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigEclipseWellLogExtractor.cpp similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigEclipseWellLogExtractor.cpp rename to ApplicationLibCode/ReservoirDataModel/Well/RigEclipseWellLogExtractor.cpp diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseWellLogExtractor.h b/ApplicationLibCode/ReservoirDataModel/Well/RigEclipseWellLogExtractor.h similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigEclipseWellLogExtractor.h rename to ApplicationLibCode/ReservoirDataModel/Well/RigEclipseWellLogExtractor.h diff --git a/ApplicationLibCode/ReservoirDataModel/RigFishbonesGeometry.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigFishbonesGeometry.cpp similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigFishbonesGeometry.cpp rename to ApplicationLibCode/ReservoirDataModel/Well/RigFishbonesGeometry.cpp diff --git a/ApplicationLibCode/ReservoirDataModel/RigFishbonesGeometry.h b/ApplicationLibCode/ReservoirDataModel/Well/RigFishbonesGeometry.h similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigFishbonesGeometry.h rename to ApplicationLibCode/ReservoirDataModel/Well/RigFishbonesGeometry.h diff --git a/ApplicationLibCode/ReservoirDataModel/RigGeoMechWellLogExtractor.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigGeoMechWellLogExtractor.cpp similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigGeoMechWellLogExtractor.cpp rename to ApplicationLibCode/ReservoirDataModel/Well/RigGeoMechWellLogExtractor.cpp diff --git a/ApplicationLibCode/ReservoirDataModel/RigGeoMechWellLogExtractor.h b/ApplicationLibCode/ReservoirDataModel/Well/RigGeoMechWellLogExtractor.h similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigGeoMechWellLogExtractor.h rename to ApplicationLibCode/ReservoirDataModel/Well/RigGeoMechWellLogExtractor.h diff --git a/ApplicationLibCode/ReservoirDataModel/RigMswCenterLineCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigMswCenterLineCalculator.cpp similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigMswCenterLineCalculator.cpp rename to ApplicationLibCode/ReservoirDataModel/Well/RigMswCenterLineCalculator.cpp diff --git a/ApplicationLibCode/ReservoirDataModel/RigMswCenterLineCalculator.h b/ApplicationLibCode/ReservoirDataModel/Well/RigMswCenterLineCalculator.h similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigMswCenterLineCalculator.h rename to ApplicationLibCode/ReservoirDataModel/Well/RigMswCenterLineCalculator.h diff --git a/ApplicationLibCode/ReservoirDataModel/RigOsduWellLogData.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigOsduWellLogData.cpp similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigOsduWellLogData.cpp rename to ApplicationLibCode/ReservoirDataModel/Well/RigOsduWellLogData.cpp diff --git a/ApplicationLibCode/ReservoirDataModel/RigOsduWellLogData.h b/ApplicationLibCode/ReservoirDataModel/Well/RigOsduWellLogData.h similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigOsduWellLogData.h rename to ApplicationLibCode/ReservoirDataModel/Well/RigOsduWellLogData.h diff --git a/ApplicationLibCode/ReservoirDataModel/RigPipeInCellEvaluator.h b/ApplicationLibCode/ReservoirDataModel/Well/RigPipeInCellEvaluator.h similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigPipeInCellEvaluator.h rename to ApplicationLibCode/ReservoirDataModel/Well/RigPipeInCellEvaluator.h diff --git a/ApplicationLibCode/ReservoirDataModel/RigSimWellData.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigSimWellData.cpp similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigSimWellData.cpp rename to ApplicationLibCode/ReservoirDataModel/Well/RigSimWellData.cpp diff --git a/ApplicationLibCode/ReservoirDataModel/RigSimWellData.h b/ApplicationLibCode/ReservoirDataModel/Well/RigSimWellData.h similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigSimWellData.h rename to ApplicationLibCode/ReservoirDataModel/Well/RigSimWellData.h diff --git a/ApplicationLibCode/ReservoirDataModel/RigSimulationWellCenterLineCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigSimulationWellCenterLineCalculator.cpp similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigSimulationWellCenterLineCalculator.cpp rename to ApplicationLibCode/ReservoirDataModel/Well/RigSimulationWellCenterLineCalculator.cpp diff --git a/ApplicationLibCode/ReservoirDataModel/RigSimulationWellCenterLineCalculator.h b/ApplicationLibCode/ReservoirDataModel/Well/RigSimulationWellCenterLineCalculator.h similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigSimulationWellCenterLineCalculator.h rename to ApplicationLibCode/ReservoirDataModel/Well/RigSimulationWellCenterLineCalculator.h diff --git a/ApplicationLibCode/ReservoirDataModel/RigSimulationWellCoordsAndMD.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigSimulationWellCoordsAndMD.cpp similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigSimulationWellCoordsAndMD.cpp rename to ApplicationLibCode/ReservoirDataModel/Well/RigSimulationWellCoordsAndMD.cpp diff --git a/ApplicationLibCode/ReservoirDataModel/RigSimulationWellCoordsAndMD.h b/ApplicationLibCode/ReservoirDataModel/Well/RigSimulationWellCoordsAndMD.h similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigSimulationWellCoordsAndMD.h rename to ApplicationLibCode/ReservoirDataModel/Well/RigSimulationWellCoordsAndMD.h diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellAllocationOverTime.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigWellAllocationOverTime.cpp similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellAllocationOverTime.cpp rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellAllocationOverTime.cpp diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellAllocationOverTime.h b/ApplicationLibCode/ReservoirDataModel/Well/RigWellAllocationOverTime.h similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellAllocationOverTime.h rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellAllocationOverTime.h diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellDiskData.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigWellDiskData.cpp similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellDiskData.cpp rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellDiskData.cpp diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellDiskData.h b/ApplicationLibCode/ReservoirDataModel/Well/RigWellDiskData.h similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellDiskData.h rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellDiskData.h diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellLogCsvFile.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigWellLogCsvFile.cpp similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellLogCsvFile.cpp rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellLogCsvFile.cpp diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellLogCsvFile.h b/ApplicationLibCode/ReservoirDataModel/Well/RigWellLogCsvFile.h similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellLogCsvFile.h rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellLogCsvFile.h diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellLogCurveData.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigWellLogCurveData.cpp similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellLogCurveData.cpp rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellLogCurveData.cpp diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellLogCurveData.h b/ApplicationLibCode/ReservoirDataModel/Well/RigWellLogCurveData.h similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellLogCurveData.h rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellLogCurveData.h diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellLogData.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigWellLogData.cpp similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellLogData.cpp rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellLogData.cpp diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellLogData.h b/ApplicationLibCode/ReservoirDataModel/Well/RigWellLogData.h similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellLogData.h rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellLogData.h diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellLogExtractionTools.h b/ApplicationLibCode/ReservoirDataModel/Well/RigWellLogExtractionTools.h similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellLogExtractionTools.h rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellLogExtractionTools.h diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellLogExtractor.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigWellLogExtractor.cpp similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellLogExtractor.cpp rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellLogExtractor.cpp diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellLogExtractor.h b/ApplicationLibCode/ReservoirDataModel/Well/RigWellLogExtractor.h similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellLogExtractor.h rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellLogExtractor.h diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellLogIndexDepthOffset.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigWellLogIndexDepthOffset.cpp similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellLogIndexDepthOffset.cpp rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellLogIndexDepthOffset.cpp diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellLogIndexDepthOffset.h b/ApplicationLibCode/ReservoirDataModel/Well/RigWellLogIndexDepthOffset.h similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellLogIndexDepthOffset.h rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellLogIndexDepthOffset.h diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellLogLasFile.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigWellLogLasFile.cpp similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellLogLasFile.cpp rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellLogLasFile.cpp diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellLogLasFile.h b/ApplicationLibCode/ReservoirDataModel/Well/RigWellLogLasFile.h similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellLogLasFile.h rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellLogLasFile.h diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellPath.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigWellPath.cpp similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellPath.cpp rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellPath.cpp diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellPath.h b/ApplicationLibCode/ReservoirDataModel/Well/RigWellPath.h similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellPath.h rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellPath.h diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellPathFormations.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigWellPathFormations.cpp similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellPathFormations.cpp rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellPathFormations.cpp diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellPathFormations.h b/ApplicationLibCode/ReservoirDataModel/Well/RigWellPathFormations.h similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellPathFormations.h rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellPathFormations.h diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryExporter.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigWellPathGeometryExporter.cpp similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryExporter.cpp rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellPathGeometryExporter.cpp diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryExporter.h b/ApplicationLibCode/ReservoirDataModel/Well/RigWellPathGeometryExporter.h similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryExporter.h rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellPathGeometryExporter.h diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryTools.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigWellPathGeometryTools.cpp similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryTools.cpp rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellPathGeometryTools.cpp diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryTools.h b/ApplicationLibCode/ReservoirDataModel/Well/RigWellPathGeometryTools.h similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryTools.h rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellPathGeometryTools.h diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellPathIntersectionTools.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigWellPathIntersectionTools.cpp similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellPathIntersectionTools.cpp rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellPathIntersectionTools.cpp diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellPathIntersectionTools.h b/ApplicationLibCode/ReservoirDataModel/Well/RigWellPathIntersectionTools.h similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellPathIntersectionTools.h rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellPathIntersectionTools.h diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellResultBranch.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigWellResultBranch.cpp similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellResultBranch.cpp rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellResultBranch.cpp diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellResultBranch.h b/ApplicationLibCode/ReservoirDataModel/Well/RigWellResultBranch.h similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellResultBranch.h rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellResultBranch.h diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellResultFrame.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigWellResultFrame.cpp similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellResultFrame.cpp rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellResultFrame.cpp diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellResultFrame.h b/ApplicationLibCode/ReservoirDataModel/Well/RigWellResultFrame.h similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellResultFrame.h rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellResultFrame.h diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellResultPoint.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigWellResultPoint.cpp similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellResultPoint.cpp rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellResultPoint.cpp diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellResultPoint.h b/ApplicationLibCode/ReservoirDataModel/Well/RigWellResultPoint.h similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellResultPoint.h rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellResultPoint.h diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellTargetCandidatesGenerator.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigWellTargetCandidatesGenerator.cpp similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellTargetCandidatesGenerator.cpp rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellTargetCandidatesGenerator.cpp diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellTargetCandidatesGenerator.h b/ApplicationLibCode/ReservoirDataModel/Well/RigWellTargetCandidatesGenerator.h similarity index 100% rename from ApplicationLibCode/ReservoirDataModel/RigWellTargetCandidatesGenerator.h rename to ApplicationLibCode/ReservoirDataModel/Well/RigWellTargetCandidatesGenerator.h diff --git a/ApplicationLibCode/SocketInterface/RiaWellDataCommands.cpp b/ApplicationLibCode/SocketInterface/RiaWellDataCommands.cpp index 3ed0a1cda3..d87a753214 100644 --- a/ApplicationLibCode/SocketInterface/RiaWellDataCommands.cpp +++ b/ApplicationLibCode/SocketInterface/RiaWellDataCommands.cpp @@ -24,9 +24,9 @@ #include "RigEclipseCaseData.h" #include "RigGridBase.h" -#include "RigSimWellData.h" -#include "RigWellResultFrame.h" -#include "RigWellResultPoint.h" +#include "Well/RigSimWellData.h" +#include "Well/RigWellResultFrame.h" +#include "Well/RigWellResultPoint.h" #include "RimEclipseCase.h" diff --git a/ApplicationLibCode/UnitTests/RifOsduWellPathReader-Test.cpp b/ApplicationLibCode/UnitTests/RifOsduWellPathReader-Test.cpp index d4e915371f..2733b55df4 100644 --- a/ApplicationLibCode/UnitTests/RifOsduWellPathReader-Test.cpp +++ b/ApplicationLibCode/UnitTests/RifOsduWellPathReader-Test.cpp @@ -20,7 +20,7 @@ #include "RifOsduWellPathReader.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "cvfObject.h" diff --git a/ApplicationLibCode/UnitTests/RigWellLogCurveData-Test.cpp b/ApplicationLibCode/UnitTests/RigWellLogCurveData-Test.cpp index 68cad3f77b..b0f474d218 100644 --- a/ApplicationLibCode/UnitTests/RigWellLogCurveData-Test.cpp +++ b/ApplicationLibCode/UnitTests/RigWellLogCurveData-Test.cpp @@ -20,7 +20,7 @@ #include "RiaDefines.h" -#include "RigWellLogCurveData.h" +#include "Well/RigWellLogCurveData.h" #include "cvfVector3.h" diff --git a/ApplicationLibCode/UnitTests/RigWellLogExtractor-Test.cpp b/ApplicationLibCode/UnitTests/RigWellLogExtractor-Test.cpp index 0182543f6e..0ab598a3d9 100644 --- a/ApplicationLibCode/UnitTests/RigWellLogExtractor-Test.cpp +++ b/ApplicationLibCode/UnitTests/RigWellLogExtractor-Test.cpp @@ -21,10 +21,10 @@ #include "RifReaderMockModel.h" #include "RigEclipseCaseData.h" -#include "RigEclipseWellLogExtractor.h" #include "RigGridManager.h" #include "RigMainGrid.h" -#include "RigWellPath.h" +#include "Well/RigEclipseWellLogExtractor.h" +#include "Well/RigWellPath.h" //-------------------------------------------------------------------------------------------------- /// diff --git a/ApplicationLibCode/UnitTests/RigWellPathGeometryExporter-Test.cpp b/ApplicationLibCode/UnitTests/RigWellPathGeometryExporter-Test.cpp index a0eee3d839..60c1da3b2a 100644 --- a/ApplicationLibCode/UnitTests/RigWellPathGeometryExporter-Test.cpp +++ b/ApplicationLibCode/UnitTests/RigWellPathGeometryExporter-Test.cpp @@ -18,9 +18,8 @@ #include "gtest/gtest.h" -#include "RigWellPathGeometryExporter.h" - -#include "RigWellPath.h" +#include "Well/RigWellPath.h" +#include "Well/RigWellPathGeometryExporter.h" #include "cvfVector3.h" diff --git a/ApplicationLibCode/UnitTests/RigWellPathGeometryTools-Test.cpp b/ApplicationLibCode/UnitTests/RigWellPathGeometryTools-Test.cpp index fb9b8f05aa..405da5cf8f 100644 --- a/ApplicationLibCode/UnitTests/RigWellPathGeometryTools-Test.cpp +++ b/ApplicationLibCode/UnitTests/RigWellPathGeometryTools-Test.cpp @@ -18,7 +18,7 @@ #include "gtest/gtest.h" -#include "RigWellPathGeometryTools.h" +#include "Well/RigWellPathGeometryTools.h" #include #include diff --git a/ApplicationLibCode/UnitTests/RigWellPathIntersectionTools-Test.cpp b/ApplicationLibCode/UnitTests/RigWellPathIntersectionTools-Test.cpp index 7b140bc34f..932272408d 100644 --- a/ApplicationLibCode/UnitTests/RigWellPathIntersectionTools-Test.cpp +++ b/ApplicationLibCode/UnitTests/RigWellPathIntersectionTools-Test.cpp @@ -18,7 +18,7 @@ #include "gtest/gtest.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" #include "cvfVector3.h" diff --git a/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp b/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp index 646d0271bd..7efb230873 100644 --- a/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp +++ b/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp @@ -28,9 +28,9 @@ #include "RigNNCData.h" #include "RigResultAccessor.h" #include "RigResultAccessorFactory.h" -#include "RigSimWellData.h" -#include "RigWellResultFrame.h" -#include "RigWellResultPoint.h" +#include "Well/RigSimWellData.h" +#include "Well/RigWellResultFrame.h" +#include "Well/RigWellResultPoint.h" #include "Rim2dIntersectionView.h" #include "RimCellEdgeColors.h" diff --git a/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp b/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp index 6de9beacac..68f8ec5e24 100644 --- a/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp +++ b/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp @@ -27,7 +27,7 @@ #include "RimWellLogExtractionCurve.h" #include "RimWellLogTrack.h" -#include "RigWellLogCurveData.h" +#include "Well/RigWellLogCurveData.h" #include "RiuGuiTheme.h" #include "RiuPlotAnnotationTool.h" diff --git a/ApplicationLibCode/UserInterface/RiuWellPathComponentPlotItem.cpp b/ApplicationLibCode/UserInterface/RiuWellPathComponentPlotItem.cpp index 7a1f33cf52..3ca0d7678f 100644 --- a/ApplicationLibCode/UserInterface/RiuWellPathComponentPlotItem.cpp +++ b/ApplicationLibCode/UserInterface/RiuWellPathComponentPlotItem.cpp @@ -29,7 +29,8 @@ #include "RimWellPathAttributeCollection.h" #include "RimWellPathValve.h" -#include "RigWellPath.h" +#include "Well/RigWellPath.h" + #include "RiuQwtPlotTools.h" #include "RiuQwtSymbol.h" diff --git a/GrpcInterface/RiaGrpcSimulationWellService.cpp b/GrpcInterface/RiaGrpcSimulationWellService.cpp index 761a38d46a..a82b65b714 100644 --- a/GrpcInterface/RiaGrpcSimulationWellService.cpp +++ b/GrpcInterface/RiaGrpcSimulationWellService.cpp @@ -22,9 +22,9 @@ #include "RigEclipseCaseData.h" #include "RigGridBase.h" -#include "RigSimWellData.h" -#include "RigWellResultFrame.h" -#include "RigWellResultPoint.h" +#include "Well/RigSimWellData.h" +#include "Well/RigWellResultFrame.h" +#include "Well/RigWellResultPoint.h" #include "RimCase.h" #include "RimEclipseCase.h" From d7d10268411fb4584e6bf8ac16357cc44c7f118f Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Wed, 30 Oct 2024 17:40:56 +0100 Subject: [PATCH 085/160] Fix build issue --- ApplicationLibCode/GeoMech/GeoMechDataModel/RigGeoMechCaseData.h | 1 + 1 file changed, 1 insertion(+) diff --git a/ApplicationLibCode/GeoMech/GeoMechDataModel/RigGeoMechCaseData.h b/ApplicationLibCode/GeoMech/GeoMechDataModel/RigGeoMechCaseData.h index b916b74f31..a6c243cbdc 100644 --- a/ApplicationLibCode/GeoMech/GeoMechDataModel/RigGeoMechCaseData.h +++ b/ApplicationLibCode/GeoMech/GeoMechDataModel/RigGeoMechCaseData.h @@ -23,6 +23,7 @@ #include "RigFemResultPosEnum.h" #include "cvfObject.h" +#include "cvfVector3.h" #include #include From e6a58d7559c669158c5ad10ff62deb4f54718156 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 31 Oct 2024 15:39:52 +0100 Subject: [PATCH 086/160] Fix spell check action --- .misspell-fixer.ignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.misspell-fixer.ignore b/.misspell-fixer.ignore index bd33fc4c8a..2cc8b7578d 100644 --- a/.misspell-fixer.ignore +++ b/.misspell-fixer.ignore @@ -1,4 +1,4 @@ -^ApplicationLibCode/ReservoirDataModel/RigWellLogLasFile.cpp:28:aswell +^ApplicationLibCode/ReservoirDataModel/Well/RigWellLogLasFile.cpp:28:aswell ^ApplicationLibCode/ReservoirDataModel/RigLasFileExporter.cpp:33:aswell ^ApplicationExeCode/Resources/EastView.svg ^ApplicationExeCode/Resources/NorthView.svg From 9a1c54c7d674bf8538a930a61e69f61f7c2e8f4f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 31 Oct 2024 15:41:10 +0100 Subject: [PATCH 087/160] Add debug timers to import of UNRST files --- ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp b/ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp index 96309c0ef8..dc9c5f5443 100644 --- a/ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp @@ -741,7 +741,9 @@ void RifReaderOpmCommon::setupInitAndRestartAccess() { try { + RiaLogging::resetTimer( "Starting import of meta data from " + QString::fromStdString( m_restartFileName ) ); m_restartFile = std::make_unique( m_restartFileName ); + RiaLogging::logTimeElapsed( "Completed import of meta data" ); } catch ( ... ) { @@ -890,6 +892,8 @@ void RifReaderOpmCommon::buildMetaData( RigEclipseCaseData* eclipseCaseData, caf auto task = progress.task( "Handling well information", 10 ); if ( loadWellDataEnabled() && !m_restartFileName.empty() ) { + RiaLogging::resetTimer( "Start import of simulation well data" ); + auto restartAccess = std::make_unique(); restartAccess->setRestartFiles( QStringList( QString::fromStdString( m_restartFileName ) ) ); restartAccess->open(); @@ -907,6 +911,8 @@ void RifReaderOpmCommon::buildMetaData( RigEclipseCaseData* eclipseCaseData, caf isImportOfCompleteMswDataEnabled() ); restartAccess->close(); + + RiaLogging::logTimeElapsed( "Completed import of simulation well data" ); } else { From 4cf6a260837ffb275e1a30955446013e9c2711f6 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Sun, 3 Nov 2024 13:38:03 +0100 Subject: [PATCH 088/160] Improve draw performance for active cell grid * Show timing for geoBuilder.generateSurface() * Check state of element vector result before geometry is created * Improve performance for isFaceVisible Avoid calling costly function cell() when possible Remove check on fault geometry as this does not affect the visualization * Performance: Avoid traversal of all cells when computing visibility When we have an active cell grid, we can skip checking for inactive and invalid state. Use the list of active grid cells when looping through cells. --- .../ModelVisualization/RivGridPartMgr.cpp | 31 +++++++++++++++++++ .../RivReservoirViewPartMgr.cpp | 22 +++++++++++++ .../ProjectDataModel/RimEclipseView.cpp | 23 ++++++++------ .../ReservoirDataModel/RigActiveCellGrid.cpp | 16 ++++++++++ .../ReservoirDataModel/RigActiveCellGrid.h | 2 ++ .../ReservoirDataModel/RigGridBase.cpp | 25 +++++---------- 6 files changed, 92 insertions(+), 27 deletions(-) diff --git a/ApplicationLibCode/ModelVisualization/RivGridPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivGridPartMgr.cpp index 935d35d4bc..cbad222ab4 100644 --- a/ApplicationLibCode/ModelVisualization/RivGridPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivGridPartMgr.cpp @@ -20,6 +20,7 @@ #include "RivGridPartMgr.h" +#include "RiaLogging.h" #include "RiaPreferences.h" #include "RiaRegressionTestRunner.h" @@ -66,6 +67,32 @@ #include "cvfTransform.h" #include "cvfUniform.h" +namespace caf +{ +template <> +void caf::AppEnum::setUp() +{ + addItem( RivCellSetEnum::OVERRIDDEN_CELL_VISIBILITY, "OVERRIDDEN_CELL_VISIBILITY", "OVERRIDDEN_CELL_VISIBILITY" ); + addItem( RivCellSetEnum::ALL_CELLS, "ALL_CELLS", "ALL_CELLS" ); + addItem( RivCellSetEnum::ACTIVE, "ACTIVE", "ACTIVE" ); + addItem( RivCellSetEnum::ALL_WELL_CELLS, "ALL_WELL_CELLS", "ALL_WELL_CELLS" ); + addItem( RivCellSetEnum::VISIBLE_WELL_CELLS, "VISIBLE_WELL_CELLS", "VISIBLE_WELL_CELLS" ); + addItem( RivCellSetEnum::VISIBLE_WELL_FENCE_CELLS, "VISIBLE_WELL_FENCE_CELLS", "VISIBLE_WELL_FENCE_CELLS" ); + addItem( RivCellSetEnum::INACTIVE, "INACTIVE", "INACTIVE" ); + addItem( RivCellSetEnum::RANGE_FILTERED, "RANGE_FILTERED", "RANGE_FILTERED" ); + addItem( RivCellSetEnum::RANGE_FILTERED_INACTIVE, "RANGE_FILTERED_INACTIVE", "RANGE_FILTERED_INACTIVE" ); + addItem( RivCellSetEnum::RANGE_FILTERED_WELL_CELLS, "RANGE_FILTERED_WELL_CELLS", "RANGE_FILTERED_WELL_CELLS" ); + addItem( RivCellSetEnum::VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER, + "VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER", + "VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER" ); + addItem( RivCellSetEnum::VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER, + "VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER", + "VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER" ); + addItem( RivCellSetEnum::PROPERTY_FILTERED, "PROPERTY_FILTERED", "PROPERTY_FILTERED" ); + addItem( RivCellSetEnum::PROPERTY_FILTERED_WELL_CELLS, "PROPERTY_FILTERED_WELL_CELLS", "PROPERTY_FILTERED_WELL_CELLS" ); +} +} // namespace caf + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -117,7 +144,11 @@ void RivGridPartMgr::generatePartGeometry( cvf::StructGridGeometryGenerator& geo // Surface geometry { + auto text = caf::AppEnum::text( m_cellSetType ); + RiaLogging::resetTimer( "Compute surface for " + text ); cvf::ref geo = geoBuilder.generateSurface(); + RiaLogging::logTimeElapsed( "" ); + if ( geo.notNull() ) { geo->computeNormals(); diff --git a/ApplicationLibCode/ModelVisualization/RivReservoirViewPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivReservoirViewPartMgr.cpp index 5e39ce8166..718ce426d6 100644 --- a/ApplicationLibCode/ModelVisualization/RivReservoirViewPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivReservoirViewPartMgr.cpp @@ -20,6 +20,7 @@ #include "RivReservoirViewPartMgr.h" +#include "RigActiveCellGrid.h" #include "RigActiveCellInfo.h" #include "RigCaseCellResultsData.h" #include "RigCaseToCaseCellMapper.h" @@ -601,6 +602,27 @@ void RivReservoirViewPartMgr::computeNativeVisibility( cvf::UByteArray* cellVisibility->resize( grid->cellCount() ); + if ( auto activeGrid = dynamic_cast( grid ) ) + { + auto reservoirIndices = activeGrid->activeReservoirCellIndices(); +#pragma omp parallel for + for ( int i = 0; i < static_cast( reservoirIndices.size() ); i++ ) + { + size_t cellIndex = reservoirIndices[i]; + + if ( ( !activeCellsIsVisible ) || ( *cellIsInWellStatuses )[cellIndex] ) + { + ( *cellVisibility )[cellIndex] = false; + } + else + { + ( *cellVisibility )[cellIndex] = true; + } + } + + return; + } + #pragma omp parallel for for ( int cellIndex = 0; cellIndex < static_cast( grid->cellCount() ); cellIndex++ ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp index 5ec6ff1489..6a9f632724 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp @@ -1139,19 +1139,22 @@ void RimEclipseView::appendElementVectorResultToModel() cvf::String name = "ElementVectorModelMod"; RimEclipseView::removeModelByName( frameScene, name ); - cvf::ref frameParts = new cvf::ModelBasicList; - frameParts->setName( name ); + if ( m_elementVectorResult->showResult() ) + { + cvf::ref frameParts = new cvf::ModelBasicList; + frameParts->setName( name ); - m_reservoirGridPartManager->appendElementVectorResultDynamicGeometryPartsToModel( frameParts.p(), - PROPERTY_FILTERED, - m_currentTimeStep ); + m_reservoirGridPartManager->appendElementVectorResultDynamicGeometryPartsToModel( frameParts.p(), + PROPERTY_FILTERED, + m_currentTimeStep ); - // TODO: should this be ACTIVE? - m_reservoirGridPartManager->appendElementVectorResultDynamicGeometryPartsToModel( frameParts.p(), - PROPERTY_FILTERED_WELL_CELLS, - m_currentTimeStep ); + // TODO: should this be ACTIVE? + m_reservoirGridPartManager->appendElementVectorResultDynamicGeometryPartsToModel( frameParts.p(), + PROPERTY_FILTERED_WELL_CELLS, + m_currentTimeStep ); - frameScene->addModel( frameParts.p() ); + frameScene->addModel( frameParts.p() ); + } } } } diff --git a/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.cpp b/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.cpp index 7eb4054962..6f98891cf0 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.cpp @@ -109,6 +109,22 @@ size_t RigActiveCellGrid::totalActiveCellCount() const return m_totalActiveCellCount; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigActiveCellGrid::activeReservoirCellIndices() const +{ + std::vector indices; + indices.reserve( m_nativeCells.size() ); + + for ( const auto& [index, cell] : m_nativeCells ) + { + indices.emplace_back( index ); + } + + return indices; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h b/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h index 142b47e822..c7e1225033 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h +++ b/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h @@ -34,6 +34,8 @@ public: size_t totalCellCount() const override; size_t totalActiveCellCount() const; + std::vector activeReservoirCellIndices() const; + protected: // only for use by file readers! friend class RifReaderOpmCommonActive; std::map& nativeCells(); diff --git a/ApplicationLibCode/ReservoirDataModel/RigGridBase.cpp b/ApplicationLibCode/ReservoirDataModel/RigGridBase.cpp index 8b87d9ccd9..1adbb1716b 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigGridBase.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigGridBase.cpp @@ -535,7 +535,7 @@ bool RigGridCellFaceVisibilityFilter::isFaceVisible( size_t CVF_TIGHT_ASSERT( m_grid ); size_t cellIndex = m_grid->cellIndexFromIJK( i, j, k ); - if ( m_grid->cell( cellIndex ).subGrid() ) + if ( m_grid->mainGrid()->gridCount() > 1 && m_grid->cell( cellIndex ).subGrid() ) { // Do not show any faces in the place where a LGR is present return false; @@ -552,27 +552,18 @@ bool RigGridCellFaceVisibilityFilter::isFaceVisible( size_t size_t neighborCellIndex = m_grid->cellIndexFromIJK( ni, nj, nk ); - // Do show the faces in the boarder between this grid and a possible LGR. Some of the LGR cells - // might not be visible. - if ( m_grid->cell( neighborCellIndex ).subGrid() ) - { - return true; - } - - // Do not show cell geometry if a fault is present to avoid z fighting between surfaces - // It will always be a better solution to avoid geometry creation instead of part priority and polygon offset - size_t nativeResvCellIndex = m_grid->reservoirCellIndex( cellIndex ); - const RigFault* fault = m_grid->mainGrid()->findFaultFromCellIndexAndCellFace( nativeResvCellIndex, face ); - if ( fault ) - { - return false; - } - // If the neighbour cell is invisible, we need to draw the face if ( ( cellVisibility != nullptr ) && !( *cellVisibility )[neighborCellIndex] ) { return true; } + // Do show the faces in the boarder between this grid and a possible LGR. Some of the LGR cells + // might not be visible. + if ( m_grid->mainGrid()->gridCount() > 1 && m_grid->cell( neighborCellIndex ).subGrid() ) + { + return true; + } + return false; } From a05645e966cc0b35d1fc98f7f570a22149a7d871 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 1 Nov 2024 14:30:37 +0100 Subject: [PATCH 089/160] #11844 Quick Access adjustments Show the Quick Access menu only for objects that implements RimFieldQuickAccessInterface Show the fields made available by RimFieldQuickAccessInterface --- .../RicAddFieldToQuickAccessFeature.cpp | 10 ++++ .../RicAddFieldToQuickAccessFeature.h | 1 + .../QuickAccess/RimFieldQuickAccessGroup.cpp | 4 +- .../QuickAccess/RimFieldReference.cpp | 59 ++++++++++--------- .../QuickAccess/RimFieldReference.h | 3 - 5 files changed, 43 insertions(+), 34 deletions(-) diff --git a/ApplicationLibCode/Commands/ToolCommands/RicAddFieldToQuickAccessFeature.cpp b/ApplicationLibCode/Commands/ToolCommands/RicAddFieldToQuickAccessFeature.cpp index 1f701e83ce..c1685252d9 100644 --- a/ApplicationLibCode/Commands/ToolCommands/RicAddFieldToQuickAccessFeature.cpp +++ b/ApplicationLibCode/Commands/ToolCommands/RicAddFieldToQuickAccessFeature.cpp @@ -18,6 +18,7 @@ #include "RicAddFieldToQuickAccessFeature.h" +#include "QuickAccess/RimFieldQuickAccessInterface.h" #include "QuickAccess/RimFieldReference.h" #include "QuickAccess/RimQuickAccessCollection.h" @@ -30,6 +31,15 @@ CAF_CMD_SOURCE_INIT( RicAddFieldToQuickAccessFeature, "RicAddFieldToQuickAccessFeature" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicAddFieldToQuickAccessFeature::isCommandEnabled() const +{ + auto objects = caf::selectedObjectsByType(); + return !objects.empty(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/ToolCommands/RicAddFieldToQuickAccessFeature.h b/ApplicationLibCode/Commands/ToolCommands/RicAddFieldToQuickAccessFeature.h index ddccd0a272..a860b71f06 100644 --- a/ApplicationLibCode/Commands/ToolCommands/RicAddFieldToQuickAccessFeature.h +++ b/ApplicationLibCode/Commands/ToolCommands/RicAddFieldToQuickAccessFeature.h @@ -28,6 +28,7 @@ class RicAddFieldToQuickAccessFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: + bool isCommandEnabled() const override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; }; diff --git a/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccessGroup.cpp b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccessGroup.cpp index cacf324709..2beb224af2 100644 --- a/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccessGroup.cpp +++ b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldQuickAccessGroup.cpp @@ -60,8 +60,6 @@ void RimFieldQuickAccessGroup::addFields( const std::vectorsetField( field ); diff --git a/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldReference.cpp b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldReference.cpp index 4493216d55..9b6b4e309c 100644 --- a/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldReference.cpp +++ b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldReference.cpp @@ -17,6 +17,7 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RimFieldReference.h" +#include "RimFieldQuickAccessInterface.h" CAF_PDM_SOURCE_INIT( RimFieldReference, "RimFieldReference" ); @@ -36,10 +37,19 @@ void RimFieldReference::setObject( caf::PdmObject* object ) { m_object = object; - auto keywordAndNames = RimFieldReference::fieldKeywordAndNames( object ); - if ( !keywordAndNames.empty() ) + if ( auto quickInterface = dynamic_cast( m_object() ) ) { - m_fieldKeyword = keywordAndNames[0].first; + for ( const auto& [groupName, fields] : quickInterface->quickAccessFields() ) + { + for ( auto field : fields ) + { + if ( field ) + { + m_fieldKeyword = field->keyword(); + return; + } + } + } } } @@ -131,29 +141,30 @@ QList RimFieldReference::calculateValueOptions( const ca if ( fieldNeedingOptions == &m_fieldKeyword ) { - auto keywordAndNames = RimFieldReference::fieldKeywordAndNames( m_object ); - for ( const auto& [keyword, name] : keywordAndNames ) + if ( auto quickInterface = dynamic_cast( m_object() ) ) { - options.push_back( caf::PdmOptionItemInfo( name, keyword ) ); + for ( const auto& [groupName, fields] : quickInterface->quickAccessFields() ) + { + for ( auto field : fields ) + { + auto text = field->keyword(); + + if ( auto uiCapability = field->uiCapability() ) + { + text = uiCapability->uiName(); + } + + options.push_back( caf::PdmOptionItemInfo( text, field->keyword() ) ); + } + } } } else if ( fieldNeedingOptions == &m_object ) { - if ( m_objectsForSelection.empty() ) + if ( m_object ) { - if ( m_object ) - { - QString text = m_object()->uiName(); - options.push_back( caf::PdmOptionItemInfo( text, m_object ) ); - } - } - else - { - for ( auto obj : m_objectsForSelection ) - { - QString text = obj->uiName(); - options.push_back( caf::PdmOptionItemInfo( text, obj ) ); - } + QString text = m_object()->uiName(); + options.push_back( caf::PdmOptionItemInfo( text, m_object ) ); } } @@ -178,14 +189,6 @@ caf::PdmObject* RimFieldReference::object() const return m_object; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimFieldReference::setObjectsForSelection( const std::vector& objectsForSelection ) -{ - m_objectsForSelection = objectsForSelection; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldReference.h b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldReference.h index 1cd5946781..4f5e826c8b 100644 --- a/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldReference.h +++ b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldReference.h @@ -43,7 +43,6 @@ public: caf::PdmFieldHandle* field() const; caf::PdmObject* object() const; - void setObjectsForSelection( const std::vector& objectsForSelection ); private: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; @@ -57,6 +56,4 @@ private: private: caf::PdmPtrField m_object; caf::PdmField m_fieldKeyword; - - std::vector m_objectsForSelection; }; From 7fe945e68d3d0aa39d639462e4189363ce6f555f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 1 Nov 2024 16:02:57 +0100 Subject: [PATCH 090/160] #11842 Fix drag/drop of VFP plot into multiplot Remove the deprecated plot collection Make sure the dropped plot is visible in the multi plot --- .../ProjectDataModel/RimMultiPlot.cpp | 1 + .../CMakeLists_files.cmake | 2 - .../RimVfpPlotCollection.cpp | 20 +- .../RimVfpPlotCollection.h | 19 +- .../RimVfpPlot_deprecated.cpp | 945 ------------------ .../RimVfpPlot_deprecated.h | 169 ---- 6 files changed, 16 insertions(+), 1140 deletions(-) delete mode 100644 ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/RimVfpPlot_deprecated.cpp delete mode 100644 ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/RimVfpPlot_deprecated.h diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index 1d8c982032..6ce15bf53e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -194,6 +194,7 @@ void RimMultiPlot::insertPlot( RimPlot* plot, size_t index ) if ( m_viewer ) { + plot->setShowWindow( true ); plot->createPlotWidget( m_viewer ); m_viewer->insertPlot( plot->plotWidget(), index ); } diff --git a/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/CMakeLists_files.cmake index 8a36f69a0e..e16cacc4e9 100644 --- a/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/CMakeLists_files.cmake @@ -1,6 +1,5 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RimVfpDefines.h - ${CMAKE_CURRENT_LIST_DIR}/RimVfpPlot_deprecated.h ${CMAKE_CURRENT_LIST_DIR}/RimCustomVfpPlot.h ${CMAKE_CURRENT_LIST_DIR}/RimVfpPlotCollection.h ${CMAKE_CURRENT_LIST_DIR}/RimVfpTableData.h @@ -10,7 +9,6 @@ set(SOURCE_GROUP_HEADER_FILES set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimVfpDefines.cpp - ${CMAKE_CURRENT_LIST_DIR}/RimVfpPlot_deprecated.cpp ${CMAKE_CURRENT_LIST_DIR}/RimCustomVfpPlot.cpp ${CMAKE_CURRENT_LIST_DIR}/RimVfpPlotCollection.cpp ${CMAKE_CURRENT_LIST_DIR}/RimVfpTableData.cpp diff --git a/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/RimVfpPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/RimVfpPlotCollection.cpp index 5ca78c1fcc..9e3b0a1d07 100644 --- a/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/RimVfpPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/RimVfpPlotCollection.cpp @@ -32,7 +32,6 @@ RimVfpPlotCollection::RimVfpPlotCollection() { CAF_PDM_InitObject( "VFP Plots", ":/VfpPlotCollection.svg" ); - CAF_PDM_InitFieldNoDefault( &m_vfpPlots_deprecated, "VfpPlots", "Vertical Flow Performance Plots" ); CAF_PDM_InitFieldNoDefault( &m_customVfpPlots, "CustomVfpPlots", "Vertical Flow Performance Plots" ); } @@ -57,25 +56,25 @@ RimCustomVfpPlot* RimVfpPlotCollection::createAndAppendPlots( RimVfpTable* mainD //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimVfpPlotCollection::addPlot( RimVfpPlot_deprecated* newPlot ) +void RimVfpPlotCollection::addPlot( RimCustomVfpPlot* newPlot ) { - m_vfpPlots_deprecated.push_back( newPlot ); + m_customVfpPlots.push_back( newPlot ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimVfpPlotCollection::insertPlot( RimVfpPlot_deprecated* vfpPlot, size_t index ) +void RimVfpPlotCollection::insertPlot( RimCustomVfpPlot* vfpPlot, size_t index ) { - m_vfpPlots_deprecated.insert( index, vfpPlot ); + m_customVfpPlots.insert( index, vfpPlot ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RimVfpPlotCollection::plots() const +std::vector RimVfpPlotCollection::plots() const { - return m_vfpPlots_deprecated.childrenByType(); + return m_customVfpPlots.childrenByType(); } //-------------------------------------------------------------------------------------------------- @@ -83,15 +82,15 @@ std::vector RimVfpPlotCollection::plots() const //-------------------------------------------------------------------------------------------------- size_t RimVfpPlotCollection::plotCount() const { - return m_vfpPlots_deprecated.size() + m_customVfpPlots.size(); + return m_customVfpPlots.size() + m_customVfpPlots.size(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimVfpPlotCollection::removePlot( RimVfpPlot_deprecated* vfpPlot ) +void RimVfpPlotCollection::removePlot( RimCustomVfpPlot* vfpPlot ) { - m_vfpPlots_deprecated.removeChild( vfpPlot ); + m_customVfpPlots.removeChild( vfpPlot ); updateAllRequiredEditors(); } @@ -100,7 +99,6 @@ void RimVfpPlotCollection::removePlot( RimVfpPlot_deprecated* vfpPlot ) //-------------------------------------------------------------------------------------------------- void RimVfpPlotCollection::deleteAllPlots() { - m_vfpPlots_deprecated.deleteChildren(); m_customVfpPlots.deleteChildren(); } diff --git a/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/RimVfpPlotCollection.h b/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/RimVfpPlotCollection.h index df8293127d..f7bb4fdf79 100644 --- a/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/RimVfpPlotCollection.h +++ b/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/RimVfpPlotCollection.h @@ -18,18 +18,16 @@ #pragma once #include "RimAbstractPlotCollection.h" -#include "RimVfpPlot_deprecated.h" +#include "RimCustomVfpPlot.h" #include "cafPdmChildArrayField.h" #include "cafPdmObject.h" -class RimCustomVfpPlot; - //================================================================================================== /// /// //================================================================================================== -class RimVfpPlotCollection : public caf::PdmObject, public RimTypedPlotCollection +class RimVfpPlotCollection : public caf::PdmObject, public RimTypedPlotCollection { CAF_PDM_HEADER_INIT; @@ -41,12 +39,12 @@ public: static void addImportItems( caf::CmdFeatureMenuBuilder& menuBuilder ); private: - void addPlot( RimVfpPlot_deprecated* newPlot ) override; - std::vector plots() const override; + void addPlot( RimCustomVfpPlot* newPlot ) override; + std::vector plots() const override; size_t plotCount() const final; - void insertPlot( RimVfpPlot_deprecated* vfpPlot, size_t index ) final; - void removePlot( RimVfpPlot_deprecated* vfpPlot ) final; + void insertPlot( RimCustomVfpPlot* vfpPlot, size_t index ) final; + void removePlot( RimCustomVfpPlot* vfpPlot ) final; void deleteAllPlots() override; void loadDataAndUpdateAllPlots() override; @@ -56,9 +54,4 @@ private: private: caf::PdmChildArrayField m_customVfpPlots; - - // To be removed in a future release. - // RimVfpPlotCollection can derive from RimTypedPlotCollection - // Consider renaming RimCustomVfpPlot to RimVfpPlot - caf::PdmChildArrayField m_vfpPlots_deprecated; }; diff --git a/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/RimVfpPlot_deprecated.cpp b/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/RimVfpPlot_deprecated.cpp deleted file mode 100644 index c023eac228..0000000000 --- a/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/RimVfpPlot_deprecated.cpp +++ /dev/null @@ -1,945 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// 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 "RimVfpPlot_deprecated.h" - -#include "RiaColorTables.h" -#include "RiaColorTools.h" -#include "RiaEclipseUnitTools.h" -#include "RiaOpmParserTools.h" - -#include "RigVfpTables.h" - -#include "RimPlotAxisProperties.h" -#include "RimPlotCurve.h" -#include "RimProject.h" -#include "RimVfpDataCollection.h" -#include "RimVfpDefines.h" -#include "RimVfpTable.h" -#include "RimVfpTableData.h" -#include "Tools/RimPlotAxisTools.h" - -#include "RiuContextMenuLauncher.h" -#include "RiuPlotCurve.h" -#include "RiuPlotWidget.h" -#include "RiuQwtCurvePointTracker.h" -#include "RiuQwtPlotCurveDefines.h" -#include "RiuQwtPlotWheelZoomer.h" -#include "RiuQwtPlotWidget.h" -#include "RiuQwtPlotZoomer.h" - -#include "cafPdmUiComboBoxEditor.h" - -#include "qwt_plot_panner.h" - -#include - -#include - -//================================================================================================== -// -// -// -//================================================================================================== - -CAF_PDM_SOURCE_INIT( RimVfpPlot_deprecated, "VfpPlot" ); - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimVfpPlot_deprecated::RimVfpPlot_deprecated() -{ - // TODO: add icon - CAF_PDM_InitObject( "VFP Plot", ":/VfpPlot.svg" ); - - CAF_PDM_InitField( &m_plotTitle, "PlotTitle", QString( "VFP Plot" ), "Plot Title" ); - m_plotTitle.uiCapability()->setUiHidden( true ); - - CAF_PDM_InitFieldNoDefault( &m_filePath_OBSOLETE, "FilePath", "File Path" ); - m_filePath_OBSOLETE.xmlCapability()->setIOWritable( false ); - - CAF_PDM_InitFieldNoDefault( &m_vfpTable, "VfpTableData", "VFP Data Source" ); - - caf::AppEnum defaultTableType = RimVfpDefines::TableType::INJECTION; - CAF_PDM_InitField( &m_tableType, "TableType", defaultTableType, "Table Type" ); - m_tableType.uiCapability()->setUiReadOnly( true ); - - CAF_PDM_InitField( &m_tableNumber, "TableNumber", -1, "Table Number" ); - m_tableNumber.uiCapability()->setUiReadOnly( true ); - - CAF_PDM_InitField( &m_referenceDepth, "ReferenceDepth", 0.0, "Reference Depth" ); - m_referenceDepth.uiCapability()->setUiReadOnly( true ); - - caf::AppEnum defaultFlowingPhase = RimVfpDefines::FlowingPhaseType::WATER; - CAF_PDM_InitField( &m_flowingPhase, "FlowingPhase", defaultFlowingPhase, "Flowing Phase" ); - m_flowingPhase.uiCapability()->setUiReadOnly( true ); - - CAF_PDM_InitFieldNoDefault( &m_flowingWaterFraction, "FlowingWaterFraction", "Flowing Water Fraction" ); - m_flowingWaterFraction.uiCapability()->setUiReadOnly( true ); - - CAF_PDM_InitFieldNoDefault( &m_flowingGasFraction, "FlowingGasFraction", "Flowing Gas Fraction" ); - m_flowingGasFraction.uiCapability()->setUiReadOnly( true ); - - caf::AppEnum defaultInterpolatedVariable = RimVfpDefines::InterpolatedVariableType::BHP; - CAF_PDM_InitField( &m_interpolatedVariable, "InterpolatedVariable", defaultInterpolatedVariable, "Interpolated Variable" ); - - caf::AppEnum defaultPrimaryVariable = RimVfpDefines::ProductionVariableType::FLOW_RATE; - CAF_PDM_InitField( &m_primaryVariable, "PrimaryVariable", defaultPrimaryVariable, "Primary Variable" ); - - caf::AppEnum defaultFamilyVariable = RimVfpDefines::ProductionVariableType::THP; - CAF_PDM_InitField( &m_familyVariable, "FamilyVariable", defaultFamilyVariable, "Family Variable" ); - - CAF_PDM_InitField( &m_flowRateIdx, "LiquidFlowRateIdx", 0, "Flow Rate" ); - m_flowRateIdx.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); - - CAF_PDM_InitField( &m_thpIdx, "THPIdx", 0, "THP" ); - m_thpIdx.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); - - CAF_PDM_InitField( &m_articifialLiftQuantityIdx, "ArtificialLiftQuantityIdx", 0, "Artificial Lift Quantity" ); - m_articifialLiftQuantityIdx.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); - - CAF_PDM_InitField( &m_waterCutIdx, "WaterCutIdx", 0, "Water Cut" ); - m_waterCutIdx.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); - - CAF_PDM_InitField( &m_gasLiquidRatioIdx, "GasLiquidRatioIdx", 0, "Gas Liquid Ratio" ); - m_gasLiquidRatioIdx.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); - - CAF_PDM_InitFieldNoDefault( &m_xAxisProperties, "xAxisProperties", "X Axis" ); - m_xAxisProperties = new RimPlotAxisProperties; - m_xAxisProperties->setNameAndAxis( "X-Axis", "X-Axis", RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ); - m_xAxisProperties->setEnableTitleTextSettings( false ); - - CAF_PDM_InitFieldNoDefault( &m_yAxisProperties, "yAxisProperties", "Y Axis" ); - m_yAxisProperties = new RimPlotAxisProperties; - m_yAxisProperties->setNameAndAxis( "Y-Axis", "Y-Axis", RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); - m_yAxisProperties->setEnableTitleTextSettings( false ); - - connectAxisSignals( m_xAxisProperties() ); - connectAxisSignals( m_yAxisProperties() ); - - CAF_PDM_InitFieldNoDefault( &m_plotCurves, "PlotCurves", "Curves" ); - - m_showWindow = true; - m_showPlotLegends = true; - m_dataIsImportedExternally = false; - - setAsPlotMdiWindow(); - - setDeletable( true ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimVfpPlot_deprecated::~RimVfpPlot_deprecated() -{ - removeMdiWindowFromMdiArea(); - deleteViewWidget(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::setDataSource( RimVfpTable* vfpTableData ) -{ - m_vfpTable = vfpTableData; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::setTableNumber( int tableNumber ) -{ - m_tableNumber = tableNumber; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::initializeObject() -{ - if ( !vfpTables() ) return; - - auto tableNumber = m_vfpTable->tableNumber(); - - // Always use the available table number if only one table is available - auto prodTableNumbers = vfpTables()->productionTableNumbers(); - auto injTableNumbers = vfpTables()->injectionTableNumbers(); - - if ( prodTableNumbers.size() == 1 && injTableNumbers.empty() ) - { - tableNumber = prodTableNumbers.front(); - } - else if ( injTableNumbers.size() == 1 && prodTableNumbers.empty() ) - { - tableNumber = injTableNumbers.front(); - } - - auto table = vfpTables()->getTableInitialData( tableNumber ); - initializeFromInitData( table ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RiuPlotWidget* RimVfpPlot_deprecated::plotWidget() -{ - return m_plotWidget; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RimVfpPlot_deprecated::isCurveHighlightSupported() const -{ - return true; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::setAutoScaleXEnabled( bool enabled ) -{ - m_xAxisProperties->setAutoZoom( enabled ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::setAutoScaleYEnabled( bool enabled ) -{ - m_yAxisProperties->setAutoZoom( enabled ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::updateAxes() -{ - if ( !m_plotWidget ) return; - - QString title; - RimPlotAxisTools::updatePlotWidgetFromAxisProperties( m_plotWidget, RiuPlotAxis::defaultBottom(), m_xAxisProperties(), title, {} ); - RimPlotAxisTools::updatePlotWidgetFromAxisProperties( m_plotWidget, RiuPlotAxis::defaultLeft(), m_yAxisProperties(), title, {} ); - - m_plotWidget->scheduleReplot(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::updateLegend() -{ - if ( !m_plotWidget ) - { - return; - } - - // Hide the legend when in multiplot mode, as the legend is handled by the multi plot grid layout - bool doShowLegend = false; - if ( isMdiWindow() ) - { - doShowLegend = m_showPlotLegends; - } - - if ( doShowLegend ) - { - m_plotWidget->insertLegend( RiuPlotWidget::Legend::BOTTOM ); - } - else - { - m_plotWidget->clearLegend(); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RimVfpPlot_deprecated::asciiDataForPlotExport() const -{ - if ( !vfpTables() ) return {}; - - auto tableText = vfpTables()->asciiDataForTable( m_tableNumber(), - m_primaryVariable(), - m_familyVariable(), - m_interpolatedVariable(), - m_flowingPhase(), - tableSelection() ); - - QString wellName; - - if ( m_vfpTable ) - { - wellName = m_vfpTable->name(); - } - else - { - QString filePath = m_filePath_OBSOLETE.v().path(); - if ( !filePath.isEmpty() ) - { - QFileInfo fi( filePath ); - QString wellName = fi.baseName(); - } - } - - QString plotTitle = - generatePlotTitle( wellName, m_tableNumber(), m_tableType(), m_interpolatedVariable(), m_primaryVariable(), m_familyVariable() ); - - return QString( "%1\n\n%2" ).arg( plotTitle ).arg( tableText ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::reattachAllCurves() -{ - for ( auto curve : m_plotCurves() ) - { - if ( curve->isChecked() ) - { - curve->setParentPlotNoReplot( m_plotWidget ); - } - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::detachAllCurves() -{ - for ( auto curve : m_plotCurves() ) - { - curve->detach(); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RimVfpPlot_deprecated::description() const -{ - return uiName(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* RimVfpPlot_deprecated::viewWidget() -{ - return m_plotWidget; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QImage RimVfpPlot_deprecated::snapshotWindowContent() -{ - QImage image; - - if ( m_plotWidget ) - { - QPixmap pix = m_plotWidget->grab(); - image = pix.toImage(); - } - - return image; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::zoomAll() -{ - setAutoScaleXEnabled( true ); - setAutoScaleYEnabled( true ); - - updatePlotWidgetFromAxisRanges(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::setDataIsImportedExternally( bool dataIsImportedExternally ) -{ - m_dataIsImportedExternally = dataIsImportedExternally; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -int RimVfpPlot_deprecated::tableNumber() const -{ - return m_tableNumber(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::onChildrenUpdated( caf::PdmChildArrayFieldHandle* childArray, std::vector& updatedObjects ) -{ - detachAllCurves(); - reattachAllCurves(); - - m_plotWidget->scheduleReplot(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RiuPlotWidget* RimVfpPlot_deprecated::doCreatePlotViewWidget( QWidget* mainWindowParent ) -{ - // It seems we risk being called multiple times - if ( m_plotWidget ) return m_plotWidget; - - auto qwtPlotWidget = new RiuQwtPlotWidget( this, mainWindowParent ); - auto qwtPlot = qwtPlotWidget->qwtPlot(); - new RiuQwtCurvePointTracker( qwtPlot, true, nullptr ); - - // LeftButton for the zooming - auto plotZoomer = new RiuQwtPlotZoomer( qwtPlot->canvas() ); - plotZoomer->setTrackerMode( QwtPicker::AlwaysOff ); - plotZoomer->initMousePattern( 1 ); - - // MidButton for the panning - auto panner = new QwtPlotPanner( qwtPlot->canvas() ); - panner->setMouseButton( Qt::MiddleButton ); - - auto wheelZoomer = new RiuQwtPlotWheelZoomer( qwtPlot ); - - // Use lambda functions to connect signals to functions instead of slots - connect( wheelZoomer, &RiuQwtPlotWheelZoomer::zoomUpdated, [=, this]() { onPlotZoomed(); } ); - connect( plotZoomer, &RiuQwtPlotZoomer::zoomed, [=, this]() { onPlotZoomed(); } ); - connect( panner, &QwtPlotPanner::panned, [=, this]() { onPlotZoomed(); } ); - connect( qwtPlotWidget, &RiuQwtPlotWidget::plotZoomed, [=, this]() { onPlotZoomed(); } ); - - // Remove event filter to disable unwanted highlighting on left click in plot. - qwtPlotWidget->removeEventFilter(); - - new RiuContextMenuLauncher( qwtPlotWidget, { "RicShowPlotDataFeature" } ); - - m_plotWidget = qwtPlotWidget; - - updateLegend(); - onLoadDataAndUpdate(); - - return m_plotWidget; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::deleteViewWidget() -{ - if ( m_plotWidget ) - { - m_plotWidget->setParent( nullptr ); - delete m_plotWidget; - m_plotWidget = nullptr; - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::onLoadDataAndUpdate() -{ - if ( isMdiWindow() ) - { - updateMdiWindowVisibility(); - } - else - { - updateParentLayout(); - } - - if ( !m_plotWidget ) - { - return; - } - - updateLegend(); - - QString wellName; - - if ( vfpTables() ) - { - wellName = vfpTableData()->baseFileName(); - - auto vfpPlotData = vfpTables()->populatePlotData( m_tableNumber(), - m_primaryVariable(), - m_familyVariable(), - m_interpolatedVariable(), - m_flowingPhase(), - tableSelection() ); - - populatePlotWidgetWithPlotData( m_plotWidget, vfpPlotData ); - } - - updatePlotTitle( - generatePlotTitle( wellName, m_tableNumber(), m_tableType(), m_interpolatedVariable(), m_primaryVariable(), m_familyVariable() ) ); - - m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultBottom(), true ); - m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultLeft(), true ); - - reattachAllCurves(); - - updatePlotWidgetFromAxisRanges(); - - m_plotWidget->scheduleReplot(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::populatePlotWidgetWithPlotData( RiuPlotWidget* plotWidget, const VfpPlotData& plotData ) -{ - plotWidget->setAxisScale( RiuPlotAxis::defaultBottom(), 0, 1 ); - plotWidget->setAxisScale( RiuPlotAxis::defaultLeft(), 0, 1 ); - plotWidget->setAxisAutoScale( RiuPlotAxis::defaultBottom(), true ); - plotWidget->setAxisAutoScale( RiuPlotAxis::defaultLeft(), true ); - plotWidget->setAxisTitleText( RiuPlotAxis::defaultBottom(), plotData.xAxisTitle() ); - plotWidget->setAxisTitleText( RiuPlotAxis::defaultLeft(), plotData.yAxisTitle() ); - - if ( m_plotCurves.size() != plotData.size() ) - { - detachAllCurves(); - m_plotCurves.deleteChildren(); - - for ( auto idx = 0u; idx < plotData.size(); idx++ ) - { - QColor qtClr = RiaColorTables::summaryCurveDefaultPaletteColors().cycledQColor( idx ); - - auto curve = new RimPlotCurve(); - - curve->setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID ); - curve->setLineThickness( 2 ); - curve->setColor( RiaColorTools::fromQColorTo3f( qtClr ) ); - curve->setSymbol( RiuPlotCurveSymbol::SYMBOL_ELLIPSE ); - curve->setSymbolSize( 6 ); - - m_plotCurves.push_back( curve ); - } - - updateConnectedEditors(); - } - - auto plotCurves = m_plotCurves.childrenByType(); - - for ( auto idx = 0u; idx < plotData.size(); idx++ ) - { - auto curve = plotCurves[idx]; - if ( !curve ) continue; - - curve->setCustomName( plotData.curveTitle( idx ) ); - curve->setParentPlotNoReplot( plotWidget ); - if ( curve->plotCurve() ) - { - bool useLogarithmicScale = false; - curve->plotCurve()->setSamplesFromXValuesAndYValues( plotData.xData( idx ), plotData.yData( idx ), useLogarithmicScale ); - } - curve->updateCurveAppearance(); - curve->appearanceChanged.connect( this, &RimVfpPlot_deprecated::curveAppearanceChanged ); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RimVfpPlot_deprecated::axisTitle( RimVfpDefines::ProductionVariableType variableType, RimVfpDefines::FlowingPhaseType flowingPhase ) -{ - QString title; - - if ( flowingPhase == RimVfpDefines::FlowingPhaseType::GAS ) - { - title = "Gas "; - } - else - { - title = "Liquid "; - } - title += QString( "%1 %2" ).arg( caf::AppEnum::uiText( variableType ), - getDisplayUnitWithBracket( variableType ) ); - - return title; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::connectAxisSignals( RimPlotAxisProperties* axis ) -{ - axis->settingsChanged.connect( this, &RimVfpPlot_deprecated::axisSettingsChanged ); - axis->logarithmicChanged.connect( this, &RimVfpPlot_deprecated::axisLogarithmicChanged ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::axisSettingsChanged( const caf::SignalEmitter* emitter ) -{ - updateAxes(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::axisLogarithmicChanged( const caf::SignalEmitter* emitter, bool isLogarithmic ) -{ - // Currently not supported -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::updatePlotWidgetFromAxisRanges() -{ - if ( m_plotWidget ) - { - updateAxes(); - - if ( auto qwtWidget = dynamic_cast( m_plotWidget.data() ) ) - { - if ( qwtWidget->qwtPlot() ) qwtWidget->qwtPlot()->updateAxes(); - } - - updateAxisRangesFromPlotWidget(); - m_plotWidget->scheduleReplot(); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::updateAxisRangesFromPlotWidget() -{ - RimPlotAxisTools::updateVisibleRangesFromPlotWidget( m_xAxisProperties(), RiuPlotAxis::defaultBottom(), m_plotWidget ); - RimPlotAxisTools::updateVisibleRangesFromPlotWidget( m_yAxisProperties(), RiuPlotAxis::defaultLeft(), m_plotWidget ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::onPlotZoomed() -{ - setAutoScaleXEnabled( false ); - setAutoScaleYEnabled( false ); - updateAxisRangesFromPlotWidget(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::curveAppearanceChanged( const caf::SignalEmitter* emitter ) -{ - scheduleReplot(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::initializeFromInitData( const VfpTableInitialData& table ) -{ - m_tableType = table.isProductionTable ? RimVfpDefines::TableType::PRODUCTION : RimVfpDefines::TableType::INJECTION; - m_tableNumber = table.tableNumber; - m_referenceDepth = table.datumDepth; - m_flowingPhase = table.flowingPhase; - m_flowingGasFraction = table.gasFraction; - m_flowingWaterFraction = table.waterFraction; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimVfpTableData* RimVfpPlot_deprecated::vfpTableData() const -{ - if ( m_vfpTable ) return m_vfpTable->dataSource(); - - return nullptr; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -const RigVfpTables* RimVfpPlot_deprecated::vfpTables() const -{ - if ( vfpTableData() ) - { - vfpTableData()->ensureDataIsImported(); - return vfpTableData()->vfpTables(); - } - - return nullptr; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -double RimVfpPlot_deprecated::convertToDisplayUnit( double value, RimVfpDefines::ProductionVariableType variableType ) -{ - if ( variableType == RimVfpDefines::ProductionVariableType::THP ) - { - return RiaEclipseUnitTools::pascalToBar( value ); - } - - if ( variableType == RimVfpDefines::ProductionVariableType::FLOW_RATE ) - { - // Convert to m3/sec to m3/day - return value * static_cast( 24 * 60 * 60 ); - } - - return value; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::convertToDisplayUnit( std::vector& values, RimVfpDefines::ProductionVariableType variableType ) -{ - for ( double& value : values ) - value = convertToDisplayUnit( value, variableType ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RimVfpPlot_deprecated::getDisplayUnitWithBracket( RimVfpDefines::ProductionVariableType variableType ) -{ - QString unit = getDisplayUnit( variableType ); - if ( !unit.isEmpty() ) return QString( "[%1]" ).arg( unit ); - - return {}; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RimVfpPlot_deprecated::getDisplayUnit( RimVfpDefines::ProductionVariableType variableType ) - -{ - if ( variableType == RimVfpDefines::ProductionVariableType::THP ) return "Bar"; - - if ( variableType == RimVfpDefines::ProductionVariableType::FLOW_RATE ) return "Sm3/day"; - - return ""; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) -{ - uiOrdering.add( &m_vfpTable ); - - uiOrdering.add( &m_tableType ); - uiOrdering.add( &m_tableNumber ); - uiOrdering.add( &m_referenceDepth ); - uiOrdering.add( &m_interpolatedVariable ); - uiOrdering.add( &m_flowingPhase ); - - if ( m_tableType == RimVfpDefines::TableType::PRODUCTION ) - { - uiOrdering.add( &m_flowingWaterFraction ); - uiOrdering.add( &m_flowingGasFraction ); - - uiOrdering.add( &m_primaryVariable ); - uiOrdering.add( &m_familyVariable ); - - caf::PdmUiOrdering* fixedVariablesGroup = uiOrdering.addNewGroup( "Fixed Variables" ); - fixedVariablesGroup->add( &m_flowRateIdx ); - fixedVariablesGroup->add( &m_thpIdx ); - fixedVariablesGroup->add( &m_articifialLiftQuantityIdx ); - fixedVariablesGroup->add( &m_waterCutIdx ); - fixedVariablesGroup->add( &m_gasLiquidRatioIdx ); - - // Disable the choices for variables as primary or family - setFixedVariableUiEditability( m_flowRateIdx, RimVfpDefines::ProductionVariableType::FLOW_RATE ); - setFixedVariableUiEditability( m_thpIdx, RimVfpDefines::ProductionVariableType::THP ); - setFixedVariableUiEditability( m_articifialLiftQuantityIdx, RimVfpDefines::ProductionVariableType::ARTIFICIAL_LIFT_QUANTITY ); - setFixedVariableUiEditability( m_waterCutIdx, RimVfpDefines::ProductionVariableType::WATER_CUT ); - setFixedVariableUiEditability( m_gasLiquidRatioIdx, RimVfpDefines::ProductionVariableType::GAS_LIQUID_RATIO ); - } - - uiOrdering.skipRemainingFields( true ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::setFixedVariableUiEditability( caf::PdmField& field, RimVfpDefines::ProductionVariableType variableType ) -{ - field.uiCapability()->setUiReadOnly( variableType == m_primaryVariable.v() || variableType == m_familyVariable.v() ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QList RimVfpPlot_deprecated::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) -{ - QList options = RimPlot::calculateValueOptions( fieldNeedingOptions ); - - if ( fieldNeedingOptions == &m_flowRateIdx ) - { - calculateTableValueOptions( RimVfpDefines::ProductionVariableType::FLOW_RATE, options ); - } - - else if ( fieldNeedingOptions == &m_thpIdx ) - { - calculateTableValueOptions( RimVfpDefines::ProductionVariableType::THP, options ); - } - - else if ( fieldNeedingOptions == &m_articifialLiftQuantityIdx ) - { - calculateTableValueOptions( RimVfpDefines::ProductionVariableType::ARTIFICIAL_LIFT_QUANTITY, options ); - } - - else if ( fieldNeedingOptions == &m_waterCutIdx ) - { - calculateTableValueOptions( RimVfpDefines::ProductionVariableType::WATER_CUT, options ); - } - - else if ( fieldNeedingOptions == &m_gasLiquidRatioIdx ) - { - calculateTableValueOptions( RimVfpDefines::ProductionVariableType::GAS_LIQUID_RATIO, options ); - } - - else if ( fieldNeedingOptions == &m_vfpTable ) - { - RimVfpDataCollection* vfpDataCollection = RimVfpDataCollection::instance(); - for ( auto table : vfpDataCollection->vfpTableData() ) - { - options.push_back( caf::PdmOptionItemInfo( table->name(), table ) ); - } - } - - return options; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::calculateTableValueOptions( RimVfpDefines::ProductionVariableType variableType, - QList& options ) -{ - if ( vfpTables() ) - { - auto values = vfpTables()->getProductionTableData( m_tableNumber(), variableType ); - - for ( size_t i = 0; i < values.size(); i++ ) - { - options.push_back( - caf::PdmOptionItemInfo( QString( "%1 %2" ).arg( convertToDisplayUnit( values[i], variableType ) ).arg( getDisplayUnit( variableType ) ), - static_cast( i ) ) ); - } - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) -{ - RimPlot::fieldChangedByUi( changedField, oldValue, newValue ); - - if ( changedField == &m_vfpTable ) - { - initializeObject(); - } - - loadDataAndUpdate(); - updateLayout(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::initAfterRead() -{ - auto filePath = m_filePath_OBSOLETE.v().path(); - if ( filePath.isEmpty() ) return; - - auto vfpDataCollection = RimVfpDataCollection::instance(); - if ( vfpDataCollection ) - { - auto tableData = vfpDataCollection->appendTableDataObject( filePath ); - if ( tableData ) - { - setDataSource( tableData ); - } - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::updatePlotTitle( const QString& plotTitle ) -{ - m_plotTitle = plotTitle; - - updateMdiWindowTitle(); - - if ( m_plotWidget ) - { - m_plotWidget->setPlotTitle( plotTitle ); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RimVfpPlot_deprecated::generatePlotTitle( const QString& wellName, - int tableNumber, - RimVfpDefines::TableType tableType, - RimVfpDefines::InterpolatedVariableType interpolatedVariable, - RimVfpDefines::ProductionVariableType primaryVariable, - RimVfpDefines::ProductionVariableType familyVariable ) -{ - QString tableTypeText = caf::AppEnum::uiText( tableType ); - QString interpolatedVariableText = caf::AppEnum::uiText( interpolatedVariable ); - QString primaryVariableText = caf::AppEnum::uiText( primaryVariable ); - QString plotTitleStr = - QString( "VFP: %1 (%2) #%3 - %4 x %5" ).arg( wellName ).arg( tableTypeText ).arg( tableNumber ).arg( interpolatedVariableText ).arg( primaryVariableText ); - - return plotTitleStr; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -caf::PdmFieldHandle* RimVfpPlot_deprecated::userDescriptionField() -{ - return &m_plotTitle; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot_deprecated::scheduleReplot() -{ - if ( m_plotWidget ) - { - m_plotWidget->scheduleReplot(); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -VfpTableSelection RimVfpPlot_deprecated::tableSelection() const -{ - return { m_flowRateIdx(), m_thpIdx(), m_articifialLiftQuantityIdx(), m_waterCutIdx(), m_gasLiquidRatioIdx() }; -} diff --git a/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/RimVfpPlot_deprecated.h b/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/RimVfpPlot_deprecated.h deleted file mode 100644 index 5f3a4f513e..0000000000 --- a/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/RimVfpPlot_deprecated.h +++ /dev/null @@ -1,169 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// 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 "RimPlot.h" -#include "RimVfpDefines.h" - -#include "cafFilePath.h" -#include "cafPdmPtrField.h" - -#include - -class RiuPlotWidget; -class VfpPlotData; -class RimPlotAxisProperties; -class RigVfpTables; -class RimVfpTable; -class RimVfpTableData; - -struct VfpTableSelection; -struct VfpTableInitialData; - -namespace Opm -{ -class VFPInjTable; -class VFPProdTable; -} // namespace Opm - -//-------------------------------------------------------------------------------------------------- -/// DEPRECATED: Vertical Flow Performance Plot -/// This class is deprecated and will be removed in a future release. -/// Use RimCustomVfpPlot instead. -//-------------------------------------------------------------------------------------------------- -class RimVfpPlot_deprecated : public RimPlot -{ - CAF_PDM_HEADER_INIT; - -public: - RimVfpPlot_deprecated(); - ~RimVfpPlot_deprecated() override; - -private: - void setDataSource( RimVfpTable* vfpTableData ); - void setTableNumber( int tableNumber ); - void initializeObject(); - - // RimPlot implementations - RiuPlotWidget* plotWidget() override; - bool isCurveHighlightSupported() const override; - - void setAutoScaleXEnabled( bool enabled ) override; - void setAutoScaleYEnabled( bool enabled ) override; - void updateAxes() override; - void updateLegend() override; - QString asciiDataForPlotExport() const override; - void reattachAllCurves() override; - void detachAllCurves() override; - - // RimPlotWindow implementations - QString description() const override; - - // RimViewWindow implementations - QWidget* viewWidget() override; - QImage snapshotWindowContent() override; - void zoomAll() override; - - void setDataIsImportedExternally( bool dataIsImportedExternally ); - int tableNumber() const; - -private: - void onChildrenUpdated( caf::PdmChildArrayFieldHandle* childArray, std::vector& updatedObjects ) override; - void deleteViewWidget() override; - void onLoadDataAndUpdate() override; - - caf::PdmFieldHandle* userDescriptionField() override; - - void scheduleReplot(); - -private: - void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - void initAfterRead() override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; - - VfpTableSelection tableSelection() const; - void initializeFromInitData( const VfpTableInitialData& table ); - - RimVfpTableData* vfpTableData() const; - const RigVfpTables* vfpTables() const; - - RiuPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent ) override; - - void calculateTableValueOptions( RimVfpDefines::ProductionVariableType variableType, QList& options ); - - void setFixedVariableUiEditability( caf::PdmField& field, RimVfpDefines::ProductionVariableType variableType ); - - void updatePlotTitle( const QString& plotTitle ); - static QString generatePlotTitle( const QString& wellName, - int tableNumber, - RimVfpDefines::TableType tableType, - RimVfpDefines::InterpolatedVariableType interpolatedVariable, - RimVfpDefines::ProductionVariableType primaryVariable, - RimVfpDefines::ProductionVariableType familyVariable ); - - static double convertToDisplayUnit( double value, RimVfpDefines::ProductionVariableType variableType ); - static void convertToDisplayUnit( std::vector& values, RimVfpDefines::ProductionVariableType variableType ); - static QString getDisplayUnit( RimVfpDefines::ProductionVariableType variableType ); - static QString getDisplayUnitWithBracket( RimVfpDefines::ProductionVariableType variableType ); - - void populatePlotWidgetWithPlotData( RiuPlotWidget* plotWidget, const VfpPlotData& plotData ); - - static QString axisTitle( RimVfpDefines::ProductionVariableType variableType, RimVfpDefines::FlowingPhaseType flowingPhase ); - - void connectAxisSignals( RimPlotAxisProperties* axis ); - void axisSettingsChanged( const caf::SignalEmitter* emitter ); - void axisLogarithmicChanged( const caf::SignalEmitter* emitter, bool isLogarithmic ); - void updatePlotWidgetFromAxisRanges() override; - void updateAxisRangesFromPlotWidget() override; - - void onPlotZoomed(); - void curveAppearanceChanged( const caf::SignalEmitter* emitter ); - -private: - caf::PdmField m_plotTitle; - caf::PdmPtrField m_vfpTable; - caf::PdmField m_tableNumber; - caf::PdmField m_referenceDepth; - caf::PdmField> m_flowingPhase; - caf::PdmField> m_flowingWaterFraction; - caf::PdmField> m_flowingGasFraction; - - caf::PdmField> m_tableType; - caf::PdmField> m_interpolatedVariable; - caf::PdmField> m_primaryVariable; - caf::PdmField> m_familyVariable; - - caf::PdmField m_flowRateIdx; - caf::PdmField m_thpIdx; - caf::PdmField m_articifialLiftQuantityIdx; - caf::PdmField m_waterCutIdx; - caf::PdmField m_gasLiquidRatioIdx; - - caf::PdmChildField m_yAxisProperties; - caf::PdmChildField m_xAxisProperties; - - caf::PdmChildArrayField m_plotCurves; - - QPointer m_plotWidget; - - caf::PdmField m_filePath_OBSOLETE; - - bool m_dataIsImportedExternally; -}; From 275526a64a590d89165cb042d24a095323bcd668 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 4 Nov 2024 08:53:03 +0100 Subject: [PATCH 091/160] Remove unused includes Remove unused includes, mostly AppEnum.h --- .../Application/RiaEclipseFileNameTools.cpp | 4 +++- .../Application/RiaEclipseFileNameTools.h | 2 -- .../Application/RiaPreferencesGeoMech.h | 1 - .../Application/Tools/RiaEclipseUnitTools.h | 1 - .../Application/Tools/RiaQDateTimeTools.h | 2 -- .../RicfCreateLgrForCompletions.h | 1 - .../RicfExportLgrForCompletions.h | 1 - .../RicfExportSimWellFractureCompletions.h | 1 - .../RicfExportWellPathCompletions.h | 1 - .../CommandFileInterface/RicfExportWellPaths.h | 1 - .../FileInterface/RifStimPlanXmlReader.cpp | 2 ++ .../Annotations/RimAnnotationInViewCollection.h | 3 --- .../Annotations/RimPolylineTarget.h | 1 - .../Annotations/RimReachCircleAnnotation.h | 3 --- .../Annotations/RimReachCircleAnnotationInView.h | 3 --- .../Annotations/RimTextAnnotation.h | 3 --- .../Annotations/RimTextAnnotationInView.h | 13 ------------- .../CellFilters/RimUserDefinedFilter.h | 1 - .../CellFilters/RimUserDefinedIndexFilter.h | 1 - .../Completions/Rim3dWellLogCurveCollection.h | 1 - .../Completions/RimEllipseFractureTemplate.h | 1 - .../Completions/RimMultipleValveLocations.h | 1 - .../Completions/RimStimPlanFractureTemplate.h | 4 ---- .../ProjectDataModel/Completions/RimWellPathValve.h | 1 - .../CorrelationPlots/RimCorrelationPlot.h | 1 - .../ProjectDataModel/GeoMech/RimGeoMechView.h | 1 - .../ProjectDataModel/Rim3dOverlayInfoConfig.h | 3 --- .../ProjectDataModel/RimEclipseFaultColors.h | 1 - .../ProjectDataModel/RimEclipseStatisticsCase.h | 2 -- .../RimEnsembleFractureStatisticsPlot.h | 3 --- ApplicationLibCode/ProjectDataModel/RimMultiPlot.h | 1 - .../ProjectDataModel/RimPlotAxisProperties.h | 1 - .../RimPlotAxisPropertiesInterface.h | 2 -- .../RimReservoirCellResultsStorage.h | 2 -- .../ProjectDataModel/RimSimWellInView.h | 2 -- .../ProjectDataModel/RimSimWellInViewCollection.h | 1 - .../ProjectDataModel/RimStimPlanColors.h | 1 - .../ProjectDataModel/RimStimPlanLegendConfig.h | 1 - .../ProjectDataModel/RimTernaryLegendConfig.h | 2 -- .../ProjectDataModel/RimTimeAxisAnnotation.h | 2 -- .../ProjectDataModel/RimWellBoreStabilityPlot.h | 2 -- .../ProjectDataModel/Summary/RimAsciiDataCurve.h | 4 ---- .../ProjectDataModel/Summary/RimSummaryAddress.h | 3 --- .../ProjectDataModel/Summary/RimSummaryCurve.h | 1 - .../ProjectDataModel/WellLog/Rim3dWellLogCurve.h | 1 - .../WellLog/RimEnsembleWellLogCurveSet.h | 3 --- .../ProjectDataModel/WellLog/RimWellLogRftCurve.h | 2 -- .../ProjectDataModel/WellPath/RimWellPath.h | 1 - .../WellPath/RimWellPathAttributeCollection.h | 4 +--- .../WellPath/RimWellPathGeometryDef.h | 2 -- .../ProjectDataModel/WellPath/RimWellPathTarget.h | 1 - .../RigStimPlanFractureDefinition.cpp | 2 ++ .../Well/RigGeoMechWellLogExtractor.h | 2 -- Fwk/AppFwk/cafCommand/cafCmdSelectionChangeExec.h | 1 - .../cafTests/cafTestApplication/TamComboBox.h | 1 - 55 files changed, 8 insertions(+), 101 deletions(-) diff --git a/ApplicationLibCode/Application/RiaEclipseFileNameTools.cpp b/ApplicationLibCode/Application/RiaEclipseFileNameTools.cpp index fb1bc9f62a..37d3945c6c 100644 --- a/ApplicationLibCode/Application/RiaEclipseFileNameTools.cpp +++ b/ApplicationLibCode/Application/RiaEclipseFileNameTools.cpp @@ -18,7 +18,9 @@ #include "RiaEclipseFileNameTools.h" -#include "QFileInfo" +#include "cafAppEnum.h" + +#include namespace caf { diff --git a/ApplicationLibCode/Application/RiaEclipseFileNameTools.h b/ApplicationLibCode/Application/RiaEclipseFileNameTools.h index a7064ff5d6..855baceb1a 100644 --- a/ApplicationLibCode/Application/RiaEclipseFileNameTools.h +++ b/ApplicationLibCode/Application/RiaEclipseFileNameTools.h @@ -18,8 +18,6 @@ #pragma once -#include "cafAppEnum.h" - #include #include diff --git a/ApplicationLibCode/Application/RiaPreferencesGeoMech.h b/ApplicationLibCode/Application/RiaPreferencesGeoMech.h index b3f30bfc71..e28e5632cb 100644 --- a/ApplicationLibCode/Application/RiaPreferencesGeoMech.h +++ b/ApplicationLibCode/Application/RiaPreferencesGeoMech.h @@ -18,7 +18,6 @@ #pragma once -#include "cafAppEnum.h" #include "cafPdmField.h" #include "cafPdmObject.h" diff --git a/ApplicationLibCode/Application/Tools/RiaEclipseUnitTools.h b/ApplicationLibCode/Application/Tools/RiaEclipseUnitTools.h index ab17656f09..85b8414f7b 100644 --- a/ApplicationLibCode/Application/Tools/RiaEclipseUnitTools.h +++ b/ApplicationLibCode/Application/Tools/RiaEclipseUnitTools.h @@ -19,7 +19,6 @@ #pragma once #include "RiaDefines.h" -#include "cafAppEnum.h" class RiaEclipseUnitTools { diff --git a/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.h b/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.h index 9f8647f462..4423284f98 100644 --- a/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.h +++ b/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.h @@ -20,8 +20,6 @@ #include "RiaDateTimeDefines.h" -#include "cafAppEnum.h" - #include #include diff --git a/ApplicationLibCode/CommandFileInterface/RicfCreateLgrForCompletions.h b/ApplicationLibCode/CommandFileInterface/RicfCreateLgrForCompletions.h index c139c6fd6e..9661f8814e 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfCreateLgrForCompletions.h +++ b/ApplicationLibCode/CommandFileInterface/RicfCreateLgrForCompletions.h @@ -22,7 +22,6 @@ #include "ExportCommands/RicLgrSplitType.h" -#include "cafAppEnum.h" #include "cafPdmField.h" class RimWellPath; diff --git a/ApplicationLibCode/CommandFileInterface/RicfExportLgrForCompletions.h b/ApplicationLibCode/CommandFileInterface/RicfExportLgrForCompletions.h index 4da67fa219..ab7506cb85 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfExportLgrForCompletions.h +++ b/ApplicationLibCode/CommandFileInterface/RicfExportLgrForCompletions.h @@ -22,7 +22,6 @@ #include "ExportCommands/RicLgrSplitType.h" -#include "cafAppEnum.h" #include "cafPdmField.h" class RimWellPath; diff --git a/ApplicationLibCode/CommandFileInterface/RicfExportSimWellFractureCompletions.h b/ApplicationLibCode/CommandFileInterface/RicfExportSimWellFractureCompletions.h index c99697f2c5..086b8c1312 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfExportSimWellFractureCompletions.h +++ b/ApplicationLibCode/CommandFileInterface/RicfExportSimWellFractureCompletions.h @@ -22,7 +22,6 @@ #include "CompletionExportCommands/RicExportCompletionDataSettingsUi.h" -#include "cafAppEnum.h" #include "cafPdmField.h" //================================================================================================== diff --git a/ApplicationLibCode/CommandFileInterface/RicfExportWellPathCompletions.h b/ApplicationLibCode/CommandFileInterface/RicfExportWellPathCompletions.h index 4ae02775de..c84c83c42c 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfExportWellPathCompletions.h +++ b/ApplicationLibCode/CommandFileInterface/RicfExportWellPathCompletions.h @@ -22,7 +22,6 @@ #include "CompletionExportCommands/RicExportCompletionDataSettingsUi.h" -#include "cafAppEnum.h" #include "cafPdmField.h" //================================================================================================== diff --git a/ApplicationLibCode/CommandFileInterface/RicfExportWellPaths.h b/ApplicationLibCode/CommandFileInterface/RicfExportWellPaths.h index bf6caf3928..b0aefa9bd3 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfExportWellPaths.h +++ b/ApplicationLibCode/CommandFileInterface/RicfExportWellPaths.h @@ -20,7 +20,6 @@ #include "RicfCommandObject.h" -#include "cafAppEnum.h" #include "cafPdmField.h" class RimWellPath; diff --git a/ApplicationLibCode/FileInterface/RifStimPlanXmlReader.cpp b/ApplicationLibCode/FileInterface/RifStimPlanXmlReader.cpp index d59da8e52e..b3acdda7ba 100644 --- a/ApplicationLibCode/FileInterface/RifStimPlanXmlReader.cpp +++ b/ApplicationLibCode/FileInterface/RifStimPlanXmlReader.cpp @@ -26,6 +26,8 @@ #include "RigStimPlanFractureDefinition.h" +#include "cafAppEnum.h" + #include #include #include diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationInViewCollection.h b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationInViewCollection.h index a138676114..4b20c4bfff 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationInViewCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationInViewCollection.h @@ -21,13 +21,10 @@ #include "RiaFontCache.h" #include "RimAnnotationCollectionBase.h" -#include "cafAppEnum.h" #include "cafPdmChildArrayField.h" #include "cafPdmChildField.h" #include "cafPdmField.h" #include "cafPdmObject.h" -#include "cafPdmPointer.h" -#include "cafTristate.h" class RimAnnotationCollection; class RimAnnotationGroupCollection; diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylineTarget.h b/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylineTarget.h index 799c983b58..5a702e6453 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylineTarget.h +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylineTarget.h @@ -20,7 +20,6 @@ #include "RiaLineArcWellPathCalculator.h" -#include "cafAppEnum.h" #include "cafPdmCoreVec3d.h" #include "cafPdmField.h" #include "cafPdmObject.h" diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimReachCircleAnnotation.h b/ApplicationLibCode/ProjectDataModel/Annotations/RimReachCircleAnnotation.h index d08ec594db..b931919dd0 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimReachCircleAnnotation.h +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimReachCircleAnnotation.h @@ -18,8 +18,6 @@ #pragma once -#include "cafAppEnum.h" -#include "cafPdmChildArrayField.h" #include "cafPdmField.h" #include "cafPdmObject.h" #include "cafPdmPointer.h" @@ -28,7 +26,6 @@ #include "cafPdmChildField.h" #include "cafPdmFieldCvfColor.h" #include "cafPdmFieldCvfVec3d.h" -#include "cafPdmObject.h" #include "cvfObject.h" #include "cvfVector3.h" diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimReachCircleAnnotationInView.h b/ApplicationLibCode/ProjectDataModel/Annotations/RimReachCircleAnnotationInView.h index 1988f7b81c..5167a1107a 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimReachCircleAnnotationInView.h +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimReachCircleAnnotationInView.h @@ -20,11 +20,8 @@ #include "RimAnnotationLineAppearance.h" -#include "cafAppEnum.h" -#include "cafPdmChildArrayField.h" #include "cafPdmField.h" #include "cafPdmObject.h" -#include "cafPdmPointer.h" #include "cafPdmPtrField.h" // Include to make Pdm work for cvf::Color diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimTextAnnotation.h b/ApplicationLibCode/ProjectDataModel/Annotations/RimTextAnnotation.h index dc457a1b1b..4c79a46746 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimTextAnnotation.h +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimTextAnnotation.h @@ -18,11 +18,8 @@ #pragma once -#include "cafAppEnum.h" -#include "cafPdmChildArrayField.h" #include "cafPdmField.h" #include "cafPdmObject.h" -#include "cafPdmPointer.h" // Include to make Pdm work for cvf::Color #include "cafPdmChildField.h" diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimTextAnnotationInView.h b/ApplicationLibCode/ProjectDataModel/Annotations/RimTextAnnotationInView.h index 0d3548a269..06e5c3e293 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimTextAnnotationInView.h +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimTextAnnotationInView.h @@ -18,23 +18,10 @@ #pragma once -#include "cafAppEnum.h" -#include "cafPdmChildArrayField.h" #include "cafPdmField.h" #include "cafPdmObject.h" -#include "cafPdmPointer.h" #include "cafPdmPtrField.h" -// Include to make Pdm work for cvf::Color -#include "cafPdmChildField.h" -#include "cafPdmFieldCvfColor.h" -#include "cafPdmFieldCvfVec3d.h" - -#include "cvfObject.h" -#include "cvfVector3.h" - -#include - class RimTextAnnotation; //================================================================================================== diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimUserDefinedFilter.h b/ApplicationLibCode/ProjectDataModel/CellFilters/RimUserDefinedFilter.h index 4747de5009..ae326ceb15 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimUserDefinedFilter.h +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimUserDefinedFilter.h @@ -20,7 +20,6 @@ #include "RimCellFilter.h" -#include "cafAppEnum.h" #include "cafPdmField.h" #include "cafPdmFieldCvfVec3d.h" #include "cafPdmObject.h" diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimUserDefinedIndexFilter.h b/ApplicationLibCode/ProjectDataModel/CellFilters/RimUserDefinedIndexFilter.h index fc721c70df..27112b31b2 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimUserDefinedIndexFilter.h +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimUserDefinedIndexFilter.h @@ -20,7 +20,6 @@ #include "RimCellFilter.h" -#include "cafAppEnum.h" #include "cafPdmField.h" #include "cafPdmObject.h" diff --git a/ApplicationLibCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.h b/ApplicationLibCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.h index 16190587aa..9c9b8b59a9 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.h @@ -18,7 +18,6 @@ #pragma once -#include "cafAppEnum.h" #include "cafPdmChildArrayField.h" #include "cafPdmField.h" #include "cafPdmObject.h" diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimEllipseFractureTemplate.h b/ApplicationLibCode/ProjectDataModel/Completions/RimEllipseFractureTemplate.h index d407ff0b7c..5c0cf99424 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimEllipseFractureTemplate.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimEllipseFractureTemplate.h @@ -20,7 +20,6 @@ #include "RimFractureTemplate.h" -#include "cafAppEnum.h" #include "cafPdmField.h" #include "cafPdmFieldCvfVec3d.h" #include "cafPdmFieldHandle.h" diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimMultipleValveLocations.h b/ApplicationLibCode/ProjectDataModel/Completions/RimMultipleValveLocations.h index eba216e0dc..c91ec00225 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimMultipleValveLocations.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimMultipleValveLocations.h @@ -19,7 +19,6 @@ #pragma once #include "cafAppEnum.h" -#include "cafPdmBase.h" #include "cafPdmField.h" #include "cafPdmObject.h" diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h b/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h index e38e7643e9..220b930281 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h @@ -19,13 +19,9 @@ #include "RimMeshFractureTemplate.h" -#include "cafAppEnum.h" -#include "cafPdmChildArrayField.h" #include "cafPdmField.h" -#include "cafPdmFieldCvfVec3d.h" #include "cafPdmFieldHandle.h" #include "cafPdmObject.h" -#include "cafPdmPtrField.h" #include "cvfObject.h" #include "cvfVector3.h" diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathValve.h b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathValve.h index a4b53008e7..6ab7278327 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathValve.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathValve.h @@ -26,7 +26,6 @@ #include "cafPdmObject.h" -#include "cafAppEnum.h" #include "cafPdmChildField.h" #include "cafPdmField.h" #include "cafPdmPtrField.h" diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.h b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.h index cb585c95af..b7442024a4 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.h +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.h @@ -22,7 +22,6 @@ #include "RimAbstractCorrelationPlot.h" -#include "cafAppEnum.h" #include "cafPdmFieldCvfColor.h" #include diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.h b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.h index 8672a055b9..edbe419717 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.h +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.h @@ -21,7 +21,6 @@ #include "RimGridView.h" -#include "cafAppEnum.h" #include "cafPdmChildField.h" #include "cafPdmField.h" #include "cafPdmFieldCvfColor.h" diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.h b/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.h index 81a47d0eee..d67fc84bf8 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.h +++ b/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.h @@ -27,9 +27,6 @@ #include "cafPdmObject.h" #include "cafPdmPointer.h" -#include "cvfAssert.h" -#include "cvfObject.h" - #include "cvfVector2.h" #include diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseFaultColors.h b/ApplicationLibCode/ProjectDataModel/RimEclipseFaultColors.h index b9d29dab3b..d0ed33a80e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseFaultColors.h +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseFaultColors.h @@ -19,7 +19,6 @@ #pragma once -#include "cafAppEnum.h" #include "cafPdmChildField.h" #include "cafPdmField.h" #include "cafPdmObject.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.h b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.h index 9af7e47b12..f7c2fa04a3 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.h +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.h @@ -27,8 +27,6 @@ #include "cafAppEnum.h" #include "cafPdmField.h" #include "cafPdmObject.h" -#include "cvfCollection.h" -#include "cvfObject.h" class RigMainGrid; class RigSimWellData; diff --git a/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlot.h b/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlot.h index 6d490f4f16..b44c533157 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlot.h @@ -18,11 +18,8 @@ #pragma once -#include "RiaDefines.h" - #include "RigEnsembleFractureStatisticsCalculator.h" -#include "RimEnsembleFractureStatistics.h" #include "RimStatisticsPlot.h" #include "cafAppEnum.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h index eb7cdee818..68868a6df9 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h @@ -21,7 +21,6 @@ #include "RiaDefines.h" #include "RimAbstractPlotCollection.h" -#include "RimPlot.h" #include "RimPlotAxisPropertiesInterface.h" #include "RimPlotWindow.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h index 21ab776fc0..d5b8c6f6bf 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h @@ -19,7 +19,6 @@ #pragma once -#include "RiaDefines.h" #include "RimPlotAxisPropertiesInterface.h" #include "RiuPlotAxis.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h index e752348826..f180411bd0 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h @@ -18,8 +18,6 @@ #pragma once -#include "RiaPlotDefines.h" - #include "RiuPlotAxis.h" #include "cafAppEnum.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimReservoirCellResultsStorage.h b/ApplicationLibCode/ProjectDataModel/RimReservoirCellResultsStorage.h index 8643a08212..464ceb8348 100644 --- a/ApplicationLibCode/ProjectDataModel/RimReservoirCellResultsStorage.h +++ b/ApplicationLibCode/ProjectDataModel/RimReservoirCellResultsStorage.h @@ -26,8 +26,6 @@ #include "cafPdmField.h" #include "cafPdmObject.h" -#include "cvfObject.h" - #include class RimReservoirCellResultsStorageEntryInfo; diff --git a/ApplicationLibCode/ProjectDataModel/RimSimWellInView.h b/ApplicationLibCode/ProjectDataModel/RimSimWellInView.h index f8ad32b358..3b4db2d480 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSimWellInView.h +++ b/ApplicationLibCode/ProjectDataModel/RimSimWellInView.h @@ -25,11 +25,9 @@ #include "Well/RigWellDiskData.h" #include "Well/RigWellResultBranch.h" -#include "cafAppEnum.h" #include "cafPdmChildField.h" #include "cafPdmField.h" #include "cafPdmObject.h" -#include "cafPdmPointer.h" // Include to make Pdm work for cvf::Color #include "cafPdmFieldCvfColor.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.h b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.h index 2fa2a50b56..9d3feb7e2e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.h +++ b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.h @@ -25,7 +25,6 @@ #include "cafPdmField.h" #include "cafPdmFieldCvfColor.h" // Include to make Pdm work for cvf::Color #include "cafPdmObject.h" -#include "cafPdmPointer.h" #include "cafPdmPtrField.h" #include "cafTristate.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimStimPlanColors.h b/ApplicationLibCode/ProjectDataModel/RimStimPlanColors.h index fec85b9d29..f692685330 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStimPlanColors.h +++ b/ApplicationLibCode/ProjectDataModel/RimStimPlanColors.h @@ -22,7 +22,6 @@ #include "cafAppEnum.h" #include "cafPdmChildArrayField.h" -#include "cafPdmChildField.h" #include "cafPdmField.h" // Include to make Pdm work for cvf::Color diff --git a/ApplicationLibCode/ProjectDataModel/RimStimPlanLegendConfig.h b/ApplicationLibCode/ProjectDataModel/RimStimPlanLegendConfig.h index 5981e04c93..9bedc88fda 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStimPlanLegendConfig.h +++ b/ApplicationLibCode/ProjectDataModel/RimStimPlanLegendConfig.h @@ -18,7 +18,6 @@ #pragma once -#include "cafAppEnum.h" #include "cafPdmChildField.h" #include "cafPdmField.h" #include "cafPdmObject.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimTernaryLegendConfig.h b/ApplicationLibCode/ProjectDataModel/RimTernaryLegendConfig.h index 77c7d80373..1dc7392e33 100644 --- a/ApplicationLibCode/ProjectDataModel/RimTernaryLegendConfig.h +++ b/ApplicationLibCode/ProjectDataModel/RimTernaryLegendConfig.h @@ -23,8 +23,6 @@ #include "cvfObject.h" -#include "cafAppEnum.h" - class RimEclipseView; class RivTernarySaturationOverlayItem; class RivTernaryScalarMapper; diff --git a/ApplicationLibCode/ProjectDataModel/RimTimeAxisAnnotation.h b/ApplicationLibCode/ProjectDataModel/RimTimeAxisAnnotation.h index e369f90b29..87d67951b4 100644 --- a/ApplicationLibCode/ProjectDataModel/RimTimeAxisAnnotation.h +++ b/ApplicationLibCode/ProjectDataModel/RimTimeAxisAnnotation.h @@ -20,10 +20,8 @@ #include "RimPlotAxisAnnotation.h" -#include "cafAppEnum.h" #include "cafPdmField.h" #include "cafPdmObject.h" -#include "cafPdmPtrField.h" #include "cvfColor3.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimWellBoreStabilityPlot.h b/ApplicationLibCode/ProjectDataModel/RimWellBoreStabilityPlot.h index 82c459a5d8..c62d6b17ce 100644 --- a/ApplicationLibCode/ProjectDataModel/RimWellBoreStabilityPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimWellBoreStabilityPlot.h @@ -22,9 +22,7 @@ #include "RigWbsParameter.h" #include "Well/RigGeoMechWellLogExtractor.h" -#include "cafAppEnum.h" #include "cafPdmField.h" -#include "cafPdmPtrField.h" class RimGeoMechCase; class RimWellPath; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.h b/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.h index 05c5a7b63e..c1647cedcd 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.h @@ -18,13 +18,9 @@ #pragma once -#include "cafPdmChildField.h" #include "cafPdmField.h" #include "cafPdmObject.h" -#include "cafPdmPointer.h" -#include "cafPdmPtrField.h" -#include "RiaDefines.h" #include "RimPlotCurve.h" #include "cafAppEnum.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h index 5974d77632..a0c10d7a82 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h @@ -18,11 +18,8 @@ #pragma once -#include "cafPdmChildField.h" #include "cafPdmField.h" #include "cafPdmObject.h" -#include "cafPdmPointer.h" -#include "cafPdmPtrField.h" #include "RiaDefines.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h index e866199726..a72b275dea 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h @@ -21,7 +21,6 @@ #include "cafPdmChildField.h" #include "cafPdmField.h" #include "cafPdmObject.h" -#include "cafPdmPointer.h" #include "cafPdmPtrField.h" #include "RiaDateTimeDefines.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogCurve.h b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogCurve.h index a0aa00145b..4af76b895d 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogCurve.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogCurve.h @@ -22,7 +22,6 @@ #include "cafPdmField.h" #include "cafPdmObject.h" -#include "cafPdmChildField.h" #include "cafPdmFieldCvfColor.h" #include "cvfObject.h" #include "cvfVector3.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.h index c8af6c95e4..8db3fe3df5 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.h @@ -24,10 +24,7 @@ #include "RimEnsembleCurveSetInterface.h" #include "RimEnsembleWellLogStatistics.h" -#include "RigEnsembleParameter.h" - #include "cafAppEnum.h" -#include "cafPdmChildArrayField.h" #include "cafPdmChildField.h" #include "cafPdmField.h" #include "cafPdmFieldCvfColor.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.h index 3110ecadf9..f27456d5d1 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.h @@ -26,8 +26,6 @@ #include "cafPdmField.h" #include "cafPdmPtrField.h" -#include "cvfObject.h" - #include #include diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.h b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.h index f43f789576..8d252ebaae 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.h +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.h @@ -29,7 +29,6 @@ #include "cafPdmChildField.h" #include "cafPdmField.h" #include "cafPdmObject.h" -#include "cafPdmPointer.h" #include "cafPdmProxyValueField.h" // Include to make Pdm work for cvf::Color diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttributeCollection.h b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttributeCollection.h index 97ede458da..17555bde65 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttributeCollection.h +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttributeCollection.h @@ -19,8 +19,6 @@ #include "RimCheckableNamedObject.h" -#include "cafAppEnum.h" - #include "cafPdmChildArrayField.h" #include "cafPdmField.h" #include "cafPdmObject.h" @@ -50,4 +48,4 @@ protected: private: caf::PdmChildArrayField m_attributes; -}; \ No newline at end of file +}; diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.h b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.h index d76ad00e7d..f9fa54693b 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.h +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.h @@ -20,14 +20,12 @@ #include "RiaLineArcWellPathCalculator.h" #include "RiaWellPlanCalculator.h" -#include "cafAppEnum.h" #include "cafPdmChildArrayField.h" #include "cafPdmChildField.h" #include "cafPdmField.h" #include "cafPdmFieldCvfColor.h" #include "cafPdmFieldCvfVec3d.h" #include "cafPdmObject.h" -#include "cafPdmPtrField.h" #include "cvfColor3.h" #include "cvfObject.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTarget.h b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTarget.h index 23079ed4b1..9cd75d5650 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTarget.h +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTarget.h @@ -25,7 +25,6 @@ #include "cafPdmCoreVec3d.h" #include "cafPdmField.h" #include "cafPdmProxyValueField.h" -#include "cafPdmPtrField.h" class RimWellPathGeometryDef; diff --git a/ApplicationLibCode/ReservoirDataModel/RigStimPlanFractureDefinition.cpp b/ApplicationLibCode/ReservoirDataModel/RigStimPlanFractureDefinition.cpp index 44b93c3587..5300a4c4c1 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigStimPlanFractureDefinition.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigStimPlanFractureDefinition.cpp @@ -30,6 +30,8 @@ #include "cafAssert.h" +#include + #include //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ReservoirDataModel/Well/RigGeoMechWellLogExtractor.h b/ApplicationLibCode/ReservoirDataModel/Well/RigGeoMechWellLogExtractor.h index 5178dca748..41c1a515e8 100644 --- a/ApplicationLibCode/ReservoirDataModel/Well/RigGeoMechWellLogExtractor.h +++ b/ApplicationLibCode/ReservoirDataModel/Well/RigGeoMechWellLogExtractor.h @@ -19,13 +19,11 @@ #pragma once -#include "RiaDefines.h" #include "RigWbsParameter.h" #include "RigWellLogExtractor.h" #include "RigFemResultPosEnum.h" -#include "cafAppEnum.h" #include "cafTensor3.h" #include "cvfObject.h" diff --git a/Fwk/AppFwk/cafCommand/cafCmdSelectionChangeExec.h b/Fwk/AppFwk/cafCommand/cafCmdSelectionChangeExec.h index 3964217077..6b10556e26 100644 --- a/Fwk/AppFwk/cafCommand/cafCmdSelectionChangeExec.h +++ b/Fwk/AppFwk/cafCommand/cafCmdSelectionChangeExec.h @@ -38,7 +38,6 @@ #include "cafCmdExecuteCommand.h" -#include "cafAppEnum.h" #include "cafPdmField.h" #include "cafPdmObject.h" diff --git a/Fwk/AppFwk/cafTests/cafTestApplication/TamComboBox.h b/Fwk/AppFwk/cafTests/cafTestApplication/TamComboBox.h index f5b8fceb6b..4594f8bc28 100644 --- a/Fwk/AppFwk/cafTests/cafTestApplication/TamComboBox.h +++ b/Fwk/AppFwk/cafTests/cafTestApplication/TamComboBox.h @@ -1,7 +1,6 @@ #pragma once -#include "cafAppEnum.h" #include "cafPdmField.h" #include "cafPdmObject.h" From 59df1a655ebb2d77f56b67ae1599033b286cf83e Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 4 Nov 2024 16:04:10 +0100 Subject: [PATCH 092/160] #11851 Initialize OpenGL when main window is created --- ApplicationLibCode/Application/RiaGuiApplication.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index 3826a8042b..bcb31c7472 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -104,7 +104,6 @@ #include "RiuPlotMainWindowTools.h" #include "RiuProcessMonitor.h" #include "RiuRecentFileActionProvider.h" -#include "RiuViewer.h" #include "DockManager.h" @@ -957,6 +956,9 @@ void RiaGuiApplication::createMainWindow() messagePanelLogger->addMessagePanel( m_mainWindow->messagePanel() ); } } + + // Initialize OpenGL here to avoid flickering when creating the first 3D view + QOpenGLWidget openGLWidget( m_mainWindow ); } //-------------------------------------------------------------------------------------------------- From 71b0ae1a161807f00d85279b2558110b19b97186 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 4 Nov 2024 16:12:06 +0100 Subject: [PATCH 093/160] Remove duplicated code in RiaPlotWindowRedrawScheduler --- .../RiaPlotWindowRedrawScheduler.cpp | 73 +------------------ .../RiaPlotWindowRedrawScheduler.h | 26 +------ .../Application/RiaScheduler.cpp | 15 +++- ApplicationLibCode/Application/RiaScheduler.h | 3 + .../RicSnapshotViewToFileFeature.cpp | 2 +- ...RicAppendSummaryPlotsForObjectsFeature.cpp | 4 +- .../RicNewMultiPhaseRftSegmentPlotFeature.cpp | 2 +- .../RicNewRftSegmentWellLogPlotFeature.cpp | 2 +- .../ProjectDataModel/RimDepthTrackPlot.cpp | 2 +- 9 files changed, 31 insertions(+), 98 deletions(-) diff --git a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp index 5133e6f579..5f98de5b1b 100644 --- a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp +++ b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp @@ -15,19 +15,13 @@ // for more details. // ///////////////////////////////////////////////////////////////////////////////// + #include "RiaPlotWindowRedrawScheduler.h" #include "RiuMultiPlotBook.h" #include "RiuMultiPlotPage.h" #include "RiuPlotWidget.h" -#include -#include - -#include - -#include "cafProgressState.h" - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -87,13 +81,8 @@ void RiaPlotWindowRedrawScheduler::schedulePlotWidgetReplot( RiuPlotWidget* plot //-------------------------------------------------------------------------------------------------- void RiaPlotWindowRedrawScheduler::clearAllScheduledUpdates() { - if ( m_plotWindowUpdateTimer ) - { - while ( m_plotWindowUpdateTimer->isActive() ) - { - QCoreApplication::processEvents(); - } - } + waitUntilWorkIsDone(); + m_plotWidgetsToReplot.clear(); m_plotPagesToUpdate.clear(); m_plotBooksToUpdate.clear(); @@ -102,7 +91,7 @@ void RiaPlotWindowRedrawScheduler::clearAllScheduledUpdates() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots() +void RiaPlotWindowRedrawScheduler::performScheduledUpdates() { std::map, RiaDefines::MultiPlotPageUpdateType> plotBooksToUpdate; std::map, RiaDefines::MultiPlotPageUpdateType> pagesToUpdate; @@ -145,57 +134,3 @@ void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots() } } } - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiaPlotWindowRedrawScheduler::blockScheduledUpdatesAndReplots() -{ - m_blockScheduledUpdatesAndReplots = true; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiaPlotWindowRedrawScheduler::unblockScheduledUpdatesAndReplots() -{ - m_blockScheduledUpdatesAndReplots = false; - startTimer( 0 ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiaPlotWindowRedrawScheduler::slotUpdateAndReplotScheduledItemsWhenReady() -{ - if ( m_blockScheduledUpdatesAndReplots ) - { - return; - } - - if ( caf::ProgressState::isActive() ) - { - startTimer( 100 ); - return; - } - - performScheduledUpdatesAndReplots(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiaPlotWindowRedrawScheduler::startTimer( int msecs ) -{ - if ( !m_plotWindowUpdateTimer ) - { - m_plotWindowUpdateTimer.reset( new QTimer( this ) ); - connect( m_plotWindowUpdateTimer.data(), SIGNAL( timeout() ), this, SLOT( slotUpdateAndReplotScheduledItemsWhenReady() ) ); - } - - if ( !m_plotWindowUpdateTimer->isActive() ) - { - m_plotWindowUpdateTimer->setSingleShot( true ); - m_plotWindowUpdateTimer->start( msecs ); - } -} diff --git a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.h b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.h index 0b540c261f..f5b1505ef6 100644 --- a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.h +++ b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.h @@ -17,23 +17,19 @@ ///////////////////////////////////////////////////////////////////////////////// #pragma once -#include "cafPdmPointer.h" - #include "RiaDefines.h" +#include "RiaScheduler.h" -#include #include -#include -#include #include -#include +#include class RiuMultiPlotPage; class RiuMultiPlotBook; class RiuPlotWidget; -class RiaPlotWindowRedrawScheduler : public QObject +class RiaPlotWindowRedrawScheduler : public RiaScheduler { Q_OBJECT @@ -46,26 +42,12 @@ public: RiaDefines::MultiPlotPageUpdateType updateType = RiaDefines::MultiPlotPageUpdateType::ALL ); void schedulePlotWidgetReplot( RiuPlotWidget* plotWidget ); void clearAllScheduledUpdates(); - void performScheduledUpdatesAndReplots(); - void blockScheduledUpdatesAndReplots(); - void unblockScheduledUpdatesAndReplots(); - -private slots: - void slotUpdateAndReplotScheduledItemsWhenReady(); - -private: - RiaPlotWindowRedrawScheduler() = default; - ~RiaPlotWindowRedrawScheduler() override = default; - - void startTimer( int msecs ); + void performScheduledUpdates() override; private: std::map, RiaDefines::MultiPlotPageUpdateType> m_plotPagesToUpdate; std::map, RiaDefines::MultiPlotPageUpdateType> m_plotBooksToUpdate; std::set> m_plotWidgetsToReplot; - - QScopedPointer m_plotWindowUpdateTimer; - bool m_blockScheduledUpdatesAndReplots = false; }; diff --git a/ApplicationLibCode/Application/RiaScheduler.cpp b/ApplicationLibCode/Application/RiaScheduler.cpp index 123ef0b5bc..9e9785e347 100644 --- a/ApplicationLibCode/Application/RiaScheduler.cpp +++ b/ApplicationLibCode/Application/RiaScheduler.cpp @@ -26,6 +26,7 @@ /// //-------------------------------------------------------------------------------------------------- RiaScheduler::RiaScheduler() + : m_blockUpdate( false ) { } @@ -36,6 +37,18 @@ RiaScheduler::~RiaScheduler() { } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaScheduler::blockUpdate( bool blockUpdate ) +{ + m_blockUpdate = blockUpdate; + if ( !m_blockUpdate ) + { + startTimer( 0 ); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -47,7 +60,7 @@ void RiaScheduler::slotUpdateScheduledItemsWhenReady() return; } - performScheduledUpdates(); + if ( !m_blockUpdate ) performScheduledUpdates(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaScheduler.h b/ApplicationLibCode/Application/RiaScheduler.h index ad0dbc3c28..77ba0532b5 100644 --- a/ApplicationLibCode/Application/RiaScheduler.h +++ b/ApplicationLibCode/Application/RiaScheduler.h @@ -35,6 +35,8 @@ public: virtual void performScheduledUpdates() = 0; + void blockUpdate( bool blockUpdate ); + protected: void startTimer( int msecs ); void waitUntilWorkIsDone(); @@ -44,4 +46,5 @@ private slots: private: QScopedPointer m_updateTimer; + bool m_blockUpdate; }; diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp index 8cc57dc646..6415fe4c88 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp @@ -89,7 +89,7 @@ void RicSnapshotViewToFileFeature::savePlotPdfReportAs( const QString& fileName, auto viewWidget = plot->viewWidget(); - RiaPlotWindowRedrawScheduler::instance()->performScheduledUpdatesAndReplots(); + RiaPlotWindowRedrawScheduler::instance()->performScheduledUpdates(); QCoreApplication::processEvents(); QFile pdfFile( fileName ); if ( pdfFile.open( QIODevice::WriteOnly ) ) diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp index 2de36126f8..09f7e1637e 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp @@ -70,7 +70,7 @@ void RicAppendSummaryPlotsForObjectsFeature::appendPlots( RimSummaryMultiPlot* caf::ProgressInfo info( sumAddressCollections.size(), "Appending plots..." ); summaryMultiPlot->startBatchAddOperation(); - RiaPlotWindowRedrawScheduler::instance()->blockScheduledUpdatesAndReplots(); + RiaPlotWindowRedrawScheduler::instance()->blockUpdate( true ); for ( auto summaryAdrCollection : sumAddressCollections ) { @@ -119,7 +119,7 @@ void RicAppendSummaryPlotsForObjectsFeature::appendPlots( RimSummaryMultiPlot* summaryMultiPlot->endBatchAddOperation(); RiaPlotWindowRedrawScheduler::instance()->clearAllScheduledUpdates(); - RiaPlotWindowRedrawScheduler::instance()->unblockScheduledUpdatesAndReplots(); + RiaPlotWindowRedrawScheduler::instance()->blockUpdate( false ); summaryMultiPlot->loadDataAndUpdate(); diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewMultiPhaseRftSegmentPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicNewMultiPhaseRftSegmentPlotFeature.cpp index 1f99b938e3..fa0387e112 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewMultiPhaseRftSegmentPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewMultiPhaseRftSegmentPlotFeature.cpp @@ -95,7 +95,7 @@ void RicNewMultiPhaseRftSegmentPlotFeature::onActionTriggered( bool isChecked ) plot->loadDataAndUpdate(); plot->updateTrackVisibility(); - RiaPlotWindowRedrawScheduler::instance()->performScheduledUpdatesAndReplots(); + RiaPlotWindowRedrawScheduler::instance()->performScheduledUpdates(); plot->updateLayout(); RiuPlotMainWindowTools::onObjectAppended( plot ); diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewRftSegmentWellLogPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicNewRftSegmentWellLogPlotFeature.cpp index b725692e51..5633697af9 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewRftSegmentWellLogPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewRftSegmentWellLogPlotFeature.cpp @@ -104,7 +104,7 @@ void RicNewRftSegmentWellLogPlotFeature::onActionTriggered( bool isChecked ) plot->loadDataAndUpdate(); plot->updateTrackVisibility(); - RiaPlotWindowRedrawScheduler::instance()->performScheduledUpdatesAndReplots(); + RiaPlotWindowRedrawScheduler::instance()->performScheduledUpdates(); plot->updateLayout(); RiuPlotMainWindowTools::onObjectAppended( plot ); diff --git a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp index 90c384c879..3617bbcd4a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp @@ -950,7 +950,7 @@ void RimDepthTrackPlot::onPlotsReordered( const SignalEmitter* emitter ) recreatePlotWidgets(); loadDataAndUpdate(); - RiaPlotWindowRedrawScheduler::instance()->performScheduledUpdatesAndReplots(); + RiaPlotWindowRedrawScheduler::instance()->performScheduledUpdates(); updateLayout(); } From 9ed4318470df0601120a3b7ae8a3d0cbd78387c9 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 4 Nov 2024 16:14:38 +0100 Subject: [PATCH 094/160] Avoid redraw of 3D views during summary import --- .../Application/Tools/RiaImportEclipseCaseTools.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp b/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp index a3183d0f17..b641e99954 100644 --- a/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp @@ -27,6 +27,7 @@ #include "RiaGuiApplication.h" #include "RiaLogging.h" #include "RiaPreferencesGrid.h" +#include "RiaViewRedrawScheduler.h" #include "RifEclipseSummaryTools.h" #include "RifReaderSettings.h" @@ -95,6 +96,10 @@ bool RiaImportEclipseCaseTools::openEclipseCasesFromFile( const QStringList& fil FileCaseIdMap openedFiles; + // Block updates until import of summary data is completed. QApplication::processEvents() is called during import of summary data, and + // this will trigger redraw of the 3D views in RiaViewRedrawScheduler + RiaViewRedrawScheduler::instance()->blockUpdate( true ); + // Import eclipse case files for ( const QString& gridCaseFile : selector.gridCaseFiles() ) { @@ -208,6 +213,8 @@ bool RiaImportEclipseCaseTools::openEclipseCasesFromFile( const QStringList& fil project->activeOilField()->completionTemplateCollection()->setDefaultUnitSystemBasedOnLoadedCases(); + RiaViewRedrawScheduler::instance()->blockUpdate( false ); + if ( RiaGuiApplication::isRunning() ) { if ( RiuPlotMainWindow::instance()->isVisible() ) RiuPlotMainWindowTools::refreshToolbars(); From 2a2ff204be53b504f0b1f7dc1fc5ec56d3620c14 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 4 Nov 2024 17:37:23 +0100 Subject: [PATCH 095/160] Bump version to 2024.09.3-dev.03 --- ResInsightVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index 7950a4720f..4904d1eda2 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -11,7 +11,7 @@ set(RESINSIGHT_VERSION_TEXT "-dev") # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -set(RESINSIGHT_DEV_VERSION ".02") +set(RESINSIGHT_DEV_VERSION ".03") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") From 1a3cb1f2419248efbf2cc1e8d9bf62b00e2de362 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 4 Nov 2024 18:01:09 +0100 Subject: [PATCH 096/160] Fix missing include and bump version --- ApplicationLibCode/Application/RiaGuiApplication.cpp | 1 + ResInsightVersion.cmake | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index bcb31c7472..ff5ec40b53 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -104,6 +104,7 @@ #include "RiuPlotMainWindowTools.h" #include "RiuProcessMonitor.h" #include "RiuRecentFileActionProvider.h" +#include "RiuViewer.h" #include "DockManager.h" diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index 4904d1eda2..4ff2f69f17 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -11,7 +11,7 @@ set(RESINSIGHT_VERSION_TEXT "-dev") # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -set(RESINSIGHT_DEV_VERSION ".03") +set(RESINSIGHT_DEV_VERSION ".04") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") From 8ff8264d1160ed474cdb7958473f8dc304b507e0 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Tue, 5 Nov 2024 14:04:02 +0100 Subject: [PATCH 097/160] Use window icons to show toggle state in windows menu --- ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp | 2 +- ThirdParty/qtadvanceddocking | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp index ae9adcaeb9..1d06c704cb 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp @@ -37,7 +37,7 @@ ads::CDockWidget* RiuDockWidgetTools::createDockWidget( QString title, QString d { ads::CDockWidget* dockWidget = new ads::CDockWidget( title, parent ); dockWidget->setObjectName( dockName ); - dockWidget->setToggleViewActionMode( ads::CDockWidget::ActionModeShow ); + dockWidget->setToggleViewActionMode( ads::CDockWidget::ActionModeToggle ); dockWidget->setIcon( RiuDockWidgetTools::dockIcon( dockName ) ); return dockWidget; diff --git a/ThirdParty/qtadvanceddocking b/ThirdParty/qtadvanceddocking index b2156037a8..234c591980 160000 --- a/ThirdParty/qtadvanceddocking +++ b/ThirdParty/qtadvanceddocking @@ -1 +1 @@ -Subproject commit b2156037a83a99c208b07bb65893630079fd1365 +Subproject commit 234c591980a1ec6fadce8a9ffc43d24370055c4b From 1cbdbfa7df92d2c3cb475eab766eaab0af7f096a Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 5 Nov 2024 14:12:26 +0100 Subject: [PATCH 098/160] Remove waitUntilWorkIsDone as this can cause eternal loops --- .../Application/RiaPlotWindowRedrawScheduler.cpp | 2 -- ApplicationLibCode/Application/RiaScheduler.cpp | 14 -------------- ApplicationLibCode/Application/RiaScheduler.h | 1 - .../Application/RiaViewRedrawScheduler.cpp | 2 -- 4 files changed, 19 deletions(-) diff --git a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp index 5f98de5b1b..1d821e0233 100644 --- a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp +++ b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp @@ -81,8 +81,6 @@ void RiaPlotWindowRedrawScheduler::schedulePlotWidgetReplot( RiuPlotWidget* plot //-------------------------------------------------------------------------------------------------- void RiaPlotWindowRedrawScheduler::clearAllScheduledUpdates() { - waitUntilWorkIsDone(); - m_plotWidgetsToReplot.clear(); m_plotPagesToUpdate.clear(); m_plotBooksToUpdate.clear(); diff --git a/ApplicationLibCode/Application/RiaScheduler.cpp b/ApplicationLibCode/Application/RiaScheduler.cpp index 9e9785e347..8d2e7a2adf 100644 --- a/ApplicationLibCode/Application/RiaScheduler.cpp +++ b/ApplicationLibCode/Application/RiaScheduler.cpp @@ -80,17 +80,3 @@ void RiaScheduler::startTimer( int msecs ) m_updateTimer->start( msecs ); } } - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiaScheduler::waitUntilWorkIsDone() -{ - if ( m_updateTimer ) - { - while ( m_updateTimer->isActive() ) - { - QCoreApplication::processEvents(); - } - } -} diff --git a/ApplicationLibCode/Application/RiaScheduler.h b/ApplicationLibCode/Application/RiaScheduler.h index 77ba0532b5..800a013c03 100644 --- a/ApplicationLibCode/Application/RiaScheduler.h +++ b/ApplicationLibCode/Application/RiaScheduler.h @@ -39,7 +39,6 @@ public: protected: void startTimer( int msecs ); - void waitUntilWorkIsDone(); private slots: void slotUpdateScheduledItemsWhenReady(); diff --git a/ApplicationLibCode/Application/RiaViewRedrawScheduler.cpp b/ApplicationLibCode/Application/RiaViewRedrawScheduler.cpp index f0e431b7dc..387de55fac 100644 --- a/ApplicationLibCode/Application/RiaViewRedrawScheduler.cpp +++ b/ApplicationLibCode/Application/RiaViewRedrawScheduler.cpp @@ -62,8 +62,6 @@ void RiaViewRedrawScheduler::scheduleDisplayModelUpdateAndRedraw( Rim3dView* res //-------------------------------------------------------------------------------------------------- void RiaViewRedrawScheduler::clearViewsScheduledForUpdate() { - waitUntilWorkIsDone(); - m_resViewsToUpdate.clear(); } From 67e6df28b55046f35b0d8285e6195d2d7010600f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 5 Nov 2024 15:00:34 +0100 Subject: [PATCH 099/160] #11857 Make sure the summary curve type is updated Always compute curve type Rate or Accumulated based on address if Auto curve type is set. --- .../Application/Tools/Summary/RiaSummaryTools.cpp | 2 +- .../FlowCommands/RicPlotProductionRateFeature.cpp | 2 +- .../SummaryPlotCommands/RicSummaryPlotEditorUi.cpp | 2 +- .../RicSummaryPlotFeatureImpl.cpp | 2 +- .../Summary/RimEnsembleCurveSet.cpp | 4 ++-- .../ProjectDataModel/Summary/RimSummaryCurve.cpp | 14 ++++---------- .../ProjectDataModel/Summary/RimSummaryCurve.h | 1 - .../ProjectDataModel/Summary/RimSummaryPlot.cpp | 2 +- 8 files changed, 11 insertions(+), 18 deletions(-) diff --git a/ApplicationLibCode/Application/Tools/Summary/RiaSummaryTools.cpp b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryTools.cpp index a86718a8e7..c37ef5914d 100644 --- a/ApplicationLibCode/Application/Tools/Summary/RiaSummaryTools.cpp +++ b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryTools.cpp @@ -100,7 +100,7 @@ void RiaSummaryTools::notifyCalculatedCurveNameHasChanged( int calculationId, co if ( adr.isCalculated() && adr.id() == calculationId ) { adr.setVectorName( currentCurveName.toStdString() ); - curve->setSummaryAddressYAndApplyInterpolation( adr ); + curve->setSummaryAddressY( adr ); } } } diff --git a/ApplicationLibCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp b/ApplicationLibCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp index 7f4fd82b81..49875ef8b4 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp +++ b/ApplicationLibCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp @@ -260,7 +260,7 @@ RimSummaryCurve* RicPlotProductionRateFeature::addSummaryCurve( RimSummaryPlot* plot->addCurveAndUpdate( newCurve ); newCurve->setSummaryCaseY( summaryCase ); - newCurve->setSummaryAddressYAndApplyInterpolation( addr ); + newCurve->setSummaryAddressY( addr ); newCurve->setColor( color ); newCurve->setLeftOrRightAxisY( RiuPlotAxis( plotAxis ) ); newCurve->loadDataAndUpdate( true ); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp index 30e27ce8ae..a9033cac38 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp @@ -532,7 +532,7 @@ void RicSummaryPlotEditorUi::updatePreviewCurvesFromCurveDefinitions( const std: curve->setShowInLegend( false ); } curve->setSummaryCaseY( currentCase ); - curve->setSummaryAddressYAndApplyInterpolation( curveDef.summaryAddressY() ); + curve->setSummaryAddressY( curveDef.summaryAddressY() ); curve->applyCurveAutoNameSettings( *m_curveNameConfig() ); if ( currentCase && currentCase->isObservedData() ) curve->setSymbolSkipDistance( 0 ); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp index 28b9ebc588..e907dffc8e 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp @@ -689,7 +689,7 @@ RimSummaryCurve* RicSummaryPlotFeatureImpl::createCurve( RimSummaryCase* summary { auto curve = new RimSummaryCurve(); curve->setSummaryCaseY( summaryCase ); - curve->setSummaryAddressYAndApplyInterpolation( address ); + curve->setSummaryAddressY( address ); return curve; } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index bec4c2309e..571b5eda60 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -2056,7 +2056,7 @@ void RimEnsembleCurveSet::updateEnsembleCurves( const std::vectorsetSummaryCaseY( sumCase ); - curve->setSummaryAddressYAndApplyInterpolation( addr->address() ); + curve->setSummaryAddressY( addr->address() ); curve->setResampling( m_resampling() ); int lineThickness = 1; @@ -2259,7 +2259,7 @@ void RimEnsembleCurveSet::updateStatisticsCurves( const std::vectorsetSummaryCaseY( summaryCase ); - curve->setSummaryAddressYAndApplyInterpolation( address.summaryAddressY() ); + curve->setSummaryAddressY( address.summaryAddressY() ); curve->setLeftOrRightAxisY( axisY() ); if ( isXAxisSummaryVector() ) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index 8ffed8c081..4804a14052 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -244,16 +244,6 @@ RifEclipseSummaryAddress RimSummaryCurve::summaryAddressY() const return m_yValuesSummaryAddress->address(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryCurve::setSummaryAddressYAndApplyInterpolation( const RifEclipseSummaryAddress& address ) -{ - setSummaryAddressY( address ); - - calculateCurveInterpolationFromAddress(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -265,6 +255,10 @@ void RimSummaryCurve::setSummaryAddressY( const RifEclipseSummaryAddress& addres } m_yValuesSummaryAddress->setAddress( address ); + + // Always calculate curve interpolation when address is changed + // This will ensure that the curve type (Rate or Accumulated) is correctly set based on the address + calculateCurveInterpolationFromAddress(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h index a72b275dea..fd36a47650 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h @@ -65,7 +65,6 @@ public: virtual std::vector valuesY() const; void setSummaryCaseY( RimSummaryCase* sumCase ); - void setSummaryAddressYAndApplyInterpolation( const RifEclipseSummaryAddress& address ); void setSummaryAddressY( const RifEclipseSummaryAddress& address ); void setResampling( RiaDefines::DateTimePeriodEnum resampling ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 0525422367..a72481c1a9 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -2553,7 +2553,7 @@ RimSummaryCurve* RimSummaryPlot::addNewCurve( const RifEclipseSummaryAddress& ad { auto* newCurve = new RimSummaryCurve(); newCurve->setSummaryCaseY( summaryCase ); - newCurve->setSummaryAddressYAndApplyInterpolation( address ); + newCurve->setSummaryAddressY( address ); // This address is RifEclipseSummaryAddress::time() if the curve is a time plot. Otherwise it is the address of the summary vector used // for the x-axis From 94d6f81b0ff0e3e71c05037e7fdd68afa0aa6098 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 7 Nov 2024 09:36:24 +0100 Subject: [PATCH 100/160] Improve Quick Access * Add css to checked menu items * Improve icons * Use group name for field if found * Add quick access fields for IJK Filter * Add tree selection for selection of multiple fields --- ApplicationExeCode/Resources/Select.svg | 2 +- .../Resources/pinned-remove.svg | 10 +- ApplicationExeCode/Resources/themes/dark.qss | 10 ++ .../RicAddFieldToQuickAccessFeature.cpp | 20 ++- .../CellFilters/RimCellRangeFilter.cpp | 11 ++ .../QuickAccess/CMakeLists_files.cmake | 2 + .../QuickAccess/RimFieldSelection.cpp | 133 ++++++++++++++++++ .../QuickAccess/RimFieldSelection.h | 48 +++++++ .../QuickAccess/RimQuickAccessCollection.cpp | 18 ++- 9 files changed, 243 insertions(+), 11 deletions(-) create mode 100644 ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldSelection.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldSelection.h diff --git a/ApplicationExeCode/Resources/Select.svg b/ApplicationExeCode/Resources/Select.svg index 73eec55876..250cb8e18b 100644 --- a/ApplicationExeCode/Resources/Select.svg +++ b/ApplicationExeCode/Resources/Select.svg @@ -1,6 +1,6 @@ - + IconLightSelect diff --git a/ApplicationExeCode/Resources/pinned-remove.svg b/ApplicationExeCode/Resources/pinned-remove.svg index 6ffaa4c5bf..8a7a257cc0 100644 --- a/ApplicationExeCode/Resources/pinned-remove.svg +++ b/ApplicationExeCode/Resources/pinned-remove.svg @@ -3,7 +3,7 @@ width="16" height="16" viewBox="0 0 16 16" - fill="currentColor" + fill="rgb(128, 128, 128)" version="1.1" id="svg1" sodipodi:docname="pinned-remove.svg" @@ -73,19 +73,19 @@ d="M4 2h7v.278c0 .406-.086.778-.258 1.117-.172.339-.42.63-.742.875v2.86c.307.145.583.328.828.546.245.219.456.464.633.735.177.27.31.565.398.882.089.318.136.646.141.985v.5H8V14l-.5 1-.5-1v-3.222H3v-.5c0-.339.047-.664.14-.977.094-.312.227-.607.4-.883A3.404 3.404 0 0 1 5 7.13V4.27a2.561 2.561 0 0 1-.734-.875A2.505 2.505 0 0 1 4 2.278V2zm1.086.778c.042.125.094.232.156.32a1.494 1.494 0 0 0 .461.43L6 3.715v4.102l-.336.117c-.411.146-.76.383-1.047.711C4.331 8.973 4.09 9.573 4 10h7c-.088-.427-.33-1.027-.617-1.355a2.456 2.456 0 0 0-1.047-.71L9 7.816V3.715l.297-.18c.094-.057.177-.122.25-.195a2.28 2.28 0 0 0 .21-.242.968.968 0 0 0 .157-.32H5.086z" id="path1" /> diff --git a/ApplicationExeCode/Resources/themes/dark.qss b/ApplicationExeCode/Resources/themes/dark.qss index 2396c4f7d4..9a3660d997 100644 --- a/ApplicationExeCode/Resources/themes/dark.qss +++ b/ApplicationExeCode/Resources/themes/dark.qss @@ -345,6 +345,16 @@ QMenu::item:selected { color: $textColor; } +QMenu::icon:checked { + background-color: $primaryColor; + border: 1px inset $backgroundColor1; + position: absolute; + top: 1px; + right: 1px; + bottom: 1px; + left: 1px; +} + QLineEdit, QComboBox, QSpinBox, diff --git a/ApplicationLibCode/Commands/ToolCommands/RicAddFieldToQuickAccessFeature.cpp b/ApplicationLibCode/Commands/ToolCommands/RicAddFieldToQuickAccessFeature.cpp index c1685252d9..c57c305de3 100644 --- a/ApplicationLibCode/Commands/ToolCommands/RicAddFieldToQuickAccessFeature.cpp +++ b/ApplicationLibCode/Commands/ToolCommands/RicAddFieldToQuickAccessFeature.cpp @@ -20,6 +20,7 @@ #include "QuickAccess/RimFieldQuickAccessInterface.h" #include "QuickAccess/RimFieldReference.h" +#include "QuickAccess/RimFieldSelection.h" #include "QuickAccess/RimQuickAccessCollection.h" #include "Riu3DMainWindowTools.h" @@ -51,15 +52,26 @@ void RicAddFieldToQuickAccessFeature::onActionTriggered( bool isChecked ) auto firstObject = objects.front(); if ( !firstObject ) return; - RimFieldReference fieldRef; - fieldRef.setObject( firstObject ); + RimFieldSelection fieldSelection; + fieldSelection.setObject( firstObject ); + fieldSelection.selectAllFields(); - caf::PdmUiPropertyViewDialog propertyDialog( Riu3DMainWindowTools::mainWindowWidget(), &fieldRef, "Select Field for Quick Access", "" ); + caf::PdmUiPropertyViewDialog propertyDialog( Riu3DMainWindowTools::mainWindowWidget(), &fieldSelection, "Select Field for Quick Access", "" ); propertyDialog.setWindowIcon( QIcon( ":/pin.svg" ) ); + propertyDialog.resize( QSize( 400, 500 ) ); if ( propertyDialog.exec() == QDialog::Accepted ) { - RimQuickAccessCollection::instance()->addQuickAccessField( fieldRef ); + auto selectedFields = fieldSelection.fields(); + for ( auto field : selectedFields ) + { + RimFieldReference fieldRef; + fieldRef.setObject( firstObject ); + fieldRef.setField( field ); + + RimQuickAccessCollection::instance()->addQuickAccessField( fieldRef ); + } + RimQuickAccessCollection::instance()->updateAllRequiredEditors(); } } diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellRangeFilter.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellRangeFilter.cpp index 54ffd2e879..807cf1d2ef 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellRangeFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellRangeFilter.cpp @@ -180,6 +180,17 @@ std::map> RimCellRangeFilter::quickAc if ( cellCountJ == 1 ) fields[""].push_back( &startIndexJ ); if ( cellCountK == 1 ) fields[""].push_back( &startIndexK ); + if ( fields.empty() ) + { + QString groupName = "IJK Filter"; + fields[groupName].push_back( &startIndexI ); + fields[groupName].push_back( &cellCountI ); + fields[groupName].push_back( &startIndexJ ); + fields[groupName].push_back( &cellCountJ ); + fields[groupName].push_back( &startIndexK ); + fields[groupName].push_back( &cellCountK ); + } + return fields; } diff --git a/ApplicationLibCode/ProjectDataModel/QuickAccess/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/QuickAccess/CMakeLists_files.cmake index 2599c59cda..217fd73a9a 100644 --- a/ApplicationLibCode/ProjectDataModel/QuickAccess/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModel/QuickAccess/CMakeLists_files.cmake @@ -3,6 +3,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RimFieldQuickAccessGroup.h ${CMAKE_CURRENT_LIST_DIR}/RimFieldQuickAccessInterface.h ${CMAKE_CURRENT_LIST_DIR}/RimFieldReference.h + ${CMAKE_CURRENT_LIST_DIR}/RimFieldSelection.h ${CMAKE_CURRENT_LIST_DIR}/RimQuickAccessCollection.h ) @@ -10,6 +11,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimFieldQuickAccess.cpp ${CMAKE_CURRENT_LIST_DIR}/RimFieldQuickAccessGroup.cpp ${CMAKE_CURRENT_LIST_DIR}/RimFieldReference.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimFieldSelection.cpp ${CMAKE_CURRENT_LIST_DIR}/RimQuickAccessCollection.cpp ) diff --git a/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldSelection.cpp b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldSelection.cpp new file mode 100644 index 0000000000..c57df9a55a --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldSelection.cpp @@ -0,0 +1,133 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "RimFieldSelection.h" + +#include "RimFieldQuickAccessInterface.h" + +#include "cafPdmUiTreeSelectionEditor.h" + +CAF_PDM_SOURCE_INIT( RimFieldSelection, "RimFieldSelection" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimFieldSelection::RimFieldSelection() +{ + CAF_PDM_InitFieldNoDefault( &m_objectName, "ObjectName", "Object" ); + m_objectName.registerGetMethod( this, &RimFieldSelection::objectName ); + m_objectName.uiCapability()->setUiReadOnly( true ); + + CAF_PDM_InitFieldNoDefault( &m_keywords, "Keywords", "Field Keywords" ); + m_keywords.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); + m_keywords.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFieldSelection::setObject( caf::PdmObject* object ) +{ + m_object = object; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFieldSelection::selectAllFields() +{ + if ( auto quickInterface = dynamic_cast( m_object.p() ) ) + { + std::vector keywords; + for ( const auto& [groupName, fields] : quickInterface->quickAccessFields() ) + { + for ( auto field : fields ) + { + keywords.push_back( field->keyword() ); + } + } + + m_keywords = keywords; + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimFieldSelection::fields() const +{ + std::vector fieldSelection; + if ( auto quickInterface = dynamic_cast( m_object.p() ) ) + { + for ( const auto& [groupName, fields] : quickInterface->quickAccessFields() ) + { + for ( auto field : fields ) + { + const auto& keyword = field->keyword(); + if ( m_keywords().empty() || std::find( m_keywords().begin(), m_keywords().end(), keyword ) != m_keywords().end() ) + { + fieldSelection.push_back( field ); + } + } + } + } + + return fieldSelection; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimFieldSelection::objectName() const +{ + if ( m_object ) + { + return m_object->uiName(); + } + + return {}; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList RimFieldSelection::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) +{ + QList options; + + if ( fieldNeedingOptions == &m_keywords ) + { + if ( auto quickInterface = dynamic_cast( m_object.p() ) ) + { + for ( const auto& [groupName, fields] : quickInterface->quickAccessFields() ) + { + for ( auto field : fields ) + { + QString displayText = field->keyword(); + if ( field->uiCapability() ) + { + displayText = field->uiCapability()->uiName(); + } + options.push_back( { displayText, field->keyword() } ); + } + } + } + } + + return options; +} diff --git a/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldSelection.h b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldSelection.h new file mode 100644 index 0000000000..7b25602062 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimFieldSelection.h @@ -0,0 +1,48 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "cafPdmObject.h" +#include "cafPdmPointer.h" +#include "cafPdmProxyValueField.h" + +class RimFieldSelection : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + RimFieldSelection(); + + void setObject( caf::PdmObject* object ); + void selectAllFields(); + + std::vector fields() const; + +private: + QString objectName() const; + + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; + +private: + caf::PdmField> m_keywords; + caf::PdmProxyValueField m_objectName; + + caf::PdmPointer m_object; +}; diff --git a/ApplicationLibCode/ProjectDataModel/QuickAccess/RimQuickAccessCollection.cpp b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimQuickAccessCollection.cpp index 174a8186fb..959f4e88f1 100644 --- a/ApplicationLibCode/ProjectDataModel/QuickAccess/RimQuickAccessCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/QuickAccess/RimQuickAccessCollection.cpp @@ -99,7 +99,23 @@ void RimQuickAccessCollection::addQuickAccessField( const RimFieldReference& fie auto field = fieldReference.field(); if ( object && field ) { - if ( auto group = findOrCreateGroup( object, "" ) ) + QString groupNameForField; + + if ( auto quickInterface = dynamic_cast( object ) ) + { + for ( const auto& [qaGroupName, qaFields] : quickInterface->quickAccessFields() ) + { + for ( const auto qaField : qaFields ) + { + if ( qaField == field ) + { + groupNameForField = qaGroupName; + } + } + } + } + + if ( auto group = findOrCreateGroup( object, groupNameForField ) ) { group->addField( field ); } From d2cd425ad0fd757cf4940a8a69a0abad05dc4d25 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 7 Nov 2024 11:38:58 +0100 Subject: [PATCH 101/160] 11867 Do not assume that the first reported time step is initial time step --- .../FileInterface/RifEclipseOutputFileTools.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp b/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp index 06a234a61f..f7af8534ae 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp @@ -260,7 +260,10 @@ void RifEclipseOutputFileTools::timeSteps( const ecl_file_type* ecl_file, int dayValue = cvf::Math::floor( dayDoubleValue ); if ( useStartOfSimulationDate ) { - reportDateTime = reportDateTime.addDays( dayValue ); + // Do not assume the first day value is zero. Adjust the day value to be relative to the first day value + // https://github.com/OPM/ResInsight/issues/11867 + const int adjustedDayValue = dayValue - dayValues.front(); + reportDateTime = reportDateTime.addDays( adjustedDayValue ); } double dayFraction = dayDoubleValue - dayValue; From f5437e6c7275886342803552e5c350bc924d38a5 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 25 Oct 2024 15:11:42 +0200 Subject: [PATCH 102/160] Refactor: extract computation for contour map projection. --- .../RimGeoMechContourMapProjection.cpp | 366 ++------------ .../GeoMech/RimGeoMechContourMapProjection.h | 31 +- .../RimContourMapProjection.cpp | 403 ++++----------- .../RimContourMapProjection.h | 52 +- .../RimEclipseContourMapProjection.cpp | 310 +++--------- .../RimEclipseContourMapProjection.h | 24 +- .../RimEclipseContourMapView.cpp | 1 + .../ReservoirDataModel/CMakeLists_files.cmake | 10 + .../RigContourMapCalculator.cpp | 37 +- .../RigContourMapCalculator.h | 28 +- .../RigContourMapProjection.cpp | 467 ++++++++++++++++++ .../RigContourMapProjection.h | 119 +++++ .../RigEclipseContourMapProjection.cpp | 334 +++++++++++++ .../RigEclipseContourMapProjection.h | 88 ++++ .../RigGeoMechContourMapProjection.cpp | 381 ++++++++++++++ .../RigGeoMechContourMapProjection.h | 81 +++ 16 files changed, 1738 insertions(+), 994 deletions(-) create mode 100644 ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.cpp create mode 100644 ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.h create mode 100644 ApplicationLibCode/ReservoirDataModel/RigEclipseContourMapProjection.cpp create mode 100644 ApplicationLibCode/ReservoirDataModel/RigEclipseContourMapProjection.h create mode 100644 ApplicationLibCode/ReservoirDataModel/RigGeoMechContourMapProjection.cpp create mode 100644 ApplicationLibCode/ReservoirDataModel/RigGeoMechContourMapProjection.h diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp index 8821377cd1..e4f5e1b2ea 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp @@ -17,19 +17,16 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RimGeoMechContourMapProjection.h" -#include "RiaImageTools.h" -#include "RiaWeightedMeanCalculator.h" - -#include "RigCellGeometryTools.h" #include "RigContourMapCalculator.h" #include "RigContourMapGrid.h" +#include "RigContourMapProjection.h" #include "RigFemAddressDefines.h" #include "RigFemPart.h" #include "RigFemPartCollection.h" #include "RigFemPartGrid.h" #include "RigFemPartResultsCollection.h" #include "RigGeoMechCaseData.h" -#include "RigHexIntersectionTools.h" +#include "RigGeoMechContourMapProjection.h" #include "RimCellFilterCollection.h" #include "RimGeoMechCase.h" @@ -46,16 +43,12 @@ #include "cvfStructGridGeometryGenerator.h" #include "cvfVector3.h" -#include -#include - CAF_PDM_SOURCE_INIT( RimGeoMechContourMapProjection, "RimGeoMechContourMapProjection" ); //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RimGeoMechContourMapProjection::RimGeoMechContourMapProjection() - : m_kLayers( 0u ) { CAF_PDM_InitObject( "RimContourMapProjection", ":/2DMapProjection16x16.png" ); CAF_PDM_InitField( &m_limitToPorePressureRegions, "LimitToPorRegion", true, "Limit to Pore Pressure regions" ); @@ -97,8 +90,8 @@ void RimGeoMechContourMapProjection::updateLegend() { RimGeoMechCellColors* cellColors = view()->cellResult(); - double minVal = minValue( m_aggregatedResults ); - double maxVal = maxValue( m_aggregatedResults ); + double minVal = m_contourMapProjection->minValue(); + double maxVal = m_contourMapProjection->maxValue(); std::pair minmaxValAllTimeSteps = minmaxValuesAllTimeSteps(); @@ -174,61 +167,16 @@ cvf::ref RimGeoMechContourMapProjection::getCellVisibility() co return cellGridIdxVisibility; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -cvf::BoundingBox RimGeoMechContourMapProjection::calculateExpandedPorBarBBox( int timeStep, int frameIndex ) const -{ - RigFemResultAddress porBarAddr( RigFemResultPosEnum::RIG_ELEMENT_NODAL, - RigFemAddressDefines::porBar(), - view()->cellResult()->resultComponentName().toStdString() ); - RigGeoMechCaseData* caseData = geoMechCase()->geoMechData(); - RigFemPartResultsCollection* resultCollection = caseData->femPartResults(); - - const std::vector& resultValues = resultCollection->resultValues( porBarAddr, 0, timeStep, frameIndex ); - cvf::BoundingBox boundingBox; - - if ( resultValues.empty() ) - { - return boundingBox; - } - - for ( int i = 0; i < m_femPart->elementCount(); ++i ) - { - size_t resValueIdx = m_femPart->elementNodeResultIdx( (int)i, 0 ); - CVF_ASSERT( resValueIdx < resultValues.size() ); - double scalarValue = resultValues[resValueIdx]; - bool validPorValue = scalarValue != std::numeric_limits::infinity(); - - if ( validPorValue ) - { - std::array hexCorners; - m_femPartGrid->cellCornerVertices( i, hexCorners.data() ); - for ( size_t c = 0; c < 8; ++c ) - { - boundingBox.add( hexCorners[c] ); - } - } - } - cvf::Vec3d boxMin = boundingBox.min(); - cvf::Vec3d boxMax = boundingBox.max(); - cvf::Vec3d boxExtent = boundingBox.extent(); - boxMin.x() -= boxExtent.x() * 0.5 * m_paddingAroundPorePressureRegion(); - boxMin.y() -= boxExtent.y() * 0.5 * m_paddingAroundPorePressureRegion(); - boxMax.x() += boxExtent.x() * 0.5 * m_paddingAroundPorePressureRegion(); - boxMax.y() += boxExtent.y() * 0.5 * m_paddingAroundPorePressureRegion(); - return cvf::BoundingBox( boxMin, boxMax ); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimGeoMechContourMapProjection::updateGridInformation() { RimGeoMechCase* geoMechCase = this->geoMechCase(); - m_femPart = geoMechCase->geoMechData()->femParts()->part( 0 ); - m_femPartGrid = m_femPart->getOrCreateStructGrid(); - m_kLayers = m_femPartGrid->cellCountK(); + if ( !geoMechCase ) return; + + m_femPart = geoMechCase->geoMechData()->femParts()->part( 0 ); + m_femPartGrid = m_femPart->getOrCreateStructGrid(); m_femPart->ensureIntersectionSearchTreeIsBuilt(); cvf::BoundingBox gridBoundingBox = geoMechCase->activeCellsBoundingBox(); @@ -238,7 +186,12 @@ void RimGeoMechContourMapProjection::updateGridInformation() { auto [stepIdx, frameIdx] = view()->currentStepAndDataFrame(); - expandedBoundingBox = calculateExpandedPorBarBBox( stepIdx, frameIdx ); + expandedBoundingBox = + RigGeoMechContourMapProjection::calculateExpandedPorBarBBox( *geoMechCase->geoMechData(), + view()->cellResult()->resultComponentName().toStdString(), + stepIdx, + frameIdx, + m_paddingAroundPorePressureRegion() ); if ( !expandedBoundingBox.isValid() ) { m_limitToPorePressureRegions = false; @@ -259,68 +212,11 @@ void RimGeoMechContourMapProjection::updateGridInformation() } expandedBoundingBox = cvf::BoundingBox( minExpandedPoint, maxExpandedPoint ); - m_contourMapGrid = std::make_unique( gridBoundingBox, expandedBoundingBox, sampleSpacing() ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector RimGeoMechContourMapProjection::getMapCellVisibility() -{ - cvf::Vec2ui nCellsIJ = numberOfElementsIJ(); - std::vector> distanceImage( nCellsIJ.x(), std::vector( nCellsIJ.y(), 0u ) ); - - std::vector mapCellVisibility; - RigFemResultAddress resAddr = view()->cellResult()->resultAddress(); - - if ( m_limitToPorePressureRegions ) - { - resAddr = RigFemAddressDefines::elementNodalPorBarAddress(); - } - - std::vector cellResults = generateResultsFromAddress( resAddr, mapCellVisibility, view()->currentTimeStep() ); - - mapCellVisibility.resize( numberOfCells(), true ); - CVF_ASSERT( mapCellVisibility.size() == cellResults.size() ); - - { - cvf::BoundingBox validResBoundingBox; - for ( size_t cellIndex = 0; cellIndex < cellResults.size(); ++cellIndex ) - { - cvf::Vec2ui ij = m_contourMapGrid->ijFromCellIndex( cellIndex ); - if ( cellResults[cellIndex] != std::numeric_limits::infinity() ) - { - distanceImage[ij.x()][ij.y()] = 1u; - validResBoundingBox.add( cvf::Vec3d( m_contourMapGrid->cellCenterPosition( ij.x(), ij.y() ), 0.0 ) ); - } - else - { - mapCellVisibility[cellIndex] = false; - } - } - - if ( m_limitToPorePressureRegions && m_paddingAroundPorePressureRegion > 0.0 ) - { - RiaImageTools::distanceTransform2d( distanceImage ); - - 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 / sampleSpacing() ); - for ( size_t cellIndex = 0; cellIndex < cellResults.size(); ++cellIndex ) - { - if ( !mapCellVisibility[cellIndex] ) - { - cvf::Vec2ui ij = m_contourMapGrid->ijFromCellIndex( cellIndex ); - if ( distanceImage[ij.x()][ij.y()] < cellPadding * cellPadding ) - { - mapCellVisibility[cellIndex] = true; - } - } - } - } - } - return mapCellVisibility; + m_contourMapGrid = std::make_unique( gridBoundingBox, expandedBoundingBox, sampleSpacing() ); + m_contourMapProjection = std::make_unique( *geoMechCase->geoMechData(), + *m_contourMapGrid, + m_limitToPorePressureRegions, + m_paddingAroundPorePressureRegion ); } //-------------------------------------------------------------------------------------------------- @@ -334,14 +230,30 @@ std::vector RimGeoMechContourMapProjection::retrieveParameterWeights() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RimGeoMechContourMapProjection::generateResults( int viewerStepIndex ) +std::vector RimGeoMechContourMapProjection::generateResults( int viewerStepIndex ) const { - RimGeoMechCellColors* cellColors = view()->cellResult(); - RigFemResultAddress resultAddress = cellColors->resultAddress(); + if ( m_contourMapProjection ) + { + RimGeoMechCellColors* cellColors = view()->cellResult(); + RigFemResultAddress resultAddress = cellColors->resultAddress(); + return generateResultsFromAddress( resultAddress, m_mapCellVisibility, viewerStepIndex ); + } - std::vector aggregatedResults = generateResultsFromAddress( resultAddress, m_mapCellVisibility, viewerStepIndex ); + return {}; +} - return aggregatedResults; +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimGeoMechContourMapProjection::generateAndSaveResults( int timeStep ) +{ + if ( m_contourMapProjection ) + { + RimGeoMechCellColors* cellColors = view()->cellResult(); + RigFemResultAddress resultAddress = cellColors->resultAddress(); + dynamic_cast( m_contourMapProjection.get() ) + ->generateAndSaveResults( resultAddress, m_resultAggregation(), timeStep ); + } } //-------------------------------------------------------------------------------------------------- @@ -349,64 +261,10 @@ std::vector RimGeoMechContourMapProjection::generateResults( int viewerS //-------------------------------------------------------------------------------------------------- std::vector RimGeoMechContourMapProjection::generateResultsFromAddress( RigFemResultAddress resultAddress, const std::vector& mapCellVisibility, - int viewerStepIndex ) + int viewerStepIndex ) const { - RigGeoMechCaseData* caseData = geoMechCase()->geoMechData(); - RigFemPartResultsCollection* resultCollection = caseData->femPartResults(); - size_t nCells = numberOfCells(); - std::vector aggregatedResults = std::vector( nCells, std::numeric_limits::infinity() ); - - auto [stepIdx, frameIdx] = caseData->femPartResults()->stepListIndexToTimeStepAndDataFrameIndex( viewerStepIndex ); - - bool wasInvalid = false; - if ( !resultAddress.isValid() ) - { - wasInvalid = true; - resultAddress = RigFemAddressDefines::elementNodalPorBarAddress(); - } - - if ( resultAddress.fieldName == "PP" ) - { - resultAddress.fieldName = RigFemAddressDefines::porBar(); // More likely to be in memory than POR - } - if ( resultAddress.fieldName == RigFemAddressDefines::porBar() ) - { - resultAddress.resultPosType = RIG_ELEMENT_NODAL; - } - else if ( resultAddress.resultPosType == RIG_FORMATION_NAMES ) - { - resultAddress.resultPosType = RIG_ELEMENT_NODAL; // formation indices are stored per element node result. - } - - std::vector resultValuesF = resultCollection->resultValues( resultAddress, 0, stepIdx, frameIdx ); - if ( resultValuesF.empty() ) return aggregatedResults; - - std::vector resultValues = gridCellValues( resultAddress, resultValuesF ); - - if ( wasInvalid ) - { - // For invalid result addresses we just use the POR-Bar result to get the reservoir region - // And display a dummy 0-result in the region. - for ( double& value : resultValues ) - { - if ( value != std::numeric_limits::infinity() ) - { - value = 0.0; - } - } - } - -#pragma omp parallel for - for ( int index = 0; index < static_cast( nCells ); ++index ) - { - if ( mapCellVisibility.empty() || mapCellVisibility[index] ) - { - cvf::Vec2ui ij = m_contourMapGrid->ijFromCellIndex( index ); - aggregatedResults[index] = calculateValueInMapCell( ij.x(), ij.y(), resultValues ); - } - } - - return aggregatedResults; + return dynamic_cast( m_contourMapProjection.get() ) + ->generateResultsFromAddress( resultAddress, mapCellVisibility, m_resultAggregation(), viewerStepIndex ); } //-------------------------------------------------------------------------------------------------- @@ -436,132 +294,6 @@ RimGridView* RimGeoMechContourMapProjection::baseView() const return view(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector RimGeoMechContourMapProjection::findIntersectingCells( const cvf::BoundingBox& bbox ) const -{ - return m_femPart->findIntersectingElementsWithExistingSearchTree( bbox ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -size_t RimGeoMechContourMapProjection::kLayer( size_t globalCellIdx ) const -{ - size_t i, j, k; - m_femPartGrid->ijkFromCellIndex( globalCellIdx, &i, &j, &k ); - return k; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -size_t RimGeoMechContourMapProjection::kLayers() const -{ - return m_kLayers; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -double RimGeoMechContourMapProjection::calculateOverlapVolume( size_t globalCellIdx, const cvf::BoundingBox& bbox ) const -{ - std::array hexCorners; - m_femPartGrid->cellCornerVertices( globalCellIdx, hexCorners.data() ); - - cvf::BoundingBox overlapBBox; - std::array overlapCorners; - if ( RigCellGeometryTools::estimateHexOverlapWithBoundingBox( hexCorners, bbox, &overlapCorners, &overlapBBox ) ) - { - double overlapVolume = RigCellGeometryTools::calculateCellVolume( overlapCorners ); - return overlapVolume; - } - return 0.0; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -double RimGeoMechContourMapProjection::calculateRayLengthInCell( size_t globalCellIdx, - const cvf::Vec3d& highestPoint, - const cvf::Vec3d& lowestPoint ) const -{ - std::array hexCorners; - - const std::vector& nodeCoords = m_femPart->nodes().coordinates; - const int* cornerIndices = m_femPart->connectivities( globalCellIdx ); - - hexCorners[0] = cvf::Vec3d( nodeCoords[cornerIndices[0]] ); - hexCorners[1] = cvf::Vec3d( nodeCoords[cornerIndices[1]] ); - hexCorners[2] = cvf::Vec3d( nodeCoords[cornerIndices[2]] ); - hexCorners[3] = cvf::Vec3d( nodeCoords[cornerIndices[3]] ); - hexCorners[4] = cvf::Vec3d( nodeCoords[cornerIndices[4]] ); - hexCorners[5] = cvf::Vec3d( nodeCoords[cornerIndices[5]] ); - hexCorners[6] = cvf::Vec3d( nodeCoords[cornerIndices[6]] ); - hexCorners[7] = cvf::Vec3d( nodeCoords[cornerIndices[7]] ); - - std::vector intersections; - - if ( RigHexIntersectionTools::lineHexCellIntersection( highestPoint, lowestPoint, hexCorners.data(), 0, &intersections ) ) - { - double lengthInCell = ( intersections.back().m_intersectionPoint - intersections.front().m_intersectionPoint ).length(); - return lengthInCell; - } - return 0.0; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -double RimGeoMechContourMapProjection::getParameterWeightForCell( size_t globalCellIdx, const std::vector& parameterWeights ) const -{ - if ( parameterWeights.empty() ) return 1.0; - - return parameterWeights[globalCellIdx]; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector RimGeoMechContourMapProjection::gridCellValues( RigFemResultAddress resAddr, std::vector& resultValues ) const -{ - std::vector gridCellValues( m_femPart->elementCount(), std::numeric_limits::infinity() ); - for ( size_t globalCellIdx = 0; globalCellIdx < static_cast( m_femPart->elementCount() ); ++globalCellIdx ) - { - RigElementType elmType = m_femPart->elementType( globalCellIdx ); - if ( !RigFemTypes::is8NodeElement( elmType ) ) continue; - - if ( resAddr.resultPosType == RIG_ELEMENT ) - { - gridCellValues[globalCellIdx] = static_cast( resultValues[globalCellIdx] ); - } - else if ( resAddr.resultPosType == RIG_ELEMENT_NODAL ) - { - RiaWeightedMeanCalculator cellAverage; - for ( int i = 0; i < 8; ++i ) - { - size_t gridResultValueIdx = - m_femPart->resultValueIdxFromResultPosType( resAddr.resultPosType, static_cast( globalCellIdx ), i ); - cellAverage.addValueAndWeight( resultValues[gridResultValueIdx], 1.0 ); - } - - gridCellValues[globalCellIdx] = static_cast( cellAverage.weightedMean() ); - } - else - { - RiaWeightedMeanCalculator cellAverage; - const int* elmNodeIndices = m_femPart->connectivities( globalCellIdx ); - for ( int i = 0; i < 8; ++i ) - { - cellAverage.addValueAndWeight( resultValues[elmNodeIndices[i]], 1.0 ); - } - gridCellValues[globalCellIdx] = static_cast( cellAverage.weightedMean() ); - } - } - return gridCellValues; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -672,20 +404,14 @@ std::pair RimGeoMechContourMapProjection::minmaxValuesAllTimeSte { clearTimeStepRange(); - m_minResultAllTimeSteps = std::min( m_minResultAllTimeSteps, minValue( m_aggregatedResults ) ); - m_maxResultAllTimeSteps = std::max( m_maxResultAllTimeSteps, maxValue( m_aggregatedResults ) ); - - if ( geoMechCase() && geoMechCase()->geoMechData() && geoMechCase()->geoMechData()->femPartResults() ) + if ( geoMechCase()->geoMechData()->femPartResults() ) { int steps = geoMechCase()->geoMechData()->femPartResults()->totalSteps(); - for ( int stepIdx = 0; stepIdx < steps; stepIdx++ ) { - if ( stepIdx == m_currentResultTimestep ) continue; - std::vector aggregatedResults = generateResults( stepIdx ); - m_minResultAllTimeSteps = std::min( m_minResultAllTimeSteps, minValue( aggregatedResults ) ); - m_maxResultAllTimeSteps = std::max( m_maxResultAllTimeSteps, maxValue( aggregatedResults ) ); + m_minResultAllTimeSteps = std::min( m_minResultAllTimeSteps, RigContourMapProjection::minValue( aggregatedResults ) ); + m_maxResultAllTimeSteps = std::max( m_maxResultAllTimeSteps, RigContourMapProjection::maxValue( aggregatedResults ) ); } } } diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.h b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.h index ea6926e229..f78d0079e0 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.h +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.h @@ -21,19 +21,13 @@ #include "RigFemPart.h" #include "RigFemResultAddress.h" -#include "RimCheckableNamedObject.h" #include "RimContourMapProjection.h" -#include "cafDisplayCoordTransform.h" -#include "cafPdmChildField.h" #include "cafPdmField.h" #include "cafPdmObject.h" #include "cvfArray.h" #include "cvfBoundingBox.h" -#include "cvfGeometryBuilderFaceList.h" -#include "cvfString.h" -#include "cvfVector2.h" class RimGeoMechContourMapView; class RimGeoMechCase; @@ -58,27 +52,19 @@ public: double sampleSpacing() const override; protected: - using CellIndexAndResult = RimContourMapProjection::CellIndexAndResult; - // GeoMech implementation specific data generation methods cvf::ref getCellVisibility() const override; cvf::BoundingBox calculateExpandedPorBarBBox( int timeStep, int frameIndex ) const; void updateGridInformation() override; - std::vector getMapCellVisibility() override; - std::vector retrieveParameterWeights() override; - std::vector generateResults( int viewerStepIndex ) override; + + std::vector retrieveParameterWeights() override; + std::vector generateResults( int timeStep ) const override; + void generateAndSaveResults( int timeStep ) override; std::vector - generateResultsFromAddress( RigFemResultAddress resultAddress, const std::vector& mapCellVisibility, int viewerStepIndex ); - bool resultVariableChanged() const override; - void clearResultVariable() override; - RimGridView* baseView() const override; - std::vector findIntersectingCells( const cvf::BoundingBox& bbox ) const override; - size_t kLayer( size_t globalCellIdx ) const override; - size_t kLayers() const override; - double calculateOverlapVolume( size_t globalCellIdx, const cvf::BoundingBox& bbox ) const override; - double calculateRayLengthInCell( size_t globalCellIdx, const cvf::Vec3d& highestPoint, const cvf::Vec3d& lowestPoint ) const override; - double getParameterWeightForCell( size_t globalCellIdx, const std::vector& parameterWeights ) const override; - std::vector gridCellValues( RigFemResultAddress resAddr, std::vector& resultValues ) const; + generateResultsFromAddress( RigFemResultAddress resultAddress, const std::vector& mapCellVisibility, int viewerStepIndex ) const; + bool resultVariableChanged() const override; + void clearResultVariable() override; + RimGridView* baseView() const override; RimGeoMechCase* geoMechCase() const; RimGeoMechContourMapView* view() const; @@ -100,5 +86,4 @@ protected: cvf::ref m_femPart; cvf::cref m_femPartGrid; RigFemResultAddress m_currentResultAddr; - size_t m_kLayers; }; diff --git a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp index d95a581789..3e0121ded4 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp @@ -19,11 +19,11 @@ #include "RimContourMapProjection.h" #include "RiaOpenMPTools.h" -#include "RiaWeightedMeanCalculator.h" #include "RigCellGeometryTools.h" #include "RigContourMapCalculator.h" #include "RigContourMapGrid.h" +#include "RigContourMapProjection.h" #include "RimCase.h" #include "RimGridView.h" @@ -37,10 +37,10 @@ #include "cafProgressInfo.h" #include "cvfArray.h" -#include "cvfGeometryTools.h" #include "cvfGeometryUtils.h" #include "cvfScalarMapper.h" #include "cvfStructGridGeometryGenerator.h" +#include "cvfVector2.h" #include @@ -66,6 +66,7 @@ void RimContourMapProjection::ResultAggregation::setUp() setDefault( RigContourMapCalculator::RESULTS_MEAN_VALUE ); } } // namespace caf + CAF_PDM_ABSTRACT_SOURCE_INIT( RimContourMapProjection, "RimContourMapProjection" ); //-------------------------------------------------------------------------------------------------- @@ -76,6 +77,7 @@ RimContourMapProjection::RimContourMapProjection() , m_currentResultTimestep( -1 ) , m_minResultAllTimeSteps( std::numeric_limits::infinity() ) , m_maxResultAllTimeSteps( -std::numeric_limits::infinity() ) + { CAF_PDM_InitObject( "RimContourMapProjection", ":/2DMapProjection16x16.png" ); @@ -106,22 +108,27 @@ void RimContourMapProjection::generateResultsIfNecessary( int timeStep ) { caf::ProgressInfo progress( 100, "Generate Results", true ); - updateGridInformation(); + if ( !m_contourMapGrid || !m_contourMapProjection ) updateGridInformation(); + + auto cellVisibility = getCellVisibility(); + m_contourMapProjection->setCellVisibility( cellVisibility ); + progress.setProgress( 10 ); - if ( gridMappingNeedsUpdating() || mapCellVisibilityNeedsUpdating() || resultVariableChanged() ) + if ( gridMappingNeedsUpdating() || mapCellVisibilityNeedsUpdating( timeStep ) || resultVariableChanged() ) { clearResults(); clearTimeStepRange(); - m_cellGridIdxVisibility = getCellVisibility(); + auto cellVisibility = getCellVisibility(); + m_contourMapProjection->setCellVisibility( cellVisibility ); if ( gridMappingNeedsUpdating() ) { - m_projected3dGridIndices = RigContourMapCalculator::generateGridMapping( *this, *m_contourMapGrid ); + m_contourMapProjection->generateGridMapping( m_resultAggregation(), retrieveParameterWeights() ); } progress.setProgress( 20 ); - m_mapCellVisibility = getMapCellVisibility(); + m_mapCellVisibility = m_contourMapProjection->getMapCellVisibility( timeStep, m_resultAggregation() ); progress.setProgress( 30 ); } else @@ -132,7 +139,8 @@ void RimContourMapProjection::generateResultsIfNecessary( int timeStep ) if ( resultsNeedsUpdating( timeStep ) ) { clearGeometry(); - m_aggregatedResults = generateResults( timeStep ); + generateAndSaveResults( timeStep ); + progress.setProgress( 80 ); generateVertexResults(); } @@ -279,7 +287,8 @@ QString RimContourMapProjection::currentTimeStepName() const //-------------------------------------------------------------------------------------------------- double RimContourMapProjection::maxValue() const { - return maxValue( m_aggregatedResults ); + if ( m_contourMapProjection ) return m_contourMapProjection->maxValue(); + return -std::numeric_limits::infinity(); } //-------------------------------------------------------------------------------------------------- @@ -287,7 +296,8 @@ double RimContourMapProjection::maxValue() const //-------------------------------------------------------------------------------------------------- double RimContourMapProjection::minValue() const { - return minValue( m_aggregatedResults ); + if ( m_contourMapProjection ) return m_contourMapProjection->minValue(); + return std::numeric_limits::infinity(); } //-------------------------------------------------------------------------------------------------- @@ -295,7 +305,8 @@ double RimContourMapProjection::minValue() const //-------------------------------------------------------------------------------------------------- double RimContourMapProjection::meanValue() const { - return sumAllValues() / numberOfValidCells(); + if ( m_contourMapProjection ) return m_contourMapProjection->meanValue(); + return std::numeric_limits::infinity(); } //-------------------------------------------------------------------------------------------------- @@ -303,24 +314,8 @@ double RimContourMapProjection::meanValue() const //-------------------------------------------------------------------------------------------------- double RimContourMapProjection::sumAllValues() const { - double sum = 0.0; - - for ( size_t index = 0; index < m_aggregatedResults.size(); ++index ) - { - if ( m_aggregatedResults[index] != std::numeric_limits::infinity() ) - { - sum += m_aggregatedResults[index]; - } - } - return sum; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -cvf::Vec2ui RimContourMapProjection::numberOfElementsIJ() const -{ - return m_contourMapGrid->numberOfElementsIJ(); + if ( m_contourMapProjection ) return m_contourMapProjection->sumAllValues(); + return 0.0; } //-------------------------------------------------------------------------------------------------- @@ -328,7 +323,8 @@ cvf::Vec2ui RimContourMapProjection::numberOfElementsIJ() const //-------------------------------------------------------------------------------------------------- cvf::Vec2ui RimContourMapProjection::numberOfVerticesIJ() const { - return m_contourMapGrid->numberOfVerticesIJ(); + if ( m_contourMapGrid ) return m_contourMapGrid->numberOfVerticesIJ(); + return cvf::Vec2ui( 0, 0 ); } //-------------------------------------------------------------------------------------------------- @@ -344,11 +340,7 @@ bool RimContourMapProjection::isColumnResult() const //-------------------------------------------------------------------------------------------------- double RimContourMapProjection::valueAtVertex( uint i, uint j ) const { - size_t index = m_contourMapGrid->vertexIndexFromIJ( i, j ); - if ( index < numberOfVertices() ) - { - return m_aggregatedVertexResults.at( index ); - } + if ( m_contourMapProjection ) return m_contourMapProjection->valueAtVertex( i, j ); return std::numeric_limits::infinity(); } @@ -357,7 +349,8 @@ double RimContourMapProjection::valueAtVertex( uint i, uint j ) const //-------------------------------------------------------------------------------------------------- uint RimContourMapProjection::numberOfCells() const { - return m_contourMapGrid->numberOfCells(); + if ( m_contourMapGrid ) return m_contourMapGrid->numberOfCells(); + return 0u; } //-------------------------------------------------------------------------------------------------- @@ -365,16 +358,8 @@ uint RimContourMapProjection::numberOfCells() const //-------------------------------------------------------------------------------------------------- uint RimContourMapProjection::numberOfValidCells() const { - uint validCount = 0u; - for ( uint i = 0; i < numberOfCells(); ++i ) - { - cvf::Vec2ui ij = m_contourMapGrid->ijFromCellIndex( i ); - if ( hasResultInCell( ij.x(), ij.y() ) ) - { - validCount++; - } - } - return validCount; + if ( m_contourMapProjection ) return m_contourMapProjection->numberOfValidCells(); + return 0u; } //-------------------------------------------------------------------------------------------------- @@ -382,8 +367,8 @@ uint RimContourMapProjection::numberOfValidCells() const //-------------------------------------------------------------------------------------------------- size_t RimContourMapProjection::numberOfVertices() const { - cvf::Vec2ui gridSize = numberOfVerticesIJ(); - return static_cast( gridSize.x() ) * static_cast( gridSize.y() ); + if ( m_contourMapGrid ) return m_contourMapGrid->numberOfVertices(); + return 0; } //-------------------------------------------------------------------------------------------------- @@ -391,22 +376,7 @@ size_t RimContourMapProjection::numberOfVertices() const //-------------------------------------------------------------------------------------------------- bool RimContourMapProjection::checkForMapIntersection( const cvf::Vec3d& domainPoint3d, cvf::Vec2d* contourMapPoint, double* valueAtPoint ) const { - CVF_TIGHT_ASSERT( contourMapPoint ); - CVF_TIGHT_ASSERT( valueAtPoint ); - - const cvf::Vec3d& minPoint = m_contourMapGrid->expandedBoundingBox().min(); - cvf::Vec3d mapPos3d = domainPoint3d - minPoint; - cvf::Vec2d mapPos2d( mapPos3d.x(), mapPos3d.y() ); - cvf::Vec2d gridorigin( minPoint.x(), minPoint.y() ); - - double value = interpolateValue( mapPos2d ); - if ( value != std::numeric_limits::infinity() ) - { - *valueAtPoint = value; - *contourMapPoint = mapPos2d + gridorigin; - - return true; - } + if ( m_contourMapProjection ) return m_contourMapProjection->checkForMapIntersection( domainPoint3d, contourMapPoint, valueAtPoint ); return false; } @@ -439,8 +409,8 @@ size_t RimContourMapProjection::gridResultIndex( size_t globalCellIdx ) const //-------------------------------------------------------------------------------------------------- double RimContourMapProjection::calculateValueInMapCell( uint i, uint j, const std::vector& gridCellValues ) const { - const std::vector>& matchingCells = cellsAtIJ( i, j ); - return RigContourMapCalculator::calculateValueInMapCell( *this, matchingCells, gridCellValues, m_resultAggregation() ); + const std::vector>& matchingCells = m_contourMapProjection->cellsAtIJ( i, j ); + return RigContourMapCalculator::calculateValueInMapCell( *m_contourMapProjection, matchingCells, gridCellValues, m_resultAggregation() ); } //-------------------------------------------------------------------------------------------------- @@ -448,16 +418,19 @@ double RimContourMapProjection::calculateValueInMapCell( uint i, uint j, const s //-------------------------------------------------------------------------------------------------- bool RimContourMapProjection::gridMappingNeedsUpdating() const { - if ( m_projected3dGridIndices.size() != numberOfCells() ) return true; + if ( !m_contourMapProjection ) return true; - if ( m_cellGridIdxVisibility.isNull() ) return true; + if ( m_contourMapProjection->projected3dGridIndices().size() != numberOfCells() ) return true; + + auto cellGridIdxVisibility = m_contourMapProjection->getCellVisibility(); + if ( cellGridIdxVisibility.isNull() ) return true; cvf::ref currentVisibility = getCellVisibility(); - CVF_ASSERT( currentVisibility->size() == m_cellGridIdxVisibility->size() ); + CVF_ASSERT( currentVisibility->size() == cellGridIdxVisibility->size() ); for ( size_t i = 0; i < currentVisibility->size(); ++i ) { - if ( ( *currentVisibility )[i] != ( *m_cellGridIdxVisibility )[i] ) return true; + if ( ( *currentVisibility )[i] != ( *cellGridIdxVisibility )[i] ) return true; } return false; @@ -468,8 +441,10 @@ bool RimContourMapProjection::gridMappingNeedsUpdating() const //-------------------------------------------------------------------------------------------------- bool RimContourMapProjection::resultsNeedsUpdating( int timeStep ) const { - return ( m_aggregatedResults.size() != numberOfCells() || m_aggregatedVertexResults.size() != numberOfVertices() || - timeStep != m_currentResultTimestep ); + if ( !m_contourMapProjection ) return true; + + return ( m_contourMapProjection->aggregatedResults().size() != numberOfCells() || + m_contourMapProjection->aggregatedVertexResults().size() != numberOfVertices() || timeStep != m_currentResultTimestep ); } //-------------------------------------------------------------------------------------------------- @@ -480,15 +455,6 @@ bool RimContourMapProjection::geometryNeedsUpdating() const return m_contourPolygons.empty() || m_trianglesWithVertexValues.empty(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RimContourMapProjection::resultRangeIsValid() const -{ - return m_minResultAllTimeSteps != std::numeric_limits::infinity() && - m_maxResultAllTimeSteps != -std::numeric_limits::infinity(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -496,7 +462,8 @@ void RimContourMapProjection::clearGridMapping() { clearResults(); clearTimeStepRange(); - m_projected3dGridIndices.clear(); + + if ( m_contourMapProjection ) m_contourMapProjection->clearGridMapping(); m_mapCellVisibility.clear(); } @@ -507,81 +474,12 @@ void RimContourMapProjection::clearResults() { clearGeometry(); - m_aggregatedResults.clear(); - m_aggregatedVertexResults.clear(); + if ( m_contourMapProjection ) m_contourMapProjection->clearResults(); m_currentResultTimestep = -1; clearResultVariable(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimContourMapProjection::clearTimeStepRange() -{ - m_minResultAllTimeSteps = std::numeric_limits::infinity(); - m_maxResultAllTimeSteps = -std::numeric_limits::infinity(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -double RimContourMapProjection::maxValue( const std::vector& aggregatedResults ) const -{ - double maxV = -std::numeric_limits::infinity(); - - for ( size_t index = 0; index < aggregatedResults.size(); ++index ) - { - if ( aggregatedResults[index] != std::numeric_limits::infinity() ) - { - maxV = std::max( maxV, aggregatedResults[index] ); - } - } - return maxV; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -double RimContourMapProjection::minValue( const std::vector& aggregatedResults ) const -{ - double minV = std::numeric_limits::infinity(); - - for ( size_t index = 0; index < aggregatedResults.size(); ++index ) - { - if ( aggregatedResults[index] != std::numeric_limits::infinity() ) - { - minV = std::min( minV, aggregatedResults[index] ); - } - } - return minV; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::pair RimContourMapProjection::minmaxValuesAllTimeSteps() -{ - if ( !resultRangeIsValid() ) - { - clearTimeStepRange(); - - m_minResultAllTimeSteps = std::min( m_minResultAllTimeSteps, minValue( m_aggregatedResults ) ); - m_maxResultAllTimeSteps = std::max( m_maxResultAllTimeSteps, maxValue( m_aggregatedResults ) ); - - for ( int i = 0; i < (int)baseView()->ownerCase()->timeStepStrings().size() - 1; ++i ) - { - if ( i != m_currentResultTimestep ) - { - std::vector aggregatedResults = generateResults( i ); - m_minResultAllTimeSteps = std::min( m_minResultAllTimeSteps, minValue( aggregatedResults ) ); - m_maxResultAllTimeSteps = std::max( m_maxResultAllTimeSteps, maxValue( aggregatedResults ) ); - } - } - } - return std::make_pair( m_minResultAllTimeSteps, m_maxResultAllTimeSteps ); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -590,20 +488,14 @@ cvf::ref RimContourMapProjection::getCellVisibility() const return baseView()->currentTotalCellVisibility(); } -//-------------------------------------------------------------------------------------------------- -/// Empty default implementation -//-------------------------------------------------------------------------------------------------- -std::vector RimContourMapProjection::getMapCellVisibility() -{ - return std::vector( numberOfCells(), true ); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RimContourMapProjection::mapCellVisibilityNeedsUpdating() +bool RimContourMapProjection::mapCellVisibilityNeedsUpdating( int timestep ) { - std::vector mapCellVisiblity = getMapCellVisibility(); + if ( m_contourMapProjection ) return true; + + std::vector mapCellVisiblity = m_contourMapProjection->getMapCellVisibility( timestep, m_resultAggregation() ); return !( mapCellVisiblity == m_mapCellVisibility ); } @@ -612,17 +504,7 @@ bool RimContourMapProjection::mapCellVisibilityNeedsUpdating() //-------------------------------------------------------------------------------------------------- void RimContourMapProjection::generateVertexResults() { - size_t nCells = numberOfCells(); - if ( nCells != m_aggregatedResults.size() ) return; - - size_t nVertices = numberOfVertices(); - m_aggregatedVertexResults = std::vector( nVertices, std::numeric_limits::infinity() ); -#pragma omp parallel for - for ( int index = 0; index < static_cast( nVertices ); ++index ) - { - cvf::Vec2ui ij = m_contourMapGrid->ijFromVertexIndex( index ); - m_aggregatedVertexResults[index] = calculateValueAtVertex( ij.x(), ij.y() ); - } + if ( m_contourMapProjection ) m_contourMapProjection->generateVertexResults(); } //-------------------------------------------------------------------------------------------------- @@ -668,6 +550,8 @@ void RimContourMapProjection::generateTrianglesWithVertexValues() std::vector>> threadTriangles( numberOfThreads ); + const std::vector& aggregatedVertexResults = m_contourMapProjection->aggregatedVertexResults(); + #pragma omp parallel { int myThread = RiaOpenMPTools::currentThreadIndex(); @@ -681,9 +565,9 @@ void RimContourMapProjection::generateTrianglesWithVertexValues() bool anyValidVertex = false; for ( size_t n = 0; n < 3; ++n ) { - uint vn = ( *faceList )[i + n]; - double value = vn < m_aggregatedVertexResults.size() ? m_aggregatedVertexResults[vn] : std::numeric_limits::infinity(); - triangle[n] = vertices[vn]; + uint vn = ( *faceList )[i + n]; + double value = vn < aggregatedVertexResults.size() ? aggregatedVertexResults[vn] : std::numeric_limits::infinity(); + triangle[n] = vertices[vn]; triangleWithValues[n] = cvf::Vec4d( vertices[vn], value ); if ( value != std::numeric_limits::infinity() ) { @@ -804,7 +688,7 @@ void RimContourMapProjection::generateTrianglesWithVertexValues() } if ( value == std::numeric_limits::infinity() ) { - value = interpolateValue( cvf::Vec2d( localVertex.x(), localVertex.y() ) ); + value = m_contourMapProjection->interpolateValue( cvf::Vec2d( localVertex.x(), localVertex.y() ) ); if ( value == std::numeric_limits::infinity() ) { value = contourLevels[c]; @@ -841,7 +725,7 @@ void RimContourMapProjection::generateTrianglesWithVertexValues() allTrianglesThisLevel.insert( allTrianglesThisLevel.end(), threadTriangles[i][c].begin(), threadTriangles[i][c].end() ); } - double triangleAreasThisLevel = sumTriangleAreas( allTrianglesThisLevel ); + double triangleAreasThisLevel = RigContourMapProjection::sumTriangleAreas( allTrianglesThisLevel ); if ( c >= m_contourLevelCumulativeAreas.size() || triangleAreasThisLevel > 1.0e-3 * m_contourLevelCumulativeAreas[c] ) { trianglesPerLevel[c] = allTrianglesThisLevel; @@ -867,6 +751,8 @@ void RimContourMapProjection::generateContourPolygons() std::vector contourLevels; if ( resultRangeIsValid() && legendConfig()->mappingMode() != RimRegularLegendConfig::MappingType::CATEGORY_INTEGER ) { + const std::vector& aggregatedVertexResults = m_contourMapProjection->aggregatedVertexResults(); + legendConfig()->scalarMapper()->majorTickValues( &contourLevels ); int nContourLevels = static_cast( contourLevels.size() ); @@ -900,7 +786,7 @@ void RimContourMapProjection::generateContourPolygons() } std::vector unorderedLineSegmentsPerLevel = - caf::ContourLines::create( m_aggregatedVertexResults, xVertexPositions(), yVertexPositions(), contourLevels ); + caf::ContourLines::create( aggregatedVertexResults, xVertexPositions(), yVertexPositions(), contourLevels ); contourPolygons = std::vector( unorderedLineSegmentsPerLevel.size() ); const double areaThreshold = 1.5 * ( sampleSpacing() * sampleSpacing() ) / ( sampleSpacingFactor() * sampleSpacingFactor() ); @@ -948,23 +834,6 @@ void RimContourMapProjection::generateContourPolygons() m_contourPolygons = contourPolygons; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -double RimContourMapProjection::sumTriangleAreas( const std::vector& triangles ) -{ - double sumArea = 0.0; - for ( size_t i = 0; i < triangles.size(); i += 3 ) - { - cvf::Vec3d v1( triangles[i].x(), triangles[i].y(), triangles[i].z() ); - cvf::Vec3d v2( triangles[i + 1].x(), triangles[i + 1].y(), triangles[i + 1].z() ); - cvf::Vec3d v3( triangles[i + 2].x(), triangles[i + 2].y(), triangles[i + 2].z() ); - double area = 0.5 * ( ( v3 - v1 ) ^ ( v2 - v1 ) ).length(); - sumArea += area; - } - return sumArea; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -981,130 +850,13 @@ bool RimContourMapProjection::isStraightSummationResult() const return RigContourMapCalculator::isStraightSummationResult( m_resultAggregation() ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -double RimContourMapProjection::interpolateValue( const cvf::Vec2d& gridPos2d ) const -{ - cvf::Vec2ui cellContainingPoint = m_contourMapGrid->ijFromLocalPos( gridPos2d ); - cvf::Vec2d cellCenter = m_contourMapGrid->cellCenterPosition( cellContainingPoint.x(), cellContainingPoint.y() ); - - std::array x; - x[0] = cvf::Vec3d( cellCenter + cvf::Vec2d( -sampleSpacing() * 0.5, -sampleSpacing() * 0.5 ), 0.0 ); - x[1] = cvf::Vec3d( cellCenter + cvf::Vec2d( sampleSpacing() * 0.5, -sampleSpacing() * 0.5 ), 0.0 ); - x[2] = cvf::Vec3d( cellCenter + cvf::Vec2d( sampleSpacing() * 0.5, sampleSpacing() * 0.5 ), 0.0 ); - x[3] = cvf::Vec3d( cellCenter + cvf::Vec2d( -sampleSpacing() * 0.5, sampleSpacing() * 0.5 ), 0.0 ); - - cvf::Vec4d baryCentricCoords = cvf::GeometryTools::barycentricCoords( x[0], x[1], x[2], x[3], cvf::Vec3d( gridPos2d, 0.0 ) ); - - std::array v; - v[0] = cellContainingPoint; - v[1] = cvf::Vec2ui( cellContainingPoint.x() + 1u, cellContainingPoint.y() ); - v[2] = cvf::Vec2ui( cellContainingPoint.x() + 1u, cellContainingPoint.y() + 1u ); - v[3] = cvf::Vec2ui( cellContainingPoint.x(), cellContainingPoint.y() + 1u ); - - std::array vertexValues; - double validBarycentricCoordsSum = 0.0; - for ( int i = 0; i < 4; ++i ) - { - double vertexValue = valueAtVertex( v[i].x(), v[i].y() ); - if ( vertexValue == std::numeric_limits::infinity() ) - { - return std::numeric_limits::infinity(); - } - else - { - vertexValues[i] = vertexValue; - validBarycentricCoordsSum += baryCentricCoords[i]; - } - } - - if ( validBarycentricCoordsSum < 1.0e-8 ) - { - return std::numeric_limits::infinity(); - } - - // Calculate final value - double value = 0.0; - for ( int i = 0; i < 4; ++i ) - { - value += baryCentricCoords[i] / validBarycentricCoordsSum * vertexValues[i]; - } - - return value; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -double RimContourMapProjection::valueInCell( uint i, uint j ) const -{ - size_t index = m_contourMapGrid->cellIndexFromIJ( i, j ); - if ( index < numberOfCells() ) - { - return m_aggregatedResults.at( index ); - } - return std::numeric_limits::infinity(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RimContourMapProjection::hasResultInCell( uint i, uint j ) const -{ - return !cellsAtIJ( i, j ).empty(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -double RimContourMapProjection::calculateValueAtVertex( uint vi, uint vj ) const -{ - std::vector averageIs; - std::vector averageJs; - - if ( vi > 0u ) averageIs.push_back( vi - 1 ); - if ( vj > 0u ) averageJs.push_back( vj - 1 ); - if ( vi < m_contourMapGrid->mapSize().x() ) averageIs.push_back( vi ); - if ( vj < m_contourMapGrid->mapSize().y() ) averageJs.push_back( vj ); - - RiaWeightedMeanCalculator calc; - for ( uint j : averageJs ) - { - for ( uint i : averageIs ) - { - if ( hasResultInCell( i, j ) ) - { - calc.addValueAndWeight( valueInCell( i, j ), 1.0 ); - } - } - } - if ( calc.validAggregatedWeight() ) - { - return calc.weightedMean(); - } - return std::numeric_limits::infinity(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector> RimContourMapProjection::cellsAtIJ( uint i, uint j ) const -{ - size_t cellIndex = m_contourMapGrid->cellIndexFromIJ( i, j ); - if ( cellIndex < m_projected3dGridIndices.size() ) - { - return m_projected3dGridIndices[cellIndex]; - } - return std::vector>(); -} - //-------------------------------------------------------------------------------------------------- /// Vertex positions in local coordinates (add origin2d.x() for UTM x) //-------------------------------------------------------------------------------------------------- std::vector RimContourMapProjection::xVertexPositions() const { - return m_contourMapGrid->xVertexPositions(); + if ( m_contourMapGrid ) return m_contourMapGrid->xVertexPositions(); + return {}; } //-------------------------------------------------------------------------------------------------- @@ -1112,7 +864,8 @@ std::vector RimContourMapProjection::xVertexPositions() const //-------------------------------------------------------------------------------------------------- std::vector RimContourMapProjection::yVertexPositions() const { - return m_contourMapGrid->yVertexPositions(); + if ( m_contourMapGrid ) return m_contourMapGrid->yVertexPositions(); + return {}; } //-------------------------------------------------------------------------------------------------- @@ -1207,3 +960,21 @@ void RimContourMapProjection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTr void RimContourMapProjection::initAfterRead() { } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimContourMapProjection::resultRangeIsValid() const +{ + return m_minResultAllTimeSteps != std::numeric_limits::infinity() && + m_maxResultAllTimeSteps != -std::numeric_limits::infinity(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimContourMapProjection::clearTimeStepRange() +{ + m_minResultAllTimeSteps = std::numeric_limits::infinity(); + m_maxResultAllTimeSteps = -std::numeric_limits::infinity(); +} diff --git a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h index 9ecc867255..ac97552d4e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h +++ b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h @@ -27,12 +27,12 @@ #include "cafPdmObject.h" #include "cvfArray.h" -#include "cvfBoundingBox.h" #include "cvfVector2.h" class RigContourMapGrid; class RimGridView; class RimRegularLegendConfig; +class RigContourMapProjection; //================================================================================================== /// @@ -43,8 +43,6 @@ class RimContourMapProjection : public RimCheckableNamedObject CAF_PDM_HEADER_INIT; public: - using CellIndexAndResult = std::pair; - using ResultAggregation = caf::AppEnum; using ContourPolygons = std::vector; @@ -78,7 +76,6 @@ public: double meanValue() const; double sumAllValues() const; - cvf::Vec2ui numberOfElementsIJ() const; cvf::Vec2ui numberOfVerticesIJ() const; bool isColumnResult() const; @@ -108,26 +105,19 @@ public: virtual std::vector retrieveParameterWeights() = 0; - virtual size_t kLayer( size_t globalCellIdx ) const = 0; - virtual size_t kLayers() const = 0; - virtual std::vector findIntersectingCells( const cvf::BoundingBox& bbox ) const = 0; - virtual double calculateOverlapVolume( size_t globalCellIdx, const cvf::BoundingBox& bbox ) const = 0; - virtual double calculateRayLengthInCell( size_t globalCellIdx, const cvf::Vec3d& highestPoint, const cvf::Vec3d& lowestPoint ) const = 0; - virtual double getParameterWeightForCell( size_t globalCellIdx, const std::vector& parameterWeights ) const = 0; - virtual cvf::ref getCellVisibility() const; protected: // Protected virtual methods to be overridden by Eclipse and Geo-mechanical contour map implementations - virtual void updateGridInformation() = 0; - virtual std::vector generateResults( int timeStep ) = 0; - virtual bool resultVariableChanged() const = 0; - virtual void clearResultVariable() = 0; - virtual RimGridView* baseView() const = 0; + virtual void updateGridInformation() = 0; + virtual std::vector generateResults( int timeStep ) const = 0; + virtual void generateAndSaveResults( int timeStep ) = 0; + virtual bool resultVariableChanged() const = 0; + virtual void clearResultVariable() = 0; + virtual RimGridView* baseView() const = 0; double calculateValueInMapCell( uint i, uint j, const std::vector& gridCellValues ) const; -protected: // Keep track of whether cached data needs updating bool gridMappingNeedsUpdating() const; bool resultsNeedsUpdating( int timeStep ) const; @@ -137,30 +127,14 @@ protected: void clearResults(); void clearTimeStepRange(); - double maxValue( const std::vector& aggregatedResults ) const; - double minValue( const std::vector& aggregatedResults ) const; + virtual std::pair minmaxValuesAllTimeSteps() = 0; - virtual std::pair minmaxValuesAllTimeSteps(); - - virtual std::vector getMapCellVisibility(); - bool mapCellVisibilityNeedsUpdating(); - static std::vector>> generateGridMapping( RimContourMapProjection& contourMapProjection, - const RigContourMapGrid& contourMapGrid ); + bool mapCellVisibilityNeedsUpdating( int timeStep ); void generateVertexResults(); void generateTrianglesWithVertexValues(); void generateContourPolygons(); - static double sumTriangleAreas( const std::vector& triangles ); - - double interpolateValue( const cvf::Vec2d& gridPosition2d ) const; - double valueInCell( uint i, uint j ) const; - bool hasResultInCell( uint i, uint j ) const; - double calculateValueAtVertex( uint i, uint j ) const; - - // Cell index and position conversion - std::vector cellsAtIJ( uint i, uint j ) const; - double gridEdgeOffset() const; virtual void updateAfterResultGeneration( int timeStep ) = 0; @@ -180,11 +154,6 @@ protected: caf::PdmField m_showContourLabels; caf::PdmField m_smoothContourLines; - cvf::ref m_cellGridIdxVisibility; - std::vector m_aggregatedResults; - std::vector m_aggregatedVertexResults; - std::vector>> m_projected3dGridIndices; - cvf::Vec2d m_pickPoint; std::vector m_contourPolygons; std::vector m_contourLevelCumulativeAreas; @@ -195,5 +164,6 @@ protected: double m_minResultAllTimeSteps; double m_maxResultAllTimeSteps; - std::unique_ptr m_contourMapGrid; + std::unique_ptr m_contourMapGrid; + std::unique_ptr m_contourMapProjection; }; diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp index 4346ab9c18..d23a540f8a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp @@ -18,15 +18,13 @@ #include "RimEclipseContourMapProjection.h" -#include "RigActiveCellInfo.h" +#include "RiaPorosityModel.h" #include "RigCaseCellResultsData.h" -#include "RigCell.h" -#include "RigCellGeometryTools.h" #include "RigContourMapCalculator.h" #include "RigContourMapGrid.h" #include "RigEclipseCaseData.h" +#include "RigEclipseContourMapProjection.h" #include "RigEclipseResultAddress.h" -#include "RigHexIntersectionTools.h" #include "RigMainGrid.h" #include "Rim3dView.h" @@ -37,8 +35,6 @@ #include "RimEclipseView.h" #include "RimRegularLegendConfig.h" -#include - CAF_PDM_SOURCE_INIT( RimEclipseContourMapProjection, "RimEclipseContourMapProjection" ); //-------------------------------------------------------------------------------------------------- @@ -46,8 +42,6 @@ CAF_PDM_SOURCE_INIT( RimEclipseContourMapProjection, "RimEclipseContourMapProjec //-------------------------------------------------------------------------------------------------- RimEclipseContourMapProjection::RimEclipseContourMapProjection() : RimContourMapProjection() - , m_kLayers( 0u ) - , m_useActiveCellInfo( true ) { CAF_PDM_InitObject( "RimEclipseContourMapProjection", ":/2DMapProjection16x16.png" ); @@ -109,8 +103,8 @@ void RimEclipseContourMapProjection::updateLegend() { RimEclipseCellColors* cellColors = view()->cellResult(); - double minVal = minValue( m_aggregatedResults ); - double maxVal = maxValue( m_aggregatedResults ); + double minVal = minValue(); + double maxVal = maxValue(); auto [minValAllTimeSteps, maxValAllTimeSteps] = minmaxValuesAllTimeSteps(); @@ -138,13 +132,16 @@ void RimEclipseContourMapProjection::updateLegend() //-------------------------------------------------------------------------------------------------- double RimEclipseContourMapProjection::sampleSpacing() const { - if ( m_mainGrid.notNull() ) + if ( auto ec = eclipseCase() ) { - return m_relativeSampleSpacing * m_mainGrid->characteristicIJCellSize(); + if ( auto mainGrid = ec->mainGrid() ) + { + return m_relativeSampleSpacing * mainGrid->characteristicIJCellSize(); + } } + return 0.0; } - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -162,76 +159,43 @@ void RimEclipseContourMapProjection::clearGridMappingAndRedraw() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RimEclipseContourMapProjection::generateResults( int timeStep ) +std::vector RimEclipseContourMapProjection::generateResults( int timeStep ) const { m_weightingResult->loadResult(); - size_t nCells = numberOfCells(); - - std::vector aggregatedResults = std::vector( nCells, std::numeric_limits::infinity() ); - - RimEclipseCellColors* cellColors = view()->cellResult(); - auto gridCellResult = view()->currentGridCellResults(); + if ( m_contourMapProjection ) { - { - auto resultAdr = cellColors->eclipseResultAddress(); - if ( resultAdr.isValid() && gridCellResult->hasResultEntry( resultAdr ) ) - m_useActiveCellInfo = gridCellResult->isUsingGlobalActiveIndex( resultAdr ); - } + RimEclipseCellColors* cellColors = view()->cellResult(); + RigEclipseResultAddress resAddr( cellColors->resultType(), + cellColors->resultVariable(), + cellColors->timeLapseBaseTimeStep(), + cellColors->caseDiffIndex() ); - if ( !cellColors->isTernarySaturationSelected() ) - { - std::vector gridResultValues; - if ( isColumnResult() ) - { - m_currentResultName = ""; - gridCellResult->ensureKnownResultLoaded( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "PORO" ) ); - gridCellResult->ensureKnownResultLoaded( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "NTG" ) ); - gridCellResult->ensureKnownResultLoaded( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "DZ" ) ); - if ( m_resultAggregation == RigContourMapCalculator::RESULTS_OIL_COLUMN || - m_resultAggregation == RigContourMapCalculator::RESULTS_HC_COLUMN ) - { - gridCellResult->ensureKnownResultLoaded( - RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::soil() ) ); - } - if ( m_resultAggregation == RigContourMapCalculator::RESULTS_GAS_COLUMN || - m_resultAggregation == RigContourMapCalculator::RESULTS_HC_COLUMN ) - { - gridCellResult->ensureKnownResultLoaded( - RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::sgas() ) ); - } - gridResultValues = calculateColumnResult( m_resultAggregation() ); - } - else - { - if ( cellColors->hasStaticResult() && timeStep > 0 ) timeStep = 0; - - m_currentResultName = cellColors->resultVariable(); - RigEclipseResultAddress resAddr( cellColors->resultType(), - cellColors->resultVariable(), - cellColors->timeLapseBaseTimeStep(), - cellColors->caseDiffIndex() ); - - // When loading a project file, grid calculator results are not computed the first time this function is - // called. Must check if result is loaded. See RimReloadCaseTools::updateAll3dViews() - if ( resAddr.isValid() && gridCellResult->hasResultEntry( resAddr ) && gridCellResult->isResultLoaded( resAddr ) ) - { - gridResultValues = gridCellResult->cellScalarResults( resAddr, timeStep ); - } - } - - if ( !gridResultValues.empty() ) - { -#pragma omp parallel for - for ( int index = 0; index < static_cast( nCells ); ++index ) - { - cvf::Vec2ui ij = m_contourMapGrid->ijFromCellIndex( index ); - aggregatedResults[index] = calculateValueInMapCell( ij.x(), ij.y(), gridResultValues ); - } - } - } + return dynamic_cast( m_contourMapProjection.get() ) + ->generateResults( resAddr, m_resultAggregation(), timeStep ); + } + + return {}; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseContourMapProjection::generateAndSaveResults( int timeStep ) +{ + m_weightingResult->loadResult(); + + if ( m_contourMapProjection ) + { + RimEclipseCellColors* cellColors = view()->cellResult(); + RigEclipseResultAddress resAddr( cellColors->resultType(), + cellColors->resultVariable(), + cellColors->timeLapseBaseTimeStep(), + cellColors->caseDiffIndex() ); + + dynamic_cast( m_contourMapProjection.get() ) + ->generateAndSaveResults( resAddr, m_resultAggregation(), timeStep ); } - return aggregatedResults; } //-------------------------------------------------------------------------------------------------- @@ -258,80 +222,18 @@ void RimEclipseContourMapProjection::clearResultVariable() m_currentResultName = ""; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector RimEclipseContourMapProjection::calculateColumnResult( ResultAggregation resultAggregation ) const -{ - const RigCaseCellResultsData* resultData = eclipseCase()->results( RiaDefines::PorosityModelType::MATRIX_MODEL ); - bool hasPoroResult = resultData->hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "PORO" ) ); - bool hasNtgResult = resultData->hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "NTG" ) ); - bool hasDzResult = resultData->hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "DZ" ) ); - - if ( !( hasPoroResult && hasNtgResult && hasDzResult ) ) - { - return std::vector(); - } - - const std::vector& poroResults = - resultData->cellScalarResults( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "PORO" ), 0 ); - const std::vector& ntgResults = - resultData->cellScalarResults( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "NTG" ), 0 ); - const std::vector& dzResults = - resultData->cellScalarResults( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "DZ" ), 0 ); - - CVF_ASSERT( poroResults.size() == ntgResults.size() && ntgResults.size() == dzResults.size() ); - - int timeStep = view()->currentTimeStep(); - - std::vector resultValues( poroResults.size(), 0.0 ); - - if ( resultAggregation == RigContourMapCalculator::RESULTS_OIL_COLUMN || resultAggregation == RigContourMapCalculator::RESULTS_HC_COLUMN ) - { - const std::vector& soilResults = - resultData->cellScalarResults( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::soil() ), - timeStep ); - for ( size_t cellResultIdx = 0; cellResultIdx < resultValues.size(); ++cellResultIdx ) - { - resultValues[cellResultIdx] = soilResults[cellResultIdx]; - } - } - - if ( resultAggregation == RigContourMapCalculator::RESULTS_GAS_COLUMN || resultAggregation == RigContourMapCalculator::RESULTS_HC_COLUMN ) - { - bool hasGasResult = - resultData->hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::sgas() ) ); - if ( hasGasResult ) - { - const std::vector& sgasResults = - resultData->cellScalarResults( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::sgas() ), - timeStep ); - for ( size_t cellResultIdx = 0; cellResultIdx < resultValues.size(); ++cellResultIdx ) - { - resultValues[cellResultIdx] += sgasResults[cellResultIdx]; - } - } - } - - for ( size_t cellResultIdx = 0; cellResultIdx < resultValues.size(); ++cellResultIdx ) - { - resultValues[cellResultIdx] *= poroResults[cellResultIdx] * ntgResults[cellResultIdx] * dzResults[cellResultIdx]; - } - return resultValues; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimEclipseContourMapProjection::updateGridInformation() { - auto eclipseCase = this->eclipseCase(); - m_mainGrid = eclipseCase->eclipseCaseData()->mainGrid(); - m_activeCellInfo = eclipseCase->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL ); - m_kLayers = m_mainGrid->cellCountK(); + auto eclipseCase = this->eclipseCase(); + auto eclipseCaseData = eclipseCase->eclipseCaseData(); + auto resultData = eclipseCaseData->results( RiaDefines::PorosityModelType::MATRIX_MODEL ); cvf::BoundingBox gridBoundingBox = eclipseCase->activeCellsBoundingBox(); m_contourMapGrid = std::make_unique( gridBoundingBox, sampleSpacing() ); + m_contourMapProjection = std::make_unique( *m_contourMapGrid, *eclipseCaseData, *resultData ); } //-------------------------------------------------------------------------------------------------- @@ -376,108 +278,6 @@ RimGridView* RimEclipseContourMapProjection::baseView() const return view(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector RimEclipseContourMapProjection::findIntersectingCells( const cvf::BoundingBox& bbox ) const -{ - return m_mainGrid->findIntersectingCells( bbox ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -size_t RimEclipseContourMapProjection::kLayer( size_t globalCellIdx ) const -{ - const RigCell& cell = m_mainGrid->cell( globalCellIdx ); - size_t mainGridCellIdx = cell.mainGridCellIndex(); - size_t i, j, k; - m_mainGrid->ijkFromCellIndex( mainGridCellIdx, &i, &j, &k ); - return k; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -size_t RimEclipseContourMapProjection::kLayers() const -{ - return m_kLayers; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -double RimEclipseContourMapProjection::calculateOverlapVolume( size_t globalCellIdx, const cvf::BoundingBox& bbox ) const -{ - std::array hexCorners; - - const RigCell& cell = m_mainGrid->cell( globalCellIdx ); - - size_t localCellIdx = cell.gridLocalCellIndex(); - RigGridBase* localGrid = cell.hostGrid(); - - localGrid->cellCornerVertices( localCellIdx, hexCorners.data() ); - - cvf::BoundingBox overlapBBox; - std::array overlapCorners; - if ( RigCellGeometryTools::estimateHexOverlapWithBoundingBox( hexCorners, bbox, &overlapCorners, &overlapBBox ) ) - { - double overlapVolume = RigCellGeometryTools::calculateCellVolume( overlapCorners ); - return overlapVolume; - } - return 0.0; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -double RimEclipseContourMapProjection::calculateRayLengthInCell( size_t globalCellIdx, - const cvf::Vec3d& highestPoint, - const cvf::Vec3d& lowestPoint ) const -{ - std::array hexCorners; - - RigCell cell = m_mainGrid->cell( globalCellIdx ); - - size_t localCellIdx = cell.gridLocalCellIndex(); - RigGridBase* localGrid = cell.hostGrid(); - - localGrid->cellCornerVertices( localCellIdx, hexCorners.data() ); - std::vector intersections; - - if ( RigHexIntersectionTools::lineHexCellIntersection( highestPoint, lowestPoint, hexCorners.data(), 0, &intersections ) ) - { - double lengthInCell = ( intersections.back().m_intersectionPoint - intersections.front().m_intersectionPoint ).length(); - return lengthInCell; - } - return 0.0; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -double RimEclipseContourMapProjection::getParameterWeightForCell( size_t cellResultIdx, const std::vector& cellWeights ) const -{ - if ( cellWeights.empty() ) return 1.0; - - double result = std::max( cellWeights[cellResultIdx], 0.0 ); - if ( result < 1.0e-6 ) - { - result = 0.0; - } - return result; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -size_t RimEclipseContourMapProjection::gridResultIndex( size_t globalCellIdx ) const -{ - if ( m_useActiveCellInfo ) return m_activeCellInfo->cellResultIndex( globalCellIdx ); - - return globalCellIdx; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -545,3 +345,23 @@ void RimEclipseContourMapProjection::initAfterRead() m_weightingResult->setEclipseCase( eclipseCase() ); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::pair RimEclipseContourMapProjection::minmaxValuesAllTimeSteps() +{ + if ( !resultRangeIsValid() ) + { + clearTimeStepRange(); + + int timeStepCount = static_cast( eclipseCase()->timeStepStrings().size() ); + for ( int i = 0; i < (int)timeStepCount; ++i ) + { + std::vector aggregatedResults = generateResults( i ); + m_minResultAllTimeSteps = std::min( m_minResultAllTimeSteps, RigContourMapProjection::minValue( aggregatedResults ) ); + m_maxResultAllTimeSteps = std::max( m_maxResultAllTimeSteps, RigContourMapProjection::maxValue( aggregatedResults ) ); + } + } + return std::make_pair( m_minResultAllTimeSteps, m_maxResultAllTimeSteps ); +} diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.h b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.h index 0a5b975ee9..6129329231 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.h +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.h @@ -24,8 +24,6 @@ #include "cafPdmField.h" #include "cafPdmObject.h" -#include "cvfBoundingBox.h" - class RigActiveCellInfo; class RigMainGrid; class RigContourMapGrid; @@ -57,28 +55,19 @@ public: double sampleSpacing() const override; protected: - using CellIndexAndResult = RimContourMapProjection::CellIndexAndResult; - void updateGridInformation() override; std::vector retrieveParameterWeights() override; - std::vector generateResults( int timeStep ) override; + std::vector generateResults( int timeStep ) const override; + void generateAndSaveResults( int timeStep ) override; bool resultVariableChanged() const override; void clearResultVariable() override; RimGridView* baseView() const override; - std::vector findIntersectingCells( const cvf::BoundingBox& bbox ) const override; - size_t kLayer( size_t globalCellIdx ) const override; - size_t kLayers() const override; - double calculateOverlapVolume( size_t globalCellIdx, const cvf::BoundingBox& bbox ) const override; - double calculateRayLengthInCell( size_t globalCellIdx, const cvf::Vec3d& highestPoint, const cvf::Vec3d& lowestPoint ) const override; - double getParameterWeightForCell( size_t cellResultIdx, const std::vector& parameterWeights ) const override; - size_t gridResultIndex( size_t globalCellIdx ) const override; - - // Eclipse implementation specific data generation methods - std::vector calculateColumnResult( ResultAggregation resultAggregation ) const; RimEclipseCase* eclipseCase() const; RimEclipseContourMapView* view() const; + std::pair minmaxValuesAllTimeSteps() override; + void updateAfterResultGeneration( int timeStep ) override; protected: @@ -91,10 +80,5 @@ protected: caf::PdmField m_weightByParameter; caf::PdmChildField m_weightingResult; - cvf::ref m_mainGrid; - cvf::ref m_activeCellInfo; - size_t m_kLayers; - bool m_useActiveCellInfo; - QString m_currentResultName; }; diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapView.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapView.cpp index f830879552..abab36c1e7 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapView.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapView.cpp @@ -272,6 +272,7 @@ void RimEclipseContourMapView::updateGeometry() { m_contourMapProjection->generateResultsIfNecessary( m_currentTimeStep() ); } + onUpdateLegends(); progress.setProgress( 30 ); } diff --git a/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake b/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake index 7c6b11ec86..1b775c4969 100644 --- a/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake +++ b/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake @@ -83,6 +83,10 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RigVisibleCategoriesCalculator.h ${CMAKE_CURRENT_LIST_DIR}/RigWbsParameter.h ${CMAKE_CURRENT_LIST_DIR}/RigWeightedMeanCalc.h + ${CMAKE_CURRENT_LIST_DIR}/RigContourMapCalculator.h + ${CMAKE_CURRENT_LIST_DIR}/RigContourMapProjection.h + ${CMAKE_CURRENT_LIST_DIR}/RigEclipseContourMapProjection.h + ${CMAKE_CURRENT_LIST_DIR}/RigGeoMechContourMapProjection.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -166,6 +170,12 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RigVisibleCategoriesCalculator.cpp ${CMAKE_CURRENT_LIST_DIR}/RigWbsParameter.cpp ${CMAKE_CURRENT_LIST_DIR}/RigWeightedMeanCalc.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigContourMapGrid.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigContourPolygonsTools.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigContourMapCalculator.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigContourMapProjection.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigEclipseContourMapProjection.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigGeoMechContourMapProjection.cpp ) list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.cpp index d7a55db529..16ca635f72 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.cpp @@ -24,15 +24,16 @@ #include "RigContourMapGrid.h" -#include "RimCase.h" -#include "RimContourMapProjection.h" +#include "RigContourMapProjection.h" #include +#include +#include //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -double RigContourMapCalculator::calculateValueInMapCell( const RimContourMapProjection& contourMapProjection, +double RigContourMapCalculator::calculateValueInMapCell( const RigContourMapProjection& contourMapProjection, const std::vector>& matchingCells, const std::vector& gridCellValues, ResultAggregationEnum resultAggregation ) @@ -70,7 +71,7 @@ double RigContourMapCalculator::calculateValueInMapCell( const RimContourMapProj //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -double RigContourMapCalculator::calculateTopValue( const RimContourMapProjection& contourMapProjection, +double RigContourMapCalculator::calculateTopValue( const RigContourMapProjection& contourMapProjection, const std::vector>& matchingCells, const std::vector& gridCellValues ) { @@ -88,7 +89,7 @@ double RigContourMapCalculator::calculateTopValue( const RimContourMapProjection //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -double RigContourMapCalculator::calculateMeanValue( const RimContourMapProjection& contourMapProjection, +double RigContourMapCalculator::calculateMeanValue( const RigContourMapProjection& contourMapProjection, const std::vector>& matchingCells, const std::vector& gridCellValues ) { @@ -111,7 +112,7 @@ double RigContourMapCalculator::calculateMeanValue( const RimContourMapProjectio //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -double RigContourMapCalculator::calculateGeometricMeanValue( const RimContourMapProjection& contourMapProjection, +double RigContourMapCalculator::calculateGeometricMeanValue( const RigContourMapProjection& contourMapProjection, const std::vector>& matchingCells, const std::vector& gridCellValues ) { @@ -138,7 +139,7 @@ double RigContourMapCalculator::calculateGeometricMeanValue( const RimContourMap //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -double RigContourMapCalculator::calculateHarmonicMeanValue( const RimContourMapProjection& contourMapProjection, +double RigContourMapCalculator::calculateHarmonicMeanValue( const RigContourMapProjection& contourMapProjection, const std::vector>& matchingCells, const std::vector& gridCellValues ) { @@ -165,7 +166,7 @@ double RigContourMapCalculator::calculateHarmonicMeanValue( const RimContourMapP //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -double RigContourMapCalculator::calculateMaxValue( const RimContourMapProjection& contourMapProjection, +double RigContourMapCalculator::calculateMaxValue( const RigContourMapProjection& contourMapProjection, const std::vector>& matchingCells, const std::vector& gridCellValues ) { @@ -188,7 +189,7 @@ double RigContourMapCalculator::calculateMaxValue( const RimContourMapProjection //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -double RigContourMapCalculator::calculateMinValue( const RimContourMapProjection& contourMapProjection, +double RigContourMapCalculator::calculateMinValue( const RigContourMapProjection& contourMapProjection, const std::vector>& matchingCells, const std::vector& gridCellValues ) { @@ -201,7 +202,10 @@ double RigContourMapCalculator::calculateMinValue( const RimContourMapProjection return minValue; } -double RigContourMapCalculator::calculateSum( const RimContourMapProjection& contourMapProjection, +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigContourMapCalculator::calculateSum( const RigContourMapProjection& contourMapProjection, const std::vector>& matchingCells, const std::vector& gridCellValues ) { @@ -221,14 +225,15 @@ double RigContourMapCalculator::calculateSum( const RimContourMapProjection& /// //-------------------------------------------------------------------------------------------------- std::vector>> - RigContourMapCalculator::generateGridMapping( RimContourMapProjection& contourMapProjection, const RigContourMapGrid& contourMapGrid ) + RigContourMapCalculator::generateGridMapping( RigContourMapProjection& contourMapProjection, + const RigContourMapGrid& contourMapGrid, + ResultAggregationEnum resultAggregation, + const std::vector& weightingResultValues ) { int nCells = contourMapGrid.numberOfCells(); std::vector>> projected3dGridIndices( nCells ); - std::vector weightingResultValues = contourMapProjection.retrieveParameterWeights(); - - if ( contourMapProjection.isStraightSummationResult() ) + if ( RigContourMapCalculator::isStraightSummationResult( resultAggregation ) ) { #pragma omp parallel for for ( int index = 0; index < nCells; ++index ) @@ -260,7 +265,7 @@ std::vector>> /// //-------------------------------------------------------------------------------------------------- std::vector - RigContourMapCalculator::cellOverlapVolumesAndResults( const RimContourMapProjection& contourMapProjection, + RigContourMapCalculator::cellOverlapVolumesAndResults( const RigContourMapProjection& contourMapProjection, const RigContourMapGrid& contourMapGrid, const cvf::Vec2d& globalPos2d, const std::vector& weightingResultValues ) @@ -326,7 +331,7 @@ std::vector /// //-------------------------------------------------------------------------------------------------- std::vector - RigContourMapCalculator::cellRayIntersectionAndResults( const RimContourMapProjection& contourMapProjection, + RigContourMapCalculator::cellRayIntersectionAndResults( const RigContourMapProjection& contourMapProjection, const RigContourMapGrid& contourMapGrid, const cvf::Vec2d& globalPos2d, const std::vector& weightingResultValues ) diff --git a/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.h b/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.h index 19257c1f56..199f578ea7 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.h +++ b/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.h @@ -24,7 +24,7 @@ #include class RigContourMapGrid; -class RimContourMapProjection; +class RigContourMapProjection; //================================================================================================== /// @@ -50,20 +50,22 @@ public: RESULTS_HC_COLUMN }; - static std::vector>> generateGridMapping( RimContourMapProjection& contourMapProjection, - const RigContourMapGrid& contourMapGrid ); + static std::vector>> generateGridMapping( RigContourMapProjection& contourMapProjection, + const RigContourMapGrid& contourMapGrid, + ResultAggregationEnum resultAggregation, + const std::vector& weightingResultValues ); - static double calculateValueInMapCell( const RimContourMapProjection& contourMapProjection, + static double calculateValueInMapCell( const RigContourMapProjection& contourMapProjection, const std::vector>& matchingCells, const std::vector& gridCellValues, ResultAggregationEnum resultAggregation ); - static std::vector cellOverlapVolumesAndResults( const RimContourMapProjection& contourMapProjection, + static std::vector cellOverlapVolumesAndResults( const RigContourMapProjection& contourMapProjection, const RigContourMapGrid& contourMapGrid, const cvf::Vec2d& globalPos2d, const std::vector& weightingResultValues ); - static std::vector cellRayIntersectionAndResults( const RimContourMapProjection& contourMapProjection, + static std::vector cellRayIntersectionAndResults( const RigContourMapProjection& contourMapProjection, const RigContourMapGrid& contourMapGrid, const cvf::Vec2d& globalPos2d, const std::vector& weightingResultValues ); @@ -73,26 +75,26 @@ public: static bool isStraightSummationResult( ResultAggregationEnum aggregationType ); private: - static double calculateTopValue( const RimContourMapProjection& contourMapProjection, + static double calculateTopValue( const RigContourMapProjection& contourMapProjection, const std::vector>& matchingCells, const std::vector& gridCellValues ); - static double calculateMeanValue( const RimContourMapProjection& contourMapProjection, + static double calculateMeanValue( const RigContourMapProjection& contourMapProjection, const std::vector>& matchingCells, const std::vector& gridCellValues ); - static double calculateGeometricMeanValue( const RimContourMapProjection& contourMapProjection, + static double calculateGeometricMeanValue( const RigContourMapProjection& contourMapProjection, const std::vector>& matchingCells, const std::vector& gridCellValues ); - static double calculateHarmonicMeanValue( const RimContourMapProjection& contourMapProjection, + static double calculateHarmonicMeanValue( const RigContourMapProjection& contourMapProjection, const std::vector>& matchingCells, const std::vector& gridCellValues ); - static double calculateMaxValue( const RimContourMapProjection& contourMapProjection, + static double calculateMaxValue( const RigContourMapProjection& contourMapProjection, const std::vector>& matchingCells, const std::vector& gridCellValues ); - static double calculateMinValue( const RimContourMapProjection& contourMapProjection, + static double calculateMinValue( const RigContourMapProjection& contourMapProjection, const std::vector>& matchingCells, const std::vector& gridCellValues ); - static double calculateSum( const RimContourMapProjection& contourMapProjection, + static double calculateSum( const RigContourMapProjection& contourMapProjection, const std::vector>& matchingCells, const std::vector& gridCellValues ); }; diff --git a/ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.cpp b/ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.cpp new file mode 100644 index 0000000000..809dd47529 --- /dev/null +++ b/ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.cpp @@ -0,0 +1,467 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- 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 "RigContourMapProjection.h" + +#include "RiaWeightedMeanCalculator.h" + +#include "RigContourMapCalculator.h" +#include "RigContourMapGrid.h" + +#include "cvfArray.h" +#include "cvfGeometryTools.h" + +#include +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigContourMapProjection::RigContourMapProjection( const RigContourMapGrid& contourMapGrid ) + : m_contourMapGrid( contourMapGrid ) + , m_currentResultTimestep( -1 ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector>> + RigContourMapProjection::generateGridMapping( RigContourMapCalculator::ResultAggregationEnum resultAggregation, + const std::vector& weights ) +{ + m_projected3dGridIndices = RigContourMapCalculator::generateGridMapping( *this, m_contourMapGrid, resultAggregation, weights ); + return m_projected3dGridIndices; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigContourMapProjection::maxValue() const +{ + return maxValue( m_aggregatedResults ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigContourMapProjection::minValue() const +{ + return minValue( m_aggregatedResults ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigContourMapProjection::meanValue() const +{ + return sumAllValues() / numberOfValidCells(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigContourMapProjection::sumAllValues() const +{ + double sum = 0.0; + + for ( size_t index = 0; index < m_aggregatedResults.size(); ++index ) + { + if ( m_aggregatedResults[index] != std::numeric_limits::infinity() ) + { + sum += m_aggregatedResults[index]; + } + } + return sum; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::Vec2ui RigContourMapProjection::numberOfElementsIJ() const +{ + return m_contourMapGrid.numberOfElementsIJ(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::Vec2ui RigContourMapProjection::numberOfVerticesIJ() const +{ + return m_contourMapGrid.numberOfVerticesIJ(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigContourMapProjection::valueAtVertex( unsigned int i, unsigned int j ) const +{ + size_t index = m_contourMapGrid.vertexIndexFromIJ( i, j ); + if ( index < numberOfVertices() ) + { + return m_aggregatedVertexResults.at( index ); + } + return std::numeric_limits::infinity(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +unsigned int RigContourMapProjection::numberOfCells() const +{ + return m_contourMapGrid.numberOfCells(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +unsigned int RigContourMapProjection::numberOfValidCells() const +{ + unsigned int validCount = 0u; + for ( unsigned int i = 0; i < numberOfCells(); ++i ) + { + cvf::Vec2ui ij = m_contourMapGrid.ijFromCellIndex( i ); + if ( hasResultInCell( ij.x(), ij.y() ) ) + { + validCount++; + } + } + return validCount; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +size_t RigContourMapProjection::numberOfVertices() const +{ + cvf::Vec2ui gridSize = numberOfVerticesIJ(); + return static_cast( gridSize.x() ) * static_cast( gridSize.y() ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RigContourMapProjection::checkForMapIntersection( const cvf::Vec3d& domainPoint3d, cvf::Vec2d* contourMapPoint, double* valueAtPoint ) const +{ + CVF_TIGHT_ASSERT( contourMapPoint ); + CVF_TIGHT_ASSERT( valueAtPoint ); + + const cvf::Vec3d& minPoint = m_contourMapGrid.expandedBoundingBox().min(); + cvf::Vec3d mapPos3d = domainPoint3d - minPoint; + cvf::Vec2d mapPos2d( mapPos3d.x(), mapPos3d.y() ); + cvf::Vec2d gridorigin( minPoint.x(), minPoint.y() ); + + double value = interpolateValue( mapPos2d ); + if ( value != std::numeric_limits::infinity() ) + { + *valueAtPoint = value; + *contourMapPoint = mapPos2d + gridorigin; + + return true; + } + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::Vec3d RigContourMapProjection::origin3d() const +{ + return m_contourMapGrid.expandedBoundingBox().min(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +size_t RigContourMapProjection::gridResultIndex( size_t globalCellIdx ) const +{ + return globalCellIdx; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigContourMapProjection::calculateValueInMapCell( unsigned int i, + unsigned int j, + const std::vector& gridCellValues, + RigContourMapCalculator::ResultAggregationEnum resultAggregation ) const +{ + const std::vector>& matchingCells = cellsAtIJ( i, j ); + return RigContourMapCalculator::calculateValueInMapCell( *this, matchingCells, gridCellValues, resultAggregation ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigContourMapProjection::maxValue( const std::vector& aggregatedResults ) +{ + double maxV = -std::numeric_limits::infinity(); + + for ( size_t index = 0; index < aggregatedResults.size(); ++index ) + { + if ( aggregatedResults[index] != std::numeric_limits::infinity() ) + { + maxV = std::max( maxV, aggregatedResults[index] ); + } + } + return maxV; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigContourMapProjection::minValue( const std::vector& aggregatedResults ) +{ + double minV = std::numeric_limits::infinity(); + + for ( size_t index = 0; index < aggregatedResults.size(); ++index ) + { + if ( aggregatedResults[index] != std::numeric_limits::infinity() ) + { + minV = std::min( minV, aggregatedResults[index] ); + } + } + return minV; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigContourMapProjection::setCellVisibility( cvf::ref cellVisibility ) +{ + m_cellGridIdxVisibility = cellVisibility; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::ref RigContourMapProjection::getCellVisibility() const +{ + return m_cellGridIdxVisibility; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigContourMapProjection::generateVertexResults() +{ + size_t nCells = numberOfCells(); + if ( nCells != m_aggregatedResults.size() ) return; + + size_t nVertices = numberOfVertices(); + m_aggregatedVertexResults = std::vector( nVertices, std::numeric_limits::infinity() ); +#pragma omp parallel for + for ( int index = 0; index < static_cast( nVertices ); ++index ) + { + cvf::Vec2ui ij = m_contourMapGrid.ijFromVertexIndex( index ); + m_aggregatedVertexResults[index] = calculateValueAtVertex( ij.x(), ij.y() ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigContourMapProjection::sumTriangleAreas( const std::vector& triangles ) +{ + double sumArea = 0.0; + for ( size_t i = 0; i < triangles.size(); i += 3 ) + { + cvf::Vec3d v1( triangles[i].x(), triangles[i].y(), triangles[i].z() ); + cvf::Vec3d v2( triangles[i + 1].x(), triangles[i + 1].y(), triangles[i + 1].z() ); + cvf::Vec3d v3( triangles[i + 2].x(), triangles[i + 2].y(), triangles[i + 2].z() ); + double area = 0.5 * ( ( v3 - v1 ) ^ ( v2 - v1 ) ).length(); + sumArea += area; + } + return sumArea; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigContourMapProjection::interpolateValue( const cvf::Vec2d& gridPos2d ) const +{ + cvf::Vec2ui cellContainingPoint = m_contourMapGrid.ijFromLocalPos( gridPos2d ); + cvf::Vec2d cellCenter = m_contourMapGrid.cellCenterPosition( cellContainingPoint.x(), cellContainingPoint.y() ); + + double sampleSpacing = m_contourMapGrid.sampleSpacing(); + std::array x; + x[0] = cvf::Vec3d( cellCenter + cvf::Vec2d( -sampleSpacing * 0.5, -sampleSpacing * 0.5 ), 0.0 ); + x[1] = cvf::Vec3d( cellCenter + cvf::Vec2d( sampleSpacing * 0.5, -sampleSpacing * 0.5 ), 0.0 ); + x[2] = cvf::Vec3d( cellCenter + cvf::Vec2d( sampleSpacing * 0.5, sampleSpacing * 0.5 ), 0.0 ); + x[3] = cvf::Vec3d( cellCenter + cvf::Vec2d( -sampleSpacing * 0.5, sampleSpacing * 0.5 ), 0.0 ); + + cvf::Vec4d baryCentricCoords = cvf::GeometryTools::barycentricCoords( x[0], x[1], x[2], x[3], cvf::Vec3d( gridPos2d, 0.0 ) ); + + std::array v; + v[0] = cellContainingPoint; + v[1] = cvf::Vec2ui( cellContainingPoint.x() + 1u, cellContainingPoint.y() ); + v[2] = cvf::Vec2ui( cellContainingPoint.x() + 1u, cellContainingPoint.y() + 1u ); + v[3] = cvf::Vec2ui( cellContainingPoint.x(), cellContainingPoint.y() + 1u ); + + std::array vertexValues; + double validBarycentricCoordsSum = 0.0; + for ( int i = 0; i < 4; ++i ) + { + double vertexValue = valueAtVertex( v[i].x(), v[i].y() ); + if ( vertexValue == std::numeric_limits::infinity() ) + { + return std::numeric_limits::infinity(); + } + else + { + vertexValues[i] = vertexValue; + validBarycentricCoordsSum += baryCentricCoords[i]; + } + } + + if ( validBarycentricCoordsSum < 1.0e-8 ) + { + return std::numeric_limits::infinity(); + } + + // Calculate final value + double value = 0.0; + for ( int i = 0; i < 4; ++i ) + { + value += baryCentricCoords[i] / validBarycentricCoordsSum * vertexValues[i]; + } + + return value; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigContourMapProjection::valueInCell( unsigned int i, unsigned int j ) const +{ + size_t index = m_contourMapGrid.cellIndexFromIJ( i, j ); + if ( index < numberOfCells() ) + { + return m_aggregatedResults.at( index ); + } + return std::numeric_limits::infinity(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RigContourMapProjection::hasResultInCell( unsigned int i, unsigned int j ) const +{ + return !cellsAtIJ( i, j ).empty(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigContourMapProjection::calculateValueAtVertex( unsigned int vi, unsigned int vj ) const +{ + std::vector averageIs; + std::vector averageJs; + + if ( vi > 0u ) averageIs.push_back( vi - 1 ); + if ( vj > 0u ) averageJs.push_back( vj - 1 ); + if ( vi < m_contourMapGrid.mapSize().x() ) averageIs.push_back( vi ); + if ( vj < m_contourMapGrid.mapSize().y() ) averageJs.push_back( vj ); + + RiaWeightedMeanCalculator calc; + for ( unsigned int j : averageJs ) + { + for ( unsigned int i : averageIs ) + { + if ( hasResultInCell( i, j ) ) + { + calc.addValueAndWeight( valueInCell( i, j ), 1.0 ); + } + } + } + if ( calc.validAggregatedWeight() ) + { + return calc.weightedMean(); + } + return std::numeric_limits::infinity(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector> RigContourMapProjection::cellsAtIJ( unsigned int i, unsigned int j ) const +{ + size_t cellIndex = m_contourMapGrid.cellIndexFromIJ( i, j ); + if ( cellIndex < m_projected3dGridIndices.size() ) + { + return m_projected3dGridIndices[cellIndex]; + } + return std::vector>(); +} + +//-------------------------------------------------------------------------------------------------- +/// Vertex positions in local coordinates (add origin2d.x() for UTM x) +//-------------------------------------------------------------------------------------------------- +std::vector RigContourMapProjection::xVertexPositions() const +{ + return m_contourMapGrid.xVertexPositions(); +} + +//-------------------------------------------------------------------------------------------------- +/// Vertex positions in local coordinates (add origin2d.y() for UTM y) +//-------------------------------------------------------------------------------------------------- +std::vector RigContourMapProjection::yVertexPositions() const +{ + return m_contourMapGrid.yVertexPositions(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const std::vector& RigContourMapProjection::aggregatedResults() const +{ + return m_aggregatedResults; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const std::vector& RigContourMapProjection::aggregatedVertexResults() const +{ + return m_aggregatedVertexResults; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const std::vector>>& RigContourMapProjection::projected3dGridIndices() const +{ + return m_projected3dGridIndices; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigContourMapProjection::clearResults() +{ + m_aggregatedResults.clear(); + m_aggregatedVertexResults.clear(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigContourMapProjection::clearGridMapping() +{ + m_projected3dGridIndices.clear(); +} diff --git a/ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.h b/ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.h new file mode 100644 index 0000000000..0b68ac2e9e --- /dev/null +++ b/ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.h @@ -0,0 +1,119 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- 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 "RigContourMapCalculator.h" +#include "RigContourPolygonsTools.h" + +#include "cvfArray.h" +#include "cvfBoundingBox.h" +#include "cvfVector2.h" + +class RigContourMapGrid; +class RimGridView; +class RimRegularLegendConfig; + +//================================================================================================== +/// +/// +//================================================================================================== +class RigContourMapProjection +{ +public: + using CellIndexAndResult = std::pair; + + RigContourMapProjection( const RigContourMapGrid& ); + + void clearResults(); + void clearGridMapping(); + + void generateVertexResults(); + + double maxValue() const; + double minValue() const; + + double meanValue() const; + double sumAllValues() const; + + cvf::Vec2ui numberOfElementsIJ() const; + cvf::Vec2ui numberOfVerticesIJ() const; + + double valueAtVertex( unsigned int i, unsigned int j ) const; + + unsigned int numberOfCells() const; + unsigned int numberOfValidCells() const; + size_t numberOfVertices() const; + + bool checkForMapIntersection( const cvf::Vec3d& domainPoint3d, cvf::Vec2d* contourMapPoint, double* valueAtPoint ) const; + cvf::Vec3d origin3d() const; + + std::vector xVertexPositions() const; + std::vector yVertexPositions() const; + + // Use this function to get the result index into grid cell results. The index will differ if we have active cells + virtual size_t gridResultIndex( size_t globalCellIdx ) const; + + virtual size_t kLayer( size_t globalCellIdx ) const = 0; + virtual size_t kLayers() const = 0; + virtual std::vector findIntersectingCells( const cvf::BoundingBox& bbox ) const = 0; + virtual double calculateOverlapVolume( size_t globalCellIdx, const cvf::BoundingBox& bbox ) const = 0; + virtual double calculateRayLengthInCell( size_t globalCellIdx, const cvf::Vec3d& highestPoint, const cvf::Vec3d& lowestPoint ) const = 0; + virtual double getParameterWeightForCell( size_t globalCellIdx, const std::vector& parameterWeights ) const = 0; + virtual std::vector getMapCellVisibility( int viewStepIndex, RigContourMapCalculator::ResultAggregationEnum resultAggregation ) = 0; + + void setCellVisibility( cvf::ref cellVisibility ); + cvf::ref getCellVisibility() const; + + std::vector>> + generateGridMapping( RigContourMapCalculator::ResultAggregationEnum resultAggregation, const std::vector& weights ); + + double interpolateValue( const cvf::Vec2d& gridPosition2d ) const; + + const std::vector& aggregatedResults() const; + const std::vector& aggregatedVertexResults() const; + const std::vector>>& projected3dGridIndices() const; + + // Cell index and position conversion + std::vector cellsAtIJ( unsigned int i, unsigned int j ) const; + + static double maxValue( const std::vector& aggregatedResults ); + static double minValue( const std::vector& aggregatedResults ); + static double sumTriangleAreas( const std::vector& triangles ); + +protected: + double calculateValueInMapCell( unsigned int i, + unsigned int j, + const std::vector& gridCellValues, + RigContourMapCalculator::ResultAggregationEnum resultAggregation ) const; + + double valueInCell( unsigned int i, unsigned int j ) const; + bool hasResultInCell( unsigned int i, unsigned int j ) const; + double calculateValueAtVertex( unsigned int i, unsigned int j ) const; + +protected: + cvf::ref m_cellGridIdxVisibility; + std::vector m_aggregatedResults; + std::vector m_aggregatedVertexResults; + std::vector>> m_projected3dGridIndices; + + int m_currentResultTimestep; + std::vector m_mapCellVisibility; + + const RigContourMapGrid& m_contourMapGrid; +}; diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseContourMapProjection.cpp b/ApplicationLibCode/ReservoirDataModel/RigEclipseContourMapProjection.cpp new file mode 100644 index 0000000000..cee5e82926 --- /dev/null +++ b/ApplicationLibCode/ReservoirDataModel/RigEclipseContourMapProjection.cpp @@ -0,0 +1,334 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- 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 "RigEclipseContourMapProjection.h" + +#include "RigActiveCellInfo.h" +#include "RigCaseCellResultsData.h" +#include "RigCell.h" +#include "RigCellGeometryTools.h" +#include "RigContourMapCalculator.h" +#include "RigContourMapGrid.h" +#include "RigEclipseCaseData.h" +#include "RigEclipseResultAddress.h" +#include "RigHexIntersectionTools.h" +#include "RigMainGrid.h" + +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigEclipseContourMapProjection::RigEclipseContourMapProjection( const RigContourMapGrid& contourMapGrid, + RigEclipseCaseData& eclipseCaseData, + RigCaseCellResultsData& resultData ) + : RigContourMapProjection( contourMapGrid ) + , m_eclipseCaseData( eclipseCaseData ) + , m_resultData( resultData ) + , m_kLayers( 0u ) + , m_useActiveCellInfo( true ) +{ + m_mainGrid = m_eclipseCaseData.mainGrid(); + m_activeCellInfo = m_eclipseCaseData.activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL ); + m_kLayers = m_mainGrid->cellCountK(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigEclipseContourMapProjection::~RigEclipseContourMapProjection() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigEclipseContourMapProjection::generateAndSaveResults( const RigEclipseResultAddress& resultAddress, + RigContourMapCalculator::ResultAggregationEnum resultAggregation, + int timeStep ) +{ + std::tie( m_useActiveCellInfo, m_aggregatedResults ) = + generateResults( *this, m_contourMapGrid, m_resultData, resultAddress, resultAggregation, timeStep ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigEclipseContourMapProjection::generateResults( const RigEclipseResultAddress& resultAddress, + RigContourMapCalculator::ResultAggregationEnum resultAggregation, + int timeStep ) const +{ + std::pair> result = + generateResults( *this, m_contourMapGrid, m_resultData, resultAddress, resultAggregation, timeStep ); + return result.second; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::pair> + RigEclipseContourMapProjection::generateResults( const RigEclipseContourMapProjection& contourMapProjection, + const RigContourMapGrid& contourMapGrid, + RigCaseCellResultsData& resultData, + const RigEclipseResultAddress& resultAddress, + RigContourMapCalculator::ResultAggregationEnum resultAggregation, + int timeStep ) +{ + size_t nCells = contourMapProjection.numberOfCells(); + + std::vector aggregatedResults = std::vector( nCells, std::numeric_limits::infinity() ); + + bool useActiveCellInfo = resultAddress.isValid() && resultData.hasResultEntry( resultAddress ) && + resultData.isUsingGlobalActiveIndex( resultAddress ); + + auto isTernaryResult = []( const RigEclipseResultAddress& address ) -> bool + { + return address.resultCatType() == RiaDefines::ResultCatType::DYNAMIC_NATIVE && + ( address.resultName().compare( RiaResultNames::ternarySaturationResultName(), Qt::CaseInsensitive ) == 0 ); + }; + + if ( !isTernaryResult( resultAddress ) ) + { + std::vector gridResultValues; + if ( RigContourMapCalculator::isColumnResult( resultAggregation ) ) + { + resultData.ensureKnownResultLoaded( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "PORO" ) ); + resultData.ensureKnownResultLoaded( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "NTG" ) ); + resultData.ensureKnownResultLoaded( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "DZ" ) ); + if ( resultAggregation == RigContourMapCalculator::RESULTS_OIL_COLUMN || + resultAggregation == RigContourMapCalculator::RESULTS_HC_COLUMN ) + { + resultData.ensureKnownResultLoaded( + RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::soil() ) ); + } + if ( resultAggregation == RigContourMapCalculator::RESULTS_GAS_COLUMN || + resultAggregation == RigContourMapCalculator::RESULTS_HC_COLUMN ) + { + resultData.ensureKnownResultLoaded( + RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::sgas() ) ); + } + gridResultValues = calculateColumnResult( resultData, resultAggregation, timeStep ); + } + else + { + // TODO: this was RimEclipseCellColors->hasStaticResult() + if ( resultAddress.resultCatType() == RiaDefines::ResultCatType::STATIC_NATIVE && timeStep > 0 ) timeStep = 0; + + // When loading a project file, grid calculator results are not computed the first time this function is + // called. Must check if result is loaded. See RimReloadCaseTools::updateAll3dViews() + if ( resultAddress.isValid() && resultData.hasResultEntry( resultAddress ) && resultData.isResultLoaded( resultAddress ) ) + { + gridResultValues = resultData.cellScalarResults( resultAddress, timeStep ); + } + } + + if ( !gridResultValues.empty() ) + { +#pragma omp parallel for + for ( int index = 0; index < static_cast( nCells ); ++index ) + { + cvf::Vec2ui ij = contourMapGrid.ijFromCellIndex( index ); + const std::vector>& matchingCells = contourMapProjection.cellsAtIJ( ij.x(), ij.y() ); + aggregatedResults[index] = + RigContourMapCalculator::calculateValueInMapCell( contourMapProjection, matchingCells, gridResultValues, resultAggregation ); + } + } + } + + return { useActiveCellInfo, aggregatedResults }; +} + +std::vector RigEclipseContourMapProjection::calculateColumnResult( RigContourMapCalculator::ResultAggregationEnum resultAggregation, + int timeStep ) const +{ + return calculateColumnResult( m_resultData, resultAggregation, timeStep ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigEclipseContourMapProjection::calculateColumnResult( RigCaseCellResultsData& resultData, + RigContourMapCalculator::ResultAggregationEnum resultAggregation, + int timeStep ) +{ + bool hasPoroResult = resultData.hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "PORO" ) ); + bool hasNtgResult = resultData.hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "NTG" ) ); + bool hasDzResult = resultData.hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "DZ" ) ); + + if ( !( hasPoroResult && hasNtgResult && hasDzResult ) ) + { + return std::vector(); + } + + const std::vector& poroResults = + resultData.cellScalarResults( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "PORO" ), 0 ); + const std::vector& ntgResults = + resultData.cellScalarResults( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "NTG" ), 0 ); + const std::vector& dzResults = + resultData.cellScalarResults( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "DZ" ), 0 ); + + CVF_ASSERT( poroResults.size() == ntgResults.size() && ntgResults.size() == dzResults.size() ); + + std::vector resultValues( poroResults.size(), 0.0 ); + + if ( resultAggregation == RigContourMapCalculator::RESULTS_OIL_COLUMN || resultAggregation == RigContourMapCalculator::RESULTS_HC_COLUMN ) + { + const std::vector& soilResults = + resultData.cellScalarResults( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::soil() ), + timeStep ); + for ( size_t cellResultIdx = 0; cellResultIdx < resultValues.size(); ++cellResultIdx ) + { + resultValues[cellResultIdx] = soilResults[cellResultIdx]; + } + } + + if ( resultAggregation == RigContourMapCalculator::RESULTS_GAS_COLUMN || resultAggregation == RigContourMapCalculator::RESULTS_HC_COLUMN ) + { + bool hasGasResult = + resultData.hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::sgas() ) ); + if ( hasGasResult ) + { + const std::vector& sgasResults = + resultData.cellScalarResults( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::sgas() ), + timeStep ); + for ( size_t cellResultIdx = 0; cellResultIdx < resultValues.size(); ++cellResultIdx ) + { + resultValues[cellResultIdx] += sgasResults[cellResultIdx]; + } + } + } + + for ( size_t cellResultIdx = 0; cellResultIdx < resultValues.size(); ++cellResultIdx ) + { + resultValues[cellResultIdx] *= poroResults[cellResultIdx] * ntgResults[cellResultIdx] * dzResults[cellResultIdx]; + } + + return resultValues; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigEclipseContourMapProjection::findIntersectingCells( const cvf::BoundingBox& bbox ) const +{ + return m_mainGrid->findIntersectingCells( bbox ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +size_t RigEclipseContourMapProjection::kLayer( size_t globalCellIdx ) const +{ + const RigCell& cell = m_mainGrid->cell( globalCellIdx ); + size_t mainGridCellIdx = cell.mainGridCellIndex(); + size_t i, j, k; + m_mainGrid->ijkFromCellIndex( mainGridCellIdx, &i, &j, &k ); + return k; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +size_t RigEclipseContourMapProjection::kLayers() const +{ + return m_kLayers; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigEclipseContourMapProjection::calculateOverlapVolume( size_t globalCellIdx, const cvf::BoundingBox& bbox ) const +{ + std::array hexCorners; + + const RigCell& cell = m_mainGrid->cell( globalCellIdx ); + + size_t localCellIdx = cell.gridLocalCellIndex(); + RigGridBase* localGrid = cell.hostGrid(); + + localGrid->cellCornerVertices( localCellIdx, hexCorners.data() ); + + cvf::BoundingBox overlapBBox; + std::array overlapCorners; + if ( RigCellGeometryTools::estimateHexOverlapWithBoundingBox( hexCorners, bbox, &overlapCorners, &overlapBBox ) ) + { + double overlapVolume = RigCellGeometryTools::calculateCellVolume( overlapCorners ); + return overlapVolume; + } + return 0.0; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigEclipseContourMapProjection::calculateRayLengthInCell( size_t globalCellIdx, + const cvf::Vec3d& highestPoint, + const cvf::Vec3d& lowestPoint ) const +{ + std::array hexCorners; + + const RigCell& cell = m_mainGrid->cell( globalCellIdx ); + + size_t localCellIdx = cell.gridLocalCellIndex(); + RigGridBase* localGrid = cell.hostGrid(); + + localGrid->cellCornerVertices( localCellIdx, hexCorners.data() ); + std::vector intersections; + + if ( RigHexIntersectionTools::lineHexCellIntersection( highestPoint, lowestPoint, hexCorners.data(), 0, &intersections ) ) + { + double lengthInCell = ( intersections.back().m_intersectionPoint - intersections.front().m_intersectionPoint ).length(); + return lengthInCell; + } + return 0.0; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigEclipseContourMapProjection::getParameterWeightForCell( size_t cellResultIdx, const std::vector& cellWeights ) const +{ + if ( cellWeights.empty() ) return 1.0; + + double result = std::max( cellWeights[cellResultIdx], 0.0 ); + if ( result < 1.0e-6 ) + { + result = 0.0; + } + return result; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +size_t RigEclipseContourMapProjection::gridResultIndex( size_t globalCellIdx ) const +{ + if ( m_useActiveCellInfo ) return m_activeCellInfo->cellResultIndex( globalCellIdx ); + + return globalCellIdx; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigEclipseContourMapProjection::getMapCellVisibility( int viewStepIndex, + RigContourMapCalculator::ResultAggregationEnum resultAggregation ) + +{ + return std::vector( numberOfCells(), true ); +} diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseContourMapProjection.h b/ApplicationLibCode/ReservoirDataModel/RigEclipseContourMapProjection.h new file mode 100644 index 0000000000..18cc04c141 --- /dev/null +++ b/ApplicationLibCode/ReservoirDataModel/RigEclipseContourMapProjection.h @@ -0,0 +1,88 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- 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 "RigContourMapCalculator.h" +#include "RigContourMapProjection.h" + +#include "cvfBoundingBox.h" + +class RigActiveCellInfo; +class RigMainGrid; +class RigContourMapGrid; +class RigResultAccessor; +class RigEclipseCaseData; +class RigCaseCellResultsData; +class RigEclipseResultAddress; + +//================================================================================================== +/// +/// +//================================================================================================== +class RigEclipseContourMapProjection : public RigContourMapProjection +{ +public: + RigEclipseContourMapProjection( const RigContourMapGrid& contourMapGrid, + RigEclipseCaseData& eclipseCaseData, + RigCaseCellResultsData& resultData ); + virtual ~RigEclipseContourMapProjection(); + + void generateAndSaveResults( const RigEclipseResultAddress& resultAddress, + RigContourMapCalculator::ResultAggregationEnum resultAggregation, + int timeStep ); + + std::vector generateResults( const RigEclipseResultAddress& resultAddress, + RigContourMapCalculator::ResultAggregationEnum resultAggregation, + int timeStep ) const; + + static std::pair> generateResults( const RigEclipseContourMapProjection& contourMapProjection, + const RigContourMapGrid& contourMapGrid, + RigCaseCellResultsData& resultData, + const RigEclipseResultAddress& resultAddress, + RigContourMapCalculator::ResultAggregationEnum resultAggregation, + int timeStep ); + + std::vector getMapCellVisibility( int viewStepIndex, RigContourMapCalculator::ResultAggregationEnum resultAggregation ) override; + +protected: + using CellIndexAndResult = RigContourMapProjection::CellIndexAndResult; + + std::vector findIntersectingCells( const cvf::BoundingBox& bbox ) const override; + size_t kLayer( size_t globalCellIdx ) const override; + size_t kLayers() const override; + double calculateOverlapVolume( size_t globalCellIdx, const cvf::BoundingBox& bbox ) const override; + double calculateRayLengthInCell( size_t globalCellIdx, const cvf::Vec3d& highestPoint, const cvf::Vec3d& lowestPoint ) const override; + double getParameterWeightForCell( size_t cellResultIdx, const std::vector& parameterWeights ) const override; + size_t gridResultIndex( size_t globalCellIdx ) const override; + + // Eclipse implementation specific data generation methods + std::vector calculateColumnResult( RigContourMapCalculator::ResultAggregationEnum resultAggregation, int timeStep ) const; + + static std::vector calculateColumnResult( RigCaseCellResultsData& resultData, + RigContourMapCalculator::ResultAggregationEnum resultAggregation, + int timeStep ); + +protected: + RigEclipseCaseData& m_eclipseCaseData; + RigCaseCellResultsData& m_resultData; + cvf::ref m_mainGrid; + cvf::ref m_activeCellInfo; + size_t m_kLayers; + bool m_useActiveCellInfo; +}; diff --git a/ApplicationLibCode/ReservoirDataModel/RigGeoMechContourMapProjection.cpp b/ApplicationLibCode/ReservoirDataModel/RigGeoMechContourMapProjection.cpp new file mode 100644 index 0000000000..58c9fe6108 --- /dev/null +++ b/ApplicationLibCode/ReservoirDataModel/RigGeoMechContourMapProjection.cpp @@ -0,0 +1,381 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- 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 "RigGeoMechContourMapProjection.h" + +#include "RiaImageTools.h" +#include "RiaWeightedMeanCalculator.h" + +#include "RigCellGeometryTools.h" +#include "RigContourMapCalculator.h" +#include "RigContourMapGrid.h" +#include "RigFemAddressDefines.h" +#include "RigFemPart.h" +#include "RigFemPartCollection.h" +#include "RigFemPartGrid.h" +#include "RigFemPartResultsCollection.h" +#include "RigGeoMechCaseData.h" +#include "RigHexIntersectionTools.h" + +#include "RivFemElmVisibilityCalculator.h" + +#include "cvfVector3.h" + +#include +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigGeoMechContourMapProjection::RigGeoMechContourMapProjection( RigGeoMechCaseData& caseData, + const RigContourMapGrid& contourMapGrid, + bool limitToPorePressureRegions, + double paddingAroundPorePressureRegion ) + : RigContourMapProjection( contourMapGrid ) + , m_caseData( caseData ) + , m_limitToPorePressureRegions( limitToPorePressureRegions ) + , m_paddingAroundPorePressureRegion( paddingAroundPorePressureRegion ) + , m_kLayers( 0u ) +{ + m_femPart = m_caseData.femParts()->part( 0 ); + m_femPartGrid = m_femPart->getOrCreateStructGrid(); + m_kLayers = m_femPartGrid->cellCountK(); + m_femPart->ensureIntersectionSearchTreeIsBuilt(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::BoundingBox RigGeoMechContourMapProjection::calculateExpandedPorBarBBox( RigGeoMechCaseData& caseData, + const std::string& resultComponentName, + int timeStep, + int frameIndex, + double paddingAroundPorePressureRegion ) +{ + RigFemResultAddress porBarAddr( RigFemResultPosEnum::RIG_ELEMENT_NODAL, RigFemAddressDefines::porBar(), resultComponentName ); + RigFemPartResultsCollection* resultCollection = caseData.femPartResults(); + + const std::vector& resultValues = resultCollection->resultValues( porBarAddr, 0, timeStep, frameIndex ); + cvf::BoundingBox boundingBox; + + if ( resultValues.empty() ) + { + return boundingBox; + } + + auto femPart = caseData.femParts()->part( 0 ); + auto femPartGrid = femPart->getOrCreateStructGrid(); + for ( int i = 0; i < femPart->elementCount(); ++i ) + { + size_t resValueIdx = femPart->elementNodeResultIdx( (int)i, 0 ); + CVF_ASSERT( resValueIdx < resultValues.size() ); + double scalarValue = resultValues[resValueIdx]; + bool validPorValue = scalarValue != std::numeric_limits::infinity(); + + if ( validPorValue ) + { + std::array hexCorners; + femPartGrid->cellCornerVertices( i, hexCorners.data() ); + for ( size_t c = 0; c < 8; ++c ) + { + boundingBox.add( hexCorners[c] ); + } + } + } + + cvf::Vec3d boxMin = boundingBox.min(); + cvf::Vec3d boxMax = boundingBox.max(); + cvf::Vec3d boxExtent = boundingBox.extent(); + boxMin.x() -= boxExtent.x() * 0.5 * paddingAroundPorePressureRegion; + boxMin.y() -= boxExtent.y() * 0.5 * paddingAroundPorePressureRegion; + boxMax.x() += boxExtent.x() * 0.5 * paddingAroundPorePressureRegion; + boxMax.y() += boxExtent.y() * 0.5 * paddingAroundPorePressureRegion; + return cvf::BoundingBox( boxMin, boxMax ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigGeoMechContourMapProjection::getMapCellVisibility( int viewStepIndex, + RigContourMapCalculator::ResultAggregationEnum resultAggregation ) +{ + return getMapCellVisibility( m_currentResultAddr, viewStepIndex, resultAggregation ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigGeoMechContourMapProjection::getMapCellVisibility( RigFemResultAddress resAddr, + int viewStepIndex, + RigContourMapCalculator::ResultAggregationEnum resultAggregation ) +{ + cvf::Vec2ui nCellsIJ = numberOfElementsIJ(); + std::vector> distanceImage( nCellsIJ.x(), std::vector( nCellsIJ.y(), 0u ) ); + + std::vector mapCellVisibility; + + if ( m_limitToPorePressureRegions ) + { + resAddr = RigFemAddressDefines::elementNodalPorBarAddress(); + } + + std::vector cellResults = generateResultsFromAddress( resAddr, mapCellVisibility, resultAggregation, viewStepIndex ); + + mapCellVisibility.resize( numberOfCells(), true ); + CVF_ASSERT( mapCellVisibility.size() == cellResults.size() ); + + { + cvf::BoundingBox validResBoundingBox; + for ( size_t cellIndex = 0; cellIndex < cellResults.size(); ++cellIndex ) + { + cvf::Vec2ui ij = m_contourMapGrid.ijFromCellIndex( cellIndex ); + if ( cellResults[cellIndex] != std::numeric_limits::infinity() ) + { + distanceImage[ij.x()][ij.y()] = 1u; + validResBoundingBox.add( cvf::Vec3d( m_contourMapGrid.cellCenterPosition( ij.x(), ij.y() ), 0.0 ) ); + } + else + { + mapCellVisibility[cellIndex] = false; + } + } + + if ( m_limitToPorePressureRegions && m_paddingAroundPorePressureRegion > 0.0 ) + { + RiaImageTools::distanceTransform2d( distanceImage ); + + 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_contourMapGrid.sampleSpacing() ); + for ( size_t cellIndex = 0; cellIndex < cellResults.size(); ++cellIndex ) + { + if ( !mapCellVisibility[cellIndex] ) + { + cvf::Vec2ui ij = m_contourMapGrid.ijFromCellIndex( cellIndex ); + if ( distanceImage[ij.x()][ij.y()] < cellPadding * cellPadding ) + { + mapCellVisibility[cellIndex] = true; + } + } + } + } + } + return mapCellVisibility; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigGeoMechContourMapProjection::generateAndSaveResults( RigFemResultAddress resultAddress, + RigContourMapCalculator::ResultAggregationEnum resultAggregation, + int viewerStepIndex ) +{ + m_aggregatedResults = generateResultsFromAddress( resultAddress, m_mapCellVisibility, resultAggregation, viewerStepIndex ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigGeoMechContourMapProjection::generateResultsFromAddress( RigFemResultAddress resultAddress, + const std::vector& mapCellVisibility, + RigContourMapCalculator::ResultAggregationEnum resultAggregation, + int viewerStepIndex ) const +{ + RigFemPartResultsCollection* resultCollection = m_caseData.femPartResults(); + size_t nCells = numberOfCells(); + std::vector aggregatedResults = std::vector( nCells, std::numeric_limits::infinity() ); + + auto [stepIdx, frameIdx] = m_caseData.femPartResults()->stepListIndexToTimeStepAndDataFrameIndex( viewerStepIndex ); + + bool wasInvalid = false; + if ( !resultAddress.isValid() ) + { + wasInvalid = true; + resultAddress = RigFemAddressDefines::elementNodalPorBarAddress(); + } + + if ( resultAddress.fieldName == "PP" ) + { + resultAddress.fieldName = RigFemAddressDefines::porBar(); // More likely to be in memory than POR + } + if ( resultAddress.fieldName == RigFemAddressDefines::porBar() ) + { + resultAddress.resultPosType = RIG_ELEMENT_NODAL; + } + else if ( resultAddress.resultPosType == RIG_FORMATION_NAMES ) + { + resultAddress.resultPosType = RIG_ELEMENT_NODAL; // formation indices are stored per element node result. + } + + std::vector resultValuesF = resultCollection->resultValues( resultAddress, 0, stepIdx, frameIdx ); + if ( resultValuesF.empty() ) return aggregatedResults; + + std::vector resultValues = gridCellValues( resultAddress, resultValuesF ); + + if ( wasInvalid ) + { + // For invalid result addresses we just use the POR-Bar result to get the reservoir region + // And display a dummy 0-result in the region. + for ( double& value : resultValues ) + { + if ( value != std::numeric_limits::infinity() ) + { + value = 0.0; + } + } + } + +#pragma omp parallel for + for ( int index = 0; index < static_cast( nCells ); ++index ) + { + if ( mapCellVisibility.empty() || mapCellVisibility[index] ) + { + cvf::Vec2ui ij = m_contourMapGrid.ijFromCellIndex( index ); + aggregatedResults[index] = calculateValueInMapCell( ij.x(), ij.y(), resultValues, resultAggregation ); + } + } + + return aggregatedResults; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigGeoMechContourMapProjection::findIntersectingCells( const cvf::BoundingBox& bbox ) const +{ + return m_femPart->findIntersectingElementsWithExistingSearchTree( bbox ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +size_t RigGeoMechContourMapProjection::kLayer( size_t globalCellIdx ) const +{ + size_t i, j, k; + m_femPartGrid->ijkFromCellIndex( globalCellIdx, &i, &j, &k ); + return k; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +size_t RigGeoMechContourMapProjection::kLayers() const +{ + return m_kLayers; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigGeoMechContourMapProjection::calculateOverlapVolume( size_t globalCellIdx, const cvf::BoundingBox& bbox ) const +{ + std::array hexCorners; + m_femPartGrid->cellCornerVertices( globalCellIdx, hexCorners.data() ); + + cvf::BoundingBox overlapBBox; + std::array overlapCorners; + if ( RigCellGeometryTools::estimateHexOverlapWithBoundingBox( hexCorners, bbox, &overlapCorners, &overlapBBox ) ) + { + double overlapVolume = RigCellGeometryTools::calculateCellVolume( overlapCorners ); + return overlapVolume; + } + return 0.0; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigGeoMechContourMapProjection::calculateRayLengthInCell( size_t globalCellIdx, + const cvf::Vec3d& highestPoint, + const cvf::Vec3d& lowestPoint ) const +{ + std::array hexCorners; + + const std::vector& nodeCoords = m_femPart->nodes().coordinates; + const int* cornerIndices = m_femPart->connectivities( globalCellIdx ); + + hexCorners[0] = cvf::Vec3d( nodeCoords[cornerIndices[0]] ); + hexCorners[1] = cvf::Vec3d( nodeCoords[cornerIndices[1]] ); + hexCorners[2] = cvf::Vec3d( nodeCoords[cornerIndices[2]] ); + hexCorners[3] = cvf::Vec3d( nodeCoords[cornerIndices[3]] ); + hexCorners[4] = cvf::Vec3d( nodeCoords[cornerIndices[4]] ); + hexCorners[5] = cvf::Vec3d( nodeCoords[cornerIndices[5]] ); + hexCorners[6] = cvf::Vec3d( nodeCoords[cornerIndices[6]] ); + hexCorners[7] = cvf::Vec3d( nodeCoords[cornerIndices[7]] ); + + std::vector intersections; + + if ( RigHexIntersectionTools::lineHexCellIntersection( highestPoint, lowestPoint, hexCorners.data(), 0, &intersections ) ) + { + double lengthInCell = ( intersections.back().m_intersectionPoint - intersections.front().m_intersectionPoint ).length(); + return lengthInCell; + } + return 0.0; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigGeoMechContourMapProjection::getParameterWeightForCell( size_t globalCellIdx, const std::vector& parameterWeights ) const +{ + if ( parameterWeights.empty() ) return 1.0; + + return parameterWeights[globalCellIdx]; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigGeoMechContourMapProjection::gridCellValues( RigFemResultAddress resAddr, std::vector& resultValues ) const +{ + std::vector gridCellValues( m_femPart->elementCount(), std::numeric_limits::infinity() ); + for ( size_t globalCellIdx = 0; globalCellIdx < static_cast( m_femPart->elementCount() ); ++globalCellIdx ) + { + RigElementType elmType = m_femPart->elementType( globalCellIdx ); + if ( !RigFemTypes::is8NodeElement( elmType ) ) continue; + + if ( resAddr.resultPosType == RIG_ELEMENT ) + { + gridCellValues[globalCellIdx] = static_cast( resultValues[globalCellIdx] ); + } + else if ( resAddr.resultPosType == RIG_ELEMENT_NODAL ) + { + RiaWeightedMeanCalculator cellAverage; + for ( int i = 0; i < 8; ++i ) + { + size_t gridResultValueIdx = + m_femPart->resultValueIdxFromResultPosType( resAddr.resultPosType, static_cast( globalCellIdx ), i ); + cellAverage.addValueAndWeight( resultValues[gridResultValueIdx], 1.0 ); + } + + gridCellValues[globalCellIdx] = static_cast( cellAverage.weightedMean() ); + } + else + { + RiaWeightedMeanCalculator cellAverage; + const int* elmNodeIndices = m_femPart->connectivities( globalCellIdx ); + for ( int i = 0; i < 8; ++i ) + { + cellAverage.addValueAndWeight( resultValues[elmNodeIndices[i]], 1.0 ); + } + gridCellValues[globalCellIdx] = static_cast( cellAverage.weightedMean() ); + } + } + return gridCellValues; +} diff --git a/ApplicationLibCode/ReservoirDataModel/RigGeoMechContourMapProjection.h b/ApplicationLibCode/ReservoirDataModel/RigGeoMechContourMapProjection.h new file mode 100644 index 0000000000..bba506e53b --- /dev/null +++ b/ApplicationLibCode/ReservoirDataModel/RigGeoMechContourMapProjection.h @@ -0,0 +1,81 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- 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 "RigContourMapCalculator.h" +#include "RigContourMapProjection.h" +#include "RigFemPart.h" +#include "RigFemResultAddress.h" + +#include "cvfBoundingBox.h" + +class RigGeoMechCaseData; + +//================================================================================================== +/// +/// +//================================================================================================== +class RigGeoMechContourMapProjection : public RigContourMapProjection +{ +public: + RigGeoMechContourMapProjection( RigGeoMechCaseData& caseData, + const RigContourMapGrid&, + bool limitToPorePressureRegions, + double paddingAroundPorePressureRegion ); + + void generateAndSaveResults( RigFemResultAddress resultAddress, + RigContourMapCalculator::ResultAggregationEnum resultAggregation, + int viewerStepIndex ); + + std::vector generateResultsFromAddress( RigFemResultAddress resultAddress, + const std::vector& mapCellVisibility, + RigContourMapCalculator::ResultAggregationEnum resultAggregation, + int viewerStepIndex ) const; + + static cvf::BoundingBox calculateExpandedPorBarBBox( RigGeoMechCaseData& caseData, + const std::string& resultComponentName, + int timeStep, + int frameIndex, + double padding ); + + std::vector getMapCellVisibility( int viewStepIndex, RigContourMapCalculator::ResultAggregationEnum resultAggregation ) override; + + std::vector getMapCellVisibility( RigFemResultAddress resAddr, + int viewStepIndex, + RigContourMapCalculator::ResultAggregationEnum resultAggregation ); + +protected: + // GeoMech implementation specific data generation methods + std::vector findIntersectingCells( const cvf::BoundingBox& bbox ) const override; + size_t kLayer( size_t globalCellIdx ) const override; + size_t kLayers() const override; + double calculateOverlapVolume( size_t globalCellIdx, const cvf::BoundingBox& bbox ) const override; + double calculateRayLengthInCell( size_t globalCellIdx, const cvf::Vec3d& highestPoint, const cvf::Vec3d& lowestPoint ) const override; + double getParameterWeightForCell( size_t globalCellIdx, const std::vector& parameterWeights ) const override; + std::vector gridCellValues( RigFemResultAddress resAddr, std::vector& resultValues ) const; + +protected: + RigGeoMechCaseData& m_caseData; + bool m_limitToPorePressureRegions; + double m_paddingAroundPorePressureRegion; + cvf::ref m_femPart; + cvf::cref m_femPartGrid; + RigFemResultAddress m_currentResultAddr; + size_t m_kLayers; +}; From 21f6cdbc1e614ff348d4e6b23c32e4e775b24a37 Mon Sep 17 00:00:00 2001 From: Arash Partow Date: Mon, 1 Jan 2024 00:00:00 +0000 Subject: [PATCH 103/160] Update ExprTk --- ThirdParty/expressionparser/exprtk/exprtk.hpp | 13147 +++++++++++----- 1 file changed, 9036 insertions(+), 4111 deletions(-) diff --git a/ThirdParty/expressionparser/exprtk/exprtk.hpp b/ThirdParty/expressionparser/exprtk/exprtk.hpp index a70adb8a9c..9e0cf6fcf6 100644 --- a/ThirdParty/expressionparser/exprtk/exprtk.hpp +++ b/ThirdParty/expressionparser/exprtk/exprtk.hpp @@ -2,7 +2,7 @@ ****************************************************************** * C++ Mathematical Expression Toolkit Library * * * - * Author: Arash Partow (1999-2023) * + * Author: Arash Partow (1999-2024) * * URL: https://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * @@ -10,6 +10,7 @@ * permitted under the guidelines and in accordance with the most * * current version of the MIT License. * * https://www.opensource.org/licenses/MIT * + * SPDX-License-Identifier: MIT * * * * Example expressions: * * (00) (y + x / y) * (x - y / x) * @@ -17,12 +18,12 @@ * (02) sqrt(1 - (x^2)) * * (03) 1 - sin(2 * x) + cos(pi / y) * * (04) a * exp(2 * t) + c * - * (05) if(((x + 2) == 3) and ((y + 5) <= 9),1 + w, 2 / z) * + * (05) if(((x + 2) == 3) and ((y + 5) <= 9), 1 + w, 2 / z) * * (06) (avg(x,y) <= x + y ? x - y : x * y) + 2 * pi / x * * (07) z := x + sin(2 * pi / y) * * (08) u := 2 * (pi * z) / (w := x + cos(y / pi)) * - * (09) clamp(-1,sin(2 * pi * x) + cos(y / 2 * pi),+1) * - * (10) inrange(-2,m,+2) == if(({-2 <= m} and [m <= +2]),1,0) * + * (09) clamp(-1, sin(2 * pi * x) + cos(y / 2 * pi), +1) * + * (10) inrange(-2, m, +2) == if(({-2 <= m} and [m <= +2]), 1, 0) * * (11) (2sin(x)cos(2y)7 + 1) == (2 * sin(x) * cos(2*y) * 7 + 1) * * (12) (x ilike 's*ri?g') and [y < (3 z^7 + w)] * * * @@ -42,7 +43,6 @@ #include #include #include -#include #include #include #include @@ -67,20 +67,6 @@ namespace exprtk #define exprtk_error_location \ "exprtk.hpp:" + details::to_str(__LINE__) \ - #if defined(__GNUC__) && (__GNUC__ >= 7) - - #define exprtk_disable_fallthrough_begin \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") \ - - #define exprtk_disable_fallthrough_end \ - _Pragma ("GCC diagnostic pop") \ - - #else - #define exprtk_disable_fallthrough_begin (void)0; - #define exprtk_disable_fallthrough_end (void)0; - #endif - #if __cplusplus >= 201103L #define exprtk_override override #define exprtk_final final @@ -91,6 +77,18 @@ namespace exprtk #define exprtk_delete #endif + #if __cplusplus >= 201603L + #define exprtk_fallthrough [[fallthrough]]; + #elif __cplusplus >= 201103L + #define exprtk_fallthrough [[gnu::fallthrough]]; + #else + #ifndef _MSC_VER + #define exprtk_fallthrough __attribute__ ((fallthrough)); + #else + #define exprtk_fallthrough + #endif + #endif + namespace details { typedef char char_t; @@ -218,15 +216,15 @@ namespace exprtk { const std::size_t length = std::min(s1.size(),s2.size()); - for (std::size_t i = 0; i < length; ++i) + for (std::size_t i = 0; i < length; ++i) { const char_t c1 = static_cast(std::tolower(s1[i])); const char_t c2 = static_cast(std::tolower(s2[i])); - if (c1 > c2) - return false; - else if (c1 < c2) + if (c1 < c2) return true; + else if (c2 < c1) + return false; } return s1.size() < s2.size(); @@ -364,9 +362,9 @@ namespace exprtk } else if (parse_hex(itr1, end, *itr2)) { - itr1+= 4; - itr2+= 1; - removal_count +=4; + itr1 += 4; + itr2 += 1; + removal_count += 4; } else if ('a' == (*itr1)) { (*itr2++) = '\a'; ++itr1; ++removal_count; } else if ('b' == (*itr1)) { (*itr2++) = '\b'; ++itr1; ++removal_count; } @@ -381,6 +379,7 @@ namespace exprtk (*itr2++) = (*itr1++); ++removal_count; } + continue; } else @@ -432,85 +431,85 @@ namespace exprtk }; static const std::string reserved_words[] = - { - "break", "case", "continue", "default", "false", "for", - "if", "else", "ilike", "in", "like", "and", "nand", "nor", - "not", "null", "or", "repeat", "return", "shl", "shr", - "swap", "switch", "true", "until", "var", "while", "xnor", - "xor", "&", "|" - }; + { + "assert", "break", "case", "continue", "const", "default", + "false", "for", "if", "else", "ilike", "in", "like", "and", + "nand", "nor", "not", "null", "or", "repeat", "return", + "shl", "shr", "swap", "switch", "true", "until", "var", + "while", "xnor", "xor", "&", "|" + }; static const std::size_t reserved_words_size = sizeof(reserved_words) / sizeof(std::string); static const std::string reserved_symbols[] = - { - "abs", "acos", "acosh", "and", "asin", "asinh", "atan", - "atanh", "atan2", "avg", "break", "case", "ceil", "clamp", - "continue", "cos", "cosh", "cot", "csc", "default", - "deg2grad", "deg2rad", "equal", "erf", "erfc", "exp", - "expm1", "false", "floor", "for", "frac", "grad2deg", - "hypot", "iclamp", "if", "else", "ilike", "in", "inrange", - "like", "log", "log10", "log2", "logn", "log1p", "mand", - "max", "min", "mod", "mor", "mul", "ncdf", "nand", "nor", - "not", "not_equal", "null", "or", "pow", "rad2deg", - "repeat", "return", "root", "round", "roundn", "sec", "sgn", - "shl", "shr", "sin", "sinc", "sinh", "sqrt", "sum", "swap", - "switch", "tan", "tanh", "true", "trunc", "until", "var", - "while", "xnor", "xor", "&", "|" - }; + { + "abs", "acos", "acosh", "and", "asin", "asinh", "assert", + "atan", "atanh", "atan2", "avg", "break", "case", "ceil", + "clamp", "continue", "const", "cos", "cosh", "cot", "csc", + "default", "deg2grad", "deg2rad", "equal", "erf", "erfc", + "exp", "expm1", "false", "floor", "for", "frac", "grad2deg", + "hypot", "iclamp", "if", "else", "ilike", "in", "inrange", + "like", "log", "log10", "log2", "logn", "log1p", "mand", + "max", "min", "mod", "mor", "mul", "ncdf", "nand", "nor", + "not", "not_equal", "null", "or", "pow", "rad2deg", + "repeat", "return", "root", "round", "roundn", "sec", "sgn", + "shl", "shr", "sin", "sinc", "sinh", "sqrt", "sum", "swap", + "switch", "tan", "tanh", "true", "trunc", "until", "var", + "while", "xnor", "xor", "&", "|" + }; static const std::size_t reserved_symbols_size = sizeof(reserved_symbols) / sizeof(std::string); static const std::string base_function_list[] = - { - "abs", "acos", "acosh", "asin", "asinh", "atan", "atanh", - "atan2", "avg", "ceil", "clamp", "cos", "cosh", "cot", - "csc", "equal", "erf", "erfc", "exp", "expm1", "floor", - "frac", "hypot", "iclamp", "like", "log", "log10", "log2", - "logn", "log1p", "mand", "max", "min", "mod", "mor", "mul", - "ncdf", "pow", "root", "round", "roundn", "sec", "sgn", - "sin", "sinc", "sinh", "sqrt", "sum", "swap", "tan", "tanh", - "trunc", "not_equal", "inrange", "deg2grad", "deg2rad", - "rad2deg", "grad2deg" - }; + { + "abs", "acos", "acosh", "asin", "asinh", "atan", "atanh", + "atan2", "avg", "ceil", "clamp", "cos", "cosh", "cot", + "csc", "equal", "erf", "erfc", "exp", "expm1", "floor", + "frac", "hypot", "iclamp", "like", "log", "log10", "log2", + "logn", "log1p", "mand", "max", "min", "mod", "mor", "mul", + "ncdf", "pow", "root", "round", "roundn", "sec", "sgn", + "sin", "sinc", "sinh", "sqrt", "sum", "swap", "tan", "tanh", + "trunc", "not_equal", "inrange", "deg2grad", "deg2rad", + "rad2deg", "grad2deg" + }; static const std::size_t base_function_list_size = sizeof(base_function_list) / sizeof(std::string); static const std::string logic_ops_list[] = - { - "and", "nand", "nor", "not", "or", "xnor", "xor", "&", "|" - }; + { + "and", "nand", "nor", "not", "or", "xnor", "xor", "&", "|" + }; static const std::size_t logic_ops_list_size = sizeof(logic_ops_list) / sizeof(std::string); static const std::string cntrl_struct_list[] = - { - "if", "switch", "for", "while", "repeat", "return" - }; + { + "if", "switch", "for", "while", "repeat", "return" + }; static const std::size_t cntrl_struct_list_size = sizeof(cntrl_struct_list) / sizeof(std::string); static const std::string arithmetic_ops_list[] = - { - "+", "-", "*", "/", "%", "^" - }; + { + "+", "-", "*", "/", "%", "^" + }; static const std::size_t arithmetic_ops_list_size = sizeof(arithmetic_ops_list) / sizeof(std::string); static const std::string assignment_ops_list[] = - { - ":=", "+=", "-=", - "*=", "/=", "%=" - }; + { + ":=", "+=", "-=", + "*=", "/=", "%=" + }; static const std::size_t assignment_ops_list_size = sizeof(assignment_ops_list) / sizeof(std::string); static const std::string inequality_ops_list[] = - { - "<", "<=", "==", - "=", "!=", "<>", - ">=", ">" - }; + { + "<", "<=", "==", + "=", "!=", "<>", + ">=", ">" + }; static const std::size_t inequality_ops_list_size = sizeof(inequality_ops_list) / sizeof(std::string); @@ -646,7 +645,7 @@ namespace exprtk } } else if (data_end == d_itr) - return true; + break; if ((data_end == d_itr) || (null_itr == nd_itr)) return false; @@ -661,23 +660,27 @@ namespace exprtk inline bool wc_match(const std::string& wild_card, const std::string& str) { - return match_impl( + return match_impl + ( wild_card.data(), wild_card.data() + wild_card.size(), str.data(), str.data() + str.size(), - '*', '?'); + '*', '?' + ); } inline bool wc_imatch(const std::string& wild_card, const std::string& str) { - return match_impl( + return match_impl + ( wild_card.data(), wild_card.data() + wild_card.size(), str.data(), str.data() + str.size(), - '*', '?'); + '*', '?' + ); } inline bool sequence_match(const std::string& pattern, @@ -750,13 +753,55 @@ namespace exprtk ); } - static const double pow10[] = { - 1.0, - 1.0E+001, 1.0E+002, 1.0E+003, 1.0E+004, - 1.0E+005, 1.0E+006, 1.0E+007, 1.0E+008, - 1.0E+009, 1.0E+010, 1.0E+011, 1.0E+012, - 1.0E+013, 1.0E+014, 1.0E+015, 1.0E+016 - }; + template + struct set_zero_value_impl + { + static inline void process(T* base_ptr, const std::size_t size) + { + const T zero = T(0); + for (std::size_t i = 0; i < size; ++i) + { + base_ptr[i] = zero; + } + } + }; + + #define pod_set_zero_value(T) \ + template <> \ + struct set_zero_value_impl \ + { \ + static inline void process(T* base_ptr, const std::size_t size) \ + { std::memset(base_ptr, 0x00, size * sizeof(T)); } \ + }; \ + + pod_set_zero_value(float ) + pod_set_zero_value(double ) + pod_set_zero_value(long double) + + #ifdef pod_set_zero_value + #undef pod_set_zero_value + #endif + + template + inline void set_zero_value(T* data, const std::size_t size) + { + set_zero_value_impl::process(data,size); + } + + template + inline void set_zero_value(std::vector& v) + { + set_zero_value(v.data(),v.size()); + } + + static const double pow10[] = + { + 1.0, + 1.0E+001, 1.0E+002, 1.0E+003, 1.0E+004, + 1.0E+005, 1.0E+006, 1.0E+007, 1.0E+008, + 1.0E+009, 1.0E+010, 1.0E+011, 1.0E+012, + 1.0E+013, 1.0E+014, 1.0E+015, 1.0E+016 + }; static const std::size_t pow10_size = sizeof(pow10) / sizeof(double); @@ -789,17 +834,17 @@ namespace exprtk number_type() {} }; - #define exprtk_register_real_type_tag(T) \ - template <> struct number_type \ - { typedef real_type_tag type; number_type() {} }; \ + #define exprtk_register_real_type_tag(T) \ + template <> struct number_type \ + { typedef real_type_tag type; number_type() {} }; \ - #define exprtk_register_int_type_tag(T) \ - template <> struct number_type \ - { typedef int_type_tag type; number_type() {} }; \ + #define exprtk_register_int_type_tag(T) \ + template <> struct number_type \ + { typedef int_type_tag type; number_type() {} }; \ + exprtk_register_real_type_tag(float ) exprtk_register_real_type_tag(double ) exprtk_register_real_type_tag(long double) - exprtk_register_real_type_tag(float ) exprtk_register_int_type_tag(short ) exprtk_register_int_type_tag(int ) @@ -848,6 +893,12 @@ namespace exprtk return static_cast<_int64_t>(v); } + template + inline _uint64_t to_uint64_impl(const T v, real_type_tag) + { + return static_cast<_uint64_t>(v); + } + template inline bool is_true_impl(const T v) { @@ -982,8 +1033,8 @@ namespace exprtk else return (T(-0.5) * v + T(1)) * v; } - else - return std::numeric_limits::quiet_NaN(); + + return std::numeric_limits::quiet_NaN(); } template @@ -993,8 +1044,8 @@ namespace exprtk { return std::log(T(1) + v); } - else - return std::numeric_limits::quiet_NaN(); + + return std::numeric_limits::quiet_NaN(); } template @@ -1193,9 +1244,9 @@ namespace exprtk #define exprtk_define_erf(TT, impl) \ inline TT erf_impl(const TT v) { return impl(v); } \ - exprtk_define_erf( float,::erff) - exprtk_define_erf( double,::erf ) - exprtk_define_erf(long double,::erfl) + exprtk_define_erf(float , ::erff) + exprtk_define_erf(double , ::erf ) + exprtk_define_erf(long double, ::erfl) #undef exprtk_define_erf #endif @@ -1204,13 +1255,14 @@ namespace exprtk { #if defined(_MSC_VER) && (_MSC_VER < 1900) // Credits: Abramowitz & Stegun Equations 7.1.25-28 - static const T c[] = { - T( 1.26551223), T(1.00002368), - T( 0.37409196), T(0.09678418), - T(-0.18628806), T(0.27886807), - T(-1.13520398), T(1.48851587), - T(-0.82215223), T(0.17087277) - }; + static const T c[] = + { + T( 1.26551223), T(1.00002368), + T( 0.37409196), T(0.09678418), + T(-0.18628806), T(0.27886807), + T(-1.13520398), T(1.48851587), + T(-0.82215223), T(0.17087277) + }; const T t = T(1) / (T(1) + T(0.5) * abs_impl(v,real_type_tag())); @@ -1262,10 +1314,7 @@ namespace exprtk template inline T ncdf_impl(const T v, real_type_tag) { - const T cnd = T(0.5) * (T(1) + - erf_impl(abs_impl(v,real_type_tag()) / - T(numeric::constant::sqrt2),real_type_tag())); - return (v < T(0)) ? (T(1) - cnd) : cnd; + return T(0.5) * erfc_impl(-(v / T(numeric::constant::sqrt2)),real_type_tag()); } template @@ -1289,12 +1338,47 @@ namespace exprtk return sinc_impl(static_cast(v),real_type_tag()); } + #if __cplusplus >= 201103L + template + inline T acosh_impl(const T v, real_type_tag) + { + return std::acosh(v); + } + + template + inline T asinh_impl(const T v, real_type_tag) + { + return std::asinh(v); + } + + template + inline T atanh_impl(const T v, real_type_tag) + { + return std::atanh(v); + } + #else + template + inline T acosh_impl(const T v, real_type_tag) + { + return std::log(v + std::sqrt((v * v) - T(1))); + } + + template + inline T asinh_impl(const T v, real_type_tag) + { + return std::log(v + std::sqrt((v * v) + T(1))); + } + + template + inline T atanh_impl(const T v, real_type_tag) + { + return (std::log(T(1) + v) - std::log(T(1) - v)) / T(2); + } + #endif + template inline T acos_impl(const T v, real_type_tag) { return std::acos (v); } - template inline T acosh_impl(const T v, real_type_tag) { return std::log(v + std::sqrt((v * v) - T(1))); } template inline T asin_impl(const T v, real_type_tag) { return std::asin (v); } - template inline T asinh_impl(const T v, real_type_tag) { return std::log(v + std::sqrt((v * v) + T(1))); } template inline T atan_impl(const T v, real_type_tag) { return std::atan (v); } - template inline T atanh_impl(const T v, real_type_tag) { return (std::log(T(1) + v) - std::log(T(1) - v)) / T(2); } template inline T ceil_impl(const T v, real_type_tag) { return std::ceil (v); } template inline T cos_impl(const T v, real_type_tag) { return std::cos (v); } template inline T cosh_impl(const T v, real_type_tag) { return std::cosh (v); } @@ -1390,6 +1474,13 @@ namespace exprtk return to_int64_impl(v, num_type); } + template + inline _uint64_t to_uint64(const T v) + { + const typename details::number_type::type num_type; + return to_uint64_impl(v, num_type); + } + template inline bool is_nan(const T v) { @@ -1629,38 +1720,38 @@ namespace exprtk { static const double fract10[] = { - 0.0, - 1.0E+001, 1.0E+002, 1.0E+003, 1.0E+004, 1.0E+005, 1.0E+006, 1.0E+007, 1.0E+008, 1.0E+009, 1.0E+010, - 1.0E+011, 1.0E+012, 1.0E+013, 1.0E+014, 1.0E+015, 1.0E+016, 1.0E+017, 1.0E+018, 1.0E+019, 1.0E+020, - 1.0E+021, 1.0E+022, 1.0E+023, 1.0E+024, 1.0E+025, 1.0E+026, 1.0E+027, 1.0E+028, 1.0E+029, 1.0E+030, - 1.0E+031, 1.0E+032, 1.0E+033, 1.0E+034, 1.0E+035, 1.0E+036, 1.0E+037, 1.0E+038, 1.0E+039, 1.0E+040, - 1.0E+041, 1.0E+042, 1.0E+043, 1.0E+044, 1.0E+045, 1.0E+046, 1.0E+047, 1.0E+048, 1.0E+049, 1.0E+050, - 1.0E+051, 1.0E+052, 1.0E+053, 1.0E+054, 1.0E+055, 1.0E+056, 1.0E+057, 1.0E+058, 1.0E+059, 1.0E+060, - 1.0E+061, 1.0E+062, 1.0E+063, 1.0E+064, 1.0E+065, 1.0E+066, 1.0E+067, 1.0E+068, 1.0E+069, 1.0E+070, - 1.0E+071, 1.0E+072, 1.0E+073, 1.0E+074, 1.0E+075, 1.0E+076, 1.0E+077, 1.0E+078, 1.0E+079, 1.0E+080, - 1.0E+081, 1.0E+082, 1.0E+083, 1.0E+084, 1.0E+085, 1.0E+086, 1.0E+087, 1.0E+088, 1.0E+089, 1.0E+090, - 1.0E+091, 1.0E+092, 1.0E+093, 1.0E+094, 1.0E+095, 1.0E+096, 1.0E+097, 1.0E+098, 1.0E+099, 1.0E+100, - 1.0E+101, 1.0E+102, 1.0E+103, 1.0E+104, 1.0E+105, 1.0E+106, 1.0E+107, 1.0E+108, 1.0E+109, 1.0E+110, - 1.0E+111, 1.0E+112, 1.0E+113, 1.0E+114, 1.0E+115, 1.0E+116, 1.0E+117, 1.0E+118, 1.0E+119, 1.0E+120, - 1.0E+121, 1.0E+122, 1.0E+123, 1.0E+124, 1.0E+125, 1.0E+126, 1.0E+127, 1.0E+128, 1.0E+129, 1.0E+130, - 1.0E+131, 1.0E+132, 1.0E+133, 1.0E+134, 1.0E+135, 1.0E+136, 1.0E+137, 1.0E+138, 1.0E+139, 1.0E+140, - 1.0E+141, 1.0E+142, 1.0E+143, 1.0E+144, 1.0E+145, 1.0E+146, 1.0E+147, 1.0E+148, 1.0E+149, 1.0E+150, - 1.0E+151, 1.0E+152, 1.0E+153, 1.0E+154, 1.0E+155, 1.0E+156, 1.0E+157, 1.0E+158, 1.0E+159, 1.0E+160, - 1.0E+161, 1.0E+162, 1.0E+163, 1.0E+164, 1.0E+165, 1.0E+166, 1.0E+167, 1.0E+168, 1.0E+169, 1.0E+170, - 1.0E+171, 1.0E+172, 1.0E+173, 1.0E+174, 1.0E+175, 1.0E+176, 1.0E+177, 1.0E+178, 1.0E+179, 1.0E+180, - 1.0E+181, 1.0E+182, 1.0E+183, 1.0E+184, 1.0E+185, 1.0E+186, 1.0E+187, 1.0E+188, 1.0E+189, 1.0E+190, - 1.0E+191, 1.0E+192, 1.0E+193, 1.0E+194, 1.0E+195, 1.0E+196, 1.0E+197, 1.0E+198, 1.0E+199, 1.0E+200, - 1.0E+201, 1.0E+202, 1.0E+203, 1.0E+204, 1.0E+205, 1.0E+206, 1.0E+207, 1.0E+208, 1.0E+209, 1.0E+210, - 1.0E+211, 1.0E+212, 1.0E+213, 1.0E+214, 1.0E+215, 1.0E+216, 1.0E+217, 1.0E+218, 1.0E+219, 1.0E+220, - 1.0E+221, 1.0E+222, 1.0E+223, 1.0E+224, 1.0E+225, 1.0E+226, 1.0E+227, 1.0E+228, 1.0E+229, 1.0E+230, - 1.0E+231, 1.0E+232, 1.0E+233, 1.0E+234, 1.0E+235, 1.0E+236, 1.0E+237, 1.0E+238, 1.0E+239, 1.0E+240, - 1.0E+241, 1.0E+242, 1.0E+243, 1.0E+244, 1.0E+245, 1.0E+246, 1.0E+247, 1.0E+248, 1.0E+249, 1.0E+250, - 1.0E+251, 1.0E+252, 1.0E+253, 1.0E+254, 1.0E+255, 1.0E+256, 1.0E+257, 1.0E+258, 1.0E+259, 1.0E+260, - 1.0E+261, 1.0E+262, 1.0E+263, 1.0E+264, 1.0E+265, 1.0E+266, 1.0E+267, 1.0E+268, 1.0E+269, 1.0E+270, - 1.0E+271, 1.0E+272, 1.0E+273, 1.0E+274, 1.0E+275, 1.0E+276, 1.0E+277, 1.0E+278, 1.0E+279, 1.0E+280, - 1.0E+281, 1.0E+282, 1.0E+283, 1.0E+284, 1.0E+285, 1.0E+286, 1.0E+287, 1.0E+288, 1.0E+289, 1.0E+290, - 1.0E+291, 1.0E+292, 1.0E+293, 1.0E+294, 1.0E+295, 1.0E+296, 1.0E+297, 1.0E+298, 1.0E+299, 1.0E+300, - 1.0E+301, 1.0E+302, 1.0E+303, 1.0E+304, 1.0E+305, 1.0E+306, 1.0E+307, 1.0E+308 + 0.0, + 1.0E+001, 1.0E+002, 1.0E+003, 1.0E+004, 1.0E+005, 1.0E+006, 1.0E+007, 1.0E+008, 1.0E+009, 1.0E+010, + 1.0E+011, 1.0E+012, 1.0E+013, 1.0E+014, 1.0E+015, 1.0E+016, 1.0E+017, 1.0E+018, 1.0E+019, 1.0E+020, + 1.0E+021, 1.0E+022, 1.0E+023, 1.0E+024, 1.0E+025, 1.0E+026, 1.0E+027, 1.0E+028, 1.0E+029, 1.0E+030, + 1.0E+031, 1.0E+032, 1.0E+033, 1.0E+034, 1.0E+035, 1.0E+036, 1.0E+037, 1.0E+038, 1.0E+039, 1.0E+040, + 1.0E+041, 1.0E+042, 1.0E+043, 1.0E+044, 1.0E+045, 1.0E+046, 1.0E+047, 1.0E+048, 1.0E+049, 1.0E+050, + 1.0E+051, 1.0E+052, 1.0E+053, 1.0E+054, 1.0E+055, 1.0E+056, 1.0E+057, 1.0E+058, 1.0E+059, 1.0E+060, + 1.0E+061, 1.0E+062, 1.0E+063, 1.0E+064, 1.0E+065, 1.0E+066, 1.0E+067, 1.0E+068, 1.0E+069, 1.0E+070, + 1.0E+071, 1.0E+072, 1.0E+073, 1.0E+074, 1.0E+075, 1.0E+076, 1.0E+077, 1.0E+078, 1.0E+079, 1.0E+080, + 1.0E+081, 1.0E+082, 1.0E+083, 1.0E+084, 1.0E+085, 1.0E+086, 1.0E+087, 1.0E+088, 1.0E+089, 1.0E+090, + 1.0E+091, 1.0E+092, 1.0E+093, 1.0E+094, 1.0E+095, 1.0E+096, 1.0E+097, 1.0E+098, 1.0E+099, 1.0E+100, + 1.0E+101, 1.0E+102, 1.0E+103, 1.0E+104, 1.0E+105, 1.0E+106, 1.0E+107, 1.0E+108, 1.0E+109, 1.0E+110, + 1.0E+111, 1.0E+112, 1.0E+113, 1.0E+114, 1.0E+115, 1.0E+116, 1.0E+117, 1.0E+118, 1.0E+119, 1.0E+120, + 1.0E+121, 1.0E+122, 1.0E+123, 1.0E+124, 1.0E+125, 1.0E+126, 1.0E+127, 1.0E+128, 1.0E+129, 1.0E+130, + 1.0E+131, 1.0E+132, 1.0E+133, 1.0E+134, 1.0E+135, 1.0E+136, 1.0E+137, 1.0E+138, 1.0E+139, 1.0E+140, + 1.0E+141, 1.0E+142, 1.0E+143, 1.0E+144, 1.0E+145, 1.0E+146, 1.0E+147, 1.0E+148, 1.0E+149, 1.0E+150, + 1.0E+151, 1.0E+152, 1.0E+153, 1.0E+154, 1.0E+155, 1.0E+156, 1.0E+157, 1.0E+158, 1.0E+159, 1.0E+160, + 1.0E+161, 1.0E+162, 1.0E+163, 1.0E+164, 1.0E+165, 1.0E+166, 1.0E+167, 1.0E+168, 1.0E+169, 1.0E+170, + 1.0E+171, 1.0E+172, 1.0E+173, 1.0E+174, 1.0E+175, 1.0E+176, 1.0E+177, 1.0E+178, 1.0E+179, 1.0E+180, + 1.0E+181, 1.0E+182, 1.0E+183, 1.0E+184, 1.0E+185, 1.0E+186, 1.0E+187, 1.0E+188, 1.0E+189, 1.0E+190, + 1.0E+191, 1.0E+192, 1.0E+193, 1.0E+194, 1.0E+195, 1.0E+196, 1.0E+197, 1.0E+198, 1.0E+199, 1.0E+200, + 1.0E+201, 1.0E+202, 1.0E+203, 1.0E+204, 1.0E+205, 1.0E+206, 1.0E+207, 1.0E+208, 1.0E+209, 1.0E+210, + 1.0E+211, 1.0E+212, 1.0E+213, 1.0E+214, 1.0E+215, 1.0E+216, 1.0E+217, 1.0E+218, 1.0E+219, 1.0E+220, + 1.0E+221, 1.0E+222, 1.0E+223, 1.0E+224, 1.0E+225, 1.0E+226, 1.0E+227, 1.0E+228, 1.0E+229, 1.0E+230, + 1.0E+231, 1.0E+232, 1.0E+233, 1.0E+234, 1.0E+235, 1.0E+236, 1.0E+237, 1.0E+238, 1.0E+239, 1.0E+240, + 1.0E+241, 1.0E+242, 1.0E+243, 1.0E+244, 1.0E+245, 1.0E+246, 1.0E+247, 1.0E+248, 1.0E+249, 1.0E+250, + 1.0E+251, 1.0E+252, 1.0E+253, 1.0E+254, 1.0E+255, 1.0E+256, 1.0E+257, 1.0E+258, 1.0E+259, 1.0E+260, + 1.0E+261, 1.0E+262, 1.0E+263, 1.0E+264, 1.0E+265, 1.0E+266, 1.0E+267, 1.0E+268, 1.0E+269, 1.0E+270, + 1.0E+271, 1.0E+272, 1.0E+273, 1.0E+274, 1.0E+275, 1.0E+276, 1.0E+277, 1.0E+278, 1.0E+279, 1.0E+280, + 1.0E+281, 1.0E+282, 1.0E+283, 1.0E+284, 1.0E+285, 1.0E+286, 1.0E+287, 1.0E+288, 1.0E+289, 1.0E+290, + 1.0E+291, 1.0E+292, 1.0E+293, 1.0E+294, 1.0E+295, 1.0E+296, 1.0E+297, 1.0E+298, 1.0E+299, 1.0E+300, + 1.0E+301, 1.0E+302, 1.0E+303, 1.0E+304, 1.0E+305, 1.0E+306, 1.0E+307, 1.0E+308 }; static const int fract10_size = static_cast(sizeof(fract10) / sizeof(double)); @@ -1710,7 +1801,6 @@ namespace exprtk if (length <= 4) { - exprtk_disable_fallthrough_begin switch (length) { #ifdef exprtk_use_lut @@ -1723,17 +1813,19 @@ namespace exprtk return_result = false; \ break; \ } \ + exprtk_fallthrough \ #else - #define exprtk_process_digit \ - if ((digit = (*itr++ - zero)) < 10) \ - result = result * T(10) + digit; \ - else \ - { \ - return_result = false; \ - break; \ - } \ + #define exprtk_process_digit \ + if ((digit = (*itr++ - zero)) < 10) \ + result = result * T(10) + digit; \ + else \ + { \ + return_result = false; \ + break; \ + } \ + exprtk_fallthrough \ #endif @@ -1748,7 +1840,6 @@ namespace exprtk #undef exprtk_process_digit } - exprtk_disable_fallthrough_end } else return_result = false; @@ -2067,14 +2158,74 @@ namespace exprtk virtual void handle_runtime_violation(const violation_context&) { - throw std::runtime_error("ExprTk Loop run-time violation."); + throw std::runtime_error("ExprTk Loop runtime violation."); } - virtual ~loop_runtime_check() {} + virtual ~loop_runtime_check() + {} }; typedef loop_runtime_check* loop_runtime_check_ptr; + struct vector_access_runtime_check + { + struct violation_context + { + void* base_ptr; + void* end_ptr; + void* access_ptr; + std::size_t type_size; + }; + + virtual ~vector_access_runtime_check() + {} + + virtual bool handle_runtime_violation(violation_context& /*context*/) + { + throw std::runtime_error("ExprTk runtime vector access violation."); + #if !defined(_MSC_VER) && !defined(__NVCOMPILER) + return false; + #endif + } + }; + + typedef vector_access_runtime_check* vector_access_runtime_check_ptr; + + struct assert_check + { + struct assert_context + { + std::string condition; + std::string message; + std::string id; + std::size_t offet; + }; + + virtual ~assert_check() + {} + + virtual void handle_assert(const assert_context& /*context*/) + { + } + }; + + typedef assert_check* assert_check_ptr; + + struct compilation_check + { + struct compilation_context + { + std::string error_message; + }; + + virtual bool continue_compilation(compilation_context& /*context*/) = 0; + + virtual ~compilation_check() + {} + }; + + typedef compilation_check* compilation_check_ptr; + namespace lexer { struct token @@ -2282,7 +2433,7 @@ namespace exprtk s_itr_ = str.data(); s_end_ = str.data() + str.size(); - eof_token_.set_operator(token_t::e_eof,s_end_,s_end_,base_itr_); + eof_token_.set_operator(token_t::e_eof, s_end_, s_end_, base_itr_); token_list_.clear(); while (!is_end(s_itr_)) @@ -2345,7 +2496,9 @@ namespace exprtk inline token_t& operator[](const std::size_t& index) { if (index < token_list_.size()) + { return token_list_[index]; + } else return eof_token_; } @@ -2353,7 +2506,9 @@ namespace exprtk inline token_t operator[](const std::size_t& index) const { if (index < token_list_.size()) + { return token_list_[index]; + } else return eof_token_; } @@ -2497,7 +2652,7 @@ namespace exprtk } } - ++s_itr_; + ++s_itr_; } if (2 == mode) @@ -2509,9 +2664,17 @@ namespace exprtk #endif } + inline bool next_is_digit(const details::char_cptr itr) const + { + return ((itr + 1) != s_end_) && + details::is_digit(*(itr + 1)); + } + inline void scan_token() { - if (details::is_whitespace(*s_itr_)) + const char_t c = *s_itr_; + + if (details::is_whitespace(c)) { skip_whitespace(); return; @@ -2521,34 +2684,39 @@ namespace exprtk skip_comments(); return; } - else if (details::is_operator_char(*s_itr_)) + else if (details::is_operator_char(c)) { scan_operator(); return; } - else if (details::is_letter(*s_itr_)) + else if (details::is_letter(c)) { scan_symbol(); return; } - else if (details::is_digit((*s_itr_)) || ('.' == (*s_itr_))) + else if (('.' == c) && !next_is_digit(s_itr_)) + { + scan_operator(); + return; + } + else if (details::is_digit(c) || ('.' == c)) { scan_number(); return; } - else if ('$' == (*s_itr_)) + else if ('$' == c) { scan_special_function(); return; } #ifndef exprtk_disable_string_capabilities - else if ('\'' == (*s_itr_)) + else if ('\'' == c) { scan_string(); return; } #endif - else if ('~' == (*s_itr_)) + else if ('~' == c) { token_t t; t.set_symbol(s_itr_, s_itr_ + 1, base_itr_); @@ -2658,7 +2826,7 @@ namespace exprtk } token_t t; - t.set_symbol(initial_itr,s_itr_,base_itr_); + t.set_symbol(initial_itr, s_itr_, base_itr_); token_list_.push_back(t); } @@ -2858,12 +3026,12 @@ namespace exprtk ((s_itr_ + 4) <= s_end_) ) { - const bool x_seperator = ('X' == std::toupper(*(s_itr_ + 1))); + const bool x_separator = ('X' == std::toupper(*(s_itr_ + 1))); const bool both_digits = details::is_hex_digit(*(s_itr_ + 2)) && details::is_hex_digit(*(s_itr_ + 3)) ; - if (!(x_seperator && both_digits)) + if (!(x_separator && both_digits)) { t.set_error(token::e_err_string, initial_itr, s_itr_, base_itr_); token_list_.push_back(t); @@ -2903,8 +3071,8 @@ namespace exprtk } t.set_string( - parsed_string, - static_cast(std::distance(base_itr_,initial_itr))); + parsed_string, + static_cast(std::distance(base_itr_,initial_itr))); } token_list_.push_back(t); @@ -2945,7 +3113,8 @@ namespace exprtk { public: - virtual ~token_scanner() {} + virtual ~token_scanner() + {} explicit token_scanner(const std::size_t& stride) : stride_(stride) @@ -3211,7 +3380,7 @@ namespace exprtk generator::token_list_t token_list; token_list.reserve(10000); - for (int i = 0; i < static_cast(g.token_list_.size() - 1); ++i) + for (int i = 0; i < static_cast(g.token_list_.size() - 1); ++i) { token t; @@ -3227,7 +3396,7 @@ namespace exprtk ++changes; - i+=2; + i += 2; if (static_cast(i) >= (g.token_list_.size() - 1)) break; @@ -3253,7 +3422,7 @@ namespace exprtk generator::token_list_t token_list; token_list.reserve(10000); - for (int i = 0; i < static_cast(g.token_list_.size() - 2); ++i) + for (int i = 0; i < static_cast(g.token_list_.size() - 2); ++i) { token t; @@ -3269,7 +3438,7 @@ namespace exprtk ++changes; - i+=3; + i += 3; if (static_cast(i) >= (g.token_list_.size() - 2)) break; @@ -3367,7 +3536,7 @@ namespace exprtk std::set ignore_set_; }; - class operator_joiner : public token_joiner + class operator_joiner exprtk_final : public token_joiner { public: @@ -3543,7 +3712,7 @@ namespace exprtk } }; - class bracket_checker : public lexer::token_scanner + class bracket_checker exprtk_final : public lexer::token_scanner { public: @@ -3554,7 +3723,7 @@ namespace exprtk , state_(true) {} - bool result() + bool result() exprtk_override { if (!stack_.empty()) { @@ -3575,7 +3744,7 @@ namespace exprtk return error_token_; } - void reset() + void reset() exprtk_override { // Why? because msvc doesn't support swap properly. stack_ = std::stack >(); @@ -3583,7 +3752,7 @@ namespace exprtk error_token_.clear(); } - bool operator() (const lexer::token& t) + bool operator() (const lexer::token& t) exprtk_override { if ( !t.value.empty() && @@ -3640,18 +3809,18 @@ namespace exprtk , current_index_(0) {} - bool result() + bool result() exprtk_override { return error_list_.empty(); } - void reset() + void reset() exprtk_override { error_list_.clear(); current_index_ = 0; } - bool operator() (const lexer::token& t) + bool operator() (const lexer::token& t) exprtk_override { if (token::e_number == t.type) { @@ -3692,7 +3861,7 @@ namespace exprtk std::vector error_list_; }; - class symbol_replacer : public lexer::token_modifier + class symbol_replacer exprtk_final : public lexer::token_modifier { private: @@ -3735,7 +3904,7 @@ namespace exprtk private: - bool modify(lexer::token& t) + bool modify(lexer::token& t) exprtk_override { if (lexer::token::e_symbol == t.type) { @@ -3798,12 +3967,12 @@ namespace exprtk add_invalid_set1(lexer::token::e_ternary); } - bool result() + bool result() exprtk_override { return error_list_.empty(); } - bool operator() (const lexer::token& t0, const lexer::token& t1) + bool operator() (const lexer::token& t0, const lexer::token& t1) exprtk_override { const set_t::value_type p = std::make_pair(t0.type,t1.type); @@ -3965,12 +4134,12 @@ namespace exprtk add_invalid(lexer::token::e_pow , lexer::token::e_mod , lexer::token::e_pow ); } - bool result() + bool result() exprtk_override { return error_list_.empty(); } - bool operator() (const lexer::token& t0, const lexer::token& t1, const lexer::token& t2) + bool operator() (const lexer::token& t0, const lexer::token& t1, const lexer::token& t2) exprtk_override { const set_t::value_type p = std::make_pair(t0.type,std::make_pair(t1.type,t2.type)); @@ -4227,6 +4396,11 @@ namespace exprtk return current_token_; } + inline const token_t& peek_next_token() + { + return lexer_.peek_next_token(); + } + enum token_advance_mode { e_hold = 0, @@ -4270,6 +4444,92 @@ namespace exprtk return true; } + inline bool token_is(const std::string& value, + const token_advance_mode mode = e_advance) + { + if (!exprtk::details::imatch(value,current_token().value)) + { + return false; + } + + advance_token(mode); + + return true; + } + + inline bool token_is_arithmetic_opr(const token_advance_mode mode = e_advance) + { + switch (current_token().type) + { + case token_t::e_add : + case token_t::e_sub : + case token_t::e_div : + case token_t::e_mul : + case token_t::e_mod : + case token_t::e_pow : break; + default : return false; + } + + advance_token(mode); + + return true; + } + + inline bool token_is_ineq_opr(const token_advance_mode mode = e_advance) + { + switch (current_token().type) + { + case token_t::e_eq : + case token_t::e_lte : + case token_t::e_ne : + case token_t::e_gte : + case token_t::e_lt : + case token_t::e_gt : break; + default : return false; + } + + advance_token(mode); + + return true; + } + + inline bool token_is_left_bracket(const token_advance_mode mode = e_advance) + { + switch (current_token().type) + { + case token_t::e_lbracket : + case token_t::e_lcrlbracket : + case token_t::e_lsqrbracket : break; + default : return false; + } + + advance_token(mode); + + return true; + } + + inline bool token_is_right_bracket(const token_advance_mode mode = e_advance) + { + switch (current_token().type) + { + case token_t::e_rbracket : + case token_t::e_rcrlbracket : + case token_t::e_rsqrbracket : break; + default : return false; + } + + advance_token(mode); + + return true; + } + + inline bool token_is_loop(const token_advance_mode mode = e_advance) + { + return token_is("for" , mode) || + token_is("while" , mode) || + token_is("repeat", mode) ; + } + inline bool peek_token_is(const token_t::token_type& ttype) { return (lexer_.peek_next_token().type == ttype); @@ -4296,16 +4556,22 @@ namespace exprtk typedef T* data_ptr_t; vector_view(data_ptr_t data, const std::size_t& size) - : size_(size) + : base_size_(size) + , size_(size) , data_(data) , data_ref_(0) - {} + { + assert(size_ > 0); + } vector_view(const vector_view& vv) - : size_(vv.size_) + : base_size_(vv.base_size_) + , size_(vv.size_) , data_(vv.data_) , data_ref_(0) - {} + { + assert(size_ > 0); + } inline void rebase(data_ptr_t data) { @@ -4325,6 +4591,11 @@ namespace exprtk return data_; } + inline std::size_t base_size() const + { + return base_size_; + } + inline std::size_t size() const { return size_; @@ -4332,22 +4603,55 @@ namespace exprtk inline const T& operator[](const std::size_t index) const { + assert(index < size_); return data_[index]; } inline T& operator[](const std::size_t index) { + assert(index < size_); return data_[index]; } void set_ref(data_ptr_t* data_ref) { data_ref_.push_back(data_ref); + exprtk_debug(("vector_view::set_ref() - data_ref: %p data_ref_.size(): %d\n", + reinterpret_cast(data_ref), + static_cast(data_ref_.size()))); + } + + void remove_ref(data_ptr_t* data_ref) + { + data_ref_.erase( + std::remove(data_ref_.begin(), data_ref_.end(), data_ref), + data_ref_.end()); + exprtk_debug(("vector_view::remove_ref() - data_ref: %p data_ref_.size(): %d\n", + reinterpret_cast(data_ref), + static_cast(data_ref_.size()))); + } + + bool set_size(const std::size_t new_size) + { + if ((new_size > 0) && (new_size <= base_size_)) + { + size_ = new_size; + exprtk_debug(("vector_view::set_size() - data_: %p size: %lu\n", + reinterpret_cast(data_), + size_)); + return true; + } + + exprtk_debug(("vector_view::set_size() - error invalid new_size: %lu base_size: %lu\n", + new_size, + base_size_)); + return false; } private: - const std::size_t size_; + const std::size_t base_size_; + std::size_t size_; data_ptr_t data_; std::vector data_ref_; }; @@ -4523,6 +4827,16 @@ namespace exprtk return v_; } + inline operator value_t() const + { + return v_; + } + + inline operator value_t() + { + return v_; + } + template inline bool to_int(IntType& i) const { @@ -4571,6 +4885,9 @@ namespace exprtk public: typedef type_store type_store_t; + typedef typename type_store_t::scalar_view scalar_t; + typedef typename type_store_t::vector_view vector_t; + typedef typename type_store_t::string_view string_t; results_context() : results_available_(false) @@ -4594,6 +4911,61 @@ namespace exprtk return parameter_list_[index]; } + inline bool get_scalar(const std::size_t& index, T& out) const + { + if ( + (index < parameter_list_.size()) && + (parameter_list_[index].type == type_store_t::e_scalar) + ) + { + const scalar_t scalar(parameter_list_[index]); + out = scalar(); + return true; + } + + return false; + } + + template + inline bool get_vector(const std::size_t& index, OutputIterator out_itr) const + { + if ( + (index < parameter_list_.size()) && + (parameter_list_[index].type == type_store_t::e_vector) + ) + { + const vector_t vector(parameter_list_[index]); + for (std::size_t i = 0; i < vector.size(); ++i) + { + *(out_itr++) = vector[i]; + } + + return true; + } + + return false; + } + + inline bool get_vector(const std::size_t& index, std::vector& out) const + { + return get_vector(index,std::back_inserter(out)); + } + + inline bool get_string(const std::size_t& index, std::string& out) const + { + if ( + (index < parameter_list_.size()) && + (parameter_list_[index].type == type_store_t::e_string) + ) + { + const string_t str(parameter_list_[index]); + out.assign(str.begin(),str.size()); + return true; + } + + return false; + } + private: inline void clear() @@ -4740,10 +5112,11 @@ namespace exprtk namespace loop_unroll { + const unsigned int global_loop_batch_size = #ifndef exprtk_disable_superscalar_unroll - const unsigned int global_loop_batch_size = 16; + 16; #else - const unsigned int global_loop_batch_size = 4; + 4; #endif struct details @@ -4770,11 +5143,28 @@ namespace exprtk ptr, static_cast(size))); else - exprtk_debug(("%s - addr: %p\n",s.c_str(),ptr)); + exprtk_debug(("%s - addr: %p\n", s.c_str(), ptr)); + } + + template + inline void dump_vector(const std::string& vec_name, const T* data, const std::size_t size) + { + printf("----- %s (%p) -----\n", + vec_name.c_str(), + static_cast(data)); + printf("[ "); + for (std::size_t i = 0; i < size; ++i) + { + printf("%8.3f\t", data[i]); + } + printf(" ]\n"); + printf("---------------------\n"); } #else inline void dump_ptr(const std::string&, const void*) {} inline void dump_ptr(const std::string&, const void*, const std::size_t) {} + template + inline void dump_vector(const std::string&, const T*, const std::size_t) {} #endif template @@ -4897,7 +5287,7 @@ namespace exprtk { if (this != &vds) { - std::size_t final_size = min_size(control_block_, vds.control_block_); + const std::size_t final_size = min_size(control_block_, vds.control_block_); vds.control_block_->size = final_size; control_block_->size = final_size; @@ -4947,7 +5337,7 @@ namespace exprtk if (5 == i) exprtk_debug(("\n")); - exprtk_debug(("%15.10f ",data()[i])); + exprtk_debug(("%15.10f ", data()[i])); } exprtk_debug(("\n")); #endif @@ -5060,8 +5450,8 @@ namespace exprtk case e_xnor : return xnor_opr(arg0,arg1); case e_root : return root (arg0,arg1); case e_roundn : return roundn (arg0,arg1); - case e_equal : return equal (arg0,arg1); - case e_nequal : return nequal (arg0,arg1); + case e_equal : return equal (arg0,arg1); + case e_nequal : return nequal (arg0,arg1); case e_hypot : return hypot (arg0,arg1); case e_shr : return shr (arg0,arg1); case e_shl : return shl (arg0,arg1); @@ -5130,17 +5520,19 @@ namespace exprtk typedef Node** node_pp_t; typedef std::vector noderef_list_t; - virtual ~node_collector_interface() {} + virtual ~node_collector_interface() + {} - virtual void collect_nodes(noderef_list_t&) {} + virtual void collect_nodes(noderef_list_t&) + {} }; template struct node_depth_base; template - class expression_node : public node_collector_interface >, - public node_depth_base > + class expression_node : public node_collector_interface > + , public node_depth_base > { public: @@ -5177,12 +5569,14 @@ namespace exprtk e_vovovoc , e_vovocov , e_vocovov , e_covovov , e_covocov , e_vocovoc , e_covovoc , e_vococov , e_sf3ext , e_sf4ext , e_nulleq , e_strass , - e_vector , e_vecelem , e_rbvecelem , e_rbveccelem , - e_vecdefass , e_vecvalass , e_vecvecass , e_vecopvalass , - e_vecopvecass , e_vecfunc , e_vecvecswap , e_vecvecineq , - e_vecvalineq , e_valvecineq , e_vecvecarith , e_vecvalarith , - e_valvecarith , e_vecunaryop , e_vecondition , e_break , - e_continue , e_swap + e_vector , e_vecsize , e_vecelem , e_veccelem , + e_vecelemrtc , e_veccelemrtc , e_rbvecelem , e_rbvecelemrtc , + e_rbveccelem , e_rbveccelemrtc , e_vecinit , e_vecvalass , + e_vecvecass , e_vecopvalass , e_vecopvecass , e_vecfunc , + e_vecvecswap , e_vecvecineq , e_vecvalineq , e_valvecineq , + e_vecvecarith , e_vecvalarith , e_valvecarith , e_vecunaryop , + e_vecondition , e_break , e_continue , e_swap , + e_assert }; typedef T value_type; @@ -5191,7 +5585,8 @@ namespace exprtk typedef typename nci_t::noderef_list_t noderef_list_t; typedef node_depth_base > ndb_t; - virtual ~expression_node() {} + virtual ~expression_node() + {} inline virtual T value() const { @@ -5207,6 +5602,11 @@ namespace exprtk { return e_none; } + + inline virtual bool valid() const + { + return true; + } }; // class expression_node template @@ -5251,6 +5651,12 @@ namespace exprtk return std::equal_to()(T(0),node.first->value()); } + template + inline bool is_literal_node(const expression_node* node) + { + return node && (details::expression_node::e_constant == node->type()); + } + template inline bool is_unary_node(const expression_node* node) { @@ -5280,10 +5686,15 @@ namespace exprtk { return node && ( - details::expression_node::e_variable == node->type() || - details::expression_node::e_vecelem == node->type() || - details::expression_node::e_rbvecelem == node->type() || - details::expression_node::e_rbveccelem == node->type() + details::expression_node::e_variable == node->type() || + details::expression_node::e_vecelem == node->type() || + details::expression_node::e_veccelem == node->type() || + details::expression_node::e_vecelemrtc == node->type() || + details::expression_node::e_veccelemrtc == node->type() || + details::expression_node::e_rbvecelem == node->type() || + details::expression_node::e_rbveccelem == node->type() || + details::expression_node::e_rbvecelemrtc == node->type() || + details::expression_node::e_rbveccelemrtc == node->type() ); } @@ -5293,12 +5704,42 @@ namespace exprtk return node && (details::expression_node::e_vecelem == node->type()); } + template + inline bool is_vector_celem_node(const expression_node* node) + { + return node && (details::expression_node::e_veccelem == node->type()); + } + + template + inline bool is_vector_elem_rtc_node(const expression_node* node) + { + return node && (details::expression_node::e_vecelemrtc == node->type()); + } + + template + inline bool is_vector_celem_rtc_node(const expression_node* node) + { + return node && (details::expression_node::e_veccelemrtc == node->type()); + } + template inline bool is_rebasevector_elem_node(const expression_node* node) { return node && (details::expression_node::e_rbvecelem == node->type()); } + template + inline bool is_rebasevector_elem_rtc_node(const expression_node* node) + { + return node && (details::expression_node::e_rbvecelemrtc == node->type()); + } + + template + inline bool is_rebasevector_celem_rtc_node(const expression_node* node) + { + return node && (details::expression_node::e_rbveccelemrtc == node->type()); + } + template inline bool is_rebasevector_celem_node(const expression_node* node) { @@ -5376,6 +5817,12 @@ namespace exprtk return node && (details::expression_node::e_function == node->type()); } + template + inline bool is_vararg_node(const expression_node* node) + { + return node && (details::expression_node::e_vararg == node->type()); + } + template inline bool is_return_node(const expression_node* node) { @@ -5395,6 +5842,12 @@ namespace exprtk return false; } + template + inline bool is_assert_node(const expression_node* node) + { + return node && (details::expression_node::e_assert == node->type()); + } + template inline bool branch_deletable(const expression_node* node) { @@ -5478,7 +5931,7 @@ namespace exprtk for (std::size_t i = 0; i < node_delete_list.size(); ++i) { node_ptr_t& node = *node_delete_list[i]; - exprtk_debug(("ncd::delete_nodes() - deleting: %p\n", static_cast(node))); + exprtk_debug(("ncd::delete_nodes() - deleting: %p\n", reinterpret_cast(node))); delete node; node = reinterpret_cast(0); } @@ -5583,7 +6036,8 @@ namespace exprtk , depth(0) {} - virtual ~node_depth_base() {} + virtual ~node_depth_base() + {} virtual std::size_t node_depth() const { return 1; } @@ -5615,6 +6069,7 @@ namespace exprtk if (!depth_set) { depth = 0; + for (std::size_t i = 0; i < N; ++i) { if (branch[i].first) @@ -5622,6 +6077,7 @@ namespace exprtk depth = std::max(depth,branch[i].first->node_depth()); } } + depth += 1; depth_set = true; } @@ -5629,12 +6085,34 @@ namespace exprtk return depth; } + template + std::size_t max_node_depth(const BranchType& n0, const BranchType& n1) const + { + return std::max(compute_node_depth(n0), compute_node_depth(n1)); + } + + template + std::size_t max_node_depth(const BranchType& n0, const BranchType& n1, const BranchType& n2) const + { + return std::max(compute_node_depth(n0), + std::max(compute_node_depth(n1), compute_node_depth(n2))); + } + + template + std::size_t max_node_depth(const BranchType& n0, const BranchType& n1, + const BranchType& n2, const BranchType& n3) const + { + return std::max( + std::max(compute_node_depth(n0), compute_node_depth(n1)), + std::max(compute_node_depth(n2), compute_node_depth(n3))); + } + template std::size_t compute_node_depth(const BranchType& n0, const BranchType& n1) const { if (!depth_set) { - depth = 1 + std::max(compute_node_depth(n0), compute_node_depth(n1)); + depth = 1 + max_node_depth(n0, n1); depth_set = true; } @@ -5647,9 +6125,7 @@ namespace exprtk { if (!depth_set) { - depth = 1 + std::max( - std::max(compute_node_depth(n0), compute_node_depth(n1)), - compute_node_depth(n2)); + depth = 1 + max_node_depth(n0, n1, n2); depth_set = true; } @@ -5662,9 +6138,7 @@ namespace exprtk { if (!depth_set) { - depth = 1 + std::max( - std::max(compute_node_depth(n0), compute_node_depth(n1)), - std::max(compute_node_depth(n2), compute_node_depth(n3))); + depth = 1 + max_node_depth(n0, n1, n2, n3); depth_set = true; } @@ -5684,6 +6158,7 @@ namespace exprtk depth = std::max(depth, compute_node_depth(branch_list[i])); } } + depth_set = true; } @@ -5703,6 +6178,7 @@ namespace exprtk depth = std::max(depth, compute_node_depth(branch_list[i].first)); } } + depth_set = true; } @@ -5795,12 +6271,14 @@ namespace exprtk typedef Type value_type; typedef value_type* value_ptr; typedef const value_ptr const_value_ptr; + typedef vector_holder vector_holder_t; class vector_holder_base { public: - virtual ~vector_holder_base() {} + virtual ~vector_holder_base() + {} inline value_ptr operator[](const std::size_t& index) const { @@ -5812,6 +6290,11 @@ namespace exprtk return vector_size(); } + inline std::size_t base_size() const + { + return vector_base_size(); + } + inline value_ptr data() const { return value_at(0); @@ -5822,15 +6305,25 @@ namespace exprtk return false; } - virtual void set_ref(value_ptr*) {} + virtual void set_ref(value_ptr*) + {} + + virtual void remove_ref(value_ptr*) + {} + + virtual vector_view* rebaseable_instance() + { + return reinterpret_cast*>(0); + } protected: virtual value_ptr value_at(const std::size_t&) const = 0; virtual std::size_t vector_size() const = 0; + virtual std::size_t vector_base_size() const = 0; }; - class array_vector_impl : public vector_holder_base + class array_vector_impl exprtk_final : public vector_holder_base { public: @@ -5843,10 +6336,8 @@ namespace exprtk value_ptr value_at(const std::size_t& index) const exprtk_override { - if (index < size_) - return const_cast(vec_ + index); - else - return const_value_ptr(0); + assert(index < size_); + return const_cast(vec_ + index); } std::size_t vector_size() const exprtk_override @@ -5854,6 +6345,11 @@ namespace exprtk return size_; } + std::size_t vector_base_size() const exprtk_override + { + return vector_size(); + } + private: array_vector_impl(const array_vector_impl&) exprtk_delete; @@ -5865,7 +6361,7 @@ namespace exprtk template class Sequence> - class sequence_vector_impl : public vector_holder_base + class sequence_vector_impl exprtk_final : public vector_holder_base { public: @@ -5879,7 +6375,8 @@ namespace exprtk value_ptr value_at(const std::size_t& index) const exprtk_override { - return (index < sequence_.size()) ? (&sequence_[index]) : const_value_ptr(0); + assert(index < sequence_.size()); + return (&sequence_[index]); } std::size_t vector_size() const exprtk_override @@ -5887,6 +6384,11 @@ namespace exprtk return sequence_.size(); } + std::size_t vector_base_size() const exprtk_override + { + return vector_size(); + } + private: sequence_vector_impl(const sequence_vector_impl&) exprtk_delete; @@ -5895,7 +6397,7 @@ namespace exprtk sequence_t& sequence_; }; - class vector_view_impl : public vector_holder_base + class vector_view_impl exprtk_final : public vector_holder_base { public: @@ -5903,30 +6405,48 @@ namespace exprtk vector_view_impl(vector_view_t& vec_view) : vec_view_(vec_view) - {} + { + assert(vec_view_.size() > 0); + } - void set_ref(value_ptr* ref) + void set_ref(value_ptr* ref) exprtk_override { vec_view_.set_ref(ref); } - virtual inline bool rebaseable() const + void remove_ref(value_ptr* ref) exprtk_override + { + vec_view_.remove_ref(ref); + } + + bool rebaseable() const exprtk_override { return true; } - protected: - - value_ptr value_at(const std::size_t& index) const + vector_view* rebaseable_instance() exprtk_override { - return (index < vec_view_.size()) ? (&vec_view_[index]) : const_value_ptr(0); + return &vec_view_; } - std::size_t vector_size() const + protected: + + value_ptr value_at(const std::size_t& index) const exprtk_override + { + assert(index < vec_view_.size()); + return (&vec_view_[index]); + } + + std::size_t vector_size() const exprtk_override { return vec_view_.size(); } + std::size_t vector_base_size() const exprtk_override + { + return vec_view_.base_size(); + } + private: vector_view_impl(const vector_view_impl&) exprtk_delete; @@ -5935,6 +6455,62 @@ namespace exprtk vector_view_t& vec_view_; }; + class resizable_vector_impl exprtk_final : public vector_holder_base + { + public: + + resizable_vector_impl(vector_holder& vec_view_holder, + const Type* vec, + const std::size_t& vec_size) + : vec_(vec) + , size_(vec_size) + , vec_view_holder_(*vec_view_holder.rebaseable_instance()) + { + assert(vec_view_holder.rebaseable_instance()); + assert(size_ <= vector_base_size()); + } + + virtual ~resizable_vector_impl() + {} + + protected: + + value_ptr value_at(const std::size_t& index) const exprtk_override + { + assert(index < vector_size()); + return const_cast(vec_ + index); + } + + std::size_t vector_size() const exprtk_override + { + return vec_view_holder_.size(); + } + + std::size_t vector_base_size() const exprtk_override + { + return vec_view_holder_.base_size(); + } + + bool rebaseable() const exprtk_override + { + return true; + } + + virtual vector_view* rebaseable_instance() exprtk_override + { + return &vec_view_holder_; + } + + private: + + resizable_vector_impl(const resizable_vector_impl&) exprtk_delete; + resizable_vector_impl& operator=(const resizable_vector_impl&) exprtk_delete; + + const Type* vec_; + const std::size_t size_; + vector_view& vec_view_holder_; + }; + public: typedef typename details::vec_data_store vds_t; @@ -5956,6 +6532,10 @@ namespace exprtk : vector_holder_base_(new(buffer)vector_view_impl(vec)) {} + explicit vector_holder(vector_holder_t& vec_holder, const vds_t& vds) + : vector_holder_base_(new(buffer)resizable_vector_impl(vec_holder, vds.data(), vds.size())) + {} + inline value_ptr operator[](const std::size_t& index) const { return (*vector_holder_base_)[index]; @@ -5966,6 +6546,11 @@ namespace exprtk return vector_holder_base_->size(); } + inline std::size_t base_size() const + { + return vector_holder_base_->base_size(); + } + inline value_ptr data() const { return vector_holder_base_->data(); @@ -5973,7 +6558,18 @@ namespace exprtk void set_ref(value_ptr* ref) { - vector_holder_base_->set_ref(ref); + if (rebaseable()) + { + vector_holder_base_->set_ref(ref); + } + } + + void remove_ref(value_ptr* ref) + { + if (rebaseable()) + { + vector_holder_base_->remove_ref(ref); + } } bool rebaseable() const @@ -5981,8 +6577,16 @@ namespace exprtk return vector_holder_base_->rebaseable(); } + vector_view* rebaseable_instance() + { + return vector_holder_base_->rebaseable_instance(); + } + private: + vector_holder(const vector_holder&) exprtk_delete; + vector_holder& operator=(const vector_holder&) exprtk_delete; + mutable vector_holder_base* vector_holder_base_; uchar_t buffer[64]; }; @@ -6060,12 +6664,11 @@ namespace exprtk : equality_(equality) { construct_branch_pair(branch_, branch); + assert(valid()); } inline T value() const exprtk_override { - assert(branch_.first); - const T v = branch_.first->value(); const bool result = details::numeric::is_nan(v); @@ -6085,6 +6688,11 @@ namespace exprtk return branch_.first; } + inline bool valid() const exprtk_override + { + return branch_.first; + } + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override { expression_node::ndb_t::collect(branch_, node_delete_list); @@ -6146,7 +6754,8 @@ namespace exprtk typedef range_pack range_t; - virtual ~range_interface() {} + virtual ~range_interface() + {} virtual range_t& range_ref() = 0; @@ -6161,7 +6770,8 @@ namespace exprtk typedef range_data_type range_data_type_t; - virtual ~string_base_node() {} + virtual ~string_base_node() + {} virtual std::string str () const = 0; @@ -6172,9 +6782,9 @@ namespace exprtk template class string_literal_node exprtk_final - : public expression_node , - public string_base_node, - public range_interface + : public expression_node + , public string_base_node + , public range_interface { public: @@ -6183,8 +6793,8 @@ namespace exprtk explicit string_literal_node(const std::string& v) : value_(v) { - rp_.n0_c = std::make_pair(true,0); - rp_.n1_c = std::make_pair(true,v.size() - 1); + rp_.n0_c = std::make_pair(true, 0); + rp_.n1_c = std::make_pair(true, v.size()); rp_.cache.first = rp_.n0_c.second; rp_.cache.second = rp_.n1_c.second; } @@ -6251,13 +6861,13 @@ namespace exprtk : operation_(opr) { construct_branch_pair(branch_,branch); + assert(valid()); } inline T value() const exprtk_override { - assert(branch_.first); - const T arg = branch_.first->value(); - return numeric::process(operation_,arg); + return numeric::process + (operation_,branch_.first->value()); } inline typename expression_node::node_type type() const exprtk_override @@ -6275,6 +6885,11 @@ namespace exprtk return branch_.first; } + inline bool valid() const exprtk_override + { + return branch_.first && branch_.first->valid(); + } + inline void release() { branch_.second = false; @@ -6310,17 +6925,17 @@ namespace exprtk : operation_(opr) { init_branches<2>(branch_, branch0, branch1); + assert(valid()); } inline T value() const exprtk_override { - assert(branch_[0].first); - assert(branch_[1].first); - - const T arg0 = branch_[0].first->value(); - const T arg1 = branch_[1].first->value(); - - return numeric::process(operation_, arg0, arg1); + return numeric::process + ( + operation_, + branch_[0].first->value(), + branch_[1].first->value() + ); } inline typename expression_node::node_type type() const exprtk_override @@ -6335,17 +6950,20 @@ namespace exprtk inline expression_node* branch(const std::size_t& index = 0) const exprtk_override { - if (0 == index) - return branch_[0].first; - else if (1 == index) - return branch_[1].first; - else - return reinterpret_cast(0); + assert(index < 2); + return branch_[index].first; + } + + inline bool valid() const exprtk_override + { + return + branch_[0].first && branch_[0].first->valid() && + branch_[1].first && branch_[1].first->valid() ; } void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override { - expression_node::ndb_t::template collect(branch_, node_delete_list); + expression_node::ndb_t::collect(branch_, node_delete_list); } std::size_t node_depth() const exprtk_final @@ -6370,16 +6988,13 @@ namespace exprtk binary_ext_node(expression_ptr branch0, expression_ptr branch1) { init_branches<2>(branch_, branch0, branch1); + assert(valid()); } inline T value() const exprtk_override { - assert(branch_[0].first); - assert(branch_[1].first); - const T arg0 = branch_[0].first->value(); const T arg1 = branch_[1].first->value(); - return Operation::process(arg0,arg1); } @@ -6395,17 +7010,20 @@ namespace exprtk inline expression_node* branch(const std::size_t& index = 0) const exprtk_override { - if (0 == index) - return branch_[0].first; - else if (1 == index) - return branch_[1].first; - else - return reinterpret_cast(0); + assert(index < 2); + return branch_[index].first; + } + + inline bool valid() const exprtk_override + { + return + branch_[0].first && branch_[0].first->valid() && + branch_[1].first && branch_[1].first->valid() ; } void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override { - expression_node::ndb_t::template collect(branch_, node_delete_list); + expression_node::ndb_t::collect(branch_, node_delete_list); } std::size_t node_depth() const exprtk_override @@ -6433,14 +7051,11 @@ namespace exprtk : operation_(opr) { init_branches<3>(branch_, branch0, branch1, branch2); + assert(valid()); } inline T value() const exprtk_override { - assert(branch_[0].first); - assert(branch_[1].first); - assert(branch_[2].first); - const T arg0 = branch_[0].first->value(); const T arg1 = branch_[1].first->value(); const T arg2 = branch_[2].first->value(); @@ -6466,9 +7081,17 @@ namespace exprtk return expression_node::e_trinary; } + inline bool valid() const exprtk_override + { + return + branch_[0].first && branch_[0].first->valid() && + branch_[1].first && branch_[1].first->valid() && + branch_[2].first && branch_[2].first->valid() ; + } + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override { - expression_node::ndb_t::template collect(branch_, node_delete_list); + expression_node::ndb_t::collect(branch_, node_delete_list); } std::size_t node_depth() const exprtk_override exprtk_final @@ -6512,7 +7135,7 @@ namespace exprtk void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override { - expression_node::ndb_t::template collect(branch_, node_delete_list); + expression_node::ndb_t::collect(branch_, node_delete_list); } std::size_t node_depth() const exprtk_override exprtk_final @@ -6520,6 +7143,15 @@ namespace exprtk return expression_node::ndb_t::template compute_node_depth<4>(branch_); } + inline bool valid() const exprtk_override + { + return + branch_[0].first && branch_[0].first->valid() && + branch_[1].first && branch_[1].first->valid() && + branch_[2].first && branch_[2].first->valid() && + branch_[3].first && branch_[3].first->valid() ; + } + protected: operator_type operation_; @@ -6541,14 +7173,11 @@ namespace exprtk construct_branch_pair(condition_ , condition ); construct_branch_pair(consequent_ , consequent ); construct_branch_pair(alternative_, alternative); + assert(valid()); } inline T value() const exprtk_override { - assert(condition_ .first); - assert(consequent_ .first); - assert(alternative_.first); - if (is_true(condition_)) return consequent_.first->value(); else @@ -6560,6 +7189,14 @@ namespace exprtk return expression_node::e_conditional; } + inline bool valid() const exprtk_override + { + return + condition_ .first && condition_ .first->valid() && + consequent_ .first && consequent_ .first->valid() && + alternative_.first && alternative_.first->valid() ; + } + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override { expression_node::ndb_t::collect(condition_ , node_delete_list); @@ -6594,13 +7231,11 @@ namespace exprtk { construct_branch_pair(condition_ , condition ); construct_branch_pair(consequent_, consequent); + assert(valid()); } inline T value() const exprtk_override { - assert(condition_ .first); - assert(consequent_.first); - if (is_true(condition_)) return consequent_.first->value(); else @@ -6612,6 +7247,13 @@ namespace exprtk return expression_node::e_conditional; } + inline bool valid() const exprtk_override + { + return + condition_ .first && condition_ .first->valid() && + consequent_.first && consequent_.first->valid() ; + } + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override { expression_node::ndb_t::collect(condition_ , node_delete_list); @@ -6653,7 +7295,7 @@ namespace exprtk typedef expression_node* expression_ptr; typedef std::pair branch_t; - break_node(expression_ptr ret = expression_ptr(0)) + explicit break_node(expression_ptr ret = expression_ptr(0)) { construct_branch_pair(return_, ret); } @@ -6666,7 +7308,7 @@ namespace exprtk throw break_exception(result); - #ifndef _MSC_VER + #if !defined(_MSC_VER) && !defined(__NVCOMPILER) return std::numeric_limits::quiet_NaN(); #endif } @@ -6699,7 +7341,7 @@ namespace exprtk inline T value() const exprtk_override { throw continue_exception(); - #ifndef _MSC_VER + #if !defined(_MSC_VER) && !defined(__NVCOMPILER) return std::numeric_limits::quiet_NaN(); #endif } @@ -6730,9 +7372,11 @@ namespace exprtk inline bool check() const { + assert(loop_runtime_check_); + if ( - (0 == loop_runtime_check_) || - ((++iteration_count_ <= max_loop_iterations_) && loop_runtime_check_->check()) + (++iteration_count_ <= max_loop_iterations_) && + loop_runtime_check_->check() ) { return true; @@ -6747,6 +7391,11 @@ namespace exprtk return false; } + bool valid() const + { + return 0 != loop_runtime_check_; + } + mutable _uint64_t iteration_count_; mutable loop_runtime_check_ptr loop_runtime_check_; const details::_uint64_t& max_loop_iterations_; @@ -6766,13 +7415,11 @@ namespace exprtk { construct_branch_pair(condition_, condition); construct_branch_pair(loop_body_, loop_body); + assert(valid()); } inline T value() const exprtk_override { - assert(condition_.first); - assert(loop_body_.first); - T result = T(0); while (is_true(condition_)) @@ -6788,6 +7435,13 @@ namespace exprtk return expression_node::e_while; } + inline bool valid() const exprtk_override + { + return + condition_.first && condition_.first->valid() && + loop_body_.first && loop_body_.first->valid() ; + } + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override { expression_node::ndb_t::collect(condition_ , node_delete_list); @@ -6820,12 +7474,12 @@ namespace exprtk loop_runtime_check_ptr loop_rt_chk) : parent_t(condition, loop_body) , loop_runtime_checker(loop_rt_chk, loop_runtime_check::e_while_loop) - {} + { + assert(valid()); + } inline T value() const exprtk_override { - assert(parent_t::condition_.first); - assert(parent_t::loop_body_.first); T result = T(0); @@ -6838,6 +7492,14 @@ namespace exprtk return result; } + + using parent_t::valid; + + bool valid() const exprtk_override exprtk_final + { + return parent_t::valid() && + loop_runtime_checker::valid(); + } }; template @@ -6853,13 +7515,11 @@ namespace exprtk { construct_branch_pair(condition_, condition); construct_branch_pair(loop_body_, loop_body); + assert(valid()); } inline T value() const exprtk_override { - assert(condition_.first); - assert(loop_body_.first); - T result = T(0); do @@ -6876,6 +7536,13 @@ namespace exprtk return expression_node::e_repeat; } + inline bool valid() const exprtk_override + { + return + condition_.first && condition_.first->valid() && + loop_body_.first && loop_body_.first->valid() ; + } + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override { expression_node::ndb_t::collect(condition_ , node_delete_list); @@ -6908,13 +7575,12 @@ namespace exprtk loop_runtime_check_ptr loop_rt_chk) : parent_t(condition, loop_body) , loop_runtime_checker(loop_rt_chk, loop_runtime_check::e_repeat_until_loop) - {} + { + assert(valid()); + } inline T value() const exprtk_override { - assert(parent_t::condition_.first); - assert(parent_t::loop_body_.first); - T result = T(0); loop_runtime_checker::reset(1); @@ -6927,6 +7593,14 @@ namespace exprtk return result; } + + using parent_t::valid; + + inline bool valid() const exprtk_override exprtk_final + { + return parent_t::valid() && + loop_runtime_checker::valid(); + } }; template @@ -6946,13 +7620,11 @@ namespace exprtk construct_branch_pair(condition_ , condition ); construct_branch_pair(incrementor_, incrementor); construct_branch_pair(loop_body_ , loop_body ); + assert(valid()); } inline T value() const exprtk_override { - assert(condition_.first); - assert(loop_body_.first); - T result = T(0); if (initialiser_.first) @@ -6982,6 +7654,11 @@ namespace exprtk return expression_node::e_for; } + inline bool valid() const exprtk_override + { + return condition_.first && loop_body_.first; + } + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override { expression_node::ndb_t::collect(initialiser_ , node_delete_list); @@ -7021,13 +7698,12 @@ namespace exprtk loop_runtime_check_ptr loop_rt_chk) : parent_t(initialiser, condition, incrementor, loop_body) , loop_runtime_checker(loop_rt_chk, loop_runtime_check::e_for_loop) - {} + { + assert(valid()); + } inline T value() const exprtk_override { - assert(parent_t::condition_.first); - assert(parent_t::loop_body_.first); - T result = T(0); loop_runtime_checker::reset(); @@ -7053,6 +7729,14 @@ namespace exprtk return result; } + + using parent_t::valid; + + inline bool valid() const exprtk_override exprtk_final + { + return parent_t::valid() && + loop_runtime_checker::valid(); + } }; #ifndef exprtk_disable_break_continue @@ -7067,13 +7751,12 @@ namespace exprtk while_loop_bc_node(expression_ptr condition, expression_ptr loop_body) : parent_t(condition, loop_body) - {} + { + assert(parent_t::valid()); + } inline T value() const exprtk_override { - assert(parent_t::condition_.first); - assert(parent_t::loop_body_.first); - T result = T(0); while (is_true(parent_t::condition_)) @@ -7109,13 +7792,12 @@ namespace exprtk loop_runtime_check_ptr loop_rt_chk) : parent_t(condition, loop_body) , loop_runtime_checker(loop_rt_chk, loop_runtime_check::e_while_loop) - {} + { + assert(valid()); + } inline T value() const exprtk_override { - assert(parent_t::condition_.first); - assert(parent_t::loop_body_.first); - T result = T(0); loop_runtime_checker::reset(); @@ -7136,6 +7818,14 @@ namespace exprtk return result; } + + using parent_t::valid; + + inline bool valid() const exprtk_override exprtk_final + { + return parent_t::valid() && + loop_runtime_checker::valid(); + } }; template @@ -7149,13 +7839,12 @@ namespace exprtk repeat_until_loop_bc_node(expression_ptr condition, expression_ptr loop_body) : parent_t(condition, loop_body) - {} + { + assert(parent_t::valid()); + } inline T value() const exprtk_override { - assert(parent_t::condition_.first); - assert(parent_t::loop_body_.first); - T result = T(0); do @@ -7179,8 +7868,8 @@ namespace exprtk template class repeat_until_loop_bc_rtc_node exprtk_final - : public repeat_until_loop_bc_node, - public loop_runtime_checker + : public repeat_until_loop_bc_node + , public loop_runtime_checker { public: @@ -7192,13 +7881,12 @@ namespace exprtk loop_runtime_check_ptr loop_rt_chk) : parent_t(condition, loop_body) , loop_runtime_checker(loop_rt_chk, loop_runtime_check::e_repeat_until_loop) - {} + { + assert(valid()); + } inline T value() const exprtk_override { - assert(parent_t::condition_.first); - assert(parent_t::loop_body_.first); - T result = T(0); loop_runtime_checker::reset(); @@ -7220,6 +7908,14 @@ namespace exprtk return result; } + + using parent_t::valid; + + inline bool valid() const exprtk_override exprtk_final + { + return parent_t::valid() && + loop_runtime_checker::valid(); + } }; template @@ -7235,13 +7931,12 @@ namespace exprtk expression_ptr incrementor, expression_ptr loop_body) : parent_t(initialiser, condition, incrementor, loop_body) - {} + { + assert(parent_t::valid()); + } inline T value() const exprtk_override { - assert(parent_t::condition_.first); - assert(parent_t::loop_body_.first); - T result = T(0); if (parent_t::initialiser_.first) @@ -7303,13 +7998,12 @@ namespace exprtk loop_runtime_check_ptr loop_rt_chk) : parent_t(initialiser, condition, incrementor, loop_body) , loop_runtime_checker(loop_rt_chk, loop_runtime_check::e_for_loop) - {} + { + assert(valid()); + } inline T value() const exprtk_override { - assert(parent_t::condition_.first); - assert(parent_t::loop_body_.first); - T result = T(0); loop_runtime_checker::reset(); @@ -7354,6 +8048,14 @@ namespace exprtk return result; } + + using parent_t::valid; + + inline bool valid() const exprtk_override exprtk_final + { + return parent_t::valid() && + loop_runtime_checker::valid(); + } }; #endif @@ -7376,7 +8078,7 @@ namespace exprtk for (std::size_t i = 0; i < arg_list.size(); ++i) { - if (arg_list[i]) + if (arg_list[i] && arg_list[i]->valid()) { construct_branch_pair(arg_list_[i], arg_list[i]); } @@ -7386,29 +8088,26 @@ namespace exprtk return; } } + + assert(valid()); } inline T value() const exprtk_override { - if (!arg_list_.empty()) + const std::size_t upper_bound = (arg_list_.size() - 1); + + for (std::size_t i = 0; i < upper_bound; i += 2) { - const std::size_t upper_bound = (arg_list_.size() - 1); + expression_ptr condition = arg_list_[i ].first; + expression_ptr consequent = arg_list_[i + 1].first; - for (std::size_t i = 0; i < upper_bound; i += 2) + if (is_true(condition)) { - expression_ptr condition = arg_list_[i ].first; - expression_ptr consequent = arg_list_[i + 1].first; - - if (is_true(condition)) - { - return consequent->value(); - } + return consequent->value(); } - - return arg_list_[upper_bound].first->value(); } - else - return std::numeric_limits::quiet_NaN(); + + return arg_list_[upper_bound].first->value(); } inline typename expression_node::node_type type() const exprtk_override exprtk_final @@ -7416,6 +8115,11 @@ namespace exprtk return expression_node::e_switch; } + inline bool valid() const exprtk_override + { + return !arg_list_.empty(); + } + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override { expression_node::ndb_t::collect(arg_list_, node_delete_list); @@ -7469,7 +8173,7 @@ namespace exprtk for (std::size_t i = 0; i < arg_list.size(); ++i) { - if (arg_list[i]) + if (arg_list[i] && arg_list[i]->valid()) { construct_branch_pair(arg_list_[i], arg_list[i]); } @@ -7479,19 +8183,16 @@ namespace exprtk return; } } + + assert(valid()); } inline T value() const exprtk_override { - T result = T(0); - - if (arg_list_.empty()) - { - return std::numeric_limits::quiet_NaN(); - } - const std::size_t upper_bound = (arg_list_.size() - 1); + T result = T(0); + for (std::size_t i = 0; i < upper_bound; i += 2) { expression_ptr condition = arg_list_[i ].first; @@ -7511,6 +8212,11 @@ namespace exprtk return expression_node::e_mswitch; } + inline bool valid() const exprtk_override + { + return !arg_list_.empty() && (0 == (arg_list_.size() % 2)); + } + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override { expression_node::ndb_t::collect(arg_list_, node_delete_list); @@ -7531,7 +8237,8 @@ namespace exprtk { public: - virtual ~ivariable() {} + virtual ~ivariable() + {} virtual T& ref() = 0; virtual const T& ref() const = 0; @@ -7539,8 +8246,8 @@ namespace exprtk template class variable_node exprtk_final - : public expression_node, - public ivariable + : public expression_node + , public ivariable { public: @@ -7677,7 +8384,7 @@ namespace exprtk (std::numeric_limits::max() == r1 ) ) { - r1 = size - 1; + r1 = size; } cache.first = r0; @@ -7692,12 +8399,12 @@ namespace exprtk inline std::size_t const_size() const { - return (n1_c.second - n0_c.second + 1); + return (n1_c.second - n0_c.second); } inline std::size_t cache_size() const { - return (cache.second - cache.first + 1); + return (cache.second - cache.first); } std::pair n0_e; @@ -7711,16 +8418,20 @@ namespace exprtk const std::size_t r1, const std::size_t size) const { - if (r0 >= size) + if (r0 > size) { - throw std::runtime_error("range error: (r0 < 0) || (r0 >= size)"); + throw std::runtime_error("range error: (r0 < 0) || (r0 > size)"); + #if !defined(_MSC_VER) && !defined(__NVCOMPILER) return false; + #endif } - if (r1 >= size) + if (r1 > size) { - throw std::runtime_error("range error: (r1 < 0) || (r1 >= size)"); + throw std::runtime_error("range error: (r1 < 0) || (r1 > size)"); + #if !defined(_MSC_VER) && !defined(__NVCOMPILER) return false; + #endif } return (r0 <= r1); @@ -7762,19 +8473,22 @@ namespace exprtk typedef vector_node* vector_node_ptr; typedef vec_data_store vds_t; - virtual ~vector_interface() {} + virtual ~vector_interface() + {} - virtual std::size_t size () const = 0; + virtual std::size_t size () const = 0; - virtual vector_node_ptr vec() const = 0; + virtual std::size_t base_size() const = 0; - virtual vector_node_ptr vec() = 0; + virtual vector_node_ptr vec () const = 0; - virtual vds_t& vds () = 0; + virtual vector_node_ptr vec () = 0; - virtual const vds_t& vds () const = 0; + virtual vds_t& vds () = 0; - virtual bool side_effect () const { return false; } + virtual const vds_t& vds () const = 0; + + virtual bool side_effect () const { return false; } }; template @@ -7801,6 +8515,12 @@ namespace exprtk , vds_(vds) {} + ~vector_node() + { + assert(valid()); + vector_holder_->remove_ref(&vds_.ref()); + } + inline T value() const exprtk_override { return vds().data()[0]; @@ -7821,9 +8541,19 @@ namespace exprtk return expression_node::e_vector; } + inline bool valid() const exprtk_override + { + return vector_holder_; + } + std::size_t size() const exprtk_override { - return vds().size(); + return vec_holder().size(); + } + + std::size_t base_size() const exprtk_override + { + return vec_holder().base_size(); } vds_t& vds() exprtk_override @@ -7841,16 +8571,65 @@ namespace exprtk return (*vector_holder_); } + inline vector_holder_t& vec_holder() const + { + return (*vector_holder_); + } + private: vector_holder_t* vector_holder_; vds_t vds_; }; + template + class vector_size_node exprtk_final + : public expression_node + { + public: + + typedef expression_node* expression_ptr; + typedef vector_holder vector_holder_t; + + explicit vector_size_node(vector_holder_t* vh) + : vector_holder_(vh) + {} + + ~vector_size_node() + { + assert(valid()); + } + + inline T value() const exprtk_override + { + assert(vector_holder_); + return static_cast(vector_holder_->size()); + } + + inline typename expression_node::node_type type() const exprtk_override + { + return expression_node::e_vecsize; + } + + inline bool valid() const exprtk_override + { + return vector_holder_ && vector_holder_->size(); + } + + inline vector_holder_t* vec_holder() + { + return vector_holder_; + } + + private: + + vector_holder_t* vector_holder_; + }; + template class vector_elem_node exprtk_final - : public expression_node, - public ivariable + : public expression_node + , public ivariable { public: @@ -7859,26 +8638,30 @@ namespace exprtk typedef vector_holder_t* vector_holder_ptr; typedef std::pair branch_t; - vector_elem_node(expression_ptr index, vector_holder_ptr vec_holder) - : vec_holder_(vec_holder) + vector_elem_node(expression_ptr vec_node, + expression_ptr index, + vector_holder_ptr vec_holder) + : vector_holder_(vec_holder) , vector_base_((*vec_holder)[0]) { - construct_branch_pair(index_, index); + construct_branch_pair(vector_node_, vec_node); + construct_branch_pair(index_ , index ); + assert(valid()); } inline T value() const exprtk_override { - return *(vector_base_ + static_cast(details::numeric::to_int64(index_.first->value()))); + return *access_vector(); } inline T& ref() exprtk_override { - return *(vector_base_ + static_cast(details::numeric::to_int64(index_.first->value()))); + return *access_vector(); } inline const T& ref() const exprtk_override { - return *(vector_base_ + static_cast(details::numeric::to_int64(index_.first->value()))); + return *access_vector(); } inline typename expression_node::node_type type() const exprtk_override @@ -7886,32 +8669,338 @@ namespace exprtk return expression_node::e_vecelem; } + inline bool valid() const exprtk_override + { + return + vector_holder_ && + index_.first && + vector_node_.first && + index_.first->valid() && + vector_node_.first->valid(); + } + inline vector_holder_t& vec_holder() { - return (*vec_holder_); + return (*vector_holder_); } void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override { - expression_node::ndb_t::collect(index_, node_delete_list); + expression_node::ndb_t::collect(vector_node_, node_delete_list); + expression_node::ndb_t::collect(index_ , node_delete_list); } std::size_t node_depth() const exprtk_override { - return expression_node::ndb_t::compute_node_depth(index_); + return expression_node::ndb_t::compute_node_depth + (vector_node_, index_); } private: - vector_holder_ptr vec_holder_; + inline T* access_vector() const + { + vector_node_.first->value(); + return (vector_base_ + details::numeric::to_uint64(index_.first->value())); + } + + vector_holder_ptr vector_holder_; T* vector_base_; + branch_t vector_node_; branch_t index_; }; + template + class vector_celem_node exprtk_final + : public expression_node + , public ivariable + { + public: + + typedef expression_node* expression_ptr; + typedef vector_holder vector_holder_t; + typedef vector_holder_t* vector_holder_ptr; + typedef std::pair branch_t; + + vector_celem_node(expression_ptr vec_node, + const std::size_t index, + vector_holder_ptr vec_holder) + : index_(index) + , vector_holder_(vec_holder) + , vector_base_((*vec_holder)[0]) + { + construct_branch_pair(vector_node_, vec_node); + assert(valid()); + } + + inline T value() const exprtk_override + { + return *access_vector(); + } + + inline T& ref() exprtk_override + { + return *access_vector(); + } + + inline const T& ref() const exprtk_override + { + return *access_vector(); + } + + inline typename expression_node::node_type type() const exprtk_override + { + return expression_node::e_veccelem; + } + + inline bool valid() const exprtk_override + { + return + vector_holder_ && + vector_node_.first && + vector_node_.first->valid(); + } + + inline vector_holder_t& vec_holder() + { + return (*vector_holder_); + } + + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override + { + expression_node::ndb_t::collect(vector_node_, node_delete_list); + } + + std::size_t node_depth() const exprtk_override + { + return expression_node::ndb_t::compute_node_depth(vector_node_); + } + + private: + + inline T* access_vector() const + { + vector_node_.first->value(); + return (vector_base_ + index_); + } + + const std::size_t index_; + vector_holder_ptr vector_holder_; + T* vector_base_; + branch_t vector_node_; + }; + + template + class vector_elem_rtc_node exprtk_final + : public expression_node + , public ivariable + { + public: + + typedef expression_node* expression_ptr; + typedef vector_holder vector_holder_t; + typedef vector_holder_t* vector_holder_ptr; + typedef std::pair branch_t; + + vector_elem_rtc_node(expression_ptr vec_node, + expression_ptr index, + vector_holder_ptr vec_holder, + vector_access_runtime_check_ptr vec_rt_chk) + : vector_holder_(vec_holder) + , vector_base_((*vec_holder)[0]) + , vec_rt_chk_(vec_rt_chk) + , max_vector_index_(vector_holder_->size() - 1) + { + construct_branch_pair(vector_node_, vec_node); + construct_branch_pair(index_ , index ); + assert(valid()); + } + + inline T value() const exprtk_override + { + return *access_vector(); + } + + inline T& ref() exprtk_override + { + return *access_vector(); + } + + inline const T& ref() const exprtk_override + { + return *access_vector(); + } + + inline typename expression_node::node_type type() const exprtk_override + { + return expression_node::e_vecelemrtc; + } + + inline bool valid() const exprtk_override + { + return + vector_holder_ && + index_.first && + vector_node_.first && + index_.first->valid() && + vector_node_.first->valid(); + } + + inline vector_holder_t& vec_holder() + { + return (*vector_holder_); + } + + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override + { + expression_node::ndb_t::collect(vector_node_, node_delete_list); + expression_node::ndb_t::collect(index_, node_delete_list); + } + + std::size_t node_depth() const exprtk_override + { + return expression_node::ndb_t::compute_node_depth + (vector_node_, index_); + } + + private: + + inline T* access_vector() const + { + const _uint64_t index = details::numeric::to_uint64(index_.first->value()); + vector_node_.first->value(); + + if (index <= max_vector_index_) + { + return (vector_holder_->data() + index); + } + + assert(vec_rt_chk_); + + vector_access_runtime_check::violation_context context; + context.base_ptr = reinterpret_cast(vector_base_); + context.end_ptr = reinterpret_cast(vector_base_ + vector_holder_->size()); + context.access_ptr = reinterpret_cast(vector_base_ + index); + context.type_size = sizeof(T); + + return vec_rt_chk_->handle_runtime_violation(context) ? + reinterpret_cast(context.access_ptr) : + vector_base_ ; + } + + vector_holder_ptr vector_holder_; + T* vector_base_; + branch_t vector_node_; + branch_t index_; + vector_access_runtime_check_ptr vec_rt_chk_; + const std::size_t max_vector_index_; + }; + + template + class vector_celem_rtc_node exprtk_final + : public expression_node + , public ivariable + { + public: + + typedef expression_node* expression_ptr; + typedef vector_holder vector_holder_t; + typedef vector_holder_t* vector_holder_ptr; + typedef std::pair branch_t; + + vector_celem_rtc_node(expression_ptr vec_node, + const std::size_t index, + vector_holder_ptr vec_holder, + vector_access_runtime_check_ptr vec_rt_chk) + : index_(index) + , max_vector_index_(vec_holder->size() - 1) + , vector_holder_(vec_holder) + , vector_base_((*vec_holder)[0]) + , vec_rt_chk_(vec_rt_chk) + { + construct_branch_pair(vector_node_, vec_node); + assert(valid()); + } + + inline T value() const exprtk_override + { + return *access_vector(); + } + + inline T& ref() exprtk_override + { + return *access_vector(); + } + + inline const T& ref() const exprtk_override + { + return *access_vector(); + } + + inline typename expression_node::node_type type() const exprtk_override + { + return expression_node::e_veccelemrtc; + } + + inline bool valid() const exprtk_override + { + return + vector_holder_ && + vector_node_.first && + vector_node_.first->valid(); + } + + inline vector_holder_t& vec_holder() + { + return (*vector_holder_); + } + + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override + { + expression_node::ndb_t::collect(vector_node_, node_delete_list); + } + + std::size_t node_depth() const exprtk_override + { + return expression_node::ndb_t::compute_node_depth(vector_node_); + } + + private: + + inline T* access_vector() const + { + vector_node_.first->value(); + + if (index_ <= max_vector_index_) + { + return (vector_holder_->data() + index_); + } + + assert(vec_rt_chk_); + + vector_access_runtime_check::violation_context context; + context.base_ptr = reinterpret_cast(vector_base_); + context.end_ptr = reinterpret_cast(vector_base_ + vector_holder_->size()); + context.access_ptr = reinterpret_cast(vector_base_ + index_); + context.type_size = sizeof(T); + + return vec_rt_chk_->handle_runtime_violation(context) ? + reinterpret_cast(context.access_ptr) : + vector_base_ ; + } + + const std::size_t index_; + const std::size_t max_vector_index_; + vector_holder_ptr vector_holder_; + T* vector_base_; + branch_t vector_node_; + vector_access_runtime_check_ptr vec_rt_chk_; + }; + template class rebasevector_elem_node exprtk_final - : public expression_node, - public ivariable + : public expression_node + , public ivariable { public: @@ -7921,27 +9010,29 @@ namespace exprtk typedef vec_data_store vds_t; typedef std::pair branch_t; - rebasevector_elem_node(expression_ptr index, vector_holder_ptr vec_holder) + rebasevector_elem_node(expression_ptr vec_node, + expression_ptr index, + vector_holder_ptr vec_holder) : vector_holder_(vec_holder) - , vds_((*vector_holder_).size(),(*vector_holder_)[0]) { - vector_holder_->set_ref(&vds_.ref()); - construct_branch_pair(index_, index); + construct_branch_pair(vector_node_, vec_node); + construct_branch_pair(index_ , index ); + assert(valid()); } inline T value() const exprtk_override { - return *(vds_.data() + static_cast(details::numeric::to_int64(index_.first->value()))); + return *access_vector(); } inline T& ref() exprtk_override { - return *(vds_.data() + static_cast(details::numeric::to_int64(index_.first->value()))); + return *access_vector(); } inline const T& ref() const exprtk_override { - return *(vds_.data() + static_cast(details::numeric::to_int64(index_.first->value()))); + return *access_vector(); } inline typename expression_node::node_type type() const exprtk_override @@ -7949,6 +9040,16 @@ namespace exprtk return expression_node::e_rbvecelem; } + inline bool valid() const exprtk_override + { + return + vector_holder_ && + index_.first && + vector_node_.first && + index_.first->valid() && + vector_node_.first->valid(); + } + inline vector_holder_t& vec_holder() { return (*vector_holder_); @@ -7956,54 +9057,65 @@ namespace exprtk void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override { - expression_node::ndb_t::template collect(index_, node_delete_list); + expression_node::ndb_t::collect(vector_node_, node_delete_list); + expression_node::ndb_t::collect(index_, node_delete_list); } std::size_t node_depth() const exprtk_override { - return expression_node::ndb_t::compute_node_depth(index_); + return expression_node::ndb_t::compute_node_depth + (vector_node_, index_); } private: + inline T* access_vector() const + { + vector_node_.first->value(); + return (vector_holder_->data() + details::numeric::to_uint64(index_.first->value())); + } + vector_holder_ptr vector_holder_; - vds_t vds_; + branch_t vector_node_; branch_t index_; }; template class rebasevector_celem_node exprtk_final - : public expression_node, - public ivariable + : public expression_node + , public ivariable { public: typedef expression_node* expression_ptr; typedef vector_holder vector_holder_t; typedef vector_holder_t* vector_holder_ptr; - typedef vec_data_store vds_t; + typedef std::pair branch_t; - rebasevector_celem_node(const std::size_t index, vector_holder_ptr vec_holder) + rebasevector_celem_node(expression_ptr vec_node, + const std::size_t index, + vector_holder_ptr vec_holder) : index_(index) , vector_holder_(vec_holder) - , vds_((*vector_holder_).size(),(*vector_holder_)[0]) { - vector_holder_->set_ref(&vds_.ref()); + construct_branch_pair(vector_node_, vec_node); + assert(valid()); } inline T value() const exprtk_override { - return *(vds_.data() + index_); + vector_node_.first->value(); + return ref();; } inline T& ref() exprtk_override { - return *(vds_.data() + index_); + return *(vector_holder_->data() + index_); } inline const T& ref() const exprtk_override { - return *(vds_.data() + index_); + return *(vector_holder_->data() + index_); } inline typename expression_node::node_type type() const exprtk_override @@ -8011,42 +9123,303 @@ namespace exprtk return expression_node::e_rbveccelem; } + inline bool valid() const exprtk_override + { + return + vector_holder_ && + vector_node_.first && + vector_node_.first->valid(); + } + inline vector_holder_t& vec_holder() { return (*vector_holder_); } + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override + { + expression_node::ndb_t::collect(vector_node_, node_delete_list); + } + + std::size_t node_depth() const exprtk_override + { + return expression_node::ndb_t::compute_node_depth(vector_node_); + } + private: const std::size_t index_; vector_holder_ptr vector_holder_; - vds_t vds_; + branch_t vector_node_; }; template - class vector_assignment_node exprtk_final : public expression_node + class rebasevector_elem_rtc_node exprtk_final + : public expression_node + , public ivariable + { + public: + + typedef expression_node* expression_ptr; + typedef vector_holder vector_holder_t; + typedef vector_holder_t* vector_holder_ptr; + typedef std::pair branch_t; + + rebasevector_elem_rtc_node(expression_ptr vec_node, + expression_ptr index, + vector_holder_ptr vec_holder, + vector_access_runtime_check_ptr vec_rt_chk) + : vector_holder_(vec_holder) + , vec_rt_chk_(vec_rt_chk) + { + construct_branch_pair(vector_node_, vec_node); + construct_branch_pair(index_ , index ); + assert(valid()); + } + + inline T value() const exprtk_override + { + return *access_vector(); + } + + inline T& ref() exprtk_override + { + return *access_vector(); + } + + inline const T& ref() const exprtk_override + { + return *access_vector(); + } + + inline typename expression_node::node_type type() const exprtk_override + { + return expression_node::e_rbvecelemrtc; + } + + inline bool valid() const exprtk_override + { + return + vector_holder_ && + index_.first && + vector_node_.first && + index_.first->valid() && + vector_node_.first->valid(); + } + + inline vector_holder_t& vec_holder() + { + return (*vector_holder_); + } + + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override + { + expression_node::ndb_t::collect(vector_node_, node_delete_list); + expression_node::ndb_t::collect(index_ , node_delete_list); + } + + std::size_t node_depth() const exprtk_override + { + return expression_node::ndb_t::compute_node_depth + (vector_node_, index_); + } + + private: + + inline T* access_vector() const + { + vector_node_.first->value(); + const _uint64_t index = details::numeric::to_uint64(index_.first->value()); + + if (index <= (vector_holder_->size() - 1)) + { + return (vector_holder_->data() + index); + } + + assert(vec_rt_chk_); + + vector_access_runtime_check::violation_context context; + context.base_ptr = reinterpret_cast(vector_holder_->data()); + context.end_ptr = reinterpret_cast(vector_holder_->data() + vector_holder_->size()); + context.access_ptr = reinterpret_cast(vector_holder_->data() + index); + context.type_size = sizeof(T); + + return vec_rt_chk_->handle_runtime_violation(context) ? + reinterpret_cast(context.access_ptr) : + vector_holder_->data() ; + } + + vector_holder_ptr vector_holder_; + branch_t vector_node_; + branch_t index_; + vector_access_runtime_check_ptr vec_rt_chk_; + }; + + template + class rebasevector_celem_rtc_node exprtk_final + : public expression_node + , public ivariable + { + public: + + typedef expression_node* expression_ptr; + typedef vector_holder vector_holder_t; + typedef vector_holder_t* vector_holder_ptr; + typedef std::pair branch_t; + + rebasevector_celem_rtc_node(expression_ptr vec_node, + const std::size_t index, + vector_holder_ptr vec_holder, + vector_access_runtime_check_ptr vec_rt_chk) + : index_(index) + , vector_holder_(vec_holder) + , vector_base_((*vec_holder)[0]) + , vec_rt_chk_(vec_rt_chk) + { + construct_branch_pair(vector_node_, vec_node); + assert(valid()); + } + + inline T value() const exprtk_override + { + return *access_vector(); + } + + inline T& ref() exprtk_override + { + return *access_vector(); + } + + inline const T& ref() const exprtk_override + { + return *access_vector(); + } + + inline typename expression_node::node_type type() const exprtk_override + { + return expression_node::e_rbveccelemrtc; + } + + inline bool valid() const exprtk_override + { + return + vector_holder_ && + vector_node_.first && + vector_node_.first->valid(); + } + + inline vector_holder_t& vec_holder() + { + return (*vector_holder_); + } + + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override + { + expression_node::ndb_t::collect(vector_node_, node_delete_list); + } + + std::size_t node_depth() const exprtk_override + { + return expression_node::ndb_t::compute_node_depth(vector_node_); + } + + private: + + inline T* access_vector() const + { + vector_node_.first->value(); + + if (index_ <= vector_holder_->size() - 1) + { + return (vector_holder_->data() + index_); + } + + assert(vec_rt_chk_); + + vector_access_runtime_check::violation_context context; + context.base_ptr = reinterpret_cast(vector_base_); + context.end_ptr = reinterpret_cast(vector_base_ + vector_holder_->size()); + context.access_ptr = reinterpret_cast(vector_base_ + index_); + context.type_size = sizeof(T); + + return vec_rt_chk_->handle_runtime_violation(context) ? + reinterpret_cast(context.access_ptr) : + vector_base_ ; + } + + const std::size_t index_; + vector_holder_ptr vector_holder_; + T* vector_base_; + branch_t vector_node_; + vector_access_runtime_check_ptr vec_rt_chk_; + }; + + template + class vector_initialisation_node exprtk_final : public expression_node { public: typedef expression_node* expression_ptr; - vector_assignment_node(T* vector_base, - const std::size_t& size, - const std::vector& initialiser_list, - const bool single_value_initialse) + vector_initialisation_node(T* vector_base, + const std::size_t& size, + const std::vector& initialiser_list, + const bool single_value_initialse) : vector_base_(vector_base) , initialiser_list_(initialiser_list) , size_(size) , single_value_initialse_(single_value_initialse) - {} + , zero_value_initialse_(false) + , const_nonzero_literal_value_initialse_(false) + , single_initialiser_value_(T(0)) + { + if (single_value_initialse_) + { + if (initialiser_list_.empty()) + zero_value_initialse_ = true; + else if ( + (initialiser_list_.size() == 1) && + details::is_constant_node(initialiser_list_[0]) && + (T(0) == initialiser_list_[0]->value()) + ) + { + zero_value_initialse_ = true; + } + else + { + assert(initialiser_list_.size() == 1); + + if (details::is_constant_node(initialiser_list_[0])) + { + const_nonzero_literal_value_initialse_ = true; + single_initialiser_value_ = initialiser_list_[0]->value(); + assert(T(0) != single_initialiser_value_); + } + } + } + } inline T value() const exprtk_override { if (single_value_initialse_) { - for (std::size_t i = 0; i < size_; ++i) + if (zero_value_initialse_) { - *(vector_base_ + i) = initialiser_list_[0]->value(); + details::set_zero_value(vector_base_, size_); + } + else if (const_nonzero_literal_value_initialse_) + { + for (std::size_t i = 0; i < size_; ++i) + { + *(vector_base_ + i) = single_initialiser_value_; + } + } + else + { + for (std::size_t i = 0; i < size_; ++i) + { + *(vector_base_ + i) = initialiser_list_[0]->value(); + } } } else @@ -8060,10 +9433,9 @@ namespace exprtk if (initialiser_list_size < size_) { - for (std::size_t i = initialiser_list_size; i < size_; ++i) - { - *(vector_base_ + i) = T(0); - } + details::set_zero_value( + vector_base_ + initialiser_list_size, + (size_ - initialiser_list_size)); } } @@ -8072,7 +9444,12 @@ namespace exprtk inline typename expression_node::node_type type() const exprtk_override { - return expression_node::e_vecdefass; + return expression_node::e_vecinit; + } + + inline bool valid() const exprtk_override + { + return vector_base_; } void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override @@ -8087,13 +9464,448 @@ namespace exprtk private: - vector_assignment_node(const vector_assignment_node&) exprtk_delete; - vector_assignment_node& operator=(const vector_assignment_node&) exprtk_delete; + vector_initialisation_node(const vector_initialisation_node&) exprtk_delete; + vector_initialisation_node& operator=(const vector_initialisation_node&) exprtk_delete; mutable T* vector_base_; std::vector initialiser_list_; const std::size_t size_; const bool single_value_initialse_; + bool zero_value_initialse_; + bool const_nonzero_literal_value_initialse_; + T single_initialiser_value_; + }; + + template + class vector_init_zero_value_node exprtk_final : public expression_node + { + public: + + typedef expression_node* expression_ptr; + + vector_init_zero_value_node(T* vector_base, + const std::size_t& size, + const std::vector& initialiser_list) + : vector_base_(vector_base) + , size_(size) + , initialiser_list_(initialiser_list) + {} + + inline T value() const exprtk_override + { + details::set_zero_value(vector_base_, size_); + return *(vector_base_); + } + + inline typename expression_node::node_type type() const exprtk_override + { + return expression_node::e_vecinit; + } + + inline bool valid() const exprtk_override + { + return vector_base_; + } + + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override + { + expression_node::ndb_t::collect(initialiser_list_, node_delete_list); + } + + std::size_t node_depth() const exprtk_override + { + return expression_node::ndb_t::compute_node_depth(initialiser_list_); + } + + private: + + vector_init_zero_value_node(const vector_init_zero_value_node&) exprtk_delete; + vector_init_zero_value_node& operator=(const vector_init_zero_value_node&) exprtk_delete; + + mutable T* vector_base_; + const std::size_t size_; + std::vector initialiser_list_; + }; + + template + class vector_init_single_constvalue_node exprtk_final : public expression_node + { + public: + + typedef expression_node* expression_ptr; + + vector_init_single_constvalue_node(T* vector_base, + const std::size_t& size, + const std::vector& initialiser_list) + : vector_base_(vector_base) + , size_(size) + , initialiser_list_(initialiser_list) + { + single_initialiser_value_ = initialiser_list_[0]->value(); + assert(valid()); + } + + inline T value() const exprtk_override + { + for (std::size_t i = 0; i < size_; ++i) + { + *(vector_base_ + i) = single_initialiser_value_; + } + + return *(vector_base_); + } + + inline typename expression_node::node_type type() const exprtk_override + { + return expression_node::e_vecinit; + } + + inline bool valid() const exprtk_override + { + return vector_base_ && + (initialiser_list_.size() == 1) && + (details::is_constant_node(initialiser_list_[0])) && + (single_initialiser_value_ != T(0)); + } + + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override + { + expression_node::ndb_t::collect(initialiser_list_, node_delete_list); + } + + std::size_t node_depth() const exprtk_override + { + return expression_node::ndb_t::compute_node_depth(initialiser_list_); + } + + private: + + vector_init_single_constvalue_node(const vector_init_single_constvalue_node&) exprtk_delete; + vector_init_single_constvalue_node& operator=(const vector_init_single_constvalue_node&) exprtk_delete; + + mutable T* vector_base_; + const std::size_t size_; + std::vector initialiser_list_; + T single_initialiser_value_; + }; + + template + class vector_init_single_value_node exprtk_final : public expression_node + { + public: + + typedef expression_node* expression_ptr; + + vector_init_single_value_node(T* vector_base, + const std::size_t& size, + const std::vector& initialiser_list) + : vector_base_(vector_base) + , size_(size) + , initialiser_list_(initialiser_list) + { + assert(valid()); + } + + inline T value() const exprtk_override + { + expression_node& node = *initialiser_list_[0]; + + for (std::size_t i = 0; i < size_; ++i) + { + *(vector_base_ + i) = node.value(); + } + + return *(vector_base_); + } + + inline typename expression_node::node_type type() const exprtk_override + { + return expression_node::e_vecinit; + } + + inline bool valid() const exprtk_override + { + return vector_base_ && + (initialiser_list_.size() == 1) && + !details::is_constant_node(initialiser_list_[0]); + } + + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override + { + expression_node::ndb_t::collect(initialiser_list_, node_delete_list); + } + + std::size_t node_depth() const exprtk_override + { + return expression_node::ndb_t::compute_node_depth(initialiser_list_); + } + + private: + + vector_init_single_value_node(const vector_init_single_value_node&) exprtk_delete; + vector_init_single_value_node& operator=(const vector_init_single_value_node&) exprtk_delete; + + mutable T* vector_base_; + const std::size_t size_; + std::vector initialiser_list_; + }; + + template + class vector_init_iota_constconst_node exprtk_final : public expression_node + { + public: + + typedef expression_node* expression_ptr; + + vector_init_iota_constconst_node(T* vector_base, + const std::size_t& size, + const std::vector& initialiser_list) + : vector_base_(vector_base) + , size_(size) + , initialiser_list_(initialiser_list) + { + base_value_ = initialiser_list_[0]->value(); + increment_value_ = initialiser_list_[1]->value(); + + assert(valid()); + } + + inline T value() const exprtk_override + { + T value = base_value_; + + for (std::size_t i = 0; i < size_; ++i, value += increment_value_) + { + *(vector_base_ + i) = value; + } + + return *(vector_base_); + } + + inline typename expression_node::node_type type() const exprtk_override + { + return expression_node::e_vecinit; + } + + inline bool valid() const exprtk_override + { + return vector_base_ && + (initialiser_list_.size() == 2) && + (details::is_constant_node(initialiser_list_[0])) && + (details::is_constant_node(initialiser_list_[1])) ; + } + + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override + { + expression_node::ndb_t::collect(initialiser_list_, node_delete_list); + } + + std::size_t node_depth() const exprtk_override + { + return expression_node::ndb_t::compute_node_depth(initialiser_list_); + } + + private: + + vector_init_iota_constconst_node(const vector_init_iota_constconst_node&) exprtk_delete; + vector_init_iota_constconst_node& operator=(const vector_init_iota_constconst_node&) exprtk_delete; + + mutable T* vector_base_; + const std::size_t size_; + std::vector initialiser_list_; + T base_value_; + T increment_value_; + }; + + template + class vector_init_iota_constnconst_node exprtk_final : public expression_node + { + public: + + typedef expression_node* expression_ptr; + + vector_init_iota_constnconst_node(T* vector_base, + const std::size_t& size, + const std::vector& initialiser_list) + : vector_base_(vector_base) + , size_(size) + , initialiser_list_(initialiser_list) + { + assert(valid()); + base_value_ = initialiser_list_[0]->value(); + } + + inline T value() const exprtk_override + { + T value = base_value_; + expression_node& increment = *initialiser_list_[1]; + + for (std::size_t i = 0; i < size_; ++i, value += increment.value()) + { + *(vector_base_ + i) = value; + } + + return *(vector_base_); + } + + inline typename expression_node::node_type type() const exprtk_override + { + return expression_node::e_vecinit; + } + + inline bool valid() const exprtk_override + { + return vector_base_ && + (initialiser_list_.size() == 2) && + ( details::is_constant_node(initialiser_list_[0])) && + (!details::is_constant_node(initialiser_list_[1])); + } + + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override + { + expression_node::ndb_t::collect(initialiser_list_, node_delete_list); + } + + std::size_t node_depth() const exprtk_override + { + return expression_node::ndb_t::compute_node_depth(initialiser_list_); + } + + private: + + vector_init_iota_constnconst_node(const vector_init_iota_constnconst_node&) exprtk_delete; + vector_init_iota_constnconst_node& operator=(const vector_init_iota_constnconst_node&) exprtk_delete; + + mutable T* vector_base_; + const std::size_t size_; + std::vector initialiser_list_; + T base_value_; + }; + + template + class vector_init_iota_nconstconst_node exprtk_final : public expression_node + { + public: + + typedef expression_node* expression_ptr; + + vector_init_iota_nconstconst_node(T* vector_base, + const std::size_t& size, + const std::vector& initialiser_list) + : vector_base_(vector_base) + , size_(size) + , initialiser_list_(initialiser_list) + { + assert(valid()); + } + + inline T value() const exprtk_override + { + T value = initialiser_list_[0]->value(); + const T increment = initialiser_list_[1]->value(); + + for (std::size_t i = 0; i < size_; ++i, value += increment) + { + *(vector_base_ + i) = value; + } + + return *(vector_base_); + } + + inline typename expression_node::node_type type() const exprtk_override + { + return expression_node::e_vecinit; + } + + inline bool valid() const exprtk_override + { + return vector_base_ && + (initialiser_list_.size() == 2) && + (!details::is_constant_node(initialiser_list_[0])) && + (details::is_constant_node(initialiser_list_[1])); + } + + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override + { + expression_node::ndb_t::collect(initialiser_list_, node_delete_list); + } + + std::size_t node_depth() const exprtk_override + { + return expression_node::ndb_t::compute_node_depth(initialiser_list_); + } + + private: + + vector_init_iota_nconstconst_node(const vector_init_iota_nconstconst_node&) exprtk_delete; + vector_init_iota_nconstconst_node& operator=(const vector_init_iota_nconstconst_node&) exprtk_delete; + + mutable T* vector_base_; + const std::size_t size_; + std::vector initialiser_list_; + }; + + template + class vector_init_iota_nconstnconst_node exprtk_final : public expression_node + { + public: + + typedef expression_node* expression_ptr; + + vector_init_iota_nconstnconst_node(T* vector_base, + const std::size_t& size, + const std::vector& initialiser_list) + : vector_base_(vector_base) + , size_(size) + , initialiser_list_(initialiser_list) + { + assert(valid()); + } + + inline T value() const exprtk_override + { + T value = initialiser_list_[0]->value(); + expression_node& increment = *initialiser_list_[1]; + + for (std::size_t i = 0; i < size_; ++i, value += increment.value()) + { + *(vector_base_ + i) = value; + } + + return *(vector_base_); + } + + inline typename expression_node::node_type type() const exprtk_override + { + return expression_node::e_vecinit; + } + + inline bool valid() const exprtk_override + { + return vector_base_ && + (initialiser_list_.size() == 2) && + (!details::is_constant_node(initialiser_list_[0])) && + (!details::is_constant_node(initialiser_list_[1])); + } + + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override + { + expression_node::ndb_t::collect(initialiser_list_, node_delete_list); + } + + std::size_t node_depth() const exprtk_override + { + return expression_node::ndb_t::compute_node_depth(initialiser_list_); + } + + private: + + vector_init_iota_nconstnconst_node(const vector_init_iota_nconstnconst_node&) exprtk_delete; + vector_init_iota_nconstnconst_node& operator=(const vector_init_iota_nconstnconst_node&) exprtk_delete; + + mutable T* vector_base_; + const std::size_t size_; + std::vector initialiser_list_; }; template @@ -8175,7 +9987,6 @@ namespace exprtk : binary_node(details::e_swap, branch0, branch1) , vec0_node_ptr_(0) , vec1_node_ptr_(0) - , vec_size_ (0) , initialised_ (false) { if (is_ivector_node(branch(0))) @@ -8201,37 +10012,29 @@ namespace exprtk if (vec0_node_ptr_ && vec1_node_ptr_) { - vec_size_ = std::min(vec0_node_ptr_->vds().size(), - vec1_node_ptr_->vds().size()); - - initialised_ = true; + initialised_ = size() <= base_size(); } - assert(initialised_); + assert(valid()); } inline T value() const exprtk_override { - if (initialised_) + binary_node::branch(0)->value(); + binary_node::branch(1)->value(); + + T* vec0 = vec0_node_ptr_->vds().data(); + T* vec1 = vec1_node_ptr_->vds().data(); + + assert(size() <= base_size()); + const std::size_t n = size(); + + for (std::size_t i = 0; i < n; ++i) { - assert(branch(0)); - assert(branch(1)); - - binary_node::branch(0)->value(); - binary_node::branch(1)->value(); - - T* vec0 = vec0_node_ptr_->vds().data(); - T* vec1 = vec1_node_ptr_->vds().data(); - - for (std::size_t i = 0; i < vec_size_; ++i) - { - std::swap(vec0[i],vec1[i]); - } - - return vec1_node_ptr_->value(); + std::swap(vec0[i],vec1[i]); } - else - return std::numeric_limits::quiet_NaN(); + + return vec1_node_ptr_->value(); } vector_node_ptr vec() const exprtk_override @@ -8249,9 +10052,23 @@ namespace exprtk return expression_node::e_vecvecswap; } + inline bool valid() const exprtk_override + { + return initialised_ && binary_node::valid(); + } + std::size_t size() const exprtk_override { - return vec_size_; + return std::min( + vec0_node_ptr_->vec_holder().size(), + vec1_node_ptr_->vec_holder().size()); + } + + std::size_t base_size() const exprtk_override + { + return std::min( + vec0_node_ptr_->vec_holder().base_size(), + vec1_node_ptr_->vec_holder().base_size()); } vds_t& vds() exprtk_override @@ -8268,7 +10085,6 @@ namespace exprtk vector_node* vec0_node_ptr_; vector_node* vec1_node_ptr_; - std::size_t vec_size_; bool initialised_; vds_t vds_; }; @@ -8276,9 +10092,9 @@ namespace exprtk #ifndef exprtk_disable_string_capabilities template class stringvar_node exprtk_final - : public expression_node , - public string_base_node, - public range_interface + : public expression_node + , public string_base_node + , public range_interface { public: @@ -8294,7 +10110,7 @@ namespace exprtk : value_(&v) { rp_.n0_c = std::make_pair(true,0); - rp_.n1_c = std::make_pair(true,v.size() - 1); + rp_.n1_c = std::make_pair(true,v.size()); rp_.cache.first = rp_.n0_c.second; rp_.cache.second = rp_.n1_c.second; } @@ -8306,7 +10122,7 @@ namespace exprtk inline T value() const exprtk_override { - rp_.n1_c.second = (*value_).size() - 1; + rp_.n1_c.second = (*value_).size(); rp_.cache.second = rp_.n1_c.second; return std::numeric_limits::quiet_NaN(); @@ -8372,9 +10188,9 @@ namespace exprtk template class string_range_node exprtk_final - : public expression_node , - public string_base_node, - public range_interface + : public expression_node + , public string_base_node + , public range_interface { public: @@ -8458,9 +10274,9 @@ namespace exprtk template class const_string_range_node exprtk_final - : public expression_node , - public string_base_node, - public range_interface + : public expression_node + , public string_base_node + , public range_interface { public: @@ -8527,9 +10343,9 @@ namespace exprtk template class generic_string_range_node exprtk_final - : public expression_node , - public string_base_node, - public range_interface + : public expression_node + , public string_base_node + , public range_interface { public: @@ -8569,8 +10385,7 @@ namespace exprtk } initialised_ = (str_base_ptr_ && str_range_ptr_); - - assert(initialised_); + assert(valid()); } ~generic_string_range_node() @@ -8580,34 +10395,29 @@ namespace exprtk inline T value() const exprtk_override { - if (initialised_) + branch_.first->value(); + + std::size_t str_r0 = 0; + std::size_t str_r1 = 0; + + std::size_t r0 = 0; + std::size_t r1 = 0; + + const range_t& range = str_range_ptr_->range_ref(); + + const std::size_t base_str_size = str_base_ptr_->size(); + + if ( + range (str_r0, str_r1, base_str_size ) && + base_range_(r0 , r1 , base_str_size - str_r0) + ) { - assert(branch_.first); + const std::size_t size = r1 - r0; - branch_.first->value(); + range_.n1_c.second = size; + range_.cache.second = range_.n1_c.second; - std::size_t str_r0 = 0; - std::size_t str_r1 = 0; - - std::size_t r0 = 0; - std::size_t r1 = 0; - - const range_t& range = str_range_ptr_->range_ref(); - - const std::size_t base_str_size = str_base_ptr_->size(); - - if ( - range (str_r0, str_r1, base_str_size) && - base_range_( r0, r1, base_str_size - str_r0) - ) - { - const std::size_t size = (r1 - r0) + 1; - - range_.n1_c.second = size - 1; - range_.cache.second = range_.n1_c.second; - - value_.assign(str_base_ptr_->base() + str_r0 + r0, size); - } + value_.assign(str_base_ptr_->base() + str_r0 + r0, size); } return std::numeric_limits::quiet_NaN(); @@ -8643,6 +10453,11 @@ namespace exprtk return expression_node::e_strgenrange; } + inline bool valid() const exprtk_override + { + return initialised_ && branch_.first; + } + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override { expression_node::ndb_t::collect(branch_, node_delete_list); @@ -8666,9 +10481,9 @@ namespace exprtk template class string_concat_node exprtk_final - : public binary_node , - public string_base_node, - public range_interface + : public binary_node + , public string_base_node + , public range_interface { public: @@ -8728,42 +10543,36 @@ namespace exprtk str0_range_ptr_ && str1_range_ptr_ ; - assert(initialised_); + assert(valid()); } inline T value() const exprtk_override { - if (initialised_) + branch(0)->value(); + branch(1)->value(); + + std::size_t str0_r0 = 0; + std::size_t str0_r1 = 0; + + std::size_t str1_r0 = 0; + std::size_t str1_r1 = 0; + + const range_t& range0 = str0_range_ptr_->range_ref(); + const range_t& range1 = str1_range_ptr_->range_ref(); + + if ( + range0(str0_r0, str0_r1, str0_base_ptr_->size()) && + range1(str1_r0, str1_r1, str1_base_ptr_->size()) + ) { - assert(branch(0)); - assert(branch(1)); + const std::size_t size0 = (str0_r1 - str0_r0); + const std::size_t size1 = (str1_r1 - str1_r0); - branch(0)->value(); - branch(1)->value(); + value_.assign(str0_base_ptr_->base() + str0_r0, size0); + value_.append(str1_base_ptr_->base() + str1_r0, size1); - std::size_t str0_r0 = 0; - std::size_t str0_r1 = 0; - - std::size_t str1_r0 = 0; - std::size_t str1_r1 = 0; - - const range_t& range0 = str0_range_ptr_->range_ref(); - const range_t& range1 = str1_range_ptr_->range_ref(); - - if ( - range0(str0_r0, str0_r1, str0_base_ptr_->size()) && - range1(str1_r0, str1_r1, str1_base_ptr_->size()) - ) - { - const std::size_t size0 = (str0_r1 - str0_r0) + 1; - const std::size_t size1 = (str1_r1 - str1_r0) + 1; - - value_.assign(str0_base_ptr_->base() + str0_r0, size0); - value_.append(str1_base_ptr_->base() + str1_r0, size1); - - range_.n1_c.second = value_.size() - 1; - range_.cache.second = range_.n1_c.second; - } + range_.n1_c.second = value_.size(); + range_.cache.second = range_.n1_c.second; } return std::numeric_limits::quiet_NaN(); @@ -8799,6 +10608,11 @@ namespace exprtk return expression_node::e_strconcat; } + inline bool valid() const exprtk_override + { + return initialised_ && binary_node::valid(); + } + private: bool initialised_; @@ -8812,9 +10626,9 @@ namespace exprtk template class swap_string_node exprtk_final - : public binary_node , - public string_base_node, - public range_interface + : public binary_node + , public string_base_node + , public range_interface { public: @@ -8829,10 +10643,10 @@ namespace exprtk using binary_node::branch; swap_string_node(expression_ptr branch0, expression_ptr branch1) - : binary_node(details::e_swap, branch0, branch1), - initialised_(false), - str0_node_ptr_(0), - str1_node_ptr_(0) + : binary_node(details::e_swap, branch0, branch1) + , initialised_(false) + , str0_node_ptr_(0) + , str1_node_ptr_(0) { if (is_string_node(branch(0))) { @@ -8845,22 +10659,15 @@ namespace exprtk } initialised_ = (str0_node_ptr_ && str1_node_ptr_); - - assert(initialised_); + assert(valid()); } inline T value() const exprtk_override { - if (initialised_) - { - assert(branch(0)); - assert(branch(1)); + branch(0)->value(); + branch(1)->value(); - branch(0)->value(); - branch(1)->value(); - - std::swap(str0_node_ptr_->ref(), str1_node_ptr_->ref()); - } + std::swap(str0_node_ptr_->ref(), str1_node_ptr_->ref()); return std::numeric_limits::quiet_NaN(); } @@ -8895,6 +10702,11 @@ namespace exprtk return expression_node::e_strswap; } + inline bool valid() const exprtk_override + { + return initialised_ && binary_node::valid(); + } + private: bool initialised_; @@ -8960,87 +10772,81 @@ namespace exprtk str0_range_ptr_ && str1_range_ptr_ ; - assert(initialised_); + assert(valid()); } inline T value() const exprtk_override { - if (initialised_) + branch(0)->value(); + branch(1)->value(); + + std::size_t str0_r0 = 0; + std::size_t str0_r1 = 0; + + std::size_t str1_r0 = 0; + std::size_t str1_r1 = 0; + + const range_t& range0 = (*str0_range_ptr_); + const range_t& range1 = (*str1_range_ptr_); + + if ( + range0(str0_r0, str0_r1, str0_base_ptr_->size()) && + range1(str1_r0, str1_r1, str1_base_ptr_->size()) + ) { - assert(branch(0)); - assert(branch(1)); + const std::size_t size0 = range0.cache_size(); + const std::size_t size1 = range1.cache_size(); + const std::size_t max_size = std::min(size0,size1); - branch(0)->value(); - branch(1)->value(); + char_ptr s0 = const_cast(str0_base_ptr_->base() + str0_r0); + char_ptr s1 = const_cast(str1_base_ptr_->base() + str1_r0); - std::size_t str0_r0 = 0; - std::size_t str0_r1 = 0; + loop_unroll::details lud(max_size); + char_cptr upper_bound = s0 + lud.upper_bound; - std::size_t str1_r0 = 0; - std::size_t str1_r1 = 0; - - const range_t& range0 = (*str0_range_ptr_); - const range_t& range1 = (*str1_range_ptr_); - - if ( - range0(str0_r0, str0_r1, str0_base_ptr_->size()) && - range1(str1_r0, str1_r1, str1_base_ptr_->size()) - ) + while (s0 < upper_bound) { - const std::size_t size0 = range0.cache_size(); - const std::size_t size1 = range1.cache_size(); - const std::size_t max_size = std::min(size0,size1); + #define exprtk_loop(N) \ + std::swap(s0[N], s1[N]); \ - char_ptr s0 = const_cast(str0_base_ptr_->base() + str0_r0); - char_ptr s1 = const_cast(str1_base_ptr_->base() + str1_r0); + exprtk_loop( 0) exprtk_loop( 1) + exprtk_loop( 2) exprtk_loop( 3) + #ifndef exprtk_disable_superscalar_unroll + exprtk_loop( 4) exprtk_loop( 5) + exprtk_loop( 6) exprtk_loop( 7) + exprtk_loop( 8) exprtk_loop( 9) + exprtk_loop(10) exprtk_loop(11) + exprtk_loop(12) exprtk_loop(13) + exprtk_loop(14) exprtk_loop(15) + #endif - loop_unroll::details lud(max_size); - char_cptr upper_bound = s0 + lud.upper_bound; - - while (s0 < upper_bound) - { - #define exprtk_loop(N) \ - std::swap(s0[N], s1[N]); \ - - exprtk_loop( 0) exprtk_loop( 1) - exprtk_loop( 2) exprtk_loop( 3) - #ifndef exprtk_disable_superscalar_unroll - exprtk_loop( 4) exprtk_loop( 5) - exprtk_loop( 6) exprtk_loop( 7) - exprtk_loop( 8) exprtk_loop( 9) - exprtk_loop(10) exprtk_loop(11) - exprtk_loop(12) exprtk_loop(13) - exprtk_loop(14) exprtk_loop(15) - #endif - - s0 += lud.batch_size; - s1 += lud.batch_size; - } - - int i = 0; - - exprtk_disable_fallthrough_begin - switch (lud.remainder) - { - #define case_stmt(N) \ - case N : { std::swap(s0[i], s1[i]); ++i; } \ - - #ifndef exprtk_disable_superscalar_unroll - case_stmt(15) case_stmt(14) - case_stmt(13) case_stmt(12) - case_stmt(11) case_stmt(10) - case_stmt( 9) case_stmt( 8) - case_stmt( 7) case_stmt( 6) - case_stmt( 5) case_stmt( 4) - #endif - case_stmt( 3) case_stmt( 2) - case_stmt( 1) - } - exprtk_disable_fallthrough_end - - #undef exprtk_loop - #undef case_stmt + s0 += lud.batch_size; + s1 += lud.batch_size; } + + int i = 0; + + switch (lud.remainder) + { + #define case_stmt(N) \ + case N : { std::swap(s0[i], s1[i]); ++i; } \ + exprtk_fallthrough \ + + #ifndef exprtk_disable_superscalar_unroll + case_stmt(15) case_stmt(14) + case_stmt(13) case_stmt(12) + case_stmt(11) case_stmt(10) + case_stmt( 9) case_stmt( 8) + case_stmt( 7) case_stmt( 6) + case_stmt( 5) case_stmt( 4) + #endif + case_stmt( 3) case_stmt( 2) + case_stmt( 1) + default: break; + } + + #undef exprtk_loop + #undef case_stmt } return std::numeric_limits::quiet_NaN(); @@ -9051,6 +10857,11 @@ namespace exprtk return expression_node::e_strswap; } + inline bool valid() const exprtk_override + { + return initialised_ && binary_node::valid(); + } + private: swap_genstrings_node(const swap_genstrings_node&) exprtk_delete; @@ -9068,7 +10879,7 @@ namespace exprtk { public: - static std::string null_value; + static const std::string null_value; explicit stringvar_size_node() : value_(&null_value) @@ -9090,11 +10901,11 @@ namespace exprtk private: - std::string* value_; + const std::string* value_; }; template - std::string stringvar_size_node::null_value = std::string(""); + const std::string stringvar_size_node::null_value = std::string(""); template class string_size_node exprtk_final : public expression_node @@ -9113,23 +10924,15 @@ namespace exprtk if (is_generally_string_node(branch_.first)) { str_base_ptr_ = dynamic_cast(branch_.first); - - if (0 == str_base_ptr_) - return; } + + assert(valid()); } inline T value() const exprtk_override { - T result = std::numeric_limits::quiet_NaN(); - - if (str_base_ptr_) - { - branch_.first->value(); - result = T(str_base_ptr_->size()); - } - - return result; + branch_.first->value(); + return T(str_base_ptr_->size()); } inline typename expression_node::node_type type() const exprtk_override @@ -9137,6 +10940,11 @@ namespace exprtk return expression_node::e_stringsize; } + inline bool valid() const exprtk_override + { + return str_base_ptr_; + } + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override { expression_node::ndb_t::collect(branch_, node_delete_list); @@ -9149,7 +10957,7 @@ namespace exprtk private: - branch_t branch_; + branch_t branch_; str_base_ptr str_base_ptr_; }; @@ -9167,9 +10975,9 @@ namespace exprtk template class assignment_string_node exprtk_final - : public binary_node , - public string_base_node, - public range_interface + : public binary_node + , public string_base_node + , public range_interface { public: @@ -9219,31 +11027,25 @@ namespace exprtk str0_node_ptr_ && str1_range_ptr_ ; - assert(initialised_); + assert(valid()); } inline T value() const exprtk_override { - if (initialised_) + branch(1)->value(); + + std::size_t r0 = 0; + std::size_t r1 = 0; + + const range_t& range = (*str1_range_ptr_); + + if (range(r0, r1, str1_base_ptr_->size())) { - assert(branch(0)); - assert(branch(1)); + AssignmentProcess::execute( + str0_node_ptr_->ref(), + str1_base_ptr_->base() + r0, (r1 - r0)); - branch(1)->value(); - - std::size_t r0 = 0; - std::size_t r1 = 0; - - const range_t& range = (*str1_range_ptr_); - - if (range(r0, r1, str1_base_ptr_->size())) - { - AssignmentProcess::execute(str0_node_ptr_->ref(), - str1_base_ptr_->base() + r0, - (r1 - r0) + 1); - - branch(0)->value(); - } + branch(0)->value(); } return std::numeric_limits::quiet_NaN(); @@ -9279,6 +11081,11 @@ namespace exprtk return expression_node::e_strass; } + inline bool valid() const exprtk_override + { + return initialised_ && binary_node::valid(); + } + private: bool initialised_; @@ -9290,9 +11097,9 @@ namespace exprtk template class assignment_string_range_node exprtk_final - : public binary_node , - public string_base_node, - public range_interface + : public binary_node + , public string_base_node + , public range_interface { public: @@ -9351,39 +11158,34 @@ namespace exprtk str0_range_ptr_ && str1_range_ptr_ ; - assert(initialised_); + assert(valid()); } inline T value() const exprtk_override { - if (initialised_) + branch(0)->value(); + branch(1)->value(); + + std::size_t s0_r0 = 0; + std::size_t s0_r1 = 0; + + std::size_t s1_r0 = 0; + std::size_t s1_r1 = 0; + + const range_t& range0 = (*str0_range_ptr_); + const range_t& range1 = (*str1_range_ptr_); + + if ( + range0(s0_r0, s0_r1, str0_base_ptr_->size()) && + range1(s1_r0, s1_r1, str1_base_ptr_->size()) + ) { - assert(branch(0)); - assert(branch(1)); + const std::size_t size = std::min((s0_r1 - s0_r0), (s1_r1 - s1_r0)); - branch(0)->value(); - branch(1)->value(); - - std::size_t s0_r0 = 0; - std::size_t s0_r1 = 0; - - std::size_t s1_r0 = 0; - std::size_t s1_r1 = 0; - - const range_t& range0 = (*str0_range_ptr_); - const range_t& range1 = (*str1_range_ptr_); - - if ( - range0(s0_r0, s0_r1, str0_base_ptr_->size()) && - range1(s1_r0, s1_r1, str1_base_ptr_->size()) - ) - { - const std::size_t size = std::min((s0_r1 - s0_r0), (s1_r1 - s1_r0)) + 1; - - std::copy(str1_base_ptr_->base() + s1_r0, - str1_base_ptr_->base() + s1_r0 + size, - const_cast(base() + s0_r0)); - } + std::copy( + str1_base_ptr_->base() + s1_r0, + str1_base_ptr_->base() + s1_r0 + size, + const_cast(base() + s0_r0)); } return std::numeric_limits::quiet_NaN(); @@ -9419,6 +11221,11 @@ namespace exprtk return expression_node::e_strass; } + inline bool valid() const exprtk_override + { + return initialised_ && binary_node::valid(); + } + private: bool initialised_; @@ -9431,9 +11238,9 @@ namespace exprtk template class conditional_string_node exprtk_final - : public trinary_node , - public string_base_node, - public range_interface + : public trinary_node + , public string_base_node + , public range_interface { public: @@ -9494,55 +11301,48 @@ namespace exprtk str0_range_ptr_ && str1_range_ptr_ ; - assert(initialised_); + assert(valid()); } inline T value() const exprtk_override { - if (initialised_) + std::size_t r0 = 0; + std::size_t r1 = 0; + + if (is_true(condition_)) { - assert(condition_ ); - assert(consequent_ ); - assert(alternative_); + consequent_->value(); - std::size_t r0 = 0; - std::size_t r1 = 0; + const range_t& range = str0_range_ptr_->range_ref(); - if (is_true(condition_)) + if (range(r0, r1, str0_base_ptr_->size())) { - consequent_->value(); + const std::size_t size = (r1 - r0); - const range_t& range = str0_range_ptr_->range_ref(); + value_.assign(str0_base_ptr_->base() + r0, size); - if (range(r0, r1, str0_base_ptr_->size())) - { - const std::size_t size = (r1 - r0) + 1; + range_.n1_c.second = value_.size(); + range_.cache.second = range_.n1_c.second; - value_.assign(str0_base_ptr_->base() + r0, size); - - range_.n1_c.second = value_.size() - 1; - range_.cache.second = range_.n1_c.second; - - return T(1); - } + return T(1); } - else + } + else + { + alternative_->value(); + + const range_t& range = str1_range_ptr_->range_ref(); + + if (range(r0, r1, str1_base_ptr_->size())) { - alternative_->value(); + const std::size_t size = (r1 - r0); - const range_t& range = str1_range_ptr_->range_ref(); + value_.assign(str1_base_ptr_->base() + r0, size); - if (range(r0, r1, str1_base_ptr_->size())) - { - const std::size_t size = (r1 - r0) + 1; + range_.n1_c.second = value_.size(); + range_.cache.second = range_.n1_c.second; - value_.assign(str1_base_ptr_->base() + r0, size); - - range_.n1_c.second = value_.size() - 1; - range_.cache.second = range_.n1_c.second; - - return T(0); - } + return T(0); } } @@ -9579,6 +11379,15 @@ namespace exprtk return expression_node::e_strcondition; } + inline bool valid() const exprtk_override + { + return + initialised_ && + condition_ && condition_ ->valid() && + consequent_ && consequent_ ->valid() && + alternative_&& alternative_->valid() ; + } + private: bool initialised_; @@ -9596,9 +11405,9 @@ namespace exprtk template class cons_conditional_str_node exprtk_final - : public binary_node , - public string_base_node, - public range_interface + : public binary_node + , public string_base_node + , public range_interface { public: @@ -9640,37 +11449,30 @@ namespace exprtk } initialised_ = str0_base_ptr_ && str0_range_ptr_ ; - - assert(initialised_); + assert(valid()); } inline T value() const exprtk_override { - if (initialised_) + if (is_true(condition_)) { - assert(condition_ ); - assert(consequent_); + consequent_->value(); - if (is_true(condition_)) + const range_t& range = str0_range_ptr_->range_ref(); + + std::size_t r0 = 0; + std::size_t r1 = 0; + + if (range(r0, r1, str0_base_ptr_->size())) { - consequent_->value(); + const std::size_t size = (r1 - r0); - const range_t& range = str0_range_ptr_->range_ref(); + value_.assign(str0_base_ptr_->base() + r0, size); - std::size_t r0 = 0; - std::size_t r1 = 0; + range_.n1_c.second = value_.size(); + range_.cache.second = range_.n1_c.second; - if (range(r0, r1, str0_base_ptr_->size())) - { - const std::size_t size = (r1 - r0) + 1; - - value_.assign(str0_base_ptr_->base() + r0, size); - - range_.n1_c.second = value_.size() - 1; - range_.cache.second = range_.n1_c.second; - - return T(1); - } + return T(1); } } @@ -9707,6 +11509,14 @@ namespace exprtk return expression_node::e_strccondition; } + inline bool valid() const exprtk_override + { + return + initialised_ && + condition_ && condition_ ->valid() && + consequent_ && consequent_ ->valid() ; + } + private: bool initialised_; @@ -9721,9 +11531,9 @@ namespace exprtk template class str_vararg_node exprtk_final - : public expression_node , - public string_base_node, - public range_interface + : public expression_node + , public string_base_node + , public range_interface { public: @@ -9759,8 +11569,6 @@ namespace exprtk if (0 == str_range_ptr_) return; - initialised_ = str_base_ptr_ && str_range_ptr_; - if (arg_list.size() > 1) { const std::size_t arg_list_size = arg_list.size() - 1; @@ -9769,7 +11577,7 @@ namespace exprtk for (std::size_t i = 0; i < arg_list_size; ++i) { - if (arg_list[i]) + if (arg_list[i] && arg_list[i]->valid()) { construct_branch_pair(arg_list_[i], arg_list[i]); } @@ -9779,7 +11587,12 @@ namespace exprtk return; } } + + initialised_ = true; } + + initialised_ &= str_base_ptr_ && str_range_ptr_; + assert(valid()); } inline T value() const exprtk_override @@ -9824,6 +11637,13 @@ namespace exprtk return expression_node::e_stringvararg; } + inline bool valid() const exprtk_override + { + return + initialised_ && + final_node_.first && final_node_.first->valid(); + } + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override { expression_node::ndb_t::collect(final_node_ , node_delete_list); @@ -9847,6 +11667,104 @@ namespace exprtk }; #endif + template + class assert_node exprtk_final : public expression_node + { + public: + + typedef expression_node* expression_ptr; + typedef std::pair branch_t; + typedef string_base_node* str_base_ptr; + typedef assert_check::assert_context assert_context_t; + + assert_node(expression_ptr assert_condition_node, + expression_ptr assert_message_node, + assert_check_ptr assert_check, + assert_context_t context) + : assert_message_str_base_(0) + , assert_check_(assert_check) + , context_(context) + { + construct_branch_pair(assert_condition_node_, assert_condition_node); + construct_branch_pair(assert_message_node_ , assert_message_node ); + + #ifndef exprtk_disable_string_capabilities + if ( + assert_message_node_.first && + details::is_generally_string_node(assert_message_node_.first) + ) + { + assert_message_str_base_ = dynamic_cast(assert_message_node_.first); + } + #endif + + assert(valid()); + } + + inline T value() const exprtk_override + { + if (details::is_true(assert_condition_node_.first->value())) + { + return T(1); + } + + #ifndef exprtk_disable_string_capabilities + if (assert_message_node_.first) + { + assert_message_node_.first->value(); + assert(assert_message_str_base_); + context_.message = assert_message_str_base_->str(); + } + #endif + + assert_check_->handle_assert(context_); + return T(0); + } + + inline typename expression_node::node_type type() const exprtk_override + { + return expression_node::e_assert; + } + + inline bool valid() const exprtk_override + { + return ( + assert_check_ && + assert_condition_node_.first && + assert_condition_node_.first->valid() + ) && + ( + (0 == assert_message_node_.first) || + ( + assert_message_node_.first && + assert_message_str_base_ && + assert_message_node_.first->valid() && + details::is_generally_string_node(assert_message_node_.first) + ) + ); + } + + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override + { + expression_node::ndb_t::collect(assert_condition_node_, node_delete_list); + expression_node::ndb_t::collect(assert_message_node_ , node_delete_list); + } + + std::size_t node_depth() const exprtk_override + { + return expression_node::ndb_t::compute_node_depth + (assert_condition_node_, assert_message_node_); + } + + private: + + branch_t assert_condition_node_; + branch_t assert_message_node_; + str_base_ptr assert_message_str_base_; + assert_check_ptr assert_check_; + mutable assert_context_t context_; + }; + template inline T axn(const T a, const T x) { @@ -10087,10 +12005,6 @@ namespace exprtk inline T value() const exprtk_override { - assert(trinary_node::branch_[0].first); - assert(trinary_node::branch_[1].first); - assert(trinary_node::branch_[2].first); - const T x = trinary_node::branch_[0].first->value(); const T y = trinary_node::branch_[1].first->value(); const T z = trinary_node::branch_[2].first->value(); @@ -10116,11 +12030,6 @@ namespace exprtk inline T value() const exprtk_override { - assert(quaternary_node::branch_[0].first); - assert(quaternary_node::branch_[1].first); - assert(quaternary_node::branch_[2].first); - assert(quaternary_node::branch_[3].first); - const T x = quaternary_node::branch_[0].first->value(); const T y = quaternary_node::branch_[1].first->value(); const T z = quaternary_node::branch_[2].first->value(); @@ -10209,12 +12118,13 @@ namespace exprtk template class Sequence> explicit vararg_node(const Sequence& arg_list) + : initialised_(false) { arg_list_.resize(arg_list.size()); for (std::size_t i = 0; i < arg_list.size(); ++i) { - if (arg_list[i]) + if (arg_list[i] && arg_list[i]->valid()) { construct_branch_pair(arg_list_[i],arg_list[i]); } @@ -10224,6 +12134,9 @@ namespace exprtk return; } } + + initialised_ = (arg_list_.size() == arg_list.size()); + assert(valid()); } inline T value() const exprtk_override @@ -10236,6 +12149,11 @@ namespace exprtk return expression_node::e_vararg; } + inline bool valid() const exprtk_override + { + return initialised_; + } + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override { expression_node::ndb_t::collect(arg_list_, node_delete_list); @@ -10246,9 +12164,20 @@ namespace exprtk return expression_node::ndb_t::compute_node_depth(arg_list_); } + std::size_t size() const + { + return arg_list_.size(); + } + + expression_ptr operator[](const std::size_t& index) const + { + return arg_list_[index].first; + } + private: std::vector arg_list_; + bool initialised_; }; template @@ -10261,12 +12190,13 @@ namespace exprtk template class Sequence> explicit vararg_varnode(const Sequence& arg_list) + : initialised_(false) { arg_list_.resize(arg_list.size()); for (std::size_t i = 0; i < arg_list.size(); ++i) { - if (arg_list[i] && is_variable_node(arg_list[i])) + if (arg_list[i] && arg_list[i]->valid() && is_variable_node(arg_list[i])) { variable_node* var_node_ptr = static_cast*>(arg_list[i]); arg_list_[i] = (&var_node_ptr->ref()); @@ -10277,14 +12207,14 @@ namespace exprtk return; } } + + initialised_ = (arg_list.size() == arg_list_.size()); + assert(valid()); } inline T value() const exprtk_override { - if (!arg_list_.empty()) - return VarArgFunction::process(arg_list_); - else - return std::numeric_limits::quiet_NaN(); + return VarArgFunction::process(arg_list_); } inline typename expression_node::node_type type() const exprtk_override @@ -10292,9 +12222,15 @@ namespace exprtk return expression_node::e_vararg; } + inline bool valid() const exprtk_override + { + return initialised_; + } + private: std::vector arg_list_; + bool initialised_; }; template @@ -10314,22 +12250,12 @@ namespace exprtk { ivec_ptr_ = dynamic_cast*>(v_.first); } - else - ivec_ptr_ = 0; } inline T value() const exprtk_override { - if (ivec_ptr_) - { - assert(v_.first); - - v_.first->value(); - - return VecFunction::process(ivec_ptr_); - } - else - return std::numeric_limits::quiet_NaN(); + v_.first->value(); + return VecFunction::process(ivec_ptr_); } inline typename expression_node::node_type type() const exprtk_override @@ -10337,6 +12263,11 @@ namespace exprtk return expression_node::e_vecfunc; } + inline bool valid() const exprtk_override + { + return ivec_ptr_ && v_.first && v_.first->valid(); + } + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override { expression_node::ndb_t::collect(v_, node_delete_list); @@ -10375,17 +12306,15 @@ namespace exprtk inline T value() const exprtk_override { - if (var_node_ptr_) - { - assert(branch(1)); - - T& result = var_node_ptr_->ref(); + T& result = var_node_ptr_->ref(); result = branch(1)->value(); - return result; - } - else - return std::numeric_limits::quiet_NaN(); + return result; + } + + inline bool valid() const exprtk_override + { + return var_node_ptr_ && binary_node::valid(); } private: @@ -10411,21 +12340,21 @@ namespace exprtk { vec_node_ptr_ = static_cast*>(branch(0)); } + + assert(valid()); } inline T value() const exprtk_override { - if (vec_node_ptr_) - { - assert(branch(1)); - - T& result = vec_node_ptr_->ref(); + T& result = vec_node_ptr_->ref(); result = branch(1)->value(); - return result; - } - else - return std::numeric_limits::quiet_NaN(); + return result; + } + + inline bool valid() const exprtk_override + { + return vec_node_ptr_ && binary_node::valid(); } private: @@ -10433,6 +12362,46 @@ namespace exprtk vector_elem_node* vec_node_ptr_; }; + template + class assignment_vec_elem_rtc_node exprtk_final : public binary_node + { + public: + + typedef expression_node* expression_ptr; + using binary_node::branch; + + assignment_vec_elem_rtc_node(const operator_type& opr, + expression_ptr branch0, + expression_ptr branch1) + : binary_node(opr, branch0, branch1) + , vec_node_ptr_(0) + { + if (is_vector_elem_rtc_node(branch(0))) + { + vec_node_ptr_ = static_cast*>(branch(0)); + } + + assert(valid()); + } + + inline T value() const exprtk_override + { + T& result = vec_node_ptr_->ref(); + result = branch(1)->value(); + + return result; + } + + inline bool valid() const exprtk_override + { + return vec_node_ptr_ && binary_node::valid(); + } + + private: + + vector_elem_rtc_node* vec_node_ptr_; + }; + template class assignment_rebasevec_elem_node exprtk_final : public binary_node { @@ -10451,22 +12420,21 @@ namespace exprtk { rbvec_node_ptr_ = static_cast*>(branch(0)); } + + assert(valid()); } inline T value() const exprtk_override { - if (rbvec_node_ptr_) - { - assert(branch(1)); - - T& result = rbvec_node_ptr_->ref(); - + T& result = rbvec_node_ptr_->ref(); result = branch(1)->value(); - return result; - } - else - return std::numeric_limits::quiet_NaN(); + return result; + } + + inline bool valid() const exprtk_override + { + return rbvec_node_ptr_ && binary_node::valid(); } private: @@ -10474,6 +12442,46 @@ namespace exprtk rebasevector_elem_node* rbvec_node_ptr_; }; + template + class assignment_rebasevec_elem_rtc_node exprtk_final : public binary_node + { + public: + + typedef expression_node* expression_ptr; + using expression_node::branch; + + assignment_rebasevec_elem_rtc_node(const operator_type& opr, + expression_ptr branch0, + expression_ptr branch1) + : binary_node(opr, branch0, branch1) + , rbvec_node_ptr_(0) + { + if (is_rebasevector_elem_rtc_node(branch(0))) + { + rbvec_node_ptr_ = static_cast*>(branch(0)); + } + + assert(valid()); + } + + inline T value() const exprtk_override + { + T& result = rbvec_node_ptr_->ref(); + result = branch(1)->value(); + + return result; + } + + inline bool valid() const exprtk_override + { + return rbvec_node_ptr_ && binary_node::valid(); + } + + private: + + rebasevector_elem_rtc_node* rbvec_node_ptr_; + }; + template class assignment_rebasevec_celem_node exprtk_final : public binary_node { @@ -10492,21 +12500,21 @@ namespace exprtk { rbvec_node_ptr_ = static_cast*>(branch(0)); } + + assert(valid()); } inline T value() const exprtk_override { - if (rbvec_node_ptr_) - { - assert(branch(1)); - - T& result = rbvec_node_ptr_->ref(); + T& result = rbvec_node_ptr_->ref(); result = branch(1)->value(); - return result; - } - else - return std::numeric_limits::quiet_NaN(); + return result; + } + + inline bool valid() const exprtk_override + { + return rbvec_node_ptr_ && binary_node::valid(); } private: @@ -10538,66 +12546,60 @@ namespace exprtk vec_node_ptr_ = static_cast*>(branch(0)); vds() = vec_node_ptr_->vds(); } + + assert(valid()); } inline T value() const exprtk_override { - if (vec_node_ptr_) + const T v = branch(1)->value(); + + T* vec = vds().data(); + + loop_unroll::details lud(size()); + const T* upper_bound = vec + lud.upper_bound; + + while (vec < upper_bound) { - assert(branch(1)); + #define exprtk_loop(N) \ + vec[N] = v; \ - const T v = branch(1)->value(); + exprtk_loop( 0) exprtk_loop( 1) + exprtk_loop( 2) exprtk_loop( 3) + #ifndef exprtk_disable_superscalar_unroll + exprtk_loop( 4) exprtk_loop( 5) + exprtk_loop( 6) exprtk_loop( 7) + exprtk_loop( 8) exprtk_loop( 9) + exprtk_loop(10) exprtk_loop(11) + exprtk_loop(12) exprtk_loop(13) + exprtk_loop(14) exprtk_loop(15) + #endif - T* vec = vds().data(); - - loop_unroll::details lud(size()); - const T* upper_bound = vec + lud.upper_bound; - - while (vec < upper_bound) - { - #define exprtk_loop(N) \ - vec[N] = v; \ - - exprtk_loop( 0) exprtk_loop( 1) - exprtk_loop( 2) exprtk_loop( 3) - #ifndef exprtk_disable_superscalar_unroll - exprtk_loop( 4) exprtk_loop( 5) - exprtk_loop( 6) exprtk_loop( 7) - exprtk_loop( 8) exprtk_loop( 9) - exprtk_loop(10) exprtk_loop(11) - exprtk_loop(12) exprtk_loop(13) - exprtk_loop(14) exprtk_loop(15) - #endif - - vec += lud.batch_size; - } - - exprtk_disable_fallthrough_begin - switch (lud.remainder) - { - #define case_stmt(N) \ - case N : *vec++ = v; \ - - #ifndef exprtk_disable_superscalar_unroll - case_stmt(15) case_stmt(14) - case_stmt(13) case_stmt(12) - case_stmt(11) case_stmt(10) - case_stmt( 9) case_stmt( 8) - case_stmt( 7) case_stmt( 6) - case_stmt( 5) case_stmt( 4) - #endif - case_stmt( 3) case_stmt( 2) - case_stmt( 1) - } - exprtk_disable_fallthrough_end - - #undef exprtk_loop - #undef case_stmt - - return vec_node_ptr_->value(); + vec += lud.batch_size; } - else - return std::numeric_limits::quiet_NaN(); + + switch (lud.remainder) + { + #define case_stmt(N) \ + case N : *vec++ = v; \ + exprtk_fallthrough \ + + #ifndef exprtk_disable_superscalar_unroll + case_stmt(15) case_stmt(14) + case_stmt(13) case_stmt(12) + case_stmt(11) case_stmt(10) + case_stmt( 9) case_stmt( 8) + case_stmt( 7) case_stmt( 6) + case_stmt( 5) case_stmt( 4) + #endif + case_stmt( 3) case_stmt( 2) + case 1 : *vec++ = v; + } + + #undef exprtk_loop + #undef case_stmt + + return vec_node_ptr_->value(); } vector_node_ptr vec() const exprtk_override @@ -10615,9 +12617,22 @@ namespace exprtk return expression_node::e_vecvalass; } + inline bool valid() const exprtk_override + { + return + vec_node_ptr_ && + (vds().size() <= vec_node_ptr_->vec_holder().base_size()) && + binary_node::valid(); + } + std::size_t size() const exprtk_override { - return vds().size(); + return vec_node_ptr_->vec_holder().size(); + } + + std::size_t base_size() const exprtk_override + { + return vec_node_ptr_->vec_holder().base_size(); } vds_t& vds() exprtk_override @@ -10687,74 +12702,71 @@ namespace exprtk } } - initialised_ = (vec0_node_ptr_ && vec1_node_ptr_); + initialised_ = + vec0_node_ptr_ && + vec1_node_ptr_ && + (size() <= base_size()) && + (vds_.size() <= base_size()) && + binary_node::valid(); - assert(initialised_); + assert(valid()); } inline T value() const exprtk_override { - if (initialised_) - { - assert(branch(1)); - - branch(1)->value(); - - if (src_is_ivec_) - return vec0_node_ptr_->value(); - - T* vec0 = vec0_node_ptr_->vds().data(); - T* vec1 = vec1_node_ptr_->vds().data(); - - loop_unroll::details lud(size()); - const T* upper_bound = vec0 + lud.upper_bound; - - while (vec0 < upper_bound) - { - #define exprtk_loop(N) \ - vec0[N] = vec1[N]; \ - - exprtk_loop( 0) exprtk_loop( 1) - exprtk_loop( 2) exprtk_loop( 3) - #ifndef exprtk_disable_superscalar_unroll - exprtk_loop( 4) exprtk_loop( 5) - exprtk_loop( 6) exprtk_loop( 7) - exprtk_loop( 8) exprtk_loop( 9) - exprtk_loop(10) exprtk_loop(11) - exprtk_loop(12) exprtk_loop(13) - exprtk_loop(14) exprtk_loop(15) - #endif - - vec0 += lud.batch_size; - vec1 += lud.batch_size; - } - - exprtk_disable_fallthrough_begin - switch (lud.remainder) - { - #define case_stmt(N) \ - case N : *vec0++ = *vec1++; \ - - #ifndef exprtk_disable_superscalar_unroll - case_stmt(15) case_stmt(14) - case_stmt(13) case_stmt(12) - case_stmt(11) case_stmt(10) - case_stmt( 9) case_stmt( 8) - case_stmt( 7) case_stmt( 6) - case_stmt( 5) case_stmt( 4) - #endif - case_stmt( 3) case_stmt( 2) - case_stmt( 1) - } - exprtk_disable_fallthrough_end - - #undef exprtk_loop - #undef case_stmt + branch(1)->value(); + if (src_is_ivec_) return vec0_node_ptr_->value(); + + T* vec0 = vec0_node_ptr_->vds().data(); + T* vec1 = vec1_node_ptr_->vds().data(); + + loop_unroll::details lud(size()); + const T* upper_bound = vec0 + lud.upper_bound; + + while (vec0 < upper_bound) + { + #define exprtk_loop(N) \ + vec0[N] = vec1[N]; \ + + exprtk_loop( 0) exprtk_loop( 1) + exprtk_loop( 2) exprtk_loop( 3) + #ifndef exprtk_disable_superscalar_unroll + exprtk_loop( 4) exprtk_loop( 5) + exprtk_loop( 6) exprtk_loop( 7) + exprtk_loop( 8) exprtk_loop( 9) + exprtk_loop(10) exprtk_loop(11) + exprtk_loop(12) exprtk_loop(13) + exprtk_loop(14) exprtk_loop(15) + #endif + + vec0 += lud.batch_size; + vec1 += lud.batch_size; } - else - return std::numeric_limits::quiet_NaN(); + + switch (lud.remainder) + { + #define case_stmt(N,fall_through) \ + case N : *vec0++ = *vec1++; \ + fall_through \ + + #ifndef exprtk_disable_superscalar_unroll + case_stmt(15, exprtk_fallthrough) case_stmt(14, exprtk_fallthrough) + case_stmt(13, exprtk_fallthrough) case_stmt(12, exprtk_fallthrough) + case_stmt(11, exprtk_fallthrough) case_stmt(10, exprtk_fallthrough) + case_stmt( 9, exprtk_fallthrough) case_stmt( 8, exprtk_fallthrough) + case_stmt( 7, exprtk_fallthrough) case_stmt( 6, exprtk_fallthrough) + case_stmt( 5, exprtk_fallthrough) case_stmt( 4, exprtk_fallthrough) + #endif + case_stmt( 3, exprtk_fallthrough) case_stmt( 2, exprtk_fallthrough) + case_stmt( 1, (void)0;) + } + + #undef exprtk_loop + #undef case_stmt + + return vec0_node_ptr_->value(); } vector_node_ptr vec() exprtk_override @@ -10772,9 +12784,23 @@ namespace exprtk return expression_node::e_vecvecass; } + inline bool valid() const exprtk_override + { + return initialised_; + } + std::size_t size() const exprtk_override { - return vds().size(); + return std::min( + vec0_node_ptr_->vec_holder().size(), + vec1_node_ptr_->vec_holder().size()); + } + + std::size_t base_size() const exprtk_override + { + return std::min( + vec0_node_ptr_->vec_holder().base_size(), + vec1_node_ptr_->vec_holder().base_size()); } vds_t& vds() exprtk_override @@ -10814,21 +12840,21 @@ namespace exprtk { var_node_ptr_ = static_cast*>(branch(0)); } + + assert(valid()); } inline T value() const exprtk_override { - if (var_node_ptr_) - { - assert(branch(1)); + T& v = var_node_ptr_->ref(); + v = Operation::process(v,branch(1)->value()); - T& v = var_node_ptr_->ref(); - v = Operation::process(v,branch(1)->value()); + return v; + } - return v; - } - else - return std::numeric_limits::quiet_NaN(); + inline bool valid() const exprtk_override + { + return var_node_ptr_ && binary_node::valid(); } private: @@ -10854,21 +12880,21 @@ namespace exprtk { vec_node_ptr_ = static_cast*>(branch(0)); } + + assert(valid()); } inline T value() const exprtk_override { - if (vec_node_ptr_) - { - assert(branch(1)); + T& v = vec_node_ptr_->ref(); + v = Operation::process(v,branch(1)->value()); - T& v = vec_node_ptr_->ref(); - v = Operation::process(v,branch(1)->value()); + return v; + } - return v; - } - else - return std::numeric_limits::quiet_NaN(); + inline bool valid() const exprtk_override + { + return vec_node_ptr_ && binary_node::valid(); } private: @@ -10876,6 +12902,86 @@ namespace exprtk vector_elem_node* vec_node_ptr_; }; + template + class assignment_vec_elem_op_rtc_node exprtk_final : public binary_node + { + public: + + typedef expression_node* expression_ptr; + using binary_node::branch; + + assignment_vec_elem_op_rtc_node(const operator_type& opr, + expression_ptr branch0, + expression_ptr branch1) + : binary_node(opr, branch0, branch1) + , vec_node_ptr_(0) + { + if (is_vector_elem_rtc_node(branch(0))) + { + vec_node_ptr_ = static_cast*>(branch(0)); + } + + assert(valid()); + } + + inline T value() const exprtk_override + { + T& v = vec_node_ptr_->ref(); + v = Operation::process(v,branch(1)->value()); + + return v; + } + + inline bool valid() const exprtk_override + { + return vec_node_ptr_ && binary_node::valid(); + } + + private: + + vector_elem_rtc_node* vec_node_ptr_; + }; + + template + class assignment_vec_celem_op_rtc_node exprtk_final : public binary_node + { + public: + + typedef expression_node* expression_ptr; + using binary_node::branch; + + assignment_vec_celem_op_rtc_node(const operator_type& opr, + expression_ptr branch0, + expression_ptr branch1) + : binary_node(opr, branch0, branch1) + , vec_node_ptr_(0) + { + if (is_vector_celem_rtc_node(branch(0))) + { + vec_node_ptr_ = static_cast*>(branch(0)); + } + + assert(valid()); + } + + inline T value() const exprtk_override + { + T& v = vec_node_ptr_->ref(); + v = Operation::process(v,branch(1)->value()); + + return v; + } + + inline bool valid() const exprtk_override + { + return vec_node_ptr_ && binary_node::valid(); + } + + private: + + vector_celem_rtc_node* vec_node_ptr_; + }; + template class assignment_rebasevec_elem_op_node exprtk_final : public binary_node { @@ -10894,21 +13000,21 @@ namespace exprtk { rbvec_node_ptr_ = static_cast*>(branch(0)); } + + assert(valid()); } inline T value() const exprtk_override { - if (rbvec_node_ptr_) - { - assert(branch(1)); + T& v = rbvec_node_ptr_->ref(); + v = Operation::process(v,branch(1)->value()); - T& v = rbvec_node_ptr_->ref(); - v = Operation::process(v,branch(1)->value()); + return v; + } - return v; - } - else - return std::numeric_limits::quiet_NaN(); + inline bool valid() const exprtk_override + { + return rbvec_node_ptr_ && binary_node::valid(); } private: @@ -10934,21 +13040,21 @@ namespace exprtk { rbvec_node_ptr_ = static_cast*>(branch(0)); } + + assert(valid()); } inline T value() const exprtk_override { - if (rbvec_node_ptr_) - { - assert(branch(1)); + T& v = rbvec_node_ptr_->ref(); + v = Operation::process(v,branch(1)->value()); - T& v = rbvec_node_ptr_->ref(); - v = Operation::process(v,branch(1)->value()); + return v; + } - return v; - } - else - return std::numeric_limits::quiet_NaN(); + inline bool valid() const exprtk_override + { + return rbvec_node_ptr_ && binary_node::valid(); } private: @@ -10956,6 +13062,86 @@ namespace exprtk rebasevector_celem_node* rbvec_node_ptr_; }; + template + class assignment_rebasevec_elem_op_rtc_node exprtk_final : public binary_node + { + public: + + typedef expression_node* expression_ptr; + using binary_node::branch; + + assignment_rebasevec_elem_op_rtc_node(const operator_type& opr, + expression_ptr branch0, + expression_ptr branch1) + : binary_node(opr, branch0, branch1) + , rbvec_node_ptr_(0) + { + if (is_rebasevector_elem_rtc_node(branch(0))) + { + rbvec_node_ptr_ = static_cast*>(branch(0)); + } + + assert(valid()); + } + + inline T value() const exprtk_override + { + T& v = rbvec_node_ptr_->ref(); + v = Operation::process(v,branch(1)->value()); + + return v; + } + + inline bool valid() const exprtk_override + { + return rbvec_node_ptr_ && binary_node::valid(); + } + + private: + + rebasevector_elem_rtc_node* rbvec_node_ptr_; + }; + + template + class assignment_rebasevec_celem_op_rtc_node exprtk_final : public binary_node + { + public: + + typedef expression_node* expression_ptr; + using binary_node::branch; + + assignment_rebasevec_celem_op_rtc_node(const operator_type& opr, + expression_ptr branch0, + expression_ptr branch1) + : binary_node(opr, branch0, branch1) + , rbvec_node_ptr_(0) + { + if (is_rebasevector_celem_rtc_node(branch(0))) + { + rbvec_node_ptr_ = static_cast*>(branch(0)); + } + + assert(valid()); + } + + inline T value() const exprtk_override + { + T& v = rbvec_node_ptr_->ref(); + v = Operation::process(v,branch(1)->value()); + + return v; + } + + inline bool valid() const exprtk_override + { + return rbvec_node_ptr_ && binary_node::valid(); + } + + private: + + rebasevector_celem_rtc_node* rbvec_node_ptr_; + }; + template class assignment_vec_op_node exprtk_final : public binary_node @@ -10980,66 +13166,60 @@ namespace exprtk vec_node_ptr_ = static_cast*>(branch(0)); vds() = vec_node_ptr_->vds(); } + + assert(valid()); } inline T value() const exprtk_override { - if (vec_node_ptr_) + const T v = branch(1)->value(); + + T* vec = vds().data(); + + loop_unroll::details lud(size()); + const T* upper_bound = vec + lud.upper_bound; + + while (vec < upper_bound) { - assert(branch(1)); + #define exprtk_loop(N) \ + Operation::assign(vec[N],v); \ - const T v = branch(1)->value(); + exprtk_loop( 0) exprtk_loop( 1) + exprtk_loop( 2) exprtk_loop( 3) + #ifndef exprtk_disable_superscalar_unroll + exprtk_loop( 4) exprtk_loop( 5) + exprtk_loop( 6) exprtk_loop( 7) + exprtk_loop( 8) exprtk_loop( 9) + exprtk_loop(10) exprtk_loop(11) + exprtk_loop(12) exprtk_loop(13) + exprtk_loop(14) exprtk_loop(15) + #endif - T* vec = vds().data(); - - loop_unroll::details lud(size()); - const T* upper_bound = vec + lud.upper_bound; - - while (vec < upper_bound) - { - #define exprtk_loop(N) \ - Operation::assign(vec[N],v); \ - - exprtk_loop( 0) exprtk_loop( 1) - exprtk_loop( 2) exprtk_loop( 3) - #ifndef exprtk_disable_superscalar_unroll - exprtk_loop( 4) exprtk_loop( 5) - exprtk_loop( 6) exprtk_loop( 7) - exprtk_loop( 8) exprtk_loop( 9) - exprtk_loop(10) exprtk_loop(11) - exprtk_loop(12) exprtk_loop(13) - exprtk_loop(14) exprtk_loop(15) - #endif - - vec += lud.batch_size; - } - - exprtk_disable_fallthrough_begin - switch (lud.remainder) - { - #define case_stmt(N) \ - case N : Operation::assign(*vec++,v); \ - - #ifndef exprtk_disable_superscalar_unroll - case_stmt(15) case_stmt(14) - case_stmt(13) case_stmt(12) - case_stmt(11) case_stmt(10) - case_stmt( 9) case_stmt( 8) - case_stmt( 7) case_stmt( 6) - case_stmt( 5) case_stmt( 4) - #endif - case_stmt( 3) case_stmt( 2) - case_stmt( 1) - } - exprtk_disable_fallthrough_end - - #undef exprtk_loop - #undef case_stmt - - return vec_node_ptr_->value(); + vec += lud.batch_size; } - else - return std::numeric_limits::quiet_NaN(); + + switch (lud.remainder) + { + #define case_stmt(N,fall_through) \ + case N : Operation::assign(*vec++,v); \ + fall_through \ + + #ifndef exprtk_disable_superscalar_unroll + case_stmt(15, exprtk_fallthrough) case_stmt(14, exprtk_fallthrough) + case_stmt(13, exprtk_fallthrough) case_stmt(12, exprtk_fallthrough) + case_stmt(11, exprtk_fallthrough) case_stmt(10, exprtk_fallthrough) + case_stmt( 9, exprtk_fallthrough) case_stmt( 8, exprtk_fallthrough) + case_stmt( 7, exprtk_fallthrough) case_stmt( 6, exprtk_fallthrough) + case_stmt( 5, exprtk_fallthrough) case_stmt( 4, exprtk_fallthrough) + #endif + case_stmt( 3, exprtk_fallthrough) case_stmt( 2, exprtk_fallthrough) + case_stmt( 1, (void)0;) + } + + #undef exprtk_loop + #undef case_stmt + + return vec_node_ptr_->value(); } vector_node_ptr vec() const exprtk_override @@ -11057,9 +13237,22 @@ namespace exprtk return expression_node::e_vecopvalass; } + inline bool valid() const exprtk_override + { + return + vec_node_ptr_ && + (size() <= base_size()) && + binary_node::valid() ; + } + std::size_t size() const exprtk_override { - return vds().size(); + return vec_node_ptr_->vec_holder().size(); + } + + std::size_t base_size() const exprtk_override + { + return vec_node_ptr_->vec_holder().base_size(); } vds_t& vds() exprtk_override @@ -11122,81 +13315,76 @@ namespace exprtk if (0 != (vi = dynamic_cast*>(branch(1)))) { vec1_node_ptr_ = vi->vec(); - vec1_node_ptr_->vds() = vds(); + vec1_node_ptr_->vds() = vi->vds(); } else vds_t::match_sizes(vds(),vec1_node_ptr_->vds()); } - initialised_ = (vec0_node_ptr_ && vec1_node_ptr_); + initialised_ = + vec0_node_ptr_ && + vec1_node_ptr_ && + (size() <= base_size()) && + binary_node::valid(); - assert(initialised_); + assert(valid()); } inline T value() const exprtk_override { - if (initialised_) + branch(0)->value(); + branch(1)->value(); + + T* vec0 = vec0_node_ptr_->vds().data(); + const T* vec1 = vec1_node_ptr_->vds().data(); + + loop_unroll::details lud(size()); + const T* upper_bound = vec0 + lud.upper_bound; + + while (vec0 < upper_bound) { - assert(branch(0)); - assert(branch(1)); + #define exprtk_loop(N) \ + vec0[N] = Operation::process(vec0[N], vec1[N]); \ - branch(0)->value(); - branch(1)->value(); + exprtk_loop( 0) exprtk_loop( 1) + exprtk_loop( 2) exprtk_loop( 3) + #ifndef exprtk_disable_superscalar_unroll + exprtk_loop( 4) exprtk_loop( 5) + exprtk_loop( 6) exprtk_loop( 7) + exprtk_loop( 8) exprtk_loop( 9) + exprtk_loop(10) exprtk_loop(11) + exprtk_loop(12) exprtk_loop(13) + exprtk_loop(14) exprtk_loop(15) + #endif - T* vec0 = vec0_node_ptr_->vds().data(); - const T* vec1 = vec1_node_ptr_->vds().data(); - - loop_unroll::details lud(size()); - const T* upper_bound = vec0 + lud.upper_bound; - - while (vec0 < upper_bound) - { - #define exprtk_loop(N) \ - vec0[N] = Operation::process(vec0[N], vec1[N]); \ - - exprtk_loop( 0) exprtk_loop( 1) - exprtk_loop( 2) exprtk_loop( 3) - #ifndef exprtk_disable_superscalar_unroll - exprtk_loop( 4) exprtk_loop( 5) - exprtk_loop( 6) exprtk_loop( 7) - exprtk_loop( 8) exprtk_loop( 9) - exprtk_loop(10) exprtk_loop(11) - exprtk_loop(12) exprtk_loop(13) - exprtk_loop(14) exprtk_loop(15) - #endif - - vec0 += lud.batch_size; - vec1 += lud.batch_size; - } - - int i = 0; - - exprtk_disable_fallthrough_begin - switch (lud.remainder) - { - #define case_stmt(N) \ - case N : { vec0[i] = Operation::process(vec0[i], vec1[i]); ++i; } \ - - #ifndef exprtk_disable_superscalar_unroll - case_stmt(15) case_stmt(14) - case_stmt(13) case_stmt(12) - case_stmt(11) case_stmt(10) - case_stmt( 9) case_stmt( 8) - case_stmt( 7) case_stmt( 6) - case_stmt( 5) case_stmt( 4) - #endif - case_stmt( 3) case_stmt( 2) - case_stmt( 1) - } - exprtk_disable_fallthrough_end - - #undef exprtk_loop - #undef case_stmt - - return vec0_node_ptr_->value(); + vec0 += lud.batch_size; + vec1 += lud.batch_size; } - else - return std::numeric_limits::quiet_NaN(); + + int i = 0; + + switch (lud.remainder) + { + #define case_stmt(N,fall_through) \ + case N : { vec0[i] = Operation::process(vec0[i], vec1[i]); ++i; } \ + fall_through \ + + #ifndef exprtk_disable_superscalar_unroll + case_stmt(15, exprtk_fallthrough) case_stmt(14, exprtk_fallthrough) + case_stmt(13, exprtk_fallthrough) case_stmt(12, exprtk_fallthrough) + case_stmt(11, exprtk_fallthrough) case_stmt(10, exprtk_fallthrough) + case_stmt( 9, exprtk_fallthrough) case_stmt( 8, exprtk_fallthrough) + case_stmt( 7, exprtk_fallthrough) case_stmt( 6, exprtk_fallthrough) + case_stmt( 5, exprtk_fallthrough) case_stmt( 4, exprtk_fallthrough) + #endif + case_stmt( 3, exprtk_fallthrough) case_stmt( 2, exprtk_fallthrough) + case_stmt( 1, (void)0;) + } + + #undef exprtk_loop + #undef case_stmt + + return vec0_node_ptr_->value(); } vector_node_ptr vec() const exprtk_override @@ -11214,9 +13402,23 @@ namespace exprtk return expression_node::e_vecopvecass; } + inline bool valid() const exprtk_override + { + return initialised_; + } + std::size_t size() const exprtk_override { - return vds().size(); + return std::min( + vec0_node_ptr_->vec_holder().size(), + vec1_node_ptr_->vec_holder().size()); + } + + std::size_t base_size() const exprtk_override + { + return std::min( + vec0_node_ptr_->vec_holder().base_size(), + vec1_node_ptr_->vec_holder().base_size()); } vds_t& vds() exprtk_override @@ -11242,6 +13444,64 @@ namespace exprtk vds_t vds_; }; + template + struct memory_context_t + { + typedef vector_node* vector_node_ptr; + typedef vector_holder vector_holder_t; + typedef vector_holder_t* vector_holder_ptr; + + memory_context_t() + : temp_(0) + , temp_vec_node_(0) + {} + + void clear() + { + delete temp_vec_node_; + delete temp_; + } + + vector_holder_ptr temp_; + vector_node_ptr temp_vec_node_; + }; + + template + inline memory_context_t make_memory_context(vector_holder& vec_holder, + vec_data_store& vds) + { + memory_context_t result_ctxt; + result_ctxt.temp_ = (vec_holder.rebaseable()) ? + new vector_holder(vec_holder,vds) : + new vector_holder(vds) ; + result_ctxt.temp_vec_node_ = new vector_node (vds,result_ctxt.temp_); + return result_ctxt; + } + + template + inline memory_context_t make_memory_context(vector_holder& vec_holder0, + vector_holder& vec_holder1, + vec_data_store& vds) + { + memory_context_t result_ctxt; + + if (!vec_holder0.rebaseable() && !vec_holder1.rebaseable()) + result_ctxt.temp_ = new vector_holder(vds); + else if (vec_holder0.rebaseable() && !vec_holder1.rebaseable()) + result_ctxt.temp_ = new vector_holder(vec_holder0,vds); + else if (!vec_holder0.rebaseable() && vec_holder1.rebaseable()) + result_ctxt.temp_ = new vector_holder(vec_holder1,vds); + else + { + result_ctxt.temp_ = (vec_holder0.base_size() >= vec_holder1.base_size()) ? + new vector_holder(vec_holder0, vds) : + new vector_holder(vec_holder1, vds) ; + } + + result_ctxt.temp_vec_node_ = new vector_node (vds,result_ctxt.temp_); + return result_ctxt; + } + template class vec_binop_vecvec_node exprtk_final : public binary_node @@ -11251,8 +13511,10 @@ namespace exprtk typedef expression_node* expression_ptr; typedef vector_node* vector_node_ptr; - typedef vector_holder* vector_holder_ptr; + typedef vector_holder vector_holder_t; + typedef vector_holder_t* vector_holder_ptr; typedef vec_data_store vds_t; + typedef memory_context_t memory_context; using binary_node::branch; @@ -11262,8 +13524,6 @@ namespace exprtk : binary_node(opr, branch0, branch1) , vec0_node_ptr_(0) , vec1_node_ptr_(0) - , temp_ (0) - , temp_vec_node_(0) , initialised_(false) { bool v0_is_ivec = false; @@ -11304,104 +13564,102 @@ namespace exprtk vector_holder& vec0 = vec0_node_ptr_->vec_holder(); vector_holder& vec1 = vec1_node_ptr_->vec_holder(); - if (v0_is_ivec && (vec0.size() <= vec1.size())) + if (v0_is_ivec && (vec0.base_size() <= vec1.base_size())) + { vds_ = vds_t(vec0_node_ptr_->vds()); - else if (v1_is_ivec && (vec1.size() <= vec0.size())) + } + else if (v1_is_ivec && (vec1.base_size() <= vec0.base_size())) + { vds_ = vds_t(vec1_node_ptr_->vds()); + } else - vds_ = vds_t(std::min(vec0.size(),vec1.size())); + { + vds_ = vds_t(std::min(vec0.base_size(),vec1.base_size())); + } - temp_ = new vector_holder(vds().data(),vds().size()); - temp_vec_node_ = new vector_node (vds(),temp_); + memory_context_ = make_memory_context(vec0, vec1, vds()); - initialised_ = true; + initialised_ = + (size() <= base_size()) && + binary_node::valid(); } - assert(initialised_); + assert(valid()); } ~vec_binop_vecvec_node() { - delete temp_; - delete temp_vec_node_; + memory_context_.clear(); } inline T value() const exprtk_override { - if (initialised_) + branch(0)->value(); + branch(1)->value(); + + const T* vec0 = vec0_node_ptr_->vds().data(); + const T* vec1 = vec1_node_ptr_->vds().data(); + T* vec2 = vds().data(); + + loop_unroll::details lud(size()); + const T* upper_bound = vec2 + lud.upper_bound; + + while (vec2 < upper_bound) { - assert(branch(0)); - assert(branch(1)); + #define exprtk_loop(N) \ + vec2[N] = Operation::process(vec0[N], vec1[N]); \ - branch(0)->value(); - branch(1)->value(); + exprtk_loop( 0) exprtk_loop( 1) + exprtk_loop( 2) exprtk_loop( 3) + #ifndef exprtk_disable_superscalar_unroll + exprtk_loop( 4) exprtk_loop( 5) + exprtk_loop( 6) exprtk_loop( 7) + exprtk_loop( 8) exprtk_loop( 9) + exprtk_loop(10) exprtk_loop(11) + exprtk_loop(12) exprtk_loop(13) + exprtk_loop(14) exprtk_loop(15) + #endif - const T* vec0 = vec0_node_ptr_->vds().data(); - const T* vec1 = vec1_node_ptr_->vds().data(); - T* vec2 = vds().data(); - - loop_unroll::details lud(size()); - const T* upper_bound = vec2 + lud.upper_bound; - - while (vec2 < upper_bound) - { - #define exprtk_loop(N) \ - vec2[N] = Operation::process(vec0[N], vec1[N]); \ - - exprtk_loop( 0) exprtk_loop( 1) - exprtk_loop( 2) exprtk_loop( 3) - #ifndef exprtk_disable_superscalar_unroll - exprtk_loop( 4) exprtk_loop( 5) - exprtk_loop( 6) exprtk_loop( 7) - exprtk_loop( 8) exprtk_loop( 9) - exprtk_loop(10) exprtk_loop(11) - exprtk_loop(12) exprtk_loop(13) - exprtk_loop(14) exprtk_loop(15) - #endif - - vec0 += lud.batch_size; - vec1 += lud.batch_size; - vec2 += lud.batch_size; - } - - int i = 0; - - exprtk_disable_fallthrough_begin - switch (lud.remainder) - { - #define case_stmt(N) \ - case N : { vec2[i] = Operation::process(vec0[i], vec1[i]); ++i; } \ - - #ifndef exprtk_disable_superscalar_unroll - case_stmt(15) case_stmt(14) - case_stmt(13) case_stmt(12) - case_stmt(11) case_stmt(10) - case_stmt( 9) case_stmt( 8) - case_stmt( 7) case_stmt( 6) - case_stmt( 5) case_stmt( 4) - #endif - case_stmt( 3) case_stmt( 2) - case_stmt( 1) - } - exprtk_disable_fallthrough_end - - #undef exprtk_loop - #undef case_stmt - - return (vds().data())[0]; + vec0 += lud.batch_size; + vec1 += lud.batch_size; + vec2 += lud.batch_size; } - else - return std::numeric_limits::quiet_NaN(); + + int i = 0; + + switch (lud.remainder) + { + #define case_stmt(N) \ + case N : { vec2[i] = Operation::process(vec0[i], vec1[i]); ++i; } \ + exprtk_fallthrough \ + + #ifndef exprtk_disable_superscalar_unroll + case_stmt(15) case_stmt(14) + case_stmt(13) case_stmt(12) + case_stmt(11) case_stmt(10) + case_stmt( 9) case_stmt( 8) + case_stmt( 7) case_stmt( 6) + case_stmt( 5) case_stmt( 4) + #endif + case_stmt( 3) case_stmt( 2) + case_stmt( 1) + default: break; + } + + #undef exprtk_loop + #undef case_stmt + + return (vds().data())[0]; } vector_node_ptr vec() const exprtk_override { - return temp_vec_node_; + return memory_context_.temp_vec_node_; } vector_node_ptr vec() exprtk_override { - return temp_vec_node_; + return memory_context_.temp_vec_node_; } inline typename expression_node::node_type type() const exprtk_override @@ -11409,9 +13667,23 @@ namespace exprtk return expression_node::e_vecvecarith; } + inline bool valid() const exprtk_override + { + return initialised_; + } + std::size_t size() const exprtk_override { - return vds_.size(); + return std::min( + vec0_node_ptr_->vec_holder().size(), + vec1_node_ptr_->vec_holder().size()); + } + + std::size_t base_size() const exprtk_override + { + return std::min( + vec0_node_ptr_->vec_holder().base_size(), + vec1_node_ptr_->vec_holder().base_size()); } vds_t& vds() exprtk_override @@ -11426,12 +13698,11 @@ namespace exprtk private: - vector_node_ptr vec0_node_ptr_; - vector_node_ptr vec1_node_ptr_; - vector_holder_ptr temp_; - vector_node_ptr temp_vec_node_; - bool initialised_; - vds_t vds_; + vector_node_ptr vec0_node_ptr_; + vector_node_ptr vec1_node_ptr_; + bool initialised_; + vds_t vds_; + memory_context memory_context_; }; template @@ -11443,8 +13714,10 @@ namespace exprtk typedef expression_node* expression_ptr; typedef vector_node* vector_node_ptr; - typedef vector_holder* vector_holder_ptr; + typedef vector_holder vector_holder_t; + typedef vector_holder_t* vector_holder_ptr; typedef vec_data_store vds_t; + typedef memory_context_t memory_context; using binary_node::branch; @@ -11453,8 +13726,6 @@ namespace exprtk expression_ptr branch1) : binary_node(opr, branch0, branch1) , vec0_node_ptr_(0) - , temp_ (0) - , temp_vec_node_(0) { bool v0_is_ivec = false; @@ -11478,93 +13749,84 @@ namespace exprtk if (v0_is_ivec) vds() = vec0_node_ptr_->vds(); else - vds() = vds_t(vec0_node_ptr_->size()); + vds() = vds_t(vec0_node_ptr_->base_size()); - temp_ = new vector_holder(vds()); - temp_vec_node_ = new vector_node (vds(),temp_); + memory_context_ = make_memory_context(vec0_node_ptr_->vec_holder(), vds()); } + + assert(valid()); } ~vec_binop_vecval_node() { - delete temp_; - delete temp_vec_node_; + memory_context_.clear(); } inline T value() const exprtk_override { - if (vec0_node_ptr_) + branch(0)->value(); + const T v = branch(1)->value(); + + const T* vec0 = vec0_node_ptr_->vds().data(); + T* vec1 = vds().data(); + + loop_unroll::details lud(size()); + const T* upper_bound = vec0 + lud.upper_bound; + + while (vec0 < upper_bound) { - assert(branch(0)); - assert(branch(1)); + #define exprtk_loop(N) \ + vec1[N] = Operation::process(vec0[N], v); \ - branch(0)->value(); - const T v = branch(1)->value(); + exprtk_loop( 0) exprtk_loop( 1) + exprtk_loop( 2) exprtk_loop( 3) + #ifndef exprtk_disable_superscalar_unroll + exprtk_loop( 4) exprtk_loop( 5) + exprtk_loop( 6) exprtk_loop( 7) + exprtk_loop( 8) exprtk_loop( 9) + exprtk_loop(10) exprtk_loop(11) + exprtk_loop(12) exprtk_loop(13) + exprtk_loop(14) exprtk_loop(15) + #endif - const T* vec0 = vec0_node_ptr_->vds().data(); - T* vec1 = vds().data(); - - loop_unroll::details lud(size()); - const T* upper_bound = vec0 + lud.upper_bound; - - while (vec0 < upper_bound) - { - #define exprtk_loop(N) \ - vec1[N] = Operation::process(vec0[N], v); \ - - exprtk_loop( 0) exprtk_loop( 1) - exprtk_loop( 2) exprtk_loop( 3) - #ifndef exprtk_disable_superscalar_unroll - exprtk_loop( 4) exprtk_loop( 5) - exprtk_loop( 6) exprtk_loop( 7) - exprtk_loop( 8) exprtk_loop( 9) - exprtk_loop(10) exprtk_loop(11) - exprtk_loop(12) exprtk_loop(13) - exprtk_loop(14) exprtk_loop(15) - #endif - - vec0 += lud.batch_size; - vec1 += lud.batch_size; - } - - int i = 0; - - exprtk_disable_fallthrough_begin - switch (lud.remainder) - { - #define case_stmt(N) \ - case N : { vec1[i] = Operation::process(vec0[i], v); ++i; } \ - - #ifndef exprtk_disable_superscalar_unroll - case_stmt(15) case_stmt(14) - case_stmt(13) case_stmt(12) - case_stmt(11) case_stmt(10) - case_stmt( 9) case_stmt( 8) - case_stmt( 7) case_stmt( 6) - case_stmt( 5) case_stmt( 4) - #endif - case_stmt( 3) case_stmt( 2) - case_stmt( 1) - } - exprtk_disable_fallthrough_end - - #undef exprtk_loop - #undef case_stmt - - return (vds().data())[0]; + vec0 += lud.batch_size; + vec1 += lud.batch_size; } - else - return std::numeric_limits::quiet_NaN(); + + int i = 0; + + switch (lud.remainder) + { + #define case_stmt(N,fall_through) \ + case N : { vec1[i] = Operation::process(vec0[i], v); ++i; } \ + fall_through \ + + #ifndef exprtk_disable_superscalar_unroll + case_stmt(15, exprtk_fallthrough) case_stmt(14, exprtk_fallthrough) + case_stmt(13, exprtk_fallthrough) case_stmt(12, exprtk_fallthrough) + case_stmt(11, exprtk_fallthrough) case_stmt(10, exprtk_fallthrough) + case_stmt( 9, exprtk_fallthrough) case_stmt( 8, exprtk_fallthrough) + case_stmt( 7, exprtk_fallthrough) case_stmt( 6, exprtk_fallthrough) + case_stmt( 5, exprtk_fallthrough) case_stmt( 4, exprtk_fallthrough) + #endif + case_stmt( 3, exprtk_fallthrough) case_stmt( 2, exprtk_fallthrough) + case_stmt( 1, (void)0;) + } + + #undef exprtk_loop + #undef case_stmt + + return (vds().data())[0]; } vector_node_ptr vec() const exprtk_override { - return temp_vec_node_; + return memory_context_.temp_vec_node_; } vector_node_ptr vec() exprtk_override { - return temp_vec_node_; + return memory_context_.temp_vec_node_; } inline typename expression_node::node_type type() const exprtk_override @@ -11572,9 +13834,22 @@ namespace exprtk return expression_node::e_vecvalarith; } + inline bool valid() const exprtk_override + { + return + vec0_node_ptr_ && + (size() <= base_size()) && + binary_node::valid(); + } + std::size_t size() const exprtk_override { - return vds().size(); + return vec0_node_ptr_->size(); + } + + std::size_t base_size() const exprtk_override + { + return vec0_node_ptr_->vec_holder().base_size(); } vds_t& vds() exprtk_override @@ -11590,9 +13865,8 @@ namespace exprtk private: vector_node_ptr vec0_node_ptr_; - vector_holder_ptr temp_; - vector_node_ptr temp_vec_node_; vds_t vds_; + memory_context memory_context_; }; template @@ -11604,8 +13878,10 @@ namespace exprtk typedef expression_node* expression_ptr; typedef vector_node* vector_node_ptr; - typedef vector_holder* vector_holder_ptr; + typedef vector_holder vector_holder_t; + typedef vector_holder_t* vector_holder_ptr; typedef vec_data_store vds_t; + typedef memory_context_t memory_context; using binary_node::branch; @@ -11614,8 +13890,6 @@ namespace exprtk expression_ptr branch1) : binary_node(opr, branch0, branch1) , vec1_node_ptr_(0) - , temp_ (0) - , temp_vec_node_(0) { bool v1_is_ivec = false; @@ -11639,93 +13913,84 @@ namespace exprtk if (v1_is_ivec) vds() = vec1_node_ptr_->vds(); else - vds() = vds_t(vec1_node_ptr_->size()); + vds() = vds_t(vec1_node_ptr_->base_size()); - temp_ = new vector_holder(vds()); - temp_vec_node_ = new vector_node (vds(),temp_); + memory_context_ = make_memory_context(vec1_node_ptr_->vec_holder(), vds()); } + + assert(valid()); } ~vec_binop_valvec_node() { - delete temp_; - delete temp_vec_node_; + memory_context_.clear(); } inline T value() const exprtk_override { - if (vec1_node_ptr_) + const T v = branch(0)->value(); + branch(1)->value(); + + T* vec0 = vds().data(); + const T* vec1 = vec1_node_ptr_->vds().data(); + + loop_unroll::details lud(size()); + const T* upper_bound = vec0 + lud.upper_bound; + + while (vec0 < upper_bound) { - assert(branch(0)); - assert(branch(1)); + #define exprtk_loop(N) \ + vec0[N] = Operation::process(v, vec1[N]); \ - const T v = branch(0)->value(); - branch(1)->value(); + exprtk_loop( 0) exprtk_loop( 1) + exprtk_loop( 2) exprtk_loop( 3) + #ifndef exprtk_disable_superscalar_unroll + exprtk_loop( 4) exprtk_loop( 5) + exprtk_loop( 6) exprtk_loop( 7) + exprtk_loop( 8) exprtk_loop( 9) + exprtk_loop(10) exprtk_loop(11) + exprtk_loop(12) exprtk_loop(13) + exprtk_loop(14) exprtk_loop(15) + #endif - T* vec0 = vds().data(); - const T* vec1 = vec1_node_ptr_->vds().data(); - - loop_unroll::details lud(size()); - const T* upper_bound = vec0 + lud.upper_bound; - - while (vec0 < upper_bound) - { - #define exprtk_loop(N) \ - vec0[N] = Operation::process(v, vec1[N]); \ - - exprtk_loop( 0) exprtk_loop( 1) - exprtk_loop( 2) exprtk_loop( 3) - #ifndef exprtk_disable_superscalar_unroll - exprtk_loop( 4) exprtk_loop( 5) - exprtk_loop( 6) exprtk_loop( 7) - exprtk_loop( 8) exprtk_loop( 9) - exprtk_loop(10) exprtk_loop(11) - exprtk_loop(12) exprtk_loop(13) - exprtk_loop(14) exprtk_loop(15) - #endif - - vec0 += lud.batch_size; - vec1 += lud.batch_size; - } - - int i = 0; - - exprtk_disable_fallthrough_begin - switch (lud.remainder) - { - #define case_stmt(N) \ - case N : { vec0[i] = Operation::process(v, vec1[i]); ++i; } \ - - #ifndef exprtk_disable_superscalar_unroll - case_stmt(15) case_stmt(14) - case_stmt(13) case_stmt(12) - case_stmt(11) case_stmt(10) - case_stmt( 9) case_stmt( 8) - case_stmt( 7) case_stmt( 6) - case_stmt( 5) case_stmt( 4) - #endif - case_stmt( 3) case_stmt( 2) - case_stmt( 1) - } - exprtk_disable_fallthrough_end - - #undef exprtk_loop - #undef case_stmt - - return (vds().data())[0]; + vec0 += lud.batch_size; + vec1 += lud.batch_size; } - else - return std::numeric_limits::quiet_NaN(); + + int i = 0; + + switch (lud.remainder) + { + #define case_stmt(N,fall_through) \ + case N : { vec0[i] = Operation::process(v, vec1[i]); ++i; } \ + fall_through \ + + #ifndef exprtk_disable_superscalar_unroll + case_stmt(15, exprtk_fallthrough) case_stmt(14, exprtk_fallthrough) + case_stmt(13, exprtk_fallthrough) case_stmt(12, exprtk_fallthrough) + case_stmt(11, exprtk_fallthrough) case_stmt(10, exprtk_fallthrough) + case_stmt( 9, exprtk_fallthrough) case_stmt( 8, exprtk_fallthrough) + case_stmt( 7, exprtk_fallthrough) case_stmt( 6, exprtk_fallthrough) + case_stmt( 5, exprtk_fallthrough) case_stmt( 4, exprtk_fallthrough) + #endif + case_stmt( 3, exprtk_fallthrough) case_stmt( 2, exprtk_fallthrough) + case_stmt( 1, (void)0;) + } + + #undef exprtk_loop + #undef case_stmt + + return (vds().data())[0]; } vector_node_ptr vec() const exprtk_override { - return temp_vec_node_; + return memory_context_.temp_vec_node_; } vector_node_ptr vec() exprtk_override { - return temp_vec_node_; + return memory_context_.temp_vec_node_; } inline typename expression_node::node_type type() const exprtk_override @@ -11733,9 +13998,23 @@ namespace exprtk return expression_node::e_vecvalarith; } + inline bool valid() const exprtk_override + { + return + vec1_node_ptr_ && + (size() <= base_size()) && + (vds_.size() <= base_size()) && + binary_node::valid(); + } + std::size_t size() const exprtk_override { - return vds().size(); + return vec1_node_ptr_->vec_holder().size(); + } + + std::size_t base_size() const exprtk_override + { + return vec1_node_ptr_->vec_holder().base_size(); } vds_t& vds() exprtk_override @@ -11751,9 +14030,8 @@ namespace exprtk private: vector_node_ptr vec1_node_ptr_; - vector_holder_ptr temp_; - vector_node_ptr temp_vec_node_; vds_t vds_; + memory_context memory_context_; }; template @@ -11765,28 +14043,28 @@ namespace exprtk typedef expression_node* expression_ptr; typedef vector_node* vector_node_ptr; - typedef vector_holder* vector_holder_ptr; + typedef vector_holder vector_holder_t; + typedef vector_holder_t* vector_holder_ptr; typedef vec_data_store vds_t; + typedef memory_context_t memory_context; using expression_node::branch; unary_vector_node(const operator_type& opr, expression_ptr branch0) : unary_node(opr, branch0) , vec0_node_ptr_(0) - , temp_ (0) - , temp_vec_node_(0) { bool vec0_is_ivec = false; - if (is_vector_node(branch())) + if (is_vector_node(branch(0))) { - vec0_node_ptr_ = static_cast(branch()); + vec0_node_ptr_ = static_cast(branch(0)); } - else if (is_ivector_node(branch())) + else if (is_ivector_node(branch(0))) { vector_interface* vi = reinterpret_cast*>(0); - if (0 != (vi = dynamic_cast*>(branch()))) + if (0 != (vi = dynamic_cast*>(branch(0)))) { vec0_node_ptr_ = vi->vec(); vec0_is_ivec = true; @@ -11798,91 +14076,84 @@ namespace exprtk if (vec0_is_ivec) vds_ = vec0_node_ptr_->vds(); else - vds_ = vds_t(vec0_node_ptr_->size()); + vds_ = vds_t(vec0_node_ptr_->base_size()); - temp_ = new vector_holder(vds()); - temp_vec_node_ = new vector_node (vds(),temp_); + memory_context_ = make_memory_context(vec0_node_ptr_->vec_holder(), vds()); } + + assert(valid()); } ~unary_vector_node() { - delete temp_; - delete temp_vec_node_; + memory_context_.clear(); } inline T value() const exprtk_override { - assert(branch()); - branch()->value(); - if (vec0_node_ptr_) + const T* vec0 = vec0_node_ptr_->vds().data(); + T* vec1 = vds().data(); + + loop_unroll::details lud(size()); + const T* upper_bound = vec0 + lud.upper_bound; + + while (vec0 < upper_bound) { - const T* vec0 = vec0_node_ptr_->vds().data(); - T* vec1 = vds().data(); + #define exprtk_loop(N) \ + vec1[N] = Operation::process(vec0[N]); \ - loop_unroll::details lud(size()); - const T* upper_bound = vec0 + lud.upper_bound; + exprtk_loop( 0) exprtk_loop( 1) + exprtk_loop( 2) exprtk_loop( 3) + #ifndef exprtk_disable_superscalar_unroll + exprtk_loop( 4) exprtk_loop( 5) + exprtk_loop( 6) exprtk_loop( 7) + exprtk_loop( 8) exprtk_loop( 9) + exprtk_loop(10) exprtk_loop(11) + exprtk_loop(12) exprtk_loop(13) + exprtk_loop(14) exprtk_loop(15) + #endif - while (vec0 < upper_bound) - { - #define exprtk_loop(N) \ - vec1[N] = Operation::process(vec0[N]); \ - - exprtk_loop( 0) exprtk_loop( 1) - exprtk_loop( 2) exprtk_loop( 3) - #ifndef exprtk_disable_superscalar_unroll - exprtk_loop( 4) exprtk_loop( 5) - exprtk_loop( 6) exprtk_loop( 7) - exprtk_loop( 8) exprtk_loop( 9) - exprtk_loop(10) exprtk_loop(11) - exprtk_loop(12) exprtk_loop(13) - exprtk_loop(14) exprtk_loop(15) - #endif - - vec0 += lud.batch_size; - vec1 += lud.batch_size; - } - - int i = 0; - - exprtk_disable_fallthrough_begin - switch (lud.remainder) - { - #define case_stmt(N) \ - case N : { vec1[i] = Operation::process(vec0[i]); ++i; } \ - - #ifndef exprtk_disable_superscalar_unroll - case_stmt(15) case_stmt(14) - case_stmt(13) case_stmt(12) - case_stmt(11) case_stmt(10) - case_stmt( 9) case_stmt( 8) - case_stmt( 7) case_stmt( 6) - case_stmt( 5) case_stmt( 4) - #endif - case_stmt( 3) case_stmt( 2) - case_stmt( 1) - } - exprtk_disable_fallthrough_end - - #undef exprtk_loop - #undef case_stmt - - return (vds().data())[0]; + vec0 += lud.batch_size; + vec1 += lud.batch_size; } - else - return std::numeric_limits::quiet_NaN(); + + int i = 0; + + switch (lud.remainder) + { + #define case_stmt(N) \ + case N : { vec1[i] = Operation::process(vec0[i]); ++i; } \ + exprtk_fallthrough \ + + #ifndef exprtk_disable_superscalar_unroll + case_stmt(15) case_stmt(14) + case_stmt(13) case_stmt(12) + case_stmt(11) case_stmt(10) + case_stmt( 9) case_stmt( 8) + case_stmt( 7) case_stmt( 6) + case_stmt( 5) case_stmt( 4) + #endif + case_stmt( 3) case_stmt( 2) + case_stmt( 1) + default: break; + } + + #undef exprtk_loop + #undef case_stmt + + return (vds().data())[0]; } vector_node_ptr vec() const exprtk_override { - return temp_vec_node_; + return memory_context_.temp_vec_node_; } vector_node_ptr vec() exprtk_override { - return temp_vec_node_; + return memory_context_.temp_vec_node_; } inline typename expression_node::node_type type() const exprtk_override @@ -11890,9 +14161,19 @@ namespace exprtk return expression_node::e_vecunaryop; } + inline bool valid() const exprtk_override + { + return vec0_node_ptr_ && unary_node::valid(); + } + std::size_t size() const exprtk_override { - return vds().size(); + return vec0_node_ptr_->vec_holder().size(); + } + + std::size_t base_size() const exprtk_override + { + return vec0_node_ptr_->vec_holder().base_size(); } vds_t& vds() exprtk_override @@ -11907,10 +14188,9 @@ namespace exprtk private: - vector_node_ptr vec0_node_ptr_; - vector_holder_ptr temp_; - vector_node_ptr temp_vec_node_; - vds_t vds_; + vector_node_ptr vec0_node_ptr_; + vds_t vds_; + memory_context memory_context_; }; template @@ -11923,8 +14203,10 @@ namespace exprtk typedef expression_node * expression_ptr; typedef vector_interface* vec_interface_ptr; typedef vector_node * vector_node_ptr; - typedef vector_holder * vector_holder_ptr; + typedef vector_holder vector_holder_t; + typedef vector_holder_t* vector_holder_ptr; typedef vec_data_store vds_t; + typedef memory_context_t memory_context; typedef std::pair branch_t; conditional_vector_node(expression_ptr condition, @@ -11934,7 +14216,7 @@ namespace exprtk , alternative_node_ptr_(0) , temp_vec_node_ (0) , temp_ (0) - , vec_size_ (0) + , result_vec_size_ (0) , initialised_ (false) { construct_branch_pair(condition_ , condition ); @@ -11963,67 +14245,62 @@ namespace exprtk if (consequent_node_ptr_ && alternative_node_ptr_) { - vec_size_ = std::min(consequent_node_ptr_ ->vds().size(), - alternative_node_ptr_->vds().size()); + const std::size_t vec_size = + std::max(consequent_node_ptr_ ->vec_holder().base_size(), + alternative_node_ptr_->vec_holder().base_size()); - vds_ = vds_t(vec_size_); - temp_ = new vector_holder(vds_); - temp_vec_node_ = new vector_node (vds(),temp_); + vds_ = vds_t(vec_size); + memory_context_ = make_memory_context( + consequent_node_ptr_ ->vec_holder(), + alternative_node_ptr_->vec_holder(), + vds()); - initialised_ = true; + initialised_ = (vec_size > 0); } - assert(initialised_ && (vec_size_ > 0)); + assert(initialised_); } ~conditional_vector_node() { - delete temp_; - delete temp_vec_node_; + memory_context_.clear(); } inline T value() const exprtk_override { - if (initialised_) + T result = T(0); + T* source_vector = 0; + T* result_vector = vds().data(); + + if (is_true(condition_)) { - assert(condition_ .first); - assert(consequent_ .first); - assert(alternative_.first); - - T result = T(0); - T* source_vector = 0; - T* result_vector = vds().data(); - - if (is_true(condition_)) - { - result = consequent_.first->value(); - source_vector = consequent_node_ptr_->vds().data(); - } - else - { - result = alternative_.first->value(); - source_vector = alternative_node_ptr_->vds().data(); - } - - for (std::size_t i = 0; i < vec_size_; ++i) - { - result_vector[i] = source_vector[i]; - } - - return result; + result = consequent_.first->value(); + source_vector = consequent_node_ptr_->vds().data(); + result_vec_size_ = consequent_node_ptr_->size(); + } + else + { + result = alternative_.first->value(); + source_vector = alternative_node_ptr_->vds().data(); + result_vec_size_ = alternative_node_ptr_->size(); } - return std::numeric_limits::quiet_NaN(); + for (std::size_t i = 0; i < result_vec_size_; ++i) + { + result_vector[i] = source_vector[i]; + } + + return result; } vector_node_ptr vec() const exprtk_override { - return temp_vec_node_; + return memory_context_.temp_vec_node_; } vector_node_ptr vec() exprtk_override { - return temp_vec_node_; + return memory_context_.temp_vec_node_; } inline typename expression_node::node_type type() const exprtk_override @@ -12031,9 +14308,26 @@ namespace exprtk return expression_node::e_vecondition; } + inline bool valid() const exprtk_override + { + return + initialised_ && + condition_ .first && condition_ .first->valid() && + consequent_ .first && consequent_ .first->valid() && + alternative_.first && alternative_.first->valid() && + size() <= base_size(); + } + std::size_t size() const exprtk_override { - return vec_size_; + return result_vec_size_; + } + + std::size_t base_size() const exprtk_override + { + return std::min( + consequent_node_ptr_ ->vec_holder().base_size(), + alternative_node_ptr_->vec_holder().base_size()); } vds_t& vds() exprtk_override @@ -12061,16 +14355,17 @@ namespace exprtk private: - branch_t condition_; - branch_t consequent_; - branch_t alternative_; - vector_node_ptr consequent_node_ptr_; - vector_node_ptr alternative_node_ptr_; - vector_node_ptr temp_vec_node_; - vector_holder_ptr temp_; - vds_t vds_; - std::size_t vec_size_; - bool initialised_; + branch_t condition_; + branch_t consequent_; + branch_t alternative_; + vector_node_ptr consequent_node_ptr_; + vector_node_ptr alternative_node_ptr_; + vector_node_ptr temp_vec_node_; + vector_holder_ptr temp_; + vds_t vds_; + mutable std::size_t result_vec_size_; + bool initialised_; + memory_context memory_context_; }; template @@ -12085,13 +14380,12 @@ namespace exprtk expression_ptr branch0, expression_ptr branch1) : binary_node(opr, branch0, branch1) - {} + { + assert(binary_node::valid()); + } inline T value() const exprtk_override { - assert(branch(0)); - assert(branch(1)); - return ( std::not_equal_to() (T(0),branch(0)->value()) && @@ -12113,13 +14407,12 @@ namespace exprtk expression_ptr branch0, expression_ptr branch1) : binary_node(opr, branch0, branch1) - {} + { + assert(binary_node::valid()); + } inline T value() const exprtk_override { - assert(branch(0)); - assert(branch(1)); - return ( std::not_equal_to() (T(0),branch(0)->value()) || @@ -12134,7 +14427,7 @@ namespace exprtk { public: - // Function of N paramters. + // Function of N parameters. typedef expression_node* expression_ptr; typedef std::pair branch_t; typedef IFunction ifunction; @@ -12142,6 +14435,7 @@ namespace exprtk explicit function_N_node(ifunction* func) : function_((N == func->param_count) ? func : reinterpret_cast(0)) , parameter_count_(func->param_count) + , initialised_(false) {} template @@ -12152,19 +14446,24 @@ namespace exprtk #pragma warning(push) #pragma warning(disable: 4127) #endif + if (N != NumBranches) - return false; - else { - for (std::size_t i = 0; i < NumBranches; ++i) - { - if (b[i]) - branch_[i] = std::make_pair(b[i],branch_deletable(b[i])); - else - return false; - } - return true; + return false; } + + for (std::size_t i = 0; i < NumBranches; ++i) + { + if (b[i] && b[i]->valid()) + branch_[i] = std::make_pair(b[i],branch_deletable(b[i])); + else + return false; + } + + initialised_ = function_; + assert(valid()); + return initialised_; + #ifdef _MSC_VER #pragma warning(pop) #endif @@ -12182,14 +14481,11 @@ namespace exprtk #pragma warning(push) #pragma warning(disable: 4127) #endif - if ((0 == function_) || (0 == N)) - return std::numeric_limits::quiet_NaN(); - else - { - T v[N]; - evaluate_branches::execute(v,branch_); - return invoke::execute(*function_,v); - } + + T v[N]; + evaluate_branches::execute(v,branch_); + return invoke::execute(*function_,v); + #ifdef _MSC_VER #pragma warning(pop) #endif @@ -12200,9 +14496,14 @@ namespace exprtk return expression_node::e_function; } + inline bool valid() const exprtk_override + { + return initialised_; + } + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override { - expression_node::ndb_t::template collect(branch_, node_delete_list); + expression_node::ndb_t::collect(branch_, node_delete_list); } std::size_t node_depth() const exprtk_override @@ -12222,6 +14523,20 @@ namespace exprtk } }; + template + struct evaluate_branches + { + static inline void execute(T_ (&v)[6], const branch_t (&b)[6]) + { + v[0] = b[0].first->value(); + v[1] = b[1].first->value(); + v[2] = b[2].first->value(); + v[3] = b[3].first->value(); + v[4] = b[4].first->value(); + v[5] = b[5].first->value(); + } + }; + template struct evaluate_branches { @@ -12425,6 +14740,7 @@ namespace exprtk ifunction* function_; std::size_t parameter_count_; branch_t branch_[N]; + bool initialised_; }; template @@ -12437,7 +14753,9 @@ namespace exprtk explicit function_N_node(ifunction* func) : function_((0 == func->param_count) ? func : reinterpret_cast(0)) - {} + { + assert(valid()); + } inline bool operator <(const function_N_node& fn) const { @@ -12446,10 +14764,7 @@ namespace exprtk inline T value() const exprtk_override { - if (function_) - return (*function_)(); - else - return std::numeric_limits::quiet_NaN(); + return (*function_)(); } inline typename expression_node::node_type type() const exprtk_override @@ -12457,6 +14772,11 @@ namespace exprtk return expression_node::e_function; } + inline bool valid() const exprtk_override + { + return function_; + } + private: ifunction* function_; @@ -12475,6 +14795,7 @@ namespace exprtk , arg_list_(arg_list) { value_list_.resize(arg_list.size(),std::numeric_limits::quiet_NaN()); + assert(valid()); } inline bool operator <(const vararg_function_node& fn) const @@ -12484,13 +14805,8 @@ namespace exprtk inline T value() const exprtk_override { - if (function_) - { - populate_value_list(); - return (*function_)(value_list_); - } - else - return std::numeric_limits::quiet_NaN(); + populate_value_list(); + return (*function_)(value_list_); } inline typename expression_node::node_type type() const exprtk_override @@ -12498,6 +14814,11 @@ namespace exprtk return expression_node::e_vafunction; } + inline bool valid() const exprtk_override + { + return function_; + } + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override { for (std::size_t i = 0; i < arg_list_.size(); ++i) @@ -12545,7 +14866,8 @@ namespace exprtk typedef typename range_interface::range_t range_t; typedef std::pair branch_t; - typedef std::pair void_t; + typedef vector_holder* vh_t; + typedef vector_view* vecview_t; typedef std::vector tmp_vs_t; typedef std::vector typestore_list_t; @@ -12557,7 +14879,18 @@ namespace exprtk , arg_list_(arg_list) {} - virtual ~generic_function_node() {} + virtual ~generic_function_node() + { + for (std::size_t i = 0; i < vv_list_.size(); ++i) + { + vecview_t& vv = vv_list_[i]; + if (vv && typestore_list_[i].vec_data) + { + vv->remove_ref(&typestore_list_[i].vec_data); + typestore_list_[i].vec_data = 0; + } + } + } void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override { @@ -12571,10 +14904,11 @@ namespace exprtk virtual bool init_branches() { - expr_as_vec1_store_.resize(arg_list_.size(),T(0) ); - typestore_list_ .resize(arg_list_.size(),type_store_t() ); - range_list_ .resize(arg_list_.size(),range_data_type_t()); - branch_ .resize(arg_list_.size(),branch_t(reinterpret_cast(0),false)); + expr_as_vec1_store_.resize(arg_list_.size(), T(0) ); + typestore_list_ .resize(arg_list_.size(), type_store_t() ); + range_list_ .resize(arg_list_.size(), range_data_type_t()); + branch_ .resize(arg_list_.size(), branch_t(reinterpret_cast(0),false)); + vv_list_ .resize(arg_list_.size(), vecview_t(0)); for (std::size_t i = 0; i < arg_list_.size(); ++i) { @@ -12592,7 +14926,15 @@ namespace exprtk ts.size = vi->size(); ts.data = vi->vds().data(); ts.type = type_store_t::e_vector; - vi->vec()->vec_holder().set_ref(&ts.vec_data); + + if ( + vi->vec()->vec_holder().rebaseable() && + vi->vec()->vec_holder().rebaseable_instance() + ) + { + vv_list_[i] = vi->vec()->vec_holder().rebaseable_instance(); + vv_list_[i]->set_ref(&ts.vec_data); + } } #ifndef exprtk_disable_string_capabilities else if (is_generally_string_node(arg_list_[i])) @@ -12628,7 +14970,10 @@ namespace exprtk range_list_[i].range = reinterpret_cast(0); } else + { range_list_[i].range = &(ri->range_ref()); + range_param_list_.push_back(i); + } } #endif else if (is_variable_node(arg_list_[i])) @@ -12662,14 +15007,11 @@ namespace exprtk inline T value() const exprtk_override { - if (function_) + if (populate_value_list()) { - if (populate_value_list()) - { - typedef typename GenericFunction::parameter_list_t parameter_list_t; + typedef typename GenericFunction::parameter_list_t parameter_list_t; - return (*function_)(parameter_list_t(typestore_list_)); - } + return (*function_)(parameter_list_t(typestore_list_)); } return std::numeric_limits::quiet_NaN(); @@ -12680,6 +15022,11 @@ namespace exprtk return expression_node::e_genfunction; } + inline bool valid() const exprtk_override + { + return function_; + } + protected: inline virtual bool populate_value_list() const @@ -12689,30 +15036,40 @@ namespace exprtk expr_as_vec1_store_[i] = branch_[i].first->value(); } - for (std::size_t i = 0; i < branch_.size(); ++i) + if (!range_param_list_.empty()) { - range_data_type_t& rdt = range_list_[i]; + assert(range_param_list_.size() <= branch_.size()); - if (rdt.range) + for (std::size_t i = 0; i < range_param_list_.size(); ++i) { + const std::size_t index = range_param_list_[i]; + range_data_type_t& rdt = range_list_[index]; + const range_t& rp = (*rdt.range); std::size_t r0 = 0; std::size_t r1 = 0; - if (rp(r0, r1, rdt.size)) - { - type_store_t& ts = typestore_list_[i]; + const std::size_t data_size = + #ifndef exprtk_disable_string_capabilities + rdt.str_node ? rdt.str_node->size() : rdt.size; + #else + rdt.size; + #endif - ts.size = rp.cache_size(); - #ifndef exprtk_disable_string_capabilities - if (ts.type == type_store_t::e_string) - ts.data = const_cast(rdt.str_node->base()) + rp.cache.first; - else - #endif - ts.data = static_cast(rdt.data) + (rp.cache.first * rdt.type_size); - } - else + if (!rp(r0, r1, data_size)) + { return false; + } + + type_store_t& ts = typestore_list_[index]; + + ts.size = rp.cache_size(); + #ifndef exprtk_disable_string_capabilities + if (ts.type == type_store_t::e_string) + ts.data = const_cast(rdt.str_node->base()) + rp.cache.first; + else + #endif + ts.data = static_cast(rdt.data) + (rp.cache.first * rdt.type_size); } } @@ -12725,16 +15082,18 @@ namespace exprtk private: std::vector arg_list_; - std::vector branch_; - mutable tmp_vs_t expr_as_vec1_store_; - mutable range_list_t range_list_; + std::vector branch_; + std::vector vv_list_; + mutable tmp_vs_t expr_as_vec1_store_; + mutable range_list_t range_list_; + std::vector range_param_list_; }; #ifndef exprtk_disable_string_capabilities template - class string_function_node : public generic_function_node, - public string_base_node, - public range_interface + class string_function_node : public generic_function_node + , public string_base_node + , public range_interface { public: @@ -12749,6 +15108,7 @@ namespace exprtk range_.n1_c = std::make_pair(true,0); range_.cache.first = range_.n0_c.second; range_.cache.second = range_.n1_c.second; + assert(valid()); } inline bool operator <(const string_function_node& fn) const @@ -12758,23 +15118,21 @@ namespace exprtk inline T value() const exprtk_override { - if (gen_function_t::function_) + if (gen_function_t::populate_value_list()) { - if (gen_function_t::populate_value_list()) - { - typedef typename StringFunction::parameter_list_t parameter_list_t; + typedef typename StringFunction::parameter_list_t parameter_list_t; - const T result = (*gen_function_t::function_) - ( - ret_string_, - parameter_list_t(gen_function_t::typestore_list_) - ); + const T result = + (*gen_function_t::function_) + ( + ret_string_, + parameter_list_t(gen_function_t::typestore_list_) + ); - range_.n1_c.second = ret_string_.size() - 1; - range_.cache.second = range_.n1_c.second; + range_.n1_c.second = ret_string_.size(); + range_.cache.second = range_.n1_c.second; - return result; - } + return result; } return std::numeric_limits::quiet_NaN(); @@ -12785,6 +15143,11 @@ namespace exprtk return expression_node::e_strfunction; } + inline bool valid() const exprtk_override + { + return gen_function_t::function_; + } + std::string str() const exprtk_override { return ret_string_; @@ -12834,18 +15197,18 @@ namespace exprtk inline T value() const exprtk_override { - if (gen_function_t::function_) - { - if (gen_function_t::populate_value_list()) - { - typedef typename GenericFunction::parameter_list_t parameter_list_t; + assert(gen_function_t::valid()); - return (*gen_function_t::function_) - ( - param_seq_index_, - parameter_list_t(gen_function_t::typestore_list_) - ); - } + if (gen_function_t::populate_value_list()) + { + typedef typename GenericFunction::parameter_list_t parameter_list_t; + + return + (*gen_function_t::function_) + ( + param_seq_index_, + parameter_list_t(gen_function_t::typestore_list_) + ); } return std::numeric_limits::quiet_NaN(); @@ -12879,24 +15242,22 @@ namespace exprtk inline T value() const exprtk_override { - if (str_function_t::function_) + if (str_function_t::populate_value_list()) { - if (str_function_t::populate_value_list()) - { - typedef typename StringFunction::parameter_list_t parameter_list_t; + typedef typename StringFunction::parameter_list_t parameter_list_t; - const T result = (*str_function_t::function_) - ( - param_seq_index_, - str_function_t::ret_string_, - parameter_list_t(str_function_t::typestore_list_) - ); + const T result = + (*str_function_t::function_) + ( + param_seq_index_, + str_function_t::ret_string_, + parameter_list_t(str_function_t::typestore_list_) + ); - str_function_t::range_.n1_c.second = str_function_t::ret_string_.size() - 1; - str_function_t::range_.cache.second = str_function_t::range_.n1_c.second; + str_function_t::range_.n1_c.second = str_function_t::ret_string_.size(); + str_function_t::range_.cache.second = str_function_t::range_.n1_c.second; - return result; - } + return result; } return std::numeric_limits::quiet_NaN(); @@ -12913,15 +15274,15 @@ namespace exprtk }; #endif - class return_exception - {}; + class return_exception {}; template class null_igenfunc { public: - virtual ~null_igenfunc() {} + virtual ~null_igenfunc() + {} typedef type_store generic_type; typedef typename generic_type::parameter_list parameter_list_t; @@ -12947,14 +15308,13 @@ namespace exprtk results_context_t& rc) : gen_function_t (arg_list) , results_context_(&rc) - {} + { + assert(valid()); + } inline T value() const exprtk_override { - if ( - (0 != results_context_) && - gen_function_t::populate_value_list() - ) + if (gen_function_t::populate_value_list()) { typedef typename type_store::parameter_list parameter_list_t; @@ -12972,6 +15332,11 @@ namespace exprtk return expression_node::e_return; } + inline bool valid() const exprtk_override + { + return results_context_; + } + private: results_context_t* results_context_; @@ -12991,12 +15356,11 @@ namespace exprtk , return_invoked_ (false) { construct_branch_pair(body_, body); + assert(valid()); } inline T value() const exprtk_override { - assert(body_.first); - try { return_invoked_ = false; @@ -13007,6 +15371,7 @@ namespace exprtk catch(const return_exception&) { return_invoked_ = true; + return std::numeric_limits::quiet_NaN(); } } @@ -13016,6 +15381,11 @@ namespace exprtk return expression_node::e_retenv; } + inline bool valid() const exprtk_override + { + return results_context_ && body_.first; + } + inline bool* retinvk_ptr() { return &return_invoked_; @@ -13400,7 +15770,7 @@ namespace exprtk } template - struct vararg_add_op : public opr_base + struct vararg_add_op exprtk_final : public opr_base { typedef typename opr_base::Type Type; @@ -13423,7 +15793,7 @@ namespace exprtk for (std::size_t i = 0; i < arg_list.size(); ++i) { - result += value(arg_list[i]); + result += value(arg_list[i]); } return result; @@ -13467,7 +15837,7 @@ namespace exprtk }; template - struct vararg_mul_op : public opr_base + struct vararg_mul_op exprtk_final : public opr_base { typedef typename opr_base::Type Type; @@ -13534,7 +15904,7 @@ namespace exprtk }; template - struct vararg_avg_op : public opr_base + struct vararg_avg_op exprtk_final : public opr_base { typedef typename opr_base::Type Type; @@ -13590,7 +15960,7 @@ namespace exprtk }; template - struct vararg_min_op : public opr_base + struct vararg_min_op exprtk_final : public opr_base { typedef typename opr_base::Type Type; @@ -13661,7 +16031,7 @@ namespace exprtk }; template - struct vararg_max_op : public opr_base + struct vararg_max_op exprtk_final : public opr_base { typedef typename opr_base::Type Type; @@ -13732,7 +16102,7 @@ namespace exprtk }; template - struct vararg_mand_op : public opr_base + struct vararg_mand_op exprtk_final : public opr_base { typedef typename opr_base::Type Type; @@ -13812,7 +16182,7 @@ namespace exprtk }; template - struct vararg_mor_op : public opr_base + struct vararg_mor_op exprtk_final : public opr_base { typedef typename opr_base::Type Type; @@ -13892,7 +16262,7 @@ namespace exprtk }; template - struct vararg_multi_op : public opr_base + struct vararg_multi_op exprtk_final : public opr_base { typedef typename opr_base::Type Type; @@ -13913,14 +16283,13 @@ namespace exprtk case 7 : return process_7(arg_list); case 8 : return process_8(arg_list); default : - { - for (std::size_t i = 0; i < (arg_list.size() - 1); ++i) - { - value(arg_list[i]); - } - - return value(arg_list.back()); - } + { + for (std::size_t i = 0; i < (arg_list.size() - 1); ++i) + { + value(arg_list[i]); + } + return value(arg_list.back()); + } } } @@ -14009,7 +16378,7 @@ namespace exprtk static inline T process(const ivector_ptr v) { const T* vec = v->vec()->vds().data(); - const std::size_t vec_size = v->vec()->vds().size(); + const std::size_t vec_size = v->size(); loop_unroll::details lud(vec_size); @@ -14018,24 +16387,24 @@ namespace exprtk T result = T(0); int i = 0; - exprtk_disable_fallthrough_begin switch (vec_size) { - #define case_stmt(N) \ - case N : result += vec[i++]; \ + #define case_stmt(N,fall_through) \ + case N : result += vec[i++]; \ + fall_through \ #ifndef exprtk_disable_superscalar_unroll - case_stmt(16) case_stmt(15) - case_stmt(14) case_stmt(13) - case_stmt(12) case_stmt(11) - case_stmt(10) case_stmt( 9) - case_stmt( 8) case_stmt( 7) - case_stmt( 6) case_stmt( 5) + case_stmt(16, exprtk_fallthrough) case_stmt(15, exprtk_fallthrough) + case_stmt(14, exprtk_fallthrough) case_stmt(13, exprtk_fallthrough) + case_stmt(12, exprtk_fallthrough) case_stmt(11, exprtk_fallthrough) + case_stmt(10, exprtk_fallthrough) case_stmt( 9, exprtk_fallthrough) + case_stmt( 8, exprtk_fallthrough) case_stmt( 7, exprtk_fallthrough) + case_stmt( 6, exprtk_fallthrough) case_stmt( 5, exprtk_fallthrough) + #endif - case_stmt( 4) case_stmt( 3) - case_stmt( 2) case_stmt( 1) + case_stmt( 4, exprtk_fallthrough) case_stmt( 3, exprtk_fallthrough) + case_stmt( 2, exprtk_fallthrough) case_stmt( 1, (void)0;) } - exprtk_disable_fallthrough_end #undef case_stmt @@ -14070,24 +16439,23 @@ namespace exprtk int i = 0; - exprtk_disable_fallthrough_begin switch (lud.remainder) { - #define case_stmt(N) \ - case N : r[0] += vec[i++]; \ + #define case_stmt(N,fall_through) \ + case N : r[0] += vec[i++]; \ + fall_through \ #ifndef exprtk_disable_superscalar_unroll - case_stmt(15) case_stmt(14) - case_stmt(13) case_stmt(12) - case_stmt(11) case_stmt(10) - case_stmt( 9) case_stmt( 8) - case_stmt( 7) case_stmt( 6) - case_stmt( 5) case_stmt( 4) + case_stmt(15, exprtk_fallthrough) case_stmt(14, exprtk_fallthrough) + case_stmt(13, exprtk_fallthrough) case_stmt(12, exprtk_fallthrough) + case_stmt(11, exprtk_fallthrough) case_stmt(10, exprtk_fallthrough) + case_stmt( 9, exprtk_fallthrough) case_stmt( 8, exprtk_fallthrough) + case_stmt( 7, exprtk_fallthrough) case_stmt( 6, exprtk_fallthrough) + case_stmt( 5, exprtk_fallthrough) case_stmt( 4, exprtk_fallthrough) #endif - case_stmt( 3) case_stmt( 2) - case_stmt( 1) + case_stmt( 3, exprtk_fallthrough) case_stmt( 2, exprtk_fallthrough) + case_stmt( 1, (void)0;) } - exprtk_disable_fallthrough_end #undef exprtk_loop #undef case_stmt @@ -14110,7 +16478,7 @@ namespace exprtk static inline T process(const ivector_ptr v) { const T* vec = v->vec()->vds().data(); - const std::size_t vec_size = v->vec()->vds().size(); + const std::size_t vec_size = v->vec()->size(); loop_unroll::details lud(vec_size); @@ -14119,24 +16487,23 @@ namespace exprtk T result = T(1); int i = 0; - exprtk_disable_fallthrough_begin switch (vec_size) { - #define case_stmt(N) \ - case N : result *= vec[i++]; \ + #define case_stmt(N,fall_through) \ + case N : result *= vec[i++]; \ + fall_through \ #ifndef exprtk_disable_superscalar_unroll - case_stmt(16) case_stmt(15) - case_stmt(14) case_stmt(13) - case_stmt(12) case_stmt(11) - case_stmt(10) case_stmt( 9) - case_stmt( 8) case_stmt( 7) - case_stmt( 6) case_stmt( 5) + case_stmt(16, exprtk_fallthrough) case_stmt(15, exprtk_fallthrough) + case_stmt(14, exprtk_fallthrough) case_stmt(13, exprtk_fallthrough) + case_stmt(12, exprtk_fallthrough) case_stmt(11, exprtk_fallthrough) + case_stmt(10, exprtk_fallthrough) case_stmt( 9, exprtk_fallthrough) + case_stmt( 8, exprtk_fallthrough) case_stmt( 7, exprtk_fallthrough) + case_stmt( 6, exprtk_fallthrough) case_stmt( 5, exprtk_fallthrough) #endif - case_stmt( 4) case_stmt( 3) - case_stmt( 2) case_stmt( 1) + case_stmt( 4, exprtk_fallthrough) case_stmt( 3, exprtk_fallthrough) + case_stmt( 2, exprtk_fallthrough) case_stmt( 1, (void)0;) } - exprtk_disable_fallthrough_end #undef case_stmt @@ -14171,33 +16538,32 @@ namespace exprtk int i = 0; - exprtk_disable_fallthrough_begin switch (lud.remainder) { - #define case_stmt(N) \ - case N : r[0] *= vec[i++]; \ + #define case_stmt(N,fall_through) \ + case N : r[0] *= vec[i++]; \ + fall_through \ #ifndef exprtk_disable_superscalar_unroll - case_stmt(15) case_stmt(14) - case_stmt(13) case_stmt(12) - case_stmt(11) case_stmt(10) - case_stmt( 9) case_stmt( 8) - case_stmt( 7) case_stmt( 6) - case_stmt( 5) case_stmt( 4) + case_stmt(15, exprtk_fallthrough) case_stmt(14, exprtk_fallthrough) + case_stmt(13, exprtk_fallthrough) case_stmt(12, exprtk_fallthrough) + case_stmt(11, exprtk_fallthrough) case_stmt(10, exprtk_fallthrough) + case_stmt( 9, exprtk_fallthrough) case_stmt( 8, exprtk_fallthrough) + case_stmt( 7, exprtk_fallthrough) case_stmt( 6, exprtk_fallthrough) + case_stmt( 5, exprtk_fallthrough) case_stmt( 4, exprtk_fallthrough) #endif - case_stmt( 3) case_stmt( 2) - case_stmt( 1) + case_stmt( 3, exprtk_fallthrough) case_stmt( 2, exprtk_fallthrough) + case_stmt( 1, (void)0;) } - exprtk_disable_fallthrough_end #undef exprtk_loop #undef case_stmt return (r[ 0] * r[ 1] * r[ 2] * r[ 3]) #ifndef exprtk_disable_superscalar_unroll - + (r[ 4] * r[ 5] * r[ 6] * r[ 7]) - + (r[ 8] * r[ 9] * r[10] * r[11]) - + (r[12] * r[13] * r[14] * r[15]) + * (r[ 4] * r[ 5] * r[ 6] * r[ 7]) + * (r[ 8] * r[ 9] * r[10] * r[11]) + * (r[12] * r[13] * r[14] * r[15]) #endif ; } @@ -14210,7 +16576,7 @@ namespace exprtk static inline T process(const ivector_ptr v) { - const T vec_size = T(v->vec()->vds().size()); + const T vec_size = T(v->vec()->size()); return vec_add_op::process(v) / vec_size; } }; @@ -14223,7 +16589,7 @@ namespace exprtk static inline T process(const ivector_ptr v) { const T* vec = v->vec()->vds().data(); - const std::size_t vec_size = v->vec()->vds().size(); + const std::size_t vec_size = v->vec()->size(); T result = vec[0]; @@ -14247,7 +16613,7 @@ namespace exprtk static inline T process(const ivector_ptr v) { const T* vec = v->vec()->vds().data(); - const std::size_t vec_size = v->vec()->vds().size(); + const std::size_t vec_size = v->vec()->size(); T result = vec[0]; @@ -14268,7 +16634,8 @@ namespace exprtk { public: - virtual ~vov_base_node() {} + virtual ~vov_base_node() + {} inline virtual operator_type operation() const { @@ -14285,7 +16652,8 @@ namespace exprtk { public: - virtual ~cov_base_node() {} + virtual ~cov_base_node() + {} inline virtual operator_type operation() const { @@ -14302,7 +16670,8 @@ namespace exprtk { public: - virtual ~voc_base_node() {} + virtual ~voc_base_node() + {} inline virtual operator_type operation() const { @@ -14319,7 +16688,8 @@ namespace exprtk { public: - virtual ~vob_base_node() {} + virtual ~vob_base_node() + {} virtual const T& v() const = 0; }; @@ -14329,7 +16699,8 @@ namespace exprtk { public: - virtual ~bov_base_node() {} + virtual ~bov_base_node() + {} virtual const T& v() const = 0; }; @@ -14339,7 +16710,8 @@ namespace exprtk { public: - virtual ~cob_base_node() {} + virtual ~cob_base_node() + {} inline virtual operator_type operation() const { @@ -14358,7 +16730,8 @@ namespace exprtk { public: - virtual ~boc_base_node() {} + virtual ~boc_base_node() + {} inline virtual operator_type operation() const { @@ -14377,7 +16750,8 @@ namespace exprtk { public: - virtual ~uv_base_node() {} + virtual ~uv_base_node() + {} inline virtual operator_type operation() const { @@ -14392,7 +16766,8 @@ namespace exprtk { public: - virtual ~sos_base_node() {} + virtual ~sos_base_node() + {} inline virtual operator_type operation() const { @@ -14405,7 +16780,8 @@ namespace exprtk { public: - virtual ~sosos_base_node() {} + virtual ~sosos_base_node() + {} inline virtual operator_type operation() const { @@ -14418,7 +16794,8 @@ namespace exprtk { public: - virtual ~T0oT1oT2_base_node() {} + virtual ~T0oT1oT2_base_node() + {} virtual std::string type_id() const = 0; }; @@ -14428,7 +16805,8 @@ namespace exprtk { public: - virtual ~T0oT1oT2oT3_base_node() {} + virtual ~T0oT1oT2oT3_base_node() + {} virtual std::string type_id() const = 0; }; @@ -14564,6 +16942,11 @@ namespace exprtk return Operation::type(); } + inline bool valid() const exprtk_override + { + return branch_.first && branch_.first->valid(); + } + inline operator_type operation() { return Operation::operation(); @@ -15186,7 +17569,8 @@ namespace exprtk { public: - virtual ~sf3ext_type_node() {} + virtual ~sf3ext_type_node() + {} virtual T0 t0() const = 0; @@ -15644,16 +18028,16 @@ namespace exprtk typedef std::pair branch_t; typedef Operation operation_t; - // variable op constant node + // variable op binary node explicit vob_node(const T& var, const expression_ptr branch) : v_(var) { construct_branch_pair(branch_, branch); + assert(valid()); } inline T value() const exprtk_override { - assert(branch_.first); return Operation::process(v_,branch_.first->value()); } @@ -15662,6 +18046,11 @@ namespace exprtk return v_; } + inline bool valid() const exprtk_override + { + return branch_.first && branch_.first->valid(); + } + inline expression_node* branch(const std::size_t&) const exprtk_override { return branch_.first; @@ -15669,7 +18058,7 @@ namespace exprtk void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override { - expression_node::ndb_t::template collect(branch_, node_delete_list); + expression_node::ndb_t::collect(branch_, node_delete_list); } std::size_t node_depth() const exprtk_override @@ -15695,16 +18084,16 @@ namespace exprtk typedef std::pair branch_t; typedef Operation operation_t; - // variable op constant node + // binary node op variable node explicit bov_node(const expression_ptr branch, const T& var) : v_(var) { construct_branch_pair(branch_, branch); + assert(valid()); } inline T value() const exprtk_override { - assert(branch_.first); return Operation::process(branch_.first->value(),v_); } @@ -15713,6 +18102,11 @@ namespace exprtk return v_; } + inline bool valid() const exprtk_override + { + return branch_.first && branch_.first->valid(); + } + inline expression_node* branch(const std::size_t&) const exprtk_override { return branch_.first; @@ -15720,7 +18114,7 @@ namespace exprtk void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override { - expression_node::ndb_t::template collect(branch_, node_delete_list); + expression_node::ndb_t::collect(branch_, node_delete_list); } std::size_t node_depth() const exprtk_override @@ -15746,16 +18140,16 @@ namespace exprtk typedef std::pair branch_t; typedef Operation operation_t; - // variable op constant node + // constant op variable node explicit cob_node(const T const_var, const expression_ptr branch) : c_(const_var) { construct_branch_pair(branch_, branch); + assert(valid()); } inline T value() const exprtk_override { - assert(branch_.first); return Operation::process(c_,branch_.first->value()); } @@ -15774,6 +18168,11 @@ namespace exprtk (*const_cast(&c_)) = new_c; } + inline bool valid() const exprtk_override + { + return branch_.first && branch_.first->valid(); + } + inline expression_node* branch(const std::size_t&) const exprtk_override { return branch_.first; @@ -15787,7 +18186,7 @@ namespace exprtk void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override { - expression_node::ndb_t::template collect(branch_, node_delete_list); + expression_node::ndb_t::collect(branch_, node_delete_list); } std::size_t node_depth() const exprtk_override @@ -15813,16 +18212,16 @@ namespace exprtk typedef std::pair branch_t; typedef Operation operation_t; - // variable op constant node + // binary node op constant node explicit boc_node(const expression_ptr branch, const T const_var) : c_(const_var) { construct_branch_pair(branch_, branch); + assert(valid()); } inline T value() const exprtk_override { - assert(branch_.first); return Operation::process(branch_.first->value(),c_); } @@ -15841,6 +18240,11 @@ namespace exprtk (*const_cast(&c_)) = new_c; } + inline bool valid() const exprtk_override + { + return branch_.first && branch_.first->valid(); + } + inline expression_node* branch(const std::size_t&) const exprtk_override { return branch_.first; @@ -15854,7 +18258,7 @@ namespace exprtk void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override { - expression_node::ndb_t::template collect(branch_, node_delete_list); + expression_node::ndb_t::collect(branch_, node_delete_list); } std::size_t node_depth() const exprtk_override @@ -16013,7 +18417,13 @@ namespace exprtk std::size_t r1 = 0; if (rp1_(r0, r1, s1_.size())) - return Operation::process(s0_, s1_.substr(r0, (r1 - r0) + 1)); + { + return Operation::process + ( + s0_, + s1_.substr(r0, (r1 - r0) + 1) + ); + } else return T(0); } @@ -16085,10 +18495,11 @@ namespace exprtk rp1_(r0_1, r1_1, s1_.size()) ) { - return Operation::process( - s0_.substr(r0_0, (r1_0 - r0_0) + 1), - s1_.substr(r0_1, (r1_1 - r0_1) + 1) - ); + return Operation::process + ( + s0_.substr(r0_0, (r1_0 - r0_0) + 1), + s1_.substr(r0_1, (r1_1 - r0_1) + 1) + ); } else return T(0); @@ -16149,6 +18560,7 @@ namespace exprtk , str1_base_ptr_ (0) , str0_range_ptr_(0) , str1_range_ptr_(0) + , initialised_ (false) { if (is_generally_string_node(branch(0))) { @@ -16179,39 +18591,40 @@ namespace exprtk str1_range_ptr_ = &(range->range_ref()); } + + initialised_ = + str0_base_ptr_ && + str1_base_ptr_ && + str0_range_ptr_ && + str1_range_ptr_; + + assert(valid()); } inline T value() const exprtk_override { + branch(0)->value(); + branch(1)->value(); + + std::size_t str0_r0 = 0; + std::size_t str0_r1 = 0; + + std::size_t str1_r0 = 0; + std::size_t str1_r1 = 0; + + const range_t& range0 = (*str0_range_ptr_); + const range_t& range1 = (*str1_range_ptr_); + if ( - str0_base_ptr_ && - str1_base_ptr_ && - str0_range_ptr_ && - str1_range_ptr_ + range0(str0_r0, str0_r1, str0_base_ptr_->size()) && + range1(str1_r0, str1_r1, str1_base_ptr_->size()) ) { - branch(0)->value(); - branch(1)->value(); - - std::size_t str0_r0 = 0; - std::size_t str0_r1 = 0; - - std::size_t str1_r0 = 0; - std::size_t str1_r1 = 0; - - const range_t& range0 = (*str0_range_ptr_); - const range_t& range1 = (*str1_range_ptr_); - - if ( - range0(str0_r0, str0_r1, str0_base_ptr_->size()) && - range1(str1_r0, str1_r1, str1_base_ptr_->size()) - ) - { - return Operation::process( - str0_base_ptr_->str().substr(str0_r0,(str0_r1 - str0_r0) + 1), - str1_base_ptr_->str().substr(str1_r0,(str1_r1 - str1_r0) + 1) - ); - } + return Operation::process + ( + str0_base_ptr_->str().substr(str0_r0,(str0_r1 - str0_r0)), + str1_base_ptr_->str().substr(str1_r0,(str1_r1 - str1_r0)) + ); } return std::numeric_limits::quiet_NaN(); @@ -16222,6 +18635,11 @@ namespace exprtk return Operation::type(); } + inline bool valid() const exprtk_override + { + return initialised_; + } + private: str_sogens_node(const str_sogens_node&) exprtk_delete; @@ -16231,6 +18649,7 @@ namespace exprtk str_base_ptr str1_base_ptr_; range_ptr str0_range_ptr_; range_ptr str1_range_ptr_; + bool initialised_; }; template @@ -16242,7 +18661,7 @@ namespace exprtk typedef Operation operation_t; typedef sosos_node node_type; - // variable op variable node + // string op string op string node explicit sosos_node(SType0 p0, SType1 p1, SType2 p2) : s0_(p0) , s1_(p1) @@ -16334,11 +18753,11 @@ namespace exprtk explicit bipow_node(expression_ptr branch) { construct_branch_pair(branch_, branch); + assert(valid()); } inline T value() const exprtk_override { - assert(branch_.first); return PowOp::result(branch_.first->value()); } @@ -16347,6 +18766,11 @@ namespace exprtk return expression_node::e_ipow; } + inline bool valid() const exprtk_override + { + return branch_.first && branch_.first->valid(); + } + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override { expression_node::ndb_t::collect(branch_, node_delete_list); @@ -16396,7 +18820,7 @@ namespace exprtk }; template - class bipowninv_node exprtk_final : public expression_node + class bipowinv_node exprtk_final : public expression_node { public: @@ -16404,14 +18828,14 @@ namespace exprtk typedef std::pair branch_t; typedef PowOp operation_t; - explicit bipowninv_node(expression_ptr branch) + explicit bipowinv_node(expression_ptr branch) { construct_branch_pair(branch_, branch); + assert(valid()); } inline T value() const exprtk_override { - assert(branch_.first); return (T(1) / PowOp::result(branch_.first->value())); } @@ -16420,9 +18844,14 @@ namespace exprtk return expression_node::e_ipowinv; } + inline bool valid() const exprtk_override + { + return branch_.first && branch_.first->valid(); + } + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) exprtk_override { - expression_node::ndb_t::template collect(branch_, node_delete_list); + expression_node::ndb_t::collect(branch_, node_delete_list); } std::size_t node_depth() const exprtk_override @@ -16432,8 +18861,8 @@ namespace exprtk private: - bipowninv_node(const bipowninv_node&) exprtk_delete; - bipowninv_node& operator=(const bipowninv_node&) exprtk_delete; + bipowinv_node(const bipowinv_node&) exprtk_delete; + bipowinv_node& operator=(const bipowinv_node&) exprtk_delete; branch_t branch_; }; @@ -17117,7 +19546,8 @@ namespace exprtk : param_count(pc) {} - virtual ~ifunction() {} + virtual ~ifunction() + {} #define empty_method_body(N) \ { \ @@ -17208,7 +19638,8 @@ namespace exprtk { public: - virtual ~ivararg_function() {} + virtual ~ivararg_function() + {} inline virtual T operator() (const std::vector&) { @@ -17233,12 +19664,13 @@ namespace exprtk typedef type_store generic_type; typedef typename generic_type::parameter_list parameter_list_t; - igeneric_function(const std::string& param_seq = "", const return_type rtr_type = e_rtrn_scalar) + explicit igeneric_function(const std::string& param_seq = "", const return_type rtr_type = e_rtrn_scalar) : parameter_sequence(param_seq) , rtrn_type(rtr_type) {} - virtual ~igeneric_function() {} + virtual ~igeneric_function() + {} #define igeneric_function_empty_body(N) \ { \ @@ -17262,6 +19694,8 @@ namespace exprtk inline virtual T operator() (const std::size_t&, std::string&, parameter_list_t) igeneric_function_empty_body(4) + #undef igeneric_function_empty_body + std::string parameter_sequence; return_type rtrn_type; }; @@ -17765,7 +20199,7 @@ namespace exprtk { static inline bool test(const variable_node_t* p, const void* ptr) { - exprtk_debug(("ptr_match::test() - %p <--> %p\n",(void*)(&(p->ref())),ptr)); + exprtk_debug(("ptr_match::test() - %p <--> %p\n", reinterpret_cast(&(p->ref())), ptr)); return (&(p->ref()) == ptr); } }; @@ -18029,7 +20463,7 @@ namespace exprtk public: - symbol_table(const symtab_mutability_type mutability = e_mutable) + explicit symbol_table(const symtab_mutability_type mutability = e_mutable) : control_block_(control_block::create()) { control_block_->set_mutability(mutability); @@ -18508,6 +20942,34 @@ namespace exprtk return false; } + #define exprtk_define_reserved_function(NN) \ + inline bool add_reserved_function(const std::string& function_name, ff##NN##_functor function) \ + { \ + if (!valid()) \ + { return false; } \ + if (!valid_symbol(function_name,false)) \ + { return false; } \ + if (symbol_exists(function_name,false)) \ + { return false; } \ + \ + exprtk::ifunction* ifunc = new freefunc##NN(function); \ + \ + local_data().free_function_list_.push_back(ifunc); \ + \ + return add_reserved_function(function_name,(*local_data().free_function_list_.back())); \ + } \ + + exprtk_define_reserved_function(00) exprtk_define_reserved_function(01) + exprtk_define_reserved_function(02) exprtk_define_reserved_function(03) + exprtk_define_reserved_function(04) exprtk_define_reserved_function(05) + exprtk_define_reserved_function(06) exprtk_define_reserved_function(07) + exprtk_define_reserved_function(08) exprtk_define_reserved_function(09) + exprtk_define_reserved_function(10) exprtk_define_reserved_function(11) + exprtk_define_reserved_function(12) exprtk_define_reserved_function(13) + exprtk_define_reserved_function(14) exprtk_define_reserved_function(15) + + #undef exprtk_define_reserved_function + template inline bool add_vector(const std::string& vector_name, T (&v)[N]) { @@ -18682,12 +21144,48 @@ namespace exprtk template class Sequence> - inline std::size_t get_vector_list(Sequence& vlist) const + inline std::size_t get_vector_list(Sequence& vec_list) const { if (!valid()) return 0; else - return local_data().vector_store.get_list(vlist); + return local_data().vector_store.get_list(vec_list); + } + + template class Sequence> + inline std::size_t get_function_list(Sequence& function_list) const + { + if (!valid()) + return 0; + + std::vector function_names; + std::size_t count = 0; + + count += local_data().function_store .get_list(function_names); + count += local_data().vararg_function_store .get_list(function_names); + count += local_data().generic_function_store .get_list(function_names); + count += local_data().string_function_store .get_list(function_names); + count += local_data().overload_function_store.get_list(function_names); + + std::set function_set; + + for (std::size_t i = 0; i < function_names.size(); ++i) + { + function_set.insert(function_names[i]); + } + + std::copy(function_set.begin(), function_set.end(), + std::back_inserter(function_list)); + + return count; + } + + inline std::vector get_function_list() const + { + std::vector result; + get_function_list(result); + return result; } inline bool symbol_exists(const std::string& symbol_name, const bool check_reserved_symb = true) const @@ -18878,6 +21376,38 @@ namespace exprtk } } + inline void load_variables_from(const symbol_table& st) + { + std::vector name_list; + + st.local_data().variable_store.get_list(name_list); + + if (!name_list.empty()) + { + for (std::size_t i = 0; i < name_list.size(); ++i) + { + T& variable = st.get_variable(name_list[i])->ref(); + add_variable(name_list[i], variable); + } + } + } + + inline void load_vectors_from(const symbol_table& st) + { + std::vector name_list; + + st.local_data().vector_store.get_list(name_list); + + if (!name_list.empty()) + { + for (std::size_t i = 0; i < name_list.size(); ++i) + { + vector_holder_t& vecholder = *st.get_vector(name_list[i]); + add_vector(name_list[i], vecholder.data(), vecholder.size()); + } + } + } + private: inline bool valid_symbol(const std::string& symbol, const bool check_reserved_symb = true) const @@ -18973,6 +21503,21 @@ namespace exprtk e_string }; + static std::string to_str(data_type dt) + { + switch(dt) + { + case e_unknown : return "e_unknown "; + case e_expr : return "e_expr" ; + case e_vecholder : return "e_vecholder"; + case e_data : return "e_data" ; + case e_vecdata : return "e_vecdata" ; + case e_string : return "e_string" ; + } + + return ""; + } + struct data_pack { data_pack() @@ -19178,17 +21723,18 @@ namespace exprtk return details::is_true(value()); } - inline void register_symbol_table(symbol_table& st) + inline bool register_symbol_table(symbol_table& st) { for (std::size_t i = 0; i < symbol_table_list_.size(); ++i) { - if (&st == &symbol_table_list_[i]) + if (st == symbol_table_list_[i]) { - return; + return false; } } symbol_table_list_.push_back(st); + return true; } inline const symbol_table& get_symbol_table(const std::size_t& index = 0) const @@ -19201,6 +21747,11 @@ namespace exprtk return symbol_table_list_[index]; } + std::size_t num_symbol_tables() const + { + return symbol_table_list_.size(); + } + typedef results_context results_context_t; inline const results_context_t& results() const @@ -19330,6 +21881,8 @@ namespace exprtk friend class parser; friend class expression_helper; friend class function_compositor; + template + friend bool is_valid(const expression& expr); }; // class expression template @@ -19337,55 +21890,165 @@ namespace exprtk { public: - static inline bool is_constant(const expression& expr) + enum node_types { - return details::is_constant_node(expr.control_block_->expr); + e_literal, + e_variable, + e_string, + e_unary, + e_binary, + e_function, + e_vararg, + e_null, + e_assert, + e_sf3ext, + e_sf4ext + }; + + static inline bool is_literal(const expression& expr) + { + return expr.control_block_ && details::is_literal_node(expr.control_block_->expr); } static inline bool is_variable(const expression& expr) { - return details::is_variable_node(expr.control_block_->expr); + return expr.control_block_ && details::is_variable_node(expr.control_block_->expr); + } + + static inline bool is_string(const expression& expr) + { + return expr.control_block_ && details::is_generally_string_node(expr.control_block_->expr); } static inline bool is_unary(const expression& expr) { - return details::is_unary_node(expr.control_block_->expr); + return expr.control_block_ && details::is_unary_node(expr.control_block_->expr); } static inline bool is_binary(const expression& expr) { - return details::is_binary_node(expr.control_block_->expr); + return expr.control_block_ && details::is_binary_node(expr.control_block_->expr); } static inline bool is_function(const expression& expr) { - return details::is_function(expr.control_block_->expr); + return expr.control_block_ && details::is_function(expr.control_block_->expr); + } + + static inline bool is_vararg(const expression& expr) + { + return expr.control_block_ && details::is_vararg_node(expr.control_block_->expr); } static inline bool is_null(const expression& expr) { - return details::is_null_node(expr.control_block_->expr); + return expr.control_block_ && details::is_null_node(expr.control_block_->expr); + } + + static inline bool is_assert(const expression& expr) + { + return expr.control_block_ && details::is_assert_node(expr.control_block_->expr); + } + + static inline bool is_sf3ext(const expression& expr) + { + return expr.control_block_ && details::is_sf3ext_node(expr.control_block_->expr); + } + + static inline bool is_sf4ext(const expression& expr) + { + return expr.control_block_ && details::is_sf4ext_node(expr.control_block_->expr); + } + + static inline bool is_type(const expression& expr, const node_types node_type) + { + if (0 == expr.control_block_) + { + return false; + } + + switch (node_type) + { + case e_literal : return is_literal_node(expr); + case e_variable : return is_variable (expr); + case e_string : return is_string (expr); + case e_unary : return is_unary (expr); + case e_binary : return is_binary (expr); + case e_function : return is_function (expr); + case e_null : return is_null (expr); + case e_assert : return is_assert (expr); + case e_sf3ext : return is_sf3ext (expr); + case e_sf4ext : return is_sf4ext (expr); + }; + + return false; + } + + static inline bool match_type_sequence(const expression& expr, const std::vector& type_seq) + { + if ((0 == expr.control_block_) || !is_vararg(expr)) + { + return false; + } + + typedef details::vararg_node > mo_vararg_t; + + mo_vararg_t* vnode = dynamic_cast(expr.control_block_->expr); + + if ( + (0 == vnode) || + type_seq.empty() || + (vnode->size() < type_seq.size()) + ) + { + return false; + } + + for (std::size_t i = 0; i < type_seq.size(); ++i) + { + assert((*vnode)[i]); + + switch(type_seq[i]) + { + case e_literal : { if (details::is_literal_node ((*vnode)[i])) continue; } break; + case e_variable : { if (details::is_variable_node ((*vnode)[i])) continue; } break; + case e_string : { if (details::is_generally_string_node((*vnode)[i])) continue; } break; + case e_unary : { if (details::is_unary_node ((*vnode)[i])) continue; } break; + case e_binary : { if (details::is_binary_node ((*vnode)[i])) continue; } break; + case e_function : { if (details::is_function ((*vnode)[i])) continue; } break; + case e_null : { if (details::is_null_node ((*vnode)[i])) continue; } break; + case e_assert : { if (details::is_assert_node ((*vnode)[i])) continue; } break; + case e_sf3ext : { if (details::is_sf3ext_node ((*vnode)[i])) continue; } break; + case e_sf4ext : { if (details::is_sf4ext_node ((*vnode)[i])) continue; } break; + case e_vararg : break; + } + + return false; + } + + return true; } }; template inline bool is_valid(const expression& expr) { - return !expression_helper::is_null(expr); + return expr.control_block_ && !expression_helper::is_null(expr); } namespace parser_error { enum error_mode { - e_unknown = 0, - e_syntax = 1, - e_token = 2, - e_numeric = 4, - e_symtab = 5, - e_lexer = 6, - e_helper = 7, - e_parser = 8 + e_unknown = 0, + e_syntax = 1, + e_token = 2, + e_numeric = 4, + e_symtab = 5, + e_lexer = 6, + e_synthesis = 7, + e_helper = 8, + e_parser = 9 }; struct type @@ -19414,7 +22077,7 @@ namespace exprtk t.token.type = lexer::token::e_error; t.diagnostic = diagnostic; t.src_location = src_location; - exprtk_debug(("%s\n",diagnostic .c_str())); + exprtk_debug(("%s\n", diagnostic .c_str())); return t; } @@ -19428,7 +22091,7 @@ namespace exprtk t.token = tk; t.diagnostic = diagnostic; t.src_location = src_location; - exprtk_debug(("%s\n",diagnostic .c_str())); + exprtk_debug(("%s\n", diagnostic .c_str())); return t; } @@ -19520,70 +22183,79 @@ namespace exprtk e_level10, e_level11, e_level12, e_level13, e_level14 }; - typedef const T& cref_t; - typedef const T const_t; - typedef ifunction F; - typedef ivararg_function VAF; - typedef igeneric_function GF; - typedef ifunction ifunction_t; - typedef ivararg_function ivararg_function_t; - typedef igeneric_function igeneric_function_t; - typedef details::expression_node expression_node_t; - typedef details::literal_node literal_node_t; - typedef details::unary_node unary_node_t; - typedef details::binary_node binary_node_t; - typedef details::trinary_node trinary_node_t; - typedef details::quaternary_node quaternary_node_t; - typedef details::conditional_node conditional_node_t; - typedef details::cons_conditional_node cons_conditional_node_t; - typedef details::while_loop_node while_loop_node_t; - typedef details::repeat_until_loop_node repeat_until_loop_node_t; - typedef details::for_loop_node for_loop_node_t; - typedef details::while_loop_rtc_node while_loop_rtc_node_t; - typedef details::repeat_until_loop_rtc_node repeat_until_loop_rtc_node_t; - typedef details::for_loop_rtc_node for_loop_rtc_node_t; + typedef const T& cref_t; + typedef const T const_t; + typedef ifunction F; + typedef ivararg_function VAF; + typedef igeneric_function GF; + typedef ifunction ifunction_t; + typedef ivararg_function ivararg_function_t; + typedef igeneric_function igeneric_function_t; + typedef details::expression_node expression_node_t; + typedef details::literal_node literal_node_t; + typedef details::unary_node unary_node_t; + typedef details::binary_node binary_node_t; + typedef details::trinary_node trinary_node_t; + typedef details::quaternary_node quaternary_node_t; + typedef details::conditional_node conditional_node_t; + typedef details::cons_conditional_node cons_conditional_node_t; + typedef details::while_loop_node while_loop_node_t; + typedef details::repeat_until_loop_node repeat_until_loop_node_t; + typedef details::for_loop_node for_loop_node_t; + typedef details::while_loop_rtc_node while_loop_rtc_node_t; + typedef details::repeat_until_loop_rtc_node repeat_until_loop_rtc_node_t; + typedef details::for_loop_rtc_node for_loop_rtc_node_t; #ifndef exprtk_disable_break_continue - typedef details::while_loop_bc_node while_loop_bc_node_t; - typedef details::repeat_until_loop_bc_node repeat_until_loop_bc_node_t; - typedef details::for_loop_bc_node for_loop_bc_node_t; - typedef details::while_loop_bc_rtc_node while_loop_bc_rtc_node_t; - typedef details::repeat_until_loop_bc_rtc_node repeat_until_loop_bc_rtc_node_t; - typedef details::for_loop_bc_rtc_node for_loop_bc_rtc_node_t; + typedef details::while_loop_bc_node while_loop_bc_node_t; + typedef details::repeat_until_loop_bc_node repeat_until_loop_bc_node_t; + typedef details::for_loop_bc_node for_loop_bc_node_t; + typedef details::while_loop_bc_rtc_node while_loop_bc_rtc_node_t; + typedef details::repeat_until_loop_bc_rtc_node repeat_until_loop_bc_rtc_node_t; + typedef details::for_loop_bc_rtc_node for_loop_bc_rtc_node_t; #endif - typedef details::switch_node switch_node_t; - typedef details::variable_node variable_node_t; - typedef details::vector_elem_node vector_elem_node_t; - typedef details::rebasevector_elem_node rebasevector_elem_node_t; - typedef details::rebasevector_celem_node rebasevector_celem_node_t; - typedef details::vector_node vector_node_t; - typedef details::range_pack range_t; + typedef details::switch_node switch_node_t; + typedef details::variable_node variable_node_t; + typedef details::vector_elem_node vector_elem_node_t; + typedef details::vector_celem_node vector_celem_node_t; + typedef details::vector_elem_rtc_node vector_elem_rtc_node_t; + typedef details::vector_celem_rtc_node vector_celem_rtc_node_t; + typedef details::rebasevector_elem_node rebasevector_elem_node_t; + typedef details::rebasevector_celem_node rebasevector_celem_node_t; + typedef details::rebasevector_elem_rtc_node rebasevector_elem_rtc_node_t; + typedef details::rebasevector_celem_rtc_node rebasevector_celem_rtc_node_t; + typedef details::vector_node vector_node_t; + typedef details::vector_size_node vector_size_node_t; + typedef details::range_pack range_t; #ifndef exprtk_disable_string_capabilities - typedef details::stringvar_node stringvar_node_t; - typedef details::string_literal_node string_literal_node_t; - typedef details::string_range_node string_range_node_t; - typedef details::const_string_range_node const_string_range_node_t; - typedef details::generic_string_range_node generic_string_range_node_t; - typedef details::string_concat_node string_concat_node_t; - typedef details::assignment_string_node assignment_string_node_t; - typedef details::assignment_string_range_node assignment_string_range_node_t; - typedef details::conditional_string_node conditional_string_node_t; - typedef details::cons_conditional_str_node cons_conditional_str_node_t; + typedef details::stringvar_node stringvar_node_t; + typedef details::string_literal_node string_literal_node_t; + typedef details::string_range_node string_range_node_t; + typedef details::const_string_range_node const_string_range_node_t; + typedef details::generic_string_range_node generic_string_range_node_t; + typedef details::string_concat_node string_concat_node_t; + typedef details::assignment_string_node assignment_string_node_t; + typedef details::assignment_string_range_node assignment_string_range_node_t; + typedef details::conditional_string_node conditional_string_node_t; + typedef details::cons_conditional_str_node cons_conditional_str_node_t; #endif - typedef details::assignment_node assignment_node_t; - typedef details::assignment_vec_elem_node assignment_vec_elem_node_t; - typedef details::assignment_rebasevec_elem_node assignment_rebasevec_elem_node_t; - typedef details::assignment_rebasevec_celem_node assignment_rebasevec_celem_node_t; - typedef details::assignment_vec_node assignment_vec_node_t; - typedef details::assignment_vecvec_node assignment_vecvec_node_t; - typedef details::conditional_vector_node conditional_vector_node_t; - typedef details::scand_node scand_node_t; - typedef details::scor_node scor_node_t; - typedef lexer::token token_t; - typedef expression_node_t* expression_node_ptr; - typedef expression expression_t; - typedef symbol_table symbol_table_t; - typedef typename expression::symtab_list_t symbol_table_list_t; - typedef details::vector_holder* vector_holder_ptr; + typedef details::assignment_node assignment_node_t; + typedef details::assignment_vec_elem_node assignment_vec_elem_node_t; + typedef details::assignment_vec_elem_rtc_node assignment_vec_elem_rtc_node_t; + typedef details::assignment_rebasevec_elem_node assignment_rebasevec_elem_node_t; + typedef details::assignment_rebasevec_elem_rtc_node assignment_rebasevec_elem_rtc_node_t; + typedef details::assignment_rebasevec_celem_node assignment_rebasevec_celem_node_t; + typedef details::assignment_vec_node assignment_vec_node_t; + typedef details::assignment_vecvec_node assignment_vecvec_node_t; + typedef details::conditional_vector_node conditional_vector_node_t; + typedef details::scand_node scand_node_t; + typedef details::scor_node scor_node_t; + typedef lexer::token token_t; + typedef expression_node_t* expression_node_ptr; + typedef expression expression_t; + typedef symbol_table symbol_table_t; + typedef typename expression::symtab_list_t symbol_table_list_t; + typedef details::vector_holder vector_holder_t; + typedef vector_holder_t* vector_holder_ptr; typedef typename details::functor_t functor_t; typedef typename functor_t::qfunc_t quaternary_functor_t; @@ -19636,6 +22308,7 @@ namespace exprtk enum element_type { e_none , + e_literal , e_variable, e_vector , e_vecelem , @@ -19643,6 +22316,7 @@ namespace exprtk }; typedef details::vector_holder vector_holder_t; + typedef literal_node_t* literal_node_ptr; typedef variable_node_t* variable_node_ptr; typedef vector_holder_t* vector_holder_ptr; typedef expression_node_t* expression_node_ptr; @@ -19657,8 +22331,8 @@ namespace exprtk , depth(std::numeric_limits::max()) , ref_count(0) , ip_index (0) - , type (e_none) - , active(false) + , type (e_none) + , active (false) , data (0) , var_node (0) , vec_node (0) @@ -19842,6 +22516,10 @@ namespace exprtk switch (se.type) { + case scope_element::e_literal : delete reinterpret_cast(se.data); + delete se.var_node; + break; + case scope_element::e_variable : delete reinterpret_cast(se.data); delete se.var_node; break; @@ -19906,6 +22584,25 @@ namespace exprtk return expression_node_ptr(0); } + inline std::string get_vector_name(const T* data) + { + for (std::size_t i = 0; i < element_.size(); ++i) + { + scope_element& se = element_[i]; + + if ( + se.active && + se.vec_node && + (se.vec_node->data() == data) + ) + { + return se.name; + } + } + + return "neo-vector"; + } + private: scope_element_manager(const scope_element_manager&) exprtk_delete; @@ -20092,16 +22789,17 @@ namespace exprtk if (++parser_.state_.stack_depth > parser_.settings_.max_stack_depth_) { limit_exceeded_ = true; - parser_.set_error( - make_error(parser_error::e_parser, - "ERR000 - Current stack depth " + details::to_str(parser_.state_.stack_depth) + - " exceeds maximum allowed stack depth of " + details::to_str(parser_.settings_.max_stack_depth_), - exprtk_error_location)); + parser_.set_error(make_error( + parser_error::e_parser, + "ERR000 - Current stack depth " + details::to_str(parser_.state_.stack_depth) + + " exceeds maximum allowed stack depth of " + details::to_str(parser_.settings_.max_stack_depth_), + exprtk_error_location)); } } ~stack_limit_handler() { + assert(parser_.state_.stack_depth > 0); parser_.state_.stack_depth--; } @@ -20211,22 +22909,23 @@ namespace exprtk inline variable_context get_variable_context(const std::string& variable_name) const { variable_context result; - if (!valid_symbol(variable_name)) - return result; - for (std::size_t i = 0; i < symtab_list_.size(); ++i) + if (valid_symbol(variable_name)) { - if (!symtab_list_[i].valid()) + for (std::size_t i = 0; i < symtab_list_.size(); ++i) { - continue; - } + if (!symtab_list_[i].valid()) + { + continue; + } - result.variable = local_data(i) - .variable_store.get(variable_name); - if (result.variable) - { - result.symbol_table = &symtab_list_[i]; - break; + result.variable = local_data(i) + .variable_store.get(variable_name); + if (result.variable) + { + result.symbol_table = &symtab_list_[i]; + break; + } } } @@ -20461,12 +23160,16 @@ namespace exprtk for (std::size_t i = 0; i < symtab_list_.size(); ++i) { if (!symtab_list_[i].valid()) + { continue; - else - result = - local_data(i).vector_store.get(vector_name); + } - if (result) break; + result = local_data(i).vector_store.get(vector_name); + + if (result) + { + break; + } } return result; @@ -20480,9 +23183,14 @@ namespace exprtk for (std::size_t i = 0; i < symtab_list_.size(); ++i) { if (!symtab_list_[i].valid()) + { continue; - else if (local_data(i).variable_store.is_constant(symbol_name)) + } + + if (local_data(i).variable_store.is_constant(symbol_name)) + { return true; + } } return false; @@ -20513,9 +23221,14 @@ namespace exprtk for (std::size_t i = 0; i < symtab_list_.size(); ++i) { if (!symtab_list_[i].valid()) + { continue; - else if (symtab_list_[i].symbol_exists(symbol)) + } + + if (symtab_list_[i].symbol_exists(symbol)) + { return true; + } } return false; @@ -20675,6 +23388,7 @@ namespace exprtk { parsing_return_stmt = false; parsing_break_stmt = false; + parsing_assert_stmt = false; return_stmt_present = false; side_effect_present = false; scope_depth = 0; @@ -20692,12 +23406,13 @@ namespace exprtk { side_effect_present = true; - exprtk_debug(("activate_side_effect() - caller: %s\n",source.c_str())); + exprtk_debug(("activate_side_effect() - caller: %s\n", source.c_str())); } } bool parsing_return_stmt; bool parsing_break_stmt; + bool parsing_assert_stmt; bool return_stmt_present; bool side_effect_present; bool type_check_enabled; @@ -20730,7 +23445,8 @@ namespace exprtk : mode(m) {} - virtual ~unknown_symbol_resolver() {} + virtual ~unknown_symbol_resolver() + {} virtual bool process(const std::string& /*unknown_symbol*/, usr_symbol_type& st, @@ -20806,11 +23522,14 @@ namespace exprtk details::case_normalise(symbol_name_list_[i].first); } - std::sort(symbol_name_list_.begin(),symbol_name_list_.end()); + std::sort(symbol_name_list_.begin(), symbol_name_list_.end()); - std::unique_copy(symbol_name_list_.begin(), - symbol_name_list_.end (), - std::back_inserter(symbols_list)); + std::unique_copy + ( + symbol_name_list_.begin(), + symbol_name_list_.end (), + std::back_inserter(symbols_list) + ); return symbols_list.size(); } @@ -20831,9 +23550,12 @@ namespace exprtk std::sort(assignment_name_list_.begin(),assignment_name_list_.end()); - std::unique_copy(assignment_name_list_.begin(), - assignment_name_list_.end (), - std::back_inserter(assignment_list)); + std::unique_copy + ( + assignment_name_list_.begin(), + assignment_name_list_.end (), + std::back_inserter(assignment_list) + ); return assignment_list.size(); } @@ -21020,7 +23742,7 @@ namespace exprtk e_ineq_gte , e_ineq_gt }; - static const std::size_t compile_all_opts = + static const std::size_t default_compile_all_opts = e_replacer + e_joiner + e_numeric_check + @@ -21029,9 +23751,10 @@ namespace exprtk e_commutative_check + e_strength_reduction; - settings_store(const std::size_t compile_options = compile_all_opts) + settings_store(const std::size_t compile_options = default_compile_all_opts) : max_stack_depth_(400) , max_node_depth_(10000) + , max_local_vector_size_(2000000000) { load_compile_options(compile_options); } @@ -21078,12 +23801,24 @@ namespace exprtk return (*this); } + settings_store& enable_commutative_check() + { + enable_commutative_check_ = true; + return (*this); + } + + settings_store& enable_strength_reduction() + { + enable_strength_reduction_ = true; + return (*this); + } + settings_store& disable_all_base_functions() { std::copy(details::base_function_list, details::base_function_list + details::base_function_list_size, std::insert_iterator - (disabled_func_set_, disabled_func_set_.begin())); + (disabled_func_set_, disabled_func_set_.begin())); return (*this); } @@ -21092,7 +23827,7 @@ namespace exprtk std::copy(details::cntrl_struct_list, details::cntrl_struct_list + details::cntrl_struct_list_size, std::insert_iterator - (disabled_ctrl_set_, disabled_ctrl_set_.begin())); + (disabled_ctrl_set_, disabled_ctrl_set_.begin())); return (*this); } @@ -21110,7 +23845,7 @@ namespace exprtk std::copy(details::arithmetic_ops_list, details::arithmetic_ops_list + details::arithmetic_ops_list_size, std::insert_iterator - (disabled_arithmetic_set_, disabled_arithmetic_set_.begin())); + (disabled_arithmetic_set_, disabled_arithmetic_set_.begin())); return (*this); } @@ -21119,7 +23854,7 @@ namespace exprtk std::copy(details::assignment_ops_list, details::assignment_ops_list + details::assignment_ops_list_size, std::insert_iterator - (disabled_assignment_set_, disabled_assignment_set_.begin())); + (disabled_assignment_set_, disabled_assignment_set_.begin())); return (*this); } @@ -21128,7 +23863,7 @@ namespace exprtk std::copy(details::inequality_ops_list, details::inequality_ops_list + details::inequality_ops_list_size, std::insert_iterator - (disabled_inequality_set_, disabled_inequality_set_.begin())); + (disabled_inequality_set_, disabled_inequality_set_.begin())); return (*this); } @@ -21138,6 +23873,18 @@ namespace exprtk return (*this); } + settings_store& disable_commutative_check() + { + enable_commutative_check_ = false; + return (*this); + } + + settings_store& disable_strength_reduction() + { + enable_strength_reduction_ = false; + return (*this); + } + bool replacer_enabled () const { return enable_replacer_; } bool commutative_check_enabled () const { return enable_commutative_check_; } bool joiner_enabled () const { return enable_joiner_; } @@ -21263,7 +24010,7 @@ namespace exprtk .find(inequality_opr_to_string(inequality)); } - settings_store& disable_base_function(settings_base_funcs bf) + settings_store& disable_base_function(const settings_base_funcs bf) { if ( (e_bf_unknown != bf) && @@ -21276,7 +24023,7 @@ namespace exprtk return (*this); } - settings_store& disable_control_structure(settings_control_structs ctrl_struct) + settings_store& disable_control_structure(const settings_control_structs ctrl_struct) { if ( (e_ctrl_unknown != ctrl_struct) && @@ -21289,7 +24036,7 @@ namespace exprtk return (*this); } - settings_store& disable_logic_operation(settings_logic_opr logic) + settings_store& disable_logic_operation(const settings_logic_opr logic) { if ( (e_logic_unknown != logic) && @@ -21302,7 +24049,7 @@ namespace exprtk return (*this); } - settings_store& disable_arithmetic_operation(settings_arithmetic_opr arithmetic) + settings_store& disable_arithmetic_operation(const settings_arithmetic_opr arithmetic) { if ( (e_arith_unknown != arithmetic) && @@ -21315,7 +24062,7 @@ namespace exprtk return (*this); } - settings_store& disable_assignment_operation(settings_assignment_opr assignment) + settings_store& disable_assignment_operation(const settings_assignment_opr assignment) { if ( (e_assign_unknown != assignment) && @@ -21328,7 +24075,7 @@ namespace exprtk return (*this); } - settings_store& disable_inequality_operation(settings_inequality_opr inequality) + settings_store& disable_inequality_operation(const settings_inequality_opr inequality) { if ( (e_ineq_unknown != inequality) && @@ -21341,7 +24088,7 @@ namespace exprtk return (*this); } - settings_store& enable_base_function(settings_base_funcs bf) + settings_store& enable_base_function(const settings_base_funcs bf) { if ( (e_bf_unknown != bf) && @@ -21359,7 +24106,7 @@ namespace exprtk return (*this); } - settings_store& enable_control_structure(settings_control_structs ctrl_struct) + settings_store& enable_control_structure(const settings_control_structs ctrl_struct) { if ( (e_ctrl_unknown != ctrl_struct) && @@ -21377,7 +24124,7 @@ namespace exprtk return (*this); } - settings_store& enable_logic_operation(settings_logic_opr logic) + settings_store& enable_logic_operation(const settings_logic_opr logic) { if ( (e_logic_unknown != logic) && @@ -21395,7 +24142,7 @@ namespace exprtk return (*this); } - settings_store& enable_arithmetic_operation(settings_arithmetic_opr arithmetic) + settings_store& enable_arithmetic_operation(const settings_arithmetic_opr arithmetic) { if ( (e_arith_unknown != arithmetic) && @@ -21413,7 +24160,7 @@ namespace exprtk return (*this); } - settings_store& enable_assignment_operation(settings_assignment_opr assignment) + settings_store& enable_assignment_operation(const settings_assignment_opr assignment) { if ( (e_assign_unknown != assignment) && @@ -21431,7 +24178,7 @@ namespace exprtk return (*this); } - settings_store& enable_inequality_operation(settings_inequality_opr inequality) + settings_store& enable_inequality_operation(const settings_inequality_opr inequality) { if ( (e_ineq_unknown != inequality) && @@ -21459,6 +24206,26 @@ namespace exprtk max_node_depth_ = max_node_depth; } + void set_max_local_vector_size(const std::size_t max_local_vector_size) + { + max_local_vector_size_ = max_local_vector_size; + } + + std::size_t max_stack_depth() const + { + return max_stack_depth_; + } + + std::size_t max_node_depth() const + { + return max_node_depth_; + } + + std::size_t max_local_vector_size() const + { + return max_local_vector_size_; + } + private: void load_compile_options(const std::size_t compile_options) @@ -21501,6 +24268,7 @@ namespace exprtk case details::e_mul : return "*"; case details::e_div : return "/"; case details::e_mod : return "%"; + case details::e_pow : return "^"; default : return "" ; } } @@ -21559,13 +24327,14 @@ namespace exprtk std::size_t max_stack_depth_; std::size_t max_node_depth_; + std::size_t max_local_vector_size_; friend class parser; }; typedef settings_store settings_t; - parser(const settings_t& settings = settings_t()) + explicit parser(const settings_t& settings = settings_t()) : settings_(settings) , resolve_unknown_symbol_(false) , results_context_(0) @@ -21581,6 +24350,9 @@ namespace exprtk , operator_joiner_2_(2) , operator_joiner_3_(3) , loop_runtime_check_(0) + , vector_access_runtime_check_(0) + , compilation_check_ptr_(0) + , assert_check_(0) { init_precompilation(); @@ -21593,15 +24365,16 @@ namespace exprtk expression_generator_.init_synthesize_map(); expression_generator_.set_parser(*this); - expression_generator_.set_uom(unary_op_map_); - expression_generator_.set_bom(binary_op_map_); + expression_generator_.set_uom (unary_op_map_ ); + expression_generator_.set_bom (binary_op_map_ ); expression_generator_.set_ibom(inv_binary_op_map_); - expression_generator_.set_sf3m(sf3_map_); - expression_generator_.set_sf4m(sf4_map_); + expression_generator_.set_sf3m(sf3_map_ ); + expression_generator_.set_sf4m(sf4_map_ ); expression_generator_.set_strength_reduction_state(settings_.strength_reduction_enabled()); } - ~parser() {} + ~parser() + {} inline void init_precompilation() { @@ -21669,11 +24442,15 @@ namespace exprtk inline bool compile(const std::string& expression_string, expression& expr) { - state_ .reset(); - error_list_ .clear(); - brkcnt_list_ .clear(); - synthesis_error_.clear(); - sem_ .cleanup(); + state_ .reset(); + error_list_ .clear(); + brkcnt_list_ .clear(); + synthesis_error_ .clear(); + immutable_memory_map_.reset(); + immutable_symtok_map_.clear(); + current_state_stack_ .clear(); + assert_ids_ .clear(); + sem_ .cleanup(); return_cleanup(); @@ -21681,10 +24458,10 @@ namespace exprtk if (expression_string.empty()) { - set_error( - make_error(parser_error::e_syntax, - "ERR001 - Empty expression!", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + "ERR001 - Empty expression!", + exprtk_error_location)); return false; } @@ -21697,19 +24474,31 @@ namespace exprtk if (lexer().empty()) { - set_error( - make_error(parser_error::e_syntax, - "ERR002 - Empty expression!", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + "ERR002 - Empty expression!", + exprtk_error_location)); return false; } + if (halt_compilation_check()) + { + exprtk_debug(("halt_compilation_check() - compile checkpoint 0\n")); + return false; + } + if (!run_assemblies()) { return false; } + if (halt_compilation_check()) + { + exprtk_debug(("halt_compilation_check() - compile checkpoint 1\n")); + return false; + } + symtab_store_.symtab_list_ = expr.get_symbol_table_list(); dec_.clear(); @@ -21743,11 +24532,11 @@ namespace exprtk { if (error_list_.empty()) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR003 - Invalid expression encountered", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR003 - Invalid expression encountered", + exprtk_error_location)); } if ((0 != e) && branch_deletable(e)) @@ -21799,11 +24588,11 @@ namespace exprtk default : diagnostic += "Unknown compiler error"; } - set_error( - make_error(parser_error::e_lexer, - lexer()[i], - diagnostic + ": " + lexer()[i].value, - exprtk_error_location)); + set_error(make_error( + parser_error::e_lexer, + lexer()[i], + diagnostic + ": " + lexer()[i].value, + exprtk_error_location)); } } } @@ -21842,11 +24631,11 @@ namespace exprtk if (0 != (bracket_checker_ptr = dynamic_cast(helper_assembly_.error_token_scanner))) { - set_error( - make_error(parser_error::e_token, - bracket_checker_ptr->error_token(), - "ERR005 - Mismatched brackets: '" + bracket_checker_ptr->error_token().value + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_token, + bracket_checker_ptr->error_token(), + "ERR005 - Mismatched brackets: '" + bracket_checker_ptr->error_token().value + "'", + exprtk_error_location)); } else if (0 != (numeric_checker_ptr = dynamic_cast*>(helper_assembly_.error_token_scanner))) { @@ -21854,11 +24643,11 @@ namespace exprtk { lexer::token error_token = lexer()[numeric_checker_ptr->error_index(i)]; - set_error( - make_error(parser_error::e_token, - error_token, - "ERR006 - Invalid numeric token: '" + error_token.value + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_token, + error_token, + "ERR006 - Invalid numeric token: '" + error_token.value + "'", + exprtk_error_location)); } if (numeric_checker_ptr->error_count()) @@ -21872,13 +24661,13 @@ namespace exprtk { std::pair error_token = sequence_validator_ptr->error(i); - set_error( - make_error(parser_error::e_token, - error_token.first, - "ERR007 - Invalid token sequence: '" + - error_token.first.value + "' and '" + - error_token.second.value + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_token, + error_token.first, + "ERR007 - Invalid token sequence: '" + + error_token.first.value + "' and '" + + error_token.second.value + "'", + exprtk_error_location)); } if (sequence_validator_ptr->error_count()) @@ -21892,13 +24681,13 @@ namespace exprtk { std::pair error_token = sequence_validator3_ptr->error(i); - set_error( - make_error(parser_error::e_token, - error_token.first, - "ERR008 - Invalid token sequence: '" + - error_token.first.value + "' and '" + - error_token.second.value + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_token, + error_token.first, + "ERR008 - Invalid token sequence: '" + + error_token.first.value + "' and '" + + error_token.second.value + "'", + exprtk_error_location)); } if (sequence_validator3_ptr->error_count()) @@ -21923,9 +24712,11 @@ namespace exprtk inline parser_error::type get_error(const std::size_t& index) const { if (index < error_list_.size()) + { return error_list_[index]; - else - throw std::invalid_argument("parser::get_error() - Invalid error index specificed"); + } + + throw std::invalid_argument("parser::get_error() - Invalid error index specified"); } inline std::string error() const @@ -21994,11 +24785,41 @@ namespace exprtk loop_runtime_check_ = &lrtchk; } + inline void register_vector_access_runtime_check(vector_access_runtime_check& vartchk) + { + vector_access_runtime_check_ = &vartchk; + } + + inline void register_compilation_timeout_check(compilation_check& compchk) + { + compilation_check_ptr_ = &compchk; + } + + inline void register_assert_check(assert_check& assrt_chck) + { + assert_check_ = &assrt_chck; + } + inline void clear_loop_runtime_check() { loop_runtime_check_ = loop_runtime_check_ptr(0); } + inline void clear_vector_access_runtime_check() + { + vector_access_runtime_check_ = vector_access_runtime_check_ptr(0); + } + + inline void clear_compilation_timeout_check() + { + compilation_check_ptr_ = compilation_check_ptr(0); + } + + inline void clear_assert_check() + { + assert_check_ = assert_check_ptr(0); + } + private: inline bool valid_base_operation(const std::string& symbol) const @@ -22102,11 +24923,11 @@ namespace exprtk { if (error_list_.empty()) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR009 - Invalid expression encountered", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR009 - Invalid expression encountered", + exprtk_error_location)); } return error_node(); @@ -22132,9 +24953,7 @@ namespace exprtk exprtk_debug(("-------------------------------------------------\n")); } - if (lexer().finished()) - break; - else if (token_is(token_t::e_eof,prsrhlpr_t::e_hold)) + if (token_is(token_t::e_eof,prsrhlpr_t::e_hold)) { if (lexer().finished()) break; @@ -22158,13 +24977,17 @@ namespace exprtk return result; } - std::string construct_subexpr(lexer::token& begin_token, lexer::token& end_token) + std::string construct_subexpr(lexer::token& begin_token, + lexer::token& end_token, + const bool cleanup_whitespace = true) { std::string result = lexer().substr(begin_token.position,end_token.position); - - for (std::size_t i = 0; i < result.size(); ++i) + if (cleanup_whitespace) { - if (details::is_whitespace(result[i])) result[i] = ' '; + for (std::size_t i = 0; i < result.size(); ++i) + { + if (details::is_whitespace(result[i])) result[i] = ' '; + } } return result; @@ -22176,11 +24999,13 @@ namespace exprtk { inline void set(const precedence_level& l, const precedence_level& r, - const details::operator_type& o) + const details::operator_type& o, + const token_t tkn = token_t()) { - left = l; - right = r; + left = l; + right = r; operation = o; + token = tkn; } inline void reset() @@ -22193,10 +25018,58 @@ namespace exprtk precedence_level left; precedence_level right; details::operator_type operation; + token_t token; }; + inline void push_current_state(const state_t current_state) + { + current_state_stack_.push_back(current_state); + } + + inline void pop_current_state() + { + if (!current_state_stack_.empty()) + { + current_state_stack_.pop_back(); + } + } + + inline state_t current_state() const + { + return (!current_state_stack_.empty()) ? + current_state_stack_.back() : + state_t(); + } + + inline bool halt_compilation_check() + { + compilation_check::compilation_context context; + + if (compilation_check_ptr_ && !compilation_check_ptr_->continue_compilation(context)) + { + const std::string error_message = + !context.error_message.empty() ? " Details: " + context.error_message : ""; + + set_error(make_error( + parser_error::e_parser, + token_t(), + "ERR010 - Internal compilation check failed." + error_message, + exprtk_error_location)); + + return true; + } + + return false; + } + inline expression_node_ptr parse_expression(precedence_level precedence = e_level00) { + if (halt_compilation_check()) + { + exprtk_debug(("halt_compilation_check() - parse_expression checkpoint 2\n")); + return error_node(); + } + stack_limit_handler slh(*this); if (!slh) @@ -22221,110 +25094,111 @@ namespace exprtk switch (current_token().type) { - case token_t::e_assign : current_state.set(e_level00, e_level00, details::e_assign); break; - case token_t::e_addass : current_state.set(e_level00, e_level00, details::e_addass); break; - case token_t::e_subass : current_state.set(e_level00, e_level00, details::e_subass); break; - case token_t::e_mulass : current_state.set(e_level00, e_level00, details::e_mulass); break; - case token_t::e_divass : current_state.set(e_level00, e_level00, details::e_divass); break; - case token_t::e_modass : current_state.set(e_level00, e_level00, details::e_modass); break; - case token_t::e_swap : current_state.set(e_level00, e_level00, details::e_swap ); break; - case token_t::e_lt : current_state.set(e_level05, e_level06, details::e_lt ); break; - case token_t::e_lte : current_state.set(e_level05, e_level06, details::e_lte ); break; - case token_t::e_eq : current_state.set(e_level05, e_level06, details::e_eq ); break; - case token_t::e_ne : current_state.set(e_level05, e_level06, details::e_ne ); break; - case token_t::e_gte : current_state.set(e_level05, e_level06, details::e_gte ); break; - case token_t::e_gt : current_state.set(e_level05, e_level06, details::e_gt ); break; - case token_t::e_add : current_state.set(e_level07, e_level08, details::e_add ); break; - case token_t::e_sub : current_state.set(e_level07, e_level08, details::e_sub ); break; - case token_t::e_div : current_state.set(e_level10, e_level11, details::e_div ); break; - case token_t::e_mul : current_state.set(e_level10, e_level11, details::e_mul ); break; - case token_t::e_mod : current_state.set(e_level10, e_level11, details::e_mod ); break; - case token_t::e_pow : current_state.set(e_level12, e_level12, details::e_pow ); break; - default : if (token_t::e_symbol == current_token().type) - { - static const std::string s_and = "and" ; - static const std::string s_nand = "nand" ; - static const std::string s_or = "or" ; - static const std::string s_nor = "nor" ; - static const std::string s_xor = "xor" ; - static const std::string s_xnor = "xnor" ; - static const std::string s_in = "in" ; - static const std::string s_like = "like" ; - static const std::string s_ilike = "ilike"; - static const std::string s_and1 = "&" ; - static const std::string s_or1 = "|" ; - static const std::string s_not = "not" ; + case token_t::e_assign : current_state.set(e_level00, e_level00, details::e_assign, current_token()); break; + case token_t::e_addass : current_state.set(e_level00, e_level00, details::e_addass, current_token()); break; + case token_t::e_subass : current_state.set(e_level00, e_level00, details::e_subass, current_token()); break; + case token_t::e_mulass : current_state.set(e_level00, e_level00, details::e_mulass, current_token()); break; + case token_t::e_divass : current_state.set(e_level00, e_level00, details::e_divass, current_token()); break; + case token_t::e_modass : current_state.set(e_level00, e_level00, details::e_modass, current_token()); break; + case token_t::e_swap : current_state.set(e_level00, e_level00, details::e_swap , current_token()); break; + case token_t::e_lt : current_state.set(e_level05, e_level06, details::e_lt , current_token()); break; + case token_t::e_lte : current_state.set(e_level05, e_level06, details::e_lte , current_token()); break; + case token_t::e_eq : current_state.set(e_level05, e_level06, details::e_eq , current_token()); break; + case token_t::e_ne : current_state.set(e_level05, e_level06, details::e_ne , current_token()); break; + case token_t::e_gte : current_state.set(e_level05, e_level06, details::e_gte , current_token()); break; + case token_t::e_gt : current_state.set(e_level05, e_level06, details::e_gt , current_token()); break; + case token_t::e_add : current_state.set(e_level07, e_level08, details::e_add , current_token()); break; + case token_t::e_sub : current_state.set(e_level07, e_level08, details::e_sub , current_token()); break; + case token_t::e_div : current_state.set(e_level10, e_level11, details::e_div , current_token()); break; + case token_t::e_mul : current_state.set(e_level10, e_level11, details::e_mul , current_token()); break; + case token_t::e_mod : current_state.set(e_level10, e_level11, details::e_mod , current_token()); break; + case token_t::e_pow : current_state.set(e_level12, e_level12, details::e_pow , current_token()); break; + default : + if (token_t::e_symbol == current_token().type) + { + static const std::string s_and = "and" ; + static const std::string s_nand = "nand" ; + static const std::string s_or = "or" ; + static const std::string s_nor = "nor" ; + static const std::string s_xor = "xor" ; + static const std::string s_xnor = "xnor" ; + static const std::string s_in = "in" ; + static const std::string s_like = "like" ; + static const std::string s_ilike = "ilike"; + static const std::string s_and1 = "&" ; + static const std::string s_or1 = "|" ; + static const std::string s_not = "not" ; - if (details::imatch(current_token().value,s_and)) - { - current_state.set(e_level03, e_level04, details::e_and); - break; - } - else if (details::imatch(current_token().value,s_and1)) - { - #ifndef exprtk_disable_sc_andor - current_state.set(e_level03, e_level04, details::e_scand); - #else - current_state.set(e_level03, e_level04, details::e_and); - #endif - break; - } - else if (details::imatch(current_token().value,s_nand)) - { - current_state.set(e_level03, e_level04, details::e_nand); - break; - } - else if (details::imatch(current_token().value,s_or)) - { - current_state.set(e_level01, e_level02, details::e_or); - break; - } - else if (details::imatch(current_token().value,s_or1)) - { - #ifndef exprtk_disable_sc_andor - current_state.set(e_level01, e_level02, details::e_scor); - #else - current_state.set(e_level01, e_level02, details::e_or); - #endif - break; - } - else if (details::imatch(current_token().value,s_nor)) - { - current_state.set(e_level01, e_level02, details::e_nor); - break; - } - else if (details::imatch(current_token().value,s_xor)) - { - current_state.set(e_level01, e_level02, details::e_xor); - break; - } - else if (details::imatch(current_token().value,s_xnor)) - { - current_state.set(e_level01, e_level02, details::e_xnor); - break; - } - else if (details::imatch(current_token().value,s_in)) - { - current_state.set(e_level04, e_level04, details::e_in); - break; - } - else if (details::imatch(current_token().value,s_like)) - { - current_state.set(e_level04, e_level04, details::e_like); - break; - } - else if (details::imatch(current_token().value,s_ilike)) - { - current_state.set(e_level04, e_level04, details::e_ilike); - break; - } - else if (details::imatch(current_token().value,s_not)) - { - break; - } - } + if (details::imatch(current_token().value,s_and)) + { + current_state.set(e_level03, e_level04, details::e_and, current_token()); + break; + } + else if (details::imatch(current_token().value,s_and1)) + { + #ifndef exprtk_disable_sc_andor + current_state.set(e_level03, e_level04, details::e_scand, current_token()); + #else + current_state.set(e_level03, e_level04, details::e_and, current_token()); + #endif + break; + } + else if (details::imatch(current_token().value,s_nand)) + { + current_state.set(e_level03, e_level04, details::e_nand, current_token()); + break; + } + else if (details::imatch(current_token().value,s_or)) + { + current_state.set(e_level01, e_level02, details::e_or, current_token()); + break; + } + else if (details::imatch(current_token().value,s_or1)) + { + #ifndef exprtk_disable_sc_andor + current_state.set(e_level01, e_level02, details::e_scor, current_token()); + #else + current_state.set(e_level01, e_level02, details::e_or, current_token()); + #endif + break; + } + else if (details::imatch(current_token().value,s_nor)) + { + current_state.set(e_level01, e_level02, details::e_nor, current_token()); + break; + } + else if (details::imatch(current_token().value,s_xor)) + { + current_state.set(e_level01, e_level02, details::e_xor, current_token()); + break; + } + else if (details::imatch(current_token().value,s_xnor)) + { + current_state.set(e_level01, e_level02, details::e_xnor, current_token()); + break; + } + else if (details::imatch(current_token().value,s_in)) + { + current_state.set(e_level04, e_level04, details::e_in, current_token()); + break; + } + else if (details::imatch(current_token().value,s_like)) + { + current_state.set(e_level04, e_level04, details::e_like, current_token()); + break; + } + else if (details::imatch(current_token().value,s_ilike)) + { + current_state.set(e_level04, e_level04, details::e_ilike, current_token()); + break; + } + else if (details::imatch(current_token().value,s_not)) + { + break; + } + } - break_loop = true; + break_loop = true; } if (break_loop) @@ -22344,49 +25218,49 @@ namespace exprtk if (is_invalid_logic_operation(current_state.operation)) { - free_node(node_allocator_,expression); + free_node(node_allocator_, expression); - set_error( - make_error(parser_error::e_syntax, - prev_token, - "ERR010 - Invalid or disabled logic operation '" + details::to_str(current_state.operation) + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + prev_token, + "ERR011 - Invalid or disabled logic operation '" + details::to_str(current_state.operation) + "'", + exprtk_error_location)); return error_node(); } else if (is_invalid_arithmetic_operation(current_state.operation)) { - free_node(node_allocator_,expression); + free_node(node_allocator_, expression); - set_error( - make_error(parser_error::e_syntax, - prev_token, - "ERR011 - Invalid or disabled arithmetic operation '" + details::to_str(current_state.operation) + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + prev_token, + "ERR012 - Invalid or disabled arithmetic operation '" + details::to_str(current_state.operation) + "'", + exprtk_error_location)); return error_node(); } else if (is_invalid_inequality_operation(current_state.operation)) { - free_node(node_allocator_,expression); + free_node(node_allocator_, expression); - set_error( - make_error(parser_error::e_syntax, - prev_token, - "ERR012 - Invalid inequality operation '" + details::to_str(current_state.operation) + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + prev_token, + "ERR013 - Invalid inequality operation '" + details::to_str(current_state.operation) + "'", + exprtk_error_location)); return error_node(); } else if (is_invalid_assignment_operation(current_state.operation)) { - free_node(node_allocator_,expression); + free_node(node_allocator_, expression); - set_error( - make_error(parser_error::e_syntax, - prev_token, - "ERR013 - Invalid or disabled assignment operation '" + details::to_str(current_state.operation) + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + prev_token, + "ERR014 - Invalid or disabled assignment operation '" + details::to_str(current_state.operation) + "'", + exprtk_error_location)); return error_node(); } @@ -22401,34 +25275,38 @@ namespace exprtk free_node(node_allocator_, expression ); free_node(node_allocator_, right_branch); - set_error( - make_error(parser_error::e_syntax, - prev_token, - "ERR014 - Return statements cannot be part of sub-expressions", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + prev_token, + "ERR015 - Return statements cannot be part of sub-expressions", + exprtk_error_location)); return error_node(); } + push_current_state(current_state); + new_expression = expression_generator_ ( current_state.operation, expression, right_branch ); + + pop_current_state(); } if (0 == new_expression) { if (error_list_.empty()) { - set_error( - make_error(parser_error::e_syntax, - prev_token, - !synthesis_error_.empty() ? - synthesis_error_ : - "ERR015 - General parsing error at token: '" + prev_token.value + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + prev_token, + !synthesis_error_.empty() ? + synthesis_error_ : + "ERR016 - General parsing error at token: '" + prev_token.value + "'", + exprtk_error_location)); } free_node(node_allocator_, expression ); @@ -22454,14 +25332,14 @@ namespace exprtk if ((0 != expression) && (expression->node_depth() > settings_.max_node_depth_)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR016 - Expression depth of " + details::to_str(static_cast(expression->node_depth())) + - " exceeds maximum allowed expression depth of " + details::to_str(static_cast(settings_.max_node_depth_)), - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR017 - Expression depth of " + details::to_str(static_cast(expression->node_depth())) + + " exceeds maximum allowed expression depth of " + details::to_str(static_cast(settings_.max_node_depth_)), + exprtk_error_location)); - free_node(node_allocator_,expression); + free_node(node_allocator_, expression); return error_node(); } @@ -22479,7 +25357,7 @@ namespace exprtk { expression_node_ptr un_r = n->branch(0); n->release(); - free_node(node_allocator_,node); + free_node(node_allocator_, node); node = un_r; return true; @@ -22501,20 +25379,20 @@ namespace exprtk (0 != (return_node = sem_ .get_variable(v))) ) { - free_node(node_allocator_,node); + free_node(node_allocator_, node); node = return_node; return true; } else { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR017 - Failed to find variable node in symbol table", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR018 - Failed to find variable node in symbol table", + exprtk_error_location)); - free_node(node_allocator_,node); + free_node(node_allocator_, node); return false; } @@ -22610,6 +25488,7 @@ namespace exprtk { for (std::size_t i = 0; i < deq_.size(); ++i) { + exprtk_debug(("~scoped_deq_delete() - deleting node: %p\n", reinterpret_cast(deq_[i]))); free_node(parser_.node_allocator_,deq_[i]); } @@ -22644,6 +25523,7 @@ namespace exprtk { for (std::size_t i = 0; i < vec_.size(); ++i) { + exprtk_debug(("~scoped_vec_delete() - deleting node: %p\n", reinterpret_cast(vec_[i]))); free_node(parser_.node_allocator_,vec_[i]); } @@ -22651,6 +25531,11 @@ namespace exprtk } } + ptr_t operator[](const std::size_t index) + { + return vec_[index]; + } + bool delete_ptr; parser& parser_; std::vector& vec_; @@ -22732,11 +25617,11 @@ namespace exprtk case 19 : func_node = parse_function_call<19>(function,function_name); break; case 20 : func_node = parse_function_call<20>(function,function_name); break; default : { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR018 - Invalid number of parameters for function: '" + function_name + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR019 - Invalid number of parameters for function: '" + function_name + "'", + exprtk_error_location)); return error_node(); } @@ -22746,11 +25631,11 @@ namespace exprtk return func_node; else { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR019 - Failed to generate call to function: '" + function_name + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR020 - Failed to generate call to function: '" + function_name + "'", + exprtk_error_location)); return error_node(); } @@ -22765,11 +25650,11 @@ namespace exprtk #endif if (0 == NumberofParameters) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR020 - Expecting ifunction '" + function_name + "' to have non-zero parameter count", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR021 - Expecting ifunction '" + function_name + "' to have non-zero parameter count", + exprtk_error_location)); return error_node(); } @@ -22788,11 +25673,11 @@ namespace exprtk if (!token_is(token_t::e_lbracket)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR021 - Expecting argument list for function: '" + function_name + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR022 - Expecting argument list for function: '" + function_name + "'", + exprtk_error_location)); return error_node(); } @@ -22803,11 +25688,11 @@ namespace exprtk if (0 == branch[i]) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR022 - Failed to parse argument " + details::to_str(i) + " for function: '" + function_name + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR023 - Failed to parse argument " + details::to_str(i) + " for function: '" + function_name + "'", + exprtk_error_location)); return error_node(); } @@ -22815,11 +25700,11 @@ namespace exprtk { if (!token_is(token_t::e_comma)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR023 - Invalid number of arguments for function: '" + function_name + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR024 - Invalid number of arguments for function: '" + function_name + "'", + exprtk_error_location)); return error_node(); } @@ -22828,11 +25713,11 @@ namespace exprtk if (!token_is(token_t::e_rbracket)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR024 - Invalid number of arguments for function: '" + function_name + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR025 - Invalid number of arguments for function: '" + function_name + "'", + exprtk_error_location)); return error_node(); } @@ -22857,13 +25742,13 @@ namespace exprtk !token_is(token_t::e_rbracket) ) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR025 - Expecting '()' to proceed call to function: '" + function_name + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR026 - Expecting '()' to proceed call to function: '" + function_name + "'", + exprtk_error_location)); - free_node(node_allocator_,result); + free_node(node_allocator_, result); return error_node(); } @@ -22882,23 +25767,23 @@ namespace exprtk if (!token_is(token_t::e_lbracket)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR026 - Expected a '(' at start of function call to '" + function_name + - "', instead got: '" + current_token().value + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR027 - Expected a '(' at start of function call to '" + function_name + + "', instead got: '" + current_token().value + "'", + exprtk_error_location)); return 0; } if (token_is(token_t::e_rbracket, e_hold)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR027 - Expected at least one input parameter for function call '" + function_name + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR028 - Expected at least one input parameter for function call '" + function_name + "'", + exprtk_error_location)); return 0; } @@ -22920,11 +25805,11 @@ namespace exprtk continue; else { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR028 - Expected a ',' between function input parameters, instead got: '" + current_token().value + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR029 - Expected a ',' between function input parameters, instead got: '" + current_token().value + "'", + exprtk_error_location)); return 0; } @@ -22932,11 +25817,11 @@ namespace exprtk if (sd.delete_ptr) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR029 - Invalid number of input parameters passed to function '" + function_name + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR030 - Invalid number of input parameters passed to function '" + function_name + "'", + exprtk_error_location)); return 0; } @@ -22955,11 +25840,11 @@ namespace exprtk if (0 == std::distance(itr_range.first,itr_range.second)) { - set_error( - make_error(parser_error::e_syntax, - diagnostic_token, - "ERR030 - No entry found for base operation: " + operation_name, - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + diagnostic_token, + "ERR031 - No entry found for base operation: " + operation_name, + exprtk_error_location)); return error_node(); } @@ -23002,11 +25887,11 @@ namespace exprtk free_node(node_allocator_, param_list[i]); } - set_error( - make_error(parser_error::e_syntax, - diagnostic_token, - "ERR031 - Invalid number of input parameters for call to function: '" + operation_name + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + diagnostic_token, + "ERR032 - Invalid number of input parameters for call to function: '" + operation_name + "'", + exprtk_error_location)); return error_node(); } @@ -23022,47 +25907,52 @@ namespace exprtk if (!token_is(token_t::e_comma)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR032 - Expected ',' between if-statement condition and consequent", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR033 - Expected ',' between if-statement condition and consequent", + exprtk_error_location)); + result = false; } else if (0 == (consequent = parse_expression())) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR033 - Failed to parse consequent for if-statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR034 - Failed to parse consequent for if-statement", + exprtk_error_location)); + result = false; } else if (!token_is(token_t::e_comma)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR034 - Expected ',' between if-statement consequent and alternative", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR035 - Expected ',' between if-statement consequent and alternative", + exprtk_error_location)); + result = false; } else if (0 == (alternative = parse_expression())) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR035 - Failed to parse alternative for if-statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR036 - Failed to parse alternative for if-statement", + exprtk_error_location)); + result = false; } else if (!token_is(token_t::e_rbracket)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR036 - Expected ')' at the end of if-statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR037 - Expected ')' at the end of if-statement", + exprtk_error_location)); + result = false; } @@ -23076,15 +25966,30 @@ namespace exprtk { if (consq_is_str && alter_is_str) { - return expression_generator_ - .conditional_string(condition, consequent, alternative); + expression_node_ptr result_node = + expression_generator_ + .conditional_string(condition, consequent, alternative); + + if (result_node && result_node->valid()) + { + return result_node; + } + + set_error(make_error( + parser_error::e_synthesis, + current_token(), + "ERR038 - Failed to synthesize node: conditional_string", + exprtk_error_location)); + + free_node(node_allocator_, result_node); + return error_node(); } - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR037 - Return types of if-statement differ: string/non-string", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR039 - Return types of if-statement differ: string/non-string", + exprtk_error_location)); result = false; } @@ -23104,11 +26009,11 @@ namespace exprtk .conditional_vector(condition, consequent, alternative); } - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR038 - Return types of if-statement differ: vector/non-vector", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR040 - Return types of if-statement differ: vector/non-vector", + exprtk_error_location)); result = false; } @@ -23138,11 +26043,31 @@ namespace exprtk { if (0 == (consequent = parse_multi_sequence("if-statement-01"))) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR039 - Failed to parse body of consequent for if-statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR041 - Failed to parse body of consequent for if-statement", + exprtk_error_location)); + + result = false; + } + else if + ( + !settings_.commutative_check_enabled() && + !token_is("else",prsrhlpr_t::e_hold) && + !token_is_loop(prsrhlpr_t::e_hold) && + !token_is_arithmetic_opr(prsrhlpr_t::e_hold) && + !token_is_right_bracket (prsrhlpr_t::e_hold) && + !token_is_ineq_opr (prsrhlpr_t::e_hold) && + !token_is(token_t::e_ternary,prsrhlpr_t::e_hold) && + !token_is(token_t::e_eof) + ) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR042 - Expected ';' at the end of the consequent for if-statement (1)", + exprtk_error_location)); result = false; } @@ -23161,22 +26086,22 @@ namespace exprtk { if (!token_is(token_t::e_eof)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR040 - Expected ';' at the end of the consequent for if-statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR043 - Expected ';' at the end of the consequent for if-statement (2)", + exprtk_error_location)); result = false; } } else { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR041 - Failed to parse body of consequent for if-statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR044 - Failed to parse body of consequent for if-statement", + exprtk_error_location)); result = false; } @@ -23192,11 +26117,11 @@ namespace exprtk { if (0 == (alternative = parse_multi_sequence("else-statement-01"))) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR042 - Failed to parse body of the 'else' for if-statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR045 - Failed to parse body of the 'else' for if-statement", + exprtk_error_location)); result = false; } @@ -23205,35 +26130,38 @@ namespace exprtk { if (0 == (alternative = parse_conditional_statement())) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR043 - Failed to parse body of if-else statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR046 - Failed to parse body of if-else statement", + exprtk_error_location)); result = false; } } else if (0 != (alternative = parse_expression())) { - if (!token_is(token_t::e_eof)) + if ( + !token_is(token_t::e_ternary,prsrhlpr_t::e_hold) && + !token_is(token_t::e_eof) + ) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR044 - Expected ';' at the end of the 'else-if' for the if-statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR047 - Expected ';' at the end of the 'else-if' for the if-statement", + exprtk_error_location)); result = false; } } else { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR045 - Failed to parse body of the 'else' for if-statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR048 - Failed to parse body of the 'else' for if-statement", + exprtk_error_location)); result = false; } @@ -23254,11 +26182,11 @@ namespace exprtk .conditional_string(condition, consequent, alternative); } - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR046 - Return types of if-statement differ: string/non-string", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR049 - Return types of if-statement differ: string/non-string", + exprtk_error_location)); result = false; } @@ -23278,11 +26206,11 @@ namespace exprtk .conditional_vector(condition, consequent, alternative); } - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR047 - Return types of if-statement differ: vector/non-vector", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR050 - Return types of if-statement differ: vector/non-vector", + exprtk_error_location)); result = false; } @@ -23309,21 +26237,21 @@ namespace exprtk if (!token_is(token_t::e_lbracket)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR048 - Expected '(' at start of if-statement, instead got: '" + current_token().value + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR051 - Expected '(' at start of if-statement, instead got: '" + current_token().value + "'", + exprtk_error_location)); return error_node(); } else if (0 == (condition = parse_expression())) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR049 - Failed to parse condition for if-statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR052 - Failed to parse condition for if-statement", + exprtk_error_location)); return error_node(); } @@ -23353,13 +26281,13 @@ namespace exprtk return parse_conditional_statement_02(condition); } - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR050 - Invalid if-statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR053 - Invalid if-statement", + exprtk_error_location)); - free_node(node_allocator_,condition); + free_node(node_allocator_, condition); return error_node(); } @@ -23374,51 +26302,51 @@ namespace exprtk if (0 == condition) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR051 - Encountered invalid condition branch for ternary if-statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR054 - Encountered invalid condition branch for ternary if-statement", + exprtk_error_location)); return error_node(); } else if (!token_is(token_t::e_ternary)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR052 - Expected '?' after condition of ternary if-statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR055 - Expected '?' after condition of ternary if-statement", + exprtk_error_location)); result = false; } else if (0 == (consequent = parse_expression())) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR053 - Failed to parse consequent for ternary if-statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR056 - Failed to parse consequent for ternary if-statement", + exprtk_error_location)); result = false; } else if (!token_is(token_t::e_colon)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR054 - Expected ':' between ternary if-statement consequent and alternative", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR057 - Expected ':' between ternary if-statement consequent and alternative", + exprtk_error_location)); result = false; } else if (0 == (alternative = parse_expression())) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR055 - Failed to parse alternative for ternary if-statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR058 - Failed to parse alternative for ternary if-statement", + exprtk_error_location)); result = false; } @@ -23437,11 +26365,11 @@ namespace exprtk .conditional_string(condition, consequent, alternative); } - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR056 - Return types of ternary differ: string/non-string", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR059 - Return types of ternary differ: string/non-string", + exprtk_error_location)); result = false; } @@ -23461,11 +26389,11 @@ namespace exprtk .conditional_vector(condition, consequent, alternative); } - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR057 - Return types of ternary differ: vector/non-vector", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR060 - Return types of ternary differ: vector/non-vector", + exprtk_error_location)); result = false; } @@ -23488,11 +26416,11 @@ namespace exprtk { if (settings_.logic_disabled("not")) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR058 - Invalid or disabled logic operation 'not'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR061 - Invalid or disabled logic operation 'not'", + exprtk_error_location)); return error_node(); } @@ -23519,31 +26447,31 @@ namespace exprtk if (!token_is(token_t::e_lbracket)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR059 - Expected '(' at start of while-loop condition statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR062 - Expected '(' at start of while-loop condition statement", + exprtk_error_location)); return error_node(); } else if (0 == (condition = parse_expression())) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR060 - Failed to parse condition for while-loop", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR063 - Failed to parse condition for while-loop", + exprtk_error_location)); return error_node(); } else if (!token_is(token_t::e_rbracket)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR061 - Expected ')' at end of while-loop condition statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR064 - Expected ')' at end of while-loop condition statement", + exprtk_error_location)); result = false; } @@ -23556,21 +26484,21 @@ namespace exprtk if (0 == (branch = parse_multi_sequence("while-loop", true))) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR062 - Failed to parse body of while-loop")); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR065 - Failed to parse body of while-loop")); result = false; } else if (0 == (result_node = expression_generator_.while_loop(condition, branch, brkcnt_list_.front()))) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR063 - Failed to synthesize while-loop", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR066 - Failed to synthesize while-loop", + exprtk_error_location)); result = false; } @@ -23587,7 +26515,20 @@ namespace exprtk return error_node(); } - return result_node; + if (result_node && result_node->valid()) + { + return result_node; + } + + set_error(make_error( + parser_error::e_synthesis, + current_token(), + "ERR067 - Failed to synthesize 'valid' while-loop", + exprtk_error_location)); + + free_node(node_allocator_, result_node); + + return error_node(); } inline expression_node_ptr parse_repeat_until_loop() @@ -23611,7 +26552,7 @@ namespace exprtk } else { - const token_t::token_type seperator = token_t::e_eof; + const token_t::token_type separator = token_t::e_eof; scope_handler sh(*this); @@ -23642,13 +26583,13 @@ namespace exprtk const bool is_next_until = peek_token_is(token_t::e_symbol) && peek_token_is("until"); - if (!token_is(seperator) && is_next_until) + if (!token_is(separator) && is_next_until) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR064 - Expected '" + token_t::to_str(seperator) + "' in body of repeat until loop", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR068 - Expected '" + token_t::to_str(separator) + "' in body of repeat until loop", + exprtk_error_location)); return error_node(); } @@ -23666,11 +26607,11 @@ namespace exprtk if (sdd.delete_ptr) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR065 - Failed to parse body of repeat until loop", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR069 - Failed to parse body of repeat until loop", + exprtk_error_location)); return error_node(); } @@ -23678,33 +26619,33 @@ namespace exprtk if (!token_is(token_t::e_lbracket)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR066 - Expected '(' before condition statement of repeat until loop", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR070 - Expected '(' before condition statement of repeat until loop", + exprtk_error_location)); - free_node(node_allocator_,branch); + free_node(node_allocator_, branch); return error_node(); } else if (0 == (condition = parse_expression())) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR067 - Failed to parse condition for repeat until loop", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR071 - Failed to parse condition for repeat until loop", + exprtk_error_location)); - free_node(node_allocator_,branch); + free_node(node_allocator_, branch); return error_node(); } else if (!token_is(token_t::e_rbracket)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR068 - Expected ')' after condition of repeat until loop", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR072 - Expected ')' after condition of repeat until loop", + exprtk_error_location)); free_node(node_allocator_, branch ); free_node(node_allocator_, condition); @@ -23712,27 +26653,42 @@ namespace exprtk return error_node(); } - expression_node_ptr result; + expression_node_ptr result_node = + expression_generator_ + .repeat_until_loop( + condition, + branch, + brkcnt_list_.front()); - result = expression_generator_ - .repeat_until_loop(condition, branch, brkcnt_list_.front()); - - if (0 == result) + if (0 == result_node) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR069 - Failed to synthesize repeat until loop", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR073 - Failed to synthesize repeat until loop", + exprtk_error_location)); - free_node(node_allocator_,condition); + free_node(node_allocator_, condition); return error_node(); } handle_brkcnt_scope_exit(); - return result; + if (result_node && result_node->valid()) + { + return result_node; + } + + set_error(make_error( + parser_error::e_synthesis, + current_token(), + "ERR074 - Failed to synthesize 'valid' repeat until loop", + exprtk_error_location)); + + free_node(node_allocator_, result_node); + + return error_node(); } inline expression_node_ptr parse_for_loop() @@ -23751,11 +26707,11 @@ namespace exprtk if (!token_is(token_t::e_lbracket)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR070 - Expected '(' at start of for-loop", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR075 - Expected '(' at start of for-loop", + exprtk_error_location)); return error_node(); } @@ -23771,21 +26727,21 @@ namespace exprtk if (!token_is(token_t::e_symbol,prsrhlpr_t::e_hold)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR071 - Expected a variable at the start of initialiser section of for-loop", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR076 - Expected a variable at the start of initialiser section of for-loop", + exprtk_error_location)); return error_node(); } else if (!peek_token_is(token_t::e_assign)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR072 - Expected variable assignment of initialiser section of for-loop", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR077 - Expected variable assignment of initialiser section of for-loop", + exprtk_error_location)); return error_node(); } @@ -23796,11 +26752,11 @@ namespace exprtk if ((se->name == loop_counter_symbol) && se->active) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR073 - For-loop variable '" + loop_counter_symbol+ "' is being shadowed by a previous declaration", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR078 - For-loop variable '" + loop_counter_symbol+ "' is being shadowed by a previous declaration", + exprtk_error_location)); return error_node(); } @@ -23828,11 +26784,11 @@ namespace exprtk if (!sem_.add_element(nse)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR074 - Failed to add new local variable '" + loop_counter_symbol + "' to SEM", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR079 - Failed to add new local variable '" + loop_counter_symbol + "' to SEM", + exprtk_error_location)); sem_.free_element(nse); @@ -23840,7 +26796,7 @@ namespace exprtk } else { - exprtk_debug(("parse_for_loop() - INFO - Added new local variable: %s\n",nse.name.c_str())); + exprtk_debug(("parse_for_loop() - INFO - Added new local variable: %s\n", nse.name.c_str())); state_.activate_side_effect("parse_for_loop()"); } @@ -23850,21 +26806,21 @@ namespace exprtk if (0 == (initialiser = parse_expression())) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR075 - Failed to parse initialiser of for-loop", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR080 - Failed to parse initialiser of for-loop", + exprtk_error_location)); result = false; } else if (!token_is(token_t::e_eof)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR076 - Expected ';' after initialiser of for-loop", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR081 - Expected ';' after initialiser of for-loop", + exprtk_error_location)); result = false; } @@ -23874,21 +26830,21 @@ namespace exprtk { if (0 == (condition = parse_expression())) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR077 - Failed to parse condition of for-loop", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR082 - Failed to parse condition of for-loop", + exprtk_error_location)); result = false; } else if (!token_is(token_t::e_eof)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR078 - Expected ';' after condition section of for-loop", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR083 - Expected ';' after condition section of for-loop", + exprtk_error_location)); result = false; } @@ -23898,21 +26854,21 @@ namespace exprtk { if (0 == (incrementor = parse_expression())) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR079 - Failed to parse incrementor of for-loop", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR084 - Failed to parse incrementor of for-loop", + exprtk_error_location)); result = false; } else if (!token_is(token_t::e_rbracket)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR080 - Expected ')' after incrementor section of for-loop", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR085 - Expected ')' after incrementor section of for-loop", + exprtk_error_location)); result = false; } @@ -23926,11 +26882,11 @@ namespace exprtk if (0 == (loop_body = parse_multi_sequence("for-loop", true))) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR081 - Failed to parse body of for-loop", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR086 - Failed to parse body of for-loop", + exprtk_error_location)); result = false; } @@ -23958,7 +26914,20 @@ namespace exprtk brkcnt_list_.front()); handle_brkcnt_scope_exit(); - return result_node; + if (result_node && result_node->valid()) + { + return result_node; + } + + set_error(make_error( + parser_error::e_synthesis, + current_token(), + "ERR087 - Failed to synthesize 'valid' for-loop", + exprtk_error_location)); + + free_node(node_allocator_, result_node); + + return error_node(); } inline expression_node_ptr parse_switch_statement() @@ -23968,11 +26937,11 @@ namespace exprtk if (!details::imatch(current_token().value,"switch")) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR082 - Expected keyword 'switch'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR088 - Expected keyword 'switch'", + exprtk_error_location)); return error_node(); } @@ -23983,11 +26952,11 @@ namespace exprtk if (!token_is(token_t::e_lcrlbracket)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR083 - Expected '{' for call to switch statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR089 - Expected '{' for call to switch statement", + exprtk_error_location)); return error_node(); } @@ -24008,18 +26977,21 @@ namespace exprtk return error_node(); else if (!token_is(token_t::e_colon)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR084 - Expected ':' for case of switch statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR090 - Expected ':' for case of switch statement", + exprtk_error_location)); free_node(node_allocator_, condition); return error_node(); } - expression_node_ptr consequent = parse_expression(); + expression_node_ptr consequent = + (token_is(token_t::e_lcrlbracket,prsrhlpr_t::e_hold)) ? + parse_multi_sequence("switch-consequent") : + parse_expression(); if (0 == consequent) { @@ -24029,11 +27001,11 @@ namespace exprtk } else if (!token_is(token_t::e_eof)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR085 - Expected ';' at end of case for switch statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR091 - Expected ';' at end of case for switch statement", + exprtk_error_location)); free_node(node_allocator_, condition ); free_node(node_allocator_, consequent); @@ -24058,11 +27030,11 @@ namespace exprtk { if (0 != default_statement) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR086 - Multiple default cases for switch statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR092 - Multiple default cases for switch statement", + exprtk_error_location)); return error_node(); } @@ -24071,29 +27043,29 @@ namespace exprtk if (!token_is(token_t::e_colon)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR087 - Expected ':' for default of switch statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR093 - Expected ':' for default of switch statement", + exprtk_error_location)); return error_node(); } - if (token_is(token_t::e_lcrlbracket,prsrhlpr_t::e_hold)) - default_statement = parse_multi_sequence("switch-default"); - else - default_statement = parse_expression(); + default_statement = + (token_is(token_t::e_lcrlbracket,prsrhlpr_t::e_hold)) ? + parse_multi_sequence("switch-default"): + parse_expression(); if (0 == default_statement) return error_node(); else if (!token_is(token_t::e_eof)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR088 - Expected ';' at end of default for switch statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR094 - Expected ';' at end of default for switch statement", + exprtk_error_location)); return error_node(); } @@ -24102,11 +27074,11 @@ namespace exprtk break; else { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR089 - Expected '}' at end of switch statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR095 - Expected '}' at end of switch statement", + exprtk_error_location)); return error_node(); } @@ -24118,6 +27090,10 @@ namespace exprtk { arg_list.push_back(default_statement); } + else + { + arg_list.push_back(node_allocator_.allocate_c(std::numeric_limits::quiet_NaN())); + } result = expression_generator_.switch_statement(arg_list, (0 != default_statement)); @@ -24133,11 +27109,11 @@ namespace exprtk if (!details::imatch(current_token().value,"[*]")) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR090 - Expected token '[*]'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR096 - Expected token '[*]'", + exprtk_error_location)); return error_node(); } @@ -24148,11 +27124,11 @@ namespace exprtk if (!token_is(token_t::e_lcrlbracket)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR091 - Expected '{' for call to [*] statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR097 - Expected '{' for call to [*] statement", + exprtk_error_location)); return error_node(); } @@ -24161,11 +27137,11 @@ namespace exprtk { if (!details::imatch("case",current_token().value)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR092 - Expected a 'case' statement for multi-switch", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR098 - Expected a 'case' statement for multi-switch", + exprtk_error_location)); return error_node(); } @@ -24179,27 +27155,30 @@ namespace exprtk if (!token_is(token_t::e_colon)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR093 - Expected ':' for case of [*] statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR099 - Expected ':' for case of [*] statement", + exprtk_error_location)); return error_node(); } - expression_node_ptr consequent = parse_expression(); + expression_node_ptr consequent = + (token_is(token_t::e_lcrlbracket,prsrhlpr_t::e_hold)) ? + parse_multi_sequence("multi-switch-consequent") : + parse_expression(); if (0 == consequent) return error_node(); if (!token_is(token_t::e_eof)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR094 - Expected ';' at end of case for [*] statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR100 - Expected ';' at end of case for [*] statement", + exprtk_error_location)); return error_node(); } @@ -24224,11 +27203,11 @@ namespace exprtk if (!token_is(token_t::e_rcrlbracket)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR095 - Expected '}' at end of [*] statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR101 - Expected '}' at end of [*] statement", + exprtk_error_location)); return error_node(); } @@ -24265,11 +27244,11 @@ namespace exprtk else if (details::imatch(symbol, "sum" )) opt_type = details::e_sum ; else { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR096 - Unsupported built-in vararg function: " + symbol, - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR102 - Unsupported built-in vararg function: " + symbol, + exprtk_error_location)); return error_node(); } @@ -24282,23 +27261,23 @@ namespace exprtk if (!token_is(token_t::e_lbracket)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR097 - Expected '(' for call to vararg function: " + symbol, - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR103 - Expected '(' for call to vararg function: " + symbol, + exprtk_error_location)); return error_node(); } if (token_is(token_t::e_rbracket)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR098 - vararg function: " + symbol + - " requires at least one input parameter", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR104 - vararg function: " + symbol + + " requires at least one input parameter", + exprtk_error_location)); return error_node(); } @@ -24316,11 +27295,11 @@ namespace exprtk break; else if (!token_is(token_t::e_comma)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR099 - Expected ',' for call to vararg function: " + symbol, - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR105 - Expected ',' for call to vararg function: " + symbol, + exprtk_error_location)); return error_node(); } @@ -24337,13 +27316,13 @@ namespace exprtk { if (!token_is(token_t::e_lsqrbracket)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR100 - Expected '[' as start of string range definition", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR106 - Expected '[' as start of string range definition", + exprtk_error_location)); - free_node(node_allocator_,expression); + free_node(node_allocator_, expression); return error_node(); } @@ -24356,7 +27335,7 @@ namespace exprtk if (!parse_range(rp,true)) { - free_node(node_allocator_,expression); + free_node(node_allocator_, expression); return error_node(); } @@ -24365,19 +27344,32 @@ namespace exprtk if (0 == result) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR101 - Failed to generate string range node", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR107 - Failed to generate string range node", + exprtk_error_location)); - free_node(node_allocator_,expression); + free_node(node_allocator_, expression); rp.free(); } rp.clear(); - return result; + if (result && result->valid()) + { + return result; + } + + set_error(make_error( + parser_error::e_synthesis, + current_token(), + "ERR108 - Failed to synthesize node: string_range_node", + exprtk_error_location)); + + free_node(node_allocator_, result); + rp.free(); + return error_node(); } #else inline expression_node_ptr parse_string_range_statement(expression_node_ptr&) @@ -24386,7 +27378,7 @@ namespace exprtk } #endif - inline void parse_pending_string_rangesize(expression_node_ptr& expression) + inline bool parse_pending_string_rangesize(expression_node_ptr& expression) { // Allow no more than 100 range calls, eg: s[][][]...[][] const std::size_t max_rangesize_parses = 100; @@ -24404,6 +27396,61 @@ namespace exprtk { expression = parse_string_range_statement(expression); } + + return (i > 1); + } + + inline void parse_pending_vector_index_operator(expression_node_ptr& expression) + { + if + ( + (0 != expression) && + error_list_.empty() && + is_ivector_node(expression) + ) + { + if ( + settings_.commutative_check_enabled() && + token_is(token_t::e_mul,prsrhlpr_t::e_hold) && + peek_token_is(token_t::e_lsqrbracket) + ) + { + token_is(token_t::e_mul); + token_is(token_t::e_lsqrbracket); + } + else if (token_is(token_t::e_lsqrbracket,prsrhlpr_t::e_hold)) + { + token_is(token_t::e_lsqrbracket); + } + else if ( + token_is(token_t::e_rbracket,prsrhlpr_t::e_hold) && + peek_token_is(token_t::e_lsqrbracket) + ) + { + token_is(token_t::e_rbracket ); + token_is(token_t::e_lsqrbracket); + } + else + return; + + details::vector_interface* vi = dynamic_cast*>(expression); + + if (vi) + { + details::vector_holder& vec = vi->vec()->vec_holder(); + const std::string vector_name = sem_.get_vector_name(vec.data()); + expression_node_ptr index = parse_vector_index(vector_name); + + if (index) + { + expression = synthesize_vector_element(vector_name, &vec, expression, index); + return; + } + } + + free_node(node_allocator_, expression); + expression = error_node(); + } } template 1..5 - // 2. [ :5] -> 0..5 - // 3. [1: ] -> 1..end - // 4. [x:y] -> x..y where x <= y - // 5. [x+1:y/2] -> x+1..y/2 where x+1 <= y/2 - // 6. [ :y] -> 0..y where 0 <= y - // 7. [x: ] -> x..end where x <= end + // 1. [1:5] -> [1,5) + // 2. [ :5] -> [0,5) + // 3. [1: ] -> [1,end) + // 4. [x:y] -> [x,y) where x <= y + // 5. [x+1:y/2] -> [x+1,y/2) where x+1 <= y/2 + // 6. [ :y] -> [0,y) where 0 <= y + // 7. [x: ] -> [x,end) where x <= end rp.clear(); if (!skip_lsqr && !token_is(token_t::e_lsqrbracket)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR104 - Expected '[' for start of range", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR111 - Expected '[' for start of range", + exprtk_error_location)); return false; } @@ -24607,11 +27654,11 @@ namespace exprtk if (0 == r0) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR105 - Failed parse begin section of range", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR112 - Failed parse begin section of range", + exprtk_error_location)); return false; } @@ -24626,15 +27673,15 @@ namespace exprtk rp.cache.first = rp.n0_c.second; } - free_node(node_allocator_,r0); + free_node(node_allocator_, r0); if (r0_value < T(0)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR106 - Range lower bound less than zero! Constraint: r0 >= 0", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR113 - Range lower bound less than zero! Constraint: r0 >= 0", + exprtk_error_location)); return false; } @@ -24647,11 +27694,11 @@ namespace exprtk if (!token_is(token_t::e_colon)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR107 - Expected ':' for break in range", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR114 - Expected ':' for break in range", + exprtk_error_location)); rp.free(); @@ -24670,11 +27717,11 @@ namespace exprtk if (0 == r1) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR108 - Failed parse end section of range", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR115 - Failed parse end section of range", + exprtk_error_location)); rp.free(); @@ -24691,15 +27738,15 @@ namespace exprtk rp.cache.second = rp.n1_c.second; } - free_node(node_allocator_,r1); + free_node(node_allocator_, r1); if (r1_value < T(0)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR109 - Range upper bound less than zero! Constraint: r1 >= 0", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR116 - Range upper bound less than zero! Constraint: r1 >= 0", + exprtk_error_location)); rp.free(); @@ -24714,11 +27761,11 @@ namespace exprtk if (!token_is(token_t::e_rsqrbracket)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR110 - Expected ']' for start of range", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR117 - Expected ']' for start of range", + exprtk_error_location)); rp.free(); @@ -24742,11 +27789,11 @@ namespace exprtk if (!rp_result || (r0 > r1)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR111 - Invalid range, Constraint: r0 <= r1", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR118 - Invalid range, Constraint: r0 <= r1", + exprtk_error_location)); return false; } @@ -24786,11 +27833,11 @@ namespace exprtk if ((0 == str_ctx.str_var) || !symtab_store_.is_conststr_stringvar(symbol)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR112 - Unknown string symbol", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR119 - Unknown string symbol", + exprtk_error_location)); return error_node(); } @@ -24826,7 +27873,7 @@ namespace exprtk if (const_str_node) { - free_node(node_allocator_,result); + free_node(node_allocator_, result); return expression_generator_(T(const_str_node->size())); } @@ -24839,13 +27886,13 @@ namespace exprtk if (!parse_range(rp)) { - free_node(node_allocator_,result); + free_node(node_allocator_, result); return error_node(); } else if (const_str_node) { - free_node(node_allocator_,result); + free_node(node_allocator_, result); result = expression_generator_(const_str_node->ref(),rp); } else @@ -24882,7 +27929,7 @@ namespace exprtk next_token(); next_token(); - free_node(node_allocator_,result); + free_node(node_allocator_, result); return expression_generator_(T(const_str.size())); } @@ -24891,13 +27938,13 @@ namespace exprtk if (!parse_range(rp)) { - free_node(node_allocator_,result); + free_node(node_allocator_, result); rp.free(); return error_node(); } - free_node(node_allocator_,result); + free_node(node_allocator_, result); if (rp.n1_c.first && (rp.n1_c.second == std::numeric_limits::max())) { @@ -24910,13 +27957,13 @@ namespace exprtk (rp.n1_c.first && (rp.n1_c.second >= const_str.size())) ) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR113 - Overflow in range for string: '" + const_str + "'[" + - (rp.n0_c.first ? details::to_str(static_cast(rp.n0_c.second)) : "?") + ":" + - (rp.n1_c.first ? details::to_str(static_cast(rp.n1_c.second)) : "?") + "]", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR120 - Overflow in range for string: '" + const_str + "'[" + + (rp.n0_c.first ? details::to_str(static_cast(rp.n0_c.second)) : "?") + ":" + + (rp.n1_c.first ? details::to_str(static_cast(rp.n1_c.second)) : "?") + "]", + exprtk_error_location)); rp.free(); @@ -24940,30 +27987,60 @@ namespace exprtk } #endif + inline expression_node_ptr parse_vector_index(const std::string& vector_name = "") + { + expression_node_ptr index_expr = error_node(); + + if (0 == (index_expr = parse_expression())) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR121 - Failed to parse index for vector: '" + vector_name + "'", + exprtk_error_location)); + + return error_node(); + } + else if (!token_is(token_t::e_rsqrbracket)) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR122 - Expected ']' for index of vector: '" + vector_name + "'", + exprtk_error_location)); + + free_node(node_allocator_, index_expr); + + return error_node(); + } + + return index_expr; + } + inline expression_node_ptr parse_vector() { - const std::string symbol = current_token().value; + const std::string vector_name = current_token().value; vector_holder_ptr vec = vector_holder_ptr(0); - const scope_element& se = sem_.get_active_element(symbol); + const scope_element& se = sem_.get_active_element(vector_name); if ( - !details::imatch(se.name, symbol) || + !details::imatch(se.name, vector_name) || (se.depth > state_.scope_depth) || (scope_element::e_vector != se.type) ) { typedef typename symtab_store::vector_context vec_ctxt_t; - vec_ctxt_t vec_ctx = symtab_store_.get_vector_context(symbol); + vec_ctxt_t vec_ctx = symtab_store_.get_vector_context(vector_name); if (0 == vec_ctx.vector_holder) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR114 - Symbol '" + symbol+ " not a vector", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR123 - Symbol '" + vector_name + " not a vector", + exprtk_error_location)); return error_node(); } @@ -24981,12 +28058,12 @@ namespace exprtk } } else + { vec = se.vec_node; + } assert(0 != vec); - expression_node_ptr index_expr = error_node(); - next_token(); if (!token_is(token_t::e_lsqrbracket)) @@ -24995,31 +28072,28 @@ namespace exprtk } else if (token_is(token_t::e_rsqrbracket)) { - return expression_generator_(T(vec->size())); + return (vec->rebaseable()) ? + node_allocator_.allocate(vec) : + expression_generator_(T(vec->size())); } - else if (0 == (index_expr = parse_expression())) + + expression_node_ptr index_expr = parse_vector_index(vector_name); + + if (index_expr) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR115 - Failed to parse index for vector: '" + symbol + "'", - exprtk_error_location)); + expression_node_ptr vec_node = node_allocator_.allocate(vec); - return error_node(); - } - else if (!token_is(token_t::e_rsqrbracket)) - { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR116 - Expected ']' for index of vector: '" + symbol + "'", - exprtk_error_location)); - - free_node(node_allocator_,index_expr); - - return error_node(); + return synthesize_vector_element(vector_name, vec, vec_node, index_expr); } + return error_node(); + } + + inline expression_node_ptr synthesize_vector_element(const std::string& vector_name, + vector_holder_ptr vec, + expression_node_ptr vec_node, + expression_node_ptr index_expr) + { // Perform compile-time range check if (details::is_constant_node(index_expr)) { @@ -25028,20 +28102,21 @@ namespace exprtk if (index >= vec_size) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR117 - Index of " + details::to_str(index) + " out of range for " - "vector '" + symbol + "' of size " + details::to_str(vec_size), - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR124 - Index of " + details::to_str(index) + " out of range for " + "vector '" + vector_name + "' of size " + details::to_str(vec_size), + exprtk_error_location)); - free_node(node_allocator_,index_expr); + free_node(node_allocator_, vec_node ); + free_node(node_allocator_, index_expr); return error_node(); } } - return expression_generator_.vector_element(symbol, vec, index_expr); + return expression_generator_.vector_element(vector_name, vec, vec_node, index_expr); } inline expression_node_ptr parse_vararg_function_call(ivararg_function* vararg_function, const std::string& vararg_function_name) @@ -25060,12 +28135,12 @@ namespace exprtk { if (!vararg_function->allow_zero_parameters()) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR118 - Zero parameter call to vararg function: " - + vararg_function_name + " not allowed", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR125 - Zero parameter call to vararg function: " + + vararg_function_name + " not allowed", + exprtk_error_location)); return error_node(); } @@ -25085,12 +28160,12 @@ namespace exprtk break; else if (!token_is(token_t::e_comma)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR119 - Expected ',' for call to vararg function: " - + vararg_function_name, - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR126 - Expected ',' for call to vararg function: " + + vararg_function_name, + exprtk_error_location)); return error_node(); } @@ -25099,37 +28174,37 @@ namespace exprtk } else if (!vararg_function->allow_zero_parameters()) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR120 - Zero parameter call to vararg function: " - + vararg_function_name + " not allowed", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR127 - Zero parameter call to vararg function: " + + vararg_function_name + " not allowed", + exprtk_error_location)); return error_node(); } if (arg_list.size() < vararg_function->min_num_args()) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR121 - Invalid number of parameters to call to vararg function: " - + vararg_function_name + ", require at least " - + details::to_str(static_cast(vararg_function->min_num_args())) + " parameters", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR128 - Invalid number of parameters to call to vararg function: " + + vararg_function_name + ", require at least " + + details::to_str(static_cast(vararg_function->min_num_args())) + " parameters", + exprtk_error_location)); return error_node(); } else if (arg_list.size() > vararg_function->max_num_args()) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR122 - Invalid number of parameters to call to vararg function: " - + vararg_function_name + ", require no more than " - + details::to_str(static_cast(vararg_function->max_num_args())) + " parameters", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR129 - Invalid number of parameters to call to vararg function: " + + vararg_function_name + ", require no more than " + + details::to_str(static_cast(vararg_function->max_num_args())) + " parameters", + exprtk_error_location)); return error_node(); } @@ -25200,14 +28275,13 @@ namespace exprtk if (1 == error_list.size()) { - parser_. - set_error( - make_error(parser_error::e_syntax, - parser_.current_token(), - "ERR123 - Failed parameter type check for function '" + function_name_ + "', " - "Expected '" + function_definition_list_[0].param_seq + - "' call set: '" + param_seq + "'", - exprtk_error_location)); + parser_.set_error(make_error( + parser_error::e_syntax, + parser_.current_token(), + "ERR130 - Failed parameter type check for function '" + function_name_ + "', " + "Expected '" + function_definition_list_[0].param_seq + + "' call set: '" + param_seq + "'", + exprtk_error_location)); } else { @@ -25222,14 +28296,13 @@ namespace exprtk } } - parser_. - set_error( - make_error(parser_error::e_syntax, - parser_.current_token(), - "ERR124 - Failed parameter type check for function '" + function_name_ + "', " - "Best match: '" + function_definition_list_[max_diff_index].param_seq + - "' call set: '" + param_seq + "'", - exprtk_error_location)); + parser_.set_error(make_error( + parser_error::e_syntax, + parser_.current_token(), + "ERR131 - Failed parameter type check for function '" + function_name_ + "', " + "Best match: '" + function_definition_list_[max_diff_index].param_seq + + "' call set: '" + param_seq + "'", + exprtk_error_location)); } return false; @@ -25364,13 +28437,12 @@ namespace exprtk { invalid_state_ = false; - parser_. - set_error( - make_error(parser_error::e_syntax, - parser_.current_token(), - "ERR125 - Invalid parameter sequence of '" + param_seq_list[i] + - "' for function: " + function_name_, - exprtk_error_location)); + parser_.set_error(make_error( + parser_error::e_syntax, + parser_.current_token(), + "ERR132 - Invalid parameter sequence of '" + param_seq_list[i] + + "' for function: " + function_name_, + exprtk_error_location)); return; } @@ -25380,15 +28452,14 @@ namespace exprtk { invalid_state_ = false; - parser_. - set_error( - make_error(parser_error::e_syntax, - parser_.current_token(), - "ERR126 - Function '" + function_name_ + "' has a parameter sequence conflict between " + - "pseq_idx[" + details::to_str(seq_itr->second) + "] and" + - "pseq_idx[" + details::to_str(i) + "] " + - "param seq: " + param_seq_list[i], - exprtk_error_location)); + parser_.set_error(make_error( + parser_error::e_syntax, + parser_.current_token(), + "ERR133 - Function '" + function_name_ + "' has a parameter sequence conflict between " + + "pseq_idx[" + details::to_str(seq_itr->second) + "] and" + + "pseq_idx[" + details::to_str(i) + "] " + + "param seq: " + param_seq_list[i], + exprtk_error_location)); return; } @@ -25424,11 +28495,11 @@ namespace exprtk if (tc.invalid()) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR127 - Type checker instantiation failure for generic function: " + function_name, - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR134 - Type checker instantiation failure for generic function: " + function_name, + exprtk_error_location)); return error_node(); } @@ -25442,12 +28513,12 @@ namespace exprtk !tc .allow_zero_parameters() ) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR128 - Zero parameter call to generic function: " - + function_name + " not allowed", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR135 - Zero parameter call to generic function: " + + function_name + " not allowed", + exprtk_error_location)); return error_node(); } @@ -25474,11 +28545,11 @@ namespace exprtk break; else if (!token_is(token_t::e_comma)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR129 - Expected ',' for call to generic function: " + function_name, - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR136 - Expected ',' for call to generic function: " + function_name, + exprtk_error_location)); return error_node(); } @@ -25491,12 +28562,12 @@ namespace exprtk !tc .allow_zero_parameters () ) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR130 - Zero parameter call to generic function: " - + function_name + " not allowed", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR137 - Zero parameter call to generic function: " + + function_name + " not allowed", + exprtk_error_location)); return error_node(); } @@ -25508,22 +28579,21 @@ namespace exprtk !tc.verify(param_type_list, param_seq_index) ) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR131 - Invalid input parameter sequence for call to generic function: " + function_name, - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR138 - Invalid input parameter sequence for call to generic function: " + function_name, + exprtk_error_location)); return error_node(); } expression_node_ptr result = error_node(); - if (tc.paramseq_count() <= 1) - result = expression_generator_ - .generic_function_call(function, arg_list); - else - result = expression_generator_ + result = (tc.paramseq_count() <= 1) ? + expression_generator_ + .generic_function_call(function, arg_list) : + expression_generator_ .generic_function_call(function, arg_list, param_seq_index); sdd.delete_ptr = (0 == result); @@ -25546,12 +28616,12 @@ namespace exprtk !tc .allow_zero_parameters() ) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR132 - Zero parameter call to generic function: " - + function_name + " not allowed", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR139 - Zero parameter call to generic function: " + + function_name + " not allowed", + exprtk_error_location)); return false; } @@ -25578,11 +28648,11 @@ namespace exprtk break; else if (!token_is(token_t::e_comma)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR133 - Expected ',' for call to string function: " + function_name, - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR140 - Expected ',' for call to string function: " + function_name, + exprtk_error_location)); return false; } @@ -25625,22 +28695,21 @@ namespace exprtk if (!tc.verify(param_type_list, param_seq_index)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR134 - Invalid input parameter sequence for call to string function: " + function_name, - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR141 - Invalid input parameter sequence for call to string function: " + function_name, + exprtk_error_location)); return error_node(); } expression_node_ptr result = error_node(); - if (tc.paramseq_count() <= 1) - result = expression_generator_ - .string_function_call(function, arg_list); - else - result = expression_generator_ + result = (tc.paramseq_count() <= 1) ? + expression_generator_ + .string_function_call(function, arg_list) : + expression_generator_ .string_function_call(function, arg_list, param_seq_index); sdd.delete_ptr = (0 == result); @@ -25677,11 +28746,11 @@ namespace exprtk if (!tc.verify(param_type_list, param_seq_index)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR135 - Invalid input parameter sequence for call to overloaded function: " + function_name, - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR142 - Invalid input parameter sequence for call to overloaded function: " + function_name, + exprtk_error_location)); return error_node(); } @@ -25708,11 +28777,11 @@ namespace exprtk } else { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR136 - Invalid return type for call to overloaded function: " + function_name, - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR143 - Invalid return type for call to overloaded function: " + function_name, + exprtk_error_location)); } sdd.delete_ptr = (0 == result); @@ -25736,11 +28805,11 @@ namespace exprtk if (!p.token_is(token_t::e_lbracket)) { - p.set_error( - make_error(parser_error::e_syntax, - p.current_token(), - "ERR137 - Expected '(' for special function '" + sf_name + "'", - exprtk_error_location)); + p.set_error(make_error( + parser_error::e_syntax, + p.current_token(), + "ERR144 - Expected '(' for special function '" + sf_name + "'", + exprtk_error_location)); return error_node(); } @@ -25757,11 +28826,11 @@ namespace exprtk { if (!p.token_is(token_t::e_comma)) { - p.set_error( - make_error(parser_error::e_syntax, - p.current_token(), - "ERR138 - Expected ',' before next parameter of special function '" + sf_name + "'", - exprtk_error_location)); + p.set_error(make_error( + parser_error::e_syntax, + p.current_token(), + "ERR145 - Expected ',' before next parameter of special function '" + sf_name + "'", + exprtk_error_location)); return p.error_node(); } @@ -25770,11 +28839,11 @@ namespace exprtk if (!p.token_is(token_t::e_rbracket)) { - p.set_error( - make_error(parser_error::e_syntax, - p.current_token(), - "ERR139 - Invalid number of parameters for special function '" + sf_name + "'", - exprtk_error_location)); + p.set_error(make_error( + parser_error::e_syntax, + p.current_token(), + "ERR146 - Invalid number of parameters for special function '" + sf_name + "'", + exprtk_error_location)); return p.error_node(); } @@ -25797,11 +28866,11 @@ namespace exprtk !details::is_digit(sf_name[3]) ) { - set_error( - make_error(parser_error::e_token, - current_token(), - "ERR140 - Invalid special function[1]: " + sf_name, - exprtk_error_location)); + set_error(make_error( + parser_error::e_token, + current_token(), + "ERR147 - Invalid special function[1]: " + sf_name, + exprtk_error_location)); return error_node(); } @@ -25811,11 +28880,11 @@ namespace exprtk if (id >= details::e_sffinal) { - set_error( - make_error(parser_error::e_token, - current_token(), - "ERR141 - Invalid special function[2]: " + sf_name, - exprtk_error_location)); + set_error(make_error( + parser_error::e_token, + current_token(), + "ERR148 - Invalid special function[2]: " + sf_name, + exprtk_error_location)); return error_node(); } @@ -25843,21 +28912,21 @@ namespace exprtk { if (state_.parsing_break_stmt) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR142 - Invoking 'break' within a break call is not allowed", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR149 - Invoking 'break' within a break call is not allowed", + exprtk_error_location)); return error_node(); } else if (0 == state_.parsing_loop_stmt_count) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR143 - Invalid use of 'break', allowed only in the scope of a loop", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR150 - Invalid use of 'break', allowed only in the scope of a loop", + exprtk_error_location)); return error_node(); } @@ -25876,23 +28945,23 @@ namespace exprtk { if (0 == (return_expr = parse_expression())) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR144 - Failed to parse return expression for 'break' statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR151 - Failed to parse return expression for 'break' statement", + exprtk_error_location)); return error_node(); } else if (!token_is(token_t::e_rsqrbracket)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR145 - Expected ']' at the completion of break's return expression", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR152 - Expected ']' at the completion of break's return expression", + exprtk_error_location)); - free_node(node_allocator_,return_expr); + free_node(node_allocator_, return_expr); return error_node(); } @@ -25904,11 +28973,11 @@ namespace exprtk } else { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR146 - Invalid use of 'break', allowed only in the scope of a loop", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR153 - Invalid use of 'break', allowed only in the scope of a loop", + exprtk_error_location)); } return error_node(); @@ -25918,11 +28987,11 @@ namespace exprtk { if (0 == state_.parsing_loop_stmt_count) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR147 - Invalid use of 'continue', allowed only in the scope of a loop", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR154 - Invalid use of 'continue', allowed only in the scope of a loop", + exprtk_error_location)); return error_node(); } @@ -25940,242 +29009,72 @@ namespace exprtk inline expression_node_ptr parse_define_vector_statement(const std::string& vec_name) { - expression_node_ptr size_expr = error_node(); + expression_node_ptr size_expression_node = error_node(); if (!token_is(token_t::e_lsqrbracket)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR148 - Expected '[' as part of vector size definition", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR155 - Expected '[' as part of vector size definition", + exprtk_error_location)); return error_node(); } - else if (0 == (size_expr = parse_expression())) + else if (0 == (size_expression_node = parse_expression())) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR149 - Failed to determine size of vector '" + vec_name + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR156 - Failed to determine size of vector '" + vec_name + "'", + exprtk_error_location)); return error_node(); } - else if (!is_constant_node(size_expr)) + else if (!is_constant_node(size_expression_node)) { - free_node(node_allocator_,size_expr); + const bool is_rebaseble_vector = + (size_expression_node->type() == details::expression_node::e_vecsize) && + static_cast*>(size_expression_node)->vec_holder()->rebaseable(); - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR150 - Expected a literal number as size of vector '" + vec_name + "'", - exprtk_error_location)); + free_node(node_allocator_, size_expression_node); + + const std::string error_msg = (is_rebaseble_vector) ? + std::string("Rebasable/Resizable vector cannot be used to define the size of vector") : + std::string("Expected a constant literal number as size of vector"); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR157 - " + error_msg + " '" + vec_name + "'", + exprtk_error_location)); return error_node(); } - const T vector_size = size_expr->value(); + const T vector_size = size_expression_node->value(); - free_node(node_allocator_,size_expr); + free_node(node_allocator_, size_expression_node); - const T max_vector_size = T(2000000000.0); + const std::size_t max_vector_size = settings_.max_local_vector_size(); if ( (vector_size <= T(0)) || std::not_equal_to() (T(0),vector_size - details::numeric::trunc(vector_size)) || - (vector_size > max_vector_size) + (static_cast(vector_size) > max_vector_size) ) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR151 - Invalid vector size. Must be an integer in the range [0,2e9], size: " + - details::to_str(details::numeric::to_int32(vector_size)), - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR158 - Invalid vector size. Must be an integer in the " + "range [0," + details::to_str(static_cast(max_vector_size)) + "], size: " + + details::to_str(details::numeric::to_int32(vector_size)), + exprtk_error_location)); return error_node(); } - std::vector vec_initilizer_list; - - scoped_vec_delete svd((*this),vec_initilizer_list); - - bool single_value_initialiser = false; - bool vec_to_vec_initialiser = false; - bool null_initialisation = false; - - if (!token_is(token_t::e_rsqrbracket)) - { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR152 - Expected ']' as part of vector size definition", - exprtk_error_location)); - - return error_node(); - } - else if (!token_is(token_t::e_eof)) - { - if (!token_is(token_t::e_assign)) - { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR153 - Expected ':=' as part of vector definition", - exprtk_error_location)); - - return error_node(); - } - else if (token_is(token_t::e_lsqrbracket)) - { - expression_node_ptr initialiser = parse_expression(); - - if (0 == initialiser) - { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR154 - Failed to parse single vector initialiser", - exprtk_error_location)); - - return error_node(); - } - - vec_initilizer_list.push_back(initialiser); - - if (!token_is(token_t::e_rsqrbracket)) - { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR155 - Expected ']' to close single value vector initialiser", - exprtk_error_location)); - - return error_node(); - } - - single_value_initialiser = true; - } - else if (!token_is(token_t::e_lcrlbracket)) - { - expression_node_ptr initialiser = error_node(); - - // Is this a vector to vector assignment and initialisation? - if (token_t::e_symbol == current_token().type) - { - // Is it a locally defined vector? - const scope_element& se = sem_.get_active_element(current_token().value); - - if (scope_element::e_vector == se.type) - { - if (0 != (initialiser = parse_expression())) - vec_initilizer_list.push_back(initialiser); - else - return error_node(); - } - // Are we dealing with a user defined vector? - else if (symtab_store_.is_vector(current_token().value)) - { - lodge_symbol(current_token().value, e_st_vector); - - if (0 != (initialiser = parse_expression())) - vec_initilizer_list.push_back(initialiser); - else - return error_node(); - } - // Are we dealing with a null initialisation vector definition? - else if (token_is(token_t::e_symbol,"null")) - null_initialisation = true; - } - - if (!null_initialisation) - { - if (0 == initialiser) - { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR156 - Expected '{' as part of vector initialiser list", - exprtk_error_location)); - - return error_node(); - } - else - vec_to_vec_initialiser = true; - } - } - else if (!token_is(token_t::e_rcrlbracket)) - { - for ( ; ; ) - { - expression_node_ptr initialiser = parse_expression(); - - if (0 == initialiser) - { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR157 - Expected '{' as part of vector initialiser list", - exprtk_error_location)); - - return error_node(); - } - else - vec_initilizer_list.push_back(initialiser); - - if (token_is(token_t::e_rcrlbracket)) - break; - - const bool is_next_close = peek_token_is(token_t::e_rcrlbracket); - - if (!token_is(token_t::e_comma) && is_next_close) - { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR158 - Expected ',' between vector initialisers", - exprtk_error_location)); - - return error_node(); - } - - if (token_is(token_t::e_rcrlbracket)) - break; - } - } - - if ( - !token_is(token_t::e_rbracket , prsrhlpr_t::e_hold) && - !token_is(token_t::e_rcrlbracket, prsrhlpr_t::e_hold) && - !token_is(token_t::e_rsqrbracket, prsrhlpr_t::e_hold) - ) - { - if (!token_is(token_t::e_eof)) - { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR159 - Expected ';' at end of vector definition", - exprtk_error_location)); - - return error_node(); - } - } - - if (T(vec_initilizer_list.size()) > vector_size) - { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR160 - Initialiser list larger than the number of elements in the vector: '" + vec_name + "'", - exprtk_error_location)); - - return error_node(); - } - } - typename symbol_table_t::vector_holder_ptr vec_holder = typename symbol_table_t::vector_holder_ptr(0); const std::size_t vec_size = static_cast(details::numeric::to_int32(vector_size)); @@ -26186,11 +29085,11 @@ namespace exprtk { if (se.active) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR161 - Illegal redefinition of local vector: '" + vec_name + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR159 - Illegal redefinition of local vector: '" + vec_name + "'", + exprtk_error_location)); return error_node(); } @@ -26218,13 +29117,15 @@ namespace exprtk nse.data = new T[vec_size]; nse.vec_node = new typename scope_element::vector_holder_t(reinterpret_cast(nse.data),nse.size); + details::set_zero_value(reinterpret_cast(nse.data),vec_size); + if (!sem_.add_element(nse)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR162 - Failed to add new local vector '" + vec_name + "' to SEM", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR160 - Failed to add new local vector '" + vec_name + "' to SEM", + exprtk_error_location)); sem_.free_element(nse); @@ -26242,9 +29143,295 @@ namespace exprtk lodge_symbol(vec_name, e_st_local_vector); + std::vector vec_initilizer_list; + + scoped_vec_delete svd((*this),vec_initilizer_list); + + bool single_value_initialiser = false; + bool range_value_initialiser = false; + bool vec_to_vec_initialiser = false; + bool null_initialisation = false; + + if (!token_is(token_t::e_rsqrbracket)) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR161 - Expected ']' as part of vector size definition", + exprtk_error_location)); + + return error_node(); + } + else if (!token_is(token_t::e_eof)) + { + if (!token_is(token_t::e_assign)) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR162 - Expected ':=' as part of vector definition", + exprtk_error_location)); + + return error_node(); + } + else if (token_is(token_t::e_lsqrbracket)) + { + expression_node_ptr initialiser_component = parse_expression(); + + if (0 == initialiser_component) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR163 - Failed to parse first component of vector initialiser for vector: " + vec_name, + exprtk_error_location)); + + return error_node(); + } + + vec_initilizer_list.push_back(initialiser_component); + + if (token_is(token_t::e_colon)) + { + initialiser_component = parse_expression(); + + if (0 == initialiser_component) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR164 - Failed to parse second component of vector initialiser for vector: " + vec_name, + exprtk_error_location)); + + return error_node(); + } + + vec_initilizer_list.push_back(initialiser_component); + } + + if (!token_is(token_t::e_rsqrbracket)) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR165 - Expected ']' to close single value vector initialiser", + exprtk_error_location)); + + return error_node(); + } + + switch (vec_initilizer_list.size()) + { + case 1 : single_value_initialiser = true; break; + case 2 : range_value_initialiser = true; break; + } + } + else if (!token_is(token_t::e_lcrlbracket)) + { + expression_node_ptr initialiser = error_node(); + + // Is this a vector to vector assignment and initialisation? + if (token_t::e_symbol == current_token().type) + { + // Is it a locally defined vector? + const scope_element& lcl_se = sem_.get_active_element(current_token().value); + + if (scope_element::e_vector == lcl_se.type) + { + if (0 != (initialiser = parse_expression())) + vec_initilizer_list.push_back(initialiser); + else + return error_node(); + } + // Are we dealing with a user defined vector? + else if (symtab_store_.is_vector(current_token().value)) + { + lodge_symbol(current_token().value, e_st_vector); + + if (0 != (initialiser = parse_expression())) + vec_initilizer_list.push_back(initialiser); + else + return error_node(); + } + // Are we dealing with a null initialisation vector definition? + else if (token_is(token_t::e_symbol,"null")) + null_initialisation = true; + } + + if (!null_initialisation) + { + if (0 == initialiser) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR166 - Expected '{' as part of vector initialiser list", + exprtk_error_location)); + + return error_node(); + } + else + vec_to_vec_initialiser = true; + } + } + else if (!token_is(token_t::e_rcrlbracket)) + { + for ( ; ; ) + { + expression_node_ptr initialiser = parse_expression(); + + if (0 == initialiser) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR167 - Expected '{' as part of vector initialiser list", + exprtk_error_location)); + + return error_node(); + } + else + vec_initilizer_list.push_back(initialiser); + + if (token_is(token_t::e_rcrlbracket)) + break; + + const bool is_next_close = peek_token_is(token_t::e_rcrlbracket); + + if (!token_is(token_t::e_comma) && is_next_close) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR168 - Expected ',' between vector initialisers", + exprtk_error_location)); + + return error_node(); + } + + if (token_is(token_t::e_rcrlbracket)) + break; + } + } + + if ( + !token_is(token_t::e_rbracket , prsrhlpr_t::e_hold) && + !token_is(token_t::e_rcrlbracket, prsrhlpr_t::e_hold) && + !token_is(token_t::e_rsqrbracket, prsrhlpr_t::e_hold) + ) + { + if (!token_is(token_t::e_eof)) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR169 - Expected ';' at end of vector definition", + exprtk_error_location)); + + return error_node(); + } + } + + if ( + !single_value_initialiser && + !range_value_initialiser && + (T(vec_initilizer_list.size()) > vector_size) + ) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR170 - Initialiser list larger than the number of elements in the vector: '" + vec_name + "'", + exprtk_error_location)); + + return error_node(); + } + } + expression_node_ptr result = error_node(); - if (null_initialisation) + if ( + (vec_initilizer_list.size() == 1) && + single_value_initialiser + ) + { + if (details::is_constant_node(vec_initilizer_list[0])) + { + // vector_init_zero_value_node var v[10] := [0] + if (T(0) == vec_initilizer_list[0]->value()) + { + result = node_allocator_ + .allocate >( + (*vec_holder)[0], + vec_size, + vec_initilizer_list); + } + else + { + // vector_init_single_constvalue_node var v[10] := [123] + result = node_allocator_ + .allocate >( + (*vec_holder)[0], + vec_size, + vec_initilizer_list); + } + } + else + { + // vector_init_single_value_node var v[10] := [123 + (x / y)] + result = node_allocator_ + .allocate >( + (*vec_holder)[0], + vec_size, + vec_initilizer_list); + } + } + else if ( + (vec_initilizer_list.size() == 2) && + range_value_initialiser + ) + { + bool base_const = details::is_constant_node(vec_initilizer_list[0]); + bool inc_const = details::is_constant_node(vec_initilizer_list[1]); + + if (base_const && inc_const) + { + // vector_init_single_value_node var v[10] := [1 : 3.5] + result = node_allocator_ + .allocate >( + (*vec_holder)[0], + vec_size, + vec_initilizer_list); + } + else if (base_const && !inc_const) + { + // vector_init_single_value_node var v[10] := [1 : x + y] + result = node_allocator_ + .allocate >( + (*vec_holder)[0], + vec_size, + vec_initilizer_list); + } + else if (!base_const && inc_const) + { + // vector_init_single_value_node var v[10] := [x + y : 3] + result = node_allocator_ + .allocate >( + (*vec_holder)[0], + vec_size, + vec_initilizer_list); + } + else if (!base_const && !inc_const) + { + // vector_init_single_value_node var v[10] := [x + y : z / w] + result = node_allocator_ + .allocate >( + (*vec_holder)[0], + vec_size, + vec_initilizer_list); + } + } + else if (null_initialisation) result = expression_generator_(T(0.0)); else if (vec_to_vec_initialiser) { @@ -26256,16 +29443,31 @@ namespace exprtk vec_initilizer_list[0]); } else + { result = node_allocator_ - .allocate >( + .allocate >( (*vec_holder)[0], vec_size, vec_initilizer_list, single_value_initialiser); + } - svd.delete_ptr = (0 == result); + svd.delete_ptr = false; - return result; + if (result && result->valid()) + { + return result; + } + + details::free_node(node_allocator_, result); + + set_error(make_error( + parser_error::e_synthesis, + current_token(), + "ERR171 - Failed to generate initialisation node for vector: " + vec_name, + exprtk_error_location)); + + return error_node(); } #ifndef exprtk_disable_string_capabilities @@ -26279,13 +29481,13 @@ namespace exprtk { if (se.active) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR163 - Illegal redefinition of local variable: '" + str_name + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR172 - Illegal redefinition of local variable: '" + str_name + "'", + exprtk_error_location)); - free_node(node_allocator_,initialisation_expression); + free_node(node_allocator_, initialisation_expression); return error_node(); } @@ -26311,13 +29513,13 @@ namespace exprtk if (!sem_.add_element(nse)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR164 - Failed to add new local string variable '" + str_name + "' to SEM", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR173 - Failed to add new local string variable '" + str_name + "' to SEM", + exprtk_error_location)); - free_node(node_allocator_,initialisation_expression); + free_node(node_allocator_, initialisation_expression); sem_.free_element(nse); @@ -26326,7 +29528,7 @@ namespace exprtk str_node = nse.str_node; - exprtk_debug(("parse_define_string_statement() - INFO - Added new local string variable: %s\n",nse.name.c_str())); + exprtk_debug(("parse_define_string_statement() - INFO - Added new local string variable: %s\n", nse.name.c_str())); } lodge_symbol(str_name, e_st_local_string); @@ -26357,11 +29559,11 @@ namespace exprtk { if (settings_.vardef_disabled()) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR165 - Illegal variable definition", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR174 - Illegal variable definition", + exprtk_error_location)); return error_node(); } @@ -26378,41 +29580,41 @@ namespace exprtk if (!token_is(token_t::e_symbol)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR166 - Expected a symbol for variable definition", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR175 - Expected a symbol for variable definition", + exprtk_error_location)); return error_node(); } else if (details::is_reserved_symbol(var_name)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR167 - Illegal redefinition of reserved keyword: '" + var_name + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR176 - Illegal redefinition of reserved keyword: '" + var_name + "'", + exprtk_error_location)); return error_node(); } else if (symtab_store_.symbol_exists(var_name)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR168 - Illegal redefinition of variable '" + var_name + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR177 - Illegal redefinition of variable '" + var_name + "'", + exprtk_error_location)); return error_node(); } else if (local_variable_is_shadowed(var_name)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR169 - Illegal redefinition of local variable: '" + var_name + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR178 - Illegal redefinition of local variable: '" + var_name + "'", + exprtk_error_location)); return error_node(); } @@ -26428,11 +29630,11 @@ namespace exprtk { if (0 == (initialisation_expression = parse_expression())) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR170 - Failed to parse initialisation expression", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR179 - Failed to parse initialisation expression", + exprtk_error_location)); return error_node(); } @@ -26446,13 +29648,13 @@ namespace exprtk { if (!token_is(token_t::e_eof,prsrhlpr_t::e_hold)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR171 - Expected ';' after variable definition", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR180 - Expected ';' after variable definition", + exprtk_error_location)); - free_node(node_allocator_,initialisation_expression); + free_node(node_allocator_, initialisation_expression); return error_node(); } @@ -26474,11 +29676,11 @@ namespace exprtk { if (se.active) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR172 - Illegal redefinition of local variable: '" + var_name + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR181 - Illegal redefinition of local variable: '" + var_name + "'", + exprtk_error_location)); free_node(node_allocator_, initialisation_expression); @@ -26506,11 +29708,11 @@ namespace exprtk if (!sem_.add_element(nse)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR173 - Failed to add new local variable '" + var_name + "' to SEM", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR182 - Failed to add new local variable '" + var_name + "' to SEM", + exprtk_error_location)); free_node(node_allocator_, initialisation_expression); @@ -26521,7 +29723,7 @@ namespace exprtk var_node = nse.var_node; - exprtk_debug(("parse_define_var_statement() - INFO - Added new local variable: %s\n",nse.name.c_str())); + exprtk_debug(("parse_define_var_statement() - INFO - Added new local variable: %s\n", nse.name.c_str())); } state_.activate_side_effect("parse_define_var_statement()"); @@ -26536,6 +29738,174 @@ namespace exprtk return expression_generator_(details::e_assign,branch); } + inline expression_node_ptr parse_define_constvar_statement() + { + if (settings_.vardef_disabled()) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR183 - Illegal const variable definition", + exprtk_error_location)); + + return error_node(); + } + else if (!token_is("const")) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR184 - Expected 'const' keyword for const-variable definition", + exprtk_error_location)); + + return error_node(); + } + else if (!token_is("var")) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR185 - Expected 'var' keyword for const-variable definition", + exprtk_error_location)); + + return error_node(); + } + + const std::string var_name = current_token().value; + + expression_node_ptr initialisation_expression = error_node(); + + if (!token_is(token_t::e_symbol)) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR186 - Expected a symbol for const-variable definition", + exprtk_error_location)); + + return error_node(); + } + else if (details::is_reserved_symbol(var_name)) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR187 - Illegal redefinition of reserved keyword: '" + var_name + "'", + exprtk_error_location)); + + return error_node(); + } + else if (symtab_store_.symbol_exists(var_name)) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR188 - Illegal redefinition of variable '" + var_name + "'", + exprtk_error_location)); + + return error_node(); + } + else if (local_variable_is_shadowed(var_name)) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR189 - Illegal redefinition of local variable: '" + var_name + "'", + exprtk_error_location)); + + return error_node(); + } + else if (token_is(token_t::e_assign)) + { + if (0 == (initialisation_expression = parse_expression())) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR190 - Failed to parse initialisation expression for const-variable: '" + var_name + "'", + exprtk_error_location)); + + return error_node(); + } + else if (!details::is_literal_node(initialisation_expression)) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR191 - initialisation expression for const-variable: '" + var_name + "' must be a constant/literal", + exprtk_error_location)); + + free_node(node_allocator_, initialisation_expression); + + return error_node(); + } + } + + const T init_value = initialisation_expression->value(); + + free_node(node_allocator_, initialisation_expression); + + expression_node_ptr var_node = reinterpret_cast(0); + + scope_element& se = sem_.get_element(var_name); + + if (se.name == var_name) + { + if (se.active) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR192 - Illegal redefinition of local variable: '" + var_name + "'", + exprtk_error_location)); + + return error_node(); + } + else if (scope_element::e_literal == se.type) + { + var_node = se.var_node; + se.active = true; + se.depth = state_.scope_depth; + se.ref_count++; + } + } + + if (0 == var_node) + { + scope_element nse; + nse.name = var_name; + nse.active = true; + nse.ref_count = 1; + nse.type = scope_element::e_literal; + nse.depth = state_.scope_depth; + nse.data = 0; + nse.var_node = node_allocator_.allocate(init_value); + + if (!sem_.add_element(nse)) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR193 - Failed to add new local const-variable '" + var_name + "' to SEM", + exprtk_error_location)); + + sem_.free_element(nse); + + return error_node(); + } + + var_node = nse.var_node; + + exprtk_debug(("parse_define_constvar_statement() - INFO - Added new local const-variable: %s\n", nse.name.c_str())); + } + + state_.activate_side_effect("parse_define_constvar_statement()"); + + lodge_symbol(var_name, e_st_local_variable); + + return expression_generator_(var_node->value()); + } + inline expression_node_ptr parse_uninitialised_var_statement(const std::string& var_name) { if ( @@ -26543,21 +29913,21 @@ namespace exprtk !token_is(token_t::e_rcrlbracket) ) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR174 - Expected a '{}' for uninitialised var definition", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR194 - Expected a '{}' for uninitialised var definition", + exprtk_error_location)); return error_node(); } else if (!token_is(token_t::e_eof,prsrhlpr_t::e_hold)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR175 - Expected ';' after uninitialised variable definition", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR195 - Expected ';' after uninitialised variable definition", + exprtk_error_location)); return error_node(); } @@ -26570,11 +29940,11 @@ namespace exprtk { if (se.active) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR176 - Illegal redefinition of local variable: '" + var_name + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR196 - Illegal redefinition of local variable: '" + var_name + "'", + exprtk_error_location)); return error_node(); } @@ -26600,11 +29970,11 @@ namespace exprtk if (!sem_.add_element(nse)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR177 - Failed to add new local variable '" + var_name + "' to SEM", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR197 - Failed to add new local variable '" + var_name + "' to SEM", + exprtk_error_location)); sem_.free_element(nse); @@ -26633,11 +30003,11 @@ namespace exprtk if (!token_is(token_t::e_lbracket)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR178 - Expected '(' at start of swap statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR198 - Expected '(' at start of swap statement", + exprtk_error_location)); return error_node(); } @@ -26652,11 +30022,11 @@ namespace exprtk if (!token_is(token_t::e_symbol,prsrhlpr_t::e_hold)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR179 - Expected a symbol for variable or vector element definition", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR199 - Expected a symbol for variable or vector element definition", + exprtk_error_location)); return error_node(); } @@ -26664,11 +30034,11 @@ namespace exprtk { if (0 == (variable0 = parse_vector())) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR180 - First parameter to swap is an invalid vector element: '" + var0_name + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR200 - First parameter to swap is an invalid vector element: '" + var0_name + "'", + exprtk_error_location)); return error_node(); } @@ -26697,11 +30067,11 @@ namespace exprtk if (0 == variable0) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR181 - First parameter to swap is an invalid variable: '" + var0_name + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR201 - First parameter to swap is an invalid variable: '" + var0_name + "'", + exprtk_error_location)); return error_node(); } @@ -26711,15 +30081,15 @@ namespace exprtk if (!token_is(token_t::e_comma)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR182 - Expected ',' between parameters to swap", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR202 - Expected ',' between parameters to swap", + exprtk_error_location)); if (variable0_generated) { - free_node(node_allocator_,variable0); + free_node(node_allocator_, variable0); } return error_node(); @@ -26729,15 +30099,15 @@ namespace exprtk if (!token_is(token_t::e_symbol,prsrhlpr_t::e_hold)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR183 - Expected a symbol for variable or vector element definition", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR203 - Expected a symbol for variable or vector element definition", + exprtk_error_location)); if (variable0_generated) { - free_node(node_allocator_,variable0); + free_node(node_allocator_, variable0); } return error_node(); @@ -26746,15 +30116,15 @@ namespace exprtk { if (0 == (variable1 = parse_vector())) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR184 - Second parameter to swap is an invalid vector element: '" + var1_name + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR204 - Second parameter to swap is an invalid vector element: '" + var1_name + "'", + exprtk_error_location)); if (variable0_generated) { - free_node(node_allocator_,variable0); + free_node(node_allocator_, variable0); } return error_node(); @@ -26784,15 +30154,15 @@ namespace exprtk if (0 == variable1) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR185 - Second parameter to swap is an invalid variable: '" + var1_name + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR205 - Second parameter to swap is an invalid variable: '" + var1_name + "'", + exprtk_error_location)); if (variable0_generated) { - free_node(node_allocator_,variable0); + free_node(node_allocator_, variable0); } return error_node(); @@ -26803,20 +30173,20 @@ namespace exprtk if (!token_is(token_t::e_rbracket)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR186 - Expected ')' at end of swap statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR206 - Expected ')' at end of swap statement", + exprtk_error_location)); if (variable0_generated) { - free_node(node_allocator_,variable0); + free_node(node_allocator_, variable0); } if (variable1_generated) { - free_node(node_allocator_,variable1); + free_node(node_allocator_, variable1); } return error_node(); @@ -26838,12 +30208,12 @@ namespace exprtk if (variable0_generated) { - free_node(node_allocator_,variable0); + free_node(node_allocator_, variable0); } if (variable1_generated) { - free_node(node_allocator_,variable1); + free_node(node_allocator_, variable1); } } else @@ -26860,11 +30230,11 @@ namespace exprtk { if (state_.parsing_return_stmt) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR187 - Return call within a return call is not allowed", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR207 - Return call within a return call is not allowed", + exprtk_error_location)); return error_node(); } @@ -26884,11 +30254,11 @@ namespace exprtk if (!token_is(token_t::e_lsqrbracket)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR188 - Expected '[' at start of return statement", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR208 - Expected '[' at start of return statement", + exprtk_error_location)); return error_node(); } @@ -26907,11 +30277,11 @@ namespace exprtk break; else if (!token_is(token_t::e_comma)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR189 - Expected ',' between values during call to return", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR209 - Expected ',' between values during call to return", + exprtk_error_location)); return error_node(); } @@ -26919,11 +30289,11 @@ namespace exprtk } else if (settings_.zero_return_disabled()) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR190 - Zero parameter return statement not allowed", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR210 - Zero parameter return statement not allowed", + exprtk_error_location)); return error_node(); } @@ -26934,11 +30304,11 @@ namespace exprtk { if (!arg_list.empty()) { - set_error( - make_error(parser_error::e_syntax, - prev_token, - "ERR191 - Invalid ']' found during return call", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + prev_token, + "ERR211 - Invalid ']' found during return call", + exprtk_error_location)); return error_node(); } @@ -26977,6 +30347,194 @@ namespace exprtk } #endif + inline expression_node_ptr parse_assert_statement() + { + assert(details::imatch(current_token().value, "assert")); + + if (state_.parsing_assert_stmt) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR212 - Assert statement within an assert statement is not allowed", + exprtk_error_location)); + + return error_node(); + } + + scoped_bool_negator sbn(state_.parsing_assert_stmt); + + next_token(); + + std::vector assert_arg_list(3, error_node()); + scoped_vec_delete sdd((*this), assert_arg_list); + + expression_node_ptr& assert_condition = assert_arg_list[0]; + expression_node_ptr& assert_message = assert_arg_list[1]; + expression_node_ptr& assert_id = assert_arg_list[2]; + + if (!token_is(token_t::e_lbracket)) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR213 - Expected '(' at start of assert statement", + exprtk_error_location)); + + return error_node(); + } + + const token_t start_token = current_token(); + + // Parse the assert condition + if (0 == (assert_condition = parse_expression())) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR214 - Failed to parse condition for assert statement", + exprtk_error_location)); + + return error_node(); + } + + const token_t end_token = current_token(); + + if (!token_is(token_t::e_rbracket)) + { + if (!token_is(token_t::e_comma)) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR215 - Expected ',' between condition and message for assert statement", + exprtk_error_location)); + + return error_node(); + } + // Parse the assert message + else if ( + (0 == (assert_message = parse_expression())) || + !details::is_generally_string_node(assert_message) + ) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR216 - " + + (assert_message ? + std::string("Expected string for assert message") : + std::string("Failed to parse message for assert statement")), + exprtk_error_location)); + + return error_node(); + } + else if (!token_is(token_t::e_rbracket)) + { + if (!token_is(token_t::e_comma)) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR217 - Expected ',' between message and ID for assert statement", + exprtk_error_location)); + + return error_node(); + } + // Parse assert ID + else if ( + (0 == (assert_id = parse_expression())) || + !details::is_const_string_node(assert_id) + ) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR218 - " + + (assert_id ? + std::string("Expected literal string for assert ID") : + std::string("Failed to parse string for assert ID")), + exprtk_error_location)); + + return error_node(); + } + else if (!token_is(token_t::e_rbracket)) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR219 - Expected ')' at start of assert statement", + exprtk_error_location)); + + return error_node(); + } + } + } + + exprtk::assert_check::assert_context context; + context.condition = lexer().substr(start_token.position, end_token.position); + context.offet = start_token.position; + + if (0 == assert_check_) + { + exprtk_debug(("parse_assert_statement() - assert functionality is disabled. assert condition: %s\n", + context.condition.c_str())); + + return new details::null_node(); + } + + #ifndef exprtk_disable_string_capabilities + if (assert_message && details::is_const_string_node(assert_message)) + { + context.message = dynamic_cast*>(assert_message)->str(); + } + + if (assert_id && details::is_const_string_node(assert_id)) + { + context.id = dynamic_cast*>(assert_id)->str(); + + if (assert_ids_.end() != assert_ids_.find(context.id)) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR220 - Duplicate assert ID: " + context.id, + exprtk_error_location)); + + return error_node(); + } + + assert_ids_.insert(context.id); + free_node(node_allocator_, assert_id); + } + #endif + + expression_node_ptr result_node = + expression_generator_.assert_call( + assert_condition, + assert_message, + context); + + exprtk_debug(("parse_assert_statement() - assert condition: [%s]\n", context.condition.c_str() )); + exprtk_debug(("parse_assert_statement() - assert message: [%s]\n", context.message .c_str() )); + exprtk_debug(("parse_assert_statement() - assert id: [%s]\n", context.id .c_str() )); + exprtk_debug(("parse_assert_statement() - assert offset: [%d]\n", static_cast(context.offet))); + + if (0 == result_node) + { + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR221 - Failed to synthesize assert", + exprtk_error_location)); + + return error_node(); + } + + sdd.delete_ptr = false; + return result_node; + } + inline bool post_variable_process(const std::string& symbol) { if ( @@ -26987,11 +30545,11 @@ namespace exprtk { if (!settings_.commutative_check_enabled()) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR192 - Invalid sequence of variable '" + symbol + "' and bracket", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR222 - Invalid sequence of variable '" + symbol + "' and bracket", + exprtk_error_location)); return false; } @@ -27013,19 +30571,19 @@ namespace exprtk switch (token) { - case token_t::e_lcrlbracket : implied_mul = token_is(token_t::e_lbracket ,hold) || - token_is(token_t::e_lcrlbracket,hold) || - token_is(token_t::e_lsqrbracket,hold) ; + case token_t::e_lcrlbracket : implied_mul = token_is(token_t::e_lbracket , hold) || + token_is(token_t::e_lcrlbracket, hold) || + token_is(token_t::e_lsqrbracket, hold) ; break; - case token_t::e_lbracket : implied_mul = token_is(token_t::e_lbracket ,hold) || - token_is(token_t::e_lcrlbracket,hold) || - token_is(token_t::e_lsqrbracket,hold) ; + case token_t::e_lbracket : implied_mul = token_is(token_t::e_lbracket , hold) || + token_is(token_t::e_lcrlbracket, hold) || + token_is(token_t::e_lsqrbracket, hold) ; break; - case token_t::e_lsqrbracket : implied_mul = token_is(token_t::e_lbracket ,hold) || - token_is(token_t::e_lcrlbracket,hold) || - token_is(token_t::e_lsqrbracket,hold) ; + case token_t::e_lsqrbracket : implied_mul = token_is(token_t::e_lbracket , hold) || + token_is(token_t::e_lcrlbracket, hold) || + token_is(token_t::e_lsqrbracket, hold) ; break; default : return true; @@ -27035,11 +30593,11 @@ namespace exprtk { if (!settings_.commutative_check_enabled()) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR193 - Invalid sequence of brackets", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR223 - Invalid sequence of brackets", + exprtk_error_location)); return false; } @@ -27122,7 +30680,10 @@ namespace exprtk if (se.active && details::imatch(se.name, symbol)) { - if (scope_element::e_variable == se.type) + if ( + (scope_element::e_variable == se.type) || + (scope_element::e_literal == se.type) + ) { se.active = true; lodge_symbol(symbol, e_st_local_variable); @@ -27132,7 +30693,9 @@ namespace exprtk next_token(); - return se.var_node; + return (scope_element::e_variable == se.type) ? + se.var_node : + expression_generator_(se.var_node->value()); } else if (scope_element::e_vector == se.type) { @@ -27170,11 +30733,11 @@ namespace exprtk return func_node; else { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR194 - Failed to generate node for function: '" + symbol + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR224 - Failed to generate node for function: '" + symbol + "'", + exprtk_error_location)); return error_node(); } @@ -27196,11 +30759,11 @@ namespace exprtk return vararg_func_node; else { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR195 - Failed to generate node for vararg function: '" + symbol + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR225 - Failed to generate node for vararg function: '" + symbol + "'", + exprtk_error_location)); return error_node(); } @@ -27222,11 +30785,11 @@ namespace exprtk return genericfunc_node; else { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR196 - Failed to generate node for generic function: '" + symbol + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR226 - Failed to generate node for generic function: '" + symbol + "'", + exprtk_error_location)); return error_node(); } @@ -27249,11 +30812,11 @@ namespace exprtk return stringfunc_node; else { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR197 - Failed to generate node for string function: '" + symbol + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR227 - Failed to generate node for string function: '" + symbol + "'", + exprtk_error_location)); return error_node(); } @@ -27275,11 +30838,11 @@ namespace exprtk return overloadfunc_node; else { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR198 - Failed to generate node for overload function: '" + symbol + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR228 - Failed to generate node for overload function: '" + symbol + "'", + exprtk_error_location)); return error_node(); } @@ -27301,11 +30864,11 @@ namespace exprtk !details::is_base_function(symbol) ) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR199 - Invalid use of reserved symbol '" + symbol + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR229 - Invalid use of reserved symbol '" + symbol + "'", + exprtk_error_location)); return error_node(); } @@ -27332,11 +30895,13 @@ namespace exprtk switch (usr_symbol_type) { - case unknown_symbol_resolver::e_usr_variable_type : create_result = symtab.create_variable(symbol, default_value); - break; + case unknown_symbol_resolver::e_usr_variable_type : + create_result = symtab.create_variable(symbol, default_value); + break; - case unknown_symbol_resolver::e_usr_constant_type : create_result = symtab.add_constant(symbol, default_value); - break; + case unknown_symbol_resolver::e_usr_constant_type : + create_result = symtab.add_constant(symbol, default_value); + break; default : create_result = false; } @@ -27364,12 +30929,12 @@ namespace exprtk } } - set_error( - make_error(parser_error::e_symtab, - current_token(), - "ERR200 - Failed to create variable: '" + symbol + "'" + - (error_message.empty() ? "" : " - " + error_message), - exprtk_error_location)); + set_error(make_error( + parser_error::e_symtab, + current_token(), + "ERR230 - Failed to create variable: '" + symbol + "'" + + (error_message.empty() ? "" : " - " + error_message), + exprtk_error_location)); } else if (unknown_symbol_resolver::e_usrmode_extended == unknown_symbol_resolver_->mode) @@ -27384,23 +30949,23 @@ namespace exprtk } } - set_error( - make_error(parser_error::e_symtab, - current_token(), - "ERR201 - Failed to resolve symbol: '" + symbol + "'" + - (error_message.empty() ? "" : " - " + error_message), - exprtk_error_location)); + set_error(make_error( + parser_error::e_symtab, + current_token(), + "ERR231 - Failed to resolve symbol: '" + symbol + "'" + + (error_message.empty() ? "" : " - " + error_message), + exprtk_error_location)); } return error_node(); } } - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR202 - Undefined symbol: '" + symbol + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR232 - Undefined symbol: '" + symbol + "'", + exprtk_error_location)); return error_node(); } @@ -27416,9 +30981,11 @@ namespace exprtk static const std::string symbol_break = "break" ; static const std::string symbol_continue = "continue"; static const std::string symbol_var = "var" ; + static const std::string symbol_const = "const" ; static const std::string symbol_swap = "swap" ; static const std::string symbol_return = "return" ; static const std::string symbol_not = "not" ; + static const std::string symbol_assert = "assert" ; const std::string symbol = current_token().value; @@ -27491,6 +31058,10 @@ namespace exprtk { return parse_define_var_statement(); } + else if (details::imatch(symbol, symbol_const)) + { + return parse_define_constvar_statement(); + } else if (details::imatch(symbol, symbol_swap)) { return parse_swap_statement(); @@ -27504,17 +31075,22 @@ namespace exprtk return parse_return_statement(); } #endif + else if (details::imatch(symbol, symbol_assert)) + { + return parse_assert_statement(); + } else if (symtab_store_.valid() || !sem_.empty()) { return parse_symtab_symbol(); } else { - set_error( - make_error(parser_error::e_symtab, - current_token(), - "ERR203 - Variable or function detected, yet symbol-table is invalid, Symbol: " + symbol, - exprtk_error_location)); + set_error(make_error( + parser_error::e_symtab, + current_token(), + "ERR233 - Unknown variable or function encountered. Symbol table(s) " + "is either invalid or does not contain symbol: '" + symbol + "'", + exprtk_error_location)); return error_node(); } @@ -27541,11 +31117,11 @@ namespace exprtk if (0 == literal_exp) { - set_error( - make_error(parser_error::e_numeric, - current_token(), - "ERR204 - Failed generate node for scalar: '" + current_token().value + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_numeric, + current_token(), + "ERR234 - Failed generate node for scalar: '" + current_token().value + "'", + exprtk_error_location)); return error_node(); } @@ -27555,11 +31131,11 @@ namespace exprtk } else { - set_error( - make_error(parser_error::e_numeric, - current_token(), - "ERR205 - Failed to convert '" + current_token().value + "' to a number", - exprtk_error_location)); + set_error(make_error( + parser_error::e_numeric, + current_token(), + "ERR235 - Failed to convert '" + current_token().value + "' to a number", + exprtk_error_location)); return error_node(); } @@ -27580,24 +31156,28 @@ namespace exprtk if (0 == (branch = parse_expression())) return error_node(); + else if (token_is(token_t::e_eof)) + {} else if (!token_is(token_t::e_rbracket)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR206 - Expected ')' instead of: '" + current_token().value + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR236 - Expected ')' instead of: '" + current_token().value + "'", + exprtk_error_location)); - details::free_node(node_allocator_,branch); + details::free_node(node_allocator_, branch); return error_node(); } else if (!post_bracket_process(token_t::e_lbracket,branch)) { - details::free_node(node_allocator_,branch); + details::free_node(node_allocator_, branch); return error_node(); } + + parse_pending_vector_index_operator(branch); } else if (token_t::e_lsqrbracket == current_token().type) { @@ -27607,19 +31187,19 @@ namespace exprtk return error_node(); else if (!token_is(token_t::e_rsqrbracket)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR207 - Expected ']' instead of: '" + current_token().value + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR237 - Expected ']' instead of: '" + current_token().value + "'", + exprtk_error_location)); - details::free_node(node_allocator_,branch); + details::free_node(node_allocator_, branch); return error_node(); } else if (!post_bracket_process(token_t::e_lsqrbracket,branch)) { - details::free_node(node_allocator_,branch); + details::free_node(node_allocator_, branch); return error_node(); } @@ -27632,19 +31212,19 @@ namespace exprtk return error_node(); else if (!token_is(token_t::e_rcrlbracket)) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR208 - Expected '}' instead of: '" + current_token().value + "'", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR238 - Expected '}' instead of: '" + current_token().value + "'", + exprtk_error_location)); - details::free_node(node_allocator_,branch); + details::free_node(node_allocator_, branch); return error_node(); } else if (!post_bracket_process(token_t::e_lcrlbracket,branch)) { - details::free_node(node_allocator_,branch); + details::free_node(node_allocator_, branch); return error_node(); } @@ -27666,7 +31246,7 @@ namespace exprtk if (0 == result) { - details::free_node(node_allocator_,branch); + details::free_node(node_allocator_, branch); return error_node(); } @@ -27681,21 +31261,21 @@ namespace exprtk } else if (token_t::e_eof == current_token().type) { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR209 - Premature end of expression[1]", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR239 - Premature end of expression[1]", + exprtk_error_location)); return error_node(); } else { - set_error( - make_error(parser_error::e_syntax, - current_token(), - "ERR210 - Premature end of expression[2]", - exprtk_error_location)); + set_error(make_error( + parser_error::e_syntax, + current_token(), + "ERR240 - Premature end of expression[2]", + exprtk_error_location)); return error_node(); } @@ -27796,6 +31376,8 @@ namespace exprtk register_synthezier(synthesize_covocov_expression4) register_synthezier(synthesize_vocovoc_expression4) register_synthezier(synthesize_covovoc_expression4) + + #undef register_synthezier #endif } @@ -27848,7 +31430,7 @@ namespace exprtk { typename binary_op_map_t::iterator bop_itr = binary_op_map_->find(operation); - if ((*binary_op_map_).end() == bop_itr) + if (binary_op_map_->end() == bop_itr) return false; bop = bop_itr->second; @@ -28260,13 +31842,20 @@ namespace exprtk if (details::is_string_node(branch[0])) return !b1_is_genstring; + else if (details::is_literal_node(branch[0])) + return true; else return ( - !details::is_variable_node (branch[0]) && - !details::is_vector_elem_node (branch[0]) && - !details::is_rebasevector_elem_node (branch[0]) && - !details::is_rebasevector_celem_node(branch[0]) && - !details::is_vector_node (branch[0]) + !details::is_variable_node (branch[0]) && + !details::is_vector_elem_node (branch[0]) && + !details::is_vector_celem_node (branch[0]) && + !details::is_vector_elem_rtc_node (branch[0]) && + !details::is_vector_celem_rtc_node (branch[0]) && + !details::is_rebasevector_elem_node (branch[0]) && + !details::is_rebasevector_celem_node (branch[0]) && + !details::is_rebasevector_elem_rtc_node (branch[0]) && + !details::is_rebasevector_celem_rtc_node(branch[0]) && + !details::is_vector_node (branch[0]) ) || b1_is_genstring; } @@ -28421,18 +32010,42 @@ namespace exprtk { if ((0 == branch[0]) || (0 == branch[1])) { + parser_->set_error(parser_error::make_error( + parser_error::e_syntax, + parser_->current_state().token, + "ERR241 - Invalid branches received for operator '" + details::to_str(operation) + "'", + exprtk_error_location)); + return error_node(); } else if (is_invalid_string_op(operation,branch)) { + parser_->set_error(parser_error::make_error( + parser_error::e_syntax, + parser_->current_state().token, + "ERR242 - Invalid branch pair for string operator '" + details::to_str(operation) + "'", + exprtk_error_location)); + return error_node(); } else if (is_invalid_assignment_op(operation,branch)) { + parser_->set_error(parser_error::make_error( + parser_error::e_syntax, + parser_->current_state().token, + "ERR243 - Invalid branch pair for assignment operator '" + details::to_str(operation) + "'", + exprtk_error_location)); + return error_node(); } else if (is_invalid_break_continue_op(branch)) { + parser_->set_error(parser_error::make_error( + parser_error::e_syntax, + parser_->current_state().token, + "ERR244 - Invalid branch pair for break/continue operator '" + details::to_str(operation) + "'", + exprtk_error_location)); + return error_node(); } else if (details::e_assign == operation) @@ -28551,10 +32164,22 @@ namespace exprtk { details::free_all_nodes(*node_allocator_,branch); + parser_->set_error(parser_error::make_error( + parser_error::e_syntax, + parser_->current_state().token, + "ERR245 - Invalid branches operator '" + details::to_str(operation) + "'", + exprtk_error_location)); + return error_node(); } else if (is_invalid_string_op(operation, branch)) { + parser_->set_error(parser_error::make_error( + parser_error::e_syntax, + parser_->current_state().token, + "ERR246 - Invalid branches for string operator '" + details::to_str(operation) + "'", + exprtk_error_location)); + return error_node(); } else if (is_string_operation(operation, branch)) @@ -28601,6 +32226,16 @@ namespace exprtk details::free_node(*node_allocator_, consequent ); details::free_node(*node_allocator_, alternative); + const std::string invalid_branches = + ((0 == condition ) ? std::string("condition ") : "") + + ((0 == consequent) ? std::string("consequent") : "") ; + + parser_->set_error(parser_error::make_error( + parser_error::e_parser, + parser_->current_state().token, + "ERR247 - Invalid " + invalid_branches + " for conditional statement", + exprtk_error_location)); + return error_node(); } // Can the condition be immediately evaluated? if so optimise. @@ -28626,14 +32261,34 @@ namespace exprtk return node_allocator_->allocate >(); } } - else if ((0 != consequent) && (0 != alternative)) + + expression_node_ptr result = error_node(); + std::string node_name = "Unknown!"; + + if ((0 != consequent) && (0 != alternative)) { - return node_allocator_-> - allocate(condition, consequent, alternative); + result = node_allocator_->allocate(condition, consequent, alternative); + node_name = "conditional_node_t"; } else - return node_allocator_-> - allocate(condition, consequent); + { + result = node_allocator_->allocate(condition, consequent); + node_name = "cons_conditional_node_t"; + } + + if (result && result->valid()) + { + return result; + } + + parser_->set_error(parser_error::make_error( + parser_error::e_parser, + token_t(), + "ERR248 - Failed to synthesize node: " + node_name, + exprtk_error_location)); + + details::free_node(*node_allocator_, result); + return error_node(); } #ifndef exprtk_disable_string_capabilities @@ -28647,6 +32302,16 @@ namespace exprtk details::free_node(*node_allocator_, consequent ); details::free_node(*node_allocator_, alternative); + const std::string invalid_branches = + ((0 == condition ) ? std::string("condition ") : "") + + ((0 == consequent) ? std::string("consequent") : "") ; + + parser_->set_error(parser_error::make_error( + parser_error::e_parser, + parser_->current_state().token, + "ERR249 - Invalid " + invalid_branches + " for string conditional statement", + exprtk_error_location)); + return error_node(); } // Can the condition be immediately evaluated? if so optimise. @@ -28674,10 +32339,25 @@ namespace exprtk } } else if ((0 != consequent) && (0 != alternative)) - return node_allocator_-> - allocate(condition, consequent, alternative); - else - return error_node(); + { + expression_node_ptr result = + node_allocator_->allocate(condition, consequent, alternative); + + if (result && result->valid()) + { + return result; + } + + parser_->set_error(parser_error::make_error( + parser_error::e_parser, + token_t(), + "ERR250 - Failed to synthesize node: conditional_string_node_t", + exprtk_error_location)); + + details::free_node(*node_allocator_, result); + } + + return error_node(); } #else inline expression_node_ptr conditional_string(expression_node_ptr, @@ -28698,6 +32378,16 @@ namespace exprtk details::free_node(*node_allocator_, consequent ); details::free_node(*node_allocator_, alternative); + const std::string invalid_branches = + ((0 == condition ) ? std::string("condition ") : "") + + ((0 == consequent) ? std::string("consequent") : "") ; + + parser_->set_error(parser_error::make_error( + parser_error::e_parser, + parser_->current_state().token, + "ERR251 - Invalid " + invalid_branches + " for vector conditional statement", + exprtk_error_location)); + return error_node(); } // Can the condition be immediately evaluated? if so optimise. @@ -28746,16 +32436,34 @@ namespace exprtk return loop_runtime_check_ptr(0); } + inline vector_access_runtime_check_ptr get_vector_access_runtime_check() const + { + return parser_->vector_access_runtime_check_; + } + inline expression_node_ptr while_loop(expression_node_ptr& condition, expression_node_ptr& branch, const bool break_continue_present = false) const { - if (!break_continue_present && details::is_constant_node(condition)) + if ( + !break_continue_present && + !parser_->state_.return_stmt_present && + details::is_constant_node(condition) + ) { expression_node_ptr result = error_node(); if (details::is_true(condition)) + { // Infinite loops are not allowed. + + parser_->set_error(parser_error::make_error( + parser_error::e_parser, + parser_->current_state().token, + "ERR252 - Infinite loop condition without 'break' or 'return' not allowed in while-loops", + exprtk_error_location)); + result = error_node(); + } else result = node_allocator_->allocate >(); @@ -28857,13 +32565,26 @@ namespace exprtk expression_node_ptr& loop_body, bool break_continue_present = false) const { - if (!break_continue_present && details::is_constant_node(condition)) + if ( + !break_continue_present && + !parser_->state_.return_stmt_present && + details::is_constant_node(condition) + ) { expression_node_ptr result = error_node(); if (details::is_true(condition)) + { // Infinite loops are not allowed. + + parser_->set_error(parser_error::make_error( + parser_error::e_parser, + parser_->current_state().token, + "ERR253 - Infinite loop condition without 'break' or 'return' not allowed in for-loop", + exprtk_error_location)); + result = error_node(); + } else result = node_allocator_->allocate >(); @@ -28890,19 +32611,19 @@ namespace exprtk if (rtc) return node_allocator_->allocate ( - initialiser, - condition, - incrementor, - loop_body, - rtc + initialiser, + condition, + incrementor, + loop_body, + rtc ); else return node_allocator_->allocate ( - initialiser, - condition, - incrementor, - loop_body + initialiser, + condition, + incrementor, + loop_body ); } #ifndef exprtk_disable_break_continue @@ -28911,19 +32632,19 @@ namespace exprtk if (rtc) return node_allocator_->allocate ( - initialiser, - condition, - incrementor, - loop_body, - rtc + initialiser, + condition, + incrementor, + loop_body, + rtc ); else return node_allocator_->allocate ( - initialiser, - condition, - incrementor, - loop_body + initialiser, + condition, + incrementor, + loop_body ); } #else @@ -28986,8 +32707,8 @@ namespace exprtk if (0 == result) { - T zero = T(0); - result = node_allocator_->allocate(zero); + const T zero = T(0); + result = node_allocator_->allocate(zero); } for (std::size_t i = 0; i < arg_list.size(); ++i) @@ -29161,6 +32882,28 @@ namespace exprtk return node_allocator_->allocate >(arg_list); } + inline expression_node_ptr assert_call(expression_node_ptr& assert_condition, + expression_node_ptr& assert_message, + const assert_check::assert_context& context) + { + typedef details::assert_node alloc_type; + + expression_node_ptr result = node_allocator_->allocate_rrrr + (assert_condition, assert_message, parser_->assert_check_, context); + + if (result && result->valid()) + { + parser_->state_.activate_side_effect("assert_call()"); + return result; + } + + details::free_node(*node_allocator_, result ); + details::free_node(*node_allocator_, assert_condition); + details::free_node(*node_allocator_, assert_message ); + + return error_node(); + } + #define unary_opr_switch_statements \ case_stmt(details::e_abs , details::abs_op ) \ case_stmt(details::e_acos , details::acos_op ) \ @@ -29280,6 +33023,8 @@ namespace exprtk default : return error_node(); } + assert(temp_node); + const T v = temp_node->value(); details::free_node(*node_allocator_,temp_node); @@ -29383,6 +33128,8 @@ namespace exprtk default : return error_node(); } + assert(temp_node); + const T v = temp_node->value(); details::free_node(*node_allocator_,temp_node); @@ -29503,7 +33250,8 @@ namespace exprtk template class Sequence> - inline expression_node_ptr varnode_optimise_varargfunc(const details::operator_type& operation, Sequence& arg_list) + inline expression_node_ptr varnode_optimise_varargfunc(const details::operator_type& operation, + Sequence& arg_list) { switch (operation) { @@ -29526,7 +33274,8 @@ namespace exprtk template class Sequence> - inline expression_node_ptr vectorize_func(const details::operator_type& operation, Sequence& arg_list) + inline expression_node_ptr vectorize_func(const details::operator_type& operation, + Sequence& arg_list) { if (1 == arg_list.size()) { @@ -29551,7 +33300,8 @@ namespace exprtk template class Sequence> - inline expression_node_ptr vararg_function(const details::operator_type& operation, Sequence& arg_list) + inline expression_node_ptr vararg_function(const details::operator_type& operation, + Sequence& arg_list) { if (!all_nodes_valid(arg_list)) { @@ -29561,9 +33311,9 @@ namespace exprtk } else if (is_constant_foldable(arg_list)) return const_optimise_varargfunc(operation,arg_list); - else if ((arg_list.size() == 1) && details::is_ivector_node(arg_list[0])) + else if ((1 == arg_list.size()) && details::is_ivector_node(arg_list[0])) return vectorize_func(operation,arg_list); - else if ((arg_list.size() == 1) && special_one_parameter_vararg(operation)) + else if ((1 == arg_list.size()) && special_one_parameter_vararg(operation)) return arg_list[0]; else if (all_nodes_variables(arg_list)) return varnode_optimise_varargfunc(operation,arg_list); @@ -29571,17 +33321,32 @@ namespace exprtk #ifndef exprtk_disable_string_capabilities if (details::e_smulti == operation) { - return node_allocator_-> + expression_node_ptr result = node_allocator_-> allocate > >(arg_list); + if (result && result->valid()) + { + return result; + } + + parser_->set_error(parser_error::make_error( + parser_error::e_synthesis, + token_t(), + "ERR254 - Failed to synthesize node: str_vararg_node", + exprtk_error_location)); + + details::free_node(*node_allocator_, result); } else #endif { + expression_node_ptr result = error_node(); + switch (operation) { #define case_stmt(op0, op1) \ - case op0 : return node_allocator_-> \ + case op0 : result = node_allocator_-> \ allocate > >(arg_list); \ + break; \ case_stmt(details::e_sum , details::vararg_add_op ) case_stmt(details::e_prod , details::vararg_mul_op ) @@ -29594,7 +33359,22 @@ namespace exprtk #undef case_stmt default : return error_node(); } + + if (result && result->valid()) + { + return result; + } + + parser_->set_error(parser_error::make_error( + parser_error::e_synthesis, + token_t(), + "ERR255 - Failed to synthesize node: vararg_node", + exprtk_error_location)); + + details::free_node(*node_allocator_, result); } + + return error_node(); } template @@ -29635,7 +33415,19 @@ namespace exprtk return error_node(); } - return result; + if (result && result->valid()) + { + return result; + } + + parser_->set_error(parser_error::make_error( + parser_error::e_synthesis, + token_t(), + "ERR256 - Failed to synthesize node: function_N_node_t", + exprtk_error_location)); + + details::free_node(*node_allocator_, result); + return error_node(); } } @@ -29672,7 +33464,19 @@ namespace exprtk parser_->state_.activate_side_effect("vararg_function_call()"); - return result; + if (result && result->valid()) + { + return result; + } + + parser_->set_error(parser_error::make_error( + parser_error::e_synthesis, + token_t(), + "ERR257 - Failed to synthesize node: vararg_function_node", + exprtk_error_location)); + + details::free_node(*node_allocator_, result); + return error_node(); } inline expression_node_ptr generic_function_call(igeneric_function_t* gf, @@ -29691,14 +33495,23 @@ namespace exprtk const std::size_t no_psi = std::numeric_limits::max(); expression_node_ptr result = error_node(); + std::string node_name = "Unknown"; if (no_psi == param_seq_index) + { result = node_allocator_->allocate(arg_list,gf); + node_name = "generic_function_node"; + } else + { result = node_allocator_->allocate(gf, param_seq_index, arg_list); + node_name = "multimode_genfunction_node"; + } alloc_type1* genfunc_node_ptr = static_cast(result); + assert(genfunc_node_ptr); + if ( !arg_list.empty() && !gf->has_side_effects() && @@ -29716,9 +33529,20 @@ namespace exprtk } else if (genfunc_node_ptr->init_branches()) { - parser_->state_.activate_side_effect("generic_function_call()"); + if (result && result->valid()) + { + parser_->state_.activate_side_effect("generic_function_call()"); + return result; + } - return result; + parser_->set_error(parser_error::make_error( + parser_error::e_synthesis, + token_t(), + "ERR258 - Failed to synthesize node: " + node_name, + exprtk_error_location)); + + details::free_node(*node_allocator_, result); + return error_node(); } else { @@ -29746,14 +33570,23 @@ namespace exprtk const std::size_t no_psi = std::numeric_limits::max(); expression_node_ptr result = error_node(); + std::string node_name = "Unknown"; if (no_psi == param_seq_index) + { result = node_allocator_->allocate(gf,arg_list); + node_name = "string_function_node"; + } else + { result = node_allocator_->allocate(gf, param_seq_index, arg_list); + node_name = "multimode_strfunction_node"; + } alloc_type1* strfunc_node_ptr = static_cast(result); + assert(strfunc_node_ptr); + if ( !arg_list.empty() && !gf->has_side_effects() && @@ -29770,9 +33603,20 @@ namespace exprtk } else if (strfunc_node_ptr->init_branches()) { - parser_->state_.activate_side_effect("string_function_call()"); + if (result && result->valid()) + { + parser_->state_.activate_side_effect("string_function_call()"); + return result; + } - return result; + parser_->set_error(parser_error::make_error( + parser_error::e_synthesis, + token_t(), + "ERR259 - Failed to synthesize node: " + node_name, + exprtk_error_location)); + + details::free_node(*node_allocator_, result); + return error_node(); } else { @@ -29800,11 +33644,24 @@ namespace exprtk alloc_type* return_node_ptr = static_cast(result); + assert(return_node_ptr); + if (return_node_ptr->init_branches()) { - parser_->state_.activate_side_effect("return_call()"); + if (result && result->valid()) + { + parser_->state_.activate_side_effect("return_call()"); + return result; + } - return result; + parser_->set_error(parser_error::make_error( + parser_error::e_synthesis, + token_t(), + "ERR260 - Failed to synthesize node: return_node", + exprtk_error_location)); + + details::free_node(*node_allocator_, result); + return error_node(); } else { @@ -29842,28 +33699,93 @@ namespace exprtk } #endif - inline expression_node_ptr vector_element(const std::string& symbol, - vector_holder_ptr vector_base, + inline expression_node_ptr vector_element(const std::string& symbol, + vector_holder_ptr vector_base, + expression_node_ptr vec_node, expression_node_ptr index) { expression_node_ptr result = error_node(); + std::string node_name = "Unknown"; if (details::is_constant_node(index)) { - std::size_t i = static_cast(details::numeric::to_int64(index->value())); + const std::size_t vec_index = static_cast(details::numeric::to_int64(index->value())); details::free_node(*node_allocator_,index); - if (vector_base->rebaseable()) + if (vec_index >= vector_base->size()) { - return node_allocator_->allocate(i,vector_base); + parser_->set_error(parser_error::make_error( + parser_error::e_parser, + token_t(), + "ERR261 - Index of " + details::to_str(vec_index) + " out of range for " + "vector '" + symbol + "' of size " + details::to_str(vector_base->size()), + exprtk_error_location)); + + details::free_node(*node_allocator_,vec_node); + + return error_node(); } - const scope_element& se = parser_->sem_.get_element(symbol,i); + if (vector_base->rebaseable()) + { + vector_access_runtime_check_ptr rtc = get_vector_access_runtime_check(); - if (se.index == i) + result = (rtc) ? + node_allocator_->allocate(vec_node, vec_index, vector_base, rtc) : + node_allocator_->allocate(vec_node, vec_index, vector_base ) ; + + node_name = (rtc) ? + "rebasevector_elem_rtc_node_t" : + "rebasevector_elem_node_t" ; + + if (result && result->valid()) + { + return result; + } + + parser_->set_error(parser_error::make_error( + parser_error::e_synthesis, + token_t(), + "ERR262 - Failed to synthesize node: " + node_name + " for vector: " + symbol, + exprtk_error_location)); + + details::free_node(*node_allocator_, result); + return error_node(); + } + else if (details::is_ivector_node(vec_node) && !details::is_vector_node(vec_node)) + { + vector_access_runtime_check_ptr rtc = get_vector_access_runtime_check(); + + result = (rtc) ? + node_allocator_->allocate(vec_node, vec_index, vector_base, rtc) : + node_allocator_->allocate(vec_node, vec_index, vector_base ) ; + + node_name = (rtc) ? + "vector_elem_rtc_node_t" : + "vector_elem_node_t" ; + + if (result && result->valid()) + { + return result; + } + + parser_->set_error(parser_error::make_error( + parser_error::e_synthesis, + token_t(), + "ERR263 - Failed to synthesize node: " + node_name + " for vector: " + symbol, + exprtk_error_location)); + + details::free_node(*node_allocator_, result); + return error_node(); + } + + const scope_element& se = parser_->sem_.get_element(symbol,vec_index); + + if (se.index == vec_index) { result = se.var_node; + details::free_node(*node_allocator_,vec_node); } else { @@ -29872,10 +33794,10 @@ namespace exprtk nse.active = true; nse.ref_count = 1; nse.type = scope_element::e_vecelem; - nse.index = i; + nse.index = vec_index; nse.depth = parser_->state_.scope_depth; nse.data = 0; - nse.var_node = node_allocator_->allocate((*(*vector_base)[i])); + nse.var_node = node_allocator_->allocate((*(*vector_base)[vec_index])); if (!parser_->sem_.add_element(nse)) { @@ -29886,19 +33808,55 @@ namespace exprtk result = error_node(); } - exprtk_debug(("vector_element() - INFO - Added new local vector element: %s\n",nse.name.c_str())); + details::free_node(*node_allocator_,vec_node); + + exprtk_debug(("vector_element() - INFO - Added new local vector element: %s\n", nse.name.c_str())); parser_->state_.activate_side_effect("vector_element()"); result = nse.var_node; + node_name = "variable_node_t"; } } - else if (vector_base->rebaseable()) - result = node_allocator_->allocate(index,vector_base); else - result = node_allocator_->allocate(index,vector_base); + { + vector_access_runtime_check_ptr rtc = get_vector_access_runtime_check(); - return result; + if (vector_base->rebaseable()) + { + result = (rtc) ? + node_allocator_->allocate(vec_node, index, vector_base, rtc) : + node_allocator_->allocate(vec_node, index, vector_base ) ; + + node_name = (rtc) ? + "rebasevector_elem_rtc_node_t" : + "rebasevector_elem_node_t" ; + } + else + { + result = rtc ? + node_allocator_->allocate(vec_node, index, vector_base, rtc) : + node_allocator_->allocate(vec_node, index, vector_base ) ; + + node_name = (rtc) ? + "vector_elem_rtc_node_t" : + "vector_elem_node_t" ; + } + } + + if (result && result->valid()) + { + return result; + } + + parser_->set_error(parser_error::make_error( + parser_error::e_synthesis, + token_t(), + "ERR264 - Failed to synthesize node: " + node_name, + exprtk_error_location)); + + details::free_node(*node_allocator_, result); + return error_node(); } private: @@ -29995,12 +33953,27 @@ namespace exprtk case details::expression_node::e_vecelem: return reinterpret_cast(&static_cast(node)->ref()); + case details::expression_node::e_veccelem: + return reinterpret_cast(&static_cast(node)->ref()); + + case details::expression_node::e_vecelemrtc: + return reinterpret_cast(&static_cast(node)->ref()); + + case details::expression_node::e_veccelemrtc: + return reinterpret_cast(&static_cast(node)->ref()); + case details::expression_node::e_rbvecelem: return reinterpret_cast(&static_cast(node)->ref()); + case details::expression_node::e_rbvecelemrtc: + return reinterpret_cast(&static_cast(node)->ref()); + case details::expression_node::e_rbveccelem: return reinterpret_cast(&static_cast(node)->ref()); + case details::expression_node::e_rbveccelemrtc: + return reinterpret_cast(&static_cast(node)->ref()); + case details::expression_node::e_vector: return reinterpret_cast(static_cast(node)->vec_holder().data()); @@ -30032,11 +34005,11 @@ namespace exprtk if (parser_->immutable_symtok_map_.end() != itr) { token_t& token = itr->second; - parser_->set_error( - parser_error::make_error(parser_error::e_parser, - token, - "ERR211 - Symbol '" + token.value + "' cannot be assigned-to as it is immutable.", - exprtk_error_location)); + parser_->set_error(parser_error::make_error( + parser_error::e_parser, + token, + "ERR265 - Symbol '" + token.value + "' cannot be assigned-to as it is immutable.", + exprtk_error_location)); } else parser_->set_synthesis_error("Unable to assign symbol is immutable."); @@ -30058,16 +34031,26 @@ namespace exprtk lodge_assignment(e_st_variable,branch[0]); return synthesize_expression(operation,branch); } - else if (details::is_vector_elem_node(branch[0])) + else if (details::is_vector_elem_node(branch[0]) || details::is_vector_celem_node(branch[0])) { lodge_assignment(e_st_vecelem,branch[0]); return synthesize_expression(operation, branch); } + else if (details::is_vector_elem_rtc_node(branch[0]) || details::is_vector_celem_rtc_node(branch[0])) + { + lodge_assignment(e_st_vecelem,branch[0]); + return synthesize_expression(operation, branch); + } else if (details::is_rebasevector_elem_node(branch[0])) { lodge_assignment(e_st_vecelem,branch[0]); return synthesize_expression(operation, branch); } + else if (details::is_rebasevector_elem_rtc_node(branch[0])) + { + lodge_assignment(e_st_vecelem,branch[0]); + return synthesize_expression(operation, branch); + } else if (details::is_rebasevector_celem_node(branch[0])) { lodge_assignment(e_st_vecelem,branch[0]); @@ -30094,9 +34077,23 @@ namespace exprtk else return synthesize_expression(operation, branch); } + else if (details::is_literal_node(branch[0])) + { + parser_->set_error(parser_error::make_error( + parser_error::e_syntax, + parser_->current_state().token, + "ERR266 - Cannot assign value to const variable", + exprtk_error_location)); + + return error_node(); + } else { - parser_->set_synthesis_error("Invalid assignment operation.[1]"); + parser_->set_error(parser_error::make_error( + parser_error::e_syntax, + parser_->current_state().token, + "ERR267 - Invalid branches for assignment operator '" + details::to_str(operation) + "'", + exprtk_error_location)); return error_node(); } @@ -30110,6 +34107,9 @@ namespace exprtk return error_node(); } + expression_node_ptr result = error_node(); + std::string node_name = "Unknown"; + if (details::is_variable_node(branch[0])) { lodge_assignment(e_st_variable,branch[0]); @@ -30117,9 +34117,11 @@ namespace exprtk switch (operation) { #define case_stmt(op0, op1) \ - case op0 : return node_allocator_-> \ + case op0 : result = node_allocator_-> \ template allocate_rrr > > \ (operation, branch[0], branch[1]); \ + node_name = "assignment_op_node"; \ + break; \ case_stmt(details::e_addass , details::add_op) case_stmt(details::e_subass , details::sub_op) @@ -30137,9 +34139,55 @@ namespace exprtk switch (operation) { #define case_stmt(op0, op1) \ - case op0 : return node_allocator_-> \ + case op0 : result = node_allocator_-> \ template allocate_rrr > > \ (operation, branch[0], branch[1]); \ + node_name = "assignment_vec_elem_op_node"; \ + break; \ + + case_stmt(details::e_addass , details::add_op) + case_stmt(details::e_subass , details::sub_op) + case_stmt(details::e_mulass , details::mul_op) + case_stmt(details::e_divass , details::div_op) + case_stmt(details::e_modass , details::mod_op) + #undef case_stmt + default : return error_node(); + } + } + else if (details::is_vector_elem_rtc_node(branch[0])) + { + lodge_assignment(e_st_vecelem,branch[0]); + + switch (operation) + { + #define case_stmt(op0, op1) \ + case op0 : result = node_allocator_-> \ + template allocate_rrr > > \ + (operation, branch[0], branch[1]); \ + node_name = "assignment_vec_elem_op_rtc_node"; \ + break; \ + + case_stmt(details::e_addass , details::add_op) + case_stmt(details::e_subass , details::sub_op) + case_stmt(details::e_mulass , details::mul_op) + case_stmt(details::e_divass , details::div_op) + case_stmt(details::e_modass , details::mod_op) + #undef case_stmt + default : return error_node(); + } + } + else if (details::is_vector_celem_rtc_node(branch[0])) + { + lodge_assignment(e_st_vecelem,branch[0]); + + switch (operation) + { + #define case_stmt(op0, op1) \ + case op0 : result = node_allocator_-> \ + template allocate_rrr > > \ + (operation, branch[0], branch[1]); \ + node_name = "assignment_vec_celem_op_rtc_node"; \ + break; \ case_stmt(details::e_addass , details::add_op) case_stmt(details::e_subass , details::sub_op) @@ -30157,9 +34205,11 @@ namespace exprtk switch (operation) { #define case_stmt(op0, op1) \ - case op0 : return node_allocator_-> \ + case op0 : result = node_allocator_-> \ template allocate_rrr > > \ (operation, branch[0], branch[1]); \ + node_name = "assignment_rebasevec_elem_op_node"; \ + break; \ case_stmt(details::e_addass , details::add_op) case_stmt(details::e_subass , details::sub_op) @@ -30177,9 +34227,55 @@ namespace exprtk switch (operation) { #define case_stmt(op0, op1) \ - case op0 : return node_allocator_-> \ + case op0 : result = node_allocator_-> \ template allocate_rrr > > \ (operation, branch[0], branch[1]); \ + node_name = "assignment_rebasevec_celem_op_node"; \ + break; \ + + case_stmt(details::e_addass , details::add_op) + case_stmt(details::e_subass , details::sub_op) + case_stmt(details::e_mulass , details::mul_op) + case_stmt(details::e_divass , details::div_op) + case_stmt(details::e_modass , details::mod_op) + #undef case_stmt + default : return error_node(); + } + } + else if (details::is_rebasevector_elem_rtc_node(branch[0])) + { + lodge_assignment(e_st_vecelem,branch[0]); + + switch (operation) + { + #define case_stmt(op0, op1) \ + case op0 : result = node_allocator_-> \ + template allocate_rrr > > \ + (operation, branch[0], branch[1]); \ + node_name = "assignment_rebasevec_elem_op_rtc_node"; \ + break; \ + + case_stmt(details::e_addass , details::add_op) + case_stmt(details::e_subass , details::sub_op) + case_stmt(details::e_mulass , details::mul_op) + case_stmt(details::e_divass , details::div_op) + case_stmt(details::e_modass , details::mod_op) + #undef case_stmt + default : return error_node(); + } + } + else if (details::is_rebasevector_celem_rtc_node(branch[0])) + { + lodge_assignment(e_st_vecelem,branch[0]); + + switch (operation) + { + #define case_stmt(op0, op1) \ + case op0 : result = node_allocator_-> \ + template allocate_rrr > > \ + (operation, branch[0], branch[1]); \ + node_name = "assignment_rebasevec_celem_op_rtc_node"; \ + break; \ case_stmt(details::e_addass , details::add_op) case_stmt(details::e_subass , details::sub_op) @@ -30199,9 +34295,11 @@ namespace exprtk switch (operation) { #define case_stmt(op0, op1) \ - case op0 : return node_allocator_-> \ + case op0 : result = node_allocator_-> \ template allocate_rrr > > \ (operation, branch[0], branch[1]); \ + node_name = "assignment_rebasevec_celem_op_node"; \ + break; \ case_stmt(details::e_addass , details::add_op) case_stmt(details::e_subass , details::sub_op) @@ -30217,9 +34315,11 @@ namespace exprtk switch (operation) { #define case_stmt(op0, op1) \ - case op0 : return node_allocator_-> \ + case op0 : result = node_allocator_-> \ template allocate_rrr > > \ (operation, branch[0], branch[1]); \ + node_name = "assignment_vec_op_node"; \ + break; \ case_stmt(details::e_addass , details::add_op) case_stmt(details::e_subass , details::sub_op) @@ -30241,15 +34341,34 @@ namespace exprtk lodge_assignment(e_st_string,branch[0]); - return synthesize_expression(operation,branch); + result = synthesize_expression(operation,branch); + node_name = "assignment_string_node"; } #endif else { - parser_->set_synthesis_error("Invalid assignment operation[2]"); + parser_->set_error(parser_error::make_error( + parser_error::e_syntax, + parser_->current_state().token, + "ERR268 - Invalid branches for assignment operator '" + details::to_str(operation) + "'", + exprtk_error_location)); return error_node(); } + + if (result && result->valid()) + { + return result; + } + + parser_->set_error(parser_error::make_error( + parser_error::e_synthesis, + token_t(), + "ERR269 - Failed to synthesize node: " + node_name, + exprtk_error_location)); + + details::free_node(*node_allocator_, result); + return error_node(); } inline expression_node_ptr synthesize_veceqineqlogic_operation_expression(const details::operator_type& operation, @@ -30273,14 +34392,19 @@ namespace exprtk case_stmt(details::e_xor , details::xor_op ) \ case_stmt(details::e_xnor , details::xnor_op ) \ + expression_node_ptr result = error_node(); + std::string node_name = "Unknown"; + if (is_b0_ivec && is_b1_ivec) { switch (operation) { #define case_stmt(op0, op1) \ - case op0 : return node_allocator_-> \ + case op0 : result = node_allocator_-> \ template allocate_rrr > > \ (operation, branch[0], branch[1]); \ + node_name = "vec_binop_vecvec_node"; \ + break; \ batch_eqineq_logic_case #undef case_stmt @@ -30292,9 +34416,11 @@ namespace exprtk switch (operation) { #define case_stmt(op0, op1) \ - case op0 : return node_allocator_-> \ + case op0 : result = node_allocator_-> \ template allocate_rrr > > \ (operation, branch[0], branch[1]); \ + node_name = "vec_binop_vecval_node"; \ + break; \ batch_eqineq_logic_case #undef case_stmt @@ -30306,9 +34432,11 @@ namespace exprtk switch (operation) { #define case_stmt(op0, op1) \ - case op0 : return node_allocator_-> \ + case op0 : result = node_allocator_-> \ template allocate_rrr > > \ (operation, branch[0], branch[1]); \ + node_name = "vec_binop_valvec_node"; \ + break; \ batch_eqineq_logic_case #undef case_stmt @@ -30318,6 +34446,20 @@ namespace exprtk else return error_node(); + if (result && result->valid()) + { + return result; + } + + parser_->set_error(parser_error::make_error( + parser_error::e_synthesis, + token_t(), + "ERR270 - Failed to synthesize node: " + node_name, + exprtk_error_location)); + + details::free_node(*node_allocator_, result); + return error_node(); + #undef batch_eqineq_logic_case } @@ -30334,14 +34476,19 @@ namespace exprtk case_stmt(details::e_div , details::div_op) \ case_stmt(details::e_mod , details::mod_op) \ + expression_node_ptr result = error_node(); + std::string node_name = "Unknown"; + if (is_b0_ivec && is_b1_ivec) { switch (operation) { #define case_stmt(op0, op1) \ - case op0 : return node_allocator_-> \ + case op0 : result = node_allocator_-> \ template allocate_rrr > > \ (operation, branch[0], branch[1]); \ + node_name = "vec_binop_vecvec_node"; \ + break; \ vector_ops case_stmt(details::e_pow,details:: pow_op) @@ -30354,9 +34501,11 @@ namespace exprtk switch (operation) { #define case_stmt(op0, op1) \ - case op0 : return node_allocator_-> \ + case op0 : result = node_allocator_-> \ template allocate_rrr > > \ (operation, branch[0], branch[1]); \ + node_name = "vec_binop_vecval_node(b0ivec,!b1ivec)"; \ + break; \ vector_ops case_stmt(details::e_pow,details:: pow_op) @@ -30369,9 +34518,11 @@ namespace exprtk switch (operation) { #define case_stmt(op0, op1) \ - case op0 : return node_allocator_-> \ + case op0 : result = node_allocator_-> \ template allocate_rrr > > \ (operation, branch[0], branch[1]); \ + node_name = "vec_binop_vecval_node(!b0ivec,b1ivec)"; \ + break; \ vector_ops #undef case_stmt @@ -30381,6 +34532,20 @@ namespace exprtk else return error_node(); + if (result && result->valid()) + { + return result; + } + + parser_->set_error(parser_error::make_error( + parser_error::e_synthesis, + token_t(), + "ERR271 - Failed to synthesize node: " + node_name, + exprtk_error_location)); + + details::free_node(*node_allocator_, result); + return error_node(); + #undef vector_ops } @@ -30398,6 +34563,7 @@ namespace exprtk #endif expression_node_ptr result = error_node(); + std::string node_name = "Unknown"; if (v0_is_ivar && v1_is_ivar) { @@ -30411,36 +34577,57 @@ namespace exprtk (0 != (v1 = dynamic_cast(branch[1]))) ) { - result = node_allocator_->allocate >(v0,v1); + result = node_allocator_->allocate >(v0,v1); + node_name = "swap_node"; } else - result = node_allocator_->allocate >(branch[0],branch[1]); + { + result = node_allocator_->allocate >(branch[0],branch[1]); + node_name = "swap_generic_node"; + } } else if (v0_is_ivec && v1_is_ivec) { - result = node_allocator_->allocate >(branch[0],branch[1]); + result = node_allocator_->allocate >(branch[0],branch[1]); + node_name = "swap_vecvec_node"; } #ifndef exprtk_disable_string_capabilities else if (v0_is_str && v1_is_str) { if (is_string_node(branch[0]) && is_string_node(branch[1])) + { result = node_allocator_->allocate > (branch[0], branch[1]); + node_name = "swap_string_node"; + } else + { result = node_allocator_->allocate > (branch[0], branch[1]); + node_name = "swap_genstrings_node"; + } } #endif else { parser_->set_synthesis_error("Only variables, strings, vectors or vector elements can be swapped"); - return error_node(); } - parser_->state_.activate_side_effect("synthesize_swap_expression()"); + if (result && result->valid()) + { + parser_->state_.activate_side_effect("synthesize_swap_expression()"); + return result; + } - return result; + parser_->set_error(parser_error::make_error( + parser_error::e_synthesis, + token_t(), + "ERR272 - Failed to synthesize node: " + node_name, + exprtk_error_location)); + + details::free_node(*node_allocator_, result); + return error_node(); } #ifndef exprtk_disable_sc_andor @@ -30596,7 +34783,7 @@ namespace exprtk else if (not_recipricol) return cardinal_pow_optimisation_impl(branch[0],p); else - return cardinal_pow_optimisation_impl(branch[0],p); + return cardinal_pow_optimisation_impl(branch[0],p); } #else inline expression_node_ptr cardinal_pow_optimisation(T&, const T&) @@ -31969,9 +36156,9 @@ namespace exprtk const details::operator_type o1) { return details::build_string() - << "(t" << expr_gen.to_str(o0) - << "t)" << expr_gen.to_str(o1) - << "t"; + << "(t" << expr_gen.to_str(o0) + << "t)" << expr_gen.to_str(o1) + << "t"; } }; @@ -32034,9 +36221,9 @@ namespace exprtk const details::operator_type o1) { return details::build_string() - << "t" << expr_gen.to_str(o0) - << "(t" << expr_gen.to_str(o1) - << "t)"; + << "t" << expr_gen.to_str(o0) + << "(t" << expr_gen.to_str(o1) + << "t)"; } }; @@ -32100,9 +36287,9 @@ namespace exprtk const details::operator_type o1) { return details::build_string() - << "(t" << expr_gen.to_str(o0) - << "t)" << expr_gen.to_str(o1) - << "t"; + << "(t" << expr_gen.to_str(o0) + << "t)" << expr_gen.to_str(o1) + << "t"; } }; @@ -32165,9 +36352,9 @@ namespace exprtk const details::operator_type o1) { return details::build_string() - << "t" << expr_gen.to_str(o0) - << "(t" << expr_gen.to_str(o1) - << "t)"; + << "t" << expr_gen.to_str(o0) + << "(t" << expr_gen.to_str(o1) + << "t)"; } }; @@ -32230,9 +36417,9 @@ namespace exprtk const details::operator_type o1) { return details::build_string() - << "(t" << expr_gen.to_str(o0) - << "t)" << expr_gen.to_str(o1) - << "t"; + << "(t" << expr_gen.to_str(o0) + << "t)" << expr_gen.to_str(o1) + << "t"; } }; @@ -32295,9 +36482,9 @@ namespace exprtk const details::operator_type o1) { return details::build_string() - << "t" << expr_gen.to_str(o0) - << "(t" << expr_gen.to_str(o1) - << "t)"; + << "t" << expr_gen.to_str(o0) + << "(t" << expr_gen.to_str(o1) + << "t)"; } }; @@ -32360,9 +36547,9 @@ namespace exprtk const details::operator_type o1) { return details::build_string() - << "(t" << expr_gen.to_str(o0) - << "t)" << expr_gen.to_str(o1) - << "t"; + << "(t" << expr_gen.to_str(o0) + << "t)" << expr_gen.to_str(o1) + << "t"; } }; @@ -32426,9 +36613,9 @@ namespace exprtk const details::operator_type o1) { return details::build_string() - << "t" << expr_gen.to_str(o0) - << "(t" << expr_gen.to_str(o1) - << "t)"; + << "t" << expr_gen.to_str(o0) + << "(t" << expr_gen.to_str(o1) + << "t)"; } }; @@ -32545,9 +36732,9 @@ namespace exprtk const details::operator_type o1) { return details::build_string() - << "(t" << expr_gen.to_str(o0) - << "t)" << expr_gen.to_str(o1) - << "t"; + << "(t" << expr_gen.to_str(o0) + << "t)" << expr_gen.to_str(o1) + << "t"; } }; @@ -32664,9 +36851,9 @@ namespace exprtk const details::operator_type o1) { return details::build_string() - << "t" << expr_gen.to_str(o0) - << "(t" << expr_gen.to_str(o1) - << "t)"; + << "t" << expr_gen.to_str(o0) + << "(t" << expr_gen.to_str(o1) + << "t)"; } }; @@ -32795,9 +36982,9 @@ namespace exprtk const details::operator_type o1) { return details::build_string() - << "t" << expr_gen.to_str(o0) - << "(t" << expr_gen.to_str(o1) - << "t)"; + << "t" << expr_gen.to_str(o0) + << "(t" << expr_gen.to_str(o1) + << "t)"; } }; @@ -32922,9 +37109,9 @@ namespace exprtk const details::operator_type o1) { return details::build_string() - << "(t" << expr_gen.to_str(o0) - << "t)" << expr_gen.to_str(o1) - << "t"; + << "(t" << expr_gen.to_str(o0) + << "t)" << expr_gen.to_str(o1) + << "t"; } }; @@ -33057,10 +37244,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "(t" << expr_gen.to_str(o0) - << "t)" << expr_gen.to_str(o1) - << "(t" << expr_gen.to_str(o2) - << "t)"; + << "(t" << expr_gen.to_str(o0) + << "t)" << expr_gen.to_str(o1) + << "(t" << expr_gen.to_str(o2) + << "t)"; } }; @@ -33146,10 +37333,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "(t" << expr_gen.to_str(o0) - << "t)" << expr_gen.to_str(o1) - << "(t" << expr_gen.to_str(o2) - << "t)"; + << "(t" << expr_gen.to_str(o0) + << "t)" << expr_gen.to_str(o1) + << "(t" << expr_gen.to_str(o2) + << "t)"; } }; @@ -33235,10 +37422,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "(t" << expr_gen.to_str(o0) - << "t)" << expr_gen.to_str(o1) - << "(t" << expr_gen.to_str(o2) - << "t)"; + << "(t" << expr_gen.to_str(o0) + << "t)" << expr_gen.to_str(o1) + << "(t" << expr_gen.to_str(o2) + << "t)"; } }; @@ -33324,10 +37511,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "(t" << expr_gen.to_str(o0) - << "t)" << expr_gen.to_str(o1) - << "(t" << expr_gen.to_str(o2) - << "t)"; + << "(t" << expr_gen.to_str(o0) + << "t)" << expr_gen.to_str(o1) + << "(t" << expr_gen.to_str(o2) + << "t)"; } }; @@ -33413,10 +37600,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "(t" << expr_gen.to_str(o0) - << "t)" << expr_gen.to_str(o1) - << "(t" << expr_gen.to_str(o2) - << "t)"; + << "(t" << expr_gen.to_str(o0) + << "t)" << expr_gen.to_str(o1) + << "(t" << expr_gen.to_str(o2) + << "t)"; } }; @@ -33607,10 +37794,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "(t" << expr_gen.to_str(o0) - << "t)" << expr_gen.to_str(o1) - << "(t" << expr_gen.to_str(o2) - << "t)"; + << "(t" << expr_gen.to_str(o0) + << "t)" << expr_gen.to_str(o1) + << "(t" << expr_gen.to_str(o2) + << "t)"; } }; @@ -33851,10 +38038,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "(t" << expr_gen.to_str(o0) - << "t)" << expr_gen.to_str(o1) - << "(t" << expr_gen.to_str(o2) - << "t)"; + << "(t" << expr_gen.to_str(o0) + << "t)" << expr_gen.to_str(o1) + << "(t" << expr_gen.to_str(o2) + << "t)"; } }; @@ -34045,10 +38232,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "(t" << expr_gen.to_str(o0) - << "t)" << expr_gen.to_str(o1) - << "(t" << expr_gen.to_str(o2) - << "t)"; + << "(t" << expr_gen.to_str(o0) + << "t)" << expr_gen.to_str(o1) + << "(t" << expr_gen.to_str(o2) + << "t)"; } }; @@ -34238,10 +38425,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "(t" << expr_gen.to_str(o0) - << "t)" << expr_gen.to_str(o1) - << "(t" << expr_gen.to_str(o2) - << "t)"; + << "(t" << expr_gen.to_str(o0) + << "t)" << expr_gen.to_str(o1) + << "(t" << expr_gen.to_str(o2) + << "t)"; } }; @@ -34298,10 +38485,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "t" << expr_gen.to_str(o0) - << "(t" << expr_gen.to_str(o1) - << "(t" << expr_gen.to_str(o2) - << "t))"; + << "t" << expr_gen.to_str(o0) + << "(t" << expr_gen.to_str(o1) + << "(t" << expr_gen.to_str(o2) + << "t))"; } }; @@ -34358,10 +38545,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "t" << expr_gen.to_str(o0) - << "(t" << expr_gen.to_str(o1) - << "(t" << expr_gen.to_str(o2) - << "t))"; + << "t" << expr_gen.to_str(o0) + << "(t" << expr_gen.to_str(o1) + << "(t" << expr_gen.to_str(o2) + << "t))"; } }; @@ -34418,10 +38605,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "t" << expr_gen.to_str(o0) - << "(t" << expr_gen.to_str(o1) - << "(t" << expr_gen.to_str(o2) - << "t))"; + << "t" << expr_gen.to_str(o0) + << "(t" << expr_gen.to_str(o1) + << "(t" << expr_gen.to_str(o2) + << "t))"; } }; @@ -34478,10 +38665,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "t" << expr_gen.to_str(o0) - << "(t" << expr_gen.to_str(o1) - << "(t" << expr_gen.to_str(o2) - << "t))"; + << "t" << expr_gen.to_str(o0) + << "(t" << expr_gen.to_str(o1) + << "(t" << expr_gen.to_str(o2) + << "t))"; } }; @@ -34539,10 +38726,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "t" << expr_gen.to_str(o0) - << "(t" << expr_gen.to_str(o1) - << "(t" << expr_gen.to_str(o2) - << "t))"; + << "t" << expr_gen.to_str(o0) + << "(t" << expr_gen.to_str(o1) + << "(t" << expr_gen.to_str(o2) + << "t))"; } }; @@ -34600,10 +38787,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "t" << expr_gen.to_str(o0) - << "(t" << expr_gen.to_str(o1) - << "(t" << expr_gen.to_str(o2) - << "t))"; + << "t" << expr_gen.to_str(o0) + << "(t" << expr_gen.to_str(o1) + << "(t" << expr_gen.to_str(o2) + << "t))"; } }; @@ -34660,10 +38847,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "t" << expr_gen.to_str(o0) - << "(t" << expr_gen.to_str(o1) - << "(t" << expr_gen.to_str(o2) - << "t))"; + << "t" << expr_gen.to_str(o0) + << "(t" << expr_gen.to_str(o1) + << "(t" << expr_gen.to_str(o2) + << "t))"; } }; @@ -34720,10 +38907,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "t" << expr_gen.to_str(o0) - << "(t" << expr_gen.to_str(o1) - << "(t" << expr_gen.to_str(o2) - << "t))"; + << "t" << expr_gen.to_str(o0) + << "(t" << expr_gen.to_str(o1) + << "(t" << expr_gen.to_str(o2) + << "t))"; } }; @@ -34780,10 +38967,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "t" << expr_gen.to_str(o0) - << "(t" << expr_gen.to_str(o1) - << "(t" << expr_gen.to_str(o2) - << "t))"; + << "t" << expr_gen.to_str(o0) + << "(t" << expr_gen.to_str(o1) + << "(t" << expr_gen.to_str(o2) + << "t))"; } }; @@ -34840,10 +39027,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "t" << expr_gen.to_str(o0) - << "((t" << expr_gen.to_str(o1) - << "t)" << expr_gen.to_str(o2) - << "t)"; + << "t" << expr_gen.to_str(o0) + << "((t" << expr_gen.to_str(o1) + << "t)" << expr_gen.to_str(o2) + << "t)"; } }; @@ -34900,10 +39087,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "t" << expr_gen.to_str(o0) - << "((t" << expr_gen.to_str(o1) - << "t)" << expr_gen.to_str(o2) - << "t)"; + << "t" << expr_gen.to_str(o0) + << "((t" << expr_gen.to_str(o1) + << "t)" << expr_gen.to_str(o2) + << "t)"; } }; @@ -34960,10 +39147,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "t" << expr_gen.to_str(o0) - << "((t" << expr_gen.to_str(o1) - << "t)" << expr_gen.to_str(o2) - << "t)"; + << "t" << expr_gen.to_str(o0) + << "((t" << expr_gen.to_str(o1) + << "t)" << expr_gen.to_str(o2) + << "t)"; } }; @@ -35020,10 +39207,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "t" << expr_gen.to_str(o0) - << "((t" << expr_gen.to_str(o1) - << "t)" << expr_gen.to_str(o2) - << "t)"; + << "t" << expr_gen.to_str(o0) + << "((t" << expr_gen.to_str(o1) + << "t)" << expr_gen.to_str(o2) + << "t)"; } }; @@ -35081,10 +39268,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "t" << expr_gen.to_str(o0) - << "((t" << expr_gen.to_str(o1) - << "t)" << expr_gen.to_str(o2) - << "t)"; + << "t" << expr_gen.to_str(o0) + << "((t" << expr_gen.to_str(o1) + << "t)" << expr_gen.to_str(o2) + << "t)"; } }; @@ -35142,10 +39329,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "t" << expr_gen.to_str(o0) - << "((t" << expr_gen.to_str(o1) - << "t)" << expr_gen.to_str(o2) - << "t)"; + << "t" << expr_gen.to_str(o0) + << "((t" << expr_gen.to_str(o1) + << "t)" << expr_gen.to_str(o2) + << "t)"; } }; @@ -35202,10 +39389,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "t" << expr_gen.to_str(o0) - << "((t" << expr_gen.to_str(o1) - << "t)" << expr_gen.to_str(o2) - << "t)"; + << "t" << expr_gen.to_str(o0) + << "((t" << expr_gen.to_str(o1) + << "t)" << expr_gen.to_str(o2) + << "t)"; } }; @@ -35263,10 +39450,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "t" << expr_gen.to_str(o0) - << "((t" << expr_gen.to_str(o1) - << "t)" << expr_gen.to_str(o2) - << "t)"; + << "t" << expr_gen.to_str(o0) + << "((t" << expr_gen.to_str(o1) + << "t)" << expr_gen.to_str(o2) + << "t)"; } }; @@ -35344,10 +39531,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "((t" << expr_gen.to_str(o0) - << "t)" << expr_gen.to_str(o1) - << "t)" << expr_gen.to_str(o2) - << "t"; + << "((t" << expr_gen.to_str(o0) + << "t)" << expr_gen.to_str(o1) + << "t)" << expr_gen.to_str(o2) + << "t"; } }; @@ -35405,10 +39592,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "((t" << expr_gen.to_str(o0) - << "t)" << expr_gen.to_str(o1) - << "t)" << expr_gen.to_str(o2) - << "t"; + << "((t" << expr_gen.to_str(o0) + << "t)" << expr_gen.to_str(o1) + << "t)" << expr_gen.to_str(o2) + << "t"; } }; @@ -35465,10 +39652,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "((t" << expr_gen.to_str(o0) - << "t)" << expr_gen.to_str(o1) - << "t)" << expr_gen.to_str(o2) - << "t"; + << "((t" << expr_gen.to_str(o0) + << "t)" << expr_gen.to_str(o1) + << "t)" << expr_gen.to_str(o2) + << "t"; } }; @@ -35525,10 +39712,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "((t" << expr_gen.to_str(o0) - << "t)" << expr_gen.to_str(o1) - << "t)" << expr_gen.to_str(o2) - << "t"; + << "((t" << expr_gen.to_str(o0) + << "t)" << expr_gen.to_str(o1) + << "t)" << expr_gen.to_str(o2) + << "t"; } }; @@ -35585,10 +39772,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "((t" << expr_gen.to_str(o0) - << "t)" << expr_gen.to_str(o1) - << "t)" << expr_gen.to_str(o2) - << "t"; + << "((t" << expr_gen.to_str(o0) + << "t)" << expr_gen.to_str(o1) + << "t)" << expr_gen.to_str(o2) + << "t"; } }; @@ -35645,10 +39832,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "((t" << expr_gen.to_str(o0) - << "t)" << expr_gen.to_str(o1) - << "t)" << expr_gen.to_str(o2) - << "t"; + << "((t" << expr_gen.to_str(o0) + << "t)" << expr_gen.to_str(o1) + << "t)" << expr_gen.to_str(o2) + << "t"; } }; @@ -35706,10 +39893,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "((t" << expr_gen.to_str(o0) - << "t)" << expr_gen.to_str(o1) - << "t)" << expr_gen.to_str(o2) - << "t"; + << "((t" << expr_gen.to_str(o0) + << "t)" << expr_gen.to_str(o1) + << "t)" << expr_gen.to_str(o2) + << "t"; } }; @@ -35767,10 +39954,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "((t" << expr_gen.to_str(o0) - << "t)" << expr_gen.to_str(o1) - << "t)" << expr_gen.to_str(o2) - << "t"; + << "((t" << expr_gen.to_str(o0) + << "t)" << expr_gen.to_str(o1) + << "t)" << expr_gen.to_str(o2) + << "t"; } }; @@ -35827,10 +40014,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "((t" << expr_gen.to_str(o0) - << "t)" << expr_gen.to_str(o1) - << "t)" << expr_gen.to_str(o2) - << "t"; + << "((t" << expr_gen.to_str(o0) + << "t)" << expr_gen.to_str(o1) + << "t)" << expr_gen.to_str(o2) + << "t"; } }; @@ -35887,10 +40074,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "(t" << expr_gen.to_str(o0) - << "(t" << expr_gen.to_str(o1) - << "t)" << expr_gen.to_str(o2) - << "t"; + << "(t" << expr_gen.to_str(o0) + << "(t" << expr_gen.to_str(o1) + << "t)" << expr_gen.to_str(o2) + << "t"; } }; @@ -35948,10 +40135,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "(t" << expr_gen.to_str(o0) - << "(t" << expr_gen.to_str(o1) - << "t)" << expr_gen.to_str(o2) - << "t"; + << "(t" << expr_gen.to_str(o0) + << "(t" << expr_gen.to_str(o1) + << "t)" << expr_gen.to_str(o2) + << "t"; } }; @@ -36008,10 +40195,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "(t" << expr_gen.to_str(o0) - << "(t" << expr_gen.to_str(o1) - << "t)" << expr_gen.to_str(o2) - << "t"; + << "(t" << expr_gen.to_str(o0) + << "(t" << expr_gen.to_str(o1) + << "t)" << expr_gen.to_str(o2) + << "t"; } }; @@ -36067,10 +40254,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "(t" << expr_gen.to_str(o0) - << "(t" << expr_gen.to_str(o1) - << "t)" << expr_gen.to_str(o2) - << "t"; + << "(t" << expr_gen.to_str(o0) + << "(t" << expr_gen.to_str(o1) + << "t)" << expr_gen.to_str(o2) + << "t"; } }; @@ -36127,10 +40314,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "(t" << expr_gen.to_str(o0) - << "(t" << expr_gen.to_str(o1) - << "t)" << expr_gen.to_str(o2) - << "t"; + << "(t" << expr_gen.to_str(o0) + << "(t" << expr_gen.to_str(o1) + << "t)" << expr_gen.to_str(o2) + << "t"; } }; @@ -36187,10 +40374,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "(t" << expr_gen.to_str(o0) - << "(t" << expr_gen.to_str(o1) - << "t)" << expr_gen.to_str(o2) - << "t"; + << "(t" << expr_gen.to_str(o0) + << "(t" << expr_gen.to_str(o1) + << "t)" << expr_gen.to_str(o2) + << "t"; } }; @@ -36248,10 +40435,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "(t" << expr_gen.to_str(o0) - << "(t" << expr_gen.to_str(o1) - << "t)" << expr_gen.to_str(o2) - << "t"; + << "(t" << expr_gen.to_str(o0) + << "(t" << expr_gen.to_str(o1) + << "t)" << expr_gen.to_str(o2) + << "t"; } }; @@ -36309,10 +40496,10 @@ namespace exprtk const details::operator_type o2) { return details::build_string() - << "(t" << expr_gen.to_str(o0) - << "(t" << expr_gen.to_str(o1) - << "t)" << expr_gen.to_str(o2) - << "t"; + << "(t" << expr_gen.to_str(o0) + << "(t" << expr_gen.to_str(o1) + << "t)" << expr_gen.to_str(o2) + << "t"; } }; @@ -36737,6 +40924,8 @@ namespace exprtk default : return error_node(); } } + + #undef string_opr_switch_statements #endif #ifndef exprtk_disable_string_capabilities @@ -37070,11 +41259,22 @@ namespace exprtk return node_allocator_->allocate(v); } - else + + if (expression_point && expression_point->valid()) + { return expression_point; + } + + parser_->set_error(parser_error::make_error( + parser_error::e_parser, + token_t(), + "ERR273 - Failed to synthesize node: NodeType", + exprtk_error_location)); + + details::free_node(*node_allocator_, expression_point); } - else - return error_node(); + + return error_node(); } template @@ -37154,8 +41354,11 @@ namespace exprtk { scope_element& se = sem_.get_element(i); + exprtk_debug(("register_local_vars() - se[%s]\n", se.name.c_str())); + if ( (scope_element::e_variable == se.type) || + (scope_element::e_literal == se.type) || (scope_element::e_vecelem == se.type) ) { @@ -37428,6 +41631,7 @@ namespace exprtk sf4_map_t sf4_map_; std::string synthesis_error_; scope_element_manager sem_; + std::vector current_state_stack_; immutable_memory_map_t immutable_memory_map_; immutable_symtok_map_t immutable_symtok_map_; @@ -37443,7 +41647,11 @@ namespace exprtk lexer::helper::sequence_validator sequence_validator_; lexer::helper::sequence_validator_3tokens sequence_validator_3tkns_; - loop_runtime_check_ptr loop_runtime_check_; + loop_runtime_check_ptr loop_runtime_check_; + vector_access_runtime_check_ptr vector_access_runtime_check_; + compilation_check_ptr compilation_check_ptr_; + assert_check_ptr assert_check_; + std::set assert_ids_; template friend void details::disable_type_checking(ParserType& p); @@ -37460,17 +41668,19 @@ namespace exprtk typedef typename parser_t::dependent_entity_collector::symbol_t symbol_t; typedef typename parser_t::unknown_symbol_resolver usr_t; - struct resolve_as_vector : public parser_t::unknown_symbol_resolver + struct resolve_as_vector : public usr_t { typedef exprtk::parser parser_t; + using usr_t::process; + resolve_as_vector() : usr_t(usr_t::e_usrmode_extended) {} virtual bool process(const std::string& unknown_symbol, symbol_table_t& symbol_table, - std::string&) + std::string&) exprtk_override { static T v[1]; symbol_table.add_vector(unknown_symbol,v); @@ -37682,7 +41892,9 @@ namespace exprtk const symbol_table& sym_table = e.get_symbol_table(); if (!sym_table.valid()) + { return std::numeric_limits::quiet_NaN(); + } details::variable_node* var = sym_table.get_variable(variable_name); @@ -37695,8 +41907,8 @@ namespace exprtk return result; } - else - return std::numeric_limits::quiet_NaN(); + + return std::numeric_limits::quiet_NaN(); } template @@ -37786,8 +41998,8 @@ namespace exprtk return result; } - else - return std::numeric_limits::quiet_NaN(); + + return std::numeric_limits::quiet_NaN(); } template @@ -37813,8 +42025,8 @@ namespace exprtk return result; } - else - return std::numeric_limits::quiet_NaN(); + + return std::numeric_limits::quiet_NaN(); } template @@ -37840,8 +42052,8 @@ namespace exprtk return result; } - else - return std::numeric_limits::quiet_NaN(); + + return std::numeric_limits::quiet_NaN(); } /* @@ -38120,97 +42332,98 @@ namespace exprtk disable_has_side_effects(*this); } - virtual ~polynomial() {} + virtual ~polynomial() + {} #define poly_rtrn(NN) \ return (NN != N) ? std::numeric_limits::quiet_NaN() : - inline virtual T operator() (const T& x, const T& c1, const T& c0) + inline virtual T operator() (const T& x, const T& c1, const T& c0) exprtk_override { poly_rtrn(1) (poly_impl::evaluate(x, c1, c0)); } - inline virtual T operator() (const T& x, const T& c2, const T& c1, const T& c0) + inline virtual T operator() (const T& x, const T& c2, const T& c1, const T& c0) exprtk_override { poly_rtrn(2) (poly_impl::evaluate(x, c2, c1, c0)); } - inline virtual T operator() (const T& x, const T& c3, const T& c2, const T& c1, const T& c0) + inline virtual T operator() (const T& x, const T& c3, const T& c2, const T& c1, const T& c0) exprtk_override { poly_rtrn(3) (poly_impl::evaluate(x, c3, c2, c1, c0)); } inline virtual T operator() (const T& x, const T& c4, const T& c3, const T& c2, const T& c1, - const T& c0) + const T& c0) exprtk_override { poly_rtrn(4) (poly_impl::evaluate(x, c4, c3, c2, c1, c0)); } inline virtual T operator() (const T& x, const T& c5, const T& c4, const T& c3, const T& c2, - const T& c1, const T& c0) + const T& c1, const T& c0) exprtk_override { poly_rtrn(5) (poly_impl::evaluate(x, c5, c4, c3, c2, c1, c0)); } inline virtual T operator() (const T& x, const T& c6, const T& c5, const T& c4, const T& c3, - const T& c2, const T& c1, const T& c0) + const T& c2, const T& c1, const T& c0) exprtk_override { poly_rtrn(6) (poly_impl::evaluate(x, c6, c5, c4, c3, c2, c1, c0)); } inline virtual T operator() (const T& x, const T& c7, const T& c6, const T& c5, const T& c4, - const T& c3, const T& c2, const T& c1, const T& c0) + const T& c3, const T& c2, const T& c1, const T& c0) exprtk_override { poly_rtrn(7) (poly_impl::evaluate(x, c7, c6, c5, c4, c3, c2, c1, c0)); } inline virtual T operator() (const T& x, const T& c8, const T& c7, const T& c6, const T& c5, - const T& c4, const T& c3, const T& c2, const T& c1, const T& c0) + const T& c4, const T& c3, const T& c2, const T& c1, const T& c0) exprtk_override { poly_rtrn(8) (poly_impl::evaluate(x, c8, c7, c6, c5, c4, c3, c2, c1, c0)); } inline virtual T operator() (const T& x, const T& c9, const T& c8, const T& c7, const T& c6, const T& c5, const T& c4, const T& c3, const T& c2, const T& c1, - const T& c0) + const T& c0) exprtk_override { poly_rtrn(9) (poly_impl::evaluate(x, c9, c8, c7, c6, c5, c4, c3, c2, c1, c0)); } inline virtual T operator() (const T& x, const T& c10, const T& c9, const T& c8, const T& c7, const T& c6, const T& c5, const T& c4, const T& c3, const T& c2, - const T& c1, const T& c0) + const T& c1, const T& c0) exprtk_override { poly_rtrn(10) (poly_impl::evaluate(x, c10, c9, c8, c7, c6, c5, c4, c3, c2, c1, c0)); } inline virtual T operator() (const T& x, const T& c11, const T& c10, const T& c9, const T& c8, const T& c7, const T& c6, const T& c5, const T& c4, const T& c3, - const T& c2, const T& c1, const T& c0) + const T& c2, const T& c1, const T& c0) exprtk_override { poly_rtrn(11) (poly_impl::evaluate(x, c11, c10, c9, c8, c7, c6, c5, c4, c3, c2, c1, c0)); } inline virtual T operator() (const T& x, const T& c12, const T& c11, const T& c10, const T& c9, const T& c8, const T& c7, const T& c6, const T& c5, const T& c4, - const T& c3, const T& c2, const T& c1, const T& c0) + const T& c3, const T& c2, const T& c1, const T& c0) exprtk_override { poly_rtrn(12) (poly_impl::evaluate(x, c12, c11, c10, c9, c8, c7, c6, c5, c4, c3, c2, c1, c0)); } #undef poly_rtrn - inline virtual T operator() () + inline virtual T operator() () exprtk_override { return std::numeric_limits::quiet_NaN(); } - inline virtual T operator() (const T&) + inline virtual T operator() (const T&) exprtk_override { return std::numeric_limits::quiet_NaN(); } - inline virtual T operator() (const T&, const T&) + inline virtual T operator() (const T&, const T&) exprtk_override { return std::numeric_limits::quiet_NaN(); } @@ -38312,6 +42525,50 @@ namespace exprtk return (*this); } + inline function& vars(const std::string& v0, + const std::string& v1) + { + v_.push_back(v0); + v_.push_back(v1); + return (*this); + } + + inline function& vars(const std::string& v0, + const std::string& v1, + const std::string& v2) + { + v_.push_back(v0); + v_.push_back(v1); + v_.push_back(v2); + return (*this); + } + + inline function& vars(const std::string& v0, + const std::string& v1, + const std::string& v2, + const std::string& v3) + { + v_.push_back(v0); + v_.push_back(v1); + v_.push_back(v2); + v_.push_back(v3); + return (*this); + } + + inline function& vars(const std::string& v0, + const std::string& v1, + const std::string& v2, + const std::string& v3, + const std::string& v4) + { + v_.push_back(v0); + v_.push_back(v1); + v_.push_back(v2); + v_.push_back(v3); + v_.push_back(v4); + return (*this); + } + std::string name_; std::string expression_; std::deque v_; @@ -38321,12 +42578,14 @@ namespace exprtk struct base_func : public exprtk::ifunction { - typedef const T& type; - typedef exprtk::ifunction function_t; - typedef std::vector varref_t; - typedef std::vector var_t; + typedef const T& type; + typedef exprtk::ifunction function_t; + typedef std::vector varref_t; + typedef std::vector var_t; + typedef std::vector str_t; typedef std::pair lvarref_t; typedef std::vector lvr_vec_t; + typedef std::vector lstr_vec_t; using exprtk::ifunction::operator(); @@ -38338,10 +42597,11 @@ namespace exprtk v.resize(pc); } - virtual ~base_func() {} + virtual ~base_func() + {} - #define exprtk_assign(Index) \ - (*v[Index]) = v##Index; \ + #define exprtk_assign(Index) \ + (*v[Index]) = v##Index; \ inline void update(const T& v0) { @@ -38387,17 +42647,33 @@ namespace exprtk { expression = expr; - typedef typename expression_t::control_block::local_data_list_t ldl_t; + typedef typename expression_t::control_block ctrlblk_t; + typedef typename ctrlblk_t::local_data_list_t ldl_t; + typedef typename ctrlblk_t::data_type data_t; + typedef typename ldl_t::value_type ldl_value_type; const ldl_t ldl = expr.local_data_list(); - std::vector index_list; + std::vector > index_list; for (std::size_t i = 0; i < ldl.size(); ++i) { + exprtk_debug(("base_func::setup() - element[%02d] type: %s size: %d\n", + static_cast(i), + expression_t::control_block::to_str(ldl[i].type).c_str(), + static_cast(ldl[i].size))); + + switch (ldl[i].type) + { + case ctrlblk_t::e_unknown : continue; + case ctrlblk_t::e_expr : continue; + case ctrlblk_t::e_vecholder : continue; + default : break; + } + if (ldl[i].size) { - index_list.push_back(i); + index_list.push_back(std::make_pair(i,ldl[i].type)); } } @@ -38405,19 +42681,34 @@ namespace exprtk for (std::size_t i = 0; i < index_list.size(); ++i) { - const std::size_t index = index_list[i]; + const std::size_t index = index_list[i].first; + const ldl_value_type& local_var = ldl[index]; + + assert(local_var.pointer); if (i < (index_list.size() - v.size())) { - lv.push_back( - std::make_pair( - reinterpret_cast(ldl[index].pointer), - ldl[index].size)); + if (local_var.type == ctrlblk_t::e_string) + { + local_str_vars.push_back( + reinterpret_cast(local_var.pointer)); + } + else if ( + (local_var.type == ctrlblk_t::e_data ) || + (local_var.type == ctrlblk_t::e_vecdata) + ) + { + local_vars.push_back(std::make_pair( + reinterpret_cast(local_var.pointer), + local_var.size)); - local_var_stack_size += ldl[index].size; + local_var_stack_size += local_var.size; + } } else - v[input_param_count++] = reinterpret_cast(ldl[index].pointer); + { + v[input_param_count++] = reinterpret_cast(local_var.pointer); + } } clear_stack(); @@ -38433,14 +42724,21 @@ namespace exprtk { var_t var_stack(v.size(),T(0)); copy(v,var_stack); - param_stack.push_back(var_stack); + input_params_stack.push_back(var_stack); } - if (!lv.empty()) + if (!local_vars.empty()) { - var_t local_var_stack(local_var_stack_size,T(0)); - copy(lv,local_var_stack); - local_stack.push_back(local_var_stack); + var_t local_vec_frame(local_var_stack_size,T(0)); + copy(local_vars,local_vec_frame); + local_var_stack.push_back(local_vec_frame); + } + + if (!local_str_vars.empty()) + { + str_t local_str_frame(local_str_vars.size()); + copy(local_str_vars,local_str_frame); + local_str_stack.push_back(local_str_frame); } } } @@ -38451,14 +42749,20 @@ namespace exprtk { if (!v.empty()) { - copy(param_stack.back(),v); - param_stack.pop_back(); + copy(input_params_stack.back(), v); + input_params_stack.pop_back(); } - if (!lv.empty()) + if (!local_vars.empty()) { - copy(local_stack.back(),lv); - local_stack.pop_back(); + copy(local_var_stack.back(), local_vars); + local_var_stack.pop_back(); + } + + if (!local_str_vars.empty()) + { + copy(local_str_stack.back(), local_str_vars); + local_str_stack.pop_back(); } } } @@ -38471,6 +42775,14 @@ namespace exprtk } } + void copy(const lstr_vec_t& src_v, str_t& dest_v) + { + for (std::size_t i = 0; i < src_v.size(); ++i) + { + dest_v[i] = (*src_v[i]); + } + } + void copy(const var_t& src_v, varref_t& dest_v) { for (std::size_t i = 0; i < src_v.size(); ++i) @@ -38503,9 +42815,12 @@ namespace exprtk typename var_t::const_iterator itr = src_v.begin(); typedef typename std::iterator_traits::difference_type diff_t; - for (std::size_t i = 0; i < src_v.size(); ++i) + for (std::size_t i = 0; i < dest_v.size(); ++i) { - lvarref_t vr = dest_v[i]; + lvarref_t& vr = dest_v[i]; + + assert(vr.first != 0); + assert(vr.second > 0); if (1 == vr.second) (*vr.first) = *itr++; @@ -38517,6 +42832,16 @@ namespace exprtk } } + void copy(const str_t& src_str, lstr_vec_t& dest_str) + { + assert(src_str.size() == dest_str.size()); + + for (std::size_t i = 0; i < dest_str.size(); ++i) + { + *dest_str[i] = src_str[i]; + } + } + inline void clear_stack() { for (std::size_t i = 0; i < v.size(); ++i) @@ -38530,29 +42855,19 @@ namespace exprtk return e.value(); } - expression_t expression; - varref_t v; - lvr_vec_t lv; - std::size_t local_var_stack_size; - std::size_t stack_depth; - std::deque param_stack; - std::deque local_stack; + expression_t expression; + varref_t v; + lvr_vec_t local_vars; + lstr_vec_t local_str_vars; + std::size_t local_var_stack_size; + std::size_t stack_depth; + std::deque input_params_stack; + std::deque local_var_stack; + std::deque local_str_stack; }; typedef std::map funcparam_t; - struct func_0param : public base_func - { - using exprtk::ifunction::operator(); - - func_0param() : base_func(0) {} - - inline T operator() () - { - return this->value(base_func::expression); - } - }; - typedef const T& type; template @@ -38577,13 +42892,26 @@ namespace exprtk scoped_bft& operator=(const scoped_bft&) exprtk_delete; }; + struct func_0param : public base_func + { + using exprtk::ifunction::operator(); + + func_0param() : base_func(0) {} + + inline T operator() () exprtk_override + { + scoped_bft sb(*this); + return this->value(base_func::expression); + } + }; + struct func_1param : public base_func { using exprtk::ifunction::operator(); func_1param() : base_func(1) {} - inline T operator() (type v0) + inline T operator() (type v0) exprtk_override { scoped_bft sb(*this); base_func::update(v0); @@ -38597,7 +42925,7 @@ namespace exprtk func_2param() : base_func(2) {} - inline T operator() (type v0, type v1) + inline T operator() (type v0, type v1) exprtk_override { scoped_bft sb(*this); base_func::update(v0, v1); @@ -38611,7 +42939,7 @@ namespace exprtk func_3param() : base_func(3) {} - inline T operator() (type v0, type v1, type v2) + inline T operator() (type v0, type v1, type v2) exprtk_override { scoped_bft sb(*this); base_func::update(v0, v1, v2); @@ -38625,7 +42953,7 @@ namespace exprtk func_4param() : base_func(4) {} - inline T operator() (type v0, type v1, type v2, type v3) + inline T operator() (type v0, type v1, type v2, type v3) exprtk_override { scoped_bft sb(*this); base_func::update(v0, v1, v2, v3); @@ -38639,7 +42967,7 @@ namespace exprtk func_5param() : base_func(5) {} - inline T operator() (type v0, type v1, type v2, type v3, type v4) + inline T operator() (type v0, type v1, type v2, type v3, type v4) exprtk_override { scoped_bft sb(*this); base_func::update(v0, v1, v2, v3, v4); @@ -38653,7 +42981,7 @@ namespace exprtk func_6param() : base_func(6) {} - inline T operator() (type v0, type v1, type v2, type v3, type v4, type v5) + inline T operator() (type v0, type v1, type v2, type v3, type v4, type v5) exprtk_override { scoped_bft sb(*this); base_func::update(v0, v1, v2, v3, v4, v5); @@ -38680,14 +43008,14 @@ namespace exprtk return result; } - #define def_fp_retval(N) \ - struct func_##N##param_retval : public func_##N##param \ - { \ - inline T value(expression_t& e) \ - { \ - return return_value(e); \ - } \ - }; \ + #define def_fp_retval(N) \ + struct func_##N##param_retval exprtk_final : public func_##N##param \ + { \ + inline T value(expression_t& e) exprtk_override \ + { \ + return return_value(e); \ + } \ + }; \ def_fp_retval(0) def_fp_retval(1) @@ -38697,6 +43025,8 @@ namespace exprtk def_fp_retval(5) def_fp_retval(6) + #undef def_fp_retval + template class Sequence> inline bool add(const std::string& name, @@ -38739,16 +43069,20 @@ namespace exprtk public: function_compositor() - : parser_(settings_t::compile_all_opts + + : parser_(settings_t::default_compile_all_opts + settings_t::e_disable_zero_return) , fp_map_(7) + , load_variables_(false) + , load_vectors_(false) {} - function_compositor(const symbol_table_t& st) + explicit function_compositor(const symbol_table_t& st) : symbol_table_(st) - , parser_(settings_t::compile_all_opts + + , parser_(settings_t::default_compile_all_opts + settings_t::e_disable_zero_return) , fp_map_(7) + , load_variables_(false) + , load_vectors_(false) {} ~function_compositor() @@ -38771,6 +43105,46 @@ namespace exprtk auxiliary_symtab_list_.push_back(&symtab); } + void load_variables(const bool load = true) + { + load_variables_ = load; + } + + void load_vectors(const bool load = true) + { + load_vectors_ = load; + } + + inline void register_loop_runtime_check(loop_runtime_check& lrtchk) + { + parser_.register_loop_runtime_check(lrtchk); + } + + inline void register_vector_access_runtime_check(vector_access_runtime_check& vartchk) + { + parser_.register_vector_access_runtime_check(vartchk); + } + + inline void register_compilation_timeout_check(compilation_check& compchk) + { + parser_.register_compilation_timeout_check(compchk); + } + + inline void clear_loop_runtime_check() + { + parser_.clear_loop_runtime_check(); + } + + inline void clear_vector_access_runtime_check() + { + parser_.clear_vector_access_runtime_check(); + } + + inline void clear_compilation_timeout_check() + { + parser_.clear_compilation_timeout_check(); + } + void clear() { symbol_table_.clear(); @@ -38789,6 +43163,10 @@ namespace exprtk fp_map_[i].clear(); } + + clear_loop_runtime_check (); + clear_vector_access_runtime_check(); + clear_compilation_timeout_check (); } inline bool add(const function& f, const bool override = false) @@ -38796,6 +43174,31 @@ namespace exprtk return add(f.name_, f.expression_, f.v_,override); } + inline std::string error() const + { + if (!error_list_.empty()) + { + return error_list_[0].diagnostic; + } + else + return std::string("No Error"); + } + + inline std::size_t error_count() const + { + return error_list_.size(); + } + + inline parser_error::type get_error(const std::size_t& index) const + { + if (index < error_list_.size()) + { + return error_list_[index]; + } + + throw std::invalid_argument("compositor::get_error() - Invalid error index specified"); + } + private: template expr_map_; std::vector fp_map_; std::vector auxiliary_symtab_list_; + std::deque error_list_; + bool load_variables_; + bool load_vectors_; }; // class function_compositor } // namespace exprtk -#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +#if defined(_MSC_VER) || defined(_WIN32) || defined(__WIN32__) || defined(WIN32) # ifndef NOMINMAX # define NOMINMAX # endif @@ -39001,9 +43433,11 @@ namespace exprtk { public: - #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) + #if defined(_MSC_VER) || defined(_WIN32) || defined(__WIN32__) || defined(WIN32) timer() : in_use_(false) + , start_time_{ {0, 0} } + , stop_time_ { {0, 0} } { QueryPerformanceFrequency(&clock_frequency_); } @@ -39081,7 +43515,7 @@ namespace exprtk bool in_use_; - #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) + #if defined(_MSC_VER) || defined(_WIN32) || defined(__WIN32__) || defined(WIN32) LARGE_INTEGER start_time_; LARGE_INTEGER stop_time_; LARGE_INTEGER clock_frequency_; @@ -39114,7 +43548,23 @@ namespace exprtk const T v, exprtk::details::numeric::details::real_type_tag) { - printf(fmt.c_str(),v); + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wformat-nonliteral" + #elif defined(__GNUC__) || defined(__GNUG__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wformat-nonliteral" + #elif defined(_MSC_VER) + #endif + + printf(fmt.c_str(), v); + + #if defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) || defined(__GNUG__) + #pragma GCC diagnostic pop + #elif defined(_MSC_VER) + #endif } template @@ -39174,19 +43624,19 @@ namespace exprtk } // namespace exprtk::rtl::io::details template - struct print : public exprtk::igeneric_function + struct print exprtk_final : public exprtk::igeneric_function { typedef typename igeneric_function::parameter_list_t parameter_list_t; using exprtk::igeneric_function::operator(); - print(const std::string& scalar_format = "%10.5f") + explicit print(const std::string& scalar_format = "%10.5f") : scalar_format_(scalar_format) { exprtk::enable_zero_parameters(*this); } - inline T operator() (parameter_list_t parameters) + inline T operator() (parameter_list_t parameters) exprtk_override { details::print_impl::process(scalar_format_,parameters); return T(0); @@ -39196,19 +43646,19 @@ namespace exprtk }; template - struct println : public exprtk::igeneric_function + struct println exprtk_final : public exprtk::igeneric_function { typedef typename igeneric_function::parameter_list_t parameter_list_t; using exprtk::igeneric_function::operator(); - println(const std::string& scalar_format = "%10.5f") + explicit println(const std::string& scalar_format = "%10.5f") : scalar_format_(scalar_format) { exprtk::enable_zero_parameters(*this); } - inline T operator() (parameter_list_t parameters) + inline T operator() (parameter_list_t parameters) exprtk_override { details::print_impl::process(scalar_format_,parameters); printf("\n"); @@ -39290,8 +43740,8 @@ namespace exprtk return false; } - else - stream_ptr = stream; + + stream_ptr = stream; return true; } @@ -39306,8 +43756,8 @@ namespace exprtk return false; } - else - stream_ptr = stream; + + stream_ptr = stream; return true; } @@ -39322,13 +43772,13 @@ namespace exprtk return false; } - else - stream_ptr = stream; + + stream_ptr = stream; return true; } - else - return false; + + return false; } template @@ -39475,12 +43925,13 @@ namespace exprtk #ifdef _MSC_VER #pragma warning(pop) #endif + assert(sizeof(T) <= sizeof(void*)); } } // namespace exprtk::rtl::io::file::details template - class open : public exprtk::igeneric_function + class open exprtk_final : public exprtk::igeneric_function { public: @@ -39489,18 +43940,20 @@ namespace exprtk typedef typename igfun_t::generic_type generic_type; typedef typename generic_type::string_view string_t; - using exprtk::igeneric_function::operator(); + using igfun_t::operator(); open() : exprtk::igeneric_function("S|SS") { details::perform_check(); } - inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override { const std::string file_name = to_str(string_t(parameters[0])); if (file_name.empty()) + { return T(0); + } if ((1 == ps_index) && (0 == string_t(parameters[1]).size())) { @@ -39532,7 +43985,7 @@ namespace exprtk }; template - struct close : public exprtk::ifunction + struct close exprtk_final : public exprtk::ifunction { using exprtk::ifunction::operator(); @@ -39540,7 +43993,7 @@ namespace exprtk : exprtk::ifunction(1) { details::perform_check(); } - inline T operator() (const T& v) + inline T operator() (const T& v) exprtk_override { details::file_descriptor* fd = details::make_handle(v); @@ -39554,7 +44007,7 @@ namespace exprtk }; template - class write : public exprtk::igeneric_function + class write exprtk_final : public exprtk::igeneric_function { public: @@ -39565,13 +44018,13 @@ namespace exprtk typedef typename generic_type::scalar_view scalar_t; typedef typename generic_type::vector_view vector_t; - using exprtk::igeneric_function::operator(); + using igfun_t::operator(); write() : igfun_t("TS|TST|TV|TVT") { details::perform_check(); } - inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override { details::file_descriptor* fd = details::make_handle(scalar_t(parameters[0])()); @@ -39611,7 +44064,7 @@ namespace exprtk }; template - class read : public exprtk::igeneric_function + class read exprtk_final : public exprtk::igeneric_function { public: @@ -39622,13 +44075,13 @@ namespace exprtk typedef typename generic_type::scalar_view scalar_t; typedef typename generic_type::vector_view vector_t; - using exprtk::igeneric_function::operator(); + using igfun_t::operator(); read() : igfun_t("TS|TST|TV|TVT") { details::perform_check(); } - inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override { details::file_descriptor* fd = details::make_handle(scalar_t(parameters[0])()); @@ -39668,7 +44121,7 @@ namespace exprtk }; template - class getline : public exprtk::igeneric_function + class getline exprtk_final : public exprtk::igeneric_function { public: @@ -39678,14 +44131,13 @@ namespace exprtk typedef typename generic_type::string_view string_t; typedef typename generic_type::scalar_view scalar_t; - using exprtk::igeneric_function::operator(); + using igfun_t::operator(); getline() : igfun_t("T",igfun_t::e_rtrn_string) { details::perform_check(); } - inline T operator() (std::string& result, - parameter_list_t parameters) + inline T operator() (std::string& result, parameter_list_t parameters) exprtk_override { details::file_descriptor* fd = details::make_handle(scalar_t(parameters[0])()); return T(fd->getline(result) ? 1 : 0); @@ -39693,7 +44145,7 @@ namespace exprtk }; template - struct eof : public exprtk::ifunction + struct eof exprtk_final : public exprtk::ifunction { using exprtk::ifunction::operator(); @@ -39701,10 +44153,9 @@ namespace exprtk : exprtk::ifunction(1) { details::perform_check(); } - inline T operator() (const T& v) + inline T operator() (const T& v) exprtk_override { details::file_descriptor* fd = details::make_handle(v); - return (fd->eof() ? T(1) : T(0)); } }; @@ -39814,236 +44265,7 @@ namespace exprtk } // namespace exprtk::rtl::details template - class all_true : public exprtk::igeneric_function - { - public: - - typedef typename exprtk::igeneric_function igfun_t; - typedef typename igfun_t::parameter_list_t parameter_list_t; - typedef typename igfun_t::generic_type generic_type; - typedef typename generic_type::vector_view vector_t; - - using exprtk::igeneric_function::operator(); - - all_true() - : exprtk::igeneric_function("V|VTT") - /* - Overloads: - 0. V - vector - 1. VTT - vector, r0, r1 - */ - {} - - inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) - { - const vector_t vec(parameters[0]); - - std::size_t r0 = 0; - std::size_t r1 = vec.size() - 1; - - if ( - (1 == ps_index) && - !helper::load_vector_range::process(parameters, r0, r1, 1, 2, 0) - ) - return std::numeric_limits::quiet_NaN(); - - for (std::size_t i = r0; i <= r1; ++i) - { - if (vec[i] == T(0)) - { - return T(0); - } - } - - return T(1); - } - }; - - template - class all_false : public exprtk::igeneric_function - { - public: - - typedef typename exprtk::igeneric_function igfun_t; - typedef typename igfun_t::parameter_list_t parameter_list_t; - typedef typename igfun_t::generic_type generic_type; - typedef typename generic_type::vector_view vector_t; - - using exprtk::igeneric_function::operator(); - - all_false() - : exprtk::igeneric_function("V|VTT") - /* - Overloads: - 0. V - vector - 1. VTT - vector, r0, r1 - */ - {} - - inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) - { - const vector_t vec(parameters[0]); - - std::size_t r0 = 0; - std::size_t r1 = vec.size() - 1; - - if ( - (1 == ps_index) && - !helper::load_vector_range::process(parameters, r0, r1, 1, 2, 0) - ) - return std::numeric_limits::quiet_NaN(); - - for (std::size_t i = r0; i <= r1; ++i) - { - if (vec[i] != T(0)) - { - return T(0); - } - } - - return T(1); - } - }; - - template - class any_true : public exprtk::igeneric_function - { - public: - - typedef typename exprtk::igeneric_function igfun_t; - typedef typename igfun_t::parameter_list_t parameter_list_t; - typedef typename igfun_t::generic_type generic_type; - typedef typename generic_type::vector_view vector_t; - - using exprtk::igeneric_function::operator(); - - any_true() - : exprtk::igeneric_function("V|VTT") - /* - Overloads: - 0. V - vector - 1. VTT - vector, r0, r1 - */ - {} - - inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) - { - const vector_t vec(parameters[0]); - - std::size_t r0 = 0; - std::size_t r1 = vec.size() - 1; - - if ( - (1 == ps_index) && - !helper::load_vector_range::process(parameters, r0, r1, 1, 2, 0) - ) - return std::numeric_limits::quiet_NaN(); - - for (std::size_t i = r0; i <= r1; ++i) - { - if (vec[i] != T(0)) - { - return T(1); - } - } - - return T(0); - } - }; - - template - class any_false : public exprtk::igeneric_function - { - public: - - typedef typename exprtk::igeneric_function igfun_t; - typedef typename igfun_t::parameter_list_t parameter_list_t; - typedef typename igfun_t::generic_type generic_type; - typedef typename generic_type::vector_view vector_t; - - using exprtk::igeneric_function::operator(); - - any_false() - : exprtk::igeneric_function("V|VTT") - /* - Overloads: - 0. V - vector - 1. VTT - vector, r0, r1 - */ - {} - - inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) - { - const vector_t vec(parameters[0]); - - std::size_t r0 = 0; - std::size_t r1 = vec.size() - 1; - - if ( - (1 == ps_index) && - !helper::load_vector_range::process(parameters, r0, r1, 1, 2, 0) - ) - return std::numeric_limits::quiet_NaN(); - - for (std::size_t i = r0; i <= r1; ++i) - { - if (vec[i] == T(0)) - { - return T(1); - } - } - - return T(0); - } - }; - - template - class count : public exprtk::igeneric_function - { - public: - - typedef typename exprtk::igeneric_function igfun_t; - typedef typename igfun_t::parameter_list_t parameter_list_t; - typedef typename igfun_t::generic_type generic_type; - typedef typename generic_type::vector_view vector_t; - - using exprtk::igeneric_function::operator(); - - count() - : exprtk::igeneric_function("V|VTT") - /* - Overloads: - 0. V - vector - 1. VTT - vector, r0, r1 - */ - {} - - inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) - { - const vector_t vec(parameters[0]); - - std::size_t r0 = 0; - std::size_t r1 = vec.size() - 1; - - if ( - (1 == ps_index) && - !helper::load_vector_range::process(parameters, r0, r1, 1, 2, 0) - ) - return std::numeric_limits::quiet_NaN(); - - std::size_t cnt = 0; - - for (std::size_t i = r0; i <= r1; ++i) - { - if (vec[i] != T(0)) ++cnt; - } - - return T(cnt); - } - }; - - template - class copy : public exprtk::igeneric_function + class all_true exprtk_final : public exprtk::igeneric_function { public: @@ -40053,7 +44275,318 @@ namespace exprtk typedef typename generic_type::scalar_view scalar_t; typedef typename generic_type::vector_view vector_t; - using exprtk::igeneric_function::operator(); + using igfun_t::operator(); + + all_true() + : exprtk::igeneric_function("V|VTT|T*") + /* + Overloads: + 0. V - vector + 1. VTT - vector, r0, r1 + 2. T* - T....T + */ + {} + + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override + { + if (2 == ps_index) + { + for (std::size_t i = 0; i < parameters.size(); ++i) + { + if (scalar_t(parameters[i])() == T(0)) + { + return T(0); + } + } + } + else + { + const vector_t vec(parameters[0]); + + std::size_t r0 = 0; + std::size_t r1 = vec.size() - 1; + + if ( + (1 == ps_index) && + !helper::load_vector_range::process(parameters, r0, r1, 1, 2, 0) + ) + { + return std::numeric_limits::quiet_NaN(); + } + + for (std::size_t i = r0; i <= r1; ++i) + { + if (vec[i] == T(0)) + { + return T(0); + } + } + } + + return T(1); + } + }; + + template + class all_false exprtk_final : public exprtk::igeneric_function + { + public: + + typedef typename exprtk::igeneric_function igfun_t; + typedef typename igfun_t::parameter_list_t parameter_list_t; + typedef typename igfun_t::generic_type generic_type; + typedef typename generic_type::scalar_view scalar_t; + typedef typename generic_type::vector_view vector_t; + + using igfun_t::operator(); + + all_false() + : exprtk::igeneric_function("V|VTT|T*") + /* + Overloads: + 0. V - vector + 1. VTT - vector, r0, r1 + 2. T* - T....T + */ + {} + + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override + { + if (2 == ps_index) + { + for (std::size_t i = 0; i < parameters.size(); ++i) + { + if (scalar_t(parameters[i])() != T(0)) + { + return T(0); + } + } + } + else + { + const vector_t vec(parameters[0]); + + std::size_t r0 = 0; + std::size_t r1 = vec.size() - 1; + + if ( + (1 == ps_index) && + !helper::load_vector_range::process(parameters, r0, r1, 1, 2, 0) + ) + { + return std::numeric_limits::quiet_NaN(); + } + + for (std::size_t i = r0; i <= r1; ++i) + { + if (vec[i] != T(0)) + { + return T(0); + } + } + } + + return T(1); + } + }; + + template + class any_true exprtk_final : public exprtk::igeneric_function + { + public: + + typedef typename exprtk::igeneric_function igfun_t; + typedef typename igfun_t::parameter_list_t parameter_list_t; + typedef typename igfun_t::generic_type generic_type; + typedef typename generic_type::scalar_view scalar_t; + typedef typename generic_type::vector_view vector_t; + + using igfun_t::operator(); + + any_true() + : exprtk::igeneric_function("V|VTT|T*") + /* + Overloads: + 0. V - vector + 1. VTT - vector, r0, r1 + 2. T* - T....T + */ + {} + + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override + { + if (2 == ps_index) + { + for (std::size_t i = 0; i < parameters.size(); ++i) + { + if (scalar_t(parameters[i])() != T(0)) + { + return T(1); + } + } + } + else + { + const vector_t vec(parameters[0]); + + std::size_t r0 = 0; + std::size_t r1 = vec.size() - 1; + + if ( + (1 == ps_index) && + !helper::load_vector_range::process(parameters, r0, r1, 1, 2, 0) + ) + { + return std::numeric_limits::quiet_NaN(); + } + + for (std::size_t i = r0; i <= r1; ++i) + { + if (vec[i] != T(0)) + { + return T(1); + } + } + } + + return T(0); + } + }; + + template + class any_false exprtk_final : public exprtk::igeneric_function + { + public: + + typedef typename exprtk::igeneric_function igfun_t; + typedef typename igfun_t::parameter_list_t parameter_list_t; + typedef typename igfun_t::generic_type generic_type; + typedef typename generic_type::scalar_view scalar_t; + typedef typename generic_type::vector_view vector_t; + + using igfun_t::operator(); + + any_false() + : exprtk::igeneric_function("V|VTT|T*") + /* + Overloads: + 0. V - vector + 1. VTT - vector, r0, r1 + 2. T* - T....T + */ + {} + + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override + { + if (2 == ps_index) + { + for (std::size_t i = 0; i < parameters.size(); ++i) + { + if (scalar_t(parameters[i])() == T(0)) + { + return T(1); + } + } + } + else + { + const vector_t vec(parameters[0]); + + std::size_t r0 = 0; + std::size_t r1 = vec.size() - 1; + + if ( + (1 == ps_index) && + !helper::load_vector_range::process(parameters, r0, r1, 1, 2, 0) + ) + { + return std::numeric_limits::quiet_NaN(); + } + + for (std::size_t i = r0; i <= r1; ++i) + { + if (vec[i] == T(0)) + { + return T(1); + } + } + } + + return T(0); + } + }; + + template + class count exprtk_final : public exprtk::igeneric_function + { + public: + + typedef typename exprtk::igeneric_function igfun_t; + typedef typename igfun_t::parameter_list_t parameter_list_t; + typedef typename igfun_t::generic_type generic_type; + typedef typename generic_type::scalar_view scalar_t; + typedef typename generic_type::vector_view vector_t; + + using igfun_t::operator(); + + count() + : exprtk::igeneric_function("V|VTT|T*") + /* + Overloads: + 0. V - vector + 1. VTT - vector, r0, r1 + 2. T* - T....T + */ + {} + + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override + { + std::size_t cnt = 0; + + if (2 == ps_index) + { + for (std::size_t i = 0; i < parameters.size(); ++i) + { + if (scalar_t(parameters[i])() != T(0)) ++cnt; + } + } + else + { + const vector_t vec(parameters[0]); + + std::size_t r0 = 0; + std::size_t r1 = vec.size() - 1; + + if ( + (1 == ps_index) && + !helper::load_vector_range::process(parameters, r0, r1, 1, 2, 0) + ) + { + return std::numeric_limits::quiet_NaN(); + } + + for (std::size_t i = r0; i <= r1; ++i) + { + if (vec[i] != T(0)) ++cnt; + } + } + + return T(cnt); + } + }; + + template + class copy exprtk_final : public exprtk::igeneric_function + { + public: + + typedef typename exprtk::igeneric_function igfun_t; + typedef typename igfun_t::parameter_list_t parameter_list_t; + typedef typename igfun_t::generic_type generic_type; + typedef typename generic_type::scalar_view scalar_t; + typedef typename generic_type::vector_view vector_t; + + using igfun_t::operator(); copy() : exprtk::igeneric_function("VV|VTTVTT") @@ -40064,7 +44597,7 @@ namespace exprtk */ {} - inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override { const vector_t x(parameters[0]); vector_t y(parameters[(0 == ps_index) ? 1 : 3]); @@ -40096,7 +44629,7 @@ namespace exprtk }; template - class rol : public exprtk::igeneric_function + class rol exprtk_final : public exprtk::igeneric_function { public: @@ -40106,7 +44639,7 @@ namespace exprtk typedef typename generic_type::scalar_view scalar_t; typedef typename generic_type::vector_view vector_t; - using exprtk::igeneric_function::operator(); + using igfun_t::operator(); rol() : exprtk::igeneric_function("VT|VTTT") @@ -40117,7 +44650,7 @@ namespace exprtk */ {} - inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override { vector_t vec(parameters[0]); @@ -40147,7 +44680,7 @@ namespace exprtk }; template - class ror : public exprtk::igeneric_function + class ror exprtk_final : public exprtk::igeneric_function { public: @@ -40157,7 +44690,7 @@ namespace exprtk typedef typename generic_type::scalar_view scalar_t; typedef typename generic_type::vector_view vector_t; - using exprtk::igeneric_function::operator(); + using igfun_t::operator(); ror() : exprtk::igeneric_function("VT|VTTT") @@ -40168,7 +44701,7 @@ namespace exprtk */ {} - inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override { vector_t vec(parameters[0]); @@ -40185,8 +44718,8 @@ namespace exprtk ) return T(0); - std::size_t dist = r1 - r0 + 1; - std::size_t shift = (dist - (n % dist)) % dist; + const std::size_t dist = r1 - r0 + 1; + const std::size_t shift = (dist - (n % dist)) % dist; std::rotate( vec.begin() + r0, @@ -40198,7 +44731,7 @@ namespace exprtk }; template - class shift_left : public exprtk::igeneric_function + class reverse exprtk_final : public exprtk::igeneric_function { public: @@ -40208,7 +44741,48 @@ namespace exprtk typedef typename generic_type::scalar_view scalar_t; typedef typename generic_type::vector_view vector_t; - using exprtk::igeneric_function::operator(); + using igfun_t::operator(); + + reverse() + : exprtk::igeneric_function("V|VTT") + /* + Overloads: + 0. V - vector + 1. VTT - vector, r0, r1 + */ + {} + + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override + { + vector_t vec(parameters[0]); + + std::size_t r0 = 0; + std::size_t r1 = vec.size() - 1; + + if ( + (1 == ps_index) && + !helper::load_vector_range::process(parameters, r0, r1, 1, 2, 0) + ) + return T(0); + + std::reverse(vec.begin() + r0, vec.begin() + r1 + 1); + + return T(1); + } + }; + + template + class shift_left exprtk_final : public exprtk::igeneric_function + { + public: + + typedef typename exprtk::igeneric_function igfun_t; + typedef typename igfun_t::parameter_list_t parameter_list_t; + typedef typename igfun_t::generic_type generic_type; + typedef typename generic_type::scalar_view scalar_t; + typedef typename generic_type::vector_view vector_t; + + using igfun_t::operator(); shift_left() : exprtk::igeneric_function("VT|VTTT") @@ -40219,7 +44793,7 @@ namespace exprtk */ {} - inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override { vector_t vec(parameters[0]); @@ -40256,7 +44830,7 @@ namespace exprtk }; template - class shift_right : public exprtk::igeneric_function + class shift_right exprtk_final : public exprtk::igeneric_function { public: @@ -40266,7 +44840,7 @@ namespace exprtk typedef typename generic_type::scalar_view scalar_t; typedef typename generic_type::vector_view vector_t; - using exprtk::igeneric_function::operator(); + using igfun_t::operator(); shift_right() : exprtk::igeneric_function("VT|VTTT") @@ -40277,7 +44851,7 @@ namespace exprtk */ {} - inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override { vector_t vec(parameters[0]); @@ -40316,7 +44890,7 @@ namespace exprtk }; template - class sort : public exprtk::igeneric_function + class sort exprtk_final : public exprtk::igeneric_function { public: @@ -40326,7 +44900,7 @@ namespace exprtk typedef typename generic_type::string_view string_t; typedef typename generic_type::vector_view vector_t; - using exprtk::igeneric_function::operator(); + using igfun_t::operator(); sort() : exprtk::igeneric_function("V|VTT|VS|VSTT") @@ -40339,7 +44913,7 @@ namespace exprtk */ {} - inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override { vector_t vec(parameters[0]); @@ -40379,7 +44953,7 @@ namespace exprtk }; template - class nthelement : public exprtk::igeneric_function + class nthelement exprtk_final : public exprtk::igeneric_function { public: @@ -40389,7 +44963,7 @@ namespace exprtk typedef typename generic_type::scalar_view scalar_t; typedef typename generic_type::vector_view vector_t; - using exprtk::igeneric_function::operator(); + using igfun_t::operator(); nthelement() : exprtk::igeneric_function("VT|VTTT") @@ -40400,7 +44974,7 @@ namespace exprtk */ {} - inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override { vector_t vec(parameters[0]); @@ -40412,7 +44986,9 @@ namespace exprtk return T(0); if ((1 == ps_index) && !helper::load_vector_range::process(parameters, r0, r1, 2, 3, 0)) + { return std::numeric_limits::quiet_NaN(); + } std::nth_element( vec.begin() + r0, @@ -40424,7 +45000,7 @@ namespace exprtk }; template - class iota : public exprtk::igeneric_function + class assign exprtk_final : public exprtk::igeneric_function { public: @@ -40434,41 +45010,41 @@ namespace exprtk typedef typename generic_type::scalar_view scalar_t; typedef typename generic_type::vector_view vector_t; - using exprtk::igeneric_function::operator(); + using igfun_t::operator(); - iota() - : exprtk::igeneric_function("VT|VTT|VTTT|VTTTT") + assign() + : exprtk::igeneric_function("VT|VTTT|VTTTT") /* Overloads: - 0. VT - vector, increment - 1. VTT - vector, increment, base - 2. VTTTT - vector, increment, r0, r1 - 3. VTTTT - vector, increment, base, r0, r1 + 0. VT - vector, V + 1. VTTT - vector, V, r0, r1 + 2. VTTTT - vector, V, r0, r1, SS */ {} - inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override { vector_t vec(parameters[0]); - T increment = scalar_t(parameters[1])(); - T base = ((1 == ps_index) || (3 == ps_index)) ? scalar_t(parameters[2])() : T(0); + const T assign_value = scalar_t(parameters[1]); + + const std::size_t step_size = (2 != ps_index) ? 1 : + static_cast(scalar_t(parameters.back())()); std::size_t r0 = 0; std::size_t r1 = vec.size() - 1; - if ((2 == ps_index) && !helper::load_vector_range::process(parameters, r0, r1, 2, 3, 0)) - return std::numeric_limits::quiet_NaN(); - else if ((3 == ps_index) && !helper::load_vector_range::process(parameters, r0, r1, 3, 4, 0)) - return std::numeric_limits::quiet_NaN(); - else + if ( + ((ps_index == 1) || (ps_index == 2)) && + !helper::load_vector_range::process(parameters, r0, r1, 2, 3, 0) + ) { - long long j = 0; + return T(0); + } - for (std::size_t i = r0; i <= r1; ++i, ++j) - { - vec[i] = base + (increment * j); - } + for (std::size_t i = r0; i <= r1; i += step_size) + { + vec[i] = assign_value; } return T(1); @@ -40476,40 +45052,110 @@ namespace exprtk }; template - class sumk : public exprtk::igeneric_function + class iota exprtk_final : public exprtk::igeneric_function { public: typedef typename exprtk::igeneric_function igfun_t; typedef typename igfun_t::parameter_list_t parameter_list_t; typedef typename igfun_t::generic_type generic_type; + typedef typename generic_type::scalar_view scalar_t; typedef typename generic_type::vector_view vector_t; - using exprtk::igeneric_function::operator(); + using igfun_t::operator(); - sumk() - : exprtk::igeneric_function("V|VTT") + iota() + : exprtk::igeneric_function("VTT|VT|VTTTT|VTTT") /* Overloads: - 0. V - vector - 1. VTT - vector, r0, r1 + 0. VTT - vector, SV, SS + 1. VT - vector, SV, SS (+1) + 2. VTTT - vector, r0, r1, SV, SS + 3. VTT - vector, r0, r1, SV, SS (+1) + + Where: + 1. SV - Start value + 2. SS - Step size */ {} - inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override { - const vector_t vec(parameters[0]); + vector_t vec(parameters[0]); + + const T start_value = (ps_index <= 1) ? + scalar_t(parameters[1]) : + scalar_t(parameters[3]) ; + + const T step_size = ((0 == ps_index) || (2 == ps_index)) ? + scalar_t(parameters.back())() : + T(1) ; std::size_t r0 = 0; std::size_t r1 = vec.size() - 1; - if ((1 == ps_index) && !helper::load_vector_range::process(parameters, r0, r1, 1, 2, 0)) + if ( + ((ps_index == 2) || (ps_index == 3)) && + !helper::load_vector_range::process(parameters, r0, r1, 1, 2, 0) + ) + { + return T(0); + } + + for (std::size_t i = r0; i <= r1; ++i) + { + vec[i] = start_value + ((i - r0) * step_size); + } + + return T(1); + } + }; + + template + class sumk exprtk_final : public exprtk::igeneric_function + { + public: + + typedef typename exprtk::igeneric_function igfun_t; + typedef typename igfun_t::parameter_list_t parameter_list_t; + typedef typename igfun_t::generic_type generic_type; + typedef typename generic_type::scalar_view scalar_t; + typedef typename generic_type::vector_view vector_t; + + using igfun_t::operator(); + + sumk() + : exprtk::igeneric_function("V|VTT|VTTT") + /* + Overloads: + 0. V - vector + 1. VTT - vector, r0, r1 + 2. VTTT - vector, r0, r1, stride + */ + {} + + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override + { + const vector_t vec(parameters[0]); + + const std::size_t stride = (2 != ps_index) ? 1 : + static_cast(scalar_t(parameters[3])()); + + std::size_t r0 = 0; + std::size_t r1 = vec.size() - 1; + + if ( + ((1 == ps_index) || (2 == ps_index)) && + !helper::load_vector_range::process(parameters, r0, r1, 1, 2, 0) + ) + { return std::numeric_limits::quiet_NaN(); + } T result = T(0); T error = T(0); - for (std::size_t i = r0; i <= r1; ++i) + for (std::size_t i = r0; i <= r1; i += stride) { details::kahan_sum(result, error, vec[i]); } @@ -40519,7 +45165,7 @@ namespace exprtk }; template - class axpy : public exprtk::igeneric_function + class axpy exprtk_final : public exprtk::igeneric_function { public: @@ -40529,7 +45175,7 @@ namespace exprtk typedef typename generic_type::scalar_view scalar_t; typedef typename generic_type::vector_view vector_t; - using exprtk::igeneric_function::operator(); + using igfun_t::operator(); axpy() : exprtk::igeneric_function("TVV|TVVTT") @@ -40541,7 +45187,7 @@ namespace exprtk */ {} - inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override { const vector_t x(parameters[1]); vector_t y(parameters[2]); @@ -40566,7 +45212,7 @@ namespace exprtk }; template - class axpby : public exprtk::igeneric_function + class axpby exprtk_final : public exprtk::igeneric_function { public: @@ -40576,7 +45222,7 @@ namespace exprtk typedef typename generic_type::scalar_view scalar_t; typedef typename generic_type::vector_view vector_t; - using exprtk::igeneric_function::operator(); + using igfun_t::operator(); axpby() : exprtk::igeneric_function("TVTV|TVTVTT") @@ -40588,7 +45234,7 @@ namespace exprtk */ {} - inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override { const vector_t x(parameters[1]); vector_t y(parameters[3]); @@ -40614,7 +45260,7 @@ namespace exprtk }; template - class axpyz : public exprtk::igeneric_function + class axpyz exprtk_final : public exprtk::igeneric_function { public: @@ -40624,7 +45270,7 @@ namespace exprtk typedef typename generic_type::scalar_view scalar_t; typedef typename generic_type::vector_view vector_t; - using exprtk::igeneric_function::operator(); + using igfun_t::operator(); axpyz() : exprtk::igeneric_function("TVVV|TVVVTT") @@ -40636,7 +45282,7 @@ namespace exprtk */ {} - inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override { const vector_t x(parameters[1]); const vector_t y(parameters[2]); @@ -40645,7 +45291,7 @@ namespace exprtk std::size_t r0 = 0; std::size_t r1 = std::min(x.size(),y.size()) - 1; - if ((1 == ps_index) && !helper::load_vector_range::process(parameters, r0, r1, 3, 4, 1)) + if ((1 == ps_index) && !helper::load_vector_range::process(parameters, r0, r1, 4, 5, 1)) return std::numeric_limits::quiet_NaN(); else if (helper::invalid_range(y, r0, r1)) return std::numeric_limits::quiet_NaN(); @@ -40664,7 +45310,7 @@ namespace exprtk }; template - class axpbyz : public exprtk::igeneric_function + class axpbyz exprtk_final : public exprtk::igeneric_function { public: @@ -40674,7 +45320,7 @@ namespace exprtk typedef typename generic_type::scalar_view scalar_t; typedef typename generic_type::vector_view vector_t; - using exprtk::igeneric_function::operator(); + using igfun_t::operator(); axpbyz() : exprtk::igeneric_function("TVTVV|TVTVVTT") @@ -40686,7 +45332,7 @@ namespace exprtk */ {} - inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override { const vector_t x(parameters[1]); const vector_t y(parameters[3]); @@ -40695,7 +45341,7 @@ namespace exprtk std::size_t r0 = 0; std::size_t r1 = std::min(x.size(),y.size()) - 1; - if ((1 == ps_index) && !helper::load_vector_range::process(parameters, r0, r1, 4, 5, 1)) + if ((1 == ps_index) && !helper::load_vector_range::process(parameters, r0, r1, 5, 6, 1)) return std::numeric_limits::quiet_NaN(); else if (helper::invalid_range(y, r0, r1)) return std::numeric_limits::quiet_NaN(); @@ -40715,7 +45361,7 @@ namespace exprtk }; template - class axpbz : public exprtk::igeneric_function + class axpbsy exprtk_final : public exprtk::igeneric_function { public: @@ -40725,7 +45371,110 @@ namespace exprtk typedef typename generic_type::scalar_view scalar_t; typedef typename generic_type::vector_view vector_t; - using exprtk::igeneric_function::operator(); + using igfun_t::operator(); + + axpbsy() + : exprtk::igeneric_function("TVTTV|TVTTVTT") + /* + y <- ax + by + Overloads: + 0. TVTVV - a, x(vector), b, shift, y(vector), z(vector) + 1. TVTVVTT - a, x(vector), b, shift, y(vector), z(vector), r0, r1 + */ + {} + + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override + { + const vector_t x(parameters[1]); + vector_t y(parameters[4]); + + std::size_t r0 = 0; + std::size_t r1 = std::min(x.size(),y.size()) - 1; + + if ((1 == ps_index) && !helper::load_vector_range::process(parameters, r0, r1, 5, 6, 1)) + return std::numeric_limits::quiet_NaN(); + else if (helper::invalid_range(y, r0, r1)) + return std::numeric_limits::quiet_NaN(); + + const T a = scalar_t(parameters[0])(); + const T b = scalar_t(parameters[2])(); + + const std::size_t s = static_cast(scalar_t(parameters[3])()); + + for (std::size_t i = r0; i <= r1; ++i) + { + y[i] = (a * x[i]) + (b * y[i + s]); + } + + return T(1); + } + }; + + template + class axpbsyz exprtk_final : public exprtk::igeneric_function + { + public: + + typedef typename exprtk::igeneric_function igfun_t; + typedef typename igfun_t::parameter_list_t parameter_list_t; + typedef typename igfun_t::generic_type generic_type; + typedef typename generic_type::scalar_view scalar_t; + typedef typename generic_type::vector_view vector_t; + + using igfun_t::operator(); + + axpbsyz() + : exprtk::igeneric_function("TVTTVV|TVTTVVTT") + /* + z <- ax + by + Overloads: + 0. TVTVV - a, x(vector), b, shift, y(vector), z(vector) + 1. TVTVVTT - a, x(vector), b, shift, y(vector), z(vector), r0, r1 + */ + {} + + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override + { + const vector_t x(parameters[1]); + const vector_t y(parameters[4]); + vector_t z(parameters[5]); + + std::size_t r0 = 0; + std::size_t r1 = std::min(x.size(),y.size()) - 1; + + if ((1 == ps_index) && !helper::load_vector_range::process(parameters, r0, r1, 6, 7, 1)) + return std::numeric_limits::quiet_NaN(); + else if (helper::invalid_range(y, r0, r1)) + return std::numeric_limits::quiet_NaN(); + else if (helper::invalid_range(z, r0, r1)) + return std::numeric_limits::quiet_NaN(); + + const T a = scalar_t(parameters[0])(); + const T b = scalar_t(parameters[2])(); + + const std::size_t s = static_cast(scalar_t(parameters[3])()); + + for (std::size_t i = r0; i <= r1; ++i) + { + z[i] = (a * x[i]) + (b * y[i + s]); + } + + return T(1); + } + }; + + template + class axpbz exprtk_final : public exprtk::igeneric_function + { + public: + + typedef typename exprtk::igeneric_function igfun_t; + typedef typename igfun_t::parameter_list_t parameter_list_t; + typedef typename igfun_t::generic_type generic_type; + typedef typename generic_type::scalar_view scalar_t; + typedef typename generic_type::vector_view vector_t; + + using igfun_t::operator(); axpbz() : exprtk::igeneric_function("TVTV|TVTVTT") @@ -40737,7 +45486,7 @@ namespace exprtk */ {} - inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override { const vector_t x(parameters[1]); vector_t z(parameters[3]); @@ -40763,7 +45512,7 @@ namespace exprtk }; template - class dot : public exprtk::igeneric_function + class diff exprtk_final : public exprtk::igeneric_function { public: @@ -40773,7 +45522,55 @@ namespace exprtk typedef typename generic_type::scalar_view scalar_t; typedef typename generic_type::vector_view vector_t; - using exprtk::igeneric_function::operator(); + using igfun_t::operator(); + + diff() + : exprtk::igeneric_function("VV|VVT") + /* + x_(i - stride) - x_i + Overloads: + 0. VV - x(vector), y(vector) + 1. VVT - x(vector), y(vector), stride + */ + {} + + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override + { + const vector_t x(parameters[0]); + vector_t y(parameters[1]); + + const std::size_t r0 = 0; + const std::size_t r1 = std::min(x.size(),y.size()) - 1; + + const std::size_t stride = (1 != ps_index) ? 1 : + std::min(r1,static_cast(scalar_t(parameters[2])())); + + for (std::size_t i = 0; i < stride; ++i) + { + y[i] = std::numeric_limits::quiet_NaN(); + } + + for (std::size_t i = (r0 + stride); i <= r1; ++i) + { + y[i] = x[i] - x[i - stride]; + } + + return T(1); + } + }; + + template + class dot exprtk_final : public exprtk::igeneric_function + { + public: + + typedef typename exprtk::igeneric_function igfun_t; + typedef typename igfun_t::parameter_list_t parameter_list_t; + typedef typename igfun_t::generic_type generic_type; + typedef typename generic_type::scalar_view scalar_t; + typedef typename generic_type::vector_view vector_t; + + using igfun_t::operator(); dot() : exprtk::igeneric_function("VV|VVTT") @@ -40784,7 +45581,7 @@ namespace exprtk */ {} - inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override { const vector_t x(parameters[0]); const vector_t y(parameters[1]); @@ -40809,7 +45606,7 @@ namespace exprtk }; template - class dotk : public exprtk::igeneric_function + class dotk exprtk_final : public exprtk::igeneric_function { public: @@ -40819,7 +45616,7 @@ namespace exprtk typedef typename generic_type::scalar_view scalar_t; typedef typename generic_type::vector_view vector_t; - using exprtk::igeneric_function::operator(); + using igfun_t::operator(); dotk() : exprtk::igeneric_function("VV|VVTT") @@ -40830,7 +45627,7 @@ namespace exprtk */ {} - inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override { const vector_t x(parameters[0]); const vector_t y(parameters[1]); @@ -40855,30 +45652,155 @@ namespace exprtk } }; + template + class threshold_below exprtk_final : public exprtk::igeneric_function + { + public: + + typedef typename exprtk::igeneric_function igfun_t; + typedef typename igfun_t::parameter_list_t parameter_list_t; + typedef typename igfun_t::generic_type generic_type; + typedef typename generic_type::scalar_view scalar_t; + typedef typename generic_type::vector_view vector_t; + + using igfun_t::operator(); + + threshold_below() + : exprtk::igeneric_function("VTT|VTTTT") + /* + Overloads: + 0. VTT - vector, TV, SV + 1. VTTTT - vector, r0, r1, TV, SV + + Where: + TV - Threshold value + SV - Snap-to value + */ + {} + + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override + { + vector_t vec(parameters[0]); + + const T threshold_value = (0 == ps_index) ? + scalar_t(parameters[1]) : + scalar_t(parameters[3]) ; + + const T snap_value = scalar_t(parameters.back()); + + std::size_t r0 = 0; + std::size_t r1 = vec.size() - 1; + + if ( + (1 == ps_index) && + !helper::load_vector_range::process(parameters, r0, r1, 1, 2, 0) + ) + { + return T(0); + } + + for (std::size_t i = r0; i <= r1; ++i) + { + if (vec[i] < threshold_value) + { + vec[i] = snap_value; + } + } + + return T(1); + } + }; + + template + class threshold_above exprtk_final : public exprtk::igeneric_function + { + public: + + typedef typename exprtk::igeneric_function igfun_t; + typedef typename igfun_t::parameter_list_t parameter_list_t; + typedef typename igfun_t::generic_type generic_type; + typedef typename generic_type::scalar_view scalar_t; + typedef typename generic_type::vector_view vector_t; + + using igfun_t::operator(); + + threshold_above() + : exprtk::igeneric_function("VTT|VTTTT") + /* + Overloads: + 0. VTT - vector, TV, SV + 1. VTTTT - vector, r0, r1, TV, SV + + Where: + TV - Threshold value + SV - Snap-to value + */ + {} + + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) exprtk_override + { + vector_t vec(parameters[0]); + + const T threshold_value = (0 == ps_index) ? + scalar_t(parameters[1]) : + scalar_t(parameters[3]) ; + + const T snap_value = scalar_t(parameters.back()); + + std::size_t r0 = 0; + std::size_t r1 = vec.size() - 1; + + if ( + (1 == ps_index) && + !helper::load_vector_range::process(parameters, r0, r1, 1, 2, 0) + ) + { + return T(0); + } + + for (std::size_t i = r0; i <= r1; ++i) + { + if (vec[i] > threshold_value) + { + vec[i] = snap_value; + } + } + + return T(1); + } + }; + template struct package { - all_true at; - all_false af; - any_true nt; - any_false nf; - count c; - copy cp; - rol rl; - ror rr; - shift_left sl; - shift_right sr; - sort st; - nthelement ne; - iota ia; - sumk sk; - axpy b1_axpy; - axpby b1_axpby; - axpyz b1_axpyz; - axpbyz b1_axpbyz; - axpbz b1_axpbz; - dot dt; - dotk dtk; + all_true at; + all_false af; + any_true nt; + any_false nf; + count c; + copy cp; + rol rl; + ror rr; + reverse rev; + shift_left sl; + shift_right sr; + sort st; + nthelement ne; + assign an; + iota ia; + sumk sk; + axpy b1_axpy; + axpby b1_axpby; + axpyz b1_axpyz; + axpbyz b1_axpbyz; + axpbsy b1_axpbsy; + axpbsyz b1_axpbsyz; + axpbz b1_axpbz; + diff df; + dot dt; + dotk dtk; + threshold_above ta; + threshold_below tb; bool register_package(exprtk::symbol_table& symtab) { @@ -40891,29 +45813,36 @@ namespace exprtk return false; \ } \ - exprtk_register_function("all_true" , at ) - exprtk_register_function("all_false" , af ) - exprtk_register_function("any_true" , nt ) - exprtk_register_function("any_false" , nf ) - exprtk_register_function("count" , c ) - exprtk_register_function("copy" , cp ) - exprtk_register_function("rotate_left" , rl ) - exprtk_register_function("rol" , rl ) - exprtk_register_function("rotate_right" , rr ) - exprtk_register_function("ror" , rr ) - exprtk_register_function("shftl" , sl ) - exprtk_register_function("shftr" , sr ) - exprtk_register_function("sort" , st ) - exprtk_register_function("nth_element" , ne ) - exprtk_register_function("iota" , ia ) - exprtk_register_function("sumk" , sk ) - exprtk_register_function("axpy" , b1_axpy ) - exprtk_register_function("axpby" , b1_axpby ) - exprtk_register_function("axpyz" , b1_axpyz ) - exprtk_register_function("axpbyz" , b1_axpbyz) - exprtk_register_function("axpbz" , b1_axpbz ) - exprtk_register_function("dot" , dt ) - exprtk_register_function("dotk" , dtk ) + exprtk_register_function("all_true" , at ) + exprtk_register_function("all_false" , af ) + exprtk_register_function("any_true" , nt ) + exprtk_register_function("any_false" , nf ) + exprtk_register_function("count" , c ) + exprtk_register_function("copy" , cp ) + exprtk_register_function("rotate_left" , rl ) + exprtk_register_function("rol" , rl ) + exprtk_register_function("rotate_right" , rr ) + exprtk_register_function("ror" , rr ) + exprtk_register_function("reverse" , rev ) + exprtk_register_function("shftl" , sl ) + exprtk_register_function("shftr" , sr ) + exprtk_register_function("sort" , st ) + exprtk_register_function("nth_element" , ne ) + exprtk_register_function("assign" , an ) + exprtk_register_function("iota" , ia ) + exprtk_register_function("sumk" , sk ) + exprtk_register_function("axpy" , b1_axpy ) + exprtk_register_function("axpby" , b1_axpby ) + exprtk_register_function("axpyz" , b1_axpyz ) + exprtk_register_function("axpbyz" , b1_axpbyz ) + exprtk_register_function("axpbsy" , b1_axpbsy ) + exprtk_register_function("axpbsyz" , b1_axpbsyz) + exprtk_register_function("axpbz" , b1_axpbz ) + exprtk_register_function("diff" , df ) + exprtk_register_function("dot" , dt ) + exprtk_register_function("dotk" , dtk ) + exprtk_register_function("threshold_above" , ta ) + exprtk_register_function("threshold_below" , tb ) #undef exprtk_register_function return true; @@ -40932,11 +45861,11 @@ namespace exprtk using ::exprtk::details::char_cptr; static char_cptr library = "Mathematical Expression Toolkit"; - static char_cptr version = "2.71828182845904523536028747135266" - "2497757247093699959574966967627724" - "0766303535475945713821785251664274" - "2746639193200305992181741359662904"; - static char_cptr date = "20230101"; + static char_cptr version = "2.71828182845904523536028747135266249775" + "7247093699959574966967627724076630353547" + "5945713821785251664274274663919320030599" + "2181741359662904357290033429526059563073"; + static char_cptr date = "20240101"; static char_cptr min_cpp = "199711L"; static inline std::string data() @@ -40958,12 +45887,8 @@ namespace exprtk #undef exprtk_error_location #endif - #ifdef exprtk_disable_fallthrough_begin - #undef exprtk_disable_fallthrough_begin - #endif - - #ifdef exprtk_disable_fallthrough_end - #undef exprtk_disable_fallthrough_end + #ifdef exprtk_fallthrough + #undef exprtk_fallthrough #endif #ifdef exprtk_override From b0344a1e72ae9eccf7145e64d2f0b3bebadb1443 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 13 Nov 2024 11:21:28 +0100 Subject: [PATCH 104/160] Logging: Skip identical messages logged close in time There can be situations where multiple identical log messages are computed in a short time interval. Default time interval is set to 1 second, if the message is reported after this interval, the message is added to the log. --- .../Application/Tools/RiaLogging.cpp | 54 +++++++++++++++++++ .../Application/Tools/RiaLogging.h | 6 +++ 2 files changed, 60 insertions(+) diff --git a/ApplicationLibCode/Application/Tools/RiaLogging.cpp b/ApplicationLibCode/Application/Tools/RiaLogging.cpp index 5e271f1403..87e28e7932 100644 --- a/ApplicationLibCode/Application/Tools/RiaLogging.cpp +++ b/ApplicationLibCode/Application/Tools/RiaLogging.cpp @@ -163,6 +163,42 @@ void RiaDefaultConsoleLogger::writeToConsole( const std::string& str ) #endif } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaLogging::setLastMessage( const QString& message ) +{ +#pragma omp critical( critical_section_logging ) + { + sm_lastMessage = message; + sm_lastMessageTime = std::chrono::high_resolution_clock::now(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiaLogging::isSameMessage( const QString& message ) +{ + bool isSame = false; + +#pragma omp critical( critical_section_logging ) + { + if ( message == sm_lastMessage ) + { + auto now = std::chrono::high_resolution_clock::now(); + auto duration = std::chrono::duration_cast( now - sm_lastMessageTime ); + + if ( duration.count() < 1000 ) + { + isSame = true; + } + } + } + + return isSame; +} + //================================================================================================== // // @@ -171,6 +207,8 @@ void RiaDefaultConsoleLogger::writeToConsole( const std::string& str ) std::vector> RiaLogging::sm_logger; std::chrono::time_point RiaLogging::sm_startTime; +QString RiaLogging::sm_lastMessage; +std::chrono::time_point RiaLogging::sm_lastMessageTime; //-------------------------------------------------------------------------------------------------- /// @@ -209,6 +247,8 @@ RILogLevel RiaLogging::logLevelBasedOnPreferences() //-------------------------------------------------------------------------------------------------- void RiaLogging::error( const QString& message ) { + if ( isSameMessage( message ) ) return; + for ( const auto& logger : sm_logger ) { if ( logger && logger->level() >= int( RILogLevel::RI_LL_ERROR ) ) @@ -217,6 +257,8 @@ void RiaLogging::error( const QString& message ) logger->error( message.toLatin1().constData() ); } } + + setLastMessage( message ); } //-------------------------------------------------------------------------------------------------- @@ -224,6 +266,8 @@ void RiaLogging::error( const QString& message ) //-------------------------------------------------------------------------------------------------- void RiaLogging::warning( const QString& message ) { + if ( isSameMessage( message ) ) return; + for ( const auto& logger : sm_logger ) { if ( logger && logger->level() >= int( RILogLevel::RI_LL_WARNING ) ) @@ -232,6 +276,8 @@ void RiaLogging::warning( const QString& message ) logger->warning( message.toLatin1().constData() ); } } + + setLastMessage( message ); } //-------------------------------------------------------------------------------------------------- @@ -239,6 +285,8 @@ void RiaLogging::warning( const QString& message ) //-------------------------------------------------------------------------------------------------- void RiaLogging::info( const QString& message ) { + if ( isSameMessage( message ) ) return; + for ( const auto& logger : sm_logger ) { if ( logger && logger->level() >= int( RILogLevel::RI_LL_INFO ) ) @@ -247,6 +295,8 @@ void RiaLogging::info( const QString& message ) logger->info( message.toLatin1().constData() ); } } + + setLastMessage( message ); } //-------------------------------------------------------------------------------------------------- @@ -254,6 +304,8 @@ void RiaLogging::info( const QString& message ) //-------------------------------------------------------------------------------------------------- void RiaLogging::debug( const QString& message ) { + if ( isSameMessage( message ) ) return; + for ( const auto& logger : sm_logger ) { if ( logger && logger->level() >= int( RILogLevel::RI_LL_DEBUG ) ) @@ -262,6 +314,8 @@ void RiaLogging::debug( const QString& message ) logger->debug( message.toLatin1().constData() ); } } + + setLastMessage( message ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/Tools/RiaLogging.h b/ApplicationLibCode/Application/Tools/RiaLogging.h index 768c206640..2338bc19af 100644 --- a/ApplicationLibCode/Application/Tools/RiaLogging.h +++ b/ApplicationLibCode/Application/Tools/RiaLogging.h @@ -76,9 +76,15 @@ public: static void resetTimer( const QString& message ); static void logTimeElapsed( const QString& message ); +private: + static void setLastMessage( const QString& message ); + static bool isSameMessage( const QString& message ); + private: static std::vector> sm_logger; static std::chrono::time_point sm_startTime; + static QString sm_lastMessage; + static std::chrono::time_point sm_lastMessageTime; }; //================================================================================================== From 11a3c66a0bbf3ab8f43601db2340d46ef4abcc63 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 13 Nov 2024 11:22:51 +0100 Subject: [PATCH 105/160] Make sure the vector name is visible for delta ensemble curves --- .../Summary/RimEnsembleCurveSet.cpp | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index 571b5eda60..9e6c5d877c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -1671,21 +1671,9 @@ void RimEnsembleCurveSet::appendOptionItemsForSummaryAddresses( QList addressesForEnsemble; - for ( RimSummaryCase* summaryCase : allSummaryCases ) - { - if ( !summaryCase ) continue; - - if ( auto reader = summaryCase->summaryReader() ) - { - const auto& addrs = reader->allResultAddresses(); - addressesForEnsemble.insert( addrs.begin(), addrs.end() ); - } - } - m_cachedAddressOptions.clear(); + auto addressesForEnsemble = summaryCaseGroup->ensembleSummaryAddresses(); for ( const auto& addr : addressesForEnsemble ) { std::string name = addr.uiText(); From 7550b8702c94476be330dcc2a48129078abfa2c4 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 13 Nov 2024 11:26:06 +0100 Subject: [PATCH 106/160] Rename delta ensemble and case Rename to RimDeltaSummaryCase and inherit RifSummaryReaderInterface Rename to RimDeltaSummaryEnsemble Remove obsolete RifDerivedEnsembleReader --- ...RicCloseSummaryCaseInCollectionFeature.cpp | 4 +- .../RicDeleteSummaryCaseCollectionFeature.cpp | 5 +- .../RicNewDerivedEnsembleFeature.cpp | 6 +- .../RicNewDerivedSummaryFeature.cpp | 4 +- .../RicSummaryPlotEditorUi.cpp | 2 +- .../FileInterface/CMakeLists_files.cmake | 2 - .../RifDerivedEnsembleReader.cpp | 105 ---------- .../FileInterface/RifDerivedEnsembleReader.h | 44 ----- .../AnalysisPlots/RimAnalysisPlot.cpp | 14 +- .../RimCorrelationMatrixPlot.cpp | 2 +- .../CorrelationPlots/RimCorrelationPlot.cpp | 2 +- .../RimParameterResultCrossPlot.cpp | 2 +- .../Summary/CMakeLists_files.cmake | 8 +- ...ummaryCase.cpp => RimDeltaSummaryCase.cpp} | 180 +++++++++--------- ...vedSummaryCase.h => RimDeltaSummaryCase.h} | 28 +-- ...ection.cpp => RimDeltaSummaryEnsemble.cpp} | 96 +++++----- ...Collection.h => RimDeltaSummaryEnsemble.h} | 37 ++-- .../Summary/RimEnsembleCurveSet.cpp | 2 +- .../Summary/RimSummaryCaseMainCollection.cpp | 6 +- .../Summary/RimSummaryEnsemble.cpp | 8 +- 20 files changed, 210 insertions(+), 347 deletions(-) delete mode 100644 ApplicationLibCode/FileInterface/RifDerivedEnsembleReader.cpp delete mode 100644 ApplicationLibCode/FileInterface/RifDerivedEnsembleReader.h rename ApplicationLibCode/ProjectDataModel/Summary/{RimDerivedSummaryCase.cpp => RimDeltaSummaryCase.cpp} (80%) rename ApplicationLibCode/ProjectDataModel/Summary/{RimDerivedSummaryCase.h => RimDeltaSummaryCase.h} (80%) rename ApplicationLibCode/ProjectDataModel/Summary/{RimDerivedEnsembleCaseCollection.cpp => RimDeltaSummaryEnsemble.cpp} (82%) rename ApplicationLibCode/ProjectDataModel/Summary/{RimDerivedEnsembleCaseCollection.h => RimDeltaSummaryEnsemble.h} (69%) diff --git a/ApplicationLibCode/Commands/RicCloseSummaryCaseInCollectionFeature.cpp b/ApplicationLibCode/Commands/RicCloseSummaryCaseInCollectionFeature.cpp index 2d7f8031d9..46c658c49c 100644 --- a/ApplicationLibCode/Commands/RicCloseSummaryCaseInCollectionFeature.cpp +++ b/ApplicationLibCode/Commands/RicCloseSummaryCaseInCollectionFeature.cpp @@ -22,7 +22,7 @@ #include "RicCloseSummaryCaseFeature.h" -#include "RimDerivedEnsembleCaseCollection.h" +#include "RimDeltaSummaryEnsemble.h" #include "RimMainPlotCollection.h" #include "RimProject.h" #include "RimSummaryCase.h" @@ -64,7 +64,7 @@ bool RicCloseSummaryCaseInCollectionFeature::isCommandEnabled() const summaryCaseCollections.erase( std::remove_if( summaryCaseCollections.begin(), summaryCaseCollections.end(), []( RimSummaryEnsemble* coll ) - { return dynamic_cast( coll ) != nullptr; } ), + { return dynamic_cast( coll ) != nullptr; } ), summaryCaseCollections.end() ); return ( !summaryCaseMainCollections.empty() || !summaryCaseCollections.empty() ); diff --git a/ApplicationLibCode/Commands/RicDeleteSummaryCaseCollectionFeature.cpp b/ApplicationLibCode/Commands/RicDeleteSummaryCaseCollectionFeature.cpp index 542205f6b3..1686006192 100644 --- a/ApplicationLibCode/Commands/RicDeleteSummaryCaseCollectionFeature.cpp +++ b/ApplicationLibCode/Commands/RicDeleteSummaryCaseCollectionFeature.cpp @@ -20,7 +20,7 @@ #include "Summary/RiaSummaryTools.h" -#include "RimDerivedEnsembleCaseCollection.h" +#include "RimDeltaSummaryEnsemble.h" #include "RimMainPlotCollection.h" #include "RimProject.h" #include "RimSummaryCase.h" @@ -70,8 +70,7 @@ bool RicDeleteSummaryCaseCollectionFeature::isCommandEnabled() const selection.erase( std::remove_if( selection.begin(), selection.end(), - []( RimSummaryEnsemble* coll ) - { return dynamic_cast( coll ) != nullptr; } ), + []( RimSummaryEnsemble* coll ) { return dynamic_cast( coll ) != nullptr; } ), selection.end() ); return ( !selection.empty() ); } diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDerivedEnsembleFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDerivedEnsembleFeature.cpp index b446aedbbe..a4b9959d4b 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDerivedEnsembleFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDerivedEnsembleFeature.cpp @@ -18,7 +18,7 @@ #include "RicNewDerivedEnsembleFeature.h" -#include "RimDerivedEnsembleCaseCollection.h" +#include "RimDeltaSummaryEnsemble.h" #include "RimProject.h" #include "RimSummaryCaseMainCollection.h" @@ -78,8 +78,8 @@ void RicNewDerivedEnsembleFeature::onActionTriggered( bool isChecked ) auto project = RimProject::current(); auto mainColl = project->firstSummaryCaseMainCollection(); - auto newColl = mainColl->addEnsemble( {}, "", true, []() { return new RimDerivedEnsembleCaseCollection(); } ); - auto newEnsemble = dynamic_cast( newColl ); + auto newColl = mainColl->addEnsemble( {}, "", true, []() { return new RimDeltaSummaryEnsemble(); } ); + auto newEnsemble = dynamic_cast( newColl ); { std::vector ensembles = caf::selectedObjectsByType(); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDerivedSummaryFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDerivedSummaryFeature.cpp index 57064423d2..a7f567028a 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDerivedSummaryFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDerivedSummaryFeature.cpp @@ -18,7 +18,7 @@ #include "RicNewDerivedSummaryFeature.h" -#include "RimDerivedSummaryCase.h" +#include "RimDeltaSummaryCase.h" #include "RimProject.h" #include "RimSummaryCaseMainCollection.h" @@ -46,7 +46,7 @@ void RicNewDerivedSummaryFeature::onActionTriggered( bool isChecked ) auto mainColl = mainCollection(); if ( mainColl ) { - auto derivedCase = new RimDerivedSummaryCase; + auto derivedCase = new RimDeltaSummaryCase; auto selectedCases = twoSelectedSummaryCases(); if ( selectedCases.empty() ) diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp index a9033cac38..b19ed085e4 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp @@ -25,7 +25,7 @@ #include "RiuSummaryCurveDefinitionKeywords.h" -#include "RimDerivedEnsembleCaseCollection.h" +#include "RimDeltaSummaryEnsemble.h" #include "RimEnsembleCurveSet.h" #include "RimEnsembleCurveSetCollection.h" #include "RimEnsembleCurveSetColorManager.h" diff --git a/ApplicationLibCode/FileInterface/CMakeLists_files.cmake b/ApplicationLibCode/FileInterface/CMakeLists_files.cmake index 259176ad1c..234e9ec5ab 100644 --- a/ApplicationLibCode/FileInterface/CMakeLists_files.cmake +++ b/ApplicationLibCode/FileInterface/CMakeLists_files.cmake @@ -47,7 +47,6 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RifCaseRealizationParametersReader.h ${CMAKE_CURRENT_LIST_DIR}/RifFileParseTools.h ${CMAKE_CURRENT_LIST_DIR}/RifReaderEnsembleStatisticsRft.h - ${CMAKE_CURRENT_LIST_DIR}/RifDerivedEnsembleReader.h ${CMAKE_CURRENT_LIST_DIR}/RifActiveCellsReader.h ${CMAKE_CURRENT_LIST_DIR}/RifCsvDataTableFormatter.h ${CMAKE_CURRENT_LIST_DIR}/RifEclipseInputPropertyLoader.h @@ -149,7 +148,6 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RifSummaryCaseRestartSelector.cpp ${CMAKE_CURRENT_LIST_DIR}/RifCaseRealizationParametersReader.cpp ${CMAKE_CURRENT_LIST_DIR}/RifFileParseTools.cpp - ${CMAKE_CURRENT_LIST_DIR}/RifDerivedEnsembleReader.cpp ${CMAKE_CURRENT_LIST_DIR}/RifActiveCellsReader.cpp ${CMAKE_CURRENT_LIST_DIR}/RifCsvDataTableFormatter.cpp ${CMAKE_CURRENT_LIST_DIR}/RifReaderEnsembleStatisticsRft.cpp diff --git a/ApplicationLibCode/FileInterface/RifDerivedEnsembleReader.cpp b/ApplicationLibCode/FileInterface/RifDerivedEnsembleReader.cpp deleted file mode 100644 index 4f3a3d1712..0000000000 --- a/ApplicationLibCode/FileInterface/RifDerivedEnsembleReader.cpp +++ /dev/null @@ -1,105 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2017- Statoil 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 "RifDerivedEnsembleReader.h" - -#include "RimDerivedSummaryCase.h" - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RifDerivedEnsembleReader::RifDerivedEnsembleReader( RimDerivedSummaryCase* derivedCase, - RifSummaryReaderInterface* sourceSummaryReader1, - RifSummaryReaderInterface* sourceSummaryReader2 ) -{ - CVF_ASSERT( derivedCase ); - - m_derivedCase = derivedCase; - - if ( sourceSummaryReader1 ) - { - m_allResultAddresses = sourceSummaryReader1->allResultAddresses(); - m_allErrorAddresses = sourceSummaryReader1->allErrorAddresses(); - } - if ( sourceSummaryReader2 ) - { - for ( auto a : sourceSummaryReader2->allResultAddresses() ) - { - m_allResultAddresses.insert( a ); - } - for ( auto a : sourceSummaryReader2->allErrorAddresses() ) - { - m_allErrorAddresses.insert( a ); - } - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector RifDerivedEnsembleReader::timeSteps( const RifEclipseSummaryAddress& resultAddress ) const -{ - if ( !resultAddress.isValid() ) - { - return {}; - } - - if ( m_derivedCase->needsCalculation( resultAddress ) ) - { - m_derivedCase->calculate( resultAddress ); - } - - return m_derivedCase->timeSteps( resultAddress ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::pair> RifDerivedEnsembleReader::values( const RifEclipseSummaryAddress& resultAddress ) const -{ - if ( !resultAddress.isValid() ) return { false, {} }; - - if ( m_derivedCase->needsCalculation( resultAddress ) ) - { - m_derivedCase->calculate( resultAddress ); - } - - auto dataValues = m_derivedCase->values( resultAddress ); - - std::vector values; - values.reserve( dataValues.size() ); - for ( auto val : dataValues ) - values.push_back( val ); - return { true, values }; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::string RifDerivedEnsembleReader::unitName( const RifEclipseSummaryAddress& resultAddress ) const -{ - return ""; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RiaDefines::EclipseUnitSystem RifDerivedEnsembleReader::unitSystem() const -{ - return RiaDefines::EclipseUnitSystem::UNITS_UNKNOWN; -} diff --git a/ApplicationLibCode/FileInterface/RifDerivedEnsembleReader.h b/ApplicationLibCode/FileInterface/RifDerivedEnsembleReader.h deleted file mode 100644 index 33adc23af9..0000000000 --- a/ApplicationLibCode/FileInterface/RifDerivedEnsembleReader.h +++ /dev/null @@ -1,44 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2017- Statoil 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 "RifSummaryReaderInterface.h" - -class RimDerivedSummaryCase; -class RimSummaryCase; -class RifEclipseSummaryAddress; - -//================================================================================================== -/// -//================================================================================================== -class RifDerivedEnsembleReader : public RifSummaryReaderInterface -{ -public: - RifDerivedEnsembleReader( RimDerivedSummaryCase* derivedCase, - RifSummaryReaderInterface* sourceSummaryReader1, - RifSummaryReaderInterface* sourceSummaryReader2 ); - - std::vector timeSteps( const RifEclipseSummaryAddress& resultAddress ) const override; - std::pair> values( const RifEclipseSummaryAddress& resultAddress ) const override; - std::string unitName( const RifEclipseSummaryAddress& resultAddress ) const override; - RiaDefines::EclipseUnitSystem unitSystem() const override; - -private: - RimDerivedSummaryCase* m_derivedCase; -}; diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp index 6a03aaded0..d7ae8c1ed4 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp @@ -28,7 +28,7 @@ #include "RifSummaryReaderInterface.h" #include "RimAnalysisPlotDataEntry.h" -#include "RimDerivedSummaryCase.h" +#include "RimDeltaSummaryCase.h" #include "RimPlotAxisProperties.h" #include "RimPlotAxisPropertiesInterface.h" #include "RimPlotDataFilterCollection.h" @@ -1442,12 +1442,12 @@ void RimAnalysisPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBui if ( referenceCaseReader ) { std::pair, std::vector> timeAndValues = - RimDerivedSummaryCase::calculateDerivedValues( reader, - -1, - referenceCaseReader, - -1, - DerivedSummaryOperator::DERIVED_OPERATOR_SUB, - curveDef.summaryAddressY() ); + RimDeltaSummaryCase::calculateDerivedValues( reader, + -1, + referenceCaseReader, + -1, + DerivedSummaryOperator::DERIVED_OPERATOR_SUB, + curveDef.summaryAddressY() ); timeSteps.swap( timeAndValues.first ); values.swap( timeAndValues.second ); } diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp index 41f04c0d88..561b24ae73 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp @@ -29,7 +29,7 @@ #include "RigEnsembleParameter.h" -#include "RimDerivedSummaryCase.h" +#include "RimDeltaSummaryCase.h" #include "RimEnsembleCurveSet.h" #include "RimPlotAxisProperties.h" #include "RimPlotAxisPropertiesInterface.h" diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp index fd1665020e..730dd587de 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp @@ -29,7 +29,7 @@ #include "RifSummaryReaderInterface.h" -#include "RimDerivedSummaryCase.h" +#include "RimDeltaSummaryCase.h" #include "RimEnsembleCurveSet.h" #include "RimPlotAxisProperties.h" #include "RimPlotAxisPropertiesInterface.h" diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp index 386dd01f17..310724a729 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp @@ -27,7 +27,7 @@ #include "RigEnsembleParameter.h" -#include "RimDerivedSummaryCase.h" +#include "RimDeltaSummaryCase.h" #include "RimEnsembleCurveSet.h" #include "RimMultiPlot.h" #include "RimPlotAxisProperties.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake index 92edcfa4e2..bd4be4102e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake @@ -31,8 +31,8 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RimEnsembleCurveFilterCollection.h ${CMAKE_CURRENT_LIST_DIR}/RimEnsembleStatistics.h ${CMAKE_CURRENT_LIST_DIR}/RimEnsembleStatisticsCase.h - ${CMAKE_CURRENT_LIST_DIR}/RimDerivedSummaryCase.h - ${CMAKE_CURRENT_LIST_DIR}/RimDerivedEnsembleCaseCollection.h + ${CMAKE_CURRENT_LIST_DIR}/RimDeltaSummaryCase.h + ${CMAKE_CURRENT_LIST_DIR}/RimDeltaSummaryEnsemble.h ${CMAKE_CURRENT_LIST_DIR}/RimObjectiveFunction.h ${CMAKE_CURRENT_LIST_DIR}/RimObjectiveFunctionTools.h ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotManager.h @@ -89,8 +89,8 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimEnsembleCurveFilterCollection.cpp ${CMAKE_CURRENT_LIST_DIR}/RimEnsembleStatistics.cpp ${CMAKE_CURRENT_LIST_DIR}/RimEnsembleStatisticsCase.cpp - ${CMAKE_CURRENT_LIST_DIR}/RimDerivedSummaryCase.cpp - ${CMAKE_CURRENT_LIST_DIR}/RimDerivedEnsembleCaseCollection.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimDeltaSummaryCase.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimDeltaSummaryEnsemble.cpp ${CMAKE_CURRENT_LIST_DIR}/RimObjectiveFunction.cpp ${CMAKE_CURRENT_LIST_DIR}/RimObjectiveFunctionTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotManager.cpp diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryCase.cpp similarity index 80% rename from ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.cpp rename to ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryCase.cpp index 84c28cea23..d33da6fedb 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryCase.cpp @@ -16,14 +16,12 @@ // ///////////////////////////////////////////////////////////////////////////////// -#include "RimDerivedSummaryCase.h" +#include "RimDeltaSummaryCase.h" #include "RiaCurveMerger.h" #include "RiaLogging.h" #include "RiaQDateTimeTools.h" -#include "RifDerivedEnsembleReader.h" - #include "RimProject.h" #include "RimSummaryEnsemble.h" #include "RimSummaryPlot.h" @@ -46,21 +44,80 @@ void caf::AppEnum::setUp() } template <> -void caf::AppEnum::setUp() +void caf::AppEnum::setUp() { - addItem( RimDerivedSummaryCase::FixedTimeStepMode::FIXED_TIME_STEP_NONE, "FIXED_TIME_STEP_NONE", "None" ); - addItem( RimDerivedSummaryCase::FixedTimeStepMode::FIXED_TIME_STEP_CASE_1, "FIXED_TIME_STEP_CASE_1", "Summary Case 1" ); - addItem( RimDerivedSummaryCase::FixedTimeStepMode::FIXED_TIME_STEP_CASE_2, "FIXED_TIME_STEP_CASE_2", "Summary Case 2" ); - setDefault( RimDerivedSummaryCase::FixedTimeStepMode::FIXED_TIME_STEP_NONE ); + addItem( RimDeltaSummaryCase::FixedTimeStepMode::FIXED_TIME_STEP_NONE, "FIXED_TIME_STEP_NONE", "None" ); + addItem( RimDeltaSummaryCase::FixedTimeStepMode::FIXED_TIME_STEP_CASE_1, "FIXED_TIME_STEP_CASE_1", "Summary Case 1" ); + addItem( RimDeltaSummaryCase::FixedTimeStepMode::FIXED_TIME_STEP_CASE_2, "FIXED_TIME_STEP_CASE_2", "Summary Case 2" ); + setDefault( RimDeltaSummaryCase::FixedTimeStepMode::FIXED_TIME_STEP_NONE ); } } // namespace caf -CAF_PDM_SOURCE_INIT( RimDerivedSummaryCase, "RimDerivedEnsembleCase" ); +CAF_PDM_SOURCE_INIT( RimDeltaSummaryCase, "RimDeltaSummaryCase", "RimDerivedEnsembleCase" ); //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimDerivedSummaryCase::RimDerivedSummaryCase() +std::string RimDeltaSummaryCase::unitName( const RifEclipseSummaryAddress& resultAddress ) const +{ + return ""; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimDeltaSummaryCase::timeSteps( const RifEclipseSummaryAddress& resultAddress ) const +{ + if ( !resultAddress.isValid() ) + { + return {}; + } + + if ( needsCalculation( resultAddress ) ) + { + calculate( resultAddress ); + } + + if ( m_dataCache.count( resultAddress ) == 0 ) + { + return {}; + } + + return m_dataCache.at( resultAddress ).first; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::pair> RimDeltaSummaryCase::values( const RifEclipseSummaryAddress& resultAddress ) const +{ + if ( !resultAddress.isValid() ) return { false, {} }; + + if ( needsCalculation( resultAddress ) ) + { + calculate( resultAddress ); + } + + if ( m_dataCache.count( resultAddress ) == 0 ) + { + return { false, {} }; + } + + return { true, m_dataCache.at( resultAddress ).second }; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaDefines::EclipseUnitSystem RimDeltaSummaryCase::unitSystem() const +{ + return RiaDefines::EclipseUnitSystem::UNITS_UNKNOWN; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimDeltaSummaryCase::RimDeltaSummaryCase() : m_summaryCase1( nullptr ) , m_summaryCase2( nullptr ) { @@ -81,14 +138,7 @@ RimDerivedSummaryCase::RimDerivedSummaryCase() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimDerivedSummaryCase::~RimDerivedSummaryCase() -{ -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimDerivedSummaryCase::setInUse( bool inUse ) +void RimDeltaSummaryCase::setInUse( bool inUse ) { m_inUse = inUse; @@ -103,7 +153,7 @@ void RimDerivedSummaryCase::setInUse( bool inUse ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RimDerivedSummaryCase::isInUse() const +bool RimDeltaSummaryCase::isInUse() const { return m_inUse; } @@ -111,7 +161,7 @@ bool RimDerivedSummaryCase::isInUse() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimDerivedSummaryCase::setSummaryCases( RimSummaryCase* sumCase1, RimSummaryCase* sumCase2 ) +void RimDeltaSummaryCase::setSummaryCases( RimSummaryCase* sumCase1, RimSummaryCase* sumCase2 ) { m_summaryCase1 = sumCase1; m_summaryCase2 = sumCase2; @@ -120,7 +170,7 @@ void RimDerivedSummaryCase::setSummaryCases( RimSummaryCase* sumCase1, RimSummar //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RimDerivedSummaryCase::needsCalculation( const RifEclipseSummaryAddress& address ) const +bool RimDeltaSummaryCase::needsCalculation( const RifEclipseSummaryAddress& address ) const { return m_dataCache.count( address ) == 0; } @@ -128,35 +178,7 @@ bool RimDerivedSummaryCase::needsCalculation( const RifEclipseSummaryAddress& ad //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -const std::vector& RimDerivedSummaryCase::timeSteps( const RifEclipseSummaryAddress& address ) const -{ - if ( m_dataCache.count( address ) == 0 ) - { - static std::vector empty; - return empty; - } - - return m_dataCache.at( address ).first; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -const std::vector& RimDerivedSummaryCase::values( const RifEclipseSummaryAddress& address ) const -{ - if ( m_dataCache.count( address ) == 0 ) - { - static std::vector empty; - return empty; - } - - return m_dataCache.at( address ).second; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimDerivedSummaryCase::calculate( const RifEclipseSummaryAddress& address ) +void RimDeltaSummaryCase::calculate( const RifEclipseSummaryAddress& address ) const { clearData( address ); @@ -188,12 +210,12 @@ void RimDerivedSummaryCase::calculate( const RifEclipseSummaryAddress& address ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::pair, std::vector> RimDerivedSummaryCase::calculateDerivedValues( RifSummaryReaderInterface* reader1, - int fixedTimeStepCase1, - RifSummaryReaderInterface* reader2, - int fixedTimeStepCase2, - DerivedSummaryOperator m_operator, - const RifEclipseSummaryAddress& address ) +std::pair, std::vector> RimDeltaSummaryCase::calculateDerivedValues( RifSummaryReaderInterface* reader1, + int fixedTimeStepCase1, + RifSummaryReaderInterface* reader2, + int fixedTimeStepCase2, + DerivedSummaryOperator summaryOperator, + const RifEclipseSummaryAddress& address ) { using ResultPair = std::pair, std::vector>; @@ -212,7 +234,7 @@ std::pair, std::vector> RimDerivedSummaryCase::calcu else if ( !reader1->hasAddress( address ) && reader2->hasAddress( address ) ) { auto [isOk, summaryValues] = reader2->values( address ); - if ( m_operator == DerivedSummaryOperator::DERIVED_OPERATOR_SUB ) + if ( summaryOperator == DerivedSummaryOperator::DERIVED_OPERATOR_SUB ) { for ( auto& v : summaryValues ) { @@ -251,11 +273,11 @@ std::pair, std::vector> RimDerivedSummaryCase::calcu { double valueCase1 = clampedIndexCase1 >= 0 ? values1[clampedIndexCase1] : allValues1[i]; double valueCase2 = clampedIndexCase2 >= 0 ? values2[clampedIndexCase2] : allValues2[i]; - if ( m_operator == DerivedSummaryOperator::DERIVED_OPERATOR_SUB ) + if ( summaryOperator == DerivedSummaryOperator::DERIVED_OPERATOR_SUB ) { calculatedValues.push_back( valueCase1 - valueCase2 ); } - else if ( m_operator == DerivedSummaryOperator::DERIVED_OPERATOR_ADD ) + else if ( summaryOperator == DerivedSummaryOperator::DERIVED_OPERATOR_ADD ) { calculatedValues.push_back( valueCase1 + valueCase2 ); } @@ -267,7 +289,7 @@ std::pair, std::vector> RimDerivedSummaryCase::calcu //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RimDerivedSummaryCase::caseName() const +QString RimDeltaSummaryCase::caseName() const { return m_displayName; } @@ -275,18 +297,14 @@ QString RimDerivedSummaryCase::caseName() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimDerivedSummaryCase::createSummaryReaderInterface() +void RimDeltaSummaryCase::createSummaryReaderInterface() { - RifSummaryReaderInterface* summaryCase1Reader1 = nullptr; - RifSummaryReaderInterface* summaryCase1Reader2 = nullptr; if ( m_summaryCase1 ) { if ( !m_summaryCase1->summaryReader() ) { m_summaryCase1->createSummaryReaderInterface(); } - - summaryCase1Reader1 = m_summaryCase1->summaryReader(); } if ( m_summaryCase2 ) { @@ -294,29 +312,21 @@ void RimDerivedSummaryCase::createSummaryReaderInterface() { m_summaryCase2->createSummaryReaderInterface(); } - - summaryCase1Reader2 = m_summaryCase2->summaryReader(); } - - m_reader = std::make_unique( this, summaryCase1Reader1, summaryCase1Reader2 ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifSummaryReaderInterface* RimDerivedSummaryCase::summaryReader() +RifSummaryReaderInterface* RimDeltaSummaryCase::summaryReader() { - if ( !m_reader ) - { - createSummaryReaderInterface(); - } - return m_reader.get(); + return this; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimDerivedSummaryCase::setOperator( DerivedSummaryOperator oper ) +void RimDeltaSummaryCase::setOperator( DerivedSummaryOperator oper ) { m_operator = oper; } @@ -324,7 +334,7 @@ void RimDerivedSummaryCase::setOperator( DerivedSummaryOperator oper ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimDerivedSummaryCase::setFixedTimeSteps( int fixedTimeStepCase1, int fixedTimeStepCase2 ) +void RimDeltaSummaryCase::setFixedTimeSteps( int fixedTimeStepCase1, int fixedTimeStepCase2 ) { m_useFixedTimeStep = FixedTimeStepMode::FIXED_TIME_STEP_NONE; @@ -343,7 +353,7 @@ void RimDerivedSummaryCase::setFixedTimeSteps( int fixedTimeStepCase1, int fixed //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimDerivedSummaryCase::clearData( const RifEclipseSummaryAddress& address ) +void RimDeltaSummaryCase::clearData( const RifEclipseSummaryAddress& address ) const { m_dataCache.erase( address ); } @@ -351,7 +361,7 @@ void RimDerivedSummaryCase::clearData( const RifEclipseSummaryAddress& address ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimDerivedSummaryCase::updateDisplayNameFromCases() +void RimDeltaSummaryCase::updateDisplayNameFromCases() { QString timeStepString; { @@ -422,7 +432,7 @@ void RimDerivedSummaryCase::updateDisplayNameFromCases() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimSummaryCase* RimDerivedSummaryCase::summaryCase1() const +RimSummaryCase* RimDeltaSummaryCase::summaryCase1() const { return m_summaryCase1; } @@ -430,7 +440,7 @@ RimSummaryCase* RimDerivedSummaryCase::summaryCase1() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimSummaryCase* RimDerivedSummaryCase::summaryCase2() const +RimSummaryCase* RimDeltaSummaryCase::summaryCase2() const { return m_summaryCase2; } @@ -438,7 +448,7 @@ RimSummaryCase* RimDerivedSummaryCase::summaryCase2() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimDerivedSummaryCase::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) +void RimDeltaSummaryCase::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { // Base class uiOrdering.add( &m_displayName ); @@ -459,7 +469,7 @@ void RimDerivedSummaryCase::defineUiOrdering( QString uiConfigName, caf::PdmUiOr //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimDerivedSummaryCase::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) +QList RimDeltaSummaryCase::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; @@ -501,7 +511,7 @@ QList RimDerivedSummaryCase::calculateValueOptions( cons //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimDerivedSummaryCase::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) +void RimDeltaSummaryCase::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) { bool reloadData = false; if ( changedField == &m_summaryCase2 || changedField == &m_summaryCase1 ) @@ -552,7 +562,7 @@ void RimDerivedSummaryCase::fieldChangedByUi( const caf::PdmFieldHandle* changed //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimDerivedSummaryCase::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) +void RimDeltaSummaryCase::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) { if ( &m_fixedTimeStepIndex == field ) { diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.h b/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryCase.h similarity index 80% rename from ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.h rename to ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryCase.h index a2fd3fa55c..39b9152fe9 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryCase.h @@ -17,6 +17,8 @@ ///////////////////////////////////////////////////////////////////////////////// #pragma once +#include "RifSummaryReaderInterface.h" + #include "RimSummaryCase.h" #include "cafPdmField.h" @@ -26,8 +28,6 @@ #include class RifEclipseSummaryAddress; -class RifSummaryReaderInterface; -class RifDerivedEnsembleReader; //================================================================================================== /// @@ -41,7 +41,7 @@ enum class DerivedSummaryOperator //================================================================================================== // //================================================================================================== -class RimDerivedSummaryCase : public RimSummaryCase +class RimDeltaSummaryCase : public RimSummaryCase, public RifSummaryReaderInterface { CAF_PDM_HEADER_INIT; @@ -54,8 +54,7 @@ public: }; public: - RimDerivedSummaryCase(); - ~RimDerivedSummaryCase() override; + RimDeltaSummaryCase(); void setInUse( bool inUse ); bool isInUse() const; @@ -63,11 +62,13 @@ public: void setOperator( DerivedSummaryOperator oper ); void setFixedTimeSteps( int fixedTimeStepCase1, int fixedTimeStepCase2 ); - bool needsCalculation( const RifEclipseSummaryAddress& address ) const; - const std::vector& timeSteps( const RifEclipseSummaryAddress& address ) const; - const std::vector& values( const RifEclipseSummaryAddress& address ) const; + bool needsCalculation( const RifEclipseSummaryAddress& address ) const; - void calculate( const RifEclipseSummaryAddress& address ); + std::string unitName( const RifEclipseSummaryAddress& resultAddress ) const override; + + std::vector timeSteps( const RifEclipseSummaryAddress& resultAddress ) const override; + std::pair> values( const RifEclipseSummaryAddress& resultAddress ) const override; + RiaDefines::EclipseUnitSystem unitSystem() const override; static std::pair, std::vector> calculateDerivedValues( RifSummaryReaderInterface* reader1, int fixedTimeStepCase1, @@ -94,7 +95,8 @@ private: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; - void clearData( const RifEclipseSummaryAddress& address ); + void calculate( const RifEclipseSummaryAddress& address ) const; + void clearData( const RifEclipseSummaryAddress& address ) const; private: caf::PdmPtrField m_summaryCase1; @@ -105,8 +107,8 @@ private: caf::PdmField> m_useFixedTimeStep; caf::PdmField m_fixedTimeStepIndex; - caf::PdmField m_inUse; - std::unique_ptr m_reader; + caf::PdmField m_inUse; - std::map, std::vector>> m_dataCache; + // Local cache considered mutable + mutable std::map, std::vector>> m_dataCache; }; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedEnsembleCaseCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryEnsemble.cpp similarity index 82% rename from ApplicationLibCode/ProjectDataModel/Summary/RimDerivedEnsembleCaseCollection.cpp rename to ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryEnsemble.cpp index ab7c613a4d..f0d146759a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedEnsembleCaseCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryEnsemble.cpp @@ -20,8 +20,8 @@ #include "SummaryPlotCommands/RicNewDerivedEnsembleFeature.h" -#include "RimDerivedEnsembleCaseCollection.h" -#include "RimDerivedSummaryCase.h" +#include "RimDeltaSummaryCase.h" +#include "RimDeltaSummaryEnsemble.h" #include "RimProject.h" #include "RimSummaryCaseMainCollection.h" #include "RimSummaryEnsemble.h" @@ -38,21 +38,21 @@ namespace caf { template <> -void caf::AppEnum::setUp() +void caf::AppEnum::setUp() { - addItem( RimDerivedEnsembleCaseCollection::FixedTimeStepMode::FIXED_TIME_STEP_NONE, "FIXED_TIME_STEP_NONE", "None" ); - addItem( RimDerivedEnsembleCaseCollection::FixedTimeStepMode::FIXED_TIME_STEP_CASE_1, "FIXED_TIME_STEP_CASE_1", "Ensemble 1" ); - addItem( RimDerivedEnsembleCaseCollection::FixedTimeStepMode::FIXED_TIME_STEP_CASE_2, "FIXED_TIME_STEP_CASE_2", "Ensemble 2" ); - setDefault( RimDerivedEnsembleCaseCollection::FixedTimeStepMode::FIXED_TIME_STEP_NONE ); + addItem( RimDeltaSummaryEnsemble::FixedTimeStepMode::FIXED_TIME_STEP_NONE, "FIXED_TIME_STEP_NONE", "None" ); + addItem( RimDeltaSummaryEnsemble::FixedTimeStepMode::FIXED_TIME_STEP_CASE_1, "FIXED_TIME_STEP_CASE_1", "Ensemble 1" ); + addItem( RimDeltaSummaryEnsemble::FixedTimeStepMode::FIXED_TIME_STEP_CASE_2, "FIXED_TIME_STEP_CASE_2", "Ensemble 2" ); + setDefault( RimDeltaSummaryEnsemble::FixedTimeStepMode::FIXED_TIME_STEP_NONE ); } } // namespace caf -CAF_PDM_SOURCE_INIT( RimDerivedEnsembleCaseCollection, "RimDerivedEnsembleCaseCollection" ); +CAF_PDM_SOURCE_INIT( RimDeltaSummaryEnsemble, "RimDeltaSummaryEnsemble", "RimDerivedEnsembleCaseCollection" ); //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimDerivedEnsembleCaseCollection::RimDerivedEnsembleCaseCollection() +RimDeltaSummaryEnsemble::RimDeltaSummaryEnsemble() { CAF_PDM_InitObject( "Delta Ensemble", ":/SummaryEnsemble.svg" ); @@ -89,14 +89,14 @@ RimDerivedEnsembleCaseCollection::RimDerivedEnsembleCaseCollection() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimDerivedEnsembleCaseCollection::~RimDerivedEnsembleCaseCollection() +RimDeltaSummaryEnsemble::~RimDeltaSummaryEnsemble() { } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimDerivedEnsembleCaseCollection::setEnsemble1( RimSummaryEnsemble* ensemble ) +void RimDeltaSummaryEnsemble::setEnsemble1( RimSummaryEnsemble* ensemble ) { m_ensemble1 = ensemble; updateAutoName(); @@ -105,7 +105,7 @@ void RimDerivedEnsembleCaseCollection::setEnsemble1( RimSummaryEnsemble* ensembl //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimDerivedEnsembleCaseCollection::setEnsemble2( RimSummaryEnsemble* ensemble ) +void RimDeltaSummaryEnsemble::setEnsemble2( RimSummaryEnsemble* ensemble ) { m_ensemble2 = ensemble; updateAutoName(); @@ -114,7 +114,7 @@ void RimDerivedEnsembleCaseCollection::setEnsemble2( RimSummaryEnsemble* ensembl //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RimDerivedEnsembleCaseCollection::allSummaryCases() const +std::vector RimDeltaSummaryEnsemble::allSummaryCases() const { std::vector cases; for ( auto sumCase : allDerivedCases( true ) ) @@ -125,7 +125,7 @@ std::vector RimDerivedEnsembleCaseCollection::allSummaryCases() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::set RimDerivedEnsembleCaseCollection::ensembleSummaryAddresses() const +std::set RimDeltaSummaryEnsemble::ensembleSummaryAddresses() const { std::set addresses; if ( !m_ensemble1 || !m_ensemble2 ) return addresses; @@ -139,7 +139,7 @@ std::set RimDerivedEnsembleCaseCollection::ensembleSum //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimDerivedEnsembleCaseCollection::createDerivedEnsembleCases() +void RimDeltaSummaryEnsemble::createDerivedEnsembleCases() { if ( !m_ensemble1 || !m_ensemble2 ) return; @@ -198,7 +198,7 @@ void RimDerivedEnsembleCaseCollection::createDerivedEnsembleCases() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RimDerivedEnsembleCaseCollection::hasCaseReference( const RimSummaryCase* sumCase ) const +bool RimDeltaSummaryEnsemble::hasCaseReference( const RimSummaryCase* sumCase ) const { if ( m_ensemble1 ) { @@ -222,17 +222,18 @@ bool RimDerivedEnsembleCaseCollection::hasCaseReference( const RimSummaryCase* s //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimDerivedEnsembleCaseCollection::onLoadDataAndUpdate() +void RimDeltaSummaryEnsemble::onLoadDataAndUpdate() { updateDerivedEnsembleCases(); updateReferringCurveSets(); + updateAutoName(); updateConnectedEditors(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimDerivedEnsembleCaseCollection::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) +QList RimDeltaSummaryEnsemble::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; @@ -280,7 +281,7 @@ QList RimDerivedEnsembleCaseCollection::calculateValueOp //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimDerivedEnsembleCaseCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) +void RimDeltaSummaryEnsemble::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { RimSummaryEnsemble::defineUiOrdering( uiConfigName, uiOrdering ); @@ -292,7 +293,7 @@ void RimDerivedEnsembleCaseCollection::defineUiOrdering( QString uiConfigName, c uiOrdering.add( &m_matchOnParameters ); uiOrdering.add( &m_useFixedTimeStep ); - if ( m_useFixedTimeStep() != RimDerivedEnsembleCaseCollection::FixedTimeStepMode::FIXED_TIME_STEP_NONE ) + if ( m_useFixedTimeStep() != RimDeltaSummaryEnsemble::FixedTimeStepMode::FIXED_TIME_STEP_NONE ) { uiOrdering.add( &m_fixedTimeStepIndex ); } @@ -306,7 +307,7 @@ void RimDerivedEnsembleCaseCollection::defineUiOrdering( QString uiConfigName, c //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimDerivedEnsembleCaseCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) +void RimDeltaSummaryEnsemble::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) { bool doUpdate = false; bool doUpdateCases = false; @@ -364,9 +365,7 @@ void RimDerivedEnsembleCaseCollection::fieldChangedByUi( const caf::PdmFieldHand //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimDerivedEnsembleCaseCollection::defineEditorAttribute( const caf::PdmFieldHandle* field, - QString uiConfigName, - caf::PdmUiEditorAttribute* attribute ) +void RimDeltaSummaryEnsemble::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) { if ( field == &m_swapEnsemblesButton ) { @@ -390,7 +389,7 @@ void RimDerivedEnsembleCaseCollection::defineEditorAttribute( const caf::PdmFiel //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimDerivedEnsembleCaseCollection::setAllCasesNotInUse() +void RimDeltaSummaryEnsemble::setAllCasesNotInUse() { for ( auto derCase : allDerivedCases( true ) ) derCase->setInUse( false ); @@ -399,14 +398,14 @@ void RimDerivedEnsembleCaseCollection::setAllCasesNotInUse() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimDerivedEnsembleCaseCollection::deleteCasesNoInUse() +void RimDeltaSummaryEnsemble::deleteCasesNoInUse() { - std::vector inactiveCases; - auto allCases = allDerivedCases( false ); + std::vector inactiveCases; + auto allCases = allDerivedCases( false ); std::copy_if( allCases.begin(), allCases.end(), std::back_inserter( inactiveCases ), - []( RimDerivedSummaryCase* derCase ) { return !derCase->isInUse(); } ); + []( RimDeltaSummaryCase* derCase ) { return !derCase->isInUse(); } ); for ( auto derCase : inactiveCases ) { @@ -418,17 +417,17 @@ void RimDerivedEnsembleCaseCollection::deleteCasesNoInUse() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimDerivedSummaryCase* RimDerivedEnsembleCaseCollection::firstCaseNotInUse() +RimDeltaSummaryCase* RimDeltaSummaryEnsemble::firstCaseNotInUse() { auto allCases = allDerivedCases( false ); - auto itr = std::find_if( allCases.begin(), allCases.end(), []( RimDerivedSummaryCase* derCase ) { return !derCase->isInUse(); } ); + auto itr = std::find_if( allCases.begin(), allCases.end(), []( RimDeltaSummaryCase* derCase ) { return !derCase->isInUse(); } ); if ( itr != allCases.end() ) { return *itr; } // If no active case was found, add a new case to the collection - auto newCase = new RimDerivedSummaryCase(); + auto newCase = new RimDeltaSummaryCase(); // Show realization data source for the first case. If we create for all, the performance will be bad newCase->setShowVectorItemsInProjectTree( m_cases.empty() ); @@ -440,12 +439,12 @@ RimDerivedSummaryCase* RimDerivedEnsembleCaseCollection::firstCaseNotInUse() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RimDerivedEnsembleCaseCollection::allDerivedCases( bool activeOnly ) const +std::vector RimDeltaSummaryEnsemble::allDerivedCases( bool activeOnly ) const { - std::vector activeCases; + std::vector activeCases; for ( auto sumCase : RimSummaryEnsemble::allSummaryCases() ) { - auto derivedCase = dynamic_cast( sumCase ); + auto derivedCase = dynamic_cast( sumCase ); if ( derivedCase && ( !activeOnly || derivedCase->isInUse() ) ) { activeCases.push_back( derivedCase ); @@ -457,7 +456,7 @@ std::vector RimDerivedEnsembleCaseCollection::allDerived //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimDerivedEnsembleCaseCollection::updateAutoName() +void RimDeltaSummaryEnsemble::updateAutoName() { QString timeStepString; { @@ -525,7 +524,7 @@ void RimDerivedEnsembleCaseCollection::updateAutoName() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimDerivedEnsembleCaseCollection::updateDerivedEnsembleCases() +void RimDeltaSummaryEnsemble::updateDerivedEnsembleCases() { for ( auto& derivedCase : allDerivedCases( true ) ) { @@ -546,7 +545,15 @@ void RimDerivedEnsembleCaseCollection::updateDerivedEnsembleCases() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimSummaryCase* RimDerivedEnsembleCaseCollection::findCaseByParametersHash( const std::vector& cases, size_t hash ) const +bool RimDeltaSummaryEnsemble::isValid() const +{ + return m_ensemble1 != nullptr && m_ensemble2 != nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryCase* RimDeltaSummaryEnsemble::findCaseByParametersHash( const std::vector& cases, size_t hash ) { for ( auto sumCase : cases ) { @@ -559,8 +566,7 @@ RimSummaryCase* RimDerivedEnsembleCaseCollection::findCaseByParametersHash( cons //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimSummaryCase* RimDerivedEnsembleCaseCollection::findCaseByRealizationNumber( const std::vector& cases, - int realizationNumber ) const +RimSummaryCase* RimDeltaSummaryEnsemble::findCaseByRealizationNumber( const std::vector& cases, int realizationNumber ) { for ( auto sumCase : cases ) { @@ -573,16 +579,16 @@ RimSummaryCase* RimDerivedEnsembleCaseCollection::findCaseByRealizationNumber( c //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RimDerivedEnsembleCaseCollection::findReferringEnsembles() const +std::vector RimDeltaSummaryEnsemble::findReferringEnsembles() const { - std::vector referringEnsembles; + std::vector referringEnsembles; auto mainColl = firstAncestorOrThisOfType(); if ( mainColl ) { for ( auto group : mainColl->summaryCaseCollections() ) { - auto derivedEnsemble = dynamic_cast( group ); + auto derivedEnsemble = dynamic_cast( group ); if ( derivedEnsemble ) { if ( derivedEnsemble->m_ensemble1() == this || derivedEnsemble->m_ensemble2() == this ) @@ -598,7 +604,7 @@ std::vector RimDerivedEnsembleCaseCollection: //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RimDerivedEnsembleCaseCollection::allEnsembles() const +std::vector RimDeltaSummaryEnsemble::allEnsembles() const { std::vector ensembles; @@ -610,7 +616,7 @@ std::vector RimDerivedEnsembleCaseCollection::allEnsembles( if ( !group->isEnsemble() ) continue; - auto derivedEnsemble = dynamic_cast( group ); + auto derivedEnsemble = dynamic_cast( group ); if ( derivedEnsemble && !derivedEnsemble->isValid() ) continue; ensembles.push_back( group ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedEnsembleCaseCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryEnsemble.h similarity index 69% rename from ApplicationLibCode/ProjectDataModel/Summary/RimDerivedEnsembleCaseCollection.h rename to ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryEnsemble.h index a6e10ef142..ba118b31aa 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedEnsembleCaseCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryEnsemble.h @@ -18,7 +18,7 @@ #pragma once -#include "RimDerivedSummaryCase.h" +#include "RimDeltaSummaryCase.h" #include "RimSummaryEnsemble.h" #include "cafPdmChildArrayField.h" @@ -34,7 +34,7 @@ class RimSummaryCase; //================================================================================================== /// //================================================================================================== -class RimDerivedEnsembleCaseCollection : public RimSummaryEnsemble +class RimDeltaSummaryEnsemble : public RimSummaryEnsemble { CAF_PDM_HEADER_INIT; @@ -47,44 +47,41 @@ public: }; public: - RimDerivedEnsembleCaseCollection(); - ~RimDerivedEnsembleCaseCollection() override; - - RimSummaryEnsemble* ensemble1() const { return m_ensemble1; } - RimSummaryEnsemble* ensemble2() const { return m_ensemble2; } - DerivedSummaryOperator op() const { return m_operator(); } - bool isValid() const { return m_ensemble1 != nullptr && m_ensemble2 != nullptr; } + RimDeltaSummaryEnsemble(); + ~RimDeltaSummaryEnsemble() override; void setEnsemble1( RimSummaryEnsemble* ensemble ); void setEnsemble2( RimSummaryEnsemble* ensemble ); std::vector allSummaryCases() const override; std::set ensembleSummaryAddresses() const override; - void createDerivedEnsembleCases(); - void updateDerivedEnsembleCases(); bool hasCaseReference( const RimSummaryCase* sumCase ) const; void onLoadDataAndUpdate() override; + void createDerivedEnsembleCases(); + private: QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; - void setAllCasesNotInUse(); - void deleteCasesNoInUse(); - RimDerivedSummaryCase* firstCaseNotInUse(); - std::vector allDerivedCases( bool activeOnly ) const; - void updateAutoName(); + void setAllCasesNotInUse(); + void deleteCasesNoInUse(); + RimDeltaSummaryCase* firstCaseNotInUse(); + std::vector allDerivedCases( bool activeOnly ) const; + void updateAutoName(); - RimSummaryCase* findCaseByParametersHash( const std::vector& cases, size_t hash ) const; - RimSummaryCase* findCaseByRealizationNumber( const std::vector& cases, int realizationNumber ) const; + void updateDerivedEnsembleCases(); + bool isValid() const; - std::vector findReferringEnsembles() const; + static RimSummaryCase* findCaseByParametersHash( const std::vector& cases, size_t hash ); + static RimSummaryCase* findCaseByRealizationNumber( const std::vector& cases, int realizationNumber ); + + std::vector findReferringEnsembles() const; -private: std::vector allEnsembles() const; private: diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index 9e6c5d877c..ae9c5c659d 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -33,7 +33,7 @@ #include "RimCustomObjectiveFunction.h" #include "RimCustomObjectiveFunctionCollection.h" -#include "RimDerivedEnsembleCaseCollection.h" +#include "RimDeltaSummaryEnsemble.h" #include "RimEnsembleCurveFilter.h" #include "RimEnsembleCurveFilterCollection.h" #include "RimEnsembleCurveSetCollection.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp index 0c179280be..c4bc937460 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp @@ -35,7 +35,7 @@ #include "RimCaseDisplayNameTools.h" #include "RimCsvSummaryCase.h" -#include "RimDerivedEnsembleCaseCollection.h" +#include "RimDeltaSummaryEnsemble.h" #include "RimEclipseResultCase.h" #include "RimFileSummaryCase.h" #include "RimOilField.h" @@ -158,12 +158,12 @@ void RimSummaryCaseMainCollection::addCase( RimSummaryCase* summaryCase ) //-------------------------------------------------------------------------------------------------- void RimSummaryCaseMainCollection::removeCase( RimSummaryCase* summaryCase, bool notifyChange ) { - std::vector derivedEnsembles; + std::vector derivedEnsembles; // Build a list of derived ensembles that must be updated after delete for ( auto group : summaryCaseCollections() ) { - auto derEnsemble = dynamic_cast( group ); + auto derEnsemble = dynamic_cast( group ); if ( derEnsemble ) { if ( derEnsemble->hasCaseReference( summaryCase ) ) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsemble.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsemble.cpp index 2521d9ac6f..75132976a1 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsemble.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsemble.cpp @@ -26,7 +26,7 @@ #include "RifSummaryReaderInterface.h" -#include "RimDerivedEnsembleCaseCollection.h" +#include "RimDeltaSummaryEnsemble.h" #include "RimEnsembleCurveSet.h" #include "RimProject.h" #include "RimSummaryAddressCollection.h" @@ -108,7 +108,7 @@ void RimSummaryEnsemble::removeCase( RimSummaryCase* summaryCase, bool notifyCha if ( m_isEnsemble && m_cases.size() != caseCountBeforeRemove ) { - if ( dynamic_cast( summaryCase ) == nullptr ) calculateEnsembleParametersIntersectionHash(); + if ( dynamic_cast( summaryCase ) == nullptr ) calculateEnsembleParametersIntersectionHash(); } clearChildNodes(); @@ -128,7 +128,7 @@ void RimSummaryEnsemble::addCase( RimSummaryCase* summaryCase ) m_analyzer.reset(); // Update derived ensemble cases (if any) - std::vector referringObjects = objectsWithReferringPtrFieldsOfType(); + std::vector referringObjects = objectsWithReferringPtrFieldsOfType(); for ( auto derivedEnsemble : referringObjects ) { if ( !derivedEnsemble ) continue; @@ -223,7 +223,7 @@ void RimSummaryEnsemble::setAsEnsemble( bool isEnsemble ) m_isEnsemble = isEnsemble; updateIcon(); - if ( m_isEnsemble && dynamic_cast( this ) == nullptr ) + if ( m_isEnsemble && dynamic_cast( this ) == nullptr ) { validateEnsembleCases( allSummaryCases() ); calculateEnsembleParametersIntersectionHash(); From 8b221c26ab09b94c0f180785b5c01e5f6ef2fe1b Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 12 Nov 2024 15:55:10 +0100 Subject: [PATCH 107/160] Discard display of delta curves if data is missing Add a flag used to control if missing data from either of the ensembles will return no data, or use zero if data is missing. --- .../Summary/RimDeltaSummaryCase.cpp | 22 +++++++++++++++++++ .../Summary/RimDeltaSummaryEnsemble.cpp | 20 ++++++++++++++++- .../Summary/RimDeltaSummaryEnsemble.h | 3 +++ 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryCase.cpp index d33da6fedb..c12178cb21 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryCase.cpp @@ -22,6 +22,7 @@ #include "RiaLogging.h" #include "RiaQDateTimeTools.h" +#include "RimDeltaSummaryEnsemble.h" #include "RimProject.h" #include "RimSummaryEnsemble.h" #include "RimSummaryPlot.h" @@ -93,6 +94,27 @@ std::pair> RimDeltaSummaryCase::values( const RifEclip { if ( !resultAddress.isValid() ) return { false, {} }; + if ( auto deltaEnsemble = firstAncestorOfType() ) + { + if ( deltaEnsemble->discardSummaryAddressOnlyPresentInOneCase() ) + { + RifSummaryReaderInterface* reader1 = m_summaryCase1 ? m_summaryCase1->summaryReader() : nullptr; + RifSummaryReaderInterface* reader2 = m_summaryCase2 ? m_summaryCase2->summaryReader() : nullptr; + + if ( !reader1 || !reader2 ) return { false, {} }; + + if ( !reader1->hasAddress( resultAddress ) || !reader2->hasAddress( resultAddress ) ) + { + QString txt = "Summary vector " + QString::fromStdString( resultAddress.toEclipseTextAddress() ) + + " is only present in one of the source ensembles, no values are calculated for this vector."; + + RiaLogging::warning( txt ); + + return { false, {} }; + } + } + } + if ( needsCalculation( resultAddress ) ) { calculate( resultAddress ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryEnsemble.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryEnsemble.cpp index f0d146759a..dfb83d6108 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryEnsemble.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryEnsemble.cpp @@ -28,6 +28,7 @@ #include "RifSummaryReaderInterface.h" +#include "cafPdmUiCheckBoxEditor.h" #include "cafPdmUiPushButtonEditor.h" #include "cafPdmUiTreeSelectionEditor.h" @@ -73,6 +74,13 @@ RimDeltaSummaryEnsemble::RimDeltaSummaryEnsemble() m_caseCount.uiCapability()->setUiReadOnly( true ); CAF_PDM_InitField( &m_matchOnParameters, "MatchOnParameters", false, "Match On Parameters" ); + caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_matchOnParameters ); + + CAF_PDM_InitField( &m_discardAddressPresentInOneSourceCase, + "DiscardAddressPresentInOneSourceCase", + false, + "Discard Vectors if Missing in One of the Source Ensembles" ); + caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_discardAddressPresentInOneSourceCase ); CAF_PDM_InitFieldNoDefault( &m_useFixedTimeStep, "UseFixedTimeStep", "Use Fixed Time Step" ); CAF_PDM_InitField( &m_fixedTimeStepIndex, "FixedTimeStepIndex", 0, "Time Step" ); @@ -195,6 +203,14 @@ void RimDeltaSummaryEnsemble::createDerivedEnsembleCases() deleteCasesNoInUse(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimDeltaSummaryEnsemble::discardSummaryAddressOnlyPresentInOneCase() const +{ + return m_discardAddressPresentInOneSourceCase(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -290,7 +306,6 @@ void RimDeltaSummaryEnsemble::defineUiOrdering( QString uiConfigName, caf::PdmUi uiOrdering.add( &m_operator ); uiOrdering.add( &m_ensemble2 ); uiOrdering.add( &m_swapEnsemblesButton ); - uiOrdering.add( &m_matchOnParameters ); uiOrdering.add( &m_useFixedTimeStep ); if ( m_useFixedTimeStep() != RimDeltaSummaryEnsemble::FixedTimeStepMode::FIXED_TIME_STEP_NONE ) @@ -298,6 +313,9 @@ void RimDeltaSummaryEnsemble::defineUiOrdering( QString uiConfigName, caf::PdmUi uiOrdering.add( &m_fixedTimeStepIndex ); } + uiOrdering.add( &m_matchOnParameters ); + uiOrdering.add( &m_discardAddressPresentInOneSourceCase ); + uiOrdering.skipRemainingFields( true ); updateAutoName(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryEnsemble.h b/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryEnsemble.h index ba118b31aa..20c1e92547 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryEnsemble.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryEnsemble.h @@ -62,6 +62,8 @@ public: void createDerivedEnsembleCases(); + bool discardSummaryAddressOnlyPresentInOneCase() const; + private: QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; @@ -91,6 +93,7 @@ private: caf::PdmField m_swapEnsemblesButton; caf::PdmField m_caseCount; caf::PdmField m_matchOnParameters; + caf::PdmField m_discardAddressPresentInOneSourceCase; caf::PdmField> m_useFixedTimeStep; caf::PdmField m_fixedTimeStepIndex; From 8e6d8ee31732ed8ff0d8502dcc807759942445c9 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 8 Nov 2024 14:43:52 +0100 Subject: [PATCH 108/160] Contour Map: Fix incorrect null guard. --- ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp index 3e0121ded4..e544fe1d82 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp @@ -493,7 +493,7 @@ cvf::ref RimContourMapProjection::getCellVisibility() const //-------------------------------------------------------------------------------------------------- bool RimContourMapProjection::mapCellVisibilityNeedsUpdating( int timestep ) { - if ( m_contourMapProjection ) return true; + if ( !m_contourMapProjection ) return true; std::vector mapCellVisiblity = m_contourMapProjection->getMapCellVisibility( timestep, m_resultAggregation() ); return !( mapCellVisiblity == m_mapCellVisibility ); From c2ec023720d1ffd5d7ca4318716e6dad15fce5e3 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 8 Nov 2024 11:45:43 +0100 Subject: [PATCH 109/160] Add utility for finding min/max of vector. --- .../Application/Tools/RiaStatisticsTools.h | 35 ++++++++++++++++--- .../RigStatisticsMath.cpp | 1 + .../UnitTests/RiaStatisticsTools-Test.cpp | 30 ++++++++++++++++ .../UnitTests/RigStatisticsMath-Test.cpp | 5 ++- 4 files changed, 66 insertions(+), 5 deletions(-) diff --git a/ApplicationLibCode/Application/Tools/RiaStatisticsTools.h b/ApplicationLibCode/Application/Tools/RiaStatisticsTools.h index 94ab689e04..65d83623d6 100644 --- a/ApplicationLibCode/Application/Tools/RiaStatisticsTools.h +++ b/ApplicationLibCode/Application/Tools/RiaStatisticsTools.h @@ -21,7 +21,7 @@ #pragma once #include -#include +#include #include //================================================================================================== @@ -41,10 +41,37 @@ public: template static bool isValidNumber( NumberType value ) { - if ( std::isinf( value ) ) return false; - if ( std::isnan( value ) ) return false; + return !std::isinf( value ) && !std::isnan( value ); + } - return true; + template + static NumberType minimumValue( const std::vector& values ) + { + NumberType minValue = std::numeric_limits::max(); + for ( NumberType value : values ) + { + if ( RiaStatisticsTools::isValidNumber( value ) ) + { + minValue = std::min( minValue, value ); + } + } + + return minValue; + } + + template + static NumberType maximumValue( const std::vector& values ) + { + NumberType maxValue = -std::numeric_limits::max(); + for ( NumberType value : values ) + { + if ( RiaStatisticsTools::isValidNumber( value ) ) + { + maxValue = std::max( maxValue, value ); + } + } + + return maxValue; } static double pearsonCorrelation( const std::vector& xValues, const std::vector& yValues ); diff --git a/ApplicationLibCode/ResultStatisticsCache/RigStatisticsMath.cpp b/ApplicationLibCode/ResultStatisticsCache/RigStatisticsMath.cpp index 56864d8549..a61b4a4b9c 100644 --- a/ApplicationLibCode/ResultStatisticsCache/RigStatisticsMath.cpp +++ b/ApplicationLibCode/ResultStatisticsCache/RigStatisticsMath.cpp @@ -23,6 +23,7 @@ #include #include #include +#include //-------------------------------------------------------------------------------------------------- /// A function to do basic statistical calculations diff --git a/ApplicationLibCode/UnitTests/RiaStatisticsTools-Test.cpp b/ApplicationLibCode/UnitTests/RiaStatisticsTools-Test.cpp index 27c45b9d00..6dd5002ee7 100644 --- a/ApplicationLibCode/UnitTests/RiaStatisticsTools-Test.cpp +++ b/ApplicationLibCode/UnitTests/RiaStatisticsTools-Test.cpp @@ -83,3 +83,33 @@ TEST( RiaStatisticsTools, NegativeCorrelation ) double correlation = RiaStatisticsTools::pearsonCorrelation( a, b ); EXPECT_NEAR( correlation, -1.0, 1.0e-2 ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +TEST( RiaStatisticsTools, MinValue ) +{ + const int N = 1000; + std::vector a; + for ( int i = 10; i < N; ++i ) + { + a.push_back( static_cast( i ) ); + } + double minValue = RiaStatisticsTools::minimumValue( a ); + EXPECT_EQ( minValue, 10.0 ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +TEST( RiaStatisticsTools, MaxValue ) +{ + const int N = 1000; + std::vector a; + for ( int i = 10; i < N; ++i ) + { + a.push_back( static_cast( i ) ); + } + double maxValue = RiaStatisticsTools::maximumValue( a ); + EXPECT_EQ( maxValue, 999.0 ); +} diff --git a/ApplicationLibCode/UnitTests/RigStatisticsMath-Test.cpp b/ApplicationLibCode/UnitTests/RigStatisticsMath-Test.cpp index de0a3820c8..360c45e25e 100644 --- a/ApplicationLibCode/UnitTests/RigStatisticsMath-Test.cpp +++ b/ApplicationLibCode/UnitTests/RigStatisticsMath-Test.cpp @@ -20,9 +20,12 @@ #include "gtest/gtest.h" -#include "QElapsedTimer" #include "RigStatisticsMath.h" +#include "QElapsedTimer" + +#include + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- From c4dd4865f46483490dfc5084c313c6b265ebd983 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 23 Oct 2024 15:10:03 +0200 Subject: [PATCH 110/160] Add StatisticsContourMap pdm object, and menu item. --- .../Commands/CMakeLists_files.cmake | 2 + .../RicNewStatisticsContourMapFeature.cpp | 86 +++++++++++++ .../RicNewStatisticsContourMapFeature.h | 41 ++++++ .../ProjectDataModel/CMakeLists_files.cmake | 2 + .../RimEclipseCaseEnsemble.cpp | 12 ++ .../ProjectDataModel/RimEclipseCaseEnsemble.h | 4 + .../RimStatisticsContourMap.cpp | 118 ++++++++++++++++++ .../RimStatisticsContourMap.h | 52 ++++++++ 8 files changed, 317 insertions(+) create mode 100644 ApplicationLibCode/Commands/RicNewStatisticsContourMapFeature.cpp create mode 100644 ApplicationLibCode/Commands/RicNewStatisticsContourMapFeature.h create mode 100644 ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.h diff --git a/ApplicationLibCode/Commands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/CMakeLists_files.cmake index d96866c0a6..fabb8395fe 100644 --- a/ApplicationLibCode/Commands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/CMakeLists_files.cmake @@ -97,6 +97,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicNewViewForGridEnsembleFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewCustomVfpPlotFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewWellTargetCandidatesGeneratorFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicNewStatisticsContourMapFeature.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -198,6 +199,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicNewViewForGridEnsembleFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewCustomVfpPlotFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewWellTargetCandidatesGeneratorFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicNewStatisticsContourMapFeature.cpp ) if(RESINSIGHT_USE_QT_CHARTS) diff --git a/ApplicationLibCode/Commands/RicNewStatisticsContourMapFeature.cpp b/ApplicationLibCode/Commands/RicNewStatisticsContourMapFeature.cpp new file mode 100644 index 0000000000..cdd7d45934 --- /dev/null +++ b/ApplicationLibCode/Commands/RicNewStatisticsContourMapFeature.cpp @@ -0,0 +1,86 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "RicNewStatisticsContourMapFeature.h" + +#include "RimEclipseCaseEnsemble.h" +#include "RimStatisticsContourMap.h" + +#include "cafSelectionManager.h" + +#include + +CAF_CMD_SOURCE_INIT( RicNewStatisticsContourMapFeature, "RicNewStatisticsContourMapFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewStatisticsContourMapFeature::addStatisticsContourMap( RimEclipseCaseEnsemble* eclipseCaseEnsemble ) +{ + if ( !eclipseCaseEnsemble ) return; + + std::vector cases = eclipseCaseEnsemble->cases(); + if ( cases.empty() ) return; + + RimStatisticsContourMap* statisticsContourMap = new RimStatisticsContourMap; + statisticsContourMap->setEclipseCase( cases[0] ); + eclipseCaseEnsemble->addStatisticsContourMap( statisticsContourMap ); + eclipseCaseEnsemble->updateConnectedEditors(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicNewStatisticsContourMapFeature::isCommandEnabled() const +{ + return selectedEclipseCaseEnsemble() != nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewStatisticsContourMapFeature::onActionTriggered( bool isChecked ) +{ + RimEclipseCaseEnsemble* eclipseCaseEnsemble = selectedEclipseCaseEnsemble(); + addStatisticsContourMap( eclipseCaseEnsemble ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewStatisticsContourMapFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "New Statistics Contour Map" ); + actionToSetup->setIcon( QIcon( ":/3DView16x16.png" ) ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimEclipseCaseEnsemble* RicNewStatisticsContourMapFeature::selectedEclipseCaseEnsemble() +{ + std::vector selection; + caf::SelectionManager::instance()->objectsByType( &selection ); + + if ( !selection.empty() ) + { + return selection[0]; + } + + return nullptr; +} diff --git a/ApplicationLibCode/Commands/RicNewStatisticsContourMapFeature.h b/ApplicationLibCode/Commands/RicNewStatisticsContourMapFeature.h new file mode 100644 index 0000000000..75ed0bb5cd --- /dev/null +++ b/ApplicationLibCode/Commands/RicNewStatisticsContourMapFeature.h @@ -0,0 +1,41 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "cafCmdFeature.h" + +class RimEclipseCaseEnsemble; + +//================================================================================================== +/// +//================================================================================================== +class RicNewStatisticsContourMapFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +public: + static void addStatisticsContourMap( RimEclipseCaseEnsemble* eclipseCaseEnsemble ); + +protected: + bool isCommandEnabled() const override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; + + static RimEclipseCaseEnsemble* selectedEclipseCaseEnsemble(); +}; diff --git a/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake index 1ebf9cddf8..11f9257dc5 100644 --- a/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake @@ -134,6 +134,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RimEclipseCaseEnsemble.h ${CMAKE_CURRENT_LIST_DIR}/RimCameraPosition.h ${CMAKE_CURRENT_LIST_DIR}/RimWellTargetCandidatesGenerator.h + ${CMAKE_CURRENT_LIST_DIR}/RimStatisticsContourMap.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -268,6 +269,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimEclipseCaseEnsemble.cpp ${CMAKE_CURRENT_LIST_DIR}/RimCameraPosition.cpp ${CMAKE_CURRENT_LIST_DIR}/RimWellTargetCandidatesGenerator.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimStatisticsContourMap.cpp ) if(RESINSIGHT_USE_QT_CHARTS) diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCaseEnsemble.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseCaseEnsemble.cpp index 2fc769f359..ea9499f7e7 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCaseEnsemble.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCaseEnsemble.cpp @@ -22,6 +22,7 @@ #include "RimEclipseCase.h" #include "RimEclipseView.h" #include "RimEclipseViewCollection.h" +#include "RimStatisticsContourMap.h" #include "RimWellTargetCandidatesGenerator.h" #include "cafCmdFeatureMenuBuilder.h" @@ -53,6 +54,8 @@ RimEclipseCaseEnsemble::RimEclipseCaseEnsemble() CAF_PDM_InitFieldNoDefault( &m_wellTargetGenerators, "WellTargetGenerators", "Well Target Candidates Generators" ); + CAF_PDM_InitFieldNoDefault( &m_statisticsContourMaps, "StatisticsContourMaps", "Statistics Contour maps" ); + setDeletable( true ); } @@ -173,6 +176,7 @@ void RimEclipseCaseEnsemble::appendMenuItems( caf::CmdFeatureMenuBuilder& menuBu { menuBuilder << "RicNewViewForGridEnsembleFeature"; menuBuilder << "RicNewWellTargetCandidatesGeneratorFeature"; + menuBuilder << "RicNewStatisticsContourMapFeature"; } //-------------------------------------------------------------------------------------------------- @@ -190,3 +194,11 @@ void RimEclipseCaseEnsemble::addWellTargetsGenerator( RimWellTargetCandidatesGen { m_wellTargetGenerators.push_back( generator ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseCaseEnsemble::addStatisticsContourMap( RimStatisticsContourMap* statisticsContourMap ) +{ + m_statisticsContourMaps.push_back( statisticsContourMap ); +} diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCaseEnsemble.h b/ApplicationLibCode/ProjectDataModel/RimEclipseCaseEnsemble.h index a66065d046..ffdefeee53 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCaseEnsemble.h +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCaseEnsemble.h @@ -30,6 +30,7 @@ class RimEclipseCase; class RimEclipseView; class RimEclipseViewCollection; class RimWellTargetCandidatesGenerator; +class RimStatisticsContourMap; //================================================================================================== // @@ -57,6 +58,8 @@ public: void addWellTargetsGenerator( RimWellTargetCandidatesGenerator* generator ); + void addStatisticsContourMap( RimStatisticsContourMap* statisticsContourMap ); + protected: QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; @@ -67,5 +70,6 @@ private: caf::PdmChildField m_caseCollection; caf::PdmChildField m_viewCollection; caf::PdmChildArrayField m_wellTargetGenerators; + caf::PdmChildArrayField m_statisticsContourMaps; caf::PdmPtrField m_selectedCase; }; diff --git a/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.cpp b/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.cpp new file mode 100644 index 0000000000..db2357ad3a --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.cpp @@ -0,0 +1,118 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "RimStatisticsContourMap.h" + +#include "RiaLogging.h" + +#include "RigCaseCellResultsData.h" +#include "RigEclipseCaseData.h" +#include "RimEclipseCaseEnsemble.h" +#include "RimProject.h" + +#include "RimEclipseResultDefinition.h" + +#include "cafPdmUiPushButtonEditor.h" +#include "cafProgressInfo.h" + +CAF_PDM_SOURCE_INIT( RimStatisticsContourMap, "RimStatisticalContourMap" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimStatisticsContourMap::RimStatisticsContourMap() +{ + CAF_PDM_InitObject( "StatisticsContourMap", ":/Histogram16x16.png" ); + + CAF_PDM_InitFieldNoDefault( &m_resultDefinition, "ResultDefinition", "" ); + m_resultDefinition.uiCapability()->setUiTreeChildrenHidden( true ); + m_resultDefinition = new RimEclipseResultDefinition; + m_resultDefinition->findField( "MResultType" )->uiCapability()->setUiName( "Result" ); + m_resultDefinition->setResultType( RiaDefines::ResultCatType::DYNAMIC_NATIVE ); + m_resultDefinition->setResultVariable( "SOIL" ); + + CAF_PDM_InitFieldNoDefault( &m_computeStatisticsButton, "ComputeStatisticsButton", "" ); + caf::PdmUiPushButtonEditor::configureEditorLabelLeft( &m_computeStatisticsButton ); + m_computeStatisticsButton = false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimStatisticsContourMap::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) +{ + caf::PdmUiGroup* resultDefinitionGroup = uiOrdering.addNewGroup( "Result Definition" ); + m_resultDefinition->uiOrdering( uiConfigName, *resultDefinitionGroup ); + + uiOrdering.add( &m_computeStatisticsButton ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimStatisticsContourMap::setEclipseCase( RimEclipseCase* eclipseCase ) +{ + m_resultDefinition->setEclipseCase( eclipseCase ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimStatisticsContourMap::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) +{ + if ( &m_computeStatisticsButton == changedField ) + { + computeStatistics(); + m_computeStatisticsButton = false; + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimStatisticsContourMap::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) +{ + if ( &m_computeStatisticsButton == field ) + { + if ( auto attrib = dynamic_cast( attribute ) ) + { + attrib->m_buttonText = "Compute"; + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimStatisticsContourMap::initAfterRead() +{ + auto ensemble = firstAncestorOrThisOfType(); + if ( !ensemble ) return; + + if ( ensemble->cases().empty() ) return; + + RimEclipseCase* eclipseCase = ensemble->cases().front(); + setEclipseCase( eclipseCase ); +} +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimStatisticsContourMap::computeStatistics() +{ + RiaLogging::info( "Computing statistics" ); +} diff --git a/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.h b/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.h new file mode 100644 index 0000000000..a37bce58c6 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.h @@ -0,0 +1,52 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "cafPdmObject.h" + +class RimEclipseCase; +class RimEclipseResultDefinition; + +//================================================================================================== +// +// +// +//================================================================================================== +class RimStatisticsContourMap : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + RimStatisticsContourMap(); + + void setEclipseCase( RimEclipseCase* eclipseCase ); + +protected: + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; + void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; + void initAfterRead() override; + +private: + void computeStatistics(); + + caf::PdmChildField m_resultDefinition; + caf::PdmField m_computeStatisticsButton; +}; From e2940e4eaf6e39f7afa1b641b379560f9c6ee644 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 6 Nov 2024 14:25:25 +0100 Subject: [PATCH 111/160] Contour Statistics Map: Compute results --- .../RimEclipseContourMapProjection.cpp | 1 + .../RimStatisticsContourMap.cpp | 95 ++++++++++++++++++- .../RigContourMapCalculator.cpp | 2 +- .../RigContourMapProjection.cpp | 26 ++--- .../RigEclipseContourMapProjection.cpp | 1 + 5 files changed, 102 insertions(+), 23 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp index d23a540f8a..faf292a26e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp @@ -142,6 +142,7 @@ double RimEclipseContourMapProjection::sampleSpacing() const return 0.0; } + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.cpp b/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.cpp index db2357ad3a..2401e5fc52 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.cpp @@ -19,17 +19,27 @@ #include "RimStatisticsContourMap.h" #include "RiaLogging.h" +#include "RiaStatisticsTools.h" #include "RigCaseCellResultsData.h" +#include "RigContourMapGrid.h" #include "RigEclipseCaseData.h" -#include "RimEclipseCaseEnsemble.h" -#include "RimProject.h" +#include "RigEclipseContourMapProjection.h" +#include "RigEclipseResultAddress.h" +#include "RigMainGrid.h" +#include "RigStatisticsMath.h" +#include "RimEclipseCase.h" +#include "RimEclipseCaseEnsemble.h" +#include "RimEclipseContourMapProjection.h" #include "RimEclipseResultDefinition.h" +#include "RimProject.h" #include "cafPdmUiPushButtonEditor.h" #include "cafProgressInfo.h" +#include + CAF_PDM_SOURCE_INIT( RimStatisticsContourMap, "RimStatisticalContourMap" ); //-------------------------------------------------------------------------------------------------- @@ -115,4 +125,85 @@ void RimStatisticsContourMap::initAfterRead() void RimStatisticsContourMap::computeStatistics() { RiaLogging::info( "Computing statistics" ); + auto ensemble = firstAncestorOrThisOfType(); + if ( !ensemble ) return; + + if ( ensemble->cases().empty() ) return; + + RimEclipseCase* firstEclipseCase = ensemble->cases().front(); + firstEclipseCase->ensureReservoirCaseIsOpen(); + + double relativeSampleSpacing = 0.9; + int timeStep = 0; + RigContourMapCalculator::ResultAggregationEnum resultAggregation = RigContourMapCalculator::ResultAggregationEnum::RESULTS_MEAN_VALUE; + + cvf::BoundingBox gridBoundingBox = firstEclipseCase->activeCellsBoundingBox(); + + auto computeSampleSpacing = []( auto ec, double relativeSampleSpacing ) + { + if ( ec ) + { + if ( auto mainGrid = ec->mainGrid() ) + { + return relativeSampleSpacing * mainGrid->characteristicIJCellSize(); + } + } + + return 0.0; + }; + + double sampleSpacing = computeSampleSpacing( firstEclipseCase, relativeSampleSpacing ); + + auto contourMapGrid = std::make_unique( gridBoundingBox, sampleSpacing ); + + std::vector> results; + for ( RimEclipseCase* eclipseCase : ensemble->cases() ) + { + if ( eclipseCase->ensureReservoirCaseIsOpen() ) + { + RiaLogging::info( QString( "Grid: %1" ).arg( eclipseCase->caseUserDescription() ) ); + + auto eclipseCaseData = eclipseCase->eclipseCaseData(); + auto resultData = eclipseCaseData->results( RiaDefines::PorosityModelType::MATRIX_MODEL ); + + RigEclipseContourMapProjection contourMapProjection( *contourMapGrid, *eclipseCaseData, *resultData ); + contourMapProjection.generateGridMapping( resultAggregation, {} ); + + std::vector result = + contourMapProjection.generateResults( m_resultDefinition()->eclipseResultAddress(), resultAggregation, timeStep ); + results.push_back( result ); + } + } + + if ( !results.empty() ) + { + int nCells = static_cast( results[0].size() ); + std::vector p10Results( nCells, std::numeric_limits::infinity() ); + std::vector p50Results( nCells, std::numeric_limits::infinity() ); + std::vector p90Results( nCells, std::numeric_limits::infinity() ); + std::vector meanResults( nCells, std::numeric_limits::infinity() ); + std::vector minResults( nCells, std::numeric_limits::infinity() ); + std::vector maxResults( nCells, std::numeric_limits::infinity() ); + +#pragma omp parallel for + for ( int i = 0; i < nCells; i++ ) + { + size_t numSamples = results.size(); + std::vector samples( numSamples, 0.0 ); + for ( size_t s = 0; s < numSamples; s++ ) + samples[s] = results[s][i]; + + double p10, p50, p90, mean; + + RigStatisticsMath::calculateStatisticsCurves( samples, &p10, &p50, &p90, &mean, RigStatisticsMath::PercentileStyle::SWITCHED ); + + p10Results[i] = p10; + p50Results[i] = p50; + p90Results[i] = p90; + meanResults[i] = mean; + + minResults[i] = RiaStatisticsTools::minimumValue( samples ); + maxResults[i] = RiaStatisticsTools::maximumValue( samples ); + } + } } diff --git a/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.cpp index 16ca635f72..e6adc990bd 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.cpp @@ -300,7 +300,7 @@ std::vector auto cellGridIdxVisibility = contourMapProjection.getCellVisibility(); for ( size_t globalCellIdx : allCellIndices ) { - if ( ( *cellGridIdxVisibility )[globalCellIdx] ) + if ( cellGridIdxVisibility.isNull() || ( *cellGridIdxVisibility )[globalCellIdx] ) { kLayerCellIndexVector[contourMapProjection.kLayer( globalCellIdx )].push_back( globalCellIdx ); } diff --git a/ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.cpp b/ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.cpp index 809dd47529..7072bc4f18 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.cpp @@ -18,6 +18,7 @@ #include "RigContourMapProjection.h" +#include "RiaStatisticsTools.h" #include "RiaWeightedMeanCalculator.h" #include "RigContourMapCalculator.h" @@ -28,6 +29,7 @@ #include #include +#include //-------------------------------------------------------------------------------------------------- /// @@ -210,16 +212,8 @@ double RigContourMapProjection::calculateValueInMapCell( unsigned int //-------------------------------------------------------------------------------------------------- double RigContourMapProjection::maxValue( const std::vector& aggregatedResults ) { - double maxV = -std::numeric_limits::infinity(); - - for ( size_t index = 0; index < aggregatedResults.size(); ++index ) - { - if ( aggregatedResults[index] != std::numeric_limits::infinity() ) - { - maxV = std::max( maxV, aggregatedResults[index] ); - } - } - return maxV; + double maxV = RiaStatisticsTools::maximumValue( aggregatedResults ); + return maxV != -std::numeric_limits::max() ? maxV : -std::numeric_limits::infinity(); } //-------------------------------------------------------------------------------------------------- @@ -227,16 +221,8 @@ double RigContourMapProjection::maxValue( const std::vector& aggregatedR //-------------------------------------------------------------------------------------------------- double RigContourMapProjection::minValue( const std::vector& aggregatedResults ) { - double minV = std::numeric_limits::infinity(); - - for ( size_t index = 0; index < aggregatedResults.size(); ++index ) - { - if ( aggregatedResults[index] != std::numeric_limits::infinity() ) - { - minV = std::min( minV, aggregatedResults[index] ); - } - } - return minV; + double minV = RiaStatisticsTools::minimumValue( aggregatedResults ); + return minV != std::numeric_limits::max() ? minV : std::numeric_limits::infinity(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseContourMapProjection.cpp b/ApplicationLibCode/ReservoirDataModel/RigEclipseContourMapProjection.cpp index cee5e82926..a0bb27aafb 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigEclipseContourMapProjection.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigEclipseContourMapProjection.cpp @@ -129,6 +129,7 @@ std::pair> // TODO: this was RimEclipseCellColors->hasStaticResult() if ( resultAddress.resultCatType() == RiaDefines::ResultCatType::STATIC_NATIVE && timeStep > 0 ) timeStep = 0; + resultData.ensureKnownResultLoaded( resultAddress ); // When loading a project file, grid calculator results are not computed the first time this function is // called. Must check if result is loaded. See RimReloadCaseTools::updateAll3dViews() if ( resultAddress.isValid() && resultData.hasResultEntry( resultAddress ) && resultData.isResultLoaded( resultAddress ) ) From c16bc11c0307edc9c55e3412e570bec7c2b55dce Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 13 Nov 2024 10:02:54 +0100 Subject: [PATCH 112/160] Add configurable "relative sample spacing". --- .../RimStatisticsContourMap.cpp | 22 ++++++++++++++++--- .../RimStatisticsContourMap.h | 2 ++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.cpp b/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.cpp index 2401e5fc52..a5634c0949 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.cpp @@ -35,6 +35,7 @@ #include "RimEclipseResultDefinition.h" #include "RimProject.h" +#include "cafPdmUiDoubleSliderEditor.h" #include "cafPdmUiPushButtonEditor.h" #include "cafProgressInfo.h" @@ -49,6 +50,9 @@ RimStatisticsContourMap::RimStatisticsContourMap() { CAF_PDM_InitObject( "StatisticsContourMap", ":/Histogram16x16.png" ); + CAF_PDM_InitField( &m_relativeSampleSpacing, "SampleSpacing", 0.9, "Sample Spacing Factor" ); + m_relativeSampleSpacing.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); + CAF_PDM_InitFieldNoDefault( &m_resultDefinition, "ResultDefinition", "" ); m_resultDefinition.uiCapability()->setUiTreeChildrenHidden( true ); m_resultDefinition = new RimEclipseResultDefinition; @@ -66,6 +70,8 @@ RimStatisticsContourMap::RimStatisticsContourMap() //-------------------------------------------------------------------------------------------------- void RimStatisticsContourMap::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { + uiOrdering.add( &m_relativeSampleSpacing ); + caf::PdmUiGroup* resultDefinitionGroup = uiOrdering.addNewGroup( "Result Definition" ); m_resultDefinition->uiOrdering( uiConfigName, *resultDefinitionGroup ); @@ -104,6 +110,17 @@ void RimStatisticsContourMap::defineEditorAttribute( const caf::PdmFieldHandle* attrib->m_buttonText = "Compute"; } } + + if ( &m_relativeSampleSpacing == field ) + { + if ( auto myAttr = dynamic_cast( attribute ) ) + { + myAttr->m_minimum = 0.2; + myAttr->m_maximum = 2.0; + myAttr->m_sliderTickCount = 9; + myAttr->m_delaySliderUpdateUntilRelease = true; + } + } } //-------------------------------------------------------------------------------------------------- @@ -133,8 +150,7 @@ void RimStatisticsContourMap::computeStatistics() RimEclipseCase* firstEclipseCase = ensemble->cases().front(); firstEclipseCase->ensureReservoirCaseIsOpen(); - double relativeSampleSpacing = 0.9; - int timeStep = 0; + int timeStep = 0; RigContourMapCalculator::ResultAggregationEnum resultAggregation = RigContourMapCalculator::ResultAggregationEnum::RESULTS_MEAN_VALUE; cvf::BoundingBox gridBoundingBox = firstEclipseCase->activeCellsBoundingBox(); @@ -152,7 +168,7 @@ void RimStatisticsContourMap::computeStatistics() return 0.0; }; - double sampleSpacing = computeSampleSpacing( firstEclipseCase, relativeSampleSpacing ); + double sampleSpacing = computeSampleSpacing( firstEclipseCase, m_relativeSampleSpacing() ); auto contourMapGrid = std::make_unique( gridBoundingBox, sampleSpacing ); diff --git a/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.h b/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.h index a37bce58c6..325c7d9fd7 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.h +++ b/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.h @@ -47,6 +47,8 @@ protected: private: void computeStatistics(); + caf::PdmField m_relativeSampleSpacing; + caf::PdmChildField m_resultDefinition; caf::PdmField m_computeStatisticsButton; }; From 88ded4f7a0898b7d4a54d459fb3448bbd4bd12d5 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 13 Nov 2024 10:27:15 +0100 Subject: [PATCH 113/160] Refactor: improve names of result aggregation enum options. --- .../RimGeoMechContourMapProjection.cpp | 16 ++++---- .../RimContourMapProjection.cpp | 26 ++++++------- .../RimContourMapProjection.h | 2 +- .../RimStatisticsContourMap.cpp | 2 +- .../RigContourMapCalculator.cpp | 39 +++++++++---------- .../RigContourMapCalculator.h | 34 ++++++++-------- .../RigContourMapProjection.cpp | 4 +- .../RigContourMapProjection.h | 6 +-- .../RigEclipseContourMapProjection.cpp | 22 +++++------ .../RigEclipseContourMapProjection.h | 12 +++--- .../RigGeoMechContourMapProjection.cpp | 8 ++-- .../RigGeoMechContourMapProjection.h | 8 ++-- 12 files changed, 88 insertions(+), 91 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp index e4f5e1b2ea..411abdb862 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp @@ -344,15 +344,15 @@ QList RimGeoMechContourMapProjection::calculateValueOpti if ( fieldNeedingOptions == &m_resultAggregation ) { - std::vector validOptions = { RigContourMapCalculator::RESULTS_TOP_VALUE, - RigContourMapCalculator::RESULTS_MEAN_VALUE, - RigContourMapCalculator::RESULTS_GEOM_VALUE, - RigContourMapCalculator::RESULTS_HARM_VALUE, - RigContourMapCalculator::RESULTS_MIN_VALUE, - RigContourMapCalculator::RESULTS_MAX_VALUE, - RigContourMapCalculator::RESULTS_SUM }; + std::vector validOptions = { RigContourMapCalculator::TOP_VALUE, + RigContourMapCalculator::MEAN, + RigContourMapCalculator::GEOMETRIC_MEAN, + RigContourMapCalculator::HARMONIC_MEAN, + RigContourMapCalculator::MIN_VALUE, + RigContourMapCalculator::MAX_VALUE, + RigContourMapCalculator::SUM }; - for ( RigContourMapCalculator::ResultAggregationEnum option : validOptions ) + for ( RigContourMapCalculator::ResultAggregationType option : validOptions ) { options.push_back( caf::PdmOptionItemInfo( ResultAggregation::uiText( option ), option ) ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp index e544fe1d82..39dd11ffc1 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp @@ -49,21 +49,21 @@ namespace caf template <> void RimContourMapProjection::ResultAggregation::setUp() { - addItem( RigContourMapCalculator::RESULTS_OIL_COLUMN, "OIL_COLUMN", "Oil Column" ); - addItem( RigContourMapCalculator::RESULTS_GAS_COLUMN, "GAS_COLUMN", "Gas Column" ); - addItem( RigContourMapCalculator::RESULTS_HC_COLUMN, "HC_COLUMN", "Hydrocarbon Column" ); + addItem( RigContourMapCalculator::OIL_COLUMN, "OIL_COLUMN", "Oil Column" ); + addItem( RigContourMapCalculator::GAS_COLUMN, "GAS_COLUMN", "Gas Column" ); + addItem( RigContourMapCalculator::HYDROCARBON_COLUMN, "HC_COLUMN", "Hydrocarbon Column" ); - addItem( RigContourMapCalculator::RESULTS_MEAN_VALUE, "MEAN_VALUE", "Arithmetic Mean" ); - addItem( RigContourMapCalculator::RESULTS_HARM_VALUE, "HARM_VALUE", "Harmonic Mean" ); - addItem( RigContourMapCalculator::RESULTS_GEOM_VALUE, "GEOM_VALUE", "Geometric Mean" ); - addItem( RigContourMapCalculator::RESULTS_VOLUME_SUM, "VOLUME_SUM", "Volume Weighted Sum" ); - addItem( RigContourMapCalculator::RESULTS_SUM, "SUM", "Sum" ); + addItem( RigContourMapCalculator::MEAN, "MEAN_VALUE", "Arithmetic Mean" ); + addItem( RigContourMapCalculator::HARMONIC_MEAN, "HARM_VALUE", "Harmonic Mean" ); + addItem( RigContourMapCalculator::GEOMETRIC_MEAN, "GEOM_VALUE", "Geometric Mean" ); + addItem( RigContourMapCalculator::VOLUME_SUM, "VOLUME_SUM", "Volume Weighted Sum" ); + addItem( RigContourMapCalculator::SUM, "SUM", "Sum" ); - addItem( RigContourMapCalculator::RESULTS_TOP_VALUE, "TOP_VALUE", "Top Value" ); - addItem( RigContourMapCalculator::RESULTS_MIN_VALUE, "MIN_VALUE", "Min Value" ); - addItem( RigContourMapCalculator::RESULTS_MAX_VALUE, "MAX_VALUE", "Max Value" ); + addItem( RigContourMapCalculator::TOP_VALUE, "TOP_VALUE", "Top Value" ); + addItem( RigContourMapCalculator::MIN_VALUE, "MIN_VALUE", "Min Value" ); + addItem( RigContourMapCalculator::MAX_VALUE, "MAX_VALUE", "Max Value" ); - setDefault( RigContourMapCalculator::RESULTS_MEAN_VALUE ); + setDefault( RigContourMapCalculator::MEAN ); } } // namespace caf @@ -883,7 +883,7 @@ void RimContourMapProjection::fieldChangedByUi( const caf::PdmFieldHandle* chang { if ( changedField == &m_resultAggregation ) { - ResultAggregation previousAggregation = static_cast( oldValue.toInt() ); + ResultAggregation previousAggregation = static_cast( oldValue.toInt() ); if ( RigContourMapCalculator::isStraightSummationResult( previousAggregation ) != isStraightSummationResult() ) { clearGridMapping(); diff --git a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h index ac97552d4e..d6f2cfe27d 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h +++ b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h @@ -43,7 +43,7 @@ class RimContourMapProjection : public RimCheckableNamedObject CAF_PDM_HEADER_INIT; public: - using ResultAggregation = caf::AppEnum; + using ResultAggregation = caf::AppEnum; using ContourPolygons = std::vector; RimContourMapProjection(); diff --git a/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.cpp b/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.cpp index a5634c0949..202b56ae96 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.cpp @@ -151,7 +151,7 @@ void RimStatisticsContourMap::computeStatistics() firstEclipseCase->ensureReservoirCaseIsOpen(); int timeStep = 0; - RigContourMapCalculator::ResultAggregationEnum resultAggregation = RigContourMapCalculator::ResultAggregationEnum::RESULTS_MEAN_VALUE; + RigContourMapCalculator::ResultAggregationType resultAggregation = RigContourMapCalculator::ResultAggregationType::MEAN; cvf::BoundingBox gridBoundingBox = firstEclipseCase->activeCellsBoundingBox(); diff --git a/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.cpp index e6adc990bd..29c13ab512 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.cpp @@ -36,29 +36,29 @@ double RigContourMapCalculator::calculateValueInMapCell( const RigContourMapProjection& contourMapProjection, const std::vector>& matchingCells, const std::vector& gridCellValues, - ResultAggregationEnum resultAggregation ) + ResultAggregationType resultAggregation ) { if ( matchingCells.empty() ) return std::numeric_limits::infinity(); switch ( resultAggregation ) { - case RESULTS_TOP_VALUE: + case TOP_VALUE: return calculateTopValue( contourMapProjection, matchingCells, gridCellValues ); - case RESULTS_MEAN_VALUE: + case MEAN: return calculateMeanValue( contourMapProjection, matchingCells, gridCellValues ); - case RESULTS_GEOM_VALUE: + case GEOMETRIC_MEAN: return calculateGeometricMeanValue( contourMapProjection, matchingCells, gridCellValues ); - case RESULTS_HARM_VALUE: + case HARMONIC_MEAN: return calculateHarmonicMeanValue( contourMapProjection, matchingCells, gridCellValues ); - case RESULTS_MAX_VALUE: + case MAX_VALUE: return calculateMaxValue( contourMapProjection, matchingCells, gridCellValues ); - case RESULTS_MIN_VALUE: + case MIN_VALUE: return calculateMinValue( contourMapProjection, matchingCells, gridCellValues ); - case RESULTS_VOLUME_SUM: - case RESULTS_SUM: - case RESULTS_OIL_COLUMN: - case RESULTS_GAS_COLUMN: - case RESULTS_HC_COLUMN: + case VOLUME_SUM: + case SUM: + case OIL_COLUMN: + case GAS_COLUMN: + case HYDROCARBON_COLUMN: return calculateSum( contourMapProjection, matchingCells, gridCellValues ); default: { @@ -227,7 +227,7 @@ double RigContourMapCalculator::calculateSum( const RigContourMapProjection& std::vector>> RigContourMapCalculator::generateGridMapping( RigContourMapProjection& contourMapProjection, const RigContourMapGrid& contourMapGrid, - ResultAggregationEnum resultAggregation, + ResultAggregationType resultAggregation, const std::vector& weightingResultValues ) { int nCells = contourMapGrid.numberOfCells(); @@ -392,24 +392,23 @@ std::vector //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RigContourMapCalculator::isColumnResult( ResultAggregationEnum aggregationType ) +bool RigContourMapCalculator::isColumnResult( ResultAggregationType aggregationType ) { - return aggregationType == RESULTS_OIL_COLUMN || aggregationType == RESULTS_GAS_COLUMN || aggregationType == RESULTS_HC_COLUMN; + return aggregationType == OIL_COLUMN || aggregationType == GAS_COLUMN || aggregationType == HYDROCARBON_COLUMN; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RigContourMapCalculator::isMeanResult( ResultAggregationEnum aggregationType ) +bool RigContourMapCalculator::isMeanResult( ResultAggregationType aggregationType ) { - return aggregationType == RESULTS_MEAN_VALUE || aggregationType == RESULTS_HARM_VALUE || aggregationType == RESULTS_GEOM_VALUE; + return aggregationType == MEAN || aggregationType == HARMONIC_MEAN || aggregationType == GEOMETRIC_MEAN; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RigContourMapCalculator::isStraightSummationResult( ResultAggregationEnum aggregationType ) +bool RigContourMapCalculator::isStraightSummationResult( ResultAggregationType aggregationType ) { - return aggregationType == RESULTS_OIL_COLUMN || aggregationType == RESULTS_GAS_COLUMN || aggregationType == RESULTS_HC_COLUMN || - aggregationType == RESULTS_SUM; + return aggregationType == OIL_COLUMN || aggregationType == GAS_COLUMN || aggregationType == HYDROCARBON_COLUMN || aggregationType == SUM; } diff --git a/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.h b/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.h index 199f578ea7..b89a155d36 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.h +++ b/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.h @@ -35,30 +35,30 @@ class RigContourMapCalculator public: using CellIndexAndResult = std::pair; - enum ResultAggregationEnum + enum ResultAggregationType { - RESULTS_TOP_VALUE, - RESULTS_MEAN_VALUE, - RESULTS_GEOM_VALUE, - RESULTS_HARM_VALUE, - RESULTS_MIN_VALUE, - RESULTS_MAX_VALUE, - RESULTS_VOLUME_SUM, - RESULTS_SUM, - RESULTS_OIL_COLUMN, - RESULTS_GAS_COLUMN, - RESULTS_HC_COLUMN + TOP_VALUE, + MEAN, + GEOMETRIC_MEAN, + HARMONIC_MEAN, + MIN_VALUE, + MAX_VALUE, + VOLUME_SUM, + SUM, + OIL_COLUMN, + GAS_COLUMN, + HYDROCARBON_COLUMN }; static std::vector>> generateGridMapping( RigContourMapProjection& contourMapProjection, const RigContourMapGrid& contourMapGrid, - ResultAggregationEnum resultAggregation, + ResultAggregationType resultAggregation, const std::vector& weightingResultValues ); static double calculateValueInMapCell( const RigContourMapProjection& contourMapProjection, const std::vector>& matchingCells, const std::vector& gridCellValues, - ResultAggregationEnum resultAggregation ); + ResultAggregationType resultAggregation ); static std::vector cellOverlapVolumesAndResults( const RigContourMapProjection& contourMapProjection, const RigContourMapGrid& contourMapGrid, @@ -70,9 +70,9 @@ public: const cvf::Vec2d& globalPos2d, const std::vector& weightingResultValues ); - static bool isColumnResult( ResultAggregationEnum aggregationType ); - static bool isMeanResult( ResultAggregationEnum aggregationType ); - static bool isStraightSummationResult( ResultAggregationEnum aggregationType ); + static bool isColumnResult( ResultAggregationType aggregationType ); + static bool isMeanResult( ResultAggregationType aggregationType ); + static bool isStraightSummationResult( ResultAggregationType aggregationType ); private: static double calculateTopValue( const RigContourMapProjection& contourMapProjection, diff --git a/ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.cpp b/ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.cpp index 7072bc4f18..39859fd777 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.cpp @@ -44,7 +44,7 @@ RigContourMapProjection::RigContourMapProjection( const RigContourMapGrid& conto /// //-------------------------------------------------------------------------------------------------- std::vector>> - RigContourMapProjection::generateGridMapping( RigContourMapCalculator::ResultAggregationEnum resultAggregation, + RigContourMapProjection::generateGridMapping( RigContourMapCalculator::ResultAggregationType resultAggregation, const std::vector& weights ) { m_projected3dGridIndices = RigContourMapCalculator::generateGridMapping( *this, m_contourMapGrid, resultAggregation, weights ); @@ -201,7 +201,7 @@ size_t RigContourMapProjection::gridResultIndex( size_t globalCellIdx ) const double RigContourMapProjection::calculateValueInMapCell( unsigned int i, unsigned int j, const std::vector& gridCellValues, - RigContourMapCalculator::ResultAggregationEnum resultAggregation ) const + RigContourMapCalculator::ResultAggregationType resultAggregation ) const { const std::vector>& matchingCells = cellsAtIJ( i, j ); return RigContourMapCalculator::calculateValueInMapCell( *this, matchingCells, gridCellValues, resultAggregation ); diff --git a/ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.h b/ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.h index 0b68ac2e9e..1a702f5971 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.h +++ b/ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.h @@ -75,13 +75,13 @@ public: virtual double calculateOverlapVolume( size_t globalCellIdx, const cvf::BoundingBox& bbox ) const = 0; virtual double calculateRayLengthInCell( size_t globalCellIdx, const cvf::Vec3d& highestPoint, const cvf::Vec3d& lowestPoint ) const = 0; virtual double getParameterWeightForCell( size_t globalCellIdx, const std::vector& parameterWeights ) const = 0; - virtual std::vector getMapCellVisibility( int viewStepIndex, RigContourMapCalculator::ResultAggregationEnum resultAggregation ) = 0; + virtual std::vector getMapCellVisibility( int viewStepIndex, RigContourMapCalculator::ResultAggregationType resultAggregation ) = 0; void setCellVisibility( cvf::ref cellVisibility ); cvf::ref getCellVisibility() const; std::vector>> - generateGridMapping( RigContourMapCalculator::ResultAggregationEnum resultAggregation, const std::vector& weights ); + generateGridMapping( RigContourMapCalculator::ResultAggregationType resultAggregation, const std::vector& weights ); double interpolateValue( const cvf::Vec2d& gridPosition2d ) const; @@ -100,7 +100,7 @@ protected: double calculateValueInMapCell( unsigned int i, unsigned int j, const std::vector& gridCellValues, - RigContourMapCalculator::ResultAggregationEnum resultAggregation ) const; + RigContourMapCalculator::ResultAggregationType resultAggregation ) const; double valueInCell( unsigned int i, unsigned int j ) const; bool hasResultInCell( unsigned int i, unsigned int j ) const; diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseContourMapProjection.cpp b/ApplicationLibCode/ReservoirDataModel/RigEclipseContourMapProjection.cpp index a0bb27aafb..d47bfae6a4 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigEclipseContourMapProjection.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigEclipseContourMapProjection.cpp @@ -59,7 +59,7 @@ RigEclipseContourMapProjection::~RigEclipseContourMapProjection() /// //-------------------------------------------------------------------------------------------------- void RigEclipseContourMapProjection::generateAndSaveResults( const RigEclipseResultAddress& resultAddress, - RigContourMapCalculator::ResultAggregationEnum resultAggregation, + RigContourMapCalculator::ResultAggregationType resultAggregation, int timeStep ) { std::tie( m_useActiveCellInfo, m_aggregatedResults ) = @@ -70,7 +70,7 @@ void RigEclipseContourMapProjection::generateAndSaveResults( const RigEclipseRes /// //-------------------------------------------------------------------------------------------------- std::vector RigEclipseContourMapProjection::generateResults( const RigEclipseResultAddress& resultAddress, - RigContourMapCalculator::ResultAggregationEnum resultAggregation, + RigContourMapCalculator::ResultAggregationType resultAggregation, int timeStep ) const { std::pair> result = @@ -86,7 +86,7 @@ std::pair> const RigContourMapGrid& contourMapGrid, RigCaseCellResultsData& resultData, const RigEclipseResultAddress& resultAddress, - RigContourMapCalculator::ResultAggregationEnum resultAggregation, + RigContourMapCalculator::ResultAggregationType resultAggregation, int timeStep ) { size_t nCells = contourMapProjection.numberOfCells(); @@ -110,14 +110,12 @@ std::pair> resultData.ensureKnownResultLoaded( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "PORO" ) ); resultData.ensureKnownResultLoaded( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "NTG" ) ); resultData.ensureKnownResultLoaded( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "DZ" ) ); - if ( resultAggregation == RigContourMapCalculator::RESULTS_OIL_COLUMN || - resultAggregation == RigContourMapCalculator::RESULTS_HC_COLUMN ) + if ( resultAggregation == RigContourMapCalculator::OIL_COLUMN || resultAggregation == RigContourMapCalculator::HYDROCARBON_COLUMN ) { resultData.ensureKnownResultLoaded( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::soil() ) ); } - if ( resultAggregation == RigContourMapCalculator::RESULTS_GAS_COLUMN || - resultAggregation == RigContourMapCalculator::RESULTS_HC_COLUMN ) + if ( resultAggregation == RigContourMapCalculator::GAS_COLUMN || resultAggregation == RigContourMapCalculator::HYDROCARBON_COLUMN ) { resultData.ensureKnownResultLoaded( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::sgas() ) ); @@ -154,7 +152,7 @@ std::pair> return { useActiveCellInfo, aggregatedResults }; } -std::vector RigEclipseContourMapProjection::calculateColumnResult( RigContourMapCalculator::ResultAggregationEnum resultAggregation, +std::vector RigEclipseContourMapProjection::calculateColumnResult( RigContourMapCalculator::ResultAggregationType resultAggregation, int timeStep ) const { return calculateColumnResult( m_resultData, resultAggregation, timeStep ); @@ -164,7 +162,7 @@ std::vector RigEclipseContourMapProjection::calculateColumnResult( RigCo /// //-------------------------------------------------------------------------------------------------- std::vector RigEclipseContourMapProjection::calculateColumnResult( RigCaseCellResultsData& resultData, - RigContourMapCalculator::ResultAggregationEnum resultAggregation, + RigContourMapCalculator::ResultAggregationType resultAggregation, int timeStep ) { bool hasPoroResult = resultData.hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "PORO" ) ); @@ -187,7 +185,7 @@ std::vector RigEclipseContourMapProjection::calculateColumnResult( RigCa std::vector resultValues( poroResults.size(), 0.0 ); - if ( resultAggregation == RigContourMapCalculator::RESULTS_OIL_COLUMN || resultAggregation == RigContourMapCalculator::RESULTS_HC_COLUMN ) + if ( resultAggregation == RigContourMapCalculator::OIL_COLUMN || resultAggregation == RigContourMapCalculator::HYDROCARBON_COLUMN ) { const std::vector& soilResults = resultData.cellScalarResults( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::soil() ), @@ -198,7 +196,7 @@ std::vector RigEclipseContourMapProjection::calculateColumnResult( RigCa } } - if ( resultAggregation == RigContourMapCalculator::RESULTS_GAS_COLUMN || resultAggregation == RigContourMapCalculator::RESULTS_HC_COLUMN ) + if ( resultAggregation == RigContourMapCalculator::GAS_COLUMN || resultAggregation == RigContourMapCalculator::HYDROCARBON_COLUMN ) { bool hasGasResult = resultData.hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::sgas() ) ); @@ -328,7 +326,7 @@ size_t RigEclipseContourMapProjection::gridResultIndex( size_t globalCellIdx ) c /// //-------------------------------------------------------------------------------------------------- std::vector RigEclipseContourMapProjection::getMapCellVisibility( int viewStepIndex, - RigContourMapCalculator::ResultAggregationEnum resultAggregation ) + RigContourMapCalculator::ResultAggregationType resultAggregation ) { return std::vector( numberOfCells(), true ); diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseContourMapProjection.h b/ApplicationLibCode/ReservoirDataModel/RigEclipseContourMapProjection.h index 18cc04c141..0e825b7abe 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigEclipseContourMapProjection.h +++ b/ApplicationLibCode/ReservoirDataModel/RigEclipseContourMapProjection.h @@ -44,21 +44,21 @@ public: virtual ~RigEclipseContourMapProjection(); void generateAndSaveResults( const RigEclipseResultAddress& resultAddress, - RigContourMapCalculator::ResultAggregationEnum resultAggregation, + RigContourMapCalculator::ResultAggregationType resultAggregation, int timeStep ); std::vector generateResults( const RigEclipseResultAddress& resultAddress, - RigContourMapCalculator::ResultAggregationEnum resultAggregation, + RigContourMapCalculator::ResultAggregationType resultAggregation, int timeStep ) const; static std::pair> generateResults( const RigEclipseContourMapProjection& contourMapProjection, const RigContourMapGrid& contourMapGrid, RigCaseCellResultsData& resultData, const RigEclipseResultAddress& resultAddress, - RigContourMapCalculator::ResultAggregationEnum resultAggregation, + RigContourMapCalculator::ResultAggregationType resultAggregation, int timeStep ); - std::vector getMapCellVisibility( int viewStepIndex, RigContourMapCalculator::ResultAggregationEnum resultAggregation ) override; + std::vector getMapCellVisibility( int viewStepIndex, RigContourMapCalculator::ResultAggregationType resultAggregation ) override; protected: using CellIndexAndResult = RigContourMapProjection::CellIndexAndResult; @@ -72,10 +72,10 @@ protected: size_t gridResultIndex( size_t globalCellIdx ) const override; // Eclipse implementation specific data generation methods - std::vector calculateColumnResult( RigContourMapCalculator::ResultAggregationEnum resultAggregation, int timeStep ) const; + std::vector calculateColumnResult( RigContourMapCalculator::ResultAggregationType resultAggregation, int timeStep ) const; static std::vector calculateColumnResult( RigCaseCellResultsData& resultData, - RigContourMapCalculator::ResultAggregationEnum resultAggregation, + RigContourMapCalculator::ResultAggregationType resultAggregation, int timeStep ); protected: diff --git a/ApplicationLibCode/ReservoirDataModel/RigGeoMechContourMapProjection.cpp b/ApplicationLibCode/ReservoirDataModel/RigGeoMechContourMapProjection.cpp index 58c9fe6108..f39468e2e3 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigGeoMechContourMapProjection.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigGeoMechContourMapProjection.cpp @@ -112,7 +112,7 @@ cvf::BoundingBox RigGeoMechContourMapProjection::calculateExpandedPorBarBBox( Ri /// //-------------------------------------------------------------------------------------------------- std::vector RigGeoMechContourMapProjection::getMapCellVisibility( int viewStepIndex, - RigContourMapCalculator::ResultAggregationEnum resultAggregation ) + RigContourMapCalculator::ResultAggregationType resultAggregation ) { return getMapCellVisibility( m_currentResultAddr, viewStepIndex, resultAggregation ); } @@ -122,7 +122,7 @@ std::vector RigGeoMechContourMapProjection::getMapCellVisibility( int //-------------------------------------------------------------------------------------------------- std::vector RigGeoMechContourMapProjection::getMapCellVisibility( RigFemResultAddress resAddr, int viewStepIndex, - RigContourMapCalculator::ResultAggregationEnum resultAggregation ) + RigContourMapCalculator::ResultAggregationType resultAggregation ) { cvf::Vec2ui nCellsIJ = numberOfElementsIJ(); std::vector> distanceImage( nCellsIJ.x(), std::vector( nCellsIJ.y(), 0u ) ); @@ -183,7 +183,7 @@ std::vector RigGeoMechContourMapProjection::getMapCellVisibility( RigFemRe /// //-------------------------------------------------------------------------------------------------- void RigGeoMechContourMapProjection::generateAndSaveResults( RigFemResultAddress resultAddress, - RigContourMapCalculator::ResultAggregationEnum resultAggregation, + RigContourMapCalculator::ResultAggregationType resultAggregation, int viewerStepIndex ) { m_aggregatedResults = generateResultsFromAddress( resultAddress, m_mapCellVisibility, resultAggregation, viewerStepIndex ); @@ -194,7 +194,7 @@ void RigGeoMechContourMapProjection::generateAndSaveResults( RigFemResultAddress //-------------------------------------------------------------------------------------------------- std::vector RigGeoMechContourMapProjection::generateResultsFromAddress( RigFemResultAddress resultAddress, const std::vector& mapCellVisibility, - RigContourMapCalculator::ResultAggregationEnum resultAggregation, + RigContourMapCalculator::ResultAggregationType resultAggregation, int viewerStepIndex ) const { RigFemPartResultsCollection* resultCollection = m_caseData.femPartResults(); diff --git a/ApplicationLibCode/ReservoirDataModel/RigGeoMechContourMapProjection.h b/ApplicationLibCode/ReservoirDataModel/RigGeoMechContourMapProjection.h index bba506e53b..7eadc3837e 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigGeoMechContourMapProjection.h +++ b/ApplicationLibCode/ReservoirDataModel/RigGeoMechContourMapProjection.h @@ -40,12 +40,12 @@ public: double paddingAroundPorePressureRegion ); void generateAndSaveResults( RigFemResultAddress resultAddress, - RigContourMapCalculator::ResultAggregationEnum resultAggregation, + RigContourMapCalculator::ResultAggregationType resultAggregation, int viewerStepIndex ); std::vector generateResultsFromAddress( RigFemResultAddress resultAddress, const std::vector& mapCellVisibility, - RigContourMapCalculator::ResultAggregationEnum resultAggregation, + RigContourMapCalculator::ResultAggregationType resultAggregation, int viewerStepIndex ) const; static cvf::BoundingBox calculateExpandedPorBarBBox( RigGeoMechCaseData& caseData, @@ -54,11 +54,11 @@ public: int frameIndex, double padding ); - std::vector getMapCellVisibility( int viewStepIndex, RigContourMapCalculator::ResultAggregationEnum resultAggregation ) override; + std::vector getMapCellVisibility( int viewStepIndex, RigContourMapCalculator::ResultAggregationType resultAggregation ) override; std::vector getMapCellVisibility( RigFemResultAddress resAddr, int viewStepIndex, - RigContourMapCalculator::ResultAggregationEnum resultAggregation ); + RigContourMapCalculator::ResultAggregationType resultAggregation ); protected: // GeoMech implementation specific data generation methods From 5588f8f0f96cc541da000a7435e382fa80ca75b3 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 13 Nov 2024 11:21:35 +0100 Subject: [PATCH 114/160] Statistics contour map: Add UI for selection result aggregation type. --- .../RimStatisticsContourMap.cpp | 32 +++++++++++++++++-- .../RimStatisticsContourMap.h | 7 +++- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.cpp b/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.cpp index 202b56ae96..17b3f1dda3 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.cpp @@ -34,6 +34,7 @@ #include "RimEclipseContourMapProjection.h" #include "RimEclipseResultDefinition.h" #include "RimProject.h" +#include "RimTools.h" #include "cafPdmUiDoubleSliderEditor.h" #include "cafPdmUiPushButtonEditor.h" @@ -53,6 +54,10 @@ RimStatisticsContourMap::RimStatisticsContourMap() CAF_PDM_InitField( &m_relativeSampleSpacing, "SampleSpacing", 0.9, "Sample Spacing Factor" ); m_relativeSampleSpacing.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); + CAF_PDM_InitFieldNoDefault( &m_resultAggregation, "ResultAggregation", "Result Aggregation" ); + + CAF_PDM_InitField( &m_timeStep, "TimeStep", 0, "Time Step" ); + CAF_PDM_InitFieldNoDefault( &m_resultDefinition, "ResultDefinition", "" ); m_resultDefinition.uiCapability()->setUiTreeChildrenHidden( true ); m_resultDefinition = new RimEclipseResultDefinition; @@ -71,6 +76,8 @@ RimStatisticsContourMap::RimStatisticsContourMap() void RimStatisticsContourMap::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { uiOrdering.add( &m_relativeSampleSpacing ); + uiOrdering.add( &m_resultAggregation ); + uiOrdering.add( &m_timeStep ); caf::PdmUiGroup* resultDefinitionGroup = uiOrdering.addNewGroup( "Result Definition" ); m_resultDefinition->uiOrdering( uiConfigName, *resultDefinitionGroup ); @@ -98,6 +105,26 @@ void RimStatisticsContourMap::fieldChangedByUi( const caf::PdmFieldHandle* chang } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList RimStatisticsContourMap::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) +{ + QList options; + + if ( fieldNeedingOptions == &m_timeStep ) + { + auto ensemble = firstAncestorOrThisOfType(); + if ( ensemble && !ensemble->cases().empty() ) + { + RimEclipseCase* firstEclipseCase = ensemble->cases().front(); + RimTools::timeStepsForCase( firstEclipseCase, &options ); + } + } + + return options; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -150,8 +177,7 @@ void RimStatisticsContourMap::computeStatistics() RimEclipseCase* firstEclipseCase = ensemble->cases().front(); firstEclipseCase->ensureReservoirCaseIsOpen(); - int timeStep = 0; - RigContourMapCalculator::ResultAggregationType resultAggregation = RigContourMapCalculator::ResultAggregationType::MEAN; + RigContourMapCalculator::ResultAggregationType resultAggregation = m_resultAggregation(); cvf::BoundingBox gridBoundingBox = firstEclipseCase->activeCellsBoundingBox(); @@ -186,7 +212,7 @@ void RimStatisticsContourMap::computeStatistics() contourMapProjection.generateGridMapping( resultAggregation, {} ); std::vector result = - contourMapProjection.generateResults( m_resultDefinition()->eclipseResultAddress(), resultAggregation, timeStep ); + contourMapProjection.generateResults( m_resultDefinition()->eclipseResultAddress(), resultAggregation, m_timeStep() ); results.push_back( result ); } } diff --git a/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.h b/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.h index 325c7d9fd7..ae4100e801 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.h +++ b/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMap.h @@ -21,6 +21,8 @@ #include "cafPdmField.h" #include "cafPdmObject.h" +#include "RimContourMapProjection.h" + class RimEclipseCase; class RimEclipseResultDefinition; @@ -43,11 +45,14 @@ protected: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; void initAfterRead() override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; private: void computeStatistics(); - caf::PdmField m_relativeSampleSpacing; + caf::PdmField m_relativeSampleSpacing; + caf::PdmField m_resultAggregation; + caf::PdmField m_timeStep; caf::PdmChildField m_resultDefinition; caf::PdmField m_computeStatisticsButton; From 7148ccdc419d8f87761314e5fd7c1bd7e64cc49e Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 13 Nov 2024 11:22:47 +0100 Subject: [PATCH 115/160] Contour Map: Fix crash when not filtering by visibility. --- .../ReservoirDataModel/RigContourMapCalculator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.cpp index 29c13ab512..3d435cc8b1 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.cpp @@ -360,7 +360,7 @@ std::vector auto cellGridIdxVisibility = contourMapProjection.getCellVisibility(); for ( size_t globalCellIdx : allCellIndices ) { - if ( ( *cellGridIdxVisibility )[globalCellIdx] ) + if ( cellGridIdxVisibility.isNull() || ( *cellGridIdxVisibility )[globalCellIdx] ) { kLayerIndexMap[contourMapProjection.kLayer( globalCellIdx )].push_back( globalCellIdx ); } From 811ae1d0be4b9f3a83598251fb1207b2ff8426f0 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 13 Nov 2024 21:37:25 +0100 Subject: [PATCH 116/160] Update ResInsightWithCache.yml Use runner ubuntu-24 and default gcc 13 --- .github/workflows/ResInsightWithCache.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ResInsightWithCache.yml b/.github/workflows/ResInsightWithCache.yml index 6b5355bb37..5973dcaf07 100644 --- a/.github/workflows/ResInsightWithCache.yml +++ b/.github/workflows/ResInsightWithCache.yml @@ -41,8 +41,8 @@ jobs: ri-unit-test-path: "ResInsight-tests", } - { - name: "Ubuntu 22.04 gcc", - os: ubuntu-22.04, + name: "Ubuntu 24.04 gcc", + os: ubuntu-24.04, cc: "gcc", cxx: "g++", build-python-module: true, @@ -163,11 +163,6 @@ jobs: sudo apt-get update --option="APT::Acquire::Retries=3" sudo apt-get install --option="APT::Acquire::Retries=3" libxkbcommon-x11-0 libgl1-mesa-dev mesa-common-dev libglfw3-dev libglu1-mesa-dev libhdf5-dev - - name: Install gcc-10 - if: contains( matrix.config.cc, 'gcc') - run: | - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10 - - name: Install clang-16 if: contains( matrix.config.cc, 'clang') run: | From acbf0ef15a269b662bbc69d91ef115367612805a Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 14 Nov 2024 11:19:12 +0100 Subject: [PATCH 117/160] Fix crash when accessing an empty vector If the UNSMRY data is missing, no timesteps are available. Make sure that we check if any timestep is available before accessing the vector. --- .../RifSummaryReaderMultipleFiles.cpp | 31 ++++++++++++++++--- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/ApplicationLibCode/FileInterface/RifSummaryReaderMultipleFiles.cpp b/ApplicationLibCode/FileInterface/RifSummaryReaderMultipleFiles.cpp index e24b2e608e..0b8381b73a 100644 --- a/ApplicationLibCode/FileInterface/RifSummaryReaderMultipleFiles.cpp +++ b/ApplicationLibCode/FileInterface/RifSummaryReaderMultipleFiles.cpp @@ -23,6 +23,7 @@ #include "cafAssert.h" #include +#include //-------------------------------------------------------------------------------------------------- /// @@ -152,11 +153,28 @@ void RifSummaryReaderMultipleFiles::calculateOverlappingTimeSteps() { if ( m_summaryReaders.empty() ) return; - auto lastRestartCase = m_summaryReaders.back().get(); - auto lastRestartCaseTimeSteps = lastRestartCase->timeSteps( {} ); - m_valueCountForReader[lastRestartCase] = lastRestartCaseTimeSteps.size(); + time_t cutOffTime = 0; + + for ( const auto& it : std::ranges::reverse_view( m_summaryReaders ) ) + { + if ( cutOffTime != 0 ) break; // Stop when we have found a valid cut-off time + + auto currentReader = it.get(); + auto currentTimeSteps = currentReader->timeSteps( {} ); + + m_valueCountForReader[currentReader] = currentTimeSteps.size(); + + if ( !currentTimeSteps.empty() ) + { + cutOffTime = currentTimeSteps.front(); + } + } + + if ( cutOffTime == 0 ) + { + return; + } - time_t cutOffTime = lastRestartCaseTimeSteps.front(); for ( int i = static_cast( m_summaryReaders.size() - 2 ); i >= 0; i-- ) { auto currentReader = m_summaryReaders.at( static_cast( i ) ).get(); @@ -170,7 +188,7 @@ void RifSummaryReaderMultipleFiles::calculateOverlappingTimeSteps() m_valueCountForReader[currentReader] = timeStepIndex; - if ( currentTimeSteps.front() < cutOffTime ) + if ( !currentTimeSteps.empty() && currentTimeSteps.front() < cutOffTime ) { cutOffTime = currentTimeSteps.front(); } @@ -181,6 +199,9 @@ void RifSummaryReaderMultipleFiles::calculateOverlappingTimeSteps() { auto currentTimeSteps = reader->timeSteps( {} ); auto valueCount = m_valueCountForReader[reader.get()]; + + if ( currentTimeSteps.empty() || valueCount == 0 ) continue; + currentTimeSteps.resize( valueCount ); m_aggregatedTimeSteps.insert( m_aggregatedTimeSteps.end(), currentTimeSteps.begin(), currentTimeSteps.end() ); From 664b082c8123b8ca8c5bbbfc0db072b255c0ddbe Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 14 Nov 2024 11:55:02 +0100 Subject: [PATCH 118/160] Use opm-common to read restart file from summary file Testing identified performance issues related to reading restart file name from summary files. Make sure the reading of timesteps is done only when required in new function getFileInfoAndTimeSteps. Add reading of restart file name using opm-common when opm-common is active. The performance of this reader is much better than resdata. --- .../Commands/RicSummaryCaseRestartDialog.cpp | 28 ++--- .../FileInterface/RifEclipseSummaryTools.cpp | 108 +++++++++++++++--- .../FileInterface/RifEclipseSummaryTools.h | 12 +- .../RifSummaryCaseRestartSelector.cpp | 14 +-- .../Summary/RimFileSummaryCase.cpp | 18 ++- .../RifReaderEclipseSummary-Test.cpp | 26 ++--- .../UnitTests/opm-summary-Test.cpp | 43 +++++++ 7 files changed, 188 insertions(+), 61 deletions(-) diff --git a/ApplicationLibCode/Commands/RicSummaryCaseRestartDialog.cpp b/ApplicationLibCode/Commands/RicSummaryCaseRestartDialog.cpp index 45c524a225..7a91e3a6f1 100644 --- a/ApplicationLibCode/Commands/RicSummaryCaseRestartDialog.cpp +++ b/ApplicationLibCode/Commands/RicSummaryCaseRestartDialog.cpp @@ -234,7 +234,7 @@ RicSummaryCaseRestartDialogResult RicSummaryCaseRestartDialog::openDialog( const RifRestartFileInfo currentFileInfo; if ( !initialSummaryFile.isEmpty() ) { - currentFileInfo = RifEclipseSummaryTools::getFileInfo( initialSummaryFile ); + currentFileInfo = RifEclipseSummaryTools::getFileInfoAndTimeSteps( initialSummaryFile ); if ( !currentFileInfo.valid() ) { @@ -268,11 +268,11 @@ RicSummaryCaseRestartDialogResult RicSummaryCaseRestartDialog::openDialog( const useFirstSummaryCaseAsTemplate || ( lastResult && lastResult->applyToAll ) ); } - std::vector warnings; - std::vector originFileInfos = RifEclipseSummaryTools::getRestartFiles( initialSummaryFile, warnings ); + std::vector warnings; + auto restartFileNames = RifEclipseSummaryTools::getRestartFileNames( initialSummaryFile, warnings ); // If no restart files are found and no warnings, do not show dialog - if ( originFileInfos.empty() && warnings.empty() ) + if ( restartFileNames.empty() && warnings.empty() ) { return RicSummaryCaseRestartDialogResult( RicSummaryCaseRestartDialogResult::SUMMARY_OK, ImportOptions::NOT_IMPORT, @@ -303,20 +303,22 @@ RicSummaryCaseRestartDialogResult RicSummaryCaseRestartDialog::openDialog( const dialog.m_currentFilesGroup->setTitle( "Current Grid and Summary Files" ); currentFileInfos.push_back( RifRestartFileInfo( initialGridFile, currentFileInfo.startDate, currentFileInfo.endDate ) ); - for ( const auto& ofi : originFileInfos ) + for ( const auto& fileName : restartFileNames ) { - QString gridFile = RifEclipseSummaryTools::findGridCaseFileFromSummaryHeaderFile( ofi.fileName ); + QString gridFile = RifEclipseSummaryTools::findGridCaseFileFromSummaryHeaderFile( fileName ); if ( QFileInfo( gridFile ).exists() ) { - originGridFileInfos.push_back( RifRestartFileInfo( gridFile, ofi.startDate, ofi.endDate ) ); + auto fileInfoWithTime = RifEclipseSummaryTools::getFileInfoAndTimeSteps( fileName ); + + originGridFileInfos.push_back( RifRestartFileInfo( gridFile, fileInfoWithTime.startDate, fileInfoWithTime.endDate ) ); } } } currentFileInfos.push_back( currentFileInfo ); - for ( const auto& ofi : originFileInfos ) + for ( const auto& fileName : restartFileNames ) { - originSummaryFileInfos.push_back( ofi ); + originSummaryFileInfos.push_back( RifRestartFileInfo( fileName, 0, 0 ) ); } if ( hideSplitCases ) @@ -409,9 +411,9 @@ RicSummaryCaseRestartDialogResult RicSummaryCaseRestartDialog::openDialog( const dialogResult.summaryFiles.push_back( RiaFilePathTools::toInternalSeparator( initialSummaryFile ) ); if ( dialogResult.summaryImportOption == ImportOptions::SEPARATE_CASES ) { - for ( const auto& ofi : originFileInfos ) + for ( const auto& fileName : restartFileNames ) { - dialogResult.summaryFiles.push_back( RiaFilePathTools::toInternalSeparator( ofi.fileName ) ); + dialogResult.summaryFiles.push_back( RiaFilePathTools::toInternalSeparator( fileName ) ); } } @@ -421,9 +423,9 @@ RicSummaryCaseRestartDialogResult RicSummaryCaseRestartDialog::openDialog( const if ( dialogResult.gridImportOption == ImportOptions::SEPARATE_CASES ) { - for ( const auto& ofi : originFileInfos ) + for ( const auto& fileName : restartFileNames ) { - QString gridFile = RifEclipseSummaryTools::findGridCaseFileFromSummaryHeaderFile( ofi.fileName ); + QString gridFile = RifEclipseSummaryTools::findGridCaseFileFromSummaryHeaderFile( fileName ); dialogResult.gridFiles.push_back( gridFile ); } } diff --git a/ApplicationLibCode/FileInterface/RifEclipseSummaryTools.cpp b/ApplicationLibCode/FileInterface/RifEclipseSummaryTools.cpp index 27c7fcb94e..5f90142392 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseSummaryTools.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseSummaryTools.cpp @@ -32,6 +32,8 @@ #include "ert/ecl/ecl_util.h" #include "ert/ecl/smspec_node.hpp" +#include "opm/io/eclipse/EclFile.hpp" + #include #include #include @@ -150,15 +152,23 @@ void RifEclipseSummaryTools::dumpMetaData( RifSummaryReaderInterface* readerEcli //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RifEclipseSummaryTools::getRestartFiles( const QString& headerFileName, std::vector& warnings ) +std::vector RifEclipseSummaryTools::getRestartFileNames( const QString& headerFileName, std::vector& warnings ) { - std::vector restartFiles; + return getRestartFileNames( headerFileName, false, warnings ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector + RifEclipseSummaryTools::getRestartFileNames( const QString& headerFileName, bool useOpmReader, std::vector& warnings ) +{ + std::vector restartFiles; std::set restartFilesOpened; - RifRestartFileInfo currFile; - currFile.fileName = headerFileName; - while ( !currFile.fileName.isEmpty() ) + QString currentFileName = headerFileName; + while ( !currentFileName.isEmpty() ) { // Due to a weakness in resdata regarding restart summary header file selection, // do some extra checking @@ -167,14 +177,14 @@ std::vector RifEclipseSummaryTools::getRestartFiles( const Q QString nonformattedHeaderExtension = ".SMSPEC"; QString formattedDataFileExtension = ".FUNSMRY"; - if ( currFile.fileName.endsWith( nonformattedHeaderExtension, Qt::CaseInsensitive ) ) + if ( currentFileName.endsWith( nonformattedHeaderExtension, Qt::CaseInsensitive ) ) { - QString formattedHeaderFile = currFile.fileName; + QString formattedHeaderFile = currentFileName; formattedHeaderFile.replace( nonformattedHeaderExtension, formattedHeaderExtension, Qt::CaseInsensitive ); - QString formattedDateFile = currFile.fileName; + QString formattedDateFile = currentFileName; formattedDateFile.replace( nonformattedHeaderExtension, formattedDataFileExtension, Qt::CaseInsensitive ); - QFileInfo nonformattedHeaderFileInfo = QFileInfo( currFile.fileName ); + QFileInfo nonformattedHeaderFileInfo = QFileInfo( currentFileName ); QFileInfo formattedHeaderFileInfo = QFileInfo( formattedHeaderFile ); QFileInfo formattedDateFileInfo = QFileInfo( formattedDateFile ); if ( formattedHeaderFileInfo.lastModified() < nonformattedHeaderFileInfo.lastModified() && @@ -187,23 +197,31 @@ std::vector RifEclipseSummaryTools::getRestartFiles( const Q break; } } - QString prevFile = currFile.fileName; - currFile = getRestartFile( currFile.fileName ); + QString prevFileName = currentFileName; + + if ( useOpmReader ) + { + currentFileName = getRestartFileNameOpm( currentFileName ); + } + else + { + currentFileName = getRestartFileName( currentFileName ); + } // Fix to stop potential infinite loop - if ( currFile.fileName == prevFile ) + if ( currentFileName == prevFileName ) { warnings.push_back( "RifReaderEclipseSummary: Restart file reference loop detected" ); break; } - if ( restartFilesOpened.count( currFile.fileName ) != 0u ) + if ( restartFilesOpened.count( currentFileName ) != 0u ) { warnings.push_back( "RifReaderEclipseSummary: Same restart file being opened multiple times" ); } - restartFilesOpened.insert( currFile.fileName ); + restartFilesOpened.insert( currentFileName ); } - if ( !currFile.fileName.isEmpty() ) restartFiles.push_back( currFile ); + if ( !currentFileName.isEmpty() ) restartFiles.push_back( currentFileName ); } return restartFiles; } @@ -211,7 +229,7 @@ std::vector RifEclipseSummaryTools::getRestartFiles( const Q //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifRestartFileInfo RifEclipseSummaryTools::getFileInfo( const QString& headerFileName ) +RifRestartFileInfo RifEclipseSummaryTools::getFileInfoAndTimeSteps( const QString& headerFileName ) { RifRestartFileInfo fileInfo; ecl_sum_type* ecl_sum = openEclSum( headerFileName, false ); @@ -227,6 +245,14 @@ RifRestartFileInfo RifEclipseSummaryTools::getFileInfo( const QString& headerFil return fileInfo; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RifEclipseSummaryTools::getRestartFileNamesOpm( const QString& headerFileName, std::vector& warnings ) +{ + return getRestartFileNames( headerFileName, true, warnings ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -261,7 +287,7 @@ void RifEclipseSummaryTools::findSummaryHeaderFileInfo( const QString& inputFile //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifRestartFileInfo RifEclipseSummaryTools::getRestartFile( const QString& headerFileName ) +QString RifEclipseSummaryTools::getRestartFileName( const QString& headerFileName ) { ecl_sum_type* ecl_sum = openEclSum( headerFileName, true ); @@ -283,11 +309,52 @@ RifRestartFileInfo RifEclipseSummaryTools::getRestartFile( const QString& header QString restartFileName = RiaFilePathTools::toInternalSeparator( RiaStringEncodingTools::fromNativeEncoded( smspec_header ) ); free( smspec_header ); - return getFileInfo( restartFileName ); + return restartFileName; } - return RifRestartFileInfo(); + return {}; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RifEclipseSummaryTools::getRestartFileNameOpm( const QString& headerFileName ) +{ + try + { + Opm::EclIO::EclFile eclFile( headerFileName.toStdString() ); + eclFile.loadData( "RESTART" ); + + std::string fullRestartFileName; + + auto restartData = eclFile.get( "RESTART" ); + for ( const auto& string : restartData ) + { + fullRestartFileName += string; + } + + if ( fullRestartFileName.empty() ) return {}; + + QFileInfo sourceFileInfo( headerFileName ); + QString suffix = sourceFileInfo.suffix(); + + QString filePath = sourceFileInfo.absolutePath() + RiaFilePathTools::separator() + QString::fromStdString( fullRestartFileName ) + + "." + suffix; + + QFileInfo restartFileInfo( filePath ); + QString restartFileName = RiaFilePathTools::toInternalSeparator( restartFileInfo.absoluteFilePath() ); + + return restartFileName; + } + catch ( ... ) + { + } + + return {}; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- std::vector RifEclipseSummaryTools::getTimeSteps( ecl_sum_type* ecl_sum ) { std::vector timeSteps; @@ -309,6 +376,9 @@ std::vector RifEclipseSummaryTools::getTimeSteps( ecl_sum_type* ecl_sum return timeSteps; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- RiaDefines::EclipseUnitSystem RifEclipseSummaryTools::readUnitSystem( ecl_sum_type* ecl_sum ) { ert_ecl_unit_enum eclUnitEnum = ecl_sum_get_unit_system( ecl_sum ); diff --git a/ApplicationLibCode/FileInterface/RifEclipseSummaryTools.h b/ApplicationLibCode/FileInterface/RifEclipseSummaryTools.h index 053c3c5a8f..c3e5e601d8 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseSummaryTools.h +++ b/ApplicationLibCode/FileInterface/RifEclipseSummaryTools.h @@ -68,8 +68,10 @@ public: static void dumpMetaData( RifSummaryReaderInterface* readerEclipseSummary ); - static std::vector getRestartFiles( const QString& headerFileName, std::vector& warnings ); - static RifRestartFileInfo getFileInfo( const QString& headerFileName ); + static std::vector getRestartFileNames( const QString& headerFileName, std::vector& warnings ); + static std::vector getRestartFileNamesOpm( const QString& headerFileName, std::vector& warnings ); + + static RifRestartFileInfo getFileInfoAndTimeSteps( const QString& headerFileName ); static void closeEclSum( ecl_sum_type* ecl_sum ); static ecl_sum_type* openEclSum( const QString& inHeaderFileName, bool includeRestartFiles ); @@ -77,8 +79,10 @@ public: static std::vector getTimeSteps( ecl_sum_type* ecl_sum ); private: - static void findSummaryFiles( const QString& inputFile, QString* headerFile, QStringList* dataFiles ); - static RifRestartFileInfo getRestartFile( const QString& headerFileName ); + static void findSummaryFiles( const QString& inputFile, QString* headerFile, QStringList* dataFiles ); + static QString getRestartFileName( const QString& headerFileName ); + static QString getRestartFileNameOpm( const QString& headerFileName ); + static std::vector getRestartFileNames( const QString& headerFileName, bool useOpmReader, std::vector& warnings ); static void findSummaryHeaderFileInfo( const QString& inputFile, QString* headerFile, QString* path, QString* base, bool* isFormatted ); }; diff --git a/ApplicationLibCode/FileInterface/RifSummaryCaseRestartSelector.cpp b/ApplicationLibCode/FileInterface/RifSummaryCaseRestartSelector.cpp index 7be3c8c2b8..fb926cb4fd 100644 --- a/ApplicationLibCode/FileInterface/RifSummaryCaseRestartSelector.cpp +++ b/ApplicationLibCode/FileInterface/RifSummaryCaseRestartSelector.cpp @@ -287,11 +287,11 @@ void RifSummaryCaseRestartSelector::determineFilesToImportUsingPrefs( const std: { m_summaryFileInfos.push_back( RifSummaryCaseFileResultInfo( initialSummaryFile, false ) ); - std::vector warnings; - std::vector restartFileInfos = RifEclipseSummaryTools::getRestartFiles( initialSummaryFile, warnings ); - for ( const auto& rfi : restartFileInfos ) + std::vector warnings; + auto fileNames = RifEclipseSummaryTools::getRestartFileNames( initialSummaryFile, warnings ); + for ( const auto& fileName : fileNames ) { - RifSummaryCaseFileResultInfo resultFileInfo( RiaFilePathTools::toInternalSeparator( rfi.fileName ), false ); + RifSummaryCaseFileResultInfo resultFileInfo( RiaFilePathTools::toInternalSeparator( fileName ), false ); if ( !vectorContains( m_summaryFileInfos, resultFileInfo ) ) { m_summaryFileInfos.push_back( resultFileInfo ); @@ -309,10 +309,10 @@ void RifSummaryCaseRestartSelector::determineFilesToImportUsingPrefs( const std: { std::vector warnings; - std::vector restartFileInfos = RifEclipseSummaryTools::getRestartFiles( initialSummaryFile, warnings ); - for ( const auto& rfi : restartFileInfos ) + auto fileNames = RifEclipseSummaryTools::getRestartFileNames( initialSummaryFile, warnings ); + for ( const auto& fileName : fileNames ) { - QString gridFileName = RifEclipseSummaryTools::findGridCaseFileFromSummaryHeaderFile( rfi.fileName ); + QString gridFileName = RifEclipseSummaryTools::findGridCaseFileFromSummaryHeaderFile( fileName ); if ( !m_gridFiles.contains( gridFileName ) && QFileInfo( gridFileName ).exists() ) { m_gridFiles.push_back( gridFileName ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp index 1a8cfc3376..ee981c2da6 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp @@ -167,16 +167,24 @@ RifSummaryReaderInterface* RimFileSummaryCase::findRelatedFilesAndCreateReader( { if ( lookForRestartFiles ) { - std::vector warnings; - std::vector restartFileInfos = RifEclipseSummaryTools::getRestartFiles( headerFileName, warnings ); + std::vector warnings; + std::vector restartFileNames; + if ( RiaPreferencesSummary::current()->summaryDataReader() == RiaPreferencesSummary::SummaryReaderMode::OPM_COMMON ) + { + restartFileNames = RifEclipseSummaryTools::getRestartFileNamesOpm( headerFileName, warnings ); + } + else + { + restartFileNames = RifEclipseSummaryTools::getRestartFileNames( headerFileName, warnings ); + } - if ( !restartFileInfos.empty() ) + if ( !restartFileNames.empty() ) { std::vector summaryFileNames; summaryFileNames.push_back( headerFileName.toStdString() ); - for ( const auto& s : restartFileInfos ) + for ( const auto& fileName : restartFileNames ) { - summaryFileNames.push_back( s.fileName.toStdString() ); + summaryFileNames.push_back( fileName.toStdString() ); } // The ordering in intended to be start of history first, so we reverse the ordering diff --git a/ApplicationLibCode/UnitTests/RifReaderEclipseSummary-Test.cpp b/ApplicationLibCode/UnitTests/RifReaderEclipseSummary-Test.cpp index 2ecee92175..51160c5c91 100644 --- a/ApplicationLibCode/UnitTests/RifReaderEclipseSummary-Test.cpp +++ b/ApplicationLibCode/UnitTests/RifReaderEclipseSummary-Test.cpp @@ -22,11 +22,11 @@ #include "RifEclipseSummaryTools.h" #include "RifReaderEclipseSummary.h" +#include "RifSummaryReaderMultipleFiles.h" #include #include -#include "RifSummaryReaderMultipleFiles.h" #include //-------------------------------------------------------------------------------------------------- @@ -38,9 +38,9 @@ TEST( DISABLED_RifEclipseSummaryTest, TestRestartSummaryFileReferences_01 ) "courses/intro2020_data/reek_ensemble/3_r001_reek_50/realization-0/base_pred/eclipse/model/" "3_R001_REEK-0.SMSPEC"; - std::vector warnings; - std::vector originFileInfos = RifEclipseSummaryTools::getRestartFiles( summaryFileName, warnings ); - EXPECT_TRUE( originFileInfos.empty() ); + std::vector warnings; + auto fileNames = RifEclipseSummaryTools::getRestartFileNames( summaryFileName, warnings ); + EXPECT_TRUE( fileNames.empty() ); } //-------------------------------------------------------------------------------------------------- @@ -50,16 +50,16 @@ TEST( DISABLED_RifEclipseSummaryTest, TestRestartSummaryFileReferences_02 ) { QString summaryFileName = "e:/models/reek_ensemble/3_r001_reek_50/realization-0/base_pred/eclipse/model/3_R001_REEK-0.SMSPEC"; - std::vector warnings; - std::vector originFileInfos = RifEclipseSummaryTools::getRestartFiles( summaryFileName, warnings ); + std::vector warnings; + auto fileNames = RifEclipseSummaryTools::getRestartFileNames( summaryFileName, warnings ); - if ( !originFileInfos.empty() ) + if ( !fileNames.empty() ) { std::vector smspecFilesNewFirst; smspecFilesNewFirst.push_back( summaryFileName.toStdString() ); - for ( const auto& s : originFileInfos ) + for ( const auto& s : fileNames ) { - smspecFilesNewFirst.push_back( s.fileName.toStdString() ); + smspecFilesNewFirst.push_back( s.toStdString() ); } RifSummaryReaderMultipleFiles multipleSummaryFiles( smspecFilesNewFirst ); @@ -67,7 +67,7 @@ TEST( DISABLED_RifEclipseSummaryTest, TestRestartSummaryFileReferences_02 ) std::cout << ts.size(); } - EXPECT_TRUE( originFileInfos.empty() ); + EXPECT_TRUE( fileNames.empty() ); } //-------------------------------------------------------------------------------------------------- @@ -79,9 +79,9 @@ TEST( DISABLED_RifEclipseSummaryTest, BasicTestSetCurrentFolder ) QString summaryFileName = testDataRootFolder + "3_R001_REEK-1.SMSPEC"; - std::vector warnings; - std::vector originFileInfos = RifEclipseSummaryTools::getRestartFiles( summaryFileName, warnings ); - EXPECT_TRUE( originFileInfos.empty() ); + std::vector warnings; + auto fileNames = RifEclipseSummaryTools::getRestartFileNames( summaryFileName, warnings ); + EXPECT_TRUE( fileNames.empty() ); } /* diff --git a/ApplicationLibCode/UnitTests/opm-summary-Test.cpp b/ApplicationLibCode/UnitTests/opm-summary-Test.cpp index 88abcce1c0..f843ccd07a 100644 --- a/ApplicationLibCode/UnitTests/opm-summary-Test.cpp +++ b/ApplicationLibCode/UnitTests/opm-summary-Test.cpp @@ -1,8 +1,10 @@ #include "gtest/gtest.h" +#include "RiaLogging.h" #include "RiaRftDefines.h" #include "RiaTestDataDirectory.h" +#include "RifEclipseSummaryTools.h" #include "RifOpmCommonSummary.h" #include "RifReaderOpmRft.h" @@ -20,6 +22,47 @@ static const QString H5_TEST_DATA_DIRECTORY = QString( "%1/h5-file/" ).arg( TEST_DATA_DIR ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +TEST( OpmSummaryTests, DISABLED_PerformanceReadOfRestartFilename ) +{ + // 2024-11-14 + // This test is intended to measure the performance of reading restart filenames from a summary file + // Both resdata and opm-common are used, and for some cases resdata is much slower than opm-common + // + // Performance comparison + // BRENT-PRED_IAM_NSA_F - 100 iterations + // opm-common: 10 ms + // resdata: 10000 ms + + QString filePath = H5_TEST_DATA_DIRECTORY + "NORNE_ATW2013_RFTPLT_V2.SMSPEC"; + filePath = "C:/gitroot/ResInsight-regression-test/ModelData/ensemble_reek_with_params/realization-7/iter-0/eclipse/model/" + "3_R001_REEK-7.SMSPEC"; + + filePath = "c:/gitroot/ResInsight-regression-test/ModelData/TestCase_MultiCaseStatistics/SIMPLE_R1.SMSPEC"; + filePath = "f:/Models/equinor_azure/Sum_File/BRENT-PRED_IAM_NSA_F.SMSPEC"; + + const int N = 100; + + RiaLogging::resetTimer( "Starting opm-common" ); + for ( int i = 0; i < N; i++ ) + { + std::vector warnings; + auto restartFileInfos = RifEclipseSummaryTools::getRestartFileNamesOpm( filePath, warnings ); + } + RiaLogging::logTimeElapsed( "Completed opm-common" ); + + RiaLogging::resetTimer( "Starting resdata" ); + for ( int i = 0; i < N; i++ ) + { + std::vector warnings; + auto restartFileInfos = RifEclipseSummaryTools::getRestartFileNames( filePath, warnings ); + } + + RiaLogging::logTimeElapsed( "Completed resdata" ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- From f6109cab2b6b61ddb89c4ebbec8219e824a693f2 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 15 Nov 2024 11:36:52 +0100 Subject: [PATCH 119/160] Bump to dev.05 * Disable logging text for timing of geometry surface creation * Suppress text output from windeployqt * Bump to 2024.09.3-dev.05 --- ApplicationExeCode/CMakeLists.txt | 9 +++++++-- .../ModelVisualization/RivGridPartMgr.cpp | 15 ++++++++++++--- ResInsightVersion.cmake | 2 +- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/ApplicationExeCode/CMakeLists.txt b/ApplicationExeCode/CMakeLists.txt index adaa483bf2..25d331b507 100644 --- a/ApplicationExeCode/CMakeLists.txt +++ b/ApplicationExeCode/CMakeLists.txt @@ -434,11 +434,16 @@ if(RESINSIGHT_PRIVATE_INSTALL) # TODO: This command copies all required dlls, so we should probably not use # the Install() command to copy external dlls dependencies. # + # The statements " >NUL 2>NUL" are used to suppress text output from + # windeployqt. ">NUL" suppresses standard output. "2>NUL" suppresses + # standard error. + # add_custom_command( TARGET ResInsight POST_BUILD - COMMAND ${WINDEPLOYQT_EXECUTABLE} $ - "$,--debug,--release>" --no-translations + COMMAND + ${WINDEPLOYQT_EXECUTABLE} $ + "$,--debug,--release>" --no-translations >NUL 2>NUL COMMENT "Running windeployqt to deploy Qt dependencies to the build folder, required by install()" ) diff --git a/ApplicationLibCode/ModelVisualization/RivGridPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivGridPartMgr.cpp index cbad222ab4..1f0e9141d4 100644 --- a/ApplicationLibCode/ModelVisualization/RivGridPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivGridPartMgr.cpp @@ -144,10 +144,19 @@ void RivGridPartMgr::generatePartGeometry( cvf::StructGridGeometryGenerator& geo // Surface geometry { - auto text = caf::AppEnum::text( m_cellSetType ); - RiaLogging::resetTimer( "Compute surface for " + text ); + bool showDebugTiming = false; + if ( showDebugTiming ) + { + auto text = caf::AppEnum::text( m_cellSetType ); + RiaLogging::resetTimer( "Compute surface for " + text ); + } + cvf::ref geo = geoBuilder.generateSurface(); - RiaLogging::logTimeElapsed( "" ); + + if ( showDebugTiming ) + { + RiaLogging::logTimeElapsed( "" ); + } if ( geo.notNull() ) { diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index 4ff2f69f17..a2cce6ed77 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -11,7 +11,7 @@ set(RESINSIGHT_VERSION_TEXT "-dev") # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -set(RESINSIGHT_DEV_VERSION ".04") +set(RESINSIGHT_DEV_VERSION ".05") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") From dbea0e25937fae267436ff8fab7725e457954f58 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Fri, 15 Nov 2024 12:12:59 +0100 Subject: [PATCH 120/160] OpenGL DPI scaling support (#11883) Scale opengl width/height based on primary screen DPI scaling. --- ApplicationExeCode/RiaMain.cpp | 7 ---- .../UserInterface/RiuComparisonViewMover.cpp | 10 +++-- .../UserInterface/RiuViewer.cpp | 36 ++++++++--------- ApplicationLibCode/UserInterface/RiuViewer.h | 1 - Fwk/AppFwk/cafViewer/cafViewer.cpp | 39 ++++++++++++++----- Fwk/AppFwk/cafViewer/cafViewer.h | 3 ++ 6 files changed, 57 insertions(+), 39 deletions(-) diff --git a/ApplicationExeCode/RiaMain.cpp b/ApplicationExeCode/RiaMain.cpp index 66ddd7eba3..4a3489ea1e 100644 --- a/ApplicationExeCode/RiaMain.cpp +++ b/ApplicationExeCode/RiaMain.cpp @@ -78,13 +78,6 @@ int main( int argc, char* argv[] ) } #endif -#ifdef WIN32 - // Temporary workaround for incorrect scaling of opengl viewport on windows with dpi scaling != 100% - // Reverts scaling behaviour to Qt5 style - // Should be replaced by proper scaling of x and y coordinates in caf::Viewer - qputenv( "QT_ENABLE_HIGHDPI_SCALING", "0" ); -#endif - // The Qt::AA_ShareOpenGLContexts setting is needed when we have multiple viz widgets in flight // and we have a setup where these widgets belong to different top-level windows, or end up // belonging to different top-level windows through re-parenting. diff --git a/ApplicationLibCode/UserInterface/RiuComparisonViewMover.cpp b/ApplicationLibCode/UserInterface/RiuComparisonViewMover.cpp index dd0d385e9a..c8825ade79 100644 --- a/ApplicationLibCode/UserInterface/RiuComparisonViewMover.cpp +++ b/ApplicationLibCode/UserInterface/RiuComparisonViewMover.cpp @@ -61,8 +61,11 @@ bool RiuComparisonViewMover::eventFilter( QObject* watched, QEvent* event ) if ( m_dragState == LEFT_EDGE ) { + const int viewWidth = m_viewer->width(); + const int viewHeight = m_viewer->height(); + QPointF mousePos = mEv->localPos(); - QPointF normMousePos = { mousePos.x() / m_viewer->width(), mousePos.y() / m_viewer->height() }; + QPointF normMousePos = { mousePos.x() / viewWidth, mousePos.y() / viewHeight }; cvf::Rectf orgCompViewWindow = m_viewer->comparisonViewVisibleNormalizedRect(); float minx = normMousePos.x(); @@ -97,8 +100,9 @@ void RiuComparisonViewMover::paintMoverHandles( QPainter* painter ) const int handleThickness = 7; cvf::Rectf normalizedComparisonRect = m_viewer->comparisonViewVisibleNormalizedRect(); - int viewerWidth = m_viewer->width(); - int viewerHeight = m_viewer->height(); + const auto ratio = m_viewer->displayScalingRatio(); + int viewerWidth = (int)( ratio * m_viewer->width() ); + int viewerHeight = (int)( ratio * m_viewer->height() ); int leftEdgePos = viewerWidth * normalizedComparisonRect.min().x(); int width = viewerWidth * normalizedComparisonRect.width(); diff --git a/ApplicationLibCode/UserInterface/RiuViewer.cpp b/ApplicationLibCode/UserInterface/RiuViewer.cpp index 1b5ef641f0..d9b8733ae4 100644 --- a/ApplicationLibCode/UserInterface/RiuViewer.cpp +++ b/ApplicationLibCode/UserInterface/RiuViewer.cpp @@ -401,6 +401,11 @@ void RiuViewer::paintOverlayItems( QPainter* painter ) // and when they are shared between views the positions are overwritten. updateLegendLayout(); + // adjust for possible DPI scaling + auto ratio = displayScalingRatio(); + const auto trueWidth = (int)( ratio * this->width() ); + const auto trueHeight = (int)( ratio * this->height() ); + int columnWidth = 200; int edgeAxisFrameBorderWidth = m_showWindowEdgeAxes ? m_windowEdgeAxisOverlay->frameBorderWidth() : 0; @@ -415,7 +420,7 @@ void RiuViewer::paintOverlayItems( QPainter* painter ) if ( m_showInfoText ) columnWidth = std::max( columnWidth, m_infoLabel->sizeHint().width() ); - int columnPos = width() - columnWidth - margin - edgeAxisFrameBorderWidth; + int columnPos = trueWidth - columnWidth - margin - edgeAxisFrameBorderWidth; if ( isComparisonViewActive() ) { @@ -424,9 +429,8 @@ void RiuViewer::paintOverlayItems( QPainter* painter ) { columnWidth = 200; - // int sliderPos = width() * comparisonViewVisibleNormalizedRect().min().x(); - int sliderPos = 0.5 * width(); - int compViewItemsXPos = sliderPos + 0.5 * ( width() - sliderPos ) - 0.5 * columnWidth; + int sliderPos = 0.5 * trueWidth; + int compViewItemsXPos = sliderPos + 0.5 * ( trueWidth - sliderPos ) - 0.5 * columnWidth; columnPos = 0.5 * sliderPos - 0.5 * columnWidth; if ( m_showInfoText ) @@ -520,13 +524,13 @@ void RiuViewer::paintOverlayItems( QPainter* painter ) { m_histogramWidget->resize( columnWidth, 40 ); m_histogramWidget->render( painter, QPoint( columnPos, yPos ) ); - // yPos += m_histogramWidget->height() + margin; } if ( m_showVersionInfo ) // Version Label { - QSize size( m_versionInfoLabel->sizeHint().width(), m_versionInfoLabel->sizeHint().height() ); - QPoint pos( width() - size.width() - margin - edgeAxisFrameBorderWidth, height() - size.height() - margin - edgeAxisFrameBorderHeight ); + QSize size( m_versionInfoLabel->sizeHint().width(), m_versionInfoLabel->sizeHint().height() ); + QPoint pos( trueWidth - size.width() - margin - edgeAxisFrameBorderWidth, + trueHeight - size.height() - margin - edgeAxisFrameBorderHeight ); m_versionInfoLabel->resize( size.width(), size.height() ); m_versionInfoLabel->render( painter, pos ); } @@ -550,8 +554,9 @@ void RiuViewer::paintOverlayItems( QPainter* painter ) cvf::Vec3d screenCoords; if ( mainCamera()->project( displayCoord, &screenCoords ) ) { - int translatedMousePosY = height() - screenCoords.y(); - QPoint centerPos( screenCoords.x(), translatedMousePosY ); + int translatedMousePosX = (int)( ratio * screenCoords.x() ); + int translatedMousePosY = (int)( ratio * ( height() - screenCoords.y() ) ); + QPoint centerPos( translatedMousePosX, translatedMousePosY ); // Draw a cross hair marker int markerHalfLength = 6; @@ -926,8 +931,9 @@ void RiuViewer::updateLegendLayout() auto scaleLegendSize = m_scaleLegend->renderSize(); auto otherItemsHeight = m_versionInfoLabel->sizeHint().height(); - const int xPos = width() - (int)scaleLegendSize.x() - margin - edgeAxisBorderWidth; - const int yPos = margin + edgeAxisBorderHeight + margin + otherItemsHeight; + const auto ratio = displayScalingRatio(); + const int xPos = (int)( ratio * width() ) - (int)scaleLegendSize.x() - margin - edgeAxisBorderWidth; + const int yPos = margin + edgeAxisBorderHeight + margin + otherItemsHeight; m_scaleLegend->setLayoutFixedPosition( { xPos, yPos } ); } @@ -1058,14 +1064,6 @@ void RiuViewer::optimizeClippingPlanes() caf::Viewer::optimizeClippingPlanes(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuViewer::resizeGL( int width, int height ) -{ - caf::Viewer::resizeGL( width, height ); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuViewer.h b/ApplicationLibCode/UserInterface/RiuViewer.h index 8f402176f3..a7bac0c1dd 100644 --- a/ApplicationLibCode/UserInterface/RiuViewer.h +++ b/ApplicationLibCode/UserInterface/RiuViewer.h @@ -141,7 +141,6 @@ public slots: protected: void optimizeClippingPlanes() override; - void resizeGL( int width, int height ) override; void mouseMoveEvent( QMouseEvent* e ) override; void enterEvent( QEnterEvent* e ) override; void leaveEvent( QEvent* ) override; diff --git a/Fwk/AppFwk/cafViewer/cafViewer.cpp b/Fwk/AppFwk/cafViewer/cafViewer.cpp index 1652b9b7c1..cdb354b49a 100644 --- a/Fwk/AppFwk/cafViewer/cafViewer.cpp +++ b/Fwk/AppFwk/cafViewer/cafViewer.cpp @@ -69,6 +69,7 @@ #include "cvfqtPerformanceInfoHud.h" #include "cvfqtUtils.h" +#include #include #include #include @@ -184,6 +185,14 @@ caf::Viewer::~Viewer() if ( m_layoutWidget ) m_layoutWidget->deleteLater(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double caf::Viewer::displayScalingRatio() const +{ + return qApp->primaryScreen()->devicePixelRatio(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -325,7 +334,9 @@ void caf::Viewer::setComparisonViewVisibleNormalizedRect( const cvf::Rectf& visi { m_comparisonWindowNormalizedRect = visibleRect; - updateCamera( width(), height() ); + const auto ratio = displayScalingRatio(); + + updateCamera( (int)( ratio * width() ), (int)( ratio * height() ) ); update(); } @@ -639,8 +650,9 @@ cvf::ref caf::Viewer::rayIntersectSpecFromWindowCoordinat cvf::ref caf::Viewer::rayIntersectSpecFromWindowCoordinates( int winPosX, int winPosY, bool isForComparisonView ) { - int translatedMousePosX = winPosX; - int translatedMousePosY = height() - winPosY; + const auto ratio = displayScalingRatio(); + int translatedMousePosX = (int)( ratio * winPosX ); + int translatedMousePosY = (int)( ratio * ( height() - winPosY ) ); cvf::Rendering* renderingToInvestigate = isForComparisonView ? m_comparisonMainRendering.p() : m_mainRendering.p(); @@ -711,6 +723,10 @@ bool caf::Viewer::isMousePosWithinComparisonView( int winPosX, int winPosY ) //-------------------------------------------------------------------------------------------------- void caf::Viewer::resizeGL( int width, int height ) { + auto ratio = displayScalingRatio(); + width = (int)( ratio * width ); + height = (int)( ratio * height ); + if ( width < 1 || height < 1 ) return; if ( m_offscreenFbo.notNull() ) @@ -755,6 +771,11 @@ void caf::Viewer::paintGL() CVF_CHECK_OGL( myOglContext.p() ); CVF_ASSERT( myOglContext->isContextValid() ); + auto ratio = displayScalingRatio(); + auto thisSize = this->size(); + thisSize.setHeight( (int)( ratio * thisSize.height() ) ); + thisSize.setWidth( (int)( ratio * thisSize.width() ) ); + QPainter painter( this ); if ( m_renderingSequence.isNull() || !canRender() ) @@ -769,9 +790,9 @@ void caf::Viewer::paintGL() if ( m_isOverlayPaintingEnabled || m_showPerfInfoHud ) { // Set up image to draw to, and painter - if ( m_overlayPaintingQImage.size() != this->size() ) + if ( m_overlayPaintingQImage.size() != thisSize ) { - m_overlayPaintingQImage = QImage( this->size(), QImage::Format_ARGB32 ); + m_overlayPaintingQImage = QImage( thisSize, QImage::Format_ARGB32 ); } m_overlayPaintingQImage.fill( Qt::transparent ); @@ -798,16 +819,16 @@ void caf::Viewer::paintGL() // Convert the QImage into the cvf::TextureImage, // handling vertical mirroring and (possible) byteswapping - if ( ( (int)m_overlayTextureImage->height() ) != this->height() || - ( (int)m_overlayTextureImage->width() != this->width() ) ) + if ( ( (int)m_overlayTextureImage->height() ) != thisSize.height() || + ( (int)m_overlayTextureImage->width() != thisSize.width() ) ) { - m_overlayTextureImage->allocate( this->width(), this->height() ); + m_overlayTextureImage->allocate( thisSize.width(), thisSize.height() ); } cvfqt::Utils::toTextureImage( m_overlayPaintingQImage, m_overlayTextureImage.p() ); m_overlayImage->setImage( m_overlayTextureImage.p() ); - m_overlayImage->setPixelSize( cvf::Vec2ui( this->width(), this->height() ) ); + m_overlayImage->setPixelSize( cvf::Vec2ui( thisSize.width(), thisSize.height() ) ); } painter.beginNativePainting(); diff --git a/Fwk/AppFwk/cafViewer/cafViewer.h b/Fwk/AppFwk/cafViewer/cafViewer.h index 36d624f0d0..b2d0d190dc 100644 --- a/Fwk/AppFwk/cafViewer/cafViewer.h +++ b/Fwk/AppFwk/cafViewer/cafViewer.h @@ -181,6 +181,9 @@ public: void setCurrentComparisonFrame( int frameIndex ); void setComparisonViewToFollowAnimation( bool isToFollow ); + // display scaling ratio (should be 1 if DPI scaling is not enabled) + double displayScalingRatio() const; + public slots: virtual void slotSetCurrentFrame( int frameIndex ); virtual void slotEndAnimation(); From 9b6e441386d6488a78b32248fca693c950afc4c1 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 15 Nov 2024 12:37:22 +0100 Subject: [PATCH 121/160] Make it possible to exclude partial delta curves Make sure statistics curves are recomputed on flag change When toggling "Discard Missing or Incomplete Realizations", make sure the statistics is recomputed and the ensemble plots updated. --- .../Application/Tools/RiaCurveMerger.h | 2 +- .../Tools/Summary/RiaSummaryTools.cpp | 12 +++ .../Tools/Summary/RiaSummaryTools.h | 2 + .../RifReaderEnsembleStatisticsRft.cpp | 3 +- .../AnalysisPlots/RimAnalysisPlot.cpp | 3 +- .../RimSummaryCalculation.cpp | 3 +- .../Summary/RimDeltaSummaryCase.cpp | 73 ++++++++++++++++++- .../Summary/RimDeltaSummaryCase.h | 5 +- .../Summary/RimDeltaSummaryEnsemble.cpp | 23 +++--- .../Summary/RimDeltaSummaryEnsemble.h | 4 +- .../Summary/RimEnsembleCurveSet.cpp | 10 +++ .../Summary/RimEnsembleStatistics.cpp | 8 ++ .../Summary/RimEnsembleStatistics.h | 2 + .../Summary/RimEnsembleStatisticsCase.cpp | 10 +-- .../Summary/RimSummaryCaseMainCollection.cpp | 2 +- .../Summary/RimSummaryCurve.cpp | 8 +- .../Summary/RimSummaryEnsemble.cpp | 33 ++++++++- .../Summary/RimSummaryEnsemble.h | 3 + .../WellLog/RimEnsembleWellLogStatistics.cpp | 5 +- .../RigTimeCurveHistoryMerger-Test.cpp | 18 ++--- 20 files changed, 184 insertions(+), 45 deletions(-) diff --git a/ApplicationLibCode/Application/Tools/RiaCurveMerger.h b/ApplicationLibCode/Application/Tools/RiaCurveMerger.h index b8a98458c7..b6a4965f17 100644 --- a/ApplicationLibCode/Application/Tools/RiaCurveMerger.h +++ b/ApplicationLibCode/Application/Tools/RiaCurveMerger.h @@ -44,7 +44,7 @@ public: void addCurveData( const std::vector& xValues, const std::vector& yValues ); size_t curveCount() const; - void computeInterpolatedValues( bool includeValuesFromPartialCurves = true ); + void computeInterpolatedValues( bool includeValuesFromPartialCurves ); RiaCurveDataTools::CurveIntervals validIntervalsForAllXValues() const; const std::vector& allXValues() const; diff --git a/ApplicationLibCode/Application/Tools/Summary/RiaSummaryTools.cpp b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryTools.cpp index c37ef5914d..9c40bab613 100644 --- a/ApplicationLibCode/Application/Tools/Summary/RiaSummaryTools.cpp +++ b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryTools.cpp @@ -430,3 +430,15 @@ void RiaSummaryTools::reloadSummaryEnsemble( RimSummaryEnsemble* ensemble ) multiPlot->updatePlotTitles(); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +time_t RiaSummaryTools::calculateTimeThreshold( const time_t& minimum, const time_t& maximum ) +{ + // The cutoff time is the time where the time step is less than 1% of the total time range + const auto epsilon = 0.01; + const auto timeThreshold = maximum - ( maximum - minimum ) * epsilon; + + return timeThreshold; +} diff --git a/ApplicationLibCode/Application/Tools/Summary/RiaSummaryTools.h b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryTools.h index b97b8a52c0..e3f3e4a06b 100644 --- a/ApplicationLibCode/Application/Tools/Summary/RiaSummaryTools.h +++ b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryTools.h @@ -97,6 +97,8 @@ public: static void reloadSummaryCase( RimSummaryCase* summaryCase ); static void reloadSummaryEnsemble( RimSummaryEnsemble* ensemble ); + static time_t calculateTimeThreshold( const time_t& minimum, const time_t& maximum ); + private: static void updateRequiredCalculatedCurves( RimSummaryCase* sourceSummaryCase ); static bool isCalculationRequired( const RimUserDefinedCalculation* summaryCalculation, const RimSummaryCase* summaryCase ); diff --git a/ApplicationLibCode/FileInterface/RifReaderEnsembleStatisticsRft.cpp b/ApplicationLibCode/FileInterface/RifReaderEnsembleStatisticsRft.cpp index 379c3671c6..ca469ae43b 100644 --- a/ApplicationLibCode/FileInterface/RifReaderEnsembleStatisticsRft.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderEnsembleStatisticsRft.cpp @@ -294,7 +294,8 @@ void RifReaderEnsembleStatisticsRft::extractStatisticsFromCurveMerger( const QSt clearCache( wellName, timeStep ); - curveMerger.computeInterpolatedValues( false ); + bool includeValuesFromPartialCurves = false; + curveMerger.computeInterpolatedValues( includeValuesFromPartialCurves ); const std::vector& allDepths = curveMerger.allXValues(); if ( !allDepths.empty() ) diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp index d7ae8c1ed4..2362ac131d 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp @@ -1447,7 +1447,8 @@ void RimAnalysisPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBui referenceCaseReader, -1, DerivedSummaryOperator::DERIVED_OPERATOR_SUB, - curveDef.summaryAddressY() ); + curveDef.summaryAddressY(), + true ); timeSteps.swap( timeAndValues.first ); values.swap( timeAndValues.second ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp index ae35be37e4..4f8d485420 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp @@ -345,7 +345,8 @@ std::optional, std::vector>> } } - timeHistoryCurveMerger.computeInterpolatedValues(); + bool includeValuesFromPartialCurves = true; + timeHistoryCurveMerger.computeInterpolatedValues( includeValuesFromPartialCurves ); ExpressionParser parser; for ( size_t i = 0; i < variables.size(); i++ ) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryCase.cpp index c12178cb21..1c1d4584e6 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryCase.cpp @@ -21,6 +21,7 @@ #include "RiaCurveMerger.h" #include "RiaLogging.h" #include "RiaQDateTimeTools.h" +#include "Summary/RiaSummaryTools.h" #include "RimDeltaSummaryEnsemble.h" #include "RimProject.h" @@ -96,7 +97,7 @@ std::pair> RimDeltaSummaryCase::values( const RifEclip if ( auto deltaEnsemble = firstAncestorOfType() ) { - if ( deltaEnsemble->discardSummaryAddressOnlyPresentInOneCase() ) + if ( deltaEnsemble->discardMissingOrIncompleteRealizations() ) { RifSummaryReaderInterface* reader1 = m_summaryCase1 ? m_summaryCase1->summaryReader() : nullptr; RifSummaryReaderInterface* reader2 = m_summaryCase2 ? m_summaryCase2->summaryReader() : nullptr; @@ -125,6 +126,36 @@ std::pair> RimDeltaSummaryCase::values( const RifEclip return { false, {} }; } + if ( auto deltaEnsemble = firstAncestorOfType() ) + { + if ( deltaEnsemble->discardMissingOrIncompleteRealizations() ) + { + auto ensembleTimeSteps = deltaEnsemble->ensembleTimeSteps(); + + auto caseTimeSteps = m_dataCache.at( resultAddress ).first; + + if ( !ensembleTimeSteps.empty() && !caseTimeSteps.empty() ) + { + const auto minTime = *std::min_element( ensembleTimeSteps.begin(), ensembleTimeSteps.end() ); + const auto maxTime = *std::max_element( ensembleTimeSteps.begin(), ensembleTimeSteps.end() ); + + // The last time step for the individual realizations in an ensemble is usually identical. Add a small threshold to improve + // robustness. + const auto timeThreshold = RiaSummaryTools::calculateTimeThreshold( minTime, maxTime ); + + if ( *caseTimeSteps.rbegin() < timeThreshold ) + { + QString txt = "Summary vector " + QString::fromStdString( resultAddress.toEclipseTextAddress() ) + + " has different time steps in the source ensembles, no values are calculated for this vector."; + + RiaLogging::warning( txt ); + + return { false, {} }; + } + } + } + } + return { true, m_dataCache.at( resultAddress ).second }; } @@ -187,6 +218,8 @@ void RimDeltaSummaryCase::setSummaryCases( RimSummaryCase* sumCase1, RimSummaryC { m_summaryCase1 = sumCase1; m_summaryCase2 = sumCase2; + + clearCache(); } //-------------------------------------------------------------------------------------------------- @@ -218,8 +251,15 @@ void RimDeltaSummaryCase::calculate( const RifEclipseSummaryAddress& address ) c fixedTimeStepCase2 = m_fixedTimeStepIndex; } + bool includeIncompleteCurves = true; + if ( auto deltaEnsemble = firstAncestorOfType() ) + { + includeIncompleteCurves = !deltaEnsemble->discardMissingOrIncompleteRealizations(); + } + auto itAndIsInsertedPair = m_dataCache.insert( - std::make_pair( address, calculateDerivedValues( reader1, fixedTimeStepCase1, reader2, fixedTimeStepCase2, m_operator(), address ) ) ); + std::make_pair( address, + calculateDerivedValues( reader1, fixedTimeStepCase1, reader2, fixedTimeStepCase2, m_operator(), address, includeIncompleteCurves ) ) ); // Check if we got any data. If not, erase the map entry to comply with previous behavior @@ -237,7 +277,8 @@ std::pair, std::vector> RimDeltaSummaryCase::calcula RifSummaryReaderInterface* reader2, int fixedTimeStepCase2, DerivedSummaryOperator summaryOperator, - const RifEclipseSummaryAddress& address ) + const RifEclipseSummaryAddress& address, + bool includeIncompleteCurves ) { using ResultPair = std::pair, std::vector>; @@ -278,7 +319,7 @@ std::pair, std::vector> RimDeltaSummaryCase::calcula RiaTimeHistoryCurveMerger merger; merger.addCurveData( reader1->timeSteps( address ), values1 ); merger.addCurveData( reader2->timeSteps( address ), values2 ); - merger.computeInterpolatedValues(); + merger.computeInterpolatedValues( includeIncompleteCurves ); const std::vector& allValues1 = merger.interpolatedYValuesForAllXValues( 0 ); const std::vector& allValues2 = merger.interpolatedYValuesForAllXValues( 1 ); @@ -321,12 +362,20 @@ QString RimDeltaSummaryCase::caseName() const //-------------------------------------------------------------------------------------------------- void RimDeltaSummaryCase::createSummaryReaderInterface() { + m_allResultAddresses.clear(); + if ( m_summaryCase1 ) { if ( !m_summaryCase1->summaryReader() ) { m_summaryCase1->createSummaryReaderInterface(); } + + if ( m_summaryCase1->summaryReader() ) + { + auto adr = m_summaryCase1->summaryReader()->allResultAddresses(); + m_allResultAddresses.insert( adr.begin(), adr.end() ); + } } if ( m_summaryCase2 ) { @@ -334,6 +383,12 @@ void RimDeltaSummaryCase::createSummaryReaderInterface() { m_summaryCase2->createSummaryReaderInterface(); } + + if ( m_summaryCase2->summaryReader() ) + { + auto adr = m_summaryCase2->summaryReader()->allResultAddresses(); + m_allResultAddresses.insert( adr.begin(), adr.end() ); + } } } @@ -351,6 +406,8 @@ RifSummaryReaderInterface* RimDeltaSummaryCase::summaryReader() void RimDeltaSummaryCase::setOperator( DerivedSummaryOperator oper ) { m_operator = oper; + + clearCache(); } //-------------------------------------------------------------------------------------------------- @@ -380,6 +437,14 @@ void RimDeltaSummaryCase::clearData( const RifEclipseSummaryAddress& address ) c m_dataCache.erase( address ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimDeltaSummaryCase::clearCache() +{ + m_dataCache.clear(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryCase.h b/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryCase.h index 39b9152fe9..0709cafbce 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryCase.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryCase.h @@ -75,7 +75,8 @@ public: RifSummaryReaderInterface* reader2, int fixedTimeStepCase2, DerivedSummaryOperator m_operator, - const RifEclipseSummaryAddress& address ); + const RifEclipseSummaryAddress& address, + bool includeIncompleteCurves ); void createSummaryReaderInterface() override; RifSummaryReaderInterface* summaryReader() override; @@ -98,6 +99,8 @@ private: void calculate( const RifEclipseSummaryAddress& address ) const; void clearData( const RifEclipseSummaryAddress& address ) const; + void clearCache(); + private: caf::PdmPtrField m_summaryCase1; caf::PdmPtrField m_summaryCase2; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryEnsemble.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryEnsemble.cpp index dfb83d6108..3137395d92 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryEnsemble.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryEnsemble.cpp @@ -76,11 +76,11 @@ RimDeltaSummaryEnsemble::RimDeltaSummaryEnsemble() CAF_PDM_InitField( &m_matchOnParameters, "MatchOnParameters", false, "Match On Parameters" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_matchOnParameters ); - CAF_PDM_InitField( &m_discardAddressPresentInOneSourceCase, - "DiscardAddressPresentInOneSourceCase", - false, - "Discard Vectors if Missing in One of the Source Ensembles" ); - caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_discardAddressPresentInOneSourceCase ); + CAF_PDM_InitField( &m_discardMissingOrIncompleteRealizations, + "DiscardMissingOrIncompleteRealizations", + true, + "Discard Missing or Incomplete Realizations" ); + caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_discardMissingOrIncompleteRealizations ); CAF_PDM_InitFieldNoDefault( &m_useFixedTimeStep, "UseFixedTimeStep", "Use Fixed Time Step" ); CAF_PDM_InitField( &m_fixedTimeStepIndex, "FixedTimeStepIndex", 0, "Time Step" ); @@ -206,9 +206,9 @@ void RimDeltaSummaryEnsemble::createDerivedEnsembleCases() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RimDeltaSummaryEnsemble::discardSummaryAddressOnlyPresentInOneCase() const +bool RimDeltaSummaryEnsemble::discardMissingOrIncompleteRealizations() const { - return m_discardAddressPresentInOneSourceCase(); + return m_discardMissingOrIncompleteRealizations(); } //-------------------------------------------------------------------------------------------------- @@ -314,7 +314,7 @@ void RimDeltaSummaryEnsemble::defineUiOrdering( QString uiConfigName, caf::PdmUi } uiOrdering.add( &m_matchOnParameters ); - uiOrdering.add( &m_discardAddressPresentInOneSourceCase ); + uiOrdering.add( &m_discardMissingOrIncompleteRealizations ); uiOrdering.skipRemainingFields( true ); @@ -337,7 +337,8 @@ void RimDeltaSummaryEnsemble::fieldChangedByUi( const caf::PdmFieldHandle* chang doUpdateCases = true; doShowDialog = true; } - else if ( changedField == &m_operator || changedField == &m_useFixedTimeStep || changedField == &m_fixedTimeStepIndex ) + else if ( changedField == &m_operator || changedField == &m_useFixedTimeStep || changedField == &m_fixedTimeStepIndex || + changedField == &m_discardMissingOrIncompleteRealizations ) { doUpdate = true; doUpdateCases = true; @@ -370,12 +371,12 @@ void RimDeltaSummaryEnsemble::fieldChangedByUi( const caf::PdmFieldHandle* chang } } - updateReferringCurveSets(); + updateReferringCurveSetsZoomAll(); // If other derived ensembles are referring to this ensemble, update their cases as well for ( auto refering : findReferringEnsembles() ) { - refering->updateReferringCurveSets(); + refering->updateReferringCurveSetsZoomAll(); } } } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryEnsemble.h b/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryEnsemble.h index 20c1e92547..ca56819b75 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryEnsemble.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryEnsemble.h @@ -62,7 +62,7 @@ public: void createDerivedEnsembleCases(); - bool discardSummaryAddressOnlyPresentInOneCase() const; + bool discardMissingOrIncompleteRealizations() const; private: QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; @@ -93,7 +93,7 @@ private: caf::PdmField m_swapEnsemblesButton; caf::PdmField m_caseCount; caf::PdmField m_matchOnParameters; - caf::PdmField m_discardAddressPresentInOneSourceCase; + caf::PdmField m_discardMissingOrIncompleteRealizations; caf::PdmField> m_useFixedTimeStep; caf::PdmField m_fixedTimeStepIndex; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index ae9c5c659d..880da03297 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -341,6 +341,9 @@ void RimEnsembleCurveSet::loadDataAndUpdate( bool updateParentPlot ) { m_yValuesSummaryAddressUiField = m_yValuesSummaryAddress->address(); + // Recreate the statistics case, as the statistics data is cached internally + m_ensembleStatCaseY = std::make_unique(); + m_curveFilters->loadDataAndUpdate(); updateAddressesUiField(); @@ -1168,6 +1171,13 @@ void RimEnsembleCurveSet::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde m_statistics->defaultUiOrdering( isXAxisSummaryVector(), *statGroup ); + bool enableIncomplete = true; + if ( dynamic_cast( m_yValuesSummaryEnsemble() ) ) + { + enableIncomplete = false; + } + m_statistics->enableIncludeIncompleteCurves( enableIncomplete ); + caf::PdmUiGroup* statAppearance = statGroup->addNewGroupWithKeyword( "Appearance", "StatisticsAppearance" ); statAppearance->add( &m_statisticsUseCustomAppearance ); if ( m_statisticsUseCustomAppearance() == AppearanceMode::CUSTOM ) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatistics.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatistics.cpp index 82d3dd19c1..7269078402 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatistics.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatistics.cpp @@ -164,6 +164,14 @@ void RimEnsembleStatistics::enableCurveLabels( bool enable ) m_showCurveLabels = enable; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEnsembleStatistics::enableIncludeIncompleteCurves( bool enable ) +{ + m_includeIncompleteCurves.uiCapability()->setUiReadOnly( !enable ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatistics.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatistics.h index f51b797a2b..cb7d1c3a11 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatistics.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatistics.h @@ -48,6 +48,8 @@ public: bool showCurveLabels() const; void enableCurveLabels( bool enable ); + void enableIncludeIncompleteCurves( bool enable ); + cvf::Color3f color() const { return m_color; } void setColor( const cvf::Color3f& color ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp index ed7e53a7ad..241b9bc5e4 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp @@ -143,14 +143,14 @@ void RimEnsembleStatisticsCase::calculate( const std::vector& s // Use first summary case to get unit system and other meta data m_firstSummaryCase = summaryCases.front(); - const auto [minTime, maxTime] = findMinMaxTime( summaryCases, inputAddress ); - RiaDefines::DateTimePeriod period = findBestResamplingPeriod( minTime, maxTime ); + const auto [minTime, maxTime] = findMinMaxTime( summaryCases, inputAddress ); // The last time step for the individual realizations in an ensemble is usually identical. Add a small threshold to improve robustness. - const auto timeThreshold = maxTime - ( maxTime - minTime ) * 0.01; + const auto timeThreshold = RiaSummaryTools::calculateTimeThreshold( minTime, maxTime ); + + RiaDefines::DateTimePeriod period = findBestResamplingPeriod( minTime, maxTime ); RiaTimeHistoryCurveMerger curveMerger; - for ( const auto& sumCase : summaryCases ) { const auto& reader = sumCase->summaryReader(); @@ -169,7 +169,7 @@ void RimEnsembleStatisticsCase::calculate( const std::vector& s } } - curveMerger.computeInterpolatedValues(); + curveMerger.computeInterpolatedValues( includeIncompleteCurves ); std::vector> curveValues; for ( size_t i = 0; i < curveMerger.curveCount(); i++ ) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp index c4bc937460..983c31468d 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp @@ -201,7 +201,7 @@ void RimSummaryCaseMainCollection::removeCases( std::vector& ca for ( RimSummaryEnsemble* summaryCaseCollection : m_caseCollections ) { - summaryCaseCollection->updateReferringCurveSets(); + summaryCaseCollection->updateReferringCurveSetsZoomAll(); } dataSourceHasChanged.send(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index 4804a14052..aa26c11c4b 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -655,7 +655,9 @@ void RimSummaryCurve::onLoadDataAndUpdate( bool updateParentPlot ) RiaTimeHistoryCurveMerger curveMerger; curveMerger.addCurveData( curveTimeStepsX, curveValuesX ); curveMerger.addCurveData( curveTimeStepsY, curveValuesY ); - curveMerger.computeInterpolatedValues(); + + bool includeValuesFromPartialCurves = true; + curveMerger.computeInterpolatedValues( includeValuesFromPartialCurves ); if ( !curveMerger.allXValues().empty() ) { @@ -1285,7 +1287,9 @@ void RimSummaryCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, RiaTimeHistoryCurveMerger curveMerger; curveMerger.addCurveData( curveTimeStepsX, curveValuesX ); curveMerger.addCurveData( curveTimeStepsY, curveValuesY ); - curveMerger.computeInterpolatedValues(); + + bool includeValuesFromPartialCurves = true; + curveMerger.computeInterpolatedValues( includeValuesFromPartialCurves ); if ( curveMerger.validIntervalsForAllXValues().empty() ) { diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsemble.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsemble.cpp index 75132976a1..3d503c04df 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsemble.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsemble.cpp @@ -32,6 +32,7 @@ #include "RimSummaryAddressCollection.h" #include "RimSummaryCase.h" #include "RimSummaryEnsembleTools.h" +#include "RimSummaryPlot.h" #include "cafPdmFieldScriptingCapability.h" #include "cafPdmObjectScriptingCapability.h" @@ -103,7 +104,7 @@ void RimSummaryEnsemble::removeCase( RimSummaryCase* summaryCase, bool notifyCha if ( notifyChange ) { - updateReferringCurveSets(); + updateReferringCurveSetsZoomAll(); } if ( m_isEnsemble && m_cases.size() != caseCountBeforeRemove ) @@ -134,7 +135,7 @@ void RimSummaryEnsemble::addCase( RimSummaryCase* summaryCase ) if ( !derivedEnsemble ) continue; derivedEnsemble->createDerivedEnsembleCases(); - derivedEnsemble->updateReferringCurveSets(); + derivedEnsemble->updateReferringCurveSetsZoomAll(); } if ( m_isEnsemble ) @@ -143,7 +144,7 @@ void RimSummaryEnsemble::addCase( RimSummaryCase* summaryCase ) calculateEnsembleParametersIntersectionHash(); } - updateReferringCurveSets(); + updateReferringCurveSetsZoomAll(); clearChildNodes(); } @@ -616,7 +617,7 @@ void RimSummaryEnsemble::onLoadDataAndUpdate() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryEnsemble::updateReferringCurveSets() +void RimSummaryEnsemble::updateReferringCurveSets( bool doZoomAll ) { // Update curve set referring to this group std::vector referringObjects = objectsWithReferringPtrFieldsOfType(); @@ -629,10 +630,34 @@ void RimSummaryEnsemble::updateReferringCurveSets() if ( curveSet ) { curveSet->loadDataAndUpdate( updateParentPlot ); + + if ( doZoomAll ) + { + if ( auto parentPlot = curveSet->firstAncestorOrThisOfType() ) + { + parentPlot->zoomAll(); + } + } } } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryEnsemble::updateReferringCurveSets() +{ + updateReferringCurveSets( false ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryEnsemble::updateReferringCurveSetsZoomAll() +{ + updateReferringCurveSets( true ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsemble.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsemble.h index d2dbb334ea..8e87fe4869 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsemble.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsemble.h @@ -98,6 +98,7 @@ public: void onCalculationUpdated(); void updateReferringCurveSets(); + void updateReferringCurveSetsZoomAll(); RiaSummaryAddressAnalyzer* addressAnalyzer(); @@ -110,6 +111,8 @@ private: QString nameAndItemCount() const; void updateIcon(); + void updateReferringCurveSets( bool doZoomAll ); + void initAfterRead() override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogStatistics.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogStatistics.cpp index cbb9cd6367..b73bf44925 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogStatistics.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogStatistics.cpp @@ -125,8 +125,9 @@ void RimEnsembleWellLogStatistics::calculate( const std::vector( interpolate.curveCount() ) ); auto interpolatedTimeSteps = interpolate.allXValues(); @@ -154,7 +154,7 @@ TEST( RiaTimeHistoryCurveMergerTest, RobustUse ) { { RiaTimeHistoryCurveMerger curveMerger; - curveMerger.computeInterpolatedValues(); + curveMerger.computeInterpolatedValues( true ); EXPECT_EQ( 0, static_cast( curveMerger.allXValues().size() ) ); } @@ -167,7 +167,7 @@ TEST( RiaTimeHistoryCurveMergerTest, RobustUse ) { RiaTimeHistoryCurveMerger curveMerger; curveMerger.addCurveData( timeStepsA, valuesA ); - curveMerger.computeInterpolatedValues(); + curveMerger.computeInterpolatedValues( true ); EXPECT_EQ( timeStepsA.size(), curveMerger.allXValues().size() ); EXPECT_EQ( timeStepsA.size(), curveMerger.interpolatedYValuesForAllXValues( 0 ).size() ); } @@ -178,8 +178,8 @@ TEST( RiaTimeHistoryCurveMergerTest, RobustUse ) curveMerger.addCurveData( timeStepsB, valuesB ); // Execute interpolation twice is allowed - curveMerger.computeInterpolatedValues(); - curveMerger.computeInterpolatedValues(); + curveMerger.computeInterpolatedValues( true ); + curveMerger.computeInterpolatedValues( true ); EXPECT_EQ( 8, static_cast( curveMerger.allXValues().size() ) ); EXPECT_EQ( 8, static_cast( curveMerger.interpolatedYValuesForAllXValues( 0 ).size() ) ); EXPECT_EQ( 8, static_cast( curveMerger.interpolatedYValuesForAllXValues( 1 ).size() ) ); @@ -203,7 +203,7 @@ TEST( RiaTimeHistoryCurveMergerTest, NoTimeStepOverlap ) curveMerger.addCurveData( timeStepsB, valuesB ); // Execute interpolation twice is allowed - curveMerger.computeInterpolatedValues(); + curveMerger.computeInterpolatedValues( true ); EXPECT_EQ( 8, static_cast( curveMerger.allXValues().size() ) ); EXPECT_EQ( 0, static_cast( curveMerger.validIntervalsForAllXValues().size() ) ); } From a305464748396a8c9182822ae7749ccf07e74544 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 15 Nov 2024 13:43:45 +0100 Subject: [PATCH 122/160] Refactor: Split out triangle generation from contour map --- .../RimContourMapProjection.cpp | 371 ++---------------- .../RimContourMapProjection.h | 2 - .../ReservoirDataModel/CMakeLists_files.cmake | 2 + .../RigContourMapTrianglesGenerator.cpp | 354 +++++++++++++++++ .../RigContourMapTrianglesGenerator.h | 52 +++ 5 files changed, 442 insertions(+), 339 deletions(-) create mode 100644 ApplicationLibCode/ReservoirDataModel/RigContourMapTrianglesGenerator.cpp create mode 100644 ApplicationLibCode/ReservoirDataModel/RigContourMapTrianglesGenerator.h diff --git a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp index 39dd11ffc1..be5beff761 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp @@ -18,12 +18,10 @@ #include "RimContourMapProjection.h" -#include "RiaOpenMPTools.h" - -#include "RigCellGeometryTools.h" #include "RigContourMapCalculator.h" #include "RigContourMapGrid.h" #include "RigContourMapProjection.h" +#include "RigContourMapTrianglesGenerator.h" #include "RimCase.h" #include "RimGridView.h" @@ -31,19 +29,15 @@ #include "RimRegularLegendConfig.h" #include "RimTextAnnotation.h" -#include "cafContourLines.h" #include "cafPdmUiDoubleSliderEditor.h" #include "cafPdmUiTreeOrdering.h" #include "cafProgressInfo.h" #include "cvfArray.h" -#include "cvfGeometryUtils.h" #include "cvfScalarMapper.h" #include "cvfStructGridGeometryGenerator.h" #include "cvfVector2.h" -#include - namespace caf { template <> @@ -157,9 +151,39 @@ void RimContourMapProjection::generateGeometryIfNecessary() if ( geometryNeedsUpdating() ) { - generateContourPolygons(); - progress.setProgress( 25 ); - generateTrianglesWithVertexValues(); + std::vector contourLevels; + + bool discrete = false; + if ( legendConfig()->mappingMode() != RimRegularLegendConfig::MappingType::CATEGORY_INTEGER ) + { + legendConfig()->scalarMapper()->majorTickValues( &contourLevels ); + + if ( resultRangeIsValid() ) + { + std::tie( m_contourPolygons, m_contourLevelCumulativeAreas ) = + RigContourMapTrianglesGenerator::generateContourPolygons( *m_contourMapGrid, + *m_contourMapProjection, + contourLevels, + sampleSpacing(), + sampleSpacingFactor(), + m_smoothContourLines() ); + } + progress.setProgress( 25 ); + + if ( legendConfig()->mappingMode() == RimRegularLegendConfig::MappingType::LINEAR_DISCRETE || + legendConfig()->mappingMode() == RimRegularLegendConfig::MappingType::LOG10_DISCRETE ) + { + discrete = true; + } + } + + m_trianglesWithVertexValues = RigContourMapTrianglesGenerator::generateTrianglesWithVertexValues( *m_contourMapGrid, + *m_contourMapProjection, + m_contourPolygons, + contourLevels, + m_contourLevelCumulativeAreas, + discrete, + sampleSpacing() ); } progress.setProgress( 100 ); } @@ -507,333 +531,6 @@ void RimContourMapProjection::generateVertexResults() if ( m_contourMapProjection ) m_contourMapProjection->generateVertexResults(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimContourMapProjection::generateTrianglesWithVertexValues() -{ - std::vector vertices = m_contourMapGrid->generateVertices(); - - cvf::Vec2ui patchSize = numberOfVerticesIJ(); - cvf::ref faceList = new cvf::UIntArray; - cvf::GeometryUtils::tesselatePatchAsTriangles( patchSize.x(), patchSize.y(), 0u, true, faceList.p() ); - - bool discrete = false; - std::vector contourLevels; - if ( legendConfig()->mappingMode() != RimRegularLegendConfig::MappingType::CATEGORY_INTEGER ) - { - legendConfig()->scalarMapper()->majorTickValues( &contourLevels ); - if ( legendConfig()->mappingMode() == RimRegularLegendConfig::MappingType::LINEAR_DISCRETE || - legendConfig()->mappingMode() == RimRegularLegendConfig::MappingType::LOG10_DISCRETE ) - { - discrete = true; - } - } - - const double cellArea = sampleSpacing() * sampleSpacing(); - const double areaThreshold = 1.0e-5 * 0.5 * cellArea; - - std::vector>> subtractPolygons; - if ( !m_contourPolygons.empty() ) - { - subtractPolygons.resize( m_contourPolygons.size() ); - for ( size_t i = 0; i < m_contourPolygons.size() - 1; ++i ) - { - for ( size_t j = 0; j < m_contourPolygons[i + 1].size(); ++j ) - { - subtractPolygons[i].push_back( m_contourPolygons[i + 1][j].vertices ); - } - } - } - - int numberOfThreads = RiaOpenMPTools::availableThreadCount(); - - std::vector>> threadTriangles( numberOfThreads ); - - const std::vector& aggregatedVertexResults = m_contourMapProjection->aggregatedVertexResults(); - -#pragma omp parallel - { - int myThread = RiaOpenMPTools::currentThreadIndex(); - threadTriangles[myThread].resize( std::max( (size_t)1, m_contourPolygons.size() ) ); - -#pragma omp for schedule( dynamic ) - for ( int64_t i = 0; i < (int64_t)faceList->size(); i += 3 ) - { - std::vector triangle( 3 ); - std::vector triangleWithValues( 3 ); - bool anyValidVertex = false; - for ( size_t n = 0; n < 3; ++n ) - { - uint vn = ( *faceList )[i + n]; - double value = vn < aggregatedVertexResults.size() ? aggregatedVertexResults[vn] : std::numeric_limits::infinity(); - triangle[n] = vertices[vn]; - triangleWithValues[n] = cvf::Vec4d( vertices[vn], value ); - if ( value != std::numeric_limits::infinity() ) - { - anyValidVertex = true; - } - } - - if ( !anyValidVertex ) - { - continue; - } - - if ( m_contourPolygons.empty() ) - { - threadTriangles[myThread][0].insert( threadTriangles[myThread][0].end(), triangleWithValues.begin(), triangleWithValues.end() ); - continue; - } - - bool outsideOuterLimit = false; - for ( size_t c = 0; c < m_contourPolygons.size() && !outsideOuterLimit; ++c ) - { - std::vector> intersectPolygons; - for ( size_t j = 0; j < m_contourPolygons[c].size(); ++j ) - { - bool containsAtLeastOne = false; - for ( size_t t = 0; t < 3; ++t ) - { - if ( m_contourPolygons[c][j].bbox.contains( triangle[t] ) ) - { - containsAtLeastOne = true; - } - } - if ( containsAtLeastOne ) - { - std::vector> clippedPolygons = - RigCellGeometryTools::intersectionWithPolygon( triangle, m_contourPolygons[c][j].vertices ); - intersectPolygons.insert( intersectPolygons.end(), clippedPolygons.begin(), clippedPolygons.end() ); - } - } - - if ( intersectPolygons.empty() ) - { - outsideOuterLimit = true; - continue; - } - - std::vector> clippedPolygons; - - if ( !subtractPolygons[c].empty() ) - { - for ( const std::vector& polygon : intersectPolygons ) - { - std::vector> fullyClippedPolygons = - RigCellGeometryTools::subtractPolygons( polygon, subtractPolygons[c] ); - clippedPolygons.insert( clippedPolygons.end(), fullyClippedPolygons.begin(), fullyClippedPolygons.end() ); - } - } - else - { - clippedPolygons.swap( intersectPolygons ); - } - - { - std::vector clippedTriangles; - for ( std::vector& clippedPolygon : clippedPolygons ) - { - std::vector> polygonTriangles; - if ( clippedPolygon.size() == 3u ) - { - polygonTriangles.push_back( clippedPolygon ); - } - else - { - cvf::Vec3d baryCenter = cvf::Vec3d::ZERO; - for ( size_t v = 0; v < clippedPolygon.size(); ++v ) - { - cvf::Vec3d& clippedVertex = clippedPolygon[v]; - baryCenter += clippedVertex; - } - baryCenter /= clippedPolygon.size(); - for ( size_t v = 0; v < clippedPolygon.size(); ++v ) - { - std::vector clippedTriangle; - if ( v == clippedPolygon.size() - 1 ) - { - clippedTriangle = { clippedPolygon[v], clippedPolygon[0], baryCenter }; - } - else - { - clippedTriangle = { clippedPolygon[v], clippedPolygon[v + 1], baryCenter }; - } - polygonTriangles.push_back( clippedTriangle ); - } - } - for ( const std::vector& polygonTriangle : polygonTriangles ) - { - // Check triangle area - double area = - 0.5 * ( ( polygonTriangle[1] - polygonTriangle[0] ) ^ ( polygonTriangle[2] - polygonTriangle[0] ) ).length(); - if ( area < areaThreshold ) continue; - for ( const cvf::Vec3d& localVertex : polygonTriangle ) - { - double value = std::numeric_limits::infinity(); - if ( discrete ) - { - value = contourLevels[c] + 0.01 * ( contourLevels.back() - contourLevels.front() ) / contourLevels.size(); - } - else - { - for ( size_t n = 0; n < 3; ++n ) - { - if ( ( triangle[n] - localVertex ).length() < sampleSpacing() * 0.01 && - triangleWithValues[n].w() != std::numeric_limits::infinity() ) - { - value = triangleWithValues[n].w(); - break; - } - } - if ( value == std::numeric_limits::infinity() ) - { - value = m_contourMapProjection->interpolateValue( cvf::Vec2d( localVertex.x(), localVertex.y() ) ); - if ( value == std::numeric_limits::infinity() ) - { - value = contourLevels[c]; - } - } - } - - cvf::Vec4d globalVertex( localVertex, value ); - clippedTriangles.push_back( globalVertex ); - } - } - } - - { - // Add critical section here due to a weird bug when running in a single thread - // Running multi threaded does not require this critical section, as we use a thread local data - // structure -#pragma omp critical - threadTriangles[myThread][c].insert( threadTriangles[myThread][c].end(), - clippedTriangles.begin(), - clippedTriangles.end() ); - } - } - } - } - } - - std::vector> trianglesPerLevel( std::max( (size_t)1, m_contourPolygons.size() ) ); - for ( size_t c = 0; c < trianglesPerLevel.size(); ++c ) - { - std::vector allTrianglesThisLevel; - for ( size_t i = 0; i < threadTriangles.size(); ++i ) - { - allTrianglesThisLevel.insert( allTrianglesThisLevel.end(), threadTriangles[i][c].begin(), threadTriangles[i][c].end() ); - } - - double triangleAreasThisLevel = RigContourMapProjection::sumTriangleAreas( allTrianglesThisLevel ); - if ( c >= m_contourLevelCumulativeAreas.size() || triangleAreasThisLevel > 1.0e-3 * m_contourLevelCumulativeAreas[c] ) - { - trianglesPerLevel[c] = allTrianglesThisLevel; - } - } - - std::vector finalTriangles; - for ( size_t i = 0; i < trianglesPerLevel.size(); ++i ) - { - finalTriangles.insert( finalTriangles.end(), trianglesPerLevel[i].begin(), trianglesPerLevel[i].end() ); - } - - m_trianglesWithVertexValues = finalTriangles; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimContourMapProjection::generateContourPolygons() -{ - std::vector contourPolygons; - - std::vector contourLevels; - if ( resultRangeIsValid() && legendConfig()->mappingMode() != RimRegularLegendConfig::MappingType::CATEGORY_INTEGER ) - { - const std::vector& aggregatedVertexResults = m_contourMapProjection->aggregatedVertexResults(); - - legendConfig()->scalarMapper()->majorTickValues( &contourLevels ); - int nContourLevels = static_cast( contourLevels.size() ); - - if ( minValue() != std::numeric_limits::infinity() && maxValue() != -std::numeric_limits::infinity() && - std::fabs( maxValue() - minValue() ) > 1.0e-8 ) - { - if ( nContourLevels > 2 ) - { - const size_t N = contourLevels.size(); - // Adjust contour levels slightly to avoid weird visual artifacts due to numerical error. - double fudgeFactor = 1.0e-3; - double fudgeAmountMin = fudgeFactor * ( contourLevels[1] - contourLevels[0] ); - double fudgeAmountMax = fudgeFactor * ( contourLevels[N - 1u] - contourLevels[N - 2u] ); - - contourLevels.front() += fudgeAmountMin; - contourLevels.back() -= fudgeAmountMax; - - double simplifyEpsilon = m_smoothContourLines() ? 5.0e-2 * sampleSpacing() : 1.0e-3 * sampleSpacing(); - - if ( nContourLevels >= 10 ) - { - simplifyEpsilon *= 2.0; - } - if ( numberOfCells() > 100000 ) - { - simplifyEpsilon *= 2.0; - } - else if ( numberOfCells() > 1000000 ) - { - simplifyEpsilon *= 4.0; - } - - std::vector unorderedLineSegmentsPerLevel = - caf::ContourLines::create( aggregatedVertexResults, xVertexPositions(), yVertexPositions(), contourLevels ); - - contourPolygons = std::vector( unorderedLineSegmentsPerLevel.size() ); - const double areaThreshold = 1.5 * ( sampleSpacing() * sampleSpacing() ) / ( sampleSpacingFactor() * sampleSpacingFactor() ); - -#pragma omp parallel for - for ( int i = 0; i < (int)unorderedLineSegmentsPerLevel.size(); ++i ) - { - contourPolygons[i] = RigContourPolygonsTools::createContourPolygonsFromLineSegments( unorderedLineSegmentsPerLevel[i], - contourLevels[i], - areaThreshold ); - - if ( m_smoothContourLines() ) - { - RigContourPolygonsTools::smoothContourPolygons( contourPolygons[i], true, sampleSpacing() ); - } - - for ( RigContourPolygonsTools::ContourPolygon& polygon : contourPolygons[i] ) - { - RigCellGeometryTools::simplifyPolygon( &polygon.vertices, simplifyEpsilon ); - } - } - - // The clipping of contour polygons is intended to detect and fix a smoothed contour polygons - // crossing into an outer contour line. The current implementation has some side effects causing - // several contour lines to disappear. Disable this clipping for now - /* - if ( m_smoothContourLines() ) - { - for ( size_t i = 1; i < contourPolygons.size(); ++i ) - { - RigContourPolygonsTools::clipContourPolygons(&contourPolygons[i], &contourPolygons[i - 1] ); - } - } - */ - - m_contourLevelCumulativeAreas.resize( contourPolygons.size(), 0.0 ); - for ( int64_t i = (int64_t)contourPolygons.size() - 1; i >= 0; --i ) - { - double levelOuterArea = RigContourPolygonsTools::sumPolygonArea( contourPolygons[i] ); - m_contourLevelCumulativeAreas[i] = levelOuterArea; - } - } - } - } - m_contourPolygons = contourPolygons; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h index d6f2cfe27d..cea72b3ccb 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h +++ b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h @@ -132,8 +132,6 @@ protected: bool mapCellVisibilityNeedsUpdating( int timeStep ); void generateVertexResults(); - void generateTrianglesWithVertexValues(); - void generateContourPolygons(); double gridEdgeOffset() const; virtual void updateAfterResultGeneration( int timeStep ) = 0; diff --git a/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake b/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake index 1b775c4969..a8fe60820b 100644 --- a/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake +++ b/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake @@ -85,6 +85,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RigWeightedMeanCalc.h ${CMAKE_CURRENT_LIST_DIR}/RigContourMapCalculator.h ${CMAKE_CURRENT_LIST_DIR}/RigContourMapProjection.h + ${CMAKE_CURRENT_LIST_DIR}/RigContourMapTrianglesGenerator.h ${CMAKE_CURRENT_LIST_DIR}/RigEclipseContourMapProjection.h ${CMAKE_CURRENT_LIST_DIR}/RigGeoMechContourMapProjection.h ) @@ -174,6 +175,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RigContourPolygonsTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RigContourMapCalculator.cpp ${CMAKE_CURRENT_LIST_DIR}/RigContourMapProjection.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigContourMapTrianglesGenerator.cpp ${CMAKE_CURRENT_LIST_DIR}/RigEclipseContourMapProjection.cpp ${CMAKE_CURRENT_LIST_DIR}/RigGeoMechContourMapProjection.cpp ) diff --git a/ApplicationLibCode/ReservoirDataModel/RigContourMapTrianglesGenerator.cpp b/ApplicationLibCode/ReservoirDataModel/RigContourMapTrianglesGenerator.cpp new file mode 100644 index 0000000000..bf750d553b --- /dev/null +++ b/ApplicationLibCode/ReservoirDataModel/RigContourMapTrianglesGenerator.cpp @@ -0,0 +1,354 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "RigContourMapTrianglesGenerator.h" + +#include "RiaOpenMPTools.h" + +#include "RigCellGeometryTools.h" +#include "RigContourMapGrid.h" +#include "RigContourMapProjection.h" + +#include "cvfGeometryUtils.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector + RigContourMapTrianglesGenerator::generateTrianglesWithVertexValues( const RigContourMapGrid& contourMapGrid, + const RigContourMapProjection& contourMapProjection, + const std::vector& contourPolygons, + const std::vector& contourLevels, + const std::vector& contourLevelCumulativeAreas, + bool discrete, + double sampleSpacing ) +{ + std::vector vertices = contourMapGrid.generateVertices(); + + cvf::Vec2ui patchSize = contourMapGrid.numberOfVerticesIJ(); + cvf::ref faceList = new cvf::UIntArray; + cvf::GeometryUtils::tesselatePatchAsTriangles( patchSize.x(), patchSize.y(), 0u, true, faceList.p() ); + + const double cellArea = sampleSpacing * sampleSpacing; + const double areaThreshold = 1.0e-5 * 0.5 * cellArea; + + std::vector>> subtractPolygons; + if ( !contourPolygons.empty() ) + { + subtractPolygons.resize( contourPolygons.size() ); + for ( size_t i = 0; i < contourPolygons.size() - 1; ++i ) + { + for ( size_t j = 0; j < contourPolygons[i + 1].size(); ++j ) + { + subtractPolygons[i].push_back( contourPolygons[i + 1][j].vertices ); + } + } + } + + int numberOfThreads = RiaOpenMPTools::availableThreadCount(); + + std::vector>> threadTriangles( numberOfThreads ); + + const std::vector& aggregatedVertexResults = contourMapProjection.aggregatedVertexResults(); + +#pragma omp parallel + { + int myThread = RiaOpenMPTools::currentThreadIndex(); + threadTriangles[myThread].resize( std::max( (size_t)1, contourPolygons.size() ) ); + +#pragma omp for schedule( dynamic ) + for ( int64_t i = 0; i < (int64_t)faceList->size(); i += 3 ) + { + std::vector triangle( 3 ); + std::vector triangleWithValues( 3 ); + bool anyValidVertex = false; + for ( size_t n = 0; n < 3; ++n ) + { + uint vn = ( *faceList )[i + n]; + double value = vn < aggregatedVertexResults.size() ? aggregatedVertexResults[vn] : std::numeric_limits::infinity(); + triangle[n] = vertices[vn]; + triangleWithValues[n] = cvf::Vec4d( vertices[vn], value ); + if ( value != std::numeric_limits::infinity() ) + { + anyValidVertex = true; + } + } + + if ( !anyValidVertex ) + { + continue; + } + + if ( contourPolygons.empty() ) + { + threadTriangles[myThread][0].insert( threadTriangles[myThread][0].end(), triangleWithValues.begin(), triangleWithValues.end() ); + continue; + } + + bool outsideOuterLimit = false; + for ( size_t c = 0; c < contourPolygons.size() && !outsideOuterLimit; ++c ) + { + std::vector> intersectPolygons; + for ( size_t j = 0; j < contourPolygons[c].size(); ++j ) + { + bool containsAtLeastOne = false; + for ( size_t t = 0; t < 3; ++t ) + { + if ( contourPolygons[c][j].bbox.contains( triangle[t] ) ) + { + containsAtLeastOne = true; + } + } + if ( containsAtLeastOne ) + { + std::vector> clippedPolygons = + RigCellGeometryTools::intersectionWithPolygon( triangle, contourPolygons[c][j].vertices ); + intersectPolygons.insert( intersectPolygons.end(), clippedPolygons.begin(), clippedPolygons.end() ); + } + } + + if ( intersectPolygons.empty() ) + { + outsideOuterLimit = true; + continue; + } + + std::vector> clippedPolygons; + + if ( !subtractPolygons[c].empty() ) + { + for ( const std::vector& polygon : intersectPolygons ) + { + std::vector> fullyClippedPolygons = + RigCellGeometryTools::subtractPolygons( polygon, subtractPolygons[c] ); + clippedPolygons.insert( clippedPolygons.end(), fullyClippedPolygons.begin(), fullyClippedPolygons.end() ); + } + } + else + { + clippedPolygons.swap( intersectPolygons ); + } + + std::vector clippedTriangles; + for ( std::vector& clippedPolygon : clippedPolygons ) + { + std::vector> polygonTriangles; + if ( clippedPolygon.size() == 3u ) + { + polygonTriangles.push_back( clippedPolygon ); + } + else + { + cvf::Vec3d baryCenter = cvf::Vec3d::ZERO; + for ( size_t v = 0; v < clippedPolygon.size(); ++v ) + { + cvf::Vec3d& clippedVertex = clippedPolygon[v]; + baryCenter += clippedVertex; + } + baryCenter /= clippedPolygon.size(); + for ( size_t v = 0; v < clippedPolygon.size(); ++v ) + { + std::vector clippedTriangle; + if ( v == clippedPolygon.size() - 1 ) + { + clippedTriangle = { clippedPolygon[v], clippedPolygon[0], baryCenter }; + } + else + { + clippedTriangle = { clippedPolygon[v], clippedPolygon[v + 1], baryCenter }; + } + polygonTriangles.push_back( clippedTriangle ); + } + } + for ( const std::vector& polygonTriangle : polygonTriangles ) + { + // Check triangle area + double area = + 0.5 * ( ( polygonTriangle[1] - polygonTriangle[0] ) ^ ( polygonTriangle[2] - polygonTriangle[0] ) ).length(); + if ( area < areaThreshold ) continue; + for ( const cvf::Vec3d& localVertex : polygonTriangle ) + { + double value = std::numeric_limits::infinity(); + if ( discrete ) + { + value = contourLevels[c] + 0.01 * ( contourLevels.back() - contourLevels.front() ) / contourLevels.size(); + } + else + { + for ( size_t n = 0; n < 3; ++n ) + { + if ( ( triangle[n] - localVertex ).length() < sampleSpacing * 0.01 && + triangleWithValues[n].w() != std::numeric_limits::infinity() ) + { + value = triangleWithValues[n].w(); + break; + } + } + if ( value == std::numeric_limits::infinity() ) + { + value = contourMapProjection.interpolateValue( cvf::Vec2d( localVertex.x(), localVertex.y() ) ); + if ( value == std::numeric_limits::infinity() ) + { + value = contourLevels[c]; + } + } + } + + cvf::Vec4d globalVertex( localVertex, value ); + clippedTriangles.push_back( globalVertex ); + } + } + + { + // Add critical section here due to a weird bug when running in a single thread + // Running multi threaded does not require this critical section, as we use a thread local data + // structure +#pragma omp critical + threadTriangles[myThread][c].insert( threadTriangles[myThread][c].end(), + clippedTriangles.begin(), + clippedTriangles.end() ); + } + } + } + } + } + + std::vector> trianglesPerLevel( std::max( (size_t)1, contourPolygons.size() ) ); + for ( size_t c = 0; c < trianglesPerLevel.size(); ++c ) + { + std::vector allTrianglesThisLevel; + for ( size_t i = 0; i < threadTriangles.size(); ++i ) + { + allTrianglesThisLevel.insert( allTrianglesThisLevel.end(), threadTriangles[i][c].begin(), threadTriangles[i][c].end() ); + } + + double triangleAreasThisLevel = RigContourMapProjection::sumTriangleAreas( allTrianglesThisLevel ); + if ( c >= contourLevelCumulativeAreas.size() || triangleAreasThisLevel > 1.0e-3 * contourLevelCumulativeAreas[c] ) + { + trianglesPerLevel[c] = allTrianglesThisLevel; + } + } + + std::vector finalTriangles; + for ( size_t i = 0; i < trianglesPerLevel.size(); ++i ) + { + finalTriangles.insert( finalTriangles.end(), trianglesPerLevel[i].begin(), trianglesPerLevel[i].end() ); + } + + return finalTriangles; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::pair, std::vector> + RigContourMapTrianglesGenerator::generateContourPolygons( const RigContourMapGrid& contourMapGrid, + const RigContourMapProjection& contourMapProjection, + const std::vector& initialContourLevels, + double sampleSpacing, + double sampleSpacingFactor, + bool smoothContourLines ) +{ + if ( contourMapProjection.minValue() != std::numeric_limits::infinity() && + contourMapProjection.maxValue() != -std::numeric_limits::infinity() && + std::fabs( contourMapProjection.maxValue() - contourMapProjection.minValue() ) > 1.0e-8 ) + { + std::vector contourLevels = initialContourLevels; + + int nContourLevels = static_cast( contourLevels.size() ); + if ( nContourLevels > 2 ) + { + const size_t N = contourLevels.size(); + // Adjust contour levels slightly to avoid weird visual artifacts due to numerical error. + double fudgeFactor = 1.0e-3; + double fudgeAmountMin = fudgeFactor * ( contourLevels[1] - contourLevels[0] ); + double fudgeAmountMax = fudgeFactor * ( contourLevels[N - 1u] - contourLevels[N - 2u] ); + + contourLevels.front() += fudgeAmountMin; + contourLevels.back() -= fudgeAmountMax; + + double simplifyEpsilon = smoothContourLines ? 5.0e-2 * sampleSpacing : 1.0e-3 * sampleSpacing; + + if ( nContourLevels >= 10 ) + { + simplifyEpsilon *= 2.0; + } + if ( contourMapGrid.numberOfCells() > 100000 ) + { + simplifyEpsilon *= 2.0; + } + else if ( contourMapGrid.numberOfCells() > 1000000 ) + { + simplifyEpsilon *= 4.0; + } + + const std::vector& aggregatedVertexResults = contourMapProjection.aggregatedVertexResults(); + + std::vector unorderedLineSegmentsPerLevel = + caf::ContourLines::create( aggregatedVertexResults, + contourMapProjection.xVertexPositions(), + contourMapProjection.yVertexPositions(), + contourLevels ); + + std::vector contourPolygons = std::vector( unorderedLineSegmentsPerLevel.size() ); + const double areaThreshold = 1.5 * ( sampleSpacing * sampleSpacing ) / ( sampleSpacingFactor * sampleSpacingFactor ); + +#pragma omp parallel for + for ( int i = 0; i < (int)unorderedLineSegmentsPerLevel.size(); ++i ) + { + contourPolygons[i] = RigContourPolygonsTools::createContourPolygonsFromLineSegments( unorderedLineSegmentsPerLevel[i], + contourLevels[i], + areaThreshold ); + + if ( smoothContourLines ) + { + RigContourPolygonsTools::smoothContourPolygons( contourPolygons[i], true, sampleSpacing ); + } + + for ( RigContourPolygonsTools::ContourPolygon& polygon : contourPolygons[i] ) + { + RigCellGeometryTools::simplifyPolygon( &polygon.vertices, simplifyEpsilon ); + } + } + + // The clipping of contour polygons is intended to detect and fix a smoothed contour polygons + // crossing into an outer contour line. The current implementation has some side effects causing + // several contour lines to disappear. Disable this clipping for now + /* + if ( m_smoothContourLines() ) + { + for ( size_t i = 1; i < contourPolygons.size(); ++i ) + { + RigContourPolygonsTools::clipContourPolygons(&contourPolygons[i], &contourPolygons[i - 1] ); + } + } + */ + + std::vector contourLevelCumulativeAreas( contourPolygons.size(), 0.0 ); + for ( int64_t i = (int64_t)contourPolygons.size() - 1; i >= 0; --i ) + { + double levelOuterArea = RigContourPolygonsTools::sumPolygonArea( contourPolygons[i] ); + contourLevelCumulativeAreas[i] = levelOuterArea; + } + + return { contourPolygons, contourLevelCumulativeAreas }; + } + } + + return {}; +} diff --git a/ApplicationLibCode/ReservoirDataModel/RigContourMapTrianglesGenerator.h b/ApplicationLibCode/ReservoirDataModel/RigContourMapTrianglesGenerator.h new file mode 100644 index 0000000000..3cf6e511e4 --- /dev/null +++ b/ApplicationLibCode/ReservoirDataModel/RigContourMapTrianglesGenerator.h @@ -0,0 +1,52 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 + +#include "RigContourPolygonsTools.h" + +class RigContourMapGrid; +class RigContourMapProjection; + +//================================================================================================== +/// +/// +//================================================================================================== +class RigContourMapTrianglesGenerator +{ +public: + using ContourPolygons = std::vector; + + static std::vector generateTrianglesWithVertexValues( const RigContourMapGrid& contourMapGrid, + const RigContourMapProjection& contourMapProjection, + const std::vector& contourPolygons, + const std::vector& contourLevels, + const std::vector& contourLevelCumulativeAreas, + bool discrete, + double sampleSpacing ); + + static std::pair, std::vector> + generateContourPolygons( const RigContourMapGrid& contourMapGrid, + const RigContourMapProjection& contourMapProjection, + const std::vector& initialContourLevels, + double sampleSpacing, + double sampleSpacingFactor, + bool smoothContourLines ); +}; From e0878fb691856e64aa187f03c5384a738d4c1039 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 18 Nov 2024 15:59:11 +0100 Subject: [PATCH 123/160] Remove obsolete files --- debian/changelog | 5 - debian/compat | 1 - debian/control | 38 --- debian/copyright | 13 - debian/docs | 1 - debian/octave-resinsight.install | 1 - debian/patches/01_use_system_ert.patch | 278 ------------------ debian/patches/02_install_docdir.patch | 24 -- .../03_remove_internal_header_include.patch | 24 -- debian/patches/04_ert_api_changes.patch | 39 --- debian/patches/series | 4 - debian/resinsight.install | 2 - debian/rules | 23 -- debian/source/format | 1 - redhat/01_use_system_ert.patch | 278 ------------------ redhat/02_install_docdir.patch | 24 -- .../03_remove_internal_header_include.patch | 24 -- redhat/04_ert_api_changes.patch | 39 --- redhat/resinsight.spec | 62 ---- 19 files changed, 881 deletions(-) delete mode 100644 debian/changelog delete mode 100644 debian/compat delete mode 100644 debian/control delete mode 100644 debian/copyright delete mode 100644 debian/docs delete mode 100644 debian/octave-resinsight.install delete mode 100644 debian/patches/01_use_system_ert.patch delete mode 100644 debian/patches/02_install_docdir.patch delete mode 100644 debian/patches/03_remove_internal_header_include.patch delete mode 100644 debian/patches/04_ert_api_changes.patch delete mode 100644 debian/patches/series delete mode 100644 debian/resinsight.install delete mode 100644 debian/rules delete mode 100644 debian/source/format delete mode 100644 redhat/01_use_system_ert.patch delete mode 100644 redhat/02_install_docdir.patch delete mode 100644 redhat/03_remove_internal_header_include.patch delete mode 100644 redhat/04_ert_api_changes.patch delete mode 100644 redhat/resinsight.spec diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index 4cccec26ee..0000000000 --- a/debian/changelog +++ /dev/null @@ -1,5 +0,0 @@ -resinsight (0.9.2-1) precise; urgency=low - - * Initial release - - -- Arne Morten Kvarving Tue, 15 Jan 2013 18:22:16 +0100 diff --git a/debian/compat b/debian/compat deleted file mode 100644 index 45a4fb75db..0000000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/debian/control b/debian/control deleted file mode 100644 index e20e82e8d5..0000000000 --- a/debian/control +++ /dev/null @@ -1,38 +0,0 @@ -Source: resinsight -Section: science -Priority: extra -Maintainer: Arne Morten Kvarving -Build-Depends: debhelper (>= 8.0.0), cmake, octave-headers, qt4-dev-tools, - libqt4-dev, libqt4-opengl-dev, libert.ecl-dev -Standards-Version: 3.9.2 -Homepage: http://opm-project.org -Vcs-Git: git://github.com/akva2/ResInsight.git -Vcs-Browser: https://github.com/akva2/ResInsight - -Package: resinsight -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: ResInsight - the 3D reservoir viewer and post processor - ResInsight is a 3D viewer and post processing tool for reservoir models. - It has been co-developed by Statoil and Ceetron with the aim to provide - a versatile tool for professionals who need to visualize and process - reservoir models. - -Package: resinsight-dbg -Architecture: any -Section: debug -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: ResInsight - the 3D reservoir viewer and post processor -- debug symbols - ResInsight is a 3D viewer and post processing tool for reservoir models. - It has been co-developed by Statoil and Ceetron with the aim to provide - a versatile tool for professionals who need to visualize and process - reservoir models. - -Package: octave-resinsight -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: ResInsight - the 3D reservoir viewer and post processor - octave support - ResInsight is a 3D viewer and post processing tool for reservoir models. - It has been co-developed by Statoil and Ceetron with the aim to provide - a versatile tool for professionals who need to visualize and process - reservoir models. diff --git a/debian/copyright b/debian/copyright deleted file mode 100644 index 00e820065d..0000000000 --- a/debian/copyright +++ /dev/null @@ -1,13 +0,0 @@ -License: GPL-3+ - This package 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. - - This package 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 for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see diff --git a/debian/docs b/debian/docs deleted file mode 100644 index e845566c06..0000000000 --- a/debian/docs +++ /dev/null @@ -1 +0,0 @@ -README diff --git a/debian/octave-resinsight.install b/debian/octave-resinsight.install deleted file mode 100644 index f1d0181f52..0000000000 --- a/debian/octave-resinsight.install +++ /dev/null @@ -1 +0,0 @@ -usr/lib/* diff --git a/debian/patches/01_use_system_ert.patch b/debian/patches/01_use_system_ert.patch deleted file mode 100644 index 97ee35712f..0000000000 --- a/debian/patches/01_use_system_ert.patch +++ /dev/null @@ -1,278 +0,0 @@ -commit 8f1291094f04563cefc93085b9b61c2bf3d914b8 -Author: Arne Morten Kvarving -Date: Tue Apr 9 17:10:58 2013 +0200 - - Use system ERT - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index e09c591..349ecf5 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -4,6 +4,8 @@ project (ResInsight) - - set (VIZ_MODULES_FOLDER_NAME VisualizationModules) - -+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} -+ ${CMAKE_SOURCE_DIR}/cmake/Modules) - - # Setup the main platform defines - #----------------------------------------------------- -@@ -37,22 +39,28 @@ include (ResInsightVersion.cmake) - ################################################################################ - # ERT - ################################################################################ --add_subdirectory(ThirdParty/Ert/devel) -- --include_directories( -- ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libecl/include/ert/ecl -- ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libert_util/include/ert/util -- ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libgeometry/include/ert/geometry -- ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well -- ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libecl/include -- ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libert_util/include -- ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libgeometry/include -- ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libecl_well/include -- -- ${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/libert_util/include/ert/util -- ${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/libert_util/include --) -- -+find_package(ERT) -+IF(ERT_FOUND) -+ include_directories(${ERT_INCLUDE_DIR}/ert/ecl -+ ${ERT_INCLUDE_DIR}/ert/geometry -+ ${ERT_INCLUDE_DIR}/ert/ecl_well -+ ${ERT_INCLUDE_DIR}/ert/util) -+else(ERT_FOUND) -+ add_subdirectory(ThirdParty/Ert/devel) -+ include_directories( -+ ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libecl/include/ert/ecl -+ ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libert_util/include/ert/util -+ ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libgeometry/include/ert/geometry -+ ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well -+ ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libecl/include -+ ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libert_util/include -+ ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libgeometry/include -+ ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libecl_well/include -+ -+ ${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/libert_util/include/ert/util -+ ${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/libert_util/include -+ ) -+endif(ERT_FOUND) - - ################################################################################ - # Qt -diff --git a/cmake/Modules/FindERT.cmake b/cmake/Modules/FindERT.cmake -new file mode 100644 -index 0000000..8067421 ---- /dev/null -+++ b/cmake/Modules/FindERT.cmake -@@ -0,0 +1,208 @@ -+# - Find the Ensemble-based Reservoir Tool (ERT) -+# -+# Set the cache variable ERT_ROOT to the install location of the ERT -+# libraries and header files. -+# -+# If found, it sets these variables: -+# -+# ERT_INCLUDE_DIRS Header file directories -+# ERT_LIBRARIES Archives and shared objects -+# ERT_CONFIG_VARS Definitions that goes in config.h -+# ERT_LINKER_FLAGS Options that must be passed to linker -+# -+# It will also add to CMAKE_C_FLAGS and CMAKE_CXX_FLAGS if necessary to -+# link with the ERT libraries. -+ -+# variables to pass on to other packages -+if (FIND_QUIETLY) -+ set (ERT_QUIET "QUIET") -+else (FIND_QUIETLY) -+ set (ERT_QUIET "") -+endif (FIND_QUIETLY) -+ -+# if a directory has been specified by the user, then don't go look -+# in the system directories as well -+if (ERT_ROOT) -+ set (_no_default_path "NO_DEFAULT_PATH") -+else (ERT_ROOT) -+ set (_no_default_path "") -+endif (ERT_ROOT) -+ -+# ERT doesn't have any config-mode file, so we need to specify the root -+# directory in its own variable -+find_path (ERT_ECL_INCLUDE_DIR -+ NAMES "ert/ecl/ecl_util.h" -+ HINTS "${ERT_ROOT}" -+ PATHS "../ert" -+ PATH_SUFFIXES "devel/libecl/include/" "include" -+ DOC "Path to ERT Eclipse library header files" -+ ${_no_default_path} -+ ) -+find_path (ERT_UTIL_INCLUDE_DIR -+ NAMES "ert/util/stringlist.h" -+ HINTS "${ERT_ROOT}" -+ PATHS "../ert" -+ PATH_SUFFIXES "devel/libert_util/include/" "include" -+ DOC "Path to ERT Eclipse library header files" -+ ${_no_default_path} -+ ) -+find_path (ERT_GEN_INCLUDE_DIR -+ NAMES "ert/util/int_vector.h" -+ HINTS "${ERT_ROOT}" -+ PATHS "${PROJECT_BINARY_DIR}/../ert" "${PROJECT_BINARY_DIR}/../ert-build" -+ "${PROJECT_BINARY_DIR}/../ert/devel" -+ PATH_SUFFIXES "libert_util/include/" "include" -+ DOC "Path to ERT generated library header files" -+ ${_no_default_path} -+ ) -+ -+# need all of these libraries -+if (CMAKE_SIZEOF_VOID_P) -+ math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}") -+endif (CMAKE_SIZEOF_VOID_P) -+find_library (ERT_LIBRARY_ECL -+ NAMES "ecl" -+ HINTS "${ERT_ROOT}" -+ PATHS "${PROJECT_BINARY_DIR}/../ert" "${PROJECT_BINARY_DIR}/../ert-build" -+ "${PROJECT_BINARY_DIR}/../ert/devel" -+ PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" -+ DOC "Path to ERT Eclipse library archive/shared object files" -+ ${_no_default_path} -+ ) -+find_library (ERT_LIBRARY_GEOMETRY -+ NAMES "ert_geometry" -+ HINTS "${ERT_ROOT}" -+ PATHS "${PROJECT_BINARY_DIR}/../ert" "${PROJECT_BINARY_DIR}/../ert-build" -+ "${PROJECT_BINARY_DIR}/../ert/devel" -+ PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" -+ DOC "Path to ERT Geometry library archive/shared object files" -+ ${_no_default_path} -+ ) -+find_library (ERT_LIBRARY_UTIL -+ NAMES "ert_util" -+ HINTS "${ERT_ROOT}" -+ PATHS "${PROJECT_BINARY_DIR}/../ert" "${PROJECT_BINARY_DIR}/../ert-build" -+ "${PROJECT_BINARY_DIR}/../ert/devel" -+ PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" -+ DOC "Path to ERT Utilities library archive/shared object files" -+ ${_no_default_path} -+ ) -+# the "library" found here is actually a list of several files -+list (APPEND ERT_INCLUDE_DIR -+ ${ERT_ECL_INCLUDE_DIR} -+ ${ERT_UTIL_INCLUDE_DIR} -+ ${ERT_GEN_INCLUDE_DIR} -+ ) -+list (APPEND ERT_LIBRARY -+ ${ERT_LIBRARY_ECL} -+ ${ERT_LIBRARY_GEOMETRY} -+ ${ERT_LIBRARY_UTIL} -+ ) -+list (APPEND ERT_LIBRARIES ${ERT_LIBRARY}) -+list (APPEND ERT_INCLUDE_DIRS ${ERT_INCLUDE_DIR}) -+ -+# if we didn't find any files, then don't proceed through the entire dependency list -+include (FindPackageHandleStandardArgs) -+if (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND") -+ find_package_handle_standard_args (ERT -+ DEFAULT_MSG -+ ERT_INCLUDE_DIR ERT_LIBRARY -+ ) -+ # write unsuccessful result to the cache, as the check_c_source_compiles -+ # would do if it failed -+ set (HAVE_ERT) -+ set (HAVE_ERT "${HAVE_ERT}" CACHE INTERNAL "Did an ERT sample program compile?") -+ return () -+endif (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND") -+ -+# these system variables are probed for, and used in HEADER files (sic) -+list (APPEND ERT_CONFIG_VARS -+ HAVE_ISFINITE -+ HAVE_GLOB -+ HAVE_FORK -+ HAVE_GETUID -+ HAVE_LOCKF -+ HAVE_OPENDIR -+ HAVE_PROC -+ HAVE_READLINKAT -+ HAVE_SYMLINK -+ HAVE_VA_COPY -+ ) -+include (CheckSymbolExists) -+include (CheckFunctionExists) -+check_symbol_exists (isfinite math.h HAVE_ISFINITE) -+check_function_exists (glob HAVE_GLOB) -+check_function_exists (fork HAVE_FORK) -+check_function_exists (getuid HAVE_GETUID) -+check_function_exists (lockf HAVE_LOCKF) -+check_function_exists (opendir HAVE_OPENDIR) -+check_function_exists (readlinkat HAVE_READLINKAT) -+check_function_exists (symlink HAVE_SYMLINK) -+check_symbol_exists (va_copy stdarg.h HAVE_VA_COPY) -+ -+if (UNIX) -+ set (HAVE_PROC 1) -+else (UNIX) -+ set (HAVE_PROC) -+endif (UNIX) -+ -+# dependencies -+ -+# compression library -+find_package (ZLIB ${ERT_QUIET}) -+if (ZLIB_FOUND) -+ list (APPEND ERT_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}) -+ list (APPEND ERT_LIBRARIES ${ZLIB_LIBRARIES}) -+endif (ZLIB_FOUND) -+ -+# numerics -+find_package (BLAS ${ERT_QUIET}) -+if (BLAS_FOUND) -+ list (APPEND ERT_INCLUDE_DIRS ${BLAS_INCLUDE_DIRS}) -+ list (APPEND ERT_LIBRARIES ${BLAS_LIBRARIES}) -+ list (APPEND ERT_LINKER_FLAGS ${BLAS_LINKER_FLAGS}) -+endif (BLAS_FOUND) -+find_package (LAPACK ${ERT_QUIET}) -+if (LAPACK_FOUND) -+ list (APPEND ERT_INCLUDE_DIRS ${LAPACK_INCLUDE_DIRS}) -+ list (APPEND ERT_LIBRARIES ${LAPACK_LIBRARIES}) -+ list (APPEND ERT_LINKER_FLAGS ${LAPACK_LINKER_FLAGS}) -+endif (LAPACK_FOUND) -+ -+# math library (should exist on all unices; automatically linked on Windows) -+if (UNIX) -+ find_library (MATH_LIBRARY -+ NAMES "m" -+ ) -+ list (APPEND ERT_LIBRARIES ${MATH_LIBRARY}) -+endif (UNIX) -+ -+# see if we can compile a minimum example -+# CMake logical test doesn't handle lists (sic) -+if (NOT (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND")) -+ include (CMakePushCheckState) -+ include (CheckCSourceCompiles) -+ cmake_push_check_state () -+ set (CMAKE_REQUIRED_INCLUDES ${ERT_INCLUDE_DIR}) -+ set (CMAKE_REQUIRED_LIBRARIES ${ERT_LIBRARIES}) -+ check_c_source_compiles ( -+ "#include -+int main (void) { -+ int sz; -+ sz = ecl_util_get_sizeof_ctype (ECL_INT_TYPE); -+ return 0; -+}" HAVE_ERT) -+ cmake_pop_check_state () -+else (NOT (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND")) -+ # write unsuccessful result to the cache, as the check_c_source_compiles -+ # would do if it failed -+ set (HAVE_ERT) -+ set (HAVE_ERT "${HAVE_ERT}" CACHE INTERNAL "Did an ERT sample program compile?") -+endif (NOT (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND")) -+ -+# if the test program didn't compile, but was required to do so, bail -+# out now and display an error; otherwise limp on -+find_package_handle_standard_args (ERT -+ DEFAULT_MSG -+ ERT_INCLUDE_DIR ERT_LIBRARY HAVE_ERT -+ ) diff --git a/debian/patches/02_install_docdir.patch b/debian/patches/02_install_docdir.patch deleted file mode 100644 index e1d98a43ef..0000000000 --- a/debian/patches/02_install_docdir.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/ApplicationCode/CMakeLists.txt b/ApplicationCode/CMakeLists.txt -index 7995ceb..4930b98 100644 ---- a/ApplicationCode/CMakeLists.txt -+++ b/ApplicationCode/CMakeLists.txt -@@ -8,6 +8,10 @@ CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/ApplicationCode/Adm/RIVersionInfo.h.cmake - ${CMAKE_BINARY_DIR}/Generated/RIVersionInfo.h - ) - -+if(NOT CMAKE_INSTALL_DOCDIR) -+ set(CMAKE_INSTALL_DOCDIR share/doc/resinsight) -+endif(NOT CMAKE_INSTALL_DOCDIR) -+ - - include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} -@@ -313,7 +317,7 @@ else (RESINSIGHT_PRIVATE_INSTALL) - ) - # license go in /usr/share/doc - install (FILES ${RESINSIGHT_LICENSE_FILES} -- DESTINATION share/doc/ResInsight -+ DESTINATION ${CMAKE_INSTALL_DOCDIR} - ) - # no bundled libraries for system install - # application icon diff --git a/debian/patches/03_remove_internal_header_include.patch b/debian/patches/03_remove_internal_header_include.patch deleted file mode 100644 index a72e206495..0000000000 --- a/debian/patches/03_remove_internal_header_include.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/ApplicationCode/FileInterface/FileInterface_UnitTests/Ert-Test.cpp b/ApplicationCode/FileInterface/FileInterface_UnitTests/Ert-Test.cpp -index 7a2aef0..c552574 100644 ---- a/ApplicationCode/FileInterface/FileInterface_UnitTests/Ert-Test.cpp -+++ b/ApplicationCode/FileInterface/FileInterface_UnitTests/Ert-Test.cpp -@@ -23,7 +23,6 @@ - - #include - #include --#include - #include - #include - #include -diff --git a/ApplicationCode/FileInterface/RifEclipseOutputFileTools.cpp b/ApplicationCode/FileInterface/RifEclipseOutputFileTools.cpp -index 2c77fd6..b6eeba7 100644 ---- a/ApplicationCode/FileInterface/RifEclipseOutputFileTools.cpp -+++ b/ApplicationCode/FileInterface/RifEclipseOutputFileTools.cpp -@@ -20,7 +20,6 @@ - - #include "util.h" - #include "ecl_file.h" --#include "ecl_intehead.h" - #include "ecl_kw_magic.h" - - #include diff --git a/debian/patches/04_ert_api_changes.patch b/debian/patches/04_ert_api_changes.patch deleted file mode 100644 index 2c24d7f185..0000000000 --- a/debian/patches/04_ert_api_changes.patch +++ /dev/null @@ -1,39 +0,0 @@ -diff --git a/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp b/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp -index 40b3e7a..27bb973 100644 ---- a/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp -+++ b/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp -@@ -53,7 +53,7 @@ bool RifEclipseRestartFilesetAccess::open(const QStringList& fileSet) - { - progInfo.setProgressDescription(fileSet[i]); - -- ecl_file_type* ecl_file = ecl_file_open(fileSet[i].toAscii().data()); -+ ecl_file_type* ecl_file = ecl_file_open(fileSet[i].toAscii().data(), 0); - if (!ecl_file) return false; - - m_ecl_files.push_back(ecl_file); -diff --git a/ApplicationCode/FileInterface/RifEclipseUnifiedRestartFileAccess.cpp b/ApplicationCode/FileInterface/RifEclipseUnifiedRestartFileAccess.cpp -index 8fecb28..73be912 100644 ---- a/ApplicationCode/FileInterface/RifEclipseUnifiedRestartFileAccess.cpp -+++ b/ApplicationCode/FileInterface/RifEclipseUnifiedRestartFileAccess.cpp -@@ -53,7 +53,7 @@ bool RifEclipseUnifiedRestartFileAccess::open(const QStringList& fileSet) - { - QString fileName = fileSet[0]; - -- m_ecl_file = ecl_file_open(fileName.toAscii().data()); -+ m_ecl_file = ecl_file_open(fileName.toAscii().data(), 0); - if (!m_ecl_file) return false; - - return true; -diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp -index bd2ec9b..e9d0afe 100644 ---- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp -+++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp -@@ -439,7 +439,7 @@ bool RifReaderEclipseOutput::buildMetaData(RigReservoir* reservoir) - QString initFileName = RifEclipseOutputFileTools::fileNameByType(m_fileSet, ECL_INIT_FILE); - if (initFileName.size() > 0) - { -- ecl_file_type* ecl_file = ecl_file_open(initFileName.toAscii().data()); -+ ecl_file_type* ecl_file = ecl_file_open(initFileName.toAscii().data(), 0); - if (!ecl_file) return false; - - progInfo.incrementProgress(); diff --git a/debian/patches/series b/debian/patches/series deleted file mode 100644 index 50d86eec62..0000000000 --- a/debian/patches/series +++ /dev/null @@ -1,4 +0,0 @@ -01_use_system_ert.patch -02_install_docdir.patch -03_remove_internal_header_include.patch -04_ert_api_changes.patch diff --git a/debian/resinsight.install b/debian/resinsight.install deleted file mode 100644 index 87deca1134..0000000000 --- a/debian/resinsight.install +++ /dev/null @@ -1,2 +0,0 @@ -usr/bin/* -usr/share/* diff --git a/debian/rules b/debian/rules deleted file mode 100644 index 8a2507916b..0000000000 --- a/debian/rules +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - -%: - dh $@ - -override_dh_auto_configure: - dh_auto_configure --buildsystem=cmake -- -DCMAKE_BUILD_TYPE=Release -DRESINSIGHT_PRIVATE_INSTALL=0 -DCMAKE_INSTALL_DOCDIR=share/doc/resinsight - -.PHONY: override_dh_strip -override_dh_strip: - dh_strip --dbg-package=resinsight-dbg - -override_dh_installdocs: - dh_installdocs --link-doc=resinsight diff --git a/debian/source/format b/debian/source/format deleted file mode 100644 index 163aaf8d82..0000000000 --- a/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (quilt) diff --git a/redhat/01_use_system_ert.patch b/redhat/01_use_system_ert.patch deleted file mode 100644 index 97ee35712f..0000000000 --- a/redhat/01_use_system_ert.patch +++ /dev/null @@ -1,278 +0,0 @@ -commit 8f1291094f04563cefc93085b9b61c2bf3d914b8 -Author: Arne Morten Kvarving -Date: Tue Apr 9 17:10:58 2013 +0200 - - Use system ERT - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index e09c591..349ecf5 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -4,6 +4,8 @@ project (ResInsight) - - set (VIZ_MODULES_FOLDER_NAME VisualizationModules) - -+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} -+ ${CMAKE_SOURCE_DIR}/cmake/Modules) - - # Setup the main platform defines - #----------------------------------------------------- -@@ -37,22 +39,28 @@ include (ResInsightVersion.cmake) - ################################################################################ - # ERT - ################################################################################ --add_subdirectory(ThirdParty/Ert/devel) -- --include_directories( -- ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libecl/include/ert/ecl -- ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libert_util/include/ert/util -- ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libgeometry/include/ert/geometry -- ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well -- ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libecl/include -- ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libert_util/include -- ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libgeometry/include -- ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libecl_well/include -- -- ${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/libert_util/include/ert/util -- ${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/libert_util/include --) -- -+find_package(ERT) -+IF(ERT_FOUND) -+ include_directories(${ERT_INCLUDE_DIR}/ert/ecl -+ ${ERT_INCLUDE_DIR}/ert/geometry -+ ${ERT_INCLUDE_DIR}/ert/ecl_well -+ ${ERT_INCLUDE_DIR}/ert/util) -+else(ERT_FOUND) -+ add_subdirectory(ThirdParty/Ert/devel) -+ include_directories( -+ ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libecl/include/ert/ecl -+ ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libert_util/include/ert/util -+ ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libgeometry/include/ert/geometry -+ ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well -+ ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libecl/include -+ ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libert_util/include -+ ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libgeometry/include -+ ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libecl_well/include -+ -+ ${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/libert_util/include/ert/util -+ ${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/libert_util/include -+ ) -+endif(ERT_FOUND) - - ################################################################################ - # Qt -diff --git a/cmake/Modules/FindERT.cmake b/cmake/Modules/FindERT.cmake -new file mode 100644 -index 0000000..8067421 ---- /dev/null -+++ b/cmake/Modules/FindERT.cmake -@@ -0,0 +1,208 @@ -+# - Find the Ensemble-based Reservoir Tool (ERT) -+# -+# Set the cache variable ERT_ROOT to the install location of the ERT -+# libraries and header files. -+# -+# If found, it sets these variables: -+# -+# ERT_INCLUDE_DIRS Header file directories -+# ERT_LIBRARIES Archives and shared objects -+# ERT_CONFIG_VARS Definitions that goes in config.h -+# ERT_LINKER_FLAGS Options that must be passed to linker -+# -+# It will also add to CMAKE_C_FLAGS and CMAKE_CXX_FLAGS if necessary to -+# link with the ERT libraries. -+ -+# variables to pass on to other packages -+if (FIND_QUIETLY) -+ set (ERT_QUIET "QUIET") -+else (FIND_QUIETLY) -+ set (ERT_QUIET "") -+endif (FIND_QUIETLY) -+ -+# if a directory has been specified by the user, then don't go look -+# in the system directories as well -+if (ERT_ROOT) -+ set (_no_default_path "NO_DEFAULT_PATH") -+else (ERT_ROOT) -+ set (_no_default_path "") -+endif (ERT_ROOT) -+ -+# ERT doesn't have any config-mode file, so we need to specify the root -+# directory in its own variable -+find_path (ERT_ECL_INCLUDE_DIR -+ NAMES "ert/ecl/ecl_util.h" -+ HINTS "${ERT_ROOT}" -+ PATHS "../ert" -+ PATH_SUFFIXES "devel/libecl/include/" "include" -+ DOC "Path to ERT Eclipse library header files" -+ ${_no_default_path} -+ ) -+find_path (ERT_UTIL_INCLUDE_DIR -+ NAMES "ert/util/stringlist.h" -+ HINTS "${ERT_ROOT}" -+ PATHS "../ert" -+ PATH_SUFFIXES "devel/libert_util/include/" "include" -+ DOC "Path to ERT Eclipse library header files" -+ ${_no_default_path} -+ ) -+find_path (ERT_GEN_INCLUDE_DIR -+ NAMES "ert/util/int_vector.h" -+ HINTS "${ERT_ROOT}" -+ PATHS "${PROJECT_BINARY_DIR}/../ert" "${PROJECT_BINARY_DIR}/../ert-build" -+ "${PROJECT_BINARY_DIR}/../ert/devel" -+ PATH_SUFFIXES "libert_util/include/" "include" -+ DOC "Path to ERT generated library header files" -+ ${_no_default_path} -+ ) -+ -+# need all of these libraries -+if (CMAKE_SIZEOF_VOID_P) -+ math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}") -+endif (CMAKE_SIZEOF_VOID_P) -+find_library (ERT_LIBRARY_ECL -+ NAMES "ecl" -+ HINTS "${ERT_ROOT}" -+ PATHS "${PROJECT_BINARY_DIR}/../ert" "${PROJECT_BINARY_DIR}/../ert-build" -+ "${PROJECT_BINARY_DIR}/../ert/devel" -+ PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" -+ DOC "Path to ERT Eclipse library archive/shared object files" -+ ${_no_default_path} -+ ) -+find_library (ERT_LIBRARY_GEOMETRY -+ NAMES "ert_geometry" -+ HINTS "${ERT_ROOT}" -+ PATHS "${PROJECT_BINARY_DIR}/../ert" "${PROJECT_BINARY_DIR}/../ert-build" -+ "${PROJECT_BINARY_DIR}/../ert/devel" -+ PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" -+ DOC "Path to ERT Geometry library archive/shared object files" -+ ${_no_default_path} -+ ) -+find_library (ERT_LIBRARY_UTIL -+ NAMES "ert_util" -+ HINTS "${ERT_ROOT}" -+ PATHS "${PROJECT_BINARY_DIR}/../ert" "${PROJECT_BINARY_DIR}/../ert-build" -+ "${PROJECT_BINARY_DIR}/../ert/devel" -+ PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" -+ DOC "Path to ERT Utilities library archive/shared object files" -+ ${_no_default_path} -+ ) -+# the "library" found here is actually a list of several files -+list (APPEND ERT_INCLUDE_DIR -+ ${ERT_ECL_INCLUDE_DIR} -+ ${ERT_UTIL_INCLUDE_DIR} -+ ${ERT_GEN_INCLUDE_DIR} -+ ) -+list (APPEND ERT_LIBRARY -+ ${ERT_LIBRARY_ECL} -+ ${ERT_LIBRARY_GEOMETRY} -+ ${ERT_LIBRARY_UTIL} -+ ) -+list (APPEND ERT_LIBRARIES ${ERT_LIBRARY}) -+list (APPEND ERT_INCLUDE_DIRS ${ERT_INCLUDE_DIR}) -+ -+# if we didn't find any files, then don't proceed through the entire dependency list -+include (FindPackageHandleStandardArgs) -+if (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND") -+ find_package_handle_standard_args (ERT -+ DEFAULT_MSG -+ ERT_INCLUDE_DIR ERT_LIBRARY -+ ) -+ # write unsuccessful result to the cache, as the check_c_source_compiles -+ # would do if it failed -+ set (HAVE_ERT) -+ set (HAVE_ERT "${HAVE_ERT}" CACHE INTERNAL "Did an ERT sample program compile?") -+ return () -+endif (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND") -+ -+# these system variables are probed for, and used in HEADER files (sic) -+list (APPEND ERT_CONFIG_VARS -+ HAVE_ISFINITE -+ HAVE_GLOB -+ HAVE_FORK -+ HAVE_GETUID -+ HAVE_LOCKF -+ HAVE_OPENDIR -+ HAVE_PROC -+ HAVE_READLINKAT -+ HAVE_SYMLINK -+ HAVE_VA_COPY -+ ) -+include (CheckSymbolExists) -+include (CheckFunctionExists) -+check_symbol_exists (isfinite math.h HAVE_ISFINITE) -+check_function_exists (glob HAVE_GLOB) -+check_function_exists (fork HAVE_FORK) -+check_function_exists (getuid HAVE_GETUID) -+check_function_exists (lockf HAVE_LOCKF) -+check_function_exists (opendir HAVE_OPENDIR) -+check_function_exists (readlinkat HAVE_READLINKAT) -+check_function_exists (symlink HAVE_SYMLINK) -+check_symbol_exists (va_copy stdarg.h HAVE_VA_COPY) -+ -+if (UNIX) -+ set (HAVE_PROC 1) -+else (UNIX) -+ set (HAVE_PROC) -+endif (UNIX) -+ -+# dependencies -+ -+# compression library -+find_package (ZLIB ${ERT_QUIET}) -+if (ZLIB_FOUND) -+ list (APPEND ERT_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}) -+ list (APPEND ERT_LIBRARIES ${ZLIB_LIBRARIES}) -+endif (ZLIB_FOUND) -+ -+# numerics -+find_package (BLAS ${ERT_QUIET}) -+if (BLAS_FOUND) -+ list (APPEND ERT_INCLUDE_DIRS ${BLAS_INCLUDE_DIRS}) -+ list (APPEND ERT_LIBRARIES ${BLAS_LIBRARIES}) -+ list (APPEND ERT_LINKER_FLAGS ${BLAS_LINKER_FLAGS}) -+endif (BLAS_FOUND) -+find_package (LAPACK ${ERT_QUIET}) -+if (LAPACK_FOUND) -+ list (APPEND ERT_INCLUDE_DIRS ${LAPACK_INCLUDE_DIRS}) -+ list (APPEND ERT_LIBRARIES ${LAPACK_LIBRARIES}) -+ list (APPEND ERT_LINKER_FLAGS ${LAPACK_LINKER_FLAGS}) -+endif (LAPACK_FOUND) -+ -+# math library (should exist on all unices; automatically linked on Windows) -+if (UNIX) -+ find_library (MATH_LIBRARY -+ NAMES "m" -+ ) -+ list (APPEND ERT_LIBRARIES ${MATH_LIBRARY}) -+endif (UNIX) -+ -+# see if we can compile a minimum example -+# CMake logical test doesn't handle lists (sic) -+if (NOT (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND")) -+ include (CMakePushCheckState) -+ include (CheckCSourceCompiles) -+ cmake_push_check_state () -+ set (CMAKE_REQUIRED_INCLUDES ${ERT_INCLUDE_DIR}) -+ set (CMAKE_REQUIRED_LIBRARIES ${ERT_LIBRARIES}) -+ check_c_source_compiles ( -+ "#include -+int main (void) { -+ int sz; -+ sz = ecl_util_get_sizeof_ctype (ECL_INT_TYPE); -+ return 0; -+}" HAVE_ERT) -+ cmake_pop_check_state () -+else (NOT (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND")) -+ # write unsuccessful result to the cache, as the check_c_source_compiles -+ # would do if it failed -+ set (HAVE_ERT) -+ set (HAVE_ERT "${HAVE_ERT}" CACHE INTERNAL "Did an ERT sample program compile?") -+endif (NOT (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND")) -+ -+# if the test program didn't compile, but was required to do so, bail -+# out now and display an error; otherwise limp on -+find_package_handle_standard_args (ERT -+ DEFAULT_MSG -+ ERT_INCLUDE_DIR ERT_LIBRARY HAVE_ERT -+ ) diff --git a/redhat/02_install_docdir.patch b/redhat/02_install_docdir.patch deleted file mode 100644 index e1d98a43ef..0000000000 --- a/redhat/02_install_docdir.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/ApplicationCode/CMakeLists.txt b/ApplicationCode/CMakeLists.txt -index 7995ceb..4930b98 100644 ---- a/ApplicationCode/CMakeLists.txt -+++ b/ApplicationCode/CMakeLists.txt -@@ -8,6 +8,10 @@ CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/ApplicationCode/Adm/RIVersionInfo.h.cmake - ${CMAKE_BINARY_DIR}/Generated/RIVersionInfo.h - ) - -+if(NOT CMAKE_INSTALL_DOCDIR) -+ set(CMAKE_INSTALL_DOCDIR share/doc/resinsight) -+endif(NOT CMAKE_INSTALL_DOCDIR) -+ - - include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} -@@ -313,7 +317,7 @@ else (RESINSIGHT_PRIVATE_INSTALL) - ) - # license go in /usr/share/doc - install (FILES ${RESINSIGHT_LICENSE_FILES} -- DESTINATION share/doc/ResInsight -+ DESTINATION ${CMAKE_INSTALL_DOCDIR} - ) - # no bundled libraries for system install - # application icon diff --git a/redhat/03_remove_internal_header_include.patch b/redhat/03_remove_internal_header_include.patch deleted file mode 100644 index a72e206495..0000000000 --- a/redhat/03_remove_internal_header_include.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/ApplicationCode/FileInterface/FileInterface_UnitTests/Ert-Test.cpp b/ApplicationCode/FileInterface/FileInterface_UnitTests/Ert-Test.cpp -index 7a2aef0..c552574 100644 ---- a/ApplicationCode/FileInterface/FileInterface_UnitTests/Ert-Test.cpp -+++ b/ApplicationCode/FileInterface/FileInterface_UnitTests/Ert-Test.cpp -@@ -23,7 +23,6 @@ - - #include - #include --#include - #include - #include - #include -diff --git a/ApplicationCode/FileInterface/RifEclipseOutputFileTools.cpp b/ApplicationCode/FileInterface/RifEclipseOutputFileTools.cpp -index 2c77fd6..b6eeba7 100644 ---- a/ApplicationCode/FileInterface/RifEclipseOutputFileTools.cpp -+++ b/ApplicationCode/FileInterface/RifEclipseOutputFileTools.cpp -@@ -20,7 +20,6 @@ - - #include "util.h" - #include "ecl_file.h" --#include "ecl_intehead.h" - #include "ecl_kw_magic.h" - - #include diff --git a/redhat/04_ert_api_changes.patch b/redhat/04_ert_api_changes.patch deleted file mode 100644 index 2c24d7f185..0000000000 --- a/redhat/04_ert_api_changes.patch +++ /dev/null @@ -1,39 +0,0 @@ -diff --git a/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp b/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp -index 40b3e7a..27bb973 100644 ---- a/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp -+++ b/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp -@@ -53,7 +53,7 @@ bool RifEclipseRestartFilesetAccess::open(const QStringList& fileSet) - { - progInfo.setProgressDescription(fileSet[i]); - -- ecl_file_type* ecl_file = ecl_file_open(fileSet[i].toAscii().data()); -+ ecl_file_type* ecl_file = ecl_file_open(fileSet[i].toAscii().data(), 0); - if (!ecl_file) return false; - - m_ecl_files.push_back(ecl_file); -diff --git a/ApplicationCode/FileInterface/RifEclipseUnifiedRestartFileAccess.cpp b/ApplicationCode/FileInterface/RifEclipseUnifiedRestartFileAccess.cpp -index 8fecb28..73be912 100644 ---- a/ApplicationCode/FileInterface/RifEclipseUnifiedRestartFileAccess.cpp -+++ b/ApplicationCode/FileInterface/RifEclipseUnifiedRestartFileAccess.cpp -@@ -53,7 +53,7 @@ bool RifEclipseUnifiedRestartFileAccess::open(const QStringList& fileSet) - { - QString fileName = fileSet[0]; - -- m_ecl_file = ecl_file_open(fileName.toAscii().data()); -+ m_ecl_file = ecl_file_open(fileName.toAscii().data(), 0); - if (!m_ecl_file) return false; - - return true; -diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp -index bd2ec9b..e9d0afe 100644 ---- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp -+++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp -@@ -439,7 +439,7 @@ bool RifReaderEclipseOutput::buildMetaData(RigReservoir* reservoir) - QString initFileName = RifEclipseOutputFileTools::fileNameByType(m_fileSet, ECL_INIT_FILE); - if (initFileName.size() > 0) - { -- ecl_file_type* ecl_file = ecl_file_open(initFileName.toAscii().data()); -+ ecl_file_type* ecl_file = ecl_file_open(initFileName.toAscii().data(), 0); - if (!ecl_file) return false; - - progInfo.incrementProgress(); diff --git a/redhat/resinsight.spec b/redhat/resinsight.spec deleted file mode 100644 index a4ab8ebd0e..0000000000 --- a/redhat/resinsight.spec +++ /dev/null @@ -1,62 +0,0 @@ -# -# spec file for package resinsight -# - -Name: resinsight -Version: 0.9.2 -Release: 0 -Summary: ResInsight - the 3D reservoir viewer and post processor -License: GPL-3.0+ -Group: Science -Url: http://opm-project.org -Source0: %{name}-%{version}.orig.tar.gz -Patch0: 01_use_system_ert.patch -Patch1: 02_install_docdir.patch -Patch2: 03_remove_internal_header_include.patch -Patch3: 04_ert_api_changes.patch -BuildRequires: lapack-devel octave-devel qt qt-devel ert.ecl-devel -BuildRequires: gcc gcc-c++ -BuildRequires: cmake28 -BuildRoot: %{_tmppath}/%{name}-%{version}-build - -%description -ResInsight is a 3D viewer and post processing tool for reservoir models. -It has been co-developed by Statoil and Ceetron with the aim to provide -a versatile tool for professionals who need to visualize and process -reservoir models. - -%package octave -Summary: ResInsight plugins for Octave -Group: Scientific -Requires: %{name} = %{version} - -%description octave -This package contains the ResInsight octave plugins. - -%prep -%setup -q -%patch0 -p1 -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 - -%build -cmake28 -DRESINSIGHT_PRIVATE_INSTALL=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%{_prefix} -DCMAKE_INSTALL_DOCDIR=share/doc/resinsight-0.9.2 -make - -%install -make install DESTDIR=${RPM_BUILD_ROOT} - -%clean -rm -rf %{buildroot} - -%post -n resinsight -p /sbin/ldconfig - -%postun -n resinsight -p /sbin/ldconfig - -%files -%{_bindir}/* -%{_datadir}/* - -%files octave -%{_libdir}/* From 06fb3e1241c37d3472f6e347072f67b1ee1cebeb Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 18 Nov 2024 17:01:26 +0100 Subject: [PATCH 124/160] #11895 Always show Oil Saturation as available If no SOIL is found on file, compute based on available SWAT and SGAS. --- .../FileInterface/RifReaderOpmRft.cpp | 91 +++++++++++++++++-- .../FileInterface/RifReaderOpmRft.h | 1 + .../RigSoilResultCalculator.cpp | 1 + 3 files changed, 84 insertions(+), 9 deletions(-) diff --git a/ApplicationLibCode/FileInterface/RifReaderOpmRft.cpp b/ApplicationLibCode/FileInterface/RifReaderOpmRft.cpp index 49bd7042ef..a2154ce229 100644 --- a/ApplicationLibCode/FileInterface/RifReaderOpmRft.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderOpmRft.cpp @@ -20,6 +20,7 @@ #include "RiaLogging.h" #include "RiaQDateTimeTools.h" +#include "RiaResultNames.h" #include "RiaRftDefines.h" #include "RiaStdStringTools.h" @@ -138,7 +139,43 @@ void RifReaderOpmRft::values( const RifEclipseRftAddress& rftAddress, std::vecto try { - std::vector data = resultAsFloat( resultName, wellName, y, m, d ); + std::vector data; + + if ( rftAddress.wellLogChannel() == RifEclipseRftAddress::RftWellLogChannelType::SOIL && + !isNativeResultAvailable( RiaResultNames::soil().toStdString(), wellName, y, m, d ) ) + { + // Compute SOIL from SWAT and SGAS + // There is a similar function in RigSoilResultCalculator, but they are too different to be merged + auto computeSoil = [&]( const std::string& wellName, int y, int m, int d ) -> std::vector + { + auto swat = resultAsFloat( RiaResultNames::swat().toStdString(), wellName, y, m, d ); + auto sgas = resultAsFloat( RiaResultNames::sgas().toStdString(), wellName, y, m, d ); + + auto maxItems = std::max( swat.size(), sgas.size() ); + std::vector data( maxItems, 1.0f ); + + for ( size_t i = 0; i < maxItems; ++i ) + { + if ( i < swat.size() ) + { + data[i] -= swat[i]; + } + if ( i < sgas.size() ) + { + data[i] -= sgas[i]; + } + data[i] = std::clamp( data[i], 0.0f, 1.0f ); + } + + return data; + }; + + data = computeSoil( wellName, y, m, d ); + } + else + { + data = resultAsFloat( resultName, wellName, y, m, d ); + } if ( !data.empty() ) { @@ -241,6 +278,17 @@ std::set RifReaderOpmRft::availableTimeSteps( const QString& timeSteps.insert( address.timeStep() ); } } + + if ( timeSteps.empty() && wellLogChannelName == RifEclipseRftAddress::RftWellLogChannelType::SOIL ) + { + auto sgasTimeSteps = availableTimeSteps( wellName, RifEclipseRftAddress::RftWellLogChannelType::SGAS ); + auto swatTimeSteps = availableTimeSteps( wellName, RifEclipseRftAddress::RftWellLogChannelType::SWAT ); + + // Combine time steps from SGAS and SWAT + timeSteps.insert( sgasTimeSteps.begin(), sgasTimeSteps.end() ); + timeSteps.insert( swatTimeSteps.begin(), swatTimeSteps.end() ); + } + return timeSteps; } @@ -281,6 +329,13 @@ std::set RifReaderOpmRft::available } } + if ( types.contains( RifEclipseRftAddress::RftWellLogChannelType::SWAT ) || + types.contains( RifEclipseRftAddress::RftWellLogChannelType::SGAS ) ) + { + // Add SOIL if SGAS or SWAT are available, SOIL can be computed from these + types.insert( RifEclipseRftAddress::RftWellLogChannelType::SOIL ); + } + return types; } @@ -473,8 +528,8 @@ std::vector { if ( !isFirstSegment && std::fabs( startMD[i] - endMD[i - 1] ) > 0.1 ) { - // Insert a segment representing the connection between the segments. Assign infinity as value to this segment - // to allow discontinuous plotting. + // Insert a segment representing the connection between the segments. Assign infinity as value to this + // segment to allow discontinuous plotting. startEndValues.emplace_back( endMD[i - 1], startMD[i], false ); } startEndValues.emplace_back( startMD[i], endMD[i], true ); @@ -1081,13 +1136,14 @@ RifEclipseRftAddress::RftWellLogChannelType RifReaderOpmRft::identifyChannelType { if ( resultName == "DEPTH" ) return RifEclipseRftAddress::RftWellLogChannelType::TVD; if ( resultName == "PRESSURE" ) return RifEclipseRftAddress::RftWellLogChannelType::PRESSURE; - if ( resultName == "SWAT" ) return RifEclipseRftAddress::RftWellLogChannelType::SWAT; - if ( resultName == "SOIL" ) return RifEclipseRftAddress::RftWellLogChannelType::SOIL; - if ( resultName == "SGAS" ) return RifEclipseRftAddress::RftWellLogChannelType::SGAS; if ( resultName == "WRAT" ) return RifEclipseRftAddress::RftWellLogChannelType::WRAT; if ( resultName == "ORAT" ) return RifEclipseRftAddress::RftWellLogChannelType::ORAT; if ( resultName == "GRAT" ) return RifEclipseRftAddress::RftWellLogChannelType::GRAT; + if ( resultName == RiaResultNames::swat().toStdString() ) return RifEclipseRftAddress::RftWellLogChannelType::SWAT; + if ( resultName == RiaResultNames::soil().toStdString() ) return RifEclipseRftAddress::RftWellLogChannelType::SOIL; + if ( resultName == RiaResultNames::sgas().toStdString() ) return RifEclipseRftAddress::RftWellLogChannelType::SGAS; + return RifEclipseRftAddress::RftWellLogChannelType::NONE; } @@ -1098,13 +1154,14 @@ std::string RifReaderOpmRft::resultNameFromChannelType( RifEclipseRftAddress::Rf { if ( channelType == RifEclipseRftAddress::RftWellLogChannelType::TVD ) return "DEPTH"; if ( channelType == RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ) return "PRESSURE"; - if ( channelType == RifEclipseRftAddress::RftWellLogChannelType::SWAT ) return "SWAT"; - if ( channelType == RifEclipseRftAddress::RftWellLogChannelType::SOIL ) return "SOIL"; - if ( channelType == RifEclipseRftAddress::RftWellLogChannelType::SGAS ) return "SGAS"; if ( channelType == RifEclipseRftAddress::RftWellLogChannelType::WRAT ) return "WRAT"; if ( channelType == RifEclipseRftAddress::RftWellLogChannelType::ORAT ) return "ORAT"; if ( channelType == RifEclipseRftAddress::RftWellLogChannelType::GRAT ) return "GRAT"; + if ( channelType == RifEclipseRftAddress::RftWellLogChannelType::SWAT ) return RiaResultNames::swat().toStdString(); + if ( channelType == RifEclipseRftAddress::RftWellLogChannelType::SOIL ) return RiaResultNames::soil().toStdString(); + if ( channelType == RifEclipseRftAddress::RftWellLogChannelType::SGAS ) return RiaResultNames::sgas().toStdString(); + return {}; } @@ -1145,6 +1202,22 @@ std::vector RifReaderOpmRft::resultAsFloat( const std::string& resultName return {}; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RifReaderOpmRft::isNativeResultAvailable( const std::string& resultName, const std::string& wellName, int year, int month, int day ) const +{ + if ( !m_opm_rft ) return false; + + auto results = m_opm_rft->listOfRftArrays( wellName, year, month, day ); + for ( const auto& [name, arrayType, size] : results ) + { + if ( resultName == name ) return true; + } + + return false; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/FileInterface/RifReaderOpmRft.h b/ApplicationLibCode/FileInterface/RifReaderOpmRft.h index 97b40172df..28b51bfcd8 100644 --- a/ApplicationLibCode/FileInterface/RifReaderOpmRft.h +++ b/ApplicationLibCode/FileInterface/RifReaderOpmRft.h @@ -87,6 +87,7 @@ private: static std::string resultNameFromChannelType( RifEclipseRftAddress::RftWellLogChannelType channelType ); std::vector resultAsFloat( const std::string& resultName, const std::string& wellName, int year, int month, int day ) const; + bool isNativeResultAvailable( const std::string& resultName, const std::string& wellName, int year, int month, int day ) const; bool openFiles(); diff --git a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigSoilResultCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigSoilResultCalculator.cpp index ef7dde6064..e0497d68e8 100644 --- a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigSoilResultCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigSoilResultCalculator.cpp @@ -50,6 +50,7 @@ bool RigSoilResultCalculator::isMatching( const RigEclipseResultAddress& resVarA //-------------------------------------------------------------------------------------------------- void RigSoilResultCalculator::calculate( const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex ) { + // See similar function in RifReaderOpmRft::values, but the current implementation is not suitable for merging // Compute SGAS based on SWAT if the simulation contains no oil m_resultsData->testAndComputeSgasForTimeStep( timeStepIndex ); From eb6467c599db9897bed6be5fce3b8e2bed87adad Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 18 Nov 2024 09:31:45 +0100 Subject: [PATCH 125/160] Refactor: remove pass-through methods from Rim to Rig. --- .../RicContourMapPickEventHandler.cpp | 7 +- .../RicExportContourMapToTextFeature.cpp | 54 +++++---- .../Rim3dOverlayInfoConfig.cpp | 18 +-- .../RimContourMapProjection.cpp | 111 +----------------- .../RimContourMapProjection.h | 20 +--- .../RimEclipseContourMapProjection.cpp | 4 +- .../RimHistogramCalculator.cpp | 25 ++-- 7 files changed, 69 insertions(+), 170 deletions(-) diff --git a/ApplicationLibCode/Commands/RicContourMapPickEventHandler.cpp b/ApplicationLibCode/Commands/RicContourMapPickEventHandler.cpp index f42664607b..3ffb1551b2 100644 --- a/ApplicationLibCode/Commands/RicContourMapPickEventHandler.cpp +++ b/ApplicationLibCode/Commands/RicContourMapPickEventHandler.cpp @@ -17,12 +17,16 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RicContourMapPickEventHandler.h" + +#include "RigContourMapProjection.h" + #include "Rim3dView.h" #include "RimContourMapProjection.h" #include "RimEclipseContourMapView.h" #include "RimGeoMechContourMapView.h" #include "RiuMainWindow.h" + #include "RivObjectSourceInfo.h" #include "cafDisplayCoordTransform.h" @@ -69,7 +73,8 @@ bool RicContourMapPickEventHandler::handle3dPickEvent( const Ric3dPickEvent& eve cvf::Vec2d pickedPoint( cvf::Vec2d::UNDEFINED ); double valueAtPoint = 0.0; - if ( contourMap->checkForMapIntersection( targetPointInDomain, &pickedPoint, &valueAtPoint ) ) + if ( contourMap->mapProjection() && + contourMap->mapProjection()->checkForMapIntersection( targetPointInDomain, &pickedPoint, &valueAtPoint ) ) { curveText += QString( "Picked Point X, Y: %1, %2\n" ).arg( pickedPoint.x(), 5, 'f', 0 ).arg( pickedPoint.y(), 5, 'f', 0 ); curveText += QString( "Result Type: %1\n" ).arg( contourMap->resultDescriptionText() ); diff --git a/ApplicationLibCode/Commands/RicExportContourMapToTextFeature.cpp b/ApplicationLibCode/Commands/RicExportContourMapToTextFeature.cpp index 4614bb5be0..5d04bb61cc 100644 --- a/ApplicationLibCode/Commands/RicExportContourMapToTextFeature.cpp +++ b/ApplicationLibCode/Commands/RicExportContourMapToTextFeature.cpp @@ -24,6 +24,8 @@ #include "RifTextDataTableFormatter.h" +#include "RigContourMapProjection.h" + #include "RimContourMapProjection.h" #include "RimEclipseContourMapProjection.h" #include "RimEclipseContourMapView.h" @@ -149,7 +151,7 @@ void RicExportContourMapToTextFeature::writeMetaDataToStream( QTextStream& const QString& caseName, bool exportLocalCoordinates ) { - cvf::Vec2ui numVerticesIJ = contourMapProjection->numberOfVerticesIJ(); + cvf::Vec2ui numVerticesIJ = contourMapProjection->mapProjection()->numberOfVerticesIJ(); stream << "# case name : " << contourMapProjection->caseName() << "\n"; stream << "# sampling points : nx=" << numVerticesIJ.x() << " ny=" << numVerticesIJ.y() << "\n"; stream << "# time and date : " << contourMapProjection->currentTimeStepName() << "\n"; @@ -185,31 +187,35 @@ void RicExportContourMapToTextFeature::writeContourMapToStream( QTextStream& formatter.header( header ); - cvf::Vec2ui numVerticesIJ = contourMapProjection->numberOfVerticesIJ(); - std::vector xVertexPositions = contourMapProjection->xVertexPositions(); - std::vector yVertexPositions = contourMapProjection->yVertexPositions(); - - // Undefined values are positive inf in contour map projection. - double undefined = std::numeric_limits::infinity(); - for ( unsigned int j = 0; j < numVerticesIJ.y(); j++ ) + const RigContourMapProjection* mapProjection = contourMapProjection->mapProjection(); + if ( mapProjection ) { - for ( unsigned int i = 0; i < numVerticesIJ.x(); i++ ) - { - double value = contourMapProjection->valueAtVertex( i, j ); - if ( !( std::isinf( value ) && excludeUndefinedValues ) ) - { - double x = xVertexPositions.at( i ); - double y = yVertexPositions.at( j ); - if ( !exportLocalCoordinates ) - { - x += contourMapProjection->origin3d().x(); - y += contourMapProjection->origin3d().y(); - } + cvf::Vec2ui numVerticesIJ = mapProjection->numberOfVerticesIJ(); + std::vector xVertexPositions = mapProjection->xVertexPositions(); + std::vector yVertexPositions = mapProjection->yVertexPositions(); - formatter.add( x ); - formatter.add( y ); - formatter.addValueOrDefaultMarker( value, undefined ); - formatter.rowCompleted(); + // Undefined values are positive inf in contour map projection. + double undefined = std::numeric_limits::infinity(); + for ( unsigned int j = 0; j < numVerticesIJ.y(); j++ ) + { + for ( unsigned int i = 0; i < numVerticesIJ.x(); i++ ) + { + double value = mapProjection->valueAtVertex( i, j ); + if ( !( std::isinf( value ) && excludeUndefinedValues ) ) + { + double x = xVertexPositions.at( i ); + double y = yVertexPositions.at( j ); + if ( !exportLocalCoordinates ) + { + x += mapProjection->origin3d().x(); + y += mapProjection->origin3d().y(); + } + + formatter.add( x ); + formatter.add( y ); + formatter.addValueOrDefaultMarker( value, undefined ); + formatter.rowCompleted(); + } } } } diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp index 7c201ab607..54cf91d21a 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp @@ -28,6 +28,7 @@ #include "RigActiveCellInfo.h" #include "RigCaseCellResultsData.h" +#include "RigContourMapProjection.h" #include "RigEclipseCaseData.h" #include "RigFemPartCollection.h" #include "RigFemPartResultsCollection.h" @@ -313,10 +314,11 @@ QString Rim3dOverlayInfoConfig::caseInfoText( RimEclipseView* eclipseView ) QLocale localeWithSpaceAsGroupSeparator( caf::norwegianLocale() ); RimEclipseContourMapView* contourMap = dynamic_cast( eclipseView ); - if ( contourMap && contourMap->contourMapProjection() ) + if ( contourMap && contourMap->contourMapProjection() && contourMap->contourMapProjection()->mapProjection() ) { - QString totCellCount = localeWithSpaceAsGroupSeparator.toString( contourMap->contourMapProjection()->numberOfCells() ); - cvf::uint validCellCount = contourMap->contourMapProjection()->numberOfValidCells(); + QString totCellCount = + localeWithSpaceAsGroupSeparator.toString( contourMap->contourMapProjection()->mapProjection()->numberOfCells() ); + cvf::uint validCellCount = contourMap->contourMapProjection()->mapProjection()->numberOfValidCells(); QString activeCellCountText = localeWithSpaceAsGroupSeparator.toString( validCellCount ); QString aggregationType = contourMap->contourMapProjection()->resultAggregationText(); QString weightingParameterString; @@ -380,10 +382,10 @@ QString Rim3dOverlayInfoConfig::caseInfoText( RimGeoMechView* geoMechView ) QString caseName = geoMechCase->caseUserDescription(); RimGeoMechContourMapView* contourMap = dynamic_cast( geoMechView ); - if ( contourMap && contourMap->contourMapProjection() ) + if ( contourMap && contourMap->contourMapProjection() && contourMap->contourMapProjection()->mapProjection() ) { - QString totCellCount = QString::number( contourMap->contourMapProjection()->numberOfCells() ); - cvf::uint validCellCount = contourMap->contourMapProjection()->numberOfValidCells(); + QString totCellCount = QString::number( contourMap->contourMapProjection()->mapProjection()->numberOfCells() ); + cvf::uint validCellCount = contourMap->contourMapProjection()->mapProjection()->numberOfValidCells(); QString activeCellCountText = QString::number( validCellCount ); QString aggregationType = contourMap->contourMapProjection()->resultAggregationText(); @@ -445,9 +447,9 @@ QString Rim3dOverlayInfoConfig::resultInfoText( const RigHistogramData& histData RimEclipseContourMapView* contourMap = dynamic_cast( eclipseView ); - if ( contourMap ) + if ( contourMap && contourMap->contourMapProjection() && contourMap->contourMapProjection()->mapProjection() ) { - bool isResultsInfoRelevant = contourMap->contourMapProjection()->numberOfValidCells() > 0u; + bool isResultsInfoRelevant = contourMap->contourMapProjection()->mapProjection()->numberOfValidCells() > 0u; if ( isResultsInfoRelevant ) { QString propName = eclipseView->cellResult()->resultVariableUiShortName(); diff --git a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp index be5beff761..ba77b919f7 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp @@ -309,46 +309,9 @@ QString RimContourMapProjection::currentTimeStepName() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -double RimContourMapProjection::maxValue() const +const RigContourMapProjection* RimContourMapProjection::mapProjection() const { - if ( m_contourMapProjection ) return m_contourMapProjection->maxValue(); - return -std::numeric_limits::infinity(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -double RimContourMapProjection::minValue() const -{ - if ( m_contourMapProjection ) return m_contourMapProjection->minValue(); - return std::numeric_limits::infinity(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -double RimContourMapProjection::meanValue() const -{ - if ( m_contourMapProjection ) return m_contourMapProjection->meanValue(); - return std::numeric_limits::infinity(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -double RimContourMapProjection::sumAllValues() const -{ - if ( m_contourMapProjection ) return m_contourMapProjection->sumAllValues(); - return 0.0; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -cvf::Vec2ui RimContourMapProjection::numberOfVerticesIJ() const -{ - if ( m_contourMapGrid ) return m_contourMapGrid->numberOfVerticesIJ(); - return cvf::Vec2ui( 0, 0 ); + return m_contourMapProjection.get(); } //-------------------------------------------------------------------------------------------------- @@ -359,51 +322,6 @@ bool RimContourMapProjection::isColumnResult() const return RigContourMapCalculator::isColumnResult( m_resultAggregation() ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -double RimContourMapProjection::valueAtVertex( uint i, uint j ) const -{ - if ( m_contourMapProjection ) return m_contourMapProjection->valueAtVertex( i, j ); - return std::numeric_limits::infinity(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -uint RimContourMapProjection::numberOfCells() const -{ - if ( m_contourMapGrid ) return m_contourMapGrid->numberOfCells(); - return 0u; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -uint RimContourMapProjection::numberOfValidCells() const -{ - if ( m_contourMapProjection ) return m_contourMapProjection->numberOfValidCells(); - return 0u; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -size_t RimContourMapProjection::numberOfVertices() const -{ - if ( m_contourMapGrid ) return m_contourMapGrid->numberOfVertices(); - return 0; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RimContourMapProjection::checkForMapIntersection( const cvf::Vec3d& domainPoint3d, cvf::Vec2d* contourMapPoint, double* valueAtPoint ) const -{ - if ( m_contourMapProjection ) return m_contourMapProjection->checkForMapIntersection( domainPoint3d, contourMapPoint, valueAtPoint ); - return false; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -444,7 +362,7 @@ bool RimContourMapProjection::gridMappingNeedsUpdating() const { if ( !m_contourMapProjection ) return true; - if ( m_contourMapProjection->projected3dGridIndices().size() != numberOfCells() ) return true; + if ( m_contourMapProjection->projected3dGridIndices().size() != m_contourMapProjection->numberOfCells() ) return true; auto cellGridIdxVisibility = m_contourMapProjection->getCellVisibility(); if ( cellGridIdxVisibility.isNull() ) return true; @@ -467,8 +385,9 @@ bool RimContourMapProjection::resultsNeedsUpdating( int timeStep ) const { if ( !m_contourMapProjection ) return true; - return ( m_contourMapProjection->aggregatedResults().size() != numberOfCells() || - m_contourMapProjection->aggregatedVertexResults().size() != numberOfVertices() || timeStep != m_currentResultTimestep ); + return ( m_contourMapProjection->aggregatedResults().size() != m_contourMapProjection->numberOfCells() || + m_contourMapProjection->aggregatedVertexResults().size() != m_contourMapProjection->numberOfVertices() || + timeStep != m_currentResultTimestep ); } //-------------------------------------------------------------------------------------------------- @@ -547,24 +466,6 @@ bool RimContourMapProjection::isStraightSummationResult() const return RigContourMapCalculator::isStraightSummationResult( m_resultAggregation() ); } -//-------------------------------------------------------------------------------------------------- -/// Vertex positions in local coordinates (add origin2d.x() for UTM x) -//-------------------------------------------------------------------------------------------------- -std::vector RimContourMapProjection::xVertexPositions() const -{ - if ( m_contourMapGrid ) return m_contourMapGrid->xVertexPositions(); - return {}; -} - -//-------------------------------------------------------------------------------------------------- -/// Vertex positions in local coordinates (add origin2d.y() for UTM y) -//-------------------------------------------------------------------------------------------------- -std::vector RimContourMapProjection::yVertexPositions() const -{ - if ( m_contourMapGrid ) return m_contourMapGrid->yVertexPositions(); - return {}; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h index cea72b3ccb..b11ee72035 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h +++ b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h @@ -70,31 +70,13 @@ public: QString caseName() const; QString currentTimeStepName() const; - double maxValue() const; - double minValue() const; - - double meanValue() const; - double sumAllValues() const; - - cvf::Vec2ui numberOfVerticesIJ() const; - bool isColumnResult() const; bool isMeanResult() const; bool isStraightSummationResult() const; - double valueAtVertex( uint i, uint j ) const; - - uint numberOfCells() const; - uint numberOfValidCells() const; - size_t numberOfVertices() const; - - bool checkForMapIntersection( const cvf::Vec3d& domainPoint3d, cvf::Vec2d* contourMapPoint, double* valueAtPoint ) const; void setPickPoint( cvf::Vec2d globalPickPoint ); cvf::Vec3d origin3d() const; - std::vector xVertexPositions() const; - std::vector yVertexPositions() const; - // Pure-virtual public methods which should be overridden by Eclipse and Geo-mechanical contour map implementations virtual QString resultDescriptionText() const = 0; virtual RimRegularLegendConfig* legendConfig() const = 0; @@ -107,6 +89,8 @@ public: virtual cvf::ref getCellVisibility() const; + const RigContourMapProjection* mapProjection() const; + protected: // Protected virtual methods to be overridden by Eclipse and Geo-mechanical contour map implementations virtual void updateGridInformation() = 0; diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp index faf292a26e..a18e45e2eb 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp @@ -103,8 +103,8 @@ void RimEclipseContourMapProjection::updateLegend() { RimEclipseCellColors* cellColors = view()->cellResult(); - double minVal = minValue(); - double maxVal = maxValue(); + double minVal = m_contourMapProjection ? m_contourMapProjection->minValue() : std::numeric_limits::infinity(); + double maxVal = m_contourMapProjection ? m_contourMapProjection->maxValue() : -std::numeric_limits::infinity(); auto [minValAllTimeSteps, maxValAllTimeSteps] = minmaxValuesAllTimeSteps(); diff --git a/ApplicationLibCode/ProjectDataModel/RimHistogramCalculator.cpp b/ApplicationLibCode/ProjectDataModel/RimHistogramCalculator.cpp index e0b389bc47..e9c0842a18 100644 --- a/ApplicationLibCode/ProjectDataModel/RimHistogramCalculator.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimHistogramCalculator.cpp @@ -18,6 +18,7 @@ #include "RimHistogramCalculator.h" +#include "RigContourMapProjection.h" #include "RigEclipseMultiPropertyStatCalc.h" #include "RigEclipseNativeVisibleCellsStatCalc.h" #include "RigFemNativeVisibleCellsStatCalc.h" @@ -94,16 +95,16 @@ RigHistogramData RimHistogramCalculator::histogramData( RimEclipseContourMapView { RigHistogramData histData; - if ( contourMap ) + if ( contourMap && contourMap->contourMapProjection() && contourMap->contourMapProjection()->mapProjection() ) { - bool isResultsInfoRelevant = contourMap->contourMapProjection()->numberOfValidCells() > 0u; + bool isResultsInfoRelevant = contourMap->contourMapProjection()->mapProjection()->numberOfValidCells() > 0u; if ( isResultsInfoRelevant ) { - histData.min = contourMap->contourMapProjection()->minValue(); - histData.max = contourMap->contourMapProjection()->maxValue(); - histData.mean = contourMap->contourMapProjection()->meanValue(); - histData.sum = contourMap->contourMapProjection()->sumAllValues(); + histData.min = contourMap->contourMapProjection()->mapProjection()->minValue(); + histData.max = contourMap->contourMapProjection()->mapProjection()->maxValue(); + histData.mean = contourMap->contourMapProjection()->mapProjection()->meanValue(); + histData.sum = contourMap->contourMapProjection()->mapProjection()->sumAllValues(); } } return histData; @@ -116,16 +117,16 @@ RigHistogramData RimHistogramCalculator::histogramData( RimGeoMechContourMapView { RigHistogramData histData; - if ( contourMap ) + if ( contourMap && contourMap->contourMapProjection() && contourMap->contourMapProjection()->mapProjection() ) { - bool isResultsInfoRelevant = contourMap->contourMapProjection()->numberOfValidCells() > 0u; + bool isResultsInfoRelevant = contourMap->contourMapProjection()->mapProjection()->numberOfValidCells() > 0u; if ( isResultsInfoRelevant ) { - histData.min = contourMap->contourMapProjection()->minValue(); - histData.max = contourMap->contourMapProjection()->maxValue(); - histData.mean = contourMap->contourMapProjection()->meanValue(); - histData.sum = contourMap->contourMapProjection()->sumAllValues(); + histData.min = contourMap->contourMapProjection()->mapProjection()->minValue(); + histData.max = contourMap->contourMapProjection()->mapProjection()->maxValue(); + histData.mean = contourMap->contourMapProjection()->mapProjection()->meanValue(); + histData.sum = contourMap->contourMapProjection()->mapProjection()->sumAllValues(); } } return histData; From 8da0690096e48ad706f207d17ec10c242ac6b804 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 18 Nov 2024 11:40:39 +0100 Subject: [PATCH 126/160] Refactor: Decouple RivContourMapProjectionPartMgr and RimContourMapProjection --- .../RivContourMapProjectionPartMgr.cpp | 201 ++++++++++-------- .../RivContourMapProjectionPartMgr.h | 95 ++++++--- .../GeoMech/RimGeoMechContourMapView.cpp | 30 ++- .../RimContourMapProjection.cpp | 49 ++--- .../RimContourMapProjection.h | 5 +- .../RimEclipseContourMapView.cpp | 29 ++- .../RimRegularLegendConfig.cpp | 16 ++ .../ProjectDataModel/RimRegularLegendConfig.h | 14 +- .../RigContourPolygonsTools.cpp | 35 ++- .../RigContourPolygonsTools.h | 4 +- 10 files changed, 307 insertions(+), 171 deletions(-) diff --git a/ApplicationLibCode/ModelVisualization/RivContourMapProjectionPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivContourMapProjectionPartMgr.cpp index 7bd447aa74..9a3558ea1b 100644 --- a/ApplicationLibCode/ModelVisualization/RivContourMapProjectionPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivContourMapProjectionPartMgr.cpp @@ -1,28 +1,41 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- 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 "RivContourMapProjectionPartMgr.h" #include "RiaColorTools.h" #include "RiaFontCache.h" -#include "RiaWeightedMeanCalculator.h" -#include "RigCellGeometryTools.h" + +#include "RigContourMapGrid.h" #include "RigContourPolygonsTools.h" + #include "RivMeshLinesSourceInfo.h" #include "RivPartPriority.h" #include "RivScalarMapperUtils.h" -#include "RimContourMapProjection.h" -#include "RimGridView.h" -#include "RimRegularLegendConfig.h" - #include "cafCategoryMapper.h" #include "cafEffectGenerator.h" #include "cafFixedAtlasFont.h" #include "cvfCamera.h" +#include "cvfColor3.h" #include "cvfDrawableText.h" -#include "cvfGeometryBuilderFaceList.h" -#include "cvfGeometryTools.h" -#include "cvfGeometryUtils.h" -#include "cvfMeshEdgeExtractor.h" +#include "cvfModelBasicList.h" #include "cvfPart.h" #include "cvfPrimitiveSetIndexedUInt.h" #include "cvfRay.h" @@ -34,35 +47,28 @@ #include #include + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RivContourMapProjectionPartMgr::RivContourMapProjectionPartMgr( RimContourMapProjection* contourMapProjection, RimGridView* contourMap ) +RivContourMapProjectionPartMgr::RivContourMapProjectionPartMgr( caf::PdmObject* pdmObject ) { - m_contourMapProjection = contourMapProjection; - m_parentContourMap = contourMap; + m_pdmObject = pdmObject; m_labelEffect = new cvf::Effect; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RivContourMapProjectionPartMgr::createProjectionGeometry() -{ - m_contourMapProjection->generateGeometryIfNecessary(); - - m_contourLinePolygons = m_contourMapProjection->contourPolygons(); - m_contourMapTriangles = m_contourMapProjection->trianglesWithVertexValues(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RivContourMapProjectionPartMgr::appendProjectionToModel( cvf::ModelBasicList* model, - const caf::DisplayCoordTransform* displayCoordTransform ) const + const caf::DisplayCoordTransform* displayCoordTransform, + const std::vector& vertices, + const RigContourMapGrid& contourMapGrid, + const cvf::Color3f& backgroundColor, + cvf::ScalarMapper* scalarMapper ) const { - cvf::ref mapPart = createProjectionMapPart( displayCoordTransform ); + cvf::ref mapPart = createProjectionMapPart( displayCoordTransform, vertices, contourMapGrid, backgroundColor, scalarMapper ); if ( mapPart.notNull() ) { model->addPart( mapPart.p() ); @@ -73,9 +79,12 @@ void RivContourMapProjectionPartMgr::appendProjectionToModel( cvf::ModelBasicLis /// //-------------------------------------------------------------------------------------------------- void RivContourMapProjectionPartMgr::appendPickPointVisToModel( cvf::ModelBasicList* model, - const caf::DisplayCoordTransform* displayCoordTransform ) const + const caf::DisplayCoordTransform* displayCoordTransform, + const cvf::Vec2d& pickPoint, + const RigContourMapGrid& contourMapGrid ) const + { - cvf::ref drawable = createPickPointVisDrawable( displayCoordTransform ); + cvf::ref drawable = createPickPointVisDrawable( displayCoordTransform, pickPoint, contourMapGrid ); if ( drawable.notNull() && drawable->boundingBox().isValid() ) { caf::MeshEffectGenerator meshEffectGen( cvf::Color3::MAGENTA ); @@ -87,7 +96,7 @@ void RivContourMapProjectionPartMgr::appendPickPointVisToModel( cvf::ModelBasicL part->setName( "RivContourMapProjectionPartMgr::appendPickPointVisToModel" ); part->setDrawable( drawable.p() ); part->setEffect( effect.p() ); - part->setSourceInfo( new RivMeshLinesSourceInfo( m_contourMapProjection.p() ) ); + part->setSourceInfo( new RivMeshLinesSourceInfo( m_pdmObject.p() ) ); model->addPart( part.p() ); } @@ -96,7 +105,8 @@ void RivContourMapProjectionPartMgr::appendPickPointVisToModel( cvf::ModelBasicL //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -cvf::ref RivContourMapProjectionPartMgr::createTextureCoords( const std::vector& values ) const +cvf::ref RivContourMapProjectionPartMgr::createTextureCoords( const std::vector& values, + cvf::ScalarMapper* scalarMapper ) const { cvf::ref textureCoords = new cvf::Vec2fArray( values.size() ); @@ -105,7 +115,7 @@ cvf::ref RivContourMapProjectionPartMgr::createTextureCoords( c { if ( values[i] != std::numeric_limits::infinity() ) { - cvf::Vec2f textureCoord = m_contourMapProjection->legendConfig()->scalarMapper()->mapToTextureCoord( values[i] ); + cvf::Vec2f textureCoord = scalarMapper->mapToTextureCoord( values[i] ); textureCoord.y() = 0.0; ( *textureCoords )[i] = textureCoord; } @@ -122,22 +132,28 @@ cvf::ref RivContourMapProjectionPartMgr::createTextureCoords( c //-------------------------------------------------------------------------------------------------- void RivContourMapProjectionPartMgr::appendContourLinesToModel( const cvf::Camera* camera, cvf::ModelBasicList* model, - const caf::DisplayCoordTransform* displayCoordTransform ) + const caf::DisplayCoordTransform* displayCoordTransform, + const std::vector& contourLinePolygons, + const RigContourMapGrid& contourMapGrid, + cvf::ScalarMapper* mapper, + bool showContourLines, + bool showContourLabels, + RiaNumberFormat::NumberFormatType numberFormat, + int precision ) { - if ( m_contourMapProjection->showContourLines() ) + if ( showContourLines ) { - cvf::ScalarMapper* mapper = m_contourMapProjection->legendConfig()->scalarMapper(); - std::vector> labelBBoxes; std::vector> labelDrawables; - if ( m_contourMapProjection->showContourLabels() ) + if ( showContourLabels ) { - labelDrawables = createContourLabels( camera, displayCoordTransform, &labelBBoxes ); + labelDrawables = + createContourLabels( camera, displayCoordTransform, &labelBBoxes, contourLinePolygons, contourMapGrid, mapper, numberFormat, precision ); } std::vector>> contourDrawablesForAllLevels = - createContourPolygons( displayCoordTransform, labelBBoxes ); + createContourPolygons( displayCoordTransform, labelBBoxes, contourLinePolygons, mapper, contourMapGrid ); std::vector tickValues; mapper->majorTickValues( &tickValues ); @@ -164,14 +180,14 @@ void RivContourMapProjectionPartMgr::appendContourLinesToModel( const cvf::Camer part->setDrawable( contourDrawable.p() ); part->setEffect( effect.p() ); part->setPriority( RivPartPriority::MeshLines ); - part->setSourceInfo( new RivMeshLinesSourceInfo( m_contourMapProjection.p() ) ); + part->setSourceInfo( new RivMeshLinesSourceInfo( m_pdmObject.p() ) ); model->addPart( part.p() ); } } } - if ( m_contourMapProjection->showContourLabels() ) + if ( showContourLabels ) { for ( auto labelDrawableRef : labelDrawables ) { @@ -180,7 +196,7 @@ void RivContourMapProjectionPartMgr::appendContourLinesToModel( const cvf::Camer part->setDrawable( labelDrawableRef.p() ); part->setEffect( m_labelEffect.p() ); part->setPriority( RivPartPriority::Text ); - part->setSourceInfo( new RivMeshLinesSourceInfo( m_contourMapProjection.p() ) ); + part->setSourceInfo( new RivMeshLinesSourceInfo( m_pdmObject.p() ) ); model->addPart( part.p() ); } } @@ -211,9 +227,12 @@ cvf::ref RivContourMapProjectionPartMgr::createTextLabel( con //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -cvf::ref RivContourMapProjectionPartMgr::createProjectionMapPart( const caf::DisplayCoordTransform* displayCoordTransform ) const +cvf::ref RivContourMapProjectionPartMgr::createProjectionMapPart( const caf::DisplayCoordTransform* displayCoordTransform, + const std::vector& vertices, + const RigContourMapGrid& contourMapGrid, + const cvf::Color3f& backgroundColor, + cvf::ScalarMapper* scalarMapper ) const { - const std::vector& vertices = m_contourMapTriangles; if ( vertices.size() < 3u ) { return cvf::ref(); @@ -223,7 +242,7 @@ cvf::ref RivContourMapProjectionPartMgr::createProjectionMapPart( con std::vector values( vertices.size() ); for ( uint i = 0; i < vertices.size(); ++i ) { - cvf::Vec3d globalVertex = cvf::Vec3d( vertices[i].x(), vertices[i].y(), vertices[i].z() ) + m_contourMapProjection->origin3d(); + cvf::Vec3d globalVertex = cvf::Vec3d( vertices[i].x(), vertices[i].y(), vertices[i].z() ) + contourMapGrid.origin3d(); cvf::Vec3f displayVertexPos( displayCoordTransform->transformToDisplayCoord( globalVertex ) ); ( *vertexArray )[i] = displayVertexPos; ( *faceList )[i] = i; @@ -240,18 +259,10 @@ cvf::ref RivContourMapProjectionPartMgr::createProjectionMapPart( con part->setName( "RivContourMapProjectionPartMgr::createProjectionMapPart" ); part->setDrawable( geo.p() ); - cvf::ScalarMapper* mapper = m_contourMapProjection->legendConfig()->scalarMapper(); + cvf::ref textureCoords = createTextureCoords( values, scalarMapper ); + RivScalarMapperUtils::applyTextureResultsToPart( part.p(), textureCoords.p(), scalarMapper, 1.0f, caf::FC_NONE, true, backgroundColor ); - cvf::ref textureCoords = createTextureCoords( values ); - RivScalarMapperUtils::applyTextureResultsToPart( part.p(), - textureCoords.p(), - mapper, - 1.0f, - caf::FC_NONE, - true, - m_parentContourMap->backgroundColor() ); - - part->setSourceInfo( new RivObjectSourceInfo( m_contourMapProjection.p() ) ); + part->setSourceInfo( new RivObjectSourceInfo( m_pdmObject.p() ) ); part->setPriority( RivPartPriority::BaseLevel ); return part; } @@ -261,41 +272,43 @@ cvf::ref RivContourMapProjectionPartMgr::createProjectionMapPart( con //-------------------------------------------------------------------------------------------------- std::vector>> RivContourMapProjectionPartMgr::createContourPolygons( const caf::DisplayCoordTransform* displayCoordTransform, - const std::vector>& labelBBoxes ) const + const std::vector>& labelBBoxes, + const std::vector& contourLinePolygons, + cvf::ScalarMapper* scalarMapper, + const RigContourMapGrid& contourMapGrid ) const { - const cvf::ScalarMapper* mapper = m_contourMapProjection->legendConfig()->scalarMapper(); - std::vector tickValues; - mapper->majorTickValues( &tickValues ); + std::vector tickValues; + scalarMapper->majorTickValues( &tickValues ); std::vector>> contourDrawablesForAllLevels; contourDrawablesForAllLevels.resize( tickValues.size() ); - for ( size_t i = 1; i < m_contourLinePolygons.size(); ++i ) + for ( size_t i = 1; i < contourLinePolygons.size(); ++i ) { std::vector> contourDrawables; - for ( size_t j = 0; j < m_contourLinePolygons[i].size(); ++j ) + for ( size_t j = 0; j < contourLinePolygons[i].size(); ++j ) { - if ( m_contourLinePolygons[i][j].vertices.empty() ) continue; + if ( contourLinePolygons[i][j].vertices.empty() ) continue; // cvf::String::number does not allow precision on 'g' formats, so use Qt. - QString qLabelText = QString::number( m_contourLinePolygons[i][j].value, 'g', 2 ); + QString qLabelText = QString::number( contourLinePolygons[i][j].value, 'g', 2 ); cvf::String labelText = cvfqt::Utils::toString( qLabelText ); - size_t nVertices = m_contourLinePolygons[i][j].vertices.size(); + size_t nVertices = contourLinePolygons[i][j].vertices.size(); std::vector displayLines; displayLines.reserve( nVertices * 2 ); for ( size_t v = 0; v < nVertices; ++v ) { - cvf::Vec3d globalVertex1 = m_contourLinePolygons[i][j].vertices[v] + m_contourMapProjection->origin3d(); + cvf::Vec3d globalVertex1 = contourLinePolygons[i][j].vertices[v] + contourMapGrid.origin3d(); cvf::Vec3d displayVertex1 = displayCoordTransform->transformToDisplayCoord( globalVertex1 ); cvf::Vec3d globalVertex2; if ( v < nVertices - 1 ) - globalVertex2 = m_contourLinePolygons[i][j].vertices[v + 1] + m_contourMapProjection->origin3d(); + globalVertex2 = contourLinePolygons[i][j].vertices[v + 1] + contourMapGrid.origin3d(); else - globalVertex2 = m_contourLinePolygons[i][j].vertices[0] + m_contourMapProjection->origin3d(); + globalVertex2 = contourLinePolygons[i][j].vertices[0] + contourMapGrid.origin3d(); cvf::Vec3d displayVertex2 = displayCoordTransform->transformToDisplayCoord( globalVertex2 ); @@ -390,41 +403,45 @@ std::vector>> /// //-------------------------------------------------------------------------------------------------- std::vector> - RivContourMapProjectionPartMgr::createContourLabels( const cvf::Camera* camera, - const caf::DisplayCoordTransform* displayCoordTransform, - std::vector>* labelBBoxes ) const + RivContourMapProjectionPartMgr::createContourLabels( const cvf::Camera* camera, + const caf::DisplayCoordTransform* displayCoordTransform, + std::vector>* labelBBoxes, + const std::vector& contourLinePolygons, + const RigContourMapGrid& contourMapGrid, + const cvf::ScalarMapper* scalarMapper, + RiaNumberFormat::NumberFormatType numberFormat, + int precision ) const { CVF_ASSERT( camera && displayCoordTransform && labelBBoxes ); std::vector> labelDrawables; labelBBoxes->clear(); - labelBBoxes->resize( m_contourLinePolygons.size() ); + labelBBoxes->resize( contourLinePolygons.size() ); if ( !camera->viewport() || camera->viewport()->width() == 0 ) return labelDrawables; - const cvf::ScalarMapper* mapper = m_contourMapProjection->legendConfig()->scalarMapper(); - if ( mapper == nullptr ) return labelDrawables; + if ( scalarMapper == nullptr ) return labelDrawables; - if ( dynamic_cast( mapper ) != nullptr ) return labelDrawables; + if ( dynamic_cast( scalarMapper ) != nullptr ) return labelDrawables; std::vector tickValues; - mapper->majorTickValues( &tickValues ); + scalarMapper->majorTickValues( &tickValues ); const RigContourPolygonsTools::ContourPolygons* previousLevel = nullptr; - for ( int64_t i = (int64_t)m_contourLinePolygons.size() - 1; i > 0; --i ) + for ( int64_t i = (int64_t)contourLinePolygons.size() - 1; i > 0; --i ) { - cvf::Color3f backgroundColor( mapper->mapToColor( tickValues[i] ) ); + cvf::Color3f backgroundColor( scalarMapper->mapToColor( tickValues[i] ) ); cvf::Color3f textColor = RiaColorTools::contrastColor( backgroundColor ); cvf::ref label = createTextLabel( textColor, backgroundColor ); - for ( size_t j = 0; j < m_contourLinePolygons[i].size(); ++j ) + for ( size_t j = 0; j < contourLinePolygons[i].size(); ++j ) { - if ( m_contourLinePolygons[i][j].vertices.empty() ) continue; + if ( contourLinePolygons[i][j].vertices.empty() ) continue; - QString qLabelText = m_contourMapProjection->legendConfig()->valueToText( m_contourLinePolygons[i][j].value ); + QString qLabelText = RiaNumberFormat::valueToText( contourLinePolygons[i][j].value, numberFormat, precision ); cvf::String labelText = cvfqt::Utils::toString( qLabelText ); - size_t nVertices = m_contourLinePolygons[i][j].vertices.size(); + size_t nVertices = contourLinePolygons[i][j].vertices.size(); size_t nLabels = nVertices; double distanceSinceLastLabel = std::numeric_limits::infinity(); for ( size_t l = 0; l < nLabels; ++l ) @@ -432,19 +449,19 @@ std::vector> size_t nVertex = ( nVertices * l ) / nLabels; size_t nextVertex = ( nVertex + 1 ) % nVertices; - const cvf::Vec3d& localVertex1 = m_contourLinePolygons[i][j].vertices[nVertex]; - const cvf::Vec3d& localVertex2 = m_contourLinePolygons[i][j].vertices[nextVertex]; + const cvf::Vec3d& localVertex1 = contourLinePolygons[i][j].vertices[nVertex]; + const cvf::Vec3d& localVertex2 = contourLinePolygons[i][j].vertices[nextVertex]; cvf::Vec3d lineCenter = ( localVertex1 + localVertex2 ) * 0.5; - double tolerance = 1.0e-2 * m_contourMapProjection->sampleSpacing(); + double tolerance = 1.0e-2 * contourMapGrid.sampleSpacing(); if ( previousLevel && lineOverlapsWithPreviousContourLevel( lineCenter, *previousLevel, tolerance ) ) { continue; } - cvf::Vec3d globalVertex1 = localVertex1 + m_contourMapProjection->origin3d(); - cvf::Vec3d globalVertex2 = localVertex2 + m_contourMapProjection->origin3d(); + cvf::Vec3d globalVertex1 = localVertex1 + contourMapGrid.origin3d(); + cvf::Vec3d globalVertex2 = localVertex2 + contourMapGrid.origin3d(); cvf::Vec3d globalVertex = 0.5 * ( globalVertex1 + globalVertex2 ); @@ -510,7 +527,7 @@ std::vector> labelDrawables.push_back( label ); } - previousLevel = &m_contourLinePolygons[i]; + previousLevel = &contourLinePolygons[i]; } return labelDrawables; } @@ -518,10 +535,12 @@ std::vector> //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -cvf::ref - RivContourMapProjectionPartMgr::createPickPointVisDrawable( const caf::DisplayCoordTransform* displayCoordTransform ) const +cvf::ref RivContourMapProjectionPartMgr::createPickPointVisDrawable( const caf::DisplayCoordTransform* displayCoordTransform, + const cvf::Vec2d& pickPoint, + const RigContourMapGrid& contourMapGrid ) const { - std::vector pickPointPolygon = m_contourMapProjection->generatePickPointPolygon(); + std::vector pickPointPolygon = RigContourPolygonsTools::generatePickPointPolygon( pickPoint, contourMapGrid ); + if ( pickPointPolygon.empty() ) { return nullptr; @@ -530,7 +549,7 @@ cvf::ref for ( size_t i = 0; i < pickPointPolygon.size(); ++i ) { - cvf::Vec3d globalPoint = pickPointPolygon[i] + m_contourMapProjection->origin3d(); + cvf::Vec3d globalPoint = pickPointPolygon[i] + contourMapGrid.origin3d(); cvf::Vec3f displayPoint( displayCoordTransform->transformToDisplayCoord( globalPoint ) ); ( *vertexArray )[i] = displayPoint; } diff --git a/ApplicationLibCode/ModelVisualization/RivContourMapProjectionPartMgr.h b/ApplicationLibCode/ModelVisualization/RivContourMapProjectionPartMgr.h index fe5c45b76e..237bd3d410 100644 --- a/ApplicationLibCode/ModelVisualization/RivContourMapProjectionPartMgr.h +++ b/ApplicationLibCode/ModelVisualization/RivContourMapProjectionPartMgr.h @@ -18,57 +18,96 @@ #pragma once -#include "RimContourMapProjection.h" +#include "RigContourPolygonsTools.h" + +#include "RiaNumberFormat.h" #include "cafDisplayCoordTransform.h" +#include "cafPdmObject.h" #include "cafPdmPointer.h" #include "cvfDrawableGeo.h" #include "cvfDrawableText.h" -#include "cvfModelBasicList.h" #include "cvfObject.h" +#include "cvfVector2.h" #include "cvfVector4.h" -class RimEclipseContourMapView; +class RigContourMapGrid; namespace cvf { class Effect; -} +class ScalarMapper; +class Color3f; +class ModelBasicList; +class Part; +} // namespace cvf class RivContourMapProjectionPartMgr : public cvf::Object { public: - RivContourMapProjectionPartMgr( RimContourMapProjection* contourMapProjection, RimGridView* contourMap ); + RivContourMapProjectionPartMgr( caf::PdmObject* contourMapProjection ); - void createProjectionGeometry(); - void appendProjectionToModel( cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayCoordTransform ) const; - void appendContourLinesToModel( const cvf::Camera* camera, - cvf::ModelBasicList* model, - const caf::DisplayCoordTransform* displayCoordTransform ); - void appendPickPointVisToModel( cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayCoordTransform ) const; + void appendProjectionToModel( cvf::ModelBasicList* model, + const caf::DisplayCoordTransform* displayCoordTransform, + const std::vector& vertices, + const RigContourMapGrid& contourMapGrid, + const cvf::Color3f& backgroundColor, + cvf::ScalarMapper* scalarMapper ) const; - cvf::ref createTextureCoords( const std::vector& values ) const; + void appendContourLinesToModel( const cvf::Camera* camera, + cvf::ModelBasicList* model, + const caf::DisplayCoordTransform* displayCoordTransform, + const std::vector& contourLinePolygons, + const RigContourMapGrid& contourMapGrid, + cvf::ScalarMapper* mapper, + bool showContourLines, + bool showContourLabels, + RiaNumberFormat::NumberFormatType numberFormat, + int precision ); + + void appendPickPointVisToModel( cvf::ModelBasicList* model, + const caf::DisplayCoordTransform* displayCoordTransform, + const cvf::Vec2d& pickPoint, + const RigContourMapGrid& contourMapGrid ) const; + + cvf::ref createTextureCoords( const std::vector& values, cvf::ScalarMapper* scalarMapper ) const; private: static cvf::ref createTextLabel( const cvf::Color3f& textColor, const cvf::Color3f& backgroundColor ); - cvf::ref createProjectionMapPart( const caf::DisplayCoordTransform* displayCoordTransform ) const; - std::vector>> createContourPolygons( const caf::DisplayCoordTransform* displayCoordTransform, - const std::vector>& labelBBoxes ) const; - std::vector> createContourLabels( const cvf::Camera* camera, - const caf::DisplayCoordTransform* displayCoordTransform, - std::vector>* labelBBoxes ) const; - cvf::ref createPickPointVisDrawable( const caf::DisplayCoordTransform* displayCoordTransform ) const; - static bool lineOverlapsWithPreviousContourLevel( const cvf::Vec3d& lineCenter, - const RimContourMapProjection::ContourPolygons& previousLevel, - double tolerance ); + cvf::ref createProjectionMapPart( const caf::DisplayCoordTransform* displayCoordTransform, + const std::vector& vertices, + const RigContourMapGrid& contourMapGrid, + const cvf::Color3f& backgroundColor, + cvf::ScalarMapper* scalarMapper ) const; + + std::vector>> + createContourPolygons( const caf::DisplayCoordTransform* displayCoordTransform, + const std::vector>& labelBBoxes, + const std::vector& contourLinePolygons, + cvf::ScalarMapper* scalarMapper, + const RigContourMapGrid& contourMapGrid ) const; + + std::vector> createContourLabels( const cvf::Camera* camera, + const caf::DisplayCoordTransform* displayCoordTransform, + std::vector>* labelBBoxes, + const std::vector& contourLinePolygons, + const RigContourMapGrid& contourMapGrid, + const cvf::ScalarMapper* scalarMapper, + RiaNumberFormat::NumberFormatType numberFormat, + int precision ) const; + + cvf::ref createPickPointVisDrawable( const caf::DisplayCoordTransform* displayCoordTransform, + const cvf::Vec2d& pickPoint, + const RigContourMapGrid& contourMapGrid ) const; + + static bool lineOverlapsWithPreviousContourLevel( const cvf::Vec3d& lineCenter, + const RigContourPolygonsTools::ContourPolygons& previousLevel, + double tolerance ); private: - caf::PdmPointer m_contourMapProjection; - caf::PdmPointer m_parentContourMap; + caf::PdmPointer m_pdmObject; - std::vector m_contourLinePolygons; - std::vector m_contourMapTriangles; - std::vector> m_labelBoundingBoxes; - cvf::ref m_labelEffect; + std::vector> m_labelBoundingBoxes; + cvf::ref m_labelEffect; }; diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapView.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapView.cpp index d7eaf4b47f..dc550251c6 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapView.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapView.cpp @@ -67,7 +67,7 @@ RimGeoMechContourMapView::RimGeoMechContourMapView() setDefaultCustomName(); - m_contourMapProjectionPartMgr = new RivContourMapProjectionPartMgr( contourMapProjection(), this ); + m_contourMapProjectionPartMgr = new RivContourMapProjectionPartMgr( contourMapProjection() ); ( (RiuViewerToViewInterface*)this )->setCameraPosition( sm_defaultViewMatrix ); @@ -283,7 +283,7 @@ void RimGeoMechContourMapView::createContourMapGeometry() { if ( nativeOrOverrideViewer() && m_contourMapProjection->isChecked() ) { - m_contourMapProjectionPartMgr->createProjectionGeometry(); + m_contourMapProjection->generateGeometryIfNecessary(); } } @@ -305,7 +305,13 @@ void RimGeoMechContourMapView::appendContourMapProjectionToModel() cvf::ref transForm = displayCoordTransform(); - m_contourMapProjectionPartMgr->appendProjectionToModel( contourMapProjectionModelBasicList.p(), transForm.p() ); + m_contourMapProjectionPartMgr->appendProjectionToModel( contourMapProjectionModelBasicList.p(), + transForm.p(), + m_contourMapProjection->trianglesWithVertexValues(), + *m_contourMapProjection->mapGrid(), + backgroundColor(), + m_contourMapProjection->legendConfig()->scalarMapper() ); + contourMapProjectionModelBasicList->updateBoundingBoxesRecursive(); frameScene->addModel( contourMapProjectionModelBasicList.p() ); } @@ -330,7 +336,17 @@ void RimGeoMechContourMapView::appendContourLinesToModel() cvf::ref transForm = displayCoordTransform(); - m_contourMapProjectionPartMgr->appendContourLinesToModel( viewer()->mainCamera(), contourMapLabelModelBasicList.p(), transForm.p() ); + m_contourMapProjectionPartMgr->appendContourLinesToModel( viewer()->mainCamera(), + contourMapLabelModelBasicList.p(), + transForm.p(), + m_contourMapProjection->contourPolygons(), + *m_contourMapProjection->mapGrid(), + m_contourMapProjection->legendConfig()->scalarMapper(), + m_contourMapProjection->showContourLines(), + m_contourMapProjection->showContourLabels(), + m_contourMapProjection->legendConfig()->tickNumberFormat(), + m_contourMapProjection->legendConfig()->significantDigitsInData() ); + contourMapLabelModelBasicList->updateBoundingBoxesRecursive(); frameScene->addModel( contourMapLabelModelBasicList.p() ); } @@ -355,7 +371,11 @@ void RimGeoMechContourMapView::appendPickPointVisToModel() cvf::ref transForm = displayCoordTransform(); - m_contourMapProjectionPartMgr->appendPickPointVisToModel( contourMapProjectionModelBasicList.p(), transForm.p() ); + m_contourMapProjectionPartMgr->appendPickPointVisToModel( contourMapProjectionModelBasicList.p(), + transForm.p(), + m_contourMapProjection->pickPoint(), + *m_contourMapProjection->mapGrid() ); + contourMapProjectionModelBasicList->updateBoundingBoxesRecursive(); frameScene->addModel( contourMapProjectionModelBasicList.p() ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp index ba77b919f7..acf64a369d 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp @@ -188,37 +188,6 @@ void RimContourMapProjection::generateGeometryIfNecessary() progress.setProgress( 100 ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector RimContourMapProjection::generatePickPointPolygon() -{ - std::vector points; - - if ( !m_pickPoint.isUndefined() ) - { -#ifndef NDEBUG - cvf::Vec2d cellDiagonal( sampleSpacing() * 0.5, sampleSpacing() * 0.5 ); - cvf::Vec2ui pickedCell = m_contourMapGrid->ijFromLocalPos( m_pickPoint ); - cvf::Vec2d cellCenter = m_contourMapGrid->cellCenterPosition( pickedCell.x(), pickedCell.y() ); - cvf::Vec2d cellCorner = cellCenter - cellDiagonal; - points.push_back( cvf::Vec3d( cellCorner, 0.0 ) ); - points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( sampleSpacing(), 0.0 ), 0.0 ) ); - points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( sampleSpacing(), 0.0 ), 0.0 ) ); - points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( sampleSpacing(), sampleSpacing() ), 0.0 ) ); - points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( sampleSpacing(), sampleSpacing() ), 0.0 ) ); - points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( 0.0, sampleSpacing() ), 0.0 ) ); - points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( 0.0, sampleSpacing() ), 0.0 ) ); - points.push_back( cvf::Vec3d( cellCorner, 0.0 ) ); -#endif - points.push_back( cvf::Vec3d( m_pickPoint - cvf::Vec2d( 0.5 * sampleSpacing(), 0.0 ), 0.0 ) ); - points.push_back( cvf::Vec3d( m_pickPoint + cvf::Vec2d( 0.5 * sampleSpacing(), 0.0 ), 0.0 ) ); - points.push_back( cvf::Vec3d( m_pickPoint - cvf::Vec2d( 0.0, 0.5 * sampleSpacing() ), 0.0 ) ); - points.push_back( cvf::Vec3d( m_pickPoint + cvf::Vec2d( 0.0, 0.5 * sampleSpacing() ), 0.0 ) ); - } - return points; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -314,6 +283,14 @@ const RigContourMapProjection* RimContourMapProjection::mapProjection() const return m_contourMapProjection.get(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const RigContourMapGrid* RimContourMapProjection::mapGrid() const +{ + return m_contourMapGrid.get(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -330,12 +307,20 @@ void RimContourMapProjection::setPickPoint( cvf::Vec2d globalPickPoint ) m_pickPoint = globalPickPoint - m_contourMapGrid->origin2d(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::Vec2d RimContourMapProjection::pickPoint() const +{ + return m_pickPoint; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- cvf::Vec3d RimContourMapProjection::origin3d() const { - return m_contourMapGrid->expandedBoundingBox().min(); + return m_contourMapGrid->origin3d(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h index b11ee72035..551983515f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h +++ b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h @@ -53,8 +53,6 @@ public: void generateGeometryIfNecessary(); void clearGeometry(); - std::vector generatePickPointPolygon(); - const std::vector& contourPolygons() const; const std::vector& trianglesWithVertexValues(); @@ -75,6 +73,8 @@ public: bool isStraightSummationResult() const; void setPickPoint( cvf::Vec2d globalPickPoint ); + cvf::Vec2d pickPoint() const; + cvf::Vec3d origin3d() const; // Pure-virtual public methods which should be overridden by Eclipse and Geo-mechanical contour map implementations @@ -90,6 +90,7 @@ public: virtual cvf::ref getCellVisibility() const; const RigContourMapProjection* mapProjection() const; + const RigContourMapGrid* mapGrid() const; protected: // Protected virtual methods to be overridden by Eclipse and Geo-mechanical contour map implementations diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapView.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapView.cpp index abab36c1e7..5604bb9602 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapView.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapView.cpp @@ -77,7 +77,7 @@ RimEclipseContourMapView::RimEclipseContourMapView() setDefaultCustomName(); - m_contourMapProjectionPartMgr = new RivContourMapProjectionPartMgr( contourMapProjection(), this ); + m_contourMapProjectionPartMgr = new RivContourMapProjectionPartMgr( contourMapProjection() ); setCameraPosition( sm_defaultViewMatrix ); @@ -314,7 +314,7 @@ void RimEclipseContourMapView::createContourMapGeometry() { if ( nativeOrOverrideViewer() && m_contourMapProjection->isChecked() ) { - m_contourMapProjectionPartMgr->createProjectionGeometry(); + m_contourMapProjection->generateGeometryIfNecessary(); } } @@ -336,7 +336,13 @@ void RimEclipseContourMapView::appendContourMapProjectionToModel() cvf::ref transForm = displayCoordTransform(); - m_contourMapProjectionPartMgr->appendProjectionToModel( contourMapProjectionModelBasicList.p(), transForm.p() ); + m_contourMapProjectionPartMgr->appendProjectionToModel( contourMapProjectionModelBasicList.p(), + transForm.p(), + m_contourMapProjection->trianglesWithVertexValues(), + *m_contourMapProjection->mapGrid(), + backgroundColor(), + m_contourMapProjection->legendConfig()->scalarMapper() ); + contourMapProjectionModelBasicList->updateBoundingBoxesRecursive(); frameScene->addModel( contourMapProjectionModelBasicList.p() ); } @@ -361,7 +367,17 @@ void RimEclipseContourMapView::appendContourLinesToModel() cvf::ref transForm = displayCoordTransform(); - m_contourMapProjectionPartMgr->appendContourLinesToModel( viewer()->mainCamera(), contourMapLabelModelBasicList.p(), transForm.p() ); + m_contourMapProjectionPartMgr->appendContourLinesToModel( viewer()->mainCamera(), + contourMapLabelModelBasicList.p(), + transForm.p(), + m_contourMapProjection->contourPolygons(), + *m_contourMapProjection->mapGrid(), + m_contourMapProjection->legendConfig()->scalarMapper(), + m_contourMapProjection->showContourLines(), + m_contourMapProjection->showContourLabels(), + m_contourMapProjection->legendConfig()->tickNumberFormat(), + m_contourMapProjection->legendConfig()->significantDigitsInData() ); + contourMapLabelModelBasicList->updateBoundingBoxesRecursive(); frameScene->addModel( contourMapLabelModelBasicList.p() ); } @@ -386,7 +402,10 @@ void RimEclipseContourMapView::appendPickPointVisToModel() cvf::ref transForm = displayCoordTransform(); - m_contourMapProjectionPartMgr->appendPickPointVisToModel( contourMapProjectionModelBasicList.p(), transForm.p() ); + m_contourMapProjectionPartMgr->appendPickPointVisToModel( contourMapProjectionModelBasicList.p(), + transForm.p(), + m_contourMapProjection->pickPoint(), + *m_contourMapProjection->mapGrid() ); contourMapProjectionModelBasicList->updateBoundingBoxesRecursive(); frameScene->addModel( contourMapProjectionModelBasicList.p() ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp b/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp index 32e799bb2c..38a42dc942 100644 --- a/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp @@ -1161,6 +1161,22 @@ QString RimRegularLegendConfig::valueToText( double value ) const return RiaNumberFormat::valueToText( value, m_tickNumberFormat(), m_significantDigitsInData ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaNumberFormat::NumberFormatType RimRegularLegendConfig::tickNumberFormat() const +{ + return m_tickNumberFormat(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RimRegularLegendConfig::significantDigitsInData() const +{ + return m_significantDigitsInData; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.h b/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.h index 78a9ed5307..37a07eae3e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.h +++ b/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.h @@ -127,10 +127,16 @@ public: RimColorLegend* colorLegend() const; void setMappingMode( MappingType mappingType ); MappingType mappingMode() { return m_mappingMode(); } - void setTickNumberFormat( RiaNumberFormat::NumberFormatType numberFormat ); - void resetUserDefinedValues(); - void setCenterLegendAroundZero( bool enable ); - void setUserDefinedRange( double minVal, double maxVal ); + + void setTickNumberFormat( RiaNumberFormat::NumberFormatType numberFormat ); + + RiaNumberFormat::NumberFormatType tickNumberFormat() const; + + int significantDigitsInData() const; + + void resetUserDefinedValues(); + void setCenterLegendAroundZero( bool enable ); + void setUserDefinedRange( double minVal, double maxVal ); void disableAllTimeStepsRange( bool doDisable ); diff --git a/ApplicationLibCode/ReservoirDataModel/RigContourPolygonsTools.cpp b/ApplicationLibCode/ReservoirDataModel/RigContourPolygonsTools.cpp index e859c873d7..518b8dc391 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigContourPolygonsTools.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigContourPolygonsTools.cpp @@ -19,13 +19,12 @@ #include "RigContourPolygonsTools.h" #include "RigCellGeometryTools.h" +#include "RigContourMapGrid.h" #include "cafContourLines.h" #include "cvfGeometryTools.h" -#include - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -186,3 +185,35 @@ bool RigContourPolygonsTools::lineOverlapsWithContourPolygons( const cvf::Vec3d& } return false; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigContourPolygonsTools::generatePickPointPolygon( const cvf::Vec2d& pickPoint, const RigContourMapGrid& contourMapGrid ) +{ + std::vector points; + + if ( !pickPoint.isUndefined() ) + { + double sampleSpacing = contourMapGrid.sampleSpacing(); +#ifndef NDEBUG + cvf::Vec2d cellDiagonal( sampleSpacing * 0.5, sampleSpacing * 0.5 ); + cvf::Vec2ui pickedCell = contourMapGrid.ijFromLocalPos( pickPoint ); + cvf::Vec2d cellCenter = contourMapGrid.cellCenterPosition( pickedCell.x(), pickedCell.y() ); + cvf::Vec2d cellCorner = cellCenter - cellDiagonal; + points.push_back( cvf::Vec3d( cellCorner, 0.0 ) ); + points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( sampleSpacing, 0.0 ), 0.0 ) ); + points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( sampleSpacing, 0.0 ), 0.0 ) ); + points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( sampleSpacing, sampleSpacing ), 0.0 ) ); + points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( sampleSpacing, sampleSpacing ), 0.0 ) ); + points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( 0.0, sampleSpacing ), 0.0 ) ); + points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( 0.0, sampleSpacing ), 0.0 ) ); + points.push_back( cvf::Vec3d( cellCorner, 0.0 ) ); +#endif + points.push_back( cvf::Vec3d( pickPoint - cvf::Vec2d( 0.5 * sampleSpacing, 0.0 ), 0.0 ) ); + points.push_back( cvf::Vec3d( pickPoint + cvf::Vec2d( 0.5 * sampleSpacing, 0.0 ), 0.0 ) ); + points.push_back( cvf::Vec3d( pickPoint - cvf::Vec2d( 0.0, 0.5 * sampleSpacing ), 0.0 ) ); + points.push_back( cvf::Vec3d( pickPoint + cvf::Vec2d( 0.0, 0.5 * sampleSpacing ), 0.0 ) ); + } + return points; +} diff --git a/ApplicationLibCode/ReservoirDataModel/RigContourPolygonsTools.h b/ApplicationLibCode/ReservoirDataModel/RigContourPolygonsTools.h index c767dcd47a..654bcc6df5 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigContourPolygonsTools.h +++ b/ApplicationLibCode/ReservoirDataModel/RigContourPolygonsTools.h @@ -23,8 +23,6 @@ #include "cvfBoundingBox.h" class RigContourMapGrid; -class RimGridView; -class RimRegularLegendConfig; //================================================================================================== /// @@ -50,4 +48,6 @@ public: static void clipContourPolygons( ContourPolygons& contourPolygons, const ContourPolygons& clipBy ); static double sumPolygonArea( const ContourPolygons& contourPolygons ); static bool lineOverlapsWithContourPolygons( const cvf::Vec3d& lineCenter, const ContourPolygons& contourPolygons, double tolerance ); + + static std::vector generatePickPointPolygon( const cvf::Vec2d& pickPoint, const RigContourMapGrid& contourMapGrid ); }; From 065528ffba9ff5dff315d6f1a306bafb37b24aad Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 21 Nov 2024 12:01:46 +0100 Subject: [PATCH 127/160] #11909 Add null pointer guards when detecting unit system --- .../WellPath/RimWellPathCollection.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp index d7c66afdfd..78a2bc5326 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp @@ -808,6 +808,8 @@ void RimWellPathCollection::sortWellsByName() //-------------------------------------------------------------------------------------------------- caf::AppEnum RimWellPathCollection::findUnitSystemForWellPath( const RimWellPath* wellPath ) { + if ( !wellPath || !wellPath->wellPathGeometry() ) return RiaDefines::EclipseUnitSystem::UNITS_UNKNOWN; + RimProject* project = RimProject::current(); if ( project->activeOilField()->analysisModels->cases.empty() ) { @@ -815,8 +817,13 @@ caf::AppEnum RimWellPathCollection::findUnitSyste } const RigEclipseCaseData* eclipseCaseData = project->activeOilField()->analysisModels->cases()[0]->eclipseCaseData(); - cvf::BoundingBox caseBoundingBox = eclipseCaseData->mainGrid()->boundingBox(); - cvf::BoundingBox wellPathBoundingBox; + if ( !eclipseCaseData || !eclipseCaseData->mainGrid() ) + { + return RiaDefines::EclipseUnitSystem::UNITS_UNKNOWN; + } + + cvf::BoundingBox caseBoundingBox = eclipseCaseData->mainGrid()->boundingBox(); + cvf::BoundingBox wellPathBoundingBox; for ( const auto& wellPathPoint : wellPath->wellPathGeometry()->wellPathPoints() ) { wellPathBoundingBox.add( wellPathPoint ); From f716b4e9641d2a310c91da5a46d5eb150226986b Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Thu, 21 Nov 2024 12:42:13 +0100 Subject: [PATCH 128/160] Support multiple timesteps per day using opm_common reader (#11908) * Fix progress window hiding time step filter dlg * Clean up reader preferences --- .../Application/RiaPreferencesGrid.cpp | 19 +++-- .../RifEclipseOutputFileTools.cpp | 1 - .../FileInterface/RifReaderOpmCommon.cpp | 49 ++++++++++-- .../FileInterface/RifReaderOpmCommon.h | 3 + .../ProjectDataModel/RimEclipseResultCase.cpp | 78 ++++++++++--------- 5 files changed, 95 insertions(+), 55 deletions(-) diff --git a/ApplicationLibCode/Application/RiaPreferencesGrid.cpp b/ApplicationLibCode/Application/RiaPreferencesGrid.cpp index a075cc8bfb..a961af4c84 100644 --- a/ApplicationLibCode/Application/RiaPreferencesGrid.cpp +++ b/ApplicationLibCode/Application/RiaPreferencesGrid.cpp @@ -89,7 +89,7 @@ RiaPreferencesGrid::RiaPreferencesGrid() CAF_PDM_InitField( &m_loadAndShowSoil, "loadAndShowSoil", true, "Load and Show SOIL" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_loadAndShowSoil ); - CAF_PDM_InitField( &m_onlyLoadActiveCells, "onlyLoadActiveCells", false, "Only Load Active Cell Geometry (Experimental)" ); + CAF_PDM_InitField( &m_onlyLoadActiveCells, "onlyLoadActiveCells", false, "Only Load Active Cell Geometry" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_onlyLoadActiveCells ); CAF_PDM_InitField( &m_invalidateLongThinCells, "invalidateLongThinCells", false, "Skip Long, Thin Cells" ); @@ -128,17 +128,20 @@ void RiaPreferencesGrid::appendItems( caf::PdmUiOrdering& uiOrdering ) wellGrp->add( &m_skipWellData ); wellGrp->add( &m_importAdvancedMswData ); + auto egridGrp = uiOrdering.addNewGroup( "EGRID Settings" ); + if ( m_gridModelReaderOverride == RiaDefines::GridModelReader::NOT_SET ) { - auto egridGrp = uiOrdering.addNewGroup( "EGRID Settings" ); egridGrp->add( &m_gridModelReader ); } - - auto resdataGrp = uiOrdering.addNewGroup( "ResData Reader Settings" ); - resdataGrp->add( &m_useResultIndexFile ); - - auto opmcGrp = uiOrdering.addNewGroup( "OPM Common Reader Settings" ); - opmcGrp->add( &m_onlyLoadActiveCells ); + if ( gridModelReader() == RiaDefines::GridModelReader::OPM_COMMON ) + { + egridGrp->add( &m_onlyLoadActiveCells ); + } + if ( gridModelReader() == RiaDefines::GridModelReader::RESDATA ) + { + egridGrp->add( &m_useResultIndexFile ); + } const bool setFaultImportSettingsReadOnly = !importFaults(); diff --git a/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp b/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp index f7af8534ae..846b5b0fdb 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp @@ -45,7 +45,6 @@ #include "cvfMath.h" #include -#include #include #include diff --git a/ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp b/ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp index dc9c5f5443..17798d1551 100644 --- a/ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp @@ -763,21 +763,54 @@ std::vector RifReaderOpmCommon::createFilteredTimeStepIn auto timeStepsOnFile = readTimeSteps(); + if ( timeStepsOnFile.size() == 0 ) return timeStepInfos; + + auto startDayOffset = timeStepsOnFile[0].simulationTimeFromStart; + QDate startDate( timeStepsOnFile[0].year, timeStepsOnFile[0].month, timeStepsOnFile[0].day ); + for ( size_t i = 0; i < timeStepsOnFile.size(); i++ ) { if ( isTimeStepIncludedByFilter( i ) ) { - QDate date( timeStepsOnFile[i].year, timeStepsOnFile[i].month, timeStepsOnFile[i].day ); - auto datetime = RiaQDateTimeTools::createDateTime( date, Qt::TimeSpec::UTC ); + auto dateTime = dateTimeFromTimeStepOnFile( timeStepsOnFile[i], startDate, startDayOffset ); timeStepInfos.push_back( - RigEclipseTimeStepInfo( datetime, timeStepsOnFile[i].sequenceNumber, timeStepsOnFile[i].simulationTimeFromStart ) ); + RigEclipseTimeStepInfo( dateTime, timeStepsOnFile[i].sequenceNumber, timeStepsOnFile[i].simulationTimeFromStart ) ); } } return timeStepInfos; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QDateTime RifReaderOpmCommon::dateTimeFromTimeStepOnFile( RifReaderOpmCommon::TimeDataFile timeOnFile, QDate startDate, double startDayOffset ) +{ + QDateTime dateTime; + if ( timeOnFile.simulationTimeFromStart == 0 ) + { + QDate date( timeOnFile.year, timeOnFile.month, timeOnFile.day ); + dateTime = RiaQDateTimeTools::createDateTime( date, Qt::TimeSpec::UTC ); + } + else + { + dateTime = RiaQDateTimeTools::createDateTime( startDate, Qt::TimeSpec::UTC ); + + double dayDoubleValue = timeOnFile.simulationTimeFromStart; + int dayValue = cvf::Math::floor( dayDoubleValue ); + const int adjustedDayValue = dayValue - startDayOffset; + dateTime = dateTime.addDays( adjustedDayValue ); + + double dayFraction = dayDoubleValue - dayValue; + double milliseconds = dayFraction * 24.0 * 60.0 * 60.0 * 1000.0; + + dateTime = dateTime.addMSecs( milliseconds ); + } + + return dateTime; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -785,7 +818,6 @@ void RifReaderOpmCommon::buildMetaData( RigEclipseCaseData* eclipseCaseData, caf { setupInitAndRestartAccess(); - std::vector timeSteps; std::vector filteredTimeStepInfos; RigEclipseTimeStepInfo firstTimeStepInfo{ QDateTime(), 0, 0.0 }; @@ -984,14 +1016,15 @@ std::vector RifReaderOpmCommon::timeStepsOnFile( QString gridFileName if ( m_restartFile == nullptr ) return {}; - auto timeStepsFromFile = readTimeSteps(); + auto timeStepsOnFile = readTimeSteps(); + auto startDayOffset = timeStepsOnFile[0].simulationTimeFromStart; + QDate startDate( timeStepsOnFile[0].year, timeStepsOnFile[0].month, timeStepsOnFile[0].day ); std::vector dateTimes; - for ( const auto& timeStep : timeStepsFromFile ) + for ( const auto& timeStep : timeStepsOnFile ) { - QDate date( timeStep.year, timeStep.month, timeStep.day ); - QDateTime dateTime = RiaQDateTimeTools::createDateTime( date, Qt::UTC ); + auto dateTime = dateTimeFromTimeStepOnFile( timeStep, startDate, startDayOffset ); dateTimes.push_back( dateTime ); } diff --git a/ApplicationLibCode/FileInterface/RifReaderOpmCommon.h b/ApplicationLibCode/FileInterface/RifReaderOpmCommon.h index c33554d95d..0ae25b7871 100644 --- a/ApplicationLibCode/FileInterface/RifReaderOpmCommon.h +++ b/ApplicationLibCode/FileInterface/RifReaderOpmCommon.h @@ -24,6 +24,8 @@ #include #include +#include + namespace Opm::EclIO { class EInit; @@ -101,6 +103,7 @@ private: }; std::vector readTimeSteps(); + QDateTime dateTimeFromTimeStepOnFile( RifReaderOpmCommon::TimeDataFile timeOnFile, QDate startDate, double startDayOffset ); protected: enum class ActiveType diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp index 07fba987c2..b7290e796a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp @@ -142,11 +142,6 @@ bool RimEclipseResultCase::importGridAndResultMetaData( bool showTimeStepFilter // dialog triggers a redraw with incomplete geometry data and causes a crash if ( m_gridAndWellDataIsReadFromFile ) return true; - caf::ProgressInfo progInfo( 50, "Reading Eclipse Grid File" ); - - progInfo.setProgressDescription( "Open Grid File" ); - progInfo.setNextProgressIncrement( 48 ); - cvf::ref readerInterface; if ( gridFileName().contains( "Result Mock Debug Model" ) ) @@ -213,6 +208,11 @@ bool RimEclipseResultCase::importGridAndResultMetaData( bool showTimeStepFilter readerInterface->setTimeStepFilter( m_timeStepFilter->filteredTimeSteps() ); } + // delay showing progress until we get here, to not have progress show up on top of time step selection + caf::ProgressInfo progInfo( 50, "Reading Eclipse Grid File" ); + progInfo.setProgressDescription( "Open Grid File" ); + progInfo.setNextProgressIncrement( 48 ); + readerInterface->setFilenamesWithFaults( filesContainingFaults() ); readerInterface->setReaderSettings( m_readerSettings ); @@ -230,41 +230,43 @@ bool RimEclipseResultCase::importGridAndResultMetaData( bool showTimeStepFilter results( RiaDefines::PorosityModelType::MATRIX_MODEL )->setReaderInterface( readerInterface.p() ); results( RiaDefines::PorosityModelType::FRACTURE_MODEL )->setReaderInterface( readerInterface.p() ); - progInfo.incrementProgress(); - - m_flowDagSolverInterface = new RigFlowDiagSolverInterface( this ); - - CVF_ASSERT( eclipseCaseData() ); - CVF_ASSERT( readerInterface.notNull() ); - - progInfo.setProgressDescription( "Computing Case Cache" ); - computeCachedData(); - loadAndSynchronizeInputProperties( false ); - - m_gridAndWellDataIsReadFromFile = true; - m_activeCellInfoIsReadFromFile = true; - - ensureRftDataIsImported(); - - if ( m_flowDiagSolutions.empty() ) { - m_flowDiagSolutions.push_back( new RimFlowDiagSolution() ); + caf::ProgressInfo progInfo( 50, "Reading Eclipse Grid File", false /*do not delay*/ ); + progInfo.setNextProgressIncrement( 49 ); + + m_flowDagSolverInterface = new RigFlowDiagSolverInterface( this ); + + CVF_ASSERT( eclipseCaseData() ); + CVF_ASSERT( readerInterface.notNull() ); + + progInfo.setProgressDescription( "Computing Case Cache" ); + computeCachedData(); + loadAndSynchronizeInputProperties( false ); + + m_gridAndWellDataIsReadFromFile = true; + m_activeCellInfoIsReadFromFile = true; + + ensureRftDataIsImported(); + + if ( m_flowDiagSolutions.empty() ) + { + m_flowDiagSolutions.push_back( new RimFlowDiagSolution() ); + } + + if ( !m_sourSimFileName().path().isEmpty() ) + { + auto* outReader = dynamic_cast( readerInterface.p() ); + outReader->setHdf5FileName( m_sourSimFileName().path() ); + } + + if ( RiaPreferencesGrid::current()->autoComputeDepthRelatedProperties() ) + { + results( RiaDefines::PorosityModelType::MATRIX_MODEL )->computeDepthRelatedResults(); + results( RiaDefines::PorosityModelType::FRACTURE_MODEL )->computeDepthRelatedResults(); + } + + results( RiaDefines::PorosityModelType::MATRIX_MODEL )->computeCellVolumes(); } - - if ( !m_sourSimFileName().path().isEmpty() ) - { - auto* outReader = dynamic_cast( readerInterface.p() ); - outReader->setHdf5FileName( m_sourSimFileName().path() ); - } - - if ( RiaPreferencesGrid::current()->autoComputeDepthRelatedProperties() ) - { - results( RiaDefines::PorosityModelType::MATRIX_MODEL )->computeDepthRelatedResults(); - results( RiaDefines::PorosityModelType::FRACTURE_MODEL )->computeDepthRelatedResults(); - } - - results( RiaDefines::PorosityModelType::MATRIX_MODEL )->computeCellVolumes(); - return true; } From 5fa572266f885fafe363270b4107c507990e83bf Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Thu, 21 Nov 2024 12:57:50 +0100 Subject: [PATCH 129/160] Fix missing size check. --- ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp b/ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp index 17798d1551..fe9a91387a 100644 --- a/ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp @@ -1016,8 +1016,10 @@ std::vector RifReaderOpmCommon::timeStepsOnFile( QString gridFileName if ( m_restartFile == nullptr ) return {}; - auto timeStepsOnFile = readTimeSteps(); - auto startDayOffset = timeStepsOnFile[0].simulationTimeFromStart; + auto timeStepsOnFile = readTimeSteps(); + if ( timeStepsOnFile.size() == 0 ) return {}; + + auto startDayOffset = timeStepsOnFile[0].simulationTimeFromStart; QDate startDate( timeStepsOnFile[0].year, timeStepsOnFile[0].month, timeStepsOnFile[0].day ); std::vector dateTimes; From 3cc2958384aa585b8d588803242dec786ec34e0c Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 21 Nov 2024 14:38:59 +0100 Subject: [PATCH 130/160] Summary Table: Add user option to set time range on x-axis * Make sure all evenly distributed labels are drawn * Add start and end data --- .../Summary/RimSummaryTable.cpp | 110 +++++++++++++++++- .../Summary/RimSummaryTable.h | 7 +- .../UserInterface/RiuMatrixPlotWidget.cpp | 5 +- 3 files changed, 115 insertions(+), 7 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTable.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTable.cpp index f7953de22d..4e9ce633e0 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTable.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTable.cpp @@ -22,6 +22,7 @@ #include "RiaQDateTimeTools.h" #include "RiaStdStringTools.h" #include "RiaTimeHistoryCurveResampler.h" +#include "RiaTimeTTools.h" #include "Summary/RiaSummaryTools.h" #include "RifSummaryReaderInterface.h" @@ -35,6 +36,7 @@ #include "RiuMatrixPlotWidget.h" #include "cafPdmUiComboBoxEditor.h" +#include "cafPdmUiDateEditor.h" #include "cafPdmUiPushButtonEditor.h" #include "cafPdmUiToolButtonEditor.h" #include "cafPdmUiTreeSelectionEditor.h" @@ -105,6 +107,10 @@ RimSummaryTable::RimSummaryTable() CAF_PDM_InitFieldNoDefault( &m_mappingType, "MappingType", "Mapping Type" ); CAF_PDM_InitFieldNoDefault( &m_rangeType, "RangeType", "Range Type" ); + CAF_PDM_InitField( &m_filterTimeSteps, "FilterTimeSteps", false, "Filter Time Steps" ); + CAF_PDM_InitField( &m_startDate, "StartDate", QDateTime::currentDateTime(), "Start Date" ); + CAF_PDM_InitField( &m_endDate, "EndDate", QDateTime::currentDateTime(), "End Date" ); + setLegendsVisible( true ); setAsPlotMdiWindow(); setShowWindow( true ); @@ -145,6 +151,8 @@ void RimSummaryTable::setDefaultCaseAndCategoryAndVectorName() m_vector = *categoryVectors.begin(); } m_tableName = createTableName(); + + initializeDateRange(); } //-------------------------------------------------------------------------------------------------- @@ -158,6 +166,9 @@ void RimSummaryTable::setFromCaseAndCategoryAndVectorName( RimSummaryCase* m_category = category; m_vector = vectorName; m_tableName = createTableName(); + + initializeDateRange(); + onLoadDataAndUpdate(); } @@ -285,7 +296,8 @@ void RimSummaryTable::fieldChangedByUi( const caf::PdmFieldHandle* changedField, } onLoadDataAndUpdate(); } - else if ( changedField == &m_maxTimeLabelCount ) + else if ( changedField == &m_maxTimeLabelCount || changedField == &m_startDate || changedField == &m_endDate || + changedField == &m_filterTimeSteps ) { onLoadDataAndUpdate(); } @@ -316,6 +328,14 @@ void RimSummaryTable::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering dataGroup.add( &m_thresholdValue ); dataGroup.add( &m_excludedRowsUiField ); + caf::PdmUiGroup* timeFilterGroup = dataGroup.addNewGroup( "Time Filter" ); + timeFilterGroup->add( &m_filterTimeSteps ); + timeFilterGroup->add( &m_startDate ); + timeFilterGroup->add( &m_endDate ); + + m_startDate.uiCapability()->setUiReadOnly( !m_filterTimeSteps() ); + m_endDate.uiCapability()->setUiReadOnly( !m_filterTimeSteps() ); + caf::PdmUiGroup* tableSettingsGroup = uiOrdering.addNewGroup( "Table Settings" ); tableSettingsGroup->add( &m_showValueLabels ); m_legendConfig->uiOrdering( "FlagAndColorsOnly", *tableSettingsGroup ); @@ -334,6 +354,32 @@ void RimSummaryTable::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering uiOrdering.skipRemainingFields( true ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryTable::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) +{ + if ( field == &m_startDate || field == &m_endDate ) + { + if ( auto myAttr = dynamic_cast( attribute ) ) + { + QString dateFormat = "yyyy-MM-dd"; + if ( m_resamplingSelection() == RiaDefines::DateTimePeriod::DECADE || m_resamplingSelection() == RiaDefines::DateTimePeriod::YEAR ) + { + dateFormat = "yyyy"; + } + else if ( m_resamplingSelection() == RiaDefines::DateTimePeriod::MONTH || + m_resamplingSelection() == RiaDefines::DateTimePeriod::QUARTER || + m_resamplingSelection() == RiaDefines::DateTimePeriod::HALFYEAR ) + { + dateFormat = "yyyy-MM"; + } + + myAttr->dateFormat = dateFormat; + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -400,6 +446,7 @@ QList RimSummaryTable::calculateValueOptions( const caf: options.push_back( caf::PdmOptionItemInfo( caf::AppEnum::uiText( mappingType ), mappingType ) ); } } + return options; } @@ -674,6 +721,25 @@ std::vector RimSummaryTable::getToplevelSummaryCases() const return summaryCaseMainCollection->topLevelSummaryCases(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryTable::initializeDateRange() +{ + if ( !m_case ) return; + const auto summaryReader = m_case->summaryReader(); + if ( !summaryReader ) return; + + const std::set allResultAddresses = summaryReader->allResultAddresses(); + if ( allResultAddresses.empty() ) return; + + auto timeSteps = summaryReader->timeSteps( *allResultAddresses.begin() ); + if ( timeSteps.empty() ) return; + + m_startDate = RiaQDateTimeTools::fromTime_t( timeSteps.front() ); + m_endDate = RiaQDateTimeTools::fromTime_t( timeSteps.back() ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -700,12 +766,49 @@ void RimSummaryTable::createTableData() const QString vectorName = QString::fromStdString( adr.vectorName() ); const QString categoryName = getCategoryNameFromAddress( adr ); - // Get re-sampled time steps and values - const auto& [resampledTimeSteps, resampledValues] = + // Get resampled time steps and values + auto [resampledTimeSteps, resampledValues] = RiaSummaryTools::resampledValuesForPeriod( adr, timeSteps, values, m_resamplingSelection() ); if ( resampledValues.empty() ) continue; + if ( m_filterTimeSteps() ) + { + auto filterTimeStepsAndValues = []( auto& resampledTimeSteps, auto& resampledValues, time_t startTime, time_t endTime ) + { + auto lowerBound = std::lower_bound( resampledTimeSteps.begin(), resampledTimeSteps.end(), startTime ); + if ( lowerBound != resampledTimeSteps.end() ) + { + const auto baseIndex = lowerBound - resampledTimeSteps.begin(); + + // Use one time step less to make sure the start date is included + const auto startIndex = ( baseIndex > 1 ) ? baseIndex - 1 : 0; + + resampledTimeSteps.erase( resampledTimeSteps.begin(), resampledTimeSteps.begin() + startIndex ); + resampledValues.erase( resampledValues.begin(), resampledValues.begin() + startIndex ); + } + + const auto upperBound = std::upper_bound( resampledTimeSteps.begin(), resampledTimeSteps.end(), endTime ); + if ( upperBound != resampledTimeSteps.end() ) + { + const auto endIndex = ( upperBound - resampledTimeSteps.begin() ) + 1; + + if ( endIndex < (int)resampledTimeSteps.size() ) + { + resampledTimeSteps.erase( resampledTimeSteps.begin() + endIndex, resampledTimeSteps.end() ); + resampledValues.erase( resampledValues.begin() + endIndex, resampledValues.end() ); + } + } + }; + + auto startTime = RiaTimeTTools::fromQDateTime( m_startDate ); + auto endTime = std::max( startTime, RiaTimeTTools::fromQDateTime( m_endDate ) ); + + filterTimeStepsAndValues( resampledTimeSteps, resampledValues, startTime, endTime ); + + if ( resampledValues.empty() ) continue; + } + // Exclude vectors with values BELOW threshold - to include visualization of values equal to threshold! const auto maxRowValue = *std::max_element( resampledValues.begin(), resampledValues.end() ); const auto minRowValue = *std::min_element( resampledValues.begin(), resampledValues.end() ); @@ -722,6 +825,7 @@ void RimSummaryTable::createTableData() std::find_if( resampledValues.rbegin(), resampledValues.rend(), [&]( double value ) { return value > 0.0; } ); const auto firstIdx = static_cast( std::distance( resampledValues.begin(), firstTimeStepItr ) ); const auto lastIdx = resampledValues.size() - static_cast( std::distance( resampledValues.rbegin(), lastTimeStepItr ) ) - 1; + const auto firstTimeStep = hasValueAboveThreshold ? resampledTimeSteps[firstIdx] : invalidTimeStep; const auto lastTimeStep = hasValueAboveThreshold ? resampledTimeSteps[lastIdx] : invalidTimeStep; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTable.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTable.h index 9b7db25081..6766efd2a9 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTable.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTable.h @@ -72,6 +72,7 @@ private: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; @@ -94,7 +95,6 @@ private: QString createTableName() const; -private: std::pair createLegendMinMaxValues( const double maxTableValue ) const; QString dateFormatString() const; @@ -106,6 +106,7 @@ private: QString getCategoryNameFromAddress( const RifEclipseSummaryAddress& address ) const; std::vector getToplevelSummaryCases() const; + void initializeDateRange(); private: // Matrix plot for visualizing table data @@ -133,6 +134,10 @@ private: caf::PdmField m_mappingType; caf::PdmField> m_rangeType; + caf::PdmField m_filterTimeSteps; + caf::PdmField m_startDate; + caf::PdmField m_endDate; + private: using VectorData = RimSummaryTableTools::VectorData; using TableData = RimSummaryTableTools::TableData; diff --git a/ApplicationLibCode/UserInterface/RiuMatrixPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuMatrixPlotWidget.cpp index 6fabe6a9bb..f8b7aa49f9 100644 --- a/ApplicationLibCode/UserInterface/RiuMatrixPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuMatrixPlotWidget.cpp @@ -458,10 +458,9 @@ std::map RiuMatrixPlotWidget::createIndexLabelMap( const std::v } std::map indexLabelMap; - for ( size_t i = 0; i < std::min( labels.size(), size_t( maxLabelCount - 1 ) ); ++i ) + for ( size_t i = 0; i < labels.size(); i += increment ) { - auto index = i * increment; - indexLabelMap.emplace( index, labels[index] ); + indexLabelMap.emplace( i, labels[i] ); } indexLabelMap.emplace( labels.size() - 1, labels.back() ); From db20065e1eea4749ad463bc92f0bd040426d7632 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 21 Nov 2024 13:48:05 +0100 Subject: [PATCH 131/160] #11896 Make sure the Fractures folder in view is visible when required The Fractures folder in a 3D view becomes visible when the first fracture is added. Make sure that the Project Tree is recreated correctly. --- .../RicCreateMultipleFracturesFeature.cpp | 2 ++ .../RicNewWellPathFractureFeature.cpp | 2 ++ .../Completions/RimWellPathFractureCollection.cpp | 13 +++++++++++++ .../Completions/RimWellPathFractureCollection.h | 2 ++ 4 files changed, 19 insertions(+) diff --git a/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesFeature.cpp b/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesFeature.cpp index 45786e161f..9984a7e425 100644 --- a/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesFeature.cpp +++ b/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesFeature.cpp @@ -150,6 +150,8 @@ void RicCreateMultipleFracturesFeature::slotAppendFractures() coll->updateConnectedEditors(); } + RimWellPathFractureCollection::updateAfterFractureIsAdded(); + proj->reloadCompletionTypeResultsInAllViews(); } diff --git a/ApplicationLibCode/Commands/FractureCommands/RicNewWellPathFractureFeature.cpp b/ApplicationLibCode/Commands/FractureCommands/RicNewWellPathFractureFeature.cpp index 03f85d9437..2e274e9d7a 100644 --- a/ApplicationLibCode/Commands/FractureCommands/RicNewWellPathFractureFeature.cpp +++ b/ApplicationLibCode/Commands/FractureCommands/RicNewWellPathFractureFeature.cpp @@ -99,6 +99,8 @@ RimWellPathFracture* RicNewWellPathFractureFeature::addFracture( gsl::not_nullreloadCompletionTypeResultsInAllViews(); } + RimWellPathFractureCollection::updateAfterFractureIsAdded(); + // Update well path, as the completion collections are hidden if empty. This update will make sure that the folder // and completion is visible wellPath->updateAllRequiredEditors(); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFractureCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFractureCollection.cpp index 0a006e22d6..3402ab40cd 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFractureCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFractureCollection.cpp @@ -18,6 +18,7 @@ #include "RimWellPathFractureCollection.h" +#include "Rim3dView.h" #include "RimProject.h" #include "RimWellPathFracture.h" @@ -79,6 +80,18 @@ void RimWellPathFractureCollection::deleteFractures() m_fractures.deleteChildren(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellPathFractureCollection::updateAfterFractureIsAdded() +{ + // When a fracture is created, update Project Tree for a view to make sure the Fractures object becomes visible + for ( auto view : RimProject::current()->allViews() ) + { + view->updateAllRequiredEditors(); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFractureCollection.h b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFractureCollection.h index b30f717802..384b7ce776 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFractureCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFractureCollection.h @@ -46,6 +46,8 @@ public: void removeFracture( RimWellPathFracture* fracture ); void deleteFractures(); + static void updateAfterFractureIsAdded(); + std::vector allFractures() const; std::vector activeFractures() const; From 036ed8b70e87f62060f23237d8da5edcab01e220 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Thu, 21 Nov 2024 14:59:35 +0100 Subject: [PATCH 132/160] Make sure we only loop over active grids local cells when calculating visibility --- .../ModelVisualization/RivReservoirViewPartMgr.cpp | 6 +++--- ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.cpp | 6 ++++-- ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ApplicationLibCode/ModelVisualization/RivReservoirViewPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivReservoirViewPartMgr.cpp index 718ce426d6..1a96249ca6 100644 --- a/ApplicationLibCode/ModelVisualization/RivReservoirViewPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivReservoirViewPartMgr.cpp @@ -604,11 +604,11 @@ void RivReservoirViewPartMgr::computeNativeVisibility( cvf::UByteArray* if ( auto activeGrid = dynamic_cast( grid ) ) { - auto reservoirIndices = activeGrid->activeReservoirCellIndices(); + auto cellIndices = activeGrid->activeLocalCellIndices(); #pragma omp parallel for - for ( int i = 0; i < static_cast( reservoirIndices.size() ); i++ ) + for ( int i = 0; i < static_cast( cellIndices.size() ); i++ ) { - size_t cellIndex = reservoirIndices[i]; + size_t cellIndex = cellIndices[i]; if ( ( !activeCellsIsVisible ) || ( *cellIsInWellStatuses )[cellIndex] ) { diff --git a/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.cpp b/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.cpp index 6f98891cf0..63ef1d683c 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.cpp @@ -112,14 +112,16 @@ size_t RigActiveCellGrid::totalActiveCellCount() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RigActiveCellGrid::activeReservoirCellIndices() const +std::vector RigActiveCellGrid::activeLocalCellIndices() const { std::vector indices; indices.reserve( m_nativeCells.size() ); + const auto maxCellIdx = cellCount(); for ( const auto& [index, cell] : m_nativeCells ) { - indices.emplace_back( index ); + // only add cells indexes that belongs to our grid, not subgrids + if ( index < maxCellIdx ) indices.emplace_back( index ); } return indices; diff --git a/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h b/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h index c7e1225033..e3f9e21d21 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h +++ b/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h @@ -34,7 +34,7 @@ public: size_t totalCellCount() const override; size_t totalActiveCellCount() const; - std::vector activeReservoirCellIndices() const; + std::vector activeLocalCellIndices() const; protected: // only for use by file readers! friend class RifReaderOpmCommonActive; From 6894149f8ea5ccf7a7ed2cb72534e52c7db09c93 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 22 Nov 2024 08:19:50 +0100 Subject: [PATCH 133/160] #11859 Summary Plot: Missing legend curve name for Excel data Remove virtual from RimPlotCurve::setTitle() Set curve name for an Ascii curve to custom Make the curve title obsolete --- .../RicPasteAsciiDataToSummaryPlotFeature.cpp | 4 +- .../ProjectDataModel/RimPlotCurve.cpp | 3 ++ .../ProjectDataModel/RimPlotCurve.h | 2 +- .../Summary/RimAsciiDataCurve.cpp | 50 ++++++++++++------- .../Summary/RimAsciiDataCurve.h | 17 +++---- 5 files changed, 46 insertions(+), 30 deletions(-) diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.cpp index d00f21b663..07771cb6ec 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.cpp @@ -180,11 +180,11 @@ std::vector RicPasteAsciiDataToSummaryPlotFeature::parseCurv curve->setValues( parser.columnInfo( i )->values ); if ( curvePrefix.isEmpty() ) { - curve->setTitle( QString::fromStdString( col->columnName() ) ); + curve->setCustomName( QString::fromStdString( col->columnName() ) ); } else { - curve->setTitle( QString( "%1: %2" ).arg( curvePrefix ).arg( QString::fromStdString( col->columnName() ) ) ); + curve->setCustomName( QString( "%1: %2" ).arg( curvePrefix ).arg( QString::fromStdString( col->columnName() ) ) ); } // Appearance curve->setSymbol( parseOptions.curveSymbol ); diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp index 2a87cd874e..13433e3c11 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp @@ -789,6 +789,9 @@ void RimPlotCurve::updateLegendsInPlot() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimPlotCurve::setTitle( const QString& title ) { if ( m_plotCurve ) m_plotCurve->setTitle( title ); diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h index 91fea83e54..14a6d94ac4 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h @@ -121,7 +121,7 @@ public: virtual bool xValueRange( double* minimumValue, double* maximumValue ) const; virtual bool yValueRange( double* minimumValue, double* maximumValue ) const; - virtual void setTitle( const QString& title ); + void setTitle( const QString& title ); int dataSize() const; std::pair sample( int index ) const; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp index 472756fd5f..9378567723 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp @@ -19,6 +19,7 @@ #include "RimAsciiDataCurve.h" #include "RiaDefines.h" + #include "RimEclipseResultCase.h" #include "RimProject.h" #include "RimSummaryCase.h" @@ -48,7 +49,7 @@ RimAsciiDataCurve::RimAsciiDataCurve() CAF_PDM_InitFieldNoDefault( &m_values, "Values", "Values" ); m_values.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_title, "Title", "Title" ); + CAF_PDM_InitFieldNoDefault( &m_title_OBSOLETE, "Title", "Title" ); setSymbolSkipDistance( 10.0f ); setLineThickness( 2 ); @@ -103,14 +104,6 @@ RiuPlotAxis RimAsciiDataCurve::yAxis() const return RiuPlotAxis( m_plotAxis() ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RimAsciiDataCurve::createCurveAutoName() -{ - return m_title(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -192,6 +185,23 @@ void RimAsciiDataCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderi uiOrdering.skipRemainingFields( true ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimAsciiDataCurve::initAfterRead() +{ + if ( RimProject::current()->isProjectFileVersionEqualOrOlderThan( "2024.09.2" ) && + ( m_namingMethod() == RiaDefines::ObjectNamingMethod::AUTO ) ) + { + setCustomName( m_title_OBSOLETE ); + } + else + { + // Use default curve name defined in base class. CUSTOM is the only valid naming method for this class, see calculateValueOptions() + setCustomName( createCurveAutoName() ); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -216,14 +226,6 @@ void RimAsciiDataCurve::setValues( const std::vector& values ) m_values = values; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimAsciiDataCurve::setTitle( const QString& title ) -{ - m_title = title; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -256,3 +258,17 @@ void RimAsciiDataCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel plot->updateAxes(); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList RimAsciiDataCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) +{ + QList options; + if ( fieldNeedingOptions == &m_namingMethod ) + { + options.push_back( caf::PdmOptionItemInfo( caf::AppEnum::uiText( RiaDefines::ObjectNamingMethod::CUSTOM ), + RiaDefines::ObjectNamingMethod::CUSTOM ) ); + } + return options; +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.h b/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.h index c1647cedcd..75624c9db9 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.h @@ -53,20 +53,17 @@ public: void setTimeSteps( const std::vector& timeSteps ); void setValues( const std::vector& values ); - void setTitle( const QString& title ) override; - -protected: - // RimPlotCurve overrides - - QString createCurveAutoName() override; - void updateZoomInParentPlot() override; - void onLoadDataAndUpdate( bool updateParentPlot ) override; - void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; private: + void updateZoomInParentPlot() override; + void onLoadDataAndUpdate( bool updateParentPlot ) override; + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + void initAfterRead() override; + bool curveData( std::vector* timeSteps, std::vector* values ) const; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; private: // Fields @@ -74,5 +71,5 @@ private: caf::PdmField> m_timeSteps; caf::PdmField> m_values; - caf::PdmField m_title; + caf::PdmField m_title_OBSOLETE; }; From ddefd39fc2a4966f4c041975c26ddd2f9bc06041 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 25 Nov 2024 09:38:23 +0100 Subject: [PATCH 134/160] Python: Make more well completion parameters available Add access to all MSW parameters in Python : "msw_settings = well_path.msw_settings()" Make all parameters of the well completion object available in Python. --- .../RimMswCompletionParameters.cpp | 37 ++++++++---- .../RimWellPathCompletionSettings.cpp | 17 +++--- .../ProjectDataModelCommands/RimcWellPath.cpp | 58 +++++++++++++++++++ .../ProjectDataModelCommands/RimcWellPath.h | 16 +++++ .../rips/tests/test_create_well_path.py | 45 ++++++++++++++ 5 files changed, 153 insertions(+), 20 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimMswCompletionParameters.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimMswCompletionParameters.cpp index f94aa76643..7c49e03ff9 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimMswCompletionParameters.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimMswCompletionParameters.cpp @@ -22,6 +22,8 @@ #include "RimWellPath.h" +#include "cafPdmFieldScriptingCapability.h" +#include "cafPdmObjectScriptingCapability.h" #include "cafPdmUiObjectEditorHandle.h" #include @@ -31,8 +33,8 @@ namespace caf template <> void RimMswCompletionParameters::ReferenceMDEnum::setUp() { - addItem( RimMswCompletionParameters::ReferenceMDType::AUTO_REFERENCE_MD, "GridIntersectionRefMD", "Grid Entry Point" ); - addItem( RimMswCompletionParameters::ReferenceMDType::MANUAL_REFERENCE_MD, "ManualRefMD", "User Defined" ); + addItem( RimMswCompletionParameters::ReferenceMDType::AUTO_REFERENCE_MD, "GridEntryPoint", "Grid Entry Point", { "GridIntersectionRefMD" } ); + addItem( RimMswCompletionParameters::ReferenceMDType::MANUAL_REFERENCE_MD, "UserDefined", "User Defined", { "ManualRefMD" } ); setDefault( RimMswCompletionParameters::ReferenceMDType::AUTO_REFERENCE_MD ); } @@ -61,22 +63,33 @@ CAF_PDM_SOURCE_INIT( RimMswCompletionParameters, "RimMswCompletionParameters" ); //-------------------------------------------------------------------------------------------------- RimMswCompletionParameters::RimMswCompletionParameters() { - CAF_PDM_InitObject( "MSW Completion Parameters", ":/CompletionsSymbol16x16.png" ); + CAF_PDM_InitScriptableObjectWithNameAndComment( "MSW Completion Parameters", + ":/CompletionsSymbol16x16.png", + "", + "", + "MswSettings", + "Multi Segment Well Completion Settings" ); - CAF_PDM_InitFieldNoDefault( &m_refMDType, "RefMDType", "Reference MD" ); - CAF_PDM_InitField( &m_refMD, "RefMD", 0.0, "" ); + CAF_PDM_InitScriptableFieldWithScriptKeywordNoDefault( &m_refMDType, "RefMDType", "ReferenceMdType", "" ); + CAF_PDM_InitScriptableFieldWithScriptKeyword( &m_refMD, "RefMD", "UserDefinedReferenceMd", 0.0, "User Defined Reference MD" ); - CAF_PDM_InitField( &m_customValuesForLateral, "CustomValuesForLateral", false, "Custom Values for Lateral" ); + CAF_PDM_InitScriptableField( &m_customValuesForLateral, "CustomValuesForLateral", false, "Custom Values for Lateral" ); const auto unitSystem = RiaDefines::EclipseUnitSystem::UNITS_METRIC; - CAF_PDM_InitField( &m_linerDiameter, "LinerDiameter", RimMswCompletionParameters::defaultLinerDiameter( unitSystem ), "Liner Inner Diameter" ); - CAF_PDM_InitField( &m_roughnessFactor, "RoughnessFactor", RimMswCompletionParameters::defaultRoughnessFactor( unitSystem ), "Roughness Factor" ); + CAF_PDM_InitScriptableField( &m_linerDiameter, + "LinerDiameter", + RimMswCompletionParameters::defaultLinerDiameter( unitSystem ), + "Liner Inner Diameter" ); + CAF_PDM_InitScriptableField( &m_roughnessFactor, + "RoughnessFactor", + RimMswCompletionParameters::defaultRoughnessFactor( unitSystem ), + "Roughness Factor" ); - CAF_PDM_InitFieldNoDefault( &m_pressureDrop, "PressureDrop", "Pressure Drop" ); - CAF_PDM_InitFieldNoDefault( &m_lengthAndDepth, "LengthAndDepth", "Length and Depth" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_pressureDrop, "PressureDrop", "Pressure Drop" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_lengthAndDepth, "LengthAndDepth", "Length and Depth" ); - CAF_PDM_InitField( &m_enforceMaxSegmentLength, "EnforceMaxSegmentLength", false, "Enforce Max Segment Length" ); - CAF_PDM_InitField( &m_maxSegmentLength, "MaxSegmentLength", 200.0, "Max Segment Length" ); + CAF_PDM_InitScriptableField( &m_enforceMaxSegmentLength, "EnforceMaxSegmentLength", false, "Enforce Max Segment Length" ); + CAF_PDM_InitScriptableField( &m_maxSegmentLength, "MaxSegmentLength", 200.0, "Max Segment Length" ); m_maxSegmentLength.uiCapability()->setUiHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.cpp index 332c42ce57..91e75108ff 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.cpp @@ -81,19 +81,20 @@ CAF_PDM_SOURCE_INIT( RimWellPathCompletionSettings, "WellPathCompletionSettings" RimWellPathCompletionSettings::RimWellPathCompletionSettings() { CAF_PDM_InitScriptableObject( "Completion Settings", ":/CompletionsSymbol16x16.png" ); + CAF_PDM_InitScriptableField( &m_wellNameForExport, "WellNameForExport", QString(), "Well Name" ); m_wellNameForExport.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() ); CAF_PDM_InitScriptableFieldWithScriptKeyword( &m_groupName, "WellGroupNameForExport", "GroupNameForExport", QString(), "Group Name" ); - CAF_PDM_InitField( &m_referenceDepth, "ReferenceDepthForExport", QString(), "Reference Depth for BHP" ); + CAF_PDM_InitScriptableField( &m_referenceDepth, "ReferenceDepthForExport", QString(), "Reference Depth for BHP" ); CAF_PDM_InitScriptableFieldNoDefault( &m_preferredFluidPhase, "WellTypeForExport", "Preferred Fluid Phase" ); - CAF_PDM_InitField( &m_drainageRadiusForPI, "DrainageRadiusForPI", QString( "0.0" ), "Drainage Radius for PI" ); - CAF_PDM_InitFieldNoDefault( &m_gasInflowEquation, "GasInflowEq", "Gas Inflow Equation" ); - CAF_PDM_InitFieldNoDefault( &m_automaticWellShutIn, "AutoWellShutIn", "Automatic well shut-in" ); - CAF_PDM_InitField( &m_allowWellCrossFlow, "AllowWellCrossFlow", true, "Allow Well Cross-Flow" ); - CAF_PDM_InitField( &m_wellBoreFluidPVTTable, "WellBoreFluidPVTTable", 0, "Wellbore Fluid PVT table" ); - CAF_PDM_InitFieldNoDefault( &m_hydrostaticDensity, "HydrostaticDensity", "Hydrostatic Density" ); - CAF_PDM_InitField( &m_fluidInPlaceRegion, "FluidInPlaceRegion", 0, "Fluid In-Place Region" ); + CAF_PDM_InitScriptableField( &m_drainageRadiusForPI, "DrainageRadiusForPI", QString( "0.0" ), "Drainage Radius for PI" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_gasInflowEquation, "GasInflowEq", "Gas Inflow Equation" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_automaticWellShutIn, "AutoWellShutIn", "Automatic well shut-in" ); + CAF_PDM_InitScriptableField( &m_allowWellCrossFlow, "AllowWellCrossFlow", true, "Allow Well Cross-Flow" ); + CAF_PDM_InitScriptableField( &m_wellBoreFluidPVTTable, "WellBoreFluidPVTTable", 0, "Wellbore Fluid PVT table" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_hydrostaticDensity, "HydrostaticDensity", "Hydrostatic Density" ); + CAF_PDM_InitScriptableField( &m_fluidInPlaceRegion, "FluidInPlaceRegion", 0, "Fluid In-Place Region" ); CAF_PDM_InitFieldNoDefault( &m_mswParameters, "MswParameters", "Multi Segment Well Parameters" ); m_mswParameters = new RimMswCompletionParameters; diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcWellPath.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcWellPath.cpp index 4fc4720cee..d7a2000e1a 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcWellPath.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcWellPath.cpp @@ -23,6 +23,7 @@ #include "RimEclipseCase.h" #include "RimEclipseCaseTools.h" +#include "RimMswCompletionParameters.h" #include "RimPerforationCollection.h" #include "RimPerforationInterval.h" #include "RimStimPlanFractureTemplate.h" @@ -31,6 +32,7 @@ #include "RimTools.h" #include "RimWellPath.h" #include "RimWellPathCollection.h" +#include "RimWellPathCompletionSettings.h" #include "RimWellPathFracture.h" #include "RigStimPlanModelTools.h" @@ -223,3 +225,59 @@ std::unique_ptr RimcWellPath_appendPerforationInterval::de { return std::unique_ptr( new RimPerforationInterval ); } + +CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimWellPath, RimcWellPath_multiSegmentWellSettings, "MswSettings" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimcWellPath_multiSegmentWellSettings::RimcWellPath_multiSegmentWellSettings( caf::PdmObjectHandle* self ) + : caf::PdmObjectMethod( self ) +{ + CAF_PDM_InitObject( "MSW Settings", "", "", "Multi Segment Well Settings" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +caf::PdmObjectHandle* RimcWellPath_multiSegmentWellSettings::execute() +{ + auto wellPath = self(); + + // RimMswCompletionParameters is a child object of RimWellPathCompletionSettings. To simplify the Python API, we return + // RimMswCompletionParameters directly from a well path object in Python. Two parameters are already exposed as part of the completion + // settings object, see RimWellPathCompletionSettings and the proxy fields liner_diameter and roughness. These fields are kept to + // ensure backward compatibility with existing scripts. + // + // https://github.com/OPM/ResInsight/issues/11901 + + if ( auto completionSettings = wellPath->completionSettings() ) + { + return completionSettings->mswCompletionParameters(); + } + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimcWellPath_multiSegmentWellSettings::resultIsPersistent() const +{ + return true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimcWellPath_multiSegmentWellSettings::isNullptrValidResult() const +{ + return true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::unique_ptr RimcWellPath_multiSegmentWellSettings::defaultResult() const +{ + return std::unique_ptr( new RimMswCompletionParameters ); +} diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcWellPath.h b/ApplicationLibCode/ProjectDataModelCommands/RimcWellPath.h index bf82d0b9ed..277741e9df 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcWellPath.h +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcWellPath.h @@ -90,3 +90,19 @@ private: caf::PdmField m_diameter; caf::PdmField m_skinFactor; }; + +//================================================================================================== +/// +//================================================================================================== +class RimcWellPath_multiSegmentWellSettings : public caf::PdmObjectMethod +{ + CAF_PDM_HEADER_INIT; + +public: + RimcWellPath_multiSegmentWellSettings( caf::PdmObjectHandle* self ); + + caf::PdmObjectHandle* execute() override; + bool resultIsPersistent() const override; + bool isNullptrValidResult() const override; + std::unique_ptr defaultResult() const override; +}; diff --git a/GrpcInterface/Python/rips/tests/test_create_well_path.py b/GrpcInterface/Python/rips/tests/test_create_well_path.py index 2cc866e05e..36fbff133a 100644 --- a/GrpcInterface/Python/rips/tests/test_create_well_path.py +++ b/GrpcInterface/Python/rips/tests/test_create_well_path.py @@ -64,3 +64,48 @@ def test_add_well_path_targets(rips_instance, initialize_test): assert target.use_fixed_azimuth == False assert target.azimuth == 0.0 assert target.inclination == 25.6 + + +def test_add_well_path_completions(rips_instance, initialize_test): + well_path_coll = rips_instance.project.descendants(rips.WellPathCollection)[0] + + well_path = well_path_coll.add_new_object(rips.ModeledWellPath) + well_path.name = "test" + well_path.update() + + # Update the completion settings + completions_settings = well_path.completion_settings() + completions_settings.msw_roughness = 12.34 + completions_settings.msw_liner_diameter = 0.2123 + completions_settings.well_name_for_export = "file name" + completions_settings.group_name_for_export = "msj" + completions_settings.well_type_for_export = "GAS" + completions_settings.update() # Commit updates back to ResInsight + + completions_settings_updated = well_path.completion_settings() + assert completions_settings_updated.msw_roughness == 12.34 + assert completions_settings_updated.msw_liner_diameter == 0.2123 + assert completions_settings_updated.well_name_for_export == "file name" + assert completions_settings_updated.group_name_for_export == "msj" + assert completions_settings_updated.well_type_for_export == "GAS" + + msw_settings = well_path.msw_settings() + msw_settings.custom_values_for_lateral = True + msw_settings.enforce_max_segment_length = True + msw_settings.liner_diameter = 20.0 + msw_settings.max_segment_length = 123.05 + msw_settings.pressure_drop = "HFA" + msw_settings.reference_md_type = "UserDefined" + msw_settings.roughness_factor = 1.3 + msw_settings.user_defined_reference_md = 1234.56 + msw_settings.update() + + msw_settings_updated = well_path.msw_settings() + assert msw_settings_updated.custom_values_for_lateral == True + assert msw_settings_updated.enforce_max_segment_length == True + assert msw_settings_updated.liner_diameter == 20.0 + assert msw_settings_updated.max_segment_length == 123.05 + assert msw_settings_updated.pressure_drop == "HFA" + assert msw_settings_updated.reference_md_type == "UserDefined" + assert msw_settings_updated.roughness_factor == 1.3 + assert msw_settings_updated.user_defined_reference_md == 1234.56 From 494175d1e69a742040fcb88200cc617e8e3a0f12 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 25 Nov 2024 07:16:42 +0100 Subject: [PATCH 135/160] Extract creation of QShortenedLabel and add context menu Create an intermediate class used to create a QShortenedLabel. If field is scriptable, add a context menu to support copy of the Python field name to clipboard. --- .../cafPdmUiFieldEditorHandle.cpp | 2 + .../cafPdmUiCore/cafPdmUiFieldEditorHandle.h | 3 +- .../cafPdmUiCore/cafQShortenedLabel.cpp | 31 ++++++++ .../cafPdmUiCore/cafQShortenedLabel.h | 2 + Fwk/AppFwk/cafUserInterface/CMakeLists.txt | 6 +- .../cafPdmUiActionPushButtonEditor.h | 4 +- .../cafPdmUiCheckBoxAndTextEditor.cpp | 9 --- .../cafPdmUiCheckBoxAndTextEditor.h | 10 +-- .../cafPdmUiCheckBoxEditor.cpp | 4 +- .../cafPdmUiCheckBoxTristateEditor.cpp | 15 +--- .../cafPdmUiCheckBoxTristateEditor.h | 8 +- .../cafUserInterface/cafPdmUiColorEditor.cpp | 12 +-- .../cafUserInterface/cafPdmUiColorEditor.h | 7 +- .../cafPdmUiComboBoxEditor.cpp | 9 --- .../cafUserInterface/cafPdmUiComboBoxEditor.h | 8 +- .../cafUserInterface/cafPdmUiDateEditor.cpp | 9 --- .../cafUserInterface/cafPdmUiDateEditor.h | 8 +- .../cafPdmUiDoubleSliderEditor.cpp | 10 +-- .../cafPdmUiDoubleSliderEditor.h | 12 ++- .../cafPdmUiDoubleValueEditor.cpp | 12 +-- .../cafPdmUiDoubleValueEditor.h | 8 +- .../cafPdmUiFieldLabelEditorHandle.cpp | 78 +++++++++++++++++++ .../cafPdmUiFieldLabelEditorHandle.h | 62 +++++++++++++++ .../cafPdmUiFilePathEditor.cpp | 9 --- .../cafUserInterface/cafPdmUiFilePathEditor.h | 12 ++- .../cafUserInterface/cafPdmUiLabelEditor.cpp | 1 + .../cafUserInterface/cafPdmUiLabelEditor.h | 1 - .../cafUserInterface/cafPdmUiLineEditor.cpp | 9 --- .../cafUserInterface/cafPdmUiLineEditor.h | 8 +- .../cafUserInterface/cafPdmUiListEditor.cpp | 21 ++--- .../cafUserInterface/cafPdmUiListEditor.h | 15 +--- .../cafPdmUiPushButtonEditor.cpp | 15 +--- .../cafPdmUiPushButtonEditor.h | 10 +-- .../cafUserInterface/cafPdmUiSliderEditor.cpp | 12 +-- .../cafUserInterface/cafPdmUiSliderEditor.h | 10 +-- .../cafPdmUiTableViewEditor.cpp | 1 + .../cafPdmUiTableViewEditor.h | 4 +- .../cafUserInterface/cafPdmUiTextEditor.cpp | 9 --- .../cafUserInterface/cafPdmUiTextEditor.h | 10 +-- .../cafUserInterface/cafPdmUiTimeEditor.cpp | 9 --- .../cafUserInterface/cafPdmUiTimeEditor.h | 8 +- .../cafPdmUiTreeSelectionEditor.cpp | 9 --- .../cafPdmUiTreeSelectionEditor.h | 6 +- .../cafPdmUiValueRangeEditor.cpp | 9 --- .../cafPdmUiValueRangeEditor.h | 10 +-- 45 files changed, 264 insertions(+), 263 deletions(-) create mode 100644 Fwk/AppFwk/cafUserInterface/cafPdmUiFieldLabelEditorHandle.cpp create mode 100644 Fwk/AppFwk/cafUserInterface/cafPdmUiFieldLabelEditorHandle.h diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldEditorHandle.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldEditorHandle.cpp index 7c2cb1ca0d..eb93e9b21a 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldEditorHandle.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldEditorHandle.cpp @@ -40,8 +40,10 @@ #include "cafPdmUiCommandSystemProxy.h" #include "cafPdmUiFieldHandle.h" #include "cafPdmUiObjectHandle.h" +#include "cafQShortenedLabel.h" #include +#include #include namespace caf diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldEditorHandle.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldEditorHandle.h index 5587792a66..d96d41b8a8 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldEditorHandle.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldEditorHandle.h @@ -38,7 +38,8 @@ #include "cafClassTypeName.h" #include "cafFactory.h" #include "cafPdmUiEditorHandle.h" -#include "cafQShortenedLabel.h" + +class QLabel; namespace caf { diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafQShortenedLabel.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafQShortenedLabel.cpp index a32ebb70ad..4d1860153b 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafQShortenedLabel.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafQShortenedLabel.cpp @@ -36,6 +36,8 @@ #include "cafQShortenedLabel.h" #include +#include +#include #include using namespace caf; @@ -142,6 +144,35 @@ void QShortenedLabel::resizeEvent( QResizeEvent* event ) QLabel::resizeEvent( event ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void QShortenedLabel::configureContextMenu( const QString& pythonParameterName ) +{ + setContextMenuPolicy( Qt::CustomContextMenu ); + + auto createContextMenu = [pythonParameterName]( const QPoint& pos ) + { + QMenu menu; + QAction* action = menu.addAction( "Copy Python Parameter Name" ); + action->setIcon( QIcon( ":/caf/duplicate.svg" ) ); + + connect( action, + &QAction::triggered, + [pythonParameterName]() + { + if ( QClipboard* clipboard = QApplication::clipboard() ) + { + clipboard->setText( pythonParameterName ); + } + } ); + + menu.exec( QCursor::pos() ); + }; + + connect( this, &QLabel::customContextMenuRequested, this, createContextMenu ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafQShortenedLabel.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafQShortenedLabel.h index 2837d92f4c..b3c1d5f0cb 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafQShortenedLabel.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafQShortenedLabel.h @@ -51,6 +51,8 @@ public: QSize minimumSizeHint() const override; QSize sizeHint() const override; + void configureContextMenu( const QString& pythonParameterName ); + protected: void resizeEvent( QResizeEvent* event ) override; void resizeText( QSize paintSize ); diff --git a/Fwk/AppFwk/cafUserInterface/CMakeLists.txt b/Fwk/AppFwk/cafUserInterface/CMakeLists.txt index fc64500a6b..cacb20031d 100644 --- a/Fwk/AppFwk/cafUserInterface/CMakeLists.txt +++ b/Fwk/AppFwk/cafUserInterface/CMakeLists.txt @@ -180,6 +180,8 @@ set(PROJECT_FILES cafUiIconFactory.cpp cafPdmUiSliderTools.h cafPdmUiSliderTools.cpp + cafPdmUiFieldLabelEditorHandle.h + cafPdmUiFieldLabelEditorHandle.cpp ) add_library( @@ -194,6 +196,8 @@ endif() target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) -target_link_libraries(${PROJECT_NAME} cafProjectDataModel ${QT_LIBRARIES}) +target_link_libraries( + ${PROJECT_NAME} cafProjectDataModel cafPdmScripting ${QT_LIBRARIES} +) source_group("" FILES ${PROJECT_FILES}) diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiActionPushButtonEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiActionPushButtonEditor.h index 00370136af..39989c78ad 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiActionPushButtonEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiActionPushButtonEditor.h @@ -78,15 +78,13 @@ public: protected: QWidget* createEditorWidget( QWidget* parent ) override; - // QWidget* createLabelWidget(QWidget * parent) override; - void configureAndUpdateUi( const QString& uiConfigName ) override; + void configureAndUpdateUi( const QString& uiConfigName ) override; protected slots: void slotClicked( bool checked ); private: QPointer m_pushButton; - // QPointer m_label; QPointer m_buttonLayout; }; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxAndTextEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxAndTextEditor.cpp index 4092b50f8c..d81910cc8a 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxAndTextEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxAndTextEditor.cpp @@ -115,15 +115,6 @@ QWidget* PdmUiCheckBoxAndTextEditor::createEditorWidget( QWidget* parent ) return containerWidget; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiCheckBoxAndTextEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxAndTextEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxAndTextEditor.h index 0b4e809f60..19504a5a4c 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxAndTextEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxAndTextEditor.h @@ -36,7 +36,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include #include @@ -50,7 +50,7 @@ namespace caf //================================================================================================== /// //================================================================================================== -class PdmUiCheckBoxAndTextEditor : public PdmUiFieldEditorHandle +class PdmUiCheckBoxAndTextEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -61,16 +61,14 @@ public: protected: QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; void configureAndUpdateUi( const QString& uiConfigName ) override; protected slots: void slotSetValueToField(); private: - QPointer m_lineEdit; - QPointer m_checkBox; - QPointer m_label; + QPointer m_lineEdit; + QPointer m_checkBox; }; } // end namespace caf diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxEditor.cpp index 48cf6ff17b..ed5b43fd20 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxEditor.cpp @@ -38,11 +38,11 @@ #include "cafPdmUiDefaultObjectEditor.h" +#include "cafFactory.h" #include "cafPdmField.h" #include "cafPdmObject.h" #include "cafPdmUiFieldEditorHandle.h" - -#include "cafFactory.h" +#include "cafQShortenedLabel.h" namespace caf { diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxTristateEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxTristateEditor.cpp index fd3749b7d9..adf27b40c8 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxTristateEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxTristateEditor.cpp @@ -2,13 +2,11 @@ #include "cafPdmUiCheckBoxTristateEditor.h" -#include "cafPdmUiDefaultObjectEditor.h" - +#include "cafFactory.h" #include "cafPdmField.h" #include "cafPdmObject.h" +#include "cafPdmUiDefaultObjectEditor.h" #include "cafPdmUiFieldEditorHandle.h" - -#include "cafFactory.h" #include "cafTristate.h" namespace caf @@ -56,15 +54,6 @@ QWidget* PdmUiCheckBoxTristateEditor::createEditorWidget( QWidget* parent ) return m_checkBox; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiCheckBoxTristateEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxTristateEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxTristateEditor.h index 9ae955b777..297a063031 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxTristateEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxTristateEditor.h @@ -2,7 +2,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include #include @@ -11,7 +11,7 @@ namespace caf { -class PdmUiCheckBoxTristateEditor : public PdmUiFieldEditorHandle +class PdmUiCheckBoxTristateEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -22,15 +22,13 @@ public: protected: QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; void configureAndUpdateUi( const QString& uiConfigName ) override; protected slots: void slotClicked( bool ); private: - QPointer m_checkBox; - QPointer m_label; + QPointer m_checkBox; }; } // end namespace caf diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiColorEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiColorEditor.cpp index 34f46ec044..52057497d8 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiColorEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiColorEditor.cpp @@ -38,12 +38,11 @@ #include "cafPdmUiDefaultObjectEditor.h" +#include "cafFactory.h" #include "cafPdmField.h" #include "cafPdmObject.h" #include "cafPdmUiFieldEditorHandle.h" -#include "cafFactory.h" - #include #include #include @@ -167,15 +166,6 @@ QWidget* PdmUiColorEditor::createEditorWidget( QWidget* parent ) return placeholder; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiColorEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiColorEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiColorEditor.h index 24ae589621..1867ed1d3d 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiColorEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiColorEditor.h @@ -36,7 +36,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include #include @@ -67,7 +67,7 @@ public: //================================================================================================== /// See cafPdmFieldCvfColor for conversion between cvf::Color3f and QColor //================================================================================================== -class PdmUiColorEditor : public PdmUiFieldEditorHandle +class PdmUiColorEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -80,7 +80,6 @@ public: protected: QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; void configureAndUpdateUi( const QString& uiConfigName ) override; QMargins calculateLabelContentMargins() const override; @@ -93,8 +92,6 @@ private: QColor getFontColor( const QColor& backgroundColor ) const; private: - QPointer m_label; - QColor m_color; QPointer m_colorTextLabel; QPointer m_colorSelectionButton; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp index b4b04b74fb..11d504fdfc 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp @@ -399,15 +399,6 @@ QWidget* PdmUiComboBoxEditor::createEditorWidget( QWidget* parent ) return m_placeholder; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiComboBoxEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.h index 16ef2ed06e..adac7873ce 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.h @@ -36,7 +36,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include #include @@ -90,7 +90,7 @@ public: //================================================================================================== /// //================================================================================================== -class PdmUiComboBoxEditor : public PdmUiFieldEditorHandle +class PdmUiComboBoxEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -101,7 +101,6 @@ public: protected: QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; void configureAndUpdateUi( const QString& uiConfigName ) override; QMargins calculateLabelContentMargins() const override; @@ -114,8 +113,7 @@ protected slots: void slotApplyAutoValue(); private: - QPointer m_comboBox; - QPointer m_label; + QPointer m_comboBox; QPointer m_previousItemButton; QPointer m_nextItemButton; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiDateEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiDateEditor.cpp index 8d1a1d4c2b..873a721490 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiDateEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiDateEditor.cpp @@ -96,15 +96,6 @@ QWidget* PdmUiDateEditor::createEditorWidget( QWidget* parent ) return m_dateEdit; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiDateEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiDateEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiDateEditor.h index 21ac72edaf..a3e5db1570 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiDateEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiDateEditor.h @@ -36,7 +36,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include #include @@ -61,7 +61,7 @@ public: //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -class PdmUiDateEditor : public PdmUiFieldEditorHandle +class PdmUiDateEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -72,15 +72,13 @@ public: protected: QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; void configureAndUpdateUi( const QString& uiConfigName ) override; protected slots: void slotEditingFinished(); private: - QPointer m_dateEdit; - QPointer m_label; + QPointer m_dateEdit; PdmUiDateEditorAttribute m_attributes; }; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.cpp index 78573a8605..a7679574ea 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.cpp @@ -42,6 +42,7 @@ #include #include +#include namespace caf { @@ -123,15 +124,6 @@ QWidget* PdmUiDoubleSliderEditor::createEditorWidget( QWidget* parent ) return containerWidget; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiDoubleSliderEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.h index 34c73c5b6b..08df3d2c1c 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.h @@ -36,7 +36,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include "cafPdmUiSliderTools.h" #include @@ -53,7 +53,7 @@ namespace caf //================================================================================================== /// //================================================================================================== -class PdmUiDoubleSliderEditor : public PdmUiFieldEditorHandle +class PdmUiDoubleSliderEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -65,7 +65,6 @@ public: protected: void configureAndUpdateUi( const QString& uiConfigName ) override; QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; protected slots: void slotEditingFinished(); @@ -76,10 +75,9 @@ private: void writeValueToField( double value ); private: - QPointer m_lineEdit; - QPointer m_slider; - QPointer m_label; - double m_sliderValue; + QPointer m_lineEdit; + QPointer m_slider; + double m_sliderValue; PdmUiDoubleSliderEditorAttribute m_attributes; }; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleValueEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleValueEditor.cpp index cf0607a388..60e59871a7 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleValueEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleValueEditor.cpp @@ -36,13 +36,12 @@ #include "cafPdmUiDoubleValueEditor.h" +#include "cafFactory.h" #include "cafPdmField.h" #include "cafPdmObject.h" #include "cafPdmUiDefaultObjectEditor.h" #include "cafPdmUiFieldEditorHandle.h" -#include "cafFactory.h" - #include #include #include @@ -126,15 +125,6 @@ QWidget* PdmUiDoubleValueEditor::createEditorWidget( QWidget* parent ) return containerWidget; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiDoubleValueEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleValueEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleValueEditor.h index 6c208a2397..f29392ac05 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleValueEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleValueEditor.h @@ -36,7 +36,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include #include @@ -90,7 +90,7 @@ public: //================================================================================================== /// //================================================================================================== -class PdmUiDoubleValueEditor : public PdmUiFieldEditorHandle +class PdmUiDoubleValueEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -102,7 +102,6 @@ public: protected: void configureAndUpdateUi( const QString& uiConfigName ) override; QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; protected slots: void slotEditingFinished(); @@ -111,8 +110,7 @@ private: void writeValueToField(); private: - QPointer m_lineEdit; - QPointer m_label; + QPointer m_lineEdit; PdmUiDoubleValueEditorAttribute m_attributes; }; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiFieldLabelEditorHandle.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiFieldLabelEditorHandle.cpp new file mode 100644 index 0000000000..2c9014c635 --- /dev/null +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiFieldLabelEditorHandle.cpp @@ -0,0 +1,78 @@ +//################################################################################################## +// +// Custom Visualization Core library +// Copyright (C) 2024 Ceetron Solutions AS +// +// This library may be used under the terms of either the GNU General Public License or +// the GNU Lesser General Public License as follows: +// +// GNU General Public License Usage +// This library 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. +// +// This library 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. +// +// GNU Lesser General Public License Usage +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This library 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 Lesser General Public License at <> +// for more details. +// +//################################################################################################## + +#include "cafPdmUiFieldLabelEditorHandle.h" +#include "cafPdmAbstractFieldScriptingCapability.h" +#include "cafPdmPythonGenerator.h" +#include "cafPdmUiFieldHandle.h" +#include "cafQShortenedLabel.h" + +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QWidget* caf::PdmUiFieldLabelEditorHandle::createLabelWidget( QWidget* parent ) +{ + m_label = createLabel( parent, this ); + + return m_label; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +caf::QShortenedLabel* caf::PdmUiFieldLabelEditorHandle::createLabel( QWidget* parent, + caf::PdmUiFieldEditorHandle* uiFieldEditorHandle ) +{ + auto label = new caf::QShortenedLabel( parent ); + + if ( uiFieldEditorHandle && uiFieldEditorHandle->uiField() && uiFieldEditorHandle->uiField()->fieldHandle() ) + { + if ( auto scriptingCapability = + uiFieldEditorHandle->uiField()->fieldHandle()->capability() ) + { + auto scriptFieldName = scriptingCapability->scriptFieldName(); + QString pythonParameterName = caf::PdmPythonGenerator::camelToSnakeCase( scriptFieldName ); + if ( !pythonParameterName.isEmpty() ) + { + label->configureContextMenu( pythonParameterName ); + } + } + } + + return label; +} diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiFieldLabelEditorHandle.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiFieldLabelEditorHandle.h new file mode 100644 index 0000000000..61aefd6478 --- /dev/null +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiFieldLabelEditorHandle.h @@ -0,0 +1,62 @@ +//################################################################################################## +// +// Custom Visualization Core library +// Copyright (C) 2024 Ceetron Solutions AS +// +// This library may be used under the terms of either the GNU General Public License or +// the GNU Lesser General Public License as follows: +// +// GNU General Public License Usage +// This library 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. +// +// This library 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. +// +// GNU Lesser General Public License Usage +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This library 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 Lesser General Public License at <> +// for more details. +// +//################################################################################################## + +#pragma once + +#include "cafPdmUiFieldEditorHandle.h" + +class QWidget; +class QLabel; + +namespace caf +{ +class QShortenedLabel; + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +class PdmUiFieldLabelEditorHandle : public PdmUiFieldEditorHandle +{ +public: + QWidget* createLabelWidget( QWidget* parent ) final; + +private: + static QShortenedLabel* createLabel( QWidget* parent, caf::PdmUiFieldEditorHandle* uiFieldEditorHandle ); + +protected: + QPointer m_label; +}; +} // end namespace caf diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.cpp index b2acbd40dc..8c87e6d4f1 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.cpp @@ -118,15 +118,6 @@ QWidget* PdmUiFilePathEditor::createEditorWidget( QWidget* parent ) return placeholder; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiFilePathEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.h index 8871258010..e8a88675d0 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.h @@ -36,7 +36,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include #include @@ -78,7 +78,7 @@ public: //================================================================================================== /// //================================================================================================== -class PdmUiFilePathEditor : public PdmUiFieldEditorHandle +class PdmUiFilePathEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -89,7 +89,6 @@ public: protected: QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; void configureAndUpdateUi( const QString& uiConfigName ) override; protected slots: @@ -98,10 +97,9 @@ protected slots: void copyToClipboard(); private: - QPointer m_lineEdit; - QPointer m_label; - QPointer m_button; - QPointer m_copyToClipboardButton; + QPointer m_lineEdit; + QPointer m_button; + QPointer m_copyToClipboardButton; PdmUiFilePathEditorAttribute m_attributes; }; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiLabelEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiLabelEditor.cpp index 028c560a2d..4cdb3bc8b0 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiLabelEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiLabelEditor.cpp @@ -39,6 +39,7 @@ #include "cafPdmUiFieldEditorHandle.h" #include "cafPdmUiFieldHandle.h" #include "cafPdmUiObjectHandle.h" +#include "cafQShortenedLabel.h" namespace caf { diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiLabelEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiLabelEditor.h index ad4091884a..13b607b4f3 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiLabelEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiLabelEditor.h @@ -37,7 +37,6 @@ #pragma once #include "cafPdmUiFieldEditorHandle.h" -#include "cafQShortenedLabel.h" #include #include diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.cpp index e41572017f..90221584c0 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.cpp @@ -115,15 +115,6 @@ QWidget* PdmUiLineEditor::createEditorWidget( QWidget* parent ) return m_lineEdit; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiLineEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.h index 5f9c8811b5..d22f96d4cb 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.h @@ -36,7 +36,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include #include @@ -115,7 +115,7 @@ private: //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -class PdmUiLineEditor : public PdmUiFieldEditorHandle +class PdmUiLineEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -131,7 +131,6 @@ public: protected: QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; void configureAndUpdateUi( const QString& uiConfigName ) override; QMargins calculateLabelContentMargins() const override; @@ -146,8 +145,7 @@ private: bool isMultipleFieldsWithSameKeywordSelected( PdmFieldHandle* editorField ) const; protected: - QPointer m_lineEdit; - QPointer m_label; + QPointer m_lineEdit; QPointer m_autoValueToolButton; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp index 28b063300c..92d913e17f 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp @@ -288,15 +288,6 @@ QWidget* PdmUiListEditor::createEditorWidget( QWidget* parent ) return m_listView; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiListEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -523,4 +514,16 @@ bool PdmUiListEditor::isMultiRowEditor() const return true; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +PdmUiListEditorAttribute::PdmUiListEditorAttribute() + : heightHint( 2000 ) + , allowHorizontalScrollBar( true ) +{ + QPalette myPalette; + + baseColor = myPalette.color( QPalette::Active, QPalette::Base ); +} + } // end namespace caf diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.h index d343c106e4..b80094847a 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.h @@ -36,7 +36,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include @@ -53,14 +53,7 @@ namespace caf class PdmUiListEditorAttribute : public PdmUiEditorAttribute { public: - PdmUiListEditorAttribute() - : heightHint( 2000 ) - , allowHorizontalScrollBar( true ) - { - QPalette myPalette; - - baseColor = myPalette.color( QPalette::Active, QPalette::Base ); - } + PdmUiListEditorAttribute(); public: QColor baseColor; @@ -72,7 +65,7 @@ public: //================================================================================================== /// //================================================================================================== -class PdmUiListEditor : public PdmUiFieldEditorHandle +class PdmUiListEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -83,7 +76,6 @@ public: protected: QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; void configureAndUpdateUi( const QString& uiConfigName ) override; bool eventFilter( QObject* listView, QEvent* event ) override; // To catch delete key press in list view. bool isMultiRowEditor() const override; @@ -101,7 +93,6 @@ private: private: QPointer m_listView; - QPointer m_label; QPointer m_model; bool m_isEditOperationsAvailable; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.cpp index 6c889f3534..909e3d3c95 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.cpp @@ -36,14 +36,12 @@ #include "cafPdmUiPushButtonEditor.h" -#include "cafPdmUiDefaultObjectEditor.h" - +#include "cafFactory.h" #include "cafPdmField.h" #include "cafPdmObject.h" +#include "cafPdmUiDefaultObjectEditor.h" #include "cafPdmUiFieldEditorHandle.h" -#include "cafFactory.h" - #include #include @@ -171,15 +169,6 @@ QWidget* PdmUiPushButtonEditor::createEditorWidget( QWidget* parent ) return containerWidget; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiPushButtonEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.h index 269c80a97a..fdc8648d6b 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.h @@ -36,7 +36,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include #include @@ -60,7 +60,7 @@ public: //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -class PdmUiPushButtonEditor : public PdmUiFieldEditorHandle +class PdmUiPushButtonEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -74,16 +74,14 @@ public: protected: QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; void configureAndUpdateUi( const QString& uiConfigName ) override; protected slots: void slotClicked( bool checked ); private: - QPointer m_pushButton; - QPointer m_label; - QPointer m_buttonLayout; + QPointer m_pushButton; + QPointer m_buttonLayout; }; } // end namespace caf diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiSliderEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiSliderEditor.cpp index f3140d4518..317edf1380 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiSliderEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiSliderEditor.cpp @@ -36,13 +36,12 @@ #include "cafPdmUiSliderEditor.h" +#include "cafFactory.h" #include "cafPdmField.h" #include "cafPdmObject.h" #include "cafPdmUiDefaultObjectEditor.h" #include "cafPdmUiFieldEditorHandle.h" -#include "cafFactory.h" - #include #include #include @@ -120,15 +119,6 @@ QWidget* PdmUiSliderEditor::createEditorWidget( QWidget* parent ) return containerWidget; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiSliderEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiSliderEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiSliderEditor.h index 8f76eb660d..ad273135fd 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiSliderEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiSliderEditor.h @@ -36,7 +36,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include #include @@ -69,7 +69,7 @@ public: int m_step; }; -class PdmUiSliderEditor : public PdmUiFieldEditorHandle +class PdmUiSliderEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -81,7 +81,6 @@ public: protected: void configureAndUpdateUi( const QString& uiConfigName ) override; QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; protected slots: void slotSliderValueChanged( int position ); @@ -92,9 +91,8 @@ private: void writeValueToField(); private: - QPointer m_spinBox; - QPointer m_slider; - QPointer m_label; + QPointer m_spinBox; + QPointer m_slider; PdmUiSliderEditorAttribute m_attributes; }; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.cpp index 55adc2893c..797c32f473 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.cpp @@ -42,6 +42,7 @@ #include "cafPdmUiEditorHandle.h" #include "cafPdmUiTableViewDelegate.h" #include "cafPdmUiTableViewQModel.h" +#include "cafQShortenedLabel.h" #include "cafSelectionManager.h" #include diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.h index b95cab8712..c0c81fee3a 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.h @@ -163,8 +163,8 @@ private slots: private: friend class FocusEventHandler; - QPointer m_tableHeading; - QPointer m_tableHeadingIcon; + QPointer m_tableHeading; + QPointer m_tableHeadingIcon; TableView* m_tableView; PdmUiTableViewQModel* m_tableModelPdm; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTextEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTextEditor.cpp index 52d065c87a..0718b558a9 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTextEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTextEditor.cpp @@ -208,15 +208,6 @@ QWidget* PdmUiTextEditor::createEditorWidget( QWidget* parent ) return containerWidget; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiTextEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTextEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTextEditor.h index 570d79e4d3..d33a570016 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTextEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTextEditor.h @@ -36,7 +36,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include #include @@ -112,7 +112,7 @@ private: //================================================================================================== /// An editor to show (and possibly edit?) formatted larger portions of text //================================================================================================== -class PdmUiTextEditor : public PdmUiFieldEditorHandle +class PdmUiTextEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -123,7 +123,6 @@ public: protected: QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; void configureAndUpdateUi( const QString& uiConfigName ) override; bool isMultiRowEditor() const override; @@ -134,9 +133,8 @@ private: QTextOption::WrapMode toQTextOptionWrapMode( PdmUiTextEditorAttribute::WrapMode wrapMode ); private: - QPointer m_textEdit; - QPointer m_saveButton; - QPointer m_label; + QPointer m_textEdit; + QPointer m_saveButton; PdmUiTextEditorAttribute::TextMode m_textMode; }; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTimeEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTimeEditor.cpp index 6b68545df1..17b9e42f96 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTimeEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTimeEditor.cpp @@ -94,15 +94,6 @@ QWidget* PdmUiTimeEditor::createEditorWidget( QWidget* parent ) return m_timeEdit; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiTimeEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTimeEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTimeEditor.h index 41f9a6b18a..e92ce58cd2 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTimeEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTimeEditor.h @@ -36,7 +36,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include #include @@ -60,7 +60,7 @@ public: //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -class PdmUiTimeEditor : public PdmUiFieldEditorHandle +class PdmUiTimeEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -71,7 +71,6 @@ public: protected: QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; void configureAndUpdateUi( const QString& uiConfigName ) override; protected slots: @@ -79,8 +78,7 @@ protected slots: void slotTimeChanged( const QTime& time ); private: - QPointer m_timeEdit; - QPointer m_label; + QPointer m_timeEdit; PdmUiTimeEditorAttribute m_attributes; }; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp index 14db565afe..76433d45b3 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp @@ -382,15 +382,6 @@ QWidget* PdmUiTreeSelectionEditor::createEditorWidget( QWidget* parent ) return frame; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiTreeSelectionEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.h index 32edc020a2..5d6fca4316 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.h @@ -35,7 +35,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include @@ -92,7 +92,7 @@ public: //================================================================================================== /// //================================================================================================== -class PdmUiTreeSelectionEditor : public PdmUiFieldEditorHandle +class PdmUiTreeSelectionEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -104,7 +104,6 @@ public: protected: void configureAndUpdateUi( const QString& uiConfigName ) override; QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; QMargins calculateLabelContentMargins() const override; bool isMultiRowEditor() const override; @@ -142,7 +141,6 @@ private: private: QPointer m_treeView; - QPointer m_label; QPointer m_toggleAllCheckBox; QPointer m_textFilterLineEdit; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiValueRangeEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiValueRangeEditor.cpp index 8c86f63aad..8ce6abc2c4 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiValueRangeEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiValueRangeEditor.cpp @@ -287,13 +287,4 @@ QWidget* PdmUiValueRangeEditor::createEditorWidget( QWidget* parent ) return containerWidget; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiValueRangeEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - } // end namespace caf diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiValueRangeEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiValueRangeEditor.h index 20cabef17d..0032275ef4 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiValueRangeEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiValueRangeEditor.h @@ -36,7 +36,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include "cafPdmUiSliderTools.h" class QLineEdit; @@ -46,7 +46,7 @@ namespace caf //================================================================================================== /// //================================================================================================== -class PdmUiValueRangeEditor : public PdmUiFieldEditorHandle +class PdmUiValueRangeEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -57,7 +57,6 @@ public: protected: QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; void configureAndUpdateUi( const QString& uiConfigName ) override; private slots: @@ -78,9 +77,8 @@ private: QPointer m_lineEditMax; QPointer m_sliderMax; - QPointer m_label; - double m_sliderValueMin; - double m_sliderValueMax; + double m_sliderValueMin; + double m_sliderValueMax; PdmUiDoubleSliderEditorAttribute m_attributes; }; From 59df36ddfcac81d2afd22c15a70f135e1bb88dd8 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 25 Nov 2024 10:44:59 +0100 Subject: [PATCH 136/160] Bump to dev.06 --- ResInsightVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index a2cce6ed77..8e6b5fd9c8 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -11,7 +11,7 @@ set(RESINSIGHT_VERSION_TEXT "-dev") # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -set(RESINSIGHT_DEV_VERSION ".05") +set(RESINSIGHT_DEV_VERSION ".06") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") From 41b19943114459126c60197a1ddc94503fa30793 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Tue, 26 Nov 2024 15:40:56 +0100 Subject: [PATCH 137/160] Allow reading unrst files without seqnum array (#11927) --- ThirdParty/custom-opm-common/opm-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ThirdParty/custom-opm-common/opm-common b/ThirdParty/custom-opm-common/opm-common index ebec02d410..6a867bab89 160000 --- a/ThirdParty/custom-opm-common/opm-common +++ b/ThirdParty/custom-opm-common/opm-common @@ -1 +1 @@ -Subproject commit ebec02d410e4f227a5d128ce9fe081f209fcb56b +Subproject commit 6a867bab89a119b9bab729195cdc8209ab57112f From 1199d761eea48f8166161ee5bdd08037057f0b49 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Tue, 26 Nov 2024 15:29:14 +0100 Subject: [PATCH 138/160] Contour map geomech: fix bug with visibility map --- .../ReservoirDataModel/RigGeoMechContourMapProjection.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/ReservoirDataModel/RigGeoMechContourMapProjection.cpp b/ApplicationLibCode/ReservoirDataModel/RigGeoMechContourMapProjection.cpp index f39468e2e3..3c79e6d05b 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigGeoMechContourMapProjection.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigGeoMechContourMapProjection.cpp @@ -114,7 +114,8 @@ cvf::BoundingBox RigGeoMechContourMapProjection::calculateExpandedPorBarBBox( Ri std::vector RigGeoMechContourMapProjection::getMapCellVisibility( int viewStepIndex, RigContourMapCalculator::ResultAggregationType resultAggregation ) { - return getMapCellVisibility( m_currentResultAddr, viewStepIndex, resultAggregation ); + m_mapCellVisibility = getMapCellVisibility( m_currentResultAddr, viewStepIndex, resultAggregation ); + return m_mapCellVisibility; } //-------------------------------------------------------------------------------------------------- @@ -187,6 +188,7 @@ void RigGeoMechContourMapProjection::generateAndSaveResults( RigFemResultAddress int viewerStepIndex ) { m_aggregatedResults = generateResultsFromAddress( resultAddress, m_mapCellVisibility, resultAggregation, viewerStepIndex ); + m_currentResultAddr = resultAddress; } //-------------------------------------------------------------------------------------------------- From 24fc63ab6dc62155325ff9b7c84a7dbdb85012df Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 25 Nov 2024 12:33:44 +0100 Subject: [PATCH 139/160] VFP: Make sure table number is included for INJ plots --- .../VerticalFlowPerformance/RimCustomVfpPlot.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/RimCustomVfpPlot.cpp b/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/RimCustomVfpPlot.cpp index 81135fe3b6..74e1cf0751 100644 --- a/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/RimCustomVfpPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/RimCustomVfpPlot.cpp @@ -662,6 +662,7 @@ void RimCustomVfpPlot::onLoadDataAndUpdate() QColor curveColor = curveColors().cycledQColor( colorIndex ); curveNameContent.defaultName = true; + if ( tables.size() > 1 ) curveNameContent.tableNumber = true; populatePlotWidgetWithPlotData( m_plotWidget, vfpPlotData, VfpValueSelection(), tableNumber, curveColor, curveNameContent ); colorIndex++; From e54c4f3c1e39bfc9c090d5ad5641f22c6b78420c Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 26 Nov 2024 09:58:38 +0100 Subject: [PATCH 140/160] Make sure all scheduled redraws are done Snapshot image from the regression test TestCase_Flow was wrong for well allocation plots, the well log part was not updated correctly. --- ApplicationLibCode/Application/RiaApplication.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ApplicationLibCode/Application/RiaApplication.cpp b/ApplicationLibCode/Application/RiaApplication.cpp index 13339fda27..0dcff1eeb0 100644 --- a/ApplicationLibCode/Application/RiaApplication.cpp +++ b/ApplicationLibCode/Application/RiaApplication.cpp @@ -28,6 +28,7 @@ #include "RiaFontCache.h" #include "RiaImportEclipseCaseTools.h" #include "RiaLogging.h" +#include "RiaPlotWindowRedrawScheduler.h" #include "RiaPreferences.h" #include "RiaPreferencesSumo.h" #include "RiaPreferencesSystem.h" @@ -802,6 +803,8 @@ bool RiaApplication::loadProject( const QString& projectFileName, ProjectLoadAct gridCalculation->updateDependentObjects(); } + RiaPlotWindowRedrawScheduler::instance()->performScheduledUpdates(); + RiaLogging::info( QString( "Completed open of project file : '%1'" ).arg( projectFileName ) ); return true; From 26a30ffa50344ccf1e5b25d0b79d76e94a865052 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 27 Nov 2024 09:04:56 +0100 Subject: [PATCH 141/160] Make sure fault geometry always is visible The check for fault was removed in 4cf6a260837ffb275e1a30955446013e9c2711f6 This causes wrong visualization when a range filter is active and a fault is present along the filter. There is some performance issues seen when profiling this code, needs more investigation. --- .../ReservoirDataModel/RigGridBase.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ReservoirDataModel/RigGridBase.cpp b/ApplicationLibCode/ReservoirDataModel/RigGridBase.cpp index 1adbb1716b..fe38e3c80d 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigGridBase.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigGridBase.cpp @@ -550,15 +550,23 @@ bool RigGridCellFaceVisibilityFilter::isFaceVisible( size_t return true; } - size_t neighborCellIndex = m_grid->cellIndexFromIJK( ni, nj, nk ); + // Do not show cell geometry if a fault is present to avoid z fighting between surfaces + // It will always be a better solution to avoid geometry creation instead of part priority and polygon offset + size_t nativeResvCellIndex = m_grid->reservoirCellIndex( cellIndex ); + const RigFault* fault = m_grid->mainGrid()->findFaultFromCellIndexAndCellFace( nativeResvCellIndex, face ); + if ( fault ) + { + return false; + } + size_t neighborCellIndex = m_grid->cellIndexFromIJK( ni, nj, nk ); // If the neighbour cell is invisible, we need to draw the face if ( ( cellVisibility != nullptr ) && !( *cellVisibility )[neighborCellIndex] ) { return true; } - // Do show the faces in the boarder between this grid and a possible LGR. Some of the LGR cells + // Do show the faces in the border between this grid and a possible LGR. Some of the LGR cells // might not be visible. if ( m_grid->mainGrid()->gridCount() > 1 && m_grid->cell( neighborCellIndex ).subGrid() ) { From 4975f260ca0988aa544c071ecbc72b45ea37d0e7 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Wed, 27 Nov 2024 15:15:15 +0100 Subject: [PATCH 142/160] Support showing both scaled and unscaled curves in relperm plot --- .../RiuRelativePermeabilityPlotPanel.cpp | 49 ++++++++++++++----- .../RiuRelativePermeabilityPlotPanel.h | 4 +- 2 files changed, 40 insertions(+), 13 deletions(-) diff --git a/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp b/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp index 61fe537330..16b37542f2 100644 --- a/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp +++ b/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp @@ -92,6 +92,7 @@ RiuRelativePermeabilityPlotPanel::RiuRelativePermeabilityPlotPanel( QWidget* par , m_groupBox( nullptr ) , m_logarithmicScaleKrAxisCheckBox( nullptr ) , m_showUnscaledCheckBox( nullptr ) + , m_showScaledCheckBox( nullptr ) , m_fixedXAxisCheckBox( nullptr ) , m_fixedLeftYAxisCheckBox( nullptr ) @@ -125,10 +126,13 @@ RiuRelativePermeabilityPlotPanel::RiuRelativePermeabilityPlotPanel( QWidget* par m_logarithmicScaleKrAxisCheckBox = new QCheckBox( "Log Scale Kr Axis" ); m_showUnscaledCheckBox = new QCheckBox( "Show Unscaled" ); + m_showScaledCheckBox = new QCheckBox( "Show Scaled" ); m_fixedXAxisCheckBox = new QCheckBox( "Fixed [0, 1] X-axis" ); m_fixedLeftYAxisCheckBox = new QCheckBox( "Fixed [0, 1] Kr-axis" ); + m_fixedXAxisCheckBox->setChecked( true ); m_fixedLeftYAxisCheckBox->setChecked( true ); + m_showScaledCheckBox->setChecked( true ); QCheckBox* showCurveSelection = new QCheckBox( "Show Curve Selection" ); showCurveSelection->setCheckState( Qt::Unchecked ); @@ -138,6 +142,7 @@ RiuRelativePermeabilityPlotPanel::RiuRelativePermeabilityPlotPanel( QWidget* par leftLayout->addWidget( showCurveSelection ); leftLayout->addWidget( m_groupBox ); leftLayout->addWidget( m_logarithmicScaleKrAxisCheckBox ); + leftLayout->addWidget( m_showScaledCheckBox ); leftLayout->addWidget( m_showUnscaledCheckBox ); leftLayout->addWidget( m_fixedXAxisCheckBox ); leftLayout->addWidget( m_fixedLeftYAxisCheckBox ); @@ -153,6 +158,7 @@ RiuRelativePermeabilityPlotPanel::RiuRelativePermeabilityPlotPanel( QWidget* par connect( m_selectedCurvesButtonGroup, SIGNAL( idClicked( int ) ), SLOT( slotButtonInButtonGroupClicked( int ) ) ); connect( m_logarithmicScaleKrAxisCheckBox, SIGNAL( stateChanged( int ) ), SLOT( slotSomeCheckBoxStateChanged( int ) ) ); connect( m_showUnscaledCheckBox, SIGNAL( stateChanged( int ) ), SLOT( slotSomeCheckBoxStateChanged( int ) ) ); + connect( m_showScaledCheckBox, SIGNAL( stateChanged( int ) ), SLOT( slotSomeCheckBoxStateChanged( int ) ) ); connect( m_fixedXAxisCheckBox, SIGNAL( stateChanged( int ) ), SLOT( slotSomeCheckBoxStateChanged( int ) ) ); connect( m_fixedLeftYAxisCheckBox, SIGNAL( stateChanged( int ) ), SLOT( slotSomeCheckBoxStateChanged( int ) ) ); @@ -233,7 +239,7 @@ void RiuRelativePermeabilityPlotPanel::clearPlot() m_caseName.clear(); m_cellReferenceText.clear(); - plotCurvesInQwt( m_unitSystem, m_allCurvesArr, m_swat, m_sgas, m_cellReferenceText, false, true, true, m_qwtPlot, &m_myPlotMarkers ); + plotCurvesInQwt( m_unitSystem, m_allCurvesArr, m_swat, m_sgas, m_cellReferenceText, false, true, true, m_qwtPlot, &m_myPlotMarkers, false ); } //-------------------------------------------------------------------------------------------------- @@ -259,10 +265,21 @@ void RiuRelativePermeabilityPlotPanel::plotUiSelectedCurves() { std::vector selectedCurves = gatherUiSelectedCurves(); - const bool useLogScale = m_logarithmicScaleKrAxisCheckBox->isChecked(); - const bool fixedXAxis = m_fixedXAxisCheckBox->isChecked(); - const bool fixedYAxis = m_fixedLeftYAxisCheckBox->isChecked(); - plotCurvesInQwt( m_unitSystem, selectedCurves, m_swat, m_sgas, m_cellReferenceText, useLogScale, fixedXAxis, fixedYAxis, m_qwtPlot, &m_myPlotMarkers ); + const bool useLogScale = m_logarithmicScaleKrAxisCheckBox->isChecked(); + const bool fixedXAxis = m_fixedXAxisCheckBox->isChecked(); + const bool fixedYAxis = m_fixedLeftYAxisCheckBox->isChecked(); + const bool skipUnscaledLegend = m_showUnscaledCheckBox->isChecked() && m_showScaledCheckBox->isChecked(); + plotCurvesInQwt( m_unitSystem, + selectedCurves, + m_swat, + m_sgas, + m_cellReferenceText, + useLogScale, + fixedXAxis, + fixedYAxis, + m_qwtPlot, + &m_myPlotMarkers, + skipUnscaledLegend ); } //-------------------------------------------------------------------------------------------------- @@ -324,7 +341,8 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt( RiaDefines::EclipseUnitS bool fixedXAxis, bool fixedLeftYAxis, QwtPlot* plot, - std::vector* myPlotMarkers ) + std::vector* myPlotMarkers, + bool skipUnscaledLegends ) { plot->detachItems( QwtPlotItem::Rtti_PlotCurve ); @@ -350,6 +368,8 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt( RiaDefines::EclipseUnitS { const RigFlowDiagSolverInterface::RelPermCurve& curve = curveArr[i]; + const auto unscaledCurve = ( curve.epsMode == RigFlowDiagSolverInterface::RelPermCurve::EPS_OFF ); + // Which axis should this curve be plotted on WhichYAxis plotOnWhichYAxis = LEFT_YAXIS; if ( curve.ident == RigFlowDiagSolverInterface::RelPermCurve::PCOW || curve.ident == RigFlowDiagSolverInterface::RelPermCurve::PCOG ) @@ -394,7 +414,8 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt( RiaDefines::EclipseUnitS const QPen curvePen( QBrush(), 1, penStyle ); qwtCurve->setPen( curvePen ); - auto* curveSymbol = new RiuQwtSymbol( RiuPlotCurveSymbol::SYMBOL_ELLIPSE ); + auto* curveSymbol = unscaledCurve ? new RiuQwtSymbol( RiuPlotCurveSymbol::SYMBOL_CROSS ) + : new RiuQwtSymbol( RiuPlotCurveSymbol::SYMBOL_ELLIPSE ); curveSymbol->setSize( 6, 6 ); curveSymbol->setBrush( Qt::NoBrush ); qwtCurve->setSymbol( curveSymbol ); @@ -403,6 +424,9 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt( RiaDefines::EclipseUnitS qwtCurve->setLegendAttribute( QwtPlotCurve::LegendShowSymbol, true ); qwtCurve->setLegendAttribute( QwtPlotCurve::LegendShowBrush, true ); + const bool showLegend = !( unscaledCurve && skipUnscaledLegends ); + qwtCurve->setItemAttribute( QwtPlotItem::Legend, showLegend ); + qwtCurve->setRenderHint( QwtPlotItem::RenderAntialiased, true ); if ( plotOnWhichYAxis == RIGHT_YAXIS ) @@ -665,18 +689,18 @@ std::vector RiuRelativePermeabilityPlo std::vector selectedCurves; // Determine which curves to actually plot based on selection in GUI - const RigFlowDiagSolverInterface::RelPermCurve::EpsMode epsModeToShow = m_showUnscaledCheckBox->isChecked() - ? RigFlowDiagSolverInterface::RelPermCurve::EPS_OFF - : RigFlowDiagSolverInterface::RelPermCurve::EPS_ON; + const bool showScaled = m_showScaledCheckBox->isChecked(); + const bool showUnscaled = m_showUnscaledCheckBox->isChecked(); for ( size_t i = 0; i < m_allCurvesArr.size(); i++ ) { const RigFlowDiagSolverInterface::RelPermCurve::Ident curveIdent = m_allCurvesArr[i].ident; const RigFlowDiagSolverInterface::RelPermCurve::EpsMode curveEpsMode = m_allCurvesArr[i].epsMode; - if ( curveEpsMode == epsModeToShow ) + if ( m_selectedCurvesButtonGroup->button( curveIdent ) && m_selectedCurvesButtonGroup->button( curveIdent )->isChecked() ) { - if ( m_selectedCurvesButtonGroup->button( curveIdent ) && m_selectedCurvesButtonGroup->button( curveIdent )->isChecked() ) + if ( ( ( curveEpsMode == RigFlowDiagSolverInterface::RelPermCurve::EPS_ON ) && showScaled ) || + ( ( curveEpsMode == RigFlowDiagSolverInterface::RelPermCurve::EPS_OFF ) && showUnscaled ) ) { selectedCurves.push_back( m_allCurvesArr[i] ); } @@ -786,6 +810,7 @@ void RiuRelativePermeabilityPlotPanel::slotShowCurveSelectionWidgets( int state m_groupBox->setVisible( setVisible ); m_showUnscaledCheckBox->setVisible( setVisible ); + m_showScaledCheckBox->setVisible( setVisible ); m_logarithmicScaleKrAxisCheckBox->setVisible( setVisible ); m_fixedXAxisCheckBox->setVisible( setVisible ); m_fixedLeftYAxisCheckBox->setVisible( setVisible ); diff --git a/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.h b/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.h index c45a90ca9b..1c947085fd 100644 --- a/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.h +++ b/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.h @@ -87,7 +87,8 @@ private: bool fixedXAxis, bool fixedLeftYAxis, QwtPlot* plot, - std::vector* myPlotMarkers ); + std::vector* myPlotMarkers, + bool skipUnscaledLegends ); static QString determineXAxisTitleFromCurveCollection( const std::vector& curveArr ); @@ -135,6 +136,7 @@ private: QGroupBox* m_groupBox; QButtonGroup* m_selectedCurvesButtonGroup; QCheckBox* m_showUnscaledCheckBox; + QCheckBox* m_showScaledCheckBox; QCheckBox* m_logarithmicScaleKrAxisCheckBox; QCheckBox* m_fixedXAxisCheckBox; QCheckBox* m_fixedLeftYAxisCheckBox; From 8822de0aeebaabb47fdbef444e9098d1e871973b Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 28 Nov 2024 08:34:18 +0100 Subject: [PATCH 143/160] Use Qt 6.6.3 on Windows --- .github/workflows/ResInsightWithCache.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ResInsightWithCache.yml b/.github/workflows/ResInsightWithCache.yml index 5973dcaf07..0373c9e927 100644 --- a/.github/workflows/ResInsightWithCache.yml +++ b/.github/workflows/ResInsightWithCache.yml @@ -37,7 +37,7 @@ jobs: publish-to-pypi: false, vcpkg-bootstrap: bootstrap-vcpkg.bat, vcpkg-triplet: x64-windows-release, - qt-version: 6.7.0, + qt-version: 6.6.3, ri-unit-test-path: "ResInsight-tests", } - { From bb19ba75a4347da9f8b84bcdb1fbf6190e336640 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Thu, 28 Nov 2024 19:40:17 +0100 Subject: [PATCH 144/160] Add support for deleting OSDU and SUMO user token files (#11935) * Add support for deleting OSDU and SUMO user token files --- .../Application/RiaPreferences.cpp | 30 +++++++++ .../Application/RiaPreferences.h | 4 ++ ApplicationLibCode/Commands/CMakeLists.txt | 2 +- .../CMakeLists_files.cmake | 2 + .../RicDeleteOsduTokenFeature.cpp | 63 +++++++++++++++++++ .../OsduCommands/RicDeleteOsduTokenFeature.h | 35 +++++++++++ .../RicWellPathsImportOsduFeature.cpp | 0 .../RicWellPathsImportOsduFeature.h | 0 .../RiuWellImportWizard.cpp | 0 .../RiuWellImportWizard.h | 0 .../RiuWellLogImportWizard.cpp | 0 .../RiuWellLogImportWizard.h | 0 .../Commands/RicImportWellLogOsduFeature.cpp | 2 +- .../Commands/Sumo/CMakeLists_files.cmake | 2 + .../Sumo/RicDeleteSumoTokenFeature.cpp | 63 +++++++++++++++++++ .../Commands/Sumo/RicDeleteSumoTokenFeature.h | 35 +++++++++++ 16 files changed, 236 insertions(+), 2 deletions(-) rename ApplicationLibCode/Commands/{OsduImportCommands => OsduCommands}/CMakeLists_files.cmake (87%) create mode 100644 ApplicationLibCode/Commands/OsduCommands/RicDeleteOsduTokenFeature.cpp create mode 100644 ApplicationLibCode/Commands/OsduCommands/RicDeleteOsduTokenFeature.h rename ApplicationLibCode/Commands/{OsduImportCommands => OsduCommands}/RicWellPathsImportOsduFeature.cpp (100%) rename ApplicationLibCode/Commands/{OsduImportCommands => OsduCommands}/RicWellPathsImportOsduFeature.h (100%) rename ApplicationLibCode/Commands/{OsduImportCommands => OsduCommands}/RiuWellImportWizard.cpp (100%) rename ApplicationLibCode/Commands/{OsduImportCommands => OsduCommands}/RiuWellImportWizard.h (100%) rename ApplicationLibCode/Commands/{OsduImportCommands => OsduCommands}/RiuWellLogImportWizard.cpp (100%) rename ApplicationLibCode/Commands/{OsduImportCommands => OsduCommands}/RiuWellLogImportWizard.h (100%) create mode 100644 ApplicationLibCode/Commands/Sumo/RicDeleteSumoTokenFeature.cpp create mode 100644 ApplicationLibCode/Commands/Sumo/RicDeleteSumoTokenFeature.h diff --git a/ApplicationLibCode/Application/RiaPreferences.cpp b/ApplicationLibCode/Application/RiaPreferences.cpp index a592fd4e8d..90ecb57cb5 100644 --- a/ApplicationLibCode/Application/RiaPreferences.cpp +++ b/ApplicationLibCode/Application/RiaPreferences.cpp @@ -32,6 +32,9 @@ #include "RiaQDateTimeTools.h" #include "RiaValidRegExpValidator.h" +#include "OsduCommands//RicDeleteOsduTokenFeature.h" +#include "Sumo/RicDeleteSumoTokenFeature.h" + #include "RiuGuiTheme.h" #include "cafPdmFieldCvfColor.h" @@ -42,6 +45,7 @@ #include "cafPdmUiFieldHandle.h" #include "cafPdmUiFilePathEditor.h" #include "cafPdmUiLineEditor.h" +#include "cafPdmUiPushButtonEditor.h" #include #include @@ -270,9 +274,15 @@ RiaPreferences::RiaPreferences() CAF_PDM_InitFieldNoDefault( &m_osduPreferences, "osduPreferences", "osduPreferences" ); m_osduPreferences = new RiaPreferencesOsdu; + CAF_PDM_InitField( &m_deleteOsduToken, "deleteOsduToken", false, "" ); + caf::PdmUiPushButtonEditor::configureEditorLabelHidden( &m_deleteOsduToken ); + m_deleteOsduToken.xmlCapability()->disableIO(); CAF_PDM_InitFieldNoDefault( &m_sumoPreferences, "sumoPreferences", "sumoPreferences" ); m_sumoPreferences = new RiaPreferencesSumo; + CAF_PDM_InitField( &m_deleteSumoToken, "deleteSumoToken", false, "" ); + caf::PdmUiPushButtonEditor::configureEditorLabelHidden( &m_deleteSumoToken ); + m_deleteSumoToken.xmlCapability()->disableIO(); } //-------------------------------------------------------------------------------------------------- @@ -338,6 +348,14 @@ void RiaPreferences::defineEditorAttribute( const caf::PdmFieldHandle* field, QS myAttr->validator = new QDoubleValidator( 0.000001, 100000.0, 6 ); } } + else if ( ( field == &m_deleteOsduToken ) || ( field == &m_deleteSumoToken ) ) + { + auto* pbAttribute = dynamic_cast( attribute ); + if ( pbAttribute ) + { + pbAttribute->m_buttonText = "Delete Token"; + } + } } //-------------------------------------------------------------------------------------------------- @@ -476,10 +494,12 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& caf::PdmUiGroup* osduGroup = uiOrdering.addNewGroup( "OSDU" ); osduGroup->setCollapsedByDefault(); m_osduPreferences()->uiOrdering( uiConfigName, *osduGroup ); + osduGroup->add( &m_deleteOsduToken ); caf::PdmUiGroup* sumoGroup = uiOrdering.addNewGroup( "SUMO" ); sumoGroup->setCollapsedByDefault(); m_sumoPreferences()->uiOrdering( uiConfigName, *sumoGroup ); + sumoGroup->add( &m_deleteSumoToken ); } else if ( RiaApplication::enableDevelopmentFeatures() && uiConfigName == RiaPreferences::tabNameSystem() ) { @@ -547,6 +567,16 @@ void RiaPreferences::fieldChangedByUi( const caf::PdmFieldHandle* changedField, { RiuGuiTheme::updateGuiTheme( m_guiTheme() ); } + else if ( changedField == &m_deleteOsduToken ) + { + RicDeleteOsduTokenFeature::deleteUserToken(); + m_deleteOsduToken = false; + } + else if ( changedField == &m_deleteSumoToken ) + { + RicDeleteSumoTokenFeature::deleteUserToken(); + m_deleteSumoToken = false; + } else { m_summaryPreferences->fieldChangedByUi( changedField, oldValue, newValue ); diff --git a/ApplicationLibCode/Application/RiaPreferences.h b/ApplicationLibCode/Application/RiaPreferences.h index c56cccf38c..77508a448a 100644 --- a/ApplicationLibCode/Application/RiaPreferences.h +++ b/ApplicationLibCode/Application/RiaPreferences.h @@ -237,7 +237,11 @@ private: // Osdu settings caf::PdmChildField m_osduPreferences; + caf::PdmField m_deleteOsduToken; + + // sumo settings caf::PdmChildField m_sumoPreferences; + caf::PdmField m_deleteSumoToken; // 3d view caf::PdmField> m_defaultMeshModeType; diff --git a/ApplicationLibCode/Commands/CMakeLists.txt b/ApplicationLibCode/Commands/CMakeLists.txt index 6fc000c3ff..9697a4989a 100644 --- a/ApplicationLibCode/Commands/CMakeLists.txt +++ b/ApplicationLibCode/Commands/CMakeLists.txt @@ -46,7 +46,7 @@ set(COMMAND_REFERENCED_CMAKE_FILES OctaveScriptCommands/CMakeLists_files.cmake OperationsUsingObjReferences/CMakeLists_files.cmake SummaryPlotCommands/CMakeLists_files.cmake - OsduImportCommands/CMakeLists_files.cmake + OsduCommands/CMakeLists_files.cmake StreamlineCommands/CMakeLists_files.cmake SurfaceCommands/CMakeLists_files.cmake SeismicCommands/CMakeLists_files.cmake diff --git a/ApplicationLibCode/Commands/OsduImportCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/OsduCommands/CMakeLists_files.cmake similarity index 87% rename from ApplicationLibCode/Commands/OsduImportCommands/CMakeLists_files.cmake rename to ApplicationLibCode/Commands/OsduCommands/CMakeLists_files.cmake index 185ab41659..2db99b5f03 100644 --- a/ApplicationLibCode/Commands/OsduImportCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/OsduCommands/CMakeLists_files.cmake @@ -2,12 +2,14 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicWellPathsImportOsduFeature.h ${CMAKE_CURRENT_LIST_DIR}/RiuWellImportWizard.h ${CMAKE_CURRENT_LIST_DIR}/RiuWellLogImportWizard.h + ${CMAKE_CURRENT_LIST_DIR}/RicDeleteOsduTokenFeature.h ) set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicWellPathsImportOsduFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuWellImportWizard.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuWellLogImportWizard.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicDeleteOsduTokenFeature.cpp ) list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/Commands/OsduCommands/RicDeleteOsduTokenFeature.cpp b/ApplicationLibCode/Commands/OsduCommands/RicDeleteOsduTokenFeature.cpp new file mode 100644 index 0000000000..05bcb825af --- /dev/null +++ b/ApplicationLibCode/Commands/OsduCommands/RicDeleteOsduTokenFeature.cpp @@ -0,0 +1,63 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "RicDeleteOsduTokenFeature.h" + +#include "RiaDefines.h" +#include "RiaGuiApplication.h" +#include "RiaOsduDefines.h" + +#include +#include +#include + +CAF_CMD_SOURCE_INIT( RicDeleteOsduTokenFeature, "RicDeleteOsduTokenFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicDeleteOsduTokenFeature::deleteUserToken() +{ + const auto filename = RiaOsduDefines::tokenPath(); + if ( !QFile::exists( filename ) ) return; + + auto parent = RiaGuiApplication::instance()->activeWindow(); + + QString question = "Do you want to delete your OSDU token file?"; + auto reply = QMessageBox::question( parent, "Delete token?", question, QMessageBox::Yes, QMessageBox::No ); + if ( reply != QMessageBox::Yes ) return; + + QFile::remove( filename ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicDeleteOsduTokenFeature::onActionTriggered( bool isChecked ) +{ + deleteUserToken(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicDeleteOsduTokenFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Delete OSDU Token" + RiaDefines::betaFeaturePostfix() ); + actionToSetup->setIcon( QIcon( ":/Cloud.svg" ) ); +} diff --git a/ApplicationLibCode/Commands/OsduCommands/RicDeleteOsduTokenFeature.h b/ApplicationLibCode/Commands/OsduCommands/RicDeleteOsduTokenFeature.h new file mode 100644 index 0000000000..618b821df5 --- /dev/null +++ b/ApplicationLibCode/Commands/OsduCommands/RicDeleteOsduTokenFeature.h @@ -0,0 +1,35 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "cafCmdFeature.h" + +//================================================================================================== +/// +//================================================================================================== +class RicDeleteOsduTokenFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + + static void deleteUserToken(); + +protected: + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; diff --git a/ApplicationLibCode/Commands/OsduImportCommands/RicWellPathsImportOsduFeature.cpp b/ApplicationLibCode/Commands/OsduCommands/RicWellPathsImportOsduFeature.cpp similarity index 100% rename from ApplicationLibCode/Commands/OsduImportCommands/RicWellPathsImportOsduFeature.cpp rename to ApplicationLibCode/Commands/OsduCommands/RicWellPathsImportOsduFeature.cpp diff --git a/ApplicationLibCode/Commands/OsduImportCommands/RicWellPathsImportOsduFeature.h b/ApplicationLibCode/Commands/OsduCommands/RicWellPathsImportOsduFeature.h similarity index 100% rename from ApplicationLibCode/Commands/OsduImportCommands/RicWellPathsImportOsduFeature.h rename to ApplicationLibCode/Commands/OsduCommands/RicWellPathsImportOsduFeature.h diff --git a/ApplicationLibCode/Commands/OsduImportCommands/RiuWellImportWizard.cpp b/ApplicationLibCode/Commands/OsduCommands/RiuWellImportWizard.cpp similarity index 100% rename from ApplicationLibCode/Commands/OsduImportCommands/RiuWellImportWizard.cpp rename to ApplicationLibCode/Commands/OsduCommands/RiuWellImportWizard.cpp diff --git a/ApplicationLibCode/Commands/OsduImportCommands/RiuWellImportWizard.h b/ApplicationLibCode/Commands/OsduCommands/RiuWellImportWizard.h similarity index 100% rename from ApplicationLibCode/Commands/OsduImportCommands/RiuWellImportWizard.h rename to ApplicationLibCode/Commands/OsduCommands/RiuWellImportWizard.h diff --git a/ApplicationLibCode/Commands/OsduImportCommands/RiuWellLogImportWizard.cpp b/ApplicationLibCode/Commands/OsduCommands/RiuWellLogImportWizard.cpp similarity index 100% rename from ApplicationLibCode/Commands/OsduImportCommands/RiuWellLogImportWizard.cpp rename to ApplicationLibCode/Commands/OsduCommands/RiuWellLogImportWizard.cpp diff --git a/ApplicationLibCode/Commands/OsduImportCommands/RiuWellLogImportWizard.h b/ApplicationLibCode/Commands/OsduCommands/RiuWellLogImportWizard.h similarity index 100% rename from ApplicationLibCode/Commands/OsduImportCommands/RiuWellLogImportWizard.h rename to ApplicationLibCode/Commands/OsduCommands/RiuWellLogImportWizard.h diff --git a/ApplicationLibCode/Commands/RicImportWellLogOsduFeature.cpp b/ApplicationLibCode/Commands/RicImportWellLogOsduFeature.cpp index 183329b25d..4945760aa1 100644 --- a/ApplicationLibCode/Commands/RicImportWellLogOsduFeature.cpp +++ b/ApplicationLibCode/Commands/RicImportWellLogOsduFeature.cpp @@ -31,7 +31,7 @@ #include "RimProject.h" #include "RimWellPathCollection.h" -#include "OsduImportCommands/RiuWellLogImportWizard.h" +#include "OsduCommands/RiuWellLogImportWizard.h" #include "RiuMainWindow.h" #include "cafSelectionManager.h" diff --git a/ApplicationLibCode/Commands/Sumo/CMakeLists_files.cmake b/ApplicationLibCode/Commands/Sumo/CMakeLists_files.cmake index 8424c2cd60..32037d10c7 100644 --- a/ApplicationLibCode/Commands/Sumo/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/Sumo/CMakeLists_files.cmake @@ -1,9 +1,11 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicCreateSumoEnsembleFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicDeleteSumoTokenFeature.h ) set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicCreateSumoEnsembleFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicDeleteSumoTokenFeature.cpp ) list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/Commands/Sumo/RicDeleteSumoTokenFeature.cpp b/ApplicationLibCode/Commands/Sumo/RicDeleteSumoTokenFeature.cpp new file mode 100644 index 0000000000..7d68372596 --- /dev/null +++ b/ApplicationLibCode/Commands/Sumo/RicDeleteSumoTokenFeature.cpp @@ -0,0 +1,63 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "RicDeleteSumoTokenFeature.h" + +#include "RiaDefines.h" +#include "RiaGuiApplication.h" +#include "Tools/Cloud/RiaSumoDefines.h" + +#include +#include +#include + +CAF_CMD_SOURCE_INIT( RicDeleteSumoTokenFeature, "RicDeleteSumoTokenFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicDeleteSumoTokenFeature::deleteUserToken() +{ + const auto filename = RiaSumoDefines::tokenPath(); + if ( !QFile::exists( filename ) ) return; + + auto parent = RiaGuiApplication::instance()->activeWindow(); + + QString question = "Do you want to delete your SUMO token file?"; + auto reply = QMessageBox::question( parent, "Delete token?", question, QMessageBox::Yes, QMessageBox::No ); + if ( reply != QMessageBox::Yes ) return; + + QFile::remove( filename ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicDeleteSumoTokenFeature::onActionTriggered( bool isChecked ) +{ + deleteUserToken(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicDeleteSumoTokenFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Delete SUMO Token" + RiaDefines::betaFeaturePostfix() ); + actionToSetup->setIcon( QIcon( ":/Cloud.svg" ) ); +} diff --git a/ApplicationLibCode/Commands/Sumo/RicDeleteSumoTokenFeature.h b/ApplicationLibCode/Commands/Sumo/RicDeleteSumoTokenFeature.h new file mode 100644 index 0000000000..2f7807949e --- /dev/null +++ b/ApplicationLibCode/Commands/Sumo/RicDeleteSumoTokenFeature.h @@ -0,0 +1,35 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024- 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 "cafCmdFeature.h" + +//================================================================================================== +/// +//================================================================================================== +class RicDeleteSumoTokenFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + + static void deleteUserToken(); + +protected: + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; From 041e2f2e13d172a017a4e90cdee34f7ddf727b32 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 28 Nov 2024 10:41:14 +0100 Subject: [PATCH 145/160] #11938 Cloud Config: Show the full path to config file for cloud services --- .../Application/RiaApplication.cpp | 56 +--------------- .../Application/RiaConsoleApplication.cpp | 3 + .../Application/RiaGuiApplication.cpp | 3 + .../Application/RiaPreferences.cpp | 1 + .../Application/RiaPreferences.h | 1 - .../Tools/Cloud/RiaConnectorTools.cpp | 64 +++++++++++++++++++ .../Tools/Cloud/RiaConnectorTools.h | 4 ++ 7 files changed, 76 insertions(+), 56 deletions(-) diff --git a/ApplicationLibCode/Application/RiaApplication.cpp b/ApplicationLibCode/Application/RiaApplication.cpp index 0dcff1eeb0..2e310f7b4b 100644 --- a/ApplicationLibCode/Application/RiaApplication.cpp +++ b/ApplicationLibCode/Application/RiaApplication.cpp @@ -30,6 +30,7 @@ #include "RiaLogging.h" #include "RiaPlotWindowRedrawScheduler.h" #include "RiaPreferences.h" +#include "RiaPreferencesOsdu.h" #include "RiaPreferencesSumo.h" #include "RiaPreferencesSystem.h" #include "RiaProjectModifier.h" @@ -1477,59 +1478,6 @@ cvf::Font* RiaApplication::defaultWellLabelFont() return m_defaultWellLabelFont.p(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -auto readCloudConfigFiles = []( RiaPreferences* preferences ) -{ - if ( preferences == nullptr ) return; - - // Check multiple locations for configuration files. The first valid configuration file is used. Currently, using Qt5 the ResInsight - // binary file is stored at the root of the installation folder. When moving to Qt6, we will probably use sub folders /bin /lib and - // others. Support both one and two search levels to support Qt6. - // - // home_folder/.resinsight/*_config.json - // location_of_resinsight_executable/../share/cloud_services/*_config.json - // location_of_resinsight_executable/../../share/cloud_services/*_config.json - // - - { - QStringList osduFilePathCandidates; - osduFilePathCandidates << QDir::homePath() + "/.resinsight/osdu_config.json"; - osduFilePathCandidates << QCoreApplication::applicationDirPath() + "/../share/cloud_services/osdu_config.json"; - osduFilePathCandidates << QCoreApplication::applicationDirPath() + "/../../share/cloud_services/osdu_config.json"; - - for ( const auto& osduFileCandidate : osduFilePathCandidates ) - { - auto keyValuePairs = RiaConnectorTools::readKeyValuePairs( osduFileCandidate ); - if ( !keyValuePairs.empty() ) - { - preferences->osduPreferences()->setData( keyValuePairs ); - preferences->osduPreferences()->setFieldsReadOnly(); - break; - } - } - } - - { - QStringList sumoFilePathCandidates; - sumoFilePathCandidates << QDir::homePath() + "/.resinsight/sumo_config.json"; - sumoFilePathCandidates << QCoreApplication::applicationDirPath() + "/../share/cloud_services/sumo_config.json"; - sumoFilePathCandidates << QCoreApplication::applicationDirPath() + "/../../share/cloud_services/sumo_config.json"; - - for ( const auto& sumoFileCandidate : sumoFilePathCandidates ) - { - auto keyValuePairs = RiaConnectorTools::readKeyValuePairs( sumoFileCandidate ); - if ( !keyValuePairs.empty() ) - { - preferences->sumoPreferences()->setData( keyValuePairs ); - preferences->sumoPreferences()->setFieldsReadOnly(); - break; - } - } - } -}; - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1548,8 +1496,6 @@ void RiaApplication::initialize() caf::SelectionManager::instance()->setPdmRootObject( project() ); initializeDataLoadController(); - - readCloudConfigFiles( m_preferences.get() ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaConsoleApplication.cpp b/ApplicationLibCode/Application/RiaConsoleApplication.cpp index eb5ff1b85c..5812533cd4 100644 --- a/ApplicationLibCode/Application/RiaConsoleApplication.cpp +++ b/ApplicationLibCode/Application/RiaConsoleApplication.cpp @@ -17,6 +17,7 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RiaConsoleApplication.h" +#include "Cloud/RiaConnectorTools.h" #include "RiaArgumentParser.h" #include "RiaLogging.h" #include "RiaPreferences.h" @@ -109,6 +110,8 @@ void RiaConsoleApplication::initialize() RiaLogging::appendLoggerInstance( std::move( logger ) ); m_socketServer = new RiaSocketServer( this ); + + RiaConnectorTools::readCloudConfigFiles( m_preferences.get() ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index ff5ec40b53..82f01ee6b2 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -20,6 +20,7 @@ #include "RiaGuiApplication.h" +#include "Cloud/RiaConnectorTools.h" #include "RiaArgumentParser.h" #include "RiaBaseDefs.h" #include "RiaDefines.h" @@ -445,6 +446,8 @@ void RiaGuiApplication::initialize() } } m_socketServer = new RiaSocketServer( this ); + + RiaConnectorTools::readCloudConfigFiles( m_preferences.get() ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaPreferences.cpp b/ApplicationLibCode/Application/RiaPreferences.cpp index 90ecb57cb5..0bfa6424b5 100644 --- a/ApplicationLibCode/Application/RiaPreferences.cpp +++ b/ApplicationLibCode/Application/RiaPreferences.cpp @@ -26,6 +26,7 @@ #include "RiaLogging.h" #include "RiaPreferencesGeoMech.h" #include "RiaPreferencesGrid.h" +#include "RiaPreferencesOsdu.h" #include "RiaPreferencesSummary.h" #include "RiaPreferencesSumo.h" #include "RiaPreferencesSystem.h" diff --git a/ApplicationLibCode/Application/RiaPreferences.h b/ApplicationLibCode/Application/RiaPreferences.h index 77508a448a..4fc1b41462 100644 --- a/ApplicationLibCode/Application/RiaPreferences.h +++ b/ApplicationLibCode/Application/RiaPreferences.h @@ -24,7 +24,6 @@ #include "RiaDateTimeDefines.h" #include "RiaDefines.h" #include "RiaFontCache.h" -#include "RiaPreferencesOsdu.h" #include "cafAppEnum.h" #include "cafPdmChildField.h" diff --git a/ApplicationLibCode/Application/Tools/Cloud/RiaConnectorTools.cpp b/ApplicationLibCode/Application/Tools/Cloud/RiaConnectorTools.cpp index eb1e650e57..93511cec94 100644 --- a/ApplicationLibCode/Application/Tools/Cloud/RiaConnectorTools.cpp +++ b/ApplicationLibCode/Application/Tools/Cloud/RiaConnectorTools.cpp @@ -18,6 +18,11 @@ #include "RiaConnectorTools.h" +#include "RiaLogging.h" +#include "RiaPreferences.h" +#include "RiaPreferencesOsdu.h" +#include "RiaPreferencesSumo.h" + #include #include #include @@ -26,6 +31,8 @@ #include #include +#include + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -121,3 +128,60 @@ std::map RiaConnectorTools::readKeyValuePairs( const QString& return keyValuePairs; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaConnectorTools::readCloudConfigFiles( RiaPreferences* preferences ) +{ + if ( preferences == nullptr ) return; + + // Check multiple locations for configuration files. The first valid configuration file is used. Currently, using Qt5 the ResInsight + // binary file is stored at the root of the installation folder. When moving to Qt6, we will probably use sub folders /bin /lib and + // others. Support both one and two search levels to support Qt6. + // + // home_folder/.resinsight/*_config.json + // location_of_resinsight_executable/../share/cloud_services/*_config.json + // location_of_resinsight_executable/../../share/cloud_services/*_config.json + // + + { + QStringList osduFilePathCandidates; + osduFilePathCandidates << QDir::homePath() + "/.resinsight/osdu_config.json"; + osduFilePathCandidates << QCoreApplication::applicationDirPath() + "/../share/cloud_services/osdu_config.json"; + osduFilePathCandidates << QCoreApplication::applicationDirPath() + "/../../share/cloud_services/osdu_config.json"; + + for ( const auto& osduFileCandidate : osduFilePathCandidates ) + { + auto keyValuePairs = RiaConnectorTools::readKeyValuePairs( osduFileCandidate ); + if ( !keyValuePairs.empty() ) + { + RiaLogging::info( QString( "Imported OSDU configuration from : '%1'" ).arg( osduFileCandidate ) ); + + preferences->osduPreferences()->setData( keyValuePairs ); + preferences->osduPreferences()->setFieldsReadOnly(); + break; + } + } + } + + { + QStringList sumoFilePathCandidates; + sumoFilePathCandidates << QDir::homePath() + "/.resinsight/sumo_config.json"; + sumoFilePathCandidates << QCoreApplication::applicationDirPath() + "/../share/cloud_services/sumo_config.json"; + sumoFilePathCandidates << QCoreApplication::applicationDirPath() + "/../../share/cloud_services/sumo_config.json"; + + for ( const auto& sumoFileCandidate : sumoFilePathCandidates ) + { + auto keyValuePairs = RiaConnectorTools::readKeyValuePairs( sumoFileCandidate ); + if ( !keyValuePairs.empty() ) + { + RiaLogging::info( QString( "Imported SUMO configuration from : '%1'" ).arg( sumoFileCandidate ) ); + + preferences->sumoPreferences()->setData( keyValuePairs ); + preferences->sumoPreferences()->setFieldsReadOnly(); + break; + } + } + } +} diff --git a/ApplicationLibCode/Application/Tools/Cloud/RiaConnectorTools.h b/ApplicationLibCode/Application/Tools/Cloud/RiaConnectorTools.h index 274ff2a13c..2d38cc2fd1 100644 --- a/ApplicationLibCode/Application/Tools/Cloud/RiaConnectorTools.h +++ b/ApplicationLibCode/Application/Tools/Cloud/RiaConnectorTools.h @@ -22,6 +22,7 @@ #include class QOAuth2AuthorizationCodeFlow; +class RiaPreferences; namespace RiaConnectorTools { @@ -31,4 +32,7 @@ void writeTokenData( const QString& filePath, const QString& tokenDataJson ); QString readStringFromFile( const QString& filePath ); std::map readKeyValuePairs( const QString& filePath ); + +void readCloudConfigFiles( RiaPreferences* preferences ); + } // namespace RiaConnectorTools From 10ce20074b1fe9bbbb39993c25287f349bb8437d Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Thu, 28 Nov 2024 19:03:04 +0100 Subject: [PATCH 146/160] Update to OpenVDS 3.4.4 for improved segy importer --- CMakeLists.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a4dc75f1f..a1322aa8c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -396,12 +396,12 @@ endif() if(MSVC) FetchContent_Declare( openvds - URL https://bluware.jfrog.io/artifactory/Releases-OpenVDSPlus/3.2/openvds+-3.2.7-win.zip + URL https://bluware.jfrog.io/artifactory/Releases-OpenVDSPlus/3.4/openvds+-3.4.4-win.zip ) else() FetchContent_Declare( openvds - URL https://bluware.jfrog.io/artifactory/Releases-OpenVDSPlus/3.2/openvds+-3.2.7-manylinux_2014.tar.gz + URL https://bluware.jfrog.io/artifactory/Releases-OpenVDSPlus/3.4/openvds+-3.4.4-manylinux_2014.tar.gz ) endif() @@ -760,11 +760,11 @@ else() set(OPENVDS_LIB_NAMES libopenvds.so libopenvds.so.3 - libopenvds.so.3.2.7 - libopenvds-e1541338.so.3.2.7 + libopenvds.so.3.4.4 + libopenvds-db55b03b.so.3.4.4 libsegyutils.so libsegyutils.so.3 - libsegyutils.so.3.2.7 + libsegyutils.so.3.4.4 ) foreach(OPENVDS_LIB_NAME ${OPENVDS_LIB_NAMES}) list(APPEND RI_FILENAMES @@ -1009,11 +1009,11 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") set(OPENVDS_SHARED_LIB_FILES ${RESINSIGHT_OPENVDS_API_DIR}/lib64/libopenvds.so ${RESINSIGHT_OPENVDS_API_DIR}/lib64/libopenvds.so.3 - ${RESINSIGHT_OPENVDS_API_DIR}/lib64/libopenvds.so.3.2.7 - ${RESINSIGHT_OPENVDS_API_DIR}/lib64/libopenvds-e1541338.so.3.2.7 + ${RESINSIGHT_OPENVDS_API_DIR}/lib64/libopenvds.so.3.4.4 + ${RESINSIGHT_OPENVDS_API_DIR}/lib64/libopenvds-db55b03b.so.3.4.4 ${RESINSIGHT_OPENVDS_API_DIR}/lib64/libsegyutils.so ${RESINSIGHT_OPENVDS_API_DIR}/lib64/libsegyutils.so.3 - ${RESINSIGHT_OPENVDS_API_DIR}/lib64/libsegyutils.so.3.2.7 + ${RESINSIGHT_OPENVDS_API_DIR}/lib64/libsegyutils.so.3.4.4 ) install(FILES ${OPENVDS_SHARED_LIB_FILES} DESTINATION ${RESINSIGHT_INSTALL_FOLDER} From a4970a2426974fc68cad36f2bd2644946fe70d9f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 29 Nov 2024 08:54:19 +0100 Subject: [PATCH 147/160] Bump to dev.07 --- ResInsightVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index 8e6b5fd9c8..894fd1cb44 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -11,7 +11,7 @@ set(RESINSIGHT_VERSION_TEXT "-dev") # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -set(RESINSIGHT_DEV_VERSION ".06") +set(RESINSIGHT_DEV_VERSION ".07") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") From 3fac7d2045fc3e369e6ad634a7b0adb65e41056f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 29 Nov 2024 15:25:22 +0100 Subject: [PATCH 148/160] Add message in CMake for download of OpenVDS --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a1322aa8c7..59e68133bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -393,6 +393,8 @@ endif() # OpenVDS seismic file access # ############################################################################## +message(STATUS "Starting download of external library OpenVDS ...") + if(MSVC) FetchContent_Declare( openvds @@ -406,6 +408,7 @@ else() endif() FetchContent_MakeAvailable(openvds) +message(STATUS "... completed download of external library OpenVDS") set(RESINSIGHT_OPENVDS_API_DIR ${openvds_SOURCE_DIR}) message(STATUS "Using OpenVDS api from : ${RESINSIGHT_OPENVDS_API_DIR}") From 9ec83836ed07beb39203f879f9263b0700d2fb10 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Fri, 29 Nov 2024 23:43:03 +0100 Subject: [PATCH 149/160] Better command support for multi-select of polygons --- .../RicNewPolygonFilterFeature.cpp | 58 ++++++++++----- .../RicNewPolygonFilterFeature.h | 8 +- .../RicNewPolygonIntersectionFeature.cpp | 31 +++++--- .../RicNewPolygonIntersectionFeature.h | 7 +- .../PolygonCommands/CMakeLists_files.cmake | 2 + .../RicBasicPolygonFeature.cpp | 74 +++++++++++++++++++ .../PolygonCommands/RicBasicPolygonFeature.h | 41 ++++++++++ .../RicDuplicatePolygonFeature.cpp | 23 +++--- .../RicDuplicatePolygonFeature.h | 7 +- .../RicExportPolygonCsvFeature.cpp | 23 +++--- .../RicExportPolygonCsvFeature.h | 7 +- .../RicExportPolygonPolFeature.cpp | 27 ++++--- .../RicExportPolygonPolFeature.h | 7 +- .../RicReloadPolygonFileFeature.cpp | 13 ++-- .../RicSimplifyPolygonFeature.cpp | 25 ++++--- .../RicSimplifyPolygonFeature.h | 7 +- .../Polygons/RimPolygonFile.cpp | 2 +- .../Polygons/RimPolygonTools.cpp | 27 ++++--- .../Polygons/RimPolygonTools.h | 4 +- 19 files changed, 287 insertions(+), 106 deletions(-) create mode 100644 ApplicationLibCode/Commands/PolygonCommands/RicBasicPolygonFeature.cpp create mode 100644 ApplicationLibCode/Commands/PolygonCommands/RicBasicPolygonFeature.h diff --git a/ApplicationLibCode/Commands/CellFilterCommands/RicNewPolygonFilterFeature.cpp b/ApplicationLibCode/Commands/CellFilterCommands/RicNewPolygonFilterFeature.cpp index 274bda4898..7df414c23b 100644 --- a/ApplicationLibCode/Commands/CellFilterCommands/RicNewPolygonFilterFeature.cpp +++ b/ApplicationLibCode/Commands/CellFilterCommands/RicNewPolygonFilterFeature.cpp @@ -37,6 +37,14 @@ CAF_CMD_SOURCE_INIT( RicNewPolygonFilterFeature, "RicNewPolygonFilterFeature" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicNewPolygonFilterFeature::RicNewPolygonFilterFeature() + : RicBasicPolygonFeature( true /*multiselect*/ ) +{ +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -50,7 +58,6 @@ void RicNewPolygonFilterFeature::onActionTriggered( bool isChecked ) } auto cellFilterCollection = caf::SelectionManager::instance()->selectedItemOfType(); - if ( !cellFilterCollection ) { RimGridView* activeView = RiaApplication::instance()->activeMainOrComparisonGridView(); @@ -59,31 +66,40 @@ void RicNewPolygonFilterFeature::onActionTriggered( bool isChecked ) cellFilterCollection = activeView->cellFilterCollection(); } } - if ( !cellFilterCollection ) return; - if ( !polygonDataSource ) - { - auto selectedPolygon = caf::SelectionManager::instance()->selectedItemOfType(); - if ( !selectedPolygon ) - { - if ( auto polygonInView = caf::SelectionManager::instance()->selectedItemOfType() ) - { - selectedPolygon = polygonInView->polygon(); - } - } + auto sourceCase = cellFilterCollection->firstAncestorOrThisOfTypeAsserted()->ownerCase(); + if ( !sourceCase ) return; - polygonDataSource = selectedPolygon; + std::vector polygons; + + if ( polygonDataSource ) + { + polygons.push_back( polygonDataSource ); + } + else + { + polygons = selectedPolygons(); } - auto sourceCase = cellFilterCollection->firstAncestorOrThisOfTypeAsserted()->ownerCase(); - if ( sourceCase ) + RimPolygonFilter* lastItem = nullptr; + + if ( polygons.empty() ) { - if ( auto lastCreatedOrUpdated = cellFilterCollection->addNewPolygonFilter( sourceCase, polygonDataSource ) ) + lastItem = cellFilterCollection->addNewPolygonFilter( sourceCase, nullptr ); + } + else + { + for ( auto polygon : polygons ) { - Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated ); + lastItem = cellFilterCollection->addNewPolygonFilter( sourceCase, polygon ); } } + + if ( lastItem ) + { + Riu3DMainWindowTools::selectAsCurrentItem( lastItem ); + } } //-------------------------------------------------------------------------------------------------- @@ -94,3 +110,11 @@ void RicNewPolygonFilterFeature::setupActionLook( QAction* actionToSetup ) actionToSetup->setIcon( QIcon( ":/CellFilter_Polygon.png" ) ); actionToSetup->setText( "User Defined Polygon Filter" ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicNewPolygonFilterFeature::isCommandEnabled() const +{ + return true; +} diff --git a/ApplicationLibCode/Commands/CellFilterCommands/RicNewPolygonFilterFeature.h b/ApplicationLibCode/Commands/CellFilterCommands/RicNewPolygonFilterFeature.h index 570408e305..1f6726f345 100644 --- a/ApplicationLibCode/Commands/CellFilterCommands/RicNewPolygonFilterFeature.h +++ b/ApplicationLibCode/Commands/CellFilterCommands/RicNewPolygonFilterFeature.h @@ -18,16 +18,20 @@ #pragma once -#include "cafCmdFeature.h" +#include "PolygonCommands/RicBasicPolygonFeature.h" //================================================================================================== /// //================================================================================================== -class RicNewPolygonFilterFeature : public caf::CmdFeature +class RicNewPolygonFilterFeature : public RicBasicPolygonFeature { CAF_CMD_HEADER_INIT; +public: + RicNewPolygonFilterFeature(); + protected: void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; + bool isCommandEnabled() const override; }; diff --git a/ApplicationLibCode/Commands/CrossSectionCommands/RicNewPolygonIntersectionFeature.cpp b/ApplicationLibCode/Commands/CrossSectionCommands/RicNewPolygonIntersectionFeature.cpp index 3ee2f4e7a3..cb4e70c1d5 100644 --- a/ApplicationLibCode/Commands/CrossSectionCommands/RicNewPolygonIntersectionFeature.cpp +++ b/ApplicationLibCode/Commands/CrossSectionCommands/RicNewPolygonIntersectionFeature.cpp @@ -27,12 +27,22 @@ #include "Polygons/RimPolygon.h" #include "Polygons/RimPolygonInView.h" +#include "Riu3DMainWindowTools.h" + #include "cafSelectionManager.h" #include CAF_CMD_SOURCE_INIT( RicNewPolygonIntersectionFeature, "RicNewPolygonIntersectionFeature" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicNewPolygonIntersectionFeature::RicNewPolygonIntersectionFeature() + : RicBasicPolygonFeature( true /*multiselect*/ ) +{ +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -44,18 +54,21 @@ void RicNewPolygonIntersectionFeature::onActionTriggered( bool isChecked ) auto collection = activeView->intersectionCollection(); if ( !collection ) return; - auto polygon = caf::SelectionManager::instance()->selectedItemOfType(); - if ( !polygon ) + auto polygons = selectedPolygons(); + + RimExtrudedCurveIntersection* lastItem = nullptr; + + for ( auto polygon : polygons ) { - if ( auto polygonInView = caf::SelectionManager::instance()->selectedItemOfType() ) - { - polygon = polygonInView->polygon(); - } + auto intersection = new RimExtrudedCurveIntersection(); + intersection->configureForProjectPolyLine( polygon ); + collection->appendIntersectionAndUpdate( intersection ); } - auto intersection = new RimExtrudedCurveIntersection(); - intersection->configureForProjectPolyLine( polygon ); - collection->appendIntersectionAndUpdate( intersection ); + if ( lastItem != nullptr ) + { + Riu3DMainWindowTools::selectAsCurrentItem( lastItem ); + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/CrossSectionCommands/RicNewPolygonIntersectionFeature.h b/ApplicationLibCode/Commands/CrossSectionCommands/RicNewPolygonIntersectionFeature.h index f06741ab06..efdb291c0f 100644 --- a/ApplicationLibCode/Commands/CrossSectionCommands/RicNewPolygonIntersectionFeature.h +++ b/ApplicationLibCode/Commands/CrossSectionCommands/RicNewPolygonIntersectionFeature.h @@ -18,15 +18,18 @@ #pragma once -#include "cafCmdFeature.h" +#include "PolygonCommands/RicBasicPolygonFeature.h" //================================================================================================== /// //================================================================================================== -class RicNewPolygonIntersectionFeature : public caf::CmdFeature +class RicNewPolygonIntersectionFeature : public RicBasicPolygonFeature { CAF_CMD_HEADER_INIT; +public: + RicNewPolygonIntersectionFeature(); + protected: void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/PolygonCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/PolygonCommands/CMakeLists_files.cmake index c4afbccf2d..f9f047dd19 100644 --- a/ApplicationLibCode/Commands/PolygonCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/PolygonCommands/CMakeLists_files.cmake @@ -6,6 +6,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicExportPolygonCsvFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicExportPolygonPolFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicSimplifyPolygonFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicBasicPolygonFeature.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -16,6 +17,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicExportPolygonCsvFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicExportPolygonPolFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicSimplifyPolygonFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicBasicPolygonFeature.cpp ) list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/Commands/PolygonCommands/RicBasicPolygonFeature.cpp b/ApplicationLibCode/Commands/PolygonCommands/RicBasicPolygonFeature.cpp new file mode 100644 index 0000000000..c655828ae2 --- /dev/null +++ b/ApplicationLibCode/Commands/PolygonCommands/RicBasicPolygonFeature.cpp @@ -0,0 +1,74 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024 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 "RicBasicPolygonFeature.h" + +#include "Polygons/RimPolygon.h" +#include "Polygons/RimPolygonInView.h" + +#include "cafSelectionManager.h" +#include + +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicBasicPolygonFeature::RicBasicPolygonFeature( bool multiSelectSupported ) + : m_multiSelectSupported( multiSelectSupported ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicBasicPolygonFeature::isCommandEnabled() const +{ + auto polygons = selectedPolygons(); + + return m_multiSelectSupported ? polygons.size() > 0 : polygons.size() == 1; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RicBasicPolygonFeature::selectedPolygons() const +{ + std::set uniquePolygons; + + auto polygons = caf::selectedObjectsByType(); + auto polygonivs = caf::selectedObjectsByType(); + for ( auto piv : polygonivs ) + { + polygons.push_back( piv->polygon() ); + } + + // make sure we avoid duplicates + for ( auto p : polygons ) + { + uniquePolygons.insert( p ); + } + + std::vector returnPolygons; + for ( auto p : uniquePolygons ) + { + returnPolygons.push_back( p ); + } + + return returnPolygons; +} diff --git a/ApplicationLibCode/Commands/PolygonCommands/RicBasicPolygonFeature.h b/ApplicationLibCode/Commands/PolygonCommands/RicBasicPolygonFeature.h new file mode 100644 index 0000000000..a8f62e1fb9 --- /dev/null +++ b/ApplicationLibCode/Commands/PolygonCommands/RicBasicPolygonFeature.h @@ -0,0 +1,41 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2024 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 "cafCmdFeature.h" + +#include + +class RimPolygon; + +//================================================================================================== +/// +//================================================================================================== +class RicBasicPolygonFeature : public caf::CmdFeature +{ +public: + RicBasicPolygonFeature( bool multiSelectSupported ); + +protected: + std::vector selectedPolygons() const; + bool isCommandEnabled() const override; + +private: + bool m_multiSelectSupported; +}; diff --git a/ApplicationLibCode/Commands/PolygonCommands/RicDuplicatePolygonFeature.cpp b/ApplicationLibCode/Commands/PolygonCommands/RicDuplicatePolygonFeature.cpp index 7c0101dd7e..8da3c923f7 100644 --- a/ApplicationLibCode/Commands/PolygonCommands/RicDuplicatePolygonFeature.cpp +++ b/ApplicationLibCode/Commands/PolygonCommands/RicDuplicatePolygonFeature.cpp @@ -31,26 +31,29 @@ #include "Riu3DMainWindowTools.h" #include "cafSelectionManager.h" +#include "cafSelectionManagerTools.h" + #include CAF_CMD_SOURCE_INIT( RicDuplicatePolygonFeature, "RicDuplicatePolygonFeature" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicDuplicatePolygonFeature::RicDuplicatePolygonFeature() + : RicBasicPolygonFeature( false /*multiselect*/ ) +{ +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicDuplicatePolygonFeature::onActionTriggered( bool isChecked ) { - auto sourcePolygon = caf::SelectionManager::instance()->selectedItemOfType(); - if ( !sourcePolygon ) - { - auto sourcePolygonInView = caf::SelectionManager::instance()->selectedItemOfType(); - if ( sourcePolygonInView ) - { - sourcePolygon = sourcePolygonInView->polygon(); - } - } + auto selPolygons = selectedPolygons(); + if ( selPolygons.empty() ) return; - if ( !sourcePolygon ) return; + auto sourcePolygon = selPolygons[0]; auto proj = RimProject::current(); auto polygonCollection = proj->activeOilField()->polygonCollection(); diff --git a/ApplicationLibCode/Commands/PolygonCommands/RicDuplicatePolygonFeature.h b/ApplicationLibCode/Commands/PolygonCommands/RicDuplicatePolygonFeature.h index a54a5975fa..67c7e5672b 100644 --- a/ApplicationLibCode/Commands/PolygonCommands/RicDuplicatePolygonFeature.h +++ b/ApplicationLibCode/Commands/PolygonCommands/RicDuplicatePolygonFeature.h @@ -18,15 +18,18 @@ #pragma once -#include "cafCmdFeature.h" +#include "RicBasicPolygonFeature.h" //================================================================================================== /// //================================================================================================== -class RicDuplicatePolygonFeature : public caf::CmdFeature +class RicDuplicatePolygonFeature : public RicBasicPolygonFeature { CAF_CMD_HEADER_INIT; +public: + RicDuplicatePolygonFeature(); + protected: void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/PolygonCommands/RicExportPolygonCsvFeature.cpp b/ApplicationLibCode/Commands/PolygonCommands/RicExportPolygonCsvFeature.cpp index 64e05b7942..2825762480 100644 --- a/ApplicationLibCode/Commands/PolygonCommands/RicExportPolygonCsvFeature.cpp +++ b/ApplicationLibCode/Commands/PolygonCommands/RicExportPolygonCsvFeature.cpp @@ -27,29 +27,28 @@ #include "RiuFileDialogTools.h" -#include "cafSelectionManager.h" - #include #include CAF_CMD_SOURCE_INIT( RicExportPolygonCsvFeature, "RicExportPolygonCsvFeature" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicExportPolygonCsvFeature::RicExportPolygonCsvFeature() + : RicBasicPolygonFeature( false /*multiselect*/ ) +{ +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicExportPolygonCsvFeature::onActionTriggered( bool isChecked ) { - auto sourcePolygon = caf::SelectionManager::instance()->selectedItemOfType(); - if ( !sourcePolygon ) - { - auto sourcePolygonInView = caf::SelectionManager::instance()->selectedItemOfType(); - if ( sourcePolygonInView ) - { - sourcePolygon = sourcePolygonInView->polygon(); - } - } + auto selPolygons = selectedPolygons(); + if ( selPolygons.empty() ) return; - if ( !sourcePolygon ) return; + auto sourcePolygon = selPolygons[0]; auto app = RiaGuiApplication::instance(); auto fallbackPath = app->lastUsedDialogDirectory( "BINARY_GRID" ); diff --git a/ApplicationLibCode/Commands/PolygonCommands/RicExportPolygonCsvFeature.h b/ApplicationLibCode/Commands/PolygonCommands/RicExportPolygonCsvFeature.h index 844b87248a..4c419081d2 100644 --- a/ApplicationLibCode/Commands/PolygonCommands/RicExportPolygonCsvFeature.h +++ b/ApplicationLibCode/Commands/PolygonCommands/RicExportPolygonCsvFeature.h @@ -18,15 +18,18 @@ #pragma once -#include "cafCmdFeature.h" +#include "RicBasicPolygonFeature.h" //================================================================================================== /// //================================================================================================== -class RicExportPolygonCsvFeature : public caf::CmdFeature +class RicExportPolygonCsvFeature : public RicBasicPolygonFeature { CAF_CMD_HEADER_INIT; +public: + RicExportPolygonCsvFeature(); + protected: void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/PolygonCommands/RicExportPolygonPolFeature.cpp b/ApplicationLibCode/Commands/PolygonCommands/RicExportPolygonPolFeature.cpp index cfdf1839f4..8ee80d7fe0 100644 --- a/ApplicationLibCode/Commands/PolygonCommands/RicExportPolygonPolFeature.cpp +++ b/ApplicationLibCode/Commands/PolygonCommands/RicExportPolygonPolFeature.cpp @@ -34,36 +34,35 @@ CAF_CMD_SOURCE_INIT( RicExportPolygonPolFeature, "RicExportPolygonPolFeature" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicExportPolygonPolFeature::RicExportPolygonPolFeature() + : RicBasicPolygonFeature( true /*multiselect*/ ) +{ +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicExportPolygonPolFeature::onActionTriggered( bool isChecked ) { - auto sourcePolygon = caf::SelectionManager::instance()->selectedItemOfType(); - if ( !sourcePolygon ) - { - auto sourcePolygonInView = caf::SelectionManager::instance()->selectedItemOfType(); - if ( sourcePolygonInView ) - { - sourcePolygon = sourcePolygonInView->polygon(); - } - } - - if ( !sourcePolygon ) return; + auto selPolygons = selectedPolygons(); + if ( selPolygons.empty() ) return; auto app = RiaGuiApplication::instance(); auto fallbackPath = app->lastUsedDialogDirectory( "BINARY_GRID" ); auto polygonPath = app->lastUsedDialogDirectoryWithFallback( RimPolygonTools::polygonCacheName(), fallbackPath ); - auto polygonFileName = polygonPath + "/" + sourcePolygon->name() + ".pol"; + auto polygonFileName = polygonPath + "/" + selPolygons[0]->name() + ".pol"; auto fileName = RiuFileDialogTools::getSaveFileName( nullptr, "Select File for Polygon Export to POL", polygonFileName, "POL Files (*.pol);;All files(*.*)" ); - if ( !RimPolygonTools::exportPolygonPol( sourcePolygon, fileName ) ) + if ( !RimPolygonTools::exportPolygonPol( selPolygons, fileName ) ) { - RiaLogging::error( "Failed to export polygon to " + fileName ); + RiaLogging::error( "Failed to export polygon(s) to " + fileName ); } else { diff --git a/ApplicationLibCode/Commands/PolygonCommands/RicExportPolygonPolFeature.h b/ApplicationLibCode/Commands/PolygonCommands/RicExportPolygonPolFeature.h index 66f3a7babb..5d943c22f5 100644 --- a/ApplicationLibCode/Commands/PolygonCommands/RicExportPolygonPolFeature.h +++ b/ApplicationLibCode/Commands/PolygonCommands/RicExportPolygonPolFeature.h @@ -18,15 +18,18 @@ #pragma once -#include "cafCmdFeature.h" +#include "RicBasicPolygonFeature.h" //================================================================================================== /// //================================================================================================== -class RicExportPolygonPolFeature : public caf::CmdFeature +class RicExportPolygonPolFeature : public RicBasicPolygonFeature { CAF_CMD_HEADER_INIT; +public: + RicExportPolygonPolFeature(); + protected: void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/PolygonCommands/RicReloadPolygonFileFeature.cpp b/ApplicationLibCode/Commands/PolygonCommands/RicReloadPolygonFileFeature.cpp index b3bb1ff89c..690815ac7e 100644 --- a/ApplicationLibCode/Commands/PolygonCommands/RicReloadPolygonFileFeature.cpp +++ b/ApplicationLibCode/Commands/PolygonCommands/RicReloadPolygonFileFeature.cpp @@ -21,6 +21,7 @@ #include "Polygons/RimPolygonFile.h" #include "cafSelectionManager.h" +#include #include @@ -31,13 +32,13 @@ CAF_CMD_SOURCE_INIT( RicReloadPolygonFileFeature, "RicReloadPolygonFileFeature" //-------------------------------------------------------------------------------------------------- void RicReloadPolygonFileFeature::onActionTriggered( bool isChecked ) { - auto polygonFile = caf::SelectionManager::instance()->selectedItemOfType(); - if ( polygonFile ) - { - polygonFile->loadData(); - polygonFile->objectChanged.send(); + auto polygonFiles = caf::selectedObjectsByType(); - polygonFile->updateConnectedEditors(); + for ( auto p : polygonFiles ) + { + p->loadData(); + p->objectChanged.send(); + p->updateConnectedEditors(); } } diff --git a/ApplicationLibCode/Commands/PolygonCommands/RicSimplifyPolygonFeature.cpp b/ApplicationLibCode/Commands/PolygonCommands/RicSimplifyPolygonFeature.cpp index d8695176fc..786afdd797 100644 --- a/ApplicationLibCode/Commands/PolygonCommands/RicSimplifyPolygonFeature.cpp +++ b/ApplicationLibCode/Commands/PolygonCommands/RicSimplifyPolygonFeature.cpp @@ -30,22 +30,21 @@ CAF_CMD_SOURCE_INIT( RicSimplifyPolygonFeature, "RicSimplifyPolygonFeature" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicSimplifyPolygonFeature::RicSimplifyPolygonFeature() + : RicBasicPolygonFeature( true /*multiselect*/ ) +{ +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicSimplifyPolygonFeature::onActionTriggered( bool isChecked ) { - auto sourcePolygon = caf::SelectionManager::instance()->selectedItemOfType(); - if ( !sourcePolygon ) - { - auto sourcePolygonInView = caf::SelectionManager::instance()->selectedItemOfType(); - if ( sourcePolygonInView ) - { - sourcePolygon = sourcePolygonInView->polygon(); - } - } - - if ( !sourcePolygon ) return; + auto selPolygons = selectedPolygons(); + if ( selPolygons.empty() ) return; const double defaultEpsilon = 10.0; @@ -53,7 +52,9 @@ void RicSimplifyPolygonFeature::onActionTriggered( bool isChecked ) auto epsilon = QInputDialog::getDouble( nullptr, "Simplify Polygon Threshold", "Threshold:", defaultEpsilon, 1.0, 1000.0, 1, &ok, Qt::WindowFlags(), 1 ); - if ( ok ) + if ( !ok ) return; + + for ( auto sourcePolygon : selPolygons ) { auto coords = sourcePolygon->pointsInDomainCoords(); RigCellGeometryTools::simplifyPolygon( &coords, epsilon ); diff --git a/ApplicationLibCode/Commands/PolygonCommands/RicSimplifyPolygonFeature.h b/ApplicationLibCode/Commands/PolygonCommands/RicSimplifyPolygonFeature.h index 1b74d5876c..61aedf45c9 100644 --- a/ApplicationLibCode/Commands/PolygonCommands/RicSimplifyPolygonFeature.h +++ b/ApplicationLibCode/Commands/PolygonCommands/RicSimplifyPolygonFeature.h @@ -18,15 +18,18 @@ #pragma once -#include "cafCmdFeature.h" +#include "RicBasicPolygonFeature.h" //================================================================================================== /// //================================================================================================== -class RicSimplifyPolygonFeature : public caf::CmdFeature +class RicSimplifyPolygonFeature : public RicBasicPolygonFeature { CAF_CMD_HEADER_INIT; +public: + RicSimplifyPolygonFeature(); + protected: void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonFile.cpp b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonFile.cpp index 105af7ea7d..5ef49eb097 100644 --- a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonFile.cpp +++ b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonFile.cpp @@ -37,7 +37,7 @@ CAF_PDM_SOURCE_INIT( RimPolygonFile, "RimPolygonFileFile" ); RimPolygonFile::RimPolygonFile() : objectChanged( this ) { - CAF_PDM_InitObject( "PolygonFile", ":/PolylinesFromFile16x16.png" ); + CAF_PDM_InitObject( "PolygonFile", ":/Folder.png" ); CAF_PDM_InitFieldNoDefault( &m_fileName, "StimPlanFileName", "File Name" ); CAF_PDM_InitFieldNoDefault( &m_polygons, "Polygons", "Polygons" ); diff --git a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonTools.cpp b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonTools.cpp index 11d2d49425..22a4822d2c 100644 --- a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonTools.cpp @@ -103,9 +103,9 @@ bool RimPolygonTools::exportPolygonCsv( const RimPolygon* polygon, const QString //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RimPolygonTools::exportPolygonPol( const RimPolygon* polygon, const QString& filePath ) +bool RimPolygonTools::exportPolygonPol( const std::vector polygons, const QString& filePath ) { - if ( !polygon ) return false; + if ( polygons.empty() ) return false; QFile file( filePath ); if ( !file.open( QIODevice::WriteOnly | QIODevice::Text ) ) return false; @@ -122,20 +122,23 @@ bool RimPolygonTools::exportPolygonPol( const RimPolygon* polygon, const QString header.emplace_back( " ", RifTextDataTableDoubleFormatting( RIF_FLOAT, precision ) ); formatter.header( header ); - for ( const auto& point : polygon->pointsInDomainCoords() ) + for ( auto polygon : polygons ) { - formatter.add( point.x() ); - formatter.add( point.y() ); - formatter.add( -point.z() ); + for ( const auto& point : polygon->pointsInDomainCoords() ) + { + formatter.add( point.x() ); + formatter.add( point.y() ); + formatter.add( -point.z() ); + formatter.rowCompleted(); + } + + const double endOfPolygon = 999.0; + formatter.add( endOfPolygon ); + formatter.add( endOfPolygon ); + formatter.add( endOfPolygon ); formatter.rowCompleted(); } - const double endOfPolygon = 999.0; - formatter.add( endOfPolygon ); - formatter.add( endOfPolygon ); - formatter.add( endOfPolygon ); - formatter.rowCompleted(); - formatter.tableCompleted(); file.close(); diff --git a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonTools.h b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonTools.h index 29fb32b401..309f3dcc22 100644 --- a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonTools.h +++ b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonTools.h @@ -23,6 +23,8 @@ class RimPolygonInView; class QString; +#include + namespace caf { class PdmObject; @@ -34,7 +36,7 @@ public: static void activate3dEditOfPolygonInView( RimPolygon* polygon, caf::PdmObject* sourceObject ); static void selectPolygonInView( RimPolygon* polygon, caf::PdmObject* sourceObject ); static bool exportPolygonCsv( const RimPolygon* polygon, const QString& filePath ); - static bool exportPolygonPol( const RimPolygon* polygon, const QString& filePath ); + static bool exportPolygonPol( const std::vector polygons, const QString& filePath ); static QString polygonCacheName(); From db1fe84c332d372fae13ddb482478a66d882b614 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 2 Dec 2024 09:04:12 +0100 Subject: [PATCH 150/160] Bump to 2024.12.0-RC1 --- ResInsightVersion.cmake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index 894fd1cb44..c583e6e99d 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -1,17 +1,17 @@ set(RESINSIGHT_MAJOR_VERSION 2024) -set(RESINSIGHT_MINOR_VERSION 09) -set(RESINSIGHT_PATCH_VERSION 3) +set(RESINSIGHT_MINOR_VERSION 12) +set(RESINSIGHT_PATCH_VERSION 0) # Opional text with no restrictions -set(RESINSIGHT_VERSION_TEXT "-dev") -#set(RESINSIGHT_VERSION_TEXT "-RC") +#set(RESINSIGHT_VERSION_TEXT "-dev") +set(RESINSIGHT_VERSION_TEXT "-RC_1") # Optional text # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -set(RESINSIGHT_DEV_VERSION ".07") +#set(RESINSIGHT_DEV_VERSION ".06") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") From bd3ef3f775729fd4f1db9f821889ebca9fe21ad6 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 2 Dec 2024 09:00:05 +0100 Subject: [PATCH 151/160] #11943 Contour Map: regenerate grid and projection on sampling factor change. --- .../ProjectDataModel/RimContourMapProjection.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp index acf64a369d..5795b3744f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp @@ -391,7 +391,9 @@ void RimContourMapProjection::clearGridMapping() clearResults(); clearTimeStepRange(); - if ( m_contourMapProjection ) m_contourMapProjection->clearGridMapping(); + m_contourMapProjection.reset(); + m_contourMapGrid.reset(); + m_mapCellVisibility.clear(); } From 8644ca1ea539b929e07f4335c56e521ffe7e5a15 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Mon, 2 Dec 2024 13:04:10 +0100 Subject: [PATCH 152/160] Code fixes --- .../Commands/PolygonCommands/RicBasicPolygonFeature.cpp | 2 +- .../Commands/PolygonCommands/RicReloadPolygonFileFeature.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/Commands/PolygonCommands/RicBasicPolygonFeature.cpp b/ApplicationLibCode/Commands/PolygonCommands/RicBasicPolygonFeature.cpp index c655828ae2..7041ab04eb 100644 --- a/ApplicationLibCode/Commands/PolygonCommands/RicBasicPolygonFeature.cpp +++ b/ApplicationLibCode/Commands/PolygonCommands/RicBasicPolygonFeature.cpp @@ -22,7 +22,7 @@ #include "Polygons/RimPolygonInView.h" #include "cafSelectionManager.h" -#include +#include "cafSelectionManagerTools.h" #include diff --git a/ApplicationLibCode/Commands/PolygonCommands/RicReloadPolygonFileFeature.cpp b/ApplicationLibCode/Commands/PolygonCommands/RicReloadPolygonFileFeature.cpp index 690815ac7e..83a8d71f91 100644 --- a/ApplicationLibCode/Commands/PolygonCommands/RicReloadPolygonFileFeature.cpp +++ b/ApplicationLibCode/Commands/PolygonCommands/RicReloadPolygonFileFeature.cpp @@ -21,7 +21,7 @@ #include "Polygons/RimPolygonFile.h" #include "cafSelectionManager.h" -#include +#include "cafSelectionManagerTools.h" #include From 6d4824b204e9aee5faf817c82f45881294f29db3 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 2 Dec 2024 11:30:13 +0100 Subject: [PATCH 153/160] fixed: build against QT 6.8 --- ApplicationLibCode/Application/Tools/RiaTextStringTools.cpp | 2 ++ ApplicationLibCode/Application/Tools/RiaTextStringTools.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/ApplicationLibCode/Application/Tools/RiaTextStringTools.cpp b/ApplicationLibCode/Application/Tools/RiaTextStringTools.cpp index 5612ddbc2c..de4f4a3a34 100644 --- a/ApplicationLibCode/Application/Tools/RiaTextStringTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaTextStringTools.cpp @@ -209,7 +209,9 @@ bool RiaTextStringTools::isNumber( const QString& text, const QString& decimalPo //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- +#if QT_VERSION < QT_VERSION_CHECK( 6, 8, 0 ) std::strong_ordering operator<=>( const QString& lhs, const QString& rhs ) { return lhs.compare( rhs ) <=> 0; } +#endif diff --git a/ApplicationLibCode/Application/Tools/RiaTextStringTools.h b/ApplicationLibCode/Application/Tools/RiaTextStringTools.h index 5c4b1ee9a2..04f5a634db 100644 --- a/ApplicationLibCode/Application/Tools/RiaTextStringTools.h +++ b/ApplicationLibCode/Application/Tools/RiaTextStringTools.h @@ -21,6 +21,7 @@ #include #include #include +#include #include @@ -47,6 +48,7 @@ bool isNumber( const QString& text, const QString& decimalPoint ); } // namespace RiaTextStringTools +#if QT_VERSION < QT_VERSION_CHECK( 6, 8, 0 ) //-------------------------------------------------------------------------------------------------- // // Add operator<=> for QString to global scope @@ -60,3 +62,4 @@ bool isNumber( const QString& text, const QString& decimalPoint ); // //-------------------------------------------------------------------------------------------------- std::strong_ordering operator<=>( const QString& lhs, const QString& rhs ); +#endif From d90dd91e291e09ecb17b439ea22cf6b4ccebaf33 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Tue, 3 Dec 2024 14:42:02 +0100 Subject: [PATCH 154/160] Hide grid mesh lines in contour map view --- .../Commands/RicNewContourMapViewFeature.cpp | 3 +++ .../GeoMech/RimGeoMechContourMapView.cpp | 12 ++++++++++-- .../GeoMech/RimGeoMechContourMapView.h | 2 ++ .../ProjectDataModel/RimEclipseContourMapView.cpp | 11 ++++++++++- .../ProjectDataModel/RimEclipseContourMapView.h | 2 ++ 5 files changed, 27 insertions(+), 3 deletions(-) diff --git a/ApplicationLibCode/Commands/RicNewContourMapViewFeature.cpp b/ApplicationLibCode/Commands/RicNewContourMapViewFeature.cpp index 7d71506328..ce5ce19330 100644 --- a/ApplicationLibCode/Commands/RicNewContourMapViewFeature.cpp +++ b/ApplicationLibCode/Commands/RicNewContourMapViewFeature.cpp @@ -262,6 +262,8 @@ RimEclipseContourMapView* RicNewContourMapViewFeature::createEclipseContourMapFr contourMap->faultCollection()->setActive( false ); contourMap->wellCollection()->isActive = false; + contourMap->setCompatibleDrawStyle(); + // Set default values RimRegularLegendConfig* legendConfig = contourMap->cellResult()->legendConfig(); if ( legendConfig && legendConfig->mappingMode() == RimRegularLegendConfig::MappingType::CATEGORY_INTEGER ) @@ -394,6 +396,7 @@ RimGeoMechContourMapView* RicNewContourMapViewFeature::createGeoMechContourMapFr contourMap->setBackgroundColor( RiaColorTools::fromQColorTo3f( col ) ); // Ignore original view background contourMap->setDefaultCustomName(); + contourMap->setCompatibleDrawStyle(); caf::PdmDocument::updateUiIconStateRecursively( contourMap ); diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapView.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapView.cpp index dc550251c6..0d3efc8225 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapView.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapView.cpp @@ -171,6 +171,15 @@ bool RimGeoMechContourMapView::isTimeStepDependentDataVisible() const return true; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimGeoMechContourMapView::setCompatibleDrawStyle() +{ + surfaceMode = FAULTS; + meshMode = RiaDefines::MeshModeType::NO_MESH; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -181,8 +190,7 @@ void RimGeoMechContourMapView::initAfterRead() m_gridCollection->setActive( false ); // This is also not added to the tree view, so cannot be enabled. disablePerspectiveProjectionField(); setShowGridBox( false ); - meshMode.setValue( RiaDefines::MeshModeType::NO_MESH ); - surfaceMode.setValue( FAULTS ); + setCompatibleDrawStyle(); scheduleCreateDisplayModelAndRedraw(); } diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapView.h b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapView.h index d763a99b03..38f126b8bc 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapView.h +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapView.h @@ -45,6 +45,8 @@ public: bool isTimeStepDependentDataVisible() const override; + void setCompatibleDrawStyle(); + protected: void initAfterRead() override; void onCreateDisplayModel() override; diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapView.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapView.cpp index 5604bb9602..e1dfa286ae 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapView.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapView.cpp @@ -166,6 +166,15 @@ void RimEclipseContourMapView::updatePickPointAndRedraw() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseContourMapView::setCompatibleDrawStyle() +{ + surfaceMode = FAULTS; + meshMode = RiaDefines::MeshModeType::NO_MESH; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -175,8 +184,8 @@ void RimEclipseContourMapView::initAfterRead() disablePerspectiveProjectionField(); setShowGridBox( false ); - surfaceMode.setValue( FAULTS ); setFaultVisParameters(); + setCompatibleDrawStyle(); scheduleCreateDisplayModelAndRedraw(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapView.h b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapView.h index 29b15be988..80ee753c13 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapView.h +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapView.h @@ -46,6 +46,8 @@ public: RimSurfaceInViewCollection* surfaceInViewCollection() const override; void zoomAll() override; + void setCompatibleDrawStyle(); + protected: void initAfterRead() override; void onCreateDisplayModel() override; From 1ce2f9651c31df3a4f2b1ce659a00006de167b67 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 3 Dec 2024 16:53:11 +0100 Subject: [PATCH 155/160] #11954 Improve the curve merger algorithm * Add flag to indicate identical X values when curves are merged * Detect if x values are monotonically increasing --- .../Application/Tools/RiaCurveMerger.h | 6 +- .../Application/Tools/RiaCurveMerger.inl | 87 ++++++++++++++++--- .../RigTimeCurveHistoryMerger-Test.cpp | 24 +++++ 3 files changed, 103 insertions(+), 14 deletions(-) diff --git a/ApplicationLibCode/Application/Tools/RiaCurveMerger.h b/ApplicationLibCode/Application/Tools/RiaCurveMerger.h index b6a4965f17..f8bf950288 100644 --- a/ApplicationLibCode/Application/Tools/RiaCurveMerger.h +++ b/ApplicationLibCode/Application/Tools/RiaCurveMerger.h @@ -67,7 +67,8 @@ public: interpolatedYValue( const XValueType& xValue, const std::vector& curveXValues, const std::vector& curveYValues ); private: - void computeUnionOfXValues( bool includeValuesFromPartialCurves ); + void computeUnionOfXValues( bool includeValuesFromPartialCurves ); + static bool isMonotonicallyIncreasing( const std::vector& curveXValues ); private: std::vector, std::vector>> m_originalValues; @@ -76,6 +77,9 @@ private: std::vector m_allXValues; std::vector> m_interpolatedValuesForAllCurves; + + bool m_isXValuesSharedBetweenCurves; + bool m_isXValuesMonotonicallyIncreasing; }; using RiaTimeHistoryCurveMerger = RiaCurveMerger; diff --git a/ApplicationLibCode/Application/Tools/RiaCurveMerger.inl b/ApplicationLibCode/Application/Tools/RiaCurveMerger.inl index d0e9fe06fd..b56590738c 100644 --- a/ApplicationLibCode/Application/Tools/RiaCurveMerger.inl +++ b/ApplicationLibCode/Application/Tools/RiaCurveMerger.inl @@ -55,6 +55,8 @@ bool XValueComparator::equals( const XValueType& lhs, const XValueTy //-------------------------------------------------------------------------------------------------- template RiaCurveMerger::RiaCurveMerger() + : m_isXValuesSharedBetweenCurves( false ) + , m_isXValuesMonotonicallyIncreasing( true ) { } @@ -68,6 +70,24 @@ void RiaCurveMerger::addCurveData( const std::vector& xV if ( !xValues.empty() ) { + if ( m_originalValues.empty() ) + { + m_isXValuesSharedBetweenCurves = true; + m_isXValuesMonotonicallyIncreasing = isMonotonicallyIncreasing( xValues ); + } + else + { + if ( m_isXValuesSharedBetweenCurves ) + { + const auto& firstXValues = m_originalValues.front().first; + m_isXValuesSharedBetweenCurves = std::equal( firstXValues.begin(), firstXValues.end(), xValues.begin() ); + } + + if ( m_isXValuesMonotonicallyIncreasing ) + { + m_isXValuesMonotonicallyIncreasing = isMonotonicallyIncreasing( xValues ); + } + } m_originalValues.push_back( std::make_pair( xValues, yValues ) ); } } @@ -131,14 +151,14 @@ void RiaCurveMerger::computeInterpolatedValues( bool includeValuesFr m_allXValues.clear(); m_interpolatedValuesForAllCurves.clear(); - computeUnionOfXValues( includeValuesFromPartialCurves ); - const size_t curveCount = m_originalValues.size(); if ( curveCount == 0 ) { return; } + computeUnionOfXValues( includeValuesFromPartialCurves ); + const size_t dataValueCount = m_allXValues.size(); if ( dataValueCount == 0 ) { @@ -157,8 +177,18 @@ void RiaCurveMerger::computeInterpolatedValues( bool includeValuesFr #pragma omp parallel for for ( int valueIndex = 0; valueIndex < static_cast( dataValueCount ); valueIndex++ ) { - double interpolValue = - interpolatedYValue( m_allXValues[valueIndex], m_originalValues[curveIdx].first, m_originalValues[curveIdx].second ); + double interpolValue = 0.0; + + if ( m_isXValuesSharedBetweenCurves ) + { + interpolValue = m_originalValues[curveIdx].second[valueIndex]; + } + else + { + interpolValue = + interpolatedYValue( m_allXValues[valueIndex], m_originalValues[curveIdx].first, m_originalValues[curveIdx].second ); + } + if ( !RiaCurveDataTools::isValidValue( interpolValue, false ) ) { #pragma omp critical @@ -180,6 +210,13 @@ void RiaCurveMerger::computeUnionOfXValues( bool includeValuesForPar { m_allXValues.clear(); + if ( m_isXValuesSharedBetweenCurves && !m_originalValues.empty() ) + { + // If all curves have the same X values, use the X values from the first curve. + m_allXValues = m_originalValues.front().first; + return; + } + std::set unionOfXValues; std::vector> originalXBounds; @@ -240,17 +277,27 @@ double RiaCurveMerger::interpolatedYValue( const XValueType& if ( xValues.empty() ) return HUGE_VAL; if ( yValues.size() != xValues.size() ) return HUGE_VAL; + size_t startIndex = 0; + + if ( isMonotonicallyIncreasing( xValues ) ) + { + // Use lower_bound to find the first element that is not less than the interpolation value using a threshold that is larger than + // the threshold used in XComparator::equals + // + // Using this method will improve the performance significantly for large datasets, as std::lower_bound is much faster than the + // search in the loop below. One relevant use case is computation of delta summary values for large datasets. Here the time + // steps are specified in increasing order + // + XValueType threshold = 1.0e-6 * xValues.back(); + auto it = std::lower_bound( xValues.begin(), xValues.end(), interpolationXValue - threshold ); + if ( it == xValues.end() ) return HUGE_VAL; + + startIndex = it - xValues.begin(); + if ( startIndex > 0 ) startIndex--; + } + const bool removeInterpolatedValues = false; - // Use lower_bound to find the first element that is not less than the interpolation value using a threshold that is larger than the - // threshold used in XComparator::equals - XValueType threshold = 1.0e-6 * xValues.back(); - auto it = std::lower_bound( xValues.begin(), xValues.end(), interpolationXValue - threshold ); - if ( it == xValues.end() ) return HUGE_VAL; - - size_t startIndex = it - xValues.begin(); - if ( startIndex > 0 ) startIndex--; - for ( size_t firstI = startIndex; firstI < xValues.size(); firstI++ ) { if ( XComparator::equals( xValues.at( firstI ), interpolationXValue ) ) @@ -307,3 +354,17 @@ double RiaCurveMerger::interpolatedYValue( const XValueType& return HUGE_VAL; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +template +bool RiaCurveMerger::isMonotonicallyIncreasing( const std::vector& container ) +{ + return std::adjacent_find( container.begin(), + container.end(), + []( const auto& a, const auto& b ) + { + return b < a; // Returns true if not monotonically increasing + } ) == container.end(); +} diff --git a/ApplicationLibCode/UnitTests/RigTimeCurveHistoryMerger-Test.cpp b/ApplicationLibCode/UnitTests/RigTimeCurveHistoryMerger-Test.cpp index 45426a5762..b4d485a3c8 100644 --- a/ApplicationLibCode/UnitTests/RigTimeCurveHistoryMerger-Test.cpp +++ b/ApplicationLibCode/UnitTests/RigTimeCurveHistoryMerger-Test.cpp @@ -208,3 +208,27 @@ TEST( RiaTimeHistoryCurveMergerTest, NoTimeStepOverlap ) EXPECT_EQ( 0, static_cast( curveMerger.validIntervalsForAllXValues().size() ) ); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +TEST( RiaTimeHistoryCurveMergerTest, SharedXValues ) +{ + std::vector valuesA{ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 }; + std::vector valuesB{ 10, 20, 30, 40, 50, 60, 70 }; + std::vector timeSteps{ 1, 2, 3, 4, 5, 6, 7 }; + + RiaTimeHistoryCurveMerger interpolate; + interpolate.addCurveData( timeSteps, valuesA ); + interpolate.addCurveData( timeSteps, valuesB ); + interpolate.computeInterpolatedValues( true ); + + auto interpolatedTimeSteps = interpolate.allXValues(); + EXPECT_TRUE( std::equal( timeSteps.begin(), timeSteps.end(), interpolatedTimeSteps.begin() ) ); + + auto generatedYValuesA = interpolate.interpolatedYValuesForAllXValues( 0 ); + EXPECT_TRUE( std::equal( valuesA.begin(), valuesA.end(), generatedYValuesA.begin() ) ); + + auto generatedYValuesB = interpolate.interpolatedYValuesForAllXValues( 1 ); + EXPECT_TRUE( std::equal( valuesB.begin(), valuesB.end(), generatedYValuesB.begin() ) ); +} From b48b58ca14dd6c4aeb12b7957e01fd3632cac447 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 4 Dec 2024 09:49:35 +0100 Subject: [PATCH 156/160] #11386 Summary plot: TCPU and ELAPSED are cumulative vectors --- ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp | 3 +++ .../ProjectDataModel/Summary/RimSummaryCurve.cpp | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp index bdb0131efd..f82e128f97 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp @@ -988,6 +988,9 @@ bool RifEclipseSummaryAddress::hasAccumulatedData() const QString qBaseName = QString::fromStdString( baseVectorName( quantityForInspection.toStdString() ) ); + if ( RiaTextStringTools::isTextEqual( qBaseName, QString( "TCPU" ) ) ) return true; + if ( RiaTextStringTools::isTextEqual( qBaseName, QString( "ELAPSED" ) ) ) return true; + if ( qBaseName.endsWith( "WCT" ) || qBaseName.endsWith( "WCTH" ) ) { // https://github.com/OPM/ResInsight/issues/5808 diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index aa26c11c4b..cf39322b24 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -1269,9 +1269,9 @@ void RimSummaryCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, m_xPushButtonSelectSummaryAddress = false; } - else if ( changedField == &m_yCurveTypeMode ) + else if ( changedField == &m_yCurveTypeMode || changedField == &m_yCurveType ) { - calculateCurveTypeFromAddress(); + calculateCurveInterpolationFromAddress(); } if ( crossPlotTestForMatchingTimeSteps ) From 586aefe0b64058cef1a4326e25ddbcf37f0b5dae Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 4 Dec 2024 10:52:45 +0100 Subject: [PATCH 157/160] Mark SUMO features with BETA --- .../ProjectDataModel/Cloud/RimCloudDataSourceCollection.cpp | 2 +- .../ProjectDataModel/Summary/Sumo/RimSummaryEnsembleSumo.cpp | 2 +- ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Cloud/RimCloudDataSourceCollection.cpp b/ApplicationLibCode/ProjectDataModel/Cloud/RimCloudDataSourceCollection.cpp index 16004c7a50..a1f311021a 100644 --- a/ApplicationLibCode/ProjectDataModel/Cloud/RimCloudDataSourceCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Cloud/RimCloudDataSourceCollection.cpp @@ -40,7 +40,7 @@ CAF_PDM_SOURCE_INIT( RimCloudDataSourceCollection, "RimCloudDataSourceCollection //-------------------------------------------------------------------------------------------------- RimCloudDataSourceCollection::RimCloudDataSourceCollection() { - CAF_PDM_InitObject( "Cloud Data", ":/Cloud.svg" ); + CAF_PDM_InitObject( "Cloud Data" + RiaDefines::betaFeaturePostfix(), ":/Cloud.svg" ); CAF_PDM_InitFieldNoDefault( &m_sumoFieldName, "SumoFieldId", "Field Id" ); CAF_PDM_InitFieldNoDefault( &m_sumoCaseId, "SumoCaseId", "Case Id" ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/Sumo/RimSummaryEnsembleSumo.cpp b/ApplicationLibCode/ProjectDataModel/Summary/Sumo/RimSummaryEnsembleSumo.cpp index 7ed4d8b412..c6b091b078 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/Sumo/RimSummaryEnsembleSumo.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/Sumo/RimSummaryEnsembleSumo.cpp @@ -43,7 +43,7 @@ RimSummaryEnsembleSumo::RimSummaryEnsembleSumo() { CAF_PDM_InitObject( "Sumo Ensemble", ":/SummaryCase.svg", "", "The Base Class for all Summary Cases" ); - CAF_PDM_InitFieldNoDefault( &m_sumoDataSource, "SumoDataSource", "Sumo Data Source" ); + CAF_PDM_InitFieldNoDefault( &m_sumoDataSource, "SumoDataSource", "Sumo Data Source" + RiaDefines::betaFeaturePostfix() ); // Disable IO for cases, as the reconstruction is done by loading data from Sumo // Will also reduce the amount of data stored in the project file diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index 358edcb4d0..bfafc98f4a 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -466,7 +466,7 @@ void RiuPlotMainWindow::refreshToolbars() //-------------------------------------------------------------------------------------------------- void RiuPlotMainWindow::createDockPanels() { - const std::vector treeViewTitles = { "Plots", "Data Sources", "Templates", "Scripts", "Cloud" }; + const std::vector treeViewTitles = { "Plots", "Data Sources", "Templates", "Scripts", "Cloud" + RiaDefines::betaFeaturePostfix() }; const std::vector treeViewConfigs = { "PlotWindow.Plots", "PlotWindow.DataSources", "PlotWindow.Templates", From 39d19c9826c71f466c1fb780c0b06ec9d96e0d83 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 4 Dec 2024 19:23:46 +0100 Subject: [PATCH 158/160] #11966 Fix visibility control of curve legends --- ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index cf39322b24..5d44bf886c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -1433,7 +1433,7 @@ void RimSummaryCurve::updateTimeAnnotations() void RimSummaryCurve::updateLegendEntryVisibilityNoPlotUpdate() { if ( !m_plotCurve ) return; - if ( !firstAncestorOrThisOfType() ) return; + if ( firstAncestorOrThisOfType() ) return; bool showLegendInPlot = m_showLegend(); if ( auto summaryPlot = firstAncestorOrThisOfType() ) From 996a10f781db1a0c9af5d1d30f4be4f2904e0d20 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 5 Dec 2024 07:53:14 +0100 Subject: [PATCH 159/160] Fix curve highlight for non-ensemble curves --- .../Summary/RimSummaryEnsembleTools.cpp | 11 +++++++++++ .../Summary/RimSummaryEnsembleTools.h | 1 + .../UserInterface/RiuQwtPlotWidget.cpp | 14 ++++++++++++-- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.cpp index e1a107334a..49142e9525 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.cpp @@ -335,6 +335,17 @@ size_t RimSummaryEnsembleTools::calculateEnsembleParametersIntersectionHash( con return commonAddressCount; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimSummaryEnsembleTools::isEnsembleCurve( RimPlotCurve* sourceCurve ) +{ + auto summaryCurve = dynamic_cast( sourceCurve ); + if ( !summaryCurve ) return false; + + return summaryCurve->isEnsembleCurve(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.h index 37843a6a8f..5974b668b4 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.h @@ -38,6 +38,7 @@ std::vector createVariationSortedEnsembleParameters( const size_t calculateEnsembleParametersIntersectionHash( const std::vector& summaryCases ); +bool isEnsembleCurve( RimPlotCurve* sourceCurve ); void highlightCurvesForSameRealization( RimPlotCurve* sourceCurve ); void resetHighlightAllPlots(); diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp index fed3552ddd..203b17c0dd 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp @@ -935,9 +935,19 @@ void RiuQwtPlotWidget::selectClosestPlotItem( const QPoint& pos, bool toggleItem { bool updateCurveOrder = false; resetPlotItemHighlighting( updateCurveOrder ); - if ( auto curve = dynamic_cast( closestItem ) ) + + auto curve = dynamic_cast( closestItem ); + if ( curve && curve->ownerRimCurve() ) { - RimSummaryEnsembleTools::highlightCurvesForSameRealization( curve->ownerRimCurve() ); + const auto rimCurve = curve->ownerRimCurve(); + if ( RimSummaryEnsembleTools::isEnsembleCurve( rimCurve ) ) + { + RimSummaryEnsembleTools::highlightCurvesForSameRealization( rimCurve ); + } + else + { + highlightCurvesUpdateOrder( { rimCurve } ); + } } else { From 4d8be6971f04819bceabe8e34f7850ce3a1ae16f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 5 Dec 2024 08:16:29 +0100 Subject: [PATCH 160/160] Bump to 2024.12.0-RC2 --- ResInsightVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index c583e6e99d..7b43ec3f79 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -5,7 +5,7 @@ set(RESINSIGHT_PATCH_VERSION 0) # Opional text with no restrictions #set(RESINSIGHT_VERSION_TEXT "-dev") -set(RESINSIGHT_VERSION_TEXT "-RC_1") +set(RESINSIGHT_VERSION_TEXT "-RC_2") # Optional text # Must be unique and increasing within one combination of major/minor/patch version