Manual copy of code from release-2019.11

This commit is contained in:
Magne Sjaastad 2019-12-18 15:44:48 +01:00
parent fa27234e6c
commit 3100ed655d
3779 changed files with 193129 additions and 164014 deletions

View File

@ -15,6 +15,6 @@ build_script:
if exist "%QT5%" set Path=%QT5%\bin;%Path% if exist "%QT5%" set Path=%QT5%\bin;%Path%
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Release -DRESINSIGHT_ENABLE_COTIRE=on "-DCMAKE_PREFIX_PATH=%QT5%" .. cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Release -DRESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS=true -DRESINSIGHT_ENABLE_COTIRE=on "-DCMAKE_PREFIX_PATH=%QT5%" ..
cmake --build . --target ResInsight_unity --config Release cmake --build . --target ResInsight_unity --config Release

3
.gitignore vendored
View File

@ -69,3 +69,6 @@ Ankh.NoLoad
/Resinsight_Host.creator /Resinsight_Host.creator
/Resinsight_Host.config /Resinsight_Host.config
*.RESINSIGHT_IDX *.RESINSIGHT_IDX
#Python
*.pyc

View File

@ -28,7 +28,7 @@ script:
- mkdir -p build - mkdir -p build
- cd build - cd build
- cmake -DRESINSIGHT_ENABLE_COTIRE=true .. - cmake -DRESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS=true -DRESINSIGHT_ENABLE_COTIRE=true ..
# Build the default target # Build the default target
#- make -j8 #- make -j8

View File

@ -20,25 +20,13 @@ AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true AlwaysBreakTemplateDeclarations: true
BinPackArguments: false BinPackArguments: false
BinPackParameters: false BinPackParameters: false
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 BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom BreakBeforeBraces: Allman
BreakBeforeTernaryOperators: true BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true BreakConstructorInitializersBeforeComma: true
BreakAfterJavaFieldAnnotations: false BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true BreakStringLiterals: true
ColumnLimit: 130 ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:' CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: false ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4 ConstructorInitializerIndentWidth: 4
@ -64,17 +52,18 @@ MacroBlockBegin: ''
MacroBlockEnd: '' MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1 MaxEmptyLinesToKeep: 1
NamespaceIndentation: Inner NamespaceIndentation: Inner
PenaltyBreakBeforeFirstCallParameter: 19 PenaltyBreakAssignment: 130
PenaltyBreakBeforeFirstCallParameter: 100000
PenaltyBreakComment: 300 PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120 PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000 PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000 PenaltyExcessCharacter: 10
PenaltyReturnTypeOnItsOwnLine: 60 PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left PointerAlignment: Left
ReflowComments: true ReflowComments: true
SortIncludes: true SortIncludes: true
SpaceAfterCStyleCast: false SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: false SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false SpaceInEmptyParentheses: false
@ -82,7 +71,7 @@ SpacesBeforeTrailingComments: 1
SpacesInAngles: false SpacesInAngles: false
SpacesInContainerLiterals: false SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false SpacesInCStyleCastParentheses: false
SpacesInParentheses: false SpacesInParentheses: true
SpacesInSquareBrackets: false SpacesInSquareBrackets: false
Standard: Cpp11 Standard: Cpp11
TabWidth: 4 TabWidth: 4

View File

@ -18,9 +18,7 @@
#pragma once #pragma once
// Company and Application name // Company and Application name
// These two together will become the registry key // These two together will become the registry key
const char RI_COMPANY_NAME[] = "Ceetron"; const char RI_COMPANY_NAME[] = "Ceetron";
const char RI_APPLICATION_NAME[] = "ResInsight"; const char RI_APPLICATION_NAME[] = "ResInsight";

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -12,10 +12,12 @@ ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveDefinition.h
${CMAKE_CURRENT_LIST_DIR}/RiaCurveSetDefinition.h ${CMAKE_CURRENT_LIST_DIR}/RiaCurveSetDefinition.h
${CMAKE_CURRENT_LIST_DIR}/RiaRftPltCurveDefinition.h ${CMAKE_CURRENT_LIST_DIR}/RiaRftPltCurveDefinition.h
${CMAKE_CURRENT_LIST_DIR}/RiaViewRedrawScheduler.h ${CMAKE_CURRENT_LIST_DIR}/RiaViewRedrawScheduler.h
${CMAKE_CURRENT_LIST_DIR}/RiaPlotWindowRedrawScheduler.h
${CMAKE_CURRENT_LIST_DIR}/RiaMemoryCleanup.h ${CMAKE_CURRENT_LIST_DIR}/RiaMemoryCleanup.h
${CMAKE_CURRENT_LIST_DIR}/RiaFontCache.h ${CMAKE_CURRENT_LIST_DIR}/RiaFontCache.h
${CMAKE_CURRENT_LIST_DIR}/RiaEclipseFileNameTools.h ${CMAKE_CURRENT_LIST_DIR}/RiaEclipseFileNameTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaFeatureCommandContext.h ${CMAKE_CURRENT_LIST_DIR}/RiaFeatureCommandContext.h
${CMAKE_CURRENT_LIST_DIR}/RiaStringListSerializer.h
) )
set (SOURCE_GROUP_SOURCE_FILES set (SOURCE_GROUP_SOURCE_FILES
@ -32,10 +34,12 @@ ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveDefinition.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaCurveSetDefinition.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaCurveSetDefinition.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaRftPltCurveDefinition.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaRftPltCurveDefinition.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaViewRedrawScheduler.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaViewRedrawScheduler.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaPlotWindowRedrawScheduler.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaMemoryCleanup.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaMemoryCleanup.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaFontCache.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaFontCache.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaEclipseFileNameTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaEclipseFileNameTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaFeatureCommandContext.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaFeatureCommandContext.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaStringListSerializer.cpp
) )
list(APPEND CODE_HEADER_FILES list(APPEND CODE_HEADER_FILES
@ -52,6 +56,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiaConsoleApplication.h
${CMAKE_CURRENT_LIST_DIR}/RiaGuiApplication.h ${CMAKE_CURRENT_LIST_DIR}/RiaGuiApplication.h
${CMAKE_CURRENT_LIST_DIR}/RiaCompletionTypeCalculationScheduler.h ${CMAKE_CURRENT_LIST_DIR}/RiaCompletionTypeCalculationScheduler.h
${CMAKE_CURRENT_LIST_DIR}/RiaViewRedrawScheduler.h ${CMAKE_CURRENT_LIST_DIR}/RiaViewRedrawScheduler.h
${CMAKE_CURRENT_LIST_DIR}/RiaPlotWindowRedrawScheduler.h
) )

View File

@ -32,9 +32,9 @@
#include "ExportCommands/RicSnapshotAllViewsToFileFeature.h" #include "ExportCommands/RicSnapshotAllViewsToFileFeature.h"
#include "HoloLensCommands/RicHoloLensSessionManager.h" #include "HoloLensCommands/RicHoloLensSessionManager.h"
#include "RicImportGeneralDataFeature.h"
#include "RicfCommandFileExecutor.h" #include "RicfCommandFileExecutor.h"
#include "RicfMessages.h" #include "RicfMessages.h"
#include "RicImportGeneralDataFeature.h"
#include "Rim2dIntersectionViewCollection.h" #include "Rim2dIntersectionViewCollection.h"
#include "RimAnnotationCollection.h" #include "RimAnnotationCollection.h"
@ -55,8 +55,9 @@
#include "RimGridCrossPlotCollection.h" #include "RimGridCrossPlotCollection.h"
#include "RimIdenticalGridCaseGroup.h" #include "RimIdenticalGridCaseGroup.h"
#include "RimMainPlotCollection.h" #include "RimMainPlotCollection.h"
#include "RimObservedData.h"
#include "RimObservedDataCollection.h" #include "RimObservedDataCollection.h"
#include "RimObservedFmuRftData.h"
#include "RimObservedSummaryData.h"
#include "RimOilField.h" #include "RimOilField.h"
#include "RimPltPlotCollection.h" #include "RimPltPlotCollection.h"
#include "RimProject.h" #include "RimProject.h"
@ -83,6 +84,9 @@
#include "RimWellPltPlot.h" #include "RimWellPltPlot.h"
#include "RimWellRftPlot.h" #include "RimWellRftPlot.h"
#include "RiuViewer.h"
#include "RiuViewerCommands.h"
#include "cafPdmSettings.h" #include "cafPdmSettings.h"
#include "cafPdmUiModelChangeDetector.h" #include "cafPdmUiModelChangeDetector.h"
#include "cafProgressInfo.h" #include "cafProgressInfo.h"
@ -149,6 +153,9 @@ RiaApplication::RiaApplication()
RiaApplication::~RiaApplication() RiaApplication::~RiaApplication()
{ {
delete m_preferences; delete m_preferences;
delete m_project;
RiaFontCache::clear();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -257,6 +264,26 @@ RimGridView* RiaApplication::activeGridView()
return dynamic_cast<RimGridView*>( m_activeReservoirView.p() ); return dynamic_cast<RimGridView*>( m_activeReservoirView.p() );
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridView* RiaApplication::activeMainOrComparisonGridView()
{
RimGridView* activeView = RiaApplication::instance()->activeGridView();
RimGridView* viewOrComparisonView = activeView;
if ( activeView != nullptr && activeView->viewer() &&
activeView->viewer()->viewerCommands()->isCurrentPickInComparisonView() )
{
if ( RimGridView* compView = dynamic_cast<RimGridView*>( activeView->activeComparisonView() ) )
{
viewOrComparisonView = compView;
}
}
return viewOrComparisonView;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -289,7 +316,7 @@ bool RiaApplication::openFile(const QString& fileName)
} }
else if ( fileType & RiaDefines::ANY_ECLIPSE_FILE ) else if ( fileType & RiaDefines::ANY_ECLIPSE_FILE )
{ {
loadingSucceded = RicImportGeneralDataFeature::openEclipseFilesFromFileNames(QStringList{fileName}); loadingSucceded = RicImportGeneralDataFeature::openEclipseFilesFromFileNames( QStringList{fileName}, true );
lastUsedDialogTag = RiaDefines::defaultDirectoryLabel( fileType ); lastUsedDialogTag = RiaDefines::defaultDirectoryLabel( fileType );
} }
@ -297,7 +324,8 @@ bool RiaApplication::openFile(const QString& fileName)
{ {
if ( !lastUsedDialogTag.isEmpty() ) if ( !lastUsedDialogTag.isEmpty() )
{ {
RiaApplication::instance()->setLastUsedDialogDirectory(lastUsedDialogTag, QFileInfo(fileName).absolutePath()); RiaApplication::instance()->setLastUsedDialogDirectory( lastUsedDialogTag,
QFileInfo( fileName ).absolutePath() );
} }
onFileSuccessfullyLoaded( fileName, fileType ); onFileSuccessfullyLoaded( fileName, fileType );
@ -406,8 +434,8 @@ bool RiaApplication::loadProject(const QString& projectFileName,
{ {
closeProject(); closeProject();
QString errMsg = QString errMsg = QString( "Unknown project file version detected in file \n%1\n\nCould not open project." )
QString("Unknown project file version detected in file \n%1\n\nCould not open project.").arg(fullPathProjectFileName); .arg( fullPathProjectFileName );
onProjectOpeningError( errMsg ); onProjectOpeningError( errMsg );
@ -426,7 +454,7 @@ bool RiaApplication::loadProject(const QString& projectFileName,
// VL check regarding specific order mentioned in comment above... // VL check regarding specific order mentioned in comment above...
m_preferences->lastUsedProjectFileName = fullPathProjectFileName; m_preferences->lastUsedProjectFileName = fullPathProjectFileName;
caf::PdmSettings::writeFieldsToApplicationStore(m_preferences); m_preferences->writePreferencesToApplicationStore();
for ( size_t oilFieldIdx = 0; oilFieldIdx < m_project->oilFields().size(); oilFieldIdx++ ) for ( size_t oilFieldIdx = 0; oilFieldIdx < m_project->oilFields().size(); oilFieldIdx++ )
{ {
@ -485,11 +513,16 @@ bool RiaApplication::loadProject(const QString& projectFileName,
{ {
oilField->observedDataCollection = new RimObservedDataCollection(); oilField->observedDataCollection = new RimObservedDataCollection();
} }
for (RimObservedData* observedData : oilField->observedDataCollection()->allObservedData()) for ( RimObservedSummaryData* observedData : oilField->observedDataCollection()->allObservedSummaryData() )
{ {
observedData->createSummaryReaderInterface(); observedData->createSummaryReaderInterface();
observedData->createRftReaderInterface();
observedData->updateMetaData(); observedData->updateMetaData();
} }
for ( RimObservedFmuRftData* observedFmuData : oilField->observedDataCollection()->allObservedFmuRftData() )
{
observedFmuData->createRftReaderInterface();
}
oilField->fractureDefinitionCollection()->loadAndUpdateData(); oilField->fractureDefinitionCollection()->loadAndUpdateData();
oilField->fractureDefinitionCollection()->createAndAssignTemplateCopyForNonMatchingUnit(); oilField->fractureDefinitionCollection()->createAndAssignTemplateCopyForNonMatchingUnit();
@ -639,6 +672,25 @@ bool RiaApplication::loadProject(const QString& projectFileName)
return loadProject( projectFileName, PLA_NONE, nullptr ); return loadProject( projectFileName, PLA_NONE, nullptr );
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaApplication::saveProject( QString* errorMessage )
{
CAF_ASSERT( errorMessage );
CAF_ASSERT( m_project.notNull() );
if ( !isProjectSavedToDisc() )
{
*errorMessage = "Project hasn't already been saved and no file name has been provided";
return false;
}
else
{
return saveProjectAs( m_project->fileName(), errorMessage );
}
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -647,18 +699,21 @@ bool RiaApplication::saveProjectAs(const QString& fileName, QString* errorMessag
// Make sure we always store path with forward slash to avoid issues when opening the project file on Linux // Make sure we always store path with forward slash to avoid issues when opening the project file on Linux
m_project->fileName = RiaFilePathTools::toInternalSeparator( fileName ); m_project->fileName = RiaFilePathTools::toInternalSeparator( fileName );
onProjectBeingSaved();
if ( !m_project->writeFile() ) if ( !m_project->writeFile() )
{ {
CAF_ASSERT( errorMessage ); CAF_ASSERT( errorMessage );
*errorMessage = *errorMessage = QString( "Not possible to save project file. Make sure you have sufficient access "
QString("Not possible to save project file. Make sure you have sufficient access rights.\n\nProject file location : %1") "rights.\n\nProject file location : %1" )
.arg( fileName ); .arg( fileName );
return false; return false;
} }
m_preferences->lastUsedProjectFileName = fileName; m_preferences->lastUsedProjectFileName = fileName;
caf::PdmSettings::writeFieldsToApplicationStore(m_preferences); m_preferences->writePreferencesToApplicationStore();
onProjectSaved();
return true; return true;
} }
@ -758,9 +813,10 @@ bool RiaApplication::openOdbCaseFromFile(const QString& fileName, bool applyTime
geoMechCase->setFileName( fileName ); geoMechCase->setFileName( fileName );
geoMechCase->caseUserDescription = caseName; geoMechCase->caseUserDescription = caseName;
geoMechCase->setApplyTimeFilter( applyTimeStepFilter ); geoMechCase->setApplyTimeFilter( applyTimeStepFilter );
m_project->assignCaseIdToCase( geoMechCase );
RimGeoMechModels* geoMechModelCollection = RimGeoMechModels* geoMechModelCollection = m_project->activeOilField() ? m_project->activeOilField()->geoMechModels()
m_project->activeOilField() ? m_project->activeOilField()->geoMechModels() : nullptr; : nullptr;
// Create the geoMech model container if it is not there already // Create the geoMech model container if it is not there already
if ( geoMechModelCollection == nullptr ) if ( geoMechModelCollection == nullptr )
@ -793,12 +849,15 @@ bool RiaApplication::openOdbCaseFromFile(const QString& fileName, bool applyTime
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Add a list of well path file paths (JSON files) to the well path collection /// Add a list of well path file paths (JSON files) to the well path collection
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiaApplication::addWellPathsToModel(QList<QString> wellPathFilePaths) std::vector<RimWellPath*> RiaApplication::addWellPathsToModel( QList<QString> wellPathFilePaths,
QStringList* errorMessages )
{ {
if (m_project == nullptr || m_project->oilFields.size() < 1) return; CAF_ASSERT( errorMessages );
if ( m_project == nullptr || m_project->oilFields.size() < 1 ) return {};
RimOilField* oilField = m_project->activeOilField(); RimOilField* oilField = m_project->activeOilField();
if (oilField == nullptr) return; if ( oilField == nullptr ) return {};
if ( oilField->wellPathCollection == nullptr ) if ( oilField->wellPathCollection == nullptr )
{ {
@ -808,9 +867,15 @@ void RiaApplication::addWellPathsToModel(QList<QString> wellPathFilePaths)
m_project->updateConnectedEditors(); m_project->updateConnectedEditors();
} }
if (oilField->wellPathCollection) oilField->wellPathCollection->addWellPaths(wellPathFilePaths); std::vector<RimWellPath*> wellPaths;
if ( oilField->wellPathCollection )
{
wellPaths = oilField->wellPathCollection->addWellPaths( wellPathFilePaths, errorMessages );
}
oilField->wellPathCollection->updateConnectedEditors(); oilField->wellPathCollection->updateConnectedEditors();
return wellPaths;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -841,12 +906,15 @@ void RiaApplication::addWellPathFormationsToModel(QList<QString> wellPathFormati
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Add a list of well log file paths (LAS files) to the well path collection /// Add a list of well log file paths (LAS files) to the well path collection
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiaApplication::addWellLogsToModel(const QList<QString>& wellLogFilePaths) std::vector<RimWellLogFile*> RiaApplication::addWellLogsToModel( const QList<QString>& wellLogFilePaths,
QStringList* errorMessages )
{ {
if (m_project == nullptr || m_project->oilFields.size() < 1) return; CAF_ASSERT( errorMessages );
if ( m_project == nullptr || m_project->oilFields.size() < 1 ) return {};
RimOilField* oilField = m_project->activeOilField(); RimOilField* oilField = m_project->activeOilField();
if (oilField == nullptr) return; if ( oilField == nullptr ) return {};
if ( oilField->wellPathCollection == nullptr ) if ( oilField->wellPathCollection == nullptr )
{ {
@ -855,9 +923,12 @@ void RiaApplication::addWellLogsToModel(const QList<QString>& wellLogFilePaths)
m_project->updateConnectedEditors(); m_project->updateConnectedEditors();
} }
oilField->wellPathCollection->addWellLogs(wellLogFilePaths); std::vector<RimWellLogFile*> wellLogFiles = oilField->wellPathCollection->addWellLogs( wellLogFilePaths,
errorMessages );
oilField->wellPathCollection->updateConnectedEditors(); oilField->wellPathCollection->updateConnectedEditors();
return wellLogFiles;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -976,7 +1047,8 @@ QProcessEnvironment RiaApplication::pythonProcessEnvironment() const
<< QCoreApplication::applicationDirPath() + "/../../Python"; << QCoreApplication::applicationDirPath() + "/../../Python";
separator = ":"; separator = ":";
#endif #endif
penv.insert("PYTHONPATH", QString("%1%2%3").arg(penv.value("PYTHONPATH")).arg(separator).arg(ripsLocations.join(separator))); penv.insert( "PYTHONPATH",
QString( "%1%2%3" ).arg( penv.value( "PYTHONPATH" ) ).arg( separator ).arg( ripsLocations.join( separator ) ) );
#endif #endif
return penv; return penv;
} }
@ -984,7 +1056,9 @@ QProcessEnvironment RiaApplication::pythonProcessEnvironment() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RiaApplication::launchProcess(const QString& program, const QStringList& arguments, const QProcessEnvironment& processEnvironment) bool RiaApplication::launchProcess( const QString& program,
const QStringList& arguments,
const QProcessEnvironment& processEnvironment )
{ {
if ( m_workerProcess == nullptr ) if ( m_workerProcess == nullptr )
{ {
@ -1015,8 +1089,8 @@ bool RiaApplication::launchProcess(const QString& program, const QStringList& ar
m_workerProcess->start( program, arguments ); m_workerProcess->start( program, arguments );
// The wait time is a compromise between large wait time when processing many octave runs after each other and short wait // The wait time is a compromise between large wait time when processing many octave runs after each other and
// time when starting octave processes interactively // short wait time when starting octave processes interactively
int waitTimeMilliseconds = 7 * 1000; int waitTimeMilliseconds = 7 * 1000;
if ( !m_workerProcess->waitForStarted( waitTimeMilliseconds ) ) if ( !m_workerProcess->waitForStarted( waitTimeMilliseconds ) )
{ {
@ -1089,7 +1163,6 @@ void RiaApplication::waitForProcess() const
} }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -1101,7 +1174,7 @@ RiaPreferences* RiaApplication::preferences()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiaApplication::applyPreferences(const RiaPreferences* oldPreferences) void RiaApplication::applyPreferences()
{ {
// The creation of a font is time consuming, so make sure you really need your own font // The creation of a font is time consuming, so make sure you really need your own font
// instead of using the application font // instead of using the application font
@ -1114,18 +1187,20 @@ void RiaApplication::applyPreferences(const RiaPreferences* oldPreferences)
if ( this->project() ) if ( this->project() )
{ {
this->project()->setScriptDirectories( m_preferences->scriptDirectories() ); this->project()->setScriptDirectories( m_preferences->scriptDirectories() );
this->project()->setPlotTemplateFolders( m_preferences->plotTemplateFolders() );
this->project()->updateConnectedEditors(); this->project()->updateConnectedEditors();
} }
caf::PdmSettings::writeFieldsToApplicationStore(m_preferences);
}
m_preferences->writePreferencesToApplicationStore();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RiaApplication::commandLineParameterHelp() QString RiaApplication::commandLineParameterHelp()
{ {
QString helpText = QString("\n%1 v. %2\n").arg(RI_APPLICATION_NAME).arg(RiaApplication::getVersionStringApp(false)); QString helpText =
QString( "\n%1 v. %2\n" ).arg( RI_APPLICATION_NAME ).arg( RiaApplication::getVersionStringApp( false ) );
helpText += "Copyright Equinor ASA, Ceetron Solution AS, Ceetron AS\n\n"; helpText += "Copyright Equinor ASA, Ceetron Solution AS, Ceetron AS\n\n";
helpText += m_commandLineHelpText; helpText += m_commandLineHelpText;
@ -1407,11 +1482,12 @@ void RiaApplication::initialize()
m_preferences = new RiaPreferences; m_preferences = new RiaPreferences;
caf::PdmSettings::readFieldsFromApplicationStore( m_preferences ); caf::PdmSettings::readFieldsFromApplicationStore( m_preferences );
m_preferences->initAfterReadRecursively(); m_preferences->initAfterReadRecursively();
applyPreferences(nullptr); applyPreferences();
// Start with a project // Start with a project
m_project = new RimProject; m_project = new RimProject;
m_project->setScriptDirectories( m_preferences->scriptDirectories() ); m_project->setScriptDirectories( m_preferences->scriptDirectories() );
m_project->setPlotTemplateFolders( m_preferences->plotTemplateFolders() );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -26,7 +26,7 @@
#include "cafPdmField.h" #include "cafPdmField.h"
#include "cafPdmObject.h" #include "cafPdmObject.h"
#include "cvfBase.h"
#include "cvfFont.h" #include "cvfFont.h"
#include "cvfObject.h" #include "cvfObject.h"
@ -54,11 +54,13 @@ class RigEclipseCaseData;
class RimCommandObject; class RimCommandObject;
class RimEclipseCase; class RimEclipseCase;
class RimEclipseView; class RimEclipseView;
class RimWellPath;
class RimGridView; class RimGridView;
class RimProject; class RimProject;
class RimSummaryPlot; class RimSummaryPlot;
class Rim3dView; class Rim3dView;
class RimViewWindow; class RimViewWindow;
class RimWellLogFile;
class RimWellLogPlot; class RimWellLogPlot;
class RimWellAllocationPlot; class RimWellAllocationPlot;
@ -110,6 +112,7 @@ public:
Rim3dView* activeReservoirView(); Rim3dView* activeReservoirView();
const Rim3dView* activeReservoirView() const; const Rim3dView* activeReservoirView() const;
RimGridView* activeGridView(); RimGridView* activeGridView();
RimGridView* activeMainOrComparisonGridView();
RimProject* project(); RimProject* project();
@ -124,9 +127,13 @@ public:
bool isProjectSavedToDisc() const; bool isProjectSavedToDisc() const;
QString currentProjectPath() const; QString currentProjectPath() const;
QString createAbsolutePathFromProjectRelativePath( QString projectRelativePath ); QString createAbsolutePathFromProjectRelativePath( QString projectRelativePath );
bool loadProject( const QString& projectFileName ); bool loadProject( const QString& projectFileName );
bool loadProject( const QString& projectFileName, ProjectLoadAction loadAction, RiaProjectModifier* projectModifier ); bool loadProject( const QString& projectFileName, ProjectLoadAction loadAction, RiaProjectModifier* projectModifier );
bool saveProject( QString* errorMessage );
bool saveProjectAs( const QString& fileName, QString* errorMessage ); bool saveProjectAs( const QString& fileName, QString* errorMessage );
static bool hasValidProjectFileExtension( const QString& fileName ); static bool hasValidProjectFileExtension( const QString& fileName );
void closeProject(); void closeProject();
@ -137,9 +144,9 @@ public:
bool openOdbCaseFromFile( const QString& fileName, bool applyTimeStepFilter = false ); bool openOdbCaseFromFile( const QString& fileName, bool applyTimeStepFilter = false );
void addWellPathsToModel(QList<QString> wellPathFilePaths); std::vector<RimWellPath*> addWellPathsToModel( QList<QString> wellPathFilePaths, QStringList* errorMessages );
void addWellPathFormationsToModel( QList<QString> wellPathFilePaths ); void addWellPathFormationsToModel( QList<QString> wellPathFilePaths );
void addWellLogsToModel(const QList<QString>& wellLogFilePaths); std::vector<RimWellLogFile*> addWellLogsToModel( const QList<QString>& wellLogFilePaths, QStringList* errorMessages );
QString scriptDirectories() const; QString scriptDirectories() const;
QString scriptEditorPath() const; QString scriptEditorPath() const;
@ -151,13 +158,18 @@ public:
QString pythonPath() const; QString pythonPath() const;
QProcessEnvironment pythonProcessEnvironment() const; QProcessEnvironment pythonProcessEnvironment() const;
bool launchProcess(const QString& program, const QStringList& arguments, const QProcessEnvironment& processEnvironment); bool launchProcess( const QString& program,
bool launchProcessForMultipleCases(const QString& program, const QStringList& arguments, const std::vector<int>& caseIds, const QProcessEnvironment& processEnvironment); const QStringList& arguments,
const QProcessEnvironment& processEnvironment );
bool launchProcessForMultipleCases( const QString& program,
const QStringList& arguments,
const std::vector<int>& caseIds,
const QProcessEnvironment& processEnvironment );
void terminateProcess(); void terminateProcess();
void waitForProcess() const; void waitForProcess() const;
RiaPreferences* preferences(); RiaPreferences* preferences();
void applyPreferences(const RiaPreferences* oldPreferences = nullptr); void applyPreferences();
QString commandLineParameterHelp(); QString commandLineParameterHelp();
void setCommandLineHelpText( const QString& commandLineHelpText ); void setCommandLineHelpText( const QString& commandLineHelpText );
@ -199,11 +211,15 @@ protected:
// Protected implementation specific overrides // Protected implementation specific overrides
virtual void invokeProcessEvents( QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents ) = 0; virtual void invokeProcessEvents( QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents ) = 0;
virtual void onFileSuccessfullyLoaded( const QString& fileName, RiaDefines::ImportFileType fileType ) {} virtual void onFileSuccessfullyLoaded( const QString& fileName, RiaDefines::ImportFileType fileType ) {}
virtual void onProjectBeingOpened() {} virtual void onProjectBeingOpened() {}
virtual void onProjectOpened() = 0; virtual void onProjectOpened() = 0;
virtual void onProjectOpeningError( const QString& errMsg ) = 0; virtual void onProjectOpeningError( const QString& errMsg ) = 0;
virtual void onProjectBeingClosed() {} virtual void onProjectBeingClosed() {}
virtual void onProjectClosed() = 0; virtual void onProjectClosed() = 0;
virtual void onProjectBeingSaved() {}
virtual void onProjectSaved() {}
virtual void startMonitoringWorkProgress( caf::UiProcess* uiProcess ) {} virtual void startMonitoringWorkProgress( caf::UiProcess* uiProcess ) {}
virtual void stopMonitoringWorkProgress() {} virtual void stopMonitoringWorkProgress() {}
@ -241,6 +257,3 @@ protected:
private: private:
static RiaApplication* s_riaApplication; static RiaApplication* s_riaApplication;
}; };

View File

@ -20,8 +20,8 @@
#include "RiaApplication.h" #include "RiaApplication.h"
#include "RigEclipseCaseData.h"
#include "RigCaseCellResultsData.h" #include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RimEclipseCase.h" #include "RimEclipseCase.h"
#include "RimEclipseCaseCollection.h" #include "RimEclipseCaseCollection.h"
@ -37,8 +37,8 @@
#include <QTimer> #include <QTimer>
#include <QTreeView> #include <QTreeView>
#include <set>
#include "cafProgressState.h" #include "cafProgressState.h"
#include <set>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -84,7 +84,9 @@ void RiaCompletionTypeCalculationScheduler::scheduleRecalculateCompletionTypeAnd
if ( eclipseCase->eclipseCaseData() ) if ( eclipseCase->eclipseCaseData() )
{ {
eclipseCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->clearScalarResult(RiaDefines::DYNAMIC_NATIVE, RiaDefines::completionTypeResultName()); eclipseCase->eclipseCaseData()
->results( RiaDefines::MATRIX_MODEL )
->clearScalarResult( RiaDefines::DYNAMIC_NATIVE, RiaDefines::completionTypeResultName() );
// Delete virtual perforation transmissibilities, as these are the basis for the computation of completion type // Delete virtual perforation transmissibilities, as these are the basis for the computation of completion type
eclipseCase->eclipseCaseData()->setVirtualPerforationTransmissibilities( nullptr ); eclipseCase->eclipseCaseData()->setVirtualPerforationTransmissibilities( nullptr );

View File

@ -30,6 +30,7 @@ class RimEclipseCase;
class RiaCompletionTypeCalculationScheduler : public QObject class RiaCompletionTypeCalculationScheduler : public QObject
{ {
Q_OBJECT; Q_OBJECT;
public: public:
static RiaCompletionTypeCalculationScheduler* instance(); static RiaCompletionTypeCalculationScheduler* instance();
void scheduleRecalculateCompletionTypeAndRedrawAllViews(); void scheduleRecalculateCompletionTypeAndRedrawAllViews();
@ -39,7 +40,10 @@ private slots:
void slotRecalculateCompletionType(); void slotRecalculateCompletionType();
private: private:
RiaCompletionTypeCalculationScheduler() : m_recalculateCompletionTypeTimer(nullptr) {} RiaCompletionTypeCalculationScheduler()
: m_recalculateCompletionTypeTimer( nullptr )
{
}
~RiaCompletionTypeCalculationScheduler() override; ~RiaCompletionTypeCalculationScheduler() override;
RiaCompletionTypeCalculationScheduler( const RiaCompletionTypeCalculationScheduler& o ) = delete; RiaCompletionTypeCalculationScheduler( const RiaCompletionTypeCalculationScheduler& o ) = delete;
@ -53,5 +57,3 @@ private:
std::vector<caf::PdmPointer<RimEclipseCase>> m_eclipseCasesToRecalculate; std::vector<caf::PdmPointer<RimEclipseCase>> m_eclipseCasesToRecalculate;
QTimer* m_recalculateCompletionTypeTimer; QTimer* m_recalculateCompletionTypeTimer;
}; };

View File

@ -125,8 +125,8 @@ RiaApplication::ApplicationStatus RiaConsoleApplication::handleArguments(cvf::Pr
if ( progOpt->option( "help" ) || progOpt->option( "?" ) ) if ( progOpt->option( "help" ) || progOpt->option( "?" ) )
{ {
this->showFormattedTextInMessageBoxOrConsole("\nThe current command line options in ResInsight are:\n" this->showFormattedTextInMessageBoxOrConsole( "\nThe current command line options in ResInsight are:\n" +
+ this->commandLineParameterHelp()); this->commandLineParameterHelp() );
return RiaApplication::EXIT_COMPLETED; return RiaApplication::EXIT_COMPLETED;
} }
@ -205,7 +205,8 @@ RiaApplication::ApplicationStatus RiaConsoleApplication::handleArguments(cvf::Pr
{ {
// One argument is available, use replace case for first occurrence in the project // One argument is available, use replace case for first occurrence in the project
std::vector<QString> gridFileNames = readFileListFromTextFile(cvfqt::Utils::toQString(o.safeValue(0))); std::vector<QString> gridFileNames = readFileListFromTextFile(
cvfqt::Utils::toQString( o.safeValue( 0 ) ) );
projectModifier->setReplaceSourceCasesFirstOccurrence( gridFileNames ); projectModifier->setReplaceSourceCasesFirstOccurrence( gridFileNames );
} }
else else
@ -214,8 +215,8 @@ RiaApplication::ApplicationStatus RiaConsoleApplication::handleArguments(cvf::Pr
while ( optionIdx < o.valueCount() ) while ( optionIdx < o.valueCount() )
{ {
const int groupId = o.safeValue( optionIdx++ ).toInt( -1 ); const int groupId = o.safeValue( optionIdx++ ).toInt( -1 );
std::vector<QString> gridFileNames = std::vector<QString> gridFileNames = readFileListFromTextFile(
readFileListFromTextFile(cvfqt::Utils::toQString(o.safeValue(optionIdx++))); cvfqt::Utils::toQString( o.safeValue( optionIdx++ ) ) );
if ( groupId != -1 && !gridFileNames.empty() ) if ( groupId != -1 && !gridFileNames.empty() )
{ {
@ -257,9 +258,10 @@ RiaApplication::ApplicationStatus RiaConsoleApplication::handleArguments(cvf::Pr
if ( cvf::Option o = progOpt->option( "case" ) ) if ( cvf::Option o = progOpt->option( "case" ) )
{ {
QStringList fileNames = RicImportGeneralDataFeature::fileNamesFromCaseNames(cvfqt::Utils::toQStringList(o.values())); QStringList fileNames = RicImportGeneralDataFeature::fileNamesFromCaseNames(
RicImportGeneralDataFeature::OpenCaseResults results = cvfqt::Utils::toQStringList( o.values() ) );
RicImportGeneralDataFeature::openEclipseFilesFromFileNames(fileNames);
RicImportGeneralDataFeature::openEclipseFilesFromFileNames( fileNames, true );
} }
if ( cvf::Option o = progOpt->option( "commandFile" ) ) if ( cvf::Option o = progOpt->option( "commandFile" ) )
@ -416,7 +418,6 @@ void RiaConsoleApplication::onProjectClosed()
processEvents(); processEvents();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -52,8 +52,8 @@ protected:
// Protected implementation specific overrides // Protected implementation specific overrides
void invokeProcessEvents( QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents ) override; void invokeProcessEvents( QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents ) override;
void onProjectOpeningError( const QString& errMsg ) override; void onProjectOpeningError( const QString& errMsg ) override;
void onProjectOpened(); void onProjectOpened() override;
void onProjectClosed(); void onProjectClosed() override;
private slots: private slots:
void runIdleProcessing(); void runIdleProcessing();
@ -63,4 +63,3 @@ private:
QPointer<QTimer> m_idleTimer; QPointer<QTimer> m_idleTimer;
#endif #endif
}; };

View File

@ -21,24 +21,22 @@
#include "RifSummaryReaderInterface.h" #include "RifSummaryReaderInterface.h"
#include "RimSummaryCaseCollection.h" #include "RimSummaryCaseCollection.h"
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RiaCurveSetDefinition::RiaCurveSetDefinition() : RiaCurveSetDefinition::RiaCurveSetDefinition()
m_ensemble(nullptr) : m_ensemble( nullptr )
{ {
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RiaCurveSetDefinition::RiaCurveSetDefinition(RimSummaryCaseCollection* ensemble, const RifEclipseSummaryAddress& summaryAddress) : RiaCurveSetDefinition::RiaCurveSetDefinition( RimSummaryCaseCollection* ensemble,
m_ensemble(ensemble), const RifEclipseSummaryAddress& summaryAddress )
m_summaryAddress(summaryAddress) : m_ensemble( ensemble )
, m_summaryAddress( summaryAddress )
{ {
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -34,8 +34,7 @@ class RiaCurveSetDefinition
{ {
public: public:
RiaCurveSetDefinition(); RiaCurveSetDefinition();
explicit RiaCurveSetDefinition(RimSummaryCaseCollection* emsemble, explicit RiaCurveSetDefinition( RimSummaryCaseCollection* emsemble, const RifEclipseSummaryAddress& summaryAddress );
const RifEclipseSummaryAddress& summaryAddress);
RimSummaryCaseCollection* ensemble() const; RimSummaryCaseCollection* ensemble() const;
const RifEclipseSummaryAddress& summaryAddress() const; const RifEclipseSummaryAddress& summaryAddress() const;

View File

@ -48,6 +48,16 @@ void caf::AppEnum<RiaDefines::DepthUnitType>::setUp()
setDefault( RiaDefines::UNIT_METER ); setDefault( RiaDefines::UNIT_METER );
} }
template <>
void caf::AppEnum<RiaDefines::DepthTypeEnum>::setUp()
{
addItem( RiaDefines::MEASURED_DEPTH, "MEASURED_DEPTH", "Measured Depth" );
addItem( RiaDefines::TRUE_VERTICAL_DEPTH, "TRUE_VERTICAL_DEPTH", "True Vertical Depth (MSL)" );
addItem( RiaDefines::PSEUDO_LENGTH, "PSEUDO_LENGTH", "Pseudo Length" );
addItem( RiaDefines::CONNECTION_NUMBER, "CONNECTION_NUMBER", "Connection Number" );
setDefault( RiaDefines::MEASURED_DEPTH );
}
template <> template <>
void caf::AppEnum<RiaDefines::PlotAxis>::setUp() void caf::AppEnum<RiaDefines::PlotAxis>::setUp()
{ {
@ -400,7 +410,7 @@ QString RiaDefines::activeFormationNamesResultName()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RiaDefines::wellPathAzimuthResultName() QString RiaDefines::wbsAzimuthResultName()
{ {
return "Azimuth"; return "Azimuth";
} }
@ -408,7 +418,7 @@ QString RiaDefines::wellPathAzimuthResultName()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RiaDefines::wellPathInclinationResultName() QString RiaDefines::wbsInclinationResultName()
{ {
return "Inclination"; return "Inclination";
} }
@ -416,7 +426,7 @@ QString RiaDefines::wellPathInclinationResultName()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RiaDefines::wellPathPPResultName() QString RiaDefines::wbsPPResultName()
{ {
return "PP"; return "PP";
} }
@ -424,7 +434,7 @@ QString RiaDefines::wellPathPPResultName()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RiaDefines::wellPathSHResultName() QString RiaDefines::wbsSHResultName()
{ {
return "SH"; return "SH";
} }
@ -432,7 +442,7 @@ QString RiaDefines::wellPathSHResultName()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RiaDefines::wellPathOBGResultName() QString RiaDefines::wbsOBGResultName()
{ {
return "OBG"; return "OBG";
} }
@ -440,7 +450,7 @@ QString RiaDefines::wellPathOBGResultName()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RiaDefines::wellPathFGResultName() QString RiaDefines::wbsFGResultName()
{ {
return "FG"; return "FG";
} }
@ -448,17 +458,33 @@ QString RiaDefines::wellPathFGResultName()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RiaDefines::wellPathSFGResultName() QString RiaDefines::wbsSFGResultName()
{ {
return "SFG"; return "SFG";
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaDefines::wbsPoissonParameterName()
{
return "RATIO";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaDefines::wbsUCSParameterName()
{
return "UCS";
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<QString> RiaDefines::wellPathAngleResultNames() std::vector<QString> RiaDefines::wellPathAngleResultNames()
{ {
return {RiaDefines::wellPathAzimuthResultName(), RiaDefines::wellPathInclinationResultName()}; return {wbsAzimuthResultName(), wbsInclinationResultName()};
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -466,11 +492,15 @@ std::vector<QString> RiaDefines::wellPathAngleResultNames()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<QString> RiaDefines::wellPathStabilityResultNames() std::vector<QString> RiaDefines::wellPathStabilityResultNames()
{ {
return {RiaDefines::wellPathFGResultName(), return {wbsFGResultName(), wbsOBGResultName(), wbsPPResultName(), wbsSFGResultName(), wbsSHResultName()};
RiaDefines::wellPathOBGResultName(), }
RiaDefines::wellPathPPResultName(),
RiaDefines::wellPathSFGResultName(), //--------------------------------------------------------------------------------------------------
RiaDefines::wellPathSHResultName()}; ///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RiaDefines::wellPathStabilityParameterNames()
{
return {wbsPoissonParameterName(), wbsUCSParameterName()};
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -42,7 +42,8 @@ namespace RiaDefines
// WARNING: DO NOT CHANGE THE ORDER WITHOUT KNOWING WHAT YOU ARE DOING! // WARNING: DO NOT CHANGE THE ORDER WITHOUT KNOWING WHAT YOU ARE DOING!
// You may well change the behaviour of property filters. // You may well change the behaviour of property filters.
enum WellPathComponentType { enum WellPathComponentType
{
// Production Tube // Production Tube
WELL_PATH, WELL_PATH,
// Well path flow completions // Well path flow completions
@ -113,17 +114,20 @@ namespace RiaDefines
QString activeFormationNamesResultName(); QString activeFormationNamesResultName();
// Well path derived results // Well path derived results
QString wellPathAzimuthResultName(); QString wbsAzimuthResultName();
QString wellPathInclinationResultName(); QString wbsInclinationResultName();
QString wellPathPPResultName(); QString wbsPPResultName();
QString wellPathSHResultName(); QString wbsSHResultName();
QString wellPathOBGResultName(); QString wbsOBGResultName();
QString wellPathFGResultName(); QString wbsFGResultName();
QString wellPathSFGResultName(); QString wbsSFGResultName();
QString wbsPoissonParameterName();
QString wbsUCSParameterName();
// List of well path derived results // List of well path derived results
std::vector<QString> wellPathAngleResultNames(); std::vector<QString> wellPathAngleResultNames();
std::vector<QString> wellPathStabilityResultNames(); std::vector<QString> wellPathStabilityResultNames();
std::vector<QString> wellPathStabilityParameterNames();
// Units and conversions // Units and conversions
enum DepthUnitType enum DepthUnitType
@ -133,7 +137,14 @@ namespace RiaDefines
UNIT_NONE UNIT_NONE
}; };
// Depth types used for well log plots
enum DepthTypeEnum
{
MEASURED_DEPTH,
TRUE_VERTICAL_DEPTH,
PSEUDO_LENGTH,
CONNECTION_NUMBER
};
// Defines relate to plotting // Defines relate to plotting
enum PlotAxis enum PlotAxis
@ -147,7 +158,8 @@ namespace RiaDefines
double minimumDefaultLogValuePlot(); double minimumDefaultLogValuePlot();
double maximumDefaultValuePlot(); double maximumDefaultValuePlot();
enum PhaseType { enum PhaseType
{
OIL_PHASE, OIL_PHASE,
GAS_PHASE, GAS_PHASE,
WATER_PHASE WATER_PHASE
@ -187,5 +199,4 @@ namespace RiaDefines
PLOT_FONT PLOT_FONT
}; };
}; }; // namespace RiaDefines

View File

@ -106,16 +106,6 @@ bool RiaEclipseFileNameTools::isSummarySpecFile(const QString& fileName)
return hasMatchingSuffix( fileName, ECLIPSE_SMSPEC ); return hasMatchingSuffix( fileName, ECLIPSE_SMSPEC );
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaEclipseFileNameTools::findBaseName(const QString& inputFilePath) const
{
QFileInfo fi(inputFilePath);
return fi.baseName();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -54,7 +54,6 @@ public:
static bool isSummarySpecFile( const QString& fileName ); static bool isSummarySpecFile( const QString& fileName );
private: private:
QString findBaseName(const QString& inputFilePath) const;
QString relatedFilePath( EclipseFileType fileType ) const; QString relatedFilePath( EclipseFileType fileType ) const;
static bool hasMatchingSuffix( const QString& fileName, EclipseFileType fileType ); static bool hasMatchingSuffix( const QString& fileName, EclipseFileType fileType );

View File

@ -31,6 +31,8 @@ class RiaFeatureCommandContext
public: public:
static RiaFeatureCommandContext* instance(); static RiaFeatureCommandContext* instance();
RiaFeatureCommandContext( const RiaFeatureCommandContext& ) = delete;
QObject* object() const; QObject* object() const;
void setObject( QObject* object ); void setObject( QObject* object );
@ -54,7 +56,7 @@ private:
class RiaFeatureCommandContextHelper class RiaFeatureCommandContextHelper
{ {
public: public:
RiaFeatureCommandContextHelper(QObject* externalObject); explicit RiaFeatureCommandContextHelper( QObject* externalObject );
~RiaFeatureCommandContextHelper(); ~RiaFeatureCommandContextHelper();
}; };

View File

@ -36,7 +36,7 @@ void RiaFontCache::FontSizeType::setUp()
setDefault( RiaFontCache::FONT_SIZE_8 ); setDefault( RiaFontCache::FONT_SIZE_8 );
} }
} } // namespace caf
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -129,3 +129,11 @@ RiaFontCache::FontSize RiaFontCache::fontSizeEnumFromPointSize(int pointSize)
} }
return closestEnumValue; return closestEnumValue;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaFontCache::clear()
{
ms_fonts.clear();
}

View File

@ -19,14 +19,15 @@
#pragma once #pragma once
#include "cafFixedAtlasFont.h" #include "cafFixedAtlasFont.h"
#include "cvfBase.h"
#include "cvfObject.h" #include "cvfObject.h"
#include <map> #include <map>
namespace caf namespace caf
{ {
template<typename T> class AppEnum; template <typename T>
class AppEnum;
} }
class RimSummaryCaseCollection; class RimSummaryCaseCollection;
@ -55,6 +56,8 @@ public:
static int pointSizeFromFontSizeEnum( FontSize fontSize ); static int pointSizeFromFontSizeEnum( FontSize fontSize );
static FontSize fontSizeEnumFromPointSize( int pointSize ); static FontSize fontSizeEnumFromPointSize( int pointSize );
static void clear();
private: private:
static std::map<FontSize, cvf::ref<caf::FixedAtlasFont>> ms_fonts; static std::map<FontSize, cvf::ref<caf::FixedAtlasFont>> ms_fonts;
}; };

View File

@ -27,6 +27,7 @@
#include "RiaFontCache.h" #include "RiaFontCache.h"
#include "RiaImportEclipseCaseTools.h" #include "RiaImportEclipseCaseTools.h"
#include "RiaLogging.h" #include "RiaLogging.h"
#include "RiaPlotWindowRedrawScheduler.h"
#include "RiaPreferences.h" #include "RiaPreferences.h"
#include "RiaProjectModifier.h" #include "RiaProjectModifier.h"
#include "RiaRegressionTestRunner.h" #include "RiaRegressionTestRunner.h"
@ -39,6 +40,7 @@
#include "ExportCommands/RicSnapshotViewToFileFeature.h" #include "ExportCommands/RicSnapshotViewToFileFeature.h"
#include "HoloLensCommands/RicHoloLensSessionManager.h" #include "HoloLensCommands/RicHoloLensSessionManager.h"
#include "RicImportGeneralDataFeature.h" #include "RicImportGeneralDataFeature.h"
#include "SummaryPlotCommands/RicSummaryPlotFeatureImpl.h"
#include "Rim2dIntersectionViewCollection.h" #include "Rim2dIntersectionViewCollection.h"
#include "RimAnnotationCollection.h" #include "RimAnnotationCollection.h"
@ -57,10 +59,11 @@
#include "RimGeoMechView.h" #include "RimGeoMechView.h"
#include "RimGridCrossPlot.h" #include "RimGridCrossPlot.h"
#include "RimGridCrossPlotCollection.h" #include "RimGridCrossPlotCollection.h"
#include "RimGridPlotWindowCollection.h"
#include "RimIdenticalGridCaseGroup.h" #include "RimIdenticalGridCaseGroup.h"
#include "RimMainPlotCollection.h" #include "RimMainPlotCollection.h"
#include "RimObservedData.h"
#include "RimObservedDataCollection.h" #include "RimObservedDataCollection.h"
#include "RimObservedSummaryData.h"
#include "RimOilField.h" #include "RimOilField.h"
#include "RimPltPlotCollection.h" #include "RimPltPlotCollection.h"
#include "RimProject.h" #include "RimProject.h"
@ -90,6 +93,7 @@
#include "Riu3dSelectionManager.h" #include "Riu3dSelectionManager.h"
#include "RiuDockWidgetTools.h" #include "RiuDockWidgetTools.h"
#include "RiuMainWindow.h" #include "RiuMainWindow.h"
#include "RiuMainWindowTools.h"
#include "RiuMdiMaximizeWindowGuard.h" #include "RiuMdiMaximizeWindowGuard.h"
#include "RiuMessagePanel.h" #include "RiuMessagePanel.h"
#include "RiuPlotMainWindow.h" #include "RiuPlotMainWindow.h"
@ -100,7 +104,6 @@
#include "cafAppEnum.h" #include "cafAppEnum.h"
#include "cafEffectGenerator.h" #include "cafEffectGenerator.h"
#include "cafFixedAtlasFont.h" #include "cafFixedAtlasFont.h"
#include "cafPdmSettings.h"
#include "cafPdmUiModelChangeDetector.h" #include "cafPdmUiModelChangeDetector.h"
#include "cafPdmUiTreeView.h" #include "cafPdmUiTreeView.h"
#include "cafProgressInfo.h" #include "cafProgressInfo.h"
@ -116,13 +119,13 @@
#include <QDir> #include <QDir>
#include <QErrorMessage> #include <QErrorMessage>
#include <QFileDialog> #include <QFileDialog>
#include <QGridLayout>
#include <QMdiSubWindow> #include <QMdiSubWindow>
#include <QMessageBox> #include <QMessageBox>
#include <QProcessEnvironment> #include <QProcessEnvironment>
#include <QTreeView>
#include <QTextEdit>
#include <QGridLayout>
#include <QPushButton> #include <QPushButton>
#include <QTextEdit>
#include <QTreeView>
#include <iostream> #include <iostream>
@ -155,7 +158,6 @@ void AppEnum<RiaGuiApplication::RINavigationPolicy>::setUp()
/// ///
//================================================================================================== //==================================================================================================
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -208,23 +210,23 @@ bool RiaGuiApplication::saveProject()
{ {
CVF_ASSERT( m_project.notNull() ); CVF_ASSERT( m_project.notNull() );
QString fileName;
if ( !isProjectSavedToDisc() ) if ( !isProjectSavedToDisc() )
{ {
return saveProjectPromptForFileName(); fileName = promptForProjectSaveAsFileName();
} }
else else
{ {
return saveProjectAs(m_project->fileName()); fileName = m_project->fileName();
} }
return saveProjectAs( fileName );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RiaGuiApplication::saveProjectPromptForFileName() QString RiaGuiApplication::promptForProjectSaveAsFileName() const
{ {
// if (m_project.isNull()) return true;
RiaGuiApplication* app = RiaGuiApplication::instance(); RiaGuiApplication* app = RiaGuiApplication::instance();
QString startPath; QString startPath;
@ -238,21 +240,11 @@ bool RiaGuiApplication::saveProjectPromptForFileName()
startPath += "/ResInsightProject.rsp"; startPath += "/ResInsightProject.rsp";
} }
QString fileName = QString fileName = QFileDialog::getSaveFileName( nullptr,
QFileDialog::getSaveFileName(nullptr, tr("Save File"), startPath, tr("Project Files (*.rsp);;All files(*.*)")); tr( "Save File" ),
if (fileName.isEmpty()) startPath,
{ tr( "Project Files (*.rsp);;All files(*.*)" ) );
return false; return fileName;
}
// Remember the directory to next time
app->setLastUsedDialogDirectory("BINARY_GRID", QFileInfo(fileName).absolutePath());
bool bSaveOk = saveProjectAs(fileName);
setWindowCaptionFromAppState();
return bSaveOk;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -297,7 +289,6 @@ bool RiaGuiApplication::askUserToSaveModifiedProject()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RiaGuiApplication::saveProjectAs( const QString& fileName ) bool RiaGuiApplication::saveProjectAs( const QString& fileName )
{ {
storeTreeViewState();
QString errMsg; QString errMsg;
if ( !RiaApplication::saveProjectAs( fileName, &errMsg ) ) if ( !RiaApplication::saveProjectAs( fileName, &errMsg ) )
{ {
@ -305,8 +296,6 @@ bool RiaGuiApplication::saveProjectAs(const QString& fileName)
return false; return false;
} }
m_recentFileActionProvider->addFileName(fileName);
caf::PdmUiModelChangeDetector::instance()->reset();
return true; return true;
} }
@ -324,38 +313,41 @@ void RiaGuiApplication::loadAndUpdatePlotData()
RimGridCrossPlotCollection* gcpColl = nullptr; RimGridCrossPlotCollection* gcpColl = nullptr;
RimSaturationPressurePlotCollection* sppColl = nullptr; RimSaturationPressurePlotCollection* sppColl = nullptr;
if (m_project->mainPlotCollection() && m_project->mainPlotCollection()->wellLogPlotCollection()) if ( m_project->mainPlotCollection() )
{
if ( m_project->mainPlotCollection()->wellLogPlotCollection() )
{ {
wlpColl = m_project->mainPlotCollection()->wellLogPlotCollection(); wlpColl = m_project->mainPlotCollection()->wellLogPlotCollection();
} }
if (m_project->mainPlotCollection() && m_project->mainPlotCollection()->summaryPlotCollection()) if ( m_project->mainPlotCollection()->summaryPlotCollection() )
{ {
spColl = m_project->mainPlotCollection()->summaryPlotCollection(); spColl = m_project->mainPlotCollection()->summaryPlotCollection();
} }
if (m_project->mainPlotCollection() && m_project->mainPlotCollection()->summaryCrossPlotCollection()) if ( m_project->mainPlotCollection()->summaryCrossPlotCollection() )
{ {
scpColl = m_project->mainPlotCollection()->summaryCrossPlotCollection(); scpColl = m_project->mainPlotCollection()->summaryCrossPlotCollection();
} }
if (m_project->mainPlotCollection() && m_project->mainPlotCollection()->flowPlotCollection()) if ( m_project->mainPlotCollection()->flowPlotCollection() )
{ {
flowColl = m_project->mainPlotCollection()->flowPlotCollection(); flowColl = m_project->mainPlotCollection()->flowPlotCollection();
} }
if (m_project->mainPlotCollection() && m_project->mainPlotCollection()->rftPlotCollection()) if ( m_project->mainPlotCollection()->rftPlotCollection() )
{ {
rftColl = m_project->mainPlotCollection()->rftPlotCollection(); rftColl = m_project->mainPlotCollection()->rftPlotCollection();
} }
if (m_project->mainPlotCollection() && m_project->mainPlotCollection()->pltPlotCollection()) if ( m_project->mainPlotCollection()->pltPlotCollection() )
{ {
pltColl = m_project->mainPlotCollection()->pltPlotCollection(); pltColl = m_project->mainPlotCollection()->pltPlotCollection();
} }
if (m_project->mainPlotCollection() && m_project->mainPlotCollection()->gridCrossPlotCollection()) if ( m_project->mainPlotCollection()->gridCrossPlotCollection() )
{ {
gcpColl = m_project->mainPlotCollection()->gridCrossPlotCollection(); gcpColl = m_project->mainPlotCollection()->gridCrossPlotCollection();
} }
if (m_project->mainPlotCollection() && m_project->mainPlotCollection()->saturationPressurePlotCollection()) if ( m_project->mainPlotCollection()->saturationPressurePlotCollection() )
{ {
sppColl = m_project->mainPlotCollection()->saturationPressurePlotCollection(); sppColl = m_project->mainPlotCollection()->saturationPressurePlotCollection();
} }
}
size_t plotCount = 0; size_t plotCount = 0;
plotCount += wlpColl ? wlpColl->wellLogPlots().size() : 0; plotCount += wlpColl ? wlpColl->wellLogPlots().size() : 0;
@ -533,7 +525,7 @@ RimViewWindow* RiaGuiApplication::activePlotWindow() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RiaGuiApplication::useShaders() const bool RiaGuiApplication::useShaders() const
{ {
if (!m_preferences->useShaders) return false; if ( !m_preferences->useShaders() ) return false;
bool isShadersSupported = caf::Viewer::isShadersSupported(); bool isShadersSupported = caf::Viewer::isShadersSupported();
if ( !isShadersSupported ) return false; if ( !isShadersSupported ) return false;
@ -549,14 +541,6 @@ RiaGuiApplication::RINavigationPolicy RiaGuiApplication::navigationPolicy() cons
return m_preferences->navigationPolicy(); return m_preferences->navigationPolicy();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaGuiApplication::showPerformanceInfo() const
{
return m_preferences->showHud;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -575,7 +559,6 @@ void RiaGuiApplication::initialize()
RiaLogging::setLoggerInstance( new RiuMessagePanelLogger( m_mainWindow->messagePanel() ) ); RiaLogging::setLoggerInstance( new RiuMessagePanelLogger( m_mainWindow->messagePanel() ) );
RiaLogging::loggerInstance()->setLevel( RI_LL_DEBUG ); RiaLogging::loggerInstance()->setLevel( RI_LL_DEBUG );
m_socketServer = new RiaSocketServer( this ); m_socketServer = new RiaSocketServer( this );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -594,8 +577,8 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments(cvf::Progra
if ( progOpt->option( "help" ) || progOpt->option( "?" ) ) if ( progOpt->option( "help" ) || progOpt->option( "?" ) )
{ {
this->showFormattedTextInMessageBoxOrConsole("The current command line options in ResInsight are:\n" this->showFormattedTextInMessageBoxOrConsole( "The current command line options in ResInsight are:\n" +
+ this->commandLineParameterHelp()); this->commandLineParameterHelp() );
return RiaApplication::EXIT_COMPLETED; return RiaApplication::EXIT_COMPLETED;
} }
@ -621,8 +604,8 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments(cvf::Progra
QString regressionTestPath = cvfqt::Utils::toQString( o.value( 0 ) ); QString regressionTestPath = cvfqt::Utils::toQString( o.value( 0 ) );
// Use a logger writing to stdout instead of message panel // Use a logger writing to stdout instead of message panel
// This is useful when executing regression tests on a build server, and this is the reason for creating the logger when // This is useful when executing regression tests on a build server, and this is the reason for creating the
// parsing the command line options // logger when parsing the command line options
auto stdLogger = new RiaStdOutLogger; auto stdLogger = new RiaStdOutLogger;
stdLogger->setLevel( RI_LL_DEBUG ); stdLogger->setLevel( RI_LL_DEBUG );
@ -648,13 +631,49 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments(cvf::Progra
if ( cvf::Option o = progOpt->option( "size" ) ) if ( cvf::Option o = progOpt->option( "size" ) )
{ {
RiuMainWindow* mainWnd = RiuMainWindow::instance();
int width = o.safeValue( 0 ).toInt( -1 ); int width = o.safeValue( 0 ).toInt( -1 );
int height = o.safeValue( 1 ).toInt( -1 ); int height = o.safeValue( 1 ).toInt( -1 );
if (mainWnd && width > 0 && height > 0)
if ( width > 0 && height > 0 )
{ {
mainWnd->resize(width, height); auto mainWindow = RiuMainWindow::instance();
if ( mainWindow )
{
mainWindow->resize( width, height );
} }
auto plotWindow = mainPlotWindow();
if ( plotWindow )
{
plotWindow->resize( width, height );
}
}
}
int snapshotWidth = -1;
int snapshotHeight = -1;
if ( cvf::Option o = progOpt->option( "snapshotsize" ) )
{
int width = o.safeValue( 0 ).toInt( -1 );
int height = o.safeValue( 1 ).toInt( -1 );
if ( width > 0 && height > 0 )
{
snapshotWidth = width;
snapshotHeight = height;
}
}
QString snapshotFolderFromCommandLine;
if ( cvf::Option o = progOpt->option( "snapshotfolder" ) )
{
CVF_ASSERT( o.valueCount() == 1 );
snapshotFolderFromCommandLine = cvfqt::Utils::toQString( o.value( 0 ) );
}
if ( cvf::Option o = progOpt->option( "summaryplot" ) )
{
RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( cvfqt::Utils::toQStringList( o.values() ) );
} }
QString projectFileName; QString projectFileName;
@ -722,7 +741,8 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments(cvf::Progra
{ {
// One argument is available, use replace case for first occurrence in the project // One argument is available, use replace case for first occurrence in the project
std::vector<QString> gridFileNames = readFileListFromTextFile(cvfqt::Utils::toQString(o.safeValue(0))); std::vector<QString> gridFileNames = readFileListFromTextFile(
cvfqt::Utils::toQString( o.safeValue( 0 ) ) );
projectModifier->setReplaceSourceCasesFirstOccurrence( gridFileNames ); projectModifier->setReplaceSourceCasesFirstOccurrence( gridFileNames );
} }
else else
@ -731,8 +751,8 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments(cvf::Progra
while ( optionIdx < o.valueCount() ) while ( optionIdx < o.valueCount() )
{ {
const int groupId = o.safeValue( optionIdx++ ).toInt( -1 ); const int groupId = o.safeValue( optionIdx++ ).toInt( -1 );
std::vector<QString> gridFileNames = std::vector<QString> gridFileNames = readFileListFromTextFile(
readFileListFromTextFile(cvfqt::Utils::toQString(o.safeValue(optionIdx++))); cvfqt::Utils::toQString( o.safeValue( optionIdx++ ) ) );
if ( groupId != -1 && !gridFileNames.empty() ) if ( groupId != -1 && !gridFileNames.empty() )
{ {
@ -774,10 +794,11 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments(cvf::Progra
if ( cvf::Option o = progOpt->option( "case" ) ) if ( cvf::Option o = progOpt->option( "case" ) )
{ {
QStringList fileNames = RicImportGeneralDataFeature::fileNamesFromCaseNames(cvfqt::Utils::toQStringList(o.values())); QStringList fileNames = RicImportGeneralDataFeature::fileNamesFromCaseNames(
cvfqt::Utils::toQStringList( o.values() ) );
RicImportGeneralDataFeature::OpenCaseResults results = RicImportGeneralDataFeature::OpenCaseResults results =
RicImportGeneralDataFeature::openEclipseFilesFromFileNames(fileNames); RicImportGeneralDataFeature::openEclipseFilesFromFileNames( fileNames, true );
if ( results && !results.eclipseSummaryFiles.empty() ) if ( results && !results.eclipseSummaryFiles.empty() )
{ {
getOrCreateAndShowMainPlotWindow(); getOrCreateAndShowMainPlotWindow();
@ -813,36 +834,62 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments(cvf::Progra
} }
} }
if (project() != nullptr && !project()->fileName().isEmpty()) QString snapshotFolder;
{
if (snapshotViews)
{
RiuMainWindow* mainWnd = RiuMainWindow::instance();
CVF_ASSERT(mainWnd);
mainWnd->hideAllDockWidgets();
// 2016-11-09 : Location of snapshot folder was previously located in 'snapshot' folder if ( snapshotFolderFromCommandLine.isEmpty() )
// relative to current working folder. Now harmonized to behave as RiuMainWindow::slotSnapshotAllViewsToFile() {
QString absolutePathToSnapshotDir = createAbsolutePathFromProjectRelativePath( "snapshots" ); snapshotFolder = QDir::currentPath() + "/snapshots";
RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( absolutePathToSnapshotDir ); }
else
mainWnd->loadWinGeoAndDockToolBarLayout(); {
snapshotFolder = snapshotFolderFromCommandLine;
} }
if ( snapshotPlots ) if ( snapshotPlots )
{ {
if (mainPlotWindow()) auto mainPlotWnd = mainPlotWindow();
if ( mainPlotWnd )
{ {
mainPlotWindow()->hideAllDockWidgets(); mainPlotWnd->show();
mainPlotWnd->raise();
// Will be saved relative to current directory if ( snapshotHeight > -1 && snapshotWidth > -1 )
RicSnapshotAllPlotsToFileFeature::saveAllPlots(); {
RiuMainWindowTools::setWindowSizeOnWidgetsInMdiWindows( mainPlotWnd, snapshotWidth, snapshotHeight );
}
mainPlotWindow()->loadWinGeoAndDockToolBarLayout(); processEvents();
RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( snapshotFolder );
} }
} }
if ( snapshotViews )
{
auto mainWnd = RiuMainWindow::instance();
mainWnd->show();
mainWnd->raise();
if ( snapshotHeight > -1 && snapshotWidth > -1 )
{
RiuMainWindowTools::setFixedWindowSizeFor3dViews( mainWnd, snapshotWidth, snapshotHeight );
} }
processEvents();
RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( snapshotFolder );
}
auto mainPlotWnd = mainPlotWindow();
if ( mainPlotWnd )
{
mainPlotWnd->loadWinGeoAndDockToolBarLayout();
}
RiuMainWindow::instance()->loadWinGeoAndDockToolBarLayout();
closeProject();
return EXIT_COMPLETED; return EXIT_COMPLETED;
} }
@ -1052,7 +1099,8 @@ void RiaGuiApplication::deleteMainPlotWindow()
{ {
if ( m_mainPlotWindow ) if ( m_mainPlotWindow )
{ {
m_mainPlotWindow->deleteLater(); m_mainPlotWindow->setParent( nullptr );
delete m_mainPlotWindow;
m_mainPlotWindow = nullptr; m_mainPlotWindow = nullptr;
} }
} }
@ -1250,7 +1298,6 @@ void RiaGuiApplication::showFormattedTextInMessageBoxOrConsole(const QString& te
20 + docSize.height() + 2 * layout->margin() + layout->spacing() + okButton->sizeHint().height() ); 20 + docSize.height() + 2 * layout->margin() + layout->spacing() + okButton->sizeHint().height() );
dlg.exec(); dlg.exec();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -1389,6 +1436,7 @@ void RiaGuiApplication::onProjectBeingClosed()
RicHoloLensSessionManager::refreshToolbarState(); RicHoloLensSessionManager::refreshToolbarState();
RiaViewRedrawScheduler::instance()->clearViewsScheduledForUpdate(); RiaViewRedrawScheduler::instance()->clearViewsScheduledForUpdate();
RiaPlotWindowRedrawScheduler::instance()->clearAllScheduledUpdates();
RiaGuiApplication::clearAllSelections(); RiaGuiApplication::clearAllSelections();
@ -1421,6 +1469,25 @@ void RiaGuiApplication::onProjectClosed()
processEvents(); processEvents();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaGuiApplication::onProjectBeingSaved()
{
setLastUsedDialogDirectory( "BINARY_GRID", QFileInfo( m_project->fileName() ).absolutePath() );
storeTreeViewState();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaGuiApplication::onProjectSaved()
{
setWindowCaptionFromAppState();
m_recentFileActionProvider->addFileName( m_project->fileName() );
caf::PdmUiModelChangeDetector::instance()->reset();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -1442,7 +1509,7 @@ void RiaGuiApplication::applyGuiPreferences(const RiaPreferences* oldPreferences
if ( m_activeReservoirView && m_activeReservoirView->viewer() ) if ( m_activeReservoirView && m_activeReservoirView->viewer() )
{ {
m_activeReservoirView->viewer()->updateNavigationPolicy(); m_activeReservoirView->viewer()->updateNavigationPolicy();
m_activeReservoirView->viewer()->enablePerfInfoHud(m_preferences->showHud()); m_activeReservoirView->viewer()->enablePerfInfoHud( m_preferences->show3dInformation() );
} }
if ( useShaders() ) if ( useShaders() )
@ -1458,7 +1525,8 @@ void RiaGuiApplication::applyGuiPreferences(const RiaPreferences* oldPreferences
{ {
m_mainWindow->projectTreeView()->enableAppendOfClassNameToUiItemText( m_preferences->appendClassNameToUiText() ); m_mainWindow->projectTreeView()->enableAppendOfClassNameToUiItemText( m_preferences->appendClassNameToUiText() );
if ( mainPlotWindow() ) if ( mainPlotWindow() )
mainPlotWindow()->projectTreeView()->enableAppendOfClassNameToUiItemText(m_preferences->appendClassNameToUiText()); mainPlotWindow()->projectTreeView()->enableAppendOfClassNameToUiItemText(
m_preferences->appendClassNameToUiText() );
} }
std::map<RiaDefines::FontSettingType, RiaFontCache::FontSize> fontSizes = m_preferences->defaultFontSizes(); std::map<RiaDefines::FontSettingType, RiaFontCache::FontSize> fontSizes = m_preferences->defaultFontSizes();
@ -1556,12 +1624,14 @@ void RiaGuiApplication::applyGuiPreferences(const RiaPreferences* oldPreferences
} }
QMessageBox::StandardButton reply; QMessageBox::StandardButton reply;
reply = QMessageBox::question( reply =
m_mainWindow, QMessageBox::question( m_mainWindow,
QString( "Apply %1 to Existing Views or Plots?" ).arg( listString ), QString( "Apply %1 to Existing Views or Plots?" ).arg( listString ),
QString("You have changed default %1 and have existing views or plots with different settings.\n") QString( "You have changed default %1 and have existing views or plots with "
"different settings.\n" )
.arg( listString ) + .arg( listString ) +
QString("Do you want to apply the new default settings to all existing views?"), QString(
"Do you want to apply the new default settings to all existing views?" ),
QMessageBox::Ok | QMessageBox::Cancel ); QMessageBox::Ok | QMessageBox::Cancel );
applySettingsToAllViews = ( reply == QMessageBox::Ok ); applySettingsToAllViews = ( reply == QMessageBox::Ok );
} }
@ -1582,20 +1652,22 @@ void RiaGuiApplication::applyGuiPreferences(const RiaPreferences* oldPreferences
auto rim3dView = dynamic_cast<Rim3dView*>( viewWindow ); auto rim3dView = dynamic_cast<Rim3dView*>( viewWindow );
if ( rim3dView ) if ( rim3dView )
{ {
if (oldPreferences && (applySettingsToAllViews || rim3dView->meshMode() == oldPreferences->defaultMeshModeType())) if ( oldPreferences &&
( applySettingsToAllViews || rim3dView->meshMode() == oldPreferences->defaultMeshModeType() ) )
{ {
rim3dView->meshMode = m_preferences->defaultMeshModeType(); rim3dView->meshMode = m_preferences->defaultMeshModeType();
} }
if (oldPreferences && if ( oldPreferences && ( applySettingsToAllViews || rim3dView->backgroundColor() ==
(applySettingsToAllViews || rim3dView->backgroundColor() == oldPreferences->defaultViewerBackgroundColor())) oldPreferences->defaultViewerBackgroundColor() ) )
{ {
rim3dView->setBackgroundColor( m_preferences->defaultViewerBackgroundColor() ); rim3dView->setBackgroundColor( m_preferences->defaultViewerBackgroundColor() );
rim3dView->applyBackgroundColorAndFontChanges(); rim3dView->applyBackgroundColorAndFontChanges();
} }
if ( oldPreferences && if ( oldPreferences &&
(applySettingsToAllViews || rim3dView->scaleZ == static_cast<double>(oldPreferences->defaultScaleFactorZ()))) ( applySettingsToAllViews ||
rim3dView->scaleZ == static_cast<double>( oldPreferences->defaultScaleFactorZ() ) ) )
{ {
rim3dView->scaleZ = static_cast<double>( m_preferences->defaultScaleFactorZ() ); rim3dView->scaleZ = static_cast<double>( m_preferences->defaultScaleFactorZ() );
rim3dView->updateScaling(); rim3dView->updateScaling();
@ -1807,7 +1879,8 @@ bool RiaGuiApplication::notify(QObject* receiver, QEvent* event)
if ( !memoryExhaustedBox && !allocatingMessageBox ) if ( !memoryExhaustedBox && !allocatingMessageBox )
{ {
allocatingMessageBox = true; allocatingMessageBox = true;
memoryExhaustedBox = new QMessageBox(QMessageBox::Critical, memoryExhaustedBox =
new QMessageBox( QMessageBox::Critical,
"ResInsight Exhausted Memory", "ResInsight Exhausted Memory",
"Memory is Exhausted!\n ResInsight could not allocate the memory needed, and is now " "Memory is Exhausted!\n ResInsight could not allocate the memory needed, and is now "
"unstable and will probably crash soon." ); "unstable and will probably crash soon." );
@ -1821,7 +1894,8 @@ bool RiaGuiApplication::notify(QObject* receiver, QEvent* event)
catch ( const std::bad_alloc& ) catch ( const std::bad_alloc& )
{ {
if ( memoryExhaustedBox ) memoryExhaustedBox->exec(); if ( memoryExhaustedBox ) memoryExhaustedBox->exec();
std::cout << "ResInsight: Memory is Exhausted!\n ResInsight could not allocate the memory needed, and is now unstable " std::cout << "ResInsight: Memory is Exhausted!\n ResInsight could not allocate the memory needed, and is now "
"unstable "
"and will probably crash soon." "and will probably crash soon."
<< std::endl; << std::endl;
// If we really want to crash instead of limping forward: // If we really want to crash instead of limping forward:

View File

@ -21,9 +21,9 @@
#include "RiaApplication.h" #include "RiaApplication.h"
#include "RiaDefines.h" #include "RiaDefines.h"
#include "cafPdmObject.h"
#include "cafPdmField.h" #include "cafPdmField.h"
#include "cvfBase.h" #include "cafPdmObject.h"
#include "cvfObject.h" #include "cvfObject.h"
#include <QApplication> #include <QApplication>
@ -92,13 +92,14 @@ public:
~RiaGuiApplication() override; ~RiaGuiApplication() override;
bool saveProject(); bool saveProject();
bool saveProjectPromptForFileName(); QString promptForProjectSaveAsFileName() const;
bool askUserToSaveModifiedProject(); bool askUserToSaveModifiedProject();
bool saveProjectAs( const QString& fileName ); bool saveProjectAs( const QString& fileName );
void runMultiCaseSnapshots(const QString& templateProjectFileName, std::vector<QString> gridFileNames, const QString& snapshotFolderName); void runMultiCaseSnapshots( const QString& templateProjectFileName,
std::vector<QString> gridFileNames,
const QString& snapshotFolderName );
bool useShaders() const; bool useShaders() const;
bool showPerformanceInfo() const;
RINavigationPolicy navigationPolicy() const; RINavigationPolicy navigationPolicy() const;
@ -139,11 +140,15 @@ protected:
// Protected RiaApplication overrides // Protected RiaApplication overrides
void invokeProcessEvents( QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents ) override; void invokeProcessEvents( QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents ) override;
void onFileSuccessfullyLoaded( const QString& fileName, RiaDefines::ImportFileType fileType ) override; void onFileSuccessfullyLoaded( const QString& fileName, RiaDefines::ImportFileType fileType ) override;
void onProjectBeingOpened() override; void onProjectBeingOpened() override;
void onProjectOpeningError(const QString& errMsg); void onProjectOpeningError( const QString& errMsg ) override;
void onProjectOpened() override; void onProjectOpened() override;
void onProjectBeingClosed() override; void onProjectBeingClosed() override;
void onProjectClosed() override; void onProjectClosed() override;
void onProjectBeingSaved() override;
void onProjectSaved() override;
void startMonitoringWorkProgress( caf::UiProcess* uiProcess ) override; void startMonitoringWorkProgress( caf::UiProcess* uiProcess ) override;
void stopMonitoringWorkProgress() override; void stopMonitoringWorkProgress() override;

View File

@ -25,8 +25,8 @@
#include "cvfqtUtils.h" #include "cvfqtUtils.h"
#ifndef WIN32 #ifndef WIN32
#include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h>
#endif #endif
RiaApplication* createApplication( int& argc, char* argv[] ) RiaApplication* createApplication( int& argc, char* argv[] )
@ -48,7 +48,8 @@ int main(int argc, char *argv[])
// But it only checks user id not group id, so better to do it ourselves. // But it only checks user id not group id, so better to do it ourselves.
if ( getuid() != geteuid() || getgid() != getegid() ) if ( getuid() != geteuid() || getgid() != getegid() )
{ {
std::cerr << "FATAL: The application binary appears to be running setuid or setgid, this is a security hole." << std::endl; std::cerr << "FATAL: The application binary appears to be running setuid or setgid, this is a security hole."
<< std::endl;
return 1; return 1;
} }
#endif #endif
@ -72,11 +73,9 @@ int main(int argc, char *argv[])
unknownOptionsText += QString( "\tUnknown option: %1\n" ).arg( cvfqt::Utils::toQString( option ) ); unknownOptionsText += QString( "\tUnknown option: %1\n" ).arg( cvfqt::Utils::toQString( option ) );
} }
app->showFormattedTextInMessageBoxOrConsole("ERROR: Unknown command line options detected ! \n" app->showFormattedTextInMessageBoxOrConsole(
+ unknownOptionsText "ERROR: Unknown command line options detected ! \n" + unknownOptionsText + "\n\n" +
+ "\n\n" "The current command line options in ResInsight are:\n" + app->commandLineParameterHelp() );
+ "The current command line options in ResInsight are:\n"
+ app->commandLineParameterHelp());
if ( dynamic_cast<RiaGuiApplication*>( app.get() ) == nullptr ) if ( dynamic_cast<RiaGuiApplication*>( app.get() ) == nullptr )
{ {
@ -87,7 +86,14 @@ int main(int argc, char *argv[])
QLocale::setDefault( QLocale( QLocale::English, QLocale::UnitedStates ) ); QLocale::setDefault( QLocale( QLocale::English, QLocale::UnitedStates ) );
setlocale( LC_NUMERIC, "C" ); setlocale( LC_NUMERIC, "C" );
// Handle the command line arguments.
// Todo: Move to a one-shot timer, delaying the execution until we are inside the event loop.
// The complete handling of the resulting ApplicationStatus must be moved along.
// The reason for this is: deleteLater() does not work outside the event loop
// Make execution of command line stuff operate in identical conditions as interactive operation.
RiaApplication::ApplicationStatus status = app->handleArguments( &progOpt ); RiaApplication::ApplicationStatus status = app->handleArguments( &progOpt );
if ( status == RiaApplication::EXIT_COMPLETED ) if ( status == RiaApplication::EXIT_COMPLETED )
{ {
return 0; return 0;
@ -109,7 +115,8 @@ int main(int argc, char *argv[])
} }
catch ( std::exception& exep ) catch ( std::exception& exep )
{ {
std::cout << "A standard c++ exception that terminated ResInsight caught in RiaMain.cpp: " << exep.what() << std::endl; std::cout << "A standard c++ exception that terminated ResInsight caught in RiaMain.cpp: " << exep.what()
<< std::endl;
throw; throw;
} }
catch ( ... ) catch ( ... )
@ -124,4 +131,3 @@ int main(int argc, char *argv[])
CVF_ASSERT( false && "Unknown ApplicationStatus" ); CVF_ASSERT( false && "Unknown ApplicationStatus" );
return -1; return -1;
} }

View File

@ -30,10 +30,10 @@
#include "RimGeoMechResultDefinition.h" #include "RimGeoMechResultDefinition.h"
#include "RimProject.h" #include "RimProject.h"
#include "RigEclipseResultInfo.h"
#include "cafPdmUiListEditor.h" #include "cafPdmUiListEditor.h"
#include "cafPdmUiPushButtonEditor.h" #include "cafPdmUiPushButtonEditor.h"
#include "cafPdmUiTreeSelectionEditor.h" #include "cafPdmUiTreeSelectionEditor.h"
#include "RigEclipseResultInfo.h"
//================================================================================================== //==================================================================================================
/// ///
@ -254,7 +254,8 @@ QList<caf::PdmOptionItemInfo> RiaMemoryCleanup::calculateValueOptions(const caf:
const RigEclipseResultInfo* resInfo = caseData->resultInfo( resultAddr ); const RigEclipseResultInfo* resInfo = caseData->resultInfo( resultAddr );
QString posText = caf::AppEnum<RiaDefines::ResultCatType>::uiTextFromIndex(resInfo->resultType()); QString posText = caf::AppEnum<RiaDefines::ResultCatType>::uiTextFromIndex(
resInfo->resultType() );
QString resultsText = QString( "%1, %2" ).arg( posText ).arg( resInfo->resultName() ); QString resultsText = QString( "%1, %2" ).arg( posText ).arg( resInfo->resultName() );
if ( inUse ) if ( inUse )
{ {
@ -264,7 +265,6 @@ QList<caf::PdmOptionItemInfo> RiaMemoryCleanup::calculateValueOptions(const caf:
} }
} }
} }
} }
else if ( geoMechCase ) else if ( geoMechCase )
{ {
@ -280,7 +280,8 @@ QList<caf::PdmOptionItemInfo> RiaMemoryCleanup::calculateValueOptions(const caf:
const RigFemResultAddress& result = m_geomResultAddresses[i]; const RigFemResultAddress& result = m_geomResultAddresses[i];
bool inUse = resultsInUse.count( result ); bool inUse = resultsInUse.count( result );
QString posText = caf::AppEnum<RigFemResultPosEnum>::uiTextFromIndex( result.resultPosType ); QString posText = caf::AppEnum<RigFemResultPosEnum>::uiTextFromIndex( result.resultPosType );
QString resultsText = QString("%1, %2").arg(posText).arg(QString::fromStdString(result.fieldName)); QString resultsText =
QString( "%1, %2" ).arg( posText ).arg( QString::fromStdString( result.fieldName ) );
if ( !result.componentName.empty() ) if ( !result.componentName.empty() )
{ {
resultsText += QString( ", %1" ).arg( QString::fromStdString( result.componentName ) ); resultsText += QString( ", %1" ).arg( QString::fromStdString( result.componentName ) );
@ -310,7 +311,9 @@ void RiaMemoryCleanup::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiaMemoryCleanup::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) void RiaMemoryCleanup::defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute )
{ {
if ( field == &m_performDelete ) if ( field == &m_performDelete )
{ {

View File

@ -18,11 +18,10 @@
#pragma once #pragma once
#include "cafPdmField.h"
#include "cafPdmChildArrayField.h" #include "cafPdmChildArrayField.h"
#include "cafPdmPtrField.h" #include "cafPdmField.h"
#include "cafPdmObject.h" #include "cafPdmObject.h"
#include "cafPdmPtrField.h"
#include "cafPdmUiItem.h" #include "cafPdmUiItem.h"
class RimCase; class RimCase;
@ -33,13 +32,18 @@ class RigEclipseResultAddress;
class RiaMemoryCleanup : public caf::PdmObject class RiaMemoryCleanup : public caf::PdmObject
{ {
CAF_PDM_HEADER_INIT; CAF_PDM_HEADER_INIT;
public: public:
RiaMemoryCleanup(); RiaMemoryCleanup();
void setPropertiesFromView( Rim3dView* view ); void setPropertiesFromView( Rim3dView* view );
void clearSelectedResultsFromMemory(); void clearSelectedResultsFromMemory();
protected: protected:
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
private: private:
std::vector<RigFemResultAddress> selectedGeoMechResults() const; std::vector<RigFemResultAddress> selectedGeoMechResults() const;
std::vector<RigEclipseResultAddress> selectedEclipseResults() const; std::vector<RigEclipseResultAddress> selectedEclipseResults() const;
@ -49,7 +53,10 @@ private:
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override; bool* useOptionsOnly ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override; void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
private: private:
caf::PdmPtrField<RimCase*> m_case; caf::PdmPtrField<RimCase*> m_case;
caf::PdmField<std::vector<size_t>> m_resultsToDelete; caf::PdmField<std::vector<size_t>> m_resultsToDelete;

View File

@ -0,0 +1,140 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiaPlotWindowRedrawScheduler.h"
#include "RiuGridPlotWindow.h"
#include "RiuQwtPlotWidget.h"
#include <QCoreApplication>
#include <QDebug>
#include <set>
#include "cafProgressState.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaPlotWindowRedrawScheduler* RiaPlotWindowRedrawScheduler::instance()
{
static RiaPlotWindowRedrawScheduler theInstance;
return &theInstance;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaPlotWindowRedrawScheduler::schedulePlotWindowUpdate( RiuGridPlotWindow* plotWindow )
{
m_plotWindowsToUpdate.push_back( plotWindow );
startTimer( 0 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaPlotWindowRedrawScheduler::schedulePlotWidgetReplot( RiuQwtPlotWidget* plotWidget )
{
m_plotWidgetsToReplot.push_back( plotWidget );
startTimer( 0 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaPlotWindowRedrawScheduler::clearAllScheduledUpdates()
{
if ( m_plotWindowUpdateTimer )
{
while ( m_plotWindowUpdateTimer->isActive() )
{
QCoreApplication::processEvents();
}
}
m_plotWidgetsToReplot.clear();
m_plotWindowsToUpdate.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots()
{
std::set<RiuQwtPlotWidget*> updatedPlots;
std::set<RiuGridPlotWindow*> updatedPlotWindows;
for ( RiuGridPlotWindow* plotWindow : m_plotWindowsToUpdate )
{
if ( plotWindow && !updatedPlotWindows.count( plotWindow ) )
{
plotWindow->performUpdate();
updatedPlotWindows.insert( plotWindow );
}
}
// Perform update and replot. Make sure we handle legend update
for ( RiuQwtPlotWidget* plot : m_plotWidgetsToReplot )
{
if ( plot && !updatedPlots.count( plot ) )
{
plot->replot();
updatedPlots.insert( plot );
}
}
m_plotWidgetsToReplot.clear();
m_plotWindowsToUpdate.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaPlotWindowRedrawScheduler::slotUpdateAndReplotScheduledItemsWhenReady()
{
if ( caf::ProgressState::isActive() )
{
startTimer( 100 );
return;
}
performScheduledUpdatesAndReplots();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaPlotWindowRedrawScheduler::startTimer( int msecs )
{
if ( !m_plotWindowUpdateTimer )
{
m_plotWindowUpdateTimer.reset( new QTimer( this ) );
connect( m_plotWindowUpdateTimer.data(),
SIGNAL( timeout() ),
this,
SLOT( slotUpdateAndReplotScheduledItemsWhenReady() ) );
}
if ( !m_plotWindowUpdateTimer->isActive() )
{
m_plotWindowUpdateTimer->setSingleShot( true );
m_plotWindowUpdateTimer->start( msecs );
}
}

View File

@ -0,0 +1,56 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmPointer.h"
#include <QObject>
#include <QPointer>
#include <QScopedPointer>
#include <QTimer>
#include <vector>
class RiuGridPlotWindow;
class RiuQwtPlotWidget;
class RiaPlotWindowRedrawScheduler : public QObject
{
Q_OBJECT
public:
static RiaPlotWindowRedrawScheduler* instance();
void schedulePlotWindowUpdate( RiuGridPlotWindow* plotWindow );
void schedulePlotWidgetReplot( RiuQwtPlotWidget* plotWidget );
void clearAllScheduledUpdates();
void performScheduledUpdatesAndReplots();
private slots:
void slotUpdateAndReplotScheduledItemsWhenReady();
private:
RiaPlotWindowRedrawScheduler() = default;
~RiaPlotWindowRedrawScheduler() = default;
void startTimer( int msecs );
private:
std::vector<QPointer<RiuQwtPlotWidget>> m_plotWidgetsToReplot;
std::vector<QPointer<RiuGridPlotWindow>> m_plotWindowsToUpdate;
QScopedPointer<QTimer> m_plotWindowUpdateTimer;
};

View File

@ -20,7 +20,6 @@
#include "cafAppEnum.h" #include "cafAppEnum.h"
namespace caf namespace caf
{ {
template <> template <>
@ -31,4 +30,4 @@ namespace caf
setDefault( RiaDefines::MATRIX_MODEL ); setDefault( RiaDefines::MATRIX_MODEL );
} }
} } // namespace caf

View File

@ -26,8 +26,9 @@
#include "RifReaderSettings.h" #include "RifReaderSettings.h"
#include "cafPdmFieldCvfColor.h" #include "cafPdmFieldCvfColor.h"
#include "cafPdmUiComboBoxEditor.h" #include "cafPdmSettings.h"
#include "cafPdmUiCheckBoxEditor.h" #include "cafPdmUiCheckBoxEditor.h"
#include "cafPdmUiComboBoxEditor.h"
#include "cafPdmUiFieldHandle.h" #include "cafPdmUiFieldHandle.h"
#include "cafPdmUiFilePathEditor.h" #include "cafPdmUiFilePathEditor.h"
@ -58,8 +59,7 @@ namespace caf
addItem( RiaPreferences::SYMBOLS_AND_LINES, "SYMBOLS_AND_LINES", "Symbols and Lines" ); addItem( RiaPreferences::SYMBOLS_AND_LINES, "SYMBOLS_AND_LINES", "Symbols and Lines" );
setDefault( RiaPreferences::SYMBOLS ); setDefault( RiaPreferences::SYMBOLS );
} }
} } // namespace caf
CAF_PDM_SOURCE_INIT( RiaPreferences, "RiaPreferences" ); CAF_PDM_SOURCE_INIT( RiaPreferences, "RiaPreferences" );
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -67,9 +67,21 @@ CAF_PDM_SOURCE_INIT(RiaPreferences, "RiaPreferences");
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RiaPreferences::RiaPreferences( void ) RiaPreferences::RiaPreferences( void )
{ {
CAF_PDM_InitField(&navigationPolicy, "navigationPolicy", caf::AppEnum<RiaGuiApplication::RINavigationPolicy>(RiaGuiApplication::NAVIGATION_POLICY_RMS), "Navigation Mode", "", "", ""); CAF_PDM_InitField( &navigationPolicy,
"navigationPolicy",
caf::AppEnum<RiaGuiApplication::RINavigationPolicy>( RiaGuiApplication::NAVIGATION_POLICY_RMS ),
"Navigation Mode",
"",
"",
"" );
CAF_PDM_InitField(&enableGrpcServer, "enableGrpcServer", true, "Enable Python Script Server", "", "Remote Procedure Call Scripting Engine", ""); CAF_PDM_InitField( &enableGrpcServer,
"enableGrpcServer",
true,
"Enable Python Script Server",
"",
"Remote Procedure Call Scripting Engine",
"" );
CAF_PDM_InitField( &defaultGrpcPortNumber, "defaultGrpcPort", 50051, "Default Python Script Server Port", "", "", "" ); CAF_PDM_InitField( &defaultGrpcPortNumber, "defaultGrpcPort", 50051, "Default Python Script Server Port", "", "", "" );
CAF_PDM_InitFieldNoDefault( &scriptDirectories, "scriptDirectory", "Shared Script Folder(s)", "", "", "" ); CAF_PDM_InitFieldNoDefault( &scriptDirectories, "scriptDirectory", "Shared Script Folder(s)", "", "", "" );
@ -99,7 +111,13 @@ RiaPreferences::RiaPreferences(void)
octaveExecutable.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); octaveExecutable.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
octaveExecutable.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); octaveExecutable.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
CAF_PDM_InitField(&octaveShowHeaderInfoWhenExecutingScripts, "octaveShowHeaderInfoWhenExecutingScripts", false, "Show Text Header When Executing Scripts", "", "", ""); CAF_PDM_InitField( &octaveShowHeaderInfoWhenExecutingScripts,
"octaveShowHeaderInfoWhenExecutingScripts",
false,
"Show Text Header When Executing Scripts",
"",
"",
"" );
octaveShowHeaderInfoWhenExecutingScripts.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); octaveShowHeaderInfoWhenExecutingScripts.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitField( &pythonExecutable, "pythonExecutable", QString( "python" ), "Python Executable Location", "", "", "" ); CAF_PDM_InitField( &pythonExecutable, "pythonExecutable", QString( "python" ), "Python Executable Location", "", "", "" );
@ -111,11 +129,35 @@ RiaPreferences::RiaPreferences(void)
ssihubAddress.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); ssihubAddress.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
CAF_PDM_InitFieldNoDefault( &defaultMeshModeType, "defaultMeshModeType", "Show Grid Lines", "", "", "" ); CAF_PDM_InitFieldNoDefault( &defaultMeshModeType, "defaultMeshModeType", "Show Grid Lines", "", "", "" );
CAF_PDM_InitField(&defaultGridLineColors, "defaultGridLineColors", RiaColorTables::defaultGridLineColor(), "Mesh Color", "", "", ""); CAF_PDM_InitField( &defaultGridLineColors,
CAF_PDM_InitField(&defaultFaultGridLineColors, "defaultFaultGridLineColors", RiaColorTables::defaultFaultLineColor(), "Mesh Color Along Faults", "", "", ""); "defaultGridLineColors",
CAF_PDM_InitField(&defaultWellLabelColor, "defaultWellLableColor", RiaColorTables::defaultWellLabelColor(), "Well Label Color", "", "The default well label color in new views", ""); RiaColorTables::defaultGridLineColor(),
"Mesh Color",
"",
"",
"" );
CAF_PDM_InitField( &defaultFaultGridLineColors,
"defaultFaultGridLineColors",
RiaColorTables::defaultFaultLineColor(),
"Mesh Color Along Faults",
"",
"",
"" );
CAF_PDM_InitField( &defaultWellLabelColor,
"defaultWellLableColor",
RiaColorTables::defaultWellLabelColor(),
"Well Label Color",
"",
"The default well label color in new views",
"" );
CAF_PDM_InitField(&defaultViewerBackgroundColor, "defaultViewerBackgroundColor", RiaColorTables::defaultViewerBackgroundColor(), "Viewer Background", "", "The viewer background color for new views", ""); CAF_PDM_InitField( &defaultViewerBackgroundColor,
"defaultViewerBackgroundColor",
RiaColorTables::defaultViewerBackgroundColor(),
"Viewer Background",
"",
"The viewer background color for new views",
"" );
CAF_PDM_InitField( &defaultScaleFactorZ, "defaultScaleFactorZ", 5, "Default Z Scale Factor", "", "", "" ); CAF_PDM_InitField( &defaultScaleFactorZ, "defaultScaleFactorZ", 5, "Default Z Scale Factor", "", "", "" );
@ -126,20 +168,41 @@ RiaPreferences::RiaPreferences(void)
CAF_PDM_InitField( &defaultWellLabelFontSize, "wellLabelFontSize", fontSize, "Well Label Font Size", "", "", "" ); CAF_PDM_InitField( &defaultWellLabelFontSize, "wellLabelFontSize", fontSize, "Well Label Font Size", "", "", "" );
CAF_PDM_InitField( &defaultPlotFontSize, "defaultPlotFontSize", plotFontSize, "Plot Font Size", "", "", "" ); CAF_PDM_InitField( &defaultPlotFontSize, "defaultPlotFontSize", plotFontSize, "Plot Font Size", "", "", "" );
CAF_PDM_InitField(&showLasCurveWithoutTvdWarning, "showLasCurveWithoutTvdWarning", true, "Show LAS Curve Without TVD Warning", "", "", ""); CAF_PDM_InitField( &showLasCurveWithoutTvdWarning,
"showLasCurveWithoutTvdWarning",
true,
"Show LAS Curve Without TVD Warning",
"",
"",
"" );
showLasCurveWithoutTvdWarning.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); showLasCurveWithoutTvdWarning.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitField(&useShaders, "useShaders", true, "Use Shaders", "", "", ""); CAF_PDM_InitField( &m_useShaders, "useShaders", true, "Use Shaders", "", "", "" );
useShaders.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); m_useShaders.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitField(&showHud, "showHud", false, "Show 3D Information", "", "", ""); CAF_PDM_InitField( &m_showHud, "showHud", false, "Show 3D Information", "", "", "" );
showHud.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); m_showHud.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitField( &m_appendClassNameToUiText, "appendClassNameToUiText", false, "Show Class Names", "", "", "" ); CAF_PDM_InitField( &m_appendClassNameToUiText, "appendClassNameToUiText", false, "Show Class Names", "", "", "" );
m_appendClassNameToUiText.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_appendClassNameToUiText.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitField(&m_appendFieldKeywordToToolTipText, "appendFieldKeywordToToolTipText", false, "Show Field Keyword in ToolTip", "", "", ""); CAF_PDM_InitField( &m_appendFieldKeywordToToolTipText,
"appendFieldKeywordToToolTipText",
false,
"Show Field Keyword in ToolTip",
"",
"",
"" );
m_appendFieldKeywordToToolTipText.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_appendFieldKeywordToToolTipText.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitField( &m_showViewIdInProjectTree, "showViewIdInTree", false, "Show View Id in Project Tree", "", "", "" );
m_showViewIdInProjectTree.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitField( &m_showTestToolbar, "showTestToolbar", false, "Enable Test Toolbar", "", "", "" ); CAF_PDM_InitField( &m_showTestToolbar, "showTestToolbar", false, "Enable Test Toolbar", "", "", "" );
m_showTestToolbar.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_showTestToolbar.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitField(&m_includeFractureDebugInfoFile, "includeFractureDebugInfoFile", false, "Include Fracture Debug Info for Completion Export", "", "", ""); CAF_PDM_InitField( &m_includeFractureDebugInfoFile,
"includeFractureDebugInfoFile",
false,
"Include Fracture Debug Info for Completion Export",
"",
"",
"" );
m_includeFractureDebugInfoFile.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_includeFractureDebugInfoFile.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitField( &showLegendBackground, "showLegendBackground", true, "Show Box around Legends", "", "", "" ); CAF_PDM_InitField( &showLegendBackground, "showLegendBackground", true, "Show Box around Legends", "", "", "" );
@ -148,30 +211,89 @@ RiaPreferences::RiaPreferences(void)
CAF_PDM_InitFieldNoDefault( &lastUsedProjectFileName, "lastUsedProjectFileName", "Last Used Project File", "", "", "" ); CAF_PDM_InitFieldNoDefault( &lastUsedProjectFileName, "lastUsedProjectFileName", "Last Used Project File", "", "", "" );
lastUsedProjectFileName.uiCapability()->setUiHidden( true ); lastUsedProjectFileName.uiCapability()->setUiHidden( true );
CAF_PDM_InitField(&autocomputeDepthRelatedProperties, "autocomputeDepth", true, "Compute DEPTH Related Properties", "", "DEPTH, DX, DY, DZ, TOP, BOTTOM", ""); CAF_PDM_InitField( &autocomputeDepthRelatedProperties,
"autocomputeDepth",
true,
"Compute DEPTH Related Properties",
"",
"DEPTH, DX, DY, DZ, TOP, BOTTOM",
"" );
autocomputeDepthRelatedProperties.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); autocomputeDepthRelatedProperties.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitField( &loadAndShowSoil, "loadAndShowSoil", true, "Load and Show SOIL", "", "", "" ); CAF_PDM_InitField( &loadAndShowSoil, "loadAndShowSoil", true, "Load and Show SOIL", "", "", "" );
loadAndShowSoil.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); loadAndShowSoil.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitFieldNoDefault(&summaryRestartFilesShowImportDialog, "summaryRestartFilesShowImportDialog", "Show Import Dialog", "", "", ""); CAF_PDM_InitFieldNoDefault( &summaryRestartFilesShowImportDialog,
CAF_PDM_InitField(&summaryImportMode, "summaryImportMode", SummaryRestartFilesImportModeType(RiaPreferences::IMPORT), "Default Summary Import Option", "", "", ""); "summaryRestartFilesShowImportDialog",
CAF_PDM_InitField(&gridImportMode, "gridImportMode", SummaryRestartFilesImportModeType(RiaPreferences::NOT_IMPORT), "Default Grid Import Option", "", "", ""); "Show Import Dialog",
CAF_PDM_InitField(&summaryEnsembleImportMode, "summaryEnsembleImportMode", SummaryRestartFilesImportModeType(RiaPreferences::IMPORT), "Default Ensemble Summary Import Option", "", "", ""); "",
"",
"" );
CAF_PDM_InitField( &summaryImportMode,
"summaryImportMode",
SummaryRestartFilesImportModeType( RiaPreferences::IMPORT ),
"Default Summary Import Option",
"",
"",
"" );
CAF_PDM_InitField( &gridImportMode,
"gridImportMode",
SummaryRestartFilesImportModeType( RiaPreferences::NOT_IMPORT ),
"Default Grid Import Option",
"",
"",
"" );
CAF_PDM_InitField( &summaryEnsembleImportMode,
"summaryEnsembleImportMode",
SummaryRestartFilesImportModeType( RiaPreferences::IMPORT ),
"Default Ensemble Summary Import Option",
"",
"",
"" );
CAF_PDM_InitField(&defaultSummaryHistoryCurveStyle, "defaultSummaryHistoryCurveStyle", SummaryHistoryCurveStyleModeType(RiaPreferences::SYMBOLS), "Default Curve Style for History Vectors", "", "", ""); CAF_PDM_InitField( &defaultSummaryHistoryCurveStyle,
CAF_PDM_InitField(&defaultSummaryCurvesTextFilter, "defaultSummaryCurvesTextFilter", QString("FOPT"), "Default Summary Curves", "", "Semicolon separated list of filters used to create curves in new summary plots", ""); "defaultSummaryHistoryCurveStyle",
SummaryHistoryCurveStyleModeType( RiaPreferences::SYMBOLS ),
"Default Curve Style for History Vectors",
"",
"",
"" );
CAF_PDM_InitField( &defaultSummaryCurvesTextFilter,
"defaultSummaryCurvesTextFilter",
QString( "FOPT" ),
"Default Summary Curves",
"",
"Semicolon separated list of filters used to create curves in new summary plots",
"" );
CAF_PDM_InitFieldNoDefault( &m_holoLensExportFolder, "holoLensExportFolder", "HoloLens Export Folder", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_holoLensExportFolder, "holoLensExportFolder", "HoloLens Export Folder", "", "", "" );
m_holoLensExportFolder.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); m_holoLensExportFolder.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
m_holoLensExportFolder.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); m_holoLensExportFolder.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
CAF_PDM_InitField(&holoLensDisableCertificateVerification, "holoLensDisableCertificateVerification", false, "Disable SSL Certificate Verification (HoloLens)", "", "", ""); CAF_PDM_InitField( &holoLensDisableCertificateVerification,
"holoLensDisableCertificateVerification",
false,
"Disable SSL Certificate Verification (HoloLens)",
"",
"",
"" );
holoLensDisableCertificateVerification.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); holoLensDisableCertificateVerification.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitField(&csvTextExportFieldSeparator, "csvTextExportFieldSeparator", QString(","), "CSV Text Export Field Separator", "", "", ""); CAF_PDM_InitField( &csvTextExportFieldSeparator,
"csvTextExportFieldSeparator",
QString( "," ),
"CSV Text Export Field Separator",
"",
"",
"" );
CAF_PDM_InitField(&m_showProjectChangedDialog, "showProjectChangedDialog", true, "Show 'Project has changed' dialog", "", "", ""); CAF_PDM_InitField( &m_showProjectChangedDialog,
"showProjectChangedDialog",
true,
"Show 'Project has changed' dialog",
"",
"",
"" );
m_showProjectChangedDialog.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_showProjectChangedDialog.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitFieldNoDefault( &m_readerSettings, "readerSettings", "Reader Settings", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_readerSettings, "readerSettings", "Reader Settings", "", "", "" );
@ -183,6 +305,38 @@ RiaPreferences::RiaPreferences(void)
CAF_PDM_InitFieldNoDefault( &m_timeFormat, "timeFormat", "Time Format", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_timeFormat, "timeFormat", "Time Format", "", "", "" );
m_timeFormat.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); m_timeFormat.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
m_timeFormat = RiaQDateTimeTools::supportedTimeFormats().front(); m_timeFormat = RiaQDateTimeTools::supportedTimeFormats().front();
CAF_PDM_InitFieldNoDefault( &m_plotTemplateFolders, "plotTemplateFolders", "Plot Template Folder(s)", "", "", "" );
m_plotTemplateFolders.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
CAF_PDM_InitField( &m_searchPlotTemplateFoldersRecursively,
"SearchPlotTemplateFoldersRecursively",
true,
"Search Plot Templates Recursively",
"",
"",
"" );
m_searchPlotTemplateFoldersRecursively.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitFieldNoDefault( &m_defaultPlotTemplate, "defaultPlotTemplate", "Default Plot Template", "", "", "" );
// m_plotTemplateFolders.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
CAF_PDM_InitField( &m_showSummaryTimeAsLongString,
"showSummaryTimeAsLongString",
false,
"Show resample time text as long time text (2010-11-21 23:15:00)",
"",
"",
"" );
m_showSummaryTimeAsLongString.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitField( &m_useMultipleThreadsWhenLoadingSummaryData,
"useMultipleThreadsWhenLoadingSummaryData",
false,
"Use multiple threads when loading summary data",
"",
"",
"" );
m_useMultipleThreadsWhenLoadingSummaryData.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -196,32 +350,32 @@ RiaPreferences::~RiaPreferences(void)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiaPreferences::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute) void RiaPreferences::defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute )
{ {
m_readerSettings->defineEditorAttribute( field, uiConfigName, attribute ); m_readerSettings->defineEditorAttribute( field, uiConfigName, attribute );
if (field == &scriptDirectories)
{ {
caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>( attribute ); caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>( attribute );
if ( myAttr ) if ( myAttr )
{
if ( field == &scriptDirectories || field == &m_plotTemplateFolders )
{ {
myAttr->m_selectDirectory = true; myAttr->m_selectDirectory = true;
myAttr->m_appendUiSelectedFolderToText = true; myAttr->m_appendUiSelectedFolderToText = true;
} }
} }
else if (field == &octaveShowHeaderInfoWhenExecutingScripts || }
field == &autocomputeDepthRelatedProperties ||
field == &loadAndShowSoil || if ( field == &octaveShowHeaderInfoWhenExecutingScripts || field == &autocomputeDepthRelatedProperties ||
field == &useShaders || field == &loadAndShowSoil || field == &m_useShaders || field == &m_showHud ||
field == &showHud || field == &m_appendClassNameToUiText || field == &m_appendFieldKeywordToToolTipText ||
field == &m_appendClassNameToUiText || field == &m_showTestToolbar || field == &m_includeFractureDebugInfoFile ||
field == &m_appendFieldKeywordToToolTipText || field == &showLasCurveWithoutTvdWarning || field == &holoLensDisableCertificateVerification ||
field == &m_showTestToolbar || field == &m_showProjectChangedDialog || field == &m_searchPlotTemplateFoldersRecursively ||
field == &m_includeFractureDebugInfoFile || field == &showLegendBackground || field == &m_showSummaryTimeAsLongString ||
field == &showLasCurveWithoutTvdWarning || field == &m_showViewIdInProjectTree || field == &m_useMultipleThreadsWhenLoadingSummaryData )
field == &holoLensDisableCertificateVerification ||
field == &m_showProjectChangedDialog ||
field == &showLegendBackground)
{ {
caf::PdmUiCheckBoxEditorAttribute* myAttr = dynamic_cast<caf::PdmUiCheckBoxEditorAttribute*>( attribute ); caf::PdmUiCheckBoxEditorAttribute* myAttr = dynamic_cast<caf::PdmUiCheckBoxEditorAttribute*>( attribute );
if ( myAttr ) if ( myAttr )
@ -237,8 +391,8 @@ void RiaPreferences::defineEditorAttribute(const caf::PdmFieldHandle* field, QSt
myAttr->m_selectDirectory = true; myAttr->m_selectDirectory = true;
} }
} }
if (field == &defaultSceneFontSize || field == &defaultWellLabelFontSize || if ( field == &defaultSceneFontSize || field == &defaultWellLabelFontSize || field == &defaultAnnotationFontSize ||
field == &defaultAnnotationFontSize || field == &defaultPlotFontSize) field == &defaultPlotFontSize )
{ {
caf::PdmUiComboBoxEditorAttribute* myAttr = dynamic_cast<caf::PdmUiComboBoxEditorAttribute*>( attribute ); caf::PdmUiComboBoxEditorAttribute* myAttr = dynamic_cast<caf::PdmUiComboBoxEditorAttribute*>( attribute );
myAttr->minimumContentsLength = 2; myAttr->minimumContentsLength = 2;
@ -269,8 +423,6 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
viewsGroup->add( &navigationPolicy ); viewsGroup->add( &navigationPolicy );
viewsGroup->add( &defaultScaleFactorZ ); viewsGroup->add( &defaultScaleFactorZ );
viewsGroup->add( &showLegendBackground ); viewsGroup->add( &showLegendBackground );
viewsGroup->add(&useShaders);
viewsGroup->add(&showHud);
caf::PdmUiGroup* otherGroup = uiOrdering.addNewGroup( "Other" ); caf::PdmUiGroup* otherGroup = uiOrdering.addNewGroup( "Other" );
otherGroup->add( &ssihubAddress ); otherGroup->add( &ssihubAddress );
@ -309,6 +461,12 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
uiOrdering.add( &defaultSummaryHistoryCurveStyle ); uiOrdering.add( &defaultSummaryHistoryCurveStyle );
uiOrdering.add( &m_dateFormat ); uiOrdering.add( &m_dateFormat );
uiOrdering.add( &m_timeFormat ); uiOrdering.add( &m_timeFormat );
uiOrdering.add( &m_showSummaryTimeAsLongString );
uiOrdering.add( &m_useMultipleThreadsWhenLoadingSummaryData );
caf::PdmUiGroup* group = uiOrdering.addNewGroup( "Plot Templates" );
group->add( &m_plotTemplateFolders );
group->add( &m_searchPlotTemplateFoldersRecursively );
} }
else if ( uiConfigName == RiaPreferences::tabNameScripting() ) else if ( uiConfigName == RiaPreferences::tabNameScripting() )
{ {
@ -333,11 +491,20 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
} }
else if ( RiaApplication::enableDevelopmentFeatures() && uiConfigName == RiaPreferences::tabNameSystem() ) else if ( RiaApplication::enableDevelopmentFeatures() && uiConfigName == RiaPreferences::tabNameSystem() )
{ {
uiOrdering.add(&m_appendClassNameToUiText); {
uiOrdering.add(&m_appendFieldKeywordToToolTipText); caf::PdmUiGroup* group = uiOrdering.addNewGroup( "Project Tree" );
group->add( &m_appendClassNameToUiText );
group->add( &m_appendFieldKeywordToToolTipText );
group->add( &m_showViewIdInProjectTree );
}
{
caf::PdmUiGroup* group = uiOrdering.addNewGroup( "3D View" );
group->add( &m_useShaders );
group->add( &m_showHud );
}
uiOrdering.add( &m_showProjectChangedDialog ); uiOrdering.add( &m_showProjectChangedDialog );
uiOrdering.add( &m_showTestToolbar ); uiOrdering.add( &m_showTestToolbar );
uiOrdering.add( &m_includeFractureDebugInfoFile ); uiOrdering.add( &m_includeFractureDebugInfoFile );
uiOrdering.add( &m_holoLensExportFolder ); uiOrdering.add( &m_holoLensExportFolder );
@ -349,7 +516,8 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RiaPreferences::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) QList<caf::PdmOptionItemInfo> RiaPreferences::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly )
{ {
QList<caf::PdmOptionItemInfo> options; QList<caf::PdmOptionItemInfo> options;
*useOptionsOnly = true; *useOptionsOnly = true;
@ -377,8 +545,8 @@ QList<caf::PdmOptionItemInfo> RiaPreferences::calculateValueOptions(const caf::P
for ( auto dateFormat : RiaQDateTimeTools::supportedDateFormats() ) for ( auto dateFormat : RiaQDateTimeTools::supportedDateFormats() )
{ {
QDate exampleDate = QDate( 2019, 8, 16 ); QDate exampleDate = QDate( 2019, 8, 16 );
QString fullDateFormat = QString fullDateFormat = RiaQDateTimeTools::dateFormatString( dateFormat,
RiaQDateTimeTools::dateFormatString(dateFormat, RiaQDateTimeTools::DATE_FORMAT_YEAR_MONTH_DAY); RiaQDateTimeTools::DATE_FORMAT_YEAR_MONTH_DAY );
QString uiText = QString( "%1 (%2)" ).arg( fullDateFormat ).arg( exampleDate.toString( fullDateFormat ) ); QString uiText = QString( "%1 (%2)" ).arg( fullDateFormat ).arg( exampleDate.toString( fullDateFormat ) );
uiText.replace( "AP", "AM/PM" ); uiText.replace( "AP", "AM/PM" );
options.push_back( caf::PdmOptionItemInfo( uiText, QVariant::fromValue( dateFormat ) ) ); options.push_back( caf::PdmOptionItemInfo( uiText, QVariant::fromValue( dateFormat ) ) );
@ -506,6 +674,14 @@ bool RiaPreferences::appendFieldKeywordToToolTipText() const
return RiaApplication::enableDevelopmentFeatures() && m_appendFieldKeywordToToolTipText(); return RiaApplication::enableDevelopmentFeatures() && m_appendFieldKeywordToToolTipText();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaPreferences::showViewIdInProjectTree() const
{
return RiaApplication::enableDevelopmentFeatures() && m_showViewIdInProjectTree();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -543,6 +719,27 @@ QString RiaPreferences::holoLensExportFolder() const
return m_holoLensExportFolder(); return m_holoLensExportFolder();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaPreferences::useShaders() const
{
if ( !RiaApplication::enableDevelopmentFeatures() )
{
return true;
}
return m_useShaders();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaPreferences::show3dInformation() const
{
return RiaApplication::enableDevelopmentFeatures() && m_showHud();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -559,6 +756,81 @@ const QString& RiaPreferences::timeFormat() const
return m_timeFormat(); return m_timeFormat();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaPreferences::searchPlotTemplateFoldersRecursively() const
{
return m_searchPlotTemplateFoldersRecursively();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QStringList RiaPreferences::plotTemplateFolders() const
{
QStringList filteredFolders;
QStringList pathList = m_plotTemplateFolders().split( ';' );
for ( const auto& path : pathList )
{
QDir dir( path );
if ( !path.isEmpty() && dir.exists() && dir.isReadable() )
{
filteredFolders.push_back( path );
}
}
return filteredFolders;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaPreferences::appendPlotTemplateFolders( const QString& folder )
{
QString folders = m_plotTemplateFolders();
if ( !folders.isEmpty() )
{
folders += ";";
}
folders += folder;
m_plotTemplateFolders = folders;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaPreferences::defaultPlotTemplateAbsolutePath() const
{
return m_defaultPlotTemplate().path();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaPreferences::setDefaultPlotTemplatePath( const QString& templatePath )
{
m_defaultPlotTemplate = templatePath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaPreferences::showSummaryTimeAsLongString() const
{
return m_showSummaryTimeAsLongString;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaPreferences::useMultipleThreadsWhenReadingSummaryData() const
{
return m_useMultipleThreadsWhenLoadingSummaryData;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -571,3 +843,11 @@ std::map<RiaDefines::FontSettingType, RiaFontCache::FontSize> RiaPreferences::de
fontSizes[RiaDefines::PLOT_FONT] = defaultPlotFontSize(); fontSizes[RiaDefines::PLOT_FONT] = defaultPlotFontSize();
return fontSizes; return fontSizes;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaPreferences::writePreferencesToApplicationStore()
{
caf::PdmSettings::writeFieldsToApplicationStore( this );
}

View File

@ -22,9 +22,9 @@
#pragma once #pragma once
#include "RiaApplication.h" #include "RiaApplication.h"
#include "RiaGuiApplication.h"
#include "RiaDefines.h" #include "RiaDefines.h"
#include "RiaFontCache.h" #include "RiaFontCache.h"
#include "RiaGuiApplication.h"
#include "RiaQDateTimeTools.h" #include "RiaQDateTimeTools.h"
#include "cafAppEnum.h" #include "cafAppEnum.h"
@ -35,16 +35,26 @@
// Include to make Pdm work for cvf::Color // Include to make Pdm work for cvf::Color
#include "cafPdmFieldCvfColor.h" #include "cafPdmFieldCvfColor.h"
#include <QStringList>
#include <map> #include <map>
class RifReaderSettings; class RifReaderSettings;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class RiaPreferences : public caf::PdmObject class RiaPreferences : public caf::PdmObject
{ {
CAF_PDM_HEADER_INIT; CAF_PDM_HEADER_INIT;
public: public:
enum SummaryRestartFilesImportMode { IMPORT, NOT_IMPORT, SEPARATE_CASES }; enum SummaryRestartFilesImportMode
{
IMPORT,
NOT_IMPORT,
SEPARATE_CASES
};
typedef caf::AppEnum<SummaryRestartFilesImportMode> SummaryRestartFilesImportModeType; typedef caf::AppEnum<SummaryRestartFilesImportMode> SummaryRestartFilesImportModeType;
typedef RiaFontCache::FontSizeType FontSizeType; typedef RiaFontCache::FontSizeType FontSizeType;
@ -66,16 +76,29 @@ public:
// Debug settings // Debug settings
bool appendClassNameToUiText() const; bool appendClassNameToUiText() const;
bool appendFieldKeywordToToolTipText() const; bool appendFieldKeywordToToolTipText() const;
bool showViewIdInProjectTree() const;
bool showTestToolbar() const; bool showTestToolbar() const;
bool includeFractureDebugInfoFile() const; bool includeFractureDebugInfoFile() const;
bool showProjectChangedDialog() const; bool showProjectChangedDialog() const;
QString holoLensExportFolder() const; QString holoLensExportFolder() const;
bool useShaders() const;
bool show3dInformation() const;
const QString& dateFormat() const; const QString& dateFormat() const;
const QString& timeFormat() const; const QString& timeFormat() const;
bool searchPlotTemplateFoldersRecursively() const;
QStringList plotTemplateFolders() const;
void appendPlotTemplateFolders( const QString& folder );
QString defaultPlotTemplateAbsolutePath() const;
void setDefaultPlotTemplatePath( const QString& templatePath );
bool showSummaryTimeAsLongString() const;
bool useMultipleThreadsWhenReadingSummaryData() const;
std::map<RiaDefines::FontSettingType, RiaFontCache::FontSize> defaultFontSizes() const; std::map<RiaDefines::FontSettingType, RiaFontCache::FontSize> defaultFontSizes() const;
void writePreferencesToApplicationStore();
public: // Pdm Fields public: // Pdm Fields
caf::PdmField<caf::AppEnum<RiaGuiApplication::RINavigationPolicy>> navigationPolicy; caf::PdmField<caf::AppEnum<RiaGuiApplication::RINavigationPolicy>> navigationPolicy;
@ -109,9 +132,6 @@ public: // Pdm Fields
caf::PdmField<bool> showLegendBackground; caf::PdmField<bool> showLegendBackground;
caf::PdmField<bool> useShaders;
caf::PdmField<bool> showHud;
caf::PdmField<QString> lastUsedProjectFileName; caf::PdmField<QString> lastUsedProjectFileName;
caf::PdmField<bool> autocomputeDepthRelatedProperties; caf::PdmField<bool> autocomputeDepthRelatedProperties;
@ -129,10 +149,14 @@ public: // Pdm Fields
caf::PdmField<QString> csvTextExportFieldSeparator; caf::PdmField<QString> csvTextExportFieldSeparator;
protected: protected:
void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override; void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override; QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void initAfterRead() override; void initAfterRead() override;
private: private:
static QString tabNameGeneral(); static QString tabNameGeneral();
static QString tabNameEclipse(); static QString tabNameEclipse();
@ -143,8 +167,12 @@ private:
private: private:
caf::PdmChildField<RifReaderSettings*> m_readerSettings; caf::PdmChildField<RifReaderSettings*> m_readerSettings;
caf::PdmField<bool> m_appendClassNameToUiText; caf::PdmField<bool> m_appendClassNameToUiText;
caf::PdmField<bool> m_appendFieldKeywordToToolTipText; caf::PdmField<bool> m_appendFieldKeywordToToolTipText;
caf::PdmField<bool> m_showViewIdInProjectTree;
caf::PdmField<bool> m_useShaders;
caf::PdmField<bool> m_showHud;
caf::PdmField<bool> m_showProjectChangedDialog; caf::PdmField<bool> m_showProjectChangedDialog;
@ -153,5 +181,12 @@ private:
caf::PdmField<QString> m_holoLensExportFolder; caf::PdmField<QString> m_holoLensExportFolder;
caf::PdmField<QString> m_dateFormat; caf::PdmField<QString> m_dateFormat;
caf::PdmField<QString> m_timeFormat; caf::PdmField<QString> m_timeFormat;
caf::PdmField<bool> m_showSummaryTimeAsLongString;
caf::PdmField<bool> m_useMultipleThreadsWhenLoadingSummaryData;
caf::PdmField<QString> m_plotTemplateFolders;
caf::PdmField<bool> m_searchPlotTemplateFoldersRecursively;
caf::PdmField<caf::FilePath> m_defaultPlotTemplate;
QStringList m_tabNames; QStringList m_tabNames;
}; };

View File

@ -18,29 +18,40 @@
#include "RiaRftPltCurveDefinition.h" #include "RiaRftPltCurveDefinition.h"
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RiaRftPltCurveDefinition::RiaRftPltCurveDefinition(RifDataSourceForRftPlt address, const QDateTime timeStep) RiaRftPltCurveDefinition::RiaRftPltCurveDefinition( const RifDataSourceForRftPlt& address,
const QString& wellName,
const QDateTime& timeStep )
: m_curveAddress( address )
, m_wellName( wellName )
, m_timeStep( timeStep )
{ {
m_curveDefinition = std::make_pair(address, timeStep);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RifDataSourceForRftPlt RiaRftPltCurveDefinition::address() const const RifDataSourceForRftPlt& RiaRftPltCurveDefinition::address() const
{ {
return m_curveDefinition.first; return m_curveAddress;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QDateTime RiaRftPltCurveDefinition::timeStep() const const QString& RiaRftPltCurveDefinition::wellName() const
{ {
return m_curveDefinition.second; return m_wellName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const QDateTime& RiaRftPltCurveDefinition::timeStep() const
{
return m_timeStep;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -48,5 +59,13 @@ QDateTime RiaRftPltCurveDefinition::timeStep() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RiaRftPltCurveDefinition::operator<( const RiaRftPltCurveDefinition& other ) const bool RiaRftPltCurveDefinition::operator<( const RiaRftPltCurveDefinition& other ) const
{ {
return m_curveDefinition < other.m_curveDefinition; if ( m_curveAddress == other.m_curveAddress )
{
if ( m_wellName == other.m_wellName )
{
return m_timeStep < other.m_timeStep;
}
return m_wellName < other.m_wellName;
}
return m_curveAddress < other.m_curveAddress;
} }

View File

@ -33,13 +33,18 @@ class RimSummaryCase;
class RiaRftPltCurveDefinition class RiaRftPltCurveDefinition
{ {
public: public:
explicit RiaRftPltCurveDefinition(RifDataSourceForRftPlt address, const QDateTime timeStep); explicit RiaRftPltCurveDefinition( const RifDataSourceForRftPlt& address,
const QString& wellName,
const QDateTime& timeStep );
RifDataSourceForRftPlt address() const; const RifDataSourceForRftPlt& address() const;
QDateTime timeStep() const; const QString& wellName() const;
const QDateTime& timeStep() const;
bool operator<( const RiaRftPltCurveDefinition& other ) const; bool operator<( const RiaRftPltCurveDefinition& other ) const;
private: private:
std::pair<RifDataSourceForRftPlt, QDateTime> m_curveDefinition; RifDataSourceForRftPlt m_curveAddress;
QString m_wellName;
QDateTime m_timeStep;
}; };

View File

@ -0,0 +1,69 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiaStringListSerializer.h"
#include <QSettings>
#include <QStringList>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaStringListSerializer::RiaStringListSerializer( const QString& key )
: m_key( key )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaStringListSerializer::addString( const QString& textString, int maxStringCount )
{
QSettings settings;
QStringList stringList = settings.value( m_key ).toStringList();
stringList.removeAll( textString );
stringList.prepend( textString );
while ( stringList.size() > maxStringCount )
stringList.removeLast();
settings.setValue( m_key, stringList );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaStringListSerializer::removeString( const QString& textString )
{
QSettings settings;
QStringList files = settings.value( m_key ).toStringList();
files.removeAll( textString );
settings.setValue( m_key, files );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QStringList RiaStringListSerializer::textStrings()
{
QSettings settings;
QStringList stringList = settings.value( m_key ).toStringList();
return stringList;
}

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2017- Statoil ASA // Copyright (C) 2019- Equinor ASA
// //
// ResInsight is free software: you can redistribute it and/or modify // ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
@ -18,31 +18,23 @@
#pragma once #pragma once
#include "cafPdmObject.h" #include <QString>
#include "cafPdmChildArrayField.h"
class RimObservedData; class QStringList;
class QFile;
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
class RimObservedDataCollection : public caf::PdmObject class RiaStringListSerializer
{ {
CAF_PDM_HEADER_INIT;
public: public:
RimObservedDataCollection(); explicit RiaStringListSerializer( const QString& key );
~RimObservedDataCollection() override;
void removeObservedData(RimObservedData* observedData); void addString( const QString& textString, int maxStringCount );
RimObservedData* createAndAddRsmObservedDataFromFile(const QString& fileName, QString* errorText = nullptr); void removeString( const QString& textString );
RimObservedData* createAndAddCvsObservedDataFromFile(const QString& fileName, bool useSavedFieldsValuesInDialog, QString* errorText = nullptr);
std::vector<RimObservedData*> allObservedData(); QStringList textStrings();
private: private:
bool fileExists(const QString& fileName, QString* errorText = nullptr); QString m_key;
private:
caf::PdmChildArrayField<RimObservedData*> m_observedDataArray;
}; };

View File

@ -79,7 +79,8 @@ bool RiaSummaryCurveDefinition::isEnsembleCurve() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiaSummaryCurveDefinition::resultValues(const RiaSummaryCurveDefinition& curveDefinition, std::vector<double>* values) void RiaSummaryCurveDefinition::resultValues( const RiaSummaryCurveDefinition& curveDefinition,
std::vector<double>* values )
{ {
CVF_ASSERT( values ); CVF_ASSERT( values );
@ -115,7 +116,7 @@ QString RiaSummaryCurveDefinition::curveDefinitionText() const
{ {
QString caseName; QString caseName;
if ( summaryCase() ) if ( summaryCase() )
caseName = summaryCase()->shortName(); caseName = summaryCase()->caseName();
else if ( ensemble() ) else if ( ensemble() )
caseName = ensemble()->name(); caseName = ensemble()->name();
@ -125,7 +126,8 @@ QString RiaSummaryCurveDefinition::curveDefinitionText() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RiaSummaryCurveDefinition::curveDefinitionText(const QString& caseName, const RifEclipseSummaryAddress& summaryAddress) QString RiaSummaryCurveDefinition::curveDefinitionText( const QString& caseName,
const RifEclipseSummaryAddress& summaryAddress )
{ {
QString txt; QString txt;

View File

@ -55,7 +55,6 @@ public:
static QString curveDefinitionText( const QString& caseName, const RifEclipseSummaryAddress& summaryAddress ); static QString curveDefinitionText( const QString& caseName, const RifEclipseSummaryAddress& summaryAddress );
private: private:
private: private:
RimSummaryCase* m_summaryCase; RimSummaryCase* m_summaryCase;
RifEclipseSummaryAddress m_summaryAddress; RifEclipseSummaryAddress m_summaryAddress;

View File

@ -19,11 +19,11 @@
#include "RiaViewRedrawScheduler.h" #include "RiaViewRedrawScheduler.h"
#include "Rim3dView.h" #include "Rim3dView.h"
#include <QTimer>
#include <QCoreApplication> #include <QCoreApplication>
#include <QTimer>
#include <set>
#include "cafProgressState.h" #include "cafProgressState.h"
#include <set>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -35,23 +35,6 @@ RiaViewRedrawScheduler* RiaViewRedrawScheduler::instance()
return &theInstance; return &theInstance;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaViewRedrawScheduler::clearViewsScheduledForUpdate()
{
if (m_resViewUpdateTimer)
{
while (m_resViewUpdateTimer->isActive())
{
QCoreApplication::processEvents();
}
}
m_resViewsToUpdate.clear();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Schedule a creation of the Display model and redraw of the reservoir view /// Schedule a creation of the Display model and redraw of the reservoir view
/// The redraw will happen as soon as the event loop is entered /// The redraw will happen as soon as the event loop is entered
@ -66,21 +49,17 @@ void RiaViewRedrawScheduler::scheduleDisplayModelUpdateAndRedraw(Rim3dView* resV
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiaViewRedrawScheduler::startTimer(int msecs) void RiaViewRedrawScheduler::clearViewsScheduledForUpdate()
{ {
if (!m_resViewUpdateTimer) if ( m_resViewUpdateTimer )
{ {
m_resViewUpdateTimer = new QTimer(this); while ( m_resViewUpdateTimer->isActive() )
connect(m_resViewUpdateTimer, SIGNAL(timeout()), this, SLOT(slotUpdateAndRedrawScheduledViewsWhenReady()));
}
if (!m_resViewUpdateTimer->isActive())
{ {
m_resViewUpdateTimer->setSingleShot(true); QCoreApplication::processEvents();
m_resViewUpdateTimer->start(msecs);
} }
} }
m_resViewsToUpdate.clear();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -103,7 +82,8 @@ void RiaViewRedrawScheduler::updateAndRedrawScheduledViews()
independent3DViewsToUpdate.insert( m_resViewsToUpdate[i] ); independent3DViewsToUpdate.insert( m_resViewsToUpdate[i] );
} }
for (std::set<Rim3dView*>::iterator it = independent3DViewsToUpdate.begin(); it != independent3DViewsToUpdate.end(); ++it ) for ( std::set<Rim3dView*>::iterator it = independent3DViewsToUpdate.begin(); it != independent3DViewsToUpdate.end();
++it )
{ {
if ( *it ) if ( *it )
{ {
@ -111,7 +91,8 @@ void RiaViewRedrawScheduler::updateAndRedrawScheduledViews()
} }
} }
for (std::set<Rim3dView*>::iterator it = dependent3DViewsToUpdate.begin(); it != dependent3DViewsToUpdate.end(); ++it) for ( std::set<Rim3dView*>::iterator it = dependent3DViewsToUpdate.begin(); it != dependent3DViewsToUpdate.end();
++it )
{ {
if ( *it ) if ( *it )
{ {
@ -136,6 +117,24 @@ void RiaViewRedrawScheduler::slotUpdateAndRedrawScheduledViewsWhenReady()
updateAndRedrawScheduledViews(); updateAndRedrawScheduledViews();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaViewRedrawScheduler::startTimer( int msecs )
{
if ( !m_resViewUpdateTimer )
{
m_resViewUpdateTimer = new QTimer( this );
connect( m_resViewUpdateTimer, SIGNAL( timeout() ), this, SLOT( slotUpdateAndRedrawScheduledViewsWhenReady() ) );
}
if ( !m_resViewUpdateTimer->isActive() )
{
m_resViewUpdateTimer->setSingleShot( true );
m_resViewUpdateTimer->start( msecs );
}
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -18,17 +18,17 @@
#pragma once #pragma once
#include "cafPdmPointer.h"
#include <QObject> #include <QObject>
#include <vector> #include <vector>
#include "cafPdmPointer.h"
class QTimer; class QTimer;
class Rim3dView; class Rim3dView;
class RiaViewRedrawScheduler : public QObject class RiaViewRedrawScheduler : public QObject
{ {
Q_OBJECT; Q_OBJECT;
public: public:
static RiaViewRedrawScheduler* instance(); static RiaViewRedrawScheduler* instance();
void scheduleDisplayModelUpdateAndRedraw( Rim3dView* resViewToUpdate ); void scheduleDisplayModelUpdateAndRedraw( Rim3dView* resViewToUpdate );
@ -41,7 +41,10 @@ private slots:
private: private:
void startTimer( int msecs ); void startTimer( int msecs );
RiaViewRedrawScheduler() : m_resViewUpdateTimer(nullptr) {} RiaViewRedrawScheduler()
: m_resViewUpdateTimer( nullptr )
{
}
~RiaViewRedrawScheduler() override; ~RiaViewRedrawScheduler() override;
RiaViewRedrawScheduler( const RiaViewRedrawScheduler& o ) = delete; RiaViewRedrawScheduler( const RiaViewRedrawScheduler& o ) = delete;
@ -50,5 +53,3 @@ private:
std::vector<caf::PdmPointer<Rim3dView>> m_resViewsToUpdate; std::vector<caf::PdmPointer<Rim3dView>> m_resViewsToUpdate;
QTimer* m_resViewUpdateTimer; QTimer* m_resViewUpdateTimer;
}; };

View File

@ -25,7 +25,8 @@ ${CMAKE_CURRENT_LIST_DIR}/RiaTextFileCompare.h
${CMAKE_CURRENT_LIST_DIR}/RiaRegressionTestRunner.h ${CMAKE_CURRENT_LIST_DIR}/RiaRegressionTestRunner.h
${CMAKE_CURRENT_LIST_DIR}/RiaExtractionTools.h ${CMAKE_CURRENT_LIST_DIR}/RiaExtractionTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaFilePathTools.h ${CMAKE_CURRENT_LIST_DIR}/RiaFilePathTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaTimeHistoryCurveMerger.h ${CMAKE_CURRENT_LIST_DIR}/RiaCurveMerger.h
${CMAKE_CURRENT_LIST_DIR}/RiaCurveMerger.inl
${CMAKE_CURRENT_LIST_DIR}/RiaCurveDataTools.h ${CMAKE_CURRENT_LIST_DIR}/RiaCurveDataTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaTimeHistoryCurveResampler.h ${CMAKE_CURRENT_LIST_DIR}/RiaTimeHistoryCurveResampler.h
${CMAKE_CURRENT_LIST_DIR}/RiaStatisticsTools.h ${CMAKE_CURRENT_LIST_DIR}/RiaStatisticsTools.h
@ -67,7 +68,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiaTextFileCompare.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaRegressionTestRunner.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaRegressionTestRunner.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaExtractionTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaExtractionTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaFilePathTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaFilePathTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaTimeHistoryCurveMerger.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaCurveMerger.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaCurveDataTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaCurveDataTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaTimeHistoryCurveResampler.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaTimeHistoryCurveResampler.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaStatisticsTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaStatisticsTools.cpp

View File

@ -48,7 +48,6 @@
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -64,43 +63,74 @@ bool RiaArgumentParser::parseArguments(cvf::ProgramOptions* progOpt)
"<casename|filename> [<casename|filename> ...]", "<casename|filename> [<casename|filename> ...]",
"Imports the Eclipse cases specified by case name with or without extension." "Imports the Eclipse cases specified by case name with or without extension."
"If <casename>, import the corresponding grid file and summary file" "If <casename>, import the corresponding grid file and summary file"
"If <filename> has extension .GRRID/.EGRID, import the grid file and corresponding summary file" "If <filename> has extension .GRRID/.EGRID, import the grid file and corresponding "
"If <filename> has extension .SMSPEC, import the summary file (does not open the corresponding grid file)", "summary file"
"If <filename> has extension .SMSPEC, import the summary file (does not open the "
"corresponding grid file)",
cvf::ProgramOptions::MULTI_VALUE );
progOpt->registerOption( "size",
"<width> <height>",
"Set size of the main application window.",
cvf::ProgramOptions::MULTI_VALUE ); cvf::ProgramOptions::MULTI_VALUE );
progOpt->registerOption("size", "<width> <height>", "Set size of the main application window.", cvf::ProgramOptions::MULTI_VALUE);
progOpt->registerOption( "console", "", "Launch as a console application without graphics" ); progOpt->registerOption( "console", "", "Launch as a console application without graphics" );
progOpt->registerOption("server", "[<portnumber>]", "Launch as a GRPC server. Default port is 50051", cvf::ProgramOptions::SINGLE_VALUE); progOpt->registerOption( "server",
"[<portnumber>]",
"Launch as a GRPC server. Default port is 50051",
cvf::ProgramOptions::SINGLE_VALUE );
progOpt->registerOption( "startdir", "<folder>", "Set startup directory.\n", cvf::ProgramOptions::SINGLE_VALUE ); progOpt->registerOption( "startdir", "<folder>", "Set startup directory.\n", cvf::ProgramOptions::SINGLE_VALUE );
progOpt->registerOption("commandFile", "<commandfile>", "Execute the command file.", cvf::ProgramOptions::SINGLE_VALUE); progOpt->registerOption( "summaryplot",
"[<plotOptions>] <eclipsesummaryvectors> <eclipsedatafiles>",
"Creates a summary plot using all the <eclipsedatafiles>,"
"and all the summary vectors defined in <eclipsesummaryvectors>."
"Use --summaryplot -help to show a more detailed help text.\n",
cvf::ProgramOptions::OPTIONAL_MULTI_VALUE );
progOpt->registerOption( "commandFile",
"<commandfile>",
"Execute the command file.",
cvf::ProgramOptions::SINGLE_VALUE );
progOpt->registerOption( "commandFileReplaceCases", progOpt->registerOption( "commandFileReplaceCases",
"[<caseId>] <caseListFile>", "[<caseId>] <caseListFile>",
"Supply list of cases to replace in project, performing command file for each case.", "Supply list of cases to replace in project, performing command file for each case.",
cvf::ProgramOptions::SINGLE_VALUE ); cvf::ProgramOptions::SINGLE_VALUE );
progOpt->registerOption( "commandFileProject", progOpt->registerOption( "commandFileProject",
"<filename>", "<filename>",
"Project to use if performing case looping for command file. Used in conjunction with 'commandFileReplaceCases'.\n", "Project to use if performing case looping for command file. Used in conjunction with "
"'commandFileReplaceCases'.\n",
cvf::ProgramOptions::SINGLE_VALUE ); cvf::ProgramOptions::SINGLE_VALUE );
progOpt->registerOption( "snapshotsize",
"<width> <height>",
"Set size of exported snapshot images.",
cvf::ProgramOptions::MULTI_VALUE );
progOpt->registerOption( "snapshotfolder",
"<folder>",
"Set the destination folder for exported snapshot images.\n",
cvf::ProgramOptions::SINGLE_VALUE );
progOpt->registerOption( "savesnapshots", progOpt->registerOption( "savesnapshots",
"all|views|plots", "all|views|plots",
"Save snapshot of all views or plots to project file location sub folder 'snapshots'. Option 'all' " "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.", "will include both views and plots. Application closes after snapshots have been written.",
cvf::ProgramOptions::OPTIONAL_MULTI_VALUE ); cvf::ProgramOptions::OPTIONAL_MULTI_VALUE );
progOpt->registerOption( "multiCaseSnapshots", progOpt->registerOption( "multiCaseSnapshots",
"<gridListFile>", "<gridListFile>",
"For each grid file listed in the <gridListFile> file, replace the first case in the project and save " "For each grid file listed in the <gridListFile> file, replace the first case in the "
"project and save "
"snapshots of all views.\n", "snapshots of all views.\n",
cvf::ProgramOptions::SINGLE_VALUE ); cvf::ProgramOptions::SINGLE_VALUE );
progOpt->registerOption( "replaceCase", progOpt->registerOption( "replaceCase",
"[<caseId>] <newGridFile>", "[<caseId>] <newGridFile>",
"Replace grid in <caseId> or first case with <newgridFile>. Repeat parameter for multiple replace operations.", "Replace grid in <caseId> or first case with <newgridFile>. Repeat parameter for multiple "
"replace operations.",
cvf::ProgramOptions::MULTI_VALUE, cvf::ProgramOptions::MULTI_VALUE,
cvf::ProgramOptions::COMBINE_REPEATED ); cvf::ProgramOptions::COMBINE_REPEATED );
progOpt->registerOption( "replaceSourceCases", progOpt->registerOption( "replaceSourceCases",
"[<caseGroupId>] <gridListFile>", "[<caseGroupId>] <gridListFile>",
"Replace source cases in <caseGroupId> or first grid case group with the grid files listed in the " "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.", "<gridListFile> file. Repeat parameter for multiple replace operations.",
cvf::ProgramOptions::MULTI_VALUE, cvf::ProgramOptions::MULTI_VALUE,
cvf::ProgramOptions::COMBINE_REPEATED ); cvf::ProgramOptions::COMBINE_REPEATED );
@ -109,7 +139,6 @@ bool RiaArgumentParser::parseArguments(cvf::ProgramOptions* progOpt)
"Replace the folder containing property files for an eclipse input case.\n", "Replace the folder containing property files for an eclipse input case.\n",
cvf::ProgramOptions::MULTI_VALUE ); cvf::ProgramOptions::MULTI_VALUE );
progOpt->registerOption( "updateregressiontestbase", "<folder>", "System command", cvf::ProgramOptions::SINGLE_VALUE ); progOpt->registerOption( "updateregressiontestbase", "<folder>", "System command", cvf::ProgramOptions::SINGLE_VALUE );
progOpt->registerOption( "regressiontest", "<folder>", "System command", cvf::ProgramOptions::SINGLE_VALUE ); progOpt->registerOption( "regressiontest", "<folder>", "System command", cvf::ProgramOptions::SINGLE_VALUE );
#ifdef USE_UNIT_TESTS #ifdef USE_UNIT_TESTS
@ -123,8 +152,8 @@ bool RiaArgumentParser::parseArguments(cvf::ProgramOptions* progOpt)
bool parseOk = progOpt->parse( cvfqt::Utils::toStringVector( 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 // If positional parameter functionality is to be supported, the test for existence of positionalParameters must be
// This is based on a pull request by @andlaus https://github.com/OPM/ResInsight/pull/162 // removed This is based on a pull request by @andlaus https://github.com/OPM/ResInsight/pull/162
if ( !parseOk || !progOpt->positionalParameters().empty() ) if ( !parseOk || !progOpt->positionalParameters().empty() )
{ {
return false; return false;

View File

@ -34,4 +34,3 @@ class RiaArgumentParser
public: public:
static bool parseArguments( cvf::ProgramOptions* progOpt ); static bool parseArguments( cvf::ProgramOptions* progOpt );
}; };

View File

@ -20,7 +20,6 @@
#pragma once #pragma once
#include <cvfBase.h>
#include <cvfBoundingBox.h> #include <cvfBoundingBox.h>
//================================================================================================== //==================================================================================================

View File

@ -53,8 +53,10 @@ std::vector<std::vector<cvf::Vec3d>> calcFacePoints(const std::vector<cvf::Vec3d
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<cvf::Vec3d> std::vector<cvf::Vec3d> RiaCellDividingTools::createHexCornerCoords( std::array<cvf::Vec3d, 8> mainCellCorners,
RiaCellDividingTools::createHexCornerCoords(std::array<cvf::Vec3d, 8> mainCellCorners, size_t nx, size_t ny, size_t nz) size_t nx,
size_t ny,
size_t nz )
{ {
std::array<std::pair<size_t, size_t>, 12> edgeCorners = { std::array<std::pair<size_t, size_t>, 12> edgeCorners = {
std::make_pair( 0, 1 ), std::make_pair( 0, 1 ),
@ -77,8 +79,9 @@ RiaCellDividingTools::createHexCornerCoords(std::array<cvf::Vec3d, 8> mainCellCo
for ( int i = 0; i < 12; i++ ) for ( int i = 0; i < 12; i++ )
{ {
int partCountsIndex = i / 4; int partCountsIndex = i / 4;
edgePoints[i] = edgePoints[i] = splitLine( mainCellCorners[edgeCorners[i].first],
splitLine(mainCellCorners[edgeCorners[i].first], mainCellCorners[edgeCorners[i].second], nxyz[partCountsIndex]); mainCellCorners[edgeCorners[i].second],
nxyz[partCountsIndex] );
} }
// lowIJ, highIJ, lowJK, highKJ, // lowIJ, highIJ, lowJK, highKJ,
@ -149,7 +152,8 @@ double RiaCellDividingTools::computeFlowDistance(const std::array<cvf::Vec3d, 8>
cvf::Vec3d centerOfSubCell = cvf::Vec3d::ZERO; cvf::Vec3d centerOfSubCell = cvf::Vec3d::ZERO;
{ {
cvf::Vec3d vertexSum = cvf::Vec3d::ZERO; cvf::Vec3d vertexSum = cvf::Vec3d::ZERO;
for (size_t v = 0; v < 8; v++) vertexSum += subCellCorners[c * 8 + v]; for ( size_t v = 0; v < 8; v++ )
vertexSum += subCellCorners[c * 8 + v];
centerOfSubCell = vertexSum / 8; centerOfSubCell = vertexSum / 8;
} }

View File

@ -18,11 +18,10 @@
#pragma once #pragma once
#include <cvfBase.h>
#include <cvfVector3.h> #include <cvfVector3.h>
#include <vector>
#include <array> #include <array>
#include <vector>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///

View File

@ -23,21 +23,18 @@
#include <QColor> #include <QColor>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const caf::ColorTable& RiaColorTables::normalPaletteColors() const caf::ColorTable& RiaColorTables::normalPaletteColors()
{ {
static std::vector<cvf::Color3ub> colors { static std::vector<cvf::Color3ub> colors{cvf::Color3ub( 0, 0, 255 ),
cvf::Color3ub( 0, 0, 255),
cvf::Color3ub( 0, 127, 255 ), cvf::Color3ub( 0, 127, 255 ),
cvf::Color3ub( 0, 255, 255 ), cvf::Color3ub( 0, 255, 255 ),
cvf::Color3ub( 0, 255, 0 ), cvf::Color3ub( 0, 255, 0 ),
cvf::Color3ub( 255, 255, 0 ), cvf::Color3ub( 255, 255, 0 ),
cvf::Color3ub( 255, 127, 0 ), cvf::Color3ub( 255, 127, 0 ),
cvf::Color3ub(255, 0, 0) cvf::Color3ub( 255, 0, 0 )};
};
static caf::ColorTable colorTable = caf::ColorTable( colors ); static caf::ColorTable colorTable = caf::ColorTable( colors );
@ -49,15 +46,13 @@ const caf::ColorTable& RiaColorTables::normalPaletteColors()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const caf::ColorTable& RiaColorTables::normalPaletteOppositeOrderingColors() const caf::ColorTable& RiaColorTables::normalPaletteOppositeOrderingColors()
{ {
static std::vector<cvf::Color3ub> colors{ static std::vector<cvf::Color3ub> colors{cvf::Color3ub( 255, 0, 0 ),
cvf::Color3ub(255, 0, 0),
cvf::Color3ub( 255, 127, 0 ), cvf::Color3ub( 255, 127, 0 ),
cvf::Color3ub( 255, 255, 0 ), cvf::Color3ub( 255, 255, 0 ),
cvf::Color3ub( 0, 255, 0 ), cvf::Color3ub( 0, 255, 0 ),
cvf::Color3ub( 0, 255, 255 ), cvf::Color3ub( 0, 255, 255 ),
cvf::Color3ub( 0, 127, 255 ), cvf::Color3ub( 0, 127, 255 ),
cvf::Color3ub( 0, 0, 255) cvf::Color3ub( 0, 0, 255 )};
};
static caf::ColorTable colorTable = caf::ColorTable( colors ); static caf::ColorTable colorTable = caf::ColorTable( colors );
@ -69,10 +64,7 @@ const caf::ColorTable& RiaColorTables::normalPaletteOppositeOrderingColors()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const caf::ColorTable& RiaColorTables::blackWhitePaletteColors() const caf::ColorTable& RiaColorTables::blackWhitePaletteColors()
{ {
static std::vector<cvf::Color3ub> colors{ static std::vector<cvf::Color3ub> colors{cvf::Color3ub::BLACK, cvf::Color3ub::WHITE};
cvf::Color3ub::BLACK,
cvf::Color3ub::WHITE
};
static caf::ColorTable colorTable = caf::ColorTable( colors ); static caf::ColorTable colorTable = caf::ColorTable( colors );
@ -84,10 +76,7 @@ const caf::ColorTable& RiaColorTables::blackWhitePaletteColors()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const caf::ColorTable& RiaColorTables::whiteBlackPaletteColors() const caf::ColorTable& RiaColorTables::whiteBlackPaletteColors()
{ {
static std::vector<cvf::Color3ub> colors{ static std::vector<cvf::Color3ub> colors{cvf::Color3ub::WHITE, cvf::Color3ub::BLACK};
cvf::Color3ub::WHITE,
cvf::Color3ub::BLACK
};
static caf::ColorTable colorTable = caf::ColorTable( colors ); static caf::ColorTable colorTable = caf::ColorTable( colors );
@ -99,10 +88,7 @@ const caf::ColorTable& RiaColorTables::whiteBlackPaletteColors()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const caf::ColorTable& RiaColorTables::pinkWhitePaletteColors() const caf::ColorTable& RiaColorTables::pinkWhitePaletteColors()
{ {
static std::vector<cvf::Color3ub> colors{ static std::vector<cvf::Color3ub> colors{cvf::Color3ub::DEEP_PINK, cvf::Color3ub::WHITE};
cvf::Color3ub::DEEP_PINK,
cvf::Color3ub::WHITE
};
static caf::ColorTable colorTable = caf::ColorTable( colors ); static caf::ColorTable colorTable = caf::ColorTable( colors );
@ -114,10 +100,7 @@ const caf::ColorTable& RiaColorTables::pinkWhitePaletteColors()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const caf::ColorTable& RiaColorTables::whitePinkPaletteColors() const caf::ColorTable& RiaColorTables::whitePinkPaletteColors()
{ {
static std::vector<cvf::Color3ub> colors{ static std::vector<cvf::Color3ub> colors{cvf::Color3ub::WHITE, cvf::Color3ub::DEEP_PINK};
cvf::Color3ub::WHITE,
cvf::Color3ub::DEEP_PINK
};
static caf::ColorTable colorTable = caf::ColorTable( colors ); static caf::ColorTable colorTable = caf::ColorTable( colors );
@ -129,11 +112,7 @@ const caf::ColorTable& RiaColorTables::whitePinkPaletteColors()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const caf::ColorTable& RiaColorTables::blueWhiteRedPaletteColors() const caf::ColorTable& RiaColorTables::blueWhiteRedPaletteColors()
{ {
static std::vector<cvf::Color3ub> colors{ static std::vector<cvf::Color3ub> colors{cvf::Color3ub::BLUE, cvf::Color3ub::WHITE, cvf::Color3ub::RED};
cvf::Color3ub::BLUE,
cvf::Color3ub::WHITE,
cvf::Color3ub::RED
};
static caf::ColorTable colorTable = caf::ColorTable( colors ); static caf::ColorTable colorTable = caf::ColorTable( colors );
@ -145,11 +124,7 @@ const caf::ColorTable& RiaColorTables::blueWhiteRedPaletteColors()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const caf::ColorTable& RiaColorTables::redWhiteBluePaletteColors() const caf::ColorTable& RiaColorTables::redWhiteBluePaletteColors()
{ {
static std::vector<cvf::Color3ub> colors{ static std::vector<cvf::Color3ub> colors{cvf::Color3ub::RED, cvf::Color3ub::WHITE, cvf::Color3ub::BLUE};
cvf::Color3ub::RED,
cvf::Color3ub::WHITE,
cvf::Color3ub::BLUE
};
static caf::ColorTable colorTable = caf::ColorTable( colors ); static caf::ColorTable colorTable = caf::ColorTable( colors );
@ -226,8 +201,7 @@ const caf::ColorTable& RiaColorTables::tensorsMagentaBrownGrayPaletteColors()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const caf::ColorTable& RiaColorTables::angularPaletteColors() const caf::ColorTable& RiaColorTables::angularPaletteColors()
{ {
static std::vector<cvf::Color3ub> colors{ static std::vector<cvf::Color3ub> colors{cvf::Color3ub( 255, 0, 255 ),
cvf::Color3ub(255, 0, 255),
cvf::Color3ub( 0, 0, 255 ), cvf::Color3ub( 0, 0, 255 ),
cvf::Color3ub( 0, 127, 255 ), cvf::Color3ub( 0, 127, 255 ),
cvf::Color3ub( 0, 255, 255 ), cvf::Color3ub( 0, 255, 255 ),
@ -235,8 +209,7 @@ const caf::ColorTable& RiaColorTables::angularPaletteColors()
cvf::Color3ub( 255, 255, 0 ), cvf::Color3ub( 255, 255, 0 ),
cvf::Color3ub( 255, 127, 0 ), cvf::Color3ub( 255, 127, 0 ),
cvf::Color3ub( 255, 0, 0 ), cvf::Color3ub( 255, 0, 0 ),
cvf::Color3ub(255, 0, 255) cvf::Color3ub( 255, 0, 255 )};
};
static caf::ColorTable colorTable = caf::ColorTable( colors ); static caf::ColorTable colorTable = caf::ColorTable( colors );
@ -413,8 +386,7 @@ const caf::ColorTable& RiaColorTables::summaryCurveNoneRedGreenBlueBrownPaletteC
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const caf::ColorTable& RiaColorTables::wellLogPlotPaletteColors() const caf::ColorTable& RiaColorTables::wellLogPlotPaletteColors()
{ {
static std::vector<cvf::Color3ub> colors{ static std::vector<cvf::Color3ub> colors{caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::darkBlue ) ),
caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::darkBlue)),
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::darkRed ) ), caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::darkRed ) ),
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::darkGreen ) ), caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::darkGreen ) ),
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::darkYellow ) ), caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::darkYellow ) ),
@ -428,8 +400,7 @@ const caf::ColorTable& RiaColorTables::wellLogPlotPaletteColors()
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::magenta ) ), caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::magenta ) ),
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::cyan ) ), caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::cyan ) ),
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::gray ) ), caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::gray ) ),
caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::black)) caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::black ) )};
};
static caf::ColorTable colorTable = caf::ColorTable( colors ); static caf::ColorTable colorTable = caf::ColorTable( colors );
@ -441,15 +412,13 @@ const caf::ColorTable& RiaColorTables::wellLogPlotPaletteColors()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const caf::ColorTable& RiaColorTables::selectionPaletteColors() const caf::ColorTable& RiaColorTables::selectionPaletteColors()
{ {
static std::vector<cvf::Color3ub> colors{ static std::vector<cvf::Color3ub> colors{caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::magenta ) ),
caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::magenta)),
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::cyan ) ), caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::cyan ) ),
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::blue ) ), caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::blue ) ),
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::red ) ), caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::red ) ),
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::green ) ), caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::green ) ),
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::yellow ) ), caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::yellow ) ),
caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::gray)) caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::gray ) )};
};
static caf::ColorTable colorTable = caf::ColorTable( colors ); static caf::ColorTable colorTable = caf::ColorTable( colors );
@ -489,7 +458,7 @@ const caf::ColorTable& RiaColorTables::timestepsPaletteColors()
const caf::ColorTable& RiaColorTables::editableWellPathsPaletteColors() const caf::ColorTable& RiaColorTables::editableWellPathsPaletteColors()
{ {
static std::vector<cvf::Color3ub> colors{ static std::vector<cvf::Color3ub> colors{
cvf::Color3ub( 204, 0, 204), // Dark magenta cvf::Color3ub( 201, 145, 201 ), // Gray pink
cvf::Color3ub( 173, 23, 212 ), // Strong Purple cvf::Color3ub( 173, 23, 212 ), // Strong Purple
cvf::Color3ub( 143, 46, 219 ), // Purple cvf::Color3ub( 143, 46, 219 ), // Purple
cvf::Color3ub( 102, 76, 230 ), // Gray Blue cvf::Color3ub( 102, 76, 230 ), // Gray Blue
@ -549,7 +518,6 @@ cvf::Color3f RiaColorTables::defaultGridLineColor()
return cvf::Color3f( 0.92f, 0.92f, 0.92f ); return cvf::Color3f( 0.92f, 0.92f, 0.92f );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -594,7 +562,8 @@ caf::ColorTable RiaColorTables::createBrightnessBasedColorTable(cvf::Color3ub ba
for ( int i = 0; i < brightnessLevelCount; ++i ) for ( int i = 0; i < brightnessLevelCount; ++i )
{ {
float brightness = static_cast<float>( i ) / static_cast<float>( brightnessLevelCount - 1 ); float brightness = static_cast<float>( i ) / static_cast<float>( brightnessLevelCount - 1 );
colors.push_back(cvf::Color3ub(RiaColorTools::fromQColorTo3f(QColor::fromHslF(hueF, satF, brightness)))); colors.push_back(
cvf::Color3ub( RiaColorTools::fromQColorTo3f( QColor::fromHslF( hueF, satF, brightness ) ) ) );
} }
} }
return caf::ColorTable( colors ); return caf::ColorTable( colors );

View File

@ -70,8 +70,8 @@ public:
static cvf::Color3f defaultWellLabelColor(); static cvf::Color3f defaultWellLabelColor();
static cvf::Color3f defaultViewerBackgroundColor(); static cvf::Color3f defaultViewerBackgroundColor();
static caf::ColorTable createBrightnessBasedColorTable( cvf::Color3ub baseColor, int brightnessLevelCount ); static caf::ColorTable createBrightnessBasedColorTable( cvf::Color3ub baseColor, int brightnessLevelCount );
private: private:
static std::vector<cvf::Color3ub> categoryColors(); static std::vector<cvf::Color3ub> categoryColors();
static std::vector<cvf::Color3ub> contrastCategoryColors(); static std::vector<cvf::Color3ub> contrastCategoryColors();

View File

@ -63,8 +63,9 @@ cvf::Color3f RiaColorTools::computeOffsetColor(cvf::Color3f color, float offsetF
gridB = color.b() + ( 1.0f - color.b() ) * offsetFactor; gridB = color.b() + ( 1.0f - color.b() ) * offsetFactor;
} }
return cvf::Color3f( return cvf::Color3f( cvf::Math::clamp( gridR, 0.0f, 1.0f ),
cvf::Math::clamp(gridR, 0.0f, 1.0f), cvf::Math::clamp(gridG, 0.0f, 1.0f), cvf::Math::clamp(gridB, 0.0f, 1.0f)); cvf::Math::clamp( gridG, 0.0f, 1.0f ),
cvf::Math::clamp( gridB, 0.0f, 1.0f ) );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -99,7 +100,6 @@ cvf::Color3f RiaColorTools::brightContrastColorSofter()
return cvf::Color3f::fromByteColor( 200, 200, 200 ); return cvf::Color3f::fromByteColor( 200, 200, 200 );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -107,12 +107,10 @@ cvf::Color3f RiaColorTools::contrastColor(cvf::Color3f backgroundColor, bool sof
{ {
if ( isBrightnessAboveThreshold( backgroundColor ) ) if ( isBrightnessAboveThreshold( backgroundColor ) )
{ {
if (softerContrast) if ( softerContrast ) return darkContrastColorSofter();
return darkContrastColorSofter();
return darkContrastColor(); return darkContrastColor();
} }
if (softerContrast) if ( softerContrast ) return brightContrastColorSofter();
return brightContrastColorSofter();
return brightContrastColor(); return brightContrastColor();
} }
@ -142,6 +140,21 @@ cvf::Color3f RiaColorTools::fromQColorTo3f(QColor color)
return cvf::Color3f( color.redF(), color.greenF(), color.blueF() ); return cvf::Color3f( color.redF(), color.greenF(), color.blueF() );
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Color3f RiaColorTools::blendCvfColors( const cvf::Color3f& color1,
const cvf::Color3f& color2,
int weight1 /*= 1*/,
int weight2 /*= 1*/ )
{
CVF_ASSERT( weight1 > 0 && weight2 > 0 );
int weightsum = weight1 + weight2;
return cvf::Color3f( ( color1.r() * weight1 + color2.r() * weight2 ) / weightsum,
( color1.g() * weight1 + color2.g() * weight2 ) / weightsum,
( color1.b() * weight1 + color2.b() * weight2 ) / weightsum );
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -19,7 +19,6 @@
#pragma once #pragma once
#include "cvfBase.h"
#include "cvfArray.h" #include "cvfArray.h"
#include <QColor> #include <QColor>
@ -43,6 +42,8 @@ public:
static QColor toQColor( cvf::Color4f color ); static QColor toQColor( cvf::Color4f color );
static cvf::Color3f fromQColorTo3f( QColor ); static cvf::Color3f fromQColorTo3f( QColor );
static cvf::Color3f
blendCvfColors( const cvf::Color3f& color1, const cvf::Color3f& color2, int weight1 = 1, int weight2 = 1 );
static QColor blendQColors( const QColor& color1, const QColor& color2, int weight1 = 1, int weight2 = 1 ); static QColor blendQColors( const QColor& color1, const QColor& color2, int weight1 = 1, int weight2 = 1 );
private: private:

View File

@ -19,10 +19,8 @@
#include "RiaCurveDataTools.h" #include "RiaCurveDataTools.h"
#include <cmath> // Needed for HUGE_VAL on Linux #include <cmath> // Needed for HUGE_VAL on Linux
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -63,7 +61,6 @@ RiaCurveDataTools::CurveIntervals RiaCurveDataTools::calculateIntervalsOfValidVa
return intervals; return intervals;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -86,7 +83,6 @@ std::vector<std::pair<size_t, size_t>> RiaCurveDataTools::computePolyLineStartSt
return lineStartAndStopIndices; return lineStartAndStopIndices;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -104,4 +100,3 @@ bool RiaCurveDataTools::isValidValue(double value, bool allowPositiveValuesOnly)
return true; return true;
} }

View File

@ -22,13 +22,12 @@
#include "cvfAssert.h" #include "cvfAssert.h"
#include <cstddef> #include <cstddef>
#include <vector>
#include <utility>
#include <set> #include <set>
#include <utility>
#include <vector>
class QDateTime; class QDateTime;
//================================================================================================== //==================================================================================================
/// ///
//================================================================================================== //==================================================================================================
@ -37,6 +36,12 @@ class RiaCurveDataTools
public: public:
typedef std::vector<std::pair<size_t, size_t>> CurveIntervals; typedef std::vector<std::pair<size_t, size_t>> CurveIntervals;
enum ErrorAxis
{
ERROR_ALONG_X_AXIS,
ERROR_ALONG_Y_AXIS
};
public: public:
static CurveIntervals calculateIntervalsOfValidValues( const std::vector<double>& values, static CurveIntervals calculateIntervalsOfValidValues( const std::vector<double>& values,
bool includePositiveValuesOnly ); bool includePositiveValuesOnly );
@ -62,4 +67,3 @@ public:
public: public:
static bool isValidValue( double value, bool allowPositiveValuesOnly ); static bool isValidValue( double value, bool allowPositiveValuesOnly );
}; };

View File

@ -0,0 +1,20 @@
#include "RiaCurveMerger.h"
#include <algorithm>
#include <time.h>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template <>
bool XValueComparator<double>::equals( const double& lhs, const double& rhs )
{
double eps = 1.0e-12 * std::max( std::fabs( lhs ), std::fabs( rhs ) );
return std::fabs( lhs - rhs ) < eps;
}
template <>
double XValueComparator<time_t>::diff( const time_t& lhs, const time_t& rhs )
{
return difftime( lhs, rhs );
}

View File

@ -0,0 +1,86 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RiaCurveDataTools.h"
#include <ctime>
template <typename XValueType>
class XValueComparator
{
public:
bool operator()( const XValueType& lhs, const XValueType& rhs ) const;
static bool equals( const XValueType& lhs, const XValueType& rhs );
static double diff( const XValueType& lhs, const XValueType& rhs );
};
//==================================================================================================
///
//==================================================================================================
template <typename XValueType>
class RiaCurveMerger
{
public:
typedef XValueComparator<XValueType> XComparator;
RiaCurveMerger();
void addCurveData( const std::vector<XValueType>& xValues, const std::vector<double>& yValues );
size_t curveCount() const;
void computeInterpolatedValues( bool includeValuesFromPartialCurves = true );
RiaCurveDataTools::CurveIntervals validIntervalsForAllXValues() const;
const std::vector<XValueType>& allXValues() const;
const std::vector<double>& interpolatedYValuesForAllXValues( size_t curveIdx ) const;
// Non-const access is not required by any clients, but the expression parser has no available const interface
// for specifying a data source for an expression variable. Allow non-const access to avoid copy of the contained
// values, interpolated for all time steps
//
// See ExpressionParserImpl::assignVector()
std::vector<double>& interpolatedYValuesForAllXValues( size_t curveIdx );
public:
// Helper methods, available as public to be able to access from unit tests
static double interpolatedYValue( const XValueType& xValue,
const std::vector<XValueType>& curveXValues,
const std::vector<double>& curveYValues );
private:
void computeUnionOfXValues( bool includeValuesFromPartialCurves );
private:
std::vector<std::pair<std::vector<XValueType>, std::vector<double>>> m_originalValues;
RiaCurveDataTools::CurveIntervals m_validIntervalsForAllXValues;
std::vector<XValueType> m_allXValues;
std::vector<std::vector<double>> m_interpolatedValuesForAllCurves;
};
typedef RiaCurveMerger<time_t> RiaTimeHistoryCurveMerger;
template <>
bool XValueComparator<double>::equals( const double& lhs, const double& rhs );
template <>
double XValueComparator<time_t>::diff( const time_t& lhs, const time_t& rhs );
#include "RiaCurveMerger.inl"

View File

@ -0,0 +1,286 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 <algorithm>
#include <cmath> // Needed for HUGE_VAL on Linux
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template <typename XValueType>
bool XValueComparator<XValueType>::operator()( const XValueType& lhs, const XValueType& rhs ) const
{
if ( XValueComparator<XValueType>::equals( lhs, rhs ) )
{
return false;
}
return lhs < rhs;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template <typename XValueType>
double XValueComparator<XValueType>::diff( const XValueType& lhs, const XValueType& rhs )
{
return lhs - rhs;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template <typename XValueType>
bool XValueComparator<XValueType>::equals( const XValueType& lhs, const XValueType& rhs )
{
return lhs == rhs;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template <typename XValueType>
RiaCurveMerger<XValueType>::RiaCurveMerger()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template <typename XValueType>
void RiaCurveMerger<XValueType>::addCurveData( const std::vector<XValueType>& xValues, const std::vector<double>& yValues )
{
CVF_ASSERT( xValues.size() == yValues.size() );
m_originalValues.push_back( std::make_pair( xValues, yValues ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template <typename XValueType>
size_t RiaCurveMerger<XValueType>::curveCount() const
{
return m_interpolatedValuesForAllCurves.size();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template <typename XValueType>
RiaCurveDataTools::CurveIntervals RiaCurveMerger<XValueType>::validIntervalsForAllXValues() const
{
return m_validIntervalsForAllXValues;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template <typename XValueType>
const std::vector<XValueType>& RiaCurveMerger<XValueType>::allXValues() const
{
return m_allXValues;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template <typename XValueType>
const std::vector<double>& RiaCurveMerger<XValueType>::interpolatedYValuesForAllXValues( size_t curveIdx ) const
{
CVF_ASSERT( curveIdx < m_interpolatedValuesForAllCurves.size() );
return m_interpolatedValuesForAllCurves[curveIdx];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template <typename XValueType>
std::vector<double>& RiaCurveMerger<XValueType>::interpolatedYValuesForAllXValues( size_t curveIdx )
{
CVF_ASSERT( curveIdx < m_interpolatedValuesForAllCurves.size() );
return m_interpolatedValuesForAllCurves[curveIdx];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template <typename XValueType>
void RiaCurveMerger<XValueType>::computeInterpolatedValues( bool includeValuesFromPartialCurves )
{
m_validIntervalsForAllXValues.clear();
m_allXValues.clear();
m_interpolatedValuesForAllCurves.clear();
computeUnionOfXValues( includeValuesFromPartialCurves );
const size_t curveCount = m_originalValues.size();
if ( curveCount == 0 )
{
return;
}
const size_t dataValueCount = m_allXValues.size();
if ( dataValueCount == 0 )
{
return;
}
m_interpolatedValuesForAllCurves.resize( curveCount );
std::vector<double> accumulatedValidValues( dataValueCount, 1.0 );
for ( size_t curveIdx = 0; curveIdx < curveCount; curveIdx++ )
{
std::vector<double>& curveValues = m_interpolatedValuesForAllCurves[curveIdx];
curveValues.resize( dataValueCount );
for ( size_t valueIndex = 0; valueIndex < dataValueCount; valueIndex++ )
{
double interpolValue = interpolatedYValue( m_allXValues[valueIndex],
m_originalValues[curveIdx].first,
m_originalValues[curveIdx].second );
if ( !RiaCurveDataTools::isValidValue( interpolValue, false ) )
{
accumulatedValidValues[valueIndex] = HUGE_VAL;
}
curveValues[valueIndex] = interpolValue;
}
}
m_validIntervalsForAllXValues = RiaCurveDataTools::calculateIntervalsOfValidValues( accumulatedValidValues, false );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template <typename XValueType>
void RiaCurveMerger<XValueType>::computeUnionOfXValues( bool includeValuesForPartialCurves )
{
m_allXValues.clear();
std::set<XValueType, XComparator> unionOfXValues;
std::vector<std::pair<XValueType, XValueType>> originalXBounds;
for ( const auto& curveData : m_originalValues )
{
for ( const auto& x : curveData.first )
{
unionOfXValues.insert( x );
}
auto minmax_it = std::minmax_element( curveData.first.begin(), curveData.first.end() );
originalXBounds.push_back( std::make_pair( *( minmax_it.first ), *( minmax_it.second ) ) );
}
if ( !includeValuesForPartialCurves )
{
for ( auto it = unionOfXValues.begin(); it != unionOfXValues.end(); )
{
bool outsideBounds = false;
for ( const auto& curveXBounds : originalXBounds )
{
if ( *it < curveXBounds.first || *it > curveXBounds.second )
{
outsideBounds = true;
break;
}
}
if ( outsideBounds )
{
it = unionOfXValues.erase( it );
}
else
{
++it;
}
}
}
m_allXValues = std::vector<XValueType>( unionOfXValues.begin(), unionOfXValues.end() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template <typename XValueType>
double RiaCurveMerger<XValueType>::interpolatedYValue( const XValueType& interpolationXValue,
const std::vector<XValueType>& xValues,
const std::vector<double>& yValues )
{
if ( yValues.size() != xValues.size() ) return HUGE_VAL;
const bool removeInterpolatedValues = false;
for ( size_t firstI = 0; firstI < xValues.size(); firstI++ )
{
if ( XComparator::equals( xValues.at( firstI ), interpolationXValue ) )
{
const double& firstValue = yValues.at( firstI );
if ( !RiaCurveDataTools::isValidValue( firstValue, removeInterpolatedValues ) )
{
return HUGE_VAL;
}
return firstValue;
}
size_t secondI = firstI + 1;
if ( secondI < xValues.size() )
{
if ( XComparator::equals( xValues.at( secondI ), interpolationXValue ) )
{
const double& secondValue = yValues.at( secondI );
if ( !RiaCurveDataTools::isValidValue( secondValue, removeInterpolatedValues ) )
{
return HUGE_VAL;
}
return secondValue;
}
if ( xValues.at( firstI ) < interpolationXValue && xValues.at( secondI ) > interpolationXValue )
{
const double& firstValue = yValues.at( firstI );
const double& secondValue = yValues.at( secondI );
bool isFirstValid = RiaCurveDataTools::isValidValue( firstValue, removeInterpolatedValues );
if ( !isFirstValid ) return HUGE_VAL;
bool isSecondValid = RiaCurveDataTools::isValidValue( secondValue, removeInterpolatedValues );
if ( !isSecondValid ) return HUGE_VAL;
double firstDiff = fabs( XComparator::diff( interpolationXValue, xValues.at( firstI ) ) );
double secondDiff = fabs( XComparator::diff( xValues.at( secondI ), interpolationXValue ) );
double firstWeight = secondDiff / ( firstDiff + secondDiff );
double secondWeight = firstDiff / ( firstDiff + secondDiff );
double val = ( firstValue * firstWeight ) + ( secondValue * secondWeight );
CVF_ASSERT( RiaCurveDataTools::isValidValue( val, removeInterpolatedValues ) );
return val;
}
}
}
return HUGE_VAL;
}

View File

@ -18,26 +18,13 @@
#include "RiaDateStringParser.h" #include "RiaDateStringParser.h"
#include "RiaStdStringTools.h"
#include "RiaQDateTimeTools.h" #include "RiaQDateTimeTools.h"
#include "RiaStdStringTools.h"
#include <algorithm> #include <algorithm>
const std::string MONTH_NAMES[] = const std::string MONTH_NAMES[] =
{ {"january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"};
"january",
"february",
"march",
"april",
"may",
"june",
"july",
"august",
"september",
"october",
"november",
"december"
};
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -53,8 +40,7 @@ QDateTime RiaDateStringParser::parseDateString(const QString& dateString)
QDateTime RiaDateStringParser::parseDateString( const std::string& dateString ) QDateTime RiaDateStringParser::parseDateString( const std::string& dateString )
{ {
int year, month, day; int year, month, day;
bool parsedOk = bool parsedOk = tryParseYearFirst( dateString, year, month, day ) ||
tryParseYearFirst(dateString, year, month, day) ||
tryParseDayFirst( dateString, year, month, day ) || tryParseDayFirst( dateString, year, month, day ) ||
tryParseMonthFirst( dateString, year, month, day ); tryParseMonthFirst( dateString, year, month, day );
@ -162,8 +148,9 @@ bool RiaDateStringParser::tryParseMonth(const std::string& s, int &month)
{ {
auto sMonth = s; auto sMonth = s;
sMonth = trimString( sMonth ); sMonth = trimString( sMonth );
std::transform(sMonth.begin(), sMonth.end(), sMonth.begin(), std::transform( sMonth.begin(), sMonth.end(), sMonth.begin(), []( const char c ) -> char {
[](const char c) -> char { return (char)::tolower(c); }); return (char)::tolower( c );
} );
for ( int i = 0; i < 12; i++ ) for ( int i = 0; i < 12; i++ )
{ {

View File

@ -18,9 +18,9 @@
#pragma once #pragma once
#include <string>
#include <QString>
#include <QDateTime> #include <QDateTime>
#include <QString>
#include <string>
//================================================================================================== //==================================================================================================
// //
@ -44,4 +44,3 @@ private:
static std::string trimString( const std::string& s ); static std::string trimString( const std::string& s );
}; };

View File

@ -34,7 +34,7 @@ namespace caf
setDefault( RiaEclipseUnitTools::UNITS_METRIC ); setDefault( RiaEclipseUnitTools::UNITS_METRIC );
} }
} } // namespace caf
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -102,13 +102,14 @@ double RiaEclipseUnitTools::convertSurfaceGasFlowRateToOilEquivalents(UnitSystem
double oilEquivalentGasRate = HUGE_VAL; double oilEquivalentGasRate = HUGE_VAL;
if (caseUnitSystem == RiaEclipseUnitTools::UNITS_FIELD) oilEquivalentGasRate = fieldGasToOilEquivalent * eclGasFlowRate; if ( caseUnitSystem == RiaEclipseUnitTools::UNITS_FIELD )
if (caseUnitSystem == RiaEclipseUnitTools::UNITS_METRIC) oilEquivalentGasRate = metricGasToOilEquivalent * eclGasFlowRate; oilEquivalentGasRate = fieldGasToOilEquivalent * eclGasFlowRate;
if ( caseUnitSystem == RiaEclipseUnitTools::UNITS_METRIC )
oilEquivalentGasRate = metricGasToOilEquivalent * eclGasFlowRate;
return oilEquivalentGasRate; return oilEquivalentGasRate;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -116,11 +117,16 @@ QString RiaEclipseUnitTools::unitStringPressure(UnitSystem unitSystem)
{ {
switch ( unitSystem ) switch ( unitSystem )
{ {
case RiaEclipseUnitTools::UNITS_METRIC: return "barsa"; case RiaEclipseUnitTools::UNITS_METRIC:
case RiaEclipseUnitTools::UNITS_FIELD: return "psia"; return "barsa";
case RiaEclipseUnitTools::UNITS_LAB: return "atma"; case RiaEclipseUnitTools::UNITS_FIELD:
case RiaEclipseUnitTools::UNITS_UNKNOWN: return ""; return "psia";
default: return ""; case RiaEclipseUnitTools::UNITS_LAB:
return "atma";
case RiaEclipseUnitTools::UNITS_UNKNOWN:
return "";
default:
return "";
} }
} }

View File

@ -18,12 +18,11 @@
#pragma once #pragma once
#include "cafAppEnum.h"
#include "RiaDefines.h" #include "RiaDefines.h"
#include "cafAppEnum.h"
class RiaEclipseUnitTools class RiaEclipseUnitTools
{ {
public: public:
enum UnitSystem enum UnitSystem
{ {
@ -35,16 +34,43 @@ public:
typedef caf::AppEnum<RiaEclipseUnitTools::UnitSystem> UnitSystemType; typedef caf::AppEnum<RiaEclipseUnitTools::UnitSystem> UnitSystemType;
static double feetPerMeter() { return 3.2808399; } static double feetPerMeter()
static double meterPerFeet() { return 0.3048000; } {
return 3.2808399;
}
static double meterPerFeet()
{
return 0.3048000;
}
static double meterToFeet(double meter) { return meter * feetPerMeter(); } static double meterToFeet( double meter )
static double feetToMeter(double feet) { return feet * meterPerFeet();} {
static double meterToInch(double meter) { return meter * feetPerMeter()*12.0; } return meter * feetPerMeter();
static double inchToMeter(double inch) { return (inch / 12.0) * meterPerFeet(); } }
static double inchToFeet (double inch) { return (inch / 12.0); } static double feetToMeter( double feet )
static double mmToMeter(double mm) { return mm / 1000.0; } {
static double meterToMm(double meter) { return 1000.0 * meter; } 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 mmToMeter( double mm )
{
return mm / 1000.0;
}
static double meterToMm( double meter )
{
return 1000.0 * meter;
}
static double darcysConstant( UnitSystem unitSystem ); static double darcysConstant( UnitSystem unitSystem );
@ -57,4 +83,3 @@ public:
static double convertToMeter( double sourceValue, const QString& unitText ); static double convertToMeter( double sourceValue, const QString& unitText );
static double convertToFeet( double sourceValue, const QString& unitText ); static double convertToFeet( double sourceValue, const QString& unitText );
}; };

View File

@ -30,7 +30,8 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigEclipseWellLogExtractor* RiaExtractionTools::wellLogExtractorEclipseCase(RimWellPath* wellPath, RimEclipseCase* eclipseCase) RigEclipseWellLogExtractor* RiaExtractionTools::wellLogExtractorEclipseCase( RimWellPath* wellPath,
RimEclipseCase* eclipseCase )
{ {
auto wlPlotCollection = wellLogPlotCollection(); auto wlPlotCollection = wellLogPlotCollection();
if ( !wlPlotCollection ) return nullptr; if ( !wlPlotCollection ) return nullptr;
@ -41,7 +42,8 @@ RigEclipseWellLogExtractor* RiaExtractionTools::wellLogExtractorEclipseCase(RimW
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigGeoMechWellLogExtractor* RiaExtractionTools::wellLogExtractorGeoMechCase(RimWellPath* wellPath, RimGeoMechCase* geomCase) RigGeoMechWellLogExtractor* RiaExtractionTools::wellLogExtractorGeoMechCase( RimWellPath* wellPath,
RimGeoMechCase* geomCase )
{ {
auto wlPlotCollection = wellLogPlotCollection(); auto wlPlotCollection = wellLogPlotCollection();
if ( !wlPlotCollection ) return nullptr; if ( !wlPlotCollection ) return nullptr;
@ -72,8 +74,10 @@ RigEclipseWellLogExtractor* RiaExtractionTools::findOrCreateSimWellExtractor(con
QString caseUserDescription = eclipseCase->caseUserDescription(); QString caseUserDescription = eclipseCase->caseUserDescription();
return wlPlotCollection->findOrCreateSimWellExtractor( return wlPlotCollection->findOrCreateSimWellExtractor( simWell->name,
simWell->name, caseUserDescription, wellPathGeom, eclipseCase->eclipseCaseData()); caseUserDescription,
wellPathGeom,
eclipseCase->eclipseCaseData() );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -37,7 +37,8 @@ namespace RiaExtractionTools
RigEclipseWellLogExtractor* wellLogExtractorEclipseCase( RimWellPath* wellPath, RimEclipseCase* eclipseCase ); RigEclipseWellLogExtractor* wellLogExtractorEclipseCase( RimWellPath* wellPath, RimEclipseCase* eclipseCase );
RigGeoMechWellLogExtractor* wellLogExtractorGeoMechCase( RimWellPath* wellPath, RimGeoMechCase* geomCase ); RigGeoMechWellLogExtractor* wellLogExtractorGeoMechCase( RimWellPath* wellPath, RimGeoMechCase* geomCase );
RigEclipseWellLogExtractor* findOrCreateSimWellExtractor(const RimSimWellInView* simWell, const RigWellPath* wellPathGeom); RigEclipseWellLogExtractor* findOrCreateSimWellExtractor( const RimSimWellInView* simWell,
const RigWellPath* wellPathGeom );
RimWellLogPlotCollection* wellLogPlotCollection(); RimWellLogPlotCollection* wellLogPlotCollection();

View File

@ -22,7 +22,6 @@
#include <QDir> #include <QDir>
#include <set> #include <set>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -135,8 +134,6 @@ QString RiaFilePathTools::removeDuplicatePathSeparators(const QString& path)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RiaFilePathTools::rootSearchPathFromSearchFilter( const QString& searchFilter ) QString RiaFilePathTools::rootSearchPathFromSearchFilter( const QString& searchFilter )
{ {
std::set<QChar> globStartCharacters = {'*', '?', '['}; // ']' not needed
QStringList pathPartList = searchFilter.split( SEPARATOR ); QStringList pathPartList = searchFilter.split( SEPARATOR );
QStringList::iterator pathPartIt = pathPartList.begin(); QStringList::iterator pathPartIt = pathPartList.begin();
@ -155,7 +152,6 @@ QString RiaFilePathTools::rootSearchPathFromSearchFilter(const QString& searchFi
if ( pathPart.contains( "*" ) ) break; if ( pathPart.contains( "*" ) ) break;
if ( pathPart.contains( "?" ) ) break; if ( pathPart.contains( "?" ) ) break;
if ( pathPart.contains( "[" ) ) break; if ( pathPart.contains( "[" ) ) break;
} }
pathPartList.erase( pathPartIt, pathPartList.end() ); pathPartList.erase( pathPartIt, pathPartList.end() );

View File

@ -20,8 +20,8 @@
#pragma once #pragma once
#include <QString>
#include <QByteArray> #include <QByteArray>
#include <QString>
#include <string> #include <string>
//================================================================================================== //==================================================================================================

View File

@ -84,7 +84,6 @@ bool RiaGitDiff::executeDiff(const QString& baseFolder)
return false; return false;
} }
QByteArray stdErr = proc.readAllStandardError();
QByteArray stdOut = proc.readAllStandardOutput(); QByteArray stdOut = proc.readAllStandardOutput();
m_diffOutput = stdOut; m_diffOutput = stdOut;

View File

@ -17,9 +17,9 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
#include "RiaImageCompareReporter.h" #include "RiaImageCompareReporter.h"
#include <iostream>
#include <fstream>
#include <QDir> #include <QDir>
#include <fstream>
#include <iostream>
RiaImageCompareReporter::RiaImageCompareReporter( void ) RiaImageCompareReporter::RiaImageCompareReporter( void )
{ {
@ -28,15 +28,15 @@ RiaImageCompareReporter::RiaImageCompareReporter(void)
m_showInteractiveDiff = false; m_showInteractiveDiff = false;
} }
RiaImageCompareReporter::~RiaImageCompareReporter( void ) {}
RiaImageCompareReporter::~RiaImageCompareReporter(void)
{
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiaImageCompareReporter::addImageDirectoryComparisonSet(const std::string& title, const std::string& baseImageDir, const std::string& newImagesDir, const std::string& diffImagesDir) void RiaImageCompareReporter::addImageDirectoryComparisonSet( const std::string& title,
const std::string& baseImageDir,
const std::string& newImagesDir,
const std::string& diffImagesDir )
{ {
m_directorySets.push_back( DirSet( title, baseImageDir, newImagesDir, diffImagesDir ) ); m_directorySets.push_back( DirSet( title, baseImageDir, newImagesDir, diffImagesDir ) );
} }
@ -90,7 +90,8 @@ void RiaImageCompareReporter::generateHTMLReport(const std::string& fileName, co
html += "<table>\n"; html += "<table>\n";
html += " <tr>\n"; html += " <tr>\n";
html += " <td colspan=\"3\" bgcolor=\"darkblue\" height=\"40\"> <b><font color=\"white\" size=\"3\"> " + m_directorySets[dsIdx].m_title + " </font></b> </td>\n"; html += " <td colspan=\"3\" bgcolor=\"darkblue\" height=\"40\"> <b><font color=\"white\" size=\"3\"> " +
m_directorySets[dsIdx].m_title + " </font></b> </td>\n";
html += " </tr>\n"; html += " </tr>\n";
std::string baseImageFolder = removeCommonStart( fileName, m_directorySets[dsIdx].m_baseImageDir ); std::string baseImageFolder = removeCommonStart( fileName, m_directorySets[dsIdx].m_baseImageDir );
@ -106,20 +107,25 @@ void RiaImageCompareReporter::generateHTMLReport(const std::string& fileName, co
html += " <tr>\n"; html += " <tr>\n";
if ( m_showOriginal ) if ( m_showOriginal )
{ {
html += " <td> <img src=\"" + baseImageFolder + "/" + baseImageNames[fIdx] + "\" width=\"100%\" alt=\"" + baseImageFolder + "/" + baseImageNames[fIdx] + "\" > </td>\n"; html += " <td> <img src=\"" + baseImageFolder + "/" + baseImageNames[fIdx] +
"\" width=\"100%\" alt=\"" + baseImageFolder + "/" + baseImageNames[fIdx] + "\" > </td>\n";
} }
if ( m_showGenerated ) if ( m_showGenerated )
{ {
html += " <td> <img src=\"" + genImageFolder + "/" + baseImageNames[fIdx] + "\" width=\"100%\" alt=\"" + genImageFolder + "/" + baseImageNames[fIdx] + "\" > </td>\n"; html += " <td> <img src=\"" + genImageFolder + "/" + baseImageNames[fIdx] +
"\" width=\"100%\" alt=\"" + genImageFolder + "/" + baseImageNames[fIdx] + "\" > </td>\n";
} }
if ( m_showInteractiveDiff ) if ( m_showInteractiveDiff )
{ {
html += " <td> <div class = \"image-slider\"> <div> <img src=\"" + baseImageFolder + "/" + baseImageNames[fIdx] + "\" > </div> <img src = \"" + genImageFolder + "/" + baseImageNames[fIdx] + "\" > </div> </td>\n"; html += " <td> <div class = \"image-slider\"> <div> <img src=\"" + baseImageFolder + "/" +
baseImageNames[fIdx] + "\" > </div> <img src = \"" + genImageFolder + "/" +
baseImageNames[fIdx] + "\" > </div> </td>\n";
} }
html += " <td> <img src=\"" + diffImageFolder + "/" + baseImageNames[fIdx] + "\" width=\"100%\" alt=\"" + diffImageFolder + "/" + baseImageNames[fIdx] + "\" > </td>\n"; html += " <td> <img src=\"" + diffImageFolder + "/" + baseImageNames[fIdx] +
"\" width=\"100%\" alt=\"" + diffImageFolder + "/" + baseImageNames[fIdx] + "\" > </td>\n";
html += " </tr>\n"; html += " </tr>\n";
// A little air between images // A little air between images

View File

@ -27,12 +27,14 @@ public:
RiaImageCompareReporter(); RiaImageCompareReporter();
virtual ~RiaImageCompareReporter(); virtual ~RiaImageCompareReporter();
void addImageDirectoryComparisonSet(const std::string& title, const std::string& baseImageDir, const std::string& newImagesDir, const std::string& diffImagesDir ); void addImageDirectoryComparisonSet( const std::string& title,
const std::string& baseImageDir,
const std::string& newImagesDir,
const std::string& diffImagesDir );
void generateHTMLReport( const std::string& filenName, const std::string& pathToDiff2html ); void generateHTMLReport( const std::string& filenName, const std::string& pathToDiff2html );
void showInteractiveOnly(); void showInteractiveOnly();
private: private:
static std::vector<std::string> getPngFilesInDirectory( const std::string& searchPath ); static std::vector<std::string> getPngFilesInDirectory( const std::string& searchPath );
std::string cssString() const; std::string cssString() const;
@ -40,12 +42,16 @@ private:
private: private:
struct DirSet struct DirSet
{ {
DirSet(const std::string& title, const std::string& baseImageDir, const std::string& newImagesDir, const std::string& diffImagesDir ) DirSet( const std::string& title,
: m_title(title), const std::string& baseImageDir,
m_baseImageDir(baseImageDir), const std::string& newImagesDir,
m_newImagesDir(newImagesDir), const std::string& diffImagesDir )
m_diffImagesDir(diffImagesDir) : m_title( title )
{} , m_baseImageDir( baseImageDir )
, m_newImagesDir( newImagesDir )
, m_diffImagesDir( diffImagesDir )
{
}
std::string m_title; std::string m_title;
std::string m_baseImageDir; std::string m_baseImageDir;
@ -59,4 +65,3 @@ private:
bool m_showGenerated; bool m_showGenerated;
bool m_showInteractiveDiff; bool m_showInteractiveDiff;
}; };

View File

@ -19,7 +19,6 @@
#include "RiaImageFileCompare.h" #include "RiaImageFileCompare.h"
#include <QtCore/QProcess> #include <QtCore/QProcess>
//================================================================================================== //==================================================================================================
// //
// //
@ -35,14 +34,10 @@ RiaImageFileCompare::RiaImageFileCompare(QString compareExecutable)
reset(); reset();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RiaImageFileCompare::~RiaImageFileCompare() RiaImageFileCompare::~RiaImageFileCompare() {}
{
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -55,11 +50,12 @@ void RiaImageFileCompare::reset()
m_errorDetails = ""; m_errorDetails = "";
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RiaImageFileCompare::runComparison(QString imgFileName, QString refFileName, QString diffFileName) bool RiaImageFileCompare::runComparison( const QString& imgFileName,
const QString& refFileName,
const QString& diffFileName )
{ {
reset(); reset();
@ -70,14 +66,20 @@ bool RiaImageFileCompare::runComparison(QString imgFileName, QString refFileName
return false; return false;
} }
// QString args = QString("-fuzz 2% -lowlight-color white -metric ae \"%1\" \"%2\"
//QString args = QString("-fuzz 2% -lowlight-color white -metric ae \"%1\" \"%2\" \"%3\"").arg(imgFileName).arg(refFileName).arg((diffFileName)); // \"%3\"").arg(imgFileName).arg(refFileName).arg((diffFileName));
// The ImageMagick compare tool on RedHat 5 does not support the lowlight-color options // 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 // Use GCC version as a crude mechanism for disabling use of this option on RedHat5
#if ( __GNUC__ == 4 && __GNUC_MINOR__ <= 1 ) #if ( __GNUC__ == 4 && __GNUC_MINOR__ <= 1 )
QString args = QString("-fuzz 0.4% -metric ae \"%1\" \"%2\" \"%3\"").arg(imgFileName).arg(refFileName).arg((diffFileName)); QString args = QString( "-fuzz 0.4% -metric ae \"%1\" \"%2\" \"%3\"" )
.arg( imgFileName )
.arg( refFileName )
.arg( ( diffFileName ) );
#else #else
QString args = QString("-fuzz 0.4% -lowlight-color white -metric ae \"%1\" \"%2\" \"%3\"").arg(imgFileName).arg(refFileName).arg((diffFileName)); QString args = QString( "-fuzz 0.4% -lowlight-color white -metric ae \"%1\" \"%2\" \"%3\"" )
.arg( imgFileName )
.arg( refFileName )
.arg( ( diffFileName ) );
#endif #endif
QString completeCommand = QString( "\"%1\" %2" ).arg( m_compareExecutable ).arg( args ); QString completeCommand = QString( "\"%1\" %2" ).arg( m_compareExecutable ).arg( args );
@ -119,7 +121,6 @@ bool RiaImageFileCompare::runComparison(QString imgFileName, QString refFileName
} }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -128,7 +129,6 @@ bool RiaImageFileCompare::imagesEqual() const
return m_imagesEqual; return m_imagesEqual;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -137,7 +137,6 @@ RiaImageFileCompare::ErrorType RiaImageFileCompare::error() const
return m_lastError; return m_lastError;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -146,7 +145,6 @@ QString RiaImageFileCompare::errorMessage() const
return m_errorMsg; return m_errorMsg;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -39,7 +39,7 @@ public:
explicit RiaImageFileCompare( QString compareExecutable ); explicit RiaImageFileCompare( QString compareExecutable );
~RiaImageFileCompare(); ~RiaImageFileCompare();
bool runComparison(QString imgFileName, QString refFileName, QString diffFileName); bool runComparison( const QString& imgFileName, const QString& refFileName, const QString& diffFileName );
bool imagesEqual() const; bool imagesEqual() const;
ErrorType error() const; ErrorType error() const;
QString errorMessage() const; QString errorMessage() const;
@ -55,6 +55,3 @@ private:
QString m_errorMsg; QString m_errorMsg;
QString m_errorDetails; QString m_errorDetails;
}; };

View File

@ -133,4 +133,3 @@ void RiaImageTools::makeGrayScale(QImage& image)
} }
} }
} }

View File

@ -28,5 +28,3 @@ public:
static void distanceTransform2d( std::vector<std::vector<unsigned int>>& image ); static void distanceTransform2d( std::vector<std::vector<unsigned int>>& image );
static void makeGrayScale( QImage& image ); static void makeGrayScale( QImage& image );
}; };

View File

@ -20,8 +20,8 @@
#include "ApplicationCommands/RicShowMainWindowFeature.h" #include "ApplicationCommands/RicShowMainWindowFeature.h"
#include "SummaryPlotCommands/RicNewSummaryPlotFeature.h"
#include "SummaryPlotCommands/RicNewSummaryCurveFeature.h" #include "SummaryPlotCommands/RicNewSummaryCurveFeature.h"
#include "SummaryPlotCommands/RicNewSummaryPlotFeature.h"
#include "SummaryPlotCommands/RicSummaryPlotFeatureImpl.h" #include "SummaryPlotCommands/RicSummaryPlotFeatureImpl.h"
#include "RiaApplication.h" #include "RiaApplication.h"
@ -55,23 +55,25 @@
#include "RimSummaryCurveFilter.h" #include "RimSummaryCurveFilter.h"
#include "RimSummaryPlot.h" #include "RimSummaryPlot.h"
#include "RimSummaryPlotCollection.h" #include "RimSummaryPlotCollection.h"
#include "RimWellLogRftCurve.h"
#include "Riu3DMainWindowTools.h" #include "Riu3DMainWindowTools.h"
#include "RiuMainWindow.h" #include "RiuMainWindow.h"
#include "RiuPlotMainWindow.h" #include "RiuPlotMainWindow.h"
#include "RiuPlotMainWindowTools.h" #include "RiuPlotMainWindowTools.h"
#include "cafUtils.h"
#include "cafProgressInfo.h" #include "cafProgressInfo.h"
#include "cafUtils.h"
#include <QFileInfo> #include <QFileInfo>
#include <QMessageBox> #include <QMessageBox>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RiaImportEclipseCaseTools::openEclipseCasesFromFile(const QStringList& fileNames, FileCaseIdMap* openedFilesOut, bool noDialog) bool RiaImportEclipseCaseTools::openEclipseCasesFromFile( const QStringList& fileNames,
FileCaseIdMap* openedFilesOut,
bool noDialog )
{ {
RiaApplication* app = RiaApplication::instance(); RiaApplication* app = RiaApplication::instance();
RimProject* project = app->project(); RimProject* project = app->project();
@ -94,22 +96,33 @@ bool RiaImportEclipseCaseTools::openEclipseCasesFromFile(const QStringList& file
} }
} }
if ( !openedFiles.empty() )
{
if ( project && project->mainPlotCollection() )
{
project->mainPlotCollection()->ensureDefaultFlowPlotsAreCreated();
}
}
// Import summary cases // Import summary cases
if ( !summaryFileInfos.empty() ) if ( !summaryFileInfos.empty() )
{ {
RimSummaryCaseMainCollection* sumCaseColl = project->activeOilField() ? project->activeOilField()->summaryCaseMainCollection() : nullptr; RimSummaryCaseMainCollection* sumCaseColl = project->activeOilField()
? project->activeOilField()->summaryCaseMainCollection()
: nullptr;
if ( sumCaseColl ) if ( sumCaseColl )
{ {
std::vector<RimSummaryCase*> newSumCases = sumCaseColl->createSummaryCasesFromFileInfos( summaryFileInfos ); std::vector<RimSummaryCase*> newSumCases = sumCaseColl->createSummaryCasesFromFileInfos( summaryFileInfos );
for ( RimSummaryCase* newSumCase : newSumCases ) for ( RimSummaryCase* newSumCase : newSumCases )
{ {
RimSummaryCaseCollection* existingCollection = nullptr; RimSummaryCaseCollection* existingCollection = nullptr;
QString gridCaseFile = RifEclipseSummaryTools::findGridCaseFileFromSummaryHeaderFile(newSumCase->summaryHeaderFilename()); QString gridCaseFile = RifEclipseSummaryTools::findGridCaseFileFromSummaryHeaderFile(
newSumCase->summaryHeaderFilename() );
RimEclipseCase* gridCase = project->eclipseCaseFromGridFileName( gridCaseFile ); RimEclipseCase* gridCase = project->eclipseCaseFromGridFileName( gridCaseFile );
if ( gridCase ) if ( gridCase )
{ {
RimSummaryCase* existingSummaryCase = sumCaseColl->findSummaryCaseFromFileName(newSumCase->summaryHeaderFilename()); RimSummaryCase* existingSummaryCase = sumCaseColl->findSummaryCaseFromFileName(
newSumCase->summaryHeaderFilename() );
RimGridSummaryCase* existingGridSummaryCase = dynamic_cast<RimGridSummaryCase*>( existingSummaryCase ); RimGridSummaryCase* existingGridSummaryCase = dynamic_cast<RimGridSummaryCase*>( existingSummaryCase );
RimFileSummaryCase* existingFileSummaryCase = dynamic_cast<RimFileSummaryCase*>( existingSummaryCase ); RimFileSummaryCase* existingFileSummaryCase = dynamic_cast<RimFileSummaryCase*>( existingSummaryCase );
if ( existingGridSummaryCase ) if ( existingGridSummaryCase )
@ -121,12 +134,22 @@ bool RiaImportEclipseCaseTools::openEclipseCasesFromFile(const QStringList& file
{ {
existingFileSummaryCase->firstAncestorOrThisOfType( existingCollection ); existingFileSummaryCase->firstAncestorOrThisOfType( existingCollection );
// Replace file summary case pointers in Rft Curves
std::vector<RimWellLogRftCurve*> rftCurves;
existingFileSummaryCase->objectsWithReferringPtrFieldsOfType( rftCurves );
for ( RimWellLogRftCurve* curve : rftCurves )
{
if ( curve->summaryCase() == existingSummaryCase )
{
curve->setSummaryCase( newSumCase );
}
}
// Replace all occurrences of file sum with ecl sum // Replace all occurrences of file sum with ecl sum
std::vector<RimSummaryCurve*> objects; std::vector<RimSummaryCurve*> objects;
existingFileSummaryCase->objectsWithReferringPtrFieldsOfType( objects ); existingFileSummaryCase->objectsWithReferringPtrFieldsOfType( objects );
// UI settings of a curve filter is updated based // UI settings of a curve filter is updated based
// on the new case association for the curves in the curve filter // on the new case association for the curves in the curve filter
// UI is updated by loadDataAndUpdate() // UI is updated by loadDataAndUpdate()
@ -135,6 +158,15 @@ bool RiaImportEclipseCaseTools::openEclipseCasesFromFile(const QStringList& file
{ {
if ( summaryCurve ) if ( summaryCurve )
{ {
if ( summaryCurve->summaryCaseX() == existingSummaryCase )
{
summaryCurve->setSummaryCaseX( newSumCase );
}
if ( summaryCurve->summaryCaseY() == existingSummaryCase )
{
summaryCurve->setSummaryCaseY( newSumCase );
}
RimSummaryCurveCollection* parentCollection = nullptr; RimSummaryCurveCollection* parentCollection = nullptr;
summaryCurve->firstAncestorOrThisOfType( parentCollection ); summaryCurve->firstAncestorOrThisOfType( parentCollection );
if ( parentCollection ) if ( parentCollection )
@ -214,7 +246,8 @@ bool RiaImportEclipseCaseTools::openEclipseCaseShowTimeStepFilter(const QString&
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RiaImportEclipseCaseTools::openEclipseInputCaseFromFileNames(const QStringList& fileNames, QString* fileContainingGrid/*=nullptr*/) bool RiaImportEclipseCaseTools::openEclipseInputCaseFromFileNames( const QStringList& fileNames,
QString* fileContainingGrid /*=nullptr*/ )
{ {
RimEclipseInputCase* rimInputReservoir = new RimEclipseInputCase(); RimEclipseInputCase* rimInputReservoir = new RimEclipseInputCase();
@ -230,7 +263,8 @@ bool RiaImportEclipseCaseTools::openEclipseInputCaseFromFileNames(const QStringL
return false; return false;
} }
RimEclipseCaseCollection* analysisModels = project->activeOilField() ? project->activeOilField()->analysisModels() : nullptr; RimEclipseCaseCollection* analysisModels = project->activeOilField() ? project->activeOilField()->analysisModels()
: nullptr;
if ( analysisModels == nullptr ) return false; if ( analysisModels == nullptr ) return false;
analysisModels->cases.push_back( rimInputReservoir ); analysisModels->cases.push_back( rimInputReservoir );
@ -280,7 +314,8 @@ int RiaImportEclipseCaseTools::openEclipseCaseShowTimeStepFilterImpl(const QStri
RiaApplication* app = RiaApplication::instance(); RiaApplication* app = RiaApplication::instance();
RimProject* project = app->project(); RimProject* project = app->project();
RimEclipseCaseCollection* analysisModels = project->activeOilField() ? project->activeOilField()->analysisModels() : nullptr; RimEclipseCaseCollection* analysisModels = project->activeOilField() ? project->activeOilField()->analysisModels()
: nullptr;
if ( analysisModels == nullptr ) if ( analysisModels == nullptr )
{ {
delete rimResultReservoir; delete rimResultReservoir;
@ -324,7 +359,8 @@ int RiaImportEclipseCaseTools::openEclipseCaseShowTimeStepFilterImpl(const QStri
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RiaImportEclipseCaseTools::addEclipseCases(const QStringList& fileNames, RimIdenticalGridCaseGroup** resultingCaseGroup/*=nullptr*/) bool RiaImportEclipseCaseTools::addEclipseCases( const QStringList& fileNames,
RimIdenticalGridCaseGroup** resultingCaseGroup /*=nullptr*/ )
{ {
if ( fileNames.size() == 0 ) return true; if ( fileNames.size() == 0 ) return true;
@ -415,11 +451,11 @@ bool RiaImportEclipseCaseTools::addEclipseCases(const QStringList& fileNames, Ri
project->activeOilField()->analysisModels()->updateConnectedEditors(); project->activeOilField()->analysisModels()->updateConnectedEditors();
if (RiaGuiApplication::isRunning() && gridCaseGroup && gridCaseGroup->statisticsCaseCollection()->reservoirs.size() > 0) if ( RiaGuiApplication::isRunning() && gridCaseGroup &&
gridCaseGroup->statisticsCaseCollection()->reservoirs.size() > 0 )
{ {
RiuMainWindow::instance()->selectAsCurrentItem( gridCaseGroup->statisticsCaseCollection()->reservoirs[0] ); RiuMainWindow::instance()->selectAsCurrentItem( gridCaseGroup->statisticsCaseCollection()->reservoirs[0] );
} }
return true; return true;
} }

View File

@ -33,7 +33,9 @@ class RiaImportEclipseCaseTools
public: public:
typedef std::map<QString, int> FileCaseIdMap; typedef std::map<QString, int> FileCaseIdMap;
static bool openEclipseCasesFromFile(const QStringList& fileNames, FileCaseIdMap* openedFilesOut = nullptr, bool noDialog = false); static bool openEclipseCasesFromFile( const QStringList& fileNames,
FileCaseIdMap* openedFilesOut = nullptr,
bool noDialog = false );
static bool openEclipseCaseShowTimeStepFilter( const QString& fileName ); static bool openEclipseCaseShowTimeStepFilter( const QString& fileName );
static bool openEclipseInputCaseFromFileNames( const QStringList& fileNames, QString* fileContainingGrid = nullptr ); static bool openEclipseInputCaseFromFileNames( const QStringList& fileNames, QString* fileContainingGrid = nullptr );
@ -45,4 +47,3 @@ private:
static int openEclipseCaseFromFile( const QString& fileName ); static int openEclipseCaseFromFile( const QString& fileName );
static int openEclipseCaseShowTimeStepFilterImpl( const QString& fileName, bool showTimeStepFilter ); static int openEclipseCaseShowTimeStepFilterImpl( const QString& fileName, bool showTimeStepFilter );
}; };

View File

@ -31,14 +31,12 @@
#include <windows.h> #include <windows.h>
#pragma warning( pop ) #pragma warning( pop )
#else #else
#include <cstring>
#include <cstdio> #include <cstdio>
#include <cstring>
#endif #endif
#include "QString" #include "QString"
//================================================================================================== //==================================================================================================
// //
// //
@ -64,8 +62,6 @@ private:
int m_logLevel; int m_logLevel;
}; };
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -106,7 +102,6 @@ void RiaDefaultConsoleLogger::warning(const char* message)
writeMessageToConsole( "warn: ", message ); writeMessageToConsole( "warn: ", message );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -115,7 +110,6 @@ void RiaDefaultConsoleLogger::info(const char* message)
writeMessageToConsole( "info: ", message ); writeMessageToConsole( "info: ", message );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -124,7 +118,6 @@ void RiaDefaultConsoleLogger::debug(const char* message)
writeMessageToConsole( "debug: ", message ); writeMessageToConsole( "debug: ", message );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -147,7 +140,6 @@ void RiaDefaultConsoleLogger::writeMessageToConsole(const char* prefix, const ch
writeToConsole( oss.str() ); writeToConsole( oss.str() );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -184,7 +176,6 @@ RiaLogger* RiaLogging::loggerInstance()
return sm_logger; return sm_logger;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -199,7 +190,6 @@ void RiaLogging::setLoggerInstance(RiaLogger* loggerInstance)
sm_logger = loggerInstance; sm_logger = loggerInstance;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -30,8 +30,6 @@ enum RILogLevel
RI_LL_DEBUG = 4 RI_LL_DEBUG = 4
}; };
//================================================================================================== //==================================================================================================
// //
// Logger interface for the application // Logger interface for the application
@ -51,8 +49,6 @@ public:
virtual void debug( const char* message ) = 0; virtual void debug( const char* message ) = 0;
}; };
//================================================================================================== //==================================================================================================
// //
// //

View File

@ -18,8 +18,8 @@
#pragma once #pragma once
#include <array>
#include "cvfVector3.h" #include "cvfVector3.h"
#include <array>
#include <cmath> #include <cmath>
// Y - North, X - East, Z - up but depth is negative Z // Y - North, X - East, Z - up but depth is negative Z
@ -34,46 +34,58 @@ public:
explicit RiaOffshoreSphericalCoords( const cvf::Vec3f& vec ) explicit RiaOffshoreSphericalCoords( const cvf::Vec3f& vec )
{ {
// Azimuth: // Azimuth:
if ( fabs(vec[0]) < singularityEpsilon && fabs(vec[1]) < singularityEpsilon ) incAziR[1] = 0.0f; if ( fabs( vec[0] ) < singularityEpsilon && fabs( vec[1] ) < singularityEpsilon )
else incAziR[1] = atan2(vec[0], vec[1]); // atan2(Y, X) incAziR[1] = 0.0f;
else
incAziR[1] = atan2( vec[0], vec[1] ); // atan2(Y, X)
// R // R
incAziR[2] = vec.length(); incAziR[2] = vec.length();
// Inclination from vertical down // Inclination from vertical down
if (fabs( incAziR[2]) < singularityEpsilon) incAziR[0] = 0.0f; if ( fabs( incAziR[2] ) < singularityEpsilon )
else incAziR[0] = acos(-vec[2]/incAziR[2]); incAziR[0] = 0.0f;
else
incAziR[0] = acos( -vec[2] / incAziR[2] );
} }
explicit RiaOffshoreSphericalCoords( const cvf::Vec3d& vec ) explicit RiaOffshoreSphericalCoords( const cvf::Vec3d& vec )
{ {
// Azimuth: // Azimuth:
if (fabs(vec[0]) < singularityEpsilon && fabs(vec[1]) < singularityEpsilon ) incAziR[1] = 0.0; if ( fabs( vec[0] ) < singularityEpsilon && fabs( vec[1] ) < singularityEpsilon )
else incAziR[1] = atan2(vec[0], vec[1]); // atan2(Y, X) incAziR[1] = 0.0;
else
incAziR[1] = atan2( vec[0], vec[1] ); // atan2(Y, X)
// R // R
incAziR[2] = vec.length(); incAziR[2] = vec.length();
// Inclination from vertical down // Inclination from vertical down
if (fabs( incAziR[2]) < singularityEpsilon) incAziR[0] = 0.0; if ( fabs( incAziR[2] ) < singularityEpsilon )
else incAziR[0] = acos(-vec[2]/incAziR[2]); incAziR[0] = 0.0;
else
incAziR[0] = acos( -vec[2] / incAziR[2] );
}
double inc() const
{
return incAziR[0];
}
double azi() const
{
return incAziR[1];
}
double r() const
{
return incAziR[2];
} }
double inc() const { return incAziR[0];}
double azi() const { return incAziR[1];}
double r() const { return incAziR[2];}
// Note that this is a double function, while the rest of the class is float. // Note that this is a double function, while the rest of the class is float.
// Todo: Convert class to a template to enable float and double versions of everything // Todo: Convert class to a template to enable float and double versions of everything
static cvf::Vec3d unitVectorFromAziInc( double azimuth, double inclination ) static cvf::Vec3d unitVectorFromAziInc( double azimuth, double inclination )
{ {
return cvf::Vec3d(sin(azimuth)*sin(inclination), return cvf::Vec3d( sin( azimuth ) * sin( inclination ), cos( azimuth ) * sin( inclination ), -cos( inclination ) );
cos(azimuth)*sin(inclination),
-cos(inclination));
} }
private: private:
std::array<double, 3> incAziR; std::array<double, 3> incAziR;
}; };

View File

@ -24,24 +24,12 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiaOptionItemFactory::appendOptionItemFromViewNameAndCaseName(Rim3dView* view, QList<caf::PdmOptionItemInfo>* optionItems) void RiaOptionItemFactory::appendOptionItemFromViewNameAndCaseName( Rim3dView* view,
QList<caf::PdmOptionItemInfo>* optionItems )
{ {
if ( !view || !optionItems ) return; if ( !view || !optionItems ) return;
QString caseName; QString displayName = view->autoName();
RimCase* rimCase = nullptr;
view->firstAncestorOrThisOfType(rimCase);
if (rimCase)
{
caseName = rimCase->caseUserDescription();
}
else
{
caseName = "<Unnamed case>";
}
QString displayName = caseName + " : " + view->name();
caf::QIconProvider iconProvider = view->uiCapability()->uiIconProvider(); caf::QIconProvider iconProvider = view->uiCapability()->uiIconProvider();

View File

@ -31,27 +31,41 @@ bool RiaProjectFileVersionTools::isCandidateVersionNewerThanOther(const QString&
int candidatePatchNumber = 0; int candidatePatchNumber = 0;
int candidateDevelopmentId = 0; int candidateDevelopmentId = 0;
RiaProjectFileVersionTools::decodeVersionString(candidateProjectFileVersion, &candidateMajorVersion, &candidateMinorVersion, RiaProjectFileVersionTools::decodeVersionString( candidateProjectFileVersion,
&candidatePatchNumber, &candidateDevelopmentId); &candidateMajorVersion,
&candidateMinorVersion,
&candidatePatchNumber,
&candidateDevelopmentId );
int majorVersion = 0; int majorVersion = 0;
int minorVersion = 0; int minorVersion = 0;
int patchNumber = 0; int patchNumber = 0;
int developmentId = 0; int developmentId = 0;
RiaProjectFileVersionTools::decodeVersionString(projectFileVersion, &majorVersion, &minorVersion, &patchNumber, RiaProjectFileVersionTools::decodeVersionString( projectFileVersion,
&majorVersion,
&minorVersion,
&patchNumber,
&developmentId ); &developmentId );
return RiaProjectFileVersionTools::isCandidateNewerThanOther(candidateMajorVersion, candidateMinorVersion, return RiaProjectFileVersionTools::isCandidateNewerThanOther( candidateMajorVersion,
candidatePatchNumber, candidateDevelopmentId, majorVersion, candidateMinorVersion,
minorVersion, patchNumber, developmentId); candidatePatchNumber,
candidateDevelopmentId,
majorVersion,
minorVersion,
patchNumber,
developmentId );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiaProjectFileVersionTools::decodeVersionString(const QString& projectFileVersion, int* majorVersion, int* minorVersion, void RiaProjectFileVersionTools::decodeVersionString( const QString& projectFileVersion,
int* patch, int* developmentId) int* majorVersion,
int* minorVersion,
int* patch,
int* developmentId )
{ {
if ( projectFileVersion.isEmpty() ) return; if ( projectFileVersion.isEmpty() ) return;
@ -87,9 +101,13 @@ void RiaProjectFileVersionTools::decodeVersionString(const QString& projectFileV
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RiaProjectFileVersionTools::isCandidateNewerThanOther(int candidateMajorVersion, int candidateMinorVersion, bool RiaProjectFileVersionTools::isCandidateNewerThanOther( int candidateMajorVersion,
int candidatePatchNumber, int candidateDevelopmentId, int candidateMinorVersion,
int otherMajorVersion, int otherMinorVersion, int otherPatchNumber, int candidatePatchNumber,
int candidateDevelopmentId,
int otherMajorVersion,
int otherMinorVersion,
int otherPatchNumber,
int otherDevelopmentId ) int otherDevelopmentId )
{ {
if ( candidateMajorVersion != otherMajorVersion ) if ( candidateMajorVersion != otherMajorVersion )
@ -139,4 +157,3 @@ QString RiaProjectFileVersionTools::stringOfDigits(const QString& string)
return digitsOnly; return digitsOnly;
} }

View File

@ -30,13 +30,21 @@ public:
const QString& otherProjectFileVersion ); const QString& otherProjectFileVersion );
// Public to be able to unit test function, not intended to be used // 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, static void decodeVersionString( const QString& projectFileVersion,
int* majorVersion,
int* minorVersion,
int* patch,
int* developmentId ); int* developmentId );
private: private:
static bool isCandidateNewerThanOther(int candidateMajorVersion, int candidateMinorVersion, int candidatePatchNumber, static bool isCandidateNewerThanOther( int candidateMajorVersion,
int candidateDevelopmentId, int otherMajorVersion, int otherMinorVersion, int candidateMinorVersion,
int otherPatchNumber, int otherDevelopmentId); int candidatePatchNumber,
int candidateDevelopmentId,
int otherMajorVersion,
int otherMinorVersion,
int otherPatchNumber,
int otherDevelopmentId );
static QString stringOfDigits( const QString& string ); static QString stringOfDigits( const QString& string );
}; };

View File

@ -28,21 +28,18 @@
#include "RimOilField.h" #include "RimOilField.h"
#include "RimProject.h" #include "RimProject.h"
#include <QFileInfo>
#include <QDir> #include <QDir>
#include <QFileInfo>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RiaProjectModifier::RiaProjectModifier() RiaProjectModifier::RiaProjectModifier() {}
{
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiaProjectModifier::setReplaceCaseFirstOccurrence(QString newGridFileName) void RiaProjectModifier::setReplaceCaseFirstOccurrence( const QString& newGridFileName )
{ {
m_caseIdToGridFileNameMap[RiaProjectModifier::firstOccurrenceId()] = makeFilePathAbsolute( newGridFileName ); m_caseIdToGridFileNameMap[RiaProjectModifier::firstOccurrenceId()] = makeFilePathAbsolute( newGridFileName );
} }
@ -50,7 +47,7 @@ void RiaProjectModifier::setReplaceCaseFirstOccurrence(QString newGridFileName)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiaProjectModifier::setReplaceCase(int caseIdToReplace, QString newGridFileName) void RiaProjectModifier::setReplaceCase( int caseIdToReplace, const QString& newGridFileName )
{ {
if ( caseIdToReplace >= 0 ) if ( caseIdToReplace >= 0 )
{ {
@ -61,7 +58,7 @@ void RiaProjectModifier::setReplaceCase(int caseIdToReplace, QString newGridFile
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiaProjectModifier::setReplaceSourceCasesFirstOccurrence(std::vector<QString> newGridFileNames) void RiaProjectModifier::setReplaceSourceCasesFirstOccurrence( const std::vector<QString>& newGridFileNames )
{ {
m_groupIdToGridFileNamesMap[RiaProjectModifier::firstOccurrenceId()] = newGridFileNames; m_groupIdToGridFileNamesMap[RiaProjectModifier::firstOccurrenceId()] = newGridFileNames;
} }
@ -69,7 +66,8 @@ void RiaProjectModifier::setReplaceSourceCasesFirstOccurrence(std::vector<QStrin
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiaProjectModifier::setReplaceSourceCasesById(int caseGroupIdToReplace, std::vector<QString> newGridFileNames) void RiaProjectModifier::setReplaceSourceCasesById( int caseGroupIdToReplace,
const std::vector<QString>& newGridFileNames )
{ {
if ( caseGroupIdToReplace >= 0 ) if ( caseGroupIdToReplace >= 0 )
{ {
@ -240,7 +238,7 @@ void RiaProjectModifier::replacePropertiesFolder(RimProject* project)
/// If \a relOrAbsolutePath is a relative, the current working directory for the process will be /// If \a relOrAbsolutePath is a relative, the current working directory for the process will be
/// used in order to make the path absolute. /// used in order to make the path absolute.
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RiaProjectModifier::makeFilePathAbsolute(QString relOrAbsolutePath) QString RiaProjectModifier::makeFilePathAbsolute( const QString& relOrAbsolutePath )
{ {
QFileInfo theFile( relOrAbsolutePath ); QFileInfo theFile( relOrAbsolutePath );
theFile.makeAbsolute(); theFile.makeAbsolute();
@ -250,7 +248,7 @@ QString RiaProjectModifier::makeFilePathAbsolute(QString relOrAbsolutePath)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RiaProjectModifier::caseNameFromGridFileName(QString fullGridFilePathName) QString RiaProjectModifier::caseNameFromGridFileName( const QString& fullGridFilePathName )
{ {
QString fn = QDir::fromNativeSeparators( fullGridFilePathName ); QString fn = QDir::fromNativeSeparators( fullGridFilePathName );
@ -330,4 +328,3 @@ int RiaProjectModifier::firstOccurrenceId()
{ {
return -999; return -999;
} }

View File

@ -19,18 +19,15 @@
#pragma once #pragma once
#include "cvfBase.h"
#include "cvfObject.h" #include "cvfObject.h"
#include <QString> #include <QString>
#include <vector>
#include <map> #include <map>
#include <vector>
class RimProject; class RimProject;
//================================================================================================== //==================================================================================================
// //
// //
@ -41,11 +38,11 @@ class RiaProjectModifier : public cvf::Object
public: public:
RiaProjectModifier(); RiaProjectModifier();
void setReplaceCaseFirstOccurrence(QString newGridFileName); void setReplaceCaseFirstOccurrence( const QString& newGridFileName );
void setReplaceCase(int caseIdToReplace, QString newGridFileName); void setReplaceCase( int caseIdToReplace, const QString& newGridFileName );
void setReplaceSourceCasesFirstOccurrence(std::vector<QString> newGridFileNames); void setReplaceSourceCasesFirstOccurrence( const std::vector<QString>& newGridFileNames );
void setReplaceSourceCasesById(int caseGroupIdToReplace, std::vector<QString> newGridFileNames); void setReplaceSourceCasesById( int caseGroupIdToReplace, const std::vector<QString>& newGridFileNames );
void setReplacePropertiesFolderFirstOccurrence( QString newPropertiesFolder ); void setReplacePropertiesFolderFirstOccurrence( QString newPropertiesFolder );
void setReplacePropertiesFolder( int caseIdToReplace, QString newPropertiesFolder ); void setReplacePropertiesFolder( int caseIdToReplace, QString newPropertiesFolder );
@ -57,8 +54,8 @@ private:
void replaceCase( RimProject* project ); void replaceCase( RimProject* project );
void replacePropertiesFolder( RimProject* project ); void replacePropertiesFolder( RimProject* project );
static QString makeFilePathAbsolute(QString relOrAbsolutePath); static QString makeFilePathAbsolute( const QString& relOrAbsolutePath );
static QString caseNameFromGridFileName(QString fullGridFilePathName); static QString caseNameFromGridFileName( const QString& fullGridFilePathName );
static int firstCaseId( RimProject* project ); static int firstCaseId( RimProject* project );
static int firstGroupId( RimProject* project ); static int firstGroupId( RimProject* project );
@ -71,4 +68,3 @@ private:
std::map<int, std::vector<QString>> m_groupIdToGridFileNamesMap; std::map<int, std::vector<QString>> m_groupIdToGridFileNamesMap;
std::map<int, QString> m_caseIdToPropertiesFolderMap; std::map<int, QString> m_caseIdToPropertiesFolderMap;
}; };

View File

@ -25,9 +25,8 @@
#include "cafAppEnum.h" #include "cafAppEnum.h"
#include <cvfAssert.h> #include <cvfAssert.h>
#include <ctime>
#include <cmath> #include <cmath>
#include <ctime>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -48,7 +47,6 @@ const QString RiaQDateTimeTools::TIMESPAN_HALFYEAR_NAME = "Half Year";
const QString RiaQDateTimeTools::TIMESPAN_YEAR_NAME = "Year"; const QString RiaQDateTimeTools::TIMESPAN_YEAR_NAME = "Year";
const QString RiaQDateTimeTools::TIMESPAN_DECADE_NAME = "Decade"; const QString RiaQDateTimeTools::TIMESPAN_DECADE_NAME = "Decade";
namespace caf namespace caf
{ {
template <> template <>
@ -70,7 +68,7 @@ void caf::AppEnum<RiaQDateTimeTools::TimeFormatComponents>::setUp()
addItem( RiaQDateTimeTools::TIME_FORMAT_HOUR_MINUTE_SECOND, "HOUR_MINUTE_SECONDS", "Hour, Minutes and Seconds" ); addItem( RiaQDateTimeTools::TIME_FORMAT_HOUR_MINUTE_SECOND, "HOUR_MINUTE_SECONDS", "Hour, Minutes and Seconds" );
setDefault( RiaQDateTimeTools::TIME_FORMAT_NONE ); setDefault( RiaQDateTimeTools::TIME_FORMAT_NONE );
} }
} } // namespace caf
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -174,10 +172,7 @@ QDateTime RiaQDateTimeTools::addYears(const QDateTime& dt, double years)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QDateTime RiaQDateTimeTools::addSpan( const QDateTime& dt, DateTimeSpan span ) QDateTime RiaQDateTimeTools::addSpan( const QDateTime& dt, DateTimeSpan span )
{ {
return createUtcDateTime(dt) return createUtcDateTime( dt ).addYears( span.years() ).addMonths( span.months() ).addDays( span.days() );
.addYears(span.years())
.addMonths(span.months())
.addDays(span.days());
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -185,10 +180,7 @@ QDateTime RiaQDateTimeTools::addSpan(const QDateTime& dt, DateTimeSpan span)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QDateTime RiaQDateTimeTools::subtractSpan( const QDateTime& dt, DateTimeSpan span ) QDateTime RiaQDateTimeTools::subtractSpan( const QDateTime& dt, DateTimeSpan span )
{ {
return createUtcDateTime(dt) return createUtcDateTime( dt ).addYears( -span.years() ).addMonths( -span.months() ).addDays( -span.days() );
.addYears(-span.years())
.addMonths(-span.months())
.addDays(-span.days());
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -212,7 +204,6 @@ QDateTime RiaQDateTimeTools::subtractPeriod(const QDateTime& dt, DateTimePeriod
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QDateTime RiaQDateTimeTools::epoch() QDateTime RiaQDateTimeTools::epoch()
{ {
// NB: Not able to use QDateTime::fromMSecsSinceEpoch as this was introduced in Qt 4.7 // NB: Not able to use QDateTime::fromMSecsSinceEpoch as this was introduced in Qt 4.7
QDateTime dt; QDateTime dt;
@ -277,13 +268,20 @@ const DateTimeSpan RiaQDateTimeTools::timeSpan(DateTimePeriod period)
{ {
switch ( period ) switch ( period )
{ {
case DateTimePeriod::DAY: return TIMESPAN_DAY; case DateTimePeriod::DAY:
case DateTimePeriod::WEEK: return TIMESPAN_WEEK; return TIMESPAN_DAY;
case DateTimePeriod::MONTH: return TIMESPAN_MONTH; case DateTimePeriod::WEEK:
case DateTimePeriod::QUARTER: return TIMESPAN_QUARTER; return TIMESPAN_WEEK;
case DateTimePeriod::HALFYEAR: return TIMESPAN_HALFYEAR; case DateTimePeriod::MONTH:
case DateTimePeriod::YEAR: return TIMESPAN_YEAR; return TIMESPAN_MONTH;
case DateTimePeriod::DECADE: return TIMESPAN_DECADE; case DateTimePeriod::QUARTER:
return TIMESPAN_QUARTER;
case DateTimePeriod::HALFYEAR:
return TIMESPAN_HALFYEAR;
case DateTimePeriod::YEAR:
return TIMESPAN_YEAR;
case DateTimePeriod::DECADE:
return TIMESPAN_DECADE;
} }
CVF_ASSERT( false ); CVF_ASSERT( false );
return DateTimeSpan(); return DateTimeSpan();
@ -301,13 +299,20 @@ QDateTime RiaQDateTimeTools::truncateTime(const QDateTime& dt, DateTimePeriod pe
switch ( period ) switch ( period )
{ {
case DateTimePeriod::DAY: return createUtcDateTime(QDate(y, m, d)); case DateTimePeriod::DAY:
case DateTimePeriod::WEEK: return createUtcDateTime(QDate(y, m, d).addDays(-dow + 1)); return createUtcDateTime( QDate( y, m, d ) );
case DateTimePeriod::MONTH: return createUtcDateTime(QDate(y, m, 1)); case DateTimePeriod::WEEK:
case DateTimePeriod::QUARTER: return createUtcDateTime(QDate(y, ((m - 1) / 3) * 3 + 1, 1)); return createUtcDateTime( QDate( y, m, d ).addDays( -dow + 1 ) );
case DateTimePeriod::HALFYEAR: return createUtcDateTime(QDate(y, ((m - 1) / 6) * 6 + 1, 1)); case DateTimePeriod::MONTH:
case DateTimePeriod::YEAR: return createUtcDateTime(QDate(y, 1, 1)); return createUtcDateTime( QDate( y, m, 1 ) );
case DateTimePeriod::DECADE: return createUtcDateTime(QDate((y / 10) * 10, 1, 1)); case DateTimePeriod::QUARTER:
return createUtcDateTime( QDate( y, ( ( m - 1 ) / 3 ) * 3 + 1, 1 ) );
case DateTimePeriod::HALFYEAR:
return createUtcDateTime( QDate( y, ( ( m - 1 ) / 6 ) * 6 + 1, 1 ) );
case DateTimePeriod::YEAR:
return createUtcDateTime( QDate( y, 1, 1 ) );
case DateTimePeriod::DECADE:
return createUtcDateTime( QDate( ( y / 10 ) * 10, 1, 1 ) );
} }
CVF_ASSERT( false ); CVF_ASSERT( false );
return createUtcDateTime(); return createUtcDateTime();
@ -318,8 +323,7 @@ QDateTime RiaQDateTimeTools::truncateTime(const QDateTime& dt, DateTimePeriod pe
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<DateTimePeriod> RiaQDateTimeTools::dateTimePeriods() std::vector<DateTimePeriod> RiaQDateTimeTools::dateTimePeriods()
{ {
return std::vector<DateTimePeriod>( return std::vector<DateTimePeriod>( {
{
DateTimePeriod::NONE, DateTimePeriod::NONE,
DateTimePeriod::DAY, DateTimePeriod::DAY,
DateTimePeriod::WEEK, DateTimePeriod::WEEK,
@ -338,14 +342,22 @@ QString RiaQDateTimeTools::dateTimePeriodName(DateTimePeriod period)
{ {
switch ( period ) switch ( period )
{ {
case DateTimePeriod::DAY: return TIMESPAN_DAY_NAME; case DateTimePeriod::DAY:
case DateTimePeriod::WEEK: return TIMESPAN_WEEK_NAME; return TIMESPAN_DAY_NAME;
case DateTimePeriod::MONTH: return TIMESPAN_MONTH_NAME; case DateTimePeriod::WEEK:
case DateTimePeriod::QUARTER: return TIMESPAN_QUARTER_NAME; return TIMESPAN_WEEK_NAME;
case DateTimePeriod::HALFYEAR: return TIMESPAN_HALFYEAR_NAME; case DateTimePeriod::MONTH:
case DateTimePeriod::YEAR: return TIMESPAN_YEAR_NAME; return TIMESPAN_MONTH_NAME;
case DateTimePeriod::DECADE: return TIMESPAN_DECADE_NAME; case DateTimePeriod::QUARTER:
default: return "None"; return TIMESPAN_QUARTER_NAME;
case DateTimePeriod::HALFYEAR:
return TIMESPAN_HALFYEAR_NAME;
case DateTimePeriod::YEAR:
return TIMESPAN_YEAR_NAME;
case DateTimePeriod::DECADE:
return TIMESPAN_DECADE_NAME;
default:
return "None";
} }
} }
@ -364,7 +376,6 @@ QString RiaQDateTimeTools::toStringUsingApplicationLocale(const QDateTime& dt, c
return defaultApplicationLocale.toString( dt, format ); return defaultApplicationLocale.toString( dt, format );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -138,7 +138,6 @@ public:
private: private:
static quint64 secondsInDay(); static quint64 secondsInDay();
static quint64 secondsInYear(); static quint64 secondsInYear();
}; };
//================================================================================================== //==================================================================================================
@ -147,14 +146,36 @@ private:
class DateTimeSpan class DateTimeSpan
{ {
public: public:
DateTimeSpan() : m_years(0), m_months(0), m_days(0) { } DateTimeSpan()
DateTimeSpan(int years, int months, int days) : m_years(years), m_months(months), m_days(days) { } : m_years( 0 )
, m_months( 0 )
, m_days( 0 )
{
}
DateTimeSpan( int years, int months, int days )
: m_years( years )
, m_months( months )
, m_days( days )
{
}
int years() const { return m_years; } int years() const
int months() const { return m_months; } {
int days() const { return m_days; } return m_years;
}
int months() const
{
return m_months;
}
int days() const
{
return m_days;
}
bool isEmpty() { return m_years == 0 && m_months == 0 && m_days; } bool isEmpty()
{
return m_years == 0 && m_months == 0 && m_days;
}
private: private:
int m_years; int m_years;

View File

@ -57,22 +57,32 @@ RiaRegressionTest::RiaRegressionTest(void)
regressionTestFolder.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); 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_InitField( CAF_PDM_InitField( &useOpenMPForGeometryCreation,
&useOpenMPForGeometryCreation, "useOpenMPForGeometryCreation", true, "Use OpenMP For Geometry Creation", "", "", ""); "useOpenMPForGeometryCreation",
true,
"Use OpenMP For Geometry Creation",
"",
"",
"" );
CAF_PDM_InitField( &openReportInBrowser, "openReportInBrowser", false, "Open Generated Report in Browser", "", "", "" ); CAF_PDM_InitField( &openReportInBrowser, "openReportInBrowser", false, "Open Generated Report in Browser", "", "", "" );
CAF_PDM_InitFieldNoDefault( CAF_PDM_InitFieldNoDefault( &testFilter,
&testFilter,
"testFilter", "testFilter",
"Test Filter", "Test Filter",
"", "",
"If empty, all tests are executed.\nTo execute a subset of tests, specify folder names separated by ;", "If empty, all tests are executed.\nTo execute a subset of tests, specify folder names "
"separated by ;",
"" ); "" );
testFilter.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() ); testFilter.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() );
CAF_PDM_InitField( CAF_PDM_InitField( &appendTestsAfterTestFilter,
&appendTestsAfterTestFilter, "appendTestsAfterTestFilter", false, "Append All Tests After Test Filter", "", "", ""); "appendTestsAfterTestFilter",
false,
"Append All Tests After Test Filter",
"",
"",
"" );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -103,8 +113,8 @@ void RiaRegressionTest::defineEditorAttribute(const caf::PdmFieldHandle* field,
QString uiConfigName, QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) caf::PdmUiEditorAttribute* attribute )
{ {
if (field == &folderContainingDiffTool || field == &folderContainingCompareTool || field == &regressionTestFolder || if ( field == &folderContainingDiffTool || field == &folderContainingCompareTool ||
field == &folderContainingGitTool) field == &regressionTestFolder || field == &folderContainingGitTool )
{ {
caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>( attribute ); caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>( attribute );
if ( myAttr ) if ( myAttr )

View File

@ -34,6 +34,7 @@
#include "RimProject.h" #include "RimProject.h"
#include "RiuMainWindow.h" #include "RiuMainWindow.h"
#include "RiuMainWindowTools.h"
#include "RiuPlotMainWindow.h" #include "RiuPlotMainWindow.h"
#include "RiuViewer.h" #include "RiuViewer.h"
@ -151,7 +152,8 @@ void RiaRegressionTestRunner::runRegressionTest()
} }
} }
QString htmlReportFileName = generateHtmlReport(folderList, baseFolderName, generatedFolderName, diffFolderName, testDir); QString htmlReportFileName =
generateHtmlReport( folderList, baseFolderName, generatedFolderName, diffFolderName, testDir );
if ( regressionTestConfig.openReportInBrowser() ) if ( regressionTestConfig.openReportInBrowser() )
{ {
@ -170,7 +172,9 @@ void RiaRegressionTestRunner::runRegressionTest()
{ {
QDir testCaseFolder( folderFileInfo.filePath() ); QDir testCaseFolder( folderFileInfo.filePath() );
bool anyCommandFilesExecuted = findAndExecuteCommandFiles(testCaseFolder, regressionTestConfig, htmlReportFileName); bool anyCommandFilesExecuted = findAndExecuteCommandFiles( testCaseFolder,
regressionTestConfig,
htmlReportFileName );
if ( !anyCommandFilesExecuted ) if ( !anyCommandFilesExecuted )
{ {
@ -197,21 +201,22 @@ void RiaRegressionTestRunner::runRegressionTest()
// Wait until all command objects have completed // Wait until all command objects have completed
app->waitUntilCommandObjectsHasBeenProcessed(); app->waitUntilCommandObjectsHasBeenProcessed();
regressionTestConfigureProject(); setDefaultSnapshotSizeFor3dViews();
resizePlotWindows();
QString fullPathGeneratedFolder = testCaseFolder.absoluteFilePath( generatedFolderName ); QString fullPathGeneratedFolder = testCaseFolder.absoluteFilePath( generatedFolderName );
RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( fullPathGeneratedFolder ); RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( fullPathGeneratedFolder );
RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder(fullPathGeneratedFolder); QApplication::processEvents();
setDefaultSnapshotSizeForPlotWindows();
RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( fullPathGeneratedFolder );
app->closeProject(); app->closeProject();
} }
else else
{ {
RiaLogging::error("Could not find a regression test file named : " + testCaseFolder.absolutePath() + "/" + RiaLogging::error( "Could not find a regression test file named : " + testCaseFolder.absolutePath() +
regTestProjectName + ".rsp"); "/" + regTestProjectName + ".rsp" );
} }
} }
@ -226,8 +231,9 @@ void RiaRegressionTestRunner::runRegressionTest()
{ {
QString fileName = baseImageFileNames[fIdx]; QString fileName = baseImageFileNames[fIdx];
RiaImageFileCompare imgComparator( RegTestNames::imageCompareExeName ); RiaImageFileCompare imgComparator( RegTestNames::imageCompareExeName );
bool ok = bool ok = imgComparator.runComparison( genDir.filePath( fileName ),
imgComparator.runComparison(genDir.filePath(fileName), baseDir.filePath(fileName), diffDir.filePath(fileName)); baseDir.filePath( fileName ),
diffDir.filePath( fileName ) );
if ( !ok ) if ( !ok )
{ {
qDebug() << "Error comparing :" << imgComparator.errorMessage() << "\n" << imgComparator.errorDetails(); qDebug() << "Error comparing :" << imgComparator.errorMessage() << "\n" << imgComparator.errorDetails();
@ -359,7 +365,8 @@ bool RiaRegressionTestRunner::findAndExecuteCommandFiles(const QDir&
html += "<table>\n"; html += "<table>\n";
html += " <tr>\n"; html += " <tr>\n";
html += " <td colspan=\"3\" bgcolor=\"darkblue\" height=\"40\"> <b><font color=\"white\" size=\"3\"> " + html +=
" <td colspan=\"3\" bgcolor=\"darkblue\" height=\"40\"> <b><font color=\"white\" size=\"3\"> " +
headerText + " </font></b> </td>\n"; headerText + " </font></b> </td>\n";
html += " </tr>\n"; html += " </tr>\n";
@ -461,74 +468,27 @@ void RiaRegressionTestRunner::removeDirectoryWithContent(QDir& dirToDelete)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiaRegressionTestRunner::regressionTestConfigureProject() void RiaRegressionTestRunner::setDefaultSnapshotSizeFor3dViews()
{ {
RiuMainWindow* mainWnd = RiuMainWindow::instance(); RiuMainWindow* mainWnd = RiuMainWindow::instance();
if ( !mainWnd ) return; if ( !mainWnd ) return;
RimProject* proj = RiaApplication::instance()->project(); QSize defaultSize = RiaRegressionTestRunner::regressionDefaultImageSize();
if (!proj) return;
std::vector<RimCase*> projectCases; RiuMainWindowTools::setFixedWindowSizeFor3dViews( mainWnd, defaultSize.width(), defaultSize.height() );
proj->allCases(projectCases);
for (RimCase* cas : projectCases)
{
if (!cas) continue;
std::vector<Rim3dView*> views = cas->views();
for (Rim3dView* riv : views)
{
if (riv && riv->viewer())
{
// Make sure all views are maximized for snapshotting
QMdiSubWindow* subWnd = mainWnd->findMdiSubWindow(riv->viewer()->layoutWidget());
if (subWnd)
{
subWnd->showMaximized();
}
// This size is set to match the regression test reference images
riv->viewer()->setFixedSize(RiaRegressionTestRunner::regressionDefaultImageSize());
}
}
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiaRegressionTestRunner::resizePlotWindows() void RiaRegressionTestRunner::setDefaultSnapshotSizeForPlotWindows()
{ {
RimProject* proj = RiaApplication::instance()->project();
if (!proj) return;
RiuPlotMainWindow* plotMainWindow = RiaGuiApplication::instance()->mainPlotWindow(); RiuPlotMainWindow* plotMainWindow = RiaGuiApplication::instance()->mainPlotWindow();
if ( !plotMainWindow ) return; if ( !plotMainWindow ) return;
std::vector<RimViewWindow*> viewWindows; QSize defaultSize = RiaRegressionTestRunner::regressionDefaultImageSize();
proj->mainPlotCollection()->descendantsIncludingThisOfType(viewWindows); RiuMainWindowTools::setWindowSizeOnWidgetsInMdiWindows( plotMainWindow, defaultSize.width(), defaultSize.height() );
for (auto viewWindow : viewWindows)
{
if (viewWindow->isMdiWindow())
{
QWidget* viewWidget = viewWindow->viewWidget();
if (viewWidget)
{
QMdiSubWindow* mdiWindow = plotMainWindow->findMdiSubWindow(viewWidget);
if (mdiWindow)
{
mdiWindow->showNormal();
viewWidget->resize(RiaRegressionTestRunner::regressionDefaultImageSize());
}
}
}
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -599,7 +559,8 @@ QFileInfoList RiaRegressionTestRunner::subDirectoriesForTestExecution(const QDir
for ( const auto& s : m_testFilter ) for ( const auto& s : m_testFilter )
{ {
QString trimmed = s.trimmed(); QString trimmed = s.trimmed();
if ((m_appendAllTestsAfterLastItemInFilter && anyMatchFound) || baseName.contains(trimmed, Qt::CaseInsensitive)) if ( ( m_appendAllTestsAfterLastItemInFilter && anyMatchFound ) ||
baseName.contains( trimmed, Qt::CaseInsensitive ) )
{ {
foldersMatchingTestFilter.push_back( fi ); foldersMatchingTestFilter.push_back( fi );
anyMatchFound = true; anyMatchFound = true;

View File

@ -42,7 +42,9 @@ public:
bool useOpenMPForGeometryCreation() const; bool useOpenMPForGeometryCreation() const;
static void updateRegressionTest( const QString& testRootPath ); static void updateRegressionTest( const QString& testRootPath );
static void regressionTestConfigureProject();
static void setDefaultSnapshotSizeFor3dViews();
static void setDefaultSnapshotSizeForPlotWindows();
private: private:
RiaRegressionTestRunner(); RiaRegressionTestRunner();
@ -60,7 +62,6 @@ private:
const QDir& testDir ); const QDir& testDir );
static void removeDirectoryWithContent( QDir& dirToDelete ); static void removeDirectoryWithContent( QDir& dirToDelete );
static void resizePlotWindows();
static QSize regressionDefaultImageSize(); static QSize regressionDefaultImageSize();
static QString diff2htmlHeaderText( const QString& testRootPath ); static QString diff2htmlHeaderText( const QString& testRootPath );
QFileInfoList subDirectoriesForTestExecution( const QDir& directory ); QFileInfoList subDirectoriesForTestExecution( const QDir& directory );

View File

@ -31,22 +31,24 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<const RigWellPath*> RiaSimWellBranchTools::simulationWellBranches(const QString& simWellName, bool useAutoDetectionOfBranches) std::vector<const RigWellPath*> RiaSimWellBranchTools::simulationWellBranches( const QString& simWellName,
bool useAutoDetectionOfBranches )
{ {
RiaApplication* app = RiaApplication::instance(); RiaApplication* app = RiaApplication::instance();
RimProject* proj = app->project(); RimProject* proj = app->project();
// Find first case containing the specified simulation well // Find first case containing the specified simulation well
auto simCases = proj->eclipseCases(); std::vector<RimEclipseCase*> simCases;
proj->descendantsIncludingThisOfType( simCases );
auto caseItr = std::find_if( simCases.begin(), simCases.end(), [&simWellName]( const RimEclipseCase* eclCase ) { auto caseItr = std::find_if( simCases.begin(), simCases.end(), [&simWellName]( const RimEclipseCase* eclCase ) {
const auto& eclData = eclCase->eclipseCaseData(); const auto& eclData = eclCase->eclipseCaseData();
return eclData != nullptr && eclData->hasSimulationWell( simWellName ); return eclData != nullptr && eclData->hasSimulationWell( simWellName );
} ); } );
RimEclipseCase* eclipseCase = caseItr != simCases.end() ? *caseItr : nullptr; RimEclipseCase* eclipseCase = caseItr != simCases.end() ? *caseItr : nullptr;
RigEclipseCaseData* eclCaseData = eclipseCase != nullptr ? eclipseCase->eclipseCaseData() : nullptr; RigEclipseCaseData* eclCaseData = eclipseCase != nullptr ? eclipseCase->eclipseCaseData() : nullptr;
return eclCaseData != nullptr ? return eclCaseData != nullptr ? eclCaseData->simulationWellBranches( simWellName, false, useAutoDetectionOfBranches )
eclCaseData->simulationWellBranches(simWellName, false, useAutoDetectionOfBranches) : : std::vector<const RigWellPath*>();
std::vector<const RigWellPath*>();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -66,7 +68,8 @@ QList<caf::PdmOptionItemInfo>
{ {
for ( int bIdx = 0; bIdx < static_cast<int>( branchCount ); ++bIdx ) for ( int bIdx = 0; bIdx < static_cast<int>( branchCount ); ++bIdx )
{ {
options.push_back(caf::PdmOptionItemInfo("Branch " + QString::number(bIdx + 1), QVariant::fromValue(bIdx))); options.push_back(
caf::PdmOptionItemInfo( "Branch " + QString::number( bIdx + 1 ), QVariant::fromValue( bIdx ) ) );
} }
} }
@ -85,7 +88,9 @@ void RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequiredFromWellName(caf:
{ {
const QString simWellName = RimWellPlotTools::simWellName( wellPathOrSimWellName ); const QString simWellName = RimWellPlotTools::simWellName( wellPathOrSimWellName );
RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequiredFromSimWellName(uiOrdering, simWellName, branchDetectionField, RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequiredFromSimWellName( uiOrdering,
simWellName,
branchDetectionField,
branchIndexField ); branchIndexField );
} }
} }
@ -93,7 +98,8 @@ void RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequiredFromWellName(caf:
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequiredFromSimWellName(caf::PdmUiOrdering* uiOrdering, void RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequiredFromSimWellName(
caf::PdmUiOrdering* uiOrdering,
const QString& simWellName, const QString& simWellName,
const caf::PdmField<bool>& branchDetectionField, const caf::PdmField<bool>& branchDetectionField,
const caf::PdmField<int>& branchIndexField ) const caf::PdmField<int>& branchIndexField )

View File

@ -39,7 +39,8 @@ class PdmUiOrdering;
class RiaSimWellBranchTools class RiaSimWellBranchTools
{ {
public: public:
static std::vector<const RigWellPath*> simulationWellBranches(const QString& simWellName, bool useAutoDetectionOfBranches); static std::vector<const RigWellPath*> simulationWellBranches( const QString& simWellName,
bool useAutoDetectionOfBranches );
static QList<caf::PdmOptionItemInfo> static QList<caf::PdmOptionItemInfo>
valueOptionsForBranchIndexField( const std::vector<const RigWellPath*>& simulationWellPaths ); valueOptionsForBranchIndexField( const std::vector<const RigWellPath*>& simulationWellPaths );
@ -49,7 +50,8 @@ public:
const caf::PdmField<bool>& branchDetectionField, const caf::PdmField<bool>& branchDetectionField,
const caf::PdmField<int>& branchIndexField ); const caf::PdmField<int>& branchIndexField );
static void appendSimWellBranchFieldsIfRequiredFromSimWellName(caf::PdmUiOrdering* uiOrdering, const QString& simWellName, static void appendSimWellBranchFieldsIfRequiredFromSimWellName( caf::PdmUiOrdering* uiOrdering,
const QString& simWellName,
const caf::PdmField<bool>& branchDetectionField, const caf::PdmField<bool>& branchDetectionField,
const caf::PdmField<int>& branchIndexField ); const caf::PdmField<int>& branchIndexField );

View File

@ -34,13 +34,14 @@ class RiaStatisticsTools
public: public:
static const QString replacePercentileByPValueText( const QString& percentile ); static const QString replacePercentileByPValueText( const QString& percentile );
template <class NumberType>
template<class NumberType> static bool isInvalidNumber(NumberType value) static bool isInvalidNumber( NumberType value )
{ {
return !isValidNumber<NumberType>( value ); return !isValidNumber<NumberType>( value );
} }
template<class NumberType> static bool isValidNumber(NumberType value) template <class NumberType>
static bool isValidNumber( NumberType value )
{ {
if ( std::isinf( value ) ) return false; if ( std::isinf( value ) ) return false;
if ( std::isnan( value ) ) return false; if ( std::isnan( value ) ) return false;
@ -48,4 +49,3 @@ public:
return true; return true;
} }
}; };

View File

@ -34,15 +34,18 @@ std::string RiaStdStringTools::trimString(const std::string& s)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RiaStdStringTools::isNumber( const std::string& s, char decimalPoint ) bool RiaStdStringTools::isNumber( const std::string& s, char decimalPoint )
{ {
if (s.size() == 0) return false; if ( s.empty() ) return false;
if ( findCharMatchCount( s, decimalPoint ) > 1 ) return false; if ( findCharMatchCount( s, decimalPoint ) > 1 ) return false;
if ( findCharMatchCount( s, '-' ) > 1 ) return false; if ( findCharMatchCount( s, '-' ) > 1 ) return false;
if ( findCharMatchCount( s, 'e' ) > 1 ) return false; if ( findCharMatchCount( s, 'e' ) > 1 ) return false;
if ( findCharMatchCount( s, 'E' ) > 1 ) return false; if ( findCharMatchCount( s, 'E' ) > 1 ) return false;
std::string matchChars("0123456789eE-"); std::string matchChars( "0123456789eE-+" );
matchChars.append( 1, decimalPoint ); matchChars.append( 1, decimalPoint );
return (s.find_first_not_of(matchChars) == std::string::npos);
auto it = s.find_first_not_of( matchChars );
return ( it == std::string::npos );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -107,7 +110,8 @@ bool RiaStdStringTools::startsWithAlphabetic(const std::string& s)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RiaStdStringTools::endsWith( const std::string& mainStr, const std::string& toMatch ) bool RiaStdStringTools::endsWith( const std::string& mainStr, const std::string& toMatch )
{ {
if (mainStr.size() >= toMatch.size() && mainStr.compare(mainStr.size() - toMatch.size(), toMatch.size(), toMatch) == 0) if ( mainStr.size() >= toMatch.size() &&
mainStr.compare( mainStr.size() - toMatch.size(), toMatch.size(), toMatch ) == 0 )
return true; return true;
else else
return false; return false;
@ -138,4 +142,3 @@ size_t RiaStdStringTools::findCharMatchCount(const std::string& s, char c)
} }
return count; return count;
} }

View File

@ -41,7 +41,6 @@ public:
static bool endsWith( const std::string& mainStr, const std::string& toMatch ); static bool endsWith( const std::string& mainStr, const std::string& toMatch );
static std::vector<std::string> splitStringBySpace( const std::string& s ); static std::vector<std::string> splitStringBySpace( const std::string& s );
private: private:

View File

@ -20,7 +20,6 @@
#include "RiaStringEncodingTools.h" #include "RiaStringEncodingTools.h"
const std::string RiaStringEncodingTools::toNativeEncoded( const QString& qstring ) const std::string RiaStringEncodingTools::toNativeEncoded( const QString& qstring )
{ {
#ifdef WIN32 #ifdef WIN32

View File

@ -20,8 +20,8 @@
#pragma once #pragma once
#include <QString>
#include <QByteArray> #include <QByteArray>
#include <QString>
#include <string> #include <string>
//================================================================================================== //==================================================================================================

View File

@ -34,7 +34,7 @@ RiaSummaryCurveAnalyzer::RiaSummaryCurveAnalyzer() {}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiaSummaryCurveAnalyzer::appendAdresses(const std::vector<RifEclipseSummaryAddress>& allAddresses) void RiaSummaryCurveAnalyzer::appendAddresses( const std::vector<RifEclipseSummaryAddress>& allAddresses )
{ {
for ( const auto& adr : allAddresses ) for ( const auto& adr : allAddresses )
{ {
@ -45,7 +45,7 @@ void RiaSummaryCurveAnalyzer::appendAdresses(const std::vector<RifEclipseSummary
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiaSummaryCurveAnalyzer::appendAdresses(const std::set<RifEclipseSummaryAddress>& allAddresses) void RiaSummaryCurveAnalyzer::appendAddresses( const std::set<RifEclipseSummaryAddress>& allAddresses )
{ {
for ( const auto& adr : allAddresses ) for ( const auto& adr : allAddresses )
{ {

View File

@ -37,8 +37,8 @@ class RiaSummaryCurveAnalyzer
public: public:
RiaSummaryCurveAnalyzer(); RiaSummaryCurveAnalyzer();
void appendAdresses(const std::set<RifEclipseSummaryAddress>& allAddresses); void appendAddresses( const std::set<RifEclipseSummaryAddress>& allAddresses );
void appendAdresses(const std::vector<RifEclipseSummaryAddress>& allAddresses); void appendAddresses( const std::vector<RifEclipseSummaryAddress>& allAddresses );
void clear(); void clear();
@ -61,7 +61,8 @@ public:
std::vector<QString> identifierTexts( RifEclipseSummaryAddress::SummaryVarCategory category, std::vector<QString> identifierTexts( RifEclipseSummaryAddress::SummaryVarCategory category,
const std::string& secondaryIdentifier ) const; const std::string& secondaryIdentifier ) const;
static std::vector<RifEclipseSummaryAddress> addressesForCategory(const std::set<RifEclipseSummaryAddress>& addresses, static std::vector<RifEclipseSummaryAddress>
addressesForCategory( const std::set<RifEclipseSummaryAddress>& addresses,
RifEclipseSummaryAddress::SummaryVarCategory category ); RifEclipseSummaryAddress::SummaryVarCategory category );
static std::string correspondingHistorySummaryCurveName( const std::string& curveName ); static std::string correspondingHistorySummaryCurveName( const std::string& curveName );

View File

@ -22,8 +22,8 @@
#include "RifEclipseSummaryAddress.h" #include "RifEclipseSummaryAddress.h"
#include "RimOilField.h"
#include "RimMainPlotCollection.h" #include "RimMainPlotCollection.h"
#include "RimOilField.h"
#include "RimProject.h" #include "RimProject.h"
#include "RimSummaryCaseMainCollection.h" #include "RimSummaryCaseMainCollection.h"
#include "RimSummaryCrossPlot.h" #include "RimSummaryCrossPlot.h"
@ -31,8 +31,8 @@
#include "RimSummaryPlot.h" #include "RimSummaryPlot.h"
#include "RimSummaryPlotCollection.h" #include "RimSummaryPlotCollection.h"
#include "cafPdmObject.h"
#include "RimSummaryCrossPlotCollection.h" #include "RimSummaryCrossPlotCollection.h"
#include "cafPdmObject.h"
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -58,7 +58,8 @@ RimSummaryCaseMainCollection* RiaSummaryTools::summaryCaseMainCollection()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Update the summary curves referencing this curve, as the curve is identified by the name /// Update the summary curves referencing this curve, as the curve is identified by the name
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiaSummaryTools::notifyCalculatedCurveNameHasChanged(const QString& previousCurveName, const QString& currentCurveName) void RiaSummaryTools::notifyCalculatedCurveNameHasChanged( const QString& previousCurveName,
const QString& currentCurveName )
{ {
RimSummaryPlotCollection* summaryPlotColl = RiaSummaryTools::summaryPlotCollection(); RimSummaryPlotCollection* summaryPlotColl = RiaSummaryTools::summaryPlotCollection();
@ -71,7 +72,8 @@ void RiaSummaryTools::notifyCalculatedCurveNameHasChanged(const QString& previou
{ {
if ( adr.quantityName() == previousCurveName.toStdString() ) if ( adr.quantityName() == previousCurveName.toStdString() )
{ {
RifEclipseSummaryAddress updatedAdr = RifEclipseSummaryAddress::calculatedAddress(currentCurveName.toStdString()); RifEclipseSummaryAddress updatedAdr = RifEclipseSummaryAddress::calculatedAddress(
currentCurveName.toStdString() );
curve->setSummaryAddressYAndApplyInterpolation( updatedAdr ); curve->setSummaryAddressYAndApplyInterpolation( updatedAdr );
} }
} }

View File

@ -26,7 +26,8 @@ class RimSummaryCaseMainCollection;
class QString; class QString;
namespace caf { namespace caf
{
class PdmObject; class PdmObject;
} }
@ -38,8 +39,7 @@ class RiaSummaryTools
public: public:
static RimSummaryPlotCollection* summaryPlotCollection(); static RimSummaryPlotCollection* summaryPlotCollection();
static RimSummaryCaseMainCollection* summaryCaseMainCollection(); static RimSummaryCaseMainCollection* summaryCaseMainCollection();
static void notifyCalculatedCurveNameHasChanged(const QString& previousCurveName, static void notifyCalculatedCurveNameHasChanged( const QString& previousCurveName, const QString& currentCurveName );
const QString& currentCurveName);
static RimSummaryPlot* parentSummaryPlot( caf::PdmObject* object ); static RimSummaryPlot* parentSummaryPlot( caf::PdmObject* object );
static RimSummaryPlotCollection* parentSummaryPlotCollection( caf::PdmObject* object ); static RimSummaryPlotCollection* parentSummaryPlotCollection( caf::PdmObject* object );

View File

@ -64,7 +64,8 @@ bool RiaTextFileCompare::runComparison(const QString& baseFolder, const QString&
// See https://docs.freebsd.org/info/diff/diff.info.diff_Options.html // See https://docs.freebsd.org/info/diff/diff.info.diff_Options.html
QString args = "-r -u --strip-trailing-cr"; QString args = "-r -u --strip-trailing-cr";
QString completeCommand = QString("\"%1\" %2 %3 %4").arg(fullFilePath).arg(baseFolder).arg(generatedFolder).arg(args); QString completeCommand =
QString( "\"%1\" %2 %3 %4" ).arg( fullFilePath ).arg( baseFolder ).arg( generatedFolder ).arg( args );
// Launch process and wait // Launch process and wait
QProcess proc; QProcess proc;

View File

@ -20,7 +20,6 @@
#include <QString> #include <QString>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -55,4 +54,3 @@ QString RiaTextStringTools::trimAndRemoveDoubleSpaces(const QString& s)
return trimmed; return trimmed;
} }

View File

@ -27,4 +27,4 @@ namespace RiaTextStringTools
{ {
bool compare( const QString& expected, const QString& actual ); bool compare( const QString& expected, const QString& actual );
QString trimAndRemoveDoubleSpaces( const QString& s ); QString trimAndRemoveDoubleSpaces( const QString& s );
} } // namespace RiaTextStringTools

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