Merge pull request #11316 from OPM/dev

Release 2024.03
This commit is contained in:
Magne Sjaastad 2024-03-25 10:32:37 +01:00 committed by GitHub
commit 4a0c2f2f4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1046 changed files with 31295 additions and 46043 deletions

View File

@ -8,9 +8,15 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
qtver: [5.12.12, 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@v3
uses: actions/checkout@v4
- name: Set apt mirror
# see https://github.com/actions/runner-images/issues/7048
@ -22,7 +28,7 @@ jobs:
sudo sed -i 's/http:\/\/azure.archive.ubuntu.com\/ubuntu\//mirror+file:\/etc\/apt\/mirrors.txt/' /etc/apt/sources.list
- name: Install Linux dependencies
if: ${{contains( matrix.os, 'ubuntu') }}
if: contains(matrix.os, 'ubuntu')
run: |
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
@ -30,10 +36,10 @@ jobs:
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: 5.12.12
modules: qtscript
version: ${{ matrix.qtver }}
dir: "${{ github.workspace }}/Qt/"
cache: true
cache-key-prefix: ${{ matrix.qtver }}-${{ matrix.os }}
- name: Get CMake and Ninja
uses: lukka/get-cmake@latest
@ -41,42 +47,41 @@ jobs:
- name: Use MSVC (Windows)
uses: ilammy/msvc-dev-cmd@v1
- name: Configure
shell: cmake -P {0}
- name: Configure and build
run: |
execute_process(
COMMAND cmake
-S Fwk
-B cmakebuild
-G Ninja
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
- name: Build
shell: cmake -P {0}
run: |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ")
execute_process(
COMMAND cmake --build cmakebuild
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
cmake -S Fwk/AppFwk ${{matrix.build_flags}} -B cmakebuild -G Ninja
cmake --build cmakebuild
- name: Run Unit Tests
- name: Install
run: |
cd cmakebuild
cmake --install . --prefix ${{github.workspace}}/cmakebuild/install
- name: Run Unit Tests Qt5
if: matrix.qtver == '5.12.12'
shell: bash
run: |
cmakebuild/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/cafPdmCore_UnitTests
cmakebuild/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests/cafPdmXml_UnitTests
cmakebuild/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/cafProjectDataModel_UnitTests
cmakebuild/AppFwk/cafPdmScripting/cafPdmScripting_UnitTests/cafPdmScripting_UnitTests
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 (does not work on Linux)
if: contains( matrix.os, 'windows')
- 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
run: |
cmakebuild/AppFwk/cafUserInterface/cafUserInterface_UnitTests/cafUserInterface_UnitTests
cmakebuild/install/bin/cafPdmCore_UnitTests
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

View File

@ -33,11 +33,12 @@ jobs:
vcpkg-triplet: x64-windows,
build-python-module: true,
execute-unit-tests: true,
execute-pytests: true,
unity-build: true,
publish-to-pypi: false,
}
- {
name: "Ubuntu Latest gcc",
name: "Ubuntu 20.04 gcc",
os: ubuntu-20.04,
cc: "gcc",
cxx: "g++",
@ -45,29 +46,31 @@ jobs:
vcpkg-triplet: x64-linux,
build-python-module: true,
execute-unit-tests: true,
execute-pytests: true,
unity-build: false,
publish-to-pypi: true,
}
- {
name: "Ubuntu Latest clang",
os: ubuntu-20.04,
cc: "clang",
cxx: "clang++",
name: "Ubuntu 22.04 clang-16",
os: ubuntu-22.04,
cc: "clang-16",
cxx: "clang++-16",
vcpkg-response-file: vcpkg_x64-linux.txt,
vcpkg-triplet: x64-linux,
build-python-module: true,
execute-unit-tests: true,
execute-pytests: false,
unity-build: false,
publish-to-pypi: false,
}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Display Python version
@ -84,7 +87,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r GrpcInterface/Python/requirements.txt
pip install -r GrpcInterface/Python/dev-requirements.txt
- name: Use CMake
uses: lukka/get-cmake@latest
@ -116,7 +119,7 @@ jobs:
endif()
- name: Get current time
uses: josStorer/get-current-time@v2.0.2
uses: josStorer/get-current-time@v2
id: current-time
with:
format: YYYY-MM-DD
@ -126,7 +129,7 @@ jobs:
- name: Cache Buildcache
id: cache-buildcache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ env.BUILDCACHE_DIR }}
key: ${{ matrix.config.os }}-${{ matrix.config.cc }}-cache-v03-${{ steps.current-time.outputs.formattedTime }}
@ -139,7 +142,7 @@ jobs:
- name: Set apt mirror
# see https://github.com/actions/runner-images/issues/7048
if: ${{contains( matrix.config.os, 'ubuntu') }}
if: contains( matrix.config.os, 'ubuntu')
run: |
# make sure there is a `\t` between URL and `priority:*` attributes
printf 'http://azure.archive.ubuntu.com/ubuntu priority:1\n' | sudo tee /etc/apt/mirrors.txt
@ -147,11 +150,24 @@ jobs:
sudo sed -i 's/http:\/\/azure.archive.ubuntu.com\/ubuntu\//mirror+file:\/etc\/apt\/mirrors.txt/' /etc/apt/sources.list
- name: Install Linux dependencies
if: ${{contains( matrix.config.os, 'ubuntu') }}
if: contains( matrix.config.os, 'ubuntu')
run: |
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: |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11
sudo apt-get upgrade
wget https://apt.llvm.org/llvm.sh
sudo chmod +x llvm.sh
sudo ./llvm.sh 16 all
- name: Install Qt
uses: jurplel/install-qt-action@v3
@ -170,14 +186,14 @@ jobs:
appendedCacheKey: ${{ matrix.config.os }}-${{ matrix.config.cxx }}-cache-key-v2
- name: Cache dynamic version of OpenSSL (Linux)
if: ${{contains( matrix.config.os, 'ubuntu_disabled') }}
uses: actions/cache@v3
if: contains( matrix.config.os, 'ubuntu_disabled')
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/ThirdParty/vcpkg/installed/x64-linux-dynamic
key: ${{ matrix.config.os }}-vcpkg-x64-linux-dynamic_v05
- name: Install dynamic version of OpenSSL (Linux)
if: ${{contains( matrix.config.os, 'ubuntu') }}
if: contains( matrix.config.os, 'ubuntu')
run: |
$VCPKG_ROOT/vcpkg install --overlay-triplets=${{ github.workspace }}/ThirdParty/vcpkg-custom-triplets --triplet x64-linux-dynamic openssl
@ -194,6 +210,7 @@ jobs:
-D CMAKE_BUILD_TYPE=$ENV{BUILD_TYPE}
-D CMAKE_INSTALL_PREFIX=cmakebuild/install
-D RESINSIGHT_BUNDLE_OPENSSL=true
-D RESINSIGHT_QT5_BUNDLE_LIBRARIES=true
-D RESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS=true
-D RESINSIGHT_TREAT_WARNINGS_AS_ERRORS=true
-D RESINSIGHT_ENABLE_PRECOMPILED_HEADERS=false
@ -224,11 +241,12 @@ jobs:
- name: Stats for buildcache
run: ${{ github.workspace }}/buildcache/bin/buildcache -s
- name: Run Unit Tests
if: matrix.config.execute-unit-tests
shell: bash
run: |
cmakebuild/ApplicationExeCode/ResInsight --unittest
cmakebuild/ApplicationLibCode/UnitTests/ResInsight-tests
- name: (Python) Check types using mypy
if: matrix.config.build-python-module
@ -239,7 +257,7 @@ jobs:
${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} -m mypy *.py generated/generated_classes.py
- name: Run pytest
if: matrix.config.build-python-module
if: matrix.config.execute-pytests
env:
RESINSIGHT_EXECUTABLE: ${{ runner.workspace }}/ResInsight/cmakebuild/ApplicationExeCode/ResInsight
run: |
@ -250,14 +268,13 @@ jobs:
- name: Upload python distribution folder
if: matrix.config.publish-to-pypi
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: python-distribution
path: GrpcInterface/Python/dist
- name: Upload Windows install artifact
if: ${{contains( matrix.config.os, 'windows') }}
uses: actions/upload-artifact@v3
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ResInsight-${{ matrix.config.name }}
path: ${{ runner.workspace }}/ResInsight/cmakebuild/install

View File

@ -20,7 +20,7 @@ jobs:
sudo apt-get update
sudo apt-get install --option="APT::Acquire::Retries=3" clang-format-15
clang-format-15 --version
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Check format - ApplicationLibCode
run: |
cd ApplicationLibCode
@ -36,7 +36,7 @@ jobs:
cd Fwk/AppFwk
find -name '*.h' -o -name '*.cpp' -o -name '*.inl' | grep -v gtest | xargs clang-format-15 -i
git diff
- uses: peter-evans/create-pull-request@v5
- uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Fixes by clang-format"

View File

@ -31,7 +31,7 @@ jobs:
}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true
@ -69,11 +69,14 @@ jobs:
run: |
cd build
run-clang-tidy-15 -config-file ../ApplicationLibCode/.clang-tidy -fix files ApplicationLibCode
run-clang-tidy-15 -config-file ../GrpcInterface/.clang-tidy -fix files GrpcInterface
- name: Run clang-format after clang-tidy
run: |
cd ApplicationLibCode
find -name '*.h' -o -name '*.cpp' -o -name '*.inl' | xargs clang-format-15 -i
- uses: peter-evans/create-pull-request@v5
cd ../GrpcInterface
find -name '*.h' -o -name '*.cpp' -o -name '*.inl' | xargs clang-format-15 -i
- uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Fixes by clang-tidy"
@ -82,3 +85,4 @@ jobs:
branch-suffix: random
add-paths: |
ApplicationLibCode/*
GrpcInterface/*

View File

@ -9,7 +9,7 @@ jobs:
- name: Install cmakelang for cmake-format
run: |
python3 -m pip install --user cmakelang
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Check format - ApplicationLibCode
run: |
~/.local/bin/cmake-format -c ${{ github.workspace }}/cmake/cmake-format.py -i CMakeLists.txt
@ -28,7 +28,7 @@ jobs:
cd ..
git diff
- uses: peter-evans/create-pull-request@v5
- uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Fixes by cmake-format"

View File

@ -6,7 +6,7 @@ import sys
org_name = "OPM"
repo_name = "ResInsight"
keep_artifacts = 20
keep_artifacts = 100
def get_all_artifacts(repo_name: str, headers: dict) -> []:
amount_items_per_page = 50

View File

@ -12,9 +12,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: setup python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Remove old artifacts

View File

@ -6,8 +6,8 @@ jobs:
lint:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: (Python) Use black to do linting
@ -15,7 +15,7 @@ jobs:
pip install black
cd GrpcInterface
black .
- uses: peter-evans/create-pull-request@v5
- uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Python code linting changes detected by black"

View File

@ -7,11 +7,11 @@ jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: sobolevn/misspell-fixer-action@master
with:
options: "-rsvnuR ApplicationLibCode/"
- uses: peter-evans/create-pull-request@v5
- uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Fixes by misspell-fixer"

9
.gitmodules vendored
View File

@ -7,9 +7,6 @@
[submodule "ThirdParty/fast_float"]
path = ThirdParty/fast_float
url = https://github.com/fastfloat/fast_float
[submodule "ThirdParty/qtadvanceddocking"]
path = ThirdParty/qtadvanceddocking
url = https://github.com/CeetronSolutions/qtadvanceddocking.git
[submodule "ThirdParty/custom-opm-common/opm-common"]
path = ThirdParty/custom-opm-common/opm-common
url = https://github.com/CeetronSolutions/opm-common
@ -25,3 +22,9 @@
[submodule "ThirdParty/tomlplusplus"]
path = ThirdParty/tomlplusplus
url = https://github.com/marzer/tomlplusplus.git
[submodule "ThirdParty/qtadvanceddocking"]
path = ThirdParty/qtadvanceddocking
url = https://github.com/CeetronSolutions/qtadvanceddocking.git
[submodule "ThirdParty/spdlog"]
path = ThirdParty/spdlog
url = https://github.com/gabime/spdlog.git

View File

@ -271,14 +271,14 @@ set(LINK_LIBRARIES
${VIZ_FWK_LIBRARIES}
ApplicationLibCode
Commands
RigGeoMechDataModel
RifGeoMechFileInterface
)
if(RESINSIGHT_ENABLE_GRPC)
list(APPEND LINK_LIBRARIES GrpcInterface)
endif()
list(APPEND LINK_LIBRARIES RigGeoMechDataModel)
if(RESINSIGHT_USE_ODB_API)
add_definitions(-DUSE_ODB_API)
list(APPEND LINK_LIBRARIES RifOdbReader)
@ -317,68 +317,6 @@ endif()
# ##############################################################################
# Copy Dlls on MSVC
# ##############################################################################
if(MSVC)
if(NOT ${RESINSIGHT_ODB_API_DIR} EQUAL "")
set(RESINSIGHT_USE_ODB_API 1)
endif()
# Odb Dlls
if(RESINSIGHT_USE_ODB_API)
# Find all the dlls
file(GLOB RI_ALL_ODB_DLLS ${RESINSIGHT_ODB_API_DIR}/lib/*.dll)
# Strip off the path
foreach(aDLL ${RI_ALL_ODB_DLLS})
get_filename_component(filenameWithExt ${aDLL} NAME)
list(APPEND RI_ODB_DLLS ${filenameWithExt})
endforeach(aDLL)
foreach(aDLL ${RI_ODB_DLLS})
list(APPEND RI_FILENAMES ${RESINSIGHT_ODB_API_DIR}/lib/${aDLL})
endforeach()
endif()
# OpenVDS Dlls
set(OPENVDS_DLL_NAMES openvds segyutils)
foreach(OPENVDS_DLL_NAME ${OPENVDS_DLL_NAMES})
list(APPEND RI_FILENAMES
${RESINSIGHT_OPENVDS_API_DIR}/bin/msvc_141/${OPENVDS_DLL_NAME}.dll
)
endforeach(OPENVDS_DLL_NAME)
list(APPEND RI_FILENAMES
${RESINSIGHT_OPENVDS_API_DIR}/bin/msvc_141/SEGYImport.exe
)
# HDF5 Dlls
if(RESINSIGHT_FOUND_HDF5)
set(HDF5_DLL_NAMES hdf5 hdf5_cpp szip zlib)
foreach(HDF5_DLL_NAME ${HDF5_DLL_NAMES})
list(APPEND RI_FILENAMES ${RESINSIGHT_HDF5_DIR}/bin/${HDF5_DLL_NAME}.dll)
endforeach(HDF5_DLL_NAME)
endif()
else()
# Linux
# OpenVDS lib files
list(APPEND RI_FILENAMES ${RESINSIGHT_OPENVDS_API_DIR}/bin/SEGYImport)
set(OPENVDS_LIB_NAMES
libopenvds.so
libopenvds.so.3
libopenvds.so.3.2.7
libopenvds-e1541338.so.3.2.7
libsegyutils.so
libsegyutils.so.3
libsegyutils.so.3.2.7
)
foreach(OPENVDS_LIB_NAME ${OPENVDS_LIB_NAMES})
list(APPEND RI_FILENAMES
${RESINSIGHT_OPENVDS_API_DIR}/lib64/${OPENVDS_LIB_NAME}
)
endforeach(OPENVDS_LIB_NAME)
endif(MSVC)
# create an empty library target that will be used to copy files to the build
# folder
@ -398,11 +336,7 @@ foreach(riFileName ${RI_FILENAMES})
$<TARGET_FILE_DIR:ResInsightDummyTarget>
)
endforeach()
add_custom_target(
PreBuildFileCopy
COMMENT "PreBuildFileCopy step: copy runtime files into build folder"
${copyCommands}
)
add_custom_target(PreBuildFileCopy ${copyCommands})
set_property(TARGET PreBuildFileCopy PROPERTY FOLDER "FileCopyTargets")
# Make ResInsight depend on the prebuild target.
@ -446,8 +380,15 @@ endif(RESINSIGHT_ENABLE_GRPC)
# bundle libraries together with private installation
if(RESINSIGHT_PRIVATE_INSTALL)
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
# tell binary to first attempt to load libraries from its own directory
set(RESINSIGHT_INSTALL_RPATH "\$ORIGIN")
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
@ -543,6 +484,8 @@ if(RESINSIGHT_PRIVATE_INSTALL)
OPTIONAL
)
install(FILES qt.conf DESTINATION ${RESINSIGHT_INSTALL_FOLDER}/)
endif(RESINSIGHT_QT5_BUNDLE_LIBRARIES)
endif()

View File

@ -277,14 +277,16 @@
<file>SeismicDelta16x16.png</file>
<file>SeismicView16x16.png</file>
<file>SeismicView24x24.png</file>
<file>SeismicViews24x24.png</file>
<file>SeismicData24x24.png</file>
<file>SeismicSection16x16.png</file>
<file>Fullscreen.png</file>
<file>SeismicViews24x24.png</file>
<file>SeismicData24x24.png</file>
<file>SeismicSection16x16.png</file>
<file>Fullscreen.png</file>
<file>plot-template-standard.svg</file>
<file>plot-template-ensemble.svg</file>
<file>decline-curve.svg</file>
<file>regression-curve.svg</file>
<file>padlock.svg</file>
<file>warning.svg</file>
</qresource>
<qresource prefix="/Shader">
<file>fs_CellFace.glsl</file>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg fill="#000000" height="800px" width="800px" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 485 485" xml:space="preserve">
<g>
<path d="M345,175v-72.5C345,45.981,299.019,0,242.5,0S140,45.981,140,102.5V175H70v310h345V175H345z M170,102.5
c0-39.977,32.523-72.5,72.5-72.5S315,62.523,315,102.5V175H170V102.5z M385,455H100V205h285V455z"/>
<path d="M227.5,338.047v53.568h30v-53.569c11.814-5.628,20-17.682,20-31.616c0-19.299-15.701-35-35-35c-19.299,0-35,15.701-35,35
C207.5,320.365,215.686,332.42,227.5,338.047z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 727 B

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg width="800px" height="800px" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><title>ionicons-v5-r</title><path d="M85.57,446.25H426.43a32,32,0,0,0,28.17-47.17L284.18,82.58c-12.09-22.44-44.27-22.44-56.36,0L57.4,399.08A32,32,0,0,0,85.57,446.25Z" style="fill:none;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px"/><path d="M250.26,195.39l5.74,122,5.73-121.95a5.74,5.74,0,0,0-5.79-6h0A5.74,5.74,0,0,0,250.26,195.39Z" style="fill:none;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px"/><path d="M256,397.25a20,20,0,1,1,20-20A20,20,0,0,1,256,397.25Z"/></svg>

After

Width:  |  Height:  |  Size: 740 B

View File

@ -46,7 +46,7 @@ RiaGrpcConsoleApplication::RiaGrpcConsoleApplication( int& argc, char** argv )
{
m_idleTimer = new QTimer( this );
connect( m_idleTimer, SIGNAL( timeout() ), this, SLOT( doIdleProcessing() ) );
m_idleTimer->start( 0 );
m_idleTimer->start( 5 );
}
//--------------------------------------------------------------------------------------------------

View File

@ -17,8 +17,8 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RiaArgumentParser.h"
#include "RiaLogging.h"
#include "RiaMainTools.h"
#include "RiaPreferences.h"
#ifdef ENABLE_GRPC
#include "RiaGrpcConsoleApplication.h"
@ -40,11 +40,15 @@
#include <unistd.h>
#endif
#include <signal.h>
void manageSegFailure( int signalCode );
RiaApplication* createApplication( int& argc, char* argv[] )
{
for ( int i = 1; i < argc; ++i )
{
if ( !qstrcmp( argv[i], "--console" ) || !qstrcmp( argv[i], "--unittest" ) || !qstrcmp( argv[i], "--version" ) )
if ( !qstrcmp( argv[i], "--console" ) || !qstrcmp( argv[i], "--unittest" ) )
{
#ifdef ENABLE_GRPC
return new RiaGrpcConsoleApplication( argc, argv );
@ -72,8 +76,12 @@ int main( int argc, char* argv[] )
return 1;
}
#endif
// Global initialization
RiaLogging::loggerInstance()->setLevel( int( RILogLevel::RI_LL_DEBUG ) );
// 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.
// See test application QtTestBenchOpenGLWidget
QApplication::setAttribute( Qt::AA_ShareOpenGLContexts );
// Create feature manager before the application object is created
RiaMainTools::initializeSingletons();
@ -112,6 +120,17 @@ int main( int argc, char* argv[] )
QLocale::setDefault( QLocale( QLocale::English, QLocale::UnitedStates ) );
setlocale( LC_NUMERIC, "C" );
// Set up signal handlers
if ( RiaPreferences::current()->loggerTrapSignalAndFlush() )
{
signal( SIGINT, manageSegFailure );
signal( SIGILL, manageSegFailure );
signal( SIGFPE, manageSegFailure );
signal( SIGSEGV, manageSegFailure );
signal( SIGTERM, manageSegFailure );
signal( SIGABRT, manageSegFailure );
}
// Handle the command line arguments.
// Todo: Move to a one-shot timer, delaying the execution until we are inside the event loop.
// The complete handling of the resulting ApplicationStatus must be moved along.

View File

@ -17,6 +17,8 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RiaMainTools.h"
#include "RiaFileLogger.h"
#include "RiaLogging.h"
#include "RiaRegressionTestRunner.h"
#include "RiaSocketCommand.h"
@ -25,6 +27,32 @@
#include "cafPdmDefaultObjectFactory.h"
#include "cafPdmUiFieldEditorHandle.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void manageSegFailure( int signalCode )
{
// Executing function here is not safe, but works as expected on Windows. Behavior on Linux is undefined, but will
// work in some cases.
// https://github.com/gabime/spdlog/issues/1607
auto loggers = RiaLogging::loggerInstances();
QString str = QString( "Segmentation fault. Signal code: %1" ).arg( signalCode );
for ( auto logger : loggers )
{
if ( auto fileLogger = dynamic_cast<RiaFileLogger*>( logger ) )
{
fileLogger->error( str.toStdString().data() );
fileLogger->flush();
}
}
exit( 1 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -0,0 +1,2 @@
[Paths]
Plugins = plugins

View File

@ -683,3 +683,35 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
===============================================================================
Notice for spdlog
===============================================================================
https://github.com/gabime/spdlog/blob/v1.x/LICENSE
The MIT License (MIT)
Copyright (c) 2016 Gabi Melman.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-- NOTE: Third party dependency used by this software --
This software depends on the fmt lib (MIT License),
and users must comply to its license: https://raw.githubusercontent.com/fmtlib/fmt/master/LICENSE

View File

@ -34,3 +34,5 @@
#define RESINSIGHT_OCTAVE_VERSION "@OCTAVE_VERSION_STRING@"
#define RESINSIGHT_PYTHON_VERSION "@Python3_VERSION@"
#define RESINSIGHT_GIT_HASH "@RESINSIGHT_GIT_HASH@"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,477 @@
// ResInsight version string : 2024.03.0-RC_05
// Report generated : Fri Mar 22 08:17:14 2024
//
//
AnalysisPlot
AnalysisPlotCollection
AnalysisPlotDataEntry
Annotations
AsciiDataCurve
CalcScript
CellEdgeResultSlot
CellFilterCollection
CellIndexFilter
CellPropertyFilter
CellPropertyFilters
CellRangeFilter
CellRangeFilterCollection
ChangeDataSourceFeatureUi
CmdAddItemExecData
CmdDeleteItemExecData
CmdSelectionChangeExecData
ColorLegend
ColorLegendCollection
ColorLegendItem
CompletionTemplateCollection
CorrelationMatrixPlot
CorrelationPlot
CorrelationPlotCollection
CorrelationReportPlot
CrossSection
CrossSectionCollection
CsvSummaryCase
CurveIntersection
DataContainerFloat
DataContainerString
DataContainerTime
DeclineCurve
DepthTrackPlot
DoubleParameter
Eclipse2dViewCollection
EclipseCase
EclipseGeometrySelectionItem
EclipseResultAddress
ElasticProperties
ElasticPropertyScaling
ElasticPropertyScalingCollection
EnsembleFractureStatistics
EnsembleFractureStatisticsPlot
EnsembleFractureStatisticsPlotCollection
EnsembleStatisticsSurface
EnsembleSurface
EnsembleWellLogStatisticsCurve
EnsembleWellLogs
EnsembleWellLogsCollection
FaciesInitialPressureConfig
FaciesProperties
Fault
FaultReactivationModel
FaultReactivationModelCollection
Faults
FileSummaryCase
FileSurface
FishbonesCollection
FishbonesMultipleSubs
FishbonesPipeProperties
FlowCharacteristicsPlot
FlowDiagSolution
FlowPlotCollection
FormationNames
FormationNamesCollectionObject
FractureContainment
FractureDefinitionCollection
FractureGroupStatisticsCollection
FractureTemplateCollection
GeoMech2dViewCollection
GeoMechGeometrySelectionItem
GeoMechPart
GeoMechPartCollection
GeoMechPropertyFilter
GeoMechPropertyFilters
GeoMechResultDefinition
GeoMechResultSlot
GeoMechView
GridCaseSurface
GridCollection
GridCrossPlotCurve
GridCrossPlotCurveSet
GridCrossPlotRegressionCurve
GridInfo
GridInfoCollection
GridStatisticsPlot
GridStatisticsPlotCollection
GridSummaryCase
GridTimeHistoryCurve
IntegerParameter
Intersection2dView
Intersection2dViewCollection
IntersectionBox
IntersectionCollection
IntersectionResultDefinition
Legend
ListParameter
MainPlotCollection
MdiWindowController
MockModelSettings
ModeledWellPath
MultiPlot
MultiSnapshotDefinition
MultiSummaryPlot
NonNetLayers
ObservedDataCollection
ObservedFmuRftData
ObservedPressureDepthData
ParameterGroup
ParameterList
ParameterResultCrossPlot
PdmDocument
PdmObjectCollection
PdmObjectGroup
Perforation
PerforationCollection
PlotDataFilterCollection
PlotDataFilterItem
PlotTemplateCollection
PlotTemplateFileItem
PolyLineFilter
PolygonFilter
PolylineTarget
PolylinesFromFileAnnotation
PressureTable
PressureTableItem
PropertyFilter
RegressionAnalysisCurve
ResInsightAnalysisModels
ResInsightGeoMechCase
ResInsightGeoMechModels
ResInsightOilField
ResInsightProject
ResampleData
ReservoirCellResultStorage
ReservoirView
ResultDefinition
ResultSlot
ResultStorageEntryInfo
RftAddress
RiaMemoryCleanup
RiaPreferences
RiaPreferencesGeoMech
RiaPreferencesSummary
RiaPreferencesSystem
RiaRegressionTest
RicCaseAndFileExportSettingsUi
RicCellRangeUi
RicCreateDepthAdjustedLasFilesUi
RicCreateEnsembleSurfaceUi
RicCreateEnsembleWellLogUi
RicCreateMultipleWellPathLateralsUi
RicCreateRftPlotsFeatureUi
RicDeleteItemExecData
RicExportCarfinUi
RicExportCompletionDataSettingsUi
RicExportContourMapToTextUi
RicExportEclipseInputGridUi
RicExportLgrUi
RicExportToLasFileObj
RicExportToLasFileResampleUi
RicExportWellPathsUi
RicGridCalculator
RicHoloLensCreateSessionUi
RicHoloLensExportToFolderUi
RicHoloLensServerSettings
RicLinkVisibleViewsFeatureUi
RicPasteAsciiDataToSummaryPlotFeatureUi
RicSaturationPressureUi
RicSaveEclipseInputVisibleCellsUi
RicSaveMultiPlotTemplateFeatureSettings
RicSelectCaseOrEnsembleUi
RicSelectPlotTemplateUi
RicSelectSummaryPlotUI
RicSelectViewUI
RicSummaryAddressSelection
RicSummaryCurveCalculator
RicSummaryCurveCreator
RicWellPathsUnitSystemSettingsUi
RifReaderSettings
Rim3dWellLogCurveCollection
Rim3dWellLogExtractionCurve
Rim3dWellLogFileCurve
Rim3dWellLogRftCurve
RimAnnotationCollection
RimAnnotationCollectionBase
RimAnnotationGroupCollection
RimAnnotationLineAppearance
RimAnnotationTextAppearance
RimBinaryExportSettings
RimCaseCollection
RimCellFilterCollection
RimCommandExecuteScript
RimCommandIssueFieldChanged
RimCommandObject
RimCommandRouter
RimContourMapView
RimCsvUserData
RimCustomObjectiveFunction
RimCustomObjectiveFunctionCollection
RimCustomObjectiveFunctionWeight
RimDerivedEnsembleCase
RimDerivedEnsembleCaseCollection
RimDialogData
RimEclipseContourMapProjection
RimEclipseResultAddressCollection
RimElementVectorResult
RimEllipseFractureTemplate
RimEmCase
RimEnsembleCurveFilter
RimEnsembleCurveFilterCollection
RimEnsembleCurveSet
RimEnsembleCurveSetCollection
RimEnsembleStatistics
RimEnsembleWellLogCurveSet
RimEquilibriumAxisAnnotation
RimExportInputSettings
RimFaultResultSlot
RimFractureExportSettings
RimGeoMechContourMapProjection
RimGeoMechContourMapView
RimGeoMechFaultReactivationResult
RimGridCalculation
RimGridCalculationCollection
RimGridCalculationVariable
RimGridCrossPlot
RimGridCrossPlotCollection
RimGridCrossPlotCurveSetNameConfig
RimGridCrossPlotNameConfig
RimIdenticalGridCaseGroup
RimInputProperty
RimInputPropertyCollection
RimInputReservoir
RimIntersectionResultsDefinitionCollection
RimMeasurement
RimMswCompletionParameters
RimMudWeightWindowParameters
RimMultiPlotCollection
RimMultipleEclipseResults
RimMultipleLocations
RimMultipleValveLocations
RimNonDarcyPerforationParameters
RimObjectiveFunction
RimObservedEclipseUserData
RimOilFieldEntry
RimOilRegionEntry
RimPlotAxisAnnotation
RimPlotCellFilterCollection
RimPlotCellPropertyFilter
RimPlotRectAnnotation
RimPolygon
RimPolygonAppearance
RimPolygonCollection
RimPolygonFileFile
RimPolygonInView
RimPolygonInViewCollection
RimPolylineAppearance
RimPolylinesAnnotationInView
RimPolylinesFromFileAnnotationInView
RimProcess
RimReachCircleAnnotation
RimReachCircleAnnotationInView
RimResultSelectionUi
RimRftCase
RimRftTopologyCurve
RimRoffCase
RimSEGYConvertOptions
RimSaturationPressurePlot
RimSaturationPressurePlotCollection
RimSeismicView
RimStatisticalCalculation
RimStatisticalCollection
RimStimPlanColors
RimStimPlanFractureTemplate
RimStimPlanLegendConfig
RimSummaryAddressCollection
RimSummaryAddressSelector
RimSummaryCalculation
RimSummaryCalculationCollection
RimSummaryCalculationVariable
RimSummaryCurveCollection
RimSummaryCurveCollectionModifier
RimSummaryMultiPlotCollection
RimSummaryPlotManager
RimSummaryTable
RimSummaryTableCollection
RimSurfaceIntersectionBand
RimSurfaceIntersectionCollection
RimSurfaceIntersectionCurve
RimTensorResults
RimTernaryLegendConfig
RimTextAnnotation
RimTextAnnotationInView
RimThermalFractureTemplate
RimTimeAxisAnnotation
RimTimeStepFilter
RimUserDefinedIndexFilter
RimUserDefinedPolylinesAnnotationInView
RimVfpPlotCollection
RimViewLinkerCollection
RimViewNameConfig
RimVirtualPerforationResults
RimWellAllocationOverTimePlot
RimWellConnectivityTable
RimWellIASettings
RimWellIASettingsCollection
RimWellLogExtractionCurve
RimWellLogExtractionCurveNameConfig
RimWellLogFileCurveNameConfig
RimWellLogLasFileCurveNameConfig
RimWellLogPlotNameConfig
RimWellLogRftCurveNameConfig
RimWellLogWbsCurve
RimWellPathEntry
RimWellPathImport
RimWellPathTieIn
RiuCreateMultipleFractionsUi
RiuMultipleFractionsOptions
ScriptLocation
SeismicCollection
SeismicData
SeismicDataCollection
SeismicDifferenceData
SeismicSection
SeismicSectionCollection
SeismicView
SeismicViewCollection
SimWellFracture
SimWellFractureCollection
StimPlanFractureTemplate
StimPlanModel
StimPlanModelCollection
StimPlanModelCurve
StimPlanModelPlot
StimPlanModelPlotCollection
StimPlanModelTemplate
StimPlanModelTemplateCollection
StreamlineInViewCollection
StringParameter
SummaryAddress
SummaryCaseCollection
SummaryCaseSubCollection
SummaryCrossPlot
SummaryCrossPlotCollection
SummaryCurve
SummaryCurveAutoName
SummaryObservedDataFile
SummaryPageDownloadEntity
SummaryPlot
SummaryPlotCollection
SummaryTimeAxisProperties
SummaryYAxisProperties
Surface
SurfaceCollection
SurfaceInView
SurfaceInViewCollection
SurfaceResultDefinition
ThermalFractureTemplate
TofAccumulatedPhaseFractionsPlot
TotalWellAllocationPlot
TriangleGeometry
UserDefinedFilter
UserDefinedPolylinesAnnotation
ValveTemplate
ValveTemplateCollection
VfpPlot
View3dOverlayInfoConfig
ViewController
ViewLinker
WbsParameters
Well
WellAllocationPlot
WellAllocationPlotLegend
WellBoreStabilityPlot
WellDistributionPlot
WellDistributionPlotCollection
WellFlowRateCurve
WellLogCalculatedCurve
WellLogCsvFile
WellLogExtractionCurve
WellLogFile
WellLogFileChannel
WellLogFileCurve
WellLogLasFile
WellLogLasFileCurve
WellLogPlot
WellLogPlotCollection
WellLogPlotTrack
WellLogRftCurve
WellMeasurement
WellMeasurementCurve
WellMeasurementFilePath
WellMeasurementInView
WellMeasurements
WellMeasurementsInView
WellPath
WellPathAicdParameters
WellPathAttribute
WellPathAttributes
WellPathBase
WellPathCompletionSettings
WellPathCompletions
WellPathFracture
WellPathFractureCollection
WellPathGeometry
WellPathGeometryDef
WellPathGroup
WellPathTarget
WellPathValve
WellPaths
WellPltPlot
WellPltPlotCollection
WellRftEnsembleCurveSet
WellRftPlot
WellRftPlotCollection
Wells
cafNamedTreeNode
cafObjectReferenceTreeNode
cafTreeNode
cloneView
closeProject
computeCaseGroupStatistics
createGridCaseGroup
createGridCaseGroupResult
createLgrForCompletions
createMultiPlot
createMultipleFractures
createSaturationPressurePlots
createStatisticsCase
createStatisticsCaseResult
createView
createViewResult
createWbsPlotResult
createWellBoreStabilityPlot
exportContourMapToText
exportFlowCharacteristics
exportLgrForCompletions
exportMsw
exportMultiCaseSnapshots
exportProperty
exportPropertyInViews
exportSimWellFractureCompletions
exportSnapshots
exportVisibleCells
exportWellLogPlotData
exportWellLogPlotDataResult
exportWellPathCompletions
exportWellPaths
importFormationNames
importWellLogFiles
importWellLogFilesResult
importWellPaths
importWellPathsResult
loadCase
loadCaseResult
openProject
replaceCase
replaceMultipleCases
replaceSourceCases
runOctaveScript
saveProject
saveProjectAs
scaleFractureTemplate
setExportFolder
setFractureContainment
setMainWindowSize
setPlotWindowSize
setStartDir
setTimeStep
stackCurves
unstackCurves

View File

@ -40,6 +40,8 @@
#include "RicfCommandObject.h"
#include "PlotTemplates/RimPlotTemplateFolderItem.h"
#include "Polygons/RimPolygonCollection.h"
#include "Rim2dIntersectionViewCollection.h"
#include "RimAnnotationCollection.h"
#include "RimAnnotationInViewCollection.h"
@ -125,10 +127,6 @@
#include <unistd.h> // for usleep
#endif // WIN32
#ifdef USE_UNIT_TESTS
#include "gtest/gtest.h"
#endif // USE_UNIT_TESTS
// Required to ignore warning of usused variable when defining caf::PdmMarkdownGenerator
#if defined( __clang__ )
#pragma clang diagnostic ignored "-Wunused-variable"
@ -548,6 +546,8 @@ bool RiaApplication::loadProject( const QString& projectFileName, ProjectLoadAct
{
seismicData->ensureFileReaderIsInitialized();
}
oilField->polygonCollection()->loadData();
}
{
@ -662,7 +662,10 @@ bool RiaApplication::loadProject( const QString& projectFileName, ProjectLoadAct
}
}
setActiveReservoirView( riv );
if ( riv->showWindow() )
{
setActiveReservoirView( riv );
}
RimGridView* rigv = dynamic_cast<RimGridView*>( riv );
if ( rigv ) rigv->cellFilterCollection()->updateIconState();
@ -1395,56 +1398,6 @@ void RiaApplication::waitUntilCommandObjectsHasBeenProcessed()
m_commandQueueLock.unlock();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RiaApplication::launchUnitTests()
{
#ifdef USE_UNIT_TESTS
caf::ProgressInfoBlocker progressBlocker;
cvf::Assert::setReportMode( cvf::Assert::CONSOLE );
int argc = QCoreApplication::arguments().size();
QStringList arguments = QCoreApplication::arguments();
std::vector<std::string> argumentsStd;
for ( QString qstring : arguments )
{
argumentsStd.push_back( qstring.toStdString() );
}
std::vector<char*> argVector;
for ( std::string& string : argumentsStd )
{
argVector.push_back( &string.front() );
}
char** argv = argVector.data();
testing::InitGoogleTest( &argc, argv );
//
// Use the gtest filter to execute a subset of tests
QString filterText = RiaPreferencesSystem::current()->gtestFilter();
if ( !filterText.isEmpty() )
{
::testing::GTEST_FLAG( filter ) = filterText.toStdString();
// Example on filter syntax
//::testing::GTEST_FLAG( filter ) = "*RifCaseRealizationParametersReaderTest*";
}
// Use this macro in main() to run all tests. It returns 0 if all
// tests are successful, or 1 otherwise.
//
// RUN_ALL_TESTS() should be invoked after the command line has been
// parsed by InitGoogleTest().
return RUN_ALL_TESTS();
#else
return -1;
#endif
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -1562,14 +1515,6 @@ void RiaApplication::initialize()
caf::SelectionManager::instance()->setPdmRootObject( project() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RiaApplication::launchUnitTestsWithConsole()
{
return launchUnitTests();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -21,12 +21,11 @@
#include "RiaDefines.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cvfFont.h"
#include "cafPdmPointer.h"
#include "cvfObject.h"
#include <QEventLoop>
#include <QMap>
#include <QMutex>
#include <QPointer>
#include <QProcess>
@ -35,7 +34,6 @@
#include <gsl/gsl>
#include <iostream>
#include <memory>
class QAction;
@ -79,7 +77,8 @@ class UiProcess;
namespace cvf
{
class ProgramOptions;
}
class Font;
} // namespace cvf
//==================================================================================================
/// Base class for all ResInsight applications. I.e. console and GUI
@ -198,7 +197,6 @@ public:
// Public implementation specific overrides
virtual void initialize();
virtual ApplicationStatus handleArguments( gsl::not_null<cvf::ProgramOptions*> progOpt ) = 0;
virtual int launchUnitTestsWithConsole();
virtual void addToRecentFiles( const QString& fileName ) {}
virtual void showFormattedTextInMessageBoxOrConsole( const QString& errMsg ) = 0;

View File

@ -103,8 +103,9 @@ void RiaConsoleApplication::initialize()
RiaApplication::initialize();
RiaLogging::setLoggerInstance( std::make_unique<RiaStdOutLogger>() );
RiaLogging::loggerInstance()->setLevel( int( RiaLogging::logLevelBasedOnPreferences() ) );
auto logger = std::make_unique<RiaStdOutLogger>();
logger->setLevel( int( RiaLogging::logLevelBasedOnPreferences() ) );
RiaLogging::appendLoggerInstance( std::move( logger ) );
m_socketServer = new RiaSocketServer( this );
}
@ -130,6 +131,7 @@ RiaApplication::ApplicationStatus RiaConsoleApplication::handleArguments( gsl::n
if ( progOpt->option( "version" ) )
{
QString text = QString( STRPRODUCTVER ) + "\n";
text += "SHA " + QString( RESINSIGHT_GIT_HASH ) + "\n";
showFormattedTextInMessageBoxOrConsole( text );
@ -153,22 +155,6 @@ RiaApplication::ApplicationStatus RiaConsoleApplication::handleArguments( gsl::n
return RiaApplication::ApplicationStatus::EXIT_COMPLETED;
}
// Unit testing
// --------------------------------------------------------
if ( cvf::Option o = progOpt->option( "unittest" ) )
{
int testReturnValue = launchUnitTestsWithConsole();
if ( testReturnValue == 0 )
{
return RiaApplication::ApplicationStatus::EXIT_COMPLETED;
}
else
{
RiaLogging::error( "Error running unit tests" );
return RiaApplication::ApplicationStatus::EXIT_WITH_ERROR;
}
}
if ( cvf::Option o = progOpt->option( "startdir" ) )
{
CVF_ASSERT( o.valueCount() == 1 );

View File

@ -269,6 +269,12 @@ RiaDefines::EclipseUnitSystem RiaDefines::fromDepthUnit( DepthUnitType depthUnit
//--------------------------------------------------------------------------------------------------
RiaDefines::ImportFileType RiaDefines::obtainFileTypeFromFileName( const QString& fileName )
{
if ( fileName.endsWith( "h5grid", Qt::CaseInsensitive ) )
{
// EM data must be detected first, since "h5grid" also matches "grid" and is interpreted as Eclipse file
return ImportFileType::EM_H5GRID;
}
if ( fileName.endsWith( "EGRID", Qt::CaseInsensitive ) )
{
return ImportFileType::ECLIPSE_EGRID_FILE;

View File

@ -132,10 +132,11 @@ enum class ImportFileType
ECLIPSE_SUMMARY_FILE = 0x08,
GEOMECH_ODB_FILE = 0x10,
RESINSIGHT_PROJECT_FILE = 0x20,
ROFF_FILE = 0x30,
GEOMECH_INP_FILE = 0x40,
EM_H5GRID = 0x80,
ROFF_FILE = 0x100,
ECLIPSE_RESULT_GRID = ECLIPSE_GRID_FILE | ECLIPSE_EGRID_FILE,
ANY_ECLIPSE_FILE = ECLIPSE_RESULT_GRID | ECLIPSE_INPUT_FILE | ECLIPSE_SUMMARY_FILE | ROFF_FILE,
ANY_ECLIPSE_FILE = ECLIPSE_RESULT_GRID | ECLIPSE_INPUT_FILE | ECLIPSE_SUMMARY_FILE | ROFF_FILE | EM_H5GRID,
ANY_GEOMECH_FILE = GEOMECH_ODB_FILE | GEOMECH_INP_FILE,
ANY_IMPORT_FILE = 0xFF
};
@ -242,8 +243,17 @@ enum class View3dContent
ALL = 0b00011111
};
enum class ItemIn3dView
{
NONE = 0b00000000,
SURFACE = 0b00000001,
POLYGON = 0b00000010,
ALL = 0b00000011
};
}; // namespace RiaDefines
// Activate bit mask operators at global scope
ENABLE_BITMASK_OPERATORS( RiaDefines::MultiPlotPageUpdateType )
ENABLE_BITMASK_OPERATORS( RiaDefines::View3dContent )
ENABLE_BITMASK_OPERATORS( RiaDefines::ItemIn3dView )

View File

@ -20,9 +20,11 @@
#include "RiaGuiApplication.h"
#include "cafAssert.h"
#include "cafFixedAtlasFont.h"
#include <QDesktopWidget>
#include <cmath>
//--------------------------------------------------------------------------------------------------

View File

@ -23,6 +23,7 @@
#include "RiaArgumentParser.h"
#include "RiaBaseDefs.h"
#include "RiaDefines.h"
#include "RiaFileLogger.h"
#include "RiaFilePathTools.h"
#include "RiaFontCache.h"
#include "RiaImportEclipseCaseTools.h"
@ -141,10 +142,6 @@
#include <unistd.h> // for usleep
#endif // WIN32
#ifdef USE_UNIT_TESTS
#include "gtest/gtest.h"
#endif // USE_UNIT_TESTS
//==================================================================================================
///
/// \class RiaGuiApplication
@ -432,9 +429,18 @@ void RiaGuiApplication::initialize()
auto logger = std::make_unique<RiuMessagePanelLogger>();
logger->addMessagePanel( m_mainWindow->messagePanel() );
logger->addMessagePanel( m_mainPlotWindow->messagePanel() );
RiaLogging::setLoggerInstance( std::move( logger ) );
logger->setLevel( int( RiaLogging::logLevelBasedOnPreferences() ) );
RiaLogging::loggerInstance()->setLevel( int( RiaLogging::logLevelBasedOnPreferences() ) );
RiaLogging::appendLoggerInstance( std::move( logger ) );
auto filename = RiaPreferences::current()->loggerFilename();
if ( !filename.isEmpty() )
{
auto fileLogger = std::make_unique<RiaFileLogger>( filename.toStdString() );
fileLogger->setLevel( int( RiaLogging::logLevelBasedOnPreferences() ) );
RiaLogging::appendLoggerInstance( std::move( fileLogger ) );
}
}
m_socketServer = new RiaSocketServer( this );
}
@ -457,6 +463,16 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( gsl::not_n
return RiaApplication::ApplicationStatus::EXIT_COMPLETED;
}
if ( progOpt->option( "version" ) )
{
QString text = QString( STRPRODUCTVER ) + "\n";
text += "SHA " + QString( RESINSIGHT_GIT_HASH ) + "\n";
showFormattedTextInMessageBoxOrConsole( text );
return RiaApplication::ApplicationStatus::EXIT_COMPLETED;
}
// Code generation
// -----------------
if ( cvf::Option o = progOpt->option( "generate" ) )
@ -474,22 +490,6 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( gsl::not_n
return RiaApplication::ApplicationStatus::EXIT_COMPLETED;
}
// Unit testing
// --------------------------------------------------------
if ( cvf::Option o = progOpt->option( "unittest" ) )
{
int testReturnValue = launchUnitTestsWithConsole();
if ( testReturnValue == 0 )
{
return RiaApplication::ApplicationStatus::EXIT_COMPLETED;
}
else
{
RiaLogging::error( "Error running unit tests" );
return RiaApplication::ApplicationStatus::EXIT_WITH_ERROR;
}
}
if ( cvf::Option o = progOpt->option( "regressiontest" ) )
{
CVF_ASSERT( o.valueCount() == 1 );
@ -501,7 +501,7 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( gsl::not_n
auto stdLogger = std::make_unique<RiaStdOutLogger>();
stdLogger->setLevel( int( RILogLevel::RI_LL_DEBUG ) );
RiaLogging::setLoggerInstance( std::move( stdLogger ) );
RiaLogging::appendLoggerInstance( std::move( stdLogger ) );
RiaRegressionTestRunner::instance()->executeRegressionTests( regressionTestPath, QStringList() );
return ApplicationStatus::EXIT_COMPLETED;
@ -881,31 +881,6 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( gsl::not_n
return ApplicationStatus::KEEP_GOING;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RiaGuiApplication::launchUnitTestsWithConsole()
{
// Following code is taken from cvfAssert.cpp
#ifdef WIN32
{
// Allocate a new console for this app
// Only one console can be associated with an app, so should fail if a console is already present.
AllocConsole();
FILE* consoleFilePointer;
freopen_s( &consoleFilePointer, "CONOUT$", "w", stdout );
freopen_s( &consoleFilePointer, "CONOUT$", "w", stderr );
// Make cout, wcout, cin, wcin, wcerr, cerr, wclog and clog point to console as well
std::ios::sync_with_stdio();
}
#endif
return launchUnitTests();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -964,10 +939,14 @@ void RiaGuiApplication::createMainWindow()
m_mainWindow->showWindow();
// if there is an existing logger, reconnect to it
auto logger = dynamic_cast<RiuMessagePanelLogger*>( RiaLogging::loggerInstance() );
if ( logger )
for ( auto logger : RiaLogging::loggerInstances() )
{
logger->addMessagePanel( m_mainWindow->messagePanel() );
auto messagePanelLogger = dynamic_cast<RiuMessagePanelLogger*>( logger );
if ( messagePanelLogger )
{
messagePanelLogger->addMessagePanel( m_mainWindow->messagePanel() );
}
}
}

View File

@ -21,11 +21,6 @@
#include "RiaApplication.h"
#include "RiaDefines.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cvfObject.h"
#include <QApplication>
#include <QMutex>
#include <QPointer>
@ -127,7 +122,6 @@ public:
// Public RiaApplication overrides
void initialize() override;
ApplicationStatus handleArguments( gsl::not_null<cvf::ProgramOptions*> progOpt ) override;
int launchUnitTestsWithConsole() override;
void addToRecentFiles( const QString& fileName ) override;
void showFormattedTextInMessageBoxOrConsole( const QString& errMsg ) override;

View File

@ -17,6 +17,7 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RiaMemoryCleanup.h"
#include "RiaStdStringTools.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseResultInfo.h"
@ -34,6 +35,10 @@
#include "cafPdmUiPushButtonEditor.h"
#include "cafPdmUiTreeSelectionEditor.h"
#include <QDialog>
#include <QTextEdit>
#include <QVBoxLayout>
//==================================================================================================
///
///
@ -54,7 +59,10 @@ RiaMemoryCleanup::RiaMemoryCleanup()
m_resultsToDelete.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() );
CAF_PDM_InitFieldNoDefault( &m_performDelete, "ClearSelectedData", "" );
caf::PdmUiPushButtonEditor::configureEditorForField( &m_performDelete );
caf::PdmUiPushButtonEditor::configureEditorLabelLeft( &m_performDelete );
CAF_PDM_InitFieldNoDefault( &m_showMemoryReport, "ShowMemoryReport", "" );
caf::PdmUiPushButtonEditor::configureEditorLabelLeft( &m_showMemoryReport );
}
//--------------------------------------------------------------------------------------------------
@ -107,6 +115,38 @@ void RiaMemoryCleanup::clearSelectedResultsFromMemory()
m_geomResultAddresses.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class TextDialog : public QDialog
{
public:
TextDialog( const QString& text, QWidget* parent = nullptr )
: QDialog( parent )
{
auto textWidget = new QTextEdit( "", this );
textWidget->setPlainText( text );
auto layout = new QVBoxLayout( this );
layout->addWidget( textWidget );
setLayout( layout );
}
};
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaMemoryCleanup::showMemoryReport()
{
auto [summary, details] = createMemoryReport();
QString allText = summary + "\n\n" + details;
auto dialog = new TextDialog( allText );
dialog->setWindowTitle( "Memory Report" );
dialog->setMinimumSize( 800, 600 );
dialog->show();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -204,6 +244,12 @@ void RiaMemoryCleanup::fieldChangedByUi( const caf::PdmFieldHandle* changedField
m_resultsToDelete.uiCapability()->updateConnectedEditors();
m_performDelete = false;
}
else if ( changedField == &m_showMemoryReport )
{
m_showMemoryReport = false;
showMemoryReport();
}
}
//--------------------------------------------------------------------------------------------------
@ -310,10 +356,72 @@ void RiaMemoryCleanup::defineEditorAttribute( const caf::PdmFieldHandle* field,
{
if ( field == &m_performDelete )
{
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute );
auto attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute );
if ( attrib )
{
attrib->m_buttonText = "Clear Checked Data From Memory";
}
}
if ( field == &m_showMemoryReport )
{
auto attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute );
if ( attrib )
{
attrib->m_buttonText = "Show Memory Report";
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::pair<QString, QString> RiaMemoryCleanup::createMemoryReport()
{
QString details;
auto allCases = RimProject::current()->allGridCases();
size_t totalMemory = 0;
for ( auto gridCase : allCases )
{
if ( auto eclipseCase = dynamic_cast<RimEclipseCase*>( gridCase ) )
{
RigCaseCellResultsData* caseData = eclipseCase->results( RiaDefines::PorosityModelType::MATRIX_MODEL );
if ( caseData )
{
size_t totalMemoryForCase = 0;
QString caseReport;
auto memoryUse = caseData->resultValueCount();
for ( const auto& [name, valueCount] : memoryUse )
{
if ( valueCount > 0 )
{
size_t memory = valueCount * sizeof( double );
totalMemoryForCase += memory;
auto formattedValueCount = RiaStdStringTools::formatThousandGrouping( valueCount );
caseReport += QString( " %1 MB\tValue count %2, %3\n" )
.arg( memory / 1024.0 / 1024.0, 0, 'f', 2 )
.arg( QString::fromStdString( formattedValueCount ) )
.arg( QString::fromStdString( name ) );
}
}
totalMemory += totalMemoryForCase;
if ( totalMemoryForCase > 0 )
{
details +=
QString( "%1 - %2 MB\n" ).arg( eclipseCase->caseUserDescription() ).arg( totalMemoryForCase / 1024.0 / 1024.0, 0, 'f', 2 );
details += caseReport;
}
}
}
}
QString summary = QString( "Total memory used: %1 MB\n\n" ).arg( totalMemory / 1024.0 / 1024.0, 0, 'f', 2 );
return std::make_pair( summary, details );
}

View File

@ -39,6 +39,8 @@ public:
void setPropertiesFromView( Rim3dView* view );
void clearSelectedResultsFromMemory();
static void showMemoryReport();
protected:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
@ -52,10 +54,13 @@ private:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
static std::pair<QString, QString> createMemoryReport();
private:
caf::PdmPtrField<RimCase*> m_case;
caf::PdmField<std::vector<size_t>> m_resultsToDelete;
std::vector<RigFemResultAddress> m_geomResultAddresses;
std::vector<RigEclipseResultAddress> m_eclipseResultAddresses;
caf::PdmField<bool> m_performDelete;
caf::PdmField<bool> m_showMemoryReport;
};

View File

@ -169,6 +169,14 @@ QString RiaDefines::namingVariableWaterDepth()
return "$WATER_DEPTH";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaDefines::selectionTextNone()
{
return "None";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -93,6 +93,8 @@ QString namingVariableTimestep();
QString namingVariableAirGap();
QString namingVariableWaterDepth();
QString selectionTextNone();
double minimumDefaultValuePlot();
double minimumDefaultLogValuePlot();
double maximumDefaultValuePlot();

View File

@ -34,12 +34,14 @@
#include "cafPdmFieldCvfColor.h"
#include "cafPdmSettings.h"
#include "cafPdmUiCheckBoxAndTextEditor.h"
#include "cafPdmUiCheckBoxEditor.h"
#include "cafPdmUiComboBoxEditor.h"
#include "cafPdmUiFieldHandle.h"
#include "cafPdmUiFilePathEditor.h"
#include "cafPdmUiLineEditor.h"
#include <QCoreApplication>
#include <QDate>
#include <QDir>
#include <QLocale>
@ -125,6 +127,19 @@ RiaPreferences::RiaPreferences()
m_pythonExecutable.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
CAF_PDM_InitField( &showPythonDebugInfo, "pythonDebugInfo", false, "Show Python Debug Info" );
auto defaultFilename = QStandardPaths::writableLocation( QStandardPaths::DocumentsLocation );
if ( defaultFilename.isEmpty() )
{
defaultFilename = QStandardPaths::writableLocation( QStandardPaths::HomeLocation );
}
defaultFilename += "/ResInsight.log";
CAF_PDM_InitField( &m_loggerFilename, "loggerFilename", std::make_pair( false, defaultFilename ), "Logging To File" );
m_loggerFilename.uiCapability()->setUiEditorTypeName( caf::PdmUiCheckBoxAndTextEditor::uiEditorTypeName() );
CAF_PDM_InitField( &m_loggerFlushInterval, "loggerFlushInterval", 500, "Logging Flush Interval [ms]" );
CAF_PDM_InitField( &m_loggerTrapSignalAndFlush, "loggerTrapSignalAndFlush", false, "Trap SIGNAL and Flush File Logs" );
CAF_PDM_InitField( &ssihubAddress, "ssihubAddress", QString( "http://" ), "SSIHUB Address" );
ssihubAddress.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
@ -461,6 +476,13 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
caf::PdmUiGroup* otherGroup = uiOrdering.addNewGroup( "Other" );
otherGroup->add( &m_gridCalculationExpressionFolder );
otherGroup->add( &m_summaryCalculationExpressionFolder );
caf::PdmUiGroup* loggingGroup = uiOrdering.addNewGroup( "Logging" );
loggingGroup->add( &m_loggerFilename );
loggingGroup->add( &m_loggerFlushInterval );
loggingGroup->add( &m_loggerTrapSignalAndFlush );
m_loggerTrapSignalAndFlush.uiCapability()->setUiReadOnly( !m_loggerFilename().first );
m_loggerFlushInterval.uiCapability()->setUiReadOnly( !m_loggerFilename().first );
}
else if ( RiaApplication::enableDevelopmentFeatures() && uiConfigName == RiaPreferences::tabNameSystem() )
{
@ -932,6 +954,35 @@ QString RiaPreferences::octaveExecutable() const
return m_octaveExecutable().trimmed();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaPreferences::loggerFilename() const
{
if ( m_loggerFilename().first )
{
return m_loggerFilename().second;
}
return {};
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RiaPreferences::loggerFlushInterval() const
{
return m_loggerFlushInterval();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaPreferences::loggerTrapSignalAndFlush() const
{
return m_loggerTrapSignalAndFlush();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -117,6 +117,10 @@ public:
QString pythonExecutable() const;
QString octaveExecutable() const;
QString loggerFilename() const;
int loggerFlushInterval() const;
bool loggerTrapSignalAndFlush() const;
RiaPreferencesGeoMech* geoMechPreferences() const;
RiaPreferencesSummary* summaryPreferences() const;
RiaPreferencesSystem* systemPreferences() const;
@ -203,6 +207,11 @@ private:
caf::PdmField<QString> m_octaveExecutable;
caf::PdmField<QString> m_pythonExecutable;
// Logging
caf::PdmField<std::pair<bool, QString>> m_loggerFilename;
caf::PdmField<int> m_loggerFlushInterval;
caf::PdmField<bool> m_loggerTrapSignalAndFlush;
// Surface Import
caf::PdmField<double> m_surfaceImportResamplingDistance;

View File

@ -121,8 +121,7 @@ RiaPreferencesSummary::RiaPreferencesSummary()
"" );
CAF_PDM_InitField( &m_selectDefaultTemplates, "selectDefaultTemplate", false, "", "", "Select Default Templates" );
m_selectDefaultTemplates.xmlCapability()->disableIO();
m_selectDefaultTemplates.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() );
caf::PdmUiPushButtonEditor::configureEditorLabelHidden( &m_selectDefaultTemplates );
CAF_PDM_InitFieldNoDefault( &m_selectedDefaultTemplates, "defaultSummaryTemplates", "Select Summary Plot Templates" );
m_selectedDefaultTemplates.uiCapability()->setUiReadOnly( true );

View File

@ -443,6 +443,38 @@ QString RiaResultNames::wbsPPResult()
return "PP";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaResultNames::wbsPPMinResult()
{
return "PP_MIN";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaResultNames::wbsPPMaxResult()
{
return "PP_MAX";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaResultNames::wbsPPExpResult()
{
return "PP_EXP";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaResultNames::wbsPPInitialResult()
{
return "PP_INIT";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -459,6 +491,45 @@ QString RiaResultNames::wbsSHMkResult()
return "SH_MK";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaResultNames::wbsSHMkExpResult()
{
return "SH_MK_EXP";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaResultNames::wbsSHMkMinResult()
{
return "SH_MK_MIN";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaResultNames::wbsSHMkMaxResult()
{
return "SH_MK_MAX";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaResultNames::wbsFGMkExpResult()
{
return "FG_MK_EXP";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaResultNames::wbsFGMkMinResult()
{
return "FG_MK_MIN";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -519,5 +590,14 @@ std::vector<QString> RiaResultNames::wbsDerivedResultNames()
wbsSFGResult(),
wbsSHResult(),
wbsSHMkResult(),
wbsSHMkExpResult(),
wbsSHMkMinResult(),
wbsSHMkMaxResult(),
wbsFGMkExpResult(),
wbsFGMkMinResult(),
wbsPPMinResult(),
wbsPPMaxResult(),
wbsPPExpResult(),
wbsPPInitialResult(),
};
}

View File

@ -92,6 +92,15 @@ QString wbsSHMkResult();
QString wbsOBGResult();
QString wbsFGResult();
QString wbsSFGResult();
QString wbsFGMkExpResult();
QString wbsFGMkMinResult();
QString wbsSHMkExpResult();
QString wbsSHMkMinResult();
QString wbsSHMkMaxResult();
QString wbsPPMinResult();
QString wbsPPMaxResult();
QString wbsPPExpResult();
QString wbsPPInitialResult();
// Fault results
QString formationBinaryAllanResultName();

View File

@ -157,3 +157,11 @@ QString RiaDefines::summaryCalculated()
{
return "Calculated";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaDefines::summaryRealizationNumber()
{
return "RI:REALIZATION_NUM";
}

View File

@ -52,4 +52,6 @@ QString summaryLgrWell();
QString summaryLgrBlock();
QString summaryCalculated();
QString summaryRealizationNumber();
}; // namespace RiaDefines

View File

@ -53,6 +53,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RiaOpenMPTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaNumericalTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaRegressionTextTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaFileLogger.h
)
set(SOURCE_GROUP_SOURCE_FILES
@ -103,6 +104,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RiaOpenMPTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaNumericalTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaRegressionTextTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaFileLogger.cpp
)
list(APPEND CODE_SOURCE_FILES ${SOURCE_GROUP_SOURCE_FILES})

View File

@ -130,9 +130,6 @@ bool RiaArgumentParser::parseArguments( cvf::ProgramOptions* progOpt )
progOpt->registerOption( "updateregressiontestbase", "<folder>", "System command", cvf::ProgramOptions::SINGLE_VALUE );
progOpt->registerOption( "regressiontest", "<folder>", "System command", cvf::ProgramOptions::SINGLE_VALUE );
#ifdef USE_UNIT_TESTS
progOpt->registerOption( "unittest", "", "System command" );
#endif
progOpt->registerOption( "generate", "[<outputFile>]", "Generate code or documentation", cvf::ProgramOptions::SINGLE_VALUE );
progOpt->registerOption( "ignoreArgs", "", "System command. Ignore all arguments. Mostly for testing purposes" );
progOpt->registerOption( "version", "", "Display the application version string" );

View File

@ -48,7 +48,7 @@ double RiaEclipseUnitTools::darcysConstant( RiaDefines::EclipseUnitSystem unitSy
//--------------------------------------------------------------------------------------------------
/// Convert Gas to oil equivalents
/// If field unit, the Gas is in Mega ft^3 while the others are in [stb] (barrel)
/// If field unit, the Gas is in Mft^3(=1000ft^3) while the others are in [stb] (barrel)
//--------------------------------------------------------------------------------------------------
double RiaEclipseUnitTools::convertSurfaceGasFlowRateToOilEquivalents( RiaDefines::EclipseUnitSystem caseUnitSystem, double eclGasFlowRate )
{
@ -56,18 +56,24 @@ double RiaEclipseUnitTools::convertSurfaceGasFlowRateToOilEquivalents( RiaDefine
/// we convert gas to stb as well. Based on
/// 1 [stb] = 0.15898729492800007 [m^3]
/// 1 [ft] = 0.3048 [m]
/// megaFt3ToStbFactor = 1.0 / (1.0e-6 * 0.15898729492800007 * ( 1.0 / 0.3048 )^3 )
/// double megaFt3ToStbFactor = 178107.60668;
///
/// NB Mft^3 = 1000 ft^3 - can wrongly be interpreted as M for Mega in metric units
double fieldGasToOilEquivalent = 1.0e6 / 5800; // Mega ft^3 to BOE
double metricGasToOilEquivalent = 1.0 / 1.0e3; // Sm^3 Gas to Sm^3 oe
if ( caseUnitSystem == RiaDefines::EclipseUnitSystem::UNITS_FIELD )
{
const double fieldGasToOilEquivalent = 1000.0 / 5614.63;
double oilEquivalentGasRate = HUGE_VAL;
return fieldGasToOilEquivalent * eclGasFlowRate;
}
if ( caseUnitSystem == RiaDefines::EclipseUnitSystem::UNITS_FIELD ) oilEquivalentGasRate = fieldGasToOilEquivalent * eclGasFlowRate;
if ( caseUnitSystem == RiaDefines::EclipseUnitSystem::UNITS_METRIC ) oilEquivalentGasRate = metricGasToOilEquivalent * eclGasFlowRate;
if ( caseUnitSystem == RiaDefines::EclipseUnitSystem::UNITS_METRIC )
{
double metricGasToOilEquivalent = 1.0 / 1000.0; // Sm^3 Gas to Sm^3 oe
return oilEquivalentGasRate;
return metricGasToOilEquivalent * eclGasFlowRate;
}
return HUGE_VAL;
}
//--------------------------------------------------------------------------------------------------

View File

@ -0,0 +1,168 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiaFileLogger.h"
#include "RiaPreferences.h"
#include "spdlog/logger.h"
#include "spdlog/sinks/basic_file_sink.h"
#include "spdlog/spdlog.h"
class RiaFileLogger::Impl
{
public:
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Impl( const std::string& fileName )
{
try
{
m_spdlogger = spdlog::basic_logger_mt( "basic_logger", fileName );
auto flushInterval = RiaPreferences::current()->loggerFlushInterval();
spdlog::flush_every( std::chrono::milliseconds( flushInterval ) );
}
catch ( ... )
{
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void log( const std::string& message )
{
if ( m_spdlogger ) m_spdlogger->info( message );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void info( const std::string& message )
{
if ( m_spdlogger ) m_spdlogger->info( message );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void debug( const std::string& message )
{
if ( m_spdlogger ) m_spdlogger->debug( message );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void error( const std::string& message )
{
if ( m_spdlogger ) m_spdlogger->error( message );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void warning( const std::string& message )
{
if ( m_spdlogger ) m_spdlogger->warn( message );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void flush()
{
if ( m_spdlogger ) m_spdlogger->flush();
}
private:
std::shared_ptr<spdlog::logger> m_spdlogger;
};
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaFileLogger::RiaFileLogger( const std::string& filename )
: m_impl( new Impl( filename ) )
, m_logLevel( int( RILogLevel::RI_LL_DEBUG ) )
{
}
//--------------------------------------------------------------------------------------------------
/// The destructor must be located in the cpp file after the definition of RiaFileLogger::Impl to make sure the Impl class is defined when
/// the destructor of std::unique_ptr<Impl> is called
//--------------------------------------------------------------------------------------------------
RiaFileLogger::~RiaFileLogger() = default;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RiaFileLogger::level() const
{
return m_logLevel;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaFileLogger::setLevel( int logLevel )
{
m_logLevel = logLevel;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaFileLogger::error( const char* message )
{
m_impl->error( message );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaFileLogger::warning( const char* message )
{
m_impl->warning( message );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaFileLogger::info( const char* message )
{
m_impl->info( message );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaFileLogger::debug( const char* message )
{
m_impl->debug( message );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaFileLogger::flush()
{
if ( m_impl ) m_impl->flush();
}

View File

@ -0,0 +1,47 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2023 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RiaLogging.h"
//==================================================================================================
//
//==================================================================================================
class RiaFileLogger : public RiaLogger
{
public:
explicit RiaFileLogger( const std::string& filename );
~RiaFileLogger() override;
int level() const override;
void setLevel( int logLevel ) override;
void error( const char* message ) override;
void warning( const char* message ) override;
void info( const char* message ) override;
void debug( const char* message ) override;
void flush();
private:
int m_logLevel;
class Impl;
std::unique_ptr<Impl> m_impl;
};

View File

@ -204,9 +204,12 @@ QStringList RiaFilePathTools::splitPathIntoComponents( const QString& inputPath,
{
auto path = QDir::cleanPath( inputPath );
QStringList components;
auto indexOfLastSeparator = path.lastIndexOf( separator() );
auto indexOfDrive = path.indexOf( ':' );
QDir dir( path );
QString pathWithoutDrive = path.mid( indexOfDrive + 1, indexOfLastSeparator - ( indexOfDrive + 1 ) );
QStringList components = RiaTextStringTools::splitSkipEmptyParts( pathWithoutDrive, separator() );
QFileInfo fileInfo( path );
@ -214,18 +217,14 @@ QStringList RiaFilePathTools::splitPathIntoComponents( const QString& inputPath,
{
QString extension = fileInfo.completeSuffix();
path = path.replace( QString( ".%1" ).arg( extension ), "" );
components.push_front( extension );
components.push_front( fileInfo.baseName() );
components.push_back( extension );
components.push_back( fileInfo.baseName() );
}
else
{
components.push_back( fileInfo.fileName() );
}
while ( dir.cdUp() )
{
components.push_front( dir.dirName() );
}
return components;
}
@ -330,16 +329,10 @@ std::map<QString, QStringList> RiaFilePathTools::keyPathComponentsForEachFilePat
{
std::map<QString, QStringList> allComponents;
std::multiset<QString> allPathComponents;
for ( auto fileName : filePaths )
{
QStringList pathComponentsForFile = splitPathIntoComponents( fileName, true );
allComponents[fileName] = pathComponentsForFile;
for ( auto pathComponent : pathComponentsForFile )
{
allPathComponents.insert( pathComponent );
}
}
auto topNode = std::unique_ptr<PathNode>( new PathNode( "", nullptr ) );
@ -376,3 +369,22 @@ bool RiaFilePathTools::isFirstOlderThanSecond( const std::string& firstFileName,
return ( timeFirstFile < timeSecondFile );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::string RiaFilePathTools::makeSuitableAsFileName( const std::string candidateName )
{
if ( candidateName.empty() ) return "noname";
QString tmp = QString::fromStdString( candidateName );
tmp.replace( ' ', '_' );
tmp.replace( '/', '_' );
tmp.replace( '\\', '_' );
tmp.replace( ':', '_' );
tmp.replace( '&', '_' );
tmp.replace( '|', '_' );
return tmp.toStdString();
}

View File

@ -44,6 +44,7 @@ public:
static QString removeDuplicatePathSeparators( const QString& path );
static QString rootSearchPathFromSearchFilter( const QString& searchFilter );
static QString commonRootOfFileNames( const QStringList& filePaths );
static std::string makeSuitableAsFileName( const std::string candidateName );
static QStringList splitPathIntoComponents( const QString& path, bool splitExtensionIntoSeparateEntry = false );

View File

@ -40,6 +40,7 @@
#include "RimEclipseInputCase.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseView.h"
#include "RimEmCase.h"
#include "RimFileSummaryCase.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimMainPlotCollection.h"
@ -357,6 +358,8 @@ int RiaImportEclipseCaseTools::openEclipseCaseShowTimeStepFilterImpl( const QStr
return -1;
}
RimMainPlotCollection::current()->ensureDefaultFlowPlotsAreCreated();
if ( createView )
{
RimEclipseView* riv = rimResultReservoir->createAndAddReservoirView();
@ -588,3 +591,56 @@ RimRoffCase* RiaImportEclipseCaseTools::openRoffCaseFromFileName( const QString&
return roffCase;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaImportEclipseCaseTools::openEmFilesFromFileNames( const QStringList& fileNames, bool createDefaultView, std::vector<int>& createdCaseIds )
{
if ( fileNames.empty() ) return false;
RimProject* project = RimProject::current();
if ( !project ) return false;
RimEclipseCaseCollection* analysisModels = project->activeOilField() ? project->activeOilField()->analysisModels() : nullptr;
if ( !analysisModels ) return false;
for ( auto fileName : fileNames )
{
auto* emCase = new RimEmCase();
project->assignCaseIdToCase( emCase );
emCase->setGridFileName( fileName );
bool gridImportSuccess = emCase->openEclipseGridFile();
if ( !gridImportSuccess )
{
const auto errMsg = "Failed to import grid from file: " + fileName.toStdString();
RiaLogging::error( errMsg.c_str() );
delete emCase;
continue;
}
analysisModels->cases.push_back( emCase );
analysisModels->updateConnectedEditors();
RimEclipseView* eclipseView = nullptr;
if ( createDefaultView )
{
eclipseView = emCase->createAndAddReservoirView();
eclipseView->cellResult()->setResultType( RiaDefines::ResultCatType::INPUT_PROPERTY );
eclipseView->loadDataAndUpdate();
emCase->updateAllRequiredEditors();
if ( RiaGuiApplication::isRunning() )
{
if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->selectAsCurrentItem( eclipseView->cellResult() );
// Make sure the call to setExpanded is done after the call to selectAsCurrentItem
Riu3DMainWindowTools::setExpanded( eclipseView );
}
}
}
return true;
}

View File

@ -59,6 +59,8 @@ public:
static std::vector<int> openRoffCasesFromFileNames( const QStringList& fileNames, bool createDefaultView );
static RimRoffCase* openRoffCaseFromFileName( const QString& fileName, bool createDefaultView );
static bool openEmFilesFromFileNames( const QStringList& fileNames, bool createDefaultView, std::vector<int>& createdCaseIds );
private:
static int openEclipseCaseShowTimeStepFilterImpl( const QString& fileName,
bool showTimeStepFilter,

View File

@ -169,22 +169,28 @@ void RiaDefaultConsoleLogger::writeToConsole( const std::string& str )
//
//==================================================================================================
std::unique_ptr<RiaLogger> RiaLogging::sm_logger = std::make_unique<RiaDefaultConsoleLogger>();
std::vector<std::unique_ptr<RiaLogger>> RiaLogging::sm_logger;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaLogger* RiaLogging::loggerInstance()
std::vector<RiaLogger*> RiaLogging::loggerInstances()
{
return sm_logger.get();
std::vector<RiaLogger*> loggerInstances;
for ( auto& logger : sm_logger )
{
loggerInstances.push_back( logger.get() );
}
return loggerInstances;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaLogging::setLoggerInstance( std::unique_ptr<RiaLogger> loggerInstance )
void RiaLogging::appendLoggerInstance( std::unique_ptr<RiaLogger> loggerInstance )
{
sm_logger = std::move( loggerInstance );
sm_logger.push_back( std::move( loggerInstance ) );
}
//--------------------------------------------------------------------------------------------------
@ -202,10 +208,13 @@ RILogLevel RiaLogging::logLevelBasedOnPreferences()
//--------------------------------------------------------------------------------------------------
void RiaLogging::error( const QString& message )
{
if ( sm_logger && sm_logger->level() >= int( RILogLevel::RI_LL_ERROR ) )
for ( const auto& logger : sm_logger )
{
if ( logger && logger->level() >= int( RILogLevel::RI_LL_ERROR ) )
{
#pragma omp critical( critical_section_logging )
sm_logger->error( message.toLatin1().constData() );
logger->error( message.toLatin1().constData() );
}
}
}
@ -214,10 +223,13 @@ void RiaLogging::error( const QString& message )
//--------------------------------------------------------------------------------------------------
void RiaLogging::warning( const QString& message )
{
if ( sm_logger && sm_logger->level() >= int( RILogLevel::RI_LL_WARNING ) )
for ( const auto& logger : sm_logger )
{
if ( logger && logger->level() >= int( RILogLevel::RI_LL_WARNING ) )
{
#pragma omp critical( critical_section_logging )
sm_logger->warning( message.toLatin1().constData() );
logger->warning( message.toLatin1().constData() );
}
}
}
@ -226,10 +238,13 @@ void RiaLogging::warning( const QString& message )
//--------------------------------------------------------------------------------------------------
void RiaLogging::info( const QString& message )
{
if ( sm_logger && sm_logger->level() >= int( RILogLevel::RI_LL_INFO ) )
for ( const auto& logger : sm_logger )
{
if ( logger && logger->level() >= int( RILogLevel::RI_LL_INFO ) )
{
#pragma omp critical( critical_section_logging )
sm_logger->info( message.toLatin1().constData() );
logger->info( message.toLatin1().constData() );
}
}
}
@ -238,10 +253,13 @@ void RiaLogging::info( const QString& message )
//--------------------------------------------------------------------------------------------------
void RiaLogging::debug( const QString& message )
{
if ( sm_logger && sm_logger->level() >= int( RILogLevel::RI_LL_DEBUG ) )
for ( const auto& logger : sm_logger )
{
if ( logger && logger->level() >= int( RILogLevel::RI_LL_DEBUG ) )
{
#pragma omp critical( critical_section_logging )
sm_logger->debug( message.toLatin1().constData() );
logger->debug( message.toLatin1().constData() );
}
}
}

View File

@ -60,8 +60,8 @@ public:
class RiaLogging
{
public:
static RiaLogger* loggerInstance();
static void setLoggerInstance( std::unique_ptr<RiaLogger> loggerInstance );
static std::vector<RiaLogger*> loggerInstances();
static void appendLoggerInstance( std::unique_ptr<RiaLogger> loggerInstance );
static RILogLevel logLevelBasedOnPreferences();
@ -73,7 +73,7 @@ public:
static void errorInMessageBox( QWidget* parent, const QString& title, const QString& text );
private:
static std::unique_ptr<RiaLogger> sm_logger;
static std::vector<std::unique_ptr<RiaLogger>> sm_logger;
};
//==================================================================================================

View File

@ -17,12 +17,15 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RiaStdStringTools.h"
#include "RiaLogging.h"
#include "fast_float/include/fast_float/fast_float.h"
#include <cctype>
#include <QString>
#include <charconv>
#include <regex>
#include <sstream>
const std::string WHITESPACE = " \n\r\t\f\v";
@ -138,6 +141,26 @@ bool RiaStdStringTools::startsWithAlphabetic( const std::string& s )
return isalpha( s[0] ) != 0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::string RiaStdStringTools::formatThousandGrouping( long value )
{
class my_punct : public std::numpunct<char>
{
protected:
char do_decimal_point() const override { return '.'; }
char do_thousands_sep() const override { return ' '; }
std::string do_grouping() const override { return std::string( "\3" ); }
};
std::ostringstream os;
os.imbue( std::locale( os.getloc(), new my_punct ) );
fixed( os );
os << value;
return os.str();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -281,3 +304,118 @@ std::string RiaStdStringTools::removeHtmlTags( const std::string& s )
return result;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<int> RiaStdStringTools::valuesFromRangeSelection( const std::string& s )
{
try
{
std::set<int> result;
std::istringstream stringStream( s );
std::string token;
while ( std::getline( stringStream, token, ',' ) )
{
token = RiaStdStringTools::trimString( token );
std::istringstream tokenStream( token );
int startIndex, endIndex;
char dash;
if ( tokenStream >> startIndex )
{
if ( tokenStream >> dash && dash == '-' && tokenStream >> endIndex )
{
if ( startIndex > endIndex )
{
// If start is greater than end, swap them
std::swap( startIndex, endIndex );
}
for ( int i = startIndex; i <= endIndex; ++i )
{
result.insert( i );
}
}
else
{
result.insert( startIndex );
}
}
}
return result;
}
catch ( const std::exception& e )
{
QString str = QString( "Failed to convert text string \" %1 \" to list of integers : " ).arg( QString::fromStdString( s ) ) +
QString::fromStdString( e.what() );
RiaLogging::error( str );
}
catch ( ... )
{
QString str =
QString( "Failed to convert text string \" %1 \" to list of integers : Caught unknown exception" ).arg( QString::fromStdString( s ) );
RiaLogging::error( str );
}
return {};
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<int> RiaStdStringTools::valuesFromRangeSelection( const std::string& s, int minVal, int maxVal )
{
try
{
std::set<int> result;
std::stringstream stringStream( s );
std::string token;
while ( std::getline( stringStream, token, ',' ) )
{
token = RiaStdStringTools::trimString( token );
// Check for range
size_t dashPos = token.find( '-' );
if ( dashPos != std::string::npos )
{
int startIndex = ( dashPos == 0 ) ? minVal : std::stoi( token.substr( 0, dashPos ) );
int endIndex = ( dashPos == token.size() - 1 ) ? maxVal : std::stoi( token.substr( dashPos + 1 ) );
if ( startIndex > endIndex )
{
// If start is greater than end, swap them
std::swap( startIndex, endIndex );
}
for ( int i = startIndex; i <= endIndex; ++i )
{
result.insert( i );
}
}
else
{
// Check for individual numbers
result.insert( std::stoi( token ) );
}
}
return result;
}
catch ( const std::exception& e )
{
QString str = QString( "Failed to convert text string \" %1 \" to list of integers : " ).arg( QString::fromStdString( s ) ) +
QString::fromStdString( e.what() );
RiaLogging::error( str );
}
catch ( ... )
{
QString str =
QString( "Failed to convert text string \" %1 \" to list of integers : Caught unknown exception" ).arg( QString::fromStdString( s ) );
RiaLogging::error( str );
}
return {};
}

View File

@ -21,6 +21,7 @@
#include <algorithm>
#include <iterator>
#include <numeric>
#include <set>
#include <string>
#include <vector>
@ -43,6 +44,8 @@ public:
static bool containsAlphabetic( const std::string& s );
static bool startsWithAlphabetic( const std::string& s );
static std::string formatThousandGrouping( long value );
// Conversion using fastest known approach
static bool toDouble( const std::string_view& s, double& value );
static bool toInt( const std::string_view& s, int& value );
@ -58,6 +61,13 @@ public:
static std::string removeHtmlTags( const std::string& s );
// Convert the string "1,2,5-8,10" to {1, 2, 5, 6, 7, 8, 10}
static std::set<int> valuesFromRangeSelection( const std::string& s );
// Convert the range string with support for open ended expressions. minimum and maximum value will be used to limit the ranges.
// The input "-3,5-8,10-", min:1, max:12 will produce {1, 2, 3, 5, 6, 7, 8, 10, 11, 12}
static std::set<int> valuesFromRangeSelection( const std::string& s, int minimumValue, int maximumValue );
private:
template <class Container>
static void splitByDelimiter( const std::string& str, Container& cont, char delimiter = ' ' );

View File

@ -215,7 +215,7 @@ void RiaSummaryTools::getSummaryCasesAndAddressesForCalculation( int
for ( RimUserDefinedCalculationVariable* v : calculation->allVariables() )
{
RimSummaryCalculationVariable* scv = dynamic_cast<RimSummaryCalculationVariable*>( v );
auto* scv = dynamic_cast<RimSummaryCalculationVariable*>( v );
if ( scv )
{
cases.push_back( scv->summaryCase() );
@ -328,3 +328,68 @@ void RiaSummaryTools::copyCurveAxisData( RimSummaryCurve& curve, const RimSummar
curve.setLeftOrRightAxisY( otherCurve.axisY() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaSummaryTools::updateRequiredCalculatedCurves( RimSummaryCase* sourceSummaryCase )
{
RimSummaryCalculationCollection* calcColl = RimProject::current()->calculationCollection();
for ( RimUserDefinedCalculation* summaryCalculation : calcColl->calculations() )
{
bool needsUpdate = RiaSummaryTools::isCalculationRequired( summaryCalculation, sourceSummaryCase );
if ( needsUpdate )
{
summaryCalculation->parseExpression();
summaryCalculation->calculate();
summaryCalculation->updateDependentObjects();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaSummaryTools::isCalculationRequired( const RimUserDefinedCalculation* summaryCalculation, const RimSummaryCase* summaryCase )
{
std::vector<RimUserDefinedCalculationVariable*> variables = summaryCalculation->allVariables();
for ( RimUserDefinedCalculationVariable* variable : variables )
{
if ( auto* summaryVariable = dynamic_cast<RimSummaryCalculationVariable*>( variable ) )
{
return summaryVariable->summaryCase() == summaryCase;
}
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaSummaryTools::reloadSummaryCase( RimSummaryCase* summaryCase )
{
if ( !summaryCase ) return;
summaryCase->updateAutoShortName();
summaryCase->createSummaryReaderInterface();
summaryCase->createRftReaderInterface();
summaryCase->refreshMetaData();
RiaSummaryTools::updateRequiredCalculatedCurves( summaryCase );
RimSummaryMultiPlotCollection* summaryPlotColl = RiaSummaryTools::summaryMultiPlotCollection();
for ( RimSummaryMultiPlot* multiPlot : summaryPlotColl->multiPlots() )
{
for ( RimSummaryPlot* summaryPlot : multiPlot->summaryPlots() )
{
summaryPlot->loadDataAndUpdate();
// Consider to make the zoom optional
summaryPlot->zoomAll();
}
multiPlot->updatePlotTitles();
}
}

View File

@ -25,6 +25,7 @@
#include <vector>
class RifEclipseSummaryAddress;
class RimSummaryPlot;
class RimSummaryMultiPlot;
class RimSummaryMultiPlotCollection;
@ -35,8 +36,7 @@ class RimSummaryTable;
class RimSummaryTableCollection;
class RimObservedDataCollection;
class RimSummaryCurve;
class RifEclipseSummaryAddress;
class RimUserDefinedCalculation;
class QStringList;
@ -85,4 +85,10 @@ public:
static void copyCurveDataSources( RimSummaryCurve& curve, const RimSummaryCurve& otherCurve );
static void copyCurveAxisData( RimSummaryCurve& curve, const RimSummaryCurve& otherCurve );
static void reloadSummaryCase( RimSummaryCase* summaryCase );
private:
static void updateRequiredCalculatedCurves( RimSummaryCase* sourceSummaryCase );
static bool isCalculationRequired( const RimUserDefinedCalculation* summaryCalculation, const RimSummaryCase* summaryCase );
};

View File

@ -272,8 +272,7 @@ void RiaSCurveCalculator::initializeByFinding_q1q2( cvf::Vec3d p1, double azi1,
SolveStatus solveResultStatus = NOT_SOLVED;
int backstepLevel = 0;
int iteration = 1;
int iteration = 1;
for ( iteration = 1; iteration < maxIterations; ++iteration )
{
if ( fabs( q1Step ) > maxStepSize || fabs( q2Step ) > maxStepSize )
@ -349,18 +348,12 @@ void RiaSCurveCalculator::initializeByFinding_q1q2( cvf::Vec3d p1, double azi1,
// if (isZeroCrossingR2)
q2Step = 0.9 * q2Step * fabs( R2_error ) / ( fabs( R2_error_new ) + fabs( R2_error ) );
++backstepLevel;
#ifdef DEBUG_OUTPUT_ON
std::cout << " Backstep needed. " << std::endl;
#endif
continue;
}
else
{
backstepLevel = 0;
}
}
#ifdef DEBUG_OUTPUT_ON

View File

@ -90,23 +90,6 @@ find_package(Eigen3 REQUIRED)
# Defining all the source (and header) files
# ##############################################################################
# Use all h files in the subdirectories to make them available in the project
file(GLOB_RECURSE HEADER_FILES *.h)
set(SOCKET_INTERFACE_FILES
SocketInterface/RiaSocketServer.cpp
SocketInterface/RiaProjectInfoCommands.cpp
SocketInterface/RiaCaseInfoCommands.cpp
SocketInterface/RiaGeometryCommands.cpp
SocketInterface/RiaNNCCommands.cpp
SocketInterface/RiaPropertyDataCommands.cpp
SocketInterface/RiaWellDataCommands.cpp
SocketInterface/RiaSocketTools.cpp
SocketInterface/RiaSocketDataTransfer.cpp
)
list(APPEND CPP_SOURCES ${SOCKET_INTERFACE_FILES} ${UNIT_TEST_FILES})
list(
APPEND
REFERENCED_CMAKE_FILES
@ -140,6 +123,7 @@ list(
ProjectDataModel/Intersections/CMakeLists_files.cmake
ProjectDataModel/CellFilters/CMakeLists_files.cmake
ProjectDataModel/ProcessControl/CMakeLists_files.cmake
ProjectDataModel/Polygons/CMakeLists_files.cmake
ProjectDataModel/WellLog/CMakeLists_files.cmake
ProjectDataModel/WellMeasurement/CMakeLists_files.cmake
ProjectDataModel/WellPath/CMakeLists_files.cmake
@ -159,23 +143,9 @@ list(
UserInterface/AnalysisPlots/CMakeLists_files.cmake
CommandFileInterface/CMakeLists_files.cmake
CommandFileInterface/Core/CMakeLists_files.cmake
SocketInterface/CMakeLists_files.cmake
)
option(RESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS
"Include ApplicationCode Unit Tests" OFF
)
mark_as_advanced(FORCE RESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS)
if(RESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS)
add_definitions(-DUSE_UNIT_TESTS)
list(APPEND REFERENCED_CMAKE_FILES UnitTests/CMakeLists_files.cmake)
list(APPEND CPP_SOURCES
${ResInsight_SOURCE_DIR}/ThirdParty/gtest/gtest-all.cc
)
endif()
# Include source file lists from *.cmake files
foreach(referencedfile ${REFERENCED_CMAKE_FILES})
include(${referencedfile})
@ -235,14 +205,11 @@ if(RESINSIGHT_FOUND_HDF5)
list(APPEND CPP_SOURCES ${HDF5_FILES})
add_definitions(-DUSE_HDF5)
add_definitions(-DH5_BUILT_AS_DYNAMIC_LIB)
if(MSVC)
add_definitions(-DH5_BUILT_AS_DYNAMIC_LIB)
list(APPEND RI_PRIVATE_INCLUDES ${RESINSIGHT_HDF5_DIR}/include)
else()
add_definitions(-DH5_BUILT_AS_DYNAMIC_LIB)
add_definitions(${HDF5_DEFINITIONS})
list(APPEND RI_PRIVATE_INCLUDES ${HDF5_INCLUDE_DIRS})
endif() # MSVC
@ -267,21 +234,9 @@ qt5_wrap_ui(FORM_FILES_CPP ${QT_UI_FILES})
# Create source groups - see also included CMakeLists_files.cmake
# ##############################################################################
source_group("ModelVisualization" FILES ${MODEL_VISUALIZATION_FILES})
source_group("SocketInterface" FILES ${SOCKET_INTERFACE_FILES})
source_group("UnitTests" FILES ${UNIT_TEST_FILES})
list(
APPEND
ALL_SOURCE_FILES
${CPP_SOURCES}
${MOC_SOURCE_FILES}
${FORM_FILES_CPP}
${HEADER_FILES}
${REFERENCED_CMAKE_FILES}
../ResInsightVersion.cmake
.clang-format
.clang-tidy
Adm/RiaVersionInfo.h.cmake
list(APPEND ALL_SOURCE_FILES ${CPP_SOURCES} ${MOC_SOURCE_FILES}
${FORM_FILES_CPP}
)
add_library(${PROJECT_NAME} OBJECT ${ALL_SOURCE_FILES})
@ -291,11 +246,6 @@ mark_as_advanced(FORCE RESINSIGHT_ENABLE_PRECOMPILED_HEADERS)
if(RESINSIGHT_ENABLE_PRECOMPILED_HEADERS)
message("Precompiled Headers is enabled on : ${PROJECT_NAME}")
target_precompile_headers(ApplicationLibCode PRIVATE pch.h)
set_source_files_properties(
${ResInsight_SOURCE_DIR}/ThirdParty/gtest/gtest-all.cc
PROPERTIES SKIP_PRECOMPILE_HEADERS ON
)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
@ -382,16 +332,14 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
endif()
target_link_libraries(
${PROJECT_NAME} ${LINK_LIBRARIES} ${EXTERNAL_LINK_LIBRARIES}
${PROJECT_NAME} PUBLIC ${LINK_LIBRARIES} ${EXTERNAL_LINK_LIBRARIES}
)
target_include_directories(
${PROJECT_NAME}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Commands
${CMAKE_CURRENT_SOURCE_DIR}/Commands/EclipseCommands
${CMAKE_CURRENT_SOURCE_DIR}/ResultStatisticsCache
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModelCommands/CommandRouter
${CMAKE_CURRENT_SOURCE_DIR}/UserInterface/AnalysisPlots
${RI_PRIVATE_INCLUDES}
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/Adm
@ -437,10 +385,13 @@ target_include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/ReservoirDataModel/Completions
${CMAKE_CURRENT_SOURCE_DIR}/ReservoirDataModel/ResultAccessors
${CMAKE_CURRENT_SOURCE_DIR}/ReservoirDataModel/ResultCalculators
${CMAKE_CURRENT_SOURCE_DIR}/ResultStatisticsCache
${CMAKE_CURRENT_SOURCE_DIR}/SocketInterface
${CMAKE_CURRENT_SOURCE_DIR}/UserInterface
${CMAKE_CURRENT_SOURCE_DIR}/UserInterface/AnalysisPlots
${CMAKE_CURRENT_SOURCE_DIR}/GeoMech/GeoMechDataModel
${CMAKE_CURRENT_SOURCE_DIR}/GeoMech/GeoMechVisualization
${CMAKE_CURRENT_SOURCE_DIR}/GeoMech/GeoMechFileInterface
${CMAKE_CURRENT_SOURCE_DIR}/GeoMech/OdbReader
${CMAKE_CURRENT_SOURCE_DIR}/Measurement
${ResInsight_SOURCE_DIR}/ThirdParty
@ -471,3 +422,16 @@ if(RESINSIGHT_ENABLE_UNITY_BUILD)
)
endforeach(fileToExclude)
endif()
# ##############################################################################
# Unit tests
# ##############################################################################
option(RESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS
"Include ApplicationLibCode Unit Tests" OFF
)
mark_as_advanced(FORCE RESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS)
if(RESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS)
enable_testing()
add_subdirectory(UnitTests)
endif()

View File

@ -1,5 +1,4 @@
set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicLaunchUnitTestsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicShowPlotWindowFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicShowMainWindowFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicTileWindowsFeature.h
@ -20,10 +19,10 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicShowClassNamesFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicShowPlotDataCtxFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicOpenInTextEditorFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicShowMemoryReportFeature.h
)
set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicLaunchUnitTestsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicShowPlotWindowFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicShowMainWindowFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicTileWindowsFeature.cpp
@ -44,6 +43,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicShowClassNamesFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicShowPlotDataCtxFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicOpenInTextEditorFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicShowMemoryReportFeature.cpp
)
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})

View File

@ -1,7 +1,6 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
// 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
@ -17,28 +16,26 @@
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicLaunchUnitTestsFeature.h"
#include "RicShowMemoryReportFeature.h"
#include "RiaApplication.h"
#include "RiaMemoryCleanup.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicLaunchUnitTestsFeature, "RicLaunchUnitTestsFeature" );
CAF_CMD_SOURCE_INIT( RicShowMemoryReportFeature, "RicShowMemoryReportFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicLaunchUnitTestsFeature::onActionTriggered( bool isChecked )
void RicShowMemoryReportFeature::onActionTriggered( bool isChecked )
{
disableModelChangeContribution();
RiaApplication::instance()->launchUnitTestsWithConsole();
RiaMemoryCleanup::showMemoryReport();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicLaunchUnitTestsFeature::setupActionLook( QAction* actionToSetup )
void RicShowMemoryReportFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Launch Unit Tests" );
actionToSetup->setText( "Memory Report" );
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicShowMemoryReportFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
private:
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@ -41,6 +41,7 @@ set(COMMAND_REFERENCED_CMAKE_FILES
PlotTemplateCommands/CMakeLists_files.cmake
FractureCommands/CMakeLists_files.cmake
PlotBuilderCommands/CMakeLists_files.cmake
PolygonCommands/CMakeLists_files.cmake
)
# Include source file lists from *.cmake files

View File

@ -93,6 +93,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicImportGridCalculationExpressionsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicExportSummaryCalculationExpressionsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicImportSummaryCalculationExpressionsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicImportWellLogCsvFileFeature.h
)
set(SOURCE_GROUP_SOURCE_FILES
@ -189,6 +190,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicImportGridCalculationExpressionsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicExportSummaryCalculationExpressionsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicImportSummaryCalculationExpressionsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicImportWellLogCsvFileFeature.cpp
)
if(RESINSIGHT_USE_QT_CHARTS)

View File

@ -18,6 +18,8 @@
#include "RicNewPolygonFilter3dviewFeature.h"
#include "Polygons/RimPolygonInView.h"
#include "RiaApplication.h"
#include "RimCase.h"
#include "RimCellFilterCollection.h"
@ -46,7 +48,7 @@ void RicNewPolygonFilter3dviewFeature::onActionTriggered( bool isChecked )
// and the case to use
RimCase* sourceCase = viewOrComparisonView->ownerCase();
RimPolygonFilter* lastCreatedOrUpdated = filtColl->addNewPolygonFilter( sourceCase );
RimPolygonFilter* lastCreatedOrUpdated = filtColl->addNewPolygonFilter( sourceCase, nullptr );
if ( lastCreatedOrUpdated )
{
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );

View File

@ -18,9 +18,16 @@
#include "RicNewPolygonFilterFeature.h"
#include "RiaApplication.h"
#include "Polygons/RimPolygon.h"
#include "Polygons/RimPolygonInView.h"
#include "RimCase.h"
#include "RimCellFilterCollection.h"
#include "RimGridView.h"
#include "RimPolygonFilter.h"
#include "Riu3DMainWindowTools.h"
#include "cafSelectionManagerTools.h"
@ -35,16 +42,31 @@ CAF_CMD_SOURCE_INIT( RicNewPolygonFilterFeature, "RicNewPolygonFilterFeature" );
//--------------------------------------------------------------------------------------------------
void RicNewPolygonFilterFeature::onActionTriggered( bool isChecked )
{
// Find the selected Cell Filter Collection
std::vector<RimCellFilterCollection*> colls = caf::selectedObjectsByTypeStrict<RimCellFilterCollection*>();
if ( colls.empty() ) return;
RimCellFilterCollection* filtColl = colls[0];
auto cellFilterCollection = caf::SelectionManager::instance()->selectedItemOfType<RimCellFilterCollection>();
// and the case to use
RimCase* sourceCase = filtColl->firstAncestorOrThisOfTypeAsserted<RimCase>();
if ( !cellFilterCollection )
{
RimGridView* activeView = RiaApplication::instance()->activeMainOrComparisonGridView();
if ( activeView )
{
cellFilterCollection = activeView->cellFilterCollection();
}
}
RimPolygonFilter* lastCreatedOrUpdated = filtColl->addNewPolygonFilter( sourceCase );
if ( lastCreatedOrUpdated )
if ( !cellFilterCollection ) return;
auto polygon = caf::SelectionManager::instance()->selectedItemOfType<RimPolygon>();
if ( !polygon )
{
if ( auto polygonInView = caf::SelectionManager::instance()->selectedItemOfType<RimPolygonInView>() )
{
polygon = polygonInView->polygon();
}
}
auto sourceCase = cellFilterCollection->firstAncestorOrThisOfTypeAsserted<RimCase>();
if ( auto lastCreatedOrUpdated = cellFilterCollection->addNewPolygonFilter( sourceCase, polygon ) )
{
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
}
@ -56,5 +78,5 @@ void RicNewPolygonFilterFeature::onActionTriggered( bool isChecked )
void RicNewPolygonFilterFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setIcon( QIcon( ":/CellFilter_Polygon.png" ) );
actionToSetup->setText( "New Polygon Filter" );
actionToSetup->setText( "Create Polygon Filter" );
}

View File

@ -34,12 +34,12 @@
#include "RimFractureTemplate.h"
#include "RimObservedEclipseUserData.h"
#include "RimProject.h"
#include "RimReloadCaseTools.h"
#include "RimSimWellFracture.h"
#include "RimSimWellFractureCollection.h"
#include "RimSimWellInView.h"
#include "RimStimPlanFractureTemplate.h"
#include "RimSummaryCase.h"
#include "RimSummaryCaseMainCollection.h"
#include "RimWellPath.h"
#include "RimWellPathCompletions.h"
#include "RimWellPathFracture.h"
@ -449,31 +449,27 @@ void RicExportFractureCompletionsImpl::getWellPressuresAndInitialProductionTimeS
currentDate = caseTimeSteps.back();
}
RifEclipseSummaryAddress wbhpPressureAddress = RifEclipseSummaryAddress::wellAddress( "WBHP", wellPathName.toStdString() );
RimSummaryCaseMainCollection* mainCollection = RiaSummaryTools::summaryCaseMainCollection();
if ( mainCollection )
{
RimSummaryCase* summaryCase = mainCollection->findSummaryCaseFromEclipseResultCase( resultCase );
RifEclipseSummaryAddress wbhpPressureAddress = RifEclipseSummaryAddress::wellAddress( "WBHP", wellPathName.toStdString() );
if ( summaryCase && summaryCase->summaryReader() )
auto summaryCase = RimReloadCaseTools::findSummaryCaseFromEclipseResultCase( resultCase );
if ( summaryCase && summaryCase->summaryReader() )
{
auto [isOk, values] = summaryCase->summaryReader()->values( wbhpPressureAddress );
if ( isOk )
{
auto [isOk, values] = summaryCase->summaryReader()->values( wbhpPressureAddress );
if ( isOk )
std::vector<time_t> summaryTimeSteps = summaryCase->summaryReader()->timeSteps( wbhpPressureAddress );
CVF_ASSERT( values.size() == summaryTimeSteps.size() );
for ( size_t i = 0; i < summaryTimeSteps.size(); ++i )
{
std::vector<time_t> summaryTimeSteps = summaryCase->summaryReader()->timeSteps( wbhpPressureAddress );
CVF_ASSERT( values.size() == summaryTimeSteps.size() );
for ( size_t i = 0; i < summaryTimeSteps.size(); ++i )
QDateTime summaryDate = RiaQDateTimeTools::fromTime_t( summaryTimeSteps[i] );
if ( initialProductionDate.isNull() && values[i] > 0.0 )
{
QDateTime summaryDate = RiaQDateTimeTools::fromTime_t( summaryTimeSteps[i] );
if ( initialProductionDate.isNull() && values[i] > 0.0 )
{
initialProductionDate = summaryDate;
*initialWellPressure = values[i];
}
if ( summaryDate <= currentDate )
{
*currentWellPressure = values[i];
}
initialProductionDate = summaryDate;
*initialWellPressure = values[i];
}
if ( summaryDate <= currentDate )
{
*currentWellPressure = values[i];
}
}
}

View File

@ -91,9 +91,19 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
const std::vector<RimSimWellInView*>& simWells,
const RicExportCompletionDataSettingsUi& exportSettings )
{
if ( exportSettings.caseToApply() == nullptr || exportSettings.caseToApply()->eclipseCaseData() == nullptr )
if ( exportSettings.caseToApply() == nullptr )
{
RiaLogging::error( "Export Completions Data: Cannot export completions data without specified eclipse case" );
RiaLogging::error( "Export Completions Data: Cannot export completions data a valid Eclipse case" );
return;
}
// Ensure that the case is open. This will enable export without any open views.
// https://github.com/OPM/ResInsight/issues/11134
exportSettings.caseToApply()->ensureReservoirCaseIsOpen();
if ( exportSettings.caseToApply()->eclipseCaseData() == nullptr )
{
RiaLogging::error( "Export Completions Data: No data available for Eclipse Case" );
return;
}

View File

@ -6,6 +6,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicNewPolylineIntersectionFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewAzimuthDipIntersectionFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCopyIntersectionsToAllViewsInCaseFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewPolygonIntersectionFeature.h
)
set(SOURCE_GROUP_SOURCE_FILES
@ -16,6 +17,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicNewPolylineIntersectionFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewAzimuthDipIntersectionFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCopyIntersectionsToAllViewsInCaseFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewPolygonIntersectionFeature.cpp
)
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})

View File

@ -0,0 +1,68 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicNewPolygonIntersectionFeature.h"
#include "RiaApplication.h"
#include "RimExtrudedCurveIntersection.h"
#include "RimGridView.h"
#include "RimIntersectionCollection.h"
#include "Polygons/RimPolygon.h"
#include "Polygons/RimPolygonInView.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicNewPolygonIntersectionFeature, "RicNewPolygonIntersectionFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewPolygonIntersectionFeature::onActionTriggered( bool isChecked )
{
RimGridView* activeView = RiaApplication::instance()->activeMainOrComparisonGridView();
if ( !activeView ) return;
auto collection = activeView->intersectionCollection();
if ( !collection ) return;
auto polygon = caf::SelectionManager::instance()->selectedItemOfType<RimPolygon>();
if ( !polygon )
{
if ( auto polygonInView = caf::SelectionManager::instance()->selectedItemOfType<RimPolygonInView>() )
{
polygon = polygonInView->polygon();
}
}
auto intersection = new RimExtrudedCurveIntersection();
intersection->configureForProjectPolyLine( polygon );
collection->appendIntersectionAndUpdate( intersection );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewPolygonIntersectionFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setIcon( QIcon( ":/CrossSection16x16.png" ) );
actionToSetup->setText( "Create Polygon Intersection" );
}

View File

@ -1,7 +1,6 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
// 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
@ -24,7 +23,7 @@
//==================================================================================================
///
//==================================================================================================
class RicLaunchUnitTestsFeature : public caf::CmdFeature
class RicNewPolygonIntersectionFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;

View File

@ -47,6 +47,7 @@
#include "cafUtils.h"
#include <QAction>
#include <QApplication>
#include <QDebug>
#include <QDir>

View File

@ -218,8 +218,7 @@ void RicCellRangeUi::setDefaultValues()
if ( grid == mainGrid && actCellInfo )
{
cvf::Vec3st min, max;
actCellInfo->IJKBoundingBox( min, max );
auto [min, max] = actCellInfo->ijkBoundingBox();
// Adjust to Eclipse indexing
min.x() = min.x() + 1;
@ -273,8 +272,7 @@ void RicCellRangeUi::updateLegendText()
if ( grid == mainGrid && actCellInfo )
{
cvf::Vec3st min, max;
actCellInfo->IJKBoundingBox( min, max );
auto [min, max] = actCellInfo->ijkBoundingBox();
// Adjust to Eclipse indexing
min.x() = min.x() + 1;

View File

@ -33,6 +33,7 @@
#include "RimEclipseCase.h"
#include "RimGeoMechCase.h"
#include "RimMainPlotCollection.h"
#include "RimWellLogFile.h"
#include "RimWellLogLasFile.h"
#include "RimWellLogPlotCollection.h"
#include "RimWellPath.h"
@ -214,14 +215,16 @@ void RicCreateDepthAdjustedLasFilesImpl::createDestinationWellLasFile( const QSt
// Add tvd msl values if existing
if ( !tvdMslValues.empty() )
{
const auto unitText = sourceWellLogData->wellLogChannelUnitString( RiaDefines::propertyNameTvdMslDepth(), deptUnit ).toStdString();
const auto unitText =
sourceWellLogData->convertedWellLogChannelUnitString( RiaDefines::propertyNameTvdMslDepth(), deptUnit ).toStdString();
lasFile.AddLog( RiaDefines::propertyNameTvdMslDepth().toStdString(), unitText, "True vertical depth " + depthUnitComment, tvdMslValues );
}
// Add tvd rkb values if existing
if ( !tvdRkbValues.empty() )
{
const auto unitText = sourceWellLogData->wellLogChannelUnitString( RiaDefines::propertyNameTvdRkbDepth(), deptUnit ).toStdString();
const auto unitText =
sourceWellLogData->convertedWellLogChannelUnitString( RiaDefines::propertyNameTvdRkbDepth(), deptUnit ).toStdString();
lasFile.AddLog( RiaDefines::propertyNameTvdRkbDepth().toStdString(), unitText, "True vertical depth (Rotary Kelly Bushing)", tvdRkbValues );
}

View File

@ -31,7 +31,6 @@
#include "cafPdmUiCheckBoxEditor.h"
#include "cafPdmUiFilePathEditor.h"
#include "cafPdmUiOrdering.h"
#include "cafPdmUiTreeSelectionEditor.h"
CAF_PDM_SOURCE_INIT( RicCreateDepthAdjustedLasFilesUi, "RicCreateDepthAdjustedLasFilesUi" );
@ -140,7 +139,7 @@ void RicCreateDepthAdjustedLasFilesUi::fieldChangedByUi( const caf::PdmFieldHand
wellLogFile = nullptr;
if ( sourceWell != nullptr && !sourceWell->wellLogFiles().empty() )
{
wellLogFile = sourceWell->wellLogFiles()[0];
wellLogFile = dynamic_cast<RimWellLogLasFile*>( sourceWell->wellLogFiles()[0] );
}
}
if ( changedField == &wellLogFile )
@ -188,7 +187,7 @@ void RicCreateDepthAdjustedLasFilesUi::setDefaultValues()
if ( !wellPath->wellLogFiles().empty() )
{
sourceWell = wellPath;
wellLogFile = wellPath->wellLogFiles()[0];
wellLogFile = dynamic_cast<RimWellLogLasFile*>( sourceWell->wellLogFiles()[0] );
break;
}
}

View File

@ -33,7 +33,6 @@
#include "cafPdmUiFilePathEditor.h"
#include "cafPdmUiGroup.h"
#include "cafPdmUiLineEditor.h"
#include "cafPdmUiOrdering.h"
#include "cafPdmUiTreeSelectionEditor.h"
#include <QDir>
@ -516,8 +515,7 @@ void RicExportEclipseSectorModelUi::applyBoundaryDefaults()
{
if ( exportGridBox == ACTIVE_CELLS_BOX )
{
cvf::Vec3st minActive, maxActive;
m_caseData->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL )->IJKBoundingBox( minActive, maxActive );
auto [minActive, maxActive] = m_caseData->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL )->ijkBoundingBox();
setMin( cvf::Vec3i( minActive ) );
setMax( cvf::Vec3i( maxActive ) );
}

View File

@ -48,19 +48,13 @@ void RicExportInpFileFeature::onActionTriggered( bool isChecked )
auto faultReactivationModel = caf::SelectionManager::instance()->selectedItemOfType<RimFaultReactivationModel>();
if ( faultReactivationModel )
{
const QString frmTitle( "Fault Reactivation Modeling" );
if ( !faultReactivationModel->extractAndExportModelData() )
{
QMessageBox::critical( nullptr, frmTitle, "Unable to get necessary data from the input case." );
return;
}
QString exportFile = faultReactivationModel->baseDir() + "/faultreactivation.inp";
auto [isOk, errorMessage] = RifFaultReactivationModelExporter::exportToFile( exportFile.toStdString(), *faultReactivationModel );
auto [isOk, errorMessage] = RifFaultReactivationModelExporter::exportToFile( *faultReactivationModel );
if ( !isOk )
{
QString outErrorText =
QString( "Failed to export INP model to file %1.\n\n%2" ).arg( exportFile ).arg( QString::fromStdString( errorMessage ) );
const QString frmTitle( "Fault Reactivation Modeling" );
QString outErrorText = QString( "Failed to export INP model to file %1.\n\n%2" )
.arg( QString::fromStdString( faultReactivationModel->inputFilename() ) )
.arg( QString::fromStdString( errorMessage ) );
QMessageBox::critical( nullptr, frmTitle, outErrorText );
}
}

View File

@ -20,7 +20,6 @@
#include "cafPdmUiCheckBoxEditor.h"
#include "cafPdmUiFilePathEditor.h"
#include "cafPdmUiOrdering.h"
#include <cmath>

View File

@ -25,7 +25,6 @@
#include "RimProject.h"
#include "cafPdmUiFilePathEditor.h"
#include "cafPdmUiOrdering.h"
CAF_PDM_SOURCE_INIT( RicExportWellPathsUi, "RicExportWellPathsUi" );

View File

@ -22,7 +22,6 @@
#include "RiaPreferences.h"
#include "cafPdmUiFilePathEditor.h"
#include "cafPdmUiOrdering.h"
#include <QDir>

View File

@ -68,14 +68,12 @@ void RicCreateMultipleFracturesFeature::replaceFractures()
//--------------------------------------------------------------------------------------------------
std::pair<cvf::Vec3st, cvf::Vec3st> RicCreateMultipleFracturesFeature::ijkRangeForGrid( RimEclipseCase* gridCase ) const
{
cvf::Vec3st minIJK;
cvf::Vec3st maxIJK;
if ( gridCase && gridCase->eclipseCaseData() )
{
gridCase->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL )->IJKBoundingBox( minIJK, maxIJK );
return std::make_pair( minIJK, maxIJK );
return gridCase->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL )->ijkBoundingBox();
}
return std::make_pair( cvf::Vec3st(), cvf::Vec3st() );
return {};
}
//--------------------------------------------------------------------------------------------------

View File

@ -50,10 +50,15 @@ void RicGeoMechCopyCaseFeature::onActionTriggered( bool isChecked )
RiaApplication* app = RiaApplication::instance();
QString defaultDir = app->lastUsedDialogDirectory( "GEOMECH_MODEL" );
QString filterStr;
#if USE_ODB_API
filterStr += "Abaqus results (*.odb);;";
#endif
filterStr += "Abaqus input file (*.inp)";
for ( RimGeoMechCase* gmc : cases )
{
QString fileName =
RiuFileDialogTools::getOpenFileName( nullptr, "Import Geo-Mechanical Model", defaultDir, "Abaqus results (*.odb)" );
QString fileName = RiuFileDialogTools::getOpenFileName( nullptr, "Import Geo-Mechanical Model", defaultDir, filterStr );
if ( fileName.isEmpty() ) break;
defaultDir = QFileInfo( fileName ).absolutePath();

View File

@ -34,11 +34,14 @@ void RicImportGeoMechCaseFeature::onActionTriggered( bool isChecked )
{
RiaApplication* app = RiaApplication::instance();
QString filterStr;
#if USE_ODB_API
filterStr += "Abaqus results (*.odb);;";
#endif
filterStr += "Abaqus input file (*.inp)";
QString defaultDir = app->lastUsedDialogDirectory( "GEOMECH_MODEL" );
QStringList fileNames = RiuFileDialogTools::getOpenFileNames( nullptr,
"Import Geo-Mechanical Model",
defaultDir,
"Abaqus results (*.odb);;Abaqus input file (*.inp)" );
QStringList fileNames = RiuFileDialogTools::getOpenFileNames( nullptr, "Import Geo-Mechanical Model", defaultDir, filterStr );
if ( !fileNames.empty() ) defaultDir = QFileInfo( fileNames.last() ).absolutePath();
app->setLastUsedDialogDirectory( "GEOMECH_MODEL", defaultDir );

View File

@ -36,9 +36,14 @@ void RicImportGeoMechCaseTimeStepFilterFeature::onActionTriggered( bool isChecke
{
RiaApplication* app = RiaApplication::instance();
QString filterStr;
#if USE_ODB_API
filterStr += "Abaqus results (*.odb);;";
#endif
filterStr += "Abaqus input file (*.inp)";
QString defaultDir = app->lastUsedDialogDirectory( "GEOMECH_MODEL" );
QStringList fileNames =
RiuFileDialogTools::getOpenFileNames( nullptr, "Import Geo-Mechanical Model", defaultDir, "Abaqus results (*.odb)" );
QStringList fileNames = RiuFileDialogTools::getOpenFileNames( nullptr, "Import Geo-Mechanical Model", defaultDir, filterStr );
if ( !fileNames.empty() ) defaultDir = QFileInfo( fileNames.last() ).absolutePath();
for ( QString fileName : fileNames )
{

View File

@ -62,27 +62,13 @@ void RicRunFaultReactModelingFeature::onActionTriggered( bool isChecked )
runProgress.setProgressDescription( "Writing input files." );
auto [modelOk, errorMsg] = model->validateBeforeRun();
if ( !modelOk )
{
QMessageBox::critical( nullptr, frmTitle, QString::fromStdString( errorMsg ) );
return;
}
if ( !model->extractAndExportModelData() )
{
QMessageBox::critical( nullptr, frmTitle, "Unable to get necessary data from the input case." );
return;
}
QString exportFile = model->inputFilename();
auto [result, errText] = RifFaultReactivationModelExporter::exportToFile( exportFile.toStdString(), *model );
auto [result, errText] = RifFaultReactivationModelExporter::exportToFile( *model );
if ( !result )
{
QString outErrorText =
QString( "Failed to export INP model to file %1.\n\n%2" ).arg( exportFile ).arg( QString::fromStdString( errText ) );
QString outErrorText = QString( "Failed to export INP model to file %1.\n\n%2" )
.arg( QString::fromStdString( model->inputFilename() ) )
.arg( QString::fromStdString( errText ) );
QMessageBox::critical( nullptr, frmTitle, outErrorText );
return;
}
@ -121,7 +107,7 @@ void RicRunFaultReactModelingFeature::onActionTriggered( bool isChecked )
for ( auto gCase : RimProject::current()->geoMechCases() )
{
if ( model->outputOdbFilename() == gCase->gridFileName() )
if ( QString::fromStdString( model->outputOdbFilename() ) == gCase->gridFileName() )
{
gCase->reloadDataAndUpdate();
auto& views = gCase->geoMechViews();
@ -138,11 +124,11 @@ void RicRunFaultReactModelingFeature::onActionTriggered( bool isChecked )
}
RiaApplication* app = RiaApplication::instance();
if ( !app->openOdbCaseFromFile( model->outputOdbFilename() ) )
if ( !app->openOdbCaseFromFile( QString::fromStdString( model->outputOdbFilename() ) ) )
{
QMessageBox::critical( nullptr,
frmTitle,
"Failed to load modeling results from file \"" + model->outputOdbFilename() +
"Failed to load modeling results from file \"" + QString::fromStdString( model->outputOdbFilename() ) +
"\". Check log window for additional information." );
}
}

View File

@ -54,15 +54,9 @@ void RicShowFaultReactModelFeature::onActionTriggered( bool isChecked )
if ( model == nullptr ) return;
const QString frmTitle( "Fault Reactivation Modeling" );
const QString exportFile = model->inputFilename();
if ( !model->extractAndExportModelData() )
{
QMessageBox::critical( nullptr, frmTitle, "Unable to get necessary data from the input case." );
return;
}
auto [result, errText] = RifFaultReactivationModelExporter::exportToFile( exportFile.toStdString(), *model );
auto exportFile = QString::fromStdString( model->inputFilename() );
auto [result, errText] = RifFaultReactivationModelExporter::exportToFile( *model );
if ( !result )
{
QString outErrorText =

View File

@ -24,7 +24,6 @@
#include "RicHoloLensServerSettings.h"
#include "cafPdmSettings.h"
#include "cafPdmUiOrdering.h"
#include "cvfAssert.h"

View File

@ -25,7 +25,6 @@
#include "RimProject.h"
#include "cafPdmUiFilePathEditor.h"
#include "cafPdmUiOrdering.h"
CAF_PDM_SOURCE_INIT( RicHoloLensExportToFolderUi, "RicHoloLensExportToFolderUi" );

View File

@ -19,8 +19,6 @@
#include "RicMeasurementPickEventHandler.h"
#include "RiaApplication.h"
#include "RiuViewer.h"
#include "RiuViewerCommands.h"
#include "Rim3dView.h"
#include "RimExtrudedCurveIntersection.h"
@ -28,13 +26,18 @@
#include "RimMeasurement.h"
#include "RimProject.h"
#include "cafDisplayCoordTransform.h"
#include "cafSelectionManager.h"
#include "RiuViewer.h"
#include "RiuViewerCommands.h"
#include "RivPartPriority.h"
#include "cafDisplayCoordTransform.h"
#include "cafSelectionManager.h"
#include "cvfPart.h"
#include <QApplication>
#include <vector>
//--------------------------------------------------------------------------------------------------

View File

@ -33,6 +33,7 @@
#include "cafPdmObjectHandle.h"
#include <QAction>
#include <QApplication>
#include <QClipboard>
#include <QString>

View File

@ -0,0 +1,29 @@
set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicCreatePolygonFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicImportPolygonFileFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicReloadPolygonFileFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicDuplicatePolygonFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicExportPolygonCsvFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicExportPolygonPolFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicSimplifyPolygonFeature.h
)
set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicCreatePolygonFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicImportPolygonFileFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicReloadPolygonFileFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicDuplicatePolygonFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicExportPolygonCsvFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicExportPolygonPolFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicSimplifyPolygonFeature.cpp
)
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
list(APPEND COMMAND_CODE_SOURCE_FILES ${SOURCE_GROUP_SOURCE_FILES})
source_group(
"CommandFeature\\Polygons"
FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES}
${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake
)

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicCreatePolygonFeature.h"
#include "RiaApplication.h"
#include "Polygons/RimPolygon.h"
#include "Polygons/RimPolygonCollection.h"
#include "Polygons/RimPolygonTools.h"
#include "Rim3dView.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "Riu3DMainWindowTools.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicCreatePolygonFeature, "RicCreatePolygonFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreatePolygonFeature::onActionTriggered( bool isChecked )
{
auto proj = RimProject::current();
auto polygonCollection = proj->activeOilField()->polygonCollection();
auto newPolygon = polygonCollection->appendUserDefinedPolygon();
polygonCollection->uiCapability()->updateAllRequiredEditors();
Riu3DMainWindowTools::setExpanded( newPolygon );
auto activeView = RiaApplication::instance()->activeReservoirView();
RimPolygonTools::activate3dEditOfPolygonInView( newPolygon, activeView );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreatePolygonFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Create Polygon" );
actionToSetup->setIcon( QIcon( ":/PolylinesFromFile16x16.png" ) );
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicCreatePolygonFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@ -0,0 +1,79 @@
////////////////////////////////////////////////////////////////////////////////
//
// 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicDuplicatePolygonFeature.h"
#include "RiaApplication.h"
#include "Polygons/RimPolygon.h"
#include "Polygons/RimPolygonCollection.h"
#include "Polygons/RimPolygonInView.h"
#include "Polygons/RimPolygonTools.h"
#include "Rim3dView.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "Riu3DMainWindowTools.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicDuplicatePolygonFeature, "RicDuplicatePolygonFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicDuplicatePolygonFeature::onActionTriggered( bool isChecked )
{
auto sourcePolygon = caf::SelectionManager::instance()->selectedItemOfType<RimPolygon>();
if ( !sourcePolygon )
{
auto sourcePolygonInView = caf::SelectionManager::instance()->selectedItemOfType<RimPolygonInView>();
if ( sourcePolygonInView )
{
sourcePolygon = sourcePolygonInView->polygon();
}
}
if ( !sourcePolygon ) return;
auto proj = RimProject::current();
auto polygonCollection = proj->activeOilField()->polygonCollection();
auto newPolygon = polygonCollection->createUserDefinedPolygon();
newPolygon->setPointsInDomainCoords( sourcePolygon->pointsInDomainCoords() );
auto sourceName = sourcePolygon->name();
newPolygon->setName( "Copy of " + sourceName );
polygonCollection->addUserDefinedPolygon( newPolygon );
polygonCollection->uiCapability()->updateAllRequiredEditors();
Riu3DMainWindowTools::setExpanded( newPolygon );
auto activeView = RiaApplication::instance()->activeReservoirView();
RimPolygonTools::selectPolygonInView( newPolygon, activeView );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicDuplicatePolygonFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Duplicate Polygon" );
actionToSetup->setIcon( QIcon( ":/caf/duplicate.svg" ) );
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicDuplicatePolygonFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@ -0,0 +1,82 @@
////////////////////////////////////////////////////////////////////////////////
//
// 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicExportPolygonCsvFeature.h"
#include "RiaGuiApplication.h"
#include "RiaLogging.h"
#include "Polygons/RimPolygon.h"
#include "Polygons/RimPolygonInView.h"
#include "Polygons/RimPolygonTools.h"
#include "RiuFileDialogTools.h"
#include "cafSelectionManager.h"
#include <QAction>
#include <QFileInfo>
CAF_CMD_SOURCE_INIT( RicExportPolygonCsvFeature, "RicExportPolygonCsvFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportPolygonCsvFeature::onActionTriggered( bool isChecked )
{
auto sourcePolygon = caf::SelectionManager::instance()->selectedItemOfType<RimPolygon>();
if ( !sourcePolygon )
{
auto sourcePolygonInView = caf::SelectionManager::instance()->selectedItemOfType<RimPolygonInView>();
if ( sourcePolygonInView )
{
sourcePolygon = sourcePolygonInView->polygon();
}
}
if ( !sourcePolygon ) return;
auto app = RiaGuiApplication::instance();
auto fallbackPath = app->lastUsedDialogDirectory( "BINARY_GRID" );
auto polygonPath = app->lastUsedDialogDirectoryWithFallback( RimPolygonTools::polygonCacheName(), fallbackPath );
auto polygonFileName = polygonPath + "/" + sourcePolygon->name() + ".csv";
auto fileName = RiuFileDialogTools::getSaveFileName( nullptr,
"Select File for Polygon Export to CSV",
polygonFileName,
"CSV Files (*.csv);;All files(*.*)" );
if ( !RimPolygonTools::exportPolygonCsv( sourcePolygon, fileName ) )
{
RiaLogging::error( "Failed to export polygon to " + fileName );
}
else
{
RiaLogging::info( "Completed polygon export to " + fileName );
app->setLastUsedDialogDirectory( RimPolygonTools::polygonCacheName(), QFileInfo( fileName ).absolutePath() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportPolygonCsvFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Export Polygon CSV" );
actionToSetup->setIcon( QIcon( ":/Save.svg" ) );
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicExportPolygonCsvFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@ -0,0 +1,82 @@
////////////////////////////////////////////////////////////////////////////////
//
// 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicExportPolygonPolFeature.h"
#include "RiaGuiApplication.h"
#include "RiaLogging.h"
#include "Polygons/RimPolygon.h"
#include "Polygons/RimPolygonInView.h"
#include "Polygons/RimPolygonTools.h"
#include "RiuFileDialogTools.h"
#include "cafSelectionManager.h"
#include <QAction>
#include <QFileInfo>
CAF_CMD_SOURCE_INIT( RicExportPolygonPolFeature, "RicExportPolygonPolFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportPolygonPolFeature::onActionTriggered( bool isChecked )
{
auto sourcePolygon = caf::SelectionManager::instance()->selectedItemOfType<RimPolygon>();
if ( !sourcePolygon )
{
auto sourcePolygonInView = caf::SelectionManager::instance()->selectedItemOfType<RimPolygonInView>();
if ( sourcePolygonInView )
{
sourcePolygon = sourcePolygonInView->polygon();
}
}
if ( !sourcePolygon ) 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 fileName = RiuFileDialogTools::getSaveFileName( nullptr,
"Select File for Polygon Export to POL",
polygonFileName,
"POL Files (*.pol);;All files(*.*)" );
if ( !RimPolygonTools::exportPolygonPol( sourcePolygon, fileName ) )
{
RiaLogging::error( "Failed to export polygon to " + fileName );
}
else
{
RiaLogging::info( "Completed polygon export to " + fileName );
RiaApplication::instance()->setLastUsedDialogDirectory( RimPolygonTools::polygonCacheName(), QFileInfo( fileName ).absolutePath() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportPolygonPolFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Export Polygon POL" );
actionToSetup->setIcon( QIcon( ":/Save.svg" ) );
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicExportPolygonPolFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@ -0,0 +1,87 @@
////////////////////////////////////////////////////////////////////////////////
//
// 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicImportPolygonFileFeature.h"
#include "RiaApplication.h"
#include "Polygons/RimPolygon.h"
#include "Polygons/RimPolygonCollection.h"
#include "Polygons/RimPolygonFile.h"
#include "Polygons/RimPolygonTools.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "Riu3DMainWindowTools.h"
#include "RiuFileDialogTools.h"
#include <QAction>
#include <QFileInfo>
CAF_CMD_SOURCE_INIT( RicImportPolygonFileFeature, "RicImportPolygonFileFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicImportPolygonFileFeature::onActionTriggered( bool isChecked )
{
RiaApplication* app = RiaApplication::instance();
auto fallbackPath = app->lastUsedDialogDirectory( "BINARY_GRID" );
auto polygonPath = app->lastUsedDialogDirectoryWithFallback( RimPolygonTools::polygonCacheName(), fallbackPath );
QStringList fileNames = RiuFileDialogTools::getOpenFileNames( Riu3DMainWindowTools::mainWindowWidget(),
"Import Polygons",
polygonPath,
"Polylines (*.csv *.dat *.pol);;Text Files (*.txt);;Polylines "
"(*.dat);;Polylines (*.pol);;Polylines (*.csv);;All Files (*.*)" );
if ( fileNames.isEmpty() ) return;
// Remember the path to next time
app->setLastUsedDialogDirectory( RimPolygonTools::polygonCacheName(), QFileInfo( fileNames.last() ).absolutePath() );
auto proj = RimProject::current();
auto polygonCollection = proj->activeOilField()->polygonCollection();
RimPolygon* objectToSelect = nullptr;
for ( const auto& filename : fileNames )
{
auto newPolygonFile = new RimPolygonFile();
newPolygonFile->setFileName( filename );
newPolygonFile->loadData();
polygonCollection->addPolygonFile( newPolygonFile );
if ( !newPolygonFile->polygons().empty() ) objectToSelect = newPolygonFile->polygons().front();
}
polygonCollection->uiCapability()->updateAllRequiredEditors();
Riu3DMainWindowTools::setExpanded( objectToSelect );
Riu3DMainWindowTools::selectAsCurrentItem( objectToSelect );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicImportPolygonFileFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Import Polygon" );
actionToSetup->setIcon( QIcon( ":/PolylinesFromFile16x16.png" ) );
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicImportPolygonFileFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

Some files were not shown because too many files have changed in this diff Show More