mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge pull request #2324 from OPM/dev
Merge dev into master for release 2018.01
This commit is contained in:
commit
d04c224430
90
.clang-format
Normal file
90
.clang-format
Normal file
@ -0,0 +1,90 @@
|
||||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: true
|
||||
AlignConsecutiveDeclarations: true
|
||||
AlignEscapedNewlinesLeft: true
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: false
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: true
|
||||
AllowShortIfStatementsOnASingleLine: true
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterClass: true
|
||||
AfterControlStatement: true
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: true
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: true
|
||||
AfterUnion: true
|
||||
BeforeCatch: true
|
||||
BeforeElse: true
|
||||
IndentBraces: false
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 130
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
|
||||
IncludeCategories:
|
||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||
Priority: 2
|
||||
- Regex: '^(<|"(gtest|isl|json)/)'
|
||||
Priority: 3
|
||||
- Regex: '.*'
|
||||
Priority: 1
|
||||
IncludeIsMainRegex: '$'
|
||||
IndentCaseLabels: true
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: true
|
||||
JavaScriptQuotes: Leave
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: Inner
|
||||
PenaltyBreakBeforeFirstCallParameter: 19
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
PointerAlignment: Left
|
||||
ReflowComments: true
|
||||
SortIncludes: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterTemplateKeyword: false
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Cpp11
|
||||
TabWidth: 4
|
||||
UseTab: Never
|
||||
...
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -59,6 +59,9 @@ CTest*.cmake
|
||||
ipch/
|
||||
Ankh.NoLoad
|
||||
|
||||
#Visual Studio Code files
|
||||
.vscode
|
||||
|
||||
#Temp files
|
||||
*.temp
|
||||
/Resinsight_Host.includes
|
||||
|
@ -1,5 +1,5 @@
|
||||
===============================================================================
|
||||
Notice for ResInsight:
|
||||
Notice for ResInsight
|
||||
===============================================================================
|
||||
Copyright (C) Statoil ASA, Ceetron AS, Ceetron Solutions AS
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
for more details.
|
||||
|
||||
===============================================================================
|
||||
Notice for Custom Visualization Core Library:
|
||||
Notice for Custom Visualization Core Library
|
||||
===============================================================================
|
||||
Custom Visualization Core library
|
||||
Copyright (C) Ceetron AS, Ceetron Solutions AS
|
||||
@ -34,7 +34,7 @@
|
||||
for more details.
|
||||
|
||||
===============================================================================
|
||||
Notice for Ensemble based Reservoir Tool:
|
||||
Notice for Ensemble based Reservoir Tool
|
||||
===============================================================================
|
||||
Copyright (C) Statoil ASA, Norway.
|
||||
|
||||
@ -50,9 +50,8 @@
|
||||
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
for more details.
|
||||
|
||||
|
||||
===============================================================================
|
||||
Notice for GLew :
|
||||
Notice for GLew
|
||||
===============================================================================
|
||||
The OpenGL Extension Wrangler Library
|
||||
Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
|
||||
@ -84,7 +83,7 @@
|
||||
THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
===============================================================================
|
||||
Notice for the Font Droid Sans Regular:
|
||||
Notice for the Font Droid Sans Regular
|
||||
===============================================================================
|
||||
Copyright (c) Google Corporation
|
||||
|
||||
@ -314,7 +313,6 @@ exceptions:
|
||||
[program/widget] is based in part on the work of
|
||||
the Qwt project (http://qwt.sf.net).
|
||||
|
||||
|
||||
===============================================================================
|
||||
Notice for the NR libraries
|
||||
===============================================================================
|
||||
@ -365,3 +363,104 @@ CRAVA is a software package for seismic inversion and conditioning of
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Please contact gordos.kund@gmail.com with any questions on this license.
|
||||
|
||||
===============================================================================
|
||||
Notice for the C++ Mathematical Expression Toolkit Library
|
||||
===============================================================================
|
||||
|
||||
Author: Arash Partow (1999-2018)
|
||||
URL: http://www.partow.net/programming/exprtk/index.html
|
||||
|
||||
Copyright notice:
|
||||
Free use of the C++ Mathematical Expression Toolkit Library is
|
||||
permitted under the guidelines and in accordance with the most
|
||||
current version of the MIT License.
|
||||
http://www.opensource.org/licenses/MIT
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
===============================================================================
|
||||
Notice for the Boost code
|
||||
===============================================================================
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
===============================================================================
|
||||
Notice for The Clipper Library
|
||||
===============================================================================
|
||||
|
||||
The Clipper Library (including Delphi, C++ & C# source code, other
|
||||
accompanying code, examples and documentation), hereafter called
|
||||
"the Software", has been released under the following license, terms and
|
||||
conditions:
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the Software covered by this license to use, reproduce,
|
||||
display, distribute, execute, and transmit the Software, and to prepare
|
||||
derivative works of the Software, and to permit third-parties to whom the
|
||||
Software is furnished to do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
===============================================================================
|
||||
Notice for the Eigen library
|
||||
===============================================================================
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla
|
||||
Public License v. 2.0. If a copy of the MPL was not distributed
|
||||
with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,188 @@
|
||||
// ResInsight version string : 2017.05.2-dev.13
|
||||
// Report generated : Mon 18. Dec 07:19:08 2017
|
||||
//
|
||||
//
|
||||
|
||||
AsciiDataCurve
|
||||
CalcScript
|
||||
CalculatedSummaryCase
|
||||
CellEdgeResultSlot
|
||||
CellFilter
|
||||
CellPropertyFilter
|
||||
CellPropertyFilters
|
||||
CellRangeFilter
|
||||
CellRangeFilterCollection
|
||||
ChangeDataSourceFeatureUi
|
||||
CmdAddItemExecData
|
||||
CmdDeleteItemExecData
|
||||
CmdFieldChangeExecData
|
||||
CrossSection
|
||||
CrossSectionCollection
|
||||
EclipseCase
|
||||
EclipseGeometrySelectionItem
|
||||
Fault
|
||||
Faults
|
||||
FileSummaryCase
|
||||
FishbonesCollection
|
||||
FishbonesMultipleSubs
|
||||
FishbonesPipeProperties
|
||||
FlowCharacteristicsPlot
|
||||
FlowDiagSolution
|
||||
FlowPlotCollection
|
||||
FormationNames
|
||||
FormationNamesCollectionObject
|
||||
FractureContainment
|
||||
FractureDefinitionCollection
|
||||
GeoMechGeometrySelectionItem
|
||||
GeoMechPropertyFilter
|
||||
GeoMechPropertyFilters
|
||||
GeoMechResultDefinition
|
||||
GeoMechResultSlot
|
||||
GeoMechView
|
||||
GridCollection
|
||||
GridSummaryCase
|
||||
GridTimeHistoryCurve
|
||||
IntersectionBox
|
||||
Legend
|
||||
MainPlotCollection
|
||||
MdiWindowController
|
||||
MockModelSettings
|
||||
MultiSnapshotDefinition
|
||||
NoCommonAreaNNC
|
||||
ObservedDataCollection
|
||||
PdmDocument
|
||||
PdmObjectCollection
|
||||
PdmObjectGroup
|
||||
Perforation
|
||||
PerforationCollection
|
||||
PropertyFilter
|
||||
ResInsightAnalysisModels
|
||||
ResInsightGeoMechCase
|
||||
ResInsightGeoMechModels
|
||||
ResInsightOilField
|
||||
ResInsightProject
|
||||
ReservoirCellResultStorage
|
||||
ReservoirView
|
||||
ResultDefinition
|
||||
ResultSlot
|
||||
ResultStorageEntryInfo
|
||||
RftAddress
|
||||
RiaPreferences
|
||||
RiaRegressionTest
|
||||
RicCaseAndFileExportSettingsUi
|
||||
RicCellRangeUi
|
||||
RicDeleteItemExecData
|
||||
RicExportCarfinUi
|
||||
RicExportCompletionDataSettingsUi
|
||||
RicExportToLasFileObj
|
||||
RicExportToLasFileResampleUi
|
||||
RicLinkVisibleViewsFeatureUi
|
||||
RicPasteAsciiDataToSummaryPlotFeatureUi
|
||||
RicSaveEclipseInputVisibleCellsUi
|
||||
RicSelectSummaryPlotUI
|
||||
RicSelectViewUI
|
||||
RicSummaryAddressSelection
|
||||
RicSummaryCurveCalculator
|
||||
RicSummaryCurveCreator
|
||||
RicWellPathsUnitSystemSettingsUi
|
||||
RifReaderSettings
|
||||
RimBinaryExportSettings
|
||||
RimCaseCollection
|
||||
RimCommandExecuteScript
|
||||
RimCommandIssueFieldChanged
|
||||
RimCommandObject
|
||||
RimCsvUserData
|
||||
RimDialogData
|
||||
RimEllipseFractureTemplate
|
||||
RimExportInputSettings
|
||||
RimFaultResultSlot
|
||||
RimFractureExportSettings
|
||||
RimIdenticalGridCaseGroup
|
||||
RimInputProperty
|
||||
RimInputPropertyCollection
|
||||
RimInputReservoir
|
||||
RimNoCommonAreaNncCollection
|
||||
RimObservedEclipseUserData
|
||||
RimOilFieldEntry
|
||||
RimOilRegionEntry
|
||||
RimStatisticalCalculation
|
||||
RimStatisticalCollection
|
||||
RimStimPlanColors
|
||||
RimStimPlanFractureTemplate
|
||||
RimStimPlanLegendConfig
|
||||
RimSummaryCalculation
|
||||
RimSummaryCalculationCollection
|
||||
RimSummaryCalculationVariable
|
||||
RimSummaryCurveCollection
|
||||
RimSummaryCurveCollectionModifier
|
||||
RimTernaryLegendConfig
|
||||
RimTimeStepFilter
|
||||
RimViewLinkerCollection
|
||||
RimWellLogExtractionCurve
|
||||
RimWellPathEntry
|
||||
RimWellPathImport
|
||||
ScriptLocation
|
||||
SimWellFracture
|
||||
SimWellFractureCollection
|
||||
SummaryAddress
|
||||
SummaryCaseCollection
|
||||
SummaryCaseSubCollection
|
||||
SummaryCrossPlot
|
||||
SummaryCrossPlotCollection
|
||||
SummaryCurve
|
||||
SummaryCurveAutoName
|
||||
SummaryCurveFilter
|
||||
SummaryFilterSettings
|
||||
SummaryObservedDataFile
|
||||
SummaryPageDownloadEntity
|
||||
SummaryPlot
|
||||
SummaryPlotCollection
|
||||
SummaryTimeAxisProperties
|
||||
SummaryYAxisProperties
|
||||
TC2
|
||||
TestCommand1
|
||||
TofAccumulatedPhaseFractionsPlot
|
||||
TotalWellAllocationPlot
|
||||
View3dOverlayInfoConfig
|
||||
ViewController
|
||||
ViewLinker
|
||||
Well
|
||||
WellAllocationPlot
|
||||
WellAllocationPlotLegend
|
||||
WellFlowRateCurve
|
||||
WellLogFile
|
||||
WellLogFileChannel
|
||||
WellLogFileCurve
|
||||
WellLogPlot
|
||||
WellLogPlotCollection
|
||||
WellLogPlotTrack
|
||||
WellLogRftCurve
|
||||
WellPath
|
||||
WellPathCompletion
|
||||
WellPathCompletionCollection
|
||||
WellPathCompletions
|
||||
WellPathFracture
|
||||
WellPathFractureCollection
|
||||
WellPaths
|
||||
WellPltPlot
|
||||
WellPltPlotCollection
|
||||
WellRftPlot
|
||||
WellRftPlotCollection
|
||||
Wells
|
||||
closeProject
|
||||
computeCaseGroupStatistics
|
||||
exportMsw
|
||||
exportMultiCaseSnapshots
|
||||
exportProperty
|
||||
exportSimWellCompletions
|
||||
exportSnapshots
|
||||
exportWellPathCompletions
|
||||
loadCase
|
||||
openProject
|
||||
replaceCase
|
||||
replaceSourceCases
|
||||
runOctaveScript
|
||||
setExportFolder
|
||||
setMainWindowSize
|
||||
setStartDir
|
||||
setTimeStep
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,188 @@
|
||||
// ResInsight version string : 2017.05.2-dev.13
|
||||
// Report generated : Mon 18. Dec 07:05:11 2017
|
||||
//
|
||||
//
|
||||
|
||||
AsciiDataCurve
|
||||
CalcScript
|
||||
CalculatedSummaryCase
|
||||
CellEdgeResultSlot
|
||||
CellFilter
|
||||
CellPropertyFilter
|
||||
CellPropertyFilters
|
||||
CellRangeFilter
|
||||
CellRangeFilterCollection
|
||||
ChangeDataSourceFeatureUi
|
||||
CmdAddItemExecData
|
||||
CmdDeleteItemExecData
|
||||
CmdFieldChangeExecData
|
||||
CrossSection
|
||||
CrossSectionCollection
|
||||
EclipseCase
|
||||
EclipseGeometrySelectionItem
|
||||
Fault
|
||||
Faults
|
||||
FileSummaryCase
|
||||
FishbonesCollection
|
||||
FishbonesMultipleSubs
|
||||
FishbonesPipeProperties
|
||||
FlowCharacteristicsPlot
|
||||
FlowDiagSolution
|
||||
FlowPlotCollection
|
||||
FormationNames
|
||||
FormationNamesCollectionObject
|
||||
FractureContainment
|
||||
FractureDefinitionCollection
|
||||
GeoMechGeometrySelectionItem
|
||||
GeoMechPropertyFilter
|
||||
GeoMechPropertyFilters
|
||||
GeoMechResultDefinition
|
||||
GeoMechResultSlot
|
||||
GeoMechView
|
||||
GridCollection
|
||||
GridSummaryCase
|
||||
GridTimeHistoryCurve
|
||||
IntersectionBox
|
||||
Legend
|
||||
MainPlotCollection
|
||||
MdiWindowController
|
||||
MockModelSettings
|
||||
MultiSnapshotDefinition
|
||||
NoCommonAreaNNC
|
||||
ObservedDataCollection
|
||||
PdmDocument
|
||||
PdmObjectCollection
|
||||
PdmObjectGroup
|
||||
Perforation
|
||||
PerforationCollection
|
||||
PropertyFilter
|
||||
ResInsightAnalysisModels
|
||||
ResInsightGeoMechCase
|
||||
ResInsightGeoMechModels
|
||||
ResInsightOilField
|
||||
ResInsightProject
|
||||
ReservoirCellResultStorage
|
||||
ReservoirView
|
||||
ResultDefinition
|
||||
ResultSlot
|
||||
ResultStorageEntryInfo
|
||||
RftAddress
|
||||
RiaPreferences
|
||||
RiaRegressionTest
|
||||
RicCaseAndFileExportSettingsUi
|
||||
RicCellRangeUi
|
||||
RicDeleteItemExecData
|
||||
RicExportCarfinUi
|
||||
RicExportCompletionDataSettingsUi
|
||||
RicExportToLasFileObj
|
||||
RicExportToLasFileResampleUi
|
||||
RicLinkVisibleViewsFeatureUi
|
||||
RicPasteAsciiDataToSummaryPlotFeatureUi
|
||||
RicSaveEclipseInputVisibleCellsUi
|
||||
RicSelectSummaryPlotUI
|
||||
RicSelectViewUI
|
||||
RicSummaryAddressSelection
|
||||
RicSummaryCurveCalculator
|
||||
RicSummaryCurveCreator
|
||||
RicWellPathsUnitSystemSettingsUi
|
||||
RifReaderSettings
|
||||
RimBinaryExportSettings
|
||||
RimCaseCollection
|
||||
RimCommandExecuteScript
|
||||
RimCommandIssueFieldChanged
|
||||
RimCommandObject
|
||||
RimCsvUserData
|
||||
RimDialogData
|
||||
RimEllipseFractureTemplate
|
||||
RimExportInputSettings
|
||||
RimFaultResultSlot
|
||||
RimFractureExportSettings
|
||||
RimIdenticalGridCaseGroup
|
||||
RimInputProperty
|
||||
RimInputPropertyCollection
|
||||
RimInputReservoir
|
||||
RimNoCommonAreaNncCollection
|
||||
RimObservedEclipseUserData
|
||||
RimOilFieldEntry
|
||||
RimOilRegionEntry
|
||||
RimStatisticalCalculation
|
||||
RimStatisticalCollection
|
||||
RimStimPlanColors
|
||||
RimStimPlanFractureTemplate
|
||||
RimStimPlanLegendConfig
|
||||
RimSummaryCalculation
|
||||
RimSummaryCalculationCollection
|
||||
RimSummaryCalculationVariable
|
||||
RimSummaryCurveCollection
|
||||
RimSummaryCurveCollectionModifier
|
||||
RimTernaryLegendConfig
|
||||
RimTimeStepFilter
|
||||
RimViewLinkerCollection
|
||||
RimWellLogExtractionCurve
|
||||
RimWellPathEntry
|
||||
RimWellPathImport
|
||||
ScriptLocation
|
||||
SimWellFracture
|
||||
SimWellFractureCollection
|
||||
SummaryAddress
|
||||
SummaryCaseCollection
|
||||
SummaryCaseSubCollection
|
||||
SummaryCrossPlot
|
||||
SummaryCrossPlotCollection
|
||||
SummaryCurve
|
||||
SummaryCurveAutoName
|
||||
SummaryCurveFilter
|
||||
SummaryFilterSettings
|
||||
SummaryObservedDataFile
|
||||
SummaryPageDownloadEntity
|
||||
SummaryPlot
|
||||
SummaryPlotCollection
|
||||
SummaryTimeAxisProperties
|
||||
SummaryYAxisProperties
|
||||
TC2
|
||||
TestCommand1
|
||||
TofAccumulatedPhaseFractionsPlot
|
||||
TotalWellAllocationPlot
|
||||
View3dOverlayInfoConfig
|
||||
ViewController
|
||||
ViewLinker
|
||||
Well
|
||||
WellAllocationPlot
|
||||
WellAllocationPlotLegend
|
||||
WellFlowRateCurve
|
||||
WellLogFile
|
||||
WellLogFileChannel
|
||||
WellLogFileCurve
|
||||
WellLogPlot
|
||||
WellLogPlotCollection
|
||||
WellLogPlotTrack
|
||||
WellLogRftCurve
|
||||
WellPath
|
||||
WellPathCompletion
|
||||
WellPathCompletionCollection
|
||||
WellPathCompletions
|
||||
WellPathFracture
|
||||
WellPathFractureCollection
|
||||
WellPaths
|
||||
WellPltPlot
|
||||
WellPltPlotCollection
|
||||
WellRftPlot
|
||||
WellRftPlotCollection
|
||||
Wells
|
||||
closeProject
|
||||
computeCaseGroupStatistics
|
||||
exportMsw
|
||||
exportMultiCaseSnapshots
|
||||
exportProperty
|
||||
exportSimWellCompletions
|
||||
exportSnapshots
|
||||
exportWellPathCompletions
|
||||
loadCase
|
||||
openProject
|
||||
replaceCase
|
||||
replaceSourceCases
|
||||
runOctaveScript
|
||||
setExportFolder
|
||||
setMainWindowSize
|
||||
setStartDir
|
||||
setTimeStep
|
40
ApplicationCode/Application/CMakeLists_files.cmake
Normal file
40
ApplicationCode/Application/CMakeLists_files.cmake
Normal file
@ -0,0 +1,40 @@
|
||||
|
||||
# Use this workaround until we're on 2.8.3 on all platforms and can use CMAKE_CURRENT_LIST_DIR directly
|
||||
if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
|
||||
set(CEE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}/)
|
||||
endif()
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RiaApplication.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaDefines.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaPreferences.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaPorosityModel.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaSummaryCurveDefinition.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaRftPltCurveDefinition.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RiaApplication.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaDefines.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaMain.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaPreferences.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaPorosityModel.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaSummaryCurveDefinition.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaRftPltCurveDefinition.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
set (QT_MOC_HEADERS
|
||||
${QT_MOC_HEADERS}
|
||||
${CEE_CURRENT_LIST_DIR}RiaApplication.h
|
||||
)
|
||||
|
||||
|
||||
source_group( "Application" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )
|
File diff suppressed because it is too large
Load Diff
@ -58,6 +58,7 @@ class RimWellAllocationPlot;
|
||||
class RiuMainWindowBase;
|
||||
class RiuMainPlotWindow;
|
||||
class RiuRecentFileActionProvider;
|
||||
class RiaArgumentParser;
|
||||
|
||||
namespace caf
|
||||
{
|
||||
@ -82,6 +83,12 @@ public:
|
||||
NAVIGATION_POLICY_RMS
|
||||
};
|
||||
|
||||
enum ProjectLoadAction
|
||||
{
|
||||
PLA_NONE = 0,
|
||||
PLA_CALCULATE_STATISTICS = 1
|
||||
};
|
||||
|
||||
public:
|
||||
RiaApplication(int& argc, char** argv);
|
||||
~RiaApplication();
|
||||
@ -90,7 +97,7 @@ public:
|
||||
int parseArgumentsAndRunUnitTestsIfRequested();
|
||||
bool parseArguments();
|
||||
|
||||
void executeRegressionTests(const QString& regressionTestPath);
|
||||
void executeRegressionTests(const QString& regressionTestPath, QStringList* testFilter = nullptr);
|
||||
|
||||
void setActiveReservoirView(RimView*);
|
||||
RimView* activeReservoirView();
|
||||
@ -99,6 +106,8 @@ public:
|
||||
RimViewWindow* activePlotWindow() const;
|
||||
|
||||
void scheduleDisplayModelUpdateAndRedraw(RimView* resViewToUpdate);
|
||||
void scheduleRecalculateCompletionTypeAndRedrawAllViews();
|
||||
void scheduleRecalculateCompletionTypeAndRedrawEclipseCase(RimEclipseCase* eclipseCase);
|
||||
|
||||
RimProject* project();
|
||||
|
||||
@ -113,16 +122,13 @@ public:
|
||||
void setLastUsedDialogDirectory(const QString& dialogName, const QString& directory);
|
||||
|
||||
bool openFile(const QString& fileName);
|
||||
bool openEclipseCaseFromFile(const QString& fileName);
|
||||
bool openEclipseCase(const QString& caseName, const QString& caseFileName);
|
||||
bool addEclipseCases(const QStringList& fileNames);
|
||||
bool openInputEclipseCaseFromFileNames(const QStringList& fileNames);
|
||||
|
||||
bool openOdbCaseFromFile(const QString& fileName);
|
||||
|
||||
QString currentProjectPath() const;
|
||||
QString createAbsolutePathFromProjectRelativePath(QString projectRelativePath);
|
||||
bool loadProject(const QString& projectFileName);
|
||||
bool loadProject(const QString& projectFileName, ProjectLoadAction loadAction, RiaProjectModifier* projectModifier);
|
||||
bool saveProject();
|
||||
bool saveProjectAs(const QString& fileName);
|
||||
bool saveProjectPromptForFileName();
|
||||
@ -132,11 +138,11 @@ public:
|
||||
void closeProject();
|
||||
|
||||
void addWellPathsToModel(QList<QString> wellPathFilePaths);
|
||||
void addWellPathFormationsToModel(QList<QString> wellPathFilePaths);
|
||||
void addWellLogsToModel(const QList<QString>& wellLogFilePaths);
|
||||
|
||||
void saveSnapshotForAllViews(const QString& snapshotFolderName);
|
||||
void runMultiCaseSnapshots(const QString& templateProjectFileName, std::vector<QString> gridFileNames, const QString& snapshotFolderName);
|
||||
void runRegressionTest(const QString& testRootPath);
|
||||
void runRegressionTest(const QString& testRootPath, QStringList* testFilter = nullptr);
|
||||
|
||||
void processNonGuiEvents();
|
||||
|
||||
@ -158,6 +164,7 @@ public:
|
||||
bool launchProcess(const QString& program, const QStringList& arguments);
|
||||
bool launchProcessForMultipleCases(const QString& program, const QStringList& arguments, const std::vector<int>& caseIds);
|
||||
void terminateProcess();
|
||||
void waitForProcess() const;
|
||||
|
||||
RiaPreferences* preferences();
|
||||
void applyPreferences();
|
||||
@ -194,20 +201,16 @@ public:
|
||||
void addToRecentFiles(const QString& fileName);
|
||||
std::vector<QAction*> recentFileActions() const;
|
||||
|
||||
private:
|
||||
enum ProjectLoadAction
|
||||
{
|
||||
PLA_NONE = 0,
|
||||
PLA_CALCULATE_STATISTICS = 1
|
||||
};
|
||||
void setStartDir(const QString& startDir);
|
||||
|
||||
bool loadProject(const QString& projectFileName, ProjectLoadAction loadAction, RiaProjectModifier* projectModifier);
|
||||
static std::vector<QString> readFileListFromTextFile(QString listFileName);
|
||||
|
||||
void clearViewsScheduledForUpdate();
|
||||
|
||||
private:
|
||||
|
||||
void onProjectOpenedOrClosed();
|
||||
std::vector<QString> readFileListFromTextFile(QString listFileName);
|
||||
void setWindowCaptionFromAppState();
|
||||
|
||||
void clearViewsScheduledForUpdate();
|
||||
|
||||
void createMainPlotWindow();
|
||||
void deleteMainPlotWindow();
|
||||
@ -221,15 +224,19 @@ private:
|
||||
void regressionTestConfigureProject();
|
||||
static QSize regressionDefaultImageSize();
|
||||
|
||||
void setHelpText(const QString& helpText);
|
||||
|
||||
private slots:
|
||||
void slotWorkerProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void slotUpdateScheduledDisplayModels();
|
||||
void slotRecalculateCompletionType();
|
||||
|
||||
// Friend classes required to have access to slotUpdateScheduledDisplayModels
|
||||
// As snapshots are produced fast in sequence, the feature must have access to force redraw
|
||||
// of scheduled redraws
|
||||
friend class RimView;
|
||||
friend class RicExportMultipleSnapshotsFeature;
|
||||
friend class RiaArgumentParser;
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimView> m_activeReservoirView;
|
||||
@ -238,6 +245,8 @@ private:
|
||||
|
||||
std::vector<caf::PdmPointer<RimView> > m_resViewsToUpdate;
|
||||
QTimer* m_resViewUpdateTimer;
|
||||
std::vector<caf::PdmPointer<RimEclipseCase> > m_eclipseCasesToRecalculate;
|
||||
QTimer* m_recalculateCompletionTypeTimer;
|
||||
|
||||
RiaSocketServer* m_socketServer;
|
||||
|
||||
@ -264,6 +273,8 @@ private:
|
||||
QString m_helpText;
|
||||
bool m_runningRegressionTests;
|
||||
|
||||
bool m_runningWorkerProcess;
|
||||
|
||||
RiuMainPlotWindow* m_mainPlotWindow;
|
||||
|
||||
std::unique_ptr<RiuRecentFileActionProvider> m_recentFileActionProvider;
|
||||
|
370
ApplicationCode/Application/RiaDefines.cpp
Normal file
370
ApplicationCode/Application/RiaDefines.cpp
Normal file
@ -0,0 +1,370 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011- Statoil ASA
|
||||
// Copyright (C) 2013- Ceetron Solutions AS
|
||||
// Copyright (C) 2011-2012 Ceetron AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaDefines.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
|
||||
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::FLOW_DIAGNOSTICS, "FLOW_DIAGNOSTICS", "Flow Diagnostics");
|
||||
addItem(RiaDefines::INJECTION_FLOODING, "INJECTION_FLOODING", "Injection Flooding");
|
||||
setDefault(RiaDefines::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");
|
||||
|
||||
|
||||
setDefault(RiaDefines::UNIT_METER);
|
||||
}
|
||||
|
||||
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");
|
||||
|
||||
setDefault(RiaDefines::PLOT_AXIS_LEFT);
|
||||
}
|
||||
|
||||
template<>
|
||||
void caf::AppEnum< RiaDefines::CompletionType >::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");
|
||||
|
||||
setDefault(RiaDefines::WELL_PATH);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaDefines::isPerCellFaceResult(const QString& resultName)
|
||||
{
|
||||
if (resultName.compare(RiaDefines::combinedTransmissibilityResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (resultName.compare(RiaDefines::combinedMultResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (resultName.compare(RiaDefines::ternarySaturationResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (resultName.compare(RiaDefines::combinedRiTranResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (resultName.compare(RiaDefines::combinedRiMultResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (resultName.compare(RiaDefines::combinedRiAreaNormTranResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (resultName.compare(RiaDefines::combinedWaterFluxResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (resultName.compare(RiaDefines::combinedOilFluxResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (resultName.compare(RiaDefines::combinedGasFluxResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (resultName.endsWith("IJK"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::undefinedResultName()
|
||||
{
|
||||
return "None";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::undefinedGridFaultName()
|
||||
{
|
||||
return "Undefined Grid Faults";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::undefinedGridFaultWithInactiveName()
|
||||
{
|
||||
return "Undefined Grid Faults With Inactive";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::combinedTransmissibilityResultName()
|
||||
{
|
||||
return "TRANXYZ";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::combinedWaterFluxResultName()
|
||||
{
|
||||
return "FLRWATIJK";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::combinedOilFluxResultName()
|
||||
{
|
||||
return "FLROILIJK";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::combinedGasFluxResultName()
|
||||
{
|
||||
return "FLRGASIJK";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::ternarySaturationResultName()
|
||||
{
|
||||
return "TERNARY";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::combinedMultResultName()
|
||||
{
|
||||
return "MULTXYZ";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::riTranXResultName()
|
||||
{
|
||||
return "riTRANX";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::riTranYResultName()
|
||||
{
|
||||
return "riTRANY";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::riTranZResultName()
|
||||
{
|
||||
return "riTRANZ";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::combinedRiTranResultName()
|
||||
{
|
||||
return "riTRANXYZ";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::riMultXResultName()
|
||||
{
|
||||
return "riMULTX";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::riMultYResultName()
|
||||
{
|
||||
return "riMULTY";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::riMultZResultName()
|
||||
{
|
||||
return "riMULTZ";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::combinedRiMultResultName()
|
||||
{
|
||||
return "riMULTXYZ";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::riAreaNormTranXResultName()
|
||||
{
|
||||
return "riTRANXbyArea";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::riAreaNormTranYResultName()
|
||||
{
|
||||
return "riTRANYbyArea";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::riAreaNormTranZResultName()
|
||||
{
|
||||
return "riTRANZbyArea";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::combinedRiAreaNormTranResultName()
|
||||
{
|
||||
return "riTRANXYZbyArea";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::mobilePoreVolumeName()
|
||||
{
|
||||
return "MOBPORV";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::completionTypeResultName()
|
||||
{
|
||||
return "Completion Type";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::mockModelBasic()
|
||||
{
|
||||
return "Result Mock Debug Model Simple";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::mockModelBasicWithResults()
|
||||
{
|
||||
return "Result Mock Debug Model With Results";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::mockModelLargeWithResults()
|
||||
{
|
||||
return "Result Mock Debug Model Large With Results";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::mockModelCustomized()
|
||||
{
|
||||
return "Result Mock Debug Model Customized";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::mockModelBasicInputCase()
|
||||
{
|
||||
return "Input Mock Debug Model Simple";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::activeFormationNamesResultName()
|
||||
{
|
||||
return "Active Formation Names";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RiaDefines::minimumDefaultValuePlot()
|
||||
{
|
||||
return -10.0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RiaDefines::maximumDefaultValuePlot()
|
||||
{
|
||||
return 100.0;
|
||||
}
|
115
ApplicationCode/Application/RiaDefines.h
Normal file
115
ApplicationCode/Application/RiaDefines.h
Normal file
@ -0,0 +1,115 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011- Statoil ASA
|
||||
// Copyright (C) 2013- Ceetron Solutions AS
|
||||
// Copyright (C) 2011-2012 Ceetron AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
|
||||
namespace RiaDefines
|
||||
{
|
||||
enum ResultCatType
|
||||
{
|
||||
DYNAMIC_NATIVE,
|
||||
STATIC_NATIVE,
|
||||
SOURSIMRL,
|
||||
GENERATED,
|
||||
INPUT_PROPERTY,
|
||||
FORMATION_NAMES,
|
||||
FLOW_DIAGNOSTICS,
|
||||
INJECTION_FLOODING,
|
||||
REMOVED
|
||||
};
|
||||
|
||||
enum CompletionType {
|
||||
WELL_PATH,
|
||||
PERFORATION_INTERVAL,
|
||||
FISHBONES,
|
||||
FRACTURE,
|
||||
};
|
||||
|
||||
bool isPerCellFaceResult(const QString& resultName);
|
||||
|
||||
QString undefinedResultName();
|
||||
QString undefinedGridFaultName();
|
||||
QString undefinedGridFaultWithInactiveName();
|
||||
QString combinedTransmissibilityResultName();
|
||||
QString combinedWaterFluxResultName();
|
||||
QString combinedOilFluxResultName();
|
||||
QString combinedGasFluxResultName();
|
||||
|
||||
QString ternarySaturationResultName();
|
||||
QString combinedMultResultName();
|
||||
|
||||
QString riTranXResultName();
|
||||
QString riTranYResultName();
|
||||
QString riTranZResultName();
|
||||
QString combinedRiTranResultName();
|
||||
|
||||
QString riMultXResultName();
|
||||
QString riMultYResultName();
|
||||
QString riMultZResultName();
|
||||
QString combinedRiMultResultName();
|
||||
|
||||
QString riAreaNormTranXResultName();
|
||||
QString riAreaNormTranYResultName();
|
||||
QString riAreaNormTranZResultName();
|
||||
QString combinedRiAreaNormTranResultName();
|
||||
|
||||
QString mobilePoreVolumeName();
|
||||
|
||||
QString completionTypeResultName();
|
||||
|
||||
// Mock model text identifiers
|
||||
QString mockModelBasic();
|
||||
QString mockModelBasicWithResults();
|
||||
QString mockModelLargeWithResults();
|
||||
QString mockModelCustomized();
|
||||
QString mockModelBasicInputCase();
|
||||
|
||||
QString activeFormationNamesResultName();
|
||||
|
||||
//Units and conversions
|
||||
enum DepthUnitType
|
||||
{
|
||||
UNIT_METER,
|
||||
UNIT_FEET,
|
||||
UNIT_NONE
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Defines relate to plotting
|
||||
enum PlotAxis
|
||||
{
|
||||
PLOT_AXIS_LEFT,
|
||||
PLOT_AXIS_RIGHT,
|
||||
PLOT_AXIS_BOTTOM
|
||||
};
|
||||
|
||||
double minimumDefaultValuePlot();
|
||||
double maximumDefaultValuePlot();
|
||||
|
||||
enum PhaseType {
|
||||
OIL_PHASE,
|
||||
GAS_PHASE,
|
||||
WATER_PHASE
|
||||
};
|
||||
};
|
||||
|
@ -44,11 +44,11 @@ int main(int argc, char *argv[])
|
||||
window.loadWinGeoAndDockToolBarLayout();
|
||||
window.showWindow();
|
||||
|
||||
RiaLogging::setLoggerInstance(new RiuMessagePanelLogger(window.messagePanel()));
|
||||
RiaLogging::loggerInstance()->setLevel(RI_LL_DEBUG);
|
||||
|
||||
if (app.parseArguments())
|
||||
{
|
||||
RiaLogging::setLoggerInstance(new RiuMessagePanelLogger(window.messagePanel()));
|
||||
RiaLogging::loggerInstance()->setLevel(RI_LL_DEBUG);
|
||||
|
||||
int exitCode = app.exec();
|
||||
RiaLogging::deleteLoggerInstance();
|
||||
|
34
ApplicationCode/Application/RiaPorosityModel.cpp
Normal file
34
ApplicationCode/Application/RiaPorosityModel.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaPorosityModel.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
void caf::AppEnum< RiaDefines::PorosityModelType >::setUp()
|
||||
{
|
||||
addItem(RiaDefines::MATRIX_MODEL, "MATRIX_MODEL", "Matrix");
|
||||
addItem(RiaDefines::FRACTURE_MODEL, "FRACTURE_MODEL", "Fracture");
|
||||
|
||||
setDefault(RiaDefines::MATRIX_MODEL);
|
||||
}
|
||||
}
|
31
ApplicationCode/Application/RiaPorosityModel.h
Normal file
31
ApplicationCode/Application/RiaPorosityModel.h
Normal file
@ -0,0 +1,31 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
namespace RiaDefines
|
||||
{
|
||||
enum PorosityModelType
|
||||
{
|
||||
MATRIX_MODEL,
|
||||
FRACTURE_MODEL
|
||||
};
|
||||
};
|
@ -33,7 +33,7 @@ CAF_PDM_SOURCE_INIT(RiaPreferences, "RiaPreferences");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaPreferences::RiaPreferences(void)
|
||||
{
|
||||
CAF_PDM_InitField(&navigationPolicy, "navigationPolicy", caf::AppEnum<RiaApplication::RINavigationPolicy>(RiaApplication::NAVIGATION_POLICY_CEETRON), "Navigation Mode", "", "", "");
|
||||
CAF_PDM_InitField(&navigationPolicy, "navigationPolicy", caf::AppEnum<RiaApplication::RINavigationPolicy>(RiaApplication::NAVIGATION_POLICY_RMS), "Navigation Mode", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&scriptDirectories, "scriptDirectory", "Shared Script Folder(s)", "", "", "");
|
||||
scriptDirectories.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
@ -68,11 +68,12 @@ RiaPreferences::RiaPreferences(void)
|
||||
useShaders.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
CAF_PDM_InitField(&showHud, "showHud", false, "Show 3D Information", "", "", "");
|
||||
showHud.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
CAF_PDM_InitField(&appendClassNameToUiText, "appendClassNameToUiText", false, "[System] Show Class Names", "", "", "");
|
||||
CAF_PDM_InitField(&appendClassNameToUiText, "appendClassNameToUiText", false, "Show Class Names", "", "", "");
|
||||
appendClassNameToUiText.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
#ifndef _DEBUG
|
||||
appendClassNameToUiText.uiCapability()->setUiHidden(true);
|
||||
#endif
|
||||
CAF_PDM_InitField(&appendFieldKeywordToToolTipText, "appendFieldKeywordToToolTipText", false, "Show Field Keyword in ToolTip", "", "", "");
|
||||
appendFieldKeywordToToolTipText.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
CAF_PDM_InitField(&includeFractureDebugInfoFile, "includeFractureDebugInfoFile", false, "Include Fracture Debug Info for Completion Export", "", "", "");
|
||||
includeFractureDebugInfoFile.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&lastUsedProjectFileName,"lastUsedProjectFileName", "Last Used Project File", "", "", "");
|
||||
lastUsedProjectFileName.uiCapability()->setUiHidden(true);
|
||||
@ -83,18 +84,13 @@ RiaPreferences::RiaPreferences(void)
|
||||
CAF_PDM_InitField(&loadAndShowSoil, "loadAndShowSoil", true, "Load and Show SOIL", "", "", "");
|
||||
loadAndShowSoil.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&readerSettings, "readerSettings", "Reader Settings", "", "", "");
|
||||
readerSettings = new RifReaderSettings;
|
||||
|
||||
CAF_PDM_InitField(&autoCreatePlotsOnImport, "AutoCreatePlotsOnImport", true, "Automatically Create Summary Plots On Import", "", "", "");
|
||||
autoCreatePlotsOnImport.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
|
||||
CAF_PDM_InitField(&defaultCurveFilter, "DefaultCurveFilter", QString("F*PT"), "Default Vector Selection Filter", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_readerSettings, "readerSettings", "Reader Settings", "", "", "");
|
||||
m_readerSettings = new RifReaderSettings;
|
||||
|
||||
m_tabNames << "General";
|
||||
m_tabNames << "Eclipse";
|
||||
m_tabNames << "Octave";
|
||||
m_tabNames << "Summary";
|
||||
m_tabNames << "System";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -102,7 +98,7 @@ RiaPreferences::RiaPreferences(void)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaPreferences::~RiaPreferences(void)
|
||||
{
|
||||
delete readerSettings;
|
||||
delete m_readerSettings;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -110,7 +106,7 @@ RiaPreferences::~RiaPreferences(void)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaPreferences::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute)
|
||||
{
|
||||
readerSettings->defineEditorAttribute(field, uiConfigName, attribute);
|
||||
m_readerSettings->defineEditorAttribute(field, uiConfigName, attribute);
|
||||
|
||||
if (field == &scriptDirectories)
|
||||
{
|
||||
@ -127,8 +123,9 @@ void RiaPreferences::defineEditorAttribute(const caf::PdmFieldHandle* field, QSt
|
||||
field == &useShaders ||
|
||||
field == &showHud ||
|
||||
field == &appendClassNameToUiText ||
|
||||
field == &showLasCurveWithoutTvdWarning ||
|
||||
field == &autoCreatePlotsOnImport)
|
||||
field == &appendFieldKeywordToToolTipText ||
|
||||
field == &includeFractureDebugInfoFile ||
|
||||
field == &showLasCurveWithoutTvdWarning)
|
||||
{
|
||||
caf::PdmUiCheckBoxEditorAttribute* myAttr = dynamic_cast<caf::PdmUiCheckBoxEditorAttribute*>(attribute);
|
||||
if (myAttr)
|
||||
@ -164,7 +161,6 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
||||
otherGroup->add(&ssihubAddress);
|
||||
otherGroup->add(&showLasCurveWithoutTvdWarning);
|
||||
|
||||
uiOrdering.add(&appendClassNameToUiText);
|
||||
}
|
||||
else if (uiConfigName == m_tabNames[1])
|
||||
{
|
||||
@ -172,7 +168,7 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
||||
newCaseBehaviourGroup->add(&autocomputeDepthRelatedProperties);
|
||||
newCaseBehaviourGroup->add(&loadAndShowSoil);
|
||||
|
||||
readerSettings->defineUiOrdering(uiConfigName, *newCaseBehaviourGroup);
|
||||
m_readerSettings->defineUiOrdering(uiConfigName, *newCaseBehaviourGroup);
|
||||
}
|
||||
else if (uiConfigName == m_tabNames[2])
|
||||
{
|
||||
@ -186,8 +182,9 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
||||
}
|
||||
else if (uiConfigName == m_tabNames[3])
|
||||
{
|
||||
uiOrdering.add(&autoCreatePlotsOnImport);
|
||||
uiOrdering.add(&defaultCurveFilter);
|
||||
uiOrdering.add(&appendClassNameToUiText);
|
||||
uiOrdering.add(&appendFieldKeywordToToolTipText);
|
||||
uiOrdering.add(&includeFractureDebugInfoFile);
|
||||
}
|
||||
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
@ -227,3 +224,11 @@ QStringList RiaPreferences::tabNames()
|
||||
return m_tabNames;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RifReaderSettings* RiaPreferences::readerSettings() const
|
||||
{
|
||||
return m_readerSettings;
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,8 @@ public:
|
||||
|
||||
QStringList tabNames();
|
||||
|
||||
const RifReaderSettings* readerSettings() const;
|
||||
|
||||
public: // Pdm Fields
|
||||
caf::PdmField<caf::AppEnum< RiaApplication::RINavigationPolicy > > navigationPolicy;
|
||||
|
||||
@ -65,25 +67,21 @@ public: // Pdm Fields
|
||||
caf::PdmField<bool> useShaders;
|
||||
caf::PdmField<bool> showHud;
|
||||
caf::PdmField<bool> appendClassNameToUiText;
|
||||
caf::PdmField<bool> appendFieldKeywordToToolTipText;
|
||||
caf::PdmField<bool> includeFractureDebugInfoFile;
|
||||
|
||||
caf::PdmField<QString> lastUsedProjectFileName;
|
||||
|
||||
caf::PdmField<bool> autocomputeDepthRelatedProperties;
|
||||
caf::PdmField<bool> loadAndShowSoil;
|
||||
|
||||
caf::PdmChildField<RifReaderSettings*> readerSettings;
|
||||
|
||||
// Summary
|
||||
|
||||
caf::PdmField<bool> autoCreatePlotsOnImport;
|
||||
caf::PdmField<QString> defaultCurveFilter;
|
||||
|
||||
|
||||
protected:
|
||||
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly);
|
||||
|
||||
private:
|
||||
caf::PdmChildField<RifReaderSettings*> m_readerSettings;
|
||||
|
||||
QStringList m_tabNames;
|
||||
};
|
||||
|
52
ApplicationCode/Application/RiaRftPltCurveDefinition.cpp
Normal file
52
ApplicationCode/Application/RiaRftPltCurveDefinition.cpp
Normal file
@ -0,0 +1,52 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaRftPltCurveDefinition.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaRftPltCurveDefinition::RiaRftPltCurveDefinition(RifDataSourceForRftPlt address, const QDateTime timeStep)
|
||||
{
|
||||
m_curveDefinition = std::make_pair(address, timeStep);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifDataSourceForRftPlt RiaRftPltCurveDefinition::address() const
|
||||
{
|
||||
return m_curveDefinition.first;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QDateTime RiaRftPltCurveDefinition::timeStep() const
|
||||
{
|
||||
return m_curveDefinition.second;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaRftPltCurveDefinition::operator<(const RiaRftPltCurveDefinition& other) const
|
||||
{
|
||||
return m_curveDefinition < other.m_curveDefinition;
|
||||
}
|
45
ApplicationCode/Application/RiaRftPltCurveDefinition.h
Normal file
45
ApplicationCode/Application/RiaRftPltCurveDefinition.h
Normal file
@ -0,0 +1,45 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RifDataSourceForRftPlt.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
class RimSummaryCase;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RiaRftPltCurveDefinition
|
||||
{
|
||||
public:
|
||||
explicit RiaRftPltCurveDefinition(RifDataSourceForRftPlt address, const QDateTime timeStep);
|
||||
|
||||
RifDataSourceForRftPlt address() const;
|
||||
QDateTime timeStep() const;
|
||||
|
||||
bool operator < (const RiaRftPltCurveDefinition& other) const;
|
||||
|
||||
private:
|
||||
std::pair<RifDataSourceForRftPlt, QDateTime> m_curveDefinition;
|
||||
};
|
118
ApplicationCode/Application/RiaSummaryCurveDefinition.cpp
Normal file
118
ApplicationCode/Application/RiaSummaryCurveDefinition.cpp
Normal file
@ -0,0 +1,118 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaSummaryCurveDefinition.h"
|
||||
|
||||
#include "RifSummaryReaderInterface.h"
|
||||
#include "RimSummaryCase.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaSummaryCurveDefinition::RiaSummaryCurveDefinition(RimSummaryCase* summaryCase, const RifEclipseSummaryAddress& summaryAddress)
|
||||
{
|
||||
m_curveDefinition = std::make_pair(summaryCase, summaryAddress);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryCase* RiaSummaryCurveDefinition::summaryCase() const
|
||||
{
|
||||
return m_curveDefinition.first;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RifEclipseSummaryAddress& RiaSummaryCurveDefinition::summaryAddress() const
|
||||
{
|
||||
return m_curveDefinition.second;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSummaryCurveDefinition::resultValues(const RiaSummaryCurveDefinition& curveDefinition, std::vector<double>* values)
|
||||
{
|
||||
CVF_ASSERT(values);
|
||||
|
||||
if (!curveDefinition.summaryAddress().isValid()) return;
|
||||
if (!curveDefinition.summaryCase()) return;
|
||||
|
||||
RifSummaryReaderInterface* reader = curveDefinition.summaryCase()->summaryReader();
|
||||
if (!reader) return;
|
||||
|
||||
reader->values(curveDefinition.summaryAddress(), values);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<time_t>& RiaSummaryCurveDefinition::timeSteps(const RiaSummaryCurveDefinition& curveDefinition)
|
||||
{
|
||||
static std::vector<time_t> dummy;
|
||||
|
||||
if (!curveDefinition.summaryAddress().isValid()) return dummy;
|
||||
if (!curveDefinition.summaryCase()) return dummy;
|
||||
|
||||
RifSummaryReaderInterface* reader = curveDefinition.summaryCase()->summaryReader();
|
||||
if (!reader) return dummy;
|
||||
|
||||
return reader->timeSteps(curveDefinition.summaryAddress());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaSummaryCurveDefinition::curveDefinitionText() const
|
||||
{
|
||||
return RiaSummaryCurveDefinition::curveDefinitionText(summaryCase(), summaryAddress());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaSummaryCurveDefinition::curveDefinitionText(RimSummaryCase* summaryCase, const RifEclipseSummaryAddress& summaryAddress)
|
||||
{
|
||||
QString txt;
|
||||
|
||||
if (summaryCase)
|
||||
{
|
||||
txt += summaryCase->caseName();
|
||||
txt += ", ";
|
||||
}
|
||||
|
||||
txt += QString::fromStdString(summaryAddress.uiText());
|
||||
|
||||
return txt;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaSummaryCurveDefinition::operator<(const RiaSummaryCurveDefinition& other) const
|
||||
{
|
||||
if (m_curveDefinition.first == other.summaryCase())
|
||||
{
|
||||
return (m_curveDefinition.second < other.summaryAddress());
|
||||
}
|
||||
|
||||
return (m_curveDefinition.first < other.summaryCase());
|
||||
}
|
||||
|
55
ApplicationCode/Application/RiaSummaryCurveDefinition.h
Normal file
55
ApplicationCode/Application/RiaSummaryCurveDefinition.h
Normal file
@ -0,0 +1,55 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
class RimSummaryCase;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RiaSummaryCurveDefinition
|
||||
{
|
||||
public:
|
||||
explicit RiaSummaryCurveDefinition(RimSummaryCase* summaryCase, const RifEclipseSummaryAddress& summaryAddress);
|
||||
|
||||
RimSummaryCase* summaryCase() const;
|
||||
const RifEclipseSummaryAddress& summaryAddress() const;
|
||||
|
||||
bool operator < (const RiaSummaryCurveDefinition& other) const;
|
||||
|
||||
// TODO: Consider moving to a separate tools class
|
||||
static void resultValues(const RiaSummaryCurveDefinition& curveDefinition, std::vector<double>* values);
|
||||
static const std::vector<time_t>& timeSteps(const RiaSummaryCurveDefinition& curveDefinition);
|
||||
|
||||
QString curveDefinitionText() const;
|
||||
|
||||
static QString curveDefinitionText(RimSummaryCase* summaryCase, const RifEclipseSummaryAddress& summaryAddress);
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
std::pair<RimSummaryCase*, RifEclipseSummaryAddress> m_curveDefinition;
|
||||
};
|
63
ApplicationCode/Application/Tools/CMakeLists_files.cmake
Normal file
63
ApplicationCode/Application/Tools/CMakeLists_files.cmake
Normal file
@ -0,0 +1,63 @@
|
||||
|
||||
# Use this workaround until we're on 2.8.3 on all platforms and can use CMAKE_CURRENT_LIST_DIR directly
|
||||
if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
|
||||
set(CEE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}/)
|
||||
endif()
|
||||
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RiaArgumentParser.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaDateStringParser.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaColorTables.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaColorTools.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaEclipseUnitTools.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaImageCompareReporter.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaImageFileCompare.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaLogging.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaProjectModifier.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaRegressionTest.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaImportEclipseCaseTools.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaQDateTimeTools.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaSummaryTools.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaWellNameComparer.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaStdStringTools.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaSummaryCurveAnalyzer.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaSimWellBranchTools.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaProjectFileVersionTools.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RiaArgumentParser.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaDateStringParser.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaColorTables.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaColorTools.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaEclipseUnitTools.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaImageCompareReporter.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaImageFileCompare.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaLogging.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaProjectModifier.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaRegressionTest.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaImportEclipseCaseTools.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaQDateTimeTools.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaSummaryTools.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaWellNameComparer.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaStdStringTools.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaSummaryCurveAnalyzer.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaSimWellBranchTools.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaProjectFileVersionTools.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
set (QT_MOC_HEADERS
|
||||
${QT_MOC_HEADERS}
|
||||
)
|
||||
|
||||
|
||||
source_group( "Application\\Tools" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )
|
452
ApplicationCode/Application/Tools/RiaArgumentParser.cpp
Normal file
452
ApplicationCode/Application/Tools/RiaArgumentParser.cpp
Normal file
@ -0,0 +1,452 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaArgumentParser.h"
|
||||
|
||||
#include "RiaProjectModifier.h"
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaImportEclipseCaseTools.h"
|
||||
#include "RiaBaseDefs.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuMainPlotWindow.h"
|
||||
|
||||
#include "RicfMessages.h"
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
|
||||
#include "ExportCommands/RicSnapshotViewToFileFeature.h"
|
||||
#include "ExportCommands/RicSnapshotAllPlotsToFileFeature.h"
|
||||
#include "ExportCommands/RicSnapshotAllViewsToFileFeature.h"
|
||||
|
||||
#include "cvfProgramOptions.h"
|
||||
#include "cvfqtUtils.h"
|
||||
|
||||
#include "cafUtils.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QCoreApplication>
|
||||
#include <QFile>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaArgumentParser::parseArguments()
|
||||
{
|
||||
cvf::ProgramOptions progOpt;
|
||||
progOpt.registerOption("last", "", "Open last used project.");
|
||||
progOpt.registerOption("project", "<filename>", "Open project file <filename>.", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt.registerOption("case", "<casename>", "Import Eclipse case <casename> (do not include the .GRID/.EGRID extension.)", cvf::ProgramOptions::MULTI_VALUE);
|
||||
progOpt.registerOption("startdir", "<folder>", "Set startup directory.", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt.registerOption("savesnapshots", "all|views|plots", "Save snapshot of all views or plots to project file location sub folder 'snapshots'. Option 'all' will include both views and plots. Application closes after snapshots have been written.", cvf::ProgramOptions::OPTIONAL_MULTI_VALUE);
|
||||
progOpt.registerOption("size", "<width> <height>", "Set size of the main application window.", cvf::ProgramOptions::MULTI_VALUE);
|
||||
progOpt.registerOption("replaceCase", "[<caseId>] <newGridFile>", "Replace grid in <caseId> or first case with <newgridFile>. Repeat parameter for multiple replace operations.", cvf::ProgramOptions::MULTI_VALUE, cvf::ProgramOptions::COMBINE_REPEATED);
|
||||
progOpt.registerOption("replaceSourceCases", "[<caseGroupId>] <gridListFile>", "Replace source cases in <caseGroupId> or first grid case group with the grid files listed in the <gridListFile> file. Repeat parameter for multiple replace operations.", cvf::ProgramOptions::MULTI_VALUE, cvf::ProgramOptions::COMBINE_REPEATED);
|
||||
progOpt.registerOption("replacePropertiesFolder", "[<caseId>] <newPropertiesFolder>", "Replace the folder containing property files for an eclipse input case.", cvf::ProgramOptions::MULTI_VALUE);
|
||||
progOpt.registerOption("multiCaseSnapshots", "<gridListFile>", "For each grid file listed in the <gridListFile> file, replace the first case in the project and save snapshot of all views.", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt.registerOption("commandFile", "<commandfile>", "Execute the command file.", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt.registerOption("commandFileProject", "<filename>", "Project to use if performing case looping for command file. Used in conjunction with 'commandFileReplaceCases'.", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt.registerOption("commandFileReplaceCases", "[<caseId>] <caseListFile>", "Supply list of cases to replace in project, performing command file for each case.", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt.registerOption("help", "", "Displays help text.");
|
||||
progOpt.registerOption("?", "", "Displays help text.");
|
||||
progOpt.registerOption("regressiontest", "<folder>", "System command", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt.registerOption("updateregressiontestbase", "<folder>", "System command", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt.registerOption("unittest", "", "System command");
|
||||
|
||||
progOpt.setOptionPrefix(cvf::ProgramOptions::DOUBLE_DASH);
|
||||
|
||||
QString helpText = QString("\n%1 v. %2\n").arg(RI_APPLICATION_NAME).arg(RiaApplication::getVersionStringApp(false));
|
||||
helpText += "Copyright Statoil ASA, Ceetron Solution AS, Ceetron AS\n\n";
|
||||
|
||||
const cvf::String usageText = progOpt.usageText(110, 30);
|
||||
helpText += cvfqt::Utils::toQString(usageText);
|
||||
|
||||
RiaApplication::instance()->setHelpText(helpText);
|
||||
|
||||
QStringList arguments = QCoreApplication::arguments();
|
||||
|
||||
bool parseOk = progOpt.parse(cvfqt::Utils::toStringVector(arguments));
|
||||
|
||||
// If positional parameter functionality is to be supported, the test for existence of positionalParameters must be removed
|
||||
// This is based on a pull request by @andlaus https://github.com/OPM/ResInsight/pull/162
|
||||
if (!parseOk ||
|
||||
progOpt.hasOption("help") ||
|
||||
progOpt.hasOption("?") ||
|
||||
progOpt.positionalParameters().size() > 0)
|
||||
{
|
||||
#if defined(_MSC_VER) && defined(_WIN32)
|
||||
RiaApplication::instance()->showFormattedTextInMessageBox(helpText);
|
||||
#else
|
||||
fprintf(stdout, "%s\n", helpText.toAscii().data());
|
||||
fflush(stdout);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Handling of the actual command line options
|
||||
// --------------------------------------------------------
|
||||
if (cvf::Option o = progOpt.option("regressiontest"))
|
||||
{
|
||||
CVF_ASSERT(o.valueCount() == 1);
|
||||
QString regressionTestPath = cvfqt::Utils::toQString(o.value(0));
|
||||
RiaApplication::instance()->executeRegressionTests(regressionTestPath);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("updateregressiontestbase"))
|
||||
{
|
||||
CVF_ASSERT(o.valueCount() == 1);
|
||||
QString regressionTestPath = cvfqt::Utils::toQString(o.value(0));
|
||||
RiaApplication::instance()->updateRegressionTest(regressionTestPath);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("startdir"))
|
||||
{
|
||||
CVF_ASSERT(o.valueCount() == 1);
|
||||
RiaApplication::instance()->setStartDir(cvfqt::Utils::toQString(o.value(0)));
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("size"))
|
||||
{
|
||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||
int width = o.safeValue(0).toInt(-1);
|
||||
int height = o.safeValue(1).toInt(-1);
|
||||
if (mainWnd && width > 0 && height > 0)
|
||||
{
|
||||
mainWnd->resize(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QString projectFileName;
|
||||
|
||||
if (progOpt.hasOption("last"))
|
||||
{
|
||||
projectFileName = RiaApplication::instance()->preferences()->lastUsedProjectFileName;
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("project"))
|
||||
{
|
||||
CVF_ASSERT(o.valueCount() == 1);
|
||||
projectFileName = cvfqt::Utils::toQString(o.value(0));
|
||||
}
|
||||
|
||||
|
||||
if (!projectFileName.isEmpty())
|
||||
{
|
||||
if (cvf::Option o = progOpt.option("multiCaseSnapshots"))
|
||||
{
|
||||
QString gridListFile = cvfqt::Utils::toQString(o.safeValue(0));
|
||||
std::vector<QString> gridFiles = RiaApplication::readFileListFromTextFile(gridListFile);
|
||||
RiaApplication::instance()->runMultiCaseSnapshots(projectFileName, gridFiles, "multiCaseSnapshots");
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!projectFileName.isEmpty())
|
||||
{
|
||||
cvf::ref<RiaProjectModifier> projectModifier;
|
||||
RiaApplication::ProjectLoadAction projectLoadAction = RiaApplication::PLA_NONE;
|
||||
|
||||
if (cvf::Option o = progOpt.option("replaceCase"))
|
||||
{
|
||||
if (projectModifier.isNull()) projectModifier = new RiaProjectModifier;
|
||||
|
||||
if (o.valueCount() == 1)
|
||||
{
|
||||
// One argument is available, use replace case for first occurrence in the project
|
||||
|
||||
QString gridFileName = cvfqt::Utils::toQString(o.safeValue(0));
|
||||
projectModifier->setReplaceCaseFirstOccurrence(gridFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t optionIdx = 0;
|
||||
while (optionIdx < o.valueCount())
|
||||
{
|
||||
const int caseId = o.safeValue(optionIdx++).toInt(-1);
|
||||
QString gridFileName = cvfqt::Utils::toQString(o.safeValue(optionIdx++));
|
||||
|
||||
if (caseId != -1 && !gridFileName.isEmpty())
|
||||
{
|
||||
projectModifier->setReplaceCase(caseId, gridFileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("replaceSourceCases"))
|
||||
{
|
||||
if (projectModifier.isNull()) projectModifier = new RiaProjectModifier;
|
||||
|
||||
if (o.valueCount() == 1)
|
||||
{
|
||||
// One argument is available, use replace case for first occurrence in the project
|
||||
|
||||
std::vector<QString> gridFileNames = RiaApplication::readFileListFromTextFile(cvfqt::Utils::toQString(o.safeValue(0)));
|
||||
projectModifier->setReplaceSourceCasesFirstOccurrence(gridFileNames);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t optionIdx = 0;
|
||||
while (optionIdx < o.valueCount())
|
||||
{
|
||||
const int groupId = o.safeValue(optionIdx++).toInt(-1);
|
||||
std::vector<QString> gridFileNames = RiaApplication::readFileListFromTextFile(cvfqt::Utils::toQString(o.safeValue(optionIdx++)));
|
||||
|
||||
if (groupId != -1 && gridFileNames.size() > 0)
|
||||
{
|
||||
projectModifier->setReplaceSourceCasesById(groupId, gridFileNames);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
projectLoadAction = RiaApplication::PLA_CALCULATE_STATISTICS;
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("replacePropertiesFolder"))
|
||||
{
|
||||
if (projectModifier.isNull()) projectModifier = new RiaProjectModifier;
|
||||
|
||||
if (o.valueCount() == 1)
|
||||
{
|
||||
QString propertiesFolder = cvfqt::Utils::toQString(o.safeValue(0));
|
||||
projectModifier->setReplacePropertiesFolderFirstOccurrence(propertiesFolder);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t optionIdx = 0;
|
||||
while (optionIdx < o.valueCount())
|
||||
{
|
||||
const int caseId = o.safeValue(optionIdx++).toInt(-1);
|
||||
QString propertiesFolder = cvfqt::Utils::toQString(o.safeValue(optionIdx++));
|
||||
|
||||
if (caseId != -1 && !propertiesFolder.isEmpty())
|
||||
{
|
||||
projectModifier->setReplacePropertiesFolder(caseId, propertiesFolder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RiaApplication::instance()->loadProject(projectFileName, projectLoadAction, projectModifier.p());
|
||||
}
|
||||
|
||||
|
||||
if (cvf::Option o = progOpt.option("case"))
|
||||
{
|
||||
QStringList caseNames = cvfqt::Utils::toQStringList(o.values());
|
||||
foreach (QString caseName, caseNames)
|
||||
{
|
||||
QString fileExtension = caf::Utils::fileExtension(caseName);
|
||||
if (caf::Utils::fileExists(caseName) &&
|
||||
(fileExtension == "EGRID" || fileExtension == "GRID"))
|
||||
{
|
||||
RiaImportEclipseCaseTools::openEclipseCaseFromFile(caseName);
|
||||
}
|
||||
else
|
||||
{
|
||||
QString caseFileNameWithExt = caseName + ".EGRID";
|
||||
if (caf::Utils::fileExists(caseFileNameWithExt))
|
||||
{
|
||||
RiaImportEclipseCaseTools::openEclipseCaseFromFile(caseFileNameWithExt);
|
||||
}
|
||||
else
|
||||
{
|
||||
caseFileNameWithExt = caseName + ".GRID";
|
||||
if (caf::Utils::fileExists(caseFileNameWithExt))
|
||||
{
|
||||
RiaImportEclipseCaseTools::openEclipseCaseFromFile(caseFileNameWithExt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (cvf::Option o = progOpt.option("savesnapshots"))
|
||||
{
|
||||
bool snapshotViews = false;
|
||||
bool snapshotPlots = false;
|
||||
|
||||
QStringList snapshotItemTexts = cvfqt::Utils::toQStringList(o.values());
|
||||
if (snapshotItemTexts.size() == 0)
|
||||
{
|
||||
// No options will keep backwards compatibility before we introduced snapshot of plots
|
||||
snapshotViews = true;
|
||||
}
|
||||
|
||||
for (QString s : snapshotItemTexts)
|
||||
{
|
||||
if (s.toLower() == "all")
|
||||
{
|
||||
snapshotViews = true;
|
||||
snapshotPlots = true;
|
||||
}
|
||||
else if (s.toLower() == "views")
|
||||
{
|
||||
snapshotViews = true;
|
||||
}
|
||||
else if (s.toLower() == "plots")
|
||||
{
|
||||
snapshotPlots = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (RiaApplication::instance()->project() != nullptr && !RiaApplication::instance()->project()->fileName().isEmpty())
|
||||
{
|
||||
if (snapshotViews)
|
||||
{
|
||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||
CVF_ASSERT(mainWnd);
|
||||
mainWnd->hideAllDockWindows();
|
||||
|
||||
// 2016-11-09 : Location of snapshot folder was previously located in 'snapshot' folder
|
||||
// relative to current working folder. Now harmonized to behave as RiuMainWindow::slotSnapshotAllViewsToFile()
|
||||
QString absolutePathToSnapshotDir = RiaApplication::instance()->createAbsolutePathFromProjectRelativePath("snapshots");
|
||||
RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(absolutePathToSnapshotDir);
|
||||
|
||||
mainWnd->loadWinGeoAndDockToolBarLayout();
|
||||
}
|
||||
|
||||
if (snapshotPlots)
|
||||
{
|
||||
if (RiaApplication::instance()->mainPlotWindow())
|
||||
{
|
||||
RiaApplication::instance()->mainPlotWindow()->hideAllDockWindows();
|
||||
|
||||
// Will be saved relative to current directory
|
||||
RicSnapshotAllPlotsToFileFeature::saveAllPlots();
|
||||
|
||||
RiaApplication::instance()->mainPlotWindow()->loadWinGeoAndDockToolBarLayout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Returning false will exit the application
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("commandFile"))
|
||||
{
|
||||
QString commandFile = cvfqt::Utils::toQString(o.safeValue(0));
|
||||
|
||||
cvf::Option projectOption = progOpt.option("commandFileProject");
|
||||
cvf::Option caseOption = progOpt.option("commandFileReplaceCases");
|
||||
if (projectOption && caseOption)
|
||||
{
|
||||
projectFileName = cvfqt::Utils::toQString(projectOption.value(0));
|
||||
|
||||
std::vector<int> caseIds;
|
||||
std::vector<QString> caseListFiles;
|
||||
|
||||
if (caseOption.valueCount() == 1)
|
||||
{
|
||||
caseListFiles.push_back(cvfqt::Utils::toQString(caseOption.safeValue(0)));
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t optionIdx = 0;
|
||||
while (optionIdx < caseOption.valueCount())
|
||||
{
|
||||
const int caseId = caseOption.safeValue(optionIdx++).toInt(-1);
|
||||
QString caseListFile = cvfqt::Utils::toQString(caseOption.safeValue(optionIdx++));
|
||||
|
||||
if (caseId != -1 && !caseListFile.isEmpty())
|
||||
{
|
||||
caseIds.push_back(caseId);
|
||||
caseListFiles.push_back(caseListFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (caseIds.empty() && !caseListFiles.empty())
|
||||
{
|
||||
QString caseListFile = caseListFiles[0];
|
||||
std::vector<QString> caseFiles = RiaApplication::readFileListFromTextFile(caseListFile);
|
||||
for (const QString& caseFile : caseFiles)
|
||||
{
|
||||
RiaProjectModifier projectModifier;
|
||||
projectModifier.setReplaceCaseFirstOccurrence(caseFile);
|
||||
RiaApplication::instance()->loadProject(projectFileName, RiaApplication::PLA_NONE, &projectModifier);
|
||||
executeCommandFile(commandFile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CVF_ASSERT(caseIds.size() == caseListFiles.size());
|
||||
|
||||
std::vector< std::vector<QString> > allCaseFiles;
|
||||
size_t maxFiles = 0;
|
||||
|
||||
for (size_t i = 0; i < caseIds.size(); ++i)
|
||||
{
|
||||
std::vector<QString> caseFiles = RiaApplication::readFileListFromTextFile(caseListFiles[i]);
|
||||
allCaseFiles.push_back(caseFiles);
|
||||
maxFiles = std::max(caseFiles.size(), maxFiles);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < caseIds.size(); ++i)
|
||||
{
|
||||
RiaProjectModifier projectModifier;
|
||||
for (size_t j = 0; j < maxFiles; ++j)
|
||||
{
|
||||
if (allCaseFiles[i].size() > j)
|
||||
{
|
||||
projectModifier.setReplaceCase(caseIds[i], allCaseFiles[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
RiaApplication::instance()->loadProject(projectFileName, RiaApplication::PLA_NONE, &projectModifier);
|
||||
executeCommandFile(commandFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
executeCommandFile(commandFile);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaArgumentParser::executeCommandFile(const QString& commandFile)
|
||||
{
|
||||
QFile file(commandFile);
|
||||
RicfMessages messages;
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
{
|
||||
// TODO : Error logging?
|
||||
return;
|
||||
}
|
||||
|
||||
QTextStream in(&file);
|
||||
RicfCommandFileExecutor::instance()->executeCommands(in);
|
||||
}
|
36
ApplicationCode/Application/Tools/RiaArgumentParser.h
Normal file
36
ApplicationCode/Application/Tools/RiaArgumentParser.h
Normal file
@ -0,0 +1,36 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RiaArgumentParser
|
||||
{
|
||||
public:
|
||||
static bool parseArguments();
|
||||
|
||||
private:
|
||||
static void executeCommandFile(const QString& commandFile);
|
||||
};
|
||||
|
@ -212,6 +212,28 @@ const caf::ColorTable& RiaColorTables::angularPaletteColors()
|
||||
return colorTable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const caf::ColorTable& RiaColorTables::stimPlanPaletteColors()
|
||||
{
|
||||
static std::vector<cvf::Color3ub> colors{
|
||||
cvf::Color3ub(220, 220, 220), //Grey
|
||||
cvf::Color3ub(0, 0, 255), //Blue
|
||||
cvf::Color3ub(0, 128, 255), //Lighter blue
|
||||
cvf::Color3ub(80, 240, 60), //Darker green
|
||||
cvf::Color3ub(0, 255, 0), //Green
|
||||
cvf::Color3ub(255, 255, 0), //Yellow
|
||||
cvf::Color3ub(255, 192, 0), //Light orange
|
||||
cvf::Color3ub(255, 128, 0), //Orange
|
||||
cvf::Color3ub(255, 64, 0), //Red-orange
|
||||
cvf::Color3ub(255, 0, 255) //Magenta
|
||||
};
|
||||
|
||||
static caf::ColorTable colorTable = caf::ColorTable(colors);
|
||||
return colorTable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
@ -38,6 +38,7 @@ public:
|
||||
static const caf::ColorTable& redWhiteBluePaletteColors();
|
||||
static const caf::ColorTable& categoryPaletteColors();
|
||||
static const caf::ColorTable& angularPaletteColors();
|
||||
static const caf::ColorTable& stimPlanPaletteColors();
|
||||
static const caf::ColorTable& faultsPaletteColors();
|
||||
static const caf::ColorTable& wellsPaletteColors();
|
||||
static const caf::ColorTable& summaryCurveDefaultPaletteColors();
|
61
ApplicationCode/Application/Tools/RiaColorTools.cpp
Normal file
61
ApplicationCode/Application/Tools/RiaColorTools.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaColorTools.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaColorTools::isBrightnessAboveThreshold(cvf::Color3f backgroundColor)
|
||||
{
|
||||
if (backgroundColor.r() + backgroundColor.g() + backgroundColor.b() > 1.5f)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3f RiaColorTools::darkContrastColor()
|
||||
{
|
||||
return cvf::Color3f::fromByteColor(10, 10, 10);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3f RiaColorTools::brightContrastColor()
|
||||
{
|
||||
return cvf::Color3f::WHITE;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3f RiaColorTools::constrastColor(cvf::Color3f backgroundColor)
|
||||
{
|
||||
if (isBrightnessAboveThreshold(backgroundColor))
|
||||
{
|
||||
return darkContrastColor();
|
||||
}
|
||||
|
||||
return brightContrastColor();
|
||||
}
|
37
ApplicationCode/Application/Tools/RiaColorTools.h
Normal file
37
ApplicationCode/Application/Tools/RiaColorTools.h
Normal file
@ -0,0 +1,37 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfArray.h"
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RiaColorTools
|
||||
{
|
||||
public:
|
||||
static bool isBrightnessAboveThreshold(cvf::Color3f backgroundColor);
|
||||
|
||||
static cvf::Color3f darkContrastColor();
|
||||
static cvf::Color3f brightContrastColor();
|
||||
static cvf::Color3f constrastColor(cvf::Color3f backgroundColor);
|
||||
};
|
225
ApplicationCode/Application/Tools/RiaDateStringParser.cpp
Normal file
225
ApplicationCode/Application/Tools/RiaDateStringParser.cpp
Normal file
@ -0,0 +1,225 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaDateStringParser.h"
|
||||
|
||||
#include "RiaStdStringTools.h"
|
||||
#include "RiaQDateTimeTools.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
const std::string MONTH_NAMES[] =
|
||||
{
|
||||
"january",
|
||||
"february",
|
||||
"march",
|
||||
"april",
|
||||
"may",
|
||||
"june",
|
||||
"july",
|
||||
"august",
|
||||
"september",
|
||||
"october",
|
||||
"november",
|
||||
"december"
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QDateTime RiaDateStringParser::parseDateString(const QString& dateString)
|
||||
{
|
||||
return RiaDateStringParser::parseDateString(dateString.toStdString());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QDateTime RiaDateStringParser::parseDateString(const std::string& dateString)
|
||||
{
|
||||
int year, month, day;
|
||||
bool parsedOk =
|
||||
tryParseYearFirst(dateString, year, month, day) ||
|
||||
tryParseDayFirst(dateString, year, month, day) ||
|
||||
tryParseMonthFirst(dateString, year, month, day);
|
||||
|
||||
QDateTime dt;
|
||||
dt.setTimeSpec(RiaQDateTimeTools::currentTimeSpec());
|
||||
if (parsedOk) dt.setDate(QDate(year, month, day));
|
||||
|
||||
return dt;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Try parse formats
|
||||
/// 'yyyy mm dd'
|
||||
/// 'yyyy MMM dd'
|
||||
/// 'yyyy_mm_dd'
|
||||
/// 'yyyy_MMM_dd'
|
||||
/// 'yyyy-mm-dd'
|
||||
/// 'yyyy-MMM-dd'
|
||||
/// 'yyyy.MMM.dd'
|
||||
/// 'yyyy.MMM.dd'
|
||||
/// MMM is month name (shortened)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaDateStringParser::tryParseYearFirst(const std::string& s, int& year, int& month, int& day)
|
||||
{
|
||||
auto firstSep = s.find_first_of(" -_.");
|
||||
auto lastSep = s.find_first_of(" -_.", firstSep + 1);
|
||||
|
||||
if (firstSep == std::string::npos || lastSep == std::string::npos) return false;
|
||||
|
||||
auto sYear = s.substr(0, firstSep);
|
||||
auto sMonth = s.substr(firstSep + 1, lastSep - firstSep - 1);
|
||||
auto sDay = s.substr(lastSep + 1);
|
||||
|
||||
return tryParseYear(sYear, year) && tryParseMonth(sMonth, month) && tryParseDay(sDay, day);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Try parse formats
|
||||
/// 'dd mm yyyy'
|
||||
/// 'dd MMM yyyy'
|
||||
/// 'dd_mm_yyyy'
|
||||
/// 'dd_MMM_yyyy'
|
||||
/// 'dd-mm-yyyy'
|
||||
/// 'dd-MMM-yyyy'
|
||||
/// 'dd.mm.yyyy'
|
||||
/// 'dd.MMM.yyyy'
|
||||
/// MMM is month name (shortened)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaDateStringParser::tryParseDayFirst(const std::string& s, int& year, int& month, int& day)
|
||||
{
|
||||
auto firstSep = s.find_first_of(" -_.");
|
||||
auto lastSep = s.find_first_of(" -_.", firstSep + 1);
|
||||
|
||||
if (firstSep == std::string::npos || lastSep == std::string::npos) return false;
|
||||
|
||||
auto sDay = s.substr(0, firstSep);
|
||||
auto sMonth = s.substr(firstSep + 1, lastSep - firstSep - 1);
|
||||
auto sYear = s.substr(lastSep + 1);
|
||||
|
||||
return tryParseYear(sYear, year) && tryParseMonth(sMonth, month) && tryParseDay(sDay, day);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaDateStringParser::tryParseMonthFirst(const std::string& s, int& year, int& month, int& day)
|
||||
{
|
||||
auto firstSep = s.find_first_of(" -_.");
|
||||
auto lastSep = s.find_first_of(" -_.", firstSep + 1);
|
||||
|
||||
if (firstSep == std::string::npos || lastSep == std::string::npos) return false;
|
||||
|
||||
auto sMonth = s.substr(0, firstSep);
|
||||
auto sDay = s.substr(firstSep + 1, lastSep - firstSep - 1);
|
||||
auto sYear = s.substr(lastSep + 1);
|
||||
|
||||
return tryParseYear(sYear, year) && tryParseMonth(sMonth, month) && tryParseDay(sDay, day);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaDateStringParser::tryParseYear(const std::string& s, int &year)
|
||||
{
|
||||
if (containsAlphabetic(s)) return false;
|
||||
|
||||
auto today = QDate::currentDate();
|
||||
int y = RiaStdStringTools::toInt(s);
|
||||
if (y > 1970 && y <= today.year())
|
||||
{
|
||||
year = y;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaDateStringParser::tryParseMonth(const std::string& s, int &month)
|
||||
{
|
||||
if (containsAlphabetic(s))
|
||||
{
|
||||
auto sMonth = s;
|
||||
sMonth = trimString(sMonth);
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
if (MONTH_NAMES[i].compare(0, sMonth.size(), sMonth) == 0)
|
||||
{
|
||||
month = i + 1;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int m = RiaStdStringTools::toInt(s);
|
||||
if (m >= 1 && m <= 12)
|
||||
{
|
||||
month = m;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaDateStringParser::tryParseDay(const std::string& s, int &day)
|
||||
{
|
||||
if (containsAlphabetic(s)) return false;
|
||||
|
||||
int d = RiaStdStringTools::toInt(s);
|
||||
if (d >= 1 && d <= 31)
|
||||
{
|
||||
day = d;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaDateStringParser::containsAlphabetic(const std::string& s)
|
||||
{
|
||||
return std::find_if(s.begin(), s.end(), [](char c) { return isalpha(c); }) != s.end();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RiaDateStringParser::trimString(const std::string& s)
|
||||
{
|
||||
auto sCopy = s.substr(0, s.find_last_not_of(' ') + 1);
|
||||
sCopy = sCopy.substr(sCopy.find_first_not_of(' '));
|
||||
|
||||
std::transform(sCopy.begin(), sCopy.end(), sCopy.begin(), ::tolower);
|
||||
|
||||
return sCopy;
|
||||
}
|
48
ApplicationCode/Application/Tools/RiaDateStringParser.h
Normal file
48
ApplicationCode/Application/Tools/RiaDateStringParser.h
Normal file
@ -0,0 +1,48 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <QString>
|
||||
#include <QDateTime>
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RiaDateStringParser
|
||||
{
|
||||
public:
|
||||
static QDateTime parseDateString(const QString& dateString);
|
||||
static QDateTime parseDateString(const std::string& dateString);
|
||||
|
||||
private:
|
||||
static bool tryParseYearFirst(const std::string& s, int& year, int& month, int& day);
|
||||
static bool tryParseDayFirst(const std::string& s, int& year, int& month, int& day);
|
||||
static bool tryParseMonthFirst(const std::string& s, int& year, int& month, int& day);
|
||||
|
||||
static bool tryParseYear(const std::string& s, int &year);
|
||||
static bool tryParseMonth(const std::string& s, int &month);
|
||||
static bool tryParseDay(const std::string& s, int &day);
|
||||
|
||||
static bool containsAlphabetic(const std::string& s);
|
||||
static std::string trimString(const std::string& s);
|
||||
};
|
||||
|
126
ApplicationCode/Application/Tools/RiaEclipseUnitTools.cpp
Normal file
126
ApplicationCode/Application/Tools/RiaEclipseUnitTools.cpp
Normal file
@ -0,0 +1,126 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017- Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaEclipseUnitTools.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
#include <cmath>
|
||||
|
||||
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");
|
||||
|
||||
setDefault(RiaEclipseUnitTools::UNITS_METRIC);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RiaEclipseUnitTools::darcysConstant(UnitSystem unitSystem)
|
||||
{
|
||||
// See "Cartesian transmissibility calculations" in the "Eclipse Technical Description"
|
||||
// CDARCY Darcys constant
|
||||
// = 0.00852702 (E300); 0.008527 (ECLIPSE 100) (METRIC)
|
||||
// = 0.00112712 (E300); 0.001127 (ECLIPSE 100) (FIELD)
|
||||
// = 3.6 (LAB)
|
||||
// = 0.00864 (PVT - M)
|
||||
switch (unitSystem)
|
||||
{
|
||||
case UNITS_FIELD:
|
||||
return 0.001127;
|
||||
case UNITS_METRIC:
|
||||
return 0.008527;
|
||||
default:
|
||||
CVF_ASSERT(false);
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaDefines::DepthUnitType RiaEclipseUnitTools::depthUnit(UnitSystem unit)
|
||||
{
|
||||
switch (unit)
|
||||
{
|
||||
case RiaEclipseUnitTools::UNITS_METRIC:
|
||||
return RiaDefines::UNIT_METER;
|
||||
break;
|
||||
case RiaEclipseUnitTools::UNITS_FIELD:
|
||||
return RiaDefines::UNIT_FEET;
|
||||
break;
|
||||
case RiaEclipseUnitTools::UNITS_LAB:
|
||||
return RiaDefines::UNIT_NONE;
|
||||
break;
|
||||
case RiaEclipseUnitTools::UNITS_UNKNOWN:
|
||||
return RiaDefines::UNIT_NONE;
|
||||
break;
|
||||
default:
|
||||
return RiaDefines::UNIT_NONE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Convert Gas to oil equivalents
|
||||
/// If field unit, the Gas is in Mega ft^3 while the others are in [stb] (barrel)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RiaEclipseUnitTools::convertSurfaceGasFlowRateToOilEquivalents(UnitSystem caseUnitSystem, double eclGasFlowRate)
|
||||
{
|
||||
/// Unused Gas to Barrel conversion :
|
||||
/// we convert gas to stb as well. Based on
|
||||
/// 1 [stb] = 0.15898729492800007 [m^3]
|
||||
/// 1 [ft] = 0.3048 [m]
|
||||
/// megaFt3ToStbFactor = 1.0 / (1.0e-6 * 0.15898729492800007 * ( 1.0 / 0.3048 )^3 )
|
||||
/// double megaFt3ToStbFactor = 178107.60668;
|
||||
|
||||
double fieldGasToOilEquivalent = 1.0e6/5800; // Mega ft^3 to BOE
|
||||
double metricGasToOilEquivalent = 1.0/1.0e3; // Sm^3 Gas to Sm^3 oe
|
||||
|
||||
double oilEquivalentGasRate = HUGE_VAL;
|
||||
|
||||
if (caseUnitSystem == RiaEclipseUnitTools::UNITS_FIELD) oilEquivalentGasRate = fieldGasToOilEquivalent * eclGasFlowRate;
|
||||
if (caseUnitSystem == RiaEclipseUnitTools::UNITS_METRIC) oilEquivalentGasRate = metricGasToOilEquivalent * eclGasFlowRate;
|
||||
|
||||
return oilEquivalentGasRate;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaEclipseUnitTools::unitStringPressure(UnitSystem unitSystem)
|
||||
{
|
||||
switch (unitSystem)
|
||||
{
|
||||
case RiaEclipseUnitTools::UNITS_METRIC: return "barsa";
|
||||
case RiaEclipseUnitTools::UNITS_FIELD: return "psia";
|
||||
case RiaEclipseUnitTools::UNITS_LAB: return "atma";
|
||||
case RiaEclipseUnitTools::UNITS_UNKNOWN: return "";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
55
ApplicationCode/Application/Tools/RiaEclipseUnitTools.h
Normal file
55
ApplicationCode/Application/Tools/RiaEclipseUnitTools.h
Normal file
@ -0,0 +1,55 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017- Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "RiaDefines.h"
|
||||
|
||||
class RiaEclipseUnitTools
|
||||
{
|
||||
|
||||
public:
|
||||
enum UnitSystem
|
||||
{
|
||||
UNITS_METRIC,
|
||||
UNITS_FIELD,
|
||||
UNITS_LAB,
|
||||
UNITS_UNKNOWN,
|
||||
};
|
||||
|
||||
typedef caf::AppEnum< RiaEclipseUnitTools::UnitSystem > UnitSystemType;
|
||||
|
||||
static double feetPerMeter() { return 3.2808399; }
|
||||
static double meterPerFeet() { return 0.3048000; }
|
||||
|
||||
static double meterToFeet(double meter) { return meter * feetPerMeter(); }
|
||||
static double feetToMeter(double feet) { return feet * meterPerFeet();}
|
||||
static double meterToInch(double meter) { return meter * feetPerMeter()*12.0; }
|
||||
static double inchToMeter(double inch) { return (inch / 12.0) * meterPerFeet(); }
|
||||
static double inchToFeet (double inch) { return (inch / 12.0); }
|
||||
|
||||
static double darcysConstant(UnitSystem unitSystem);
|
||||
|
||||
static RiaDefines::DepthUnitType depthUnit(UnitSystem unit);
|
||||
|
||||
static double convertSurfaceGasFlowRateToOilEquivalents(UnitSystem, double eclGasFlowRate);
|
||||
|
||||
static QString unitStringPressure(UnitSystem unitSystem);
|
||||
};
|
||||
|
@ -1,156 +1,156 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaImageFileCompare.h"
|
||||
#include <QtCore/QProcess>
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaImageFileCompare::RiaImageFileCompare(QString compareExecutable)
|
||||
: m_compareExecutable(compareExecutable)
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaImageFileCompare::~RiaImageFileCompare()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaImageFileCompare::reset()
|
||||
{
|
||||
m_imagesEqual = false;
|
||||
m_lastError = IC_NO_ERROR;
|
||||
m_errorMsg = "";
|
||||
m_errorDetails = "";
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaImageFileCompare::runComparison(QString imgFileName, QString refFileName, QString diffFileName)
|
||||
{
|
||||
reset();
|
||||
|
||||
if (m_compareExecutable.isEmpty())
|
||||
{
|
||||
m_lastError = SEVERE_ERROR;
|
||||
m_errorMsg = "Cannot compare images, no compare executable set";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//QString args = QString("-fuzz 2% -lowlight-color white -metric ae \"%1\" \"%2\" \"%3\"").arg(imgFileName).arg(refFileName).arg((diffFileName));
|
||||
// The ImageMagick compare tool on RedHat 5 does not support the lowlight-color options
|
||||
// Use GCC version as a crude mechanism for disabling use of this option on RedHat5
|
||||
#if (__GNUC__ == 4 && __GNUC_MINOR__ <= 1)
|
||||
QString args = QString("-fuzz 0.4% -metric ae \"%1\" \"%2\" \"%3\"").arg(imgFileName).arg(refFileName).arg((diffFileName));
|
||||
#else
|
||||
QString args = QString("-fuzz 0.4% -lowlight-color white -metric ae \"%1\" \"%2\" \"%3\"").arg(imgFileName).arg(refFileName).arg((diffFileName));
|
||||
#endif
|
||||
QString completeCommand = QString("\"%1\" %2").arg(m_compareExecutable).arg(args);
|
||||
|
||||
// Launch process and wait
|
||||
QProcess proc;
|
||||
proc.start(completeCommand);
|
||||
proc.waitForFinished(30000);
|
||||
|
||||
QProcess::ProcessError procError = proc.error();
|
||||
if (procError != QProcess::UnknownError)
|
||||
{
|
||||
m_lastError = SEVERE_ERROR;
|
||||
m_errorMsg = "Error running compare tool process";
|
||||
m_errorDetails = completeCommand;
|
||||
return false;
|
||||
}
|
||||
|
||||
QByteArray stdErr = proc.readAllStandardError();
|
||||
int procExitCode = proc.exitCode();
|
||||
if (procExitCode == 0)
|
||||
{
|
||||
// Strip out whitespace and look for 0 (as in zero pixel differences)
|
||||
stdErr = stdErr.simplified();
|
||||
if (!stdErr.isEmpty() && stdErr[0] == '0')
|
||||
{
|
||||
m_imagesEqual = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Report non-severe error
|
||||
m_lastError = IC_ERROR;
|
||||
m_errorMsg = "Error running compare tool process";
|
||||
m_errorDetails = stdErr;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaImageFileCompare::imagesEqual() const
|
||||
{
|
||||
return m_imagesEqual;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaImageFileCompare::ErrorType RiaImageFileCompare::error() const
|
||||
{
|
||||
return m_lastError;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaImageFileCompare::errorMessage() const
|
||||
{
|
||||
return m_errorMsg;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaImageFileCompare::errorDetails() const
|
||||
{
|
||||
return m_errorDetails;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaImageFileCompare.h"
|
||||
#include <QtCore/QProcess>
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaImageFileCompare::RiaImageFileCompare(QString compareExecutable)
|
||||
: m_compareExecutable(compareExecutable)
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaImageFileCompare::~RiaImageFileCompare()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaImageFileCompare::reset()
|
||||
{
|
||||
m_imagesEqual = false;
|
||||
m_lastError = IC_NO_ERROR;
|
||||
m_errorMsg = "";
|
||||
m_errorDetails = "";
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaImageFileCompare::runComparison(QString imgFileName, QString refFileName, QString diffFileName)
|
||||
{
|
||||
reset();
|
||||
|
||||
if (m_compareExecutable.isEmpty())
|
||||
{
|
||||
m_lastError = SEVERE_ERROR;
|
||||
m_errorMsg = "Cannot compare images, no compare executable set";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//QString args = QString("-fuzz 2% -lowlight-color white -metric ae \"%1\" \"%2\" \"%3\"").arg(imgFileName).arg(refFileName).arg((diffFileName));
|
||||
// The ImageMagick compare tool on RedHat 5 does not support the lowlight-color options
|
||||
// Use GCC version as a crude mechanism for disabling use of this option on RedHat5
|
||||
#if (__GNUC__ == 4 && __GNUC_MINOR__ <= 1)
|
||||
QString args = QString("-fuzz 0.4% -metric ae \"%1\" \"%2\" \"%3\"").arg(imgFileName).arg(refFileName).arg((diffFileName));
|
||||
#else
|
||||
QString args = QString("-fuzz 0.4% -lowlight-color white -metric ae \"%1\" \"%2\" \"%3\"").arg(imgFileName).arg(refFileName).arg((diffFileName));
|
||||
#endif
|
||||
QString completeCommand = QString("\"%1\" %2").arg(m_compareExecutable).arg(args);
|
||||
|
||||
// Launch process and wait
|
||||
QProcess proc;
|
||||
proc.start(completeCommand);
|
||||
proc.waitForFinished(30000);
|
||||
|
||||
QProcess::ProcessError procError = proc.error();
|
||||
if (procError != QProcess::UnknownError)
|
||||
{
|
||||
m_lastError = SEVERE_ERROR;
|
||||
m_errorMsg = "Error running compare tool process";
|
||||
m_errorDetails = completeCommand;
|
||||
return false;
|
||||
}
|
||||
|
||||
QByteArray stdErr = proc.readAllStandardError();
|
||||
int procExitCode = proc.exitCode();
|
||||
if (procExitCode == 0)
|
||||
{
|
||||
// Strip out whitespace and look for 0 (as in zero pixel differences)
|
||||
stdErr = stdErr.simplified();
|
||||
if (!stdErr.isEmpty() && stdErr[0] == '0')
|
||||
{
|
||||
m_imagesEqual = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Report non-severe error
|
||||
m_lastError = IC_ERROR;
|
||||
m_errorMsg = "Error running compare tool process";
|
||||
m_errorDetails = stdErr;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaImageFileCompare::imagesEqual() const
|
||||
{
|
||||
return m_imagesEqual;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaImageFileCompare::ErrorType RiaImageFileCompare::error() const
|
||||
{
|
||||
return m_lastError;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaImageFileCompare::errorMessage() const
|
||||
{
|
||||
return m_errorMsg;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaImageFileCompare::errorDetails() const
|
||||
{
|
||||
return m_errorDetails;
|
||||
}
|
291
ApplicationCode/Application/Tools/RiaImportEclipseCaseTools.cpp
Normal file
291
ApplicationCode/Application/Tools/RiaImportEclipseCaseTools.cpp
Normal file
@ -0,0 +1,291 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaImportEclipseCaseTools.h"
|
||||
|
||||
#include "../SummaryPlotCommands/RicNewSummaryPlotFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RigGridManager.h"
|
||||
|
||||
#include "RimCaseCollection.h"
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCaseMainCollection.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryCurveCollection.h"
|
||||
#include "RimSummaryCurveFilter.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
|
||||
#include "RiuMainPlotWindow.h"
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafUtils.h"
|
||||
#include "cafProgressInfo.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaImportEclipseCaseTools::openEclipseCaseFromFile(const QString& fileName)
|
||||
{
|
||||
if (!caf::Utils::fileExists(fileName)) return false;
|
||||
|
||||
return RiaImportEclipseCaseTools::openEclipseCaseShowTimeStepFilterImpl(fileName, false);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaImportEclipseCaseTools::openEclipseCaseShowTimeStepFilter(const QString& fileName)
|
||||
{
|
||||
if (!caf::Utils::fileExists(fileName)) return false;
|
||||
|
||||
return RiaImportEclipseCaseTools::openEclipseCaseShowTimeStepFilterImpl(fileName, true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaImportEclipseCaseTools::openMockModel(const QString& name)
|
||||
{
|
||||
return RiaImportEclipseCaseTools::openEclipseCaseShowTimeStepFilterImpl(name, false);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaImportEclipseCaseTools::openEclipseCaseShowTimeStepFilterImpl(const QString& fileName, bool showTimeStepFilter)
|
||||
{
|
||||
QFileInfo gridFileName(fileName);
|
||||
QString caseName = gridFileName.completeBaseName();
|
||||
|
||||
RimEclipseResultCase* rimResultReservoir = new RimEclipseResultCase();
|
||||
rimResultReservoir->setCaseInfo(caseName, fileName);
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RimProject* project = app->project();
|
||||
|
||||
RimEclipseCaseCollection* analysisModels = project->activeOilField() ? project->activeOilField()->analysisModels() : NULL;
|
||||
if (analysisModels == NULL) return false;
|
||||
|
||||
RiuMainWindow::instance()->show();
|
||||
|
||||
analysisModels->cases.push_back(rimResultReservoir);
|
||||
|
||||
if (!rimResultReservoir->importGridAndResultMetaData(showTimeStepFilter))
|
||||
{
|
||||
analysisModels->removeCaseFromAllGroups(rimResultReservoir);
|
||||
|
||||
delete rimResultReservoir;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
RimEclipseView* riv = rimResultReservoir->createAndAddReservoirView();
|
||||
|
||||
// Select SOIL as default result variable
|
||||
riv->cellResult()->setResultType(RiaDefines::DYNAMIC_NATIVE);
|
||||
|
||||
if (app->preferences()->loadAndShowSoil)
|
||||
{
|
||||
riv->cellResult()->setResultVariable("SOIL");
|
||||
}
|
||||
riv->hasUserRequestedAnimation = true;
|
||||
|
||||
riv->loadDataAndUpdate();
|
||||
|
||||
// Add a corresponding summary case if it exists
|
||||
{
|
||||
RimSummaryCaseMainCollection* sumCaseColl = project->activeOilField() ? project->activeOilField()->summaryCaseMainCollection() : NULL;
|
||||
if (sumCaseColl)
|
||||
{
|
||||
{
|
||||
RiuMainPlotWindow* mainPlotWindow = app->mainPlotWindow();
|
||||
if (sumCaseColl->summaryCaseCount() == 0 && mainPlotWindow)
|
||||
{
|
||||
mainPlotWindow->hide();
|
||||
}
|
||||
}
|
||||
|
||||
if (!sumCaseColl->findSummaryCaseFromEclipseResultCase(rimResultReservoir))
|
||||
{
|
||||
RimSummaryCase* newSumCase = sumCaseColl->createAndAddSummaryCaseFromEclipseResultCase(rimResultReservoir);
|
||||
|
||||
if (newSumCase)
|
||||
{
|
||||
RimSummaryCase* existingFileSummaryCase = sumCaseColl->findSummaryCaseFromFileName(newSumCase->summaryHeaderFilename());
|
||||
if (existingFileSummaryCase)
|
||||
{
|
||||
// Replace all occurrences of file sum with ecl sum
|
||||
|
||||
std::vector<caf::PdmObjectHandle*> referringObjects;
|
||||
existingFileSummaryCase->objectsWithReferringPtrFields(referringObjects);
|
||||
|
||||
// UI settings of a curve filter is updated based
|
||||
// on the new case association for the curves in the curve filter
|
||||
// UI is updated by loadDataAndUpdate()
|
||||
|
||||
for (caf::PdmObjectHandle* objHandle : referringObjects)
|
||||
{
|
||||
RimSummaryCurve* summaryCurve = dynamic_cast<RimSummaryCurve*>(objHandle);
|
||||
if (summaryCurve)
|
||||
{
|
||||
RimSummaryCurveCollection* parentCollection = nullptr;
|
||||
summaryCurve->firstAncestorOrThisOfType(parentCollection);
|
||||
if (parentCollection)
|
||||
{
|
||||
parentCollection->loadDataAndUpdate(true);
|
||||
parentCollection->updateConnectedEditors();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sumCaseColl->removeCase(existingFileSummaryCase);
|
||||
|
||||
delete existingFileSummaryCase;
|
||||
|
||||
}
|
||||
|
||||
sumCaseColl->updateAllRequiredEditors();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!riv->cellResult()->hasResult())
|
||||
{
|
||||
riv->cellResult()->setResultVariable(RiaDefines::undefinedResultName());
|
||||
}
|
||||
|
||||
analysisModels->updateConnectedEditors();
|
||||
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(riv->cellResult());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaImportEclipseCaseTools::addEclipseCases(const QStringList& fileNames)
|
||||
{
|
||||
if (fileNames.size() == 0) return true;
|
||||
|
||||
// First file is read completely including grid.
|
||||
// The main grid from the first case is reused directly in for the other cases.
|
||||
// When reading active cell info, only the total cell count is tested for consistency
|
||||
RimEclipseResultCase* mainResultCase = NULL;
|
||||
std::vector< std::vector<int> > mainCaseGridDimensions;
|
||||
RimIdenticalGridCaseGroup* gridCaseGroup = NULL;
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RimProject* project = app->project();
|
||||
|
||||
{
|
||||
QString firstFileName = fileNames[0];
|
||||
QFileInfo gridFileName(firstFileName);
|
||||
|
||||
QString caseName = gridFileName.completeBaseName();
|
||||
|
||||
RimEclipseResultCase* rimResultReservoir = new RimEclipseResultCase();
|
||||
rimResultReservoir->setCaseInfo(caseName, firstFileName);
|
||||
if (!rimResultReservoir->openEclipseGridFile())
|
||||
{
|
||||
delete rimResultReservoir;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
rimResultReservoir->readGridDimensions(mainCaseGridDimensions);
|
||||
|
||||
mainResultCase = rimResultReservoir;
|
||||
RimOilField* oilField = project->activeOilField();
|
||||
if (oilField && oilField->analysisModels())
|
||||
{
|
||||
gridCaseGroup = oilField->analysisModels->createIdenticalCaseGroupFromMainCase(mainResultCase);
|
||||
}
|
||||
}
|
||||
|
||||
caf::ProgressInfo info(fileNames.size(), "Reading Active Cell data");
|
||||
|
||||
for (int i = 1; i < fileNames.size(); i++)
|
||||
{
|
||||
QString caseFileName = fileNames[i];
|
||||
QFileInfo gridFileName(caseFileName);
|
||||
|
||||
QString caseName = gridFileName.completeBaseName();
|
||||
|
||||
RimEclipseResultCase* rimResultReservoir = new RimEclipseResultCase();
|
||||
rimResultReservoir->setCaseInfo(caseName, caseFileName);
|
||||
|
||||
std::vector< std::vector<int> > caseGridDimensions;
|
||||
rimResultReservoir->readGridDimensions(caseGridDimensions);
|
||||
|
||||
bool identicalGrid = RigGridManager::isGridDimensionsEqual(mainCaseGridDimensions, caseGridDimensions);
|
||||
if (identicalGrid)
|
||||
{
|
||||
if (rimResultReservoir->openAndReadActiveCellData(mainResultCase->eclipseCaseData()))
|
||||
{
|
||||
RimOilField* oilField = project->activeOilField();
|
||||
if (oilField && oilField->analysisModels())
|
||||
{
|
||||
oilField->analysisModels()->insertCaseInCaseGroup(gridCaseGroup, rimResultReservoir);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
delete rimResultReservoir;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
delete rimResultReservoir;
|
||||
}
|
||||
|
||||
info.setProgress(i);
|
||||
}
|
||||
|
||||
if (gridCaseGroup)
|
||||
{
|
||||
// Create placeholder results and propagate results info from main case to all other cases
|
||||
gridCaseGroup->loadMainCaseAndActiveCellInfo();
|
||||
}
|
||||
|
||||
project->activeOilField()->analysisModels()->updateConnectedEditors();
|
||||
|
||||
if (gridCaseGroup->statisticsCaseCollection()->reservoirs.size() > 0)
|
||||
{
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(gridCaseGroup->statisticsCaseCollection()->reservoirs[0]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -0,0 +1,40 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
class QString;
|
||||
class QStringList;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RiaImportEclipseCaseTools
|
||||
{
|
||||
public:
|
||||
static bool openEclipseCaseFromFile(const QString& fileName);
|
||||
static bool openEclipseCaseShowTimeStepFilter(const QString& fileName);
|
||||
|
||||
static bool openMockModel(const QString& name);
|
||||
|
||||
static bool addEclipseCases(const QStringList& fileNames);
|
||||
|
||||
private:
|
||||
static bool openEclipseCaseShowTimeStepFilterImpl(const QString& fileName, bool showTimeStepFilter);
|
||||
};
|
||||
|
142
ApplicationCode/Application/Tools/RiaProjectFileVersionTools.cpp
Normal file
142
ApplicationCode/Application/Tools/RiaProjectFileVersionTools.cpp
Normal file
@ -0,0 +1,142 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaProjectFileVersionTools.h"
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaProjectFileVersionTools::isCandidateVersionNewerThanOther(const QString& candidateProjectFileVersion,
|
||||
const QString& projectFileVersion)
|
||||
{
|
||||
int candidateMajorVersion = 0;
|
||||
int candidateMinorVersion = 0;
|
||||
int candidatePatchNumber = 0;
|
||||
int candidateDevelopmentId = 0;
|
||||
|
||||
RiaProjectFileVersionTools::decodeVersionString(candidateProjectFileVersion, &candidateMajorVersion, &candidateMinorVersion,
|
||||
&candidatePatchNumber, &candidateDevelopmentId);
|
||||
|
||||
int majorVersion = 0;
|
||||
int minorVersion = 0;
|
||||
int patchNumber = 0;
|
||||
int developmentId = 0;
|
||||
|
||||
RiaProjectFileVersionTools::decodeVersionString(projectFileVersion, &majorVersion, &minorVersion, &patchNumber,
|
||||
&developmentId);
|
||||
|
||||
return RiaProjectFileVersionTools::isCandidateNewerThanOther(candidateMajorVersion, candidateMinorVersion,
|
||||
candidatePatchNumber, candidateDevelopmentId, majorVersion,
|
||||
minorVersion, patchNumber, developmentId);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaProjectFileVersionTools::decodeVersionString(const QString& projectFileVersion, int* majorVersion, int* minorVersion,
|
||||
int* patch, int* developmentId)
|
||||
{
|
||||
if (projectFileVersion.isEmpty()) return;
|
||||
|
||||
QStringList subStrings = projectFileVersion.split(".");
|
||||
|
||||
if (subStrings.size() > 0)
|
||||
{
|
||||
*majorVersion = subStrings[0].toInt();
|
||||
}
|
||||
|
||||
if (subStrings.size() > 1)
|
||||
{
|
||||
*minorVersion = subStrings[1].toInt();
|
||||
}
|
||||
|
||||
if (subStrings.size() > 2)
|
||||
{
|
||||
QString candidate = subStrings[2];
|
||||
QString candidateDigitsOnly = RiaProjectFileVersionTools::stringOfDigits(candidate);
|
||||
|
||||
*patch = candidateDigitsOnly.toInt();
|
||||
}
|
||||
|
||||
if (subStrings.size() > 3)
|
||||
{
|
||||
QString candidate = subStrings.back();
|
||||
QString candidateDigitsOnly = RiaProjectFileVersionTools::stringOfDigits(candidate);
|
||||
|
||||
*developmentId = candidateDigitsOnly.toInt();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaProjectFileVersionTools::isCandidateNewerThanOther(int candidateMajorVersion, int candidateMinorVersion,
|
||||
int candidatePatchNumber, int candidateDevelopmentId,
|
||||
int otherMajorVersion, int otherMinorVersion, int otherPatchNumber,
|
||||
int otherDevelopmentId)
|
||||
{
|
||||
if (candidateMajorVersion != otherMajorVersion)
|
||||
{
|
||||
return (candidateMajorVersion > otherMajorVersion);
|
||||
}
|
||||
|
||||
if (candidateMinorVersion != otherMinorVersion)
|
||||
{
|
||||
return (candidateMinorVersion > otherMinorVersion);
|
||||
}
|
||||
|
||||
if (candidatePatchNumber != otherPatchNumber)
|
||||
{
|
||||
return (candidatePatchNumber > otherPatchNumber);
|
||||
}
|
||||
|
||||
if (candidateDevelopmentId != otherDevelopmentId)
|
||||
{
|
||||
return (candidateDevelopmentId > otherDevelopmentId);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaProjectFileVersionTools::stringOfDigits(const QString& string)
|
||||
{
|
||||
QString digitsOnly;
|
||||
|
||||
for (const auto& c : string)
|
||||
{
|
||||
if (c.isDigit())
|
||||
{
|
||||
digitsOnly += c;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!digitsOnly.isEmpty())
|
||||
{
|
||||
return digitsOnly;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return digitsOnly;
|
||||
}
|
||||
|
@ -0,0 +1,42 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//==================================================================================================
|
||||
class RiaProjectFileVersionTools
|
||||
{
|
||||
public:
|
||||
static bool isCandidateVersionNewerThanOther(const QString& candidateProjectFileVersion,
|
||||
const QString& otherProjectFileVersion);
|
||||
|
||||
// Public to be able to unit test function, not intended to be used
|
||||
static void decodeVersionString(const QString& projectFileVersion, int* majorVersion, int* minorVersion, int* patch,
|
||||
int* developmentId);
|
||||
|
||||
private:
|
||||
static bool isCandidateNewerThanOther(int candidateMajorVersion, int candidateMinorVersion, int candidatePatchNumber,
|
||||
int candidateDevelopmentId, int otherMajorVersion, int otherMinorVersion,
|
||||
int otherPatchNumber, int otherDevelopmentId);
|
||||
|
||||
static QString stringOfDigits(const QString& string);
|
||||
};
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include "RimCaseCollection.h"
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RimEclipseInputCase.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
#include "RimOilField.h"
|
||||
@ -75,6 +76,25 @@ void RiaProjectModifier::setReplaceSourceCasesById(int caseGroupIdToReplace, std
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaProjectModifier::setReplacePropertiesFolderFirstOccurrence(QString newPropertiesFolder)
|
||||
{
|
||||
m_caseIdToPropertiesFolderMap[RiaProjectModifier::firstOccurrenceId()] = makeFilePathAbsolute(newPropertiesFolder);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaProjectModifier::setReplacePropertiesFolder(int caseIdToReplace, QString newPropertiesFolder)
|
||||
{
|
||||
if (caseIdToReplace >= 0)
|
||||
{
|
||||
m_caseIdToPropertiesFolderMap[caseIdToReplace] = makeFilePathAbsolute(newPropertiesFolder);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -90,6 +110,11 @@ bool RiaProjectModifier::applyModificationsToProject(RimProject* project)
|
||||
replaceSourceCases(project);
|
||||
}
|
||||
|
||||
if (m_caseIdToPropertiesFolderMap.size() > 0)
|
||||
{
|
||||
replacePropertiesFolder(project);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -167,6 +192,38 @@ void RiaProjectModifier::replaceCase(RimProject* project)
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaProjectModifier::replacePropertiesFolder(RimProject* project)
|
||||
{
|
||||
std::vector<RimCase*> allCases;
|
||||
project->allCases(allCases);
|
||||
|
||||
for (RimCase* rimCase : allCases)
|
||||
{
|
||||
RimEclipseInputCase* inputCase = dynamic_cast<RimEclipseInputCase*>(rimCase);
|
||||
|
||||
if (inputCase)
|
||||
{
|
||||
for (auto item : m_caseIdToPropertiesFolderMap)
|
||||
{
|
||||
int caseIdToReplace = item.first;
|
||||
|
||||
if (caseIdToReplace == RiaProjectModifier::firstOccurrenceId())
|
||||
{
|
||||
caseIdToReplace = firstInputCaseId(project);
|
||||
}
|
||||
|
||||
if (caseIdToReplace == inputCase->caseId())
|
||||
{
|
||||
inputCase->updateAdditionalFileFolder(item.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Returns absolute path name to the specified file.
|
||||
///
|
||||
@ -236,6 +293,26 @@ int RiaProjectModifier::firstGroupId(RimProject* project)
|
||||
return -1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RiaProjectModifier::firstInputCaseId(RimProject * project)
|
||||
{
|
||||
std::vector<RimCase*> allCases;
|
||||
project->allCases(allCases);
|
||||
|
||||
for (RimCase* rimCase : allCases)
|
||||
{
|
||||
RimEclipseInputCase* resultCase = dynamic_cast<RimEclipseInputCase*>(rimCase);
|
||||
if (resultCase)
|
||||
{
|
||||
return resultCase->caseId();
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
@ -47,21 +47,28 @@ public:
|
||||
void setReplaceSourceCasesFirstOccurrence(std::vector<QString> newGridFileNames);
|
||||
void setReplaceSourceCasesById(int caseGroupIdToReplace, std::vector<QString> newGridFileNames);
|
||||
|
||||
void setReplacePropertiesFolderFirstOccurrence(QString newPropertiesFolder);
|
||||
void setReplacePropertiesFolder(int caseIdToReplace, QString newPropertiesFolder);
|
||||
|
||||
bool applyModificationsToProject(RimProject* project);
|
||||
|
||||
private:
|
||||
void replaceSourceCases(RimProject* project);
|
||||
void replaceCase(RimProject* project);
|
||||
void replacePropertiesFolder(RimProject* project);
|
||||
|
||||
static QString makeFilePathAbsolute(QString relOrAbsolutePath);
|
||||
static QString caseNameFromGridFileName(QString fullGridFilePathName);
|
||||
|
||||
static int firstCaseId(RimProject* project);
|
||||
static int firstGroupId(RimProject* project);
|
||||
static int firstInputCaseId(RimProject* project);
|
||||
|
||||
static int firstOccurrenceId();
|
||||
|
||||
private:
|
||||
std::map<int, QString> m_caseIdToGridFileNameMap;
|
||||
std::map<int, std::vector<QString> > m_groupIdToGridFileNamesMap;
|
||||
std::map<int, QString> m_caseIdToPropertiesFolderMap;
|
||||
};
|
||||
|
157
ApplicationCode/Application/Tools/RiaQDateTimeTools.cpp
Normal file
157
ApplicationCode/Application/Tools/RiaQDateTimeTools.cpp
Normal file
@ -0,0 +1,157 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaQDateTimeTools.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QDateTime>
|
||||
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Qt::TimeSpec RiaQDateTimeTools::currentTimeSpec()
|
||||
{
|
||||
return Qt::UTC;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
quint64 RiaQDateTimeTools::secondsInDay()
|
||||
{
|
||||
return 60 * 60 * 24;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
quint64 RiaQDateTimeTools::secondsInYear()
|
||||
{
|
||||
return 60 * 60 * 24 * 365;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QDateTime RiaQDateTimeTools::fromString(const QString& dateString, const QString& format)
|
||||
{
|
||||
QDateTime dt = QDateTime::fromString(dateString, format);
|
||||
dt.setTimeSpec(currentTimeSpec());
|
||||
|
||||
return dt;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QDateTime RiaQDateTimeTools::fromYears(double years)
|
||||
{
|
||||
double yearsAfterEpoch = years - 1970.0;
|
||||
|
||||
QDateTime dt = RiaQDateTimeTools::epoch();
|
||||
|
||||
return RiaQDateTimeTools::addYears(dt, yearsAfterEpoch);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QDateTime RiaQDateTimeTools::addMSecs(const QDateTime& dt, double msecs)
|
||||
{
|
||||
return dt.addMSecs(msecs);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QDateTime RiaQDateTimeTools::addDays(const QDateTime& dt, double days)
|
||||
{
|
||||
double integerPart = 0.0;
|
||||
double fractionPart = 0.0;
|
||||
|
||||
fractionPart = modf(days, &integerPart);
|
||||
|
||||
QDateTime tmp = dt.addDays(integerPart);
|
||||
tmp = tmp.addSecs(fractionPart * RiaQDateTimeTools::secondsInDay());
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QDateTime RiaQDateTimeTools::addYears(const QDateTime& dt, double years)
|
||||
{
|
||||
double integerPart = 0.0;
|
||||
double fractionPart = 0.0;
|
||||
|
||||
fractionPart = modf(years, &integerPart);
|
||||
|
||||
QDateTime tmp = dt.addYears(integerPart);
|
||||
tmp = tmp.addSecs(fractionPart * RiaQDateTimeTools::secondsInYear());
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QDateTime RiaQDateTimeTools::epoch()
|
||||
{
|
||||
|
||||
// NB: Not able to use QDateTime::fromMSecsSinceEpoch as this was introduced in Qt 4.7
|
||||
|
||||
QDateTime dt;
|
||||
dt.setDate(QDate(1970, 1, 1));
|
||||
dt.setTimeSpec(currentTimeSpec());
|
||||
|
||||
return dt;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QDateTime RiaQDateTimeTools::createUtcDateTime()
|
||||
{
|
||||
auto qdt = QDateTime();
|
||||
qdt.setTimeSpec(currentTimeSpec());
|
||||
return qdt;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QDateTime RiaQDateTimeTools::createUtcDateTime(const QDate& date)
|
||||
{
|
||||
auto qdt = QDateTime(date);
|
||||
qdt.setTimeSpec(currentTimeSpec());
|
||||
return qdt;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QDateTime RiaQDateTimeTools::createUtcDateTime(const QDate& date, const QTime& time)
|
||||
{
|
||||
auto qdt = QDateTime(date, time, currentTimeSpec());
|
||||
return qdt;
|
||||
}
|
54
ApplicationCode/Application/Tools/RiaQDateTimeTools.h
Normal file
54
ApplicationCode/Application/Tools/RiaQDateTimeTools.h
Normal file
@ -0,0 +1,54 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <qglobal.h>
|
||||
#include <qnamespace.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
class QDateTime;
|
||||
class QDate;
|
||||
class QTime;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//==================================================================================================
|
||||
class RiaQDateTimeTools
|
||||
{
|
||||
public:
|
||||
static Qt::TimeSpec currentTimeSpec();
|
||||
|
||||
static QDateTime fromString(const QString& dateString, const QString& format);
|
||||
static QDateTime fromYears(double years);
|
||||
|
||||
static QDateTime addMSecs(const QDateTime& dt, double msecs);
|
||||
static QDateTime addDays(const QDateTime& dt, double days);
|
||||
static QDateTime addYears(const QDateTime& dt, double years);
|
||||
|
||||
static QDateTime epoch();
|
||||
|
||||
static QDateTime createUtcDateTime();
|
||||
static QDateTime createUtcDateTime(const QDate& date);
|
||||
static QDateTime createUtcDateTime(const QDate& date, const QTime& time);
|
||||
|
||||
private:
|
||||
static quint64 secondsInDay();
|
||||
static quint64 secondsInYear();
|
||||
};
|
@ -17,7 +17,9 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaRegressionTest.h"
|
||||
|
||||
#include "cafPdmUiFilePathEditor.h"
|
||||
#include "cafPdmUiTextEditor.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RiaRegressionTest, "RiaRegressionTest");
|
||||
@ -30,10 +32,13 @@ RiaRegressionTest::RiaRegressionTest(void)
|
||||
CAF_PDM_InitFieldNoDefault(&applicationWorkingFolder, "workingFolder", "Folder containing <b>compare</b>", "", "Location of compare tool from Image Magic suite", "");
|
||||
applicationWorkingFolder.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(®ressionTestFolder, "regressionTestFolder", "Regression Test Folder", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(®ressionTestFolder, "regressionTestFolder", "Regression Test Folder", "", "", "");
|
||||
regressionTestFolder.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitField(&showInteractiveDiffImages, "showInteractiveDiffImages", false, "Interactive diff images", "", "", "");
|
||||
CAF_PDM_InitField(&showInteractiveDiffImages, "showInteractiveDiffImages", false, "Interactive Diff Images", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&testFilter, "testFilter", "Test Filter", "", "If empty, all tests are executed.\nTo execute a subset of tests, specify folder names separated by ;", "");
|
||||
testFilter.uiCapability()->setUiEditorTypeName(caf::PdmUiTextEditor::uiEditorTypeName());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
@ -35,10 +35,9 @@ public:
|
||||
public:
|
||||
caf::PdmField<QString> applicationWorkingFolder;
|
||||
caf::PdmField<QString> regressionTestFolder;
|
||||
caf::PdmField<QString> testFilter;
|
||||
caf::PdmField<bool> showInteractiveDiffImages;
|
||||
|
||||
protected:
|
||||
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
|
||||
|
||||
|
||||
};
|
131
ApplicationCode/Application/Tools/RiaSimWellBranchTools.cpp
Normal file
131
ApplicationCode/Application/Tools/RiaSimWellBranchTools.cpp
Normal file
@ -0,0 +1,131 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaSimWellBranchTools.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RigEclipseCaseData.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimWellPlotTools.h"
|
||||
|
||||
#include "cafPdmUiOrdering.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<const RigWellPath*> RiaSimWellBranchTools::simulationWellBranches(const QString& simWellName, bool useAutoDetectionOfBranches)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RimProject* proj = app->project();
|
||||
|
||||
// Find first case containing the specified simulation well
|
||||
auto simCases = proj->eclipseCases();
|
||||
auto caseItr = std::find_if(simCases.begin(), simCases.end(), [&simWellName](const RimEclipseCase* eclCase) {
|
||||
const auto& eclData = eclCase->eclipseCaseData();
|
||||
return eclData != nullptr && eclData->hasSimulationWell(simWellName);
|
||||
});
|
||||
RimEclipseCase* eclipseCase = caseItr != simCases.end() ? *caseItr : nullptr;
|
||||
RigEclipseCaseData* eclCaseData = eclipseCase != nullptr ? eclipseCase->eclipseCaseData() : nullptr;
|
||||
return eclCaseData != nullptr ?
|
||||
eclCaseData->simulationWellBranches(simWellName, false, useAutoDetectionOfBranches) :
|
||||
std::vector<const RigWellPath*>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo>
|
||||
RiaSimWellBranchTools::valueOptionsForBranchIndexField(const std::vector<const RigWellPath*>& simulationWellPaths)
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
size_t branchCount = simulationWellPaths.size();
|
||||
if (simulationWellPaths.size() == 0)
|
||||
{
|
||||
options.push_front(caf::PdmOptionItemInfo("None", -1));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int bIdx = 0; bIdx < static_cast<int>(branchCount); ++bIdx)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo("Branch " + QString::number(bIdx + 1), QVariant::fromValue(bIdx)));
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequiredFromWellName(caf::PdmUiOrdering* uiOrdering,
|
||||
const QString& wellPathOrSimWellName,
|
||||
const caf::PdmField<bool>& branchDetectionField,
|
||||
const caf::PdmField<int>& branchIndexField)
|
||||
{
|
||||
if (!RimWellPlotTools::hasAssociatedWellPath(wellPathOrSimWellName))
|
||||
{
|
||||
const QString simWellName = RimWellPlotTools::simWellName(wellPathOrSimWellName);
|
||||
|
||||
RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequiredFromSimWellName(uiOrdering, simWellName, branchDetectionField,
|
||||
branchIndexField);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequiredFromSimWellName(caf::PdmUiOrdering* uiOrdering,
|
||||
const QString& simWellName,
|
||||
const caf::PdmField<bool>& branchDetectionField,
|
||||
const caf::PdmField<int>& branchIndexField)
|
||||
{
|
||||
if (RiaSimWellBranchTools::simulationWellBranches(simWellName, true).size() > 1)
|
||||
{
|
||||
uiOrdering->add(&branchDetectionField);
|
||||
|
||||
if (RiaSimWellBranchTools::simulationWellBranches(simWellName, branchDetectionField).size() > 1)
|
||||
{
|
||||
uiOrdering->add(&branchIndexField);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RiaSimWellBranchTools::clampBranchIndex(const QString& simWellName, int branchIndexValue, bool branchDetection)
|
||||
{
|
||||
auto branches = RiaSimWellBranchTools::simulationWellBranches(simWellName, branchDetection);
|
||||
|
||||
if (branches.size() == 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int maxIndexValue = static_cast<int>(branches.size()) - 1;
|
||||
if (branchIndexValue > maxIndexValue)
|
||||
{
|
||||
branchIndexValue = maxIndexValue;
|
||||
}
|
||||
|
||||
return branchIndexValue;
|
||||
}
|
57
ApplicationCode/Application/Tools/RiaSimWellBranchTools.h
Normal file
57
ApplicationCode/Application/Tools/RiaSimWellBranchTools.h
Normal file
@ -0,0 +1,57 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RigWellPath;
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmOptionItemInfo;
|
||||
class PdmUiOrdering;
|
||||
} // namespace caf
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//==================================================================================================
|
||||
class RiaSimWellBranchTools
|
||||
{
|
||||
public:
|
||||
static std::vector<const RigWellPath*> simulationWellBranches(const QString& simWellName, bool useAutoDetectionOfBranches);
|
||||
|
||||
static QList<caf::PdmOptionItemInfo>
|
||||
valueOptionsForBranchIndexField(const std::vector<const RigWellPath*>& simulationWellPaths);
|
||||
|
||||
static void appendSimWellBranchFieldsIfRequiredFromWellName(caf::PdmUiOrdering* uiOrdering,
|
||||
const QString& wellPathOrSimWellName,
|
||||
const caf::PdmField<bool>& branchDetectionField,
|
||||
const caf::PdmField<int>& branchIndexField);
|
||||
|
||||
static void appendSimWellBranchFieldsIfRequiredFromSimWellName(caf::PdmUiOrdering* uiOrdering, const QString& simWellName,
|
||||
const caf::PdmField<bool>& branchDetectionField,
|
||||
const caf::PdmField<int>& branchIndexField);
|
||||
|
||||
static int clampBranchIndex(const QString& simWellName, int branchIndexValue, bool branchDetection);
|
||||
};
|
@ -1,8 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011- Statoil ASA
|
||||
// Copyright (C) 2013- Ceetron Solutions AS
|
||||
// Copyright (C) 2011-2012 Ceetron AS
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
@ -18,67 +16,88 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RivWellPathCollectionPartMgr.h"
|
||||
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
#include "RivWellPathPartMgr.h"
|
||||
|
||||
#include "RiaStdStringTools.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivWellPathCollectionPartMgr::RivWellPathCollectionPartMgr(RimWellPathCollection* wellPathCollection)
|
||||
std::string RiaStdStringTools::trimString(const std::string& s)
|
||||
{
|
||||
m_wellPathCollection = wellPathCollection;
|
||||
auto sCopy = s.substr(0, s.find_last_not_of(' ') + 1);
|
||||
sCopy = sCopy.substr(sCopy.find_first_not_of(' '));
|
||||
|
||||
return sCopy;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivWellPathCollectionPartMgr::~RivWellPathCollectionPartMgr()
|
||||
bool RiaStdStringTools::isNumber(const std::string& s, char decimalPoint)
|
||||
{
|
||||
if (s.size() == 0) return false;
|
||||
if (findCharMatchCount(s, decimalPoint) > 1) return false;
|
||||
if (findCharMatchCount(s, '-') > 1) return false;
|
||||
if (findCharMatchCount(s, 'e') > 1) return false;
|
||||
if (findCharMatchCount(s, 'E') > 1) return false;
|
||||
|
||||
std::string matchChars("0123456789eE-");
|
||||
matchChars.append(1, decimalPoint);
|
||||
return (s.find_first_not_of(matchChars) == std::string::npos);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivWellPathCollectionPartMgr::scheduleGeometryRegen()
|
||||
int RiaStdStringTools::toInt(const std::string& s)
|
||||
{
|
||||
for (size_t wIdx = 0; wIdx < m_wellPathCollection->wellPaths.size(); wIdx++)
|
||||
int intValue = -1;
|
||||
|
||||
try
|
||||
{
|
||||
m_wellPathCollection->wellPaths[wIdx]->partMgr()->scheduleGeometryRegen();
|
||||
intValue = std::stoi(s);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
|
||||
return intValue;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivWellPathCollectionPartMgr::setScaleTransform(cvf::Transform * scaleTransform)
|
||||
double RiaStdStringTools::toDouble(const std::string& s)
|
||||
{
|
||||
for (size_t wIdx = 0; wIdx < m_wellPathCollection->wellPaths.size(); wIdx++)
|
||||
{
|
||||
m_wellPathCollection->wellPaths[wIdx]->partMgr()->setScaleTransform(scaleTransform);
|
||||
}
|
||||
double doubleValue = -1.0;
|
||||
|
||||
char* end;
|
||||
doubleValue = std::strtod(s.data(), &end);
|
||||
|
||||
return doubleValue;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivWellPathCollectionPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, cvf::Vec3d displayModelOffset,
|
||||
cvf::Transform* scaleTransform, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox)
|
||||
std::vector<std::string> RiaStdStringTools::splitStringBySpace(const std::string& s)
|
||||
{
|
||||
setScaleTransform(scaleTransform);
|
||||
std::vector<std::string> words;
|
||||
|
||||
if (!m_wellPathCollection->isActive()) return;
|
||||
if (m_wellPathCollection->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF) return;
|
||||
|
||||
for (size_t wIdx = 0; wIdx < m_wellPathCollection->wellPaths.size(); wIdx++)
|
||||
{
|
||||
RivWellPathPartMgr* partMgr = m_wellPathCollection->wellPaths[wIdx]->partMgr();
|
||||
partMgr->setScaleTransform(scaleTransform);
|
||||
partMgr->appendStaticGeometryPartsToModel(model, displayModelOffset, characteristicCellSize, wellPathClipBoundingBox);
|
||||
}
|
||||
splitByDelimiter(s, words);
|
||||
|
||||
return words;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RiaStdStringTools::findCharMatchCount(const std::string& s, char c)
|
||||
{
|
||||
size_t count = 0;
|
||||
size_t pos = 0;
|
||||
while ((pos = s.find_first_of(c, pos + 1)) != std::string::npos)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
62
ApplicationCode/Application/Tools/RiaStdStringTools.h
Normal file
62
ApplicationCode/Application/Tools/RiaStdStringTools.h
Normal file
@ -0,0 +1,62 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//==================================================================================================
|
||||
class RiaStdStringTools
|
||||
{
|
||||
public:
|
||||
static std::string trimString(const std::string& s);
|
||||
static bool isNumber(const std::string& s, char decimalPoint);
|
||||
|
||||
static int toInt(const std::string& s);
|
||||
static double toDouble(const std::string& s);
|
||||
|
||||
static std::vector<std::string> splitStringBySpace(const std::string& s);
|
||||
|
||||
private:
|
||||
template <class Container>
|
||||
static void splitByDelimiter(const std::string& str, Container& cont, char delimiter = ' ');
|
||||
static size_t findCharMatchCount(const std::string& s, char c);
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//==================================================================================================
|
||||
template <class Container>
|
||||
void RiaStdStringTools::splitByDelimiter(const std::string& str, Container& cont, char delimiter)
|
||||
{
|
||||
std::stringstream ss(str);
|
||||
std::string token;
|
||||
while (std::getline(ss, token, delimiter))
|
||||
{
|
||||
if (token.find_first_not_of(delimiter) != std::string::npos)
|
||||
{
|
||||
cont.push_back(token);
|
||||
}
|
||||
}
|
||||
}
|
190
ApplicationCode/Application/Tools/RiaSummaryCurveAnalyzer.cpp
Normal file
190
ApplicationCode/Application/Tools/RiaSummaryCurveAnalyzer.cpp
Normal file
@ -0,0 +1,190 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaSummaryCurveAnalyzer.h"
|
||||
|
||||
#include "RiaSummaryCurveDefinition.h"
|
||||
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryCurveCollection.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <set>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaSummaryCurveAnalyzer::RiaSummaryCurveAnalyzer() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSummaryCurveAnalyzer::appendAdresses(const std::vector<RifEclipseSummaryAddress>& allAddresses)
|
||||
{
|
||||
for (const auto& adr : allAddresses)
|
||||
{
|
||||
analyzeSingleAddress(adr);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSummaryCurveAnalyzer::appendAdresses(const std::set<RifEclipseSummaryAddress>& allAddresses)
|
||||
{
|
||||
for (const auto& adr : allAddresses)
|
||||
{
|
||||
analyzeSingleAddress(adr);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<std::string> RiaSummaryCurveAnalyzer::quantities() const
|
||||
{
|
||||
return m_quantities;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<std::string> RiaSummaryCurveAnalyzer::wellNames() const
|
||||
{
|
||||
return m_wellNames;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<std::string> RiaSummaryCurveAnalyzer::wellGroupNames() const
|
||||
{
|
||||
return m_wellGroupNames;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<int> RiaSummaryCurveAnalyzer::regionNumbers() const
|
||||
{
|
||||
return m_regionNumbers;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RifEclipseSummaryAddress::SummaryVarCategory> RiaSummaryCurveAnalyzer::categories() const
|
||||
{
|
||||
return m_categories;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<QString> RiaSummaryCurveAnalyzer::identifierTexts(RifEclipseSummaryAddress::SummaryVarCategory category) const
|
||||
{
|
||||
std::set<QString> stringSet;
|
||||
|
||||
if (category == RifEclipseSummaryAddress::SUMMARY_REGION)
|
||||
{
|
||||
for (const auto& regionNumber : m_regionNumbers)
|
||||
{
|
||||
stringSet.insert(QString::number(regionNumber));
|
||||
}
|
||||
}
|
||||
else if (category == RifEclipseSummaryAddress::SUMMARY_WELL)
|
||||
{
|
||||
for (const auto& wellName : m_wellNames)
|
||||
{
|
||||
stringSet.insert(QString::fromStdString(wellName));
|
||||
}
|
||||
}
|
||||
else if (category == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP)
|
||||
{
|
||||
for (const auto& wellGroupName : m_wellGroupNames)
|
||||
{
|
||||
stringSet.insert(QString::fromStdString(wellGroupName));
|
||||
}
|
||||
}
|
||||
|
||||
return stringSet;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RifEclipseSummaryAddress>
|
||||
RiaSummaryCurveAnalyzer::addressesForCategory(const std::vector<RifEclipseSummaryAddress>& addresses,
|
||||
RifEclipseSummaryAddress::SummaryVarCategory category)
|
||||
{
|
||||
std::vector<RifEclipseSummaryAddress> filteredAddresses;
|
||||
|
||||
for (const auto& adr : addresses)
|
||||
{
|
||||
if (adr.category() == category)
|
||||
{
|
||||
filteredAddresses.push_back(adr);
|
||||
}
|
||||
}
|
||||
|
||||
return filteredAddresses;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSummaryCurveAnalyzer::clear()
|
||||
{
|
||||
m_quantities.clear();
|
||||
m_wellNames.clear();
|
||||
m_wellGroupNames.clear();
|
||||
m_regionNumbers.clear();
|
||||
m_categories.clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSummaryCurveAnalyzer::analyzeSingleAddress(const RifEclipseSummaryAddress& address)
|
||||
{
|
||||
if (!address.wellName().empty())
|
||||
{
|
||||
m_wellNames.insert(address.wellName());
|
||||
}
|
||||
|
||||
if (!address.quantityName().empty())
|
||||
{
|
||||
m_quantities.insert(address.quantityName());
|
||||
}
|
||||
|
||||
if (!address.wellGroupName().empty())
|
||||
{
|
||||
m_wellGroupNames.insert(address.wellGroupName());
|
||||
}
|
||||
|
||||
if (address.regionNumber() != -1)
|
||||
{
|
||||
m_regionNumbers.insert(address.regionNumber());
|
||||
}
|
||||
|
||||
if (address.category() != RifEclipseSummaryAddress::SUMMARY_INVALID)
|
||||
{
|
||||
m_categories.insert(address.category());
|
||||
}
|
||||
}
|
66
ApplicationCode/Application/Tools/RiaSummaryCurveAnalyzer.h
Normal file
66
ApplicationCode/Application/Tools/RiaSummaryCurveAnalyzer.h
Normal file
@ -0,0 +1,66 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class RimSummaryCurveCollection;
|
||||
|
||||
class QString;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//==================================================================================================
|
||||
class RiaSummaryCurveAnalyzer
|
||||
{
|
||||
public:
|
||||
RiaSummaryCurveAnalyzer();
|
||||
|
||||
void appendAdresses(const std::set<RifEclipseSummaryAddress>& allAddresses);
|
||||
void appendAdresses(const std::vector<RifEclipseSummaryAddress>& allAddresses);
|
||||
|
||||
void clear();
|
||||
|
||||
std::set<std::string> quantities() const;
|
||||
std::set<std::string> wellNames() const;
|
||||
std::set<std::string> wellGroupNames() const;
|
||||
std::set<int> regionNumbers() const;
|
||||
|
||||
std::set<RifEclipseSummaryAddress::SummaryVarCategory> categories() const;
|
||||
|
||||
std::set<QString> identifierTexts(RifEclipseSummaryAddress::SummaryVarCategory category) const;
|
||||
|
||||
static std::vector<RifEclipseSummaryAddress> addressesForCategory(const std::vector<RifEclipseSummaryAddress>& addresses,
|
||||
RifEclipseSummaryAddress::SummaryVarCategory category);
|
||||
|
||||
private:
|
||||
void analyzeSingleAddress(const RifEclipseSummaryAddress& address);
|
||||
|
||||
private:
|
||||
std::set<std::string> m_quantities;
|
||||
std::set<std::string> m_wellNames;
|
||||
std::set<std::string> m_wellGroupNames;
|
||||
std::set<int> m_regionNumbers;
|
||||
|
||||
std::set<RifEclipseSummaryAddress::SummaryVarCategory> m_categories;
|
||||
};
|
140
ApplicationCode/Application/Tools/RiaSummaryTools.cpp
Normal file
140
ApplicationCode/Application/Tools/RiaSummaryTools.cpp
Normal file
@ -0,0 +1,140 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaSummaryTools.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCrossPlot.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "RimSummaryCrossPlotCollection.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlotCollection* RiaSummaryTools::summaryPlotCollection()
|
||||
{
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
|
||||
return project->mainPlotCollection()->summaryPlotCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Update the summary curves referencing this curve, as the curve is identified by the name
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSummaryTools::notifyCalculatedCurveNameHasChanged(const QString& previousCurveName, const QString& currentCurveName)
|
||||
{
|
||||
RimSummaryPlotCollection* summaryPlotColl = RiaSummaryTools::summaryPlotCollection();
|
||||
|
||||
for (RimSummaryPlot* plot : summaryPlotColl->summaryPlots())
|
||||
{
|
||||
for (RimSummaryCurve* curve : plot->summaryCurves())
|
||||
{
|
||||
RifEclipseSummaryAddress adr = curve->summaryAddressY();
|
||||
if (adr.category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED)
|
||||
{
|
||||
if (adr.quantityName() == previousCurveName.toStdString())
|
||||
{
|
||||
RifEclipseSummaryAddress updatedAdr = RifEclipseSummaryAddress::calculatedCurveAddress(currentCurveName.toStdString());
|
||||
curve->setSummaryAddressY(updatedAdr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlot* RiaSummaryTools::parentSummaryPlot(caf::PdmObject* object)
|
||||
{
|
||||
if (parentCrossPlot(object))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RimSummaryPlot* summaryPlot = nullptr;
|
||||
|
||||
if (object)
|
||||
{
|
||||
object->firstAncestorOrThisOfType(summaryPlot);
|
||||
}
|
||||
|
||||
return summaryPlot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlotCollection* RiaSummaryTools::parentSummaryPlotCollection(caf::PdmObject* object)
|
||||
{
|
||||
RimSummaryPlotCollection* summaryPlotColl = nullptr;
|
||||
|
||||
if (object)
|
||||
{
|
||||
object->firstAncestorOrThisOfType(summaryPlotColl);
|
||||
}
|
||||
|
||||
return summaryPlotColl;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryCrossPlot* RiaSummaryTools::parentCrossPlot(caf::PdmObject* object)
|
||||
{
|
||||
RimSummaryCrossPlot* crossPlot = nullptr;
|
||||
|
||||
if (object)
|
||||
{
|
||||
object->firstAncestorOrThisOfType(crossPlot);
|
||||
}
|
||||
|
||||
return crossPlot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryCrossPlotCollection* RiaSummaryTools::parentCrossPlotCollection(caf::PdmObject* object)
|
||||
{
|
||||
RimSummaryCrossPlotCollection* crossPlotColl = nullptr;
|
||||
|
||||
if (object)
|
||||
{
|
||||
object->firstAncestorOrThisOfType(crossPlotColl);
|
||||
}
|
||||
|
||||
return crossPlotColl;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaSummaryTools::isSummaryCrossPlot(const RimSummaryPlot* plot)
|
||||
{
|
||||
return dynamic_cast<const RimSummaryCrossPlot*>(plot);
|
||||
}
|
48
ApplicationCode/Application/Tools/RiaSummaryTools.h
Normal file
48
ApplicationCode/Application/Tools/RiaSummaryTools.h
Normal file
@ -0,0 +1,48 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
class RimSummaryPlotCollection;
|
||||
class RimSummaryPlot;
|
||||
class RimSummaryCrossPlot;
|
||||
class RimSummaryCrossPlotCollection;
|
||||
|
||||
class QString;
|
||||
|
||||
namespace caf {
|
||||
class PdmObject;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//==================================================================================================
|
||||
class RiaSummaryTools
|
||||
{
|
||||
public:
|
||||
static RimSummaryPlotCollection* summaryPlotCollection();
|
||||
static void notifyCalculatedCurveNameHasChanged(const QString& previousCurveName,
|
||||
const QString& currentCurveName);
|
||||
|
||||
static RimSummaryPlot* parentSummaryPlot(caf::PdmObject* object);
|
||||
static RimSummaryPlotCollection* parentSummaryPlotCollection(caf::PdmObject* object);
|
||||
|
||||
static RimSummaryCrossPlot* parentCrossPlot(caf::PdmObject* object);
|
||||
static RimSummaryCrossPlotCollection* parentCrossPlotCollection(caf::PdmObject* object);
|
||||
static bool isSummaryCrossPlot(const RimSummaryPlot* plot);
|
||||
};
|
121
ApplicationCode/Application/Tools/RiaWellNameComparer.cpp
Normal file
121
ApplicationCode/Application/Tools/RiaWellNameComparer.cpp
Normal file
@ -0,0 +1,121 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "../RiaApplication.h"
|
||||
#include "RiaWellNameComparer.h"
|
||||
#include "../../ProjectDataModel/RimProject.h"
|
||||
#include "../../ProjectDataModel/RimWellPath.h"
|
||||
#include <regex>
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//==================================================================================================
|
||||
QString RiaWellNameComparer::tryFindMatchingSimWellName(QString searchName)
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
const std::vector<QString>& simWellNames = proj->simulationWellNames();
|
||||
|
||||
if (searchName.isEmpty() || simWellNames.empty()) return QString();
|
||||
|
||||
searchName = removeWellNamePrefix(searchName);
|
||||
return tryMatchNameInList(searchName, simWellNames);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaWellNameComparer::tryFindMatchingWellPath(QString wellName)
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
const std::vector<RimWellPath*>& wellPaths = proj->allWellPaths();
|
||||
|
||||
if (wellName.isEmpty() || wellPaths.empty()) return QString();
|
||||
|
||||
std::vector<QString> wellPathNames;
|
||||
for (const RimWellPath* wellPath : wellPaths)
|
||||
{
|
||||
wellPathNames.push_back(wellPath->name());
|
||||
}
|
||||
|
||||
wellName = removeWellNamePrefix(wellName);
|
||||
return tryMatchNameInList(wellName, wellPathNames);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaWellNameComparer::tryMatchNameInList(QString searchName, const std::vector<QString>& nameList)
|
||||
{
|
||||
// Try exact name match
|
||||
QString matchedName = tryMatchName(searchName, nameList);
|
||||
if (!matchedName.isEmpty())
|
||||
{
|
||||
return matchedName;
|
||||
}
|
||||
|
||||
// Try matching ignoring spaces, dashes and underscores
|
||||
return tryMatchName(searchName,
|
||||
nameList,
|
||||
[](const QString& str)
|
||||
{
|
||||
QString s = str;
|
||||
s = removeWellNamePrefix(s);
|
||||
return s.remove(' ').remove('-').remove('_');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaWellNameComparer::tryMatchName(QString searchName,
|
||||
const std::vector<QString>& simWellNames,
|
||||
std::function<QString(QString)> stringFormatter)
|
||||
{
|
||||
if (searchName.isEmpty()) return QString();
|
||||
|
||||
if (stringFormatter != nullptr)
|
||||
{
|
||||
searchName = stringFormatter(searchName);
|
||||
}
|
||||
|
||||
for (const auto& simWellName : simWellNames)
|
||||
{
|
||||
QString simWn = simWellName;
|
||||
if (stringFormatter != nullptr)
|
||||
{
|
||||
simWn = stringFormatter(simWn);
|
||||
}
|
||||
if (QString::compare(simWn, searchName, Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return simWellName;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaWellNameComparer::removeWellNamePrefix(const QString& name)
|
||||
{
|
||||
// Try to remove prefix on the format 'xx xxxx/xx-'
|
||||
std::regex pattern("^.*\\d*[/]\\d*[-_]");
|
||||
|
||||
return QString::fromStdString(std::regex_replace(name.toStdString(), pattern, ""));
|
||||
}
|
45
ApplicationCode/Application/Tools/RiaWellNameComparer.h
Normal file
45
ApplicationCode/Application/Tools/RiaWellNameComparer.h
Normal file
@ -0,0 +1,45 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RiaWellNameComparer
|
||||
{
|
||||
public:
|
||||
static QString tryFindMatchingSimWellName(QString searchName);
|
||||
static QString tryFindMatchingWellPath(QString wellName);
|
||||
|
||||
private:
|
||||
static QString tryMatchNameInList(QString searchName,
|
||||
const std::vector<QString>& nameList);
|
||||
static QString tryMatchName(QString searchName,
|
||||
const std::vector<QString>& nameList,
|
||||
std::function<QString(QString)> stringFormatter = nullptr);
|
||||
|
||||
static QString removeWellNamePrefix(const QString& name);
|
||||
};
|
||||
|
@ -8,6 +8,11 @@ CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/ApplicationCode/Adm/RiaVersionInfo.h.cmake
|
||||
${CMAKE_BINARY_DIR}/Generated/RiaVersionInfo.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)
|
||||
message("Add flag to disable warings from gtest - _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING")
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
${cafPdmCore_SOURCE_DIR}
|
||||
@ -27,7 +32,6 @@ include_directories(
|
||||
${ResInsight_SOURCE_DIR}/ThirdParty
|
||||
${ResInsight_SOURCE_DIR}/ThirdParty/NRLib/nrlib/well
|
||||
${ResInsight_SOURCE_DIR}/ThirdParty/Qwt/src
|
||||
${ERT_INCLUDE_DIRS}
|
||||
|
||||
${boost-Subset_SOURCE_DIR}
|
||||
${custom-opm-flowdiagnostics_SOURCE_DIR}/opm-flowdiagnostics/
|
||||
@ -37,6 +41,7 @@ include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Adm
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Application
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Application/Tools
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Commands
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Commands/EclipseCommands
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/FileInterface
|
||||
@ -45,10 +50,13 @@ include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ModelVisualization/GridBox
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ModelVisualization/Intersections
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/UserInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CommandFileInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CommandFileInterface/Core
|
||||
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Summary
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Completions
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Flow
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Summary
|
||||
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ResultStatisticsCache
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ReservoirDataModel
|
||||
@ -68,25 +76,12 @@ include_directories(
|
||||
# Use all h files in the subdirectories to make them available in the project
|
||||
file( GLOB_RECURSE HEADER_FILES *.h )
|
||||
|
||||
set( APPLICATION_FILES
|
||||
RiaMain.cpp
|
||||
|
||||
Application/RiaApplication.cpp
|
||||
Application/RiaPreferences.cpp
|
||||
Application/RiaImageFileCompare.cpp
|
||||
Application/RiaImageCompareReporter.cpp
|
||||
Application/RiaProjectModifier.cpp
|
||||
Application/RiaRegressionTest.cpp
|
||||
Application/RiaColorTables.cpp
|
||||
Application/RiaLogging.h
|
||||
Application/RiaLogging.cpp
|
||||
)
|
||||
|
||||
set( SOCKET_INTERFACE_FILES
|
||||
SocketInterface/RiaSocketServer.cpp
|
||||
SocketInterface/RiaProjectInfoCommands.cpp
|
||||
SocketInterface/RiaCaseInfoCommands.cpp
|
||||
SocketInterface/RiaGeometryCommands.cpp
|
||||
SocketInterface/RiaNNCCommands.cpp
|
||||
SocketInterface/RiaPropertyDataCommands.cpp
|
||||
SocketInterface/RiaWellDataCommands.cpp
|
||||
SocketInterface/RiaSocketTools.cpp
|
||||
@ -94,12 +89,14 @@ set( SOCKET_INTERFACE_FILES
|
||||
)
|
||||
|
||||
list( APPEND CPP_SOURCES
|
||||
${APPLICATION_FILES}
|
||||
${SOCKET_INTERFACE_FILES}
|
||||
${UNIT_TEST_FILES}
|
||||
)
|
||||
|
||||
list( APPEND REFERENCED_CMAKE_FILES
|
||||
Application/CMakeLists_files.cmake
|
||||
Application/Tools/CMakeLists_files.cmake
|
||||
|
||||
ReservoirDataModel/CMakeLists_files.cmake
|
||||
ReservoirDataModel/CMakeLists_filesNotToUnitTest.cmake
|
||||
FileInterface/CMakeLists_files.cmake
|
||||
@ -107,6 +104,7 @@ list( APPEND REFERENCED_CMAKE_FILES
|
||||
ProjectDataModel/CMakeLists_files.cmake
|
||||
ProjectDataModel/Summary/CMakeLists_files.cmake
|
||||
ProjectDataModel/Flow/CMakeLists_files.cmake
|
||||
ProjectDataModel/Completions/CMakeLists_files.cmake
|
||||
|
||||
GeoMech/GeoMechVisualization/CMakeLists_files.cmake
|
||||
|
||||
@ -118,18 +116,23 @@ list( APPEND REFERENCED_CMAKE_FILES
|
||||
|
||||
Commands/CMakeLists_files.cmake
|
||||
Commands/ApplicationCommands/CMakeLists_files.cmake
|
||||
Commands/CompletionCommands/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/IntersectionBoxCommands/CMakeLists_files.cmake
|
||||
Commands/OctaveScriptCommands/CMakeLists_files.cmake
|
||||
Commands/OperationsUsingObjReferences/CMakeLists_files.cmake
|
||||
Commands/OperationsUsingObjReferences/CMakeLists_files.cmake
|
||||
Commands/SummaryPlotCommands/CMakeLists_files.cmake
|
||||
Commands/ToggleCommands/CMakeLists_files.cmake
|
||||
Commands/ViewLink/CMakeLists_files.cmake
|
||||
Commands/WellLogCommands/CMakeLists_files.cmake
|
||||
Commands/WellPathCommands/CMakeLists_files.cmake
|
||||
|
||||
CommandFileInterface/CMakeLists_files.cmake
|
||||
CommandFileInterface/Core/CMakeLists_files.cmake
|
||||
)
|
||||
|
||||
option (RESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS "Include ApplicationCode Unit Tests" OFF)
|
||||
@ -166,7 +169,7 @@ add_subdirectory(ResultStatisticsCache)
|
||||
#
|
||||
# Odb api
|
||||
#
|
||||
set(RESINSIGHT_ODB_API_DIR "" CACHE PATH "Path to the ODB api from Simulia")
|
||||
set(RESINSIGHT_ODB_API_DIR "" CACHE PATH "Optional path to the ABAQUS ODB API from Simulia. Needed for support of geomechanical models")
|
||||
if(NOT ${RESINSIGHT_ODB_API_DIR} EQUAL "")
|
||||
add_definitions(-DUSE_ODB_API)
|
||||
add_subdirectory(GeoMech/OdbReader)
|
||||
@ -176,13 +179,36 @@ endif()
|
||||
|
||||
add_subdirectory(GeoMech/GeoMechDataModel)
|
||||
|
||||
#
|
||||
# HDF5
|
||||
#
|
||||
if (RESINSIGHT_FOUND_HDF5)
|
||||
list( APPEND CPP_SOURCES
|
||||
FileInterface/RifHdf5Reader.h
|
||||
FileInterface/RifHdf5Reader.cpp
|
||||
)
|
||||
|
||||
source_group( "FileInterface" FILES FileInterface/RifHdf5Reader.h FileInterface/RifHdf5Reader.cpp )
|
||||
|
||||
add_definitions(-DUSE_HDF5)
|
||||
endif()
|
||||
|
||||
if (RESINSIGHT_ENABLE_PROTOTYPE_FEATURE_SOURING)
|
||||
add_definitions(-DENABLE_SOURING)
|
||||
endif()
|
||||
|
||||
|
||||
if (RESINSIGHT_ENABLE_PROTOTYPE_FEATURE_FRACTURES)
|
||||
add_definitions(-DUSE_PROTOTYPE_FEATURE_FRACTURES)
|
||||
endif()
|
||||
|
||||
|
||||
#############################################################################
|
||||
# Qt specifics: Moc, ui, resources
|
||||
#############################################################################
|
||||
|
||||
set ( QT_MOC_HEADERS
|
||||
${QT_MOC_HEADERS}
|
||||
Application/RiaApplication.h
|
||||
|
||||
ProjectDataModel/RimMimeData.h
|
||||
ProjectDataModel/RimIntersectionBox.h
|
||||
@ -218,7 +244,6 @@ endif()
|
||||
################################################################################
|
||||
# Create source groups - see also included CMakeLists_files.cmake
|
||||
################################################################################
|
||||
source_group( "Application" FILES ${APPLICATION_FILES} )
|
||||
source_group( "ModelVisualization" FILES ${MODEL_VISUALIZATION_FILES} )
|
||||
source_group( "SocketInterface" FILES ${SOCKET_INTERFACE_FILES} )
|
||||
source_group( "UnitTests" FILES ${UNIT_TEST_FILES} )
|
||||
@ -255,6 +280,9 @@ set( EXE_FILES
|
||||
|
||||
add_executable( ResInsight ${EXE_FILES} )
|
||||
|
||||
if (MSVC)
|
||||
set_target_properties(ResInsight PROPERTIES COMPILE_FLAGS "/wd4190")
|
||||
endif()
|
||||
|
||||
#############################################################################
|
||||
# Application icon for MacOS X bundle
|
||||
@ -287,20 +315,15 @@ set( LINK_LIBRARIES
|
||||
${APP_FWK_LIBRARIES}
|
||||
${VIZ_FWK_LIBRARIES}
|
||||
|
||||
${ERT_LIBRARIES}
|
||||
|
||||
${THIRD_PARTY_LIBRARIES}
|
||||
|
||||
${OPENGL_LIBRARIES}
|
||||
${QT_LIBRARIES}
|
||||
)
|
||||
|
||||
set( EXTERNAL_LINK_LIBRARIES ${ERT_LIBRARY_LIST} )
|
||||
|
||||
# According to ivarun this is needed on OpenSuse, and Fedora. See: https://github.com/OPM/ResInsight/pull/7
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
set ( EXTERNAL_LINK_LIBRARIES
|
||||
${EXTERNAL_LINK_LIBRARIES}
|
||||
list(APPEND EXTERNAL_LINK_LIBRARIES
|
||||
rt
|
||||
)
|
||||
endif()
|
||||
@ -318,27 +341,29 @@ target_link_libraries( ResInsight ${LINK_LIBRARIES} ${EXTERNAL_LINK_LIBRARIES})
|
||||
#############################################################################
|
||||
if(RESINSIGHT_ENABLE_COTIRE)
|
||||
|
||||
# forever is used as variable name, and this symbol is defined by Qt and used in precompiled headers
|
||||
set_source_files_properties (${ResInsight_SOURCE_DIR}/ThirdParty/gtest/gtest-all.cc PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
|
||||
# multiple QRC files are not supported
|
||||
set_source_files_properties (qrc_cafAnimControl.cxx PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
|
||||
# variables at global file scope
|
||||
set_source_files_properties (ModelVisualization/Intersections/RivIntersectionGeometryGenerator.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
set_source_files_properties (ModelVisualization/Intersections/RivIntersectionPartMgr.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
set_source_files_properties (ModelVisualization/Intersections/RivIntersectionBoxPartMgr.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
set( COTIRE_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
|
||||
|
||||
set_source_files_properties (ModelVisualization/GridBox/RivGridBoxGenerator.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
set_source_files_properties (Commands/WellLogCommands/RicWellLogPlotCurveFeatureImpl.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
# multiple QRC files are not supported
|
||||
qrc_cafAnimControl.cxx
|
||||
qrc_ResInsight.cxx
|
||||
|
||||
# using namespace cvf
|
||||
set_source_files_properties (GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
set_source_files_properties (UnitTests/cvfGeometryTools-Test.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
# mix of cvf and Qt namespaces
|
||||
ModelVisualization/GridBox/RivGridBoxGenerator.cpp
|
||||
ModelVisualization/Intersections/RivIntersectionGeometryGenerator.cpp
|
||||
|
||||
# opm parser
|
||||
set_source_files_properties (ProjectDataModel/RimProject.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
|
||||
# exclude file using Eigen
|
||||
ReservoirDataModel/RigTransmissibilityCondenser.cpp
|
||||
ReservoirDataModel/RigEclipseToStimPlanCellTransmissibilityCalculator.cpp
|
||||
ReservoirDataModel/RigCellGeometryTools.cpp
|
||||
)
|
||||
|
||||
foreach (fileToExclude ${COTIRE_EXCLUDE_FILES})
|
||||
set_source_files_properties (${fileToExclude} PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
endforeach(fileToExclude)
|
||||
|
||||
# disable precompiled headers
|
||||
set_target_properties(ResInsight PROPERTIES COTIRE_ENABLE_PRECOMPILED_HEADER FALSE)
|
||||
|
||||
cotire(ResInsight)
|
||||
@ -356,54 +381,56 @@ endif()
|
||||
# Copy Dlls on MSVC
|
||||
#############################################################################
|
||||
|
||||
# Copy Odb Dlls
|
||||
|
||||
if ((MSVC) AND (${RESINSIGHT_USE_ODB_API}))
|
||||
# Find all the dlls
|
||||
file (GLOB RI_ALL_ODB_DLLS ${RESINSIGHT_ODB_API_DIR}/lib/*.dll)
|
||||
|
||||
# Strip off the path
|
||||
foreach (aDLL ${RI_ALL_ODB_DLLS})
|
||||
get_filename_component(filenameWithExt ${aDLL} NAME)
|
||||
list(APPEND RI_ODB_DLLS ${filenameWithExt} )
|
||||
endforeach(aDLL)
|
||||
|
||||
# Copy to target directory
|
||||
foreach (aDLL ${RI_ODB_DLLS})
|
||||
add_custom_command(TARGET ResInsight POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"${RESINSIGHT_ODB_API_DIR}/lib/${aDLL}"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
|
||||
if (_unityTargetName)
|
||||
add_custom_command(TARGET ${_unityTargetName} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"${RESINSIGHT_ODB_API_DIR}/lib/${aDLL}"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
endif()
|
||||
|
||||
# Qt DLLs
|
||||
|
||||
if (MSVC)
|
||||
|
||||
# Qt DLLs
|
||||
set (QTLIBLIST QtCore QtCored QtGui QtGuid QtOpenGl QtOpenGld QtNetwork QtNetworkd QtScript QtScriptd QtScriptTools QtScriptToolsd)
|
||||
foreach (qtlib ${QTLIBLIST})
|
||||
add_custom_command(TARGET ResInsight POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"${QT_BINARY_DIR}/${qtlib}4.dll"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
|
||||
if (_unityTargetName)
|
||||
add_custom_command(TARGET ResInsight POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"${QT_BINARY_DIR}/${qtlib}4.dll"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
|
||||
endif()
|
||||
list(APPEND RI_DLL_FILENAMES ${QT_BINARY_DIR}/${qtlib}4.dll)
|
||||
endforeach( qtlib )
|
||||
|
||||
# Odb Dlls
|
||||
if (RESINSIGHT_USE_ODB_API)
|
||||
# Find all the dlls
|
||||
file (GLOB RI_ALL_ODB_DLLS ${RESINSIGHT_ODB_API_DIR}/lib/*.dll)
|
||||
|
||||
# Strip off the path
|
||||
foreach (aDLL ${RI_ALL_ODB_DLLS})
|
||||
get_filename_component(filenameWithExt ${aDLL} NAME)
|
||||
list(APPEND RI_ODB_DLLS ${filenameWithExt} )
|
||||
endforeach(aDLL)
|
||||
|
||||
foreach (aDLL ${RI_ODB_DLLS})
|
||||
list(APPEND RI_DLL_FILENAMES ${RESINSIGHT_ODB_API_DIR}/lib/${aDLL})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# HDF5 Dlls
|
||||
if (RESINSIGHT_FOUND_HDF5)
|
||||
set (HDF5_DLL_NAMES hdf5 hdf5_cpp szip zlib)
|
||||
foreach (HDF5_DLL_NAME ${HDF5_DLL_NAMES})
|
||||
list(APPEND RI_DLL_FILENAMES ${RESINSIGHT_HDF5_DIR}/bin/${HDF5_DLL_NAME}.dll)
|
||||
endforeach( HDF5_DLL_NAME )
|
||||
endif()
|
||||
|
||||
endif(MSVC)
|
||||
|
||||
# Copy to target directory
|
||||
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>")
|
||||
if (_unityTargetName)
|
||||
add_custom_command(TARGET ${_unityTargetName} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"${FILE_TO_COPY}"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
|
||||
#############################################################################
|
||||
# Install
|
||||
#############################################################################
|
||||
@ -439,21 +466,10 @@ if (RESINSIGHT_PRIVATE_INSTALL)
|
||||
endif()
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||
# put a .exe.local file in the target directory to pick up DLLs from there
|
||||
install (CODE "exec_program (\"${CMAKE_COMMAND}\" ARGS -E touch \$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}ResInsight${CMAKE_EXECUTABLE_SUFFIX}.local)")
|
||||
# put a .exe.local file in the target directory to pick up DLLs from there
|
||||
install (CODE "exec_program (\"${CMAKE_COMMAND}\" ARGS -E touch \$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}ResInsight${CMAKE_EXECUTABLE_SUFFIX}.local)")
|
||||
|
||||
set (RESINSIGHT_FILES
|
||||
${QT_BINARY_DIR}/QtCore4.dll
|
||||
${QT_BINARY_DIR}/QtGui4.dll
|
||||
${QT_BINARY_DIR}/QtOpenGL4.dll
|
||||
${QT_BINARY_DIR}/QtNetwork4.dll
|
||||
${QT_BINARY_DIR}/QtScript4.dll
|
||||
${QT_BINARY_DIR}/QtScriptTools4.dll
|
||||
)
|
||||
|
||||
if (${RESINSIGHT_USE_ODB_API})
|
||||
set (RESINSIGHT_FILES ${RESINSIGHT_FILES} ${RI_ALL_ODB_DLLS})
|
||||
endif()
|
||||
set (RESINSIGHT_FILES ${RI_DLL_FILENAMES})
|
||||
|
||||
# CRT
|
||||
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP ON)
|
||||
@ -500,3 +516,69 @@ else (RESINSIGHT_PRIVATE_INSTALL)
|
||||
DESTINATION share/applications
|
||||
)
|
||||
endif (RESINSIGHT_PRIVATE_INSTALL)
|
||||
|
||||
|
||||
################################################################################
|
||||
# Installation packaging
|
||||
################################################################################
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
set(CPACK_GENERATOR TGZ)
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||
set(CPACK_GENERATOR ZIP)
|
||||
endif()
|
||||
|
||||
if(RESINSIGHT_OCTAVE_PLUGIN_MKOCTFILE)
|
||||
get_filename_component(RESINSIGHT_OCTAVE_DIRECTORY ${RESINSIGHT_OCTAVE_PLUGIN_MKOCTFILE} DIRECTORY)
|
||||
|
||||
execute_process (COMMAND octave-config -v
|
||||
WORKING_DIRECTORY ${RESINSIGHT_OCTAVE_DIRECTORY}
|
||||
OUTPUT_VARIABLE OCTAVE_VERSION_STRING
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif ()
|
||||
|
||||
# Handling of system name on Windows
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES Windows)
|
||||
if(CMAKE_CL_64)
|
||||
set(CPACK_SYSTEM_NAME win64)
|
||||
else()
|
||||
set(CPACK_SYSTEM_NAME win32)
|
||||
endif()
|
||||
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})
|
||||
|
||||
|
||||
set(RESINSIGHT_PACKAGE_NAME "ResInsight")
|
||||
|
||||
set (RESINSIGHT_PACKAGE_NAME "${RESINSIGHT_PACKAGE_NAME}-${STRPRODUCTVER}")
|
||||
|
||||
if(NOT ${RESINSIGHT_ODB_API_DIR} EQUAL "")
|
||||
set (RESINSIGHT_PACKAGE_NAME "${RESINSIGHT_PACKAGE_NAME}_odb")
|
||||
endif()
|
||||
|
||||
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_ENABLE_PROTOTYPE_FEATURE_FRACTURES)
|
||||
set (RESINSIGHT_PACKAGE_NAME "${RESINSIGHT_PACKAGE_NAME}_fractures")
|
||||
endif()
|
||||
|
||||
# Append el5 when compiled on RHEL5 and el6 if compiled on RHEL6
|
||||
if (NOT "${RESINSIGHT_RHEL_SYSTEM_NAME}" STREQUAL "")
|
||||
set (RESINSIGHT_PACKAGE_NAME "${RESINSIGHT_PACKAGE_NAME}_${RESINSIGHT_RHEL_SYSTEM_NAME}")
|
||||
else()
|
||||
set (RESINSIGHT_PACKAGE_NAME "${RESINSIGHT_PACKAGE_NAME}_${CPACK_SYSTEM_NAME}")
|
||||
endif()
|
||||
|
||||
#message("RESINSIGHT_PACKAGE_NAME : " ${RESINSIGHT_PACKAGE_NAME})
|
||||
set(CPACK_PACKAGE_FILE_NAME ${RESINSIGHT_PACKAGE_NAME})
|
||||
|
||||
|
||||
include (CPack)
|
||||
|
52
ApplicationCode/CommandFileInterface/CMakeLists_files.cmake
Normal file
52
ApplicationCode/CommandFileInterface/CMakeLists_files.cmake
Normal file
@ -0,0 +1,52 @@
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCloseProject.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCommandFileExecutor.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfComputeCaseGroupStatistics.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportMsw.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportMultiCaseSnapshots.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportProperty.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportSimWellCompletions.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportSnapshots.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportWellPathCompletions.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfLoadCase.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfOpenProject.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfReplaceCase.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfReplaceSourceCases.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfRunOctaveScript.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfSetExportFolder.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfSetMainWindowSize.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfSetStartDir.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfSetTimeStep.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCloseProject.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCommandFileExecutor.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfComputeCaseGroupStatistics.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportMsw.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportMultiCaseSnapshots.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportProperty.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportSimWellCompletions.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportSnapshots.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportWellPathCompletions.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfLoadCase.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfOpenProject.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfReplaceCase.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfReplaceSourceCases.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfRunOctaveScript.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfSetExportFolder.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfSetMainWindowSize.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfSetStartDir.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfSetTimeStep.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
source_group( "CommandFileInterface" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
|
@ -0,0 +1,28 @@
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCommandObject.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfFieldCapability.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfFieldHandle.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfObjectCapability.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifcCommandFileReader.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfMessages.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCommandObject.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfFieldCapability.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfFieldHandle.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfObjectCapability.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifcCommandFileReader.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfMessages.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
source_group( "CommandFileInterface\\Core" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
|
@ -0,0 +1,37 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandObject::RicfCommandObject(): RicfObjectCapability(this, false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandObject::~RicfCommandObject()
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
#include "cafPdmObject.h"
|
||||
#include "RicfObjectCapability.h"
|
||||
#include "RicfFieldCapability.h"
|
||||
|
||||
#define RICF_InitField(field, keyword, default, uiName, iconResourceName, toolTip, whatsThis) \
|
||||
CAF_PDM_InitField(field, keyword, default, uiName, iconResourceName, toolTip, whatsThis); \
|
||||
AddRicfCapabilityToField(field)
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfCommandObject : public caf::PdmObject, public RicfObjectCapability
|
||||
{
|
||||
public:
|
||||
RicfCommandObject();
|
||||
~RicfCommandObject();
|
||||
|
||||
virtual void execute() = 0;
|
||||
};
|
||||
|
||||
|
@ -0,0 +1,88 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicfFieldCapability.h"
|
||||
#include "RicfMessages.h"
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfFieldReader<QString>::readFieldData(QString& fieldValue, QTextStream& inputStream, RicfMessages* errorMessageContainer)
|
||||
{
|
||||
fieldValue = "";
|
||||
|
||||
errorMessageContainer->skipWhiteSpaceWithLineNumberCount(inputStream);
|
||||
QString accumulatedFieldValue;
|
||||
QChar currentChar;
|
||||
currentChar = errorMessageContainer->readCharWithLineNumberCount(inputStream);
|
||||
if ( currentChar == QChar('"') )
|
||||
{
|
||||
while ( !inputStream.atEnd() )
|
||||
{
|
||||
currentChar = errorMessageContainer->readCharWithLineNumberCount(inputStream);
|
||||
if ( currentChar != QChar('\\') )
|
||||
{
|
||||
if ( currentChar == QChar('"') ) // End Quote
|
||||
{
|
||||
// Reached end of string
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
accumulatedFieldValue += currentChar;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
currentChar = errorMessageContainer->readCharWithLineNumberCount(inputStream);
|
||||
accumulatedFieldValue += currentChar;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Unexpected start of string, Missing '"'
|
||||
// Error message
|
||||
errorMessageContainer->addError("String argument does not seem to be quoted. Missing the start '\"' in the \""
|
||||
+ errorMessageContainer->currentArgument + "\" argument of the command: \""
|
||||
+ errorMessageContainer->currentCommand + "\"" );
|
||||
// Could interpret as unquoted text
|
||||
}
|
||||
|
||||
fieldValue = accumulatedFieldValue;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfFieldWriter<QString>::writeFieldData(const QString& fieldValue, QTextStream& outputStream)
|
||||
{
|
||||
outputStream << "\"";
|
||||
for ( int i = 0; i < fieldValue.size(); ++i )
|
||||
{
|
||||
if ( fieldValue[i] == QChar('"') || fieldValue[i] == QChar('\\') )
|
||||
{
|
||||
outputStream << "\\";
|
||||
}
|
||||
outputStream << fieldValue[i];
|
||||
}
|
||||
outputStream << "\"";
|
||||
}
|
207
ApplicationCode/CommandFileInterface/Core/RicfFieldCapability.h
Normal file
207
ApplicationCode/CommandFileInterface/Core/RicfFieldCapability.h
Normal file
@ -0,0 +1,207 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RicfFieldHandle.h"
|
||||
#include "RicfMessages.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
#include <QTextStream>
|
||||
#include <QString>
|
||||
|
||||
|
||||
template <typename DataType>
|
||||
struct RicfFieldReader
|
||||
{
|
||||
static void readFieldData(DataType & fieldValue, QTextStream& inputStream, RicfMessages* errorMessageContainer)
|
||||
{
|
||||
inputStream >> fieldValue;
|
||||
if (inputStream.status() == QTextStream::ReadCorruptData)
|
||||
{
|
||||
errorMessageContainer->addError("Argument value is unreadable in the argument: \""
|
||||
+ errorMessageContainer->currentArgument + "\" in the command: \""
|
||||
+ errorMessageContainer->currentCommand + "\"" );
|
||||
|
||||
inputStream.setStatus( QTextStream::Ok);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <typename DataType>
|
||||
struct RicfFieldWriter
|
||||
{
|
||||
static void writeFieldData(const DataType & fieldValue, QTextStream& outputStream)
|
||||
{
|
||||
outputStream << fieldValue;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct RicfFieldReader<QString>
|
||||
{
|
||||
static void readFieldData(QString & fieldValue, QTextStream& inputStream, RicfMessages* errorMessageContainer);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct RicfFieldWriter<QString>
|
||||
{
|
||||
static void writeFieldData(const QString & fieldValue, QTextStream& outputStream);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct RicfFieldReader< caf::AppEnum<T> >
|
||||
{
|
||||
static void readFieldData(caf::AppEnum<T>& fieldValue, QTextStream& inputStream, RicfMessages* errorMessageContainer)
|
||||
{
|
||||
errorMessageContainer->skipWhiteSpaceWithLineNumberCount(inputStream);
|
||||
QString accumulatedFieldValue;
|
||||
QChar nextChar;
|
||||
QChar currentChar;
|
||||
while (!inputStream.atEnd())
|
||||
{
|
||||
nextChar = errorMessageContainer->peekNextChar(inputStream);
|
||||
if (nextChar.isLetterOrNumber() || nextChar == QChar('_'))
|
||||
{
|
||||
currentChar = errorMessageContainer->readCharWithLineNumberCount(inputStream);
|
||||
accumulatedFieldValue += currentChar;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!fieldValue.setFromText(accumulatedFieldValue))
|
||||
{
|
||||
// Unexpected enum value
|
||||
// Error message
|
||||
errorMessageContainer->addError("Argument must be valid enum value. "
|
||||
+ errorMessageContainer->currentArgument + "\" argument of the command: \""
|
||||
+ errorMessageContainer->currentCommand + "\"");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct RicfFieldWriter< caf::AppEnum<T> >
|
||||
{
|
||||
static void writeFieldData(const caf::AppEnum<T>& fieldValue, QTextStream& outputStream)
|
||||
{
|
||||
outputStream << fieldValue;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct RicfFieldReader< std::vector<T> >
|
||||
{
|
||||
static void readFieldData(std::vector<T>& fieldValue, QTextStream& inputStream, RicfMessages* errorMessageContainer)
|
||||
{
|
||||
errorMessageContainer->skipWhiteSpaceWithLineNumberCount(inputStream);
|
||||
QChar chr = errorMessageContainer->readCharWithLineNumberCount(inputStream);
|
||||
if (chr == QChar('[')) {
|
||||
while (!inputStream.atEnd())
|
||||
{
|
||||
errorMessageContainer->skipWhiteSpaceWithLineNumberCount(inputStream);
|
||||
QChar nextChar = errorMessageContainer->peekNextChar(inputStream);
|
||||
if (nextChar == QChar(']'))
|
||||
{
|
||||
nextChar = errorMessageContainer->readCharWithLineNumberCount(inputStream);
|
||||
break;
|
||||
}
|
||||
else if (nextChar == QChar(','))
|
||||
{
|
||||
nextChar = errorMessageContainer->readCharWithLineNumberCount(inputStream);
|
||||
errorMessageContainer->skipWhiteSpaceWithLineNumberCount(inputStream);
|
||||
}
|
||||
|
||||
T value;
|
||||
RicfFieldReader<T>::readFieldData(value, inputStream, errorMessageContainer);
|
||||
fieldValue.push_back(value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
errorMessageContainer->addError("Array argument is missing start '['. "
|
||||
+ errorMessageContainer->currentArgument + "\" argument of the command: \""
|
||||
+ errorMessageContainer->currentCommand + "\"" );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct RicfFieldWriter< std::vector<T> >
|
||||
{
|
||||
static void writeFieldData(const std::vector<T>& fieldValue, QTextStream& outputStream)
|
||||
{
|
||||
outputStream << "[";
|
||||
for (size_t i = 0; i < fieldValue.size(); ++i)
|
||||
{
|
||||
RicfFieldWriter<T>::writeFieldData(fieldValue[i], outputStream);
|
||||
if (i < fieldValue.size() - 1)
|
||||
{
|
||||
outputStream << ", ";
|
||||
}
|
||||
}
|
||||
outputStream << "]";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
template < typename FieldType>
|
||||
class RicfFieldCapability : public RicfFieldHandle
|
||||
{
|
||||
public:
|
||||
RicfFieldCapability(FieldType* field, bool giveOwnership) : RicfFieldHandle(field, giveOwnership) { m_field = field; }
|
||||
|
||||
// Xml Serializing
|
||||
public:
|
||||
virtual void readFieldData (QTextStream& inputStream, caf::PdmObjectFactory* objectFactory, RicfMessages* errorMessageContainer) override
|
||||
{
|
||||
//m_field->xmlCapability()->assertValid();
|
||||
typename FieldType::FieldDataType value;
|
||||
RicfFieldReader<typename FieldType::FieldDataType>::readFieldData(value, inputStream, errorMessageContainer);
|
||||
m_field->setValue(value);
|
||||
}
|
||||
|
||||
virtual void writeFieldData(QTextStream& outputStream) const override
|
||||
{
|
||||
//m_field->xmlCapability()->assertValid();
|
||||
RicfFieldWriter<typename FieldType::FieldDataType>::writeFieldData(m_field->value(), outputStream);
|
||||
}
|
||||
|
||||
private:
|
||||
FieldType* m_field;
|
||||
};
|
||||
|
||||
|
||||
template<typename FieldType>
|
||||
void AddRicfCapabilityToField(FieldType* field)
|
||||
{
|
||||
if(field->template capability< RicfFieldCapability<FieldType> >() == NULL)
|
||||
{
|
||||
new RicfFieldCapability<FieldType>(field, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,39 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicfFieldHandle.h"
|
||||
#include "cafPdmFieldHandle.h"
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfFieldHandle::RicfFieldHandle(caf::PdmFieldHandle* owner, bool giveOwnership)
|
||||
{
|
||||
m_owner = owner;
|
||||
owner->addCapability(this, giveOwnership);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfFieldHandle::~RicfFieldHandle()
|
||||
{
|
||||
|
||||
}
|
55
ApplicationCode/CommandFileInterface/Core/RicfFieldHandle.h
Normal file
55
ApplicationCode/CommandFileInterface/Core/RicfFieldHandle.h
Normal file
@ -0,0 +1,55 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
#include "cafPdmFieldCapability.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmObjectFactory;
|
||||
class PdmFieldHandle;
|
||||
}
|
||||
|
||||
class RicfMessages;
|
||||
|
||||
class QTextStream;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfFieldHandle : public caf::PdmFieldCapability
|
||||
{
|
||||
public:
|
||||
RicfFieldHandle(caf::PdmFieldHandle* owner , bool giveOwnership);
|
||||
|
||||
virtual ~RicfFieldHandle();
|
||||
|
||||
virtual void readFieldData (QTextStream& inputStream,
|
||||
caf::PdmObjectFactory* objectFactory,
|
||||
RicfMessages* errorMessageContainer ) = 0;
|
||||
virtual void writeFieldData(QTextStream& outputStream) const = 0;
|
||||
|
||||
private:
|
||||
caf::PdmFieldHandle* m_owner;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
81
ApplicationCode/CommandFileInterface/Core/RicfMessages.cpp
Normal file
81
ApplicationCode/CommandFileInterface/Core/RicfMessages.cpp
Normal file
@ -0,0 +1,81 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RicfMessages.h"
|
||||
#include <QTextStream>
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfMessages::addWarning(const QString& message)
|
||||
{
|
||||
m_messages.push_back(std::make_pair(MESSAGE_WARNING, "Line " + QString::number(m_currentLineNumber) +": " + message));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfMessages::addError(const QString& message)
|
||||
{
|
||||
m_messages.push_back(std::make_pair(MESSAGE_ERROR, "Line " + QString::number(m_currentLineNumber) +": " + message));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfMessages::skipWhiteSpaceWithLineNumberCount(QTextStream& inputStream)
|
||||
{
|
||||
while ( !inputStream.atEnd() )
|
||||
{
|
||||
QChar ch = readCharWithLineNumberCount(inputStream);
|
||||
if ( !ch.isSpace() )
|
||||
{
|
||||
inputStream.seek(inputStream.pos()-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QChar RicfMessages::readCharWithLineNumberCount(QTextStream& inputStream)
|
||||
{
|
||||
QChar ch;
|
||||
inputStream >> ch;
|
||||
if ( ch == QChar('\n') )
|
||||
{
|
||||
m_currentLineNumber++;
|
||||
}
|
||||
return ch;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QChar RicfMessages::peekNextChar(QTextStream& inputStream)
|
||||
{
|
||||
QChar ch;
|
||||
if (!inputStream.atEnd())
|
||||
{
|
||||
inputStream >> ch;
|
||||
inputStream.seek(inputStream.pos() - 1);
|
||||
}
|
||||
return ch;
|
||||
}
|
51
ApplicationCode/CommandFileInterface/Core/RicfMessages.h
Normal file
51
ApplicationCode/CommandFileInterface/Core/RicfMessages.h
Normal file
@ -0,0 +1,51 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <QString>
|
||||
|
||||
class QTextStream;
|
||||
|
||||
class RicfMessages
|
||||
{
|
||||
public:
|
||||
RicfMessages() : m_currentLineNumber(1) {}
|
||||
|
||||
enum MessageType
|
||||
{
|
||||
MESSAGE_WARNING,
|
||||
MESSAGE_ERROR
|
||||
};
|
||||
|
||||
void addWarning(const QString& message);
|
||||
void addError(const QString& message);
|
||||
|
||||
void skipWhiteSpaceWithLineNumberCount(QTextStream& inputStream);
|
||||
QChar readCharWithLineNumberCount(QTextStream& inputStream);
|
||||
QChar peekNextChar(QTextStream& inputStream);
|
||||
|
||||
QString currentCommand;
|
||||
QString currentArgument;
|
||||
std::vector<std::pair<MessageType, QString> > m_messages;
|
||||
|
||||
private:
|
||||
int m_currentLineNumber;
|
||||
};
|
||||
|
||||
|
@ -0,0 +1,210 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicfObjectCapability.h"
|
||||
#include "cafPdmObjectHandle.h"
|
||||
#include <QTextStream>
|
||||
#include "RicfFieldHandle.h"
|
||||
#include "cafPdmXmlFieldHandle.h"
|
||||
#include "RicfMessages.h"
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfObjectCapability::RicfObjectCapability(caf::PdmObjectHandle* owner, bool giveOwnership)
|
||||
{
|
||||
m_owner = owner;
|
||||
m_owner->addCapability(this, giveOwnership);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfObjectCapability::~RicfObjectCapability()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfObjectCapability::readFields(QTextStream& inputStream,
|
||||
caf::PdmObjectFactory* objectFactory,
|
||||
RicfMessages* errorMessageContainer)
|
||||
{
|
||||
std::set<QString> readFields;
|
||||
bool isLastArgumentRead = false;
|
||||
while ( !inputStream.atEnd() && !isLastArgumentRead )
|
||||
{
|
||||
// Read field keyword
|
||||
bool fieldDataFound = false;
|
||||
bool isEndOfArgumentFound = false;
|
||||
QString keyword;
|
||||
{
|
||||
errorMessageContainer->skipWhiteSpaceWithLineNumberCount(inputStream);
|
||||
{
|
||||
QChar currentChar;
|
||||
while (!inputStream.atEnd())
|
||||
{
|
||||
currentChar = errorMessageContainer->readCharWithLineNumberCount(inputStream);
|
||||
|
||||
if (currentChar == QChar('=') || currentChar == QChar(')') || currentChar == QChar(',') || currentChar.isSpace())
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
keyword += currentChar;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (currentChar.isSpace())
|
||||
{
|
||||
errorMessageContainer->skipWhiteSpaceWithLineNumberCount(inputStream);
|
||||
currentChar = errorMessageContainer->readCharWithLineNumberCount(inputStream);
|
||||
}
|
||||
|
||||
if (currentChar == QChar('='))
|
||||
{
|
||||
fieldDataFound = true;
|
||||
}
|
||||
else if (currentChar == QChar(')'))
|
||||
{
|
||||
if (!keyword.isNull())
|
||||
{
|
||||
errorMessageContainer->addError(QString("Can't find the '=' after the argument named '%1' in the command '%2'").arg(keyword).arg(errorMessageContainer->currentCommand));
|
||||
}
|
||||
isLastArgumentRead = true;
|
||||
}
|
||||
else if (currentChar == QChar(','))
|
||||
{
|
||||
errorMessageContainer->addError(QString("Can't find the '=' after the argument named '%1' in the command '%2'").arg(keyword).arg(errorMessageContainer->currentCommand));
|
||||
isEndOfArgumentFound = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessageContainer->addError(QString("Can't find the '=' after the argument named '%1' in the command '%2'").arg(keyword).arg(errorMessageContainer->currentCommand));
|
||||
}
|
||||
}
|
||||
|
||||
if ( readFields.count(keyword) )
|
||||
{
|
||||
// Warning message: Referenced the same argument several times
|
||||
errorMessageContainer->addWarning("The argument: \"" + keyword + "\" is referenced several times in the command: \"" + errorMessageContainer->currentCommand + "\"" );
|
||||
}
|
||||
}
|
||||
|
||||
if (fieldDataFound)
|
||||
{
|
||||
// Make field read its data
|
||||
|
||||
caf::PdmFieldHandle* fieldHandle = m_owner->findField(keyword);
|
||||
if ( fieldHandle && fieldHandle->xmlCapability() && fieldHandle->capability<RicfFieldHandle>() )
|
||||
{
|
||||
caf::PdmXmlFieldHandle* xmlFieldHandle = fieldHandle->xmlCapability();
|
||||
RicfFieldHandle* rcfField = fieldHandle->capability<RicfFieldHandle>();
|
||||
|
||||
if ( xmlFieldHandle->isIOReadable() )
|
||||
{
|
||||
errorMessageContainer->currentArgument = keyword;
|
||||
rcfField->readFieldData(inputStream, objectFactory, errorMessageContainer);
|
||||
errorMessageContainer->currentArgument = keyword;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Error message: Unknown argument name
|
||||
errorMessageContainer->addWarning("The argument: \"" + keyword + "\" does not exist in the command: \"" + errorMessageContainer->currentCommand + "\"");
|
||||
}
|
||||
}
|
||||
|
||||
// Skip to end of argument ',' or end of call ')'
|
||||
if (!(isLastArgumentRead || isEndOfArgumentFound) )
|
||||
{
|
||||
QChar currentChar;
|
||||
bool isOutsideQuotes = true;
|
||||
while ( !inputStream.atEnd() )
|
||||
{
|
||||
currentChar = errorMessageContainer->readCharWithLineNumberCount(inputStream);
|
||||
if ( isOutsideQuotes )
|
||||
{
|
||||
if ( currentChar == QChar(',') )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if ( currentChar == QChar(')') )
|
||||
{
|
||||
isLastArgumentRead = true;
|
||||
break;
|
||||
}
|
||||
if ( currentChar == QChar('\"') )
|
||||
{
|
||||
isOutsideQuotes = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( currentChar == QChar('\"') )
|
||||
{
|
||||
isOutsideQuotes = true;
|
||||
}
|
||||
|
||||
if ( currentChar == QChar('\\') )
|
||||
{
|
||||
currentChar = errorMessageContainer->readCharWithLineNumberCount(inputStream);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfObjectCapability::writeFields(QTextStream& outputStream) const
|
||||
{
|
||||
std::vector<caf::PdmFieldHandle*> fields;
|
||||
m_owner->fields(fields);
|
||||
int writtenFieldCount = 0;
|
||||
for ( size_t it = 0; it < fields.size(); ++it )
|
||||
{
|
||||
const caf::PdmXmlFieldHandle* xmlField = fields[it]->xmlCapability();
|
||||
const RicfFieldHandle* rcfField = fields[it]->capability<RicfFieldHandle>();
|
||||
if ( rcfField && xmlField && xmlField->isIOWritable() )
|
||||
{
|
||||
QString keyword = xmlField->fieldHandle()->keyword();
|
||||
CAF_ASSERT(caf::PdmXmlObjectHandle::isValidXmlElementName(keyword));
|
||||
|
||||
if ( writtenFieldCount >= 1 )
|
||||
{
|
||||
outputStream << ", ";
|
||||
++writtenFieldCount;
|
||||
}
|
||||
|
||||
outputStream << keyword << " = ";
|
||||
rcfField->writeFieldData(outputStream);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
#include "cafPdmObjectCapability.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmObjectHandle;
|
||||
class PdmObjectFactory;
|
||||
}
|
||||
|
||||
class QTextStream;
|
||||
class RicfMessages;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfObjectCapability : public caf::PdmObjectCapability
|
||||
{
|
||||
public:
|
||||
RicfObjectCapability(caf::PdmObjectHandle* owner, bool giveOwnership);
|
||||
|
||||
virtual ~RicfObjectCapability();
|
||||
|
||||
void readFields(QTextStream& inputStream, caf::PdmObjectFactory* objectFactory, RicfMessages* errorMessageContainer);
|
||||
void writeFields(QTextStream& outputStream) const;
|
||||
|
||||
private:
|
||||
caf::PdmObjectHandle* m_owner;
|
||||
};
|
||||
|
||||
|
||||
|
@ -0,0 +1,137 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RifcCommandFileReader.h"
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
#include "RicfObjectCapability.h"
|
||||
#include "RicfMessages.h"
|
||||
|
||||
#include "cafPdmObjectFactory.h"
|
||||
|
||||
#include <QTextStream>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RicfCommandObject*> RicfCommandFileReader::readCommands(QTextStream& inputStream,
|
||||
caf::PdmObjectFactory* objectFactory,
|
||||
RicfMessages* errorMessageContainer)
|
||||
{
|
||||
std::vector<RicfCommandObject*> readCommands;
|
||||
|
||||
while ( !inputStream.atEnd() )
|
||||
{
|
||||
errorMessageContainer->skipWhiteSpaceWithLineNumberCount(inputStream);
|
||||
// Read command name
|
||||
QString commandName;
|
||||
bool foundStartBracet = false;
|
||||
{
|
||||
errorMessageContainer->skipWhiteSpaceWithLineNumberCount(inputStream);
|
||||
while ( !inputStream.atEnd() )
|
||||
{
|
||||
QChar currentChar;
|
||||
currentChar = errorMessageContainer->readCharWithLineNumberCount(inputStream);
|
||||
if ( currentChar.isSpace() )
|
||||
{
|
||||
errorMessageContainer->skipWhiteSpaceWithLineNumberCount(inputStream);
|
||||
QChar isBracket('a');
|
||||
isBracket = errorMessageContainer->readCharWithLineNumberCount(inputStream);
|
||||
if ( isBracket != QChar('(') )
|
||||
{
|
||||
// Error, could not find start bracket for command
|
||||
errorMessageContainer->addError("Could not find start bracket for command " + commandName);
|
||||
|
||||
return readCommands;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else if ( currentChar == QChar('(') )
|
||||
{
|
||||
break;
|
||||
}
|
||||
commandName += currentChar;
|
||||
}
|
||||
}
|
||||
|
||||
if (commandName.isEmpty() && inputStream.atEnd())
|
||||
{
|
||||
// Read past the last command
|
||||
break;
|
||||
}
|
||||
|
||||
CAF_ASSERT(objectFactory);
|
||||
caf::PdmObjectHandle* obj = objectFactory->create(commandName);
|
||||
RicfCommandObject* cObj = dynamic_cast<RicfCommandObject*>(obj);
|
||||
|
||||
if ( cObj == nullptr )
|
||||
{
|
||||
errorMessageContainer->addError("The command: \"" + commandName + "\" does not exist.");
|
||||
|
||||
// Error: Unknown command
|
||||
// Skip to end of command
|
||||
QChar currentChar;
|
||||
bool isOutsideQuotes = true;
|
||||
while ( !inputStream.atEnd() )
|
||||
{
|
||||
currentChar = errorMessageContainer->readCharWithLineNumberCount(inputStream);
|
||||
if ( isOutsideQuotes )
|
||||
{
|
||||
if ( currentChar == QChar(')') )
|
||||
{
|
||||
break;
|
||||
}
|
||||
if ( currentChar == QChar('\"') )
|
||||
{
|
||||
isOutsideQuotes = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( currentChar == QChar('\"') )
|
||||
{
|
||||
isOutsideQuotes = true;
|
||||
}
|
||||
|
||||
if ( currentChar == QChar('\\') )
|
||||
{
|
||||
currentChar = errorMessageContainer->readCharWithLineNumberCount(inputStream);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
readCommands.push_back(cObj);
|
||||
auto rcfCap = cObj->capability<RicfObjectCapability>();
|
||||
errorMessageContainer->currentCommand = commandName;
|
||||
rcfCap->readFields(inputStream, objectFactory, errorMessageContainer);
|
||||
errorMessageContainer->currentCommand = "";
|
||||
}
|
||||
}
|
||||
|
||||
return readCommands;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfCommandFileReader::writeCommands(QTextStream& outputStream, const std::vector<RicfCommandObject*>& commandsToWrite)
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
class RicfCommandObject;
|
||||
class QTextStream;
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmObjectFactory;
|
||||
}
|
||||
|
||||
class RicfMessages;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfCommandFileReader
|
||||
{
|
||||
public:
|
||||
static std::vector<RicfCommandObject*> readCommands(QTextStream& inputStream,
|
||||
caf::PdmObjectFactory* objectFactory,
|
||||
RicfMessages* errorMessageContainer);
|
||||
|
||||
static void writeCommands(QTextStream& outputStream,
|
||||
const std::vector<RicfCommandObject*>& commandsToWrite);
|
||||
};
|
38
ApplicationCode/CommandFileInterface/RicfCloseProject.cpp
Normal file
38
ApplicationCode/CommandFileInterface/RicfCloseProject.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicfCloseProject.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfCloseProject, "closeProject");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCloseProject::RicfCloseProject()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfCloseProject::execute()
|
||||
{
|
||||
RiaApplication::instance()->closeProject();
|
||||
}
|
40
ApplicationCode/CommandFileInterface/RicfCloseProject.h
Normal file
40
ApplicationCode/CommandFileInterface/RicfCloseProject.h
Normal file
@ -0,0 +1,40 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfCloseProject : public RicfCommandObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfCloseProject();
|
||||
|
||||
virtual void execute() override;
|
||||
|
||||
private:
|
||||
};
|
121
ApplicationCode/CommandFileInterface/RicfCommandFileExecutor.cpp
Normal file
121
ApplicationCode/CommandFileInterface/RicfCommandFileExecutor.cpp
Normal file
@ -0,0 +1,121 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
|
||||
#include "RifcCommandFileReader.h"
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "RiaLogging.h"
|
||||
|
||||
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");
|
||||
setDefault(RicfCommandFileExecutor::COMPLETIONS);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandFileExecutor::RicfCommandFileExecutor()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandFileExecutor::~RicfCommandFileExecutor()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfCommandFileExecutor::executeCommands(QTextStream& stream)
|
||||
{
|
||||
std::vector<RicfCommandObject*> commands = RicfCommandFileReader::readCommands(stream, caf::PdmDefaultObjectFactory::instance(), &m_messages);
|
||||
for (auto message : m_messages.m_messages)
|
||||
{
|
||||
if (message.first == RicfMessages::MESSAGE_WARNING)
|
||||
{
|
||||
RiaLogging::warning(QString("Command file parsing warning: %1").arg(message.second));
|
||||
}
|
||||
else
|
||||
{
|
||||
RiaLogging::error(QString("Command file parsing error: %1").arg(message.second));
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (RicfCommandObject* command : commands)
|
||||
{
|
||||
command->execute();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfCommandFileExecutor::setExportPath(ExportType type, QString path)
|
||||
{
|
||||
m_exportPaths[type] = path;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicfCommandFileExecutor::getExportPath(ExportType type) const
|
||||
{
|
||||
auto it = m_exportPaths.find(type);
|
||||
QString path;
|
||||
if (it != m_exportPaths.end())
|
||||
{
|
||||
path = it->second;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfCommandFileExecutor::setLastProjectPath(const QString& path)
|
||||
{
|
||||
m_lastProjectPath = path;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicfCommandFileExecutor::getLastProjectPath() const
|
||||
{
|
||||
return m_lastProjectPath;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandFileExecutor* RicfCommandFileExecutor::instance()
|
||||
{
|
||||
static RicfCommandFileExecutor* commandFileExecutorInstance = new RicfCommandFileExecutor();
|
||||
return commandFileExecutorInstance;
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RicfMessages.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfCommandFileExecutor
|
||||
{
|
||||
public:
|
||||
enum ExportType {
|
||||
COMPLETIONS,
|
||||
SNAPSHOTS,
|
||||
PROPERTIES,
|
||||
STATISTICS
|
||||
};
|
||||
|
||||
typedef caf::AppEnum<ExportType> ExportTypeEnum;
|
||||
|
||||
public:
|
||||
RicfCommandFileExecutor();
|
||||
~RicfCommandFileExecutor();
|
||||
|
||||
void executeCommands(QTextStream& stream);
|
||||
void setExportPath(ExportType type, QString path);
|
||||
QString getExportPath(ExportType type) const;
|
||||
void setLastProjectPath(const QString& path);
|
||||
QString getLastProjectPath() const;
|
||||
|
||||
static RicfCommandFileExecutor* instance();
|
||||
|
||||
private:
|
||||
RicfMessages m_messages;
|
||||
|
||||
std::map<ExportType, QString> m_exportPaths;
|
||||
QString m_lastProjectPath;
|
||||
};
|
@ -0,0 +1,79 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicfComputeCaseGroupStatistics.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseStatisticsCase.h"
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
#include "RimCaseCollection.h"
|
||||
#include "RimView.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfComputeCaseGroupStatistics, "computeCaseGroupStatistics");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfComputeCaseGroupStatistics::RicfComputeCaseGroupStatistics()
|
||||
{
|
||||
RICF_InitField(&m_caseIds, "caseIds", std::vector<int>(), "Case IDs", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfComputeCaseGroupStatistics::execute()
|
||||
{
|
||||
for (int caseId : m_caseIds())
|
||||
{
|
||||
bool foundCase = false;
|
||||
for (RimIdenticalGridCaseGroup* group : RiaApplication::instance()->project()->activeOilField()->analysisModels()->caseGroups)
|
||||
{
|
||||
for (RimEclipseCase* c : group->statisticsCaseCollection->reservoirs)
|
||||
{
|
||||
if (c->caseId == caseId)
|
||||
{
|
||||
RimEclipseStatisticsCase* statsCase = dynamic_cast<RimEclipseStatisticsCase*>(c);
|
||||
if (statsCase)
|
||||
{
|
||||
statsCase->computeStatisticsAndUpdateViews();
|
||||
}
|
||||
else
|
||||
{
|
||||
RiaLogging::warning(QString("computeCaseGroupStatistics: Found case with ID %1, but it is not a statistics case, cannot compute statistics.").arg(caseId));
|
||||
}
|
||||
foundCase = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (foundCase) break;
|
||||
}
|
||||
|
||||
if (!foundCase)
|
||||
{
|
||||
RiaLogging::warning(QString("computeCaseGroupStatistics: Could not find statistics case with ID %1.").arg(caseId));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfComputeCaseGroupStatistics : public RicfCommandObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfComputeCaseGroupStatistics();
|
||||
|
||||
virtual void execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField< std::vector<int> > m_caseIds;
|
||||
};
|
96
ApplicationCode/CommandFileInterface/RicfExportMsw.cpp
Normal file
96
ApplicationCode/CommandFileInterface/RicfExportMsw.cpp
Normal file
@ -0,0 +1,96 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicfExportMsw.h"
|
||||
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimFishbonesCollection.h"
|
||||
#include "RimFishbonesMultipleSubs.h"
|
||||
|
||||
#include "CompletionCommands/RicExportFishbonesWellSegmentsFeature.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfExportMsw, "exportMsw");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfExportMsw::RicfExportMsw()
|
||||
{
|
||||
RICF_InitField(&m_caseId, "caseId", -1, "Case ID", "", "", "");
|
||||
RICF_InitField(&m_wellPathName, "wellPath", QString(), "Well Path Name", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfExportMsw::execute()
|
||||
{
|
||||
RicCaseAndFileExportSettingsUi exportSettings;
|
||||
|
||||
{
|
||||
bool foundCase = false;
|
||||
for (RimEclipseCase* c : RiaApplication::instance()->project()->activeOilField()->analysisModels->cases())
|
||||
{
|
||||
if (c->caseId() == m_caseId())
|
||||
{
|
||||
exportSettings.caseToApply = c;
|
||||
foundCase = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundCase)
|
||||
{
|
||||
RiaLogging::error(QString("exportMsw: Could not find case with ID %1.").arg(m_caseId()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
QString exportFolder = RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::COMPLETIONS);
|
||||
if (exportFolder.isNull())
|
||||
{
|
||||
exportFolder = RiaApplication::instance()->createAbsolutePathFromProjectRelativePath("completions");
|
||||
}
|
||||
exportSettings.folder = exportFolder;
|
||||
|
||||
RimWellPath* wellPath = RiaApplication::instance()->project()->activeOilField()->wellPathCollection->wellPathByName(m_wellPathName);
|
||||
if (!wellPath)
|
||||
{
|
||||
RiaLogging::error(QString("exportMsw: Could not find well path with name %1").arg(m_wellPathName()));
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<RimFishbonesMultipleSubs*> fishbonesSubs;
|
||||
|
||||
for (RimFishbonesMultipleSubs* fishbones : wellPath->fishbonesCollection()->fishbonesSubs())
|
||||
{
|
||||
fishbonesSubs.push_back(fishbones);
|
||||
}
|
||||
|
||||
RicExportFishbonesWellSegmentsFeature::exportWellSegments(wellPath, fishbonesSubs, exportSettings);
|
||||
}
|
42
ApplicationCode/CommandFileInterface/RicfExportMsw.h
Normal file
42
ApplicationCode/CommandFileInterface/RicfExportMsw.h
Normal file
@ -0,0 +1,42 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfExportMsw : public RicfCommandObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfExportMsw();
|
||||
|
||||
virtual void execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_caseId;
|
||||
caf::PdmField<QString> m_wellPathName;
|
||||
};
|
@ -0,0 +1,57 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicfExportMultiCaseSnapshots.h"
|
||||
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaProjectModifier.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfExportMultiCaseSnapshots, "exportMultiCaseSnapshots");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfExportMultiCaseSnapshots::RicfExportMultiCaseSnapshots()
|
||||
{
|
||||
RICF_InitField(&m_gridListFile, "gridListFile", QString(), "Grid List File", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfExportMultiCaseSnapshots::execute()
|
||||
{
|
||||
if (m_gridListFile().isNull())
|
||||
{
|
||||
RiaLogging::error("exportMultiCaseSnapshots: Required parameter gridListFile.");
|
||||
return;
|
||||
}
|
||||
|
||||
QString lastProjectPath = RicfCommandFileExecutor::instance()->getLastProjectPath();
|
||||
if (lastProjectPath.isNull())
|
||||
{
|
||||
RiaLogging::error("exportMultiCaseSnapshots: 'openProject' must be called before 'exportMultiCaseSnapshots' to specify project file to replace cases in.");
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<QString> listFileNames = RiaApplication::readFileListFromTextFile(m_gridListFile());
|
||||
RiaApplication::instance()->runMultiCaseSnapshots(lastProjectPath, listFileNames, RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::SNAPSHOTS));
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfExportMultiCaseSnapshots : public RicfCommandObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfExportMultiCaseSnapshots();
|
||||
|
||||
virtual void execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_gridListFile;
|
||||
};
|
112
ApplicationCode/CommandFileInterface/RicfExportProperty.cpp
Normal file
112
ApplicationCode/CommandFileInterface/RicfExportProperty.cpp
Normal file
@ -0,0 +1,112 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicfExportProperty.h"
|
||||
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
|
||||
#include "RifEclipseInputFileTools.h"
|
||||
|
||||
#include "cafUtils.h"
|
||||
|
||||
#include <QDir>
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfExportProperty, "exportProperty");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfExportProperty::RicfExportProperty()
|
||||
{
|
||||
RICF_InitField(&m_caseId, "caseId", -1, "Case ID", "", "", "");
|
||||
RICF_InitField(&m_timeStepIndex, "timeStep", -1, "Time Step Index", "", "", "");
|
||||
RICF_InitField(&m_propertyName, "property", QString(), "Property Name", "", "", "");
|
||||
RICF_InitField(&m_type, "type", caf::AppEnum<RiaDefines::ResultCatType>(RiaDefines::DYNAMIC_NATIVE), "Property type", "", "", "");
|
||||
RICF_InitField(&m_eclipseKeyword, "eclipseKeyword", QString(), "Eclipse Keyword", "", "", "");
|
||||
RICF_InitField(&m_undefinedValue, "undefinedValue", 0.0, "Undefined Value", "", "", "");
|
||||
RICF_InitField(&m_path, "exportFile", QString(), "Export File", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfExportProperty::execute()
|
||||
{
|
||||
|
||||
RimEclipseCase* eclipseCase;
|
||||
{
|
||||
bool foundCase = false;
|
||||
for (RimEclipseCase* c : RiaApplication::instance()->project()->activeOilField()->analysisModels()->cases)
|
||||
{
|
||||
if (c->caseId == m_caseId)
|
||||
{
|
||||
eclipseCase = c;
|
||||
foundCase = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!foundCase)
|
||||
{
|
||||
RiaLogging::error(QString("exportProperty: Could not find case with ID %1").arg(m_caseId()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
QString filePath = m_path;
|
||||
if (filePath.isNull())
|
||||
{
|
||||
QDir propertiesDir(RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::PROPERTIES));
|
||||
QString fileName = QString("%1-%2").arg(eclipseCase->caseUserDescription()).arg(m_propertyName);
|
||||
fileName = caf::Utils::makeValidFileBasename(fileName);
|
||||
filePath = propertiesDir.filePath(fileName);
|
||||
}
|
||||
|
||||
// FIXME : Select correct view?
|
||||
RimEclipseView* view;
|
||||
for (RimView* v : eclipseCase->views())
|
||||
{
|
||||
view = dynamic_cast<RimEclipseView*>(v);
|
||||
if (view) break;
|
||||
}
|
||||
if (!view)
|
||||
{
|
||||
RiaLogging::error(QString("exportProperty: Could not find a view for case with ID %1").arg(m_caseId()));
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_eclipseKeyword().isNull())
|
||||
{
|
||||
m_eclipseKeyword = m_propertyName;
|
||||
}
|
||||
|
||||
view->cellResult->setResultType(m_type());
|
||||
view->cellResult->setResultVariable(m_propertyName());
|
||||
view->loadDataAndUpdate();
|
||||
|
||||
RifEclipseInputFileTools::writeBinaryResultToTextFile(filePath, eclipseCase->eclipseCaseData(), m_timeStepIndex, view->cellResult, m_eclipseKeyword, m_undefinedValue);
|
||||
}
|
49
ApplicationCode/CommandFileInterface/RicfExportProperty.h
Normal file
49
ApplicationCode/CommandFileInterface/RicfExportProperty.h
Normal file
@ -0,0 +1,49 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RiaDefines.h"
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfExportProperty : public RicfCommandObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfExportProperty();
|
||||
|
||||
virtual void execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_caseId;
|
||||
caf::PdmField<int> m_timeStepIndex;
|
||||
caf::PdmField<QString> m_propertyName;
|
||||
caf::PdmField< caf::AppEnum<RiaDefines::ResultCatType> > m_type;
|
||||
caf::PdmField<QString> m_eclipseKeyword;
|
||||
caf::PdmField<double> m_undefinedValue;
|
||||
caf::PdmField<QString> m_path;
|
||||
};
|
@ -0,0 +1,131 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicfExportSimWellCompletions.h"
|
||||
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RimDialogData.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimSimWellInViewCollection.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSimWellInView.h"
|
||||
#include "RimSimWellInView.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
#include "CompletionCommands/RicWellPathExportCompletionDataFeature.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfExportSimWellCompletions, "exportSimWellCompletions");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfExportSimWellCompletions::RicfExportSimWellCompletions()
|
||||
{
|
||||
RICF_InitField(&m_caseId, "case", -1, "Case ID", "", "", "");
|
||||
RICF_InitField(&m_timeStep, "timeStep", -1, "Time Step Index", "", "", "");
|
||||
RICF_InitField(&m_wellPathNames, "wellPathNames", std::vector<QString>(), "Well Path Names", "", "", "");
|
||||
RICF_InitField(&m_wellSelection, "wellSelection", RicExportCompletionDataSettingsUi::WellSelectionType(), "Well Selection", "", "", "");
|
||||
RICF_InitField(&m_fileSplit, "fileSplit", RicExportCompletionDataSettingsUi::ExportSplitType(), "File Split", "", "", "");
|
||||
RICF_InitField(&m_compdatExport, "compdatExport", RicExportCompletionDataSettingsUi::CompdatExportType(), "Compdat Export", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfExportSimWellCompletions::execute()
|
||||
{
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
RicExportCompletionDataSettingsUi* exportSettings = project->dialogData()->exportCompletionData(false);
|
||||
exportSettings->timeStep = m_timeStep;
|
||||
exportSettings->wellSelection = m_wellSelection;
|
||||
exportSettings->fileSplit = m_fileSplit;
|
||||
exportSettings->compdatExport = m_compdatExport;
|
||||
|
||||
{
|
||||
bool foundCase = false;
|
||||
for (RimEclipseCase* c : RiaApplication::instance()->project()->activeOilField()->analysisModels->cases())
|
||||
{
|
||||
if (c->caseId() == m_caseId())
|
||||
{
|
||||
exportSettings->caseToApply = c;
|
||||
foundCase = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!foundCase)
|
||||
{
|
||||
RiaLogging::error(QString("exportSimWellCompletions: Could not find case with ID %1").arg(m_caseId()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
QString exportFolder = RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::COMPLETIONS);
|
||||
if (exportFolder.isNull())
|
||||
{
|
||||
exportFolder = RiaApplication::instance()->createAbsolutePathFromProjectRelativePath("completions");
|
||||
}
|
||||
exportSettings->folder = exportFolder;
|
||||
|
||||
// FIXME : Select correct view?
|
||||
RimEclipseView* view;
|
||||
for (RimView* v : exportSettings->caseToApply->views())
|
||||
{
|
||||
view = dynamic_cast<RimEclipseView*>(v);
|
||||
if (view) break;
|
||||
}
|
||||
if (!view)
|
||||
{
|
||||
RiaLogging::error(QString("exportSimWellCompletions: Could not find a view for case with ID %1").arg(m_caseId()));
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<RimSimWellInView*> simWells;
|
||||
if (m_wellPathNames().empty())
|
||||
{
|
||||
std::copy(view->wellCollection->wells.begin(),
|
||||
view->wellCollection->wells.end(),
|
||||
std::back_inserter(simWells));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (const QString& wellPathName : m_wellPathNames())
|
||||
{
|
||||
RimSimWellInView* simWell = view->wellCollection->findWell(wellPathName);
|
||||
if (simWell)
|
||||
{
|
||||
simWells.push_back(simWell);
|
||||
}
|
||||
else
|
||||
{
|
||||
RiaLogging::warning(QString("exportSimWellCompletions: Could not find well with name %1 on case with ID %2").arg(wellPathName).arg(m_caseId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
|
||||
RicWellPathExportCompletionDataFeature::exportCompletions(wellPaths, simWells, *exportSettings);
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "CompletionCommands/RicExportCompletionDataSettingsUi.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmField.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfExportSimWellCompletions : public RicfCommandObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfExportSimWellCompletions();
|
||||
|
||||
virtual void execute() override;
|
||||
|
||||
private:
|
||||
|
||||
caf::PdmField<int> m_caseId;
|
||||
caf::PdmField<int> m_timeStep;
|
||||
caf::PdmField< std::vector<QString> > m_wellPathNames;
|
||||
caf::PdmField<RicExportCompletionDataSettingsUi::WellSelectionType> m_wellSelection;
|
||||
caf::PdmField<RicExportCompletionDataSettingsUi::ExportSplitType> m_fileSplit;
|
||||
caf::PdmField<RicExportCompletionDataSettingsUi::CompdatExportType> m_compdatExport;
|
||||
};
|
79
ApplicationCode/CommandFileInterface/RicfExportSnapshots.cpp
Normal file
79
ApplicationCode/CommandFileInterface/RicfExportSnapshots.cpp
Normal file
@ -0,0 +1,79 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicfExportSnapshots.h"
|
||||
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
|
||||
#include "ExportCommands/RicSnapshotAllPlotsToFileFeature.h"
|
||||
#include "ExportCommands/RicSnapshotAllViewsToFileFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfExportSnapshots, "exportSnapshots");
|
||||
|
||||
namespace caf {
|
||||
template<>
|
||||
void RicfExportSnapshots::SnapshotsTypeEnum::setUp()
|
||||
{
|
||||
addItem(RicfExportSnapshots::ALL, "ALL", "All");
|
||||
addItem(RicfExportSnapshots::VIEWS, "VIEWS", "Views");
|
||||
addItem(RicfExportSnapshots::PLOTS, "PLOTS", "Plots");
|
||||
setDefault(RicfExportSnapshots::ALL);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfExportSnapshots::RicfExportSnapshots()
|
||||
{
|
||||
RICF_InitField(&m_type, "type", RicfExportSnapshots::SnapshotsTypeEnum(), "Type", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfExportSnapshots::execute()
|
||||
{
|
||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||
CVF_ASSERT(mainWnd);
|
||||
mainWnd->hideAllDockWindows();
|
||||
RiaApplication::instance()->processEvents();
|
||||
|
||||
QString absolutePathToSnapshotDir = RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::SNAPSHOTS);
|
||||
if (absolutePathToSnapshotDir.isNull())
|
||||
{
|
||||
absolutePathToSnapshotDir = RiaApplication::instance()->createAbsolutePathFromProjectRelativePath("snapshots");
|
||||
}
|
||||
if (m_type == RicfExportSnapshots::VIEWS || m_type == RicfExportSnapshots::ALL)
|
||||
{
|
||||
RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(absolutePathToSnapshotDir);
|
||||
}
|
||||
if (m_type == RicfExportSnapshots::PLOTS || m_type == RicfExportSnapshots::ALL)
|
||||
{
|
||||
RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder(absolutePathToSnapshotDir);
|
||||
}
|
||||
|
||||
mainWnd->loadWinGeoAndDockToolBarLayout();
|
||||
RiaApplication::instance()->processEvents();
|
||||
}
|
51
ApplicationCode/CommandFileInterface/RicfExportSnapshots.h
Normal file
51
ApplicationCode/CommandFileInterface/RicfExportSnapshots.h
Normal file
@ -0,0 +1,51 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmField.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfExportSnapshots : public RicfCommandObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
enum SnapshotsType
|
||||
{
|
||||
VIEWS,
|
||||
PLOTS,
|
||||
ALL
|
||||
};
|
||||
typedef caf::AppEnum<SnapshotsType> SnapshotsTypeEnum;
|
||||
|
||||
public:
|
||||
RicfExportSnapshots();
|
||||
|
||||
virtual void execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<SnapshotsTypeEnum> m_type;
|
||||
};
|
@ -0,0 +1,120 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicfExportWellPathCompletions.h"
|
||||
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RimDialogData.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
#include "RimWellPath.h"
|
||||
|
||||
#include "CompletionCommands/RicWellPathExportCompletionDataFeature.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfExportWellPathCompletions, "exportWellPathCompletions");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfExportWellPathCompletions::RicfExportWellPathCompletions()
|
||||
{
|
||||
RICF_InitField(&m_caseId, "caseId", -1, "Case ID", "", "", "");
|
||||
RICF_InitField(&m_timeStep, "timeStep", -1, "Time Step Index", "", "", "");
|
||||
RICF_InitField(&m_wellPathNames, "wellPathNames", std::vector<QString>(), "Well Path Names", "", "", "");
|
||||
RICF_InitField(&m_wellSelection, "wellSelection", RicExportCompletionDataSettingsUi::WellSelectionType(), "Well Selection", "", "", "");
|
||||
RICF_InitField(&m_fileSplit, "fileSplit", RicExportCompletionDataSettingsUi::ExportSplitType(), "File Split", "", "", "");
|
||||
RICF_InitField(&m_compdatExport, "compdatExport", RicExportCompletionDataSettingsUi::CompdatExportType(), "Compdat Export", "", "", "");
|
||||
RICF_InitField(&m_includePerforations, "includePerforations", true, "Include Perforations", "", "", "");
|
||||
RICF_InitField(&m_includeFishbones, "includeFishbones", true, "Include Fishbones", "", "", "");
|
||||
RICF_InitField(&m_excludeMainBoreForFishbones, "excludeMainBoreForFishbones", false, "Exclude Main Bore for Fishbones", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfExportWellPathCompletions::execute()
|
||||
{
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
RicExportCompletionDataSettingsUi* exportSettings = project->dialogData()->exportCompletionData(false);
|
||||
exportSettings->timeStep = m_timeStep;
|
||||
exportSettings->wellSelection = m_wellSelection;
|
||||
exportSettings->fileSplit = m_fileSplit;
|
||||
exportSettings->compdatExport = m_compdatExport;
|
||||
exportSettings->includePerforations = m_includePerforations;
|
||||
exportSettings->includeFishbones = m_includeFishbones;
|
||||
exportSettings->excludeMainBoreForFishbones = m_excludeMainBoreForFishbones;
|
||||
|
||||
{
|
||||
bool foundCase = false;
|
||||
for (RimEclipseCase* c : RiaApplication::instance()->project()->activeOilField()->analysisModels->cases())
|
||||
{
|
||||
if (c->caseId() == m_caseId())
|
||||
{
|
||||
exportSettings->caseToApply = c;
|
||||
foundCase = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!foundCase)
|
||||
{
|
||||
RiaLogging::error(QString("exportWellPathCompletions: Could not find case with ID %1").arg(m_caseId()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
QString exportFolder = RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::COMPLETIONS);
|
||||
if (exportFolder.isNull())
|
||||
{
|
||||
exportFolder = RiaApplication::instance()->createAbsolutePathFromProjectRelativePath("completions");
|
||||
}
|
||||
exportSettings->folder = exportFolder;
|
||||
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
if (m_wellPathNames().empty())
|
||||
{
|
||||
std::copy(RiaApplication::instance()->project()->activeOilField()->wellPathCollection->wellPaths().begin(),
|
||||
RiaApplication::instance()->project()->activeOilField()->wellPathCollection->wellPaths().end(),
|
||||
std::back_inserter(wellPaths));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (const QString& wellPathName : m_wellPathNames())
|
||||
{
|
||||
RimWellPath* wellPath = RiaApplication::instance()->project()->activeOilField()->wellPathCollection->wellPathByName(wellPathName);
|
||||
if (wellPath)
|
||||
{
|
||||
wellPaths.push_back(wellPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
RiaLogging::warning(QString("exportWellPathCompletions: Could not find well path with name %1").arg(wellPathName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<RimSimWellInView*> simWells;
|
||||
|
||||
RicWellPathExportCompletionDataFeature::exportCompletions(wellPaths, simWells, *exportSettings);
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "CompletionCommands/RicExportCompletionDataSettingsUi.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmField.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfExportWellPathCompletions : public RicfCommandObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfExportWellPathCompletions();
|
||||
|
||||
virtual void execute() override;
|
||||
|
||||
private:
|
||||
|
||||
caf::PdmField<int> m_caseId;
|
||||
caf::PdmField<int> m_timeStep;
|
||||
caf::PdmField< std::vector<QString> > m_wellPathNames;
|
||||
caf::PdmField<RicExportCompletionDataSettingsUi::WellSelectionType> m_wellSelection;
|
||||
caf::PdmField<RicExportCompletionDataSettingsUi::ExportSplitType> m_fileSplit;
|
||||
caf::PdmField<RicExportCompletionDataSettingsUi::CompdatExportType> m_compdatExport;
|
||||
caf::PdmField<bool> m_includePerforations;
|
||||
caf::PdmField<bool> m_includeFishbones;
|
||||
caf::PdmField<bool> m_excludeMainBoreForFishbones;
|
||||
};
|
45
ApplicationCode/CommandFileInterface/RicfLoadCase.cpp
Normal file
45
ApplicationCode/CommandFileInterface/RicfLoadCase.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicfLoadCase.h"
|
||||
|
||||
#include "RiaImportEclipseCaseTools.h"
|
||||
|
||||
#include "RiaLogging.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfLoadCase, "loadCase");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfLoadCase::RicfLoadCase()
|
||||
{
|
||||
RICF_InitField(&m_path, "path", QString(), "Path to Case File", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfLoadCase::execute()
|
||||
{
|
||||
bool ok = RiaImportEclipseCaseTools::openEclipseCaseFromFile(m_path);
|
||||
if (!ok)
|
||||
{
|
||||
RiaLogging::error(QString("loadCase: Unable to load case from %1").arg(m_path()));
|
||||
}
|
||||
}
|
41
ApplicationCode/CommandFileInterface/RicfLoadCase.h
Normal file
41
ApplicationCode/CommandFileInterface/RicfLoadCase.h
Normal file
@ -0,0 +1,41 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfLoadCase : public RicfCommandObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfLoadCase();
|
||||
|
||||
virtual void execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_path;
|
||||
};
|
49
ApplicationCode/CommandFileInterface/RicfOpenProject.cpp
Normal file
49
ApplicationCode/CommandFileInterface/RicfOpenProject.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicfOpenProject.h"
|
||||
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfOpenProject, "openProject");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfOpenProject::RicfOpenProject()
|
||||
{
|
||||
RICF_InitField(&m_path, "path", QString(), "Path", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfOpenProject::execute()
|
||||
{
|
||||
bool ok = RiaApplication::instance()->loadProject(m_path);
|
||||
if (!ok)
|
||||
{
|
||||
RiaLogging::error(QString("openProject: Unable to open project at %1").arg(m_path()));
|
||||
return;
|
||||
}
|
||||
|
||||
RicfCommandFileExecutor::instance()->setLastProjectPath(m_path);
|
||||
}
|
41
ApplicationCode/CommandFileInterface/RicfOpenProject.h
Normal file
41
ApplicationCode/CommandFileInterface/RicfOpenProject.h
Normal file
@ -0,0 +1,41 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfOpenProject : public RicfCommandObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfOpenProject();
|
||||
|
||||
virtual void execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_path;
|
||||
};
|
68
ApplicationCode/CommandFileInterface/RicfReplaceCase.cpp
Normal file
68
ApplicationCode/CommandFileInterface/RicfReplaceCase.cpp
Normal file
@ -0,0 +1,68 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicfReplaceCase.h"
|
||||
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaProjectModifier.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfReplaceCase, "replaceCase");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfReplaceCase::RicfReplaceCase()
|
||||
{
|
||||
RICF_InitField(&m_caseId, "caseId", -1, "Case ID", "", "", "");
|
||||
RICF_InitField(&m_newGridFile, "newGridFile", QString(), "New Grid File", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfReplaceCase::execute()
|
||||
{
|
||||
if (m_newGridFile().isNull())
|
||||
{
|
||||
RiaLogging::error("replaceCase: Required parameter newGridFile.");
|
||||
return;
|
||||
}
|
||||
|
||||
QString lastProjectPath = RicfCommandFileExecutor::instance()->getLastProjectPath();
|
||||
if (lastProjectPath.isNull())
|
||||
{
|
||||
RiaLogging::error("replaceCase: 'openProject' must be called before 'replaceCase' to specify project file to replace case in.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
cvf::ref<RiaProjectModifier> projectModifier = new RiaProjectModifier;
|
||||
if (m_caseId() == -1)
|
||||
{
|
||||
projectModifier->setReplaceCaseFirstOccurrence(m_newGridFile());
|
||||
}
|
||||
else
|
||||
{
|
||||
projectModifier->setReplaceCase(m_caseId(), m_newGridFile());
|
||||
}
|
||||
|
||||
RiaApplication::instance()->loadProject(lastProjectPath, RiaApplication::PLA_NONE, projectModifier.p());
|
||||
}
|
42
ApplicationCode/CommandFileInterface/RicfReplaceCase.h
Normal file
42
ApplicationCode/CommandFileInterface/RicfReplaceCase.h
Normal file
@ -0,0 +1,42 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfReplaceCase : public RicfCommandObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfReplaceCase();
|
||||
|
||||
virtual void execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_newGridFile;
|
||||
caf::PdmField<int> m_caseId;
|
||||
};
|
@ -0,0 +1,69 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicfReplaceSourceCases.h"
|
||||
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaProjectModifier.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfReplaceSourceCases, "replaceSourceCases");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfReplaceSourceCases::RicfReplaceSourceCases()
|
||||
{
|
||||
RICF_InitField(&m_caseGroupId, "caseGroupId", -1, "Case Group ID", "", "", "");
|
||||
RICF_InitField(&m_gridListFile, "gridListFile", QString(), "Grid List File", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfReplaceSourceCases::execute()
|
||||
{
|
||||
if (m_gridListFile().isNull())
|
||||
{
|
||||
RiaLogging::error("replaceSourceCases: Required parameter gridListFile.");
|
||||
return;
|
||||
}
|
||||
|
||||
QString lastProjectPath = RicfCommandFileExecutor::instance()->getLastProjectPath();
|
||||
if (lastProjectPath.isNull())
|
||||
{
|
||||
RiaLogging::error("replaceSourceCases: 'openProject' must be called before 'replaceSourceCases' to specify project file to replace cases in.");
|
||||
return;
|
||||
}
|
||||
|
||||
cvf::ref<RiaProjectModifier> projectModifier = new RiaProjectModifier;
|
||||
|
||||
std::vector<QString> listFileNames = RiaApplication::readFileListFromTextFile(m_gridListFile());
|
||||
if (m_caseGroupId() == -1)
|
||||
{
|
||||
projectModifier->setReplaceSourceCasesFirstOccurrence(listFileNames);
|
||||
}
|
||||
else
|
||||
{
|
||||
projectModifier->setReplaceSourceCasesById(m_caseGroupId(), listFileNames);
|
||||
}
|
||||
|
||||
RiaApplication::instance()->loadProject(lastProjectPath, RiaApplication::PLA_CALCULATE_STATISTICS, projectModifier.p());
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfReplaceSourceCases : public RicfCommandObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfReplaceSourceCases();
|
||||
|
||||
virtual void execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_gridListFile;
|
||||
caf::PdmField<int> m_caseGroupId;
|
||||
};
|
67
ApplicationCode/CommandFileInterface/RicfRunOctaveScript.cpp
Normal file
67
ApplicationCode/CommandFileInterface/RicfRunOctaveScript.cpp
Normal file
@ -0,0 +1,67 @@
|
||||
#include "RicfRunOctaveScript.h"
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicfRunOctaveScript.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfRunOctaveScript, "runOctaveScript");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfRunOctaveScript::RicfRunOctaveScript()
|
||||
{
|
||||
RICF_InitField(&m_path, "path", QString(), "Path", "", "", "");
|
||||
RICF_InitField(&m_caseIds, "caseIds", std::vector<int>(), "Case IDs", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfRunOctaveScript::execute()
|
||||
{
|
||||
QString octavePath = RiaApplication::instance()->octavePath();
|
||||
QFileInfo scriptFileInfo(m_path());
|
||||
QStringList processArguments;
|
||||
|
||||
processArguments << "--path" << scriptFileInfo.absolutePath();
|
||||
processArguments << scriptFileInfo.absoluteFilePath();
|
||||
|
||||
bool ok;
|
||||
if (m_caseIds().empty())
|
||||
{
|
||||
ok = RiaApplication::instance()->launchProcess(octavePath, processArguments);
|
||||
}
|
||||
else
|
||||
{
|
||||
ok = RiaApplication::instance()->launchProcessForMultipleCases(octavePath, processArguments, m_caseIds());
|
||||
}
|
||||
if (!ok)
|
||||
{
|
||||
RiaLogging::error(QString("runOctaveScript: Could not execute script %1").arg(m_path()));
|
||||
}
|
||||
else
|
||||
{
|
||||
RiaApplication::instance()->waitForProcess();
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user