Merge pull request #8771 from OPM/patch_2021.10.3

Prepare for patch release
This commit is contained in:
Magne Sjaastad
2022-04-04 14:47:25 +02:00
committed by GitHub
140 changed files with 2849 additions and 756 deletions

View File

@@ -11,38 +11,44 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache Qt
id: cache-qt
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/Qt/
key: ${{ runner.os }}-QtCache
key: ${{ runner.os }}-QtCache-5-12-12
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: 5.9.9
modules: qtscript
dir: '${{ github.workspace }}/Qt/'
version: 5.12.12
modules: qtscript
dir: "${{ github.workspace }}/Qt/"
cached: ${{ steps.cache-qt.outputs.cache-hit }}
- name: Install Linux dependencies
if: "contains( matrix.os, 'ubuntu')"
run: sudo apt-get install libxkbcommon-x11-0 libgl1-mesa-dev mesa-common-dev libglfw3-dev libglu1-mesa-dev
- name: Build AppFwk with Unit Tests
uses: lukka/run-cmake@v1
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: '${{ github.workspace }}/Fwk/AppFwk/CMakeLists.txt'
cmakeAppendedArgs:
cmakeListsTxtPath: "${{ github.workspace }}/Fwk/AppFwk/CMakeLists.txt"
cmakeAppendedArgs:
buildDirectory: ${{ github.workspace }}/cmakebuild
buildWithCMakeArgs: '--config Release'
buildWithCMakeArgs: "--config Release"
useVcpkgToolchainFile: false
- name: Run Unit Tests Windows
if: contains( matrix.os, 'windows')
if: contains( matrix.os, 'windows')
shell: bash
run: |
cmakebuild/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/Release/cafPdmCore_UnitTests
cmakebuild/cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests/Release/cafPdmXml_UnitTests
cmakebuild/cafProjectDataModel/cafProjectDataModel_UnitTests/Release/cafProjectDataModel_UnitTests
- name: Run Unit Tests Linux
if: "!contains( matrix.os, 'windows')"
shell: bash
@@ -50,4 +56,3 @@ jobs:
cmakebuild/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/cafPdmCore_UnitTests
cmakebuild/cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests/cafPdmXml_UnitTests
cmakebuild/cafProjectDataModel/cafProjectDataModel_UnitTests/cafProjectDataModel_UnitTests

View File

@@ -5,11 +5,11 @@ on:
pull_request:
schedule:
# Every day at 1am to make sure we have a build cache for the current date
# build cache is
- cron: '0 1 * * * '
# build cache is
- cron: "0 1 * * * "
env:
BUILD_TYPE: Release
BUILDCACHE_VERSION: 0.24.4
BUILDCACHE_VERSION: 0.27.6
BUILDCACHE_DIR: ${{ github.workspace }}/buildcache_dir
BUILDCACHE_ACCURACY: SLOPPY
@@ -20,69 +20,72 @@ jobs:
fail-fast: false
matrix:
config:
- {
name: "Windows Latest MSVC",
os: windows-latest,
cc: "cl", cxx: "cl",
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
vcpkg-response-file: vcpkg_x64-windows.txt,
vcpkg-triplet: x64-windows,
cmake-toolchain: 'ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake',
build-python-module: true,
execute-unit-tests: true
}
- {
name: "Ubuntu Latest gcc",
os: ubuntu-latest,
cc: "gcc", cxx: "g++",
vcpkg-response-file: vcpkg_x64-linux.txt,
vcpkg-triplet: x64-linux,
cmake-toolchain: 'ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake',
build-python-module: true,
execute-unit-tests: true
}
- {
name: "Ubuntu Latest clang",
os: ubuntu-latest,
cc: "clang", cxx: "clang++",
vcpkg-response-file: vcpkg_x64-linux.txt,
vcpkg-triplet: x64-linux,
cmake-toolchain: 'ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake',
build-python-module: true,
execute-unit-tests: true
}
- {
name: "Mac OS",
os: macos-latest,
cc: "clang", cxx: "clang++",
vcpkg-response-file: vcpkg_x64-osx.txt,
vcpkg-triplet: x64-osx,
cmake-toolchain: 'ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake',
build-python-module: false,
execute-unit-tests: false
}
- {
name: "Windows Latest MSVC",
os: windows-latest,
cc: "cl",
cxx: "cl",
vcpkg-response-file: vcpkg_x64-windows.txt,
vcpkg-triplet: x64-windows,
build-python-module: true,
execute-unit-tests: true,
}
- {
name: "Ubuntu Latest gcc",
os: ubuntu-latest,
cc: "gcc",
cxx: "g++",
vcpkg-response-file: vcpkg_x64-linux.txt,
vcpkg-triplet: x64-linux,
build-python-module: true,
execute-unit-tests: true,
}
- {
name: "Ubuntu Latest clang",
os: ubuntu-latest,
cc: "clang",
cxx: "clang++",
vcpkg-response-file: vcpkg_x64-linux.txt,
vcpkg-triplet: x64-linux,
build-python-module: true,
execute-unit-tests: true,
}
- {
name: "Mac OS",
os: macos-latest,
cc: "clang",
cxx: "clang++",
vcpkg-response-file: vcpkg_x64-osx.txt,
vcpkg-triplet: x64-osx,
build-python-module: false,
execute-unit-tests: false,
}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
python-version: "3.8"
- name: Display Python version
run: python -c "import sys; print(sys.version)"
# workaround a poor interaction between github actions/cmake/vcpkg, see https://github.com/lukka/run-vcpkg/issues/88#issuecomment-885758902
- name: Use CMake 3.20.1
uses: lukka/get-cmake@v3.20.1
- name: Use CMake
uses: lukka/get-cmake@latest
- name: Use MSVC (Windows)
if: matrix.config.os == 'windows-latest'
uses: ilammy/msvc-dev-cmd@v1
- name: Download buildcache
id: buildcache-download
shell: cmake -P {0}
run: |
if ("${{ runner.os }}" STREQUAL "Windows")
set(buildcache_suffix "win-msvc.zip")
set(buildcache_suffix "windows.zip")
elseif ("${{ runner.os }}" STREQUAL "macOS")
set(buildcache_suffix "macos.zip")
elseif ("${{ runner.os }}" STREQUAL "Linux")
@@ -99,7 +102,7 @@ jobs:
COMMAND chmod +x buildcache/bin/buildcache
)
endif()
- name: Prepare cache timestamp
id: cache_timestamp_string
shell: cmake -P {0}
@@ -113,28 +116,30 @@ jobs:
path: ${{ env.BUILDCACHE_DIR }}
key: ${{ matrix.config.os }}-${{ matrix.config.cc }}-cache-v02-${{ steps.cache_timestamp_string.outputs.timestamp }}
- name: Create Folder for buildcache
run: New-Item ${{ env.BUILDCACHE_DIR }} -ItemType "directory" -Force
run: New-Item ${{ env.BUILDCACHE_DIR }} -ItemType "directory" -Force
shell: pwsh
- name: Add buildcache to system path
run: echo "${{github.workspace}}/buildcache/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
shell: pwsh
- name: Cache Qt
- name: Cache Qt
id: cache-qt
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/Qt/
key: ${{ matrix.config.os }}-QtCache-v03
key: ${{ matrix.config.os }}-QtCache-5-12-12
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: 5.9.9
version: 5.12.12
modules: qtscript qtcharts
dir: '${{ github.workspace }}/Qt/'
dir: "${{ github.workspace }}/Qt/"
cached: ${{ steps.cache-qt.outputs.cache-hit }}
- name: Install Linux dependencies
if: "contains( matrix.config.os, 'ubuntu')"
run: sudo apt-get install libxkbcommon-x11-0 libgl1-mesa-dev mesa-common-dev libglfw3-dev libglu1-mesa-dev libhdf5-dev
- name: Get Python executable path
id: python-path
run: echo "::set-output name=PYTHON_EXECUTABLE::$(python -c 'import sys; import pathlib; print (pathlib.PurePath(sys.executable).as_posix())')"
@@ -149,9 +154,10 @@ jobs:
uses: lukka/run-vcpkg@v7
id: runvcpkg
with:
vcpkgArguments: '@${{ github.workspace }}/${{ matrix.config.vcpkg-response-file }}'
vcpkgDirectory: '${{ github.workspace }}/ThirdParty/vcpkg'
# Ensure the cache key changes any time the content of the response file changes.
vcpkgArguments: "@${{ github.workspace }}/${{ matrix.config.vcpkg-response-file }}"
vcpkgDirectory:
"${{ github.workspace }}/ThirdParty/vcpkg"
# Ensure the cache key changes any time the content of the response file changes.
appendedCacheKey: ${{ hashFiles(env.VCPKGRESPONSEFILE) }}-cache-key-v2
- name: Cache dynamic version of OpenSSL (Linux)
@@ -171,38 +177,20 @@ jobs:
run: |
set(ENV{CC} ${{ matrix.config.cc }})
set(ENV{CXX} ${{ matrix.config.cxx }})
if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x")
execute_process(
COMMAND "${{ matrix.config.environment_script }}" && set
OUTPUT_FILE environment_script_output.txt
)
file(STRINGS environment_script_output.txt output_lines)
foreach(line IN LISTS output_lines)
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
endif()
endforeach()
endif()
set(path_separator ":")
if ("${{ runner.os }}" STREQUAL "Windows")
set(path_separator ";")
endif()
set(ENV{PATH} "$ENV{GITHUB_WORKSPACE}${path_separator}$ENV{PATH}")
execute_process(
COMMAND cmake
-S .
-B cmakebuild
-D CMAKE_BUILD_TYPE=$ENV{BUILD_TYPE}
-D CMAKE_INSTALL_PREFIX=cmakebuild/install
-D RESINSIGHT_ENABLE_UNITY_BUILD=true
-D RESINSIGHT_BUNDLE_OPENSSL=true
-D RESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS=true
-D RESINSIGHT_TREAT_WARNINGS_AS_ERRORS=true
-D RESINSIGHT_ENABLE_GRPC=${{ matrix.config.build-python-module }}
-D RESINSIGHT_GRPC_PYTHON_EXECUTABLE=${{ steps.python-path.outputs.PYTHON_EXECUTABLE }}
-D RESINSIGHT_GRPC_DOWNLOAD_PYTHON_MODULE=true
-D CMAKE_TOOLCHAIN_FILE=${{ matrix.config.cmake-toolchain }}
-D CMAKE_TOOLCHAIN_FILE=ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake
-G Ninja
RESULT_VARIABLE result
)
@@ -213,18 +201,6 @@ jobs:
shell: cmake -P {0}
run: |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ")
if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x")
file(STRINGS environment_script_output.txt output_lines)
foreach(line IN LISTS output_lines)
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
endif()
endforeach()
endif()
set(path_separator ":")
if ("${{ runner.os }}" STREQUAL "Windows")
set(path_separator ";")
endif()
execute_process(
COMMAND cmake --build cmakebuild --target install
RESULT_VARIABLE result

View File

@@ -4,7 +4,7 @@ on:
workflow_dispatch:
schedule:
# Once every night
- cron: '0 1 * * * '
- cron: "0 1 * * * "
env:
NINJA_VERSION: 1.9.0
BUILD_TYPE: Release
@@ -18,14 +18,15 @@ jobs:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu 20.04",
os: ubuntu-20.04,
cc: "gcc", cxx: "g++",
vcpkg-response-file: vcpkg_x64-linux.txt,
vcpkg-triplet: x64-linux,
cmake-toolchain: 'ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake'
}
- {
name: "Ubuntu 20.04",
os: ubuntu-20.04,
cc: "gcc",
cxx: "g++",
vcpkg-response-file: vcpkg_x64-linux.txt,
vcpkg-triplet: x64-linux,
cmake-toolchain: "ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake",
}
steps:
- name: Checkout
uses: actions/checkout@v2
@@ -34,7 +35,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
python-version: "3.8"
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Download Ninja
@@ -61,7 +62,7 @@ jobs:
COMMAND chmod +x buildcache/bin/buildcache
)
endif()
- name: Prepare cache timestamp
id: cache_timestamp_string
shell: cmake -P {0}
@@ -75,24 +76,24 @@ jobs:
path: ${{ env.BUILDCACHE_DIR }}
key: ${{ matrix.config.name }}-cache-v02-${{ steps.cache_timestamp_string.outputs.timestamp }}
- name: Create Folder for buildcache
run: New-Item ${{ env.BUILDCACHE_DIR }} -ItemType "directory" -Force
run: New-Item ${{ env.BUILDCACHE_DIR }} -ItemType "directory" -Force
shell: pwsh
- name: Add buildcache to system path
run: echo "${{github.workspace}}/buildcache/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
shell: pwsh
- name: Cache Qt
- name: Cache Qt
id: cache-qt
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/Qt/
key: ${{ matrix.config.os }}-QtCache-v03
key: ${{ matrix.config.os }}-QtCache-5-12-12
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: 5.9.9
version: 5.12.12
modules: qtscript qtcharts
dir: '${{ github.workspace }}/Qt/'
dir: "${{ github.workspace }}/Qt/"
cached: ${{ steps.cache-qt.outputs.cache-hit }}
- name: Install Linux dependencies
if: "contains( matrix.config.os, 'ubuntu')"
@@ -111,9 +112,10 @@ jobs:
uses: lukka/run-vcpkg@v5
id: runvcpkg
with:
vcpkgArguments: '@${{ github.workspace }}/${{ matrix.config.vcpkg-response-file }}'
vcpkgDirectory: '${{ github.workspace }}/ThirdParty/vcpkg'
# Ensure the cache key changes any time the content of the response file changes.
vcpkgArguments: "@${{ github.workspace }}/${{ matrix.config.vcpkg-response-file }}"
vcpkgDirectory:
"${{ github.workspace }}/ThirdParty/vcpkg"
# Ensure the cache key changes any time the content of the response file changes.
appendedCacheKey: ${{ hashFiles(env.VCPKGRESPONSEFILE) }}
- name: Configure
@@ -138,7 +140,7 @@ jobs:
set(path_separator ";")
endif()
set(ENV{PATH} "$ENV{GITHUB_WORKSPACE}${path_separator}$ENV{PATH}")
execute_process(
COMMAND cmake
-S .

View File

@@ -4,93 +4,93 @@ on:
workflow_dispatch:
schedule:
# Once every night
- cron: '0 1 * * * '
- cron: "0 1 * * * "
jobs:
build_on_centos7:
runs-on: ubuntu-latest
container:
image: centos:7
steps:
- name: Install Dependencies
run: |
yum install -y centos-release-scl
yum-config-manager --enable rhel-server-rhscl-7-rpms
yum install -y https://repo.ius.io/ius-release-el7.rpm
yum install -y git222
- name: Install Dependencies
run: |
yum install -y centos-release-scl
yum-config-manager --enable rhel-server-rhscl-7-rpms
yum install -y qt5-qtbase
yum install -y qt5-qtbase-devel
yum install -y qt5-qtscript-devel
yum install -y qt5-qtsvg-devel
yum install -y https://repo.ius.io/ius-release-el7.rpm
yum install -y git222
yum install -y cmake3
yum install -y make
yum install -y qt5-qtbase
yum install -y qt5-qtbase-devel
yum install -y qt5-qtscript-devel
yum install -y qt5-qtsvg-devel
yum install -y mesa-libGL-devel
yum install -y freeglut-devel
yum install -y cmake3
yum install -y make
yum install -y devtoolset-10
yum install -y rh-python36
- name: Build QtCharts
run: |
source /opt/rh/devtoolset-10/enable
git clone git://code.qt.io/qt/qtcharts.git
cd qtcharts/
git checkout v5.9.7
qmake-qt5 --version
qmake-qt5 -makefile
make -j 4
make install
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Set up Python
id: python-path
run: |
source /opt/rh/rh-python36/enable
python -c "import sys; print(sys.version)"
echo "::set-output name=PYTHON_EXECUTABLE::$(python -c 'import sys; import pathlib; print (pathlib.PurePath(sys.executable).as_posix())')"
- name: Build ResInsight
run: |
source /opt/rh/devtoolset-10/enable
source /opt/rh/rh-python36/enable
yum install -y mesa-libGL-devel
yum install -y freeglut-devel
cmake3 --version
git --version
g++ --version
${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} --version
yum install -y devtoolset-10
${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} -m pip install --upgrade pip
${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} -m pip install grpcio-tools
yum install -y rh-python36
- name: Build QtCharts
run: |
source /opt/rh/devtoolset-10/enable
git clone git://code.qt.io/qt/qtcharts.git
cd qtcharts/
git checkout v5.9.7
qmake-qt5 --version
qmake-qt5 -makefile
make -j 4
make install
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Set up Python
id: python-path
run: |
source /opt/rh/rh-python36/enable
python -c "import sys; print(sys.version)"
echo "::set-output name=PYTHON_EXECUTABLE::$(python -c 'import sys; import pathlib; print (pathlib.PurePath(sys.executable).as_posix())')"
- name: Build ResInsight
run: |
source /opt/rh/devtoolset-10/enable
source /opt/rh/rh-python36/enable
ThirdParty/vcpkg/bootstrap-vcpkg.sh
ThirdParty/vcpkg/vcpkg install grpc boost-filesystem boost-spirit eigen3
mkdir cmakebuild
cd cmakebuild
cmake3 \
-DRESINSIGHT_QT5_BUNDLE_LIBRARIES=ON \
-DRESINSIGHT_ENABLE_GRPC=true \
-DRESINSIGHT_ENABLE_UNITY_BUILD=true \
-DVCPKG_TARGET_TRIPLET=x64-linux \
-DCMAKE_TOOLCHAIN_FILE=../ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DRESINSIGHT_GRPC_PYTHON_EXECUTABLE=${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} \
-DRESINSIGHT_GRPC_DOWNLOAD_PYTHON_MODULE=true \
..
make -j8
make package
rm -rf packages/_CPack_Packages
# Show file structure
pwd
ls
cmake3 --version
git --version
g++ --version
${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} --version
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ResInsight
path: ./cmakebuild/packages
${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} -m pip install --upgrade pip
${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} -m pip install grpcio-tools
ThirdParty/vcpkg/bootstrap-vcpkg.sh
ThirdParty/vcpkg/vcpkg install grpc boost-filesystem boost-spirit eigen3
mkdir cmakebuild
cd cmakebuild
cmake3 \
-DRESINSIGHT_QT5_BUNDLE_LIBRARIES=ON \
-DRESINSIGHT_ENABLE_GRPC=true \
-DRESINSIGHT_ENABLE_UNITY_BUILD=true \
-DVCPKG_TARGET_TRIPLET=x64-linux \
-DCMAKE_TOOLCHAIN_FILE=../ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DRESINSIGHT_GRPC_PYTHON_EXECUTABLE=${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} \
-DRESINSIGHT_GRPC_DOWNLOAD_PYTHON_MODULE=true \
..
make -j8
make package
rm -rf packages/_CPack_Packages
# Show file structure
pwd
ls
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ResInsight
path: ./cmakebuild/packages

View File

@@ -32,5 +32,6 @@ jobs:
commit-message: 'Fixes by clang-format'
title: 'Fixes by clang-format'
branch: clang-format-patches
branch-suffix: random

View File

@@ -31,11 +31,11 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/Qt/
key: ${{ matrix.config.os }}-QtCache-v03
key: ${{ matrix.config.os }}-QtCache-5-12-12
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: 5.9.9
version: 5.12.12
modules: qtscript qtcharts
dir: '${{ github.workspace }}/Qt/'
cached: ${{ steps.cache-qt.outputs.cache-hit }}
@@ -94,4 +94,5 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'Fixes by clang-tidy'
title: 'Fixes by clang-tidy'
branch: clang-tidy-patches
branch: clang-tidy-patches
branch-suffix: random

View File

@@ -34,3 +34,4 @@ jobs:
commit-message: 'Fixes by cmake-format'
title: 'Fixes by cmake-format'
branch: cmake-format-patches
branch-suffix: random

View File

@@ -19,4 +19,5 @@ jobs:
commit-message: 'Python code linting changes detected by black'
title: 'Fixes by black (Python)'
branch: python-black-patches
branch-suffix: random
base: ${{ github.head_ref }}

View File

@@ -19,4 +19,6 @@ jobs:
commit-message: 'Fixes by misspell-fixer'
title: 'Typos fix by misspell-fixer'
branch: spell-check-patches
branch-suffix: random

2
.gitmodules vendored
View File

@@ -3,7 +3,7 @@
url = https://github.com/CeetronSolutions/qwt.git
[submodule "ThirdParty/vcpkg"]
path = ThirdParty/vcpkg
url = https://github.com/CeetronSolutions/vcpkg
url = https://github.com/microsoft/vcpkg
[submodule "ThirdParty/fast_float"]
path = ThirdParty/fast_float
url = https://github.com/fastfloat/fast_float

View File

@@ -486,6 +486,10 @@ if(RESINSIGHT_PRIVATE_INSTALL)
install(FILES ${QT_PLUGIN_PATH}/iconengines/libqsvgicon.so
DESTINATION ${RESINSIGHT_INSTALL_FOLDER}/iconengines/
)
# Required when using --platform offscreen
install(FILES ${QT_PLUGIN_PATH}/platforms/libqoffscreen.so
DESTINATION ${RESINSIGHT_INSTALL_FOLDER}/platforms/
)
# Required by xcb module used to create OpenGL widgets
install(

View File

@@ -20,6 +20,8 @@
#include "RiaDefines.h"
#include "RiaResultNames.h"
#include "cafAppEnum.h"
namespace caf
@@ -151,7 +153,8 @@ void AppEnum<RiaDefines::RINavigationPolicy>::setUp()
//--------------------------------------------------------------------------------------------------
bool RiaDefines::isNativeCategoryResult( const QString& resultName )
{
return resultName.endsWith( "NUM" );
return resultName.endsWith( "NUM" ) || resultName == RiaResultNames::indexIResultName() ||
resultName == RiaResultNames::indexJResultName() || resultName == RiaResultNames::indexKResultName();
}
//--------------------------------------------------------------------------------------------------
@@ -285,6 +288,10 @@ RiaDefines::ImportFileType RiaDefines::obtainFileTypeFromFileName( const QString
{
return ImportFileType::ECLIPSE_SUMMARY_FILE;
}
else if ( fileName.endsWith( "ESMRY", Qt::CaseInsensitive ) )
{
return ImportFileType::ECLIPSE_SUMMARY_FILE;
}
else if ( fileName.endsWith( "ODB", Qt::CaseInsensitive ) )
{
return ImportFileType::GEOMECH_ODB_FILE;

View File

@@ -77,54 +77,6 @@ QString RiaEclipseFileNameTools::findRelatedDataFile()
return relatedFilePath( EclipseFileType::ECLIPSE_DATA );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaEclipseFileNameTools::isProjectFile( const QString& fileName )
{
return hasMatchingSuffix( fileName, EclipseFileType::RESINSIGHT_PROJECT );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaEclipseFileNameTools::isGridFile( const QString& fileName )
{
if ( hasMatchingSuffix( fileName, EclipseFileType::ECLIPSE_EGRID ) )
{
return true;
}
return hasMatchingSuffix( fileName, EclipseFileType::ECLIPSE_GRID );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaEclipseFileNameTools::isSummarySpecFile( const QString& fileName )
{
return hasMatchingSuffix( fileName, EclipseFileType::ECLIPSE_SMSPEC );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaEclipseFileNameTools::isSummaryDataFilePresent( const QString& smspecFileName )
{
QFileInfo fi( smspecFileName );
{
QString candidateFileName = fi.absolutePath() + '/' + fi.baseName() + ".UNSMRY";
if ( QFile::exists( candidateFileName ) ) return true;
}
{
QString candidateFileName = fi.absolutePath() + '/' + fi.baseName() + ".FUNSMRY";
if ( QFile::exists( candidateFileName ) ) return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -49,11 +49,6 @@ public:
QString findRelatedSummarySpecFile();
QString findRelatedDataFile();
static bool isProjectFile( const QString& fileName );
static bool isGridFile( const QString& fileName );
static bool isSummarySpecFile( const QString& fileName );
static bool isSummaryDataFilePresent( const QString& smspecFileName );
private:
QString relatedFilePath( EclipseFileType fileType ) const;

View File

@@ -32,6 +32,7 @@
#include "RiaProjectModifier.h"
#include "RiaRegressionTestRunner.h"
#include "RiaSocketServer.h"
#include "RiaSummaryTools.h"
#include "RiaVersionInfo.h"
#include "RiaViewRedrawScheduler.h"
@@ -1338,6 +1339,8 @@ void RiaGuiApplication::onProjectBeingSaved()
{
setLastUsedDialogDirectory( "BINARY_GRID", QFileInfo( m_project->fileName() ).absolutePath() );
storeTreeViewState();
RiaSummaryTools::summaryCaseMainCollection()->onProjectBeingSaved();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -72,14 +72,14 @@ RiaPreferencesGeoMech::RiaPreferencesGeoMech()
m_geomechWIACommand.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
m_geomechWIACommand.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
CAF_PDM_InitField( &m_keepTemporaryFiles,
"keepTemporaryFile",
false,
"Keep temporary parameter files (for debugging)",
"",
"",
"" );
CAF_PDM_InitField( &m_keepTemporaryFiles, "keepTemporaryFile", false, "Keep temporary parameter files (for debugging)" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_keepTemporaryFiles );
CAF_PDM_InitField( &m_waitForInputFileEdit,
"waitForInputFileEdit",
true,
"Pause to allow modification of input files before running modeling." );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_waitForInputFileEdit );
}
//--------------------------------------------------------------------------------------------------
@@ -109,6 +109,7 @@ void RiaPreferencesGeoMech::appendItems( caf::PdmUiOrdering& uiOrdering ) const
caf::PdmUiGroup* wellIAGroup = uiOrdering.addNewGroup( "Well Integrity Analysis" );
wellIAGroup->add( &m_geomechWIACommand );
wellIAGroup->add( &m_geomechWIADefaultXML );
wellIAGroup->add( &m_waitForInputFileEdit );
caf::PdmUiGroup* commonGroup = uiOrdering.addNewGroup( "Common Settings" );
commonGroup->add( &m_keepTemporaryFiles );
@@ -185,6 +186,14 @@ bool RiaPreferencesGeoMech::keepTemporaryFiles() const
return m_keepTemporaryFiles;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaPreferencesGeoMech::waitBeforeRunWIA() const
{
return m_waitForInputFileEdit;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -48,6 +48,7 @@ public:
QString geomechWIADefaultXML() const;
QString geomechWIACommand() const;
bool waitBeforeRunWIA() const;
bool keepTemporaryFiles() const;
@@ -65,6 +66,7 @@ private:
caf::PdmField<QString> m_geomechWIADefaultXML;
caf::PdmField<QString> m_geomechWIACommand;
caf::PdmField<bool> m_waitForInputFileEdit;
caf::PdmField<bool> m_keepTemporaryFiles;
};

View File

@@ -23,15 +23,32 @@
#include <cctype>
#include <charconv>
const std::string WHITESPACE = " \n\r\t\f\v";
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::string RiaStdStringTools::leftTrimString( const std::string& s )
{
size_t start = s.find_first_not_of( WHITESPACE );
return ( start == std::string::npos ) ? "" : s.substr( start );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::string RiaStdStringTools::rightTrimString( const std::string& s )
{
size_t end = s.find_last_not_of( WHITESPACE );
return ( end == std::string::npos ) ? "" : s.substr( 0, end + 1 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::string RiaStdStringTools::trimString( const std::string& s )
{
auto sCopy = s.substr( 0, s.find_last_not_of( ' ' ) + 1 );
sCopy = sCopy.substr( sCopy.find_first_not_of( ' ' ) );
return sCopy;
return rightTrimString( leftTrimString( s ) );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -31,7 +31,10 @@ class RiaStdStringTools
{
public:
static std::string trimString( const std::string& s );
static bool isNumber( const std::string& s, char decimalPoint );
static std::string rightTrimString( const std::string& s );
static std::string leftTrimString( const std::string& s );
static bool isNumber( const std::string& s, char decimalPoint );
static int16_t toInt16( const std::string& s );
static int toInt( const std::string& s );

View File

@@ -1126,14 +1126,13 @@ std::vector<WellPathCellIntersectionInfo>
WellPathCellIntersectionInfo extraIntersection;
extraIntersection.globCellIndex = std::numeric_limits<size_t>::max();
extraIntersection.startPoint = intersectionPoint;
extraIntersection.endPoint = firstIntersection.startPoint;
extraIntersection.startMD = initialMD;
extraIntersection.endMD = firstIntersection.startMD;
extraIntersection.intersectedCellFaceIn = cvf::StructGridInterface::NO_FACE;
extraIntersection.intersectedCellFaceOut =
cvf::StructGridInterface::oppositeFace( firstIntersection.intersectedCellFaceIn );
extraIntersection.globCellIndex = std::numeric_limits<size_t>::max();
extraIntersection.startPoint = intersectionPoint;
extraIntersection.endPoint = firstIntersection.startPoint;
extraIntersection.startMD = initialMD;
extraIntersection.endMD = firstIntersection.startMD;
extraIntersection.intersectedCellFaceIn = cvf::StructGridInterface::NO_FACE;
extraIntersection.intersectedCellFaceOut = firstIntersection.intersectedCellFaceOut;
extraIntersection.intersectionLengthsInCellCS = cvf::Vec3d::ZERO;
filteredIntersections.push_back( extraIntersection );

View File

@@ -17,6 +17,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicImportEclipseCaseTimeStepFilterFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicEclipsePropertyFilterNewInViewFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicEclipseHideFaultFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicEclipseShowOnlyFaultFeature.h
)
set(SOURCE_GROUP_SOURCE_FILES
@@ -38,6 +39,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicImportEclipseCaseTimeStepFilterFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicEclipsePropertyFilterNewInViewFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicEclipseHideFaultFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicEclipseShowOnlyFaultFeature.cpp
)
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})

View File

@@ -0,0 +1,105 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 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 "RicEclipseShowOnlyFaultFeature.h"
#include "RicEclipsePropertyFilterFeatureImpl.h"
#include "RicEclipsePropertyFilterNewExec.h"
#include "RiaApplication.h"
#include "Rim3dView.h"
#include "RimEclipseCellColors.h"
#include "RimEclipsePropertyFilterCollection.h"
#include "RimEclipseView.h"
#include "RimFaultInView.h"
#include "RimFaultInViewCollection.h"
#include "RigFault.h"
#include "RigMainGrid.h"
#include "cafCmdExecCommandManager.h"
#include "cafPdmUiObjectHandle.h"
#include "cvfStructGrid.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicEclipseShowOnlyFaultFeature, "RicEclipseShowOnlyFaultFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicEclipseShowOnlyFaultFeature::isCommandEnabled()
{
Rim3dView* view = RiaApplication::instance()->activeReservoirView();
if ( !view ) return false;
RimEclipseView* eclView = dynamic_cast<RimEclipseView*>( view );
if ( !eclView ) return false;
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicEclipseShowOnlyFaultFeature::onActionTriggered( bool isChecked )
{
QVariant userData = this->userData();
if ( userData.isNull() || userData.type() != QVariant::String ) return;
QString faultName = userData.toString();
Rim3dView* view = RiaApplication::instance()->activeReservoirView();
if ( !view ) return;
RimEclipseView* eclView = dynamic_cast<RimEclipseView*>( view );
if ( !eclView ) return;
RimFaultInViewCollection* coll = eclView->faultCollection();
RimFaultInView* rimFault = coll->findFaultByName( faultName );
if ( !rimFault ) return;
if ( !rimFault->parentField() ) return;
std::vector<caf::PdmObjectHandle*> children;
rimFault->parentField()->childObjects( &children );
for ( auto& child : children )
{
caf::PdmUiObjectHandle* childUiObject = uiObj( child );
if ( childUiObject && childUiObject->objectToggleField() )
{
caf::PdmField<bool>* field = dynamic_cast<caf::PdmField<bool>*>( childUiObject->objectToggleField() );
if ( field ) field->setValueWithFieldChanged( false );
}
}
if ( rimFault )
{
rimFault->showFault.setValueWithFieldChanged( true );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicEclipseShowOnlyFaultFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setIcon( QIcon( ":/draw_style_faults_24x24.png" ) );
}

View File

@@ -0,0 +1,34 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 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 RicEclipseShowOnlyFaultFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@@ -29,7 +29,6 @@
#include "RimViewWindow.h"
#include "RiuFileDialogTools.h"
#include "RiuGuiTheme.h"
#include "RiuPlotMainWindow.h"
#include "RicSnapshotFilenameGenerator.h"
@@ -87,9 +86,8 @@ void RicSnapshotViewToFileFeature::saveSnapshotAs( const QString& fileName, cons
//--------------------------------------------------------------------------------------------------
void RicSnapshotViewToFileFeature::savePlotPdfReportAs( const QString& fileName, RimPlotWindow* plot )
{
auto currentTheme = RiuGuiTheme::currentGuiTheme();
if ( !plot || !plot->viewWidget() ) return;
RiuGuiTheme::updateGuiTheme( RiaDefines::ThemeEnum::LIGHT );
RiaPlotWindowRedrawScheduler::instance()->performScheduledUpdatesAndReplots();
QCoreApplication::processEvents();
QFile pdfFile( fileName );
@@ -136,7 +134,6 @@ void RicSnapshotViewToFileFeature::savePlotPdfReportAs( const QString& fileName,
{
RiaLogging::error( QString( "Could not write PDF to %1" ).arg( fileName ) );
}
RiuGuiTheme::updateGuiTheme( currentTheme );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -87,6 +87,19 @@ void RicRunWellIntegrityAnalysisFeature::onActionTriggered( bool isChecked )
return;
}
if ( RiaPreferencesGeoMech::current()->waitBeforeRunWIA() )
{
runProgress.setProgressDescription( "Waiting for input file modifications." );
QString infoText = "Input parameter files can now be found in the working folder:";
infoText += " \"" + modelSettings->outputBaseDirectory() + "\"\n";
infoText += "\nClick OK to start the Abaqus modeling or Cancel to stop.";
auto reply = QMessageBox::information( nullptr, wiaTitle, infoText, QMessageBox::Ok | QMessageBox::Cancel );
if ( reply != QMessageBox::Ok ) return;
}
runProgress.incrementProgress();
runProgress.setProgressDescription( "Running Abaqus modeling." );
@@ -107,11 +120,11 @@ void RicRunWellIntegrityAnalysisFeature::onActionTriggered( bool isChecked )
runProgress.setProgressDescription( "Loading modeling results." );
RiaApplication* app = RiaApplication::instance();
if ( !app->openOdbCaseFromFile( modelSettings->outputHeatOdbFilename() ) )
if ( !app->openOdbCaseFromFile( modelSettings->outputDrillingOdbFilename() ) )
{
QMessageBox::critical( nullptr,
wiaTitle,
"Failed to load modeling results from file \"" + modelSettings->outputHeatOdbFilename() +
"Failed to load modeling results from file \"" + modelSettings->outputDrillingOdbFilename() +
"\". Check log window for additional information." );
}

View File

@@ -73,7 +73,30 @@ RimSimWellInView* RicWellLogTools::selectedSimulationWell( int* branchIndex )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicWellLogTools::wellHasRftData( const QString& wellName )
bool RicWellLogTools::hasRftData()
{
RimEclipseResultCase* resultCase;
std::vector<RimCase*> cases;
RimProject::current()->allCases( cases );
for ( RimCase* rimCase : cases )
{
if ( ( resultCase = dynamic_cast<RimEclipseResultCase*>( rimCase ) ) )
{
if ( resultCase->rftReader() )
{
return true;
}
}
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicWellLogTools::hasRftDataForWell( const QString& wellName )
{
RimEclipseResultCase* resultCase;
std::vector<RimCase*> cases;

View File

@@ -42,7 +42,8 @@ class RicWellLogTools
{
public:
static RimSimWellInView* selectedSimulationWell( int* branchIndex );
static bool wellHasRftData( const QString& wellName );
static bool hasRftData();
static bool hasRftDataForWell( const QString& wellName );
static bool isWellPathOrSimWellSelectedInView();
static void addWellLogChannelsToPlotTrack( RimWellLogTrack* plotTrack,
const std::vector<RimWellLogFileChannel*>& wellLogFileChannels );

View File

@@ -79,7 +79,7 @@ void RicPasteAsciiDataToSummaryPlotFeature::onActionTriggered( bool isChecked )
QString text = getPastedData();
RicPasteAsciiDataToSummaryPlotFeatureUi pasteOptions;
caf::PdmSettings::readFieldsFromApplicationStore( &pasteOptions );
caf::PdmSettings::readFieldsFromApplicationStore( &pasteOptions, pasteOptions.contextString() );
if ( !summaryPlot ) pasteOptions.createNewPlot();
pasteOptions.setUiModePasteText( text );
@@ -102,7 +102,7 @@ void RicPasteAsciiDataToSummaryPlotFeature::onActionTriggered( bool isChecked )
summaryPlotCollection->updateConnectedEditors();
}
caf::PdmSettings::writeFieldsToApplicationStore( &pasteOptions );
caf::PdmSettings::writeFieldsToApplicationStore( &pasteOptions, pasteOptions.contextString() );
for ( RimAsciiDataCurve* curve : curves )
{

View File

@@ -556,3 +556,11 @@ void RicPasteAsciiDataToSummaryPlotFeatureUi::updatePreviewTextAndDateFormat()
m_dateFormat = df;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RicPasteAsciiDataToSummaryPlotFeatureUi::contextString() const
{
return QString( "AsciiDataToSummarySettings" );
}

View File

@@ -131,6 +131,8 @@ public:
const AsciiDataParseOptions parseOptions() const;
void createNewPlot();
QString contextString() const;
static DateFormat dateFormatFromString( const QString& dateString );
protected:

View File

@@ -44,7 +44,7 @@ bool RicAdd3dWellLogRftCurveFeature::isCommandEnabled()
RimWellPath* wellPath = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellPath>();
if ( wellPath )
{
return RicWellLogTools::wellHasRftData( wellPath->name() );
return RicWellLogTools::hasRftData();
}
return false;
}
@@ -57,6 +57,8 @@ void RicAdd3dWellLogRftCurveFeature::onActionTriggered( bool isChecked )
RimWellPath* selectedWellPath = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellPath>();
if ( !selectedWellPath ) return;
if ( !RicWellLogTools::hasRftDataForWell( selectedWellPath->name() ) ) return;
Rim3dWellLogRftCurve* rim3dWellLogRftCurve = new Rim3dWellLogRftCurve();
selectedWellPath->add3dWellLogCurve( rim3dWellLogRftCurve );

View File

@@ -59,7 +59,7 @@ bool RicNewWellLogRftCurveFeature::isCommandEnabled()
if ( simulationWell != nullptr )
{
return RicWellLogTools::wellHasRftData( simulationWell->name() );
return RicWellLogTools::hasRftData();
}
return false;

View File

@@ -69,6 +69,8 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RifWellIAFileWriter.h
${CMAKE_CURRENT_LIST_DIR}/RifEclipseTextFileReader.h
${CMAKE_CURRENT_LIST_DIR}/RifEclipseKeywordContent.h
${CMAKE_CURRENT_LIST_DIR}/RifMultipleSummaryReaders.h
${CMAKE_CURRENT_LIST_DIR}/RifProjectSummaryDataWriter.h
)
set(SOURCE_GROUP_SOURCE_FILES
@@ -139,6 +141,8 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RifEclEclipseSummary.cpp
${CMAKE_CURRENT_LIST_DIR}/RifWellIAFileWriter.cpp
${CMAKE_CURRENT_LIST_DIR}/RifEclipseTextFileReader.cpp
${CMAKE_CURRENT_LIST_DIR}/RifMultipleSummaryReaders.cpp
${CMAKE_CURRENT_LIST_DIR}/RifProjectSummaryDataWriter.cpp
)
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})

View File

@@ -200,6 +200,8 @@ void RifEclipseOutputFileTools::timeSteps( const ecl_file_type* ecl_file,
// Some simulations might end up with wrong data reported for day/month/year. If this situation is detected,
// base all time step on double values and use start of simulation as first date
// See https://github.com/OPM/ResInsight/issues/4850
// https://github.com/OPM/ResInsight/issues/8558
if ( uniqueDays.size() == uniqueDayValues.size() ) useStartOfSimulationDate = false;
if ( uniqueDays.size() == dayValues.size() ) useStartOfSimulationDate = false;
}

View File

@@ -88,7 +88,8 @@ std::pair<std::string, std::vector<float>>
{
std::vector<float> values;
const auto commentChar = '-';
const auto commentChar = '-';
const auto commentString = "--";
std::string keywordName;
std::string_view line;
@@ -121,6 +122,12 @@ std::pair<std::string, std::vector<float>>
if ( keywordName.empty() )
{
auto found = line.find_first_of( commentString );
if ( found != std::string::npos )
{
line = line.substr( 0, found );
}
trim( line );
if ( !line.empty() )
{

View File

@@ -0,0 +1,121 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- 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 "RifMultipleSummaryReaders.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifMultipleSummaryReaders::RifMultipleSummaryReaders() = default;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifMultipleSummaryReaders::addReader( RifSummaryReaderInterface* reader )
{
for ( auto existingReader : m_readers )
{
if ( existingReader.p() == reader ) return;
}
m_readers.push_back( reader );
rebuildMetaData();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifMultipleSummaryReaders::removeReader( RifSummaryReaderInterface* reader )
{
m_readers.erase( reader );
rebuildMetaData();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<time_t>& RifMultipleSummaryReaders::timeSteps( const RifEclipseSummaryAddress& resultAddress ) const
{
for ( const auto& r : m_readers )
{
if ( r->hasAddress( resultAddress ) ) return r->timeSteps( resultAddress );
}
static std::vector<time_t> empty;
return empty;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RifMultipleSummaryReaders::values( const RifEclipseSummaryAddress& resultAddress, std::vector<double>* values ) const
{
for ( const auto& r : m_readers )
{
if ( r->hasAddress( resultAddress ) ) return r->values( resultAddress, values );
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::string RifMultipleSummaryReaders::unitName( const RifEclipseSummaryAddress& resultAddress ) const
{
for ( const auto& r : m_readers )
{
if ( r->hasAddress( resultAddress ) ) return r->unitName( resultAddress );
}
return {};
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaDefines::EclipseUnitSystem RifMultipleSummaryReaders::unitSystem() const
{
CVF_ASSERT( !m_readers.empty() );
return m_readers.at( 0 )->unitSystem();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifMultipleSummaryReaders::rebuildMetaData()
{
m_allErrorAddresses.clear();
m_allResultAddresses.clear();
for ( const auto& reader : m_readers )
{
{
auto resultAddresses = reader->allResultAddresses();
m_allResultAddresses.insert( resultAddresses.begin(), resultAddresses.end() );
}
{
auto errorResultAddresses = reader->allErrorAddresses();
m_allErrorAddresses.insert( errorResultAddresses.begin(), errorResultAddresses.end() );
}
}
}

View File

@@ -0,0 +1,47 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- 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 "RifSummaryReaderInterface.h"
#include "cvfCollection.h"
#include <list>
//==================================================================================================
///
//==================================================================================================
class RifMultipleSummaryReaders : public RifSummaryReaderInterface
{
public:
RifMultipleSummaryReaders();
void addReader( RifSummaryReaderInterface* reader );
void removeReader( RifSummaryReaderInterface* reader );
const std::vector<time_t>& timeSteps( const RifEclipseSummaryAddress& resultAddress ) const override;
bool values( const RifEclipseSummaryAddress& resultAddress, std::vector<double>* values ) const override;
std::string unitName( const RifEclipseSummaryAddress& resultAddress ) const override;
RiaDefines::EclipseUnitSystem unitSystem() const override;
void rebuildMetaData();
private:
cvf::Collection<RifSummaryReaderInterface> m_readers;
};

View File

@@ -0,0 +1,220 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- 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 "RifProjectSummaryDataWriter.h"
#include "RifSummaryReaderInterface.h"
#include "opm/common/utility/TimeService.hpp"
#include "opm/io/eclipse/EclOutput.hpp"
#include "opm/io/eclipse/ExtESmry.hpp"
#include "cafAssert.h"
#include <numeric>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifProjectSummaryDataWriter::RifProjectSummaryDataWriter()
: m_timeStepCount( 0 )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifProjectSummaryDataWriter::importFromSourceSummaryReader( const RifSummaryReaderInterface* reader )
{
if ( !reader ) return;
std::string keyword = "TIME";
auto summaryAddress = RifEclipseSummaryAddress::miscAddress( keyword );
if ( reader->hasAddress( summaryAddress ) )
{
auto timeSteps = reader->timeSteps( summaryAddress );
if ( !timeSteps.empty() )
{
Opm::TimeStampUTC ts( timeSteps.front() );
m_startTime = { ts.day(), ts.month(), ts.year(), ts.hour(), ts.minutes(), ts.seconds(), 0 };
}
std::vector<double> values;
reader->values( summaryAddress, &values );
const auto& unitString = reader->unitName( summaryAddress );
m_keywords.push_back( keyword );
m_units.push_back( unitString );
std::vector<float> floatValues;
floatValues.reserve( values.size() );
for ( const auto& v : values )
{
floatValues.push_back( v );
}
m_values.push_back( floatValues );
m_timeStepCount = values.size();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifProjectSummaryDataWriter::importFromProjectSummaryFile( const std::string& projectSummaryFileName )
{
try
{
Opm::EclIO::ExtESmry sourceSummary( projectSummaryFileName );
Opm::TimeStampUTC ts( std::chrono::system_clock::to_time_t( sourceSummary.startdate() ) );
m_startTime = { ts.day(), ts.month(), ts.year(), ts.hour(), ts.minutes(), ts.seconds(), 0 };
auto keywords = sourceSummary.keywordList();
for ( const auto& keyword : keywords )
{
const auto& values = sourceSummary.get( keyword );
const auto& unitString = sourceSummary.get_unit( keyword );
m_keywords.push_back( keyword );
m_units.push_back( unitString );
m_values.push_back( values );
if ( m_timeStepCount == 0 )
{
m_timeStepCount = values.size();
}
}
}
catch ( ... )
{
std::string txt = "Error detected during import of data from " + projectSummaryFileName;
m_errorMessages.push_back( txt );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifProjectSummaryDataWriter::setData( const std::vector<std::string>& keywords,
const std::vector<std::string>& units,
const std::vector<std::vector<float>>& values )
{
if ( keywords.empty() ) return;
CAF_ASSERT( keywords.size() == units.size() );
CAF_ASSERT( keywords.size() == values.size() );
for ( size_t i = 0; i < keywords.size(); i++ )
{
auto existingIndex = indexForKeyword( keywords[i] );
if ( existingIndex == -1 )
{
m_keywords.push_back( keywords[i] );
m_units.push_back( units[i] );
m_values.push_back( values[i] );
}
else
{
// Overwrite existing data
m_keywords[existingIndex] = keywords[i];
m_units[existingIndex] = units[i];
m_values[existingIndex] = values[i];
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifProjectSummaryDataWriter::writeDataToFile( const std::string& fileName )
{
// Reference to other locations writing to ESMRY files
// ESmry::make_esmry_file()
// ExtSmryOutput::write()
try
{
// The ExtESmry reader supports only binary mode, set formatted to false
bool formatted = false;
Opm::EclIO::EclOutput outFile( fileName, formatted, std::ios::out );
outFile.write<int>( "START", m_startTime );
outFile.write( "KEYCHECK", m_keywords );
outFile.write( "UNITS", m_units );
{
// Bool array 1 means RSTEP, 0 means no RSTEP
// Dummy values, but required by the reader
std::vector<int> intValues( m_timeStepCount, 1 );
outFile.write<int>( "RSTEP", intValues );
}
{
// TSTEP represents time steps
// Dummy values, but required by the reader
std::vector<int> intValues;
intValues.resize( m_timeStepCount );
std::iota( intValues.begin(), intValues.end(), 0 );
outFile.write<int>( "TSTEP", intValues );
}
for ( size_t i = 0; i < static_cast<size_t>( m_keywords.size() ); i++ )
{
std::string vect_name = "V" + std::to_string( i );
outFile.write<float>( vect_name, m_values[i] );
}
}
catch ( ... )
{
std::string txt = "Error detected during export of data to " + fileName;
m_errorMessages.push_back( txt );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::string> RifProjectSummaryDataWriter::errorMessages() const
{
return m_errorMessages;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifProjectSummaryDataWriter::clearErrorMessages()
{
m_errorMessages.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RifProjectSummaryDataWriter::indexForKeyword( const std::string& keyword ) const
{
for ( int i = 0; i < static_cast<int>( m_keywords.size() ); i++ )
{
if ( m_keywords[i] == keyword ) return i;
}
return -1;
}

View File

@@ -0,0 +1,67 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- 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 <string>
#include <vector>
class RifEclipseSummaryAddress;
class RifSummaryReaderInterface;
//==================================================================================================
//
//
//==================================================================================================
class RifProjectSummaryDataWriter
{
public:
RifProjectSummaryDataWriter();
// Import start time, time values, and time step count from a source summary case
void importFromSourceSummaryReader( const RifSummaryReaderInterface* reader );
// Import all data from project summary file. This file can than be overwritten using writeDataToFile()
void importFromProjectSummaryFile( const std::string& projectSummaryFileName );
// Set data for a list of keyword/unit/values. If a keyword exist, the data will be overwritten
void setData( const std::vector<std::string>& keywords,
const std::vector<std::string>& units,
const std::vector<std::vector<float>>& values );
void writeDataToFile( const std::string& fileName );
std::vector<std::string> errorMessages() const;
void clearErrorMessages();
private:
int indexForKeyword( const std::string& keyword ) const;
private:
// Structure used to represent start time defined in the following order
// [DAY, MONTH, YEAR, HOUR, MINUTE, SECOND, MILLI_SEC]
std::vector<int> m_startTime;
std::vector<std::string> m_keywords;
std::vector<std::string> m_units;
std::vector<std::vector<float>> m_values;
size_t m_timeStepCount;
std::vector<std::string> m_errorMessages;
};

View File

@@ -41,6 +41,7 @@
#include "RigEclipseResultInfo.h"
#include "RigEquil.h"
#include "RigMainGrid.h"
#include "RigNNCData.h"
#include "RigSimWellData.h"
#include "RigWellResultPoint.h"
@@ -769,7 +770,7 @@ void RifReaderEclipseOutput::transferStaticNNCData( const ecl_grid_type* mainEcl
transmissibilityValuesTemp.push_back( transValues[nIdx] );
}
mainGrid->nncData()->setNativeConnections( nncConnections );
mainGrid->nncData()->setEclipseConnections( nncConnections );
mainGrid->nncData()->makeScalarResultAndSetValues( RiaDefines::propertyNameCombTrans(),
transmissibilityValuesTemp );
}

View File

@@ -56,11 +56,19 @@ void RifReaderEclipseRft::open()
RiaLogging::info( QString( "Opening file '%1'" ).arg( m_fileName ) );
m_ecl_rft_file = ecl_rft_file_alloc_case( RiaStringEncodingTools::toNativeEncoded( m_fileName ).data() );
try
{
// Use try/catch, as inconsistent RFT data might lead to exceptions
// https://github.com/OPM/ResInsight/issues/8354
m_ecl_rft_file = ecl_rft_file_alloc_case( RiaStringEncodingTools::toNativeEncoded( m_fileName ).data() );
}
catch ( ... )
{
}
if ( m_ecl_rft_file == nullptr )
{
RiaLogging::warning( QString( "Libecl could not find/open file '%'" ).arg( m_fileName ) );
RiaLogging::warning( QString( "Libecl could not find/open file '%1" ).arg( m_fileName ) );
return;
}

View File

@@ -89,7 +89,7 @@ void RifSurfaceImporter::readGocadFile( const QString& filename, RigGocadData* g
auto tokens = RiaStdStringTools::splitString( line, ' ' );
std::string firstToken;
if ( !tokens.empty() ) firstToken = tokens.front();
if ( !tokens.empty() ) firstToken = RiaStdStringTools::trimString( tokens.front() );
if ( isInTfaceSection )
{

View File

@@ -204,14 +204,16 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateSurfaceIntersection
cvf::Vec3d intersectionPoint;
bool foundMatch = RigSurfaceResampler::resamplePoint( surface, pointAbove, pointBelow, intersectionPoint );
if ( !foundMatch )
intersectionPoint = cvf::Vec3d( point.x(), point.y(), std::numeric_limits<double>::infinity() );
const size_t lineIndex = 0;
transformedSurfacePolyline.push_back(
transformPointByPolylineSegmentIndex( intersectionPoint, lineIndex, segmentIndex ) );
if ( foundMatch )
{
const size_t lineIndex = 0;
transformedSurfacePolyline.push_back(
transformPointByPolylineSegmentIndex( intersectionPoint, lineIndex, segmentIndex ) );
}
}
m_transformedSurfaceIntersectionPolylines[rimSurface] = transformedSurfacePolyline;
if ( !transformedSurfacePolyline.empty() )
m_transformedSurfaceIntersectionPolylines[rimSurface] = transformedSurfacePolyline;
}
}
}
@@ -436,6 +438,15 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays()
point1 = point1.getTransformedPoint( invSectionCS );
point2 = point2.getTransformedPoint( invSectionCS );
if ( m_isFlattened )
{
// The points are transformed in to the XZ-plane with Y = zero.
// Set all y values to zero to avoid numerical issues
point0.y() = 0.0;
point1.y() = 0.0;
point2.y() = 0.0;
}
triangleVertices.emplace_back( point0 );
triangleVertices.emplace_back( point1 );
triangleVertices.emplace_back( point2 );
@@ -641,6 +652,31 @@ const cvf::Vec3fArray* RivExtrudedCurveIntersectionGeometryGenerator::triangleVx
return m_triangleVxes.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const cvf::Vec3fArray* RivExtrudedCurveIntersectionGeometryGenerator::cellMeshVxes() const
{
CVF_ASSERT( m_cellBorderLineVxes->size() );
return m_cellBorderLineVxes.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const cvf::Vec3fArray* RivExtrudedCurveIntersectionGeometryGenerator::faultMeshVxes() const
{
return m_faultCellBorderLineVxes.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivExtrudedCurveIntersectionGeometryGenerator::ensureGeometryIsCalculated()
{
calculateArrays();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -81,6 +81,10 @@ public:
const std::vector<size_t>& triangleToCellIndex() const override;
const std::vector<RivIntersectionVertexWeights>& triangleVxToCellCornerInterpolationWeights() const override;
const cvf::Vec3fArray* triangleVxes() const override;
const cvf::Vec3fArray* cellMeshVxes() const override;
const cvf::Vec3fArray* faultMeshVxes() const override;
void ensureGeometryIsCalculated();
private:
void calculateArrays();

View File

@@ -27,8 +27,11 @@
class RivIntersectionGeometryGeneratorInterface
{
public:
virtual bool isAnyGeometryPresent() const = 0;
virtual const std::vector<size_t>& triangleToCellIndex() const = 0;
virtual ~RivIntersectionGeometryGeneratorInterface() = default;
virtual bool isAnyGeometryPresent() const = 0;
virtual const std::vector<size_t>& triangleToCellIndex() const = 0;
virtual const std::vector<RivIntersectionVertexWeights>& triangleVxToCellCornerInterpolationWeights() const = 0;
virtual const cvf::Vec3fArray* triangleVxes() const = 0;
virtual const cvf::Vec3fArray* cellMeshVxes() const { return nullptr; };
virtual const cvf::Vec3fArray* faultMeshVxes() const { return nullptr; };
};

View File

@@ -29,6 +29,7 @@
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigMainGrid.h"
#include "RigNNCData.h"
#include "cafDisplayCoordTransform.h"
@@ -95,13 +96,14 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode
double characteristicCellSize = eclipseCase->characteristicCellSize();
float arrowConstantScaling = 10.0 * result->sizeScale() * characteristicCellSize;
double min, max;
result->mappingRange( min, max );
double maxAbsResult = 1.0;
if ( min != cvf::UNDEFINED_DOUBLE && max != cvf::UNDEFINED_DOUBLE )
{
maxAbsResult = std::max( cvf::Math::abs( max ), cvf::Math::abs( min ) );
double min, max;
result->mappingRange( min, max );
if ( min != cvf::UNDEFINED_DOUBLE && max != cvf::UNDEFINED_DOUBLE )
{
maxAbsResult = std::max( cvf::Math::abs( max ), cvf::Math::abs( min ) );
}
}
float arrowScaling = arrowConstantScaling / maxAbsResult;
@@ -120,7 +122,8 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode
if ( fluidIndex == 0 ) directions.push_back( cvf::StructGridInterface::POS_I );
auto candidate = addresses[0 + fluidIndex];
if ( resultsData->hasResultEntry( candidate ) )
if ( resultsData->hasResultEntry( candidate ) &&
!resultsData->cellScalarResults( candidate, timeStepIndex ).empty() )
{
resultAddresses.push_back( candidate );
}
@@ -129,7 +132,8 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode
{
if ( fluidIndex == 0 ) directions.push_back( cvf::StructGridInterface::POS_J );
auto candidate = addresses[1 + fluidIndex];
if ( resultsData->hasResultEntry( candidate ) )
if ( resultsData->hasResultEntry( candidate ) &&
!resultsData->cellScalarResults( candidate, timeStepIndex ).empty() )
{
resultAddresses.push_back( candidate );
}
@@ -138,7 +142,8 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode
{
if ( fluidIndex == 0 ) directions.push_back( cvf::StructGridInterface::POS_K );
auto candidate = addresses[2 + fluidIndex];
if ( resultsData->hasResultEntry( candidate ) )
if ( resultsData->hasResultEntry( candidate ) &&
!resultsData->cellScalarResults( candidate, timeStepIndex ).empty() )
{
resultAddresses.push_back( candidate );
}
@@ -160,75 +165,81 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode
faceNormal = ( faceCenter - cellCenter ).getNormalized() * arrowScaling;
};
for ( size_t gcIdx = 0; gcIdx < cells.size(); ++gcIdx )
if ( !resultAddresses.empty() && !directions.empty() )
{
if ( !cells[gcIdx].isInvalid() && activeCellInfo->isActive( gcIdx ) )
#pragma omp parallel for
for ( int gcIdx = 0; gcIdx < static_cast<int>( cells.size() ); ++gcIdx )
{
size_t resultIdx = activeCellInfo->cellResultIndex( gcIdx );
if ( result->vectorView() == RimElementVectorResult::VectorView::PER_FACE )
if ( !cells[gcIdx].isInvalid() && activeCellInfo->isActive( gcIdx ) )
{
for ( int dir = 0; dir < static_cast<int>( directions.size() ); dir++ )
size_t resultIdx = activeCellInfo->cellResultIndex( gcIdx );
if ( result->vectorView() == RimElementVectorResult::VectorView::PER_FACE )
{
double resultValue = 0.0;
for ( size_t flIdx = dir; flIdx < resultAddresses.size(); flIdx += directions.size() )
for ( int dir = 0; dir < static_cast<int>( directions.size() ); dir++ )
{
resultValue +=
resultsData->cellScalarResults( resultAddresses[flIdx], timeStepIndex ).at( resultIdx );
}
double resultValue = 0.0;
for ( size_t flIdx = dir; flIdx < resultAddresses.size(); flIdx += directions.size() )
{
resultValue +=
resultsData->cellScalarResults( resultAddresses[flIdx], timeStepIndex ).at( resultIdx );
}
if ( std::abs( resultValue ) >= result->threshold() )
if ( std::abs( resultValue ) >= result->threshold() )
{
cvf::Vec3d faceCenter;
cvf::Vec3d faceNormal;
getFaceCenterAndNormal( static_cast<size_t>( gcIdx ), directions[dir], faceCenter, faceNormal );
faceNormal *= std::abs( resultValue );
#pragma omp critical( critical_section_RivElementVectorResultPartMgr_add_1 )
tensorVisualizations.push_back(
ElementVectorResultVisualization( faceCenter,
faceNormal,
resultValue,
std::cbrt( cells[gcIdx].volume() / 3.0 ) ) );
}
}
}
else if ( result->vectorView() == RimElementVectorResult::VectorView::CELL_CENTER_TOTAL )
{
cvf::Vec3d aggregatedVector;
cvf::Vec3d aggregatedResult;
for ( int dir = 0; dir < static_cast<int>( directions.size() ); dir++ )
{
double resultValue = 0.0;
for ( size_t flIdx = dir; flIdx < resultAddresses.size(); flIdx += directions.size() )
{
resultValue +=
resultsData->cellScalarResults( resultAddresses[flIdx], timeStepIndex ).at( resultIdx );
}
cvf::Vec3d faceCenter;
cvf::Vec3d faceNormal;
cvf::Vec3d faceNormalScaled;
getFaceCenterAndNormal( gcIdx, directions[dir], faceCenter, faceNormal );
faceNormal *= std::abs( resultValue );
faceNormalScaled = faceNormal * resultValue;
aggregatedVector += faceNormalScaled;
aggregatedResult += faceNormal.getNormalized() * resultValue;
}
if ( aggregatedResult.length() >= result->threshold() )
{
#pragma omp critical( critical_section_RivElementVectorResultPartMgr_add_2 )
tensorVisualizations.push_back(
ElementVectorResultVisualization( faceCenter,
faceNormal,
resultValue,
ElementVectorResultVisualization( displayCordXf->transformToDisplayCoord( cells[gcIdx].center() ),
aggregatedVector,
aggregatedResult.length(),
std::cbrt( cells[gcIdx].volume() / 3.0 ) ) );
}
}
}
else if ( result->vectorView() == RimElementVectorResult::VectorView::CELL_CENTER_TOTAL )
{
cvf::Vec3d aggregatedVector;
cvf::Vec3d aggregatedResult;
for ( int dir = 0; dir < static_cast<int>( directions.size() ); dir++ )
{
double resultValue = 0.0;
for ( size_t flIdx = dir; flIdx < resultAddresses.size(); flIdx += directions.size() )
{
resultValue +=
resultsData->cellScalarResults( resultAddresses[flIdx], timeStepIndex ).at( resultIdx );
}
cvf::Vec3d faceCenter;
cvf::Vec3d faceNormal;
cvf::Vec3d faceNormalScaled;
getFaceCenterAndNormal( gcIdx, directions[dir], faceCenter, faceNormal );
faceNormalScaled = faceNormal * resultValue;
aggregatedVector += faceNormalScaled;
aggregatedResult += faceNormal.getNormalized() * resultValue;
}
if ( aggregatedResult.length() >= result->threshold() )
{
tensorVisualizations.push_back(
ElementVectorResultVisualization( displayCordXf->transformToDisplayCoord( cells[gcIdx].center() ),
aggregatedVector,
aggregatedResult.length(),
std::cbrt( cells[gcIdx].volume() / 3.0 ) ) );
}
}
}
}
RigNNCData* nncData = eclipseCaseData->mainGrid()->nncData();
size_t numNncConnections = nncData->connections().size();
if ( result->showNncData() )
{
RigNNCData* nncData = eclipseCaseData->mainGrid()->nncData();
nncData->buildPolygonsForEclipseConnections();
std::vector<const std::vector<std::vector<double>>*> nncResultVals;
std::vector<RigEclipseResultAddress> combinedAddresses;
result->resultAddressesCombined( combinedAddresses );
@@ -244,15 +255,16 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode
}
}
for ( size_t nIdx = 0; nIdx < numNncConnections; ++nIdx )
#pragma omp parallel for
for ( int nIdx = 0; nIdx < static_cast<int>( nncData->eclipseConnectionCount() ); ++nIdx )
{
const RigConnection& conn = nncData->connections()[nIdx];
const RigConnection& conn = nncData->availableConnections()[nIdx];
if ( conn.polygon().size() )
{
double resultValue = 0.0;
for ( size_t flIdx = 0; flIdx < nncResultVals.size(); flIdx++ )
{
if ( nIdx < nncResultVals.at( flIdx )->at( timeStepIndex ).size() )
if ( nIdx < static_cast<int>( nncResultVals.at( flIdx )->at( timeStepIndex ).size() ) )
{
resultValue += nncResultVals.at( flIdx )->at( timeStepIndex )[nIdx];
}
@@ -268,6 +280,7 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode
if ( std::abs( resultValue ) >= result->threshold() )
{
#pragma omp critical( critical_section_RivElementVectorResultPartMgr_add_nnc )
tensorVisualizations.push_back(
ElementVectorResultVisualization( displayCordXf->transformToDisplayCoord( connCenter ),
connNormal,

View File

@@ -29,16 +29,20 @@
#include "cvfScalarMapper.h"
#include "RigFault.h"
#include "RigNNCData.h"
#include "RigNncConnection.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivFaultGeometryGenerator::RivFaultGeometryGenerator( const cvf::StructGridInterface* grid,
const RigFault* fault,
RigNNCData* nncData,
bool computeNativeFaultFaces )
: m_grid( grid )
, m_fault( fault )
, m_computeNativeFaultFaces( computeNativeFaultFaces )
, m_nncData( nncData )
{
m_quadMapper = new cvf::StructGridQuadToCellFaceMapper;
m_triangleMapper = new cvf::StuctGridTriangleToCellFaceMapper( m_quadMapper.p() );
@@ -54,9 +58,9 @@ RivFaultGeometryGenerator::~RivFaultGeometryGenerator()
//--------------------------------------------------------------------------------------------------
/// Generate surface drawable geo from the specified region
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivFaultGeometryGenerator::generateSurface()
cvf::ref<cvf::DrawableGeo> RivFaultGeometryGenerator::generateSurface( bool onlyShowFacesWithDefinedNeighbors )
{
computeArrays();
computeArrays( onlyShowFacesWithDefinedNeighbors );
CVF_ASSERT( m_vertices.notNull() );
@@ -119,7 +123,31 @@ cvf::ref<cvf::DrawableGeo> RivFaultGeometryGenerator::createOutlineMeshDrawable(
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivFaultGeometryGenerator::computeArrays()
bool RivFaultGeometryGenerator::hasConnection( size_t cellIdx,
cvf::StructGridInterface::FaceType face,
const RigConnectionContainer& conns,
const std::vector<size_t>& nncConnectionIndices )
{
cvf::StructGridInterface::FaceType oppositeFace = cvf::StructGridInterface::oppositeFace( face );
for ( auto i : nncConnectionIndices )
{
if ( i >= conns.size() ) continue;
const auto& r = conns[i];
if ( ( r.c1GlobIdx() == cellIdx ) && ( r.face() == face ) && r.hasCommonArea() ) return true;
if ( ( r.c2GlobIdx() == cellIdx ) && ( r.face() == oppositeFace ) && r.hasCommonArea() ) return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivFaultGeometryGenerator::computeArrays( bool onlyShowFacesWithDefinedNeighbors )
{
std::vector<cvf::Vec3f> vertices;
m_quadMapper->quadToCellIndexMap().clear();
@@ -127,6 +155,15 @@ void RivFaultGeometryGenerator::computeArrays()
cvf::Vec3d offset = m_grid->displayModelOffset();
if ( onlyShowFacesWithDefinedNeighbors )
{
// Make sure the connection polygon is computed, as this is used as criteria for visibility
m_nncData->ensureAllConnectionDataIsProcessed();
}
auto connIndices = m_fault->connectionIndices();
auto& connections = m_nncData->availableConnections();
const std::vector<RigFault::FaultFace>& faultFaces = m_fault->faultFaces();
#pragma omp parallel for
@@ -135,23 +172,26 @@ void RivFaultGeometryGenerator::computeArrays()
size_t cellIndex = faultFaces[fIdx].m_nativeReservoirCellIndex;
cvf::StructGridInterface::FaceType face = faultFaces[fIdx].m_nativeFace;
if ( cellIndex >= m_cellVisibility->size() ) continue;
if ( !m_computeNativeFaultFaces )
{
cellIndex = faultFaces[fIdx].m_oppositeReservoirCellIndex;
face = cvf::StructGridInterface::oppositeFace( faultFaces[fIdx].m_nativeFace );
face = cvf::StructGridInterface::oppositeFace( face );
}
if ( cellIndex >= m_cellVisibility->size() ) continue;
if ( !( *m_cellVisibility )[cellIndex] ) continue;
if ( onlyShowFacesWithDefinedNeighbors && !hasConnection( cellIndex, face, connections, connIndices ) )
continue;
cvf::Vec3d cornerVerts[8];
m_grid->cellCornerVertices( cellIndex, cornerVerts );
cvf::ubyte faceConn[4];
m_grid->cellFaceVertexIndices( face, faceConn );
// Critical section to avoid two threads accessing the arrays at the same time.
// Critical section to avoid two threads accessing the arrays at the same time.
#pragma omp critical( critical_section_RivFaultGeometryGenerator_computeArrays )
{
int n;

View File

@@ -32,6 +32,8 @@ class Transform;
class Part;
} // namespace cvf
class RigNNCData;
class RigConnectionContainer;
class RigFault;
//==================================================================================================
@@ -42,7 +44,10 @@ class RigFault;
class RivFaultGeometryGenerator : public cvf::Object
{
public:
RivFaultGeometryGenerator( const cvf::StructGridInterface* grid, const RigFault* fault, bool computeNativeFaultFaces );
RivFaultGeometryGenerator( const cvf::StructGridInterface* grid,
const RigFault* fault,
RigNNCData* nncData,
bool computeNativeFaultFaces );
~RivFaultGeometryGenerator() override;
void setCellVisibility( const cvf::UByteArray* cellVisibilities );
@@ -53,18 +58,24 @@ public:
const cvf::StuctGridTriangleToCellFaceMapper* triangleToCellFaceMapper() { return m_triangleMapper.p(); }
// Generated geometry
cvf::ref<cvf::DrawableGeo> generateSurface();
cvf::ref<cvf::DrawableGeo> generateSurface( bool onlyShowFacesWithDefinedNeighbors );
cvf::ref<cvf::DrawableGeo> createMeshDrawable();
cvf::ref<cvf::DrawableGeo> createOutlineMeshDrawable( double creaseAngle );
private:
void computeArrays();
void computeArrays( bool onlyShowFacesWithDefinedNeighbors );
bool hasConnection( size_t cellIdx,
cvf::StructGridInterface::FaceType face,
const RigConnectionContainer& conns,
const std::vector<size_t>& nncConnectionIndices );
private:
// Input
cvf::cref<cvf::StructGridInterface> m_grid;
cvf::cref<RigFault> m_fault;
cvf::cref<cvf::UByteArray> m_cellVisibility;
cvf::ref<RigNNCData> m_nncData;
bool m_computeNativeFaultFaces;

View File

@@ -24,6 +24,7 @@
#include "RigCaseCellResultsData.h"
#include "RigMainGrid.h"
#include "RigNNCData.h"
#include "RigResultAccessor.h"
#include "RimEclipseCase.h"
@@ -71,27 +72,18 @@ RivFaultPartMgr::RivFaultPartMgr( const RigGridBase* grid,
{
CVF_ASSERT( rimFault->faultGeometry() );
cvf::ref<cvf::Array<size_t>> connIdxes = new cvf::Array<size_t>;
connIdxes->assign( rimFault->faultGeometry()->connectionIndices() );
m_nativeFaultGenerator = new RivFaultGeometryGenerator( grid, rimFault->faultGeometry(), true );
m_oppositeFaultGenerator = new RivFaultGeometryGenerator( grid, rimFault->faultGeometry(), false );
m_nativeFaultGenerator =
new RivFaultGeometryGenerator( grid, rimFault->faultGeometry(), grid->mainGrid()->nncData(), true );
m_oppositeFaultGenerator =
new RivFaultGeometryGenerator( grid, rimFault->faultGeometry(), grid->mainGrid()->nncData(), false );
m_nativeFaultFacesTextureCoords = new cvf::Vec2fArray;
m_oppositeFaultFacesTextureCoords = new cvf::Vec2fArray;
m_NNCGenerator = new RivNNCGeometryGenerator( false,
grid->mainGrid()->nncData(),
grid->mainGrid()->displayModelOffset(),
connIdxes.p() );
m_NNCTextureCoords = new cvf::Vec2fArray;
m_allanNNCGenerator = new RivNNCGeometryGenerator( true,
grid->mainGrid()->nncData(),
grid->mainGrid()->displayModelOffset(),
connIdxes.p() );
m_allanNNCTextureCoords = new cvf::Vec2fArray;
}
@@ -102,8 +94,9 @@ void RivFaultPartMgr::setCellVisibility( cvf::UByteArray* cellVisibilities )
{
m_nativeFaultGenerator->setCellVisibility( cellVisibilities );
m_oppositeFaultGenerator->setCellVisibility( cellVisibilities );
m_NNCGenerator->setCellVisibility( cellVisibilities, m_grid.p() );
m_allanNNCGenerator->setCellVisibility( cellVisibilities, m_grid.p() );
if ( m_NNCGenerator.notNull() ) m_NNCGenerator->setCellVisibility( cellVisibilities, m_grid.p() );
if ( m_allanNNCGenerator.notNull() ) m_allanNNCGenerator->setCellVisibility( cellVisibilities, m_grid.p() );
clearFlags();
}
@@ -280,7 +273,8 @@ void RivFaultPartMgr::generatePartGeometry()
bool useBufferObjects = true;
// Surface geometry
{
cvf::ref<cvf::DrawableGeo> geo = m_nativeFaultGenerator->generateSurface();
cvf::ref<cvf::DrawableGeo> geo =
m_nativeFaultGenerator->generateSurface( m_rimFaultCollection->onlyShowFacesWithDefinedNeighbor() );
if ( geo.notNull() )
{
geo->computeNormals();
@@ -333,7 +327,8 @@ void RivFaultPartMgr::generatePartGeometry()
// Surface geometry
{
cvf::ref<cvf::DrawableGeo> geo = m_oppositeFaultGenerator->generateSurface();
cvf::ref<cvf::DrawableGeo> geo =
m_oppositeFaultGenerator->generateSurface( m_rimFaultCollection->onlyShowFacesWithDefinedNeighbor() );
if ( geo.notNull() )
{
geo->computeNormals();
@@ -397,6 +392,20 @@ void RivFaultPartMgr::generatePartGeometry()
//--------------------------------------------------------------------------------------------------
void RivFaultPartMgr::generateNativeNncPartGeometry()
{
if ( m_NNCGenerator.isNull() )
{
auto nncConnectionIndices = m_rimFault->faultGeometry()->connectionIndices();
if ( !nncConnectionIndices.empty() )
{
m_NNCGenerator = new RivNNCGeometryGenerator( false,
m_grid->mainGrid()->nncData(),
m_grid->mainGrid()->displayModelOffset(),
nncConnectionIndices );
}
}
if ( m_NNCGenerator.isNull() ) return;
cvf::ref<cvf::DrawableGeo> geo = m_NNCGenerator->generateSurface();
if ( geo.notNull() )
{
@@ -432,6 +441,20 @@ void RivFaultPartMgr::generateNativeNncPartGeometry()
//--------------------------------------------------------------------------------------------------
void RivFaultPartMgr::generateAllNncPartGeometry()
{
if ( m_allanNNCGenerator.isNull() )
{
auto nncConnectionIndices = m_rimFault->faultGeometry()->connectionIndices();
if ( !nncConnectionIndices.empty() )
{
m_allanNNCGenerator = new RivNNCGeometryGenerator( true,
m_grid->mainGrid()->nncData(),
m_grid->mainGrid()->displayModelOffset(),
nncConnectionIndices );
}
}
if ( m_allanNNCGenerator.isNull() ) return;
cvf::ref<cvf::DrawableGeo> geo = m_allanNNCGenerator->generateSurface();
if ( geo.notNull() )
{

View File

@@ -37,6 +37,7 @@ class RimEclipseCellColors;
class RimCellEdgeColors;
class RimFaultInViewCollection;
class RigGridBase;
class RimFaultInViewCollection;
class RimFaultInView;
class RivFaultGeometryGenerator;

View File

@@ -31,10 +31,10 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivNNCGeometryGenerator::RivNNCGeometryGenerator( bool includeAllan,
RigNNCData* nncData,
const cvf::Vec3d& offset,
const cvf::Array<size_t>* nncIndexes )
RivNNCGeometryGenerator::RivNNCGeometryGenerator( bool includeAllan,
RigNNCData* nncData,
const cvf::Vec3d& offset,
const std::vector<size_t>& nncIndexes )
: m_includeAllanDiagramGeometry( includeAllan )
, m_nncData( nncData )
, m_nncIndexes( nncIndexes )
@@ -76,7 +76,7 @@ void RivNNCGeometryGenerator::computeArrays()
const cvf::Vec3f offset( m_offset );
long long numConnections =
static_cast<long long>( m_nncIndexes.isNull() ? m_nncData->connections().size() : m_nncIndexes->size() );
static_cast<long long>( m_nncIndexes.empty() ? m_nncData->allConnections().size() : m_nncIndexes.size() );
bool isVisibilityCalcActive = m_cellVisibility.notNull() && m_grid.notNull();
std::vector<RigCell>* allCells = nullptr;
@@ -88,14 +88,14 @@ void RivNNCGeometryGenerator::computeArrays()
#pragma omp parallel for ordered
for ( long long nIdx = 0; nIdx < numConnections; ++nIdx )
{
size_t conIdx = m_nncIndexes.isNull() ? nIdx : ( *m_nncIndexes )[nIdx];
size_t conIdx = m_nncIndexes.empty() ? nIdx : m_nncIndexes[nIdx];
if ( !m_includeAllanDiagramGeometry && conIdx >= m_nncData->nativeConnectionCount() )
if ( !m_includeAllanDiagramGeometry && conIdx >= m_nncData->eclipseConnectionCount() )
{
continue;
}
const RigConnection& conn = m_nncData->connections()[conIdx];
const RigConnection& conn = m_nncData->allConnections()[conIdx];
if ( conn.polygon().size() )
{

View File

@@ -42,10 +42,10 @@ class RigEclipseResultAddress;
class RivNNCGeometryGenerator : public cvf::Object
{
public:
RivNNCGeometryGenerator( bool includeAllan,
RigNNCData* nncData,
const cvf::Vec3d& offset,
const cvf::Array<size_t>* nncIndexes );
RivNNCGeometryGenerator( bool includeAllan,
RigNNCData* nncData,
const cvf::Vec3d& offset,
const std::vector<size_t>& nncIndexes );
~RivNNCGeometryGenerator() override;
@@ -70,11 +70,11 @@ private:
bool m_includeAllanDiagramGeometry;
// Input
cvf::ref<RigNNCData> m_nncData;
cvf::cref<cvf::Array<size_t>> m_nncIndexes;
cvf::cref<cvf::UByteArray> m_cellVisibility;
cvf::cref<RigGridBase> m_grid;
cvf::Vec3d m_offset;
cvf::ref<RigNNCData> m_nncData;
std::vector<size_t> m_nncIndexes;
cvf::cref<cvf::UByteArray> m_cellVisibility;
cvf::cref<RigGridBase> m_grid;
cvf::Vec3d m_offset;
// Triangles
cvf::ref<cvf::Vec3fArray> m_vertices;

View File

@@ -20,6 +20,7 @@
#include "RivReservoirFaultsPartMgr.h"
#include "RigMainGrid.h"
#include "RigNNCData.h"
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
@@ -118,8 +119,6 @@ void RivReservoirFaultsPartMgr::appendPartsToModel( cvf::ModelBasicList* model )
forceDisplayOfFault = true;
}
// qDebug() << forceDisplayOfFault;
cvf::ModelBasicList parts;
for ( size_t i = 0; i < faultCollection->faults.size(); i++ )
@@ -202,7 +201,7 @@ void RivReservoirFaultsPartMgr::appendPartsToModel( cvf::ModelBasicList* model )
if ( showNncs )
{
RigMainGrid* mainGrid = m_reservoirView->mainGrid();
mainGrid->nncData()->ensureConnectionDataIsProcessed();
mainGrid->nncData()->ensureAllConnectionDataIsProcessed();
if ( showCompleteNncGeo )
{

View File

@@ -37,6 +37,8 @@
#include "cvfModelBasicList.h"
#include "cvfPart.h"
#include <cmath>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -109,9 +109,11 @@ void RivWellSpheresPartMgr::appendDynamicGeometryPartsToModel( cvf::ModelBasicLi
}
}
cvf::ref<cvf::Part> part = createPart( centerColorPairs, wellResultFrame->m_isOpen );
model->addPart( part.p() );
if ( !centerColorPairs.empty() )
{
cvf::ref<cvf::Part> part = createPart( centerColorPairs, wellResultFrame->m_isOpen );
model->addPart( part.p() );
}
}
//--------------------------------------------------------------------------------------------------

View File

@@ -33,6 +33,7 @@
#include "cvfStructGrid.h"
#include <array>
#include <cmath>
//--------------------------------------------------------------------------------------------------
///

View File

@@ -39,6 +39,7 @@
#include "cafAppEnum.h"
#include "cafPdmFieldCvfColor.h"
#include "cafPdmFieldCvfMat4d.h"
#include "cafPdmUiCheckBoxEditor.h"
#include "cafPdmUiTreeOrdering.h"
namespace caf
@@ -65,31 +66,38 @@ RimFaultInViewCollection::RimFaultInViewCollection()
CAF_PDM_InitField( &showFaultCollection, "Active", true, "Active", "", "", "" );
showFaultCollection.uiCapability()->setUiHidden( true );
CAF_PDM_InitField( &showFaultFaces, "ShowFaultFaces", true, "Show Defined faces", "", "", "" );
CAF_PDM_InitField( &showOppositeFaultFaces, "ShowOppositeFaultFaces", true, "Show Opposite Faces", "", "", "" );
CAF_PDM_InitField( &m_showFaultsOutsideFilters, "ShowFaultsOutsideFilters", true, "Show Faults Outside Filters", "", "", "" );
CAF_PDM_InitField( &showFaultFaces, "ShowFaultFaces", true, "Show Defined faces" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &showFaultFaces );
CAF_PDM_InitField( &showOppositeFaultFaces, "ShowOppositeFaultFaces", true, "Show Opposite Faces" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &showOppositeFaultFaces );
CAF_PDM_InitField( &m_showFaultsOutsideFilters, "ShowFaultsOutsideFilters", true, "Show Faults Outside Filters" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_showFaultsOutsideFilters );
CAF_PDM_InitField( &m_onlyShowWithNeighbor, "OnlyShowWithDefNeighbor", false, "Only Show Faces With Defined Cell Neighbor" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_onlyShowWithNeighbor );
CAF_PDM_InitField( &faultResult,
"FaultFaceCulling",
caf::AppEnum<RimFaultInViewCollection::FaultFaceCullingMode>(
RimFaultInViewCollection::FAULT_BACK_FACE_CULLING ),
"Dynamic Face Selection",
"",
"",
"" );
"Dynamic Face Selection" );
CAF_PDM_InitField( &showFaultLabel, "ShowFaultLabel", false, "Show Labels" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &showFaultLabel );
CAF_PDM_InitField( &showFaultLabel, "ShowFaultLabel", false, "Show Labels", "", "", "" );
cvf::Color3f defWellLabelColor = RiaPreferences::current()->defaultWellLabelColor();
CAF_PDM_InitField( &faultLabelColor, "FaultLabelColor", defWellLabelColor, "Label Color", "", "", "" );
CAF_PDM_InitField( &showNNCs, "ShowNNCs", true, "Show NNCs", "", "", "" );
CAF_PDM_InitField( &showNNCs, "ShowNNCs", true, "Show NNCs" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &showNNCs );
CAF_PDM_InitField( &hideNncsWhenNoResultIsAvailable,
"HideNncsWhenNoResultIsAvailable",
true,
"Hide NNC Geometry if No NNC Result is Available",
"",
"",
"" );
"Hide NNC Geometry if No NNC Result is Available" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &hideNncsWhenNoResultIsAvailable );
CAF_PDM_InitFieldNoDefault( &faults, "Faults", "Faults", "", "", "" );
faults.uiCapability()->setUiTreeHidden( true );
@@ -127,10 +135,16 @@ void RimFaultInViewCollection::fieldChangedByUi( const caf::PdmFieldHandle* chan
parentView()->intersectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
}
if ( changedField == &m_onlyShowWithNeighbor )
{
parentView()->scheduleReservoirGridGeometryRegen();
}
if ( &showFaultFaces == changedField || &showOppositeFaultFaces == changedField ||
&showFaultCollection == changedField || &showFaultLabel == changedField ||
&m_showFaultsOutsideFilters == changedField || &faultLabelColor == changedField ||
&faultResult == changedField || &showNNCs == changedField || &hideNncsWhenNoResultIsAvailable == changedField )
&m_onlyShowWithNeighbor == changedField || &faultResult == changedField || &showNNCs == changedField ||
&hideNncsWhenNoResultIsAvailable == changedField )
{
parentView()->scheduleCreateDisplayModelAndRedraw();
parentView()->intersectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
@@ -286,6 +300,7 @@ void RimFaultInViewCollection::uiOrderingFaults( QString uiConfigName, caf::PdmU
ffviz->add( &showFaultFaces );
ffviz->add( &showOppositeFaultFaces );
ffviz->add( &faultResult );
ffviz->add( &m_onlyShowWithNeighbor );
caf::PdmUiGroup* nncViz = uiOrdering.addNewGroup( "NNC Visibility" );
nncViz->setCollapsedByDefault( true );
@@ -368,6 +383,14 @@ void RimFaultInViewCollection::setShowFaultsOutsideFilter( bool show )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimFaultInViewCollection::onlyShowFacesWithDefinedNeighbor() const
{
return m_onlyShowWithNeighbor;
}
//-------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFaultRASettings* RimFaultInViewCollection::faultRASettings() const
{
return m_faultRASettings();

View File

@@ -62,6 +62,8 @@ public:
bool isShowingFaultsAndFaultsOutsideFilters() const;
void setShowFaultsOutsideFilter( bool show );
bool onlyShowFacesWithDefinedNeighbor() const;
RimFaultRASettings* faultRASettings() const;
bool faultRAEnabled() const;
bool faultRAAdvancedEnabled() const;
@@ -95,6 +97,7 @@ private:
private:
caf::PdmField<bool> m_showFaultsOutsideFilters;
caf::PdmField<bool> m_onlyShowWithNeighbor;
caf::PdmChildField<RimFaultRASettings*> m_faultRASettings;
caf::PdmField<bool> m_enableFaultRA;

View File

@@ -50,10 +50,14 @@
#include "cafCmdFeature.h"
#include "cafCmdFeatureManager.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmFieldScriptingCapabilityCvfVec3d.h"
#include "cafPdmObjectScriptingCapability.h"
#include "cafPdmUiCheckBoxEditor.h"
#include "cafPdmUiDoubleSliderEditor.h"
#include "cafPdmUiListEditor.h"
#include "cafPdmUiPushButtonEditor.h"
#include "cafPdmUiSliderEditor.h"
#include "cafPdmUiTreeOrdering.h"
#include "cafPdmUiTreeSelectionEditor.h"
#include "cvfBoundingBox.h"
@@ -69,7 +73,7 @@ void caf::AppEnum<RimExtrudedCurveIntersection::CrossSectionEnum>::setUp()
addItem( RimExtrudedCurveIntersection::CrossSectionEnum::CS_SIMULATION_WELL, "CS_SIMULATION_WELL", "Simulation Well" );
addItem( RimExtrudedCurveIntersection::CrossSectionEnum::CS_POLYLINE, "CS_POLYLINE", "Polyline" );
addItem( RimExtrudedCurveIntersection::CrossSectionEnum::CS_AZIMUTHLINE, "CS_AZIMUTHLINE", "Azimuth and Dip" );
setDefault( RimExtrudedCurveIntersection::CrossSectionEnum::CS_WELL_PATH );
setDefault( RimExtrudedCurveIntersection::CrossSectionEnum::CS_POLYLINE );
}
template <>
@@ -83,7 +87,7 @@ void caf::AppEnum<RimExtrudedCurveIntersection::CrossSectionDirEnum>::setUp()
} // namespace caf
CAF_PDM_SOURCE_INIT( RimExtrudedCurveIntersection, "CrossSection" );
CAF_PDM_SOURCE_INIT( RimExtrudedCurveIntersection, "CurveIntersection", "CrossSection" );
//--------------------------------------------------------------------------------------------------
///
@@ -192,14 +196,19 @@ void RimExtrudedCurveIntersection::configureForAzimuthLine()
//--------------------------------------------------------------------------------------------------
RimExtrudedCurveIntersection::RimExtrudedCurveIntersection()
{
CAF_PDM_InitObject( "Intersection", ":/CrossSection16x16.png", "", "" );
CAF_PDM_InitField( &m_name, "UserDescription", QString( "Intersection Name" ), "Name", "", "", "" );
CAF_PDM_InitScriptableObject( "Intersection", ":/CrossSection16x16.png" );
CAF_PDM_InitScriptableFieldWithScriptKeyword( &m_name, "UserDescription", "Name", QString( "Intersection Name" ), "Name" );
CAF_PDM_InitFieldNoDefault( &m_type, "Type", "Type", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_direction, "Direction", "Direction", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_wellPath, "WellPath", "Well Path ", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_simulationWell, "SimulationWell", "Simulation Well", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_userPolylineXyz, "Points", "Points", "", "Use Ctrl-C for copy and Ctrl-V for paste", "" );
CAF_PDM_InitScriptableFieldNoDefault( &m_type, "Type", "Type" );
CAF_PDM_InitFieldNoDefault( &m_direction, "Direction", "Direction" );
CAF_PDM_InitScriptableFieldNoDefault( &m_wellPath, "WellPath", "Well Path " );
CAF_PDM_InitScriptableFieldNoDefault( &m_simulationWell, "SimulationWell", "Simulation Well" );
CAF_PDM_InitScriptableFieldNoDefault( &m_userPolylineXyz,
"Points",
"Points",
"",
"Use Ctrl-C for copy and Ctrl-V for paste",
"" );
CAF_PDM_InitFieldNoDefault( &m_userPolylineXydForUi, "PointsUi", "Points", "", "Use Ctrl-C for copy and Ctrl-V for paste", "" );
m_userPolylineXydForUi.registerSetMethod( this, &RimExtrudedCurveIntersection::setPointsFromXYD );

View File

@@ -35,17 +35,20 @@
#include "RivBoxIntersectionPartMgr.h"
#include "RivExtrudedCurveIntersectionPartMgr.h"
#include "cafPdmObjectScriptingCapability.h"
#include "cafPdmUiCheckBoxEditor.h"
#include "cafPdmUiDoubleSliderEditor.h"
#include "cafPdmUiTreeOrdering.h"
#include "cvfModelBasicList.h"
CAF_PDM_SOURCE_INIT( RimIntersectionCollection, "CrossSectionCollection" );
CAF_PDM_SOURCE_INIT( RimIntersectionCollection, "IntersectionCollection", "CrossSectionCollection" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimIntersectionCollection::RimIntersectionCollection()
{
CAF_PDM_InitObject( "Intersections", ":/CrossSections16x16.png", "", "" );
CAF_PDM_InitScriptableObject( "Intersections", ":/CrossSections16x16.png" );
CAF_PDM_InitFieldNoDefault( &m_intersections, "CrossSections", "Intersections", "", "", "" );
m_intersections.uiCapability()->setUiTreeHidden( true );
@@ -374,6 +377,14 @@ void RimIntersectionCollection::onChildDeleted( caf::PdmChildArrayFieldHandle*
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionCollection::onChildAdded( caf::PdmFieldHandle* containerForNewObject )
{
syncronize2dIntersectionViews();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -80,6 +80,8 @@ public:
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
void onChildAdded( caf::PdmFieldHandle* containerForNewObject ) override;
protected:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
caf::PdmFieldHandle* objectToggleField() override;

View File

@@ -35,6 +35,7 @@
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigMainGrid.h"
#include "RigNNCData.h"
#include "RigSimWellData.h"
#include "RigVirtualPerforationTransmissibilities.h"
#include "RigWellResultPoint.h"
@@ -711,7 +712,7 @@ bool RimEclipseCase::ensureNncDataIsComputed()
RigEclipseCaseData* rigEclipseCase = eclipseCaseData();
if ( rigEclipseCase && rigEclipseCase->mainGrid() )
{
computedData = rigEclipseCase->mainGrid()->nncData()->ensureConnectionDataIsProcessed();
computedData = rigEclipseCase->mainGrid()->nncData()->ensureAllConnectionDataIsProcessed();
}
return computedData;
@@ -1070,7 +1071,8 @@ double RimEclipseCase::characteristicCellSize() const
const RigEclipseCaseData* rigEclipseCase = eclipseCaseData();
if ( rigEclipseCase && rigEclipseCase->mainGrid() )
{
return rigEclipseCase->mainGrid()->characteristicIJCellSize();
double maxSize = 200.0;
return std::min( rigEclipseCase->mainGrid()->characteristicIJCellSize(), maxSize );
}
return 10.0;

View File

@@ -219,8 +219,10 @@ std::vector<double> RimEclipseContourMapProjection::generateResults( int timeSte
}
gridResultValues = calculateColumnResult( m_resultAggregation() );
}
else if ( !( cellColors->hasStaticResult() && timeStep > 0 ) )
else
{
if ( cellColors->hasStaticResult() && timeStep > 0 ) timeStep = 0;
m_currentResultName = cellColors->resultVariable();
RigEclipseResultAddress resAddr( cellColors->resultType(),
cellColors->resultVariable(),

View File

@@ -169,6 +169,14 @@ void RimEclipseContourMapView::initAfterRead()
scheduleCreateDisplayModelAndRedraw();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimEclipseContourMapView::isTimeStepDependentDataVisible() const
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -552,3 +560,12 @@ void RimEclipseContourMapView::onLegendConfigChanged( const caf::SignalEmitter*
m_contourMapProjection->clearGeometry();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSurfaceInViewCollection* RimEclipseContourMapView::surfaceInViewCollection() const
{
// Surfaces should not be shown in contour map.
return nullptr;
}

View File

@@ -40,6 +40,8 @@ public:
void setDefaultCustomName();
void updatePickPointAndRedraw();
RimSurfaceInViewCollection* surfaceInViewCollection() const override;
protected:
void initAfterRead() override;
void onCreateDisplayModel() override;
@@ -58,6 +60,8 @@ protected:
void onLoadDataAndUpdate() override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
bool isTimeStepDependentDataVisible() const override;
caf::PdmFieldHandle* userDescriptionField() override;
std::set<RivCellSetEnum> allVisibleFaultGeometryTypes() const override;

View File

@@ -597,9 +597,10 @@ void RimEclipseView::onCreateDisplayModel()
// Surfaces
m_surfaceVizModel->removeAllParts();
if ( m_surfaceCollection )
if ( surfaceInViewCollection() )
{
m_surfaceCollection->appendPartsToModel( m_surfaceVizModel.p(), m_reservoirGridPartManager->scaleTransform() );
surfaceInViewCollection()->appendPartsToModel( m_surfaceVizModel.p(),
m_reservoirGridPartManager->scaleTransform() );
nativeOrOverrideViewer()->addStaticModelOnce( m_surfaceVizModel.p(), isUsingOverrideViewer() );
}
@@ -912,7 +913,8 @@ void RimEclipseView::updateVisibleCellColors()
bool hasGeneralCellResult = this->cellResult()->hasResult() || this->cellResult()->isTernarySaturationSelected();
m_intersectionCollection->updateCellResultColor( hasGeneralCellResult, m_currentTimeStep );
if ( m_surfaceCollection ) m_surfaceCollection->updateCellResultColor( hasGeneralCellResult, m_currentTimeStep );
if ( surfaceInViewCollection() )
surfaceInViewCollection()->updateCellResultColor( hasGeneralCellResult, m_currentTimeStep );
}
//--------------------------------------------------------------------------------------------------
@@ -2291,9 +2293,9 @@ std::vector<RimLegendConfig*> RimEclipseView::legendConfigs() const
absLegends.push_back( wellMeasurement->legendConfig() );
}
if ( m_surfaceCollection )
if ( surfaceInViewCollection() )
{
for ( auto legendConfig : m_surfaceCollection->legendConfigs() )
for ( auto legendConfig : surfaceInViewCollection()->legendConfigs() )
{
absLegends.push_back( legendConfig );
}

View File

@@ -93,17 +93,17 @@ RimElementVectorResult::RimElementVectorResult()
m_vectorSurfaceCrossingLocation.uiCapability()->setUiReadOnly(
m_vectorView() == RimElementVectorResult::VectorView::CELL_CENTER_TOTAL );
CAF_PDM_InitField( &m_showVectorI, "ShowVectorI", true, "I", "", "", "" );
CAF_PDM_InitField( &m_showVectorJ, "ShowVectorJ", true, "J", "", "", "" );
CAF_PDM_InitField( &m_showVectorK, "ShowVectorK", true, "K", "", "", "" );
CAF_PDM_InitField( &m_showNncData, "ShowNncData", true, "Show NNC Data", "", "", "" );
CAF_PDM_InitField( &m_threshold, "Threshold", 0.0f, "Threshold", "", "", "" );
CAF_PDM_InitField( &m_showVectorI, "ShowVectorI", true, "I" );
CAF_PDM_InitField( &m_showVectorJ, "ShowVectorJ", true, "J" );
CAF_PDM_InitField( &m_showVectorK, "ShowVectorK", true, "K" );
CAF_PDM_InitField( &m_showNncData, "ShowNncData", true, "Show NNC Data" );
CAF_PDM_InitField( &m_threshold, "Threshold", 0.0, "Threshold" );
CAF_PDM_InitFieldNoDefault( &m_vectorColor, "VectorColor", "Color", "", "", "" );
cvf::Color3f defaultUniformColor = cvf::Color3f::BLACK;
CAF_PDM_InitField( &m_uniformVectorColor, "UniformVectorColor", defaultUniformColor, "Uniform Vector Color", "", "", "" );
CAF_PDM_InitField( &m_sizeScale, "SizeScale", 1.0f, "Size Scale", "", "", "" );
CAF_PDM_InitField( &m_sizeScale, "SizeScale", 1.0, "Size Scale" );
}
//--------------------------------------------------------------------------------------------------
@@ -209,7 +209,7 @@ RimElementVectorResult::VectorSurfaceCrossingLocation RimElementVectorResult::ve
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
float RimElementVectorResult::threshold() const
double RimElementVectorResult::threshold() const
{
return m_threshold();
}
@@ -217,7 +217,7 @@ float RimElementVectorResult::threshold() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
float RimElementVectorResult::sizeScale() const
double RimElementVectorResult::sizeScale() const
{
return m_sizeScale();
}
@@ -335,10 +335,12 @@ void RimElementVectorResult::mappingRange( double& min, double& max ) const
{
resultsData->minMaxCellScalarValues( resVarAddr, localMin, localMax );
}
else if ( m_legendConfig->rangeMode() == RimRegularLegendConfig::RangeModeType::AUTOMATIC_CURRENT_TIMESTEP )
else if ( m_legendConfig->rangeMode() == RimRegularLegendConfig::RangeModeType::AUTOMATIC_CURRENT_TIMESTEP ||
m_legendConfig->rangeMode() == RimRegularLegendConfig::RangeModeType::USER_DEFINED )
{
resultsData->minMaxCellScalarValues( resVarAddr, currentTimeStep, localMin, localMax );
}
if ( vectorView() == RimElementVectorResult::VectorView::CELL_CENTER_TOTAL )
{
aggregatedVectorMax += unitVectors.at( dir ) * localMax;
@@ -400,7 +402,8 @@ void RimElementVectorResult::mappingRange( double& min, double& max ) const
}
}
else if ( m_legendConfig->rangeMode() ==
RimRegularLegendConfig::RangeModeType::AUTOMATIC_CURRENT_TIMESTEP )
RimRegularLegendConfig::RangeModeType::AUTOMATIC_CURRENT_TIMESTEP ||
m_legendConfig->rangeMode() == RimRegularLegendConfig::RangeModeType::USER_DEFINED )
{
const std::vector<double>* nncResultVals =
nncData->dynamicConnectionScalarResult( combinedAddresses[flIdx],
@@ -444,9 +447,8 @@ void RimElementVectorResult::updateLegendRangesTextAndVisibility( RiuViewer* nat
double minResultValue;
double maxResultValue;
mappingRange( minResultValue, maxResultValue );
m_legendConfig->setAutomaticRanges( minResultValue, maxResultValue, minResultValue, maxResultValue );
m_legendConfig->setMappingMode( RimRegularLegendConfig::MappingType::LINEAR_CONTINUOUS );
m_legendConfig->setAutomaticRanges( minResultValue, maxResultValue, minResultValue, maxResultValue );
double posClosestToZero = HUGE_VAL;
double negClosestToZero = -HUGE_VAL;

View File

@@ -77,8 +77,8 @@ public:
bool showVectorK() const;
bool showNncData() const;
VectorSurfaceCrossingLocation vectorSuraceCrossingLocation() const;
float threshold() const;
float sizeScale() const;
double threshold() const;
double sizeScale() const;
TensorColors vectorColors() const;
const cvf::Color3f& getUniformVectorColor() const;
@@ -108,10 +108,10 @@ private:
caf::PdmField<bool> m_showVectorK;
caf::PdmField<bool> m_showNncData;
caf::PdmField<caf::AppEnum<VectorSurfaceCrossingLocation>> m_vectorSurfaceCrossingLocation;
caf::PdmField<float> m_threshold;
caf::PdmField<double> m_threshold;
caf::PdmField<caf::AppEnum<TensorColors>> m_vectorColor;
caf::PdmField<cvf::Color3f> m_uniformVectorColor;
caf::PdmField<float> m_sizeScale;
caf::PdmField<double> m_sizeScale;
caf::PdmField<RimRegularLegendConfig::RangeModeEnum> m_rangeMode;
caf::PdmChildField<RimRegularLegendConfig*> m_legendConfig;
};

View File

@@ -48,7 +48,7 @@ public:
cvf::ref<cvf::UByteArray> currentTotalCellVisibility();
RimIntersectionCollection* intersectionCollection() const;
RimSurfaceInViewCollection* surfaceInViewCollection() const;
virtual RimSurfaceInViewCollection* surfaceInViewCollection() const;
RimIntersectionResultsDefinitionCollection* separateIntersectionResultsCollection() const;
RimIntersectionResultsDefinitionCollection* separateSurfaceResultsCollection() const;
RimAnnotationInViewCollection* annotationCollection() const;

View File

@@ -179,10 +179,11 @@ RimObservedSummaryData*
if ( useSavedFieldsValuesInDialog )
{
caf::PdmSettings::readFieldsFromApplicationStore( parseOptions );
caf::PdmSettings::readFieldsFromApplicationStore( parseOptions, parseOptions->contextString() );
}
parseOptions->setUiModeImport( fileName );
bool parseOptionsChanged = false;
if ( parseOptions->uiModeImport() != RicPasteAsciiDataToSummaryPlotFeatureUi::UI_MODE_SILENT )
{
caf::PdmUiPropertyViewDialog propertyDialog( nullptr, parseOptions, "CSV Import Options", "" );
@@ -190,9 +191,14 @@ RimObservedSummaryData*
{
return nullptr;
}
parseOptionsChanged = true;
}
caf::PdmSettings::writeFieldsToApplicationStore( parseOptions );
if ( useSavedFieldsValuesInDialog && parseOptionsChanged )
{
caf::PdmSettings::writeFieldsToApplicationStore( parseOptions, parseOptions->contextString() );
}
// userData->setParseOptions(parseOptionsUi.parseOptions());
userData->setSummaryHeaderFileName( fileName );

View File

@@ -22,6 +22,7 @@
#include "cafUtils.h"
#include "opm/parser/eclipse/Parser/Parser.hpp"
#include "opm/parser/eclipse/Parser/ParserKeywords/V.hpp"
//--------------------------------------------------------------------------------------------------
///
@@ -38,12 +39,22 @@ std::vector<Opm::VFPInjTable> RimVfpTableExtractor::extractVfpInjectionTables( c
std::string myKeyword = "VFPINJ";
auto keywordList = deck.getKeywordList( myKeyword );
Opm::UnitSystem unitSystem;
for ( auto kw : keywordList )
{
auto name = kw->name();
Opm::UnitSystem unitSystem;
{
const auto& header = kw->getRecord( 0 );
if ( header.getItem<Opm::ParserKeywords::VFPINJ::UNITS>().hasValue( 0 ) )
{
std::string units_string;
units_string = header.getItem<Opm::ParserKeywords::VFPINJ::UNITS>().get<std::string>( 0 );
unitSystem = Opm::UnitSystem( units_string );
}
}
Opm::VFPInjTable table( *kw, unitSystem );
tables.push_back( table );
}
@@ -70,12 +81,22 @@ std::vector<Opm::VFPProdTable> RimVfpTableExtractor::extractVfpProductionTables(
std::string myKeyword = "VFPPROD";
auto keywordList = deck.getKeywordList( myKeyword );
Opm::UnitSystem unitSystem;
for ( auto kw : keywordList )
{
auto name = kw->name();
Opm::UnitSystem unitSystem;
{
const auto& header = kw->getRecord( 0 );
if ( header.getItem<Opm::ParserKeywords::VFPPROD::UNITS>().hasValue( 0 ) )
{
std::string units_string;
units_string = header.getItem<Opm::ParserKeywords::VFPPROD::UNITS>().get<std::string>( 0 );
unitSystem = Opm::UnitSystem( units_string );
}
}
Opm::VFPProdTable table( *kw, unitSystem );
tables.push_back( table );
}

View File

@@ -24,6 +24,8 @@
#include "RimStreamline.h"
#include "RimStreamlineDataAccess.h"
#include <cmath>
//--------------------------------------------------------------------------------------------------
/// Helper class for prioritizing streamline seed points
//--------------------------------------------------------------------------------------------------

View File

@@ -18,21 +18,29 @@
#include "RimFileSummaryCase.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "RicfCommandObject.h"
#include "RifEclipseSummaryTools.h"
#include "RifMultipleSummaryReaders.h"
#include "RifOpmCommonSummary.h"
#include "RifProjectSummaryDataWriter.h"
#include "RifReaderEclipseRft.h"
#include "RifReaderEclipseSummary.h"
#include "RifSummaryReaderMultipleFiles.h"
#include "RimProject.h"
#include "RimTools.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmObjectScriptingCapability.h"
#include "cafPdmUiFilePathEditor.h"
#include <QDir>
#include <QFileInfo>
#include <QUuid>
//==================================================================================================
//
@@ -47,9 +55,13 @@ CAF_PDM_SOURCE_INIT( RimFileSummaryCase, "FileSummaryCase" );
RimFileSummaryCase::RimFileSummaryCase()
{
CAF_PDM_InitScriptableObject( "File Summary Case ", ":/SummaryCases16x16.png", "", "A Summary Case based on SMSPEC files" );
CAF_PDM_InitScriptableField( &m_includeRestartFiles, "IncludeRestartFiles", false, "Include Restart Files", "", "", "" );
CAF_PDM_InitScriptableField( &m_includeRestartFiles, "IncludeRestartFiles", false, "Include Restart Files" );
m_includeRestartFiles.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_additionalSummaryFilePath,
"AdditionalSummaryFilePath",
"Additional File Path (set invisible when ready)" );
m_additionalSummaryFilePath.uiCapability()->setUiHidden( true );
}
//--------------------------------------------------------------------------------------------------
@@ -91,9 +103,14 @@ void RimFileSummaryCase::updateFilePathsFromProjectPath( const QString& newProje
//--------------------------------------------------------------------------------------------------
void RimFileSummaryCase::createSummaryReaderInterfaceThreadSafe( RiaThreadSafeLogger* threadSafeLogger )
{
m_summaryFileReader = RimFileSummaryCase::findRelatedFilesAndCreateReader( this->summaryHeaderFilename(),
m_fileSummaryReader = RimFileSummaryCase::findRelatedFilesAndCreateReader( this->summaryHeaderFilename(),
m_includeRestartFiles,
threadSafeLogger );
m_multiSummaryReader = new RifMultipleSummaryReaders;
m_multiSummaryReader->addReader( m_fileSummaryReader.p() );
openAndAttachAdditionalReader();
}
//--------------------------------------------------------------------------------------------------
@@ -102,9 +119,13 @@ void RimFileSummaryCase::createSummaryReaderInterfaceThreadSafe( RiaThreadSafeLo
void RimFileSummaryCase::createSummaryReaderInterface()
{
RiaThreadSafeLogger threadSafeLogger;
m_summaryFileReader = RimFileSummaryCase::findRelatedFilesAndCreateReader( this->summaryHeaderFilename(),
m_fileSummaryReader = RimFileSummaryCase::findRelatedFilesAndCreateReader( this->summaryHeaderFilename(),
m_includeRestartFiles,
&threadSafeLogger );
m_multiSummaryReader = new RifMultipleSummaryReaders;
m_multiSummaryReader->addReader( m_fileSummaryReader.p() );
openAndAttachAdditionalReader();
auto messages = threadSafeLogger.messages();
for ( const auto& m : messages )
@@ -190,16 +211,52 @@ RifReaderEclipseRft* RimFileSummaryCase::findRftDataAndCreateReader( const QStri
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFileSummaryCase::defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute )
{
if ( field == &m_additionalSummaryFilePath )
{
caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>( attribute );
if ( myAttr )
{
myAttr->m_selectSaveFileName = true;
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFileSummaryCase::openAndAttachAdditionalReader()
{
QString additionalSummaryFilePath = m_additionalSummaryFilePath().path();
cvf::ref<RifOpmCommonEclipseSummary> opmCommonReader = new RifOpmCommonEclipseSummary;
opmCommonReader->useEnhancedSummaryFiles( true );
bool includeRestartFiles = false;
auto isValid = opmCommonReader->open( additionalSummaryFilePath, includeRestartFiles, nullptr );
if ( isValid )
{
m_multiSummaryReader->addReader( opmCommonReader.p() );
m_additionalSummaryFileReader = opmCommonReader;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifSummaryReaderInterface* RimFileSummaryCase::summaryReader()
{
if ( m_summaryFileReader.isNull() )
if ( m_multiSummaryReader.isNull() )
{
createSummaryReaderInterface();
}
return m_summaryFileReader.p();
return m_multiSummaryReader.p();
}
//--------------------------------------------------------------------------------------------------
@@ -221,3 +278,136 @@ void RimFileSummaryCase::setIncludeRestartFiles( bool includeRestartFiles )
{
m_includeRestartFiles = includeRestartFiles;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFileSummaryCase::setSummaryData( const std::string& keyword, const std::string& unit, const std::vector<float>& values )
{
size_t mainSummaryFileValueCount = m_fileSummaryReader->timeSteps( RifEclipseSummaryAddress() ).size();
if ( values.size() != mainSummaryFileValueCount )
{
QString txt = QString( "Wrong size of summary data for keyword %1. Expected %2 values, received %3 values" )
.arg( QString::fromStdString( keyword ) )
.arg( mainSummaryFileValueCount )
.arg( values.size() );
RiaLogging::error( txt );
return;
}
// Remove existing reader to be able to write to the summary file
m_multiSummaryReader->removeReader( m_additionalSummaryFileReader.p() );
m_additionalSummaryFileReader = nullptr;
RifProjectSummaryDataWriter projectSummaryDataWriter;
QString tmpAdditionalSummaryFilePath = m_additionalSummaryFilePath().path();
QFileInfo fi( tmpAdditionalSummaryFilePath );
if ( fi.exists() )
{
projectSummaryDataWriter.importFromProjectSummaryFile( tmpAdditionalSummaryFilePath.toStdString() );
}
else
{
projectSummaryDataWriter.importFromSourceSummaryReader( m_fileSummaryReader.p() );
auto tempFilePath = additionalSummaryDataFilePath();
m_additionalSummaryFilePath = tempFilePath;
tmpAdditionalSummaryFilePath = tempFilePath;
}
projectSummaryDataWriter.setData( { keyword }, { unit }, { values } );
std::string outputFilePath = tmpAdditionalSummaryFilePath.toStdString();
projectSummaryDataWriter.writeDataToFile( outputFilePath );
for ( const auto& txt : projectSummaryDataWriter.errorMessages() )
{
RiaLogging::error( QString::fromStdString( txt ) );
}
projectSummaryDataWriter.clearErrorMessages();
openAndAttachAdditionalReader();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFileSummaryCase::onProjectBeingSaved()
{
// If additional data is stored in temp folder, copy to project folder and remove file in temp folder
auto existingFilePath = m_additionalSummaryFilePath().path();
if ( QFile::exists( existingFilePath ) )
{
auto currentFilePath = additionalSummaryDataFilePath();
if ( existingFilePath != currentFilePath )
{
if ( QFile::copy( existingFilePath, currentFilePath ) )
{
QFile::remove( existingFilePath );
m_additionalSummaryFilePath = currentFilePath;
openAndAttachAdditionalReader();
}
else
{
QString txt = "Error when copying temporary file to " + currentFilePath;
RiaLogging::error( txt );
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFileSummaryCase::createAdditionalSummaryFileName()
{
QUuid uuid = QUuid::createUuid();
QString uuidString = uuid.toString();
uuidString.remove( '{' ).remove( '}' );
auto filePath = "RI_SUMMARY_DATA_" + uuidString + ".ESMRY";
return filePath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFileSummaryCase::additionalSummaryDataFilePath() const
{
QDir storageDir;
RiaApplication* app = RiaApplication::instance();
if ( app->isProjectSavedToDisc() )
{
QString projectFileName = RimProject::current()->fileName();
QFileInfo fileInfo( projectFileName );
storageDir = fileInfo.dir();
}
else
{
// If project is not saved, use the temp folder
storageDir = QDir::temp();
}
QString fileName;
auto cacheSummaryFilePath = m_additionalSummaryFilePath().path();
if ( cacheSummaryFilePath.isEmpty() )
{
fileName = createAdditionalSummaryFileName();
}
else
{
QFileInfo fi( cacheSummaryFilePath );
fileName = fi.fileName();
}
auto filePath = storageDir.absoluteFilePath( fileName );
return filePath;
}

View File

@@ -26,6 +26,9 @@ class RifReaderRftInterface;
class RifReaderEclipseRft;
class RifReaderEclipseSummary;
class RiaThreadSafeLogger;
class RifOpmCommonEclipseSummary;
class RifEclipseSummaryAddress;
class RifMultipleSummaryReaders;
//==================================================================================================
//
@@ -52,14 +55,31 @@ public:
void setIncludeRestartFiles( bool includeRestartFiles );
void setSummaryData( const std::string& keyword, const std::string& unit, const std::vector<float>& values );
void onProjectBeingSaved();
static RifSummaryReaderInterface* findRelatedFilesAndCreateReader( const QString& headerFileName,
bool includeRestartFiles,
RiaThreadSafeLogger* threadSafeLogger );
static RifReaderEclipseRft* findRftDataAndCreateReader( const QString& headerFileName );
protected:
void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
private:
cvf::ref<RifSummaryReaderInterface> m_summaryFileReader;
void openAndAttachAdditionalReader();
QString additionalSummaryDataFilePath() const;
static QString createAdditionalSummaryFileName();
private:
cvf::ref<RifSummaryReaderInterface> m_fileSummaryReader;
cvf::ref<RifMultipleSummaryReaders> m_multiSummaryReader;
cvf::ref<RifReaderEclipseRft> m_summaryEclipseRftReader;
caf::PdmField<bool> m_includeRestartFiles;
caf::PdmField<caf::FilePath> m_additionalSummaryFilePath;
cvf::ref<RifOpmCommonEclipseSummary> m_additionalSummaryFileReader;
};

View File

@@ -625,13 +625,12 @@ std::vector<RimSummaryCase*> RimSummaryCaseMainCollection::createSummaryCasesFro
{
const QString& smspecFileName = fileInfo.summaryFileName();
bool foundDataFile = RiaEclipseFileNameTools::isSummaryDataFilePresent( smspecFileName );
if ( foundDataFile )
if ( !smspecFileName.isEmpty() )
{
RimFileSummaryCase* newSumCase = new RimFileSummaryCase();
auto newSumCase = new RimFileSummaryCase();
newSumCase->setIncludeRestartFiles( fileInfo.includeRestartFiles() );
newSumCase->setSummaryHeaderFileName( fileInfo.summaryFileName() );
newSumCase->setSummaryHeaderFileName( smspecFileName );
newSumCase->updateOptionSensitivity();
project->assignCaseIdToSummaryCase( newSumCase );
@@ -739,3 +738,19 @@ void RimSummaryCaseMainCollection::updateAutoShortName()
s->updateAutoShortName();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCaseMainCollection::onProjectBeingSaved()
{
auto sumCases = allSummaryCases();
for ( auto s : sumCases )
{
auto fileSumCase = dynamic_cast<RimFileSummaryCase*>( s );
if ( fileSumCase )
{
fileSumCase->onProjectBeingSaved();
}
}
}

View File

@@ -73,6 +73,7 @@ public:
void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath );
void updateAutoShortName();
void onProjectBeingSaved();
private:
static void loadSummaryCaseData( std::vector<RimSummaryCase*> summaryCases );

View File

@@ -47,6 +47,8 @@
#include "cafPdmUiFilePathEditor.h"
#include "cafPdmUiTableViewEditor.h"
#include "cvfMath.h"
#include <QDebug>
#include <QFileInfo>
@@ -326,9 +328,9 @@ QString RimWellIASettings::outputOdbFilename() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellIASettings::outputHeatOdbFilename() const
QString RimWellIASettings::outputDrillingOdbFilename() const
{
return m_baseDir() + "/" + name() + "_heat.odb";
return m_baseDir() + "/" + name() + "_drilling.odb";
}
//--------------------------------------------------------------------------------------------------
@@ -495,8 +497,8 @@ bool RimWellIASettings::updateResInsightParameters()
auto angles = RigWellPathGeometryTools::calculateAzimuthAndInclinationAtMd( ( m_startMD + m_endMD ) / 2.0,
wellPath()->wellPathGeometry() );
initialStress->addParameter( "azimuth_well", angles.first );
initialStress->addParameter( "inclination_well", angles.second );
initialStress->addParameter( "azimuth_well", cvf::Math::toDegrees( angles.first ) );
initialStress->addParameter( "inclination_well", cvf::Math::toDegrees( angles.second ) );
m_parametersRI.push_back( initialStress );

View File

@@ -63,7 +63,7 @@ public:
void setOutputBaseDirectory( QString baseDir );
QString outputBaseDirectory() const;
QString outputOdbFilename() const;
QString outputHeatOdbFilename() const;
QString outputDrillingOdbFilename() const;
bool showBox() const;
void setShowBox( bool show );

View File

@@ -20,6 +20,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RimcModeledWellPath.h
${CMAKE_CURRENT_LIST_DIR}/RimcWellPath.h
${CMAKE_CURRENT_LIST_DIR}/RimcFractureTemplateCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimcIntersection.h
)
set(SOURCE_GROUP_SOURCE_FILES
@@ -44,6 +45,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RimcModeledWellPath.cpp
${CMAKE_CURRENT_LIST_DIR}/RimcWellPath.cpp
${CMAKE_CURRENT_LIST_DIR}/RimcFractureTemplateCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimcIntersection.cpp
)
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})

View File

@@ -32,3 +32,14 @@ RimcDataContainerDouble::RimcDataContainerDouble()
CAF_PDM_InitScriptableObject( "Data Container Float", "", "", "" );
CAF_PDM_InitScriptableFieldNoDefault( &m_doubleValues, "values", "Float Values", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimcDataContainerDouble* RimcDataContainerDouble::create( const std::vector<double>& values )
{
auto obj = new RimcDataContainerDouble;
obj->m_doubleValues = values;
return obj;
}

View File

@@ -31,5 +31,7 @@ class RimcDataContainerDouble : public caf::PdmObject
public:
RimcDataContainerDouble();
static RimcDataContainerDouble* create( const std::vector<double>& values );
caf::PdmField<std::vector<double>> m_doubleValues;
};

View File

@@ -37,7 +37,7 @@ RimcElasticProperties_addPropertyScaling::RimcElasticProperties_addPropertyScali
CAF_PDM_InitScriptableFieldNoDefault( &m_formation, "Formation", "", "", "", "Formation" );
CAF_PDM_InitScriptableFieldNoDefault( &m_facies, "Facies", "", "", "", "Facies" );
CAF_PDM_InitScriptableFieldNoDefault( &m_property, "Property", "", "", "", "Property" );
CAF_PDM_InitScriptableFieldNoDefault( &m_scale, "Scale", "", "", "", "Scale" );
CAF_PDM_InitScriptableField( &m_scale, "Scale", 1.0, "", "", "", "Scale" );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -0,0 +1,365 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022- 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 "RimcIntersection.h"
#include "RiaLogging.h"
#include "RigResultAccessor.h"
#include "RigResultAccessorFactory.h"
#include "Rim2dIntersectionView.h"
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseResultDefinition.h"
#include "RimEclipseView.h"
#include "RimExtrudedCurveIntersection.h"
#include "RimIntersectionResultDefinition.h"
#include "RimcDataContainerDouble.h"
#include "RivExtrudedCurveIntersectionGeometryGenerator.h"
#include "RivExtrudedCurveIntersectionPartMgr.h"
#include "RivIntersectionGeometryGeneratorInterface.h"
#include "RivIntersectionHexGridInterface.h"
#include "cafPdmAbstractFieldScriptingCapability.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmFieldScriptingCapabilityCvfVec3d.h"
#include "cafPdmObjectScriptingCapability.h"
#include <memory>
namespace caf
{
template <>
void caf::AppEnum<RimcTriangleGeometry::GeometryType>::setUp()
{
addItem( RimcTriangleGeometry::GeometryType::FULL_3D, "FULL_3D", "Full 3DDynamic" );
addItem( RimcTriangleGeometry::GeometryType::PROJECTED_TO_PLANE, "PROJECTED_TO_PLANE", "Projected To Plane" );
setDefault( RimcTriangleGeometry::GeometryType::FULL_3D );
}
}; // namespace caf
CAF_PDM_SOURCE_INIT( RimcTriangleGeometry, "TriangleGeometry" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimcTriangleGeometry::RimcTriangleGeometry()
{
CAF_PDM_InitScriptableObject( "Triangle Geometry" );
CAF_PDM_InitScriptableFieldNoDefault( &m_x, "XCoords", "X coords" );
CAF_PDM_InitScriptableFieldNoDefault( &m_y, "YCoords", "Y coords" );
CAF_PDM_InitScriptableFieldNoDefault( &m_z, "ZCoords", "Z coords" );
CAF_PDM_InitScriptableFieldNoDefault( &m_connections, "Connections", "Indices to triangle vertices" );
CAF_PDM_InitScriptableFieldNoDefault( &m_meshX, "MeshXCoords", "Mesh X coords" );
CAF_PDM_InitScriptableFieldNoDefault( &m_meshY, "MeshYCoords", "Mesh Y coords" );
CAF_PDM_InitScriptableFieldNoDefault( &m_meshZ, "MeshZCoords", "Mesh Z coords" );
CAF_PDM_InitScriptableFieldNoDefault( &m_faultMeshX, "FaultMeshXCoords", "Fault Mesh X coords" );
CAF_PDM_InitScriptableFieldNoDefault( &m_faultMeshY, "FaultMeshYCoords", "Fault Mesh Y coords" );
CAF_PDM_InitScriptableFieldNoDefault( &m_faultMeshZ, "FaultMeshZCoords", "Fault Mesh Z coords" );
CAF_PDM_InitScriptableFieldNoDefault( &m_displayModelOffset, "DisplayModelOffset", "Display Model Offset" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimcTriangleGeometry* RimcTriangleGeometry::createFromVertices( const std::vector<cvf::Vec3f>& vertices )
{
std::vector<int> conn;
if ( !vertices.empty() )
{
conn.resize( vertices.size() );
std::iota( conn.begin(), conn.end(), 0 );
}
return createFromVerticesAndConnections( vertices, conn );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimcTriangleGeometry* RimcTriangleGeometry::createFromVerticesAndConnections( const std::vector<cvf::Vec3f>& vertices,
const std::vector<int>& connections )
{
auto [xVals, yVals, zVals] = assignCoordinatesToSeparateVectors( vertices );
auto obj = new RimcTriangleGeometry;
obj->m_x = xVals;
obj->m_y = yVals;
obj->m_z = zVals;
obj->m_connections = connections;
return obj;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimcTriangleGeometry::setMeshVertices( const std::vector<cvf::Vec3f>& vertices )
{
auto [xVals, yVals, zVals] = assignCoordinatesToSeparateVectors( vertices );
m_meshX = xVals;
m_meshY = yVals;
m_meshZ = zVals;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimcTriangleGeometry::setFaultMeshVertices( const std::vector<cvf::Vec3f>& faultMeshVertices )
{
auto [xVals, yVals, zVals] = assignCoordinatesToSeparateVectors( faultMeshVertices );
m_faultMeshX = xVals;
m_faultMeshY = yVals;
m_faultMeshZ = zVals;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimcTriangleGeometry::setDisplayModelOffset( const cvf::Vec3d& offset )
{
m_displayModelOffset = offset;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::tuple<std::vector<float>, std::vector<float>, std::vector<float>>
RimcTriangleGeometry::assignCoordinatesToSeparateVectors( const std::vector<cvf::Vec3f>& vertices )
{
std::vector<float> xVals;
std::vector<float> yVals;
std::vector<float> zVals;
if ( !vertices.empty() )
{
xVals.reserve( vertices.size() );
yVals.reserve( vertices.size() );
zVals.reserve( vertices.size() );
for ( const auto& v : vertices )
{
xVals.push_back( v.x() );
yVals.push_back( v.y() );
zVals.push_back( v.z() );
}
}
return { xVals, yVals, zVals };
}
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimExtrudedCurveIntersection, RimcExtrudedCurveIntersection_geometry, "geometry" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimcExtrudedCurveIntersection_geometry::RimcExtrudedCurveIntersection_geometry( caf::PdmObjectHandle* self )
: caf::PdmObjectMethod( self )
{
CAF_PDM_InitObject( "Intersection Geometry" );
CAF_PDM_InitScriptableFieldNoDefault( &m_geometryType, "GeometryType", "Geometry Type" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmObjectHandle* RimcExtrudedCurveIntersection_geometry::execute()
{
auto intersection = self<RimExtrudedCurveIntersection>();
auto geoGenerator = RimcExtrudedCurveIntersection_geometry::createGeometryGenerator( intersection, m_geometryType() );
if ( geoGenerator && geoGenerator->isAnyGeometryPresent() )
{
std::vector<cvf::Vec3f> coords;
geoGenerator->triangleVxes()->toStdVector( &coords );
auto triangleGeometry = RimcTriangleGeometry::createFromVertices( coords );
{
auto cellMeshVertices = geoGenerator->cellMeshVxes();
if ( cellMeshVertices )
{
std::vector<cvf::Vec3f> meshCoords;
cellMeshVertices->toStdVector( &meshCoords );
triangleGeometry->setMeshVertices( meshCoords );
}
}
{
auto faultMeshVertices = geoGenerator->faultMeshVxes();
if ( faultMeshVertices )
{
std::vector<cvf::Vec3f> meshCoords;
faultMeshVertices->toStdVector( &meshCoords );
triangleGeometry->setFaultMeshVertices( meshCoords );
}
}
{
RimEclipseView* eclView = nullptr;
intersection->firstAncestorOfType( eclView );
if ( eclView && eclView->eclipseCase() )
{
auto offset = eclView->eclipseCase()->displayModelOffset();
triangleGeometry->setDisplayModelOffset( offset );
}
}
return triangleGeometry;
}
return new RimcTriangleGeometry;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimcExtrudedCurveIntersection_geometry::resultIsPersistent() const
{
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::unique_ptr<caf::PdmObjectHandle> RimcExtrudedCurveIntersection_geometry::defaultResult() const
{
return std::unique_ptr<caf::PdmObjectHandle>( new RimcTriangleGeometry );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::unique_ptr<RivIntersectionGeometryGeneratorInterface>
RimcExtrudedCurveIntersection_geometry::createGeometryGenerator( RimExtrudedCurveIntersection* intersection,
RimcTriangleGeometry::GeometryType geometryType )
{
bool isFlat = false;
if ( geometryType == RimcTriangleGeometry::GeometryType::PROJECTED_TO_PLANE ) isFlat = true;
cvf::Vec3d flattenedPolylineStartPoint;
auto polyLines = intersection->polyLines( &flattenedPolylineStartPoint );
if ( !polyLines.empty() )
{
auto direction = intersection->extrusionDirection();
auto hexGrid = intersection->createHexGridInterface();
auto intersectionGeoGenerator =
std::make_unique<RivExtrudedCurveIntersectionGeometryGenerator>( intersection,
polyLines,
direction,
hexGrid.p(),
isFlat,
flattenedPolylineStartPoint );
intersectionGeoGenerator->ensureGeometryIsCalculated();
return intersectionGeoGenerator;
}
return nullptr;
}
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimExtrudedCurveIntersection,
RimcExtrudedCurveIntersection_geometryResult,
"geometryResult" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimcExtrudedCurveIntersection_geometryResult::RimcExtrudedCurveIntersection_geometryResult( caf::PdmObjectHandle* self )
: caf::PdmObjectMethod( self )
{
CAF_PDM_InitObject( "Geometry Result" );
CAF_PDM_InitScriptableFieldNoDefault( &m_geometryType, "GeometryType", "Geometry Type" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmObjectHandle* RimcExtrudedCurveIntersection_geometryResult::execute()
{
auto intersection = self<RimExtrudedCurveIntersection>();
auto geoGenerator = RimcExtrudedCurveIntersection_geometry::createGeometryGenerator( intersection, m_geometryType() );
if ( geoGenerator && geoGenerator->isAnyGeometryPresent() )
{
RimEclipseView* eclView = nullptr;
intersection->firstAncestorOfType( eclView );
if ( !eclView )
{
RiaLogging::error( "No Eclipse view found. Extraction of intersection result is only supported for "
"Eclipse view." );
return nullptr;
}
RimEclipseResultDefinition* eclResultDef = nullptr;
auto intersectionResultDef = intersection->activeSeparateResultDefinition();
if ( intersectionResultDef ) eclResultDef = intersectionResultDef->eclipseResultDefinition();
if ( !eclResultDef ) eclResultDef = eclView->cellResult();
RigEclipseCaseData* eclipseCase = eclView->eclipseCase()->eclipseCaseData();
size_t gridIndex = 0;
cvf::ref<RigResultAccessor> resultAccessor =
RigResultAccessorFactory::createFromResultDefinition( eclipseCase,
gridIndex,
eclView->currentTimeStep(),
eclResultDef );
auto triToCellIndex = geoGenerator->triangleToCellIndex();
std::vector<double> values;
values.reserve( triToCellIndex.size() );
for ( const auto& i : triToCellIndex )
{
auto value = resultAccessor->cellScalar( i );
values.push_back( value );
}
return RimcDataContainerDouble::create( values );
}
return new RimcDataContainerDouble();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimcExtrudedCurveIntersection_geometryResult::resultIsPersistent() const
{
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::unique_ptr<caf::PdmObjectHandle> RimcExtrudedCurveIntersection_geometryResult::defaultResult() const
{
return std::unique_ptr<caf::PdmObjectHandle>( new RimcDataContainerDouble );
}

View File

@@ -0,0 +1,117 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022- 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 "cafPdmField.h"
#include "cafPdmObjectHandle.h"
#include "cafPdmObjectMethod.h"
#include "cafPdmPtrField.h"
#include <QString>
#include "cvfVector3.h"
class RivIntersectionGeometryGeneratorInterface;
class RimExtrudedCurveIntersection;
//==================================================================================================
///
//==================================================================================================
class RimcTriangleGeometry : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
enum class GeometryType
{
FULL_3D,
PROJECTED_TO_PLANE,
};
public:
RimcTriangleGeometry();
static RimcTriangleGeometry* createFromVertices( const std::vector<cvf::Vec3f>& vertices );
static RimcTriangleGeometry* createFromVerticesAndConnections( const std::vector<cvf::Vec3f>& vertices,
const std::vector<int>& connections );
void setMeshVertices( const std::vector<cvf::Vec3f>& meshVertices );
void setFaultMeshVertices( const std::vector<cvf::Vec3f>& faultMeshVertices );
void setDisplayModelOffset( const cvf::Vec3d& offset );
private:
static std::tuple<std::vector<float>, std::vector<float>, std::vector<float>>
assignCoordinatesToSeparateVectors( const std::vector<cvf::Vec3f>& vertices );
private:
caf::PdmField<std::vector<float>> m_x;
caf::PdmField<std::vector<float>> m_y;
caf::PdmField<std::vector<float>> m_z;
caf::PdmField<std::vector<int>> m_connections;
caf::PdmField<std::vector<float>> m_meshX;
caf::PdmField<std::vector<float>> m_meshY;
caf::PdmField<std::vector<float>> m_meshZ;
caf::PdmField<std::vector<float>> m_faultMeshX;
caf::PdmField<std::vector<float>> m_faultMeshY;
caf::PdmField<std::vector<float>> m_faultMeshZ;
caf::PdmField<cvf::Vec3d> m_displayModelOffset;
};
//==================================================================================================
///
//==================================================================================================
class RimcExtrudedCurveIntersection_geometry : public caf::PdmObjectMethod
{
CAF_PDM_HEADER_INIT;
public:
RimcExtrudedCurveIntersection_geometry( caf::PdmObjectHandle* self );
caf::PdmObjectHandle* execute() override;
bool resultIsPersistent() const override;
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
static std::unique_ptr<RivIntersectionGeometryGeneratorInterface>
createGeometryGenerator( RimExtrudedCurveIntersection* intersection,
RimcTriangleGeometry::GeometryType geometryType );
private:
caf::PdmField<caf::AppEnum<RimcTriangleGeometry::GeometryType>> m_geometryType;
};
//==================================================================================================
///
//==================================================================================================
class RimcExtrudedCurveIntersection_geometryResult : public caf::PdmObjectMethod
{
CAF_PDM_HEADER_INIT;
public:
RimcExtrudedCurveIntersection_geometryResult( caf::PdmObjectHandle* self );
caf::PdmObjectHandle* execute() override;
bool resultIsPersistent() const override;
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
private:
caf::PdmField<caf::AppEnum<RimcTriangleGeometry::GeometryType>> m_geometryType;
};

View File

@@ -43,7 +43,7 @@ RimcStimPlanModelTemplateCollection_appendStimPlanModelTemplate::RimcStimPlanMod
{
CAF_PDM_InitObject( "Create StimPlan Model Template", "", "", "Create a new StimPlan Model Template" );
CAF_PDM_InitScriptableFieldNoDefault( &m_eclipseCase, "EclipseCase", "", "", "", "Eclipse Case" );
CAF_PDM_InitScriptableFieldNoDefault( &m_timeStep, "TimeStep", "", "", "", "Time Step" );
CAF_PDM_InitScriptableField( &m_timeStep, "TimeStep", 0, "", "", "", "Time Step" );
CAF_PDM_InitScriptableFieldNoDefault( &m_faciesPropertiesFilePath,
"FaciesPropertiesFilePath",

View File

@@ -22,6 +22,8 @@
#include "RiaSummaryTools.h"
#include "RifSummaryReaderInterface.h"
#include "RimFileSummaryCase.h"
#include "RimSummaryCase.h"
#include "RimcDataContainerDouble.h"
@@ -64,10 +66,7 @@ caf::PdmObjectHandle* RimSummaryCase_summaryVectorValues::execute()
}
}
auto dataObject = new RimcDataContainerDouble();
dataObject->m_doubleValues = values;
return dataObject;
return RimcDataContainerDouble::create( values );
}
//--------------------------------------------------------------------------------------------------
@@ -257,3 +256,57 @@ std::unique_ptr<caf::PdmObjectHandle> RimSummaryCase_resampleValues::defaultResu
{
return std::unique_ptr<caf::PdmObjectHandle>( new RimcSummaryResampleData );
}
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimSummaryCase, RimSummaryCase_setSummaryVectorValues, "setSummaryValues" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryCase_setSummaryVectorValues::RimSummaryCase_setSummaryVectorValues( caf::PdmObjectHandle* self )
: caf::PdmObjectMethod( self )
{
CAF_PDM_InitObject( "Set Summary Values" );
CAF_PDM_InitScriptableFieldNoDefault( &m_addressString, "Address", "", "", "", "Formatted address specifying the summary vector" );
CAF_PDM_InitScriptableFieldNoDefault( &m_unitString, "Unit", "", "", "", "Unit" );
CAF_PDM_InitScriptableFieldNoDefault( &m_values, "Values", "", "", "", "Values" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmObjectHandle* RimSummaryCase_setSummaryVectorValues::execute()
{
auto* summaryCase = self<RimSummaryCase>();
auto* fileSummaryCase = dynamic_cast<RimFileSummaryCase*>( summaryCase );
if ( fileSummaryCase )
{
fileSummaryCase->setSummaryData( m_addressString().toStdString(), m_unitString().toStdString(), m_values() );
}
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimSummaryCase_setSummaryVectorValues::resultIsPersistent() const
{
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::unique_ptr<caf::PdmObjectHandle> RimSummaryCase_setSummaryVectorValues::defaultResult() const
{
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimSummaryCase_setSummaryVectorValues::isNullptrValidResult() const
{
return true;
}

View File

@@ -92,3 +92,24 @@ private:
caf::PdmField<QString> m_addressString;
caf::PdmField<QString> m_resamplingPeriod;
};
//==================================================================================================
///
//==================================================================================================
class RimSummaryCase_setSummaryVectorValues : public caf::PdmObjectMethod
{
CAF_PDM_HEADER_INIT;
public:
RimSummaryCase_setSummaryVectorValues( caf::PdmObjectHandle* self );
caf::PdmObjectHandle* execute() override;
bool resultIsPersistent() const override;
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
bool isNullptrValidResult() const override;
private:
caf::PdmField<QString> m_addressString;
caf::PdmField<QString> m_unitString;
caf::PdmField<std::vector<float>> m_values;
};

View File

@@ -25,6 +25,8 @@
#include "RigSimulationWellCoordsAndMD.h"
#include "RigWellResultPoint.h"
#include <cmath>
//==================================================================================================
///
///

View File

@@ -25,7 +25,6 @@
//--------------------------------------------------------------------------------------------------
RigActiveCellInfo::RigActiveCellInfo()
: m_reservoirActiveCellCount( 0 )
, m_reservoirCellResultCount( 0 )
, m_activeCellPositionMin( cvf::Vec3d::ZERO )
, m_activeCellPositionMax( cvf::Vec3d::ZERO )
{
@@ -47,14 +46,6 @@ size_t RigActiveCellInfo::reservoirCellCount() const
return m_cellIndexToResultIndex.size();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RigActiveCellInfo::reservoirCellResultCount() const
{
return m_reservoirCellResultCount;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -75,11 +66,6 @@ bool RigActiveCellInfo::isActive( size_t reservoirCellIndex ) const
//--------------------------------------------------------------------------------------------------
size_t RigActiveCellInfo::cellResultIndex( size_t reservoirCellIndex ) const
{
if ( m_cellIndexToResultIndex.size() == 0 )
{
return reservoirCellIndex;
}
CVF_TIGHT_ASSERT( reservoirCellIndex < m_cellIndexToResultIndex.size() );
return m_cellIndexToResultIndex[reservoirCellIndex];
@@ -93,12 +79,6 @@ void RigActiveCellInfo::setCellResultIndex( size_t reservoirCellIndex, size_t re
CVF_TIGHT_ASSERT( reservoirCellResultIndex < m_cellIndexToResultIndex.size() );
m_cellIndexToResultIndex[reservoirCellIndex] = reservoirCellResultIndex;
if ( reservoirCellResultIndex >= m_reservoirCellResultCount )
{
#pragma omp critical
m_reservoirCellResultCount = reservoirCellResultIndex + 1;
}
}
//--------------------------------------------------------------------------------------------------
@@ -215,14 +195,6 @@ void RigActiveCellInfo::addLgr( size_t cellCount )
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RigActiveCellInfo::isCoarseningActive() const
{
return m_reservoirCellResultCount != m_reservoirActiveCellCount;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -34,8 +34,6 @@ public:
void setReservoirCellCount( size_t reservoirCellCount );
size_t reservoirCellCount() const;
size_t reservoirActiveCellCount() const;
size_t reservoirCellResultCount() const;
bool isCoarseningActive() const;
bool isActive( size_t reservoirCellIndex ) const;
size_t cellResultIndex( size_t reservoirCellIndex ) const;
@@ -75,7 +73,6 @@ private:
std::vector<size_t> m_cellIndexToResultIndex;
size_t m_reservoirActiveCellCount;
size_t m_reservoirCellResultCount;
cvf::Vec3st m_activeCellPositionMin;
cvf::Vec3st m_activeCellPositionMax;

View File

@@ -264,6 +264,8 @@ bool RigCaseCellResultCalculator::computeDivideByCellFaceArea( RigMainGrid*
cvf::ref<RigResultModifier> resultModifier =
RigResultModifierFactory::createResultModifier( destination, gridIdx, porosityModel, fIdx, address );
if ( resultModifier.isNull() ) continue;
#pragma omp parallel for
for ( int localGridCellIdx = 0; localGridCellIdx < static_cast<int>( grid->cellCount() ); localGridCellIdx++ )
{

View File

@@ -820,7 +820,7 @@ const std::vector<double>*
QString resultName,
std::vector<double>& activeCellsResultsTempContainer )
{
size_t resultCellCount = actCellInfo->reservoirCellResultCount();
size_t resultCellCount = actCellInfo->reservoirActiveCellCount();
size_t reservoirCellCount = actCellInfo->reservoirCellCount();
RigEclipseResultAddress resVarAddr( RiaDefines::ResultCatType::STATIC_NATIVE, resultName );
@@ -2465,7 +2465,7 @@ void RigCaseCellResultsData::computeNncCombRiTrans()
bool isFaceNormalsOutwards = m_ownerMainGrid->isFaceNormalsOutwards();
// NNC calculation
const RigConnectionContainer& nncConnections = m_ownerMainGrid->nncData()->connections();
const RigConnectionContainer& nncConnections = m_ownerMainGrid->nncData()->allConnections();
for ( size_t connIdx = 0; connIdx < nncConnections.size(); connIdx++ )
{
size_t nativeResvCellIndex = nncConnections[connIdx].c1GlobIdx();
@@ -2829,7 +2829,7 @@ void RigCaseCellResultsData::computeNncCombRiTRANSbyArea()
if ( transResults->size() != riAreaNormTransResults.size() ) return;
const RigConnectionContainer& connections = m_ownerMainGrid->nncData()->connections();
const RigConnectionContainer& connections = m_ownerMainGrid->nncData()->allConnections();
for ( size_t nncConIdx = 0; nncConIdx < riAreaNormTransResults.size(); ++nncConIdx )
{
@@ -2897,7 +2897,7 @@ void RigCaseCellResultsData::computeCellVolumes()
}
std::vector<double>& cellVolumeResults = m_cellScalarResults[cellVolIdx][0];
size_t cellResultCount = m_activeCellInfo->reservoirCellResultCount();
size_t cellResultCount = m_activeCellInfo->reservoirActiveCellCount();
cellVolumeResults.resize( cellResultCount, std::numeric_limits<double>::infinity() );
#pragma omp parallel for
@@ -2938,7 +2938,7 @@ void RigCaseCellResultsData::computeOilVolumes()
false );
m_cellScalarResults[oilVolIdx].resize( this->maxTimeStepCount() );
size_t cellResultCount = m_activeCellInfo->reservoirCellResultCount();
size_t cellResultCount = m_activeCellInfo->reservoirActiveCellCount();
for ( size_t timeStepIdx = 0; timeStepIdx < this->maxTimeStepCount(); timeStepIdx++ )
{
const std::vector<double>& soilResults = m_cellScalarResults[soilIdx][timeStepIdx];
@@ -3299,7 +3299,7 @@ void RigCaseCellResultsData::computeAllanResults( RigCaseCellResultsData* cellRe
formationCount = cellResultsData->activeFormationNames()->formationNames().size();
}
const RigConnectionContainer& nncConnections = mainGrid->nncData()->connections();
const RigConnectionContainer& nncConnections = mainGrid->nncData()->allConnections();
std::map<std::pair<int, int>, int> formationCombinationToCategory;
for ( size_t i = 0; i < nncConnections.size(); i++ )

View File

@@ -24,6 +24,8 @@
#include "RigFemPartGrid.h"
#include "RigMainGrid.h"
#include <cmath>
//==================================================================================================
///
//==================================================================================================

View File

@@ -27,6 +27,8 @@
#include "RimCellRangeFilter.h"
#include <cmath>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -16,6 +16,8 @@
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiaLogging.h"
#include "RigCellFaceGeometryTools.h"
#include "RigActiveCellInfo.h"
@@ -27,8 +29,6 @@
#include "cafAssert.h"
#include <QDebug>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -150,7 +150,7 @@ RigConnectionContainer RigCellFaceGeometryTools::computeOtherNncs( const RigMain
QString message = QString( "Nnc connection imported from Eclipse are not unique\nNNC count : %1\nUnique : %2" )
.arg( nativeConnections.size() )
.arg( nativeCellPairs.size() );
qDebug() << message;
RiaLogging::warning( message );
}
const cvf::Collection<RigFault>& faults = mainGrid->faults();
@@ -199,10 +199,23 @@ RigConnectionContainer RigCellFaceGeometryTools::computeOtherNncs( const RigMain
} // end parallel region
}
size_t nncCountWarningThreshold = 5000000;
if ( otherConnections.size() > nncCountWarningThreshold )
{
auto txt = QString( "Additional NNC count has reached %1, and is above the warning threshold of %2. Faults for "
"inactive cells can be managed from Preferences->Eclipse Grid->Include Inactive Cells" )
.arg( otherConnections.size() )
.arg( nncCountWarningThreshold );
RiaLogging::warning( txt );
}
otherConnections.remove_duplicates();
return otherConnections;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigCellFaceGeometryTools::extractConnectionsForFace( const RigFault::FaultFace& face,
const RigMainGrid* mainGrid,
const std::set<std::pair<unsigned, unsigned>>& nativeCellPairs,
@@ -304,8 +317,18 @@ void RigCellFaceGeometryTools::extractConnectionsForFace( const RigFault::FaultF
}
}
std::pair<unsigned, unsigned> candidate( static_cast<unsigned>( sourceReservoirCellIndex ),
static_cast<unsigned>( candidateCellIndex ) );
// Test if this pair of cells already has a connection. Check both combinations of cell index ordering to avoid
// duplicate NNC geometry for the same pair of cells
auto candidate = std::make_pair( static_cast<unsigned>( sourceReservoirCellIndex ),
static_cast<unsigned>( candidateCellIndex ) );
if ( nativeCellPairs.count( candidate ) > 0 )
{
continue;
}
std::swap( candidate.first, candidate.second );
if ( nativeCellPairs.count( candidate ) > 0 )
{

View File

@@ -203,3 +203,33 @@ void RigFault::accumulateFaultsPrCell( RigFaultsPrCellAccumulator* faultsPrCellA
faultIdx );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFaultsPrCellAccumulator::RigFaultsPrCellAccumulator( size_t reservoirCellCount )
{
std::array<int, 6> initVals = { NO_FAULT, NO_FAULT, NO_FAULT, NO_FAULT, NO_FAULT, NO_FAULT };
m_faultIdxForCellFace.resize( reservoirCellCount, initVals );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RigFaultsPrCellAccumulator::faultIdx( size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face ) const
{
// Ensure no crash after creating temporary LGRs
if ( reservoirCellIndex < m_faultIdxForCellFace.size() )
{
return m_faultIdxForCellFace[reservoirCellIndex][face];
}
return NO_FAULT;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFaultsPrCellAccumulator::setFaultIdx( size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face, int faultIdx )
{
m_faultIdxForCellFace[reservoirCellIndex][face] = faultIdx;
}

View File

@@ -46,26 +46,11 @@ public:
};
public:
explicit RigFaultsPrCellAccumulator( size_t reservoirCellCount )
{
std::array<int, 6> initVals = {NO_FAULT, NO_FAULT, NO_FAULT, NO_FAULT, NO_FAULT, NO_FAULT};
m_faultIdxForCellFace.resize( reservoirCellCount, initVals );
}
explicit RigFaultsPrCellAccumulator( size_t reservoirCellCount );
inline int faultIdx( size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face ) const
{
// Ensure no crash after creating temporary LGRs
if ( reservoirCellIndex < m_faultIdxForCellFace.size() )
{
return m_faultIdxForCellFace[reservoirCellIndex][face];
}
return NO_FAULT;
}
int faultIdx( size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face ) const;
inline void setFaultIdx( size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face, int faultIdx )
{
m_faultIdxForCellFace[reservoirCellIndex][face] = faultIdx;
}
void setFaultIdx( size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face, int faultIdx );
private:
std::vector<std::array<int, 6>> m_faultIdxForCellFace;

View File

@@ -22,8 +22,10 @@
#include "RiaLogging.h"
#include "RiaResultNames.h"
#include "RigActiveCellInfo.h"
#include "RigHexIntersectionTools.h"
#include "RigNNCData.h"
#include "cvfAssert.h"
#include "cvfBoundingBoxTree.h"
@@ -591,7 +593,7 @@ void RigMainGrid::distributeNNCsToFaults()
{
if ( m_faultsPrCellAcc.isNull() ) return;
const RigConnectionContainer& nncs = this->nncData()->connections();
const RigConnectionContainer& nncs = this->nncData()->allConnections();
for ( size_t nncIdx = 0; nncIdx < nncs.size(); ++nncIdx )
{
// Find the fault for each side of the nnc

View File

@@ -23,7 +23,6 @@
#include "RigCell.h"
#include "RigGridBase.h"
#include "RigLocalGrid.h"
#include "RigNNCData.h"
#include "cvfBoundingBox.h"
#include "cvfCollection.h"
@@ -31,6 +30,7 @@
#include <vector>
class RigActiveCellInfo;
class RigNNCData;
namespace cvf
{

View File

@@ -35,8 +35,9 @@
///
//--------------------------------------------------------------------------------------------------
RigNNCData::RigNNCData()
: m_nativeConnectionCount( 0 )
, m_connectionsAreProcessed( false )
: m_eclipseConnectionCount( 0 )
, m_havePolygonsForEclipseConnections( false )
, m_haveGeneratedConnections( false )
, m_mainGrid( nullptr )
, m_activeCellInfo( nullptr )
, m_computeNncForInactiveCells( false )
@@ -54,44 +55,52 @@ void RigNNCData::setSourceDataForProcessing( RigMainGrid* mainGrid,
m_activeCellInfo = activeCellInfo;
m_computeNncForInactiveCells = includeInactiveCells;
m_connectionsAreProcessed = false;
m_havePolygonsForEclipseConnections = false;
m_haveGeneratedConnections = false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigNNCData::processNativeConnections( const RigMainGrid& mainGrid )
void RigNNCData::buildPolygonsForEclipseConnections()
{
// cvf::Trace::show("NNC: Total number: " + cvf::String((int)m_connections.size()));
if ( m_havePolygonsForEclipseConnections ) return;
if ( !m_mainGrid ) return;
#pragma omp parallel for
for ( int cnIdx = 0; cnIdx < (int)m_connections.size(); ++cnIdx )
for ( int cnIdx = 0; cnIdx < static_cast<int>( eclipseConnectionCount() ); ++cnIdx )
{
const RigCell& c1 = mainGrid.globalCellArray()[m_connections[cnIdx].c1GlobIdx()];
const RigCell& c2 = mainGrid.globalCellArray()[m_connections[cnIdx].c2GlobIdx()];
const RigCell& c1 = m_mainGrid->globalCellArray()[m_connections[cnIdx].c1GlobIdx()];
const RigCell& c2 = m_mainGrid->globalCellArray()[m_connections[cnIdx].c2GlobIdx()];
std::vector<size_t> connectionPolygon;
std::vector<cvf::Vec3d> connectionIntersections;
cvf::StructGridInterface::FaceType connectionFace = cvf::StructGridInterface::NO_FACE;
connectionFace =
RigCellFaceGeometryTools::calculateCellFaceOverlap( c1, c2, mainGrid, &connectionPolygon, &connectionIntersections );
connectionFace = RigCellFaceGeometryTools::calculateCellFaceOverlap( c1,
c2,
*m_mainGrid,
&connectionPolygon,
&connectionIntersections );
if ( connectionFace != cvf::StructGridInterface::NO_FACE )
{
m_connections[cnIdx].setFace( connectionFace );
m_connections[cnIdx].setPolygon(
RigCellFaceGeometryTools::extractPolygon( mainGrid.nodes(), connectionPolygon, connectionIntersections ) );
m_connections[cnIdx].setPolygon( RigCellFaceGeometryTools::extractPolygon( m_mainGrid->nodes(),
connectionPolygon,
connectionIntersections ) );
}
}
m_havePolygonsForEclipseConnections = true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigNNCData::computeCompleteSetOfNncs( const RigMainGrid* mainGrid,
const RigActiveCellInfo* activeCellInfo,
bool includeInactiveCells )
void RigNNCData::computeAdditionalNncs( const RigMainGrid* mainGrid,
const RigActiveCellInfo* activeCellInfo,
bool includeInactiveCells )
{
RigConnectionContainer otherConnections =
RigCellFaceGeometryTools::computeOtherNncs( mainGrid, m_connections, activeCellInfo, includeInactiveCells );
@@ -188,9 +197,9 @@ size_t RigNNCData::connectionsWithNoCommonArea( QStringList& connectionTextFirst
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RigNNCData::ensureConnectionDataIsProcessed()
bool RigNNCData::ensureAllConnectionDataIsProcessed()
{
if ( m_connectionsAreProcessed ) return false;
if ( m_haveGeneratedConnections ) return false;
if ( m_mainGrid )
{
@@ -198,13 +207,13 @@ bool RigNNCData::ensureConnectionDataIsProcessed()
RiaLogging::info( "NNC geometry computation - starting process" );
processNativeConnections( *m_mainGrid );
buildPolygonsForEclipseConnections();
progressInfo.incrementProgress();
computeCompleteSetOfNncs( m_mainGrid, m_activeCellInfo, m_computeNncForInactiveCells );
computeAdditionalNncs( m_mainGrid, m_activeCellInfo, m_computeNncForInactiveCells );
progressInfo.incrementProgress();
m_connectionsAreProcessed = true;
m_haveGeneratedConnections = true;
m_mainGrid->distributeNNCsToFaults();
@@ -215,7 +224,7 @@ bool RigNNCData::ensureConnectionDataIsProcessed()
RiaLogging::info( "NNC geometry computation - completed process" );
RiaLogging::info( QString( "Native NNC count : %1" ).arg( nativeConnectionCount() ) );
RiaLogging::info( QString( "Native NNC count : %1" ).arg( eclipseConnectionCount() ) );
RiaLogging::info( QString( "Computed NNC count : %1" ).arg( m_connections.size() ) );
RiaLogging::info( QString( "NNCs with no common area count : %1" ).arg( noCommonAreaCount ) );
@@ -237,28 +246,41 @@ bool RigNNCData::ensureConnectionDataIsProcessed()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigNNCData::setNativeConnections( RigConnectionContainer& connections )
void RigNNCData::setEclipseConnections( RigConnectionContainer& eclipseConnections )
{
m_connections = connections;
m_nativeConnectionCount = m_connections.size();
m_connections = eclipseConnections;
m_eclipseConnectionCount = m_connections.size();
m_connectionsAreProcessed = false;
m_haveGeneratedConnections = false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RigNNCData::nativeConnectionCount() const
size_t RigNNCData::eclipseConnectionCount() const
{
return m_nativeConnectionCount;
return m_eclipseConnectionCount;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigConnectionContainer& RigNNCData::connections()
const RigConnectionContainer& RigNNCData::availableConnections() const
{
ensureConnectionDataIsProcessed();
// Return connections without calling ensureConnectionDataIsProcessed() to avoid potential heavy computations
// Relevant if only native connection data is required
// NB: If computeAdditionalNncs() is called before this method, the size of this collection is larger than
// nativeConnectionCount()
return m_connections;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigConnectionContainer& RigNNCData::allConnections()
{
ensureAllConnectionDataIsProcessed();
return m_connections;
}
@@ -268,7 +290,7 @@ RigConnectionContainer& RigNNCData::connections()
//--------------------------------------------------------------------------------------------------
std::vector<double>& RigNNCData::makeStaticConnectionScalarResult( QString nncDataType )
{
ensureConnectionDataIsProcessed();
ensureAllConnectionDataIsProcessed();
std::vector<std::vector<double>>& results = m_connectionResults[nncDataType];
results.resize( 1 );
@@ -623,12 +645,14 @@ bool RigNNCData::generateScalarValues( const RigEclipseResultAddress& resVarAddr
auto it = m_connectionResults.find( nameit->second );
if ( it == m_connectionResults.end() ) return false;
auto& srcdata = it->second;
// Connection polygons are used to compute the center for the NNC flow vectors
// If connection polygons are present, this is a no-op
buildPolygonsForEclipseConnections();
auto& srcdata = it->second;
auto& dstdata = makeDynamicConnectionScalarResult( resVarAddr.resultName(), srcdata.size() );
const double epsilon = 1.0e-3;
const double epsilon = 1.0e-3;
std::vector<double> areas( m_connections.size() );
for ( size_t dataIdx = 0; dataIdx < m_connections.size(); dataIdx++ )

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