Merge pull request #6812 from OPM/dev

Release 2020.10.0
This commit is contained in:
Magne Sjaastad
2020-10-20 04:16:45 -04:00
committed by GitHub
3927 changed files with 399696 additions and 462699 deletions

View File

@@ -1,6 +1,11 @@
name: ResInsight Build
name: ResInsight Build and Package
on: [push, pull_request]
on:
push:
branches:
- master
- dev
pull_request:
jobs:
ResInsight-x64:
runs-on: ${{ matrix.os }}
@@ -15,7 +20,7 @@ jobs:
vcpkg-response-file: vcpkg_x64-linux.txt
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2
with:
submodules: true
- name: Cache Qt
@@ -37,7 +42,7 @@ jobs:
pip install pytest
- 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
run: sudo apt-get install libxkbcommon-x11-0 libgl1-mesa-dev mesa-common-dev libglfw3-dev libglu1-mesa-dev libhdf5-dev
- name: Cache vcpkg artifacts
uses: actions/cache@v1
with:
@@ -54,7 +59,7 @@ jobs:
uses: lukka/run-cmake@v1
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeAppendedArgs: '-DRESINSIGHT_ENABLE_GRPC=true -DRESINSIGHT_GRPC_PYTHON_EXECUTABLE=python -DRESINSIGHT_ENABLE_PRECOMPILED_HEADERS=true -DRESINSIGHT_ENABLE_UNITY_BUILD=true -DRESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS=true'
cmakeAppendedArgs: '-DGSL_ENABLE=true -DRESINSIGHT_ENABLE_GRPC=true -DRESINSIGHT_GRPC_PYTHON_EXECUTABLE=python -DRESINSIGHT_ENABLE_PRECOMPILED_HEADERS=true -DRESINSIGHT_ENABLE_UNITY_BUILD=true -DRESINSIGHT_TREAT_WARNINGS_AS_ERRORS=true -DRESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS=true'
buildDirectory: ${{ github.workspace }}/cmakebuild
buildWithCMakeArgs: '--config Release --target package'
useVcpkgToolchainFile: true
@@ -87,4 +92,4 @@ jobs:
path: ${{ runner.workspace }}/ResInsight/cmakebuild/packages

View File

@@ -10,18 +10,19 @@ jobs:
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2
- name: Cache Qt
id: cache-qt
uses: actions/cache@v1
uses: actions/cache@v2
with:
path: ../Qt
path: ${{ github.workspace }}/Qt/
key: ${{ runner.os }}-QtCache
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: 5.9.9
modules: qtscript
dir: '${{ github.workspace }}/Qt/'
cached: ${{ steps.cache-qt.outputs.cache-hit }}
- name: Install Linux dependencies
if: "contains( matrix.os, 'ubuntu')"

View File

@@ -0,0 +1,226 @@
name: ResInsight Build With Cache
on:
push:
schedule:
# Every day at 1am to make sure we have a build cache for the current date
# build cache is
- cron: '0 1 * * * '
env:
NINJA_VERSION: 1.9.0
BUILD_TYPE: Release
BUILDCACHE_VERSION: 0.18.0
BUILDCACHE_DIR: ${{ github.workspace }}/buildcache_dir
jobs:
ResInsight-x64-buildcache:
runs-on: ${{ matrix.config.os }}
strategy:
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: 'vcpkg/scripts/buildsystems/vcpkg.cmake'
}
- {
name: "Ubuntu Latest GCC",
os: ubuntu-latest,
cc: "gcc", cxx: "g++",
vcpkg-response-file: vcpkg_x64-linux.txt,
vcpkg-triplet: x64-linux,
cmake-toolchain: '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: 'vcpkg/scripts/buildsystems/vcpkg.cmake'
}
- {
name: "Ubuntu 20.04 clang",
os: ubuntu-20.04,
cc: "clang", cxx: "clang++",
vcpkg-response-file: vcpkg_x64-linux.txt,
vcpkg-triplet: x64-linux,
cmake-toolchain: 'vcpkg/scripts/buildsystems/vcpkg.cmake'
}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Download Ninja
uses: seanmiddleditch/gha-setup-ninja@master
with:
version: ${{ env.NINJA_VERSION }}
- name: Download buildcache
id: buildcache-download
shell: cmake -P {0}
run: |
if ("${{ runner.os }}" STREQUAL "Windows")
set(buildcache_suffix "win-msvc.zip")
elseif ("${{ runner.os }}" STREQUAL "Linux")
set(buildcache_suffix "linux.zip")
endif()
set(buildcache_version $ENV{BUILDCACHE_VERSION})
set(buildcache_url "https://github.com/mbitsnbites/buildcache/releases/download/v${buildcache_version}/buildcache-${buildcache_suffix}")
file(DOWNLOAD "${buildcache_url}" ./buildcache.zip)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./buildcache.zip)
if (NOT "${{ runner.os }}" STREQUAL "Windows")
execute_process(
COMMAND chmod +x bin/buildcache
)
endif()
- name: Prepare cache timestamp
id: cache_timestamp_string
shell: cmake -P {0}
run: |
string(TIMESTAMP current_date "%Y-%m-%d" UTC)
message("::set-output name=timestamp::${current_date}")
- name: Cache Buildcache
id: cache-buildcache
uses: actions/cache@v2
with:
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
shell: pwsh
- name: Add buildcache to system path
run: echo "::add-path::${{ github.workspace }}/bin"
- name: Cache Qt
id: cache-qt
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/Qt/
key: ${{ matrix.config.os }}-QtCache-v02
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: 5.9.9
modules: qtscript
dir: '${{ github.workspace }}/Qt/'
cached: ${{ steps.cache-qt.outputs.cache-hit }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install grpcio-tools
pip install pytest
- 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: Cache vcpkg artifacts
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/vcpkg/
# Ensure the cache is invalidated any time vcpkg version changes, or a different set of packages is being used.
key: ${{ hashFiles( format('{0}/{1}', github.workspace, matrix.config.vcpkg-response-file )) }}-${{ hashFiles('.git/modules/vcpkg/HEAD') }}-${{ runner.os }}-v02
- name: Run vcpkg
uses: lukka/run-vcpkg@v1
id: runvcpkg
with:
vcpkgArguments: '@${{ github.workspace }}/${{ matrix.config.vcpkg-response-file }}'
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
- name: Configure
shell: cmake -P {0}
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 GSL_ENABLE=true
-D RESINSIGHT_ENABLE_UNITY_BUILD=true
-D RESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS=true
-D RESINSIGHT_TREAT_WARNINGS_AS_ERRORS=true
-D RESINSIGHT_ENABLE_GRPC=true
-D RESINSIGHT_GRPC_PYTHON_EXECUTABLE=python
-D VCPKG_TARGET_TRIPLET=${{ matrix.config.vcpkg-triplet }}
-D CMAKE_TOOLCHAIN_FILE=${{ matrix.config.cmake-toolchain }}
-G Ninja
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
- name: Build
shell: cmake -P {0}
run: |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ")
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
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
- name: Stats for buildcache
run: ${{ github.workspace }}/bin/buildcache -s
- name: (Windows) Run Unit Tests
if: contains( matrix.config.os, 'windows')
shell: bash
run: |
cmakebuild/ApplicationCode/ResInsight --unittest
- name: (Linux) Run Unit Tests
if: "!contains( matrix.config.os, 'windows')"
shell: bash
run: |
cmakebuild/ApplicationCode/ResInsight --unittest
- name: Run pytest
if: contains( matrix.config.os, 'windows')
env:
RESINSIGHT_EXECUTABLE: ${{ runner.workspace }}/ResInsight/cmakebuild/ApplicationCode/ResInsight.exe
run: |
cd ApplicationCode/GrpcInterface/Python/rips
pytest --console
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ResInsight-${{ matrix.config.name }}
path: ${{ runner.workspace }}/ResInsight/cmakebuild/install

82
.github/workflows/centos7.yml vendored Normal file
View File

@@ -0,0 +1,82 @@
name: centOS 7 (without geomech)
on:
workflow_dispatch:
schedule:
# Once every night
- cron: '0 1 * * * '
jobs:
build_on_centos7:
runs-on: ubuntu-latest
container:
image: centos:7
steps:
- name: Intall 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
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 cmake3
yum install -y make
yum install -y mesa-libGL-devel
yum install -y freeglut-devel
yum install -y devtoolset-7
yum install -y rh-python36
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Build ResInsight
run: |
source /opt/rh/devtoolset-7/enable
source /opt/rh/rh-python36/enable
cmake3 --version
git --version
g++ --version
python --version
python -m pip install --upgrade pip
python -m pip install grpcio-tools
vcpkg/bootstrap-vcpkg.sh
vcpkg/vcpkg install grpc
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=../vcpkg/scripts/buildsystems/vcpkg.cmake \
-DRESINSIGHT_GRPC_PYTHON_EXECUTABLE=python \
..
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

31
.github/workflows/clang-format.yml vendored Normal file
View File

@@ -0,0 +1,31 @@
name: clang-format
on: [push]
jobs:
clang-format-job:
runs-on: ubuntu-latest
steps:
- name: Install clang-format 6.0
run: |
sudo apt install clang-format-6.0
clang-format-6.0 --version
- uses: actions/checkout@v2
- name: Check format - ApplicationCode
run: |
cd ApplicationCode
find -name *.h -o -name *.cpp -o -name *.inl | xargs clang-format-6.0 -i
git diff
- name: Check format - AppFwk
run: |
cd Fwk/AppFwk
find -name *.h -o -name *.cpp -o -name *.inl | grep -v gtest | xargs clang-format-6.0 -i
git diff
- uses: peter-evans/create-pull-request@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'Fixes by clang-format'
title: 'Fixes by clang-format'
branch: clang-format-patches

76
.github/workflows/delete_artifacts.py vendored Normal file
View File

@@ -0,0 +1,76 @@
import json
import urllib.request
import requests
import math
import sys
org_name = "OPM"
repo_name = "ResInsight"
keep_artifacts = 20
def get_all_artifacts(repo_name: str, headers: dict) -> []:
amount_items_per_page = 50
page = 1
ref = "https://api.github.com/repos/" + org_name + "/" + repo_name + "/actions/artifacts" + "?per_page=" + str(amount_items_per_page)
result = requests.get(ref, headers=headers).json()
#print(json.dumps(result, indent=4, sort_keys=True))
done = False
all_artifacts = []
while not done:
total_count = int(result["total_count"])
if total_count == 0:
done = True
all_artifacts = all_artifacts + result["artifacts"]
max_pages = math.ceil(total_count / amount_items_per_page)
if max_pages > page:
page = page + 1
else:
done = True
return all_artifacts
def delete_artifact(repo_name: str, artifact_id: str, headers: dict) -> bool:
try:
res = urllib.request.urlopen(urllib.request.Request(
url="https://api.github.com/repos/" + org_name + "/" + repo_name + "/actions/artifacts/" + artifact_id,
headers=headers,
method='DELETE')
).getcode()
return res == 204
except urllib.error.URLError as error:
print(error)
return False
length = len(sys.argv)
if length < 2:
print('This script requires Github access token as argment')
sys.exit()
access_token = sys.argv[1]
headers = {"content-type": "application/json; charset=UTF-8",'Authorization':'Bearer {}'.format(access_token)}
artifacts = get_all_artifacts(repo_name, headers)
print("Amount of artifacts for repo " + repo_name + " is " + str(len(artifacts)))
if len(artifacts) > keep_artifacts:
for a in artifacts[keep_artifacts:]:
artifact_id = str(a["id"])
deleted = delete_artifact(repo_name, artifact_id, headers)
if deleted:
print("Repo: " + repo_name + " | Artifact with id " + artifact_id + " has been deleted")
else:
print("Repo: " + repo_name + " | Something went wrong while deleting artifact with id " + artifact_id)

25
.github/workflows/delete_artifacts.yml vendored Normal file
View File

@@ -0,0 +1,25 @@
name: Remove old artifacts
on:
schedule:
# Every day at 1am
- cron: '0 1 * * *'
jobs:
remove-old-artifacts:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v2
- name: setup python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Remove old artifacts
run: |
python -m pip install --upgrade pip
pip install urllib3 requests
cd .github/workflows
python delete_artifacts.py ${{ secrets.GITHUB_TOKEN }}

22
.github/workflows/spell-check.yml vendored Normal file
View File

@@ -0,0 +1,22 @@
name: Spell Check
on:
- push
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: sobolevn/misspell-fixer-action@master
with:
options: '-rsvnuR ApplicationCode/'
- uses: peter-evans/create-pull-request@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'Fixes by misspell-fixer'
title: 'Typos fix by misspell-fixer'
branch: spell-check-patches

5
.gitignore vendored
View File

@@ -58,6 +58,11 @@ CTest*.cmake
*.unsuccessfulbuild
ipch/
Ankh.NoLoad
.vs
out
build
CMakeSettings.json
enc_temp_folder
#Visual Studio Code files
.vscode

3
.gitmodules vendored
View File

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

6
.misspell-fixer.ignore Normal file
View File

@@ -0,0 +1,6 @@
^ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp:28:aswell
^ApplicationCode/ReservoirDataModel/RigLasFileExporter.cpp:33:aswell
^ApplicationCode/Resources/EastView.svg
^ApplicationCode/Resources/NorthView.svg
^ApplicationCode/Resources/SouthView.svg
^ApplicationCode/Resources/WestView.svg

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,334 @@
// ResInsight version string : 2020.04.0
// Report generated : Fri Apr 17 13:45:38 2020
//
//
Annotations
AsciiDataCurve
CalcScript
CalculatedSummaryCase
CellEdgeResultSlot
CellFilter
CellPropertyFilter
CellPropertyFilters
CellRangeFilter
CellRangeFilterCollection
ChangeDataSourceFeatureUi
CmdAddItemExecData
CmdDeleteItemExecData
CmdFieldChangeExecData
CmdSelectionChangeExecData
CompletionTemplateCollection
CrossSection
CrossSectionCollection
DataContainerFloat
DataContainerString
DataContainerTime
Eclipse2dViewCollection
EclipseCase
EclipseGeometrySelectionItem
Fault
Faults
FileSummaryCase
FishbonesCollection
FishbonesMultipleSubs
FishbonesPipeProperties
FlowCharacteristicsPlot
FlowDiagSolution
FlowPlotCollection
FormationNames
FormationNamesCollectionObject
FractureContainment
FractureDefinitionCollection
GeoMech2dViewCollection
GeoMechGeometrySelectionItem
GeoMechPropertyFilter
GeoMechPropertyFilters
GeoMechResultDefinition
GeoMechResultSlot
GeoMechView
GridCollection
GridCrossPlotCurve
GridCrossPlotCurveSet
GridInfo
GridInfoCollection
GridSummaryCase
GridTimeHistoryCurve
Intersection2dView
Intersection2dViewCollection
IntersectionBox
IntersectionResultDefinition
Legend
MainPlotCollection
MdiWindowController
MockModelSettings
ModeledWellPath
MultiPlot
MultiSnapshotDefinition
NoCommonAreaNNC
ObservedDataCollection
ObservedFmuRftData
PdmDocument
PdmObjectCollection
PdmObjectGroup
Perforation
PerforationCollection
PlotTemplateCollection
PlotTemplateFileItem
PolylineTarget
PolylinesFromFileAnnotation
PropertyFilter
ResInsightAnalysisModels
ResInsightGeoMechCase
ResInsightGeoMechModels
ResInsightOilField
ResInsightProject
ResampleData
ReservoirCellResultStorage
ReservoirView
ResultDefinition
ResultSlot
ResultStorageEntryInfo
RftAddress
RiaMemoryCleanup
RiaPreferences
RiaRegressionTest
RicCaseAndFileExportSettingsUi
RicCellRangeUi
RicDeleteItemExecData
RicExportCarfinUi
RicExportCompletionDataSettingsUi
RicExportContourMapToTextUi
RicExportEclipseInputGridUi
RicExportLgrUi
RicExportToLasFileObj
RicExportToLasFileResampleUi
RicExportWellPathsUi
RicHoloLensCreateSessionUi
RicHoloLensExportToFolderUi
RicHoloLensServerSettings
RicLinkVisibleViewsFeatureUi
RicPasteAsciiDataToSummaryPlotFeatureUi
RicSaturationPressureUi
RicSaveEclipseInputVisibleCellsUi
RicSelectPlotTemplateUi
RicSelectSummaryPlotUI
RicSelectViewUI
RicSummaryAddressSelection
RicSummaryCurveCalculator
RicSummaryCurveCreator
RicWellPathsUnitSystemSettingsUi
RifReaderSettings
Rim3dWellLogCurveCollection
Rim3dWellLogExtractionCurve
Rim3dWellLogFileCurve
Rim3dWellLogRftCurve
RimAnnotationCollection
RimAnnotationCollectionBase
RimAnnotationGroupCollection
RimAnnotationLineAppearance
RimAnnotationTextAppearance
RimBinaryExportSettings
RimCaseCollection
RimCommandExecuteScript
RimCommandIssueFieldChanged
RimCommandObject
RimContourMapView
RimCsvUserData
RimDerivedEnsembleCase
RimDerivedEnsembleCaseCollection
RimDialogData
RimEclipseContourMapProjection
RimEllipseFractureTemplate
RimEnsembleCurveFilter
RimEnsembleCurveFilterCollection
RimEnsembleCurveSet
RimEnsembleCurveSetCollection
RimEnsembleStatistics
RimExportInputSettings
RimFaultResultSlot
RimFractureExportSettings
RimGeoMechContourMapProjection
RimGeoMechContourMapView
RimGridCrossPlot
RimGridCrossPlotCollection
RimGridCrossPlotCurveSetNameConfig
RimGridCrossPlotNameConfig
RimIdenticalGridCaseGroup
RimInputProperty
RimInputPropertyCollection
RimInputReservoir
RimIntersectionResultsDefinitionCollection
RimMeasurement
RimMswCompletionParameters
RimMultiPlotCollection
RimMultipleValveLocations
RimNoCommonAreaNncCollection
RimNonDarcyPerforationParameters
RimObservedEclipseUserData
RimOilFieldEntry
RimOilRegionEntry
RimPlotAxisAnnotation
RimPlotCellFilterCollection
RimPlotCellPropertyFilter
RimPolylineAppearance
RimPolylinesAnnotationInView
RimPolylinesFromFileAnnotationInView
RimReachCircleAnnotation
RimReachCircleAnnotationInView
RimSaturationPressurePlot
RimSaturationPressurePlotCollection
RimStatisticalCalculation
RimStatisticalCollection
RimStimPlanColors
RimStimPlanFractureTemplate
RimStimPlanLegendConfig
RimSummaryCalculation
RimSummaryCalculationCollection
RimSummaryCalculationVariable
RimSummaryCurveCollection
RimSummaryCurveCollectionModifier
RimTensorResults
RimTernaryLegendConfig
RimTextAnnotation
RimTextAnnotationInView
RimTimeStepFilter
RimUserDefinedPolylinesAnnotationInView
RimViewLinkerCollection
RimViewNameConfig
RimVirtualPerforationResults
RimWellLogExtractionCurve
RimWellLogExtractionCurveNameConfig
RimWellLogFileCurveNameConfig
RimWellLogPlotNameConfig
RimWellLogRftCurveNameConfig
RimWellLogWbsCurve
RimWellPathEntry
RimWellPathImport
RiuCreateMultipleFractionsUi
RiuMultipleFractionsOptions
ScaleLegend
ScriptLocation
SimWellFracture
SimWellFractureCollection
SummaryAddress
SummaryCaseCollection
SummaryCaseSubCollection
SummaryCrossPlot
SummaryCrossPlotCollection
SummaryCurve
SummaryCurveAutoName
SummaryCurveFilter
SummaryFilterSettings
SummaryObservedDataFile
SummaryPageDownloadEntity
SummaryPlot
SummaryPlotCollection
SummaryPlotFilterTextCurveSetEditor
SummaryTimeAxisProperties
SummaryYAxisProperties
Surface
SurfaceCollection
SurfaceInView
SurfaceInViewCollection
TC2
TestCommand1
TofAccumulatedPhaseFractionsPlot
TotalWellAllocationPlot
UserDefinedPolylinesAnnotation
ValveTemplate
ValveTemplateCollection
View3dOverlayInfoConfig
ViewController
ViewLinker
WbsParameters
Well
WellAllocationPlot
WellAllocationPlotLegend
WellBoreStabilityPlot
WellDistributionPlot
WellDistributionPlotCollection
WellFlowRateCurve
WellLogFile
WellLogFileChannel
WellLogFileCurve
WellLogPlot
WellLogPlotCollection
WellLogPlotTrack
WellLogRftCurve
WellMeasurement
WellMeasurementCurve
WellMeasurementFilePath
WellMeasurementInView
WellMeasurements
WellMeasurementsInView
WellPath
WellPathAicdParameters
WellPathAttribute
WellPathAttributes
WellPathBase
WellPathCompletion
WellPathCompletionCollection
WellPathCompletions
WellPathFracture
WellPathFractureCollection
WellPathGeometryDef
WellPathTarget
WellPathValve
WellPaths
WellPltPlot
WellPltPlotCollection
WellRftEnsembleCurveSet
WellRftPlot
WellRftPlotCollection
Wells
cloneView
closeProject
computeCaseGroupStatistics
createGridCaseGroup
createGridCaseGroupResult
createLgrForCompletions
createMultiPlot
createMultipleFractures
createSaturationPressurePlots
createStatisticsCase
createStatisticsCaseResult
createView
createViewResult
createWbsPlotResult
createWellBoreStabilityPlot
exportContourMapToText
exportFlowCharacteristics
exportLgrForCompletions
exportMsw
exportMultiCaseSnapshots
exportProperty
exportPropertyInViews
exportSimWellFractureCompletions
exportSnapshots
exportVisibleCells
exportWellLogPlotData
exportWellLogPlotDataResult
exportWellPathCompletions
exportWellPaths
importFormationNames
importWellLogFiles
importWellLogFilesResult
importWellPaths
importWellPathsResult
loadCase
loadCaseResult
openProject
replaceCase
replaceMultipleCases
replaceSourceCases
runOctaveScript
saveProject
saveProjectAs
scaleFractureTemplate
setExportFolder
setFractureContainment
setMainWindowSize
setPlotWindowSize
setStartDir
setTimeStep

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,366 @@
// ResInsight version string : 2020.10.0-RC04
// Report generated : Wed Oct 14 08:12:00 2020
//
//
AnalysisPlot
AnalysisPlotCollection
AnalysisPlotDataEntry
Annotations
AsciiDataCurve
CalcScript
CalculatedSummaryCase
CellEdgeResultSlot
CellFilter
CellPropertyFilter
CellPropertyFilters
CellRangeFilter
CellRangeFilterCollection
ChangeDataSourceFeatureUi
CmdAddItemExecData
CmdDeleteItemExecData
CmdFieldChangeExecData
CmdSelectionChangeExecData
ColorLegend
ColorLegendCollection
ColorLegendItem
CompletionTemplateCollection
CorrelationMatrixPlot
CorrelationPlot
CorrelationPlotCollection
CorrelationReportPlot
CrossSection
CrossSectionCollection
DataContainerFloat
DataContainerString
DataContainerTime
DepthTrackPlot
Eclipse2dViewCollection
EclipseCase
EclipseGeometrySelectionItem
ElasticProperties
ElasticPropertiesCurve
FaciesProperties
Fault
Faults
FileSummaryCase
FishbonesCollection
FishbonesMultipleSubs
FishbonesPipeProperties
FlowCharacteristicsPlot
FlowDiagSolution
FlowPlotCollection
FormationNames
FormationNamesCollectionObject
FractureContainment
FractureDefinitionCollection
FractureModelCollection
FractureModelCurve
FractureModelPlot
FractureModelPlotCollection
FractureModelTemplateCollection
GeoMech2dViewCollection
GeoMechGeometrySelectionItem
GeoMechPropertyFilter
GeoMechPropertyFilters
GeoMechResultDefinition
GeoMechResultSlot
GeoMechView
GridCaseSurface
GridCollection
GridCrossPlotCurve
GridCrossPlotCurveSet
GridInfo
GridInfoCollection
GridSummaryCase
GridTimeHistoryCurve
Intersection2dView
Intersection2dViewCollection
IntersectionBox
IntersectionResultDefinition
LayerCurve
Legend
MainPlotCollection
MdiWindowController
MockModelSettings
ModeledWellPath
MultiPlot
MultiSnapshotDefinition
NoCommonAreaNNC
ObservedDataCollection
ObservedFmuRftData
ParameterResultCrossPlot
PdmDocument
PdmObjectCollection
PdmObjectGroup
Perforation
PerforationCollection
PlotDataFilterCollection
PlotDataFilterItem
PlotTemplateCollection
PlotTemplateFileItem
PolylineTarget
PolylinesFromFileAnnotation
PropertyFilter
ResInsightAnalysisModels
ResInsightGeoMechCase
ResInsightGeoMechModels
ResInsightOilField
ResInsightProject
ResampleData
ReservoirCellResultStorage
ReservoirView
ResultDefinition
ResultSlot
ResultStorageEntryInfo
RftAddress
RiaMemoryCleanup
RiaPreferences
RiaRegressionTest
RicCaseAndFileExportSettingsUi
RicCellRangeUi
RicDeleteItemExecData
RicExportCarfinUi
RicExportCompletionDataSettingsUi
RicExportContourMapToTextUi
RicExportEclipseInputGridUi
RicExportLgrUi
RicExportToLasFileObj
RicExportToLasFileResampleUi
RicExportWellPathsUi
RicHoloLensCreateSessionUi
RicHoloLensExportToFolderUi
RicHoloLensServerSettings
RicLinkVisibleViewsFeatureUi
RicPasteAsciiDataToSummaryPlotFeatureUi
RicSaturationPressureUi
RicSaveEclipseInputVisibleCellsUi
RicSelectPlotTemplateUi
RicSelectSummaryPlotUI
RicSelectViewUI
RicSummaryAddressSelection
RicSummaryCurveCalculator
RicSummaryCurveCreator
RicWellPathsUnitSystemSettingsUi
RifReaderSettings
Rim3dWellLogCurveCollection
Rim3dWellLogExtractionCurve
Rim3dWellLogFileCurve
Rim3dWellLogRftCurve
RimAnnotationCollection
RimAnnotationCollectionBase
RimAnnotationGroupCollection
RimAnnotationLineAppearance
RimAnnotationTextAppearance
RimBinaryExportSettings
RimCaseCollection
RimCommandExecuteScript
RimCommandIssueFieldChanged
RimCommandObject
RimContourMapView
RimCsvUserData
RimDerivedEnsembleCase
RimDerivedEnsembleCaseCollection
RimDialogData
RimEclipseContourMapProjection
RimElementVectorResult
RimEllipseFractureTemplate
RimEnsembleCurveFilter
RimEnsembleCurveFilterCollection
RimEnsembleCurveSet
RimEnsembleCurveSetCollection
RimEnsembleStatistics
RimExportInputSettings
RimFaultResultSlot
RimFractureExportSettings
RimFractureModel
RimFractureModelStressCurve
RimFractureModelTemplate
RimGeoMechContourMapProjection
RimGeoMechContourMapView
RimGridCrossPlot
RimGridCrossPlotCollection
RimGridCrossPlotCurveSetNameConfig
RimGridCrossPlotNameConfig
RimIdenticalGridCaseGroup
RimInputProperty
RimInputPropertyCollection
RimInputReservoir
RimIntersectionResultsDefinitionCollection
RimMeasurement
RimMswCompletionParameters
RimMudWeightWindowParameters
RimMultiPlotCollection
RimMultipleValveLocations
RimNoCommonAreaNncCollection
RimNonDarcyPerforationParameters
RimObservedEclipseUserData
RimOilFieldEntry
RimOilRegionEntry
RimPlotAxisAnnotation
RimPlotCellFilterCollection
RimPlotCellPropertyFilter
RimPolylineAppearance
RimPolylinesAnnotationInView
RimPolylinesFromFileAnnotationInView
RimReachCircleAnnotation
RimReachCircleAnnotationInView
RimSaturationPressurePlot
RimSaturationPressurePlotCollection
RimStatisticalCalculation
RimStatisticalCollection
RimStimPlanColors
RimStimPlanFractureTemplate
RimStimPlanLegendConfig
RimSummaryCalculation
RimSummaryCalculationCollection
RimSummaryCalculationVariable
RimSummaryCurveCollection
RimSummaryCurveCollectionModifier
RimTensorResults
RimTernaryLegendConfig
RimTextAnnotation
RimTextAnnotationInView
RimTimeStepFilter
RimUserDefinedPolylinesAnnotationInView
RimViewLinkerCollection
RimViewNameConfig
RimVirtualPerforationResults
RimWellLogExtractionCurve
RimWellLogExtractionCurveNameConfig
RimWellLogFileCurveNameConfig
RimWellLogPlotNameConfig
RimWellLogRftCurveNameConfig
RimWellLogWbsCurve
RimWellPathEntry
RimWellPathImport
RiuCreateMultipleFractionsUi
RiuMultipleFractionsOptions
ScriptLocation
SimWellFracture
SimWellFractureCollection
SummaryAddress
SummaryCaseCollection
SummaryCaseSubCollection
SummaryCrossPlot
SummaryCrossPlotCollection
SummaryCurve
SummaryCurveAutoName
SummaryCurveFilter
SummaryFilterSettings
SummaryObservedDataFile
SummaryPageDownloadEntity
SummaryPlot
SummaryPlotCollection
SummaryPlotFilterTextCurveSetEditor
SummaryTimeAxisProperties
SummaryYAxisProperties
Surface
SurfaceCollection
SurfaceInView
SurfaceInViewCollection
SurfaceResultDefinition
TC2
TestCommand1
TofAccumulatedPhaseFractionsPlot
TotalWellAllocationPlot
UserDefinedPolylinesAnnotation
ValveTemplate
ValveTemplateCollection
View3dOverlayInfoConfig
ViewController
ViewLinker
WbsParameters
Well
WellAllocationPlot
WellAllocationPlotLegend
WellBoreStabilityPlot
WellDistributionPlot
WellDistributionPlotCollection
WellFlowRateCurve
WellLogFile
WellLogFileChannel
WellLogFileCurve
WellLogPlot
WellLogPlotCollection
WellLogPlotTrack
WellLogRftCurve
WellMeasurement
WellMeasurementCurve
WellMeasurementFilePath
WellMeasurementInView
WellMeasurements
WellMeasurementsInView
WellPath
WellPathAicdParameters
WellPathAttribute
WellPathAttributes
WellPathBase
WellPathCompletion
WellPathCompletionCollection
WellPathCompletions
WellPathFracture
WellPathFractureCollection
WellPathGeometry
WellPathGeometryDef
WellPathTarget
WellPathValve
WellPaths
WellPltPlot
WellPltPlotCollection
WellRftEnsembleCurveSet
WellRftPlot
WellRftPlotCollection
Wells
cloneView
closeProject
computeCaseGroupStatistics
createGridCaseGroup
createGridCaseGroupResult
createLgrForCompletions
createMultiPlot
createMultipleFractures
createSaturationPressurePlots
createStatisticsCase
createStatisticsCaseResult
createView
createViewResult
createWbsPlotResult
createWellBoreStabilityPlot
exportContourMapToText
exportFlowCharacteristics
exportLgrForCompletions
exportMsw
exportMultiCaseSnapshots
exportProperty
exportPropertyInViews
exportSimWellFractureCompletions
exportSnapshots
exportVisibleCells
exportWellLogPlotData
exportWellLogPlotDataResult
exportWellPathCompletions
exportWellPaths
importFormationNames
importWellLogFiles
importWellLogFilesResult
importWellPaths
importWellPathsResult
loadCase
loadCaseResult
openProject
replaceCase
replaceMultipleCases
replaceSourceCases
runOctaveScript
saveProject
saveProjectAs
scaleFractureTemplate
setExportFolder
setFractureContainment
setMainWindowSize
setPlotWindowSize
setStartDir
setTimeStep
stackCurves
unstackCurves

View File

@@ -19,6 +19,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiaEclipseFileNameTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaFeatureCommandContext.h
${CMAKE_CURRENT_LIST_DIR}/RiaStringListSerializer.h
${CMAKE_CURRENT_LIST_DIR}/RiaNncDefines.h
${CMAKE_CURRENT_LIST_DIR}/RiaFractureModelDefines.h
)
set (SOURCE_GROUP_SOURCE_FILES
@@ -42,6 +43,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiaEclipseFileNameTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaFeatureCommandContext.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaStringListSerializer.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaNncDefines.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaFractureModelDefines.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@@ -38,15 +38,25 @@
#include "RicfCommandObject.h"
#include "Rim2dIntersectionViewCollection.h"
#include "RimAnalysisPlot.h"
#include "RimAnalysisPlotCollection.h"
#include "RimAnnotationCollection.h"
#include "RimAnnotationInViewCollection.h"
#include "RimAnnotationTextAppearance.h"
#include "RimCellRangeFilterCollection.h"
#include "RimCommandObject.h"
#include "RimCompletionTemplateCollection.h"
#include "RimCorrelationPlot.h"
#include "RimCorrelationPlotCollection.h"
#include "RimCorrelationReportPlot.h"
#include "RimEclipseCaseCollection.h"
#include "RimEclipseView.h"
#include "RimFlowPlotCollection.h"
#include "RimFormationNamesCollection.h"
#include "RimFractureModel.h"
#include "RimFractureModelCollection.h"
#include "RimFractureModelPlot.h"
#include "RimFractureModelPlotCollection.h"
#include "RimFractureTemplateCollection.h"
#include "RimGeoMechCase.h"
#include "RimGeoMechCellColors.h"
@@ -84,12 +94,14 @@
#include "RimWellLogFile.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotCollection.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RimWellPathFracture.h"
#include "RimWellPltPlot.h"
#include "RimWellRftPlot.h"
#include "Riu3DMainWindowTools.h"
#include "RiuGuiTheme.h"
#include "RiuViewer.h"
#include "RiuViewerCommands.h"
@@ -318,16 +330,16 @@ bool RiaApplication::openFile( const QString& fileName )
RiaDefines::ImportFileType fileType = RiaDefines::obtainFileTypeFromFileName( fileName );
if ( fileType == RiaDefines::RESINSIGHT_PROJECT_FILE )
if ( fileType == RiaDefines::ImportFileType::RESINSIGHT_PROJECT_FILE )
{
loadingSucceded = loadProject( fileName );
}
else if ( fileType == RiaDefines::GEOMECH_ODB_FILE )
else if ( fileType == RiaDefines::ImportFileType::GEOMECH_ODB_FILE )
{
loadingSucceded = openOdbCaseFromFile( fileName );
lastUsedDialogTag = "GEOMECH_MODEL";
}
else if ( fileType & RiaDefines::ANY_ECLIPSE_FILE )
else if ( int( fileType ) & int( RiaDefines::ImportFileType::ANY_ECLIPSE_FILE ) )
{
loadingSucceded = RicImportGeneralDataFeature::openEclipseFilesFromFileNames( QStringList{fileName}, true );
lastUsedDialogTag = RiaDefines::defaultDirectoryLabel( fileType );
@@ -501,15 +513,10 @@ bool RiaApplication::loadProject( const QString& projectFileName,
if ( oilField == nullptr ) continue;
if ( oilField->wellPathCollection == nullptr )
{
// printf("Create well path collection for oil field %i in loadProject.\n", oilFieldIdx);
oilField->wellPathCollection = new RimWellPathCollection();
}
if ( oilField->wellPathCollection )
{
oilField->wellPathCollection->loadDataAndUpdate();
oilField->wellPathCollection->readWellPathFormationFiles();
}
oilField->wellPathCollection->loadDataAndUpdate();
}
{
@@ -544,7 +551,7 @@ bool RiaApplication::loadProject( const QString& projectFileName,
observedFmuData->createRftReaderInterface();
}
oilField->fractureDefinitionCollection()->loadAndUpdateData();
oilField->completionTemplateCollection()->loadAndUpdateData();
oilField->fractureDefinitionCollection()->createAndAssignTemplateCopyForNonMatchingUnit();
{
@@ -563,7 +570,7 @@ bool RiaApplication::loadProject( const QString& projectFileName,
// If load action is specified to recalculate statistics, do it now.
// Apparently this needs to be done before the views are loaded, lest the number of time steps for statistics will
// be clamped
if ( loadAction & PLA_CALCULATE_STATISTICS )
if ( loadAction == ProjectLoadAction::PLA_CALCULATE_STATISTICS )
{
for ( size_t oilFieldIdx = 0; oilFieldIdx < m_project->oilFields().size(); oilFieldIdx++ )
{
@@ -692,7 +699,7 @@ bool RiaApplication::loadProject( const QString& projectFileName,
//--------------------------------------------------------------------------------------------------
bool RiaApplication::loadProject( const QString& projectFileName )
{
return loadProject( projectFileName, PLA_NONE, nullptr );
return loadProject( projectFileName, ProjectLoadAction::PLA_NONE, nullptr );
}
//--------------------------------------------------------------------------------------------------
@@ -832,15 +839,8 @@ bool RiaApplication::openOdbCaseFromFile( const QString& fileName, bool applyTim
QFileInfo gridFileName( fileName );
QString caseName = gridFileName.completeBaseName();
RimGeoMechCase* geoMechCase = new RimGeoMechCase();
geoMechCase->setGridFileName( fileName );
geoMechCase->caseUserDescription = caseName;
geoMechCase->setApplyTimeFilter( applyTimeStepFilter );
m_project->assignCaseIdToCase( geoMechCase );
RimGeoMechModels* geoMechModelCollection = m_project->activeOilField() ? m_project->activeOilField()->geoMechModels()
: nullptr;
// Create the geoMech model container if it is not there already
if ( geoMechModelCollection == nullptr )
{
@@ -848,6 +848,22 @@ bool RiaApplication::openOdbCaseFromFile( const QString& fileName, bool applyTim
m_project->activeOilField()->geoMechModels = geoMechModelCollection;
}
// Check if the file is already open, the odb reader does not support opening the same file twice very well
for ( auto gmcase : geoMechModelCollection->cases() )
{
if ( gmcase->gridFileName() == fileName )
{
RiaLogging::warning( "File has already been opened. Cannot open the file twice! - " + fileName );
return false;
}
}
RimGeoMechCase* geoMechCase = new RimGeoMechCase();
geoMechCase->setGridFileName( fileName );
geoMechCase->caseUserDescription = caseName;
geoMechCase->setApplyTimeFilter( applyTimeStepFilter );
m_project->assignCaseIdToCase( geoMechCase );
RimGeoMechView* riv = geoMechCase->createAndAddReservoirView();
caf::ProgressInfo progress( 11, "Loading Case" );
progress.setNextProgressIncrement( 10 );
@@ -859,7 +875,7 @@ bool RiaApplication::openOdbCaseFromFile( const QString& fileName, bool applyTim
delete geoMechCase;
return false;
}
geoMechModelCollection->cases.push_back( geoMechCase );
geoMechModelCollection->addCase( geoMechCase );
progress.incrementProgress();
progress.setProgressDescription( "Loading results information" );
@@ -1123,9 +1139,6 @@ bool RiaApplication::launchProcess( const QString& program,
stopMonitoringWorkProgress();
// QMessageBox::warning(m_mainWindow, "Script execution", "Failed to start script executable
// located at\n" + program);
return false;
}
@@ -1133,9 +1146,6 @@ bool RiaApplication::launchProcess( const QString& program,
}
else
{
// QMessageBox::warning(nullptr,
// "Script execution",
// "An Octave process is still running. Please stop this process before executing a new script.");
return false;
}
}
@@ -1204,9 +1214,9 @@ void RiaApplication::applyPreferences()
// instead of using the application font
std::map<RiaDefines::FontSettingType, RiaFontCache::FontSize> fontSizes = m_preferences->defaultFontSizes();
m_defaultSceneFont = RiaFontCache::getFont( fontSizes[RiaDefines::SCENE_FONT] );
m_defaultAnnotationFont = RiaFontCache::getFont( fontSizes[RiaDefines::ANNOTATION_FONT] );
m_defaultWellLabelFont = RiaFontCache::getFont( fontSizes[RiaDefines::WELL_LABEL_FONT] );
m_defaultSceneFont = RiaFontCache::getFont( fontSizes[RiaDefines::FontSettingType::SCENE_FONT] );
m_defaultAnnotationFont = RiaFontCache::getFont( fontSizes[RiaDefines::FontSettingType::ANNOTATION_FONT] );
m_defaultWellLabelFont = RiaFontCache::getFont( fontSizes[RiaDefines::FontSettingType::WELL_LABEL_FONT] );
if ( this->project() )
{
@@ -1350,12 +1360,8 @@ int RiaApplication::launchUnitTests()
caf::ProgressInfoBlocker progressBlocker;
cvf::Assert::setReportMode( cvf::Assert::CONSOLE );
#if QT_VERSION < 0x050000
int argc = QCoreApplication::argc();
char** argv = QCoreApplication::argv();
#else
int argc = QCoreApplication::arguments().size();
QStringList arguments = QCoreApplication::arguments();
int argc = QCoreApplication::arguments().size();
QStringList arguments = QCoreApplication::arguments();
std::vector<std::string> argumentsStd;
for ( QString qstring : arguments )
{
@@ -1367,15 +1373,19 @@ int RiaApplication::launchUnitTests()
argVector.push_back( &string.front() );
}
char** argv = argVector.data();
#endif
testing::InitGoogleTest( &argc, argv );
//
// Use the gtest filter to execute a subset of tests
//::testing::GTEST_FLAG( filter ) = "*RifCaseRealizationParametersReaderTest*";
//
//
QString filterText = RiaPreferences::current()->gtestFilter();
if ( !filterText.isEmpty() )
{
::testing::GTEST_FLAG( filter ) = filterText.toStdString();
// Example on filter syntax
//::testing::GTEST_FLAG( filter ) = "*RifCaseRealizationParametersReaderTest*";
}
// Use this macro in main() to run all tests. It returns 0 if all
// tests are successful, or 1 otherwise.
@@ -1456,6 +1466,19 @@ cvf::Font* RiaApplication::defaultSceneFont()
return m_defaultSceneFont.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Font* RiaApplication::sceneFont( int fontSize )
{
if ( fontSize != caf::FontTools::absolutePointSize( m_preferences->defaultSceneFontSize() ) )
{
auto font = RiaFontCache::getFont( fontSize );
return font.p();
}
return defaultSceneFont();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1543,7 +1566,10 @@ void RiaApplication::loadAndUpdatePlotData()
RimPltPlotCollection* pltColl = nullptr;
RimGridCrossPlotCollection* gcpColl = nullptr;
RimSaturationPressurePlotCollection* sppColl = nullptr;
RimAnalysisPlotCollection* alsColl = nullptr;
RimCorrelationPlotCollection* corrColl = nullptr;
RimMultiPlotCollection* gpwColl = nullptr;
RimFractureModelPlotCollection* frmColl = nullptr;
if ( m_project->mainPlotCollection() )
{
@@ -1579,22 +1605,37 @@ void RiaApplication::loadAndUpdatePlotData()
{
sppColl = m_project->mainPlotCollection()->saturationPressurePlotCollection();
}
if ( m_project->mainPlotCollection()->analysisPlotCollection() )
{
alsColl = m_project->mainPlotCollection()->analysisPlotCollection();
}
if ( m_project->mainPlotCollection->correlationPlotCollection() )
{
corrColl = m_project->mainPlotCollection()->correlationPlotCollection();
}
if ( m_project->mainPlotCollection()->multiPlotCollection() )
{
gpwColl = m_project->mainPlotCollection()->multiPlotCollection();
}
if ( m_project->mainPlotCollection()->fractureModelPlotCollection() )
{
frmColl = m_project->mainPlotCollection()->fractureModelPlotCollection();
}
}
size_t plotCount = 0;
plotCount += wlpColl ? wlpColl->wellLogPlots().size() : 0;
plotCount += spColl ? spColl->summaryPlots().size() : 0;
plotCount += scpColl ? scpColl->summaryPlots().size() : 0;
plotCount += spColl ? spColl->plots().size() : 0;
plotCount += scpColl ? scpColl->plots().size() : 0;
plotCount += flowColl ? flowColl->plotCount() : 0;
plotCount += rftColl ? rftColl->rftPlots().size() : 0;
plotCount += pltColl ? pltColl->pltPlots().size() : 0;
plotCount += gcpColl ? gcpColl->gridCrossPlots().size() : 0;
plotCount += sppColl ? sppColl->plots().size() : 0;
plotCount += gcpColl ? gcpColl->plotCount() : 0;
plotCount += sppColl ? sppColl->plotCount() : 0;
plotCount += alsColl ? alsColl->plotCount() : 0;
plotCount += corrColl ? corrColl->plotCount() + corrColl->reports().size() : 0;
plotCount += gpwColl ? gpwColl->multiPlots().size() : 0;
plotCount += frmColl ? frmColl->fractureModelPlots().size() : 0;
if ( plotCount > 0 )
{
@@ -1610,16 +1651,16 @@ void RiaApplication::loadAndUpdatePlotData()
if ( spColl )
{
for ( size_t wlpIdx = 0; wlpIdx < spColl->summaryPlots().size(); ++wlpIdx )
for ( auto plot : spColl->plots() )
{
spColl->summaryPlots[wlpIdx]->loadDataAndUpdate();
plot->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
if ( scpColl )
{
for ( auto plot : scpColl->summaryPlots() )
for ( auto plot : scpColl->plots() )
{
plot->loadDataAndUpdate();
plotProgress.incrementProgress();
@@ -1653,7 +1694,7 @@ void RiaApplication::loadAndUpdatePlotData()
if ( gcpColl )
{
for ( const auto& gcpPlot : gcpColl->gridCrossPlots() )
for ( const auto& gcpPlot : gcpColl->plots() )
{
gcpPlot->loadDataAndUpdate();
plotProgress.incrementProgress();
@@ -1669,6 +1710,29 @@ void RiaApplication::loadAndUpdatePlotData()
}
}
if ( alsColl )
{
for ( const auto& alsPlot : alsColl->plots() )
{
alsPlot->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
if ( corrColl )
{
for ( const auto& corrPlot : corrColl->plots() )
{
corrPlot->loadDataAndUpdate();
plotProgress.incrementProgress();
}
for ( const auto& reports : corrColl->reports() )
{
reports->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
if ( gpwColl )
{
for ( const auto& multiPlot : gpwColl->multiPlots() )
@@ -1677,6 +1741,15 @@ void RiaApplication::loadAndUpdatePlotData()
plotProgress.incrementProgress();
}
}
if ( frmColl )
{
for ( const auto& fractureModelPlot : frmColl->fractureModelPlots() )
{
fractureModelPlot->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
}
}
@@ -1777,8 +1850,10 @@ bool RiaApplication::generateCode( const QString& fileName, QString* errMsg )
out << "+++ \n";
out << "# Introduction\n\n";
out << "As the Python interface is growing release by release, we are investigating how to automate "
"the building of reference documentation. This document is not complete, but will improve as "
out << "As the Python interface is growing release by release, we are investigating how to "
"automate "
"the building of reference documentation. This document is not complete, but will improve "
"as "
"the automation "
"moves forward.\n";

View File

@@ -87,13 +87,13 @@ class ProgramOptions;
class RiaApplication
{
public:
enum ProjectLoadAction
enum class ProjectLoadAction
{
PLA_NONE = 0,
PLA_CALCULATE_STATISTICS = 1
};
enum ApplicationStatus
enum class ApplicationStatus
{
KEEP_GOING = 0,
EXIT_COMPLETED,
@@ -188,6 +188,7 @@ public:
static std::vector<QString> readFileListFromTextFile( QString listFileName );
cvf::Font* defaultSceneFont();
cvf::Font* sceneFont( int fontSize );
cvf::Font* defaultAnnotationFont();
cvf::Font* defaultWellLabelFont();

View File

@@ -56,7 +56,7 @@ RiaCompletionTypeCalculationScheduler* RiaCompletionTypeCalculationScheduler::in
void RiaCompletionTypeCalculationScheduler::scheduleRecalculateCompletionTypeAndRedrawAllViews()
{
std::vector<RimEclipseCase*> eclipseCases =
RiaApplication::instance()->project()->activeOilField()->analysisModels->cases().childObjects();
RimProject::current()->activeOilField()->analysisModels->cases().childObjects();
scheduleRecalculateCompletionTypeAndRedrawAllViews( eclipseCases );
}
@@ -85,8 +85,8 @@ void RiaCompletionTypeCalculationScheduler::scheduleRecalculateCompletionTypeAnd
if ( eclipseCase->eclipseCaseData() )
{
eclipseCase->eclipseCaseData()
->results( RiaDefines::MATRIX_MODEL )
->clearScalarResult( RiaDefines::DYNAMIC_NATIVE, RiaDefines::completionTypeResultName() );
->results( RiaDefines::PorosityModelType::MATRIX_MODEL )
->clearScalarResult( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaDefines::completionTypeResultName() );
// Delete virtual perforation transmissibilities, as these are the basis for the computation of completion type
eclipseCase->eclipseCaseData()->setVirtualPerforationTransmissibilities( nullptr );

View File

@@ -104,7 +104,7 @@ void RiaConsoleApplication::initialize()
RiaApplication::initialize();
RiaLogging::setLoggerInstance( new RiaStdOutLogger );
RiaLogging::loggerInstance()->setLevel( RI_LL_DEBUG );
RiaLogging::loggerInstance()->setLevel( int( RILogLevel::RI_LL_DEBUG ) );
m_socketServer = new RiaSocketServer( this );
}
@@ -120,14 +120,14 @@ RiaApplication::ApplicationStatus RiaConsoleApplication::handleArguments( cvf::P
// --------------------------------------------------------
if ( cvf::Option o = progOpt->option( "ignoreArgs" ) )
{
return KEEP_GOING;
return ApplicationStatus::KEEP_GOING;
}
if ( progOpt->option( "help" ) || progOpt->option( "?" ) )
{
this->showFormattedTextInMessageBoxOrConsole( "\nThe current command line options in ResInsight are:\n" +
this->commandLineParameterHelp() );
return RiaApplication::EXIT_COMPLETED;
return RiaApplication::ApplicationStatus::EXIT_COMPLETED;
}
// Code generation
@@ -141,10 +141,10 @@ RiaApplication::ApplicationStatus RiaConsoleApplication::handleArguments( cvf::P
if ( !RiaApplication::generateCode( outputFile, &errMsg ) )
{
RiaLogging::error( QString( "Error: %1" ).arg( errMsg ) );
return RiaApplication::EXIT_WITH_ERROR;
return RiaApplication::ApplicationStatus::EXIT_WITH_ERROR;
}
return RiaApplication::EXIT_COMPLETED;
return RiaApplication::ApplicationStatus::EXIT_COMPLETED;
}
// Unit testing
@@ -154,12 +154,12 @@ RiaApplication::ApplicationStatus RiaConsoleApplication::handleArguments( cvf::P
int testReturnValue = launchUnitTestsWithConsole();
if ( testReturnValue == 0 )
{
return RiaApplication::EXIT_COMPLETED;
return RiaApplication::ApplicationStatus::EXIT_COMPLETED;
}
else
{
RiaLogging::error( "Error running unit tests" );
return RiaApplication::EXIT_WITH_ERROR;
return RiaApplication::ApplicationStatus::EXIT_WITH_ERROR;
}
}
@@ -185,7 +185,7 @@ RiaApplication::ApplicationStatus RiaConsoleApplication::handleArguments( cvf::P
if ( !projectFileName.isEmpty() )
{
cvf::ref<RiaProjectModifier> projectModifier;
RiaApplication::ProjectLoadAction projectLoadAction = RiaApplication::PLA_NONE;
RiaApplication::ProjectLoadAction projectLoadAction = RiaApplication::ProjectLoadAction::PLA_NONE;
if ( cvf::Option o = progOpt->option( "replaceCase" ) )
{
@@ -242,7 +242,7 @@ RiaApplication::ApplicationStatus RiaConsoleApplication::handleArguments( cvf::P
}
}
projectLoadAction = RiaApplication::PLA_CALCULATE_STATISTICS;
projectLoadAction = RiaApplication::ProjectLoadAction::PLA_CALCULATE_STATISTICS;
}
if ( cvf::Option o = progOpt->option( "replacePropertiesFolder" ) )
@@ -328,7 +328,7 @@ RiaApplication::ApplicationStatus RiaConsoleApplication::handleArguments( cvf::P
{
RiaProjectModifier projectModifier;
projectModifier.setReplaceCaseFirstOccurrence( caseFile );
loadProject( projectFileName, RiaApplication::PLA_NONE, &projectModifier );
loadProject( projectFileName, RiaApplication::ProjectLoadAction::PLA_NONE, &projectModifier );
executeCommandFile( commandFile );
}
}
@@ -357,7 +357,7 @@ RiaApplication::ApplicationStatus RiaConsoleApplication::handleArguments( cvf::P
}
}
loadProject( projectFileName, RiaApplication::PLA_NONE, &projectModifier );
loadProject( projectFileName, RiaApplication::ProjectLoadAction::PLA_NONE, &projectModifier );
executeCommandFile( commandFile );
}
}
@@ -366,10 +366,10 @@ RiaApplication::ApplicationStatus RiaConsoleApplication::handleArguments( cvf::P
{
executeCommandFile( commandFile );
}
return EXIT_COMPLETED;
return ApplicationStatus::EXIT_COMPLETED;
}
return KEEP_GOING;
return ApplicationStatus::KEEP_GOING;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -27,82 +27,103 @@ namespace caf
template <>
void caf::AppEnum<RiaDefines::ResultCatType>::setUp()
{
addItem( RiaDefines::DYNAMIC_NATIVE, "DYNAMIC_NATIVE", "Dynamic" );
addItem( RiaDefines::STATIC_NATIVE, "STATIC_NATIVE", "Static" );
addItem( RiaDefines::SOURSIMRL, "SOURSIMRL", "SourSimRL" );
addItem( RiaDefines::GENERATED, "GENERATED", "Generated" );
addItem( RiaDefines::INPUT_PROPERTY, "INPUT_PROPERTY", "Input Property" );
addItem( RiaDefines::FORMATION_NAMES, "FORMATION_NAMES", "Formation Names" );
addItem( RiaDefines::ALLAN_DIAGRAMS, "ALLAN_DIAGRAMS", "Allan Diagrams" );
addItem( RiaDefines::FLOW_DIAGNOSTICS, "FLOW_DIAGNOSTICS", "Flow Diagnostics" );
addItem( RiaDefines::INJECTION_FLOODING, "INJECTION_FLOODING", "Injection Flooding" );
setDefault( RiaDefines::DYNAMIC_NATIVE );
addItem( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "DYNAMIC_NATIVE", "Dynamic" );
addItem( RiaDefines::ResultCatType::STATIC_NATIVE, "STATIC_NATIVE", "Static" );
addItem( RiaDefines::ResultCatType::SOURSIMRL, "SOURSIMRL", "SourSimRL" );
addItem( RiaDefines::ResultCatType::GENERATED, "GENERATED", "Generated" );
addItem( RiaDefines::ResultCatType::INPUT_PROPERTY, "INPUT_PROPERTY", "Input Property" );
addItem( RiaDefines::ResultCatType::FORMATION_NAMES, "FORMATION_NAMES", "Formation Names" );
addItem( RiaDefines::ResultCatType::ALLAN_DIAGRAMS, "ALLAN_DIAGRAMS", "Allan Diagrams" );
addItem( RiaDefines::ResultCatType::FLOW_DIAGNOSTICS, "FLOW_DIAGNOSTICS", "Flow Diagnostics" );
addItem( RiaDefines::ResultCatType::INJECTION_FLOODING, "INJECTION_FLOODING", "Injection Flooding" );
setDefault( RiaDefines::ResultCatType::DYNAMIC_NATIVE );
}
template <>
void caf::AppEnum<RiaDefines::DepthUnitType>::setUp()
{
addItem( RiaDefines::UNIT_METER, "UNIT_METER", "Meter" );
addItem( RiaDefines::UNIT_FEET, "UNIT_FEET", "Feet" );
addItem( RiaDefines::UNIT_NONE, "UNIT_NONE", "None" );
addItem( RiaDefines::DepthUnitType::UNIT_METER, "UNIT_METER", "Meter" );
addItem( RiaDefines::DepthUnitType::UNIT_FEET, "UNIT_FEET", "Feet" );
addItem( RiaDefines::DepthUnitType::UNIT_NONE, "UNIT_NONE", "None" );
setDefault( RiaDefines::UNIT_METER );
setDefault( RiaDefines::DepthUnitType::UNIT_METER );
}
template <>
void caf::AppEnum<RiaDefines::DepthTypeEnum>::setUp()
{
addItem( RiaDefines::MEASURED_DEPTH, "MEASURED_DEPTH", "Measured Depth" );
addItem( RiaDefines::TRUE_VERTICAL_DEPTH, "TRUE_VERTICAL_DEPTH", "True Vertical Depth (MSL)" );
addItem( RiaDefines::PSEUDO_LENGTH, "PSEUDO_LENGTH", "Pseudo Length" );
addItem( RiaDefines::CONNECTION_NUMBER, "CONNECTION_NUMBER", "Connection Number" );
addItem( RiaDefines::TRUE_VERTICAL_DEPTH_RKB, "TRUE_VERTICAL_DEPTH_RKB", "True Vertical Depth (RKB)" );
setDefault( RiaDefines::MEASURED_DEPTH );
addItem( RiaDefines::DepthTypeEnum::MEASURED_DEPTH, "MEASURED_DEPTH", "Measured Depth" );
addItem( RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH, "TRUE_VERTICAL_DEPTH", "True Vertical Depth (MSL)" );
addItem( RiaDefines::DepthTypeEnum::PSEUDO_LENGTH, "PSEUDO_LENGTH", "Pseudo Length" );
addItem( RiaDefines::DepthTypeEnum::CONNECTION_NUMBER, "CONNECTION_NUMBER", "Connection Number" );
addItem( RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH_RKB, "TRUE_VERTICAL_DEPTH_RKB", "True Vertical Depth (RKB)" );
setDefault( RiaDefines::DepthTypeEnum::MEASURED_DEPTH );
}
template <>
void caf::AppEnum<RiaDefines::PlotAxis>::setUp()
{
addItem( RiaDefines::PLOT_AXIS_LEFT, "PLOT_AXIS_LEFT", "Left" );
addItem( RiaDefines::PLOT_AXIS_RIGHT, "PLOT_AXIS_RIGHT", "Right" );
addItem( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "PLOT_AXIS_LEFT", "Left" );
addItem( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT, "PLOT_AXIS_RIGHT", "Right" );
setDefault( RiaDefines::PLOT_AXIS_LEFT );
setDefault( RiaDefines::PlotAxis::PLOT_AXIS_LEFT );
}
template <>
void caf::AppEnum<RiaDefines::PhaseType>::setUp()
{
addItem( RiaDefines::OIL_PHASE, "OIL_PHASE", "Oil" );
addItem( RiaDefines::GAS_PHASE, "GAS_PHASE", "Gas" );
addItem( RiaDefines::WATER_PHASE, "WATER_PHASE", "Water" );
setDefault( RiaDefines::OIL_PHASE );
addItem( RiaDefines::PhaseType::OIL_PHASE, "OIL_PHASE", "Oil" );
addItem( RiaDefines::PhaseType::GAS_PHASE, "GAS_PHASE", "Gas" );
addItem( RiaDefines::PhaseType::WATER_PHASE, "WATER_PHASE", "Water" );
setDefault( RiaDefines::PhaseType::OIL_PHASE );
}
template <>
void caf::AppEnum<RiaDefines::WellPathComponentType>::setUp()
{
addItem( RiaDefines::WELL_PATH, "WELL_PATH", "Well Path" );
addItem( RiaDefines::PERFORATION_INTERVAL, "PERFORATION_INTERVAL", "Perforation Interval" );
addItem( RiaDefines::FISHBONES, "FISHBONES", "Fishbones" );
addItem( RiaDefines::FRACTURE, "FRACTURE", "Fracture" );
addItem( RiaDefines::ICD, "ICD", "ICD" );
addItem( RiaDefines::AICD, "AICD", "AICD" );
addItem( RiaDefines::ICV, "ICV", "ICV" );
addItem( RiaDefines::CASING, "CASING", "Casing" );
addItem( RiaDefines::LINER, "LINER", "Liner" );
addItem( RiaDefines::PACKER, "PACKER", "Packer" );
addItem( RiaDefines::UNDEFINED_COMPONENT, "UNDEFINED", "Undefined Component" );
setDefault( RiaDefines::WELL_PATH );
addItem( RiaDefines::WellPathComponentType::WELL_PATH, "WELL_PATH", "Well Path" );
addItem( RiaDefines::WellPathComponentType::PERFORATION_INTERVAL, "PERFORATION_INTERVAL", "Perforation Interval" );
addItem( RiaDefines::WellPathComponentType::FISHBONES, "FISHBONES", "Fishbones" );
addItem( RiaDefines::WellPathComponentType::FRACTURE, "FRACTURE", "Fracture" );
addItem( RiaDefines::WellPathComponentType::ICD, "ICD", "ICD" );
addItem( RiaDefines::WellPathComponentType::AICD, "AICD", "AICD" );
addItem( RiaDefines::WellPathComponentType::ICV, "ICV", "ICV" );
addItem( RiaDefines::WellPathComponentType::CASING, "CASING", "Casing" );
addItem( RiaDefines::WellPathComponentType::LINER, "LINER", "Liner" );
addItem( RiaDefines::WellPathComponentType::PACKER, "PACKER", "Packer" );
addItem( RiaDefines::WellPathComponentType::UNDEFINED_COMPONENT, "UNDEFINED", "Undefined Component" );
setDefault( RiaDefines::WellPathComponentType::WELL_PATH );
}
template <>
void caf::AppEnum<RiaDefines::MeshModeType>::setUp()
{
addItem( RiaDefines::FULL_MESH, "FULL_MESH", "All" );
addItem( RiaDefines::FAULTS_MESH, "FAULTS_MESH", "Faults only" );
addItem( RiaDefines::NO_MESH, "NO_MESH", "None" );
setDefault( RiaDefines::FULL_MESH );
addItem( RiaDefines::MeshModeType::FULL_MESH, "FULL_MESH", "All" );
addItem( RiaDefines::MeshModeType::FAULTS_MESH, "FAULTS_MESH", "Faults only" );
addItem( RiaDefines::MeshModeType::NO_MESH, "NO_MESH", "None" );
setDefault( RiaDefines::MeshModeType::FULL_MESH );
}
template <>
void caf::AppEnum<RiaDefines::GridCaseAxis>::setUp()
{
addItem( RiaDefines::GridCaseAxis::UNDEFINED_AXIS, "None", "None" );
addItem( RiaDefines::GridCaseAxis::AXIS_I, "I", "I" );
addItem( RiaDefines::GridCaseAxis::AXIS_J, "J", "J" );
addItem( RiaDefines::GridCaseAxis::AXIS_K, "K", "K" );
setDefault( RiaDefines::GridCaseAxis::AXIS_K );
}
template <>
void caf::AppEnum<RiaDefines::ThemeEnum>::setUp()
{
addItem( RiaDefines::ThemeEnum::DEFAULT, "DEFAULT", "Default theme" );
addItem( RiaDefines::ThemeEnum::DARK, "DARK", "Dark theme" );
addItem( RiaDefines::ThemeEnum::LIGHT, "LIGHT", "Light theme" );
setDefault( RiaDefines::ThemeEnum::DEFAULT );
}
} // namespace caf
//--------------------------------------------------------------------------------------------------
@@ -167,7 +188,9 @@ bool RiaDefines::isNativeCategoryResult( const QString& resultName )
//--------------------------------------------------------------------------------------------------
QString RiaDefines::undefinedResultName()
{
return "None";
const static QString undefResultName = "None";
return undefResultName;
}
//--------------------------------------------------------------------------------------------------
@@ -568,29 +591,29 @@ RiaDefines::ImportFileType RiaDefines::obtainFileTypeFromFileName( const QString
{
if ( fileName.endsWith( "EGRID", Qt::CaseInsensitive ) )
{
return ECLIPSE_EGRID_FILE;
return ImportFileType::ECLIPSE_EGRID_FILE;
}
else if ( fileName.endsWith( "GRID", Qt::CaseInsensitive ) )
{
return ECLIPSE_GRID_FILE;
return ImportFileType::ECLIPSE_GRID_FILE;
}
else if ( fileName.endsWith( "GRDECL", Qt::CaseInsensitive ) )
{
return ECLIPSE_INPUT_FILE;
return ImportFileType::ECLIPSE_INPUT_FILE;
}
else if ( fileName.endsWith( "SMSPEC", Qt::CaseInsensitive ) )
{
return ECLIPSE_SUMMARY_FILE;
return ImportFileType::ECLIPSE_SUMMARY_FILE;
}
else if ( fileName.endsWith( "ODB", Qt::CaseInsensitive ) )
{
return GEOMECH_ODB_FILE;
return ImportFileType::GEOMECH_ODB_FILE;
}
else if ( fileName.endsWith( ".rsp", Qt::CaseInsensitive ) || fileName.endsWith( ".rip", Qt::CaseInsensitive ) )
{
return RESINSIGHT_PROJECT_FILE;
return ImportFileType::RESINSIGHT_PROJECT_FILE;
}
return NOT_A_VALID_IMPORT_FILE;
return ImportFileType::NOT_A_VALID_IMPORT_FILE;
}
//--------------------------------------------------------------------------------------------------
@@ -600,25 +623,27 @@ QString RiaDefines::defaultDirectoryLabel( RiaDefines::ImportFileType fileType )
{
QString defaultDirLabel;
if ( fileType == ANY_ECLIPSE_FILE )
int fileTypeAsInt = int( fileType );
if ( fileType == ImportFileType::ANY_ECLIPSE_FILE )
{
defaultDirLabel = "GENERAL_DATA";
}
else if ( fileType & ECLIPSE_RESULT_GRID )
else if ( fileTypeAsInt & int( ImportFileType::ECLIPSE_RESULT_GRID ) )
{
defaultDirLabel = "BINARY_GRID";
}
else if ( fileType & ECLIPSE_INPUT_FILE )
else if ( fileTypeAsInt & int( ImportFileType::ECLIPSE_INPUT_FILE ) )
{
defaultDirLabel = "INPUT_FILES";
}
else if ( fileType & ECLIPSE_SUMMARY_FILE )
else if ( fileTypeAsInt & int( ImportFileType::ECLIPSE_SUMMARY_FILE ) )
{
// TODO: Summary files used "INPUT_FILES" as last used directory.
// Check if this is correct.
defaultDirLabel = "INPUT_FILES";
}
else if ( fileType & GEOMECH_ODB_FILE )
else if ( fileTypeAsInt & int( ImportFileType::GEOMECH_ODB_FILE ) )
{
defaultDirLabel = "GEOMECH_MODEL";
}

View File

@@ -26,7 +26,7 @@
namespace RiaDefines
{
enum ResultCatType
enum class ResultCatType
{
DYNAMIC_NATIVE,
STATIC_NATIVE,
@@ -44,7 +44,7 @@ enum ResultCatType
// WARNING: DO NOT CHANGE THE ORDER WITHOUT KNOWING WHAT YOU ARE DOING!
// You may well change the behaviour of property filters.
enum WellPathComponentType
enum class WellPathComponentType
{
// Production Tube
WELL_PATH,
@@ -62,7 +62,7 @@ enum WellPathComponentType
UNDEFINED_COMPONENT
};
enum MeshModeType
enum class MeshModeType
{
FULL_MESH,
FAULTS_MESH,
@@ -135,7 +135,7 @@ std::vector<QString> wbsAngleResultNames();
std::vector<QString> wbsDerivedResultNames();
// Units and conversions
enum DepthUnitType
enum class DepthUnitType
{
UNIT_METER,
UNIT_FEET,
@@ -143,7 +143,7 @@ enum DepthUnitType
};
// Depth types used for well log plots
enum DepthTypeEnum
enum class DepthTypeEnum
{
MEASURED_DEPTH,
TRUE_VERTICAL_DEPTH,
@@ -153,7 +153,7 @@ enum DepthTypeEnum
};
// Defines relate to plotting
enum PlotAxis
enum class PlotAxis
{
PLOT_AXIS_LEFT,
PLOT_AXIS_RIGHT,
@@ -164,14 +164,15 @@ double minimumDefaultValuePlot();
double minimumDefaultLogValuePlot();
double maximumDefaultValuePlot();
enum PhaseType
enum class PhaseType
{
OIL_PHASE,
GAS_PHASE,
WATER_PHASE
WATER_PHASE,
PHASE_NOT_APPLICABLE
};
enum ImportFileType
enum class ImportFileType
{
NOT_A_VALID_IMPORT_FILE = 0x00,
ECLIPSE_GRID_FILE = 0x01,
@@ -188,7 +189,7 @@ enum ImportFileType
ImportFileType obtainFileTypeFromFileName( const QString& fileName );
QString defaultDirectoryLabel( ImportFileType fileTypes );
enum CaseType
enum class CaseType
{
UNDEFINED_CASE = -1,
ECLIPSE_RESULT_CASE = 1,
@@ -198,7 +199,7 @@ enum CaseType
GEOMECH_ODB_CASE = 5
};
enum FontSettingType
enum class FontSettingType
{
SCENE_FONT,
ANNOTATION_FONT,
@@ -206,4 +207,20 @@ enum FontSettingType
PLOT_FONT
};
enum class GridCaseAxis
{
AXIS_I,
AXIS_J,
AXIS_K,
UNDEFINED_AXIS
};
enum class ThemeEnum
{
DEFAULT,
DARK,
LIGHT,
UNDEFINED
};
}; // namespace RiaDefines

View File

@@ -25,14 +25,14 @@ namespace caf
template <>
void caf::AppEnum<RiaEclipseFileNameTools::EclipseFileType>::setUp()
{
addItem( RiaEclipseFileNameTools::ECLIPSE_DATA, "DATA", "Data Deck" );
addItem( RiaEclipseFileNameTools::ECLIPSE_GRID, "GRID", "Grid" );
addItem( RiaEclipseFileNameTools::ECLIPSE_EGRID, "EGRID", "Grid" );
addItem( RiaEclipseFileNameTools::ECLIPSE_UNRST, "UNRST", "Unified Restart" );
addItem( RiaEclipseFileNameTools::ECLIPSE_SMSPEC, "SMSPEC", "Summary Specification" );
addItem( RiaEclipseFileNameTools::ECLIPSE_UNSMRY, "UNSMR", "Summary Vectors" );
addItem( RiaEclipseFileNameTools::EclipseFileType::ECLIPSE_DATA, "DATA", "Data Deck" );
addItem( RiaEclipseFileNameTools::EclipseFileType::ECLIPSE_GRID, "GRID", "Grid" );
addItem( RiaEclipseFileNameTools::EclipseFileType::ECLIPSE_EGRID, "EGRID", "Grid" );
addItem( RiaEclipseFileNameTools::EclipseFileType::ECLIPSE_UNRST, "UNRST", "Unified Restart" );
addItem( RiaEclipseFileNameTools::EclipseFileType::ECLIPSE_SMSPEC, "SMSPEC", "Summary Specification" );
addItem( RiaEclipseFileNameTools::EclipseFileType::ECLIPSE_UNSMRY, "UNSMR", "Summary Vectors" );
addItem( RiaEclipseFileNameTools::RESINSIGHT_PROJECT, "rsp", "ResInsight Project" );
addItem( RiaEclipseFileNameTools::EclipseFileType::RESINSIGHT_PROJECT, "rsp", "ResInsight Project" );
}
} // End namespace caf
@@ -52,7 +52,7 @@ RiaEclipseFileNameTools::RiaEclipseFileNameTools( const QString& inputFilePath )
//--------------------------------------------------------------------------------------------------
QString RiaEclipseFileNameTools::findRelatedSummarySpecFile()
{
return relatedFilePath( ECLIPSE_SMSPEC );
return relatedFilePath( EclipseFileType::ECLIPSE_SMSPEC );
}
//--------------------------------------------------------------------------------------------------
@@ -60,13 +60,13 @@ QString RiaEclipseFileNameTools::findRelatedSummarySpecFile()
//--------------------------------------------------------------------------------------------------
QString RiaEclipseFileNameTools::findRelatedGridFile()
{
QString candidate = relatedFilePath( ECLIPSE_EGRID );
QString candidate = relatedFilePath( EclipseFileType::ECLIPSE_EGRID );
if ( !candidate.isEmpty() )
{
return candidate;
}
return relatedFilePath( ECLIPSE_GRID );
return relatedFilePath( EclipseFileType::ECLIPSE_GRID );
}
//--------------------------------------------------------------------------------------------------
@@ -74,7 +74,7 @@ QString RiaEclipseFileNameTools::findRelatedGridFile()
//--------------------------------------------------------------------------------------------------
QString RiaEclipseFileNameTools::findRelatedDataFile()
{
return relatedFilePath( ECLIPSE_DATA );
return relatedFilePath( EclipseFileType::ECLIPSE_DATA );
}
//--------------------------------------------------------------------------------------------------
@@ -82,7 +82,7 @@ QString RiaEclipseFileNameTools::findRelatedDataFile()
//--------------------------------------------------------------------------------------------------
bool RiaEclipseFileNameTools::isProjectFile( const QString& fileName )
{
return hasMatchingSuffix( fileName, RESINSIGHT_PROJECT );
return hasMatchingSuffix( fileName, EclipseFileType::RESINSIGHT_PROJECT );
}
//--------------------------------------------------------------------------------------------------
@@ -90,12 +90,12 @@ bool RiaEclipseFileNameTools::isProjectFile( const QString& fileName )
//--------------------------------------------------------------------------------------------------
bool RiaEclipseFileNameTools::isGridFile( const QString& fileName )
{
if ( hasMatchingSuffix( fileName, ECLIPSE_EGRID ) )
if ( hasMatchingSuffix( fileName, EclipseFileType::ECLIPSE_EGRID ) )
{
return true;
}
return hasMatchingSuffix( fileName, ECLIPSE_GRID );
return hasMatchingSuffix( fileName, EclipseFileType::ECLIPSE_GRID );
}
//--------------------------------------------------------------------------------------------------
@@ -103,7 +103,7 @@ bool RiaEclipseFileNameTools::isGridFile( const QString& fileName )
//--------------------------------------------------------------------------------------------------
bool RiaEclipseFileNameTools::isSummarySpecFile( const QString& fileName )
{
return hasMatchingSuffix( fileName, ECLIPSE_SMSPEC );
return hasMatchingSuffix( fileName, EclipseFileType::ECLIPSE_SMSPEC );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -30,7 +30,7 @@
class RiaEclipseFileNameTools
{
public:
enum EclipseFileType
enum class EclipseFileType
{
ECLIPSE_DATA,
ECLIPSE_GRID,

View File

@@ -20,71 +20,72 @@
#include "RiaGuiApplication.h"
#include "cafAppEnum.h"
#include "cafFixedAtlasFont.h"
#include <QDesktopWidget>
#include <cmath>
namespace caf
{
template <>
void RiaFontCache::FontSizeType::setUp()
{
addItem( RiaFontCache::FONT_SIZE_8, "8", "8" );
addItem( RiaFontCache::FONT_SIZE_10, "10", "10" );
addItem( RiaFontCache::FONT_SIZE_12, "12", "12" );
addItem( RiaFontCache::FONT_SIZE_14, "14", "14" );
addItem( RiaFontCache::FONT_SIZE_16, "16", "16" );
addItem( RiaFontCache::FONT_SIZE_24, "24", "24" );
addItem( RiaFontCache::FONT_SIZE_32, "32", "32" );
setDefault( RiaFontCache::FONT_SIZE_8 );
}
} // namespace caf
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::FixedAtlasFont::FontSize mapToAtlasFontSize( RiaFontCache::FontSize fontSize )
caf::FixedAtlasFont::FontSize mapToAtlasFontSize( int pointSize )
{
switch ( fontSize )
{
case RiaFontCache::FONT_SIZE_8:
return caf::FixedAtlasFont::POINT_SIZE_8;
case RiaFontCache::FONT_SIZE_10:
return caf::FixedAtlasFont::POINT_SIZE_10;
case RiaFontCache::FONT_SIZE_12:
return caf::FixedAtlasFont::POINT_SIZE_12;
case RiaFontCache::FONT_SIZE_14:
return caf::FixedAtlasFont::POINT_SIZE_14;
case RiaFontCache::FONT_SIZE_16:
return caf::FixedAtlasFont::POINT_SIZE_16;
case RiaFontCache::FONT_SIZE_24:
return caf::FixedAtlasFont::POINT_SIZE_24;
case RiaFontCache::FONT_SIZE_32:
return caf::FixedAtlasFont::POINT_SIZE_32;
default:
return caf::FixedAtlasFont::POINT_SIZE_16;
}
if ( pointSize >= 6 && pointSize < 8 )
return caf::FixedAtlasFont::POINT_SIZE_6;
else if ( pointSize >= 8 && pointSize < 10 )
return caf::FixedAtlasFont::POINT_SIZE_8;
else if ( pointSize >= 10 && pointSize < 12 )
return caf::FixedAtlasFont::POINT_SIZE_10;
else if ( pointSize >= 12 && pointSize < 14 )
return caf::FixedAtlasFont::POINT_SIZE_12;
else if ( pointSize >= 14 && pointSize < 16 )
return caf::FixedAtlasFont::POINT_SIZE_14;
else if ( pointSize >= 16 && pointSize < 20 )
return caf::FixedAtlasFont::POINT_SIZE_16;
else if ( pointSize >= 20 && pointSize < 28 )
return caf::FixedAtlasFont::POINT_SIZE_24;
return caf::FixedAtlasFont::POINT_SIZE_32;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::map<RiaFontCache::FontSize, cvf::ref<caf::FixedAtlasFont>> RiaFontCache::ms_fonts;
std::map<caf::FixedAtlasFont::FontSize, cvf::ref<caf::FixedAtlasFont>> RiaFontCache::ms_fonts;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<caf::FixedAtlasFont> RiaFontCache::getFont( FontSize size )
cvf::ref<caf::FixedAtlasFont> RiaFontCache::getFont( FontSize pointFontSize )
{
if ( ms_fonts.count( size ) == 0 )
int pointSize = caf::FontTools::absolutePointSize( pointFontSize );
return getFont( pointSize );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<caf::FixedAtlasFont> RiaFontCache::getFont( int pointSize )
{
int currentDPI = 96;
if ( RiaGuiApplication::isRunning() )
{
auto newFont = new caf::FixedAtlasFont( mapToAtlasFontSize( size ) );
ms_fonts.insert( std::make_pair( size, newFont ) );
currentDPI = RiaGuiApplication::desktop()->logicalDpiX();
}
return ms_fonts[size];
// the Fixed Atlas Fonts appear to be assuming a DPI of 96, so we need scaling.
double scaling = currentDPI / 96.0;
int scaledSize = scaling * pointSize;
auto atlasFontSize = mapToAtlasFontSize( scaledSize );
auto existing_it = ms_fonts.find( atlasFontSize );
if ( existing_it == ms_fonts.end() )
{
auto newFont = new caf::FixedAtlasFont( atlasFontSize );
bool inserted = false;
std::tie( existing_it, inserted ) = ms_fonts.insert( std::make_pair( atlasFontSize, newFont ) );
CAF_ASSERT( inserted );
}
return existing_it->second;
}
//--------------------------------------------------------------------------------------------------
@@ -96,76 +97,24 @@ RiaFontCache::FontSize RiaFontCache::legacyEnumToPointSize( int enumValue )
switch ( enumValue )
{
case 0:
return FONT_SIZE_8;
return FontSize::FONT_SIZE_8;
case 1:
return FONT_SIZE_10;
return FontSize::FONT_SIZE_10;
case 2:
return FONT_SIZE_12;
return FontSize::FONT_SIZE_12;
case 3:
return FONT_SIZE_14;
return FontSize::FONT_SIZE_14;
case 4:
return FONT_SIZE_16;
return FontSize::FONT_SIZE_16;
case 5:
return FONT_SIZE_24;
return FontSize::FONT_SIZE_24;
case 6:
return FONT_SIZE_32;
return FontSize::FONT_SIZE_32;
default:
return FONT_SIZE_8;
return FontSize::FONT_SIZE_8;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaFontCache::FontSize RiaFontCache::fontSizeEnumFromPointSize( int pointSize )
{
std::vector<FontSize> allValues =
{FONT_SIZE_8, FONT_SIZE_10, FONT_SIZE_12, FONT_SIZE_14, FONT_SIZE_16, FONT_SIZE_24, FONT_SIZE_32};
FontSize closestEnumValue = FONT_SIZE_8;
int closestDiff = std::numeric_limits<int>::max();
for ( FontSize enumValue : allValues )
{
int diff = std::abs( (int)enumValue - pointSize );
if ( diff < closestDiff )
{
closestEnumValue = enumValue;
closestDiff;
}
}
return closestEnumValue;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RiaFontCache::pointSizeToPixelSize( int pointSize )
{
auto app = RiaGuiApplication::instance();
if ( app )
{
int dpi = app->desktop()->logicalDpiX();
double inches = pointSize / 72.0;
return static_cast<int>( std::ceil( inches * dpi ) );
}
return pointSize;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RiaFontCache::pixelSizeToPointSize( int pixelSize )
{
auto app = RiaGuiApplication::instance();
if ( app )
{
int dpi = app->desktop()->logicalDpiX();
double inches = pixelSize / dpi;
return static_cast<int>( std::ceil( inches * 72.0 ) );
}
return pixelSize;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -19,6 +19,7 @@
#pragma once
#include "cafFixedAtlasFont.h"
#include "cafFontTools.h"
#include "cvfObject.h"
@@ -38,30 +39,14 @@ class RimSummaryCaseCollection;
class RiaFontCache
{
public:
enum FontSize
{
INVALID = -1,
MIN_FONT_SIZE = 8,
FONT_SIZE_8 = 8,
FONT_SIZE_10 = 10,
FONT_SIZE_12 = 12,
FONT_SIZE_14 = 14,
FONT_SIZE_16 = 16,
FONT_SIZE_24 = 24,
FONT_SIZE_32 = 32,
MAX_FONT_SIZE = FONT_SIZE_32
};
typedef caf::AppEnum<FontSize> FontSizeType;
using FontSize = caf::FontTools::FontSize;
using FontSizeEnum = caf::FontTools::FontSizeEnum;
static cvf::ref<caf::FixedAtlasFont> getFont( FontSize fontSize );
static cvf::ref<caf::FixedAtlasFont> getFont( int pointSize );
static FontSize legacyEnumToPointSize( int enumValue );
static FontSize fontSizeEnumFromPointSize( int pointSize );
static int pointSizeToPixelSize( int pointSize );
static int pixelSizeToPointSize( int pixelSize );
static void clear();
static void clear();
private:
static std::map<FontSize, cvf::ref<caf::FixedAtlasFont>> ms_fonts;
static std::map<caf::FixedAtlasFont::FontSize, cvf::ref<caf::FixedAtlasFont>> ms_fonts;
};

View File

@@ -33,9 +33,9 @@ QString RiaDefines::unitStringConductivity( RiaEclipseUnitTools::UnitSystem unit
{
switch ( unitSystem )
{
case RiaEclipseUnitTools::UNITS_METRIC:
case RiaEclipseUnitTools::UnitSystem::UNITS_METRIC:
return "md-m";
case RiaEclipseUnitTools::UNITS_FIELD:
case RiaEclipseUnitTools::UnitSystem::UNITS_FIELD:
return "md-ft";
default:
return "";
@@ -49,11 +49,11 @@ double RiaDefines::nonDarcyFlowAlpha( RiaEclipseUnitTools::UnitSystem unitSystem
{
switch ( unitSystem )
{
case RiaEclipseUnitTools::UNITS_METRIC:
case RiaEclipseUnitTools::UnitSystem::UNITS_METRIC:
return 2.24460e-10;
case RiaEclipseUnitTools::UNITS_FIELD:
case RiaEclipseUnitTools::UnitSystem::UNITS_FIELD:
return 6.83352e-8;
case RiaEclipseUnitTools::UNITS_LAB:
case RiaEclipseUnitTools::UnitSystem::UNITS_LAB:
return 5.41375E-11;
// case RiaEclipseUnitTools::PVT_METRIC: return 2.25533E-10;
@@ -61,3 +61,19 @@ double RiaDefines::nonDarcyFlowAlpha( RiaEclipseUnitTools::UnitSystem unitSystem
return 0.0;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaDefines::faciesColorLegendName()
{
return "Facies colors";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaDefines::rockTypeColorLegendName()
{
return "Rock Types";
}

View File

@@ -28,4 +28,7 @@ QString conductivityResultName();
QString unitStringConductivity( RiaEclipseUnitTools::UnitSystem unitSystem );
double nonDarcyFlowAlpha( RiaEclipseUnitTools::UnitSystem unitSystem );
QString faciesColorLegendName();
QString rockTypeColorLegendName();
}; // namespace RiaDefines

View File

@@ -0,0 +1,57 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiaFractureModelDefines.h"
namespace caf
{
template <>
void AppEnum<RiaDefines::CurveProperty>::setUp()
{
addItem( RiaDefines::CurveProperty::UNDEFINED, "UNDEFINED", "Undefined" );
addItem( RiaDefines::CurveProperty::FACIES, "FACIES", "Facies" );
addItem( RiaDefines::CurveProperty::LAYERS, "LAYERS", "Layers" );
addItem( RiaDefines::CurveProperty::POROSITY, "POROSITY", "Porosity" );
addItem( RiaDefines::CurveProperty::PERMEABILITY_X, "PERMEABILITY_X", "Permeability Horizontal" );
addItem( RiaDefines::CurveProperty::PERMEABILITY_Z, "PERMEABILITY_Z", "Permeability Vertical" );
addItem( RiaDefines::CurveProperty::INITIAL_PRESSURE, "INITIAL_PRESSURE", "Initial Pressure" );
addItem( RiaDefines::CurveProperty::PRESSURE, "PRESSURE", "Pressure" );
addItem( RiaDefines::CurveProperty::STRESS, "STRESS", "Stress" );
addItem( RiaDefines::CurveProperty::INITIAL_STRESS, "INITIAL_STRESS", "Initial Stress" );
addItem( RiaDefines::CurveProperty::STRESS_GRADIENT, "STRESS_GRADIENT", "Stress Gradient" );
addItem( RiaDefines::CurveProperty::YOUNGS_MODULUS, "YOUNGS_MODULUS", "Young's Modulus" );
addItem( RiaDefines::CurveProperty::POISSONS_RATIO, "POISSONS_RATIO", "Poisson's Ratio" );
addItem( RiaDefines::CurveProperty::K_IC, "K_IC", "K-Ic" );
addItem( RiaDefines::CurveProperty::PROPPANT_EMBEDMENT, "PROPPANT_EMBEDMENT", "Proppant Embedment" );
addItem( RiaDefines::CurveProperty::BIOT_COEFFICIENT, "BIOT_COEFFICIENT", "Biot Coefficient" );
addItem( RiaDefines::CurveProperty::K0, "K0", "k0" );
addItem( RiaDefines::CurveProperty::FLUID_LOSS_COEFFICIENT, "FLUID_LOSS_COEFFICIENT", "Fluid Loss Coefficient" );
addItem( RiaDefines::CurveProperty::SPURT_LOSS, "SPURT_LOSS", "Spurt Loss" );
addItem( RiaDefines::CurveProperty::TEMPERATURE, "TEMPERATURE", "Temperature" );
addItem( RiaDefines::CurveProperty::RELATIVE_PERMEABILITY_FACTOR,
"RELATIVE_PERMEABILITY_FACTOR",
"Relative Permeability Factor" );
addItem( RiaDefines::CurveProperty::PORO_ELASTIC_CONSTANT, "PORO_ELASTIC_CONSTANT", "Poro-Elastic Constant" );
addItem( RiaDefines::CurveProperty::THERMAL_EXPANSION_COEFFICIENT,
"THERMAL_EXPANSION_COEFFICIENT",
"Thermal Expansion Coefficient" );
addItem( RiaDefines::CurveProperty::IMMOBILE_FLUID_SATURATION, "IMMOBILE_FLUID_SATURATION", "Immobile Fluid Saturation" );
setDefault( RiaDefines::CurveProperty::UNDEFINED );
}
}; // namespace caf

View File

@@ -0,0 +1,54 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RiaEclipseUnitTools.h"
#include <QString>
namespace RiaDefines
{
enum class CurveProperty
{
UNDEFINED,
FACIES,
LAYERS,
POROSITY,
PERMEABILITY_X,
PERMEABILITY_Z,
INITIAL_PRESSURE,
PRESSURE,
STRESS,
INITIAL_STRESS,
STRESS_GRADIENT,
YOUNGS_MODULUS,
POISSONS_RATIO,
K_IC,
PROPPANT_EMBEDMENT,
BIOT_COEFFICIENT,
K0,
FLUID_LOSS_COEFFICIENT,
SPURT_LOSS,
TEMPERATURE,
RELATIVE_PERMEABILITY_FACTOR,
PORO_ELASTIC_CONSTANT,
THERMAL_EXPANSION_COEFFICIENT,
IMMOBILE_FLUID_SATURATION,
};
}; // namespace RiaDefines

View File

@@ -22,7 +22,6 @@
#include "RiaArgumentParser.h"
#include "RiaBaseDefs.h"
#include "RiaColorTables.h"
#include "RiaFilePathTools.h"
#include "RiaFontCache.h"
#include "RiaImportEclipseCaseTools.h"
@@ -93,6 +92,8 @@
#include "Riu3dSelectionManager.h"
#include "RiuDockWidgetTools.h"
#include "RiuFileDialogTools.h"
#include "RiuGuiTheme.h"
#include "RiuMainWindow.h"
#include "RiuMainWindowTools.h"
#include "RiuMdiMaximizeWindowGuard.h"
@@ -120,7 +121,6 @@
#include <QDesktopWidget>
#include <QDir>
#include <QErrorMessage>
#include <QFileDialog>
#include <QGridLayout>
#include <QMdiSubWindow>
#include <QMessageBox>
@@ -144,11 +144,11 @@ namespace caf
template <>
void AppEnum<RiaGuiApplication::RINavigationPolicy>::setUp()
{
addItem( RiaGuiApplication::NAVIGATION_POLICY_CEETRON, "NAVIGATION_POLICY_CEETRON", "Ceetron" );
addItem( RiaGuiApplication::NAVIGATION_POLICY_CAD, "NAVIGATION_POLICY_CAD", "CAD" );
addItem( RiaGuiApplication::NAVIGATION_POLICY_GEOQUEST, "NAVIGATION_POLICY_GEOQUEST", "GEOQUEST" );
addItem( RiaGuiApplication::NAVIGATION_POLICY_RMS, "NAVIGATION_POLICY_RMS", "RMS" );
setDefault( RiaGuiApplication::NAVIGATION_POLICY_RMS );
addItem( RiaGuiApplication::RINavigationPolicy::NAVIGATION_POLICY_CEETRON, "NAVIGATION_POLICY_CEETRON", "Ceetron" );
addItem( RiaGuiApplication::RINavigationPolicy::NAVIGATION_POLICY_CAD, "NAVIGATION_POLICY_CAD", "CAD" );
addItem( RiaGuiApplication::RINavigationPolicy::NAVIGATION_POLICY_GEOQUEST, "NAVIGATION_POLICY_GEOQUEST", "GEOQUEST" );
addItem( RiaGuiApplication::RINavigationPolicy::NAVIGATION_POLICY_RMS, "NAVIGATION_POLICY_RMS", "RMS" );
setDefault( RiaGuiApplication::RINavigationPolicy::NAVIGATION_POLICY_RMS );
}
} // namespace caf
@@ -242,8 +242,10 @@ QString RiaGuiApplication::promptForProjectSaveAsFileName() const
startPath += "/ResInsightProject.rsp";
}
QString fileName =
QFileDialog::getSaveFileName( nullptr, tr( "Save File" ), startPath, tr( "Project Files (*.rsp);;All files(*.*)" ) );
QString fileName = RiuFileDialogTools::getSaveFileName( nullptr,
tr( "Save File" ),
startPath,
tr( "Project Files (*.rsp);;All files(*.*)" ) );
return fileName;
}
@@ -424,12 +426,14 @@ void RiaGuiApplication::initialize()
RiuPlotMainWindow* plotMainWindow = getOrCreateMainPlotWindow();
plotMainWindow->hideAllDockWidgets();
RiuGuiTheme::updateGuiTheme( m_preferences->guiTheme() );
{
auto logger = new RiuMessagePanelLogger;
logger->addMessagePanel( m_mainWindow->messagePanel() );
logger->addMessagePanel( m_mainPlotWindow->messagePanel() );
RiaLogging::setLoggerInstance( logger );
RiaLogging::loggerInstance()->setLevel( RI_LL_DEBUG );
RiaLogging::loggerInstance()->setLevel( int( RILogLevel::RI_LL_DEBUG ) );
}
m_socketServer = new RiaSocketServer( this );
}
@@ -445,14 +449,14 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( cvf::Progr
// --------------------------------------------------------
if ( cvf::Option o = progOpt->option( "ignoreArgs" ) )
{
return KEEP_GOING;
return ApplicationStatus::KEEP_GOING;
}
if ( progOpt->option( "help" ) || progOpt->option( "?" ) )
{
this->showFormattedTextInMessageBoxOrConsole( "The current command line options in ResInsight are:\n" +
this->commandLineParameterHelp() );
return RiaApplication::EXIT_COMPLETED;
return RiaApplication::ApplicationStatus::EXIT_COMPLETED;
}
// Code generation
@@ -466,10 +470,10 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( cvf::Progr
if ( !RiaApplication::generateCode( outputFile, &errMsg ) )
{
RiaLogging::error( QString( "Error: %1" ).arg( errMsg ) );
return RiaApplication::EXIT_WITH_ERROR;
return RiaApplication::ApplicationStatus::EXIT_WITH_ERROR;
}
return RiaApplication::EXIT_COMPLETED;
return RiaApplication::ApplicationStatus::EXIT_COMPLETED;
}
// Unit testing
@@ -479,12 +483,12 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( cvf::Progr
int testReturnValue = launchUnitTestsWithConsole();
if ( testReturnValue == 0 )
{
return RiaApplication::EXIT_COMPLETED;
return RiaApplication::ApplicationStatus::EXIT_COMPLETED;
}
else
{
RiaLogging::error( "Error running unit tests" );
return RiaApplication::EXIT_WITH_ERROR;
return RiaApplication::ApplicationStatus::EXIT_WITH_ERROR;
}
}
@@ -497,12 +501,12 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( cvf::Progr
// This is useful when executing regression tests on a build server, and this is the reason for creating the
// logger when parsing the command line options
auto stdLogger = new RiaStdOutLogger;
stdLogger->setLevel( RI_LL_DEBUG );
stdLogger->setLevel( int( RILogLevel::RI_LL_DEBUG ) );
RiaLogging::setLoggerInstance( stdLogger );
RiaRegressionTestRunner::instance()->executeRegressionTests( regressionTestPath, QStringList() );
return EXIT_COMPLETED;
return ApplicationStatus::EXIT_COMPLETED;
}
if ( cvf::Option o = progOpt->option( "updateregressiontestbase" ) )
@@ -510,7 +514,7 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( cvf::Progr
CVF_ASSERT( o.valueCount() == 1 );
QString regressionTestPath = cvfqt::Utils::toQString( o.value( 0 ) );
RiaRegressionTestRunner::instance()->updateRegressionTest( regressionTestPath );
return EXIT_COMPLETED;
return ApplicationStatus::EXIT_COMPLETED;
}
if ( cvf::Option o = progOpt->option( "startdir" ) )
@@ -587,14 +591,14 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( cvf::Progr
std::vector<QString> gridFiles = readFileListFromTextFile( gridListFile );
runMultiCaseSnapshots( projectFileName, gridFiles, "multiCaseSnapshots" );
return EXIT_COMPLETED;
return ApplicationStatus::EXIT_COMPLETED;
}
}
if ( !projectFileName.isEmpty() )
{
cvf::ref<RiaProjectModifier> projectModifier;
RiaApplication::ProjectLoadAction projectLoadAction = RiaApplication::PLA_NONE;
RiaApplication::ProjectLoadAction projectLoadAction = RiaApplication::ProjectLoadAction::PLA_NONE;
if ( cvf::Option o = progOpt->option( "replaceCase" ) )
{
@@ -651,7 +655,7 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( cvf::Progr
}
}
projectLoadAction = RiaApplication::PLA_CALCULATE_STATISTICS;
projectLoadAction = RiaApplication::ProjectLoadAction::PLA_CALCULATE_STATISTICS;
}
if ( cvf::Option o = progOpt->option( "replacePropertiesFolder" ) )
@@ -780,7 +784,7 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( cvf::Progr
closeProject();
return EXIT_COMPLETED;
return ApplicationStatus::EXIT_COMPLETED;
}
if ( cvf::Option o = progOpt->option( "commandFile" ) )
@@ -831,7 +835,7 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( cvf::Progr
{
RiaProjectModifier projectModifier;
projectModifier.setReplaceCaseFirstOccurrence( caseFile );
loadProject( projectFileName, RiaApplication::PLA_NONE, &projectModifier );
loadProject( projectFileName, RiaApplication::ProjectLoadAction::PLA_NONE, &projectModifier );
executeCommandFile( commandFile );
}
}
@@ -860,7 +864,7 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( cvf::Progr
}
}
loadProject( projectFileName, RiaApplication::PLA_NONE, &projectModifier );
loadProject( projectFileName, RiaApplication::ProjectLoadAction::PLA_NONE, &projectModifier );
executeCommandFile( commandFile );
}
}
@@ -869,10 +873,10 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( cvf::Progr
{
executeCommandFile( commandFile );
}
return EXIT_COMPLETED;
return ApplicationStatus::EXIT_COMPLETED;
}
return KEEP_GOING;
return ApplicationStatus::KEEP_GOING;
}
//--------------------------------------------------------------------------------------------------
@@ -1082,6 +1086,17 @@ RimViewWindow* RiaGuiApplication::activeViewWindow()
return viewWindow;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuMainWindowBase* RiaGuiApplication::activeMainWindow()
{
QWidget* mainWindowWidget = RiaGuiApplication::activeWindow();
RiuMainWindowBase* mainWindow = dynamic_cast<RiuMainWindowBase*>( mainWindowWidget );
return mainWindow;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1226,11 +1241,11 @@ void RiaGuiApplication::invokeProcessEvents( QEventLoop::ProcessEventsFlags flag
//--------------------------------------------------------------------------------------------------
void RiaGuiApplication::onFileSuccessfullyLoaded( const QString& fileName, RiaDefines::ImportFileType fileType )
{
if ( fileType & RiaDefines::ANY_ECLIPSE_FILE )
if ( int( fileType ) & int( RiaDefines::ImportFileType::ANY_ECLIPSE_FILE ) )
{
getOrCreateAndShowMainPlotWindow();
if ( fileType != RiaDefines::ECLIPSE_SUMMARY_FILE )
if ( fileType != RiaDefines::ImportFileType::ECLIPSE_SUMMARY_FILE )
{
if ( mainWindow() )
{
@@ -1261,7 +1276,7 @@ void RiaGuiApplication::onProjectBeingOpened()
//--------------------------------------------------------------------------------------------------
void RiaGuiApplication::onProjectOpeningError( const QString& errMsg )
{
QMessageBox::warning( nullptr, "Error when opening project file", errMsg );
RiaLogging::errorInMessageBox( nullptr, "Error when opening project file", errMsg );
m_mainWindow->setPdmRoot( nullptr );
}
@@ -1394,7 +1409,8 @@ void RiaGuiApplication::onProgramExit()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaGuiApplication::applyGuiPreferences( const RiaPreferences* oldPreferences )
void RiaGuiApplication::applyGuiPreferences( const RiaPreferences* oldPreferences,
const std::vector<caf::FontHolderInterface*>& defaultFontObjects )
{
if ( m_activeReservoirView && m_activeReservoirView->viewer() )
{
@@ -1419,7 +1435,10 @@ void RiaGuiApplication::applyGuiPreferences( const RiaPreferences* oldPreference
m_preferences->appendClassNameToUiText() );
}
std::map<RiaDefines::FontSettingType, RiaFontCache::FontSize> fontSizes = m_preferences->defaultFontSizes();
for ( auto fontObject : defaultFontObjects )
{
fontObject->updateFonts();
}
if ( this->project() )
{
@@ -1431,7 +1450,6 @@ void RiaGuiApplication::applyGuiPreferences( const RiaPreferences* oldPreference
bool existingViewsWithDifferentMeshLines = false;
bool existingViewsWithCustomColors = false;
bool existingViewsWithCustomZScale = false;
bool existingObjectsWithCustomFonts = false;
if ( oldPreferences )
{
for ( auto viewWindow : allViewWindows )
@@ -1458,13 +1476,6 @@ void RiaGuiApplication::applyGuiPreferences( const RiaPreferences* oldPreference
existingViewsWithCustomZScale = true;
}
RimGridView* gridView = dynamic_cast<RimGridView*>( rim3dView );
if ( gridView && gridView->annotationCollection() )
{
RiaFontCache::FontSize oldFontSize = oldPreferences->defaultAnnotationFontSize();
existingObjectsWithCustomFonts =
gridView->annotationCollection()->hasTextAnnotationsWithCustomFontSize( oldFontSize );
}
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>( rim3dView );
if ( eclipseView )
{
@@ -1476,18 +1487,6 @@ void RiaGuiApplication::applyGuiPreferences( const RiaPreferences* oldPreference
}
}
}
for ( auto fontTypeSizePair : fontSizes )
{
RiaFontCache::FontSize oldFontSize = oldPreferences->defaultFontSizes()[fontTypeSizePair.first];
if ( oldFontSize != fontTypeSizePair.second )
{
if ( viewWindow->hasCustomFontSizes( fontTypeSizePair.first, oldFontSize ) )
{
existingObjectsWithCustomFonts = true;
}
}
}
}
if ( oldPreferences->defaultWellLabelColor() != wellPathCollection->wellPathLabelColor() )
@@ -1497,14 +1496,12 @@ void RiaGuiApplication::applyGuiPreferences( const RiaPreferences* oldPreference
}
bool applySettingsToAllViews = false;
if ( existingViewsWithCustomColors || existingViewsWithCustomZScale || existingViewsWithDifferentMeshLines ||
existingObjectsWithCustomFonts )
if ( existingViewsWithCustomColors || existingViewsWithCustomZScale || existingViewsWithDifferentMeshLines )
{
QStringList changedData;
if ( existingViewsWithDifferentMeshLines ) changedData << "Mesh Visibility";
if ( existingViewsWithCustomColors ) changedData << "Colors";
if ( existingViewsWithCustomZScale ) changedData << "Z-Scale";
if ( existingObjectsWithCustomFonts ) changedData << "Fonts Sizes";
QString listString = changedData.takeLast();
if ( !changedData.empty() )
@@ -1526,16 +1523,6 @@ void RiaGuiApplication::applyGuiPreferences( const RiaPreferences* oldPreference
for ( auto viewWindow : allViewWindows )
{
for ( auto fontTypeSizePair : fontSizes )
{
RiaFontCache::FontSize oldFontSize = oldPreferences->defaultFontSizes()[fontTypeSizePair.first];
int newFontSize = fontTypeSizePair.second;
if ( oldFontSize != newFontSize )
{
viewWindow->applyFontSize( fontTypeSizePair.first, oldFontSize, newFontSize, applySettingsToAllViews );
}
}
auto rim3dView = dynamic_cast<Rim3dView*>( viewWindow );
if ( rim3dView )
{
@@ -1729,7 +1716,8 @@ void RiaGuiApplication::runIdleProcessing()
}
else
{
idleIterationCount = std::min( ++idleIterationCount, 500 );
++idleIterationCount;
idleIterationCount = std::min( idleIterationCount, 500 );
if ( idleIterationCount == 500 )
{
iterationInterval = 5;
@@ -1762,7 +1750,7 @@ void RiaGuiApplication::runMultiCaseSnapshots( const QString& templateProj
RiaProjectModifier modifier;
modifier.setReplaceCaseFirstOccurrence( gridFn );
bool loadOk = loadProject( templateProjectFileName, PLA_NONE, &modifier );
bool loadOk = loadProject( templateProjectFileName, ProjectLoadAction::PLA_NONE, &modifier );
if ( loadOk )
{
RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( snapshotFolderName );

View File

@@ -66,6 +66,11 @@ class RiuPlotMainWindow;
class RiuRecentFileActionProvider;
class RiaArgumentParser;
namespace caf
{
class FontHolderInterface;
}
//==================================================================================================
//
//
@@ -76,7 +81,7 @@ class RiaGuiApplication : public QApplication, public RiaApplication
Q_OBJECT
public:
enum RINavigationPolicy
enum class RINavigationPolicy
{
NAVIGATION_POLICY_CEETRON,
NAVIGATION_POLICY_CAD,
@@ -112,7 +117,8 @@ public:
RiuPlotMainWindow* mainPlotWindow();
RiuMainWindowBase* mainWindowByID( int mainWindowID );
static RimViewWindow* activeViewWindow();
static RimViewWindow* activeViewWindow();
static RiuMainWindowBase* activeMainWindow();
bool isMain3dWindowVisible() const;
bool isMainPlotWindowVisible() const;
@@ -123,7 +129,8 @@ public:
std::vector<QAction*> recentFileActions() const;
static void clearAllSelections();
void applyGuiPreferences( const RiaPreferences* oldPreferences = nullptr );
void applyGuiPreferences( const RiaPreferences* oldPreferences = nullptr,
const std::vector<caf::FontHolderInterface*>& defaultFontObjects = {} );
void updateGrpcServer();
static int applicationResolution();

View File

@@ -53,7 +53,7 @@ int main( int argc, char* argv[] )
return 1;
}
#endif
RiaLogging::loggerInstance()->setLevel( RI_LL_DEBUG );
RiaLogging::loggerInstance()->setLevel( int( RILogLevel::RI_LL_DEBUG ) );
std::unique_ptr<RiaApplication> app( createApplication( argc, argv ) );
@@ -94,15 +94,15 @@ int main( int argc, char* argv[] )
RiaApplication::ApplicationStatus status = app->handleArguments( &progOpt );
if ( status == RiaApplication::EXIT_COMPLETED )
if ( status == RiaApplication::ApplicationStatus::EXIT_COMPLETED )
{
return 0;
}
else if ( status == RiaApplication::EXIT_WITH_ERROR )
else if ( status == RiaApplication::ApplicationStatus::EXIT_WITH_ERROR )
{
return 2;
}
else if ( status == RiaApplication::KEEP_GOING )
else if ( status == RiaApplication::ApplicationStatus::KEEP_GOING )
{
int exitCode = 0;
try

View File

@@ -18,7 +18,6 @@
#include "RiaMemoryCleanup.h"
#include "RiaApplication.h"
#include "RigCaseCellResultsData.h"
#include "RigFemPartResultsCollection.h"
#include "RigFemResultAddress.h"
@@ -79,7 +78,7 @@ void RiaMemoryCleanup::clearSelectedResultsFromMemory()
RimGeoMechCase* geoMechCase = dynamic_cast<RimGeoMechCase*>( m_case() );
if ( eclipseCase )
{
RigCaseCellResultsData* caseData = eclipseCase->results( RiaDefines::MATRIX_MODEL );
RigCaseCellResultsData* caseData = eclipseCase->results( RiaDefines::PorosityModelType::MATRIX_MODEL );
if ( caseData )
{
std::vector<RigEclipseResultAddress> resultsToDelete = selectedEclipseResults();
@@ -217,7 +216,7 @@ QList<caf::PdmOptionItemInfo> RiaMemoryCleanup::calculateValueOptions( const caf
QList<caf::PdmOptionItemInfo> options;
if ( fieldNeedingOptions == &m_case )
{
RimProject* proj = RiaApplication::instance()->project();
RimProject* proj = RimProject::current();
if ( proj )
{
std::vector<RimEclipseCase*> eclipseCases = proj->eclipseCases();
@@ -240,7 +239,7 @@ QList<caf::PdmOptionItemInfo> RiaMemoryCleanup::calculateValueOptions( const caf
if ( eclipseCase )
{
std::set<RigEclipseResultAddress> resultsInUse = findEclipseResultsInUse();
RigCaseCellResultsData* caseData = eclipseCase->results( RiaDefines::MATRIX_MODEL );
RigCaseCellResultsData* caseData = eclipseCase->results( RiaDefines::PorosityModelType::MATRIX_MODEL );
if ( caseData )
{
m_eclipseResultAddresses = caseData->existingResults();
@@ -254,7 +253,7 @@ QList<caf::PdmOptionItemInfo> RiaMemoryCleanup::calculateValueOptions( const caf
const RigEclipseResultInfo* resInfo = caseData->resultInfo( resultAddr );
QString posText = caf::AppEnum<RiaDefines::ResultCatType>::uiTextFromIndex( resInfo->resultType() );
QString posText = caf::AppEnum<RiaDefines::ResultCatType>::uiText( resInfo->resultType() );
QString resultsText = QString( "%1, %2" ).arg( posText ).arg( resInfo->resultName() );
if ( inUse )
{

View File

@@ -25,9 +25,9 @@ namespace caf
template <>
void caf::AppEnum<RiaDefines::PorosityModelType>::setUp()
{
addItem( RiaDefines::MATRIX_MODEL, "MATRIX_MODEL", "Matrix" );
addItem( RiaDefines::FRACTURE_MODEL, "FRACTURE_MODEL", "Fracture" );
addItem( RiaDefines::PorosityModelType::MATRIX_MODEL, "MATRIX_MODEL", "Matrix" );
addItem( RiaDefines::PorosityModelType::FRACTURE_MODEL, "FRACTURE_MODEL", "Fracture" );
setDefault( RiaDefines::MATRIX_MODEL );
setDefault( RiaDefines::PorosityModelType::MATRIX_MODEL );
}
} // namespace caf

View File

@@ -23,7 +23,7 @@
//--------------------------------------------------------------------------------------------------
namespace RiaDefines
{
enum PorosityModelType
enum class PorosityModelType
{
MATRIX_MODEL,
FRACTURE_MODEL

View File

@@ -22,8 +22,8 @@
#include "RiaPreferences.h"
#include "RiaColorTables.h"
#include "RiaQDateTimeTools.h"
#include "RifReaderSettings.h"
#include "RiuGuiTheme.h"
#include "cafPdmFieldCvfColor.h"
#include "cafPdmSettings.h"
@@ -35,29 +35,26 @@
#include <QDate>
#include <QDir>
#include <QLocale>
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
#include <QStandardPaths>
#endif
namespace caf
{
template <>
void RiaPreferences::SummaryRestartFilesImportModeType::setUp()
{
addItem( RiaPreferences::IMPORT, "IMPORT", "Unified" );
addItem( RiaPreferences::SEPARATE_CASES, "SEPARATE_CASES", "Separate Cases" );
addItem( RiaPreferences::NOT_IMPORT, "NOT_IMPORT", "Skip" );
setDefault( RiaPreferences::IMPORT );
addItem( RiaPreferences::SummaryRestartFilesImportMode::IMPORT, "IMPORT", "Unified" );
addItem( RiaPreferences::SummaryRestartFilesImportMode::SEPARATE_CASES, "SEPARATE_CASES", "Separate Cases" );
addItem( RiaPreferences::SummaryRestartFilesImportMode::NOT_IMPORT, "NOT_IMPORT", "Skip" );
setDefault( RiaPreferences::SummaryRestartFilesImportMode::IMPORT );
}
template <>
void RiaPreferences::SummaryHistoryCurveStyleModeType::setUp()
{
addItem( RiaPreferences::SYMBOLS, "SYMBOLS", "Symbols" );
addItem( RiaPreferences::LINES, "LINES", "Lines" );
addItem( RiaPreferences::SYMBOLS_AND_LINES, "SYMBOLS_AND_LINES", "Symbols and Lines" );
setDefault( RiaPreferences::SYMBOLS );
addItem( RiaPreferences::SummaryHistoryCurveStyleMode::SYMBOLS, "SYMBOLS", "Symbols" );
addItem( RiaPreferences::SummaryHistoryCurveStyleMode::LINES, "LINES", "Lines" );
addItem( RiaPreferences::SummaryHistoryCurveStyleMode::SYMBOLS_AND_LINES, "SYMBOLS_AND_LINES", "Symbols and Lines" );
setDefault( RiaPreferences::SummaryHistoryCurveStyleMode::SYMBOLS );
}
template <>
@@ -92,7 +89,8 @@ RiaPreferences::RiaPreferences( void )
{
CAF_PDM_InitField( &m_navigationPolicy,
"navigationPolicy",
caf::AppEnum<RiaGuiApplication::RINavigationPolicy>( RiaGuiApplication::NAVIGATION_POLICY_RMS ),
caf::AppEnum<RiaGuiApplication::RINavigationPolicy>(
RiaGuiApplication::RINavigationPolicy::NAVIGATION_POLICY_RMS ),
"Navigation Mode",
"",
"",
@@ -117,14 +115,11 @@ RiaPreferences::RiaPreferences( void )
#ifdef WIN32
defaultTextEditor = QString( "notepad.exe" );
#else
defaultTextEditor = QString( "kate" );
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
defaultTextEditor = QStandardPaths::findExecutable( "kate" );
if ( defaultTextEditor.isEmpty() )
{
defaultTextEditor = QStandardPaths::findExecutable( "gedit" );
}
#endif
#endif
CAF_PDM_InitField( &scriptEditorExecutable, "scriptEditorExecutable", defaultTextEditor, "Script Editor", "", "", "" );
@@ -184,12 +179,10 @@ RiaPreferences::RiaPreferences( void )
CAF_PDM_InitField( &m_defaultScaleFactorZ, "defaultScaleFactorZ", 5, "Default Z Scale Factor", "", "", "" );
caf::AppEnum<RiaFontCache::FontSize> fontSize = RiaFontCache::FONT_SIZE_8;
caf::AppEnum<RiaFontCache::FontSize> plotFontSize = RiaFontCache::FONT_SIZE_10;
CAF_PDM_InitField( &defaultSceneFontSize, "defaultSceneFontSizePt", fontSize, "Viewer Font Size", "", "", "" );
CAF_PDM_InitField( &defaultAnnotationFontSize, "defaultAnnotationFontSizePt", fontSize, "Annotation Font Size", "", "", "" );
CAF_PDM_InitField( &defaultWellLabelFontSize, "defaultWellLabelFontSizePt", fontSize, "Well Label Font Size", "", "", "" );
CAF_PDM_InitField( &defaultPlotFontSize, "defaultPlotFontSizePt", plotFontSize, "Plot Font Size", "", "", "" );
CAF_PDM_InitFieldNoDefault( &defaultSceneFontSize, "defaultSceneFontSizePt", "Viewer Font Size", "", "", "" );
CAF_PDM_InitFieldNoDefault( &defaultAnnotationFontSize, "defaultAnnotationFontSizePt", "Annotation Font Size", "", "", "" );
CAF_PDM_InitFieldNoDefault( &defaultWellLabelFontSize, "defaultWellLabelFontSizePt", "Well Label Font Size", "", "", "" );
CAF_PDM_InitFieldNoDefault( &defaultPlotFontSize, "defaultPlotFontSizePt", "Plot Font Size", "", "", "" );
CAF_PDM_InitField( &showLasCurveWithoutTvdWarning,
"showLasCurveWithoutTvdWarning",
@@ -234,6 +227,12 @@ RiaPreferences::RiaPreferences( void )
CAF_PDM_InitField( &m_enableFaultsByDefault, "enableFaultsByDefault", true, "Enable Faults By Default", "", "", "" );
m_enableFaultsByDefault.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitField( &m_showInfoBox, "showInfoBox", true, "Show Info Box in New Projects", "", "", "" );
m_showInfoBox.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitField( &m_showGridBox, "showGridBox", true, "Show Grid Box in New Projects", "", "", "" );
m_showGridBox.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitFieldNoDefault( &lastUsedProjectFileName, "lastUsedProjectFileName", "Last Used Project File", "", "", "" );
lastUsedProjectFileName.uiCapability()->setUiHidden( true );
@@ -257,21 +256,21 @@ RiaPreferences::RiaPreferences( void )
"" );
CAF_PDM_InitField( &summaryImportMode,
"summaryImportMode",
SummaryRestartFilesImportModeType( RiaPreferences::IMPORT ),
SummaryRestartFilesImportModeType( RiaPreferences::SummaryRestartFilesImportMode::IMPORT ),
"Default Summary Import Option",
"",
"",
"" );
CAF_PDM_InitField( &gridImportMode,
"gridImportMode",
SummaryRestartFilesImportModeType( RiaPreferences::NOT_IMPORT ),
SummaryRestartFilesImportModeType( RiaPreferences::SummaryRestartFilesImportMode::NOT_IMPORT ),
"Default Grid Import Option",
"",
"",
"" );
CAF_PDM_InitField( &summaryEnsembleImportMode,
"summaryEnsembleImportMode",
SummaryRestartFilesImportModeType( RiaPreferences::IMPORT ),
SummaryRestartFilesImportModeType( RiaPreferences::SummaryRestartFilesImportMode::IMPORT ),
"Default Ensemble Summary Import Option",
"",
"",
@@ -279,7 +278,7 @@ RiaPreferences::RiaPreferences( void )
CAF_PDM_InitField( &defaultSummaryHistoryCurveStyle,
"defaultSummaryHistoryCurveStyle",
SummaryHistoryCurveStyleModeType( RiaPreferences::SYMBOLS ),
SummaryHistoryCurveStyleModeType( RiaPreferences::SummaryHistoryCurveStyleMode::SYMBOLS ),
"Default Curve Style for History Vectors",
"",
"",
@@ -374,33 +373,20 @@ RiaPreferences::RiaPreferences( void )
CAF_PDM_InitField( &m_pageRightMargin, "pageRightMargin", defaultMarginSize( m_pageSize() ), "Right Margin", "", "", "" );
CAF_PDM_InitField( &m_pageBottomMargin, "pageBottomMargin", defaultMarginSize( m_pageSize() ), "Bottom Margin", "", "", "" );
caf::AppEnum<RiaFontCache::FontSize> invalidFontSize = RiaFontCache::INVALID;
CAF_PDM_InitField( &m_defaultSceneFontSize_OBSOLETE, "fontSizeInScene", invalidFontSize, "Viewer Font Size", "", "", "" );
m_defaultSceneFontSize_OBSOLETE.xmlCapability()->setIOWritable( false );
CAF_PDM_InitField( &m_defaultAnnotationFontSize_OBSOLETE,
"defaultAnnotationFontSize",
invalidFontSize,
"Annotation Font Size",
"",
"",
"" );
m_defaultAnnotationFontSize_OBSOLETE.xmlCapability()->setIOWritable( false );
CAF_PDM_InitField( &m_defaultWellLabelFontSize_OBSOLETE,
"wellLabelFontSize",
invalidFontSize,
"Well Label Font Size",
"",
"",
"" );
m_defaultWellLabelFontSize_OBSOLETE.xmlCapability()->setIOWritable( false );
CAF_PDM_InitField( &m_defaultPlotFontSize_OBSOLETE, "defaultPlotFontSize", invalidFontSize, "Plot Font Size", "", "", "" );
m_defaultPlotFontSize_OBSOLETE.xmlCapability()->setIOWritable( false );
CAF_PDM_InitField( &m_openExportedPdfInViewer, "openExportedPdfInViewer", false, "Open Exported PDF in Viewer", "", "", "" );
m_openExportedPdfInViewer.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitField( &m_gtestFilter, "gtestFilter", QString(), "Unit Test Filter (gtest)", "", "", "" );
CAF_PDM_InitField( &m_surfaceImportResamplingDistance,
"SurfaceImportResamplingDistance",
100.0,
"Surface Import Coarsening",
"",
"Defines preferred minimum distance between surface points in XY-plane",
"" );
CAF_PDM_InitFieldNoDefault( &m_guiTheme, "guiTheme", "GUI theme", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
@@ -411,6 +397,14 @@ RiaPreferences::~RiaPreferences( void )
delete m_readerSettings;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaPreferences* RiaPreferences::current()
{
return RiaApplication::instance()->preferences();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -440,7 +434,8 @@ void RiaPreferences::defineEditorAttribute( const caf::PdmFieldHandle* field,
field == &m_showProjectChangedDialog || field == &m_searchPlotTemplateFoldersRecursively ||
field == &m_showLegendBackground || field == &m_showSummaryTimeAsLongString ||
field == &m_showViewIdInProjectTree || field == &m_useMultipleThreadsWhenLoadingSummaryData ||
field == &m_enableFaultsByDefault || field == &m_showProgressBar || field == &m_openExportedPdfInViewer )
field == &m_enableFaultsByDefault || field == &m_showProgressBar || field == &m_openExportedPdfInViewer ||
field == &m_showInfoBox || field == &m_showGridBox )
{
caf::PdmUiCheckBoxEditorAttribute* myAttr = dynamic_cast<caf::PdmUiCheckBoxEditorAttribute*>( attribute );
if ( myAttr )
@@ -476,6 +471,7 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
colorGroup->add( &defaultGridLineColors, false );
colorGroup->add( &defaultFaultGridLineColors );
colorGroup->add( &defaultWellLabelColor, false );
colorGroup->add( &m_guiTheme, {true, 2} );
caf::PdmUiGroup* fontGroup = uiOrdering.addNewGroup( "Default Font Sizes" );
fontGroup->add( &defaultSceneFontSize );
@@ -487,8 +483,11 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
viewsGroup->add( &m_defaultMeshModeType );
viewsGroup->add( &m_navigationPolicy );
viewsGroup->add( &m_defaultScaleFactorZ );
viewsGroup->add( &m_showLegendBackground );
viewsGroup->add( &m_enableFaultsByDefault );
viewsGroup->add( &m_enableFaultsByDefault, {false, 1} );
viewsGroup->add( &m_showInfoBox );
viewsGroup->add( &m_showGridBox, {false, 1} );
caf::PdmUiGroup* otherGroup = uiOrdering.addNewGroup( "Other" );
otherGroup->add( &ssihubAddress );
@@ -575,6 +574,10 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
uiOrdering.add( &csvTextExportFieldSeparator );
uiOrdering.add( &m_openExportedPdfInViewer );
}
else if ( uiConfigName == RiaPreferences::tabNameImport() )
{
uiOrdering.add( &m_surfaceImportResamplingDistance );
}
else if ( RiaApplication::enableDevelopmentFeatures() && uiConfigName == RiaPreferences::tabNameSystem() )
{
{
@@ -590,6 +593,7 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
group->add( &m_showHud );
}
uiOrdering.add( &m_gtestFilter );
uiOrdering.add( &m_showProgressBar );
uiOrdering.add( &m_showProjectChangedDialog );
uiOrdering.add( &m_showTestToolbar );
@@ -612,20 +616,24 @@ QList<caf::PdmOptionItemInfo> RiaPreferences::calculateValueOptions( const caf::
if ( fieldNeedingOptions == &gridImportMode )
{
// Manual option handling in order to one only a subset of the enum values
SummaryRestartFilesImportModeType skip( RiaPreferences::NOT_IMPORT );
SummaryRestartFilesImportModeType separate( RiaPreferences::SEPARATE_CASES );
SummaryRestartFilesImportModeType skip( RiaPreferences::SummaryRestartFilesImportMode::NOT_IMPORT );
SummaryRestartFilesImportModeType separate( RiaPreferences::SummaryRestartFilesImportMode::SEPARATE_CASES );
options.push_back( caf::PdmOptionItemInfo( skip.uiText(), RiaPreferences::NOT_IMPORT ) );
options.push_back( caf::PdmOptionItemInfo( separate.uiText(), RiaPreferences::SEPARATE_CASES ) );
options.push_back(
caf::PdmOptionItemInfo( skip.uiText(), RiaPreferences::SummaryRestartFilesImportMode::NOT_IMPORT ) );
options.push_back( caf::PdmOptionItemInfo( separate.uiText(),
RiaPreferences::SummaryRestartFilesImportMode::SEPARATE_CASES ) );
}
else if ( fieldNeedingOptions == &summaryEnsembleImportMode )
{
// Manual option handling in order to one only a subset of the enum values
SummaryRestartFilesImportModeType skip( RiaPreferences::NOT_IMPORT );
SummaryRestartFilesImportModeType allowImport( RiaPreferences::IMPORT );
SummaryRestartFilesImportModeType skip( RiaPreferences::SummaryRestartFilesImportMode::NOT_IMPORT );
SummaryRestartFilesImportModeType allowImport( RiaPreferences::SummaryRestartFilesImportMode::IMPORT );
options.push_back( caf::PdmOptionItemInfo( skip.uiText(), RiaPreferences::NOT_IMPORT ) );
options.push_back( caf::PdmOptionItemInfo( allowImport.uiText(), RiaPreferences::IMPORT ) );
options.push_back(
caf::PdmOptionItemInfo( skip.uiText(), RiaPreferences::SummaryRestartFilesImportMode::NOT_IMPORT ) );
options.push_back(
caf::PdmOptionItemInfo( allowImport.uiText(), RiaPreferences::SummaryRestartFilesImportMode::IMPORT ) );
}
else if ( fieldNeedingOptions == &m_dateFormat )
{
@@ -645,7 +653,8 @@ QList<caf::PdmOptionItemInfo> RiaPreferences::calculateValueOptions( const caf::
{
QTime exampleTime = QTime( 15, 48, 22 );
QString timeFormatString =
RiaQDateTimeTools::timeFormatString( timeFormat, RiaQDateTimeTools::TIME_FORMAT_HOUR_MINUTE_SECOND );
RiaQDateTimeTools::timeFormatString( timeFormat,
RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE_SECOND );
QString uiText = QString( "%1 (%2)" ).arg( timeFormatString ).arg( exampleTime.toString( timeFormatString ) );
uiText.replace( "AP", "AM/PM" );
options.push_back( caf::PdmOptionItemInfo( uiText, QVariant::fromValue( timeFormat ) ) );
@@ -660,27 +669,6 @@ QList<caf::PdmOptionItemInfo> RiaPreferences::calculateValueOptions( const caf::
//--------------------------------------------------------------------------------------------------
void RiaPreferences::initAfterRead()
{
// If the stored font size is smaller than the minimum enum value, the stored font size is actually just an enum value
int defaultSceneFontEnumValue = static_cast<int>( m_defaultSceneFontSize_OBSOLETE.v() );
if ( defaultSceneFontEnumValue >= (int)RiaFontCache::MIN_FONT_SIZE )
{
defaultSceneFontSize = RiaFontCache::legacyEnumToPointSize( defaultSceneFontEnumValue );
}
int defaultWellLabelFontEnumValue = static_cast<int>( m_defaultWellLabelFontSize_OBSOLETE.v() );
if ( defaultWellLabelFontEnumValue >= (int)RiaFontCache::MIN_FONT_SIZE )
{
defaultWellLabelFontSize = RiaFontCache::legacyEnumToPointSize( defaultWellLabelFontEnumValue );
}
int defaultAnnotationFontEnumValue = static_cast<int>( m_defaultAnnotationFontSize_OBSOLETE.v() );
if ( defaultAnnotationFontEnumValue >= (int)RiaFontCache::MIN_FONT_SIZE )
{
defaultAnnotationFontSize = RiaFontCache::legacyEnumToPointSize( defaultAnnotationFontEnumValue );
}
int defaultPlotFontEnumValue = static_cast<int>( m_defaultPlotFontSize_OBSOLETE.v() );
if ( defaultPlotFontEnumValue >= (int)RiaFontCache::MIN_FONT_SIZE )
{
defaultPlotFontSize = RiaFontCache::legacyEnumToPointSize( defaultPlotFontEnumValue );
}
}
//--------------------------------------------------------------------------------------------------
@@ -697,6 +685,11 @@ void RiaPreferences::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
m_pageTopMargin = defaultMarginSize( m_pageSize() );
m_pageBottomMargin = defaultMarginSize( m_pageSize() );
}
if ( changedField == &m_guiTheme )
{
RiuGuiTheme::updateGuiTheme( m_guiTheme() );
}
}
//--------------------------------------------------------------------------------------------------
///
@@ -746,6 +739,14 @@ QString RiaPreferences::tabNameSystem()
return "System";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaPreferences::tabNameImport()
{
return "Import";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -774,6 +775,7 @@ QStringList RiaPreferences::tabNames()
names << tabNamePlotting();
names << tabNameScripting();
names << tabNameExport();
names << tabNameImport();
if ( RiaApplication::enableDevelopmentFeatures() )
{
@@ -873,6 +875,14 @@ bool RiaPreferences::show3dInformation() const
return RiaApplication::enableDevelopmentFeatures() && m_showHud();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaPreferences::gtestFilter() const
{
return m_gtestFilter();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -889,6 +899,16 @@ const QString& RiaPreferences::timeFormat() const
return m_timeFormat();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaPreferences::dateTimeFormat( DateFormatComponents dateComponents, TimeFormatComponents timeComponents ) const
{
return QString( "%1 %2" )
.arg( RiaQDateTimeTools::dateFormatString( m_dateFormat(), dateComponents ) )
.arg( RiaQDateTimeTools::timeFormatString( m_timeFormat(), timeComponents ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -980,16 +1000,24 @@ bool RiaPreferences::openExportedPdfInViewer() const
return m_openExportedPdfInViewer;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaDefines::ThemeEnum RiaPreferences::guiTheme() const
{
return m_guiTheme();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::map<RiaDefines::FontSettingType, RiaFontCache::FontSize> RiaPreferences::defaultFontSizes() const
{
std::map<RiaDefines::FontSettingType, RiaFontCache::FontSize> fontSizes;
fontSizes[RiaDefines::SCENE_FONT] = defaultSceneFontSize();
fontSizes[RiaDefines::ANNOTATION_FONT] = defaultAnnotationFontSize();
fontSizes[RiaDefines::WELL_LABEL_FONT] = defaultWellLabelFontSize();
fontSizes[RiaDefines::PLOT_FONT] = defaultPlotFontSize();
fontSizes[RiaDefines::FontSettingType::SCENE_FONT] = defaultSceneFontSize();
fontSizes[RiaDefines::FontSettingType::ANNOTATION_FONT] = defaultAnnotationFontSize();
fontSizes[RiaDefines::FontSettingType::WELL_LABEL_FONT] = defaultWellLabelFontSize();
fontSizes[RiaDefines::FontSettingType::PLOT_FONT] = defaultPlotFontSize();
return fontSizes;
}
@@ -1020,6 +1048,14 @@ QMarginsF RiaPreferences::margins() const
return QMarginsF( m_pageLeftMargin, m_pageTopMargin, m_pageRightMargin, m_pageBottomMargin );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RiaPreferences::surfaceImportResamplingDistance() const
{
return m_surfaceImportResamplingDistance;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1052,6 +1088,22 @@ bool RiaPreferences::showLegendBackground() const
return m_showLegendBackground();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaPreferences::showInfoBox() const
{
return m_showInfoBox();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaPreferences::showGridBox() const
{
return m_showGridBox();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -21,10 +21,10 @@
#pragma once
#include "RiaApplication.h"
#include "RiaDefines.h"
#include "RiaFontCache.h"
#include "RiaGuiApplication.h"
#include "RiaQDateTimeTools.h"
#include "cafAppEnum.h"
#include "cafPdmChildField.h"
@@ -50,16 +50,19 @@ class RiaPreferences : public caf::PdmObject
CAF_PDM_HEADER_INIT;
public:
enum SummaryRestartFilesImportMode
using DateFormatComponents = RiaQDateTimeTools::DateFormatComponents;
using TimeFormatComponents = RiaQDateTimeTools::TimeFormatComponents;
enum class SummaryRestartFilesImportMode
{
IMPORT,
NOT_IMPORT,
SEPARATE_CASES
};
typedef caf::AppEnum<SummaryRestartFilesImportMode> SummaryRestartFilesImportModeType;
typedef RiaFontCache::FontSizeType FontSizeType;
typedef RiaFontCache::FontSizeEnum FontSizeEnum;
enum SummaryHistoryCurveStyleMode
enum class SummaryHistoryCurveStyleMode
{
SYMBOLS,
LINES,
@@ -76,6 +79,8 @@ public:
RiaPreferences( void );
~RiaPreferences( void ) override;
static RiaPreferences* current();
QStringList tabNames();
const RifReaderSettings* readerSettings() const;
@@ -90,9 +95,12 @@ public:
QString holoLensExportFolder() const;
bool useShaders() const;
bool show3dInformation() const;
QString gtestFilter() const;
const QString& dateFormat() const;
const QString& timeFormat() const;
QString dateTimeFormat( DateFormatComponents dateComponents = DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY,
TimeFormatComponents timeComponents = TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE_SECOND ) const;
bool searchPlotTemplateFoldersRecursively() const;
QStringList plotTemplateFolders() const;
@@ -104,17 +112,23 @@ public:
bool showProgressBar() const;
bool openExportedPdfInViewer() const;
RiaDefines::ThemeEnum guiTheme() const;
std::map<RiaDefines::FontSettingType, RiaFontCache::FontSize> defaultFontSizes() const;
void writePreferencesToApplicationStore();
QPageLayout defaultPageLayout() const;
QMarginsF margins() const;
double surfaceImportResamplingDistance() const;
// 3D view
RiaDefines::MeshModeType defaultMeshModeType() const;
RiaGuiApplication::RINavigationPolicy navigationPolicy() const;
int defaultScaleFactorZ() const;
bool showLegendBackground() const;
bool showInfoBox() const;
bool showGridBox() const;
public: // Pdm Fields
caf::PdmField<bool> enableGrpcServer;
@@ -137,10 +151,10 @@ public: // Pdm Fields
caf::PdmField<cvf::Color3f> defaultWellLabelColor;
caf::PdmField<bool> showLasCurveWithoutTvdWarning;
caf::PdmField<FontSizeType> defaultSceneFontSize;
caf::PdmField<FontSizeType> defaultWellLabelFontSize;
caf::PdmField<FontSizeType> defaultAnnotationFontSize;
caf::PdmField<FontSizeType> defaultPlotFontSize;
caf::PdmField<FontSizeEnum> defaultSceneFontSize;
caf::PdmField<FontSizeEnum> defaultWellLabelFontSize;
caf::PdmField<FontSizeEnum> defaultAnnotationFontSize;
caf::PdmField<FontSizeEnum> defaultPlotFontSize;
caf::PdmField<QString> lastUsedProjectFileName;
@@ -175,6 +189,7 @@ private:
static QString tabNameScripting();
static QString tabNameExport();
static QString tabNameSystem();
static QString tabNameImport();
static double defaultMarginSize( QPageSize::PageSizeId pageSizeId );
@@ -197,6 +212,9 @@ private:
caf::PdmField<bool> m_showSummaryTimeAsLongString;
caf::PdmField<bool> m_useMultipleThreadsWhenLoadingSummaryData;
caf::PdmField<bool> m_showProgressBar;
caf::PdmField<QString> m_gtestFilter;
caf::PdmField<caf::AppEnum<RiaDefines::ThemeEnum>> m_guiTheme;
caf::PdmField<PageSizeEnum> m_pageSize;
caf::PdmField<PageOrientationEnum> m_pageOrientation;
@@ -210,17 +228,17 @@ private:
caf::PdmField<bool> m_searchPlotTemplateFoldersRecursively;
caf::PdmField<caf::FilePath> m_defaultPlotTemplate;
// Surface Import
caf::PdmField<double> m_surfaceImportResamplingDistance;
// 3d view
caf::PdmField<caf::AppEnum<RiaDefines::MeshModeType>> m_defaultMeshModeType;
caf::PdmField<caf::AppEnum<RiaGuiApplication::RINavigationPolicy>> m_navigationPolicy;
caf::PdmField<int> m_defaultScaleFactorZ;
caf::PdmField<bool> m_showLegendBackground;
caf::PdmField<bool> m_enableFaultsByDefault;
caf::PdmField<bool> m_showInfoBox;
caf::PdmField<bool> m_showGridBox;
QStringList m_tabNames;
caf::PdmField<FontSizeType> m_defaultSceneFontSize_OBSOLETE;
caf::PdmField<FontSizeType> m_defaultWellLabelFontSize_OBSOLETE;
caf::PdmField<FontSizeType> m_defaultAnnotationFontSize_OBSOLETE;
caf::PdmField<FontSizeType> m_defaultPlotFontSize_OBSOLETE;
};

View File

@@ -22,13 +22,15 @@
#include "RimSummaryCase.h"
#include "RimSummaryCaseCollection.h"
#include "cafAssert.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaSummaryCurveDefinition::RiaSummaryCurveDefinition()
: m_summaryCase( nullptr )
, m_ensemble( nullptr )
, m_isEnsembleCurve( false )
{
}
@@ -37,10 +39,30 @@ RiaSummaryCurveDefinition::RiaSummaryCurveDefinition()
//--------------------------------------------------------------------------------------------------
RiaSummaryCurveDefinition::RiaSummaryCurveDefinition( RimSummaryCase* summaryCase,
const RifEclipseSummaryAddress& summaryAddress,
RimSummaryCaseCollection* ensemble )
bool isEnsembleCurve )
: m_summaryCase( summaryCase )
, m_ensemble( ensemble )
, m_summaryAddress( summaryAddress )
, m_isEnsembleCurve( isEnsembleCurve )
{
CAF_ASSERT( summaryCase );
if ( summaryCase )
{
RimSummaryCaseCollection* ensemble = nullptr;
summaryCase->firstAncestorOfType( ensemble );
m_ensemble = ensemble;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaSummaryCurveDefinition::RiaSummaryCurveDefinition( RimSummaryCaseCollection* ensemble,
const RifEclipseSummaryAddress& summaryAddress )
: m_summaryCase( nullptr )
, m_summaryAddress( summaryAddress )
, m_ensemble( ensemble )
, m_isEnsembleCurve( true )
{
}
@@ -73,7 +95,7 @@ const RifEclipseSummaryAddress& RiaSummaryCurveDefinition::summaryAddress() cons
//--------------------------------------------------------------------------------------------------
bool RiaSummaryCurveDefinition::isEnsembleCurve() const
{
return m_ensemble != nullptr;
return m_isEnsembleCurve;
}
//--------------------------------------------------------------------------------------------------
@@ -192,5 +214,50 @@ bool RiaSummaryCurveDefinition::operator<( const RiaSummaryCurveDefinition& othe
return m_summaryCase < other.summaryCase();
}
return ( m_summaryAddress < other.summaryAddress() );
if ( m_summaryAddress != other.summaryAddress() )
{
return ( m_summaryAddress < other.summaryAddress() );
}
return m_isEnsembleCurve < other.isEnsembleCurve();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaSummaryCurveDefinitionAnalyser::setCurveDefinitions( const std::vector<RiaSummaryCurveDefinition>& curveDefs )
{
m_singleSummaryCases.clear();
m_ensembles.clear();
m_quantityNames.clear();
m_summaryItems.clear();
for ( const auto& curveDef : curveDefs )
{
bool valid = false;
if ( curveDef.ensemble() && curveDef.isEnsembleCurve() )
{
m_ensembles.insert( curveDef.ensemble() );
valid = true;
}
else if ( curveDef.summaryCase() )
{
m_singleSummaryCases.insert( curveDef.summaryCase() );
if ( curveDef.summaryCase()->ensemble() )
{
m_ensembles.insert( curveDef.summaryCase()->ensemble() );
}
valid = true;
}
if ( valid )
{
RifEclipseSummaryAddress address = curveDef.summaryAddress();
m_quantityNames.insert( address.quantityName() );
address.setQuantityName( "" );
if ( !address.itemUiText().empty() ) m_summaryItems.insert( address );
}
}
}

View File

@@ -37,7 +37,8 @@ public:
RiaSummaryCurveDefinition();
explicit RiaSummaryCurveDefinition( RimSummaryCase* summaryCase,
const RifEclipseSummaryAddress& summaryAddress,
RimSummaryCaseCollection* ensemble = nullptr );
bool isEnsembleCurve );
explicit RiaSummaryCurveDefinition( RimSummaryCaseCollection* ensemble, const RifEclipseSummaryAddress& summaryAddress );
RimSummaryCase* summaryCase() const;
const RifEclipseSummaryAddress& summaryAddress() const;
@@ -54,9 +55,22 @@ public:
static QString curveDefinitionText( const QString& caseName, const RifEclipseSummaryAddress& summaryAddress );
private:
private:
RimSummaryCase* m_summaryCase;
RifEclipseSummaryAddress m_summaryAddress;
RimSummaryCaseCollection* m_ensemble;
bool m_isEnsembleCurve;
};
class RiaSummaryCurveDefinitionAnalyser
{
public:
RiaSummaryCurveDefinitionAnalyser() = default;
void setCurveDefinitions( const std::vector<RiaSummaryCurveDefinition>& curveDefs );
std::set<RimSummaryCase*> m_singleSummaryCases; // All summary cases used
std::set<RimSummaryCaseCollection*> m_ensembles; // All the ensembles referenced by the summary cases
std::set<RifEclipseSummaryAddress> m_summaryItems; // Quantity name set to "", stores only the identifiers
std::set<std::string> m_quantityNames; // Quantity names from the addresses
};

View File

@@ -16,6 +16,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiaQDateTimeTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaSummaryTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaWellNameComparer.h
${CMAKE_CURRENT_LIST_DIR}/RiaStdStringTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaInterpolationTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveAnalyzer.h
${CMAKE_CURRENT_LIST_DIR}/RiaSimWellBranchTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaProjectFileVersionTools.h
@@ -62,6 +63,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiaQDateTimeTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaSummaryTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaWellNameComparer.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaStdStringTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaInterpolationTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveAnalyzer.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaSimWellBranchTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaProjectFileVersionTools.cpp

View File

@@ -17,7 +17,7 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RiaArgumentParser.h"
#include "RiaApplication.h"
#include "RiaBaseDefs.h"
#include "RiaImportEclipseCaseTools.h"
#include "RiaLogging.h"

View File

@@ -216,6 +216,24 @@ const caf::ColorTable& RiaColorTables::angularPaletteColors()
return colorTable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const caf::ColorTable& RiaColorTables::rainbowPaletteColors()
{
static std::vector<cvf::Color3ub> colors{cvf::Color3ub::BLACK,
cvf::Color3ub::MAGENTA,
cvf::Color3ub::BLUE,
cvf::Color3ub::CYAN,
cvf::Color3ub::GREEN,
cvf::Color3ub::RED,
cvf::Color3ub::YELLOW,
cvf::Color3ub::WHITE};
static caf::ColorTable colorTable = caf::ColorTable( colors );
return colorTable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -279,7 +297,7 @@ const caf::ColorTable& RiaColorTables::summaryCurveDefaultPaletteColors()
cvf::Color3ub( 202, 0, 0 ), // Red
cvf::Color3ub( 78, 204, 0 ), // Clear Green
cvf::Color3ub( 236, 118, 0 ), // Orange
cvf::Color3ub( 0, 0, 0 ), // Black
cvf::Color3ub( 130, 130, 130 ), // Grey
cvf::Color3ub( 56, 56, 255 ), // Vivid Blue
cvf::Color3ub( 248, 0, 170 ), // Magenta
cvf::Color3ub( 169, 2, 240 ), // Purple
@@ -386,20 +404,17 @@ const caf::ColorTable& RiaColorTables::summaryCurveNoneRedGreenBlueBrownPaletteC
//--------------------------------------------------------------------------------------------------
const caf::ColorTable& RiaColorTables::wellLogPlotPaletteColors()
{
static std::vector<cvf::Color3ub> colors{caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::darkBlue ) ),
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::darkRed ) ),
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::darkGreen ) ),
static std::vector<cvf::Color3ub> colors{caf::ColorTable::fromQColor( QColor( "peru" ) ),
caf::ColorTable::fromQColor( QColor( "blueviolet" ) ),
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::darkYellow ) ),
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::darkMagenta ) ),
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::darkCyan ) ),
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::darkMagenta ) ),
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::darkGray ) ),
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::blue ) ),
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::red ) ),
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::green ) ),
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::yellow ) ),
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::magenta ) ),
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::cyan ) ),
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::gray ) ),
caf::ColorTable::fromQColor( QColor( "yellowgreen" ) ),
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::black ) )};
static caf::ColorTable colorTable = caf::ColorTable( colors );
@@ -498,6 +513,22 @@ const caf::ColorTable& RiaColorTables::waterAndRockPaletteColors()
return colorTable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const caf::ColorTable& RiaColorTables::correlationPaletteColors()
{
static std::vector<cvf::Color3ub> colors{
cvf::Color3ub( 255, 25, 50 ), // Bluish red
cvf::Color3ub( 240, 240, 240 ), // Light Gray
cvf::Color3ub( 255, 100, 50 ), // Dark red Orange
};
static caf::ColorTable colorTable = caf::ColorTable( colors );
return colorTable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -511,17 +542,17 @@ cvf::Color3f RiaColorTables::undefinedCellColor()
//--------------------------------------------------------------------------------------------------
RiaColorTables::WellPathComponentColors RiaColorTables::wellPathComponentColors()
{
return {{RiaDefines::WELL_PATH, cvf::Color3::CEETRON},
{RiaDefines::PERFORATION_INTERVAL, cvf::Color3::DARK_MAGENTA},
{RiaDefines::FISHBONES, cvf::Color3::DARK_GREEN},
{RiaDefines::FRACTURE, cvf::Color3::CRIMSON},
{RiaDefines::ICD, cvf::Color3::DARK_ORANGE},
{RiaDefines::AICD, cvf::Color3::INDIGO},
{RiaDefines::ICV, cvf::Color3::ORCHID},
{RiaDefines::CASING, cvf::Color3::SEA_GREEN},
{RiaDefines::LINER, cvf::Color3::OLIVE},
{RiaDefines::PACKER, cvf::Color3::GRAY},
{RiaDefines::UNDEFINED_COMPONENT, cvf::Color3::MAGENTA}};
return {{RiaDefines::WellPathComponentType::WELL_PATH, cvf::Color3::CEETRON},
{RiaDefines::WellPathComponentType::PERFORATION_INTERVAL, cvf::Color3::DARK_MAGENTA},
{RiaDefines::WellPathComponentType::FISHBONES, cvf::Color3::DARK_GREEN},
{RiaDefines::WellPathComponentType::FRACTURE, cvf::Color3::CRIMSON},
{RiaDefines::WellPathComponentType::ICD, cvf::Color3::DARK_ORANGE},
{RiaDefines::WellPathComponentType::AICD, cvf::Color3::INDIGO},
{RiaDefines::WellPathComponentType::ICV, cvf::Color3::ORCHID},
{RiaDefines::WellPathComponentType::CASING, cvf::Color3::SEA_GREEN},
{RiaDefines::WellPathComponentType::LINER, cvf::Color3::OLIVE},
{RiaDefines::WellPathComponentType::PACKER, cvf::Color3::GRAY},
{RiaDefines::WellPathComponentType::UNDEFINED_COMPONENT, cvf::Color3::MAGENTA}};
}
//--------------------------------------------------------------------------------------------------
@@ -582,6 +613,22 @@ caf::ColorTable RiaColorTables::createBrightnessBasedColorTable( cvf::Color3ub b
return caf::ColorTable( colors );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::map<RiaDefines::PhaseType, caf::ColorTable> RiaColorTables::phaseColors()
{
static std::vector<cvf::Color3ub> waterColors{cvf::Color3ub( cvf::Color3::DARK_BLUE ),
cvf::Color3ub( cvf::Color3::SKY_BLUE )};
static std::vector<cvf::Color3ub> gasColors{cvf::Color3ub( cvf::Color3::DARK_RED ), cvf::Color3ub( cvf::Color3::PINK )};
static std::vector<cvf::Color3ub> oilColors{cvf::Color3ub( cvf::Color3::DARK_GREEN ),
cvf::Color3ub( cvf::Color3::YELLOW_GREEN )};
return {{RiaDefines::PhaseType::WATER_PHASE, caf::ColorTable( waterColors )},
{RiaDefines::PhaseType::GAS_PHASE, caf::ColorTable( gasColors )},
{RiaDefines::PhaseType::OIL_PHASE, caf::ColorTable( oilColors )}};
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -45,6 +45,7 @@ public:
static const caf::ColorTable& tensorOrangeBlueWhitePaletteColors();
static const caf::ColorTable& tensorsMagentaBrownGrayPaletteColors();
static const caf::ColorTable& angularPaletteColors();
static const caf::ColorTable& rainbowPaletteColors();
static const caf::ColorTable& stimPlanPaletteColors();
static const caf::ColorTable& faultsPaletteColors();
static const caf::ColorTable& wellsPaletteColors();
@@ -60,6 +61,7 @@ public:
static const caf::ColorTable& editableWellPathsPaletteColors();
static const caf::ColorTable& wellPathsPaletteColors();
static const caf::ColorTable& waterAndRockPaletteColors();
static const caf::ColorTable& correlationPaletteColors();
static cvf::Color3f undefinedCellColor();
@@ -73,6 +75,8 @@ public:
static caf::ColorTable createBrightnessBasedColorTable( cvf::Color3ub baseColor, int brightnessLevelCount );
static std::map<RiaDefines::PhaseType, caf::ColorTable> phaseColors();
private:
static std::vector<cvf::Color3ub> categoryColors();
static std::vector<cvf::Color3ub> contrastCategoryColors();

View File

@@ -18,6 +18,7 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RiaColorTools.h"
#include "RiuGuiTheme.h"
#include "cvfAssert.h"
#include "cvfMath.h"
@@ -25,6 +26,8 @@
#include <algorithm>
#include <cmath>
#include <QPalette>
//--------------------------------------------------------------------------------------------------
/// Uses W3.org relative luminance calculation taking into account the different luminance of the different colors
/// https://www.w3.org/TR/WCAG20-TECHS/G18.html
@@ -141,6 +144,22 @@ cvf::Color3f RiaColorTools::fromQColorTo3f( QColor color )
return cvf::Color3f( color.redF(), color.greenF(), color.blueF() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QColor RiaColorTools::textColor()
{
return RiuGuiTheme::getColorByVariableName( "textColor" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Color3f RiaColorTools::textColor3f()
{
return fromQColorTo3f( textColor() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -42,6 +42,9 @@ public:
static QColor toQColor( cvf::Color4f color );
static cvf::Color3f fromQColorTo3f( QColor );
static QColor textColor();
static cvf::Color3f textColor3f();
static cvf::Color3f
blendCvfColors( const cvf::Color3f& color1, const cvf::Color3f& color2, int weight1 = 1, int weight2 = 1 );
static QColor blendQColors( const QColor& color1, const QColor& color2, int weight1 = 1, int weight2 = 1 );

View File

@@ -36,7 +36,7 @@ class RiaCurveDataTools
public:
typedef std::vector<std::pair<size_t, size_t>> CurveIntervals;
enum ErrorAxis
enum class ErrorAxis
{
ERROR_ALONG_X_AXIS,
ERROR_ALONG_Y_AXIS

View File

@@ -28,11 +28,11 @@ namespace caf
template <>
void RiaEclipseUnitTools::UnitSystemType::setUp()
{
addItem( RiaEclipseUnitTools::UNITS_METRIC, "UNITS_METRIC", "Metric" );
addItem( RiaEclipseUnitTools::UNITS_FIELD, "UNITS_FIELD", "Field" );
addItem( RiaEclipseUnitTools::UNITS_UNKNOWN, "UNITS_UNKNOWN", "Unknown" );
addItem( RiaEclipseUnitTools::UnitSystem::UNITS_METRIC, "UNITS_METRIC", "Metric" );
addItem( RiaEclipseUnitTools::UnitSystem::UNITS_FIELD, "UNITS_FIELD", "Field" );
addItem( RiaEclipseUnitTools::UnitSystem::UNITS_UNKNOWN, "UNITS_UNKNOWN", "Unknown" );
setDefault( RiaEclipseUnitTools::UNITS_METRIC );
setDefault( RiaEclipseUnitTools::UnitSystem::UNITS_METRIC );
}
} // namespace caf
@@ -49,9 +49,9 @@ double RiaEclipseUnitTools::darcysConstant( UnitSystem unitSystem )
// = 0.00864 (PVT - M)
switch ( unitSystem )
{
case UNITS_FIELD:
case UnitSystem::UNITS_FIELD:
return 0.001127;
case UNITS_METRIC:
case UnitSystem::UNITS_METRIC:
return 0.008527;
default:
CVF_ASSERT( false );
@@ -66,20 +66,20 @@ RiaDefines::DepthUnitType RiaEclipseUnitTools::depthUnit( UnitSystem unit )
{
switch ( unit )
{
case RiaEclipseUnitTools::UNITS_METRIC:
return RiaDefines::UNIT_METER;
case RiaEclipseUnitTools::UnitSystem::UNITS_METRIC:
return RiaDefines::DepthUnitType::UNIT_METER;
break;
case RiaEclipseUnitTools::UNITS_FIELD:
return RiaDefines::UNIT_FEET;
case RiaEclipseUnitTools::UnitSystem::UNITS_FIELD:
return RiaDefines::DepthUnitType::UNIT_FEET;
break;
case RiaEclipseUnitTools::UNITS_LAB:
return RiaDefines::UNIT_NONE;
case RiaEclipseUnitTools::UnitSystem::UNITS_LAB:
return RiaDefines::DepthUnitType::UNIT_NONE;
break;
case RiaEclipseUnitTools::UNITS_UNKNOWN:
return RiaDefines::UNIT_NONE;
case RiaEclipseUnitTools::UnitSystem::UNITS_UNKNOWN:
return RiaDefines::DepthUnitType::UNIT_NONE;
break;
default:
return RiaDefines::UNIT_NONE;
return RiaDefines::DepthUnitType::UNIT_NONE;
break;
}
}
@@ -102,9 +102,9 @@ double RiaEclipseUnitTools::convertSurfaceGasFlowRateToOilEquivalents( UnitSyste
double oilEquivalentGasRate = HUGE_VAL;
if ( caseUnitSystem == RiaEclipseUnitTools::UNITS_FIELD )
if ( caseUnitSystem == RiaEclipseUnitTools::UnitSystem::UNITS_FIELD )
oilEquivalentGasRate = fieldGasToOilEquivalent * eclGasFlowRate;
if ( caseUnitSystem == RiaEclipseUnitTools::UNITS_METRIC )
if ( caseUnitSystem == RiaEclipseUnitTools::UnitSystem::UNITS_METRIC )
oilEquivalentGasRate = metricGasToOilEquivalent * eclGasFlowRate;
return oilEquivalentGasRate;
@@ -117,13 +117,13 @@ QString RiaEclipseUnitTools::unitStringPressure( UnitSystem unitSystem )
{
switch ( unitSystem )
{
case RiaEclipseUnitTools::UNITS_METRIC:
case RiaEclipseUnitTools::UnitSystem::UNITS_METRIC:
return "barsa";
case RiaEclipseUnitTools::UNITS_FIELD:
case RiaEclipseUnitTools::UnitSystem::UNITS_FIELD:
return "psia";
case RiaEclipseUnitTools::UNITS_LAB:
case RiaEclipseUnitTools::UnitSystem::UNITS_LAB:
return "atma";
case RiaEclipseUnitTools::UNITS_UNKNOWN:
case RiaEclipseUnitTools::UnitSystem::UNITS_UNKNOWN:
return "";
default:
return "";

View File

@@ -24,7 +24,7 @@
class RiaEclipseUnitTools
{
public:
enum UnitSystem
enum class UnitSystem
{
UNITS_METRIC,
UNITS_FIELD,
@@ -45,6 +45,11 @@ public:
static double mmToMeter( double mm ) { return mm / 1000.0; }
static double meterToMm( double meter ) { return 1000.0 * meter; }
static double barToPascal( double bar ) { return bar * 100000.0; }
static double barToPsi( double bar ) { return bar * 14.5038; }
static double barPerMeterToPsiPerFeet( double barPerMeter ) { return barPerMeter * 4.42075; }
static double gigaPascalToPascal( double gigaPascal ) { return gigaPascal * 1.0e9; }
static double darcysConstant( UnitSystem unitSystem );
static RiaDefines::DepthUnitType depthUnit( UnitSystem unit );

View File

@@ -18,8 +18,6 @@
#include "RiaExtractionTools.h"
#include "RiaApplication.h"
#include "RigWellPath.h"
#include "RimEclipseCase.h"
#include "RimMainPlotCollection.h"
@@ -84,7 +82,7 @@ RigEclipseWellLogExtractor* RiaExtractionTools::findOrCreateSimWellExtractor( co
//--------------------------------------------------------------------------------------------------
RimWellLogPlotCollection* RiaExtractionTools::wellLogPlotCollection()
{
auto proj = RiaApplication::instance()->project();
auto proj = RimProject::current();
if ( !proj ) return nullptr;
auto plotCollection = proj->mainPlotCollection();

View File

@@ -19,7 +19,13 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RiaFilePathTools.h"
#include "RiaTextStringTools.h"
#include "cafAssert.h"
#include <QDir>
#include <memory>
#include <set>
//--------------------------------------------------------------------------------------------------
@@ -122,12 +128,24 @@ std::pair<QString, QString> RiaFilePathTools::toFolderAndFileName( const QString
QString RiaFilePathTools::removeDuplicatePathSeparators( const QString& path )
{
QString correctedPath = path;
int len;
do
QString prefix;
QString doubleBackslash = R"(\\)";
if ( correctedPath.size() > 2 )
{
len = correctedPath.size();
correctedPath.replace( QString( "%1%1" ).arg( separator() ), separator() );
} while ( correctedPath.size() != len );
QString prefixCandidate = correctedPath.left( 2 );
if ( prefixCandidate == doubleBackslash || prefixCandidate == "//" )
{
prefix = prefixCandidate;
correctedPath = correctedPath.right( correctedPath.size() - 2 );
}
}
correctedPath.replace( QString( "%1%1" ).arg( separator() ), separator() );
correctedPath.replace( doubleBackslash, R"(\)" );
correctedPath = prefix + correctedPath;
return correctedPath;
}
@@ -161,3 +179,186 @@ QString RiaFilePathTools::rootSearchPathFromSearchFilter( const QString& searchF
return pathPartList.join( separator() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaFilePathTools::commonRootOfFileNames( const QStringList& fileList )
{
QStringList fileNameList;
for ( auto filePath : fileList )
{
QFileInfo fileInfo( filePath );
QString fileNameWithoutExt = fileInfo.baseName();
fileNameList.push_back( fileNameWithoutExt );
}
QString root = RiaTextStringTools::findCommonRoot( fileNameList );
return root;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QStringList RiaFilePathTools::splitPathIntoComponents( const QString& inputPath, bool splitExtensionIntoSeparateEntry )
{
auto path = QDir::cleanPath( inputPath );
QStringList components;
QDir dir( path );
QFileInfo fileInfo( path );
if ( splitExtensionIntoSeparateEntry )
{
QString extension = fileInfo.completeSuffix();
path = path.replace( QString( ".%1" ).arg( extension ), "" );
components.push_front( extension );
components.push_front( fileInfo.baseName() );
}
else
{
components.push_back( fileInfo.fileName() );
}
while ( dir.cdUp() )
{
components.push_front( dir.dirName() );
}
return components;
}
struct PathNode
{
QString name;
PathNode* parent;
std::list<std::unique_ptr<PathNode>> children;
QString fileName;
PathNode( const QString& name, PathNode* parent )
: name( name )
, parent( parent )
{
}
};
void addToPathTree( PathNode* node, QStringList pathComponents, const QString& fileName )
{
CAF_ASSERT( node );
if ( !pathComponents.empty() )
{
QString pathComponent = pathComponents.front();
pathComponents.pop_front();
for ( auto it = node->children.begin(); it != node->children.end(); ++it )
{
if ( it->get()->name == pathComponent )
{
addToPathTree( it->get(), pathComponents, fileName );
return;
}
}
node->children.push_back( std::unique_ptr<PathNode>( new PathNode( pathComponent, node ) ) );
addToPathTree( node->children.back().get(), pathComponents, fileName );
}
else
{
// Reached leaf, just set file name
node->fileName = fileName;
}
}
void trimTree( PathNode* node )
{
if ( node->children.size() == 1u )
{
// Unnecessary level. Remove it.
std::unique_ptr<PathNode> singleChildNode = std::move( node->children.front() );
node->children.clear();
node->children.swap( singleChildNode->children );
node->fileName = singleChildNode->fileName;
// Re-parent children
for ( auto it = node->children.begin(); it != node->children.end(); ++it )
{
it->get()->parent = node;
}
trimTree( node );
}
else
{
for ( auto it = node->children.begin(); it != node->children.end(); ++it )
{
trimTree( it->get() );
}
}
}
void extractLeafNodes( PathNode* node, std::list<PathNode*>* leafNodes )
{
if ( node->children.empty() )
{
leafNodes->push_back( node );
}
else
{
for ( auto it = node->children.begin(); it != node->children.end(); ++it )
{
extractLeafNodes( it->get(), leafNodes );
}
}
}
void pathToNode( PathNode* node, QStringList* path )
{
CAF_ASSERT( path );
if ( node != nullptr )
{
if ( !node->name.isEmpty() ) path->push_front( node->name );
pathToNode( node->parent, path );
}
}
//--------------------------------------------------------------------------------------------------
/// Takes a list of file paths and returns a map with the key components that separate the path
/// from the others.
//--------------------------------------------------------------------------------------------------
std::map<QString, QStringList> RiaFilePathTools::keyPathComponentsForEachFilePath( const QStringList& filePaths )
{
std::map<QString, QStringList> allComponents;
std::multiset<QString> allPathComponents;
for ( auto fileName : filePaths )
{
QStringList pathComponentsForFile = splitPathIntoComponents( fileName, true );
allComponents[fileName] = pathComponentsForFile;
for ( auto pathComponent : pathComponentsForFile )
{
allPathComponents.insert( pathComponent );
}
}
auto topNode = std::unique_ptr<PathNode>( new PathNode( "", nullptr ) );
for ( auto keyComponentsPair : allComponents )
{
addToPathTree( topNode.get(), keyComponentsPair.second, keyComponentsPair.first );
}
trimTree( topNode.get() );
std::list<PathNode*> leafNodes;
extractLeafNodes( topNode.get(), &leafNodes );
std::map<QString, QStringList> keyComponents;
for ( PathNode* node : leafNodes )
{
QStringList path;
pathToNode( node, &path );
keyComponents[node->fileName] = path;
}
return keyComponents;
}

View File

@@ -22,6 +22,8 @@
#include <QByteArray>
#include <QString>
#include <QStringList>
#include <map>
#include <string>
//==================================================================================================
@@ -41,4 +43,9 @@ public:
static std::pair<QString, QString> toFolderAndFileName( const QString& absFileName );
static QString removeDuplicatePathSeparators( const QString& path );
static QString rootSearchPathFromSearchFilter( const QString& searchFilter );
static QString commonRootOfFileNames( const QStringList& filePaths );
static QStringList splitPathIntoComponents( const QString& path, bool splitExtensionIntoSeparateEntry = false );
static std::map<QString, QStringList> keyPathComponentsForEachFilePath( const QStringList& filePaths );
};

View File

@@ -44,7 +44,7 @@ RiaGitDiff::~RiaGitDiff()
//--------------------------------------------------------------------------------------------------
void RiaGitDiff::reset()
{
m_lastError = IC_NO_ERROR;
m_lastError = ErrorType::IC_NO_ERROR;
m_errorMsg.clear();
m_errorDetails.clear();
m_diffOutput.clear();
@@ -80,7 +80,7 @@ bool RiaGitDiff::executeDiff( const QString& baseFolder )
QProcess::ProcessError procError = proc.error();
if ( procError != QProcess::UnknownError )
{
m_lastError = SEVERE_ERROR;
m_lastError = ErrorType::SEVERE_ERROR;
m_errorMsg = "Error running 'git' tool process";
m_errorDetails = completeCommand;
return false;

View File

@@ -28,7 +28,7 @@
class RiaGitDiff
{
public:
enum ErrorType
enum class ErrorType
{
IC_NO_ERROR, // No error occurred
IC_ERROR, // An error occurred

View File

@@ -153,7 +153,7 @@ void RiaImageCompareReporter::showInteractiveOnly()
}
//--------------------------------------------------------------------------------------------------
/// Retuns the names of the *.png files in a directory. The names are without path, but with extention
/// Retuns the names of the *.png files in a directory. The names are without path, but with extension
//--------------------------------------------------------------------------------------------------
std::vector<std::string> RiaImageCompareReporter::getPngFilesInDirectory( const std::string& searchPath )

View File

@@ -47,7 +47,7 @@ RiaImageFileCompare::~RiaImageFileCompare()
void RiaImageFileCompare::reset()
{
m_imagesEqual = false;
m_lastError = IC_NO_ERROR;
m_lastError = ErrorType::IC_NO_ERROR;
m_errorMsg = "";
m_errorDetails = "";
}
@@ -61,7 +61,7 @@ bool RiaImageFileCompare::runComparison( const QString& imgFileName, const QStri
if ( m_compareExecutable.isEmpty() )
{
m_lastError = SEVERE_ERROR;
m_lastError = ErrorType::SEVERE_ERROR;
m_errorMsg = "Cannot compare images, no compare executable set";
return false;
}
@@ -89,7 +89,7 @@ bool RiaImageFileCompare::runComparison( const QString& imgFileName, const QStri
QProcess::ProcessError procError = proc.error();
if ( procError != QProcess::UnknownError )
{
m_lastError = SEVERE_ERROR;
m_lastError = ErrorType::SEVERE_ERROR;
m_errorMsg = "Error running compare tool process";
m_errorDetails = completeCommand;
return false;
@@ -111,7 +111,7 @@ bool RiaImageFileCompare::runComparison( const QString& imgFileName, const QStri
else
{
// Report non-severe error
m_lastError = IC_ERROR;
m_lastError = ErrorType::IC_ERROR;
m_errorMsg = "Error running compare tool process";
m_errorDetails = stdErr;

View File

@@ -28,7 +28,7 @@
class RiaImageFileCompare
{
public:
enum ErrorType
enum class ErrorType
{
IC_NO_ERROR, // No error occurred
IC_ERROR, // An error occurred

View File

@@ -66,7 +66,6 @@
#include "cafUtils.h"
#include <QFileInfo>
#include <QMessageBox>
//--------------------------------------------------------------------------------------------------
///
@@ -270,7 +269,7 @@ bool RiaImportEclipseCaseTools::openEclipseInputCaseFromFileNames( const QString
RimEclipseView* riv = rimInputReservoir->createAndAddReservoirView();
riv->cellResult()->setResultType( RiaDefines::INPUT_PROPERTY );
riv->cellResult()->setResultType( RiaDefines::ResultCatType::INPUT_PROPERTY );
riv->loadDataAndUpdate();

View File

@@ -0,0 +1,212 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiaInterpolationTools.h"
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <limits>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool almostEqual( double a, double b, double maxRelDiff = std::numeric_limits<double>::epsilon() * 128 )
{
// Calculate the difference.
double diff = std::fabs( a - b );
double fabsa = std::fabs( a );
double fabsb = std::fabs( b );
// Find the largest
double largest = ( fabsb > fabsa ) ? fabsb : fabsa;
return ( diff <= largest * maxRelDiff );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RiaInterpolationTools::linear( const std::vector<double>& x, const std::vector<double>& y, double value )
{
assert( x.size() == y.size() );
// Handle cases with only one data point.
if ( x.size() <= 1 )
{
return std::numeric_limits<double>::infinity();
}
// Find the lower boundary
bool found = false;
int lowerIndex = 0;
for ( int i = 0; i < static_cast<int>( x.size() - 1 ); i++ )
{
if ( x[i] <= value && x[i + 1] >= value )
{
lowerIndex = i;
found = true;
}
}
// Value is outside of the defined range
if ( !found )
{
// Check if we are just outside the boundaries
if ( almostEqual( value, x[0] ) )
return y[0];
else if ( almostEqual( value, x[x.size() - 1] ) )
return y[x.size() - 1];
return std::numeric_limits<double>::infinity();
}
int upperIndex = lowerIndex + 1;
double lowerX = x[lowerIndex];
double lowerY = y[lowerIndex];
double upperX = x[upperIndex];
double upperY = y[upperIndex];
double deltaY = upperY - lowerY;
double deltaX = upperX - lowerX;
return lowerY + ( ( value - lowerX ) / deltaX ) * deltaY;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RiaInterpolationTools::extrapolate( const std::vector<double>& x, const std::vector<double>& y, double value )
{
return y[0] + ( value - x[0] ) / ( x[1] - x[0] ) * ( y[1] - y[0] );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RiaInterpolationTools::findNextDataPoint( const std::vector<double>& values, int index )
{
for ( size_t i = index; i < values.size(); i++ )
{
if ( values[i] != std::numeric_limits<double>::infinity() ) return static_cast<int>( i );
}
return -1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RiaInterpolationTools::findPreviousDataPoint( const std::vector<double>& values, int index )
{
assert( index >= 0 );
for ( int i = index; i >= 0; i-- )
{
if ( values[i] != std::numeric_limits<double>::infinity() ) return static_cast<int>( i );
}
return -1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RiaInterpolationTools::extrapolateRange( int start,
int end,
int firstPoint,
int lastPoint,
const std::vector<double>& x,
std::vector<double>& y )
{
std::vector<double> xs = {x[firstPoint], x[lastPoint]};
std::vector<double> ys = {y[firstPoint], y[lastPoint]};
for ( int index = start; index < end; index++ )
{
y[index] = extrapolate( xs, ys, x[index] );
}
return end;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RiaInterpolationTools::interpolateRange( int start,
int end,
int firstPoint,
int lastPoint,
const std::vector<double>& x,
std::vector<double>& y )
{
assert( start <= end );
std::vector<double> xs = {x[firstPoint], x[lastPoint]};
std::vector<double> ys = {y[firstPoint], y[lastPoint]};
for ( int index = start; index < end; index++ )
{
y[index] = RiaInterpolationTools::linear( xs, ys, x[index] );
}
return end;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaInterpolationTools::interpolateMissingValues( const std::vector<double>& x, std::vector<double>& y )
{
assert( x.size() == y.size() );
int index = 0;
// Previous index which is not inf
int prevSetIndex = -1;
while ( index < static_cast<int>( y.size() ) )
{
// Missing values are inf in the input data
if ( y[index] == std::numeric_limits<double>::infinity() )
{
// Find the next index with a value
int nextSetIndex = findNextDataPoint( y, index + 1 );
if ( prevSetIndex == -1 )
{
// The first value is inf: need to find next two valid points and extrapolate
int nextSetIndex2 = findNextDataPoint( y, nextSetIndex + 1 );
index = extrapolateRange( index, nextSetIndex, nextSetIndex, nextSetIndex2, x, y );
}
else if ( nextSetIndex == -1 )
{
// The last value is inf: extrapolate from two last data points
int prevSetIndex2 = findPreviousDataPoint( y, prevSetIndex - 1 );
index = extrapolateRange( index, (int)y.size(), prevSetIndex2, prevSetIndex, x, y );
}
else if ( nextSetIndex != static_cast<int>( y.size() ) )
{
// The missing values somewhere between non-inf data: interpolate all the values
index = interpolateRange( index, nextSetIndex, prevSetIndex, nextSetIndex, x, y );
}
}
else
{
// Nothing to do for the values which are not missing
prevSetIndex = index;
++index;
}
}
}

View File

@@ -0,0 +1,50 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <vector>
//==================================================================================================
//
//==================================================================================================
class RiaInterpolationTools
{
public:
static double linear( const std::vector<double>& x, const std::vector<double>& y, double value );
// Interpolate/extrapolate away inf values in y vector.
static void interpolateMissingValues( const std::vector<double>& x, std::vector<double>& y );
private:
static int interpolateRange( int start,
int end,
int firstPoint,
int lastPoint,
const std::vector<double>& x,
std::vector<double>& y );
static int extrapolateRange( int start,
int end,
int firstPoint,
int lastPoint,
const std::vector<double>& x,
std::vector<double>& y );
static int findNextDataPoint( const std::vector<double>& values, int index );
static int findPreviousDataPoint( const std::vector<double>& values, int index );
static double extrapolate( const std::vector<double>& x, const std::vector<double>& y, double value );
};

View File

@@ -17,6 +17,8 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RiaLogging.h"
#include "RiaGuiApplication.h"
#include "RiaRegressionTestRunner.h"
#include <iostream>
#include <sstream>
@@ -35,7 +37,8 @@
#include <cstring>
#endif
#include "QString"
#include <QMessageBox>
#include <QString>
//==================================================================================================
//
@@ -66,7 +69,7 @@ private:
///
//--------------------------------------------------------------------------------------------------
RiaDefaultConsoleLogger::RiaDefaultConsoleLogger()
: m_logLevel( RI_LL_WARNING )
: m_logLevel( int( RILogLevel::RI_LL_WARNING ) )
{
}
@@ -204,7 +207,7 @@ void RiaLogging::deleteLoggerInstance()
//--------------------------------------------------------------------------------------------------
void RiaLogging::error( const QString& message )
{
if ( sm_logger && sm_logger->level() >= RI_LL_ERROR )
if ( sm_logger && sm_logger->level() >= int( RILogLevel::RI_LL_ERROR ) )
{
#pragma omp critical( critical_section_logging )
sm_logger->error( message.toLatin1().constData() );
@@ -216,7 +219,7 @@ void RiaLogging::error( const QString& message )
//--------------------------------------------------------------------------------------------------
void RiaLogging::warning( const QString& message )
{
if ( sm_logger && sm_logger->level() >= RI_LL_WARNING )
if ( sm_logger && sm_logger->level() >= int( RILogLevel::RI_LL_WARNING ) )
{
#pragma omp critical( critical_section_logging )
sm_logger->warning( message.toLatin1().constData() );
@@ -228,7 +231,7 @@ void RiaLogging::warning( const QString& message )
//--------------------------------------------------------------------------------------------------
void RiaLogging::info( const QString& message )
{
if ( sm_logger && sm_logger->level() >= RI_LL_INFO )
if ( sm_logger && sm_logger->level() >= int( RILogLevel::RI_LL_INFO ) )
{
#pragma omp critical( critical_section_logging )
sm_logger->info( message.toLatin1().constData() );
@@ -240,18 +243,31 @@ void RiaLogging::info( const QString& message )
//--------------------------------------------------------------------------------------------------
void RiaLogging::debug( const QString& message )
{
if ( sm_logger && sm_logger->level() >= RI_LL_DEBUG )
if ( sm_logger && sm_logger->level() >= int( RILogLevel::RI_LL_DEBUG ) )
{
#pragma omp critical( critical_section_logging )
sm_logger->debug( message.toLatin1().constData() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaLogging::errorInMessageBox( QWidget* parent, const QString& title, const QString& text )
{
if ( RiaGuiApplication::isRunning() && !RiaRegressionTestRunner::instance()->isRunningRegressionTests() )
{
QMessageBox::warning( parent, title, text );
}
RiaLogging::error( text );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuMessageLoggerBase::RiuMessageLoggerBase()
: m_logLevel( RI_LL_WARNING )
: m_logLevel( (int)RILogLevel::RI_LL_WARNING )
{
}

View File

@@ -21,8 +21,9 @@
#include <string>
class QString;
class QWidget;
enum RILogLevel
enum class RILogLevel
{
RI_LL_ERROR = 1,
RI_LL_WARNING = 2,
@@ -66,6 +67,8 @@ public:
static void info( const QString& message );
static void debug( const QString& message );
static void errorInMessageBox( QWidget* parent, const QString& title, const QString& text );
private:
static RiaLogger* sm_logger;
};

View File

@@ -31,7 +31,7 @@ void RiaOptionItemFactory::appendOptionItemFromViewNameAndCaseName( Rim3dView*
QString displayName = view->autoName();
caf::QIconProvider iconProvider = view->uiCapability()->uiIconProvider();
caf::IconProvider iconProvider = view->uiCapability()->uiIconProvider();
optionItems->push_back( caf::PdmOptionItemInfo( displayName, view, false, iconProvider ) );
}

View File

@@ -35,6 +35,7 @@
///
//--------------------------------------------------------------------------------------------------
RiaProjectModifier::RiaProjectModifier()
: m_invalidateExternalFilePaths( false )
{
}
@@ -95,6 +96,28 @@ void RiaProjectModifier::setReplacePropertiesFolder( int caseIdToReplace, QStrin
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaProjectModifier::setInvalidateExternalFilePaths()
{
m_invalidateExternalFilePaths = true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaProjectModifier::invalidateExternalFilePaths( RimProject* project )
{
std::vector<caf::FilePath*> filePaths = project->allFilePaths();
const QString invalidPath = "path_does_not_exist";
for ( caf::FilePath* filePath : filePaths )
{
filePath->setPath( invalidPath );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -115,6 +138,11 @@ bool RiaProjectModifier::applyModificationsToProject( RimProject* project )
replacePropertiesFolder( project );
}
if ( m_invalidateExternalFilePaths )
{
invalidateExternalFilePaths( project );
}
return true;
}

View File

@@ -47,12 +47,17 @@ public:
void setReplacePropertiesFolderFirstOccurrence( QString newPropertiesFolder );
void setReplacePropertiesFolder( int caseIdToReplace, QString newPropertiesFolder );
// Used by the regression test system to invalidate all paths to test if the tests run as expected if external files
// are missing/invalid
void setInvalidateExternalFilePaths();
bool applyModificationsToProject( RimProject* project );
private:
void replaceSourceCases( RimProject* project );
void replaceCase( RimProject* project );
void replacePropertiesFolder( RimProject* project );
void invalidateExternalFilePaths( RimProject* project );
static QString makeFilePathAbsolute( const QString& relOrAbsolutePath );
static QString caseNameFromGridFileName( const QString& fullGridFilePathName );
@@ -67,4 +72,5 @@ private:
std::map<int, QString> m_caseIdToGridFileNameMap;
std::map<int, std::vector<QString>> m_groupIdToGridFileNamesMap;
std::map<int, QString> m_caseIdToPropertiesFolderMap;
bool m_invalidateExternalFilePaths;
};

View File

@@ -58,11 +58,11 @@ void caf::AppEnum<RiaQDateTimeTools::DateFormatComponents>::setUp()
template <>
void caf::AppEnum<RiaQDateTimeTools::TimeFormatComponents>::setUp()
{
addItem( RiaQDateTimeTools::TIME_FORMAT_NONE, "NO_TIME", "No Time of Day" );
addItem( RiaQDateTimeTools::TIME_FORMAT_HOUR, "HOUR", "Hour Only" );
addItem( RiaQDateTimeTools::TIME_FORMAT_HOUR_MINUTE, "HOUR_MINUTE", "Hour and Minute" );
addItem( RiaQDateTimeTools::TIME_FORMAT_HOUR_MINUTE_SECOND, "HOUR_MINUTE_SECONDS", "Hour, Minutes and Seconds" );
setDefault( RiaQDateTimeTools::TIME_FORMAT_NONE );
addItem( RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_NONE, "NO_TIME", "No Time of Day" );
addItem( RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_HOUR, "HOUR", "Hour Only" );
addItem( RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE, "HOUR_MINUTE", "Hour and Minute" );
addItem( RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE_SECOND, "HOUR_MINUTE_SECONDS", "Hour, Minutes and Seconds" );
setDefault( RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_NONE );
}
template <>
@@ -489,12 +489,12 @@ QString RiaQDateTimeTools::dateFormatString( const QString& fullDateFormat, Date
//--------------------------------------------------------------------------------------------------
QString RiaQDateTimeTools::timeFormatString( const QString& fullTimeFormat, TimeFormatComponents timeComponents )
{
if ( timeComponents == TIME_FORMAT_NONE ) return "";
if ( timeComponents == TimeFormatComponents::TIME_FORMAT_NONE ) return "";
QStringList allVariants = fullTimeFormat.split( ";" );
if ( static_cast<int>( timeComponents ) < allVariants.size() )
{
return allVariants[timeComponents];
return allVariants[static_cast<int>( timeComponents )];
}
CVF_ASSERT( false && "Time format string is malformed" );
return "";

View File

@@ -66,7 +66,7 @@ public:
DATE_FORMAT_SIZE
};
enum TimeFormatComponents
enum class TimeFormatComponents
{
TIME_FORMAT_UNSPECIFIED = -2,
TIME_FORMAT_NONE = -1,
@@ -117,7 +117,7 @@ public:
static QDateTime truncateTime( const QDateTime& dt, RiaQDateTimeTools::DateTimePeriod period );
static std::vector<RiaQDateTimeTools::DateTimePeriod> dateTimePeriods();
static QString dateTimePeriodName( RiaQDateTimeTools::DateTimePeriod period );
static QString dateTimePeriodName( RiaQDateTimeTools::DateTimePeriod period );
// This function uses C locale to make sure the text representation of a date is stable, independent of the locale
// settings on local machine. Required for stable regression testing.
@@ -129,8 +129,12 @@ public:
static std::vector<QString> supportedDateFormats();
static std::vector<QString> supportedTimeFormats();
static QString dateFormatString( const QString& fullDateFormat, DateFormatComponents dateComponents );
static QString timeFormatString( const QString& fullTimeFormat, TimeFormatComponents timeComponents );
static QString
dateFormatString( const QString& fullDateFormat,
DateFormatComponents dateComponents = DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY );
static QString
timeFormatString( const QString& fullTimeFormat,
TimeFormatComponents timeComponents = TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE_SECOND );
static QList<caf::PdmOptionItemInfo> createOptionItems( const std::vector<time_t>& timeSteps );

View File

@@ -83,6 +83,14 @@ RiaRegressionTest::RiaRegressionTest( void )
"",
"",
"" );
CAF_PDM_InitField( &invalidateExternalFilePaths,
"invalidateExternalFilePaths",
false,
"Invalidate External File Paths",
"",
"",
"" );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -43,6 +43,7 @@ public:
caf::PdmField<bool> useOpenMPForGeometryCreation;
caf::PdmField<bool> openReportInBrowser;
caf::PdmField<bool> appendTestsAfterTestFilter;
caf::PdmField<bool> invalidateExternalFilePaths;
protected:
void defineEditorAttribute( const caf::PdmFieldHandle* field,

View File

@@ -23,6 +23,7 @@
#include "RiaImageCompareReporter.h"
#include "RiaImageFileCompare.h"
#include "RiaLogging.h"
#include "RiaProjectModifier.h"
#include "RiaRegressionTest.h"
#include "RiaTextFileCompare.h"
@@ -47,6 +48,7 @@
#include <QDebug>
#include <QDesktopServices>
#include <QDir>
#include <QElapsedTimer>
#include <QMdiSubWindow>
#include <QSettings>
#include <QStatusBar>
@@ -70,7 +72,7 @@ const QString commandFileFilter = "commandfile-*";
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void logInfoTextWithTimeInSeconds( const QTime& time, const QString& msg )
void logInfoTextWithTimeInSeconds( const QElapsedTimer& time, const QString& msg )
{
double timeRunning = time.elapsed() / 1000.0;
@@ -164,7 +166,7 @@ void RiaRegressionTestRunner::runRegressionTest()
RiaLogging::info( QTime::currentTime().toString() + ": Launching regression tests" );
RiaLogging::info( "--------------------------------------------------" );
QTime timeStamp;
QElapsedTimer timeStamp;
timeStamp.start();
logInfoTextWithTimeInSeconds( timeStamp, "Starting regression tests\n" );
@@ -193,9 +195,17 @@ void RiaRegressionTestRunner::runRegressionTest()
if ( !projectFileName.isEmpty() )
{
cvf::ref<RiaProjectModifier> projectModifier;
if ( regressionTestConfig.invalidateExternalFilePaths )
{
projectModifier = new RiaProjectModifier;
projectModifier->setInvalidateExternalFilePaths();
}
logInfoTextWithTimeInSeconds( timeStamp, "Initializing test :" + testCaseFolder.absolutePath() );
app->loadProject( testCaseFolder.filePath( projectFileName ) );
app->loadProject( testCaseFolder.filePath( projectFileName ),
RiaApplication::ProjectLoadAction::PLA_NONE,
projectModifier.p() );
// Wait until all command objects have completed
app->waitUntilCommandObjectsHasBeenProcessed();

View File

@@ -21,6 +21,9 @@
#include "RiaStatisticsTools.h"
#include "RifEclipseSummaryAddress.h"
#include "RigStatisticsMath.h"
#include "cafAssert.h"
#include <QString>
@@ -49,3 +52,45 @@ const QString RiaStatisticsTools::replacePercentileByPValueText( const QString&
}
return result;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RiaStatisticsTools::pearsonCorrelation( const std::vector<double>& xValues, const std::vector<double>& yValues )
{
const double eps = 1.0e-8;
double rangeX = 0.0, rangeY = 0.0;
RigStatisticsMath::calculateBasicStatistics( xValues, nullptr, nullptr, nullptr, &rangeX, nullptr, nullptr );
RigStatisticsMath::calculateBasicStatistics( yValues, nullptr, nullptr, nullptr, &rangeY, nullptr, nullptr );
if ( rangeX < eps || rangeY < eps ) return 0.0;
if ( xValues.size() != yValues.size() ) return 0.0;
if ( xValues.empty() ) return 0.0;
size_t sampleSize = xValues.size();
double meanX = 0.0, meanY = 0.0;
for ( size_t i = 0; i < sampleSize; ++i )
{
meanX += xValues[i];
meanY += yValues[i];
}
meanX /= sampleSize;
meanY /= sampleSize;
double sumNumerator = 0.0;
double sumxDiffSquared = 0.0, sumyDiffSquared = 0.0;
for ( size_t i = 0; i < sampleSize; ++i )
{
double xDiff = xValues[i] - meanX;
double yDiff = yValues[i] - meanY;
sumNumerator += xDiff * yDiff;
sumxDiffSquared += xDiff * xDiff;
sumyDiffSquared += yDiff * yDiff;
}
if ( sumxDiffSquared < eps && sumyDiffSquared < eps ) return 1.0;
if ( sumxDiffSquared < eps || sumyDiffSquared < eps ) return 0.0;
return sumNumerator / ( std::sqrt( sumxDiffSquared ) * std::sqrt( sumyDiffSquared ) );
}

View File

@@ -21,6 +21,8 @@
#pragma once
#include <cmath>
#include <numeric>
#include <vector>
class QString;
@@ -48,4 +50,6 @@ public:
return true;
}
static double pearsonCorrelation( const std::vector<double>& xValues, const std::vector<double>& yValues );
};

View File

@@ -142,3 +142,51 @@ size_t RiaStdStringTools::findCharMatchCount( const std::string& s, char c )
}
return count;
}
//--------------------------------------------------------------------------------------------------
/// Function to find Levenshtein Distance between two strings (x and y).
/// Adapted from pseudocode from wikipedia: https://en.wikipedia.org/wiki/Levenshtein_distance
/// Implementation is the Wagner-Fischer variant: https://en.wikipedia.org/wiki/Wagner-Fischer_algorithm
///
/// Return value is higher when strings are more "different", and zero when strings are equal.
//--------------------------------------------------------------------------------------------------
int RiaStdStringTools::computeEditDistance( const std::string& x, const std::string& y )
{
// for all i and j, T[i,j] will hold the Levenshtein distance between
// the first i characters of x and the first j characters of y
int m = static_cast<int>( x.length() );
int n = static_cast<int>( y.length() );
std::vector<std::vector<int>> T( m + 1, std::vector<int>( n + 1, 0 ) );
// source prefixes can be transformed into empty string by
// dropping all characters
for ( int i = 1; i <= m; i++ )
T[i][0] = i;
// target prefixes can be reached from empty source prefix
// by inserting every character
for ( int j = 1; j <= n; j++ )
T[0][j] = j;
// fill the lookup table in bottom-up manner
for ( int i = 1; i <= m; i++ )
{
for ( int j = 1; j <= n; j++ )
{
int substitutionCost;
if ( x[i - 1] == y[j - 1] )
substitutionCost = 0;
else
substitutionCost = 1;
int deletion = T[i - 1][j] + 1;
int insertion = T[i][j - 1] + 1;
int replacement = T[i - 1][j - 1] + substitutionCost;
T[i][j] = std::min( std::min( deletion, insertion ), replacement );
}
}
// The distance between the two full strings as the last value computed.
return T[m][n];
}

View File

@@ -43,6 +43,8 @@ public:
static std::vector<std::string> splitStringBySpace( const std::string& s );
static int computeEditDistance( const std::string& x, const std::string& y );
private:
template <class Container>
static void splitByDelimiter( const std::string& str, Container& cont, char delimiter = ' ' );

View File

@@ -18,8 +18,7 @@
#include "RiaSummaryTools.h"
#include "RiaApplication.h"
#include "RiaFilePathTools.h"
#include "RifEclipseSummaryAddress.h"
#include "RimMainPlotCollection.h"
@@ -38,12 +37,14 @@
#include "cafPdmObject.h"
#include <QRegularExpression>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryPlotCollection* RiaSummaryTools::summaryPlotCollection()
{
RimProject* project = RiaApplication::instance()->project();
RimProject* project = RimProject::current();
return project->mainPlotCollection()->summaryPlotCollection();
}
@@ -53,7 +54,7 @@ RimSummaryPlotCollection* RiaSummaryTools::summaryPlotCollection()
//--------------------------------------------------------------------------------------------------
RimSummaryCrossPlotCollection* RiaSummaryTools::summaryCrossPlotCollection()
{
RimProject* project = RiaApplication::instance()->project();
RimProject* project = RimProject::current();
return project->mainPlotCollection()->summaryCrossPlotCollection();
}
@@ -63,7 +64,7 @@ RimSummaryCrossPlotCollection* RiaSummaryTools::summaryCrossPlotCollection()
//--------------------------------------------------------------------------------------------------
RimSummaryCaseMainCollection* RiaSummaryTools::summaryCaseMainCollection()
{
RimProject* project = RiaApplication::instance()->project();
RimProject* project = RimProject::current();
RimSummaryCaseMainCollection* summaryCaseMainCollection = project->activeOilField()->summaryCaseMainCollection();
CVF_ASSERT( summaryCaseMainCollection );
return summaryCaseMainCollection;
@@ -76,7 +77,7 @@ void RiaSummaryTools::notifyCalculatedCurveNameHasChanged( int calculationId, co
{
RimSummaryPlotCollection* summaryPlotColl = RiaSummaryTools::summaryPlotCollection();
for ( RimSummaryPlot* plot : summaryPlotColl->summaryPlots() )
for ( RimSummaryPlot* plot : summaryPlotColl->plots() )
{
for ( RimSummaryCurve* curve : plot->summaryCurves() )
{
@@ -197,7 +198,7 @@ void RiaSummaryTools::getSummaryCasesAndAddressesForCalculation( int
std::vector<RimSummaryCase*>& cases,
std::vector<RifEclipseSummaryAddress>& addresses )
{
RimProject* proj = RiaApplication::instance()->project();
RimProject* proj = RimProject::current();
RimSummaryCalculationCollection* calculationColl = proj->calculationCollection();
if ( !calculationColl ) return;
@@ -211,3 +212,56 @@ void RiaSummaryTools::getSummaryCasesAndAddressesForCalculation( int
addresses.push_back( v->summaryAddress()->address() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaSummaryTools::findSuitableEnsembleName( const QStringList& summaryCaseFileNames )
{
std::vector<QStringList> componentsForAllFilePaths;
for ( auto filePath : summaryCaseFileNames )
{
QStringList components = RiaFilePathTools::splitPathIntoComponents( filePath );
componentsForAllFilePaths.push_back( components );
}
// Find list of all folders inside a folder matching realization-*
QRegularExpression realizationRe( "realization\\-\\d+" );
QStringList iterations;
for ( const auto& fileComponents : componentsForAllFilePaths )
{
QString lastComponent = "";
for ( auto it = fileComponents.rbegin(); it != fileComponents.rend(); ++it )
{
if ( realizationRe.match( *it ).hasMatch() )
{
iterations.push_back( lastComponent );
}
lastComponent = *it;
}
}
iterations.removeDuplicates();
if ( iterations.size() == 1u )
{
return iterations.front();
}
else if ( !iterations.empty() )
{
return QString( "Multiple iterations: %1" ).arg( iterations.join( ", " ) );
}
QString root = RiaFilePathTools::commonRootOfFileNames( summaryCaseFileNames );
QRegularExpression trimRe( "[^a-zA-Z0-9]+$" );
QString trimmedRoot = root.replace( trimRe, "" );
if ( trimmedRoot.length() >= 4 )
{
return trimmedRoot;
}
return "Ensemble";
}

View File

@@ -18,6 +18,8 @@
#pragma once
#include <QString>
#include <vector>
class RimSummaryPlotCollection;
@@ -29,7 +31,7 @@ class RimSummaryCase;
class RifEclipseSummaryAddress;
class QString;
class QStringList;
namespace caf
{
@@ -59,4 +61,6 @@ public:
static void getSummaryCasesAndAddressesForCalculation( int id,
std::vector<RimSummaryCase*>& cases,
std::vector<RifEclipseSummaryAddress>& addresses );
static QString findSuitableEnsembleName( const QStringList& summaryCaseFileNames );
};

View File

@@ -43,7 +43,7 @@ RiaTextFileCompare::~RiaTextFileCompare()
//--------------------------------------------------------------------------------------------------
void RiaTextFileCompare::reset()
{
m_lastError = IC_NO_ERROR;
m_lastError = ErrorType::IC_NO_ERROR;
m_errorMsg.clear();
m_errorDetails.clear();
m_diffOutput.clear();
@@ -77,7 +77,7 @@ bool RiaTextFileCompare::runComparison( const QString& baseFolder, const QString
QProcess::ProcessError procError = proc.error();
if ( procError != QProcess::UnknownError )
{
m_lastError = SEVERE_ERROR;
m_lastError = ErrorType::SEVERE_ERROR;
m_errorMsg = "Error running 'diff' tool process";
m_errorDetails = completeCommand;
return false;
@@ -102,7 +102,7 @@ bool RiaTextFileCompare::runComparison( const QString& baseFolder, const QString
stdErr = stdErr.simplified();
// Report non-severe error
m_lastError = IC_ERROR;
m_lastError = ErrorType::IC_ERROR;
m_errorMsg = "Error running 'diff' tool process";
m_errorDetails = stdErr;

View File

@@ -28,7 +28,7 @@
class RiaTextFileCompare
{
public:
enum ErrorType
enum class ErrorType
{
IC_NO_ERROR, // No error occurred
IC_ERROR, // An error occurred

View File

@@ -20,6 +20,7 @@
#include <QRegularExpression>
#include <QString>
#include <QStringList>
//--------------------------------------------------------------------------------------------------
///
@@ -55,3 +56,29 @@ QString RiaTextStringTools::trimAndRemoveDoubleSpaces( const QString& s )
return trimmed;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaTextStringTools::findCommonRoot( const QStringList& stringList )
{
QString root = stringList.front();
for ( const auto& item : stringList )
{
if ( root.length() > item.length() )
{
root.truncate( item.length() );
}
for ( int i = 0; i < root.length(); ++i )
{
if ( root[i] != item[i] )
{
root.truncate( i );
break;
}
}
}
return root;
}

View File

@@ -19,6 +19,7 @@
#pragma once
class QString;
class QStringList;
//--------------------------------------------------------------------------------------------------
///
@@ -27,4 +28,5 @@ namespace RiaTextStringTools
{
bool compare( const QString& expected, const QString& actual );
QString trimAndRemoveDoubleSpaces( const QString& s );
QString findCommonRoot( const QStringList& stringList );
} // namespace RiaTextStringTools

View File

@@ -47,15 +47,24 @@ public:
static std::vector<FloatType> convertDepths( const std::vector<FloatType>& depthsIn,
RiaDefines::DepthUnitType unitsIn,
RiaDefines::DepthUnitType unitsOut );
static bool convertValues( const std::vector<FloatType>& tvdRKBs,
const std::vector<FloatType>& valuesIn,
std::vector<FloatType>* valuesOut,
const QString& unitsIn,
const QString& unitsOut );
static bool convertValues( std::vector<std::pair<FloatType, FloatType>>* measuredDepthsAndValues,
const QString& unitsIn,
const QString& unitsOut,
const RigWellPath* wellPath );
static std::vector<std::pair<FloatType, FloatType>>
convertDepths( const std::vector<std::pair<FloatType, FloatType>>& depthsIn,
RiaDefines::DepthUnitType unitsIn,
RiaDefines::DepthUnitType unitsOut );
static FloatType
convertDepth( FloatType depthIn, RiaDefines::DepthUnitType unitsIn, RiaDefines::DepthUnitType unitsOut );
static bool convertValues( const std::vector<FloatType>& tvdRKBs,
const std::vector<FloatType>& valuesIn,
std::vector<FloatType>* valuesOut,
const QString& unitsIn,
const QString& unitsOut );
static bool convertValues( std::vector<std::pair<FloatType, FloatType>>* measuredDepthsAndValues,
const QString& unitsIn,
const QString& unitsOut,
const RigWellPath* wellPath );
static std::vector<FloatType> tvdRKBs( const std::vector<FloatType>& measuredDepths, const RigWellPath* wellPath );

View File

@@ -22,14 +22,13 @@
#include <limits>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template <typename FloatType>
const FloatType RiaWellLogUnitTools<FloatType>::gravityAcceleration()
{
return (FloatType) 9.81;
return (FloatType)9.81;
}
//--------------------------------------------------------------------------------------------------
@@ -136,29 +135,78 @@ QString RiaWellLogUnitTools<FloatType>::pascalUnitStringShort()
//--------------------------------------------------------------------------------------------------
template <typename FloatType>
std::vector<FloatType> RiaWellLogUnitTools<FloatType>::convertDepths( const std::vector<FloatType>& depthsIn,
RiaDefines::DepthUnitType unitsIn,
RiaDefines::DepthUnitType unitsOut )
RiaDefines::DepthUnitType unitsIn,
RiaDefines::DepthUnitType unitsOut )
{
if ( unitsOut == RiaDefines::UNIT_METER && unitsIn == RiaDefines::UNIT_FEET )
{
return multiply( depthsIn, RiaEclipseUnitTools::feetPerMeter() );
}
else if ( unitsOut == RiaDefines::UNIT_FEET && unitsIn == RiaDefines::UNIT_METER )
if ( unitsOut == RiaDefines::DepthUnitType::UNIT_METER && unitsIn == RiaDefines::DepthUnitType::UNIT_FEET )
{
return multiply( depthsIn, RiaEclipseUnitTools::meterPerFeet() );
}
else if ( unitsOut == RiaDefines::DepthUnitType::UNIT_FEET && unitsIn == RiaDefines::DepthUnitType::UNIT_METER )
{
return multiply( depthsIn, RiaEclipseUnitTools::feetPerMeter() );
}
return depthsIn;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template <typename FloatType>
FloatType RiaWellLogUnitTools<FloatType>::convertDepth( FloatType depthIn,
RiaDefines::DepthUnitType unitsIn,
RiaDefines::DepthUnitType unitsOut )
{
FloatType factor = 1.0;
if ( unitsOut == RiaDefines::DepthUnitType::UNIT_METER && unitsIn == RiaDefines::DepthUnitType::UNIT_FEET )
{
factor = RiaEclipseUnitTools::meterPerFeet();
}
else if ( unitsOut == RiaDefines::DepthUnitType::UNIT_FEET && unitsIn == RiaDefines::DepthUnitType::UNIT_METER )
{
factor = RiaEclipseUnitTools::feetPerMeter();
}
return depthIn * factor;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template <typename FloatType>
std::vector<std::pair<FloatType, FloatType>>
RiaWellLogUnitTools<FloatType>::convertDepths( const std::vector<std::pair<FloatType, FloatType>>& depthsIn,
RiaDefines::DepthUnitType unitsIn,
RiaDefines::DepthUnitType unitsOut )
{
std::vector<std::pair<FloatType, FloatType>> convertedDepths( depthsIn.size() );
double factor = 1.0;
if ( unitsOut == RiaDefines::DepthUnitType::UNIT_METER && unitsIn == RiaDefines::DepthUnitType::UNIT_FEET )
{
factor = RiaEclipseUnitTools::meterPerFeet();
}
else if ( unitsOut == RiaDefines::DepthUnitType::UNIT_FEET && unitsIn == RiaDefines::DepthUnitType::UNIT_METER )
{
factor = RiaEclipseUnitTools::feetPerMeter();
}
int i = 0;
for ( auto& p : depthsIn )
{
convertedDepths[i++] = std::make_pair( factor * p.first, factor * p.second );
}
return convertedDepths;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template <typename FloatType>
bool RiaWellLogUnitTools<FloatType>::convertValues( const std::vector<FloatType>& tvdRKBs,
const std::vector<FloatType>& valuesIn,
std::vector<FloatType>* valuesOut,
const QString& unitsIn,
const QString& unitsOut )
const std::vector<FloatType>& valuesIn,
std::vector<FloatType>* valuesOut,
const QString& unitsIn,
const QString& unitsOut )
{
CAF_ASSERT( valuesOut );
@@ -215,7 +263,7 @@ bool RiaWellLogUnitTools<FloatType>::convertValues( const std::vector<FloatType>
}
else if ( stringsMatch( unitsIn, barUnitString() ) && stringsMatch( unitsOut, barX100UnitString() ) )
{
*valuesOut = multiply( valuesIn, (FloatType) 0.01 );
*valuesOut = multiply( valuesIn, (FloatType)0.01 );
return true;
}
else if ( ( stringsMatch( unitsIn, noUnitString() ) || stringsMatch( unitsIn, sg_emwUnitString() ) ) &&
@@ -230,12 +278,14 @@ bool RiaWellLogUnitTools<FloatType>::convertValues( const std::vector<FloatType>
*valuesOut = convertBarToNormalizedByPP( tvdRKBs, valuesIn );
return true;
}
else if ( (stringsMatch( unitsIn, pascalUnitString()) || stringsMatch( unitsIn, pascalUnitString() ) && stringsMatch( unitsOut, barUnitString() ) ))
else if ( ( stringsMatch( unitsIn, pascalUnitString() ) ||
stringsMatch( unitsIn, pascalUnitString() ) && stringsMatch( unitsOut, barUnitString() ) ) )
{
*valuesOut = multiply( valuesIn, 1.0 / pascalPerBar() );
return true;
}
else if ( stringsMatch( unitsIn, barUnitString() ) && (stringsMatch( unitsIn, pascalUnitString()) || stringsMatch( unitsIn, pascalUnitString() )) )
else if ( stringsMatch( unitsIn, barUnitString() ) &&
( stringsMatch( unitsIn, pascalUnitString() ) || stringsMatch( unitsIn, pascalUnitString() ) ) )
{
*valuesOut = multiply( valuesIn, pascalPerBar() );
return true;
@@ -248,9 +298,9 @@ bool RiaWellLogUnitTools<FloatType>::convertValues( const std::vector<FloatType>
//--------------------------------------------------------------------------------------------------
template <typename FloatType>
bool RiaWellLogUnitTools<FloatType>::convertValues( std::vector<std::pair<FloatType, FloatType>>* measuredDepthsAndValues,
const QString& unitsIn,
const QString& unitsOut,
const RigWellPath* wellPath )
const QString& unitsIn,
const QString& unitsOut,
const RigWellPath* wellPath )
{
CAF_ASSERT( measuredDepthsAndValues );
if ( unitsIn == unitsOut ) return true;
@@ -282,7 +332,8 @@ bool RiaWellLogUnitTools<FloatType>::convertValues( std::vector<std::pair<FloatT
///
//--------------------------------------------------------------------------------------------------
template <typename FloatType>
std::vector<FloatType> RiaWellLogUnitTools<FloatType>::tvdRKBs( const std::vector<FloatType>& measuredDepths, const RigWellPath* wellPath )
std::vector<FloatType>
RiaWellLogUnitTools<FloatType>::tvdRKBs( const std::vector<FloatType>& measuredDepths, const RigWellPath* wellPath )
{
std::vector<double> tvdRKBs( measuredDepths.size(), 0.0 );
for ( size_t i = 0; i < measuredDepths.size(); ++i )
@@ -290,7 +341,7 @@ std::vector<FloatType> RiaWellLogUnitTools<FloatType>::tvdRKBs( const std::vecto
cvf::Vec3d point = wellPath->interpolatedPointAlongWellPath( measuredDepths[i] );
tvdRKBs[i] = -point.z() + wellPath->rkbDiff();
}
return std::vector<FloatType>(tvdRKBs.begin(), tvdRKBs.end());
return std::vector<FloatType>( tvdRKBs.begin(), tvdRKBs.end() );
}
//--------------------------------------------------------------------------------------------------
@@ -298,7 +349,7 @@ std::vector<FloatType> RiaWellLogUnitTools<FloatType>::tvdRKBs( const std::vecto
//--------------------------------------------------------------------------------------------------
template <typename FloatType>
std::vector<FloatType> RiaWellLogUnitTools<FloatType>::convertGpcm3ToBar( const std::vector<FloatType>& tvdRKBs,
const std::vector<FloatType>& valuesInGpcm3 )
const std::vector<FloatType>& valuesInGpcm3 )
{
CAF_ASSERT( tvdRKBs.size() == valuesInGpcm3.size() );
@@ -325,7 +376,7 @@ std::vector<FloatType> RiaWellLogUnitTools<FloatType>::convertGpcm3ToBar( const
//--------------------------------------------------------------------------------------------------
template <typename FloatType>
std::vector<FloatType> RiaWellLogUnitTools<FloatType>::convertBarToGpcm3( const std::vector<FloatType>& tvdRKBs,
const std::vector<FloatType>& valuesInBar )
const std::vector<FloatType>& valuesInBar )
{
CAF_ASSERT( tvdRKBs.size() == valuesInBar.size() );
@@ -350,9 +401,10 @@ std::vector<FloatType> RiaWellLogUnitTools<FloatType>::convertBarToGpcm3( const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<typename FloatType>
std::vector<FloatType> RiaWellLogUnitTools<FloatType>::convertNormalizedByPPToBar( const std::vector<FloatType>& tvdRKBs,
const std::vector<FloatType>& normalizedValues )
template <typename FloatType>
std::vector<FloatType>
RiaWellLogUnitTools<FloatType>::convertNormalizedByPPToBar( const std::vector<FloatType>& tvdRKBs,
const std::vector<FloatType>& normalizedValues )
{
CAF_ASSERT( tvdRKBs.size() == normalizedValues.size() );
@@ -368,8 +420,9 @@ std::vector<FloatType> RiaWellLogUnitTools<FloatType>::convertNormalizedByPPToBa
///
//--------------------------------------------------------------------------------------------------
template <typename FloatType>
std::vector<FloatType> RiaWellLogUnitTools<FloatType>::convertBarToNormalizedByPP( const std::vector<FloatType>& tvdRKBs,
const std::vector<FloatType>& valuesInBar )
std::vector<FloatType>
RiaWellLogUnitTools<FloatType>::convertBarToNormalizedByPP( const std::vector<FloatType>& tvdRKBs,
const std::vector<FloatType>& valuesInBar )
{
CAF_ASSERT( tvdRKBs.size() == valuesInBar.size() );
@@ -410,7 +463,7 @@ FloatType RiaWellLogUnitTools<FloatType>::pascalPerBar()
template <typename FloatType>
FloatType RiaWellLogUnitTools<FloatType>::MPaPerBar()
{
return (FloatType) 1.0e-1;
return (FloatType)1.0e-1;
}
//--------------------------------------------------------------------------------------------------
@@ -419,5 +472,5 @@ FloatType RiaWellLogUnitTools<FloatType>::MPaPerBar()
template <typename FloatType>
FloatType RiaWellLogUnitTools<FloatType>::hydrostaticPorePressureBar( FloatType depth )
{
return (FloatType) 1.0 / pascalPerBar() * depth * unitWeightOfWater();
return (FloatType)1.0 / pascalPerBar() * depth * unitWeightOfWater();
}

View File

@@ -18,8 +18,6 @@
#include "RiaWellNameComparer.h"
#include "RiaApplication.h"
#include "RimProject.h"
#include "RimWellPath.h"
@@ -30,7 +28,7 @@
//==================================================================================================
QString RiaWellNameComparer::tryFindMatchingSimWellName( QString searchName )
{
RimProject* proj = RiaApplication::instance()->project();
RimProject* proj = RimProject::current();
const std::vector<QString>& simWellNames = proj->simulationWellNames();
if ( searchName.isEmpty() || simWellNames.empty() ) return QString();
@@ -44,7 +42,7 @@ QString RiaWellNameComparer::tryFindMatchingSimWellName( QString searchName )
//--------------------------------------------------------------------------------------------------
QString RiaWellNameComparer::tryFindMatchingWellPath( QString wellName )
{
RimProject* proj = RiaApplication::instance()->project();
RimProject* proj = RimProject::current();
const std::vector<RimWellPath*>& wellPaths = proj->allWellPaths();
if ( wellName.isEmpty() || wellPaths.empty() ) return QString();

View File

@@ -23,9 +23,9 @@
//--------------------------------------------------------------------------------------------------
/// + p1
/// t1 //
/// | + C
/// \
/// t1 **
/// * + C
/// *
/// + p2
//--------------------------------------------------------------------------------------------------
RiaArcCurveCalculator::RiaArcCurveCalculator( cvf::Vec3d p1, cvf::Vec3d t1, cvf::Vec3d p2 )

View File

@@ -23,9 +23,9 @@
//--------------------------------------------------------------------------------------------------
/// + p1
/// t1 //
/// | + C
/// \
/// t1 **
/// * + C
/// *
/// + p2
//--------------------------------------------------------------------------------------------------
class RiaArcCurveCalculator

View File

@@ -22,12 +22,12 @@
//--------------------------------------------------------------------------------------------------
/// + p1
/// t1 //
/// | r1 + C
/// \
/// t1 **
/// * r1 + C
/// *
/// + firstArcEndpoint
/// \
/// \
/// *
/// *
/// + p2
//--------------------------------------------------------------------------------------------------
class RiaJCurveCalculator

View File

@@ -39,7 +39,7 @@ private:
void sampleArc( cvf::Vec3d t1, cvf::Vec3d p1, cvf::Vec3d p2, cvf::Vec3d* endTangent );
void sampleSegment( cvf::Vec3d t1, cvf::Vec3d p1, cvf::Vec3d p2, cvf::Vec3d* endTangent );
std::vector<cvf::Vec3d>* m_points; // Internal temporary pointers to collections beeing filled.
std::vector<cvf::Vec3d>* m_points; // Internal temporary pointers to collections being filled.
std::vector<double>* m_meshDs;
double m_maxSamplingsInterval;

View File

@@ -33,7 +33,7 @@ RiaWellPlanCalculator::RiaWellPlanCalculator( const cvf::Vec3d& sta
{
if ( m_lineArcEndPoints.size() < 2 ) return;
WellPlanSegment segment = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
WellPlanSegment segment = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
RiaOffshoreSphericalCoords startAziIncRad( m_startTangent );
segment.inc = cvf::Math::toDegrees( startAziIncRad.inc() );
@@ -80,7 +80,7 @@ void RiaWellPlanCalculator::addSegment( cvf::Vec3d t1, cvf::Vec3d p1, cvf::Vec3d
//--------------------------------------------------------------------------------------------------
void RiaWellPlanCalculator::addLineSegment( cvf::Vec3d p1, cvf::Vec3d p2, cvf::Vec3d* endTangent )
{
WellPlanSegment segment = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
WellPlanSegment segment = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
cvf::Vec3d p1p2 = p2 - p1;
double length = p1p2.length();
@@ -110,7 +110,7 @@ void RiaWellPlanCalculator::addLineSegment( cvf::Vec3d p1, cvf::Vec3d p2, cvf::V
//--------------------------------------------------------------------------------------------------
void RiaWellPlanCalculator::addArcSegment( cvf::Vec3d t1, cvf::Vec3d p1, cvf::Vec3d p2, cvf::Vec3d* endTangent )
{
WellPlanSegment segment = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
WellPlanSegment segment = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
RiaArcCurveCalculator arcCalc( p1, t1, p2 );

View File

@@ -22,18 +22,13 @@ find_package( OpenGL )
option(RESINSIGHT_ENABLE_GRPC "Enable the gRPC scripting framework" OFF)
option(RESINSIGHT_GRPC_BUNDLE_PYTHON_MODULE "Bundle the gRPC python modules into the install folder" OFF)
option(RESINSIGHT_TREAT_WARNINGS_AS_ERRORS "Treat warnings as errors (stops build)" OFF)
if (RESINSIGHT_BUILD_WITH_QT5)
find_package(Qt5 COMPONENTS Core QUIET)
endif(RESINSIGHT_BUILD_WITH_QT5)
find_package(Qt5 COMPONENTS Core QUIET)
if (Qt5Core_FOUND)
find_package(Qt5 CONFIG REQUIRED Core Gui OpenGL Network Script Widgets Xml Concurrent PrintSupport)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Network Qt5::OpenGL Qt5::Script Qt5::Widgets Qt5::Xml Qt5::Concurrent Qt5::PrintSupport)
else()
set (QT_COMPONENTS_REQUIRED QtCore QtGui QtMain QtOpenGl QtNetwork QtScript)
find_package(Qt4 COMPONENTS ${QT_COMPONENTS_REQUIRED} REQUIRED)
include(${QT_USE_FILE})
find_package(Qt5 CONFIG REQUIRED Core Gui OpenGL Network Script Widgets Xml Concurrent PrintSupport Svg)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Network Qt5::OpenGL Qt5::Script Qt5::Widgets Qt5::Xml Qt5::Concurrent Qt5::PrintSupport Qt5::Svg)
endif(Qt5Core_FOUND)
# NB: The generated file is written to Cmake binary folder to avoid source tree pollution
@@ -42,6 +37,11 @@ CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/ApplicationCode/Adm/RiaVersionInfo.h.cmake
${CMAKE_BINARY_DIR}/Generated/RiaVersionInfo.h
)
CONFIGURE_FILE( ${CMAKE_CURRENT_LIST_DIR}/RiuThemesDirectory.h.cmake
${CMAKE_BINARY_DIR}/Generated/RiuThemesDirectory.h
)
if (MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11))
# VS 2017 : Disable warnings from from gtest code, using deprecated code related to TR1
add_definitions(-D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING)
@@ -70,10 +70,13 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/ModelVisualization/Intersections
${CMAKE_CURRENT_SOURCE_DIR}/ModelVisualization/Surfaces
${CMAKE_CURRENT_SOURCE_DIR}/UserInterface
${CMAKE_CURRENT_SOURCE_DIR}/UserInterface/AnalysisPlots
${CMAKE_CURRENT_SOURCE_DIR}/CommandFileInterface
${CMAKE_CURRENT_SOURCE_DIR}/CommandFileInterface/Core
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/AnalysisPlots
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/CorrelationPlots
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Annotations
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Completions
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Flow
@@ -140,6 +143,8 @@ list( APPEND REFERENCED_CMAKE_FILES
FileInterface/CMakeLists_files.cmake
ProjectDataModel/CMakeLists_files.cmake
ProjectDataModel/AnalysisPlots/CMakeLists_files.cmake
ProjectDataModel/CorrelationPlots/CMakeLists_files.cmake
ProjectDataModel/GridCrossPlots/CMakeLists_files.cmake
ProjectDataModel/GridCrossPlots/CellFilters/CMakeLists_files.cmake
ProjectDataModel/Summary/CMakeLists_files.cmake
@@ -159,36 +164,10 @@ list( APPEND REFERENCED_CMAKE_FILES
ModelVisualization/WindowEdgeAxesOverlayItem/CMakeLists_files.cmake
UserInterface/CMakeLists_files.cmake
UserInterface/AnalysisPlots/CMakeLists_files.cmake
Commands/CMakeLists_files.cmake
Commands/ApplicationCommands/CMakeLists_files.cmake
Commands/AnnotationCommands/CMakeLists_files.cmake
Commands/CompletionCommands/CMakeLists_files.cmake
Commands/CompletionExportCommands/CMakeLists_files.cmake
Commands/CrossSectionCommands/CMakeLists_files.cmake
Commands/EclipseCommands/CMakeLists_files.cmake
Commands/EclipseCommands/EclipseWell/CMakeLists_files.cmake
Commands/ExportCommands/CMakeLists_files.cmake
Commands/FlowCommands/CMakeLists_files.cmake
Commands/GridCrossPlotCommands/CMakeLists_files.cmake
Commands/HoloLensCommands/CMakeLists_files.cmake
Commands/IntersectionBoxCommands/CMakeLists_files.cmake
Commands/IntersectionViewCommands/CMakeLists_files.cmake
Commands/MeasurementCommands/CMakeLists_files.cmake
Commands/OctaveScriptCommands/CMakeLists_files.cmake
Commands/OperationsUsingObjReferences/CMakeLists_files.cmake
Commands/SummaryPlotCommands/CMakeLists_files.cmake
Commands/SsiHubImportCommands/CMakeLists_files.cmake
Commands/SurfaceCommands/CMakeLists_files.cmake
Commands/ToggleCommands/CMakeLists_files.cmake
Commands/ViewLink/CMakeLists_files.cmake
Commands/WellLogCommands/CMakeLists_files.cmake
Commands/WellPathCommands/CMakeLists_files.cmake
Commands/PlotTemplateCommands/CMakeLists_files.cmake
CommandFileInterface/CMakeLists_files.cmake
CommandFileInterface/Core/CMakeLists_files.cmake
Commands/FractureCommands/CMakeLists_files.cmake
)
option (RESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS "Include ApplicationCode Unit Tests" OFF)
@@ -221,6 +200,7 @@ list( APPEND CPP_SOURCES
#############################################################################
add_subdirectory(ResultStatisticsCache)
add_subdirectory(Commands)
set( RI_LIBRARIES
ResultStatisticsCache
@@ -272,11 +252,6 @@ if (RESINSIGHT_FOUND_HDF5)
endif() # MSVC
source_group( "FileInterface" FILES FileInterface/RifHdf5Reader.h FileInterface/RifHdf5Reader.cpp )
endif()
if (RESINSIGHT_ENABLE_PROTOTYPE_FEATURE_SOURING)
add_definitions(-DENABLE_SOURING)
endif()
#############################################################################
@@ -292,13 +267,8 @@ set ( QT_MOC_HEADERS
SocketInterface/RiaSocketServer.h
)
if (RESINSIGHT_BUILD_WITH_QT5)
qt5_wrap_cpp(MOC_SOURCE_FILES ${QT_MOC_HEADERS} )
qt5_wrap_ui( FORM_FILES_CPP ${QT_UI_FILES} )
else()
qt4_wrap_cpp(MOC_SOURCE_FILES ${QT_MOC_HEADERS} )
qt4_wrap_ui( FORM_FILES_CPP ${QT_UI_FILES} )
endif(RESINSIGHT_BUILD_WITH_QT5)
qt5_wrap_cpp(MOC_SOURCE_FILES ${QT_MOC_HEADERS} )
qt5_wrap_ui( FORM_FILES_CPP ${QT_UI_FILES} )
# NOTE! Resources in subfolders must append to QRC_FILES using the following statement
@@ -314,15 +284,9 @@ set( QRC_FILES
)
# Runs RCC on specified files
if (RESINSIGHT_BUILD_WITH_QT5)
qt5_add_resources( QRC_FILES_CPP
${QRC_FILES}
)
else()
qt4_add_resources( QRC_FILES_CPP
${QRC_FILES}
)
endif(RESINSIGHT_BUILD_WITH_QT5)
qt5_add_resources( QRC_FILES_CPP
${QRC_FILES}
)
# Adding resource (RC) files for Windows
if ( MSVC )
@@ -375,6 +339,7 @@ set( EXE_FILES
.clang-tidy
Adm/RiaVersionInfo.h.cmake
$<TARGET_OBJECTS:cafCommandFeatures> # Needed for cmake version < 3.12. Remove when we can use target_link_libraries with OBJECT libraries
$<TARGET_OBJECTS:Commands> # Needed for cmake version < 3.12. Remove when we can use target_link_libraries with OBJECT libraries
)
if (RESINSIGHT_ENABLE_GRPC)
@@ -403,6 +368,19 @@ if(RESINSIGHT_ENABLE_PRECOMPILED_HEADERS)
endif()
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set_target_properties(ResInsight PROPERTIES COMPILE_FLAGS "-Wall -Wno-unused-parameter -Wno-reorder -Wno-parentheses -Wno-switch")
# Treat warnings as errors if asked to do so
if (RESINSIGHT_TREAT_WARNINGS_AS_ERRORS)
set_target_properties(ResInsight PROPERTIES COMPILE_FLAGS "-Wall -Wno-unused-parameter -Wno-reorder -Wno-parentheses -Wno-switch -Werror")
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set_target_properties(ResInsight PROPERTIES COMPILE_FLAGS "-Wall -Wno-unused-parameter -Wno-reorder -Wno-parentheses -Wno-switch -Wno-delete-abstract-non-virtual-dtor -Wno-undefined-var-template -Wno-invalid-source-encoding -Wno-enum-compare -Wno-call-to-pure-virtual-from-ctor-dtor -Wno-unused-variable -Wno-unused-private-field -Wno-unused-lambda-capture -Wno-delete-non-abstract-non-virtual-dtor -Wno-braced-scalar-init -Wno-tautological-constant-out-of-range-compare")
endif()
endif()
if (MSVC)
# The following warnings are supposed to be used in ResInsight, but temporarily disabled to avoid too much noise
# warning C4245: 'return': conversion from 'int' to 'size_t', signed/unsigned mismatch
@@ -411,7 +389,7 @@ if (MSVC)
# If possible, the following command is supposed to be the final target
# set_target_properties(ResInsight PROPERTIES COMPILE_FLAGS "/W3 /wd4190 /wd4100 /wd4127")
set_target_properties(ResInsight PROPERTIES COMPILE_FLAGS "/W3 /wd4190 /wd4100 /wd4127 /wd4245 /wd4005")
set_target_properties(ResInsight PROPERTIES COMPILE_FLAGS "/wd4190 /wd4100 /wd4127 /wd4245 /wd4005")
if (CMAKE_CXX_COMPILER_VERSION LESS_EQUAL 19.14)
# The following warning is generated over 800 times from a qwt header only using VS2015
# Disabling temporarily
@@ -478,60 +456,18 @@ target_link_libraries( ResInsight ${LINK_LIBRARIES} ${EXTERNAL_LINK_LIBRARIES})
#############################################################################
# cotire and unity builds
# Unity builds
#############################################################################
set( UNITY_EXCLUDE_FILES
# forever is used as variable name, and this symbol is defined by Qt and used in precompiled headers
${ResInsight_SOURCE_DIR}/ThirdParty/gtest/gtest-all.cc
# multiple QRC files are not supported
qrc_cafAnimControl.cxx
qrc_ResInsight.cxx
# mix of cvf and Qt namespaces
ModelVisualization/GridBox/RivGridBoxGenerator.cpp
ModelVisualization/Intersections/RivIntersectionGeometryGenerator.cpp
# exclude file using Eigen
ReservoirDataModel/RigCellGeometryTools.cpp
ReservoirDataModel/Completions/RigTransmissibilityCondenser.cpp
ReservoirDataModel/Completions/RigEclipseToStimPlanCellTransmissibilityCalculator.cpp
ReservoirDataModel/Completions/RigEclipseToStimPlanCalculator.cpp
# exclude file using SolveSpace
Application/Tools/WellPathTools/RiaSCurveCalculator.cpp
# QT 5
qrc_cafAnimControl.cpp
qrc_ResInsight.cpp
qrc_cafCommandFeatures.cpp
ProjectDataModel/RimContourMapView.cpp
Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp
)
if(RESINSIGHT_ENABLE_COTIRE)
foreach (fileToExclude ${UNITY_EXCLUDE_FILES})
set_source_files_properties (${fileToExclude} PROPERTIES COTIRE_EXCLUDED TRUE)
endforeach(fileToExclude)
foreach (cppFile ${CAF_COTIRE_START_NEW_UNITY_SOURCES})
set_source_files_properties (${cppFile} PROPERTIES COTIRE_START_NEW_UNITY_SOURCE TRUE)
endforeach(cppFile ${CAF_COTIRE_START_NEW_UNITY_SOURCES})
# disable precompiled headers
set_target_properties(ResInsight PROPERTIES COTIRE_ENABLE_PRECOMPILED_HEADER FALSE)
cotire(ResInsight)
# make sure the unity target is included in the active builds to trigger rebuild before debug
get_target_property(_unityTargetName ResInsight COTIRE_UNITY_TARGET_NAME)
set_target_properties(${_unityTargetName} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD FALSE)
set_target_properties(ResInsight PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE)
endif()
if(RESINSIGHT_ENABLE_UNITY_BUILD)
foreach (fileToExclude ${UNITY_EXCLUDE_FILES})
set_source_files_properties (${fileToExclude} PROPERTIES SKIP_UNITY_BUILD_INCLUSION TRUE)
@@ -543,30 +479,6 @@ endif()
#############################################################################
if (MSVC)
# Qt DLLs
if (RESINSIGHT_BUILD_WITH_QT5)
message(STATUS "Creating post build step for copying Qt DLLs")
foreach (qtlib ${QT_LIBRARIES})
add_custom_command(TARGET ResInsight POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${qtlib}> $<TARGET_FILE_DIR:ResInsight>
)
endforeach(qtlib)
if (_unityTargetName)
foreach (qtlib ${QT_LIBRARIES})
add_custom_command(TARGET ${_unityTargetName} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${qtlib}> $<TARGET_FILE_DIR:${_unityTargetName}>
)
endforeach(qtlib)
endif(_unityTargetName)
else()
set (QTLIBLIST QtCore QtGui QtGui QtOpenGl QtNetwork QtScript QtScriptTools)
foreach (qtlib ${QTLIBLIST})
list(APPEND RI_DLL_FILENAMES ${QT_BINARY_DIR}/$<IF:$<CONFIG:Debug>,${qtlib}d4.dll,${qtlib}4.dll>)
endforeach( qtlib )
endif(RESINSIGHT_BUILD_WITH_QT5)
# Odb Dlls
if (RESINSIGHT_USE_ODB_API)
# Find all the dlls
@@ -597,13 +509,13 @@ endif(MSVC)
foreach (FILE_TO_COPY ${RI_DLL_FILENAMES})
add_custom_command(TARGET ResInsight POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${FILE_TO_COPY}"
"${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
${FILE_TO_COPY}
$<TARGET_FILE_DIR:ResInsight>)
if (_unityTargetName)
add_custom_command(TARGET ${_unityTargetName} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${FILE_TO_COPY}"
"${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
${FILE_TO_COPY}
$<TARGET_FILE_DIR:ResInsight>)
endif()
endforeach()
@@ -611,12 +523,12 @@ endforeach()
if (RESINSIGHT_ENABLE_GRPC)
set(RESINSIGHT_GRPC_PYTHON_EXECUTABLE "" CACHE FILEPATH "gRPC : Path to Python 3 executable, required to build the Python client library")
if (RESINSIGHT_GRPC_PYTHON_EXECUTABLE)
add_custom_command(OUTPUT ${GRPC_PYTHON_SOURCE_PATH}/rips/generated/pdm_objects.py
COMMAND ResInsight ARGS --console --generate ${GRPC_PYTHON_SOURCE_PATH}/rips/generated/pdm_objects.py
add_custom_command(OUTPUT ${GRPC_PYTHON_SOURCE_PATH}/rips/generated/resinsight_classes.py
COMMAND ResInsight ARGS --console --generate ${GRPC_PYTHON_SOURCE_PATH}/rips/generated/resinsight_classes.py
DEPENDS ResInsight
COMMENT "Generating ${GRPC_PYTHON_SOURCE_PATH}/rips/generated/pdm_objects.py"
COMMENT "Generating ${GRPC_PYTHON_SOURCE_PATH}/rips/generated/resinsight_classes.py"
)
list(APPEND GRPC_GENERATED_PYTHON_SOURCES ${GRPC_PYTHON_SOURCE_PATH}/rips/generated/pdm_objects.py)
list(APPEND GRPC_GENERATED_PYTHON_SOURCES ${GRPC_PYTHON_SOURCE_PATH}/rips/generated/resinsight_classes.py)
add_custom_target(GeneratedPythonSources ALL DEPENDS ${GRPC_GENERATED_PYTHON_SOURCES})
add_dependencies(GeneratedPythonSources ResInsight)
else()
@@ -660,16 +572,33 @@ if (RESINSIGHT_PRIVATE_INSTALL)
mark_as_advanced(FORCE RESINSIGHT_QT5_BUNDLE_LIBRARIES)
if (RESINSIGHT_QT5_BUNDLE_LIBRARIES)
message( STATUS "Bundling of Qt5 libraries is enabled" )
# Get root directory
get_property(_filepath TARGET "Qt5::Core" PROPERTY LOCATION_RELEASE)
get_filename_component(_dir ${_filepath} PATH)
foreach (qtlib ${QT_LIBRARIES})
get_target_property(FILE_NAME_FULL_PATH ${qtlib} LOCATION)
message (STATUS "${qtlib} location on disk - ${FILE_NAME_FULL_PATH}")
get_filename_component(FILE_NAME_WE ${FILE_NAME_FULL_PATH} NAME_WE)
set(FILE_NAME_FOR_INSTALL "${FILE_NAME_WE}.so.5")
message (STATUS "${qtlib} filename for install - ${FILE_NAME_FOR_INSTALL}")
install(FILES ${FILE_NAME_FULL_PATH} DESTINATION ${RESINSIGHT_INSTALL_FOLDER} RENAME ${FILE_NAME_FOR_INSTALL} )
message (STATUS "${FILE_NAME_WE} name without ext - ${FILE_NAME_WE}")
list( APPEND QT_INSTALL_FILES_WITHOUT_EXTENSION ${FILE_NAME_WE})
endforeach()
# XcbQpa is used by libXcb.so required by platform plugin xcb
list( APPEND QT_INSTALL_FILES_WITHOUT_EXTENSION libQt5XcbQpa libQt5DBus)
foreach (installfile ${QT_INSTALL_FILES_WITHOUT_EXTENSION})
file(GLOB FILE_AND_SYMLINKS ${_dir}/${installfile}.so*)
install(FILES ${FILE_AND_SYMLINKS} DESTINATION ${RESINSIGHT_INSTALL_FOLDER} )
endforeach()
# include platform files
install(FILES ${_dir}/qt5/plugins/platforms/libqxcb.so DESTINATION ${RESINSIGHT_INSTALL_FOLDER}/platforms/ )
install(FILES ${_dir}/qt5/plugins/imageformats/libqsvg.so DESTINATION ${RESINSIGHT_INSTALL_FOLDER}/imageformats/ )
install(FILES ${_dir}/qt5/plugins/iconengines/libqsvgicon.so DESTINATION ${RESINSIGHT_INSTALL_FOLDER}/iconengines/ )
endif(RESINSIGHT_QT5_BUNDLE_LIBRARIES)
endif()
@@ -680,7 +609,7 @@ if (RESINSIGHT_PRIVATE_INSTALL)
set (RESINSIGHT_FILES ${RI_DLL_FILENAMES})
if(RESINSIGHT_BUILD_WITH_QT5 AND WIN32 AND TARGET Qt5::qmake AND NOT TARGET Qt5::windeployqt)
if(WIN32 AND TARGET Qt5::qmake AND NOT TARGET Qt5::windeployqt)
get_target_property(_qt5_qmake_location Qt5::qmake IMPORTED_LOCATION)
execute_process(
@@ -722,6 +651,22 @@ if (RESINSIGHT_PRIVATE_INSTALL)
"$<TARGET_FILE_DIR:ResInsight>/$<TARGET_FILE_NAME:ResInsight>"
)
# Qt DLLs
message(STATUS "Creating post build step for copying Qt DLLs")
# copy all files in the windeployqt directory to the installation directory
add_custom_command(TARGET ResInsight POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_BINARY_DIR}/windeployqt/" $<TARGET_FILE_DIR:ResInsight>
)
if (_unityTargetName)
foreach (qtlib ${QT_LIBRARIES})
add_custom_command(TARGET ${_unityTargetName} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${qtlib}> $<TARGET_FILE_DIR:${_unityTargetName}>
)
endforeach(qtlib)
endif(_unityTargetName)
# copy deployment directory during installation
install(
DIRECTORY
@@ -734,7 +679,7 @@ if (RESINSIGHT_PRIVATE_INSTALL)
if (RESINSIGHT_ENABLE_GRPC)
set (GRPC_DLL_NAMES libprotobuf cares zlib1)
foreach (dllname ${GRPC_DLL_NAMES})
list(APPEND RESINSIGHT_FILES "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>/${dllname}.dll")
list(APPEND RESINSIGHT_FILES $<TARGET_FILE_DIR:ResInsight>/${dllname}.dll)
endforeach(dllname ${GRPC_DLL_NAMES})
endif()
@@ -777,7 +722,7 @@ if (RESINSIGHT_PRIVATE_INSTALL)
)
endif()
install(DIRECTORY ${GRPC_PYTHON_SOURCE_PATH}/ DESTINATION ${RESINSIGHT_INSTALL_FOLDER}/Python)
install(FILES ${GRPC_PYTHON_SOURCE_PATH}/rips/generated/pdm_objects.py DESTINATION ${RESINSIGHT_INSTALL_FOLDER}/Python/rips/generated)
install(FILES ${GRPC_PYTHON_SOURCE_PATH}/rips/generated/resinsight_classes.py DESTINATION ${RESINSIGHT_INSTALL_FOLDER}/Python/rips/generated)
endif()
endif()
@@ -841,7 +786,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES Windows)
endif()
# Append el5 when compiled on RHEL5 and el6 if compiled on RHEL6
string(REGEX MATCH "el[5,6]?" RESINSIGHT_RHEL_SYSTEM_NAME ${CMAKE_SYSTEM})
string(REGEX MATCH "el[6,7,8]?" RESINSIGHT_RHEL_SYSTEM_NAME ${CMAKE_SYSTEM})
set(RESINSIGHT_PACKAGE_NAME "ResInsight")
@@ -856,10 +801,6 @@ if(NOT ${OCTAVE_VERSION_STRING} EQUAL "")
set (RESINSIGHT_PACKAGE_NAME "${RESINSIGHT_PACKAGE_NAME}_oct-${OCTAVE_VERSION_STRING}")
endif()
if(RESINSIGHT_FOUND_HDF5)
set (RESINSIGHT_PACKAGE_NAME "${RESINSIGHT_PACKAGE_NAME}_souring")
endif()
if(RESINSIGHT_BUNDLE_OPENSSL AND OPENSSL_FOUND)
set (RESINSIGHT_PACKAGE_NAME "${RESINSIGHT_PACKAGE_NAME}_openssl")
endif()

View File

@@ -22,7 +22,7 @@
///
//--------------------------------------------------------------------------------------------------
RicfCommandObject::RicfCommandObject()
: PdmObjectScriptability( this, false )
: PdmObjectScriptingCapability( this, false )
{
}

View File

@@ -20,7 +20,7 @@
#include "cafCmdFeature.h"
#include "cafPdmObject.h"
#include "cafPdmObjectScriptability.h"
#include "cafPdmObjectScriptingCapability.h"
#include "cafPdmScriptResponse.h"
#define RICF_HEADER_INIT \
@@ -42,7 +42,7 @@
//
//
//==================================================================================================
class RicfCommandObject : public caf::PdmObject, public caf::PdmObjectScriptability
class RicfCommandObject : public caf::PdmObject, public caf::PdmObjectScriptingCapability
{
public:
RicfCommandObject();

View File

@@ -21,7 +21,7 @@
#include "RicfCommandObject.h"
#include "cafPdmObjectFactory.h"
#include "cafPdmObjectScriptability.h"
#include "cafPdmObjectScriptingCapability.h"
#include "cafPdmScriptIOMessages.h"
#include <QTextStream>
@@ -127,7 +127,7 @@ std::vector<RicfCommandObject*> RicfCommandFileReader::readCommands( QTextStream
else
{
readCommands.push_back( cObj );
auto rcfCap = cObj->capability<caf::PdmObjectScriptability>();
auto rcfCap = cObj->capability<caf::PdmObjectScriptingCapability>();
errorMessageContainer->currentCommand = commandName;
rcfCap->readFields( inputStream, objectFactory, errorMessageContainer );
errorMessageContainer->currentCommand = "";
@@ -144,7 +144,7 @@ void RicfCommandFileReader::writeCommands( QTextStream& outputStream, const std:
{
for ( const auto& cmdObj : commandsToWrite )
{
auto rcfCap = cmdObj->capability<caf::PdmObjectScriptability>();
auto rcfCap = cmdObj->capability<caf::PdmObjectScriptingCapability>();
if ( !rcfCap ) continue;
outputStream << cmdObj->classKeyword();

View File

@@ -18,7 +18,6 @@
#include "RicfApplicationTools.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "RiaWellNameComparer.h"
@@ -39,7 +38,7 @@ std::vector<RimWellPath*> RicfApplicationTools::wellPathsFromNames( const QStrin
QStringList* wellsNotFound )
{
std::vector<RimWellPath*> wellPaths;
auto allWellPaths = RiaApplication::instance()->project()->allWellPaths();
auto allWellPaths = RimProject::current()->allWellPaths();
if ( !wellPathNames.empty() )
{
@@ -98,7 +97,7 @@ QStringList RicfApplicationTools::toQStringList( const std::vector<QString>& v )
//--------------------------------------------------------------------------------------------------
RimEclipseCase* RicfApplicationTools::caseFromId( int caseId )
{
auto eclipseCases = RiaApplication::instance()->project()->eclipseCases();
auto eclipseCases = RimProject::current()->eclipseCases();
if ( caseId < 0 )
{
if ( !eclipseCases.empty() ) return eclipseCases.front();
@@ -118,7 +117,7 @@ RimEclipseCase* RicfApplicationTools::caseFromId( int caseId )
//--------------------------------------------------------------------------------------------------
RimEclipseView* RicfApplicationTools::viewFromCaseIdAndViewName( int caseId, const QString& viewName )
{
for ( RimEclipseCase* c : RiaApplication::instance()->project()->eclipseCases() )
for ( RimEclipseCase* c : RimProject::current()->eclipseCases() )
{
if ( c->caseId() == caseId )
{
@@ -140,7 +139,7 @@ RimEclipseView* RicfApplicationTools::viewFromCaseIdAndViewName( int caseId, con
//--------------------------------------------------------------------------------------------------
RimEclipseView* RicfApplicationTools::viewFromCaseIdAndViewId( int caseId, int viewId )
{
for ( RimEclipseCase* c : RiaApplication::instance()->project()->eclipseCases() )
for ( RimEclipseCase* c : RimProject::current()->eclipseCases() )
{
if ( c->caseId() == caseId )
{

View File

@@ -1,6 +1,5 @@
#include "RicfCloneView.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "RicfCreateView.h"
@@ -14,7 +13,7 @@
#include "Riu3DMainWindowTools.h"
#include "cafPdmFieldIOScriptability.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafSelectionManager.h"
#include <QAction>
@@ -26,7 +25,7 @@ CAF_PDM_SOURCE_INIT( RicfCloneView, "cloneView" );
//--------------------------------------------------------------------------------------------------
RicfCloneView::RicfCloneView()
{
CAF_PDM_InitScriptableFieldWithIO( &m_viewId, "viewId", -1, "View Id", "", "", "" );
CAF_PDM_InitScriptableField( &m_viewId, "viewId", -1, "View Id", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
@@ -34,7 +33,7 @@ RicfCloneView::RicfCloneView()
//--------------------------------------------------------------------------------------------------
caf::PdmScriptResponse RicfCloneView::execute()
{
RimProject* project = RiaApplication::instance()->project();
RimProject* project = RimProject::current();
std::vector<Rim3dView*> allViews;
project->descendantsIncludingThisOfType( allViews );

View File

@@ -31,14 +31,14 @@ namespace caf
template <>
void RicfCommandFileExecutor::ExportTypeEnum::setUp()
{
addItem( RicfCommandFileExecutor::COMPLETIONS, "COMPLETIONS", "Completions" );
addItem( RicfCommandFileExecutor::PROPERTIES, "PROPERTIES", "Properties" );
addItem( RicfCommandFileExecutor::SNAPSHOTS, "SNAPSHOTS", "Snapshots" );
addItem( RicfCommandFileExecutor::STATISTICS, "STATISTICS", "Statistics" );
addItem( RicfCommandFileExecutor::WELLPATHS, "WELLPATHS", "Well Path" );
addItem( RicfCommandFileExecutor::CELLS, "CELLS", "Cells" );
addItem( RicfCommandFileExecutor::LGRS, "LGRS", "Lgrs" );
setDefault( RicfCommandFileExecutor::COMPLETIONS );
addItem( RicfCommandFileExecutor::ExportType::COMPLETIONS, "COMPLETIONS", "Completions" );
addItem( RicfCommandFileExecutor::ExportType::PROPERTIES, "PROPERTIES", "Properties" );
addItem( RicfCommandFileExecutor::ExportType::SNAPSHOTS, "SNAPSHOTS", "Snapshots" );
addItem( RicfCommandFileExecutor::ExportType::STATISTICS, "STATISTICS", "Statistics" );
addItem( RicfCommandFileExecutor::ExportType::WELLPATHS, "WELLPATHS", "Well Path" );
addItem( RicfCommandFileExecutor::ExportType::CELLS, "CELLS", "Cells" );
addItem( RicfCommandFileExecutor::ExportType::LGRS, "LGRS", "Lgrs" );
setDefault( RicfCommandFileExecutor::ExportType::COMPLETIONS );
}
} // namespace caf

View File

@@ -34,7 +34,7 @@ class RicfCommandObject;
class RicfCommandFileExecutor
{
public:
enum ExportType
enum class ExportType
{
COMPLETIONS,
SNAPSHOTS,

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