From 84bc868338a118ac146059a75995fee10242e220 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 5 Jan 2018 15:34:26 +0100 Subject: [PATCH 01/78] #2313 Upped version to 2018.01.00-dev.01 --- ResInsightVersion.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index aaedd76815..10aaf91004 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -4,13 +4,13 @@ set(RESINSIGHT_MINOR_VERSION 01) set(RESINSIGHT_PATCH_VERSION 00) # Opional text with no restrictions -#set(RESINSIGHT_VERSION_TEXT "-dev") +set(RESINSIGHT_VERSION_TEXT "-dev") # Optional text # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -#set(RESINSIGHT_DEV_VERSION ".16") +set(RESINSIGHT_DEV_VERSION ".01") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") From f515d3c2de6d435c916bd7b2da05b7a14053b37e Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 5 Jan 2018 15:40:09 +0100 Subject: [PATCH 02/78] System : Add field and object keywords for 2018.01 --- .../2018.01/ri-fieldKeywords.txt | 1678 +++++++++++++++++ .../2018.01/ri-objectKeywords.txt | 188 ++ 2 files changed, 1866 insertions(+) create mode 100644 ApplicationCode/Adm/projectfilekeywords/2018.01/ri-fieldKeywords.txt create mode 100644 ApplicationCode/Adm/projectfilekeywords/2018.01/ri-objectKeywords.txt diff --git a/ApplicationCode/Adm/projectfilekeywords/2018.01/ri-fieldKeywords.txt b/ApplicationCode/Adm/projectfilekeywords/2018.01/ri-fieldKeywords.txt new file mode 100644 index 0000000000..0f85509521 --- /dev/null +++ b/ApplicationCode/Adm/projectfilekeywords/2018.01/ri-fieldKeywords.txt @@ -0,0 +1,1678 @@ +// ResInsight version string : 2018.01.00-dev.01 +// Report generated : Fri 5. Jan 15:39:23 2018 +// +// + +AsciiDataCurve - class RimAsciiDataCurve + Show + CurveName + CurveDescription + AutoName + Color + Thickness + LineStyle + CurveInterpolation + PointSymbol + SymbolSkipPxDist + ShowLegend + PlotAxis + TimeSteps + Values + Title + +CalcScript - class RimCalcScript + AbsolutePath + Content + +CalculatedSummaryCase - class RimCalculatedSummaryCase + ShortName + AutoShortyName + SummaryHeaderFilename + +CellEdgeResultSlot - class RimCellEdgeColors + EnableCellEdgeColors + propertyType + CellEdgeVariable + UseXVariable + UseYVariable + UseZVariable + LegendDefinition + SingleVarEdgeResult + +CellFilter - class RimCellFilter + UserDescription + Active + FilterType + +CellPropertyFilter - class RimEclipsePropertyFilter + UserDescription + Active + FilterType + SelectedValues + EvaluationRegion + ResultDefinition + Dummy_keyword + LowerBound + UpperBound + CategorySelection + +CellPropertyFilters - class RimEclipsePropertyFilterCollection + Active + PropertyFilters + +CellRangeFilter - class RimCellRangeFilter + UserDescription + Active + FilterType + GridIndex + PropagateToSubGrids + StartIndexI + CellCountI + StartIndexJ + CellCountJ + StartIndexK + CellCountK + +CellRangeFilterCollection - class RimCellRangeFilterCollection + RangeFilters + Active + +ChangeDataSourceFeatureUi - class RicChangeDataSourceFeatureUi + CurveWellPath + CurveCase + +CmdAddItemExecData - class caf::CmdAddItemExecData + PathToField + indexAfter + createdItemIndex + +CmdDeleteItemExecData - class caf::CmdDeleteItemExecData + PathToField + indexToObject + deletedObjectAsXml + +CmdFieldChangeExecData - class caf::CmdFieldChangeExecData + PathToField + +CrossSection - class RimIntersection + UserDescription + Active + Type + Direction + WellPath + SimulationWell + Points + AzimuthAngle + DipAngle + CustomExtrusionPoints + TwoAzimuthPoints + Branch + ExtentLength + lengthUp + lengthDown + ShowInactiveCells + m_activateUiAppendPointsCommand + inputExtrusionPointsFromViewerEnabled + inputTwoAzimuthPointsFromViewerEnabled + +CrossSectionCollection - class RimIntersectionCollection + CrossSections + IntersectionBoxes + Active + +EclipseCase - class RimEclipseResultCase + CaseUserDescription + CaseId + DefaultFormationNames + TimeStepFilter + ReservoirViews + MatrixModelResults + FractureModelResults + FlipXAxis + FlipYAxis + CachedFileNamesContainingFaults + FilesContainingFaults + CaseName + CaseFileName + FlowDiagSolutions + CaseFolder + SourSimFileName + +EclipseGeometrySelectionItem - class RimEclipseGeometrySelectionItem + EclipseCase + GridIndex + CellIndex + LocalIntersectionPoint + +Fault - class RimFaultInView + FaultName + ShowFault + Color + +Faults - class RimFaultInViewCollection + Active + ShowFaultFaces + ShowOppositeFaultFaces + ShowFaultsOutsideFilters + FaultFaceCulling + ShowFaultLabel + FaultLabelColor + ShowNNCs + HideNncsWhenNoResultIsAvailable + NoCommonAreaNnncCollection + Faults + +FileSummaryCase - class RimFileSummaryCase + ShortName + AutoShortyName + SummaryHeaderFilename + +FishbonesCollection - class RimFishbonesCollection + Name + IsChecked + FishbonesSubs + WellPathCollection + StartMD + MainBoreDiameter + MainBoreSkinFactor + LinerDiameter + RoughnessFactor + PressureDrop + LengthAndDepth + +FishbonesMultipleSubs - class RimFishbonesMultipleSubs + Active + Name + Color + LateralCountPerSub + LateralLength + LateralExitAngle + LateralBuildAngle + LateralTubingDiameter + LateralOpenHoleRoghnessFactor + LateralTubingRoghnessFactor + LateralInstallSuccessFraction + IcdCount + IcdOrificeDiameter + IcdFlowCoefficient + LocationOfSubs + SubsLocationMode + RangeStart + RangeEnd + RangeSubSpacing + RangeSubCount + SubsOrientationMode + InstallationRotationAngles + FixedInstallationRotationAngle + PipeProperties + +FishbonesPipeProperties - class RimFishbonesPipeProperties + LateralHoleDiameter + SkinFactor + +FlowCharacteristicsPlot - class RimFlowCharacteristicsPlot + WindowController + ShowWindow + WindowGeometry + FlowCase + FlowDiagSolution + TimeSelectionType + SelectedTimeSteps + SelectedTimeStepsUi + ApplyTimeSteps + CellPVThreshold + ShowLegend + CellFilter + CellFilterView + TracerFilter + SelectedTracerNames + ShowRegion + MinCommunication + MaxTof + +FlowDiagSolution - class RimFlowDiagSolution + UserDescription + +FlowPlotCollection - class RimFlowPlotCollection + FlowCharacteristicsPlot + DefaultWellAllocationPlot + StoredWellAllocationPlots + StoredFlowCharacteristicsPlots + +FormationNames - class RimFormationNames + FormationNamesFileName + +FormationNamesCollectionObject - class RimFormationNamesCollection + FormationNamesList + +FractureContainment - class RimFractureContainment + IsUsingFractureContainment + TopKLayer + BaseKLayer + FaultTruncationType + +FractureDefinitionCollection - class RimFractureTemplateCollection + DefaultUnitForTemplates + FractureDefinitions + +GeoMechGeometrySelectionItem - class RimGeoMechGeometrySelectionItem + GeoMechCase + m_gridIndex + m_cellIndex + m_elementFace + m_hasIntersectionTriangle + m_intersectionTriangle_0 + m_intersectionTriangle_1 + m_intersectionTriangle_2 + m_localIntersectionPoint + +GeoMechPropertyFilter - class RimGeoMechPropertyFilter + UserDescription + Active + FilterType + SelectedValues + ResultDefinition + LowerBound + UpperBound + +GeoMechPropertyFilters - class RimGeoMechPropertyFilterCollection + Active + PropertyFilters + +GeoMechResultDefinition - class RimGeoMechResultDefinition + ResultPositionType + ResultFieldName + ResultComponentName + IsTimeLapseResult + TimeLapseBaseTimeStep + ResultPositionTypeUi + ResultVariableUI + IsTimeLapseResultUI + TimeLapseBaseTimeStepUI + +GeoMechResultSlot - class RimGeoMechCellColors + ResultPositionType + ResultFieldName + ResultComponentName + IsTimeLapseResult + TimeLapseBaseTimeStep + ResultPositionTypeUi + ResultVariableUI + IsTimeLapseResultUI + TimeLapseBaseTimeStepUI + LegendDefinition + +GeoMechView - class RimGeoMechView + WindowController + ShowWindow + WindowGeometry + UserDescription + CameraPosition + CameraPointOfInterest + PerspectiveProjection + GridZScale + ViewBackgroundColor + MaximumFrameRate + AnimationMode + CurrentTimeStep + OverlayInfoConfig + MeshMode + SurfaceMode + ShowGridBox + DisableLighting + RangeFilters + RangeFiltersControlled + CrossSections + GridCollection + GridCellResult + PropertyFilters + +GridCollection - class RimGridCollection + IsActive + +GridSummaryCase - class RimGridSummaryCase + ShortName + AutoShortyName + SummaryHeaderFilename + Associated3DCase + CachedCasename + Associated3DCaseGridFileName + +GridTimeHistoryCurve - class RimGridTimeHistoryCurve + Show + CurveName + CurveDescription + AutoName + Color + Thickness + LineStyle + CurveInterpolation + PointSymbol + SymbolSkipPxDist + ShowLegend + GeometrySelectionText + EclipseResultDefinition + GeoMechResultDefinition + GeometrySelectionItem + PlotAxis + +IntersectionBox - class RimIntersectionBox + UserDescription + Active + singlePlaneState + MinXCoord + MaxXCoord + MinYCoord + MaxYCoord + MinDepth + MaxDepth + ShowInactiveCells + xySliderStepSize + DepthSliderStepSize + show3DManipulator + +Legend - class RimLegendConfig + NumberOfLevels + Precision + TickNumberFormat + ColorRangeMode + MappingMode + RangeType + UserDefinedMax + UserDefinedMin + ResultVariableUsage + +MainPlotCollection - class RimMainPlotCollection + Show + WellLogPlotCollection + RftPlotCollection + PltPlotCollection + SummaryPlotCollection + SummaryCrossPlotCollection + FlowPlotCollection + +MdiWindowController - class RimMdiWindowController + MainWindowID + xPos + yPos + Width + Height + IsMaximized + +MockModelSettings - class RimMockModelSettings + CellCountX + CellCountY + CellCountZ + TotalCellCount + ResultCount + TimeStepCount + +MultiSnapshotDefinition - class RimMultiSnapshotDefinition + IsActive + View + EclipseResultType + SelectedEclipseResults + TimeStepStart + TimeStepEnd + SnapShotDirection + RangeFilterStart + RangeFilterEnd + AdditionalCases + +NoCommonAreaNNC - class RimNoCommonAreaNNC + Name + +ObservedDataCollection - class RimObservedDataCollection + ObservedDataArray + +PdmDocument - class caf::PdmDocument + DocumentFileName + +PdmObjectCollection - class caf::PdmObjectCollection + PdmObjects + +PdmObjectGroup - class caf::PdmObjectGroup + +Perforation - class RimPerforationInterval + Name + IsChecked + StartMeasuredDepth + EndMeasuredDepth + Diameter + SkinFactor + StartOfHistory + StartDate + +PerforationCollection - class RimPerforationCollection + Name + IsChecked + Perforations + +PropertyFilter - class RimPropertyFilter + UserDescription + Active + FilterType + SelectedValues + +ResInsightAnalysisModels - class RimEclipseCaseCollection + Reservoirs + CaseGroups + +ResInsightGeoMechCase - class RimGeoMechCase + CaseUserDescription + CaseId + DefaultFormationNames + TimeStepFilter + CaseFileName + GeoMechViews + CaseCohesion + FrctionAngleDeg + +ResInsightGeoMechModels - class RimGeoMechModels + Cases + +ResInsightOilField - class RimOilField + AnalysisModels + GeoMechModels + WellPathCollection + FractureDefinitionCollection + SummaryCaseCollection + FormationNamesCollection + ObservedDataCollection + +ResInsightProject - class RimProject + DocumentFileName + ProjectFileVersionString + NextValidCaseId + NextValidCaseGroupId + OilFields + ScriptCollection + WellPathImport + MainPlotCollection + LinkedViews + CalculationCollection + CommandObjects + MultiSnapshotDefinitions + TreeViewState + TreeViewCurrentModelIndexPath + PlotWindowTreeViewState + PlotWindowTreeViewCurrentModelIndexPath + show3DWindow + showPlotWindow + DialogData + Reservoirs + CaseGroups + +ReservoirCellResultStorage - class RimReservoirCellResultsStorage + ResultCacheFileName + ResultCacheEntries + +ReservoirView - class RimEclipseView + WindowController + ShowWindow + WindowGeometry + UserDescription + CameraPosition + CameraPointOfInterest + PerspectiveProjection + GridZScale + ViewBackgroundColor + MaximumFrameRate + AnimationMode + CurrentTimeStep + OverlayInfoConfig + MeshMode + SurfaceMode + ShowGridBox + DisableLighting + RangeFilters + RangeFiltersControlled + CrossSections + GridCollection + GridCellResult + GridCellEdgeResult + FaultResultSettings + StimPlanColors + WellCollection + FaultCollection + PropertyFilters + ShowMainGrid + ShowInactiveCells + ShowInvalidCells + +ResultDefinition - class RimEclipseResultDefinition + ResultType + PorosityModelType + ResultVariable + FlowDiagSolution + SelectedTracers + SelectedSouringTracers + FlowTracerSelectionMode + PhaseSelection + MResultType + MPorosityModelType + MResultVariable + MFlowDiagSolution + MSelectedTracers + MSelectedSouringTracers + SelectedTracersFilter + +ResultSlot - class RimEclipseCellColors + ResultType + PorosityModelType + ResultVariable + FlowDiagSolution + SelectedTracers + SelectedSouringTracers + FlowTracerSelectionMode + PhaseSelection + MResultType + MPorosityModelType + MResultVariable + MFlowDiagSolution + MSelectedTracers + MSelectedSouringTracers + SelectedTracersFilter + LegendDefinition + ResultVarLegendDefinitionList + TernaryLegendDefinition + LegendDefinitionPtrField + +ResultStorageEntryInfo - class RimReservoirCellResultsStorageEntryInfo + ResultType + ResultName + TimeSteps + DaysSinceSimulationStart + FilePositionDataStart + +RftAddress - class RimDataSourceForRftPlt + SourceType + EclipseCase + WellLogFile + +RiaPreferences - class RiaPreferences + navigationPolicy + scriptDirectory + scriptEditorExecutable + octaveExecutable + octaveShowHeaderInfoWhenExecutingScripts + ssihubAddress + defaultGridLines + defaultGridLineColors + defaultFaultGridLineColors + defaultWellLableColor + defaultViewerBackgroundColor + defaultScaleFactorZ + fontSizeInScene + showLasCurveWithoutTvdWarning + useShaders + showHud + appendClassNameToUiText + appendFieldKeywordToToolTipText + includeFractureDebugInfoFile + lastUsedProjectFileName + autocomputeDepth + loadAndShowSoil + readerSettings + +RiaRegressionTest - class RiaRegressionTest + workingFolder + regressionTestFolder + showInteractiveDiffImages + testFilter + +RicCaseAndFileExportSettingsUi - class RicCaseAndFileExportSettingsUi + Folder + CaseToApply + +RicCellRangeUi - class RicCellRangeUi + Case + GridIndex + StartIndexI + StartIndexJ + StartIndexK + CellCountI + CellCountJ + CellCountK + +RicDeleteItemExecData - class RicDeleteItemExecData + PathToField + indexToObject + deletedObjectAsXml + +RicExportCarfinUi - class RicExportCarfinUi + CellRange + ExportFileName + CaseToApply + CellCountI + CellCountJ + CellCountK + MaxWellCount + +RicExportCompletionDataSettingsUi - class RicExportCompletionDataSettingsUi + Folder + CaseToApply + +RicExportToLasFileObj - class RicExportToLasFileObj + tvdrkbOffset + +RicExportToLasFileResampleUi - class RicExportToLasFileResampleUi + ExportFolder + ActivateResample + ResampleInterval + ExportTvdrkb + tvdrkbOffsets + +RicLinkVisibleViewsFeatureUi - class RicLinkVisibleViewsFeatureUi + MasterView + +RicPasteAsciiDataToSummaryPlotFeatureUi - class RicPasteAsciiDataToSummaryPlotFeatureUi + PlotTitle + CurvePrefix + DecimalSeparator + DateFormat + TimeFormat + UseCustomDateFormat + CustomDateTimeFormat + LineStyle + Symbol + SymbolSkipDinstance + CellSeparator + TimeColumnName + PreviewText + +RicSaveEclipseInputVisibleCellsUi - class RicSaveEclipseInputVisibleCellsUi + ExportFilename + ExportKeyword + VisibleActiveCellsValue + HiddenActiveCellsValue + InactiveCellsValue + +RicSelectSummaryPlotUI - class RicSelectSummaryPlotUI + SelectedSummaryPlot + CreateNewPlot + NewViewName + +RicSelectViewUI - class RicSelectViewUI + MasterView + CreateNewView + NewViewName + +RicSummaryAddressSelection - class RiuSummaryCurveDefSelection + SummaryCases + CurrentSummaryCategory + SelectedSummaryCategories + FieldVectors + Aquifers + AquiferVectors + NetworkVectors + MiscVectors + Regions + RegionsVectors + Region2RegionRegions + Region2RegionVectors + WellGroupWellGroupNames + WellGroupVectors + WellWellName + WellVectors + WellCompletionWellName + WellCompletionIjk + WellCompletionVectors + WellCompletionLgrLgrName + WellCompletionLgrWellName + WellCompletionLgrIjk + WellCompletionLgrVectors + WellLgrLgrName + WellLgrWellName + WellLgrVectors + WellSegmentWellName + WellSegmentNumber + WellSegmentVectors + BlockIjk + BlockVectors + BlockLgrLgrName + BlockLgrIjk + BlockLgrVectors + CalculatedVectors + ImportedVectors + +RicSummaryCurveCalculator - class RicSummaryCurveCalculator + CurrentCalculation + NewCalculation + DeleteCalculation + +RicSummaryCurveCreator - class RicSummaryCurveCreator + TargetPlot + UseAutoAppearanceAssignment + AppearanceApplyButton + CaseAppearanceType + VariableAppearanceType + WellAppearanceType + GroupAppearanceType + RegionAppearanceType + UseAutoPlotTitle + ApplySelection + Close + OK + SummaryCurveNameConfig + +RicWellPathsUnitSystemSettingsUi - class RicWellPathsUnitSystemSettingsUi + UnitSystem + +RifReaderSettings - class RifReaderSettings + importFaults + importSimulationNNCs + importAdvancedMswData + useResultIndexFile + skipWellData + faultIncludeFileAbsolutePathPrefix + +RimBinaryExportSettings - class RimBinaryExportSettings + Filename + EclipseKeyword + UndefinedValue + +RimCaseCollection - class RimCaseCollection + Reservoirs + +RimCommandExecuteScript - class RimCommandExecuteScript + Name + ScriptText + IsEnabled + Execute + +RimCommandIssueFieldChanged - class RimCommandIssueFieldChanged + CommandName + ObjectName + FieldName + FieldValueToApply + +RimCommandObject - class RimCommandObject + +RimCsvUserData - class RimCsvUserData + ShortName + AutoShortyName + SummaryHeaderFilename + ImportedSummaryData + UseCustomIdentifier + SummaryType + IdentifierName + ParseOptions + +RimDialogData - class RimDialogData + ExportCarfin + ExportCompletionData + +RimEllipseFractureTemplate - class RimEllipseFractureTemplate + UserDescription + UnitSystem + Orientation + AzimuthAngle + SkinFactor + PerforationLength + PerforationEfficiency + WellDiameter + ConductivityType + FractureContainmentField + HalfLength + Height + Width + Permeability + +RimExportInputSettings - class RimExportInputSettings + Filename + Keyword + +RimFaultResultSlot - class RimEclipseFaultColors + ShowCustomFaultResult + CustomResultSlot + +RimFractureExportSettings - class RimFractureExportSettings + Filename + CaseToApply + +RimIdenticalGridCaseGroup - class RimIdenticalGridCaseGroup + UserDescription + GroupId + StatisticsCaseCollection + CaseCollection + +RimInputProperty - class RimEclipseInputProperty + ResultName + EclipseKeyword + FileName + ResolvedState + +RimInputPropertyCollection - class RimEclipseInputPropertyCollection + InputProperties + +RimInputReservoir - class RimEclipseInputCase + CaseUserDescription + CaseId + DefaultFormationNames + TimeStepFilter + ReservoirViews + MatrixModelResults + FractureModelResults + FlipXAxis + FlipYAxis + CachedFileNamesContainingFaults + FilesContainingFaults + CaseName + GridFileName + InputPropertyCollection + AdditionalFileNamesProxy + AdditionalFileNames + +RimNoCommonAreaNncCollection - class RimNoCommonAreaNncCollection + UserDescription + NoCommonAreaNncs + +RimObservedEclipseUserData - class RimObservedEclipseUserData + ShortName + AutoShortyName + SummaryHeaderFilename + ImportedSummaryData + UseCustomIdentifier + SummaryType + IdentifierName + +RimOilFieldEntry - class RimOilFieldEntry + OilFieldName + EdmId + Selected + wellsFilePath + Wells + +RimOilRegionEntry - class RimOilRegionEntry + OilRegionEntry + Fields + Selected + +RimStatisticalCalculation - class RimEclipseStatisticsCase + CaseUserDescription + CaseId + DefaultFormationNames + TimeStepFilter + ReservoirViews + MatrixModelResults + FractureModelResults + FlipXAxis + FlipYAxis + CachedFileNamesContainingFaults + FilesContainingFaults + CaseName + m_editingAllowed + SelectionSummary + ResultType + PorosityModel + DynamicPropertiesToCalculate + StaticPropertiesToCalculate + GeneratedPropertiesToCalculate + InputPropertiesToCalculate + FractureDynamicPropertiesToCalculate + FractureStaticPropertiesToCalculate + FractureGeneratedPropertiesToCalculate + FractureInputPropertiesToCalculate + CalculatePercentiles + PercentileCalculationType + LowPercentile + MidPercentile + HighPercentile + WellDataSourceCase + UseZeroAsInactiveCellValue + +RimStatisticalCollection - class RimEclipseStatisticsCaseCollection + Reservoirs + +RimStimPlanColors - class RimStimPlanColors + Name + IsChecked + ResultName + DefaultColor + LegendConfigurations + +RimStimPlanFractureTemplate - class RimStimPlanFractureTemplate + UserDescription + UnitSystem + Orientation + AzimuthAngle + SkinFactor + PerforationLength + PerforationEfficiency + WellDiameter + ConductivityType + FractureContainmentField + StimPlanFileName + WellPathDepthAtFracture + BorderPolygonResultName + ActiveTimeStepIndex + ShowStimPlanMesh + ConductivityFactor + +RimStimPlanLegendConfig - class RimStimPlanLegendConfig + Name + Legend + +RimSummaryCalculation - class RimSummaryCalculation + Description + Expression + Unit + Variables + CalculatedValues + TimeSteps + +RimSummaryCalculationCollection - class RimSummaryCalculationCollection + Calculations + CalculationsSummaryCase + +RimSummaryCalculationVariable - class RimSummaryCalculationVariable + VariableName + PushButton + SummaryAddressUi + SummaryCase + SummaryAddress + +RimSummaryCurveCollection - class RimSummaryCurveCollection + CollectionCurves + IsActive + YSourceStepping + XSourceStepping + UnionSourceStepping + +RimSummaryCurveCollectionModifier - class RimSummaryPlotSourceStepping + CurveCase + WellName + GroupName + Region + Quantities + Placeholder + +RimTernaryLegendConfig - class RimTernaryLegendConfig + Precision + RangeType + m_applyLocalMinMax + m_applyGlobalMinMax + m_applyFullRangeMinMax + ternaryRangeSummary + UserDefinedMaxSoil + UserDefinedMinSoil + UserDefinedMaxSgas + UserDefinedMinSgas + UserDefinedMaxSwat + UserDefinedMinSwat + +RimTimeStepFilter - class RimTimeStepFilter + TimeStepIndicesToImport + FirstTimeStep + LastTimeStep + FilterType + Interval + FilteredTimeSteps + ApplyReloadOfCase + +RimViewLinkerCollection - class RimViewLinkerCollection + Active + ViewLinkers + +RimWellLogExtractionCurve - class RimWellLogExtractionCurve + Show + CurveName + CurveDescription + AutoName + Color + Thickness + LineStyle + CurveInterpolation + PointSymbol + SymbolSkipPxDist + ShowLegend + TrajectoryType + CurveWellPath + SimulationWellName + BranchDetection + Branch + CurveCase + CurveEclipseResult + CurveGeomechResult + CurveTimeStep + AddCaseNameToCurveName + AddPropertyToCurveName + AddWellNameToCurveName + AddTimestepToCurveName + AddDateToCurveName + +RimWellPathEntry - class RimWellPathEntry + Name + Selected + WellPathType + surveyType + requestUrl + wellPathFilePath + +RimWellPathImport - class RimWellPathImport + WellTypeSurvey + WellTypePlans + UtmMode + UtmNorth + UtmSouth + UtmEast + UtmWest + Regions + +ScriptLocation - class RimScriptCollection + ScriptDirectory + CalcScripts + SubDirectories + +SimWellFracture - class RimSimWellFracture + Name + IsChecked + FractureDef + AnchorPosition + ui_positionAtWellpath + Azimuth + PerforationLength + PerforationEfficiency + WellDiameter + Dip + Tilt + FractureUnit + TimeIndexToPlot + WellPathAzimuth + WellFractureAzimuthDiff + WellFractureAzimithAngleWarning + MeasuredDepth + Cell_IJK + Branch + +SimWellFractureCollection - class RimSimWellFractureCollection + Fractures + +SummaryAddress - class RimSummaryAddress + SummaryVarType + SummaryQuantityName + SummaryRegion + SummaryRegion2 + SummaryWellGroup + SummaryWell + SummaryWellSegment + SummaryLgr + SummaryCellI + SummaryCellJ + SummaryCellK + SummaryAquifer + +SummaryCaseCollection - class RimSummaryCaseMainCollection + SummaryCases + SummaryCaseCollections + +SummaryCaseSubCollection - class RimSummaryCaseCollection + SummaryCases + SummaryCollectionName + +SummaryCrossPlot - class RimSummaryCrossPlot + WindowController + ShowWindow + WindowGeometry + PlotDescription + ShowPlotTitle + ShowLegend + LegendFontSize + IsUsingAutoName + SummaryCurveFilters + SummaryCurveCollection + SummaryCurves + GridTimeHistoryCurves + AsciiDataCurves + LeftYAxisProperties + RightYAxisProperties + BottomAxisProperties + TimeAxisProperties + AutoZoom + +SummaryCrossPlotCollection - class RimSummaryCrossPlotCollection + SummaryCrossPlots + +SummaryCurve - class RimSummaryCurve + Show + CurveName + CurveDescription + AutoName + Color + Thickness + LineStyle + CurveInterpolation + PointSymbol + SymbolSkipPxDist + ShowLegend + SummaryCase + SelectedVariableDisplayVar + VarListFilter + FilterResultSelection + SummaryAddress + SelectAddress + SummaryCaseX + SelectedVariableDisplayVarX + VarListFilterX + FilterResultSelectionX + SummaryAddressX + SelectAddressX + PlotAxis + SummaryCurveNameConfig + +SummaryCurveAutoName - class RimSummaryCurveAutoName + VectorName + Unit + RegionNumber + WellGroupName + WellName + WellSegmentNumber + LgrName + Completion + Aquifer + CaseName + +SummaryCurveFilter - class RimSummaryCurveFilter_OBSOLETE + SummaryCases + VarListFilter + FilterResultSelection + FilteredCurves + ApplySelection + AutoApplyFilterChanges + IsActive + UseAutoAppearanceAssignment + CaseAppearanceType + VariableAppearanceType + WellAppearanceType + GroupAppearanceType + RegionAppearanceType + PlotAxis + ShowLegend + SummaryCurveNameConfig + +SummaryFilterSettings - class RimSummaryFilter + SummaryFilterType + SummaryCompleteVarStringFilter + SummaryVarQuantityFilter + SummaryRegionNumberFilter + SummaryRegionNumber2Filter + SummaryWellGroupNameFilter + SummaryWellNameFilter + SummaryWellSegmentNumberFilter + SummaryLgrNameFilter + SummaryCellIJKFilter + +SummaryObservedDataFile - class RimSummaryObservedDataFile + ShortName + AutoShortyName + SummaryHeaderFilename + ImportedSummaryData + UseCustomIdentifier + SummaryType + IdentifierName + +SummaryPageDownloadEntity - class SummaryPageDownloadEntity + Name + RequestUrl + ResponseFilename + +SummaryPlot - class RimSummaryPlot + WindowController + ShowWindow + WindowGeometry + PlotDescription + ShowPlotTitle + ShowLegend + LegendFontSize + IsUsingAutoName + SummaryCurveFilters + SummaryCurveCollection + SummaryCurves + GridTimeHistoryCurves + AsciiDataCurves + LeftYAxisProperties + RightYAxisProperties + BottomAxisProperties + TimeAxisProperties + AutoZoom + +SummaryPlotCollection - class RimSummaryPlotCollection + SummaryPlots + +SummaryTimeAxisProperties - class RimSummaryTimeAxisProperties + Active + ShowTitle + Title + TitlePosition + FontSize + ValuesFontSize + TimeMode + TimeUnit + VisibleRangeMax + VisibleRangeMin + VisibleTimeModeRangeMax + VisibleTimeModeRangeMin + +SummaryYAxisProperties - class RimSummaryAxisProperties + Active + Name + AutoTitle + DisplayLongName + DisplayShortName + DisplayUnitText + CustomTitle + TitlePosition + FontSize + VisibleRangeMax + VisibleRangeMin + NumberFormat + Decimals + ScaleFactor + ValuesFontSize + LogarithmicScale + +TC2 - class TC2 + ta + da + ia + +TestCommand1 - class TestCommand1 + TextArgument + DoubleArgument + IntArgument + +TofAccumulatedPhaseFractionsPlot - class RimTofAccumulatedPhaseFractionsPlot + WindowController + ShowWindow + WindowGeometry + PlotDescription + ShowPlotTitle + MaxTof + +TotalWellAllocationPlot - class RimTotalWellAllocationPlot + WindowController + ShowWindow + WindowGeometry + PlotDescription + ShowPlotTitle + +View3dOverlayInfoConfig - class Rim3dOverlayInfoConfig + Active + ShowAnimProgress + ShowInfoText + ShowResultInfo + ShowHistogram + ShowVolumeWeightedMean + StatisticsTimeRange + StatisticsCellRange + +ViewController - class RimViewController + Active + Name + ManagedView + SyncCamera + ShowCursor + SyncTimeStep + SyncCellResult + SyncLegendDefinitions + SyncVisibleCells + SyncRangeFilters + SyncPropertyFilters + +ViewLinker - class RimViewLinker + Name + MainView + ManagedViews + +Well - class RimSimWellInView + WellName + ShowWell + ShowWellLabel + ShowWellHead + ShowWellPipe + ShowWellSpheres + WellHeadScaleFactor + WellPipeRadiusScale + WellPipeColor + ShowWellCells + ShowWellCellFence + FractureCollection + +WellAllocationPlot - class RimWellAllocationPlot + WindowController + ShowWindow + WindowGeometry + PlotDescription + ShowPlotTitle + BranchDetection + CurveCase + PlotTimeStep + WellName + FlowDiagSolution + FlowType + GroupSmallContributions + SmallContributionsThreshold + AccumulatedWellFlowPlot + TotalWellFlowPlot + WellAllocLegend + TofAccumulatedPhaseFractionsPlot + +WellAllocationPlotLegend - class RimWellAllocationPlotLegend + ShowPlotLegend + +WellFlowRateCurve - class RimWellFlowRateCurve + Show + CurveName + CurveDescription + AutoName + Color + Thickness + LineStyle + CurveInterpolation + PointSymbol + SymbolSkipPxDist + ShowLegend + +WellLogFile - class RimWellLogFile + WellName + Date + FileName + Name + WellLogFileChannels + WellFlowCondition + InvalidDateMessage + +WellLogFileChannel - class RimWellLogFileChannel + Name + +WellLogFileCurve - class RimWellLogFileCurve + Show + CurveName + CurveDescription + AutoName + Color + Thickness + LineStyle + CurveInterpolation + PointSymbol + SymbolSkipPxDist + ShowLegend + CurveWellPath + CurveWellLogChannel + WellLogFile + +WellLogPlot - class RimWellLogPlot + WindowController + ShowWindow + WindowGeometry + PlotDescription + DepthType + DepthUnit + MinimumDepth + MaximumDepth + AutoScaleDepthEnabled + ShowTrackLegends + Tracks + +WellLogPlotCollection - class RimWellLogPlotCollection + WellLogPlots + +WellLogPlotTrack - class RimWellLogTrack + TrackDescription + Show + Curves + VisibleXRangeMin + VisibleXRangeMax + AutoScaleX + LogarithmicScaleX + ShowFormations + FormationSource + FormationTrajectoryType + FormationWellPath + FormationWellPathForSourceWellPath + FormationSimulationWellName + FormationBranchIndex + FormationBranchDetection + FormationCase + FormationLevel + ShowFormationFluids + +WellLogRftCurve - class RimWellLogRftCurve + Show + CurveName + CurveDescription + AutoName + Color + Thickness + LineStyle + CurveInterpolation + PointSymbol + SymbolSkipPxDist + ShowLegend + CurveEclipseResultCase + TimeStep + WellName + BranchIndex + BranchDetection + WellLogChannelName + +WellPath - class RimWellPath + WellPathName + WellPathId + SourceSystem + UTMZone + WellPathUpdateDate + WellPathUpdateUser + WellPathSurveyType + DatumElevation + UnitSystem + WellPathFilepath + WellPathNumberInFile + SimWellName + SimBranchIndex + ShowWellPathLabel + ShowWellPath + WellPathRadiusScale + WellPathColor + Completions + WellLogFiles + WellPathFormationKeyInFile + WellPathFormationFilePath + WellLogFile + +WellPathCompletion - class RimFishboneWellPath + Name + IsChecked + Coordinates + MeasuredDepth + DisplayCoordinates + +WellPathCompletionCollection - class RimFishboneWellPathCollection + Name + IsChecked + WellPaths + PipeProperties + +WellPathCompletions - class RimWellPathCompletions + Perforations + Fishbones + Fractures + WellNameForExport + +WellPathFracture - class RimWellPathFracture + Name + IsChecked + FractureDef + AnchorPosition + ui_positionAtWellpath + Azimuth + PerforationLength + PerforationEfficiency + WellDiameter + Dip + Tilt + FractureUnit + TimeIndexToPlot + WellPathAzimuth + WellFractureAzimuthDiff + WellFractureAzimithAngleWarning + MeasuredDepth + +WellPathFractureCollection - class RimWellPathFractureCollection + Name + IsChecked + Fractures + +WellPaths - class RimWellPathCollection + Active + ShowWellPathLabel + WellPathLabelColor + GlobalWellPathVisibility + WellPathRadiusScale + WellPathVertexCount + WellPathClip + WellPathClipZDistance + WellPaths + +WellPltPlot - class RimWellPltPlot + WindowController + ShowWindow + WindowGeometry + PlotDescription + ShowPlotTitle + WellLog + WellName + SourcesInternal + Sources + TimeSteps + UseStandardConditionCurves + UseReservoirConditionCurves + Phases + +WellPltPlotCollection - class RimPltPlotCollection + PltPlots + +WellRftPlot - class RimWellRftPlot + WindowController + ShowWindow + WindowGeometry + PlotDescription + ShowPlotTitle + WellLog + WellName + BranchIndex + BranchDetection + Sources + TimeSteps + +WellRftPlotCollection - class RimRftPlotCollection + RftPlots + +Wells - class RimSimWellInViewCollection + Active + ShowWellsIntersectingVisibleCells + ShowWellHeadTristate + ShowWellLabelTristate + ShowWellPipe + ShowWellSpheres + WellHeadScale + WellPipeRadiusScale + CellCenterSphereScale + WellLabelColor + ShowConnectionStatusColors + WellColorForApply + ApplySingleColorToWells + ApplyIndividualColorsToWells + WellPipeVertexCount + WellPipeCoordType + ShowWellCellsTristate + DefaultWellFenceDirection + WellCellTransparency + IsAutoDetectingBranches + WellHeadPosition + Wells + ShowWellCellFenceTristate + GlobalWellPipeVisibility + GlobalWellCellVisibility + ShowWellHead + ShowWellLabel + ShowWellFences + ShowWellCommunicationLines + +closeProject - class RicfCloseProject + +computeCaseGroupStatistics - class RicfComputeCaseGroupStatistics + caseIds + +exportMsw - class RicfExportMsw + caseId + wellPath + +exportMultiCaseSnapshots - class RicfExportMultiCaseSnapshots + gridListFile + +exportProperty - class RicfExportProperty + caseId + timeStep + property + type + eclipseKeyword + undefinedValue + exportFile + +exportSimWellCompletions - class RicfExportSimWellCompletions + case + timeStep + wellPathNames + wellSelection + fileSplit + compdatExport + +exportSnapshots - class RicfExportSnapshots + type + +exportWellPathCompletions - class RicfExportWellPathCompletions + caseId + timeStep + wellPathNames + wellSelection + fileSplit + compdatExport + includePerforations + includeFishbones + excludeMainBoreForFishbones + +loadCase - class RicfLoadCase + path + +openProject - class RicfOpenProject + path + +replaceCase - class RicfReplaceCase + caseId + newGridFile + +replaceSourceCases - class RicfReplaceSourceCases + caseGroupId + gridListFile + +runOctaveScript - class RicfRunOctaveScript + path + caseIds + +setExportFolder - class RicfSetExportFolder + type + path + +setMainWindowSize - class RicfSetMainWindowSize + height + width + +setStartDir - class RicfSetStartDir + path + +setTimeStep - class RicfSetTimeStep + caseId + timeStep + diff --git a/ApplicationCode/Adm/projectfilekeywords/2018.01/ri-objectKeywords.txt b/ApplicationCode/Adm/projectfilekeywords/2018.01/ri-objectKeywords.txt new file mode 100644 index 0000000000..367c35bad8 --- /dev/null +++ b/ApplicationCode/Adm/projectfilekeywords/2018.01/ri-objectKeywords.txt @@ -0,0 +1,188 @@ +// ResInsight version string : 2018.01.00-dev.01 +// Report generated : Fri 5. Jan 15:39:23 2018 +// +// + +AsciiDataCurve +CalcScript +CalculatedSummaryCase +CellEdgeResultSlot +CellFilter +CellPropertyFilter +CellPropertyFilters +CellRangeFilter +CellRangeFilterCollection +ChangeDataSourceFeatureUi +CmdAddItemExecData +CmdDeleteItemExecData +CmdFieldChangeExecData +CrossSection +CrossSectionCollection +EclipseCase +EclipseGeometrySelectionItem +Fault +Faults +FileSummaryCase +FishbonesCollection +FishbonesMultipleSubs +FishbonesPipeProperties +FlowCharacteristicsPlot +FlowDiagSolution +FlowPlotCollection +FormationNames +FormationNamesCollectionObject +FractureContainment +FractureDefinitionCollection +GeoMechGeometrySelectionItem +GeoMechPropertyFilter +GeoMechPropertyFilters +GeoMechResultDefinition +GeoMechResultSlot +GeoMechView +GridCollection +GridSummaryCase +GridTimeHistoryCurve +IntersectionBox +Legend +MainPlotCollection +MdiWindowController +MockModelSettings +MultiSnapshotDefinition +NoCommonAreaNNC +ObservedDataCollection +PdmDocument +PdmObjectCollection +PdmObjectGroup +Perforation +PerforationCollection +PropertyFilter +ResInsightAnalysisModels +ResInsightGeoMechCase +ResInsightGeoMechModels +ResInsightOilField +ResInsightProject +ReservoirCellResultStorage +ReservoirView +ResultDefinition +ResultSlot +ResultStorageEntryInfo +RftAddress +RiaPreferences +RiaRegressionTest +RicCaseAndFileExportSettingsUi +RicCellRangeUi +RicDeleteItemExecData +RicExportCarfinUi +RicExportCompletionDataSettingsUi +RicExportToLasFileObj +RicExportToLasFileResampleUi +RicLinkVisibleViewsFeatureUi +RicPasteAsciiDataToSummaryPlotFeatureUi +RicSaveEclipseInputVisibleCellsUi +RicSelectSummaryPlotUI +RicSelectViewUI +RicSummaryAddressSelection +RicSummaryCurveCalculator +RicSummaryCurveCreator +RicWellPathsUnitSystemSettingsUi +RifReaderSettings +RimBinaryExportSettings +RimCaseCollection +RimCommandExecuteScript +RimCommandIssueFieldChanged +RimCommandObject +RimCsvUserData +RimDialogData +RimEllipseFractureTemplate +RimExportInputSettings +RimFaultResultSlot +RimFractureExportSettings +RimIdenticalGridCaseGroup +RimInputProperty +RimInputPropertyCollection +RimInputReservoir +RimNoCommonAreaNncCollection +RimObservedEclipseUserData +RimOilFieldEntry +RimOilRegionEntry +RimStatisticalCalculation +RimStatisticalCollection +RimStimPlanColors +RimStimPlanFractureTemplate +RimStimPlanLegendConfig +RimSummaryCalculation +RimSummaryCalculationCollection +RimSummaryCalculationVariable +RimSummaryCurveCollection +RimSummaryCurveCollectionModifier +RimTernaryLegendConfig +RimTimeStepFilter +RimViewLinkerCollection +RimWellLogExtractionCurve +RimWellPathEntry +RimWellPathImport +ScriptLocation +SimWellFracture +SimWellFractureCollection +SummaryAddress +SummaryCaseCollection +SummaryCaseSubCollection +SummaryCrossPlot +SummaryCrossPlotCollection +SummaryCurve +SummaryCurveAutoName +SummaryCurveFilter +SummaryFilterSettings +SummaryObservedDataFile +SummaryPageDownloadEntity +SummaryPlot +SummaryPlotCollection +SummaryTimeAxisProperties +SummaryYAxisProperties +TC2 +TestCommand1 +TofAccumulatedPhaseFractionsPlot +TotalWellAllocationPlot +View3dOverlayInfoConfig +ViewController +ViewLinker +Well +WellAllocationPlot +WellAllocationPlotLegend +WellFlowRateCurve +WellLogFile +WellLogFileChannel +WellLogFileCurve +WellLogPlot +WellLogPlotCollection +WellLogPlotTrack +WellLogRftCurve +WellPath +WellPathCompletion +WellPathCompletionCollection +WellPathCompletions +WellPathFracture +WellPathFractureCollection +WellPaths +WellPltPlot +WellPltPlotCollection +WellRftPlot +WellRftPlotCollection +Wells +closeProject +computeCaseGroupStatistics +exportMsw +exportMultiCaseSnapshots +exportProperty +exportSimWellCompletions +exportSnapshots +exportWellPathCompletions +loadCase +openProject +replaceCase +replaceSourceCases +runOctaveScript +setExportFolder +setMainWindowSize +setStartDir +setTimeStep From a40a3578f20b2775b9bea0c29980f935f071baca Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 8 Jan 2018 10:35:53 +0100 Subject: [PATCH 03/78] #2329 Add relocate of well path formation file --- ApplicationCode/ProjectDataModel/RimWellPath.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ApplicationCode/ProjectDataModel/RimWellPath.cpp b/ApplicationCode/ProjectDataModel/RimWellPath.cpp index 712e520eb8..6c703b76b2 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPath.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellPath.cpp @@ -621,6 +621,18 @@ void RimWellPath::updateFilePathsFromProjectPath(const QString& newProjectPath, { filepath = RimTools::relocateFile(filepath(), newProjectPath, oldProjectPath, nullptr, nullptr); } + + { + bool foundFile = false; + std::vector searchedPaths; + + QString fileNameCandidate = RimTools::relocateFile(m_wellPathFormationFilePath, newProjectPath, oldProjectPath, &foundFile, &searchedPaths); + if (foundFile) + { + m_wellPathFormationFilePath = fileNameCandidate; + } + } + } //-------------------------------------------------------------------------------------------------- From 561e20a37ea6935fa4bcefd27a3688f96ac1daf9 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 8 Jan 2018 10:37:57 +0100 Subject: [PATCH 04/78] #2329 Add relocate of RimWellLogFile --- ApplicationCode/ProjectDataModel/RimProject.cpp | 16 +++++++++++++--- .../ProjectDataModel/RimWellLogFile.cpp | 15 +++++++++++++++ .../ProjectDataModel/RimWellLogFile.h | 2 ++ 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimProject.cpp b/ApplicationCode/ProjectDataModel/RimProject.cpp index 35e9f9275e..079d06c6ac 100644 --- a/ApplicationCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationCode/ProjectDataModel/RimProject.cpp @@ -52,6 +52,8 @@ #include "RimMultiSnapshotDefinition.h" #include "RimObservedDataCollection.h" #include "RimOilField.h" +#include "RimPltPlotCollection.h" +#include "RimRftPlotCollection.h" #include "RimScriptCollection.h" #include "RimSummaryCaseMainCollection.h" #include "RimSummaryCrossPlotCollection.h" @@ -59,12 +61,11 @@ #include "RimView.h" #include "RimViewLinker.h" #include "RimViewLinkerCollection.h" +#include "RimWellLogFile.h" #include "RimWellLogPlotCollection.h" -#include "RimRftPlotCollection.h" -#include "RimPltPlotCollection.h" +#include "RimWellPath.h" #include "RimWellPathCollection.h" #include "RimWellPathImport.h" -#include "RimWellPath.h" #include "RiuMainWindow.h" #include "RiuMainPlotWindow.h" @@ -470,6 +471,15 @@ void RimProject::setProjectFileNameAndUpdateDependencies(const QString& fileName #endif // USE_PROTOTYPE_FEATURE_FRACTURES } + { + std::vector rimWellLogFiles; + this->descendantsIncludingThisOfType(rimWellLogFiles); + + for (auto rimWellLogFile : rimWellLogFiles) + { + rimWellLogFile->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath); + } + } wellPathImport->updateFilePaths(); } diff --git a/ApplicationCode/ProjectDataModel/RimWellLogFile.cpp b/ApplicationCode/ProjectDataModel/RimWellLogFile.cpp index 9750eb7745..5dcb6f5049 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogFile.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogFile.cpp @@ -243,6 +243,21 @@ bool RimWellLogFile::hasFlowData() const return RimWellPlotTools::hasFlowData(this); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogFile::updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath) +{ + bool foundFile = false; + std::vector searchedPaths; + + QString fileNameCandidate = RimTools::relocateFile(m_fileName(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths); + if (foundFile) + { + m_fileName = fileNameCandidate; + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimWellLogFile.h b/ApplicationCode/ProjectDataModel/RimWellLogFile.h index 160c3c6fa8..819a0b8797 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogFile.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogFile.h @@ -72,6 +72,8 @@ class RimWellLogFile : public caf::PdmObject RimWellLogFile::WellFlowCondition wellFlowRateCondition() const { return m_wellFlowCondition(); } + void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath); + private: virtual void setupBeforeSave() override; virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; From a26f3b6907f837f92d61fb26f61e889e4efa713f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 8 Jan 2018 11:46:51 +0100 Subject: [PATCH 05/78] #2340 Snapshot : Space in path is replaced with underscore --- .../ExportCommands/RicExportMultipleSnapshotsFeature.cpp | 5 +++-- .../ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ApplicationCode/Commands/ExportCommands/RicExportMultipleSnapshotsFeature.cpp b/ApplicationCode/Commands/ExportCommands/RicExportMultipleSnapshotsFeature.cpp index ff579259d6..f035c88abc 100644 --- a/ApplicationCode/Commands/ExportCommands/RicExportMultipleSnapshotsFeature.cpp +++ b/ApplicationCode/Commands/ExportCommands/RicExportMultipleSnapshotsFeature.cpp @@ -238,8 +238,9 @@ void RicExportMultipleSnapshotsFeature::exportViewVariationsToFolder(RimView* ri if (msd->sliceDirection == RimMultiSnapshotDefinition::NO_RANGEFILTER) { QString fileName = viewCaseResultString + "_" + timeStepString; + fileName.replace(" ", "_"); + QString absoluteFileName = caf::Utils::constructFullFileName(folder, fileName, ".png"); - absoluteFileName.replace(" ", "_"); RicSnapshotViewToFileFeature::saveSnapshotAs(absoluteFileName, rimView); } @@ -274,9 +275,9 @@ void RicExportMultipleSnapshotsFeature::exportViewVariationsToFolder(RimView* ri } rimView->rangeFilterCollection()->updateDisplayModeNotifyManagedViews(rangeFilter); + fileName.replace(" ", "_"); QString absoluteFileName = caf::Utils::constructFullFileName(folder, fileName, ".png"); - absoluteFileName.replace(" ", "_"); RicSnapshotViewToFileFeature::saveSnapshotAs(absoluteFileName, rimView); } diff --git a/ApplicationCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp b/ApplicationCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp index 48724e965b..b91b150254 100644 --- a/ApplicationCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp +++ b/ApplicationCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp @@ -92,9 +92,9 @@ void RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder(QStrin if (viewWindow->isMdiWindow() && viewWindow->viewWidget()) { QString fileName = RicSnapshotFilenameGenerator::generateSnapshotFileName(viewWindow); + fileName.replace(" ", "_"); QString absoluteFileName = caf::Utils::constructFullFileName(absSnapshotPath, fileName, ".png"); - absoluteFileName.replace(" ", "_"); RicSnapshotViewToFileFeature::saveSnapshotAs(absoluteFileName, viewWindow); } From 69a18e1a1123c142bb9753fcdcb17a6b920ac09e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Mon, 8 Jan 2018 14:03:27 +0100 Subject: [PATCH 06/78] #2329. Relocate summary cases --- ApplicationCode/ProjectDataModel/RimProject.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ApplicationCode/ProjectDataModel/RimProject.cpp b/ApplicationCode/ProjectDataModel/RimProject.cpp index 079d06c6ac..4f435d01d1 100644 --- a/ApplicationCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationCode/ProjectDataModel/RimProject.cpp @@ -449,6 +449,11 @@ void RimProject::setProjectFileNameAndUpdateDependencies(const QString& fileName cases[i]->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath); } + for (RimSummaryCase* summaryCase : allSummaryCases()) + { + summaryCase->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath); + } + // Update path to well path file cache for(RimOilField* oilField: oilFields) { From cd4b930d7748e62d9e2c7b1d93bd14215325cfe3 Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Mon, 8 Jan 2018 16:34:41 +0100 Subject: [PATCH 07/78] #2352 Geomech: Geo mech: Fix crash when choosing invalid Result Variable --- .../GeoMechDataModel/RigFemPartResultsCollection.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp index 6ee750394b..45a5088a6f 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp @@ -1369,10 +1369,18 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateDerivedResult(in if(resVarAddr.resultPosType == RIG_ELEMENT_NODAL_FACE ) { - if (resVarAddr.componentName == "Pazi" || resVarAddr.componentName == "Pinc" ) + if (resVarAddr.componentName == "Pazi" || resVarAddr.componentName == "Pinc") + { return calculateSurfaceAngles(partIndex, resVarAddr); - else + } + else if (resVarAddr.componentName.empty()) + { + return nullptr; + } + else + { return calculateSurfaceAlignedStress(partIndex, resVarAddr); + } } if (resVarAddr.fieldName == "SE" && resVarAddr.componentName == "SFI") From 09d776dd7389211b795cedf64b2cefcb653b8cc3 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 9 Jan 2018 09:16:06 +0100 Subject: [PATCH 08/78] #2353 Empty function caseName() shadows base class field with same signature --- ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp | 2 -- ApplicationCode/ProjectDataModel/RimEclipseResultCase.h | 5 ----- ApplicationCode/ProjectDataModel/RimWellLogRftCurve.cpp | 2 +- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp index 6f4a067b95..7ae7a860d9 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp @@ -92,8 +92,6 @@ RimEclipseResultCase::RimEclipseResultCase() m_activeCellInfoIsReadFromFile = false; m_gridAndWellDataIsReadFromFile = false; - - m_caseName = ""; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.h b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.h index 054c01485a..ef6aa46d7f 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.h @@ -65,8 +65,6 @@ class RimEclipseResultCase : public RimEclipseCase RifReaderEclipseRft* rftReader(); - QString caseName() const { return m_caseName; } - protected: virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute); @@ -90,12 +88,9 @@ class RimEclipseResultCase : public RimEclipseCase caf::PdmChildArrayField m_flowDiagSolutions; caf::PdmField m_sourSimFileName; - QString m_caseName; - // Obsolete field caf::PdmField caseDirectory; bool m_gridAndWellDataIsReadFromFile; bool m_activeCellInfoIsReadFromFile; - }; diff --git a/ApplicationCode/ProjectDataModel/RimWellLogRftCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogRftCurve.cpp index f29d395352..b583f9e4ab 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogRftCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogRftCurve.cpp @@ -258,7 +258,7 @@ QString RimWellLogRftCurve::createCurveAutoName() if (m_eclipseResultCase) { - name.push_back(m_eclipseResultCase->caseName()); + name.push_back(m_eclipseResultCase->caseUserDescription()); } if (wellLogChannelName() != caf::AppEnum::text(RifEclipseRftAddress::NONE)) { From 472aa8726585b0549409326c1f50abf9a4ce2845 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 9 Jan 2018 09:57:54 +0100 Subject: [PATCH 09/78] System : Postfix with _OBSOLETE --- ApplicationCode/ProjectDataModel/RimEclipseCase.cpp | 10 +++++----- ApplicationCode/ProjectDataModel/RimEclipseCase.h | 2 +- .../ProjectDataModel/RimEclipseResultCase.cpp | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp index d5a68c1d81..54cf89d46e 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp @@ -91,9 +91,9 @@ RimEclipseCase::RimEclipseCase() m_filesContainingFaults_OBSOLETE.xmlCapability()->setIOWritable(false); m_filesContainingFaults_OBSOLETE.uiCapability()->setUiHidden(true); - CAF_PDM_InitField(&caseName, "CaseName", QString(), "Obsolete", "", "" ,""); - caseName.xmlCapability()->setIOWritable(false); - caseName.uiCapability()->setUiHidden(true); + CAF_PDM_InitField(&m_caseName_OBSOLETE, "CaseName", QString(), "Obsolete", "", "" ,""); + m_caseName_OBSOLETE.xmlCapability()->setIOWritable(false); + m_caseName_OBSOLETE.uiCapability()->setUiHidden(true); // Init @@ -210,9 +210,9 @@ void RimEclipseCase::initAfterRead() riv->setEclipseCase(this); } - if (caseUserDescription().isEmpty() && !caseName().isEmpty()) + if (caseUserDescription().isEmpty() && !m_caseName_OBSOLETE().isEmpty()) { - caseUserDescription = caseName; + caseUserDescription = m_caseName_OBSOLETE; } } diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCase.h b/ApplicationCode/ProjectDataModel/RimEclipseCase.h index 5e8710df62..8731b2b62c 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCase.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseCase.h @@ -135,7 +135,7 @@ class RimEclipseCase : public RimCase // Obsolete fields protected: - caf::PdmField caseName; + caf::PdmField m_caseName_OBSOLETE; private: caf::PdmField > m_filesContainingFaults_OBSOLETE; diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp index 7ae7a860d9..cebd388f37 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp @@ -572,9 +572,9 @@ void RimEclipseResultCase::initAfterRead() // Convert from old (9.0.2) way of storing the case file if (caseFileName().isEmpty()) { - if (!this->caseName().isEmpty() && !caseDirectory().isEmpty()) + if (!this->m_caseName_OBSOLETE().isEmpty() && !caseDirectory().isEmpty()) { - caseFileName = QDir::fromNativeSeparators(caseDirectory()) + "/" + caseName() + ".EGRID"; + caseFileName = QDir::fromNativeSeparators(caseDirectory()) + "/" + m_caseName_OBSOLETE() + ".EGRID"; } } } From 67bc555d49c5610ecf1ed6f43e1cdfe7787bfc75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Fri, 12 Jan 2018 11:36:12 +0100 Subject: [PATCH 10/78] #2367 Fix crash in completion type calculation for wellpaths without geometry --- .../Completions/RimCompletionCellIntersectionCalc.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/Completions/RimCompletionCellIntersectionCalc.cpp b/ApplicationCode/ProjectDataModel/Completions/RimCompletionCellIntersectionCalc.cpp index 9874da25c7..d2cc18dae8 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimCompletionCellIntersectionCalc.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimCompletionCellIntersectionCalc.cpp @@ -92,9 +92,13 @@ void RimCompletionCellIntersectionCalc::calculateWellPathIntersections(const Rim std::vector& values, const QDateTime& fromDate) { - std::vector intersections = RigWellPathIntersectionTools::findRawHexCellIntersections(grid, - wellPath->wellPathGeometry()->m_wellPathPoints); - + std::vector intersections; + if (wellPath->wellPathGeometry()) + { + intersections = RigWellPathIntersectionTools::findRawHexCellIntersections(grid, + wellPath->wellPathGeometry()->m_wellPathPoints); + } + for (auto& intersection : intersections) { values[intersection.m_hexIndex] = RiaDefines::WELL_PATH; From 28ea6f054cc942e7e44173226403c893205d80ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Thu, 18 Jan 2018 13:24:04 +0100 Subject: [PATCH 11/78] #2377 summary plot. Add missing curve update --- .../Commands/FlowCommands/RicPlotProductionRateFeature.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ApplicationCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp b/ApplicationCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp index d6b19ae5fb..c25232e52e 100644 --- a/ApplicationCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp +++ b/ApplicationCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp @@ -295,6 +295,7 @@ RimSummaryCurve* RicPlotProductionRateFeature::addSummaryCurve( RimSummaryPlot* newCurve->setSummaryAddressY(addr); newCurve->setColor(color); newCurve->setLeftOrRightAxisY(plotAxis); + newCurve->loadDataAndUpdate(true); return newCurve; } From 79539c1c99db7c6b10cb0ed42a9e4c63468a37b2 Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Thu, 18 Jan 2018 15:04:04 +0100 Subject: [PATCH 12/78] #2378 Fractures: Hide "Fracture Colors" in Project tree when not in use --- ApplicationCode/Commands/RicDeleteItemExec.cpp | 11 +++++++++++ .../RicNewEllipseFractureTemplateFeature.cpp | 13 +++++++++++++ .../RicNewStimPlanFractureTemplateFeature.cpp | 15 ++++++++++++++- .../ProjectDataModel/RimEclipseView.cpp | 14 +++++++++++++- 4 files changed, 51 insertions(+), 2 deletions(-) diff --git a/ApplicationCode/Commands/RicDeleteItemExec.cpp b/ApplicationCode/Commands/RicDeleteItemExec.cpp index 05d3c6a472..1aab715e05 100644 --- a/ApplicationCode/Commands/RicDeleteItemExec.cpp +++ b/ApplicationCode/Commands/RicDeleteItemExec.cpp @@ -26,6 +26,7 @@ #include "RimCase.h" #include "RimCellRangeFilterCollection.h" #include "RimEclipsePropertyFilterCollection.h" +#include "RimEclipseView.h" #include "RimFormationNamesCollection.h" #include "RimGeoMechPropertyFilterCollection.h" #include "RimIntersectionCollection.h" @@ -150,6 +151,16 @@ void RicDeleteItemExec::redo() { proj->createDisplayModelAndRedrawAllViews(); } + + std::vector views; + proj->allVisibleViews(views); + for (RimView* view : views) + { + if (dynamic_cast(view)) + { + view->updateConnectedEditors(); + } + } } #endif // USE_PROTOTYPE_FEATURE_FRACTURES diff --git a/ApplicationCode/Commands/RicNewEllipseFractureTemplateFeature.cpp b/ApplicationCode/Commands/RicNewEllipseFractureTemplateFeature.cpp index 094c4c1039..39d82aea1a 100644 --- a/ApplicationCode/Commands/RicNewEllipseFractureTemplateFeature.cpp +++ b/ApplicationCode/Commands/RicNewEllipseFractureTemplateFeature.cpp @@ -21,6 +21,7 @@ #include "RiaApplication.h" #include "RimOilField.h" +#include "RimEclipseView.h" #include "RimEllipseFractureTemplate.h" #include "RimFractureTemplateCollection.h" #include "RimProject.h" @@ -58,6 +59,18 @@ void RicNewEllipseFractureTemplateFeature::onActionTriggered(bool isChecked) fractureDef->setDefaultWellDiameterFromUnit(); fracDefColl->updateConnectedEditors(); + + std::vector views; + project->allVisibleViews(views); + + for (RimView* view : views) + { + if (dynamic_cast(view)) + { + view->updateConnectedEditors(); + } + } + RiuMainWindow::instance()->selectAsCurrentItem(fractureDef); } } diff --git a/ApplicationCode/Commands/RicNewStimPlanFractureTemplateFeature.cpp b/ApplicationCode/Commands/RicNewStimPlanFractureTemplateFeature.cpp index 440ce22623..c0f7114a60 100644 --- a/ApplicationCode/Commands/RicNewStimPlanFractureTemplateFeature.cpp +++ b/ApplicationCode/Commands/RicNewStimPlanFractureTemplateFeature.cpp @@ -21,6 +21,7 @@ #include "RiaApplication.h" #include "RimOilField.h" +#include "RimEclipseView.h" #include "RimFractureTemplateCollection.h" #include "RimProject.h" #include "RimStimPlanFractureTemplate.h" @@ -44,7 +45,7 @@ void RicNewStimPlanFractureTemplateFeature::onActionTriggered(bool isChecked) { RiaApplication* app = RiaApplication::instance(); QString defaultDir = app->lastUsedDialogDirectory("BINARY_GRID"); - QString fileName = QFileDialog::getOpenFileName(NULL, "Open StimPlan XML File", defaultDir, "StimPlan XML File (*.xml);;All files(*.*)"); + QString fileName = QFileDialog::getOpenFileName(nullptr, "Open StimPlan XML File", defaultDir, "StimPlan XML File (*.xml);;All files(*.*)"); if (fileName.isEmpty()) return; @@ -67,6 +68,18 @@ void RicNewStimPlanFractureTemplateFeature::onActionTriggered(bool isChecked) fractureDef->setDefaultWellDiameterFromUnit(); fracDefColl->updateConnectedEditors(); + + std::vector views; + project->allVisibleViews(views); + + for (RimView* view : views) + { + if (dynamic_cast(view)) + { + view->updateConnectedEditors(); + } + } + RiuMainWindow::instance()->selectAsCurrentItem(fractureDef); } } diff --git a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp index c2d86ec21b..10967ed631 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp @@ -71,6 +71,7 @@ #ifdef USE_PROTOTYPE_FEATURE_FRACTURES #include "RimFracture.h" +#include "RimFractureTemplateCollection.h" #include "RimSimWellFracture.h" #include "RivWellFracturePartMgr.h" #endif // USE_PROTOTYPE_FEATURE_FRACTURES @@ -1469,7 +1470,18 @@ void RimEclipseView::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering uiTreeOrdering.add(cellEdgeResult()); uiTreeOrdering.add(faultResultSettings()); #ifdef USE_PROTOTYPE_FEATURE_FRACTURES - uiTreeOrdering.add(stimPlanColors()); + + RimProject* project = RiaApplication::instance()->project(); + CVF_ASSERT(project); + RimOilField* oilfield = project->activeOilField(); + + if (oilfield && oilfield->fractureDefinitionCollection().notNull()) + { + if (!oilfield->fractureDefinitionCollection()->fractureDefinitions.empty()) + { + uiTreeOrdering.add(stimPlanColors()); + } + } #endif // USE_PROTOTYPE_FEATURE_FRACTURES uiTreeOrdering.add(wellCollection()); From 6adcbd9c5689637adb0367de778bf073487aa786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Fri, 19 Jan 2018 12:46:53 +0100 Subject: [PATCH 13/78] #2375 Fix missing catch of exceptions from opm-flowdiagnostics libraries --- .../RigFlowDiagSolverInterface.cpp | 52 ++++++++++--------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp b/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp index 4efc3dd41c..fc4a99224c 100644 --- a/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp +++ b/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp @@ -237,6 +237,7 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI caf::ProgressInfo progressInfo(8, "Calculating Flow Diagnostics"); + try { progressInfo.setProgressDescription("Grid access"); @@ -294,6 +295,11 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI } } } + catch ( const std::exception& e ) + { + QMessageBox::critical(nullptr, "ResInsight", "Flow Diagnostics Exception: " + QString(e.what())); + return result; + } progressInfo.setProgress(3); progressInfo.setProgressDescription("Assigning Flux Field"); @@ -328,6 +334,7 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI // Set up flow Toolbox with timestep data std::map WellInFluxPrCell; + try { if (m_eclipseCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->hasFlowDiagUsableFluxes()) { @@ -338,12 +345,12 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI } else { - Opm::ECLInitFileData init(getInitFileName()); - Opm::FlowDiagnostics::ConnectionValues connectionVals = RigFlowDiagInterfaceTools::calculateFluxField((*m_opmFlowDiagStaticData->m_eclGraph), - init, - *currentRestartData, - phaseSelection); - m_opmFlowDiagStaticData->m_fldToolbox->assignConnectionFlux(connectionVals); + Opm::ECLInitFileData init(getInitFileName()); + Opm::FlowDiagnostics::ConnectionValues connectionVals = RigFlowDiagInterfaceTools::calculateFluxField((*m_opmFlowDiagStaticData->m_eclGraph), + init, + *currentRestartData, + phaseSelection); + m_opmFlowDiagStaticData->m_fldToolbox->assignConnectionFlux(connectionVals); } @@ -360,10 +367,16 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI m_opmFlowDiagStaticData->m_fldToolbox->assignInflowFlux(WellInFluxPrCell); } + catch ( const std::exception& e ) + { + QMessageBox::critical(nullptr, "ResInsight", "Flow Diagnostics Exception: " + QString(e.what())); + return result; + } progressInfo.incrementProgress(); progressInfo.setProgressDescription("Injector Solution"); + try { // Injection Solution std::set injectorCrossFlowTracers; @@ -380,16 +393,8 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI } injectorCellSets.push_back(CellSet(CellSetID(tracerName), tIt.second)); } - - try - { - injectorSolution.reset(new Toolbox::Forward(m_opmFlowDiagStaticData->m_fldToolbox->computeInjectionDiagnostics(injectorCellSets))); - } - catch ( const std::exception& e ) - { - QMessageBox::critical(nullptr, "ResInsight", "Flow Diagnostics: " + QString(e.what())); - return result; - } + + injectorSolution.reset(new Toolbox::Forward(m_opmFlowDiagStaticData->m_fldToolbox->computeInjectionDiagnostics(injectorCellSets))); for ( const CellSetID& tracerId: injectorSolution->fd.startPoints() ) { @@ -422,15 +427,7 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI prodjCellSets.push_back(CellSet(CellSetID(tracerName), tIt.second)); } - try - { - producerSolution.reset(new Toolbox::Reverse(m_opmFlowDiagStaticData->m_fldToolbox->computeProductionDiagnostics(prodjCellSets))); - } - catch ( const std::exception& e ) - { - QMessageBox::critical(nullptr, "ResInsight", "Flow Diagnostics: " + QString(e.what())); - return result; - } + producerSolution.reset(new Toolbox::Reverse(m_opmFlowDiagStaticData->m_fldToolbox->computeProductionDiagnostics(prodjCellSets))); for ( const CellSetID& tracerId: producerSolution->fd.startPoints() ) { @@ -490,6 +487,11 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI } } } + catch ( const std::exception& e ) + { + QMessageBox::critical(nullptr, "ResInsight", "Flow Diagnostics Exception: " + QString(e.what())); + return result; + } return result; // Relying on implicit move constructor } From 5855e412e741342e0cedabf173686aa039b20cbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Fri, 19 Jan 2018 15:21:17 +0100 Subject: [PATCH 14/78] #2375 Fix missing catch of exeptions from pvt/relperm curve generation --- .../RigFlowDiagSolverInterface.cpp | 62 ++++++++++++++++++- .../RigFlowDiagSolverInterface.h | 7 +++ 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp b/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp index fc4a99224c..a0d684c36e 100644 --- a/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp +++ b/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp @@ -185,7 +185,9 @@ class RigOpmFlowDiagStaticData : public cvf::Object /// //-------------------------------------------------------------------------------------------------- RigFlowDiagSolverInterface::RigFlowDiagSolverInterface(RimEclipseResultCase * eclipseCase) -: m_eclipseCase(eclipseCase) + : m_eclipseCase(eclipseCase), + m_pvtCurveErrorCount(0), + m_relpermCurveErrorCount(0) { } @@ -561,6 +563,30 @@ void RigFlowDiagSolverInterface::assignPhaseCorrecedPORV(RigFlowDiagResultAddres } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigFlowDiagSolverInterface::reportRelPermCurveError(const QString& message) +{ + if (m_relpermCurveErrorCount == 0) + { + QMessageBox::critical(nullptr, "ResInsight", "RelPerm curve problems: \n" + message); + } + m_relpermCurveErrorCount++; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigFlowDiagSolverInterface::reportPvtCurveError(const QString& message) +{ + if (m_pvtCurveErrorCount == 0) + { + QMessageBox::critical(nullptr, "ResInsight", "PVT curve problems: \n" + message); + } + m_pvtCurveErrorCount++; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -636,6 +662,8 @@ std::vector RigFlowDiagSolverInterface curveIdentNameArr.push_back(std::make_pair(RelPermCurve::PCOG, "PCOG")); satFuncRequests.push_back(pcgo); curveIdentNameArr.push_back(std::make_pair(RelPermCurve::PCOW, "PCOW")); satFuncRequests.push_back(pcow); + try { + // Calculate and return curves both with and without endpoint scaling and tag them accordingly // Must use two calls to achieve this const std::array epsModeArr = { RelPermCurve::EPS_ON , RelPermCurve::EPS_OFF }; @@ -657,6 +685,13 @@ std::vector RigFlowDiagSolverInterface } } + } + catch ( const std::exception& e ) + { + reportRelPermCurveError( QString(e.what())); + return retCurveArr; + } + return retCurveArr; } @@ -667,6 +702,8 @@ std::vector RigFlowDiagSolverInterface::ca { std::vector retCurveArr; + try { + if (!ensureStaticDataObjectInstanceCreated()) { return retCurveArr; @@ -734,6 +771,13 @@ std::vector RigFlowDiagSolverInterface::ca } } + } + catch ( const std::exception& e ) + { + reportPvtCurveError( QString(e.what())); + return retCurveArr; + } + return retCurveArr; } @@ -756,6 +800,7 @@ bool RigFlowDiagSolverInterface::calculatePvtDynamicPropertiesFvf(size_t activeC return false; } + try { // Bo { std::vector phasePress = { pressure }; @@ -778,6 +823,13 @@ bool RigFlowDiagSolverInterface::calculatePvtDynamicPropertiesFvf(size_t activeC } } + } + catch ( const std::exception& e ) + { + reportPvtCurveError( QString(e.what())); + return false; + } + return true; } @@ -800,6 +852,7 @@ bool RigFlowDiagSolverInterface::calculatePvtDynamicPropertiesViscosity(size_t a return false; } + try { // mu_o { std::vector phasePress = { pressure }; @@ -822,6 +875,13 @@ bool RigFlowDiagSolverInterface::calculatePvtDynamicPropertiesViscosity(size_t a } } + } + catch ( const std::exception& e ) + { + reportPvtCurveError( QString(e.what())); + return false; + } + return true; } diff --git a/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.h b/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.h index d580faa31e..49f94be389 100644 --- a/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.h +++ b/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.h @@ -129,9 +129,16 @@ class RigFlowDiagSolverInterface : public cvf::Object bool ensureStaticDataObjectInstanceCreated(); void assignPhaseCorrecedPORV(RigFlowDiagResultAddress::PhaseSelection phaseSelection, size_t timeStepIdx); + void reportRelPermCurveError(const QString &message); + void reportPvtCurveError(const QString &message); RimEclipseResultCase * m_eclipseCase; cvf::ref m_opmFlowDiagStaticData; + + + int m_pvtCurveErrorCount; + int m_relpermCurveErrorCount; + }; From 7dbd6c102730a2146539d9ffe590bc2ed677171c Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 23 Jan 2018 07:28:32 +0100 Subject: [PATCH 15/78] #2398 Fracture : Hide "New Fracture" in context menu when no Fracture Template is defined --- .../Commands/RicNewSimWellFractureAtPosFeature.cpp | 6 ++++++ ApplicationCode/Commands/RicNewSimWellFractureFeature.cpp | 6 ++++++ .../Commands/RicNewWellPathFractureAtPosFeature.cpp | 8 ++++++++ .../Commands/RicNewWellPathFractureFeature.cpp | 6 ++++++ 4 files changed, 26 insertions(+) diff --git a/ApplicationCode/Commands/RicNewSimWellFractureAtPosFeature.cpp b/ApplicationCode/Commands/RicNewSimWellFractureAtPosFeature.cpp index b2f00babc1..17549893e5 100644 --- a/ApplicationCode/Commands/RicNewSimWellFractureAtPosFeature.cpp +++ b/ApplicationCode/Commands/RicNewSimWellFractureAtPosFeature.cpp @@ -49,6 +49,9 @@ CAF_CMD_SOURCE_INIT(RicNewSimWellFractureAtPosFeature, "RicNewSimWellFractureAtP //-------------------------------------------------------------------------------------------------- void RicNewSimWellFractureAtPosFeature::onActionTriggered(bool isChecked) { + RimProject* proj = RiaApplication::instance()->project(); + if (proj->allFractureTemplates().empty()) return; + RimView* activeView = RiaApplication::instance()->activeReservoirView(); if (!activeView) return; @@ -120,6 +123,9 @@ void RicNewSimWellFractureAtPosFeature::setupActionLook(QAction* actionToSetup) //-------------------------------------------------------------------------------------------------- bool RicNewSimWellFractureAtPosFeature::isCommandEnabled() { + RimProject* proj = RiaApplication::instance()->project(); + if (proj->allFractureTemplates().empty()) return false; + caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem(); if (!pdmUiItem) return false; diff --git a/ApplicationCode/Commands/RicNewSimWellFractureFeature.cpp b/ApplicationCode/Commands/RicNewSimWellFractureFeature.cpp index 06baffd42b..789d212924 100644 --- a/ApplicationCode/Commands/RicNewSimWellFractureFeature.cpp +++ b/ApplicationCode/Commands/RicNewSimWellFractureFeature.cpp @@ -50,6 +50,9 @@ CAF_CMD_SOURCE_INIT(RicNewSimWellFractureFeature, "RicNewSimWellFractureFeature" //-------------------------------------------------------------------------------------------------- void RicNewSimWellFractureFeature::onActionTriggered(bool isChecked) { + RimProject* proj = RiaApplication::instance()->project(); + if (proj->allFractureTemplates().empty()) return; + caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem(); if (!pdmUiItem) return; @@ -109,6 +112,9 @@ void RicNewSimWellFractureFeature::setupActionLook(QAction* actionToSetup) //-------------------------------------------------------------------------------------------------- bool RicNewSimWellFractureFeature::isCommandEnabled() { + RimProject* proj = RiaApplication::instance()->project(); + if (proj->allFractureTemplates().empty()) return false; + caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem(); if (!pdmUiItem) return false; diff --git a/ApplicationCode/Commands/RicNewWellPathFractureAtPosFeature.cpp b/ApplicationCode/Commands/RicNewWellPathFractureAtPosFeature.cpp index b91169c5d6..3b2368b175 100644 --- a/ApplicationCode/Commands/RicNewWellPathFractureAtPosFeature.cpp +++ b/ApplicationCode/Commands/RicNewWellPathFractureAtPosFeature.cpp @@ -22,6 +22,8 @@ #include "RicNewWellPathFractureFeature.h" +#include "RimProject.h" + #include "RiuSelectionManager.h" #include @@ -35,6 +37,9 @@ CAF_CMD_SOURCE_INIT(RicNewWellPathFractureAtPosFeature, "RicNewWellPathFractureA //-------------------------------------------------------------------------------------------------- void RicNewWellPathFractureAtPosFeature::onActionTriggered(bool isChecked) { + RimProject* proj = RiaApplication::instance()->project(); + if (proj->allFractureTemplates().empty()) return; + RiuSelectionManager* riuSelManager = RiuSelectionManager::instance(); RiuSelectionItem* selItem = riuSelManager->selectedItem(RiuSelectionManager::RUI_TEMPORARY); @@ -61,5 +66,8 @@ void RicNewWellPathFractureAtPosFeature::setupActionLook(QAction* actionToSetup) //-------------------------------------------------------------------------------------------------- bool RicNewWellPathFractureAtPosFeature::isCommandEnabled() { + RimProject* proj = RiaApplication::instance()->project(); + if (proj->allFractureTemplates().empty()) return false; + return true; } diff --git a/ApplicationCode/Commands/RicNewWellPathFractureFeature.cpp b/ApplicationCode/Commands/RicNewWellPathFractureFeature.cpp index bcbcabb42d..4918c73bc1 100644 --- a/ApplicationCode/Commands/RicNewWellPathFractureFeature.cpp +++ b/ApplicationCode/Commands/RicNewWellPathFractureFeature.cpp @@ -96,6 +96,9 @@ void RicNewWellPathFractureFeature::addFracture(RimWellPath* wellPath, double me //-------------------------------------------------------------------------------------------------- void RicNewWellPathFractureFeature::onActionTriggered(bool isChecked) { + RimProject* proj = RiaApplication::instance()->project(); + if (proj->allFractureTemplates().empty()) return; + RimWellPathFractureCollection* fractureColl = RicNewWellPathFractureFeature::selectedWellPathFractureCollection(); if (!fractureColl) return; @@ -120,6 +123,9 @@ void RicNewWellPathFractureFeature::setupActionLook(QAction* actionToSetup) //-------------------------------------------------------------------------------------------------- bool RicNewWellPathFractureFeature::isCommandEnabled() { + RimProject* proj = RiaApplication::instance()->project(); + if (proj->allFractureTemplates().empty()) return false; + if (selectedWellPathFractureCollection()) { return true; From 9617481406434af9ce4b7a0b452d2009fe2091a2 Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Wed, 24 Jan 2018 08:21:22 +0100 Subject: [PATCH 16/78] #2327 Formation RFT Plot: Read tvdss from well pick files --- .../RifWellPathFormationReader.cpp | 98 ++++++- .../RifWellPathFormationReader.h | 3 +- .../ProjectDataModel/RimWellLogTrack.cpp | 9 +- .../RigWellPathFormations.cpp | 274 +++++++++++------- .../RigWellPathFormations.h | 89 +++++- 5 files changed, 345 insertions(+), 128 deletions(-) diff --git a/ApplicationCode/FileInterface/RifWellPathFormationReader.cpp b/ApplicationCode/FileInterface/RifWellPathFormationReader.cpp index efed4f6f66..4c6e31b760 100644 --- a/ApplicationCode/FileInterface/RifWellPathFormationReader.cpp +++ b/ApplicationCode/FileInterface/RifWellPathFormationReader.cpp @@ -39,11 +39,29 @@ std::map> std::vector wellNames; std::vector formationNames; + std::vector mdTop; std::vector mdBase; - readFile(filePath, &wellNames, &formationNames, &mdTop, &mdBase); - if (wellNames.empty() || formationNames.empty() || mdTop.empty() || mdBase.empty()) + std::vector tvdTop; + std::vector tvdBase; + + readFile(filePath, &wellNames, &formationNames, &mdTop, &mdBase, &tvdTop, &tvdBase); + + bool mdIsPresent = true; + bool tvdIsPresent = true; + + if (mdTop.empty() || mdBase.empty()) + { + mdIsPresent = false; + } + + if (tvdTop.empty() || tvdBase.empty()) + { + tvdIsPresent = false; + } + + if (wellNames.empty() || formationNames.empty()) { QMessageBox::warning(RiuMainWindow::instance(), "Import failure", QString("Failed to parse %1 as a well pick file").arg(filePath)); @@ -51,10 +69,16 @@ std::map> return result; } + else if (!(mdIsPresent || tvdIsPresent)) + { + QMessageBox::warning(RiuMainWindow::instance(), "Import failure", + QString("Failed to parse %1 as a well pick file. Neither MD or TVD is present.").arg(filePath)); + RiaLogging::error(QString("Failed to parse %1 as a well pick file. Neither MD or TVD is present.").arg(filePath)); + + return result; + } CVF_ASSERT(wellNames.size() == formationNames.size()); - CVF_ASSERT(mdTop.size() == formationNames.size()); - CVF_ASSERT(mdBase.size() == formationNames.size()); std::map> formations; @@ -62,8 +86,18 @@ std::map> { RigWellPathFormation formation; formation.formationName = formationNames[i]; - formation.mdTop = mdTop[i]; - formation.mdBase = mdBase[i]; + + if (mdIsPresent) + { + formation.mdTop = mdTop[i]; + formation.mdBase = mdBase[i]; + } + + if (tvdIsPresent) + { + formation.tvdTop = tvdTop[i]; + formation.tvdBase = tvdBase[i]; + } if (!formations.count(wellNames[i])) { @@ -73,10 +107,10 @@ std::map> formations[wellNames[i]].push_back(formation); } - for (auto it = formations.begin(); it != formations.end(); it++) + for (const std::pair>& formation : formations) { - cvf::ref wellPathFormations = new RigWellPathFormations(it->second, filePath, it->first); - result[it->first] = wellPathFormations; + cvf::ref wellPathFormations = new RigWellPathFormations(formation.second, filePath, formation.first); + result[formation.first] = wellPathFormations; } return result; @@ -95,7 +129,8 @@ void removeWhiteSpaces(QString* word) //-------------------------------------------------------------------------------------------------- void RifWellPathFormationReader::readFile(const QString& filePath, std::vector* wellNames, std::vector* formationNames, std::vector* mdTop, - std::vector* mdBase) + std::vector* mdBase, std::vector* tvdTop, + std::vector* tvdBase) { QFile data(filePath); @@ -151,12 +186,31 @@ void RifWellPathFormationReader::readFile(const QString& filePath, std::vectorpush_back(mdTopValue); + mdBase->push_back(mdBaseValue); + } + + if (tvdIsPresent) + { + double tvdTopValue = dataLine[trueVerticalDepthTopIndex].toDouble(); + double tvdBaseValue = dataLine[trueVerticalDepthBaseIndex].toDouble(); + + tvdTop->push_back(-tvdTopValue); + tvdBase->push_back(-tvdBaseValue); + } wellNames->push_back(wellName); formationNames->push_back(unitName); - mdTop->push_back(measuredDepthTop); - mdBase->push_back(measuredDepthBase); } while (!data.atEnd()); } diff --git a/ApplicationCode/FileInterface/RifWellPathFormationReader.h b/ApplicationCode/FileInterface/RifWellPathFormationReader.h index fa61d6f4be..6270fcce94 100644 --- a/ApplicationCode/FileInterface/RifWellPathFormationReader.h +++ b/ApplicationCode/FileInterface/RifWellPathFormationReader.h @@ -39,5 +39,6 @@ class RifWellPathFormationReader private: static void readFile(const QString& filePath, std::vector* wellNames, std::vector* formationNames, - std::vector* mdTop, std::vector* mdBase); + std::vector* mdTop, std::vector* mdBase, std::vector* tvdTop, + std::vector* tvdBase); }; diff --git a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp index b6a9d41bcb..4087f02c82 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp @@ -1269,14 +1269,19 @@ void RimWellLogTrack::updateFormationNamesOnPlot() else if (m_formationSource() == WELL_PICK_FILTER) { if (m_formationWellPathForSourceWellPath == nullptr) return; - if (plot->depthType() != RimWellLogPlot::MEASURED_DEPTH) return; + + if (!(plot->depthType() == RimWellLogPlot::MEASURED_DEPTH || plot->depthType() == RimWellLogPlot::TRUE_VERTICAL_DEPTH)) + { + return; + } std::vector yValues; const RigWellPathFormations* formations = m_formationWellPathForSourceWellPath->formationsGeometry(); if (!formations) return; - formations->measuredDepthAndFormationNamesUpToLevel(m_formationLevel(), &formationNamesToPlot, &yValues, m_showformationFluids()); + + formations->depthAndFormationNamesUpToLevel(m_formationLevel(), &formationNamesToPlot, &yValues, m_showformationFluids(), plot->depthType()); m_annotationTool->attachWellPicks(this->viewer(), formationNamesToPlot, yValues); } diff --git a/ApplicationCode/ReservoirDataModel/RigWellPathFormations.cpp b/ApplicationCode/ReservoirDataModel/RigWellPathFormations.cpp index 6f33c1b5cb..3ecb300e73 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellPathFormations.cpp +++ b/ApplicationCode/ReservoirDataModel/RigWellPathFormations.cpp @@ -20,16 +20,14 @@ #include "QStringList" -#include "cvfMath.h" - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RigWellPathFormations::RigWellPathFormations(const std::vector& formations, const QString& filePath, const QString& key) { - m_filePath = filePath; - m_keyInFile = key; + m_filePath = filePath; + m_keyInFile = key; for (const RigWellPathFormation& formation : formations) { @@ -39,7 +37,7 @@ RigWellPathFormations::RigWellPathFormations(const std::vector(formation, level)); @@ -47,74 +45,114 @@ RigWellPathFormations::RigWellPathFormations(const std::vector* names, + std::vector* measuredDepths, + RimWellLogPlot::DepthTypeEnum depthType) const { - bool operator()(const double& md1, const double& md2) const + std::map tempMakeVectorUniqueOnMeasuredDepth; + + if (depthType == RimWellLogPlot::MEASURED_DEPTH) { - if (cvf::Math::abs(md1 - md2) < 0.1) + for (const std::pair& formation : m_formations) { - return false; + if (!tempMakeVectorUniqueOnMeasuredDepth.count(formation.first.mdTop)) + { + measuredDepths->push_back(formation.first.mdTop); + names->push_back(formation.first.formationName + " Top"); + tempMakeVectorUniqueOnMeasuredDepth[formation.first.mdTop] = true; + } + } + + for (const std::pair& formation : m_formations) + { + if (!tempMakeVectorUniqueOnMeasuredDepth.count(formation.first.mdBase)) + { + measuredDepths->push_back(formation.first.mdBase); + names->push_back(formation.first.formationName + " Base"); + tempMakeVectorUniqueOnMeasuredDepth[formation.first.mdBase] = true; + } } - return md1 < md2; } -}; + else if (depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH) + { + for (const std::pair& formation : m_formations) + { + if (!tempMakeVectorUniqueOnMeasuredDepth.count(formation.first.tvdTop)) + { + measuredDepths->push_back(formation.first.tvdTop); + names->push_back(formation.first.formationName + " Top"); + tempMakeVectorUniqueOnMeasuredDepth[formation.first.tvdTop] = true; + } + } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RigWellPathFormations::measuredDepthAndFormationNamesWithoutDuplicatesOnDepth(std::vector* names, - std::vector* measuredDepths) const -{ - std::map tempMakeVectorUniqueOnMeasuredDepth; + for (const std::pair& formation : m_formations) + { + if (!tempMakeVectorUniqueOnMeasuredDepth.count(formation.first.tvdBase)) + { + measuredDepths->push_back(formation.first.tvdBase); + names->push_back(formation.first.formationName + " Base"); + tempMakeVectorUniqueOnMeasuredDepth[formation.first.tvdBase] = true; + } + } + } + + + + /* for (const std::pair& formation : m_formations) { if (!tempMakeVectorUniqueOnMeasuredDepth.count(formation.first.mdTop)) { - measuredDepths->push_back(formation.first.mdTop); + double depth; + if (depthType == RimWellLogPlot::MEASURED_DEPTH) + { + depth = formation.first.mdTop; + } + else if (depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH) + { + depth = formation.first.tvdTop; + } + else return; + + measuredDepths->push_back(depth); names->push_back(formation.first.formationName + " Top"); - tempMakeVectorUniqueOnMeasuredDepth[formation.first.mdTop] = true; + tempMakeVectorUniqueOnMeasuredDepth[depth] = true; } } for (const std::pair& formation : m_formations) { + double depth; + if (depthType == RimWellLogPlot::MEASURED_DEPTH) + { + depth = formation.first.mdBase; + } + else if (depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH) + { + depth = formation.first.tvdBase; + } + else return; + if (!tempMakeVectorUniqueOnMeasuredDepth.count(formation.first.mdBase)) { - measuredDepths->push_back(formation.first.mdBase); + measuredDepths->push_back(depth); names->push_back(formation.first.formationName + " Base"); - tempMakeVectorUniqueOnMeasuredDepth[formation.first.mdBase] = true; + tempMakeVectorUniqueOnMeasuredDepth[depth] = true; } - } + }*/ } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -struct LevelAndName -{ - LevelAndName() {} - LevelAndName(RigWellPathFormations::FormationLevel level, QString name) : level(level), name(name) {} - - RigWellPathFormations::FormationLevel level; - QString name; -}; - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -enum PICK_POSITION -{ - TOP, - BASE -}; - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void evaluateFormationsForOnePosition(const std::vector>& formations, - const RigWellPathFormations::FormationLevel& maxLevel, const PICK_POSITION& position, - std::map* uniqueListMaker) +void RigWellPathFormations::evaluateFormationsForOnePosition( + const std::vector>& formations, + const FormationLevel& maxLevel, const PickPosition& position, + std::map* uniqueListMaker, RimWellLogPlot::DepthTypeEnum depthType) const { QString postFix; @@ -127,92 +165,134 @@ void evaluateFormationsForOnePosition(const std::vector& formation : formations) + for (const std::pair& formation : formations) { - double md; - if (position == TOP) + double depth; + + if (depthType == RimWellLogPlot::MEASURED_DEPTH) { - md = formation.first.mdTop; + if (position == TOP) + { + depth = formation.first.mdTop; + } + else + { + depth = formation.first.mdBase; + } } - else + else if (depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH) { - md = formation.first.mdBase; + if (position == TOP) + { + depth = formation.first.tvdTop; + } + else + { + depth = formation.first.tvdBase; + } } + else return; if (formation.second > maxLevel) continue; - if (!uniqueListMaker->count(md) || uniqueListMaker->at(md).level < formation.second) + if (!uniqueListMaker->count(depth) || uniqueListMaker->at(depth).level < formation.second) { - (*uniqueListMaker)[md] = LevelAndName(formation.second, formation.first.formationName + postFix); + (*uniqueListMaker)[depth] = LevelAndName(formation.second, formation.first.formationName + postFix); } } } -void evaluateFormations(const std::vector>& formations, - const RigWellPathFormations::FormationLevel& maxLevel, - std::vector* names, std::vector* measuredDepths) +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigWellPathFormations::evaluateFormations(const std::vector>& formations, + const FormationLevel& maxLevel, std::vector* names, + std::vector* depths, RimWellLogPlot::DepthTypeEnum depthType) const { - std::map tempMakeVectorUniqueOnMeasuredDepth; + std::map tempMakeVectorUniqueOnDepth; - evaluateFormationsForOnePosition(formations, maxLevel, PICK_POSITION::TOP, &tempMakeVectorUniqueOnMeasuredDepth); - evaluateFormationsForOnePosition(formations, maxLevel, PICK_POSITION::BASE, &tempMakeVectorUniqueOnMeasuredDepth); + evaluateFormationsForOnePosition(formations, maxLevel, PickPosition::TOP, &tempMakeVectorUniqueOnDepth, depthType); + evaluateFormationsForOnePosition(formations, maxLevel, PickPosition::BASE, &tempMakeVectorUniqueOnDepth, depthType); - for (auto it = tempMakeVectorUniqueOnMeasuredDepth.begin(); it != tempMakeVectorUniqueOnMeasuredDepth.end(); it++) + for (const std::pair& uniqueDepth : tempMakeVectorUniqueOnDepth) { - measuredDepths->push_back(it->first); - names->push_back(it->second.name); + depths->push_back(uniqueDepth.first); + names->push_back(uniqueDepth.second.name); } } -void evaluateFluids(const std::vector& fluidFormations, - std::vector* names, std::vector* measuredDepths) +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigWellPathFormations::evaluateFluids(const std::vector& fluidFormations, std::vector* names, + std::vector* depths, RimWellLogPlot::DepthTypeEnum depthType) const { - - std::map uniqueListMaker; + std::map uniqueListMaker; for (const RigWellPathFormation& formation : fluidFormations) { - uniqueListMaker[formation.mdBase] = formation.formationName + " Base"; + double depthBase; + if (depthType == RimWellLogPlot::MEASURED_DEPTH) + { + depthBase = formation.mdBase; + } + else if (depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH) + { + depthBase = formation.tvdBase; + } + else return; + + uniqueListMaker[depthBase] = formation.formationName + " Base"; } for (const RigWellPathFormation& formation : fluidFormations) { - uniqueListMaker[formation.mdTop] = formation.formationName + " Top"; + double depthTop; + if (depthType == RimWellLogPlot::MEASURED_DEPTH) + { + depthTop = formation.mdTop; + } + else if (depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH) + { + depthTop = formation.tvdTop; + } + else return; + + uniqueListMaker[depthTop] = formation.formationName + " Top"; } - for (auto it = uniqueListMaker.begin(); it != uniqueListMaker.end(); it++) + for (const std::pair& depthAndFormation : uniqueListMaker) { - measuredDepths->push_back(it->first); - names->push_back(it->second); + depths->push_back(depthAndFormation.first); + names->push_back(depthAndFormation.second); } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RigWellPathFormations::measuredDepthAndFormationNamesUpToLevel(FormationLevel maxLevel, - std::vector* names, - std::vector* measuredDepths, bool includeFluids) const +void RigWellPathFormations::depthAndFormationNamesUpToLevel(FormationLevel level, std::vector* names, std::vector* depths, + bool includeFluids, RimWellLogPlot::DepthTypeEnum depthType) const { names->clear(); - measuredDepths->clear(); + depths->clear(); if (includeFluids) { - evaluateFluids(m_fluids, names, measuredDepths); + evaluateFluids(m_fluids, names, depths, depthType); } - if (maxLevel == RigWellPathFormations::NONE) + if (level == RigWellPathFormations::NONE) { return; } - else if (maxLevel == RigWellPathFormations::ALL) + else if (level == RigWellPathFormations::ALL) { - measuredDepthAndFormationNamesWithoutDuplicatesOnDepth(names, measuredDepths); + depthAndFormationNamesWithoutDuplicatesOnDepth(names, depths, depthType); } else { - evaluateFormations(m_formations, maxLevel, names, measuredDepths); + evaluateFormations(m_formations, level, names, depths, depthType); } } @@ -223,9 +303,9 @@ std::vector RigWellPathFormations::format { std::vector formationLevels; - for (auto it = m_formationsLevelsPresent.begin(); it != m_formationsLevelsPresent.end(); it++) + for (const std::pair& formationLevel : m_formationsLevelsPresent) { - formationLevels.push_back(it->first); + formationLevels.push_back(formationLevel.first); } return formationLevels; } @@ -255,7 +335,7 @@ size_t RigWellPathFormations::formationNamesCount() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- bool RigWellPathFormations::isFluid(QString formationName) { @@ -327,7 +407,7 @@ RigWellPathFormations::FormationLevel RigWellPathFormations::detectLevel(QString QString levelDescriptor = levelDesctiptorCandidates[0]; QStringList joinedLevel = levelDescriptor.split('+'); - if ( joinedLevel.size() > 1 ) + if (joinedLevel.size() > 1) { levelDescriptor = joinedLevel[0]; } @@ -338,16 +418,16 @@ RigWellPathFormations::FormationLevel RigWellPathFormations::detectLevel(QString switch (dotCount) { - case 0: return RigWellPathFormations::LEVEL1; - case 1: return RigWellPathFormations::LEVEL2; - case 2: return RigWellPathFormations::LEVEL3; - case 3: return RigWellPathFormations::LEVEL4; - case 4: return RigWellPathFormations::LEVEL5; - case 5: return RigWellPathFormations::LEVEL6; - case 6: return RigWellPathFormations::LEVEL7; - case 7: return RigWellPathFormations::LEVEL8; - case 8: return RigWellPathFormations::LEVEL9; - case 9: return RigWellPathFormations::LEVEL10; + case 0: return RigWellPathFormations::LEVEL1; + case 1: return RigWellPathFormations::LEVEL2; + case 2: return RigWellPathFormations::LEVEL3; + case 3: return RigWellPathFormations::LEVEL4; + case 4: return RigWellPathFormations::LEVEL5; + case 5: return RigWellPathFormations::LEVEL6; + case 6: return RigWellPathFormations::LEVEL7; + case 7: return RigWellPathFormations::LEVEL8; + case 8: return RigWellPathFormations::LEVEL9; + case 9: return RigWellPathFormations::LEVEL10; default: break; } return RigWellPathFormations::UNKNOWN; diff --git a/ApplicationCode/ReservoirDataModel/RigWellPathFormations.h b/ApplicationCode/ReservoirDataModel/RigWellPathFormations.h index 6d1909be69..cc2a7629c5 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellPathFormations.h +++ b/ApplicationCode/ReservoirDataModel/RigWellPathFormations.h @@ -1,17 +1,17 @@ ///////////////////////////////////////////////////////////////////////////////// // // 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 +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// @@ -19,8 +19,11 @@ #pragma once #include "cvfBase.h" +#include "cvfMath.h" #include "cvfObject.h" +#include "RimWellLogPlot.h" + #include #include #include @@ -31,32 +34,92 @@ struct RigWellPathFormation { double mdTop; double mdBase; + double tvdTop; + double tvdBase; QString formationName; }; +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- class RigWellPathFormations : public cvf::Object { public: - RigWellPathFormations(const std::vector& formations, const QString& filePath, const QString& key); - enum FormationLevel { - GROUP, LEVEL0, LEVEL1, LEVEL2, LEVEL3, LEVEL4, LEVEL5, LEVEL6, LEVEL7, LEVEL8, LEVEL9, LEVEL10, ALL, UNKNOWN, NONE + GROUP, + LEVEL0, + LEVEL1, + LEVEL2, + LEVEL3, + LEVEL4, + LEVEL5, + LEVEL6, + LEVEL7, + LEVEL8, + LEVEL9, + LEVEL10, + ALL, + UNKNOWN, + NONE }; - void measuredDepthAndFormationNamesUpToLevel(FormationLevel level, std::vector* names, - std::vector* measuredDepths, bool includeFluids) const; +public: + RigWellPathFormations(const std::vector& formations, const QString& filePath, const QString& key); + + void depthAndFormationNamesUpToLevel(FormationLevel level, std::vector* names, std::vector* depths, + bool includeFluids, RimWellLogPlot::DepthTypeEnum depthType) const; std::vector formationsLevelsPresent() const; QString filePath() const; QString keyInFile() const; - size_t formationNamesCount() const; + size_t formationNamesCount() const; private: - void measuredDepthAndFormationNamesWithoutDuplicatesOnDepth(std::vector* names, - std::vector* measuredDepths) const; + struct DepthComp + { + bool operator()(const double& depth1, const double& depth2) const + { + if (cvf::Math::abs(depth1 - depth2) < 0.1) + { + return false; + } + return depth1 < depth2; + } + }; + + struct LevelAndName + { + LevelAndName() = default; + LevelAndName(RigWellPathFormations::FormationLevel level, QString name) : level(level), name(name) {} + + RigWellPathFormations::FormationLevel level; + QString name; + }; + + enum PickPosition + { + TOP, + BASE + }; + +private: + void evaluateFormations(const std::vector>& formations, + const FormationLevel& maxLevel, std::vector* names, std::vector* depths, + RimWellLogPlot::DepthTypeEnum depthType) const; + + void evaluateFluids(const std::vector& fluidFormations, std::vector* names, + std::vector* depths, RimWellLogPlot::DepthTypeEnum depthType) const; + + void evaluateFormationsForOnePosition(const std::vector>& formations, + const FormationLevel& maxLevel, const PickPosition& position, + std::map* uniqueListMaker, + RimWellLogPlot::DepthTypeEnum depthType) const; + + void depthAndFormationNamesWithoutDuplicatesOnDepth(std::vector* names, std::vector* measuredDepths, + RimWellLogPlot::DepthTypeEnum depthType) const; bool isFluid(QString formationName); FormationLevel detectLevel(QString formationName); @@ -68,5 +131,5 @@ class RigWellPathFormations : public cvf::Object std::map m_formationsLevelsPresent; std::vector> m_formations; - std::vector m_fluids; + std::vector m_fluids; }; From 650fc2147d8948a5a7284aa85e4f7d6b29c08dad Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Wed, 24 Jan 2018 10:48:23 +0100 Subject: [PATCH 17/78] #2404 Intersection: Update 3d view when creating new Intersection Box --- .../RicAppendIntersectionFeature.cpp | 2 +- .../RicNewAzimuthDipIntersectionFeature.cpp | 2 +- .../RicNewPolylineIntersectionFeature.cpp | 2 +- .../RicNewSimWellIntersectionFeature.cpp | 2 +- .../RicNewWellPathIntersectionFeature.cpp | 2 +- .../RicAppendIntersectionBoxFeature.cpp | 2 +- .../RicIntersectionBoxAtPosFeature.cpp | 2 +- .../RicIntersectionBoxXSliceFeature.cpp | 2 +- .../RicIntersectionBoxYSliceFeature.cpp | 2 +- .../RicIntersectionBoxZSliceFeature.cpp | 2 +- .../ProjectDataModel/RimIntersectionCollection.cpp | 14 ++++++++++++-- .../ProjectDataModel/RimIntersectionCollection.h | 5 +++-- 12 files changed, 25 insertions(+), 14 deletions(-) diff --git a/ApplicationCode/Commands/CrossSectionCommands/RicAppendIntersectionFeature.cpp b/ApplicationCode/Commands/CrossSectionCommands/RicAppendIntersectionFeature.cpp index 71acc20341..0b463e7793 100644 --- a/ApplicationCode/Commands/CrossSectionCommands/RicAppendIntersectionFeature.cpp +++ b/ApplicationCode/Commands/CrossSectionCommands/RicAppendIntersectionFeature.cpp @@ -100,7 +100,7 @@ void RicAppendIntersectionFeatureCmd::redo() RimIntersection* intersection = new RimIntersection(); intersection->name = QString("Intersection"); - m_intersectionCollection->appendIntersection(intersection); + m_intersectionCollection->appendIntersectionAndUpdate(intersection); RimView* view = nullptr; m_intersectionCollection->firstAncestorOrThisOfTypeAsserted(view); diff --git a/ApplicationCode/Commands/CrossSectionCommands/RicNewAzimuthDipIntersectionFeature.cpp b/ApplicationCode/Commands/CrossSectionCommands/RicNewAzimuthDipIntersectionFeature.cpp index 049500112a..6205e3d840 100644 --- a/ApplicationCode/Commands/CrossSectionCommands/RicNewAzimuthDipIntersectionFeature.cpp +++ b/ApplicationCode/Commands/CrossSectionCommands/RicNewAzimuthDipIntersectionFeature.cpp @@ -122,7 +122,7 @@ void RicNewAzimuthDipIntersectionFeatureCmd::redo() intersection->setLengthDown(cvf::Math::floor(bBox.extent()[2] / 2)); } - m_intersectionCollection->appendIntersection(intersection); + m_intersectionCollection->appendIntersectionAndUpdate(intersection); RiuSelectionManager::instance()->deleteAllItems(); RiuMainWindow::instance()->selectAsCurrentItem(intersection); diff --git a/ApplicationCode/Commands/CrossSectionCommands/RicNewPolylineIntersectionFeature.cpp b/ApplicationCode/Commands/CrossSectionCommands/RicNewPolylineIntersectionFeature.cpp index 7d7ea02d34..ac7f045f5b 100644 --- a/ApplicationCode/Commands/CrossSectionCommands/RicNewPolylineIntersectionFeature.cpp +++ b/ApplicationCode/Commands/CrossSectionCommands/RicNewPolylineIntersectionFeature.cpp @@ -112,7 +112,7 @@ void RicNewPolylineIntersectionFeatureCmd::redo() intersection->type = RimIntersection::CS_POLYLINE; intersection->inputPolyLineFromViewerEnabled = true; - m_intersectionCollection->appendIntersection(intersection); + m_intersectionCollection->appendIntersectionAndUpdate(intersection); RiuSelectionManager::instance()->deleteAllItems(); diff --git a/ApplicationCode/Commands/CrossSectionCommands/RicNewSimWellIntersectionFeature.cpp b/ApplicationCode/Commands/CrossSectionCommands/RicNewSimWellIntersectionFeature.cpp index 2d20fd4ba3..d20238f06b 100644 --- a/ApplicationCode/Commands/CrossSectionCommands/RicNewSimWellIntersectionFeature.cpp +++ b/ApplicationCode/Commands/CrossSectionCommands/RicNewSimWellIntersectionFeature.cpp @@ -107,7 +107,7 @@ void RicNewSimWellIntersectionCmd::redo() intersection->type = RimIntersection::CS_SIMULATION_WELL; intersection->simulationWell = m_simWell; - m_intersectionCollection->appendIntersection(intersection); + m_intersectionCollection->appendIntersectionAndUpdate(intersection); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/CrossSectionCommands/RicNewWellPathIntersectionFeature.cpp b/ApplicationCode/Commands/CrossSectionCommands/RicNewWellPathIntersectionFeature.cpp index fcb0a3b455..a778aa82c6 100644 --- a/ApplicationCode/Commands/CrossSectionCommands/RicNewWellPathIntersectionFeature.cpp +++ b/ApplicationCode/Commands/CrossSectionCommands/RicNewWellPathIntersectionFeature.cpp @@ -116,7 +116,7 @@ void RicNewWellPathIntersectionFeatureCmd::redo() intersection->type = RimIntersection::CS_WELL_PATH; intersection->wellPath = m_wellPath; - m_intersectionCollection->appendIntersection(intersection); + m_intersectionCollection->appendIntersectionAndUpdate(intersection); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/IntersectionBoxCommands/RicAppendIntersectionBoxFeature.cpp b/ApplicationCode/Commands/IntersectionBoxCommands/RicAppendIntersectionBoxFeature.cpp index 226292ed97..b5449d3dc7 100644 --- a/ApplicationCode/Commands/IntersectionBoxCommands/RicAppendIntersectionBoxFeature.cpp +++ b/ApplicationCode/Commands/IntersectionBoxCommands/RicAppendIntersectionBoxFeature.cpp @@ -56,7 +56,7 @@ void RicAppendIntersectionBoxFeature::onActionTriggered(bool isChecked) RimIntersectionBox* intersectionBox = new RimIntersectionBox(); intersectionBox->name = QString("Intersection Box"); - coll->appendIntersectionBox(intersectionBox); + coll->appendIntersectionBoxAndUpdate(intersectionBox); intersectionBox->setToDefaultSizeBox(); diff --git a/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxAtPosFeature.cpp b/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxAtPosFeature.cpp index 3ad0570eb5..d8b9cb928c 100644 --- a/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxAtPosFeature.cpp +++ b/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxAtPosFeature.cpp @@ -59,7 +59,7 @@ void RicIntersectionBoxAtPosFeature::onActionTriggered(bool isChecked) RimIntersectionBox* intersectionBox = new RimIntersectionBox(); intersectionBox->name = QString("Intersection box"); - coll->appendIntersectionBox(intersectionBox); + coll->appendIntersectionBoxAndUpdate(intersectionBox); cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords(); intersectionBox->setToDefaultSizeSlice(RimIntersectionBox::PLANE_STATE_NONE, domainCoord); diff --git a/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxXSliceFeature.cpp b/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxXSliceFeature.cpp index fbf17a62e8..102971ae8b 100644 --- a/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxXSliceFeature.cpp +++ b/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxXSliceFeature.cpp @@ -59,7 +59,7 @@ void RicIntersectionBoxXSliceFeature::onActionTriggered(bool isChecked) RimIntersectionBox* intersectionBox = new RimIntersectionBox(); intersectionBox->name = QString("X-slice (Intersection box)"); - coll->appendIntersectionBox(intersectionBox); + coll->appendIntersectionBoxAndUpdate(intersectionBox); cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords(); intersectionBox->setToDefaultSizeSlice(RimIntersectionBox::PLANE_STATE_X, domainCoord); diff --git a/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxYSliceFeature.cpp b/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxYSliceFeature.cpp index aea7a5d115..abe6bff899 100644 --- a/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxYSliceFeature.cpp +++ b/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxYSliceFeature.cpp @@ -59,7 +59,7 @@ void RicIntersectionBoxYSliceFeature::onActionTriggered(bool isChecked) RimIntersectionBox* intersectionBox = new RimIntersectionBox(); intersectionBox->name = QString("Y-slice (Intersection box)"); - coll->appendIntersectionBox(intersectionBox); + coll->appendIntersectionBoxAndUpdate(intersectionBox); cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords(); intersectionBox->setToDefaultSizeSlice(RimIntersectionBox::PLANE_STATE_Y, domainCoord); diff --git a/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxZSliceFeature.cpp b/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxZSliceFeature.cpp index 68d65a23e0..0a73ce33b1 100644 --- a/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxZSliceFeature.cpp +++ b/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxZSliceFeature.cpp @@ -59,7 +59,7 @@ void RicIntersectionBoxZSliceFeature::onActionTriggered(bool isChecked) RimIntersectionBox* intersectionBox = new RimIntersectionBox(); intersectionBox->name = QString("Z-slice (Intersection box)"); - coll->appendIntersectionBox(intersectionBox); + coll->appendIntersectionBoxAndUpdate(intersectionBox); cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords(); intersectionBox->setToDefaultSizeSlice(RimIntersectionBox::PLANE_STATE_Z, domainCoord); diff --git a/ApplicationCode/ProjectDataModel/RimIntersectionCollection.cpp b/ApplicationCode/ProjectDataModel/RimIntersectionCollection.cpp index eaebab0d58..ae205a7e32 100644 --- a/ApplicationCode/ProjectDataModel/RimIntersectionCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimIntersectionCollection.cpp @@ -149,7 +149,7 @@ void RimIntersectionCollection::appendPartsToModel(cvf::ModelBasicList* model, c //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimIntersectionCollection::appendIntersection(RimIntersection* intersection) +void RimIntersectionCollection::appendIntersectionAndUpdate(RimIntersection* intersection) { m_intersections.push_back(intersection); @@ -167,9 +167,19 @@ void RimIntersectionCollection::appendIntersection(RimIntersection* intersection //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimIntersectionCollection::appendIntersectionBox(RimIntersectionBox* intersectionBox) +void RimIntersectionCollection::appendIntersectionBoxAndUpdate(RimIntersectionBox* intersectionBox) { m_intersectionBoxes.push_back(intersectionBox); + + updateConnectedEditors(); + RiuMainWindow::instance()->selectAsCurrentItem(intersectionBox); + + RimView* rimView = NULL; + firstAncestorOrThisOfType(rimView); + if (rimView) + { + rimView->scheduleCreateDisplayModelAndRedraw(); + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimIntersectionCollection.h b/ApplicationCode/ProjectDataModel/RimIntersectionCollection.h index 2575250b64..631107f5e7 100644 --- a/ApplicationCode/ProjectDataModel/RimIntersectionCollection.h +++ b/ApplicationCode/ProjectDataModel/RimIntersectionCollection.h @@ -48,8 +48,9 @@ class RimIntersectionCollection : public caf::PdmObject caf::PdmField isActive; - void appendIntersection(RimIntersection* intersection); - void appendIntersectionBox(RimIntersectionBox* intersectionBox); + void appendIntersectionAndUpdate(RimIntersection* intersection); + + void appendIntersectionBoxAndUpdate(RimIntersectionBox* intersectionBox); bool hasActiveIntersectionForSimulationWell(const RimSimWellInView* simWell) const; From 0ea10a45eba21e31ecf41b79efa8982207aaa1f0 Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Wed, 24 Jan 2018 14:58:21 +0100 Subject: [PATCH 18/78] #2362 Grdecl SegFault: Guard for empty vectors --- ApplicationCode/UserInterface/RiuResultQwtPlot.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ApplicationCode/UserInterface/RiuResultQwtPlot.cpp b/ApplicationCode/UserInterface/RiuResultQwtPlot.cpp index 0cef8c26c6..f6bec832ac 100644 --- a/ApplicationCode/UserInterface/RiuResultQwtPlot.cpp +++ b/ApplicationCode/UserInterface/RiuResultQwtPlot.cpp @@ -66,6 +66,11 @@ RiuResultQwtPlot::~RiuResultQwtPlot() //-------------------------------------------------------------------------------------------------- void RiuResultQwtPlot::addCurve(const QString& curveName, const cvf::Color3f& curveColor, const std::vector& dateTimes, const std::vector& timeHistoryValues) { + if (dateTimes.empty() || timeHistoryValues.empty()) + { + return; + } + RiuLineSegmentQwtPlotCurve* plotCurve = new RiuLineSegmentQwtPlotCurve("Curve 1"); plotCurve->setSamplesFromDatesAndYValues(dateTimes, timeHistoryValues, false); From d3f1767ff95261dec14f57cf2bfd0874634c5939 Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Wed, 24 Jan 2018 15:01:19 +0100 Subject: [PATCH 19/78] #2362 Grdecl: Read input file only once --- ApplicationCode/ProjectDataModel/RimEclipseInputCase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseInputCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseInputCase.cpp index 6af6cc2056..4bbefbf730 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseInputCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseInputCase.cpp @@ -249,9 +249,9 @@ void RimEclipseInputCase::loadAndSyncronizeInputProperties() // Then read the properties from all the files referenced by the InputReservoir std::vector filenames; - for (const RimEclipseInputProperty* inputProperty : m_inputPropertyCollection()->inputProperties()) + for (const QString& fileName : additionalFiles()) { - filenames.push_back(inputProperty->fileName); + filenames.push_back(fileName); } filenames.push_back(m_gridFileName); From a6333128e3afc419c7dfb448119f56954e2e49e6 Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Wed, 24 Jan 2018 16:32:48 +0100 Subject: [PATCH 20/78] #2328 Fix crash when calculating "Water Flooded PV" --- .../RigNumberOfFloodedPoreVolumesCalculator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApplicationCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp b/ApplicationCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp index 065270c68c..09f43e0821 100644 --- a/ApplicationCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp +++ b/ApplicationCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp @@ -236,7 +236,7 @@ void RigNumberOfFloodedPoreVolumesCalculator::calculate(RigMainGrid* mainGrid, const std::vector* flowrateNNC = flowrateNNCatAllTimeSteps[timeStep-1]; - if (flowrateNNC->size() > 0) + if (flowrateNNC && flowrateNNC->size() > 0) { distributeNNCflow(connections, caseToApply, From 09cd140bbad5362a43a7c38e98db96cf76ae3581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Wed, 24 Jan 2018 16:37:32 +0100 Subject: [PATCH 21/78] #2375 Updated opm-flowdiagnostics-applications to 5bcd6d99259a63f5cd820db541b45c4f07aec808 including fixes for Relperm and PVT curves --- ResInsightVersion.cmake | 2 +- .../CMakeLists.txt | 2 +- .../dune.module | 4 +- ...flowdiagnostics-applications-prereqs.cmake | 26 ++ .../opm/utility/ECLEndPointScaling.cpp | 91 ++++++- .../opm/utility/ECLFluxCalc.cpp | 85 ++++++- .../opm/utility/ECLFluxCalc.hpp | 50 +++- .../opm/utility/ECLGraph.cpp | 102 ++++++++ .../opm/utility/ECLGraph.hpp | 15 ++ .../opm/utility/ECLPvtGas.cpp | 32 ++- .../opm/utility/ECLPvtOil.cpp | 233 +++++++++++++++++- .../opm/utility/ECLPvtOil.hpp | 7 +- .../opm/utility/ECLWellSolution.cpp | 31 ++- .../opm/utility/ECLWellSolution.hpp | 16 +- 14 files changed, 658 insertions(+), 38 deletions(-) create mode 100644 ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm-flowdiagnostics-applications-prereqs.cmake diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index 10aaf91004..de0ecb0061 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -22,7 +22,7 @@ set(ERT_GITHUB_SHA "2e36798b43daf18c112b91aa3febbf2fccd4a95f") set(OPM_FLOWDIAGNOSTICS_SHA "7e2be931d430796ed42efcfb5c6b67a8d5962f7f") # https://github.com/OPM/opm-flowdiagnostics-applications -set(OPM_FLOWDIAGNOSTICS_APPLICATIONS_SHA "44f7e47ecdc87ba566ab4146629de49039a73b2e") +set(OPM_FLOWDIAGNOSTICS_APPLICATIONS_SHA "5bcd6d99259a63f5cd820db541b45c4f07aec808") # https://github.com/OPM/opm-parser/blob/master/opm/parser/eclipse/Units/Units.hpp # This file was moved from opm-core to opm-parser october 2016 diff --git a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/CMakeLists.txt b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/CMakeLists.txt index 3f086ceb51..565b1aafce 100644 --- a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/CMakeLists.txt +++ b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/CMakeLists.txt @@ -20,7 +20,7 @@ cmake_minimum_required (VERSION 2.8) option(SIBLING_SEARCH "Search for other modules in sibling directories?" ON) # Mandatory call to project -project(opm-flowdiagnostics-applications CXX) +project(opm-flowdiagnostics-applications C CXX) if(SIBLING_SEARCH AND NOT opm-common_DIR) # guess the sibling dir diff --git a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/dune.module b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/dune.module index 1285983fed..b55f213284 100644 --- a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/dune.module +++ b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/dune.module @@ -5,8 +5,8 @@ Module: opm-flowdiagnostics-applications Description: flow diagnostics applications and examples -Version: 2016.10-pre -Label: 2016.10-pre +Version: 2018.04-pre +Label: 2018.04-pre Maintainer: bard.skaflestad@sintef.no MaintainerName: BÃ¥rd Skaflestad Url: http://opm-project.org diff --git a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm-flowdiagnostics-applications-prereqs.cmake b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm-flowdiagnostics-applications-prereqs.cmake new file mode 100644 index 0000000000..5461c566c8 --- /dev/null +++ b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm-flowdiagnostics-applications-prereqs.cmake @@ -0,0 +1,26 @@ +# defines that must be present in config.h for our headers +set (opm-flowdiagnostics-applications_CONFIG_VAR + ) + +# Build prerequisites +set (opm-flowdiagnostics-applications_DEPS + # This module requires C++11 support, including std::regex + "CXX11Features REQUIRED" + # We need Boost.Filesystem for advanced file handling + # filesystem::path + # filesystem::directory_iterator + # filesystem::last_write_time() + "Boost 1.44.0 + COMPONENTS filesystem system unit_test_framework REQUIRED" + # We need LibECL to handle ECL result sets. + "ecl REQUIRED" + # Prerequisite OPM modules + # common -> Parameter System + # fdiag -> Solver + # parser -> Unit Conversions + "opm-common REQUIRED" + "opm-flowdiagnostics REQUIRED" + "opm-parser REQUIRED" + ) + +find_package_deps(opm-flowdiagnostics-applications) diff --git a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLEndPointScaling.cpp b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLEndPointScaling.cpp index 5b03b0690f..0c9a99bc65 100644 --- a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLEndPointScaling.cpp +++ b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLEndPointScaling.cpp @@ -81,6 +81,16 @@ namespace { return tep; } + double defaultedScaledSaturation(const double s, const double dflt) + { + // Use input scaled saturation ('s') if not defaulted (|s| < 1e20), + // default scaled saturation otherwise. The sentinel value 1e20 is + // the common value used to represent unset/defaulted values in ECL + // result sets. + + return (std::abs(s) < 1.0e+20) ? s : dflt; + } + bool validSaturation(const double s) { return (! (s < 0.0)) && (! (s > 1.0)); @@ -135,6 +145,24 @@ class Opm::SatFunc::TwoPointScaling::Impl void handleInvalidEndpoint(const SaturationAssoc& sp, std::vector& effsat) const; + + double sMin(const std::vector::size_type cell, + const TableEndPoints& tep) const + { + // Use model's scaled connate saturation if defined, otherwise fall + // back to table's unscaled connate saturation. + + return defaultedScaledSaturation(this->smin_[cell], tep.low); + } + + double sMax(const std::vector::size_type cell, + const TableEndPoints& tep) const + { + // Use model's scaled maximum saturation if defined, otherwise fall + // back to table's unscaled maximum saturation. + + return defaultedScaledSaturation(this->smax_[cell], tep.high); + } }; std::vector @@ -150,8 +178,8 @@ Impl::eval(const TableEndPoints& tep, for (const auto& eval_pt : sp) { const auto cell = eval_pt.cell; - const auto sLO = this->smin_[cell]; - const auto sHI = this->smax_[cell]; + const auto sLO = this->sMin(cell, tep); + const auto sHI = this->sMax(cell, tep); if (! validSaturations({ sLO, sHI })) { this->handleInvalidEndpoint(eval_pt, effsat); @@ -195,8 +223,8 @@ Impl::reverse(const TableEndPoints& tep, for (const auto& eval_pt : sp) { const auto cell = eval_pt.cell; - const auto sLO = this->smin_[cell]; - const auto sHI = this->smax_[cell]; + const auto sLO = this->sMin(cell, tep); + const auto sHI = this->sMax(cell, tep); if (! validSaturations({ sLO, sHI })) { this->handleInvalidEndpoint(eval_pt, unscaledsat); @@ -293,6 +321,33 @@ class Opm::SatFunc::ThreePointScaling::Impl void handleInvalidEndpoint(const SaturationAssoc& sp, std::vector& effsat) const; + + double sMin(const std::vector::size_type cell, + const TableEndPoints& tep) const + { + // Use model's scaled connate saturation if defined, otherwise fall + // back to table's unscaled connate saturation. + + return defaultedScaledSaturation(this->smin_[cell], tep.low); + } + + double sDisp(const std::vector::size_type cell, + const TableEndPoints& tep) const + { + // Use model's scaled displacing saturation if defined, otherwise + // fall back to table's unscaled displacing saturation. + + return defaultedScaledSaturation(this->sdisp_[cell], tep.disp); + } + + double sMax(const std::vector::size_type cell, + const TableEndPoints& tep) const + { + // Use model's scaled maximum saturation if defined, otherwise fall + // back to table's unscaled maximum saturation. + + return defaultedScaledSaturation(this->smax_[cell], tep.high); + } }; std::vector @@ -306,9 +361,9 @@ Impl::eval(const TableEndPoints& tep, for (const auto& eval_pt : sp) { const auto cell = eval_pt.cell; - const auto sLO = this->smin_ [cell]; - const auto sR = this->sdisp_[cell]; - const auto sHI = this->smax_ [cell]; + const auto sLO = this->sMin (cell, tep); + const auto sR = this->sDisp(cell, tep); + const auto sHI = this->sMax (cell, tep); if (! validSaturations({ sLO, sR, sHI })) { this->handleInvalidEndpoint(eval_pt, effsat); @@ -355,9 +410,9 @@ Impl::reverse(const TableEndPoints& tep, for (const auto& eval_pt : sp) { const auto cell = eval_pt.cell; - const auto sLO = this->smin_ [cell]; - const auto sR = this->sdisp_[cell]; - const auto sHI = this->smax_ [cell]; + const auto sLO = this->sMin (cell, tep); + const auto sR = this->sDisp(cell, tep); + const auto sHI = this->sMax (cell, tep); if (! validSaturations({ sLO, sR, sHI })) { this->handleInvalidEndpoint(eval_pt, unscaledsat); @@ -678,7 +733,13 @@ Create::TwoPoint::Pc::GO(const ::Opm::ECLGraph& G, const ::Opm::ECLInitFileData& init, const InvBeh handle_invalid) { - auto sgl = G.rawLinearisedCellData(init, "SGL"); + // Try dedicated scaled Sg_conn for Pc first + auto sgl = G.rawLinearisedCellData(init, "SGLPC"); + if (sgl.empty()) { + // Fall back to general scaled Sg_conn if not available. + sgl = G.rawLinearisedCellData(init, "SGL"); + } + auto sgu = G.rawLinearisedCellData(init, "SGU"); if ((sgl.size() != sgu.size()) || @@ -702,7 +763,13 @@ Create::TwoPoint::Pc::OW(const ::Opm::ECLGraph& G, const ::Opm::ECLInitFileData& init, const InvBeh handle_invalid) { - auto swl = G.rawLinearisedCellData(init, "SWL"); + // Try dedicated scaled Sw_conn for Pc first + auto swl = G.rawLinearisedCellData(init, "SWLPC"); + if (swl.empty()) { + // Fall back to general scaled Sw_conn if not available. + swl = G.rawLinearisedCellData(init, "SWL"); + } + auto swu = G.rawLinearisedCellData(init, "SWU"); if ((swl.size() != swu.size()) || diff --git a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLFluxCalc.cpp b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLFluxCalc.cpp index 473635ce15..5550d376c3 100644 --- a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLFluxCalc.cpp +++ b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLFluxCalc.cpp @@ -20,7 +20,7 @@ #include #include #include - +#include #include #include @@ -221,6 +221,21 @@ namespace Opm } + std::vector + ECLFluxCalc::massflux(const ECLRestartData& rstrt, + const ECLPhaseIndex phase) const + { + // Obtain dynamic data. + const auto dyn_data = this->phaseProperties(rstrt, phase); + + // Compute fluxes per connection. + const int num_conn = transmissibility_.size(); + std::vector fluxvec(num_conn); + for (int conn = 0; conn < num_conn; ++conn) { + fluxvec[conn] = singleMassFlux(conn, dyn_data); + } + return fluxvec; + } @@ -251,7 +266,35 @@ namespace Opm return mob * T * dh; } + double ECLFluxCalc::singleMassFlux(const int connection, + const DynamicData& dyn_data) const + { + const int c1 = neighbours_[2*connection]; + const int c2 = neighbours_[2*connection + 1]; + // Phase pressure in connecting cells. + const auto p1 = dyn_data.pressure[c1]; + const auto p2 = dyn_data.pressure[c2]; + + // Phase density at interface: Arith. avg. of cell values. + const auto rho = + (dyn_data.density[c1] + dyn_data.density[c2]) / 2.0; + + // Phase potential drop across interface. + const auto dh = p1 - p2 + rho*this->gravDz_[connection]; + + // Phase mobility at interface: Upstream weighting (phase pot). + const auto ucell = (dh < 0.0) ? c2 : c1; + const auto mob = dyn_data.mobility[ucell]; + + // Background (static) transmissibility. + const auto T = this->transmissibility_[connection]; + + // Upstream weighted phase density. + const auto urho = dyn_data.density[ucell]; + + return urho * mob * T * dh; + } @@ -278,12 +321,39 @@ namespace Opm switch (phase) { case ECLPhaseIndex::Aqua: + dyn_data.saturation = this->graph_.rawLinearisedCellData(rstrt, "SWAT"); return this->watPVT(std::move(dyn_data)); case ECLPhaseIndex::Liquid: - return this->oilPVT(rstrt, std::move(dyn_data)); + dyn_data.saturation = this->graph_.rawLinearisedCellData(rstrt, "SOIL"); + if (!dyn_data.saturation.empty()) { + return this->oilPVT(rstrt, std::move(dyn_data)); + } else { + // SOIL vector not provided. Compute from SWAT and/or SGAS. + // may read two times + auto sw = this->graph_.rawLinearisedCellData(rstrt, "SWAT"); + auto sg = this->graph_.rawLinearisedCellData(rstrt, "SGAS"); + std::vector& so = dyn_data.saturation; + so.assign(this->graph_.numCells(), 1.0); + auto adjust_So_for_other_phase = + [&so](const std::vector& s) + { + std::transform(std::begin(so), std::end(so), + std::begin(s) , + std::begin(so), std::minus()); + }; + if (sg.size() == this->graph_.numCells()) { + adjust_So_for_other_phase(sg); + } + + if (sw.size() == this->graph_.numCells()) { + adjust_So_for_other_phase(sw); + } + return this->oilPVT(rstrt, std::move(dyn_data)); + } case ECLPhaseIndex::Vapour: + dyn_data.saturation = this->graph_.rawLinearisedCellData(rstrt, "SGAS"); return this->gasPVT(rstrt, std::move(dyn_data)); } @@ -292,7 +362,18 @@ namespace Opm }; } + double ECLFluxCalc::surfaceDensity(const ECLPhaseIndex phase) const{ + switch (phase) { + case ECLPhaseIndex::Aqua: + return this->pvtWat_->surfaceMassDensity(0); + case ECLPhaseIndex::Liquid: + return this->pvtOil_->surfaceMassDensity(0); + + case ECLPhaseIndex::Vapour: + return this->pvtGas_->surfaceMassDensity(0); + } + } diff --git a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLFluxCalc.hpp b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLFluxCalc.hpp index a229983dfe..341f91326a 100644 --- a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLFluxCalc.hpp +++ b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLFluxCalc.hpp @@ -33,6 +33,7 @@ namespace Opm { + class ECLRestartData; class ECLInitFileData; @@ -73,19 +74,62 @@ namespace Opm flux(const ECLRestartData& rstrt, const ECLPhaseIndex phase) const; - private: + /// Retrive phase mass flux on all connections defined by \code + /// graph.neighbours() \endcode. + /// + /// \param[in] rstrt ECL Restart data set from which to extract + /// relevant data per cell. + /// + /// \param[in] phase Canonical phase for which to retrive flux. + /// + /// \return Mass flux values corresponding to selected phase. + /// Empty if required data is missing. + /// Numerical values in SI units (kg/s). + std::vector + massflux(const ECLRestartData& rstrt, + const ECLPhaseIndex phase) const; + + /// Return type for the phaseProperties() method, + /// encapsulates dynamic properties for a single + /// phase. struct DynamicData { std::vector pressure; std::vector mobility; std::vector density; + std::vector saturation; }; + /// Retrive dynamical properties of a single phase on all cells. + /// + /// \param[in] rstrt ECL Restart data set from which to extract + /// relevant data per cell. + /// + /// \param[in] phase Canonical phase for which to retrive properties. + /// + /// \return DynamicData struct containing cell-values for phase properties. + /// Numerical values in SI units (kg/s). + DynamicData phaseProperties(const ECLRestartData& rstrt, + const ECLPhaseIndex phase) const; + + /// Retrive the constant surface density of a phase. + /// + /// \param[in] phase Canonical phase for which to retrive the surface density. + /// + /// \return Density of given phase at surface conditions. + /// Numerical value in SI units (kg/m^3). + double surfaceDensity(const ECLPhaseIndex phase) const; + + + private: + + double singleFlux(const int connection, const DynamicData& dyn_data) const; - DynamicData phaseProperties(const ECLRestartData& rstrt, - const ECLPhaseIndex phase) const; + double singleMassFlux(const int connection, + const DynamicData& dyn_data) const; + DynamicData gasPVT(const ECLRestartData& rstrt, DynamicData&& dyn_data) const; diff --git a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLGraph.cpp b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLGraph.cpp index f56f880c35..8783275b98 100644 --- a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLGraph.cpp +++ b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLGraph.cpp @@ -195,6 +195,8 @@ namespace { /// \endcode. const std::vector& neighbours() const; + const std::vector& getLocalCellID() const; + /// Retrive static pore-volume values on active cells only. /// /// Corresponds to the \c PORV vector in the INIT file, possibly @@ -349,6 +351,8 @@ namespace { std::size_t getGlobalCell(const int i, const int j, const int k) const; + const std::vector& getLocalCellID() const; + /// Retrieve active cell ID of particular global cell's /// neighbour in given Cartesian direction. /// @@ -872,6 +876,13 @@ CartesianCells::getGlobalCell(const int i, const int j, const int k) const return this->globIdx(ijk); } +const std::vector& +ECL::CartesianGridData:: +CartesianCells::getLocalCellID() const +{ + return this->active_ID_; +} + int ECL::CartesianGridData:: CartesianCells::getNeighbour(const std::size_t globalCell, @@ -1006,6 +1017,12 @@ ECL::CartesianGridData::neighbours() const return this->neigh_; } +const std::vector& +ECL::CartesianGridData::getLocalCellID() const +{ + return this->cells_.getLocalCellID(); +} + const std::vector& ECL::CartesianGridData::activePoreVolume() const { @@ -1292,6 +1309,8 @@ class Opm::ECLGraph::Impl /// \endcode. std::vector neighbours() const; + std::vector localCellID() const; + /// Retrieve static pore-volume values on active cells only. /// /// Corresponds to the \c PORV vector in the INIT file, possibly @@ -1372,6 +1391,12 @@ class Opm::ECLGraph::Impl const std::string& vector, UnitConvention unit) const; + + const ECLGeometryGrid& getGeometryGrid() const + { + return this->geomGrid_; + } + private: /// Collection of non-Cartesian neighbourship relations attributed to a /// particular ECL keyword set (i.e., one of NNC{1,2}, NNC{G,L}, NNCLL). @@ -1614,8 +1639,12 @@ class Opm::ECLGraph::Impl /// Set of active grids in result set. std::vector activeGrids_; + /// Map grid names to numeric grid IDs std::unordered_map gridID_; + /// Geometry for main grid. + ECLGeometryGrid geomGrid_; + /// Extract explicit non-neighbouring connections from ECL output. /// /// Writes to \c neigh_ and \c nncID_. @@ -1885,6 +1914,46 @@ Opm::ECLGraph::Impl::Impl(const boost::filesystem::path& grid, this->defineNNCs(G.get(), init); this->defineActivePhases(init); + + // Extract geometry of main grid. + { + // Size + { + this->geomGrid_.size[0] = ecl_grid_get_nx(G.get()); + this->geomGrid_.size[1] = ecl_grid_get_ny(G.get()); + this->geomGrid_.size[2] = ecl_grid_get_nz(G.get()); + } + + // COORD + { + const auto ncoord = + static_cast(ecl_grid_get_coord_size(G.get())); + this->geomGrid_.coord.resize(ncoord, 0.0); + + ecl_grid_init_coord_data_double(G.get(), this->geomGrid_.coord.data()); + } + + // ZCORN + { + const auto nzcorn = + static_cast(ecl_grid_get_zcorn_size(G.get())); + this->geomGrid_.zcorn.resize(nzcorn, 0.0); + + ecl_grid_init_zcorn_data_double(G.get(), this->geomGrid_.zcorn.data()); + } + + // ACTNUM + { + const auto nglob = + static_cast(this->geomGrid_.size[0]) * + static_cast(this->geomGrid_.size[1]) * + static_cast(this->geomGrid_.size[2]); + + this->geomGrid_.actnum.assign(nglob, 1); + + ecl_grid_init_actnum_data(G.get(), this->geomGrid_.actnum.data()); + } + } } int @@ -1983,6 +2052,28 @@ Opm::ECLGraph::Impl::neighbours() const return N; } +std::vector +Opm::ECLGraph::Impl::localCellID() const +{ + auto ret = std::vector{}; + ret.reserve(this->numCells()); + + auto off = this->activeOffset_.begin(); + for (const auto& G : this->grid_) { + for (const auto& loc : G.getLocalCellID()) { + const auto locID = (loc >= 0) + ? static_cast(*off) + loc + : -1; + + ret.push_back(locID); + } + + ++off; + } + + return ret; +} + std::vector Opm::ECLGraph::Impl::activePoreVolume() const { @@ -2322,6 +2413,11 @@ std::size_t Opm::ECLGraph::numConnections() const return this->pImpl_->numConnections(); } +std::vector Opm::ECLGraph::localCellID() const +{ + return this->pImpl_->localCellID(); +} + const std::vector& Opm::ECLGraph::activePhases() const { @@ -2393,3 +2489,9 @@ Opm::ECLGraph::linearisedCellData(const ECLRestartData& rstrt, { return this->pImpl_->linearisedCellData(rstrt, vector, unit); } + +const Opm::ECLGraph::ECLGeometryGrid& +Opm::ECLGraph::getGeometryGrid() const +{ + return this->pImpl_->getGeometryGrid(); +} diff --git a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLGraph.hpp b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLGraph.hpp index 4ad8bc7490..e8114d7127 100644 --- a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLGraph.hpp +++ b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLGraph.hpp @@ -119,6 +119,9 @@ namespace Opm { /// Retrieve number of connections in graph. std::size_t numConnections() const; + /// Retrieve active cell indices for all global cells in all grids. + std::vector localCellID() const; + /// Retrieve the simulation scenario's active phases. /// /// Mostly useful to determine the set of \c PhaseIndex values for @@ -211,6 +214,18 @@ namespace Opm { const std::string& vector, UnitConvention unit) const; + /// Raw grid data (geometric grid) for corner-point grids. + struct ECLGeometryGrid { + std::array size; + std::vector zcorn; + std::vector coord; + std::vector actnum; + }; + + /// Retrieve corner-point grid definition, + /// only for main grid in case of local grid refinement (LGR). + const ECLGeometryGrid& getGeometryGrid() const; + private: /// Implementation class. class Impl; diff --git a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLPvtGas.cpp b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLPvtGas.cpp index 77d5db5942..e84cba83b9 100644 --- a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLPvtGas.cpp +++ b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLPvtGas.cpp @@ -593,10 +593,34 @@ fromECLOutput(const ECLInitFileData& init) const auto& tabdims = init.keywordData("TABDIMS"); const auto& tab = init.keywordData("TAB"); - raw.numPrimary = tabdims[ TABDIMS_NRPVTG_ITEM ]; // #Composition nodes - raw.numRows = tabdims[ TABDIMS_NPPVTG_ITEM ]; // #Rv (or Pg) nodes - raw.numCols = 5; // [ Rv, 1/B, 1/(B*mu), d(1/B)/dRv, d(1/(B*mu))/dRv ] - raw.numTables = tabdims[ TABDIMS_NTPVTG_ITEM ]; // # PVTG tables + const auto numRv = tabdims[ TABDIMS_NRPVTG_ITEM ]; // #Composition (Rv) nodes + const auto numPg = tabdims[ TABDIMS_NPPVTG_ITEM ]; // #Pg nodes + + raw.numCols = 5; // [ x, 1/B, 1/(B*mu), d(1/B)/dx, d(1/(B*mu))/dx ] + raw.numTables = tabdims[ TABDIMS_NTPVTG_ITEM ]; // # PV{D,T}G tables + + const auto& lh = init.keywordData(LOGIHEAD_KW); + + if (lh[ LOGIHEAD_RV_INDEX ]) { + // Vaporised oil flag set => Wet Gas. + // + // Inner dimension (number of rows per sub-table) is number of + // composition nodes. Number of primary keys (outer dimension, + // number of sub-tables per PVTG table) is number of pressure nodes. + + raw.numPrimary = numPg; + raw.numRows = numRv; + } + else { + // Vaporised oil flag NOT set => Dry Gas. + // + // Inner dimension (number of rows per sub-table) is number of + // pressure nodes. Number of primary keys (outer dimension, number + // of sub-tables per PVDG table) is one. + + raw.numPrimary = 1; + raw.numRows = numPg; + } // Extract Primary Key (Pg) { diff --git a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLPvtOil.cpp b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLPvtOil.cpp index 5161784815..b572ccb35a 100644 --- a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLPvtOil.cpp +++ b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLPvtOil.cpp @@ -40,6 +40,48 @@ #include namespace { + std::function + fvf(const Opm::ECLUnits::UnitSystem& usys) + { + const auto scale = usys.reservoirVolume() + / usys.surfaceVolumeLiquid(); + + return [scale](const double x) -> double + { + return Opm::unit::convert::from(x, scale); + }; + } + + std::function + viscosity(const Opm::ECLUnits::UnitSystem& usys) + { + const auto scale = usys.viscosity(); + + return [scale](const double x) -> double + { + return Opm::unit::convert::from(x, scale); + }; + } + + ::Opm::ECLPVT::ConvertUnits pvcdoUnitConverter(const int usys) + { + using ToSI = ::Opm::ECLPVT::CreateUnitConverter::ToSI; + + const auto u = ::Opm::ECLUnits::createUnitSystem(usys); + + // [ Pref, Bo, Co, mu_o, Cv ] + + return ::Opm::ECLPVT::ConvertUnits { + ToSI::pressure(*u), + { + fvf(*u), + ToSI::compressibility(*u), + viscosity(*u), + ToSI::compressibility(*u) + } + }; + } + ::Opm::ECLPVT::ConvertUnits deadOilUnitConverter(const ::Opm::ECLUnits::UnitSystem& usys) { @@ -101,6 +143,142 @@ class PVxOBase virtual std::unique_ptr clone() const = 0; }; +// ===================================================================== + +class DeadOilConstCompr : public PVxOBase +{ +public: + using ElemIt = std::vector::const_iterator; + using ConvertUnits = ::Opm::ECLPVT::ConvertUnits; + + DeadOilConstCompr(ElemIt xBegin, + ElemIt xEnd, + const ConvertUnits& convert, + std::vector& colIt); + + virtual std::vector + formationVolumeFactor(const std::vector& /* rs */, + const std::vector& po) const + { + return this->evaluate(po, [this](const double p) -> double + { + // 1 / (1 / B) + return 1.0 / this->recipFvf(p); + }); + } + + virtual std::vector + viscosity(const std::vector& /*rs*/, + const std::vector& po) const + { + return this->evaluate(po, [this](const double p) -> double + { + // (1 / B) / (1 / (B * mu)) + return this->recipFvf(p) / this->recipFvfVisc(p); + }); + } + + virtual std::vector + getPvtCurve(const Opm::ECLPVT::RawCurve /*curve*/) const + { + return {}; + } + + virtual std::unique_ptr clone() const + { + return std::unique_ptr(new DeadOilConstCompr(*this)); + } + + double& surfaceMassDensity() + { + return this->rhoS_; + } + + double surfaceMassDensity() const + { + return this->rhoS_; + } + +private: + double po_ref_ { 1.0 }; + double fvf_ { 1.0 }; // B + double visc_ { 1.0 }; // mu + double Co_ { 1.0 }; + double cv_ { 0.0 }; // Cv + double rhoS_ { 0.0 }; + + double recipFvf(const double po) const + { + const auto x = this->Co_ * (po - this->po_ref_); + + return this->exp(x) / this->fvf_ ; + } + + double recipFvfVisc(const double po) const + { + const auto y = (this->Co_ - this->cv_) * (po - this->po_ref_); + + return this->exp(y) / (this->fvf_ * this->visc_); + } + + double exp(const double x) const + { + return 1.0 + x*(1.0 + x/2.0); + } + + template + std::vector + evaluate(const std::vector& po, + CalcQuant&& calculate) const + { + auto q = std::vector{}; + q.reserve(po.size()); + + for (const auto& poi : po) { + q.push_back(calculate(poi)); + } + + return q; + } +}; + +DeadOilConstCompr::DeadOilConstCompr(ElemIt xBegin, + ElemIt xEnd, + const ConvertUnits& convert, + std::vector& colIt) +{ + // Recall: Table is + // + // [ Po, Bo, Co, mu_o, Cv ] + // + // xBegin is Pw, colIt is remaining four columns. + + this->fvf_ = convert.column[0](*colIt[0]); // Bo + this->Co_ = convert.column[1](*colIt[1]); // Co + this->visc_ = convert.column[2](*colIt[2]); // mu_o + this->cv_ = convert.column[3](*colIt[3]); // Cw - Cv + + // Honour requirement that constructor advances column iterators. + const auto N = std::distance(xBegin, xEnd); + for (auto& it : colIt) { it += N; } + + if (! (std::abs(*xBegin) < 1.0e20)) { + throw std::invalid_argument { + "Invalid Input PVCDO Table" + }; + } + + this->po_ref_ = convert.indep(*xBegin); + + ++xBegin; + if (std::abs(*xBegin) < 1.0e20) { + throw std::invalid_argument { + "Probably Invalid Input PVCDO Table" + }; + } +} + + // ===================================================================== class DeadOil : public PVxOBase @@ -227,6 +405,7 @@ class LiveOil : public PVxOBase namespace { std::vector> createDeadOil(const ::Opm::ECLPropTableRawData& raw, + const bool const_compr, const int usys) { using PVTInterp = std::unique_ptr; @@ -235,6 +414,16 @@ namespace { assert ((raw.numPrimary == 1) && "Can't Create Dead Oil Function From Live Oil Table"); + if (const_compr) { + const auto cvrt = pvcdoUnitConverter(usys); + + return ::Opm::MakeInterpolants::fromRawData(raw, + [&cvrt](ElmIt xBegin, ElmIt xEnd, std::vector& colIt) + { + return PVTInterp{ new DeadOilConstCompr(xBegin, xEnd, cvrt, colIt) }; + }); + } + const auto cvrt = deadOilUnitConverter(usys); return ::Opm::MakeInterpolants::fromRawData(raw, @@ -313,6 +502,7 @@ namespace { std::vector> createPVTFunction(const ::Opm::ECLPropTableRawData& raw, + const bool const_compr, const int usys) { if (raw.numPrimary == 0) { @@ -344,7 +534,7 @@ namespace { } if (raw.numPrimary == 1) { - return createDeadOil(raw, usys); + return createDeadOil(raw, const_compr, usys); } return createLiveOil(raw, usys); @@ -379,6 +569,7 @@ class Opm::ECLPVT::Oil::Impl public: Impl(const ECLPropTableRawData& raw, const int usys, + const bool const_compr, std::vector rhoS); Impl(const Impl& rhs); @@ -420,8 +611,9 @@ class Opm::ECLPVT::Oil::Impl Opm::ECLPVT::Oil::Impl:: Impl(const ECLPropTableRawData& raw, const int usys, + const bool const_compr, std::vector rhoS) - : eval_(createPVTFunction(raw, usys)) + : eval_(createPVTFunction(raw, const_compr, usys)) , rhoS_(std::move(rhoS)) {} @@ -504,8 +696,9 @@ Opm::ECLPVT::Oil::Impl::validateRegIdx(const RegIdx region) const Opm::ECLPVT::Oil::Oil(const ECLPropTableRawData& raw, const int usys, + const bool const_compr, std::vector rhoS) - : pImpl_(new Impl(raw, usys, std::move(rhoS))) + : pImpl_(new Impl(raw, usys, const_compr, std::move(rhoS))) {} Opm::ECLPVT::Oil::~Oil() @@ -583,15 +776,39 @@ fromECLOutput(const ECLInitFileData& init) return OPtr{}; } + const auto& lh = init.keywordData(LOGIHEAD_KW); + const int LOGIHEAD_CONST_COMPR_INDEX = 38; + const bool is_const_compr = lh[LOGIHEAD_CONST_COMPR_INDEX]; + auto raw = ::Opm::ECLPropTableRawData{}; const auto& tabdims = init.keywordData("TABDIMS"); const auto& tab = init.keywordData("TAB"); - raw.numPrimary = tabdims[ TABDIMS_NRPVTO_ITEM ]; // #Rs nodes/full table - raw.numRows = tabdims[ TABDIMS_NPPVTO_ITEM ]; // #Po nodes/sub-table - raw.numCols = 5; // [ Po, 1/B, 1/(B*mu), d(1/B)/dPo, d(1/(B*mu))/dPo ] - raw.numTables = tabdims[ TABDIMS_NTPVTO_ITEM ]; // # PVTO tables + const auto numRs = tabdims[ TABDIMS_NRPVTO_ITEM ]; // #Rs nodes/full table + + // Inner dimension (number of rows per sub-table) is number of pressure + // nodes for both live oil and dead oil cases. + raw.numRows = tabdims[ TABDIMS_NPPVTO_ITEM ]; // #Po nodes/sub-table + raw.numCols = 5; // [ Po, 1/B, 1/(B*mu), d(1/B)/dPo, d(1/(B*mu))/dPo ] + raw.numTables = tabdims[ TABDIMS_NTPVTO_ITEM ]; // # PVTO tables + + if (lh[ LOGIHEAD_RS_INDEX ]) { + // Dissolved gas flag set => Live Oil. + // + // Number of primary keys (outer dimension, number of sub-tables per + // PVTO table) is number of composition nodes. + + raw.numPrimary = numRs; + } + else { + // Dissolved gas flag NOT set => Dead Oil. + // + // Number of primary keys (outer dimension, number of sub-tables per + // PVDO table) is one. + + raw.numPrimary = 1; + } // Extract Primary Key (Rs) { @@ -617,6 +834,6 @@ fromECLOutput(const ECLInitFileData& init) auto rhoS = surfaceMassDensity(init, ECLPhaseIndex::Liquid); return OPtr{ - new Oil(raw, ih[ INTEHEAD_UNIT_INDEX ], std::move(rhoS)) + new Oil(raw, ih[ INTEHEAD_UNIT_INDEX ], is_const_compr, std::move(rhoS)) }; } diff --git a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLPvtOil.hpp b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLPvtOil.hpp index 78235de9b0..da8adf52b2 100644 --- a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLPvtOil.hpp +++ b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLPvtOil.hpp @@ -40,8 +40,10 @@ namespace Opm { namespace ECLPVT { public: /// Constructor. /// - /// \param[in] raw Raw tabulated data. Must correspond to the PVTO - /// vector of an ECL INIT file.. + /// \param[in] raw Raw tabulated data. Must correspond to either + /// the PVTO vector of an ECL INIT file (tabulated live oil), + /// to PVDO data (tabulated dead oil) or to PVCDO data (constant + /// compressibility dead oil). /// /// \param[in] usys Unit system convention of the result set from /// which \p raw was extracted. Must correspond to item 3 of the @@ -52,6 +54,7 @@ namespace Opm { namespace ECLPVT { /// \endcode. Oil(const ECLPropTableRawData& raw, const int usys, + const bool const_compr, std::vector rhoS); /// Destructor. diff --git a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLWellSolution.cpp b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLWellSolution.cpp index 73eff37197..78a477fddd 100644 --- a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLWellSolution.cpp +++ b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLWellSolution.cpp @@ -112,9 +112,22 @@ namespace Opm return ECLUnits::createUnitSystem(unit_code)->reservoirRate(); } + double surfaceRateGasUnit(const int unit_code) + { + return ( ECLUnits::createUnitSystem(unit_code)->surfaceVolumeGas() )/ + ( ECLUnits::createUnitSystem(unit_code)->time() ); + } + double pressureUnit(const int unit_code) + { + return ECLUnits::createUnitSystem(unit_code)->pressure(); + } - + double surfaceRateLiquidUnit(const int unit_code) + { + return ( ECLUnits::createUnitSystem(unit_code)->surfaceVolumeLiquid() )/ + ( ECLUnits::createUnitSystem(unit_code)->time() ); + } // Return input string with spaces stripped of the right end. std::string trimSpacesRight(const std::string& s) { @@ -187,6 +200,9 @@ namespace Opm return {}; } const double qr_unit = resRateUnit(ih.unit); + const double qGs_unit = surfaceRateGasUnit(ih.unit); + const double qLs_unit = surfaceRateLiquidUnit(ih.unit); + const double pressure_unit = pressureUnit(ih.unit); // Load well topology and flow rates. auto zwel = restart.keywordData(ZWEL_KW, gridName); @@ -214,6 +230,16 @@ namespace Opm } // Otherwise: add data for this well. WellData wd; + // add well rates + int xwel_offset = well * ih.nxwel; + wd.qOs = -unit::convert::from(xwel[ 0 + xwel_offset], qLs_unit); + wd.qWs = -unit::convert::from(xwel[ 1 + xwel_offset], qLs_unit); + wd.qGs = -unit::convert::from(xwel[ 2 + xwel_offset], qGs_unit); + wd.lrat = -unit::convert::from(xwel[ 3 + xwel_offset], qLs_unit); + wd.qr = -unit::convert::from(xwel[ 4 + xwel_offset], qr_unit); + wd.bhp = unit::convert::from(xwel[ 6 + xwel_offset], pressure_unit); + + wd.name = trimSpacesRight(zwel[well * ih.nzwel]); const bool is_producer = (iwel[well * ih.niwel + IWEL_TYPE_INDEX] == IWEL_TYPE_PRODUCER); wd.is_injector_well = !is_producer; @@ -229,6 +255,9 @@ namespace Opm icon[icon_offset + ICON_K_INDEX] - 1 }; // Note: taking the negative input, to get inflow rate. completion.reservoir_inflow_rate = -unit::convert::from(xcon[xcon_offset + XCON_QR_INDEX], qr_unit); + completion.qOs = -unit::convert::from(xcon[xcon_offset + 0 ], qLs_unit); + completion.qWs = -unit::convert::from(xcon[xcon_offset + 1] , qLs_unit); + completion.qGs = -unit::convert::from(xcon[xcon_offset + 2 ], qGs_unit); if (disallow_crossflow_) { // Add completion only if not cross-flowing (injecting producer or producing injector). if ((completion.reservoir_inflow_rate < 0.0) == is_producer) { diff --git a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLWellSolution.hpp b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLWellSolution.hpp index 94e24c65ec..25f584d29c 100644 --- a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLWellSolution.hpp +++ b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLWellSolution.hpp @@ -45,11 +45,23 @@ namespace Opm { std::string name; bool is_injector_well; + + double qOs; // Well oil surface volume rate. + double qWs; // Well water surface volume rate. + double qGs; // Well gas surface volume rate. + double lrat; // Well liquid (oil + water) surface volume rate. + double bhp; // Well bottom hole pressure. + double qr; // Well total reservoir volume rate. + struct Completion { - std::string gridName; // empty for main grid, otherwise LGR grid. + std::string gridName; // Empty for main grid, otherwise LGR grid. std::array ijk; // Cartesian location in grid. - double reservoir_inflow_rate; // Total fluid rate in SI (m^3/s). + double reservoir_inflow_rate; // Total reservoir volume fluid rate in SI (m^3/s). + double qOs; // Completion oil surface volute rate. + double qWs; // Completion water surface volute rate. + double qGs; // Completion gas surface volute rate. + }; std::vector completions; }; From 08a46c23073563e0595411e021c7a7f778be09b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Wed, 24 Jan 2018 16:53:41 +0100 Subject: [PATCH 22/78] Upped to version 2018.01.00-patch.03 --- ResInsightVersion.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index de0ecb0061..a68a1dac23 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -4,13 +4,13 @@ set(RESINSIGHT_MINOR_VERSION 01) set(RESINSIGHT_PATCH_VERSION 00) # Opional text with no restrictions -set(RESINSIGHT_VERSION_TEXT "-dev") +set(RESINSIGHT_VERSION_TEXT "-patch") # Optional text # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -set(RESINSIGHT_DEV_VERSION ".01") +set(RESINSIGHT_DEV_VERSION ".03") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") From ab729816816869fe303d95b3e5e148e06384f8a3 Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Thu, 25 Jan 2018 11:59:43 +0100 Subject: [PATCH 23/78] #2328 Give warning when user tries to calculate injection flooding without available fluxes --- .../ProjectDataModel/RimEclipseCellColors.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp b/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp index 0e30d696a6..d377a51c32 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp @@ -40,6 +40,8 @@ #include "cafPdmUiTreeOrdering.h" +#include "QMessageBox" + CAF_PDM_SOURCE_INIT(RimEclipseCellColors, "ResultSlot"); //-------------------------------------------------------------------------------------------------- @@ -275,6 +277,22 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep) { if (this->isFlowDiagOrInjectionFlooding()) { + RimEclipseCase* rimEclipseCase = nullptr; + this->firstAncestorOrThisOfType(rimEclipseCase); + CVF_ASSERT(rimEclipseCase); + if (!rimEclipseCase) return; + + RigEclipseCaseData* eclipseCase = rimEclipseCase->eclipseCaseData(); + CVF_ASSERT(eclipseCase); + if (!eclipseCase) return; + RigCaseCellResultsData* cellResultsData = eclipseCase->results(this->porosityModel()); + + if (!cellResultsData->hasFlowDiagUsableFluxes()) + { + QMessageBox::warning(RiuMainWindow::instance(), "Injection Flooding", "Cannot calculate any injection flooding properties, since no fluxes are available"); + return; + } + double globalMin, globalMax; double globalPosClosestToZero, globalNegClosestToZero; RigFlowDiagResults* flowResultsData = this->flowDiagSolution()->flowDiagResults(); From 64731fb24266200e288045aabce1783cb57c938f Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Thu, 25 Jan 2018 12:00:48 +0100 Subject: [PATCH 24/78] Change "QMessageBox" to --- ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp b/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp index d377a51c32..891798e060 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp @@ -40,7 +40,7 @@ #include "cafPdmUiTreeOrdering.h" -#include "QMessageBox" +#include CAF_PDM_SOURCE_INIT(RimEclipseCellColors, "ResultSlot"); From 3a1c6406ffa746b1d764094fc11eabe81d995b66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Thu, 25 Jan 2018 14:53:51 +0100 Subject: [PATCH 25/78] #2406 delete plot crash. Guard pointer to view --- ApplicationCode/UserInterface/RiuMainPlotWindow.cpp | 2 +- ApplicationCode/UserInterface/RiuMainPlotWindow.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ApplicationCode/UserInterface/RiuMainPlotWindow.cpp b/ApplicationCode/UserInterface/RiuMainPlotWindow.cpp index 747c1ad3b5..190e2b0868 100644 --- a/ApplicationCode/UserInterface/RiuMainPlotWindow.cpp +++ b/ApplicationCode/UserInterface/RiuMainPlotWindow.cpp @@ -422,7 +422,7 @@ void RiuMainPlotWindow::addToTemporaryWidgets(QWidget* widget) //-------------------------------------------------------------------------------------------------- void RiuMainPlotWindow::updateSummaryPlotToolBar() { - RimSummaryPlot* summaryPlot = dynamic_cast(m_activePlotViewWindow); + RimSummaryPlot* summaryPlot = dynamic_cast(m_activePlotViewWindow.p()); if (summaryPlot) { std::vector toolBarFields; diff --git a/ApplicationCode/UserInterface/RiuMainPlotWindow.h b/ApplicationCode/UserInterface/RiuMainPlotWindow.h index 697a0f7fc7..214df5ef2c 100644 --- a/ApplicationCode/UserInterface/RiuMainPlotWindow.h +++ b/ApplicationCode/UserInterface/RiuMainPlotWindow.h @@ -21,6 +21,7 @@ #include "RiuMainWindowBase.h" #include "cafPdmUiDragDropInterface.h" +#include "cafPdmPointer.h" #include @@ -116,7 +117,7 @@ private slots: QByteArray m_initialDockAndToolbarLayout; // Initial dock window and toolbar layout, used to reset GUI QMdiArea* m_mdiArea; - RimViewWindow* m_activePlotViewWindow; + caf::PdmPointer m_activePlotViewWindow; QMenu* m_windowMenu; From 5273ace5e68ea0d9b647102ee24ad1942dbd3a0b Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Thu, 25 Jan 2018 17:04:20 +0100 Subject: [PATCH 26/78] #2301 Rel.perm Plot: Add tooltip for cell value --- .../RiuRelativePermeabilityPlotPanel.cpp | 94 ++++++++++++++-- .../RiuRelativePermeabilityPlotPanel.h | 103 +++++++++++------- 2 files changed, 147 insertions(+), 50 deletions(-) diff --git a/ApplicationCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp b/ApplicationCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp index 0e5ef06448..4ed965093d 100644 --- a/ApplicationCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp +++ b/ApplicationCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp @@ -169,7 +169,12 @@ void RiuRelativePermeabilityPlotPanel::setPlotDefaults(QwtPlot* plot) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuRelativePermeabilityPlotPanel::setPlotData(RiaEclipseUnitTools::UnitSystem unitSystem, const std::vector& relPermCurves, double swat, double sgas, QString caseName, QString cellReferenceText) +void RiuRelativePermeabilityPlotPanel::setPlotData(RiaEclipseUnitTools::UnitSystem unitSystem, + const std::vector& relPermCurves, + double swat, + double sgas, + QString caseName, + QString cellReferenceText) { //cvf::Trace::show("Set RelPerm plot data"); @@ -224,10 +229,59 @@ void RiuRelativePermeabilityPlotPanel::plotUiSelectedCurves() plotCurvesInQwt(m_unitSystem, selectedCurves, m_swat, m_sgas, m_cellReferenceText, useLogScale, m_qwtPlot, &m_myPlotMarkers); } +//-------------------------------------------------------------------------------------------------- +/// Add a transparent curve to make tooltip available on given points. +//-------------------------------------------------------------------------------------------------- +void RiuRelativePermeabilityPlotPanel::addTransparentCurve(QwtPlot* plot, const std::vector& points, const std::vector& axes) +{ + QwtPlotCurve* curveLeftAxis = new QwtPlotCurve(); + QwtPlotCurve* curveRightAxis = new QwtPlotCurve(); + + QVector pointsOnLeftAxis; + QVector pointsOnRightAxis; + + // Each point is defined by either left or right axis + CVF_ASSERT(points.size() == axes.size()); + + for (size_t i = 0; i < points.size(); i++) + { + if (axes[i] == LEFT_YAXIS) + { + pointsOnLeftAxis.push_back(points[i]); + } + else + { + pointsOnRightAxis.push_back(points[i]); + } + } + + curveLeftAxis->setSamples(pointsOnLeftAxis); + curveRightAxis->setSamples(pointsOnRightAxis); + + curveLeftAxis->setYAxis(QwtPlot::yLeft); + curveRightAxis->setYAxis(QwtPlot::yRight); + + curveLeftAxis->setStyle(QwtPlotCurve::NoCurve); + curveRightAxis->setStyle(QwtPlotCurve::NoCurve); + + curveLeftAxis->setLegendAttribute(QwtPlotCurve::LegendNoAttribute); + curveRightAxis->setLegendAttribute(QwtPlotCurve::LegendNoAttribute); + + curveLeftAxis->attach(plot); + curveRightAxis->attach(plot); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt(RiaEclipseUnitTools::UnitSystem unitSystem, const std::vector& curveArr, double swat, double sgas, QString cellReferenceText, bool logScaleLeftAxis, QwtPlot* plot, std::vector* myPlotMarkers) +void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt(RiaEclipseUnitTools::UnitSystem unitSystem, + const std::vector& curveArr, + double swat, + double sgas, + QString cellReferenceText, + bool logScaleLeftAxis, + QwtPlot* plot, + std::vector* myPlotMarkers) { plot->detachItems(QwtPlotItem::Rtti_PlotCurve); @@ -240,7 +294,9 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt(RiaEclipseUnitTools::Unit delete marker; } myPlotMarkers->clear(); - + + std::vector points; + std::vector axes; bool shouldEnableRightYAxis = false; @@ -255,7 +311,6 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt(RiaEclipseUnitTools::Unit plotOnWhichYAxis = RIGHT_YAXIS; } - //QwtPlotCurve* qwtCurve = new QwtPlotCurve(curve.name.c_str()); RiuLineSegmentQwtPlotCurve* qwtCurve = new RiuLineSegmentQwtPlotCurve(curve.name.c_str()); @@ -303,7 +358,6 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt(RiaEclipseUnitTools::Unit qwtCurve->attach(plot); - // Add markers to indicate where SWAT and/or SGAS saturation intersects the respective curves // Note that if we're using log scale we must guard against non-positive values if (swat != HUGE_VAL) @@ -312,7 +366,7 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt(RiaEclipseUnitTools::Unit curve.ident == RigFlowDiagSolverInterface::RelPermCurve::KROW || curve.ident == RigFlowDiagSolverInterface::RelPermCurve::PCOW) { - addCurveConstSaturationIntersectionMarker(curve, swat, Qt::blue, plotOnWhichYAxis, plot, myPlotMarkers); + addCurveConstSaturationIntersectionMarker(curve, swat, Qt::blue, plotOnWhichYAxis, plot, myPlotMarkers, &points, &axes); } } if (sgas != HUGE_VAL) @@ -321,11 +375,14 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt(RiaEclipseUnitTools::Unit curve.ident == RigFlowDiagSolverInterface::RelPermCurve::KROG || curve.ident == RigFlowDiagSolverInterface::RelPermCurve::PCOG) { - addCurveConstSaturationIntersectionMarker(curve, sgas, Qt::red, plotOnWhichYAxis, plot, myPlotMarkers); + addCurveConstSaturationIntersectionMarker(curve, sgas, Qt::red, plotOnWhichYAxis, plot, myPlotMarkers, &points, &axes); } } } + plot->enableAxis(QwtPlot::yRight, shouldEnableRightYAxis); + + addTransparentCurve(plot, points, axes); // Add vertical marker lines to indicate cell SWAT and/or SGAS saturations if (swat != HUGE_VAL) @@ -367,8 +424,6 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt(RiaEclipseUnitTools::Unit plot->setAxisTitle(QwtPlot::yLeft, "Kr"); plot->setAxisTitle(QwtPlot::yRight, QString("Pc [%1]").arg(RiaEclipseUnitTools::unitStringPressure(unitSystem))); - plot->enableAxis(QwtPlot::yRight, shouldEnableRightYAxis); - plot->replot(); } @@ -408,7 +463,11 @@ QString RiuRelativePermeabilityPlotPanel::determineXAxisTitleFromCurveCollection //-------------------------------------------------------------------------------------------------- /// Add a vertical labeled marker line at the specified saturation value //-------------------------------------------------------------------------------------------------- -void RiuRelativePermeabilityPlotPanel::addVerticalSaturationMarkerLine(double saturationValue, QString label, QColor color, QwtPlot* plot, std::vector* myPlotMarkers) +void RiuRelativePermeabilityPlotPanel::addVerticalSaturationMarkerLine(double saturationValue, + QString label, + QColor color, + QwtPlot* plot, + std::vector* myPlotMarkers) { QwtPlotMarker* lineMarker = new QwtPlotMarker; lineMarker->setXValue(saturationValue); @@ -425,7 +484,14 @@ void RiuRelativePermeabilityPlotPanel::addVerticalSaturationMarkerLine(double sa //-------------------------------------------------------------------------------------------------- /// Add a marker at the intersection of the passed curve and the constant saturation value //-------------------------------------------------------------------------------------------------- -void RiuRelativePermeabilityPlotPanel::addCurveConstSaturationIntersectionMarker(const RigFlowDiagSolverInterface::RelPermCurve& curve, double saturationValue, QColor markerColor, WhichYAxis whichYAxis, QwtPlot* plot, std::vector* myPlotMarkers) +void RiuRelativePermeabilityPlotPanel::addCurveConstSaturationIntersectionMarker(const RigFlowDiagSolverInterface::RelPermCurve& curve, + double saturationValue, + QColor markerColor, + WhichYAxis whichYAxis, + QwtPlot* plot, + std::vector* myPlotMarkers, + std::vector* points, + std::vector* axes) { const double yVal = interpolatedCurveYValue(curve.saturationVals, curve.yVals, saturationValue); if (yVal != HUGE_VAL) @@ -446,6 +512,8 @@ void RiuRelativePermeabilityPlotPanel::addCurveConstSaturationIntersectionMarker } myPlotMarkers->push_back(pointMarker); + axes->push_back(whichYAxis); + points->push_back(QPointF(saturationValue, yVal)); } } @@ -497,7 +565,9 @@ std::vector RiuRelativePermeabilityPlo std::vector selectedCurves; // Determine which curves to actually plot based on selection in GUI - const RigFlowDiagSolverInterface::RelPermCurve::EpsMode epsModeToShow = m_showUnscaledCheckBox->isChecked() ? RigFlowDiagSolverInterface::RelPermCurve::EPS_OFF : RigFlowDiagSolverInterface::RelPermCurve::EPS_ON; + const RigFlowDiagSolverInterface::RelPermCurve::EpsMode epsModeToShow = m_showUnscaledCheckBox->isChecked() ? + RigFlowDiagSolverInterface::RelPermCurve::EPS_OFF : + RigFlowDiagSolverInterface::RelPermCurve::EPS_ON; for (size_t i = 0; i < m_allCurvesArr.size(); i++) { diff --git a/ApplicationCode/UserInterface/RiuRelativePermeabilityPlotPanel.h b/ApplicationCode/UserInterface/RiuRelativePermeabilityPlotPanel.h index 6dd085b499..b3bbd6e759 100644 --- a/ApplicationCode/UserInterface/RiuRelativePermeabilityPlotPanel.h +++ b/ApplicationCode/UserInterface/RiuRelativePermeabilityPlotPanel.h @@ -1,25 +1,25 @@ ///////////////////////////////////////////////////////////////////////////////// // // 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 +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// #pragma once -#include "RigFlowDiagSolverInterface.h" #include "RiaEclipseUnitTools.h" +#include "RigFlowDiagSolverInterface.h" #include @@ -31,8 +31,7 @@ class QButtonGroup; class QCheckBox; class QwtPlot; class QwtPlotMarker; - - +class QPointF; //================================================================================================== // @@ -46,8 +45,13 @@ class RiuRelativePermeabilityPlotPanel : public QWidget public: RiuRelativePermeabilityPlotPanel(QDockWidget* parent); virtual ~RiuRelativePermeabilityPlotPanel(); - - void setPlotData(RiaEclipseUnitTools::UnitSystem unitSystem, const std::vector& relPermCurves, double swat, double sgas, QString caseName, QString cellReferenceText); + + void setPlotData(RiaEclipseUnitTools::UnitSystem unitSystem, + const std::vector& relPermCurves, + double swat, + double sgas, + QString caseName, + QString cellReferenceText); void clearPlot(); RiuRelativePermeabilityPlotUpdater* plotUpdater(); @@ -69,38 +73,61 @@ class RiuRelativePermeabilityPlotPanel : public QWidget double max; }; - void plotUiSelectedCurves(); - static void setPlotDefaults(QwtPlot* plot); - static void plotCurvesInQwt(RiaEclipseUnitTools::UnitSystem unitSystem, const std::vector& curveArr, double swat, double sgas, QString cellReferenceText, bool logScaleLeftAxis, QwtPlot* plot, std::vector* myPlotMarkers); - static QString determineXAxisTitleFromCurveCollection(const std::vector& curveArr); - static void addVerticalSaturationMarkerLine(double saturationValue, QString label, QColor color, QwtPlot* plot, std::vector* myPlotMarkers); - static void addCurveConstSaturationIntersectionMarker(const RigFlowDiagSolverInterface::RelPermCurve& curve, double saturationValue, QColor markerColor, WhichYAxis whichYAxis, QwtPlot* plot, std::vector* myPlotMarkers); - static double interpolatedCurveYValue(const std::vector& xVals, const std::vector& yVals, double x); - - std::vector gatherUiSelectedCurves() const; - QString asciiDataForUiSelectedCurves() const; + void plotUiSelectedCurves(); + static void setPlotDefaults(QwtPlot* plot); + static void plotCurvesInQwt(RiaEclipseUnitTools::UnitSystem unitSystem, + const std::vector& curveArr, + double swat, + double sgas, + QString cellReferenceText, + bool logScaleLeftAxis, + QwtPlot* plot, + std::vector* myPlotMarkers); - virtual void contextMenuEvent(QContextMenuEvent* event) override; + static QString determineXAxisTitleFromCurveCollection(const std::vector& curveArr); + + static void addVerticalSaturationMarkerLine(double saturationValue, + QString label, + QColor color, + QwtPlot* plot, + std::vector* myPlotMarkers); + + static void addCurveConstSaturationIntersectionMarker(const RigFlowDiagSolverInterface::RelPermCurve& curve, + double saturationValue, + QColor markerColor, + WhichYAxis whichYAxis, + QwtPlot* plot, + std::vector* myPlotMarkers, + std::vector* points, + std::vector* axes); + + static double interpolatedCurveYValue(const std::vector& xVals, const std::vector& yVals, double x); + + static void addTransparentCurve(QwtPlot* plot, const std::vector& points, const std::vector& axes); + + std::vector gatherUiSelectedCurves() const; + QString asciiDataForUiSelectedCurves() const; + + virtual void contextMenuEvent(QContextMenuEvent* event) override; private slots: - void slotButtonInButtonGroupClicked(int); - void slotSomeCheckBoxStateChanged(int); - void slotCurrentPlotDataInTextDialog(); + void slotButtonInButtonGroupClicked(int); + void slotSomeCheckBoxStateChanged(int); + void slotCurrentPlotDataInTextDialog(); private: - RiaEclipseUnitTools::UnitSystem m_unitSystem; - std::vector m_allCurvesArr; - double m_swat; - double m_sgas; - QString m_caseName; - QString m_cellReferenceText; - QwtPlot* m_qwtPlot; - std::vector m_myPlotMarkers; - - QButtonGroup* m_selectedCurvesButtonGroup; - QCheckBox* m_showUnscaledCheckBox; - QCheckBox* m_logarithmicScaleKrAxisCheckBox; - - std::unique_ptr m_plotUpdater; + RiaEclipseUnitTools::UnitSystem m_unitSystem; + std::vector m_allCurvesArr; + double m_swat; + double m_sgas; + QString m_caseName; + QString m_cellReferenceText; + QwtPlot* m_qwtPlot; + std::vector m_myPlotMarkers; + + QButtonGroup* m_selectedCurvesButtonGroup; + QCheckBox* m_showUnscaledCheckBox; + QCheckBox* m_logarithmicScaleKrAxisCheckBox; + + std::unique_ptr m_plotUpdater; }; - From 83ed95a311a5be9aeb8b7d2ae22522721aeacf80 Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Thu, 25 Jan 2018 18:24:12 +0100 Subject: [PATCH 27/78] #2328 Water flooded PV: Remove warning. Remove injection flooding option if no fluxes are available --- .../ProjectDataModel/RimEclipseCellColors.cpp | 16 ---------------- .../RimEclipseResultDefinition.cpp | 8 +++++++- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp b/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp index 891798e060..db6bf8bf95 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp @@ -277,22 +277,6 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep) { if (this->isFlowDiagOrInjectionFlooding()) { - RimEclipseCase* rimEclipseCase = nullptr; - this->firstAncestorOrThisOfType(rimEclipseCase); - CVF_ASSERT(rimEclipseCase); - if (!rimEclipseCase) return; - - RigEclipseCaseData* eclipseCase = rimEclipseCase->eclipseCaseData(); - CVF_ASSERT(eclipseCase); - if (!eclipseCase) return; - RigCaseCellResultsData* cellResultsData = eclipseCase->results(this->porosityModel()); - - if (!cellResultsData->hasFlowDiagUsableFluxes()) - { - QMessageBox::warning(RiuMainWindow::instance(), "Injection Flooding", "Cannot calculate any injection flooding properties, since no fluxes are available"); - return; - } - double globalMin, globalMax; double globalPosClosestToZero, globalNegClosestToZero; RigFlowDiagResults* flowResultsData = this->flowDiagSolution()->flowDiagResults(); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp index 52bdcbcbd1..6ed05507c9 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp @@ -458,7 +458,13 @@ QList RimEclipseResultDefinition::calculateValueOptions( bool enableSouring = false; #ifdef ENABLE_SOURING - enableSouring = true; + RigCaseCellResultsData* cellResultsData = m_eclipseCase->results(this->porosityModel()); + + if (cellResultsData->hasFlowDiagUsableFluxes()) + { + enableSouring = true; + } + #endif /* ENABLE_SOURING */ From 0559084d9315f23090fc74dd5f101a00ee632f2c Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 25 Jan 2018 21:16:24 +0100 Subject: [PATCH 28/78] #2325 Summary plot: Apply axis settings on preview plot --- .../RicSummaryCurveCreator.cpp | 2 ++ .../Summary/RimSummaryPlot.cpp | 18 ++++++++++++++++++ .../ProjectDataModel/Summary/RimSummaryPlot.h | 2 ++ 3 files changed, 22 insertions(+) diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.cpp index 283d96dc2a..2c1bd90cea 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.cpp +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.cpp @@ -510,8 +510,10 @@ void RicSummaryCurveCreator::populateCurveCreator(const RimSummaryPlot& sourceSu curve->setCurveVisiblity(false); } + m_previewPlot->copyAxisPropertiesFromOther(sourceSummaryPlot); m_previewPlot->enableAutoPlotTitle(sourceSummaryPlot.autoPlotTitle()); m_previewPlot->updatePlotTitle(); + m_previewPlot->updateAxes(); m_summaryCurveSelectionEditor->summaryAddressSelection()->setSelectedCurveDefinitions(curveDefs); diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 803a3d3f61..d4a0725535 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -528,6 +528,24 @@ QString RimSummaryPlot::generatedPlotTitleFromVisibleCurves() const return generatePlotTitle(&nameHelper); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlot::copyAxisPropertiesFromOther(const RimSummaryPlot& sourceSummaryPlot) +{ + { + QString data = sourceSummaryPlot.yAxisPropertiesLeftOrRight(RiaDefines::PLOT_AXIS_LEFT)->writeObjectToXmlString(); + yAxisPropertiesLeftOrRight(RiaDefines::PLOT_AXIS_LEFT) + ->readObjectFromXmlString(data, caf::PdmDefaultObjectFactory::instance()); + } + + { + QString data = sourceSummaryPlot.yAxisPropertiesLeftOrRight(RiaDefines::PLOT_AXIS_RIGHT)->writeObjectToXmlString(); + yAxisPropertiesLeftOrRight(RiaDefines::PLOT_AXIS_RIGHT) + ->readObjectFromXmlString(data, caf::PdmDefaultObjectFactory::instance()); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.h index 02dbeb8934..fe43619508 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -115,6 +115,8 @@ class RimSummaryPlot : public RimViewWindow void updateCurveNames(); QString generatedPlotTitleFromVisibleCurves() const; + void copyAxisPropertiesFromOther(const RimSummaryPlot& sourceSummaryPlot); + // RimViewWindow overrides public: virtual QWidget* createViewWidget(QWidget* mainWindowParent) override; From 889f615d19571beb937ef2e9bbeebe6643377e49 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 26 Jan 2018 08:16:07 +0100 Subject: [PATCH 29/78] #2276 : Source Stepping : Improve region ordering Internally, region numbers are stored in a set and then ordered correctly. When converting to strings for UI, the sorting criteria changes, and the order is wrong. If a vector is used to represent the UI strings, the problem is solved. --- .../Application/Tools/RiaSummaryCurveAnalyzer.cpp | 10 +++++----- .../Application/Tools/RiaSummaryCurveAnalyzer.h | 2 +- .../Summary/RimSummaryPlotSourceStepping.cpp | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ApplicationCode/Application/Tools/RiaSummaryCurveAnalyzer.cpp b/ApplicationCode/Application/Tools/RiaSummaryCurveAnalyzer.cpp index a177756486..595df584ba 100644 --- a/ApplicationCode/Application/Tools/RiaSummaryCurveAnalyzer.cpp +++ b/ApplicationCode/Application/Tools/RiaSummaryCurveAnalyzer.cpp @@ -97,29 +97,29 @@ std::set RiaSummaryCurveAnalyzer:: //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::set RiaSummaryCurveAnalyzer::identifierTexts(RifEclipseSummaryAddress::SummaryVarCategory category) const +std::vector RiaSummaryCurveAnalyzer::identifierTexts(RifEclipseSummaryAddress::SummaryVarCategory category) const { - std::set stringSet; + std::vector stringSet; if (category == RifEclipseSummaryAddress::SUMMARY_REGION) { for (const auto& regionNumber : m_regionNumbers) { - stringSet.insert(QString::number(regionNumber)); + stringSet.push_back(QString::number(regionNumber)); } } else if (category == RifEclipseSummaryAddress::SUMMARY_WELL) { for (const auto& wellName : m_wellNames) { - stringSet.insert(QString::fromStdString(wellName)); + stringSet.push_back(QString::fromStdString(wellName)); } } else if (category == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP) { for (const auto& wellGroupName : m_wellGroupNames) { - stringSet.insert(QString::fromStdString(wellGroupName)); + stringSet.push_back(QString::fromStdString(wellGroupName)); } } diff --git a/ApplicationCode/Application/Tools/RiaSummaryCurveAnalyzer.h b/ApplicationCode/Application/Tools/RiaSummaryCurveAnalyzer.h index 7037140b73..ba12c9cef8 100644 --- a/ApplicationCode/Application/Tools/RiaSummaryCurveAnalyzer.h +++ b/ApplicationCode/Application/Tools/RiaSummaryCurveAnalyzer.h @@ -48,7 +48,7 @@ class RiaSummaryCurveAnalyzer std::set categories() const; - std::set identifierTexts(RifEclipseSummaryAddress::SummaryVarCategory category) const; + std::vector identifierTexts(RifEclipseSummaryAddress::SummaryVarCategory category) const; static std::vector addressesForCategory(const std::vector& addresses, RifEclipseSummaryAddress::SummaryVarCategory category); diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index 944a130bc0..4f7a0169bf 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -227,7 +227,7 @@ QList RimSummaryPlotSourceStepping::calculateValueOption return options; } - std::set identifierTexts; + std::vector identifierTexts; RifSummaryReaderInterface* reader = firstSummaryReaderForVisibleCurves(); if (reader) @@ -265,7 +265,7 @@ QList RimSummaryPlotSourceStepping::calculateValueOption quantityAnalyzer.appendAdresses(subset); for (const auto& quantity : quantityAnalyzer.quantities()) { - identifierTexts.insert(QString::fromStdString(quantity)); + identifierTexts.push_back(QString::fromStdString(quantity)); } } } From 78068e547d608583dff57c04e01c734ad9fef272 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 19 Jan 2018 16:55:16 +0100 Subject: [PATCH 30/78] Fix compiler warnings related to converting time_t to double --- .../ReservoirDataModel/RigTimeHistoryCurveMerger.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ApplicationCode/ReservoirDataModel/RigTimeHistoryCurveMerger.cpp b/ApplicationCode/ReservoirDataModel/RigTimeHistoryCurveMerger.cpp index 37e88709d4..19d7b4634d 100644 --- a/ApplicationCode/ReservoirDataModel/RigTimeHistoryCurveMerger.cpp +++ b/ApplicationCode/ReservoirDataModel/RigTimeHistoryCurveMerger.cpp @@ -196,8 +196,8 @@ double RigTimeHistoryCurveMerger::interpolationValue(const time_t& interpolation bool isSecondValid = RigCurveDataTools::isValidValue(secondValue, removeInterpolatedValues); if (!isSecondValid) return HUGE_VAL; - double firstDiff = interpolationTimeStep - curveTimeSteps.at(firstI); - double secondDiff = curveTimeSteps.at(secondI) - interpolationTimeStep; + double firstDiff = fabs(difftime(interpolationTimeStep, curveTimeSteps.at(firstI))); + double secondDiff = fabs(difftime(curveTimeSteps.at(secondI), interpolationTimeStep)); double firstWeight = secondDiff / (firstDiff + secondDiff); double secondWeight = firstDiff / (firstDiff + secondDiff); From 007602dbf9f0af5d29bfb26a28808f294cdff0ce Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Fri, 26 Jan 2018 10:28:24 +0100 Subject: [PATCH 31/78] #2326 Well allocation plot: Remove formation options regarding well path --- .../Flow/RimWellAllocationPlot.cpp | 1 + .../ProjectDataModel/RimWellLogTrack.cpp | 34 +++++++++++++++---- .../ProjectDataModel/RimWellLogTrack.h | 4 +++ 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp index 194d71e9ae..f178b4ab3a 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp @@ -253,6 +253,7 @@ void RimWellAllocationPlot::updateFromWell() RimWellLogTrack* plotTrack = new RimWellLogTrack(); plotTrack->setDescription(QString("Branch %1").arg(brIdx + 1)); + plotTrack->setFormationsForCaseWithSimWellOnly(true); plotTrack->setFormationBranchIndex((int)brIdx); accumulatedWellFlowPlot()->addTrack(plotTrack); diff --git a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp index 4087f02c82..7ff373fff1 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp @@ -152,6 +152,8 @@ RimWellLogTrack::RimWellLogTrack() CAF_PDM_InitFieldNoDefault(&m_formationLevel, "FormationLevel", "Well Pick Filter", "", "", ""); CAF_PDM_InitField(&m_showformationFluids, "ShowFormationFluids", false, "Show Fluids", "", "", ""); + + m_formationsForCaseWithSimWellOnly = false; } //-------------------------------------------------------------------------------------------------- @@ -807,21 +809,33 @@ void RimWellLogTrack::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& formationGroup->add(&m_showFormations); - formationGroup->add(&m_formationSource); + if (!m_formationsForCaseWithSimWellOnly) + { + formationGroup->add(&m_formationSource); + } + else + { + m_formationSource = CASE; + } if (m_formationSource() == CASE) { formationGroup->add(&m_formationCase); - formationGroup->add(&m_formationTrajectoryType); - if (m_formationTrajectoryType() == WELL_PATH) + if (!m_formationsForCaseWithSimWellOnly) { - formationGroup->add(&m_formationWellPathForSourceCase); + formationGroup->add(&m_formationTrajectoryType); + + if (m_formationTrajectoryType() == WELL_PATH) + { + formationGroup->add(&m_formationWellPathForSourceCase); + } } - else + + if (m_formationsForCaseWithSimWellOnly || m_formationTrajectoryType() == SIMULATION_WELL) { formationGroup->add(&m_formationSimWellName); - + RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequiredFromSimWellName(formationGroup, m_formationSimWellName, m_formationBranchDetection, @@ -996,6 +1010,14 @@ void RimWellLogTrack::uiOrderingForVisibleXRange(caf::PdmUiOrdering& uiOrdering) gridGroup->add(&m_visibleXRangeMax); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogTrack::setFormationsForCaseWithSimWellOnly(bool caseWithSimWellOnly) +{ + m_formationsForCaseWithSimWellOnly = caseWithSimWellOnly; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimWellLogTrack.h b/ApplicationCode/ProjectDataModel/RimWellLogTrack.h index 12fd376904..500c746932 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogTrack.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogTrack.h @@ -119,6 +119,8 @@ class RimWellLogTrack : public caf::PdmObject void uiOrderingForRftPltFormations(caf::PdmUiOrdering& uiOrdering); void uiOrderingForVisibleXRange(caf::PdmUiOrdering& uiOrdering); + void setFormationsForCaseWithSimWellOnly(bool caseWithSimWellOnly); + private: virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; virtual QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override; @@ -178,6 +180,8 @@ class RimWellLogTrack : public caf::PdmObject caf::PdmField m_formationBranchDetection; + bool m_formationsForCaseWithSimWellOnly; + QPointer m_wellLogTrackPlotWidget; std::unique_ptr m_annotationTool; From 906484bd469f8b6a054e4ee6b0f8e3877d4f8094 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 26 Jan 2018 13:46:15 +0100 Subject: [PATCH 32/78] #2411 AppFwk : Increase precision when writing real numbers to XML --- .../cafInternalPdmXmlFieldReaderWriter.h | 5 + .../cafPdmXml_UnitTests/CMakeLists.txt | 1 + .../cafPdmXmlNumberTest.cpp | 110 ++++++++++++++++++ 3 files changed, 116 insertions(+) create mode 100644 Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests/cafPdmXmlNumberTest.cpp diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafInternalPdmXmlFieldReaderWriter.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafInternalPdmXmlFieldReaderWriter.h index 68cd701683..67711e2620 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafInternalPdmXmlFieldReaderWriter.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafInternalPdmXmlFieldReaderWriter.h @@ -29,6 +29,11 @@ struct PdmFieldWriter { QString dataString; QTextStream data(&dataString, QIODevice::WriteOnly); + + // Use precision of 15 to cover most value ranges for double values + // Default Qt behavior is precision of 6 + data.setRealNumberPrecision(15); + data << fieldValue; xmlStream.writeCharacters(dataString); } diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests/CMakeLists.txt b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests/CMakeLists.txt index 468c827c18..7a56128283 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests/CMakeLists.txt +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests/CMakeLists.txt @@ -19,6 +19,7 @@ add_executable (${PROJECT_NAME} cafPdmXmlBasicTest.cpp cafPdmAdvancedTemplateTest.cpp + cafPdmXmlNumberTest.cpp ) message(STATUS ${PROJECT_NAME}" - Qt includes : " ${QT_LIBRARIES}) diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests/cafPdmXmlNumberTest.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests/cafPdmXmlNumberTest.cpp new file mode 100644 index 0000000000..50f5db1294 --- /dev/null +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests/cafPdmXmlNumberTest.cpp @@ -0,0 +1,110 @@ + +#include "gtest/gtest.h" + +#include "cafPdmDataValueField.h" +#include "cafPdmObjectHandle.h" +#include "cafPdmXmlObjectHandle.h" +#include "cafPdmXmlObjectHandleMacros.h" + +#include + +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +class SimpleObjectWithNumbers : public caf::PdmObjectHandle, public caf::PdmXmlObjectHandle +{ + CAF_PDM_XML_HEADER_INIT; + +public: + SimpleObjectWithNumbers() : PdmObjectHandle(), PdmXmlObjectHandle(this, false) + { + CAF_PDM_XML_InitField(&m_valueA, "ValueA"); + CAF_PDM_XML_InitField(&m_valueB, "ValueB"); + + CAF_PDM_XML_InitField(&m_floatValueA, "FloatValueA"); + CAF_PDM_XML_InitField(&m_floatValueB, "FloatValueB"); + } + + caf::PdmDataValueField m_valueA; + caf::PdmDataValueField m_valueB; + + caf::PdmDataValueField m_floatValueA; + caf::PdmDataValueField m_floatValueB; +}; +CAF_PDM_XML_SOURCE_INIT(SimpleObjectWithNumbers, "SimpleObjectWithNumbers"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +TEST(SerializeNumbers, SimpleObjectWithDoubleValues) +{ + double valueA = 0.123456789; + double valueB = 123456789 + valueA; + + QString objectAsText; + + { + SimpleObjectWithNumbers obj1; + + obj1.m_valueA = valueA; + obj1.m_valueB = valueB; + + objectAsText = obj1.writeObjectToXmlString(); + } + + { + SimpleObjectWithNumbers obj1; + + obj1.readObjectFromXmlString(objectAsText, caf::PdmDefaultObjectFactory::instance()); + + { + double epsilon = 1e-7; + + double diffA = fabs(obj1.m_valueA - valueA); + EXPECT_TRUE(diffA < epsilon); + } + + { + double epsilon = 3e-7; + + double diffB = fabs(obj1.m_valueB - valueB); + EXPECT_TRUE(diffB < epsilon); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +TEST(SerializeNumbers, SimpleObjectWithFloatValues) +{ + float valueA = 0.123456789; + float valueB = 123456 + valueA; + + QString objectAsText; + + { + SimpleObjectWithNumbers obj1; + + obj1.m_floatValueA = valueA; + obj1.m_floatValueB = valueB; + + objectAsText = obj1.writeObjectToXmlString(); + } + + { + SimpleObjectWithNumbers obj1; + + obj1.readObjectFromXmlString(objectAsText, caf::PdmDefaultObjectFactory::instance()); + + double epsilon = 1e-7; + + double diffA = fabs(obj1.m_floatValueA - valueA); + EXPECT_TRUE(diffA < epsilon); + + double diffB = fabs(obj1.m_floatValueB - valueB); + EXPECT_TRUE(diffB < epsilon); + } +} From 4b00c6e14445a1d953d0f893e853d0b3ebb9fec4 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 26 Jan 2018 14:30:06 +0100 Subject: [PATCH 33/78] #2414 AppFwk : Do not overwrite field double value with UI text representation --- .../cafPdmUiDoubleSliderEditor.cpp | 28 ++++++++----------- .../cafPdmUiDoubleSliderEditor.h | 4 +-- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.cpp index 9385044e88..f92ad6bc30 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.cpp @@ -106,6 +106,7 @@ void PdmUiDoubleSliderEditor::configureAndUpdateUi(const QString& uiConfigName) uiObject->editorAttribute(field()->fieldHandle(), uiConfigName, &m_attributes); } + double doubleValue = field()->uiValue().toDouble(); QString textValue = field()->uiValue().toString(); m_slider->blockSignals(true); @@ -118,7 +119,7 @@ void PdmUiDoubleSliderEditor::configureAndUpdateUi(const QString& uiConfigName) m_lineEdit->setValidator(pdmValidator); m_lineEdit->setText(textValue); - updateSliderPosition(); + updateSliderPosition(doubleValue); } //-------------------------------------------------------------------------------------------------- @@ -161,9 +162,12 @@ QWidget* PdmUiDoubleSliderEditor::createLabelWidget(QWidget * parent) //-------------------------------------------------------------------------------------------------- void PdmUiDoubleSliderEditor::slotEditingFinished() { - updateSliderPosition(); + QString textValue = m_lineEdit->text(); + + double doubleVal = textValue.toDouble(); + doubleVal = qBound(m_attributes.m_minimum, doubleVal, m_attributes.m_maximum); - writeValueToField(); + writeValueToField(doubleVal); } //-------------------------------------------------------------------------------------------------- @@ -172,22 +176,16 @@ void PdmUiDoubleSliderEditor::slotEditingFinished() void PdmUiDoubleSliderEditor::slotSliderValueChanged(int value) { double newDoubleValue = convertFromSliderValue(value); - m_lineEdit->setText(QString::number(newDoubleValue)); - writeValueToField(); + writeValueToField(newDoubleValue); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void PdmUiDoubleSliderEditor::updateSliderPosition() +void PdmUiDoubleSliderEditor::updateSliderPosition(double value) { - QString textValue = m_lineEdit->text(); - - bool convertOk = false; - double newSliderValue = textValue.toDouble(&convertOk); - - int newSliderPosition = convertToSliderValue(newSliderValue); + int newSliderPosition = convertToSliderValue(value); if (m_slider->value() != newSliderPosition) { m_slider->blockSignals(true); @@ -199,11 +197,9 @@ void PdmUiDoubleSliderEditor::updateSliderPosition() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void PdmUiDoubleSliderEditor::writeValueToField() +void PdmUiDoubleSliderEditor::writeValueToField(double value) { - QString textValue = m_lineEdit->text(); - QVariant v; - v = textValue; + QVariant v = value; this->setValueToField(v); } diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.h index dba27056c8..21b85bdd63 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.h @@ -92,8 +92,8 @@ protected slots: void slotSliderValueChanged(int value); private: - void updateSliderPosition(); - void writeValueToField(); + void updateSliderPosition(double value); + void writeValueToField(double value); int convertToSliderValue(double value); double convertFromSliderValue(int sliderValue); From fe6f64e09312f42a8dc09dfbfe318c0b7b11c5ea Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 26 Jan 2018 14:50:15 +0100 Subject: [PATCH 34/78] #2414 AppFwk : Cleaned up includes --- .../cafUserInterface/cafPdmUiDoubleSliderEditor.cpp | 11 ++--------- .../cafUserInterface/cafPdmUiDoubleSliderEditor.h | 5 +++-- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.cpp index f92ad6bc30..a875ac4721 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.cpp @@ -37,20 +37,13 @@ #include "cafPdmUiDoubleSliderEditor.h" -#include "cafPdmUiDefaultObjectEditor.h" -#include "cafPdmObject.h" -#include "cafPdmUiFieldEditorHandle.h" #include "cafPdmField.h" +#include "cafPdmUiFieldHandle.h" +#include "cafPdmUiObjectHandle.h" -#include "cafFactory.h" - -#include -#include #include #include -#include - //-------------------------------------------------------------------------------------------------- /// diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.h index 21b85bdd63..a616831c9a 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.h @@ -43,7 +43,6 @@ #include #include #include -#include #include @@ -53,7 +52,6 @@ namespace caf //================================================================================================== /// //================================================================================================== - class PdmUiDoubleSliderEditorAttribute : public PdmUiEditorAttribute { public: @@ -73,6 +71,9 @@ class PdmUiDoubleSliderEditorAttribute : public PdmUiEditorAttribute }; +//================================================================================================== +/// +//================================================================================================== class PdmUiDoubleSliderEditor : public PdmUiFieldEditorHandle { Q_OBJECT From 4d5503afb4557f7cd2eb4493db3656d73eef3b8a Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 19 Jan 2018 10:30:33 +0100 Subject: [PATCH 35/78] #2385 Main Window: More flexible docking restrictions --- ApplicationCode/UserInterface/RiuMainWindowBase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApplicationCode/UserInterface/RiuMainWindowBase.cpp b/ApplicationCode/UserInterface/RiuMainWindowBase.cpp index 0bada423d5..0c09d6e193 100644 --- a/ApplicationCode/UserInterface/RiuMainWindowBase.cpp +++ b/ApplicationCode/UserInterface/RiuMainWindowBase.cpp @@ -27,7 +27,7 @@ //-------------------------------------------------------------------------------------------------- RiuMainWindowBase::RiuMainWindowBase() { - + setDockNestingEnabled(true); } //-------------------------------------------------------------------------------------------------- From 84725ced9b75ebb8e5147f8acebd7507445b4204 Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Fri, 26 Jan 2018 15:49:13 +0100 Subject: [PATCH 36/78] Make branch detection toggle hidden if show formations is toggled off --- ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp index 7ff373fff1..aafbeffed8 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp @@ -1202,6 +1202,7 @@ void RimWellLogTrack::setFormationFieldsUiReadOnly(bool readOnly /*= true*/) m_formationCase.uiCapability()->setUiReadOnly(readOnly); m_formationWellPathForSourceCase.uiCapability()->setUiReadOnly(readOnly); m_formationWellPathForSourceWellPath.uiCapability()->setUiReadOnly(readOnly); + m_formationBranchDetection.uiCapability()->setUiReadOnly(readOnly); m_formationBranchIndex.uiCapability()->setUiReadOnly(readOnly); m_formationLevel.uiCapability()->setUiReadOnly(readOnly); m_showformationFluids.uiCapability()->setUiReadOnly(readOnly); From ca3bb02c57bca14053ba0749564fbcdbea4be7f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Fri, 26 Jan 2018 15:52:59 +0100 Subject: [PATCH 37/78] #2356 grid statistics dialog. Display of Mobile Volume Weighted Mean controlled by info box property --- ApplicationCode/Commands/RicGridStatisticsDialog.cpp | 2 +- ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp | 6 +++--- ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ApplicationCode/Commands/RicGridStatisticsDialog.cpp b/ApplicationCode/Commands/RicGridStatisticsDialog.cpp index 88f9a7edd4..4264105495 100644 --- a/ApplicationCode/Commands/RicGridStatisticsDialog.cpp +++ b/ApplicationCode/Commands/RicGridStatisticsDialog.cpp @@ -142,7 +142,7 @@ void RicGridStatisticsDialog::setInfoText(RimView* view) QString text; text = overlayInfo->timeStepText(); text += overlayInfo->caseInfoText(); - text += overlayInfo->resultInfoText(overlayInfo->histogramData(), true); + text += overlayInfo->resultInfoText(overlayInfo->histogramData()); m_textEdit->setText(text); adjustTextEditHeightToContent(); } diff --git a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp index 3f1cbfafe3..311c249987 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp +++ b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp @@ -204,12 +204,12 @@ QString Rim3dOverlayInfoConfig::caseInfoText() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData, bool showVolumeWeightedMean) +QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData) { auto eclipseView = dynamic_cast(m_viewDef.p()); auto geoMechView = dynamic_cast(m_viewDef.p()); - if (eclipseView) return resultInfoText(histData, eclipseView, showVolumeWeightedMean); + if (eclipseView) return resultInfoText(histData, eclipseView, showVolumeWeightedMean()); if (geoMechView) return resultInfoText(histData, geoMechView); return ""; } @@ -755,7 +755,7 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView) if (showResultInfo()) { - infoText += resultInfoText(histData, showVolumeWeightedMean()); + infoText += resultInfoText(histData); } if (!infoText.isEmpty()) diff --git a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.h b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.h index 302a6e4eb5..66c81a2421 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.h +++ b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.h @@ -74,7 +74,7 @@ class Rim3dOverlayInfoConfig : public caf::PdmObject HistogramData histogramData(); QString timeStepText(); QString caseInfoText(); - QString resultInfoText(const HistogramData& histData, bool showVolumeWeightedMean); + QString resultInfoText(const HistogramData& histData); void showStatisticsInfoDialog(bool raise = true); QImage statisticsDialogScreenShotImage(); From aa12ac743a2feaa1d5d1e6f811845d04d8fe9e30 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Sun, 28 Jan 2018 21:29:40 +0100 Subject: [PATCH 38/78] #2418 : Import of text grid model fails when comments is on same line as keyword --- .../FileInterface/RifEclipseInputFileTools.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ApplicationCode/FileInterface/RifEclipseInputFileTools.cpp b/ApplicationCode/FileInterface/RifEclipseInputFileTools.cpp index 0ee901f68f..4755a4f06a 100644 --- a/ApplicationCode/FileInterface/RifEclipseInputFileTools.cpp +++ b/ApplicationCode/FileInterface/RifEclipseInputFileTools.cpp @@ -342,7 +342,17 @@ void RifEclipseInputFileTools::findKeywordsOnFile(const QString &fileName, std:: filepos = data.pos() - lineLength; keyPos.filePos = filepos; - keyPos.keyword = line.trimmed(); + + QString keywordCandidate = line; + int commentStart = keywordCandidate.indexOf("--"); + if (commentStart > 0) + { + keywordCandidate = keywordCandidate.left(commentStart); + } + + keywordCandidate = keywordCandidate.trimmed(); + + keyPos.keyword = keywordCandidate; keywords->push_back(keyPos); //qDebug() << keyPos.keyword << " - " << keyPos.filePos; } From c8546eb7e7d95b43c5874b8068ac198313a78e61 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 29 Jan 2018 08:44:30 +0100 Subject: [PATCH 39/78] #2241 : Improve robustness when reading report numbers from libecl --- ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp index f9e0714f78..3bfababb90 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp @@ -2108,6 +2108,9 @@ std::vector RifReaderEclipseOutput::createFilteredTimeSt m_dynamicResultsAccess->timeSteps(&timeStepsOnFile, &daysSinceSimulationStartOnFile); reportNumbersOnFile = m_dynamicResultsAccess->reportNumbers(); + if (timeStepsOnFile.size() != daysSinceSimulationStartOnFile.size()) return timeStepInfos; + if (timeStepsOnFile.size() != reportNumbersOnFile.size()) return timeStepInfos; + for (size_t i = 0; i < timeStepsOnFile.size(); i++) { if (this->isTimeStepIncludedByFilter(i)) From 9cc090256d568ac1c1d3c28b81657367cefc4e1c Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 29 Jan 2018 08:46:28 +0100 Subject: [PATCH 40/78] #2241 : Do not skip report numbers with -1 --- .../FileInterface/RifEclipseRestartFilesetAccess.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp b/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp index ae372b569d..02265f0c5a 100644 --- a/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp +++ b/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp @@ -321,10 +321,7 @@ std::vector RifEclipseRestartFilesetAccess::reportNumbers() { const char* fileName = ecl_file_get_src_file(m_ecl_files[i]); int reportNumber = ecl_util_filename_report_nr(fileName); - if (reportNumber != -1) - { - reportNr.push_back(reportNumber); - } + reportNr.push_back(reportNumber); } } From b59734160c4abb464aec21dc16583c8b1bd0e2b3 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 29 Jan 2018 08:47:23 +0100 Subject: [PATCH 41/78] Use range based for --- .../FileInterface/RifEclipseRestartFilesetAccess.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp b/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp index 02265f0c5a..84fbe522ec 100644 --- a/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp +++ b/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp @@ -315,11 +315,11 @@ std::vector RifEclipseRestartFilesetAccess::reportNumbers() { std::vector reportNr; - for (size_t i = 0; i < m_ecl_files.size(); i++) + for (const auto* ecl_file : m_ecl_files) { - if (m_ecl_files[i]) + if (ecl_file) { - const char* fileName = ecl_file_get_src_file(m_ecl_files[i]); + const char* fileName = ecl_file_get_src_file(ecl_file); int reportNumber = ecl_util_filename_report_nr(fileName); reportNr.push_back(reportNumber); } From ff0599df0494816f9b7edbffd45ebd283bf97fe2 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 29 Jan 2018 10:04:33 +0100 Subject: [PATCH 42/78] Guard for access of dynamic data with no time steps --- .../ReservoirDataModel/RigEclipseNativeStatCalc.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ApplicationCode/ReservoirDataModel/RigEclipseNativeStatCalc.h b/ApplicationCode/ReservoirDataModel/RigEclipseNativeStatCalc.h index 059b5c41e7..bab42e2063 100644 --- a/ApplicationCode/ReservoirDataModel/RigEclipseNativeStatCalc.h +++ b/ApplicationCode/ReservoirDataModel/RigEclipseNativeStatCalc.h @@ -50,6 +50,11 @@ class RigEclipseNativeStatCalc : public RigStatisticsCalculator template void traverseCells(StatisticsAccumulator& accumulator, size_t timeStepIndex) { + if (timeStepIndex >= m_resultsData->cellScalarResults(m_scalarResultIndex).size()) + { + return; + } + std::vector& values = m_resultsData->cellScalarResults(m_scalarResultIndex, timeStepIndex); if (values.empty()) From 41506afe0639d4711c25c9e56dc81cecada8925d Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 29 Jan 2018 10:09:30 +0100 Subject: [PATCH 43/78] #2241 : Workaround for report numbers : Convert to upper case befor calling libecl --- .../RifEclipseRestartFilesetAccess.cpp | 28 +++++++++++++++---- .../RifEclipseRestartFilesetAccess.h | 1 + 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp b/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp index 84fbe522ec..7522865d98 100644 --- a/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp +++ b/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp @@ -251,8 +251,7 @@ void RifEclipseRestartFilesetAccess::readWellData(well_info_type* well_info, boo if (m_ecl_files[i]) { - const char* fileName = ecl_file_get_src_file(m_ecl_files[i]); - int reportNumber = ecl_util_filename_report_nr(fileName); + int reportNumber = RifEclipseRestartFilesetAccess::reportNumber(m_ecl_files[i]); if(reportNumber != -1) { well_info_add_wells(well_info, m_ecl_files[i], reportNumber, importCompleteMswData); @@ -284,6 +283,23 @@ void RifEclipseRestartFilesetAccess::openTimeStep(size_t timeStep) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RifEclipseRestartFilesetAccess::reportNumber(const ecl_file_type* ecl_file) +{ + if (!ecl_file) return -1; + + const char* eclFileName = ecl_file_get_src_file(ecl_file); + QString fileNameUpper(eclFileName); + fileNameUpper = fileNameUpper.toUpper(); + + // Convert to upper case, as ecl_util_filename_report_nr does not handle lower case file extensions + int reportNumber = ecl_util_filename_report_nr(fileNameUpper.toAscii().data()); + + return reportNumber; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -319,9 +335,11 @@ std::vector RifEclipseRestartFilesetAccess::reportNumbers() { if (ecl_file) { - const char* fileName = ecl_file_get_src_file(ecl_file); - int reportNumber = ecl_util_filename_report_nr(fileName); - reportNr.push_back(reportNumber); + int reportNumber = RifEclipseRestartFilesetAccess::reportNumber(ecl_file); + if (reportNumber != -1) + { + reportNr.push_back(reportNumber); + } } } diff --git a/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.h b/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.h index 493c1f74bc..a5a68101cf 100644 --- a/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.h +++ b/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.h @@ -58,6 +58,7 @@ class RifEclipseRestartFilesetAccess : public RifEclipseRestartDataAccess private: void openTimeStep(size_t timeStep); + static int reportNumber(const ecl_file_type* ecl_file); private: QStringList m_fileNames; From 0171589c727a8a325022fea191d90127e5229207 Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Mon, 29 Jan 2018 10:16:12 +0100 Subject: [PATCH 44/78] Add option to avoid updating parent plot --- ApplicationCode/ProjectDataModel/RimPlotCurve.cpp | 11 +++++++---- ApplicationCode/ProjectDataModel/RimPlotCurve.h | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimPlotCurve.cpp b/ApplicationCode/ProjectDataModel/RimPlotCurve.cpp index 208c921970..d5a3f5d08f 100644 --- a/ApplicationCode/ProjectDataModel/RimPlotCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimPlotCurve.cpp @@ -135,7 +135,7 @@ void RimPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, con { if (changedField == &m_showCurve) { - this->updateCurveVisibility(); + this->updateCurveVisibility(true); if (m_showCurve()) loadDataAndUpdate(true); } else if (changedField == &m_curveName) @@ -180,7 +180,7 @@ caf::PdmFieldHandle* RimPlotCurve::objectToggleField() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimPlotCurve::updateCurveVisibility() +void RimPlotCurve::updateCurveVisibility(bool updateParent) { bool isVisibleInPossibleParent = true; @@ -199,7 +199,10 @@ void RimPlotCurve::updateCurveVisibility() m_qwtPlotCurve->detach(); } - updateZoomInParentPlot(); + if (updateParent) + { + updateZoomInParentPlot(); + } } //-------------------------------------------------------------------------------------------------- @@ -207,7 +210,7 @@ void RimPlotCurve::updateCurveVisibility() //-------------------------------------------------------------------------------------------------- void RimPlotCurve::updateCurvePresentation(bool updatePlotLegend) { - this->updateCurveVisibility(); + this->updateCurveVisibility(updatePlotLegend); if (updatePlotLegend) { diff --git a/ApplicationCode/ProjectDataModel/RimPlotCurve.h b/ApplicationCode/ProjectDataModel/RimPlotCurve.h index ee58669c7e..f3c6126389 100644 --- a/ApplicationCode/ProjectDataModel/RimPlotCurve.h +++ b/ApplicationCode/ProjectDataModel/RimPlotCurve.h @@ -92,7 +92,7 @@ class RimPlotCurve : public caf::PdmObject QString curveName() const { return m_curveName; } - void updateCurveVisibility(); + void updateCurveVisibility(bool updateParent); void updateLegendEntryVisibilityAndPlotLegend(); void updateLegendEntryVisibilityNoPlotUpdate(); From b7a316589ab0e0ce730efcf860f388e8d6b4b9f9 Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Mon, 29 Jan 2018 10:17:38 +0100 Subject: [PATCH 45/78] #2319 PLT/Well log plot: Remove auto scale on scroll. Make auto scale from file work --- .../ProjectDataModel/RimWellLogPlot.cpp | 27 ++++++++++++++----- .../ProjectDataModel/RimWellLogPlot.h | 2 ++ .../UserInterface/RiuWellLogPlot.cpp | 1 + 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp index cfe4e53150..9be63af1f9 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp @@ -147,6 +147,14 @@ void RimWellLogPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c { rftPlot->updateConnectedEditors(); } + + RimWellPltPlot* pltPlot(nullptr); + this->firstAncestorOrThisOfType(pltPlot); + + if (pltPlot) + { + pltPlot->updateConnectedEditors(); + } } //-------------------------------------------------------------------------------------------------- @@ -294,6 +302,7 @@ void RimWellLogPlot::setDepthZoomByFactorAndCenter(double zoomFactor, double zoo double newMaximum = zoomCenter + (m_maxVisibleDepth - zoomCenter)*zoomFactor; setDepthZoomMinMax(newMinimum, newMaximum); + setDepthAutoZoom(false); } //-------------------------------------------------------------------------------------------------- @@ -303,6 +312,7 @@ void RimWellLogPlot::panDepth(double panFactor) { double delta = panFactor*(m_maxVisibleDepth - m_minVisibleDepth); setDepthZoomMinMax(m_minVisibleDepth + delta, m_maxVisibleDepth + delta); + setDepthAutoZoom(false); } //-------------------------------------------------------------------------------------------------- @@ -383,9 +393,7 @@ bool RimWellLogPlot::hasAvailableDepthRange() const //-------------------------------------------------------------------------------------------------- void RimWellLogPlot::zoomAll() { - m_isAutoScaleDepthEnabled = true; - m_isAutoScaleDepthEnabled.uiCapability()->updateConnectedEditors(); - + setDepthAutoZoom(true); updateDepthZoom(); } @@ -397,6 +405,15 @@ QWidget* RimWellLogPlot::viewWidget() return m_viewer; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogPlot::setDepthAutoZoom(bool on) +{ + m_isAutoScaleDepthEnabled = on; + m_isAutoScaleDepthEnabled.uiCapability()->updateConnectedEditors(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -594,11 +611,7 @@ void RimWellLogPlot::onLoadDataAndUpdate() { updateMdiWindowVisibility(); - bool tempAutoScale = m_isAutoScaleDepthEnabled; - m_isAutoScaleDepthEnabled = false; updateTracks(); - - m_isAutoScaleDepthEnabled = tempAutoScale; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlot.h b/ApplicationCode/ProjectDataModel/RimWellLogPlot.h index b92ac0d402..da12f14bff 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlot.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlot.h @@ -99,6 +99,8 @@ class RimWellLogPlot : public RimViewWindow virtual void zoomAll() override; virtual QWidget* viewWidget() override; + void setDepthAutoZoom(bool on); + QString asciiDataForPlotExport() const; diff --git a/ApplicationCode/UserInterface/RiuWellLogPlot.cpp b/ApplicationCode/UserInterface/RiuWellLogPlot.cpp index eaa8fb7819..34a3f8484d 100644 --- a/ApplicationCode/UserInterface/RiuWellLogPlot.cpp +++ b/ApplicationCode/UserInterface/RiuWellLogPlot.cpp @@ -264,6 +264,7 @@ void RiuWellLogPlot::slotSetMinDepth(int value) double delta = value - minimumDepth; m_plotDefinition->setDepthZoomMinMax(minimumDepth + delta, maximumDepth + delta); + m_plotDefinition->setDepthAutoZoom(false); } //-------------------------------------------------------------------------------------------------- From 438ee340e3b7dd19a57d3ea4306eec603b30a4e7 Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Mon, 29 Jan 2018 10:47:54 +0100 Subject: [PATCH 46/78] Rename variable --- ApplicationCode/ProjectDataModel/RimPlotCurve.cpp | 4 ++-- ApplicationCode/ProjectDataModel/RimPlotCurve.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimPlotCurve.cpp b/ApplicationCode/ProjectDataModel/RimPlotCurve.cpp index d5a3f5d08f..b856cc3633 100644 --- a/ApplicationCode/ProjectDataModel/RimPlotCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimPlotCurve.cpp @@ -180,7 +180,7 @@ caf::PdmFieldHandle* RimPlotCurve::objectToggleField() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimPlotCurve::updateCurveVisibility(bool updateParent) +void RimPlotCurve::updateCurveVisibility(bool updateParentPlot) { bool isVisibleInPossibleParent = true; @@ -199,7 +199,7 @@ void RimPlotCurve::updateCurveVisibility(bool updateParent) m_qwtPlotCurve->detach(); } - if (updateParent) + if (updateParentPlot) { updateZoomInParentPlot(); } diff --git a/ApplicationCode/ProjectDataModel/RimPlotCurve.h b/ApplicationCode/ProjectDataModel/RimPlotCurve.h index f3c6126389..0cd9c4495a 100644 --- a/ApplicationCode/ProjectDataModel/RimPlotCurve.h +++ b/ApplicationCode/ProjectDataModel/RimPlotCurve.h @@ -92,7 +92,7 @@ class RimPlotCurve : public caf::PdmObject QString curveName() const { return m_curveName; } - void updateCurveVisibility(bool updateParent); + void updateCurveVisibility(bool updateParentPlot); void updateLegendEntryVisibilityAndPlotLegend(); void updateLegendEntryVisibilityNoPlotUpdate(); From d67e1a7d139ac6b3af273ab0433cbaf5a59375f8 Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Mon, 29 Jan 2018 11:24:12 +0100 Subject: [PATCH 47/78] #2261 Well Paths: Change newestAddedWellPath to mostRecentlyUpdatedWellPath --- .../RicWellPathFormationsImportFileFeature.cpp | 2 +- .../RicWellPathsImportFileFeature.cpp | 2 +- .../ProjectDataModel/RimWellPathCollection.cpp | 15 ++++++--------- .../ProjectDataModel/RimWellPathCollection.h | 4 ++-- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/ApplicationCode/Commands/WellPathCommands/RicWellPathFormationsImportFileFeature.cpp b/ApplicationCode/Commands/WellPathCommands/RicWellPathFormationsImportFileFeature.cpp index 71aeba0909..43bf2004ed 100644 --- a/ApplicationCode/Commands/WellPathCommands/RicWellPathFormationsImportFileFeature.cpp +++ b/ApplicationCode/Commands/WellPathCommands/RicWellPathFormationsImportFileFeature.cpp @@ -77,7 +77,7 @@ void RicWellPathFormationsImportFileFeature::onActionTriggered(bool isChecked) if (oilField->wellPathCollection->wellPaths().size() > 0) { - RimWellPath* wellPath = oilField->wellPathCollection->newestAddedWellPath(); + RimWellPath* wellPath = oilField->wellPathCollection->mostRecentlyUpdatedWellPath(); if (wellPath) { RiuMainWindow::instance()->selectAsCurrentItem(wellPath); diff --git a/ApplicationCode/Commands/WellPathCommands/RicWellPathsImportFileFeature.cpp b/ApplicationCode/Commands/WellPathCommands/RicWellPathsImportFileFeature.cpp index bb8cbda1ae..3168992c9c 100644 --- a/ApplicationCode/Commands/WellPathCommands/RicWellPathsImportFileFeature.cpp +++ b/ApplicationCode/Commands/WellPathCommands/RicWellPathsImportFileFeature.cpp @@ -70,7 +70,7 @@ void RicWellPathsImportFileFeature::onActionTriggered(bool isChecked) if (oilField->wellPathCollection->wellPaths().size() > 0) { - RimWellPath* wellPath = oilField->wellPathCollection->newestAddedWellPath(); + RimWellPath* wellPath = oilField->wellPathCollection->mostRecentlyUpdatedWellPath(); if (wellPath) { RiuMainWindow::instance()->selectAsCurrentItem(wellPath); diff --git a/ApplicationCode/ProjectDataModel/RimWellPathCollection.cpp b/ApplicationCode/ProjectDataModel/RimWellPathCollection.cpp index 95d17ab4d8..6b0a745863 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellPathCollection.cpp @@ -101,7 +101,7 @@ RimWellPathCollection::RimWellPathCollection() m_wellPathImporter = new RifWellPathImporter; m_wellPathFormationsImporter = new RifWellPathFormationsImporter; - m_newestAddedWellPath = nullptr; + m_mostRecentlyUpdatedWellPath = nullptr; } @@ -268,23 +268,20 @@ void RimWellPathCollection::readAndAddWellPaths(std::vector& wellP // Let name from well path file override name from well log file existingWellPath->setName(wellPath->name()); + m_mostRecentlyUpdatedWellPath = existingWellPath; delete wellPath; } else { wellPath->wellPathColor = cvf::Color3f(interpolatedWellColors[wpIdx]); wellPath->setUnitSystem(findUnitSystemForWellPath(wellPath)); + m_mostRecentlyUpdatedWellPath = wellPath; wellPaths.push_back(wellPath); } progress.incrementProgress(); } - if (!wellPaths.empty()) - { - m_newestAddedWellPath = wellPaths[wellPaths.size() - 1]; - } - this->sortWellsByName(); } @@ -360,7 +357,7 @@ void RimWellPathCollection::addWellPathFormations(const QStringList& filePaths) QString wellFormationsCount = QString("%1").arg(it->second->formationNamesCount()); - m_newestAddedWellPath = wellPath; + m_mostRecentlyUpdatedWellPath = wellPath; outputMessage += it->first + "\t\t"; outputMessage += wellPath->name() + " \t\t\t"; @@ -520,9 +517,9 @@ void RimWellPathCollection::deleteAllWellPaths() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimWellPath* RimWellPathCollection::newestAddedWellPath() +RimWellPath* RimWellPathCollection::mostRecentlyUpdatedWellPath() { - return m_newestAddedWellPath; + return m_mostRecentlyUpdatedWellPath; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimWellPathCollection.h b/ApplicationCode/ProjectDataModel/RimWellPathCollection.h index b798c2a689..a4b4c87479 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathCollection.h +++ b/ApplicationCode/ProjectDataModel/RimWellPathCollection.h @@ -93,7 +93,7 @@ class RimWellPathCollection : public caf::PdmObject void removeWellPath(RimWellPath* wellPath); void deleteAllWellPaths(); - RimWellPath* newestAddedWellPath(); + RimWellPath* mostRecentlyUpdatedWellPath(); void readWellPathFormationFiles(); void reloadAllWellPathFormations(); @@ -136,5 +136,5 @@ class RimWellPathCollection : public caf::PdmObject RifWellPathImporter* m_wellPathImporter; RifWellPathFormationsImporter* m_wellPathFormationsImporter; - caf::PdmPointer m_newestAddedWellPath; + caf::PdmPointer m_mostRecentlyUpdatedWellPath; }; From 4a4dab3f1c19b21e394ea85dd7fed8cb447bbfef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Mon, 29 Jan 2018 11:23:21 +0100 Subject: [PATCH 48/78] #2408 summary plot. Update qwt axis when duplicating curves --- .../ProjectDataModel/Summary/RimSummaryCurveCollection.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp index 28c4af2a5c..e8a7c4670e 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp @@ -98,6 +98,7 @@ void RimSummaryCurveCollection::loadDataAndUpdate(bool updateParentPlot) for (RimSummaryCurve* curve : m_curves) { curve->loadDataAndUpdate(false); + curve->updateQwtPlotAxis(); } if ( updateParentPlot ) From ecfd1ad8170bcc32863dfd525337e7b1c9bf59fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Mon, 29 Jan 2018 12:46:10 +0100 Subject: [PATCH 49/78] #2368 summary plot. Fix right axis properties update issue --- ApplicationCode/UserInterface/RiuSummaryQwtPlot.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ApplicationCode/UserInterface/RiuSummaryQwtPlot.cpp b/ApplicationCode/UserInterface/RiuSummaryQwtPlot.cpp index d25812a444..7e13a3facd 100644 --- a/ApplicationCode/UserInterface/RiuSummaryQwtPlot.cpp +++ b/ApplicationCode/UserInterface/RiuSummaryQwtPlot.cpp @@ -140,7 +140,9 @@ void RiuSummaryQwtPlot::setZoomWindow(const QwtInterval& leftAxis, const QwtInte zoomWindow.setTop(leftAxis.maxValue()); zoomWindow.setBottom(leftAxis.minValue()); + m_zoomerLeft->blockSignals(true); m_zoomerLeft->zoom(zoomWindow); + m_zoomerLeft->blockSignals(false); } { @@ -150,8 +152,10 @@ void RiuSummaryQwtPlot::setZoomWindow(const QwtInterval& leftAxis, const QwtInte zoomWindow.setTop(rightAxis.maxValue()); zoomWindow.setBottom(rightAxis.minValue()); + // No need to block signal since there is no connected slot m_zoomerRight->zoom(zoomWindow); } + } //-------------------------------------------------------------------------------------------------- From f598e6905c7fb1d231a11803ed2e4bc3cbc664b5 Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Mon, 29 Jan 2018 14:41:07 +0100 Subject: [PATCH 50/78] #2419 Do not make OpmFlowDiagStat if result is fracture (DUAL) --- .../RimEclipseResultDefinition.cpp | 12 +++++------- .../ReservoirDataModel/RigEclipseCaseData.cpp | 14 ++++++++++++++ .../ReservoirDataModel/RigEclipseCaseData.h | 2 ++ .../RigFlowDiagSolverInterface.cpp | 8 +++++++- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp index 6ed05507c9..d9a062c9bd 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp @@ -1113,13 +1113,11 @@ bool RimEclipseResultDefinition::isFlowDiagOrInjectionFlooding() const //-------------------------------------------------------------------------------------------------- bool RimEclipseResultDefinition::hasDualPorFractureResult() { - if ( m_eclipseCase - && m_eclipseCase->eclipseCaseData() - && m_eclipseCase->eclipseCaseData()->activeCellInfo(RiaDefines::FRACTURE_MODEL) - && m_eclipseCase->eclipseCaseData()->activeCellInfo(RiaDefines::FRACTURE_MODEL)->reservoirActiveCellCount() > 0 ) - { - return true; - } + if (m_eclipseCase + && m_eclipseCase->eclipseCaseData()) + { + return m_eclipseCase->eclipseCaseData()->hasFractureResults(); + } return false; } diff --git a/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.cpp b/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.cpp index 690da01709..477edc830c 100644 --- a/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.cpp @@ -563,6 +563,20 @@ void RigEclipseCaseData::setActiveCellInfo(RiaDefines::PorosityModelType porosit } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RigEclipseCaseData::hasFractureResults() const +{ + if (activeCellInfo(RiaDefines::FRACTURE_MODEL) + && activeCellInfo(RiaDefines::FRACTURE_MODEL)->reservoirActiveCellCount() > 0) + { + return true; + } + + return false; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.h b/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.h index 7d0a0ca330..0a2f0e83d9 100644 --- a/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.h +++ b/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.h @@ -82,6 +82,8 @@ class RigEclipseCaseData : public cvf::Object const RigActiveCellInfo* activeCellInfo(RiaDefines::PorosityModelType porosityModel) const; void setActiveCellInfo(RiaDefines::PorosityModelType porosityModel, RigActiveCellInfo* activeCellInfo); + bool hasFractureResults() const; + void setActiveFormationNames(RigFormationNames* activeFormationNames); RigFormationNames* activeFormationNames(); diff --git a/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp b/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp index a0d684c36e..7ffa197027 100644 --- a/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp +++ b/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp @@ -511,8 +511,14 @@ bool RigFlowDiagSolverInterface::ensureStaticDataObjectInstanceCreated() if (initFileName.empty()) return false; const RigEclipseCaseData* eclipseCaseData = m_eclipseCase->eclipseCaseData(); - RiaEclipseUnitTools::UnitSystem caseUnitSystem = eclipseCaseData ? eclipseCaseData->unitsType() : RiaEclipseUnitTools::UNITS_UNKNOWN; + if (eclipseCaseData->hasFractureResults()) + { + return false; + } + + RiaEclipseUnitTools::UnitSystem caseUnitSystem = eclipseCaseData ? eclipseCaseData->unitsType() : RiaEclipseUnitTools::UNITS_UNKNOWN; + m_opmFlowDiagStaticData = new RigOpmFlowDiagStaticData(gridFileName.toStdString(), initFileName, caseUnitSystem); } From 9f08f1264a2564320e8de337be81ac09b288d469 Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Mon, 29 Jan 2018 16:04:21 +0100 Subject: [PATCH 51/78] #2417 Extraction Curves: Avoid clamping time step to -1 --- .../ProjectDataModel/RimWellLogExtractionCurve.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp index 24f8822ecf..d67e58d620 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp @@ -215,7 +215,7 @@ void RimWellLogExtractionCurve::setPropertiesFromView(RimView* view) //-------------------------------------------------------------------------------------------------- void RimWellLogExtractionCurve::clampTimestep() { - if (m_case) + if (m_timeStep > 0 && m_case) { if (m_timeStep > m_case->timeStepStrings().size() - 1) { @@ -814,7 +814,7 @@ QString RimWellLogExtractionCurve::wellDate() const } } - return (m_timeStep < timeStepNames.size()) ? timeStepNames[m_timeStep] : ""; + return (m_timeStep >= 0 && m_timeStep < timeStepNames.size()) ? timeStepNames[m_timeStep] : ""; } //-------------------------------------------------------------------------------------------------- From 4094fd186182857f759ff92fe021ba06f58217c9 Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Tue, 30 Jan 2018 13:30:05 +0100 Subject: [PATCH 52/78] #2421 RelPerm: Remove invalid points on transparent curve --- .../UserInterface/RiuRelativePermeabilityPlotPanel.cpp | 7 +++++-- .../UserInterface/RiuRelativePermeabilityPlotPanel.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ApplicationCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp b/ApplicationCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp index 4ed965093d..48a35fb816 100644 --- a/ApplicationCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp +++ b/ApplicationCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp @@ -22,6 +22,7 @@ #include "RiuLineSegmentQwtPlotCurve.h" #include "RiuTextDialog.h" +#include "RigCurveDataTools.h" #include "RigFlowDiagSolverInterface.h" #include "cvfBase.h" @@ -232,7 +233,7 @@ void RiuRelativePermeabilityPlotPanel::plotUiSelectedCurves() //-------------------------------------------------------------------------------------------------- /// Add a transparent curve to make tooltip available on given points. //-------------------------------------------------------------------------------------------------- -void RiuRelativePermeabilityPlotPanel::addTransparentCurve(QwtPlot* plot, const std::vector& points, const std::vector& axes) +void RiuRelativePermeabilityPlotPanel::addTransparentCurve(QwtPlot* plot, const std::vector& points, const std::vector& axes, bool logScaleLeftAxis) { QwtPlotCurve* curveLeftAxis = new QwtPlotCurve(); QwtPlotCurve* curveRightAxis = new QwtPlotCurve(); @@ -245,6 +246,8 @@ void RiuRelativePermeabilityPlotPanel::addTransparentCurve(QwtPlot* plot, const for (size_t i = 0; i < points.size(); i++) { + if (!RigCurveDataTools::isValidValue(points[i].y(), logScaleLeftAxis)) continue; + if (axes[i] == LEFT_YAXIS) { pointsOnLeftAxis.push_back(points[i]); @@ -382,7 +385,7 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt(RiaEclipseUnitTools::Unit plot->enableAxis(QwtPlot::yRight, shouldEnableRightYAxis); - addTransparentCurve(plot, points, axes); + addTransparentCurve(plot, points, axes, logScaleLeftAxis); // Add vertical marker lines to indicate cell SWAT and/or SGAS saturations if (swat != HUGE_VAL) diff --git a/ApplicationCode/UserInterface/RiuRelativePermeabilityPlotPanel.h b/ApplicationCode/UserInterface/RiuRelativePermeabilityPlotPanel.h index b3bbd6e759..faeb469935 100644 --- a/ApplicationCode/UserInterface/RiuRelativePermeabilityPlotPanel.h +++ b/ApplicationCode/UserInterface/RiuRelativePermeabilityPlotPanel.h @@ -103,7 +103,7 @@ class RiuRelativePermeabilityPlotPanel : public QWidget static double interpolatedCurveYValue(const std::vector& xVals, const std::vector& yVals, double x); - static void addTransparentCurve(QwtPlot* plot, const std::vector& points, const std::vector& axes); + static void addTransparentCurve(QwtPlot* plot, const std::vector& points, const std::vector& axes, bool logScaleLeftAxis); std::vector gatherUiSelectedCurves() const; QString asciiDataForUiSelectedCurves() const; From e417e3af76074cc6038522cd382c33f7c50d24fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Tue, 30 Jan 2018 13:48:28 +0100 Subject: [PATCH 53/78] #2277 external files. Improve robustness when importing --- .../RimStimPlanFractureTemplate.cpp | 37 +++++++++++++------ .../Completions/RimStimPlanFractureTemplate.h | 1 + .../RimEclipseResultDefinition.cpp | 12 +++--- 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp b/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp index 7a3ad7d19b..259948df34 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp @@ -50,7 +50,7 @@ #include #include - +static std::vector EMPTY_DOUBLE_VECTOR; CAF_PDM_SOURCE_INIT(RimStimPlanFractureTemplate, "RimStimPlanFractureTemplate"); @@ -75,6 +75,7 @@ RimStimPlanFractureTemplate::RimStimPlanFractureTemplate(void) CAF_PDM_InitField(&m_conductivityScalingFactor, "ConductivityFactor", 1.0, "Conductivity Scaling Factor", "", "The conductivity values read from file will be scaled with this parameters", ""); m_fractureGrid = new RigFractureGrid(); + m_readError = false; } //-------------------------------------------------------------------------------------------------- @@ -93,6 +94,7 @@ void RimStimPlanFractureTemplate::fieldChangedByUi(const caf::PdmFieldHandle* ch if (&m_stimPlanFileName == changedField) { + m_readError = false; updateUiTreeName(); loadDataAndUpdate(); setDefaultsBasedOnXMLfile(); @@ -237,16 +239,21 @@ bool RimStimPlanFractureTemplate::setBorderPolygonResultNameToDefault() void RimStimPlanFractureTemplate::loadDataAndUpdate() { QString errorMessage; + + if (m_readError) return; + m_stimPlanFractureDefinitionData = RifStimPlanXmlReader::readStimPlanXMLFile( m_stimPlanFileName(), m_conductivityScalingFactor(), &errorMessage); if (errorMessage.size() > 0) RiaLogging::error(errorMessage); if (m_stimPlanFractureDefinitionData.notNull()) { fractureTemplateUnit = m_stimPlanFractureDefinitionData->unitSet(); + m_readError = false; } else { fractureTemplateUnit = RiaEclipseUnitTools::UNITS_UNKNOWN; + m_readError = true; } updateFractureGrid(); @@ -335,7 +342,7 @@ QString RimStimPlanFractureTemplate::getUnitForStimPlanParameter(QString paramet const std::vector& RimStimPlanFractureTemplate::timeSteps() { if (m_stimPlanFractureDefinitionData.isNull()) loadDataAndUpdate(); - return m_stimPlanFractureDefinitionData->timeSteps(); + return m_stimPlanFractureDefinitionData.notNull() ? m_stimPlanFractureDefinitionData->timeSteps() : EMPTY_DOUBLE_VECTOR; } //-------------------------------------------------------------------------------------------------- @@ -367,6 +374,7 @@ void RimStimPlanFractureTemplate::computeMinMax(const QString& resultName, const //-------------------------------------------------------------------------------------------------- std::vector> RimStimPlanFractureTemplate::resultValues(const QString& resultName, const QString& unitName, size_t timeStepIndex) const { + if (m_stimPlanFractureDefinitionData.isNull()) return std::vector>(); return m_stimPlanFractureDefinitionData->getDataAtTimeIndex(resultName, unitName, timeStepIndex); } @@ -375,6 +383,7 @@ std::vector> RimStimPlanFractureTemplate::resultValues(const //-------------------------------------------------------------------------------------------------- std::vector RimStimPlanFractureTemplate::fractureGridResults(const QString& resultName, const QString& unitName, size_t timeStepIndex) const { + if (m_stimPlanFractureDefinitionData.isNull()) return EMPTY_DOUBLE_VECTOR; return m_stimPlanFractureDefinitionData->fractureGridResults(resultName, unitName, timeStepIndex); } @@ -405,9 +414,12 @@ const RigFractureGrid* RimStimPlanFractureTemplate::fractureGrid() const //-------------------------------------------------------------------------------------------------- void RimStimPlanFractureTemplate::updateFractureGrid() { - m_fractureGrid = m_stimPlanFractureDefinitionData->createFractureGrid(m_activeTimeStepIndex, - fractureTemplateUnit, - m_wellPathDepthAtFracture); + if (m_stimPlanFractureDefinitionData.notNull()) + { + m_fractureGrid = m_stimPlanFractureDefinitionData->createFractureGrid(m_activeTimeStepIndex, + fractureTemplateUnit, + m_wellPathDepthAtFracture); + } } @@ -424,12 +436,14 @@ void RimStimPlanFractureTemplate::fractureTriangleGeometry(std::vectorcreateFractureTriangleGeometry(m_wellPathDepthAtFracture, - neededUnit, - name, - nodeCoords, - triangleIndices); + else + { + m_stimPlanFractureDefinitionData->createFractureTriangleGeometry(m_wellPathDepthAtFracture, + neededUnit, + name, + nodeCoords, + triangleIndices); + } return; } @@ -438,6 +452,7 @@ void RimStimPlanFractureTemplate::fractureTriangleGeometry(std::vector RimStimPlanFractureTemplate::fractureBorderPolygon(RiaEclipseUnitTools::UnitSystem neededUnit) { + if (m_stimPlanFractureDefinitionData.isNull()) return std::vector(); QString parameterName = m_borderPolygonResultName; QString parameterUnit = getUnitForStimPlanParameter(parameterName); diff --git a/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h b/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h index 52f1e5fc1b..3bb90111a1 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h +++ b/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h @@ -107,4 +107,5 @@ class RimStimPlanFractureTemplate : public RimFractureTemplate caf::PdmField m_conductivityScalingFactor; cvf::ref m_fractureGrid; + bool m_readError; }; diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp index d9a062c9bd..ea528d28fc 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp @@ -458,13 +458,15 @@ QList RimEclipseResultDefinition::calculateValueOptions( bool enableSouring = false; #ifdef ENABLE_SOURING - RigCaseCellResultsData* cellResultsData = m_eclipseCase->results(this->porosityModel()); - - if (cellResultsData->hasFlowDiagUsableFluxes()) + if (m_eclipseCase.notNull()) { - enableSouring = true; - } + RigCaseCellResultsData* cellResultsData = m_eclipseCase->results(this->porosityModel()); + if (cellResultsData->hasFlowDiagUsableFluxes()) + { + enableSouring = true; + } + } #endif /* ENABLE_SOURING */ From bc72c86497fd2f99d8ba117550849579613145e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Tue, 30 Jan 2018 15:51:48 +0100 Subject: [PATCH 54/78] #2229 curve creator. Update when adding/deleting observed summary cases --- .../ProjectDataModel/Summary/RimObservedDataCollection.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ApplicationCode/ProjectDataModel/Summary/RimObservedDataCollection.cpp b/ApplicationCode/ProjectDataModel/Summary/RimObservedDataCollection.cpp index a8ca65068a..e302d3b260 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimObservedDataCollection.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimObservedDataCollection.cpp @@ -36,6 +36,7 @@ #include "cafUtils.h" #include "cafPdmSettings.h" #include "cafPdmUiPropertyViewDialog.h" +#include "cafPdmUiObjectEditorHandle.h" #include @@ -67,6 +68,7 @@ RimObservedDataCollection::~RimObservedDataCollection() void RimObservedDataCollection::removeObservedData(RimObservedData* observedData) { m_observedDataArray.removeChildObject(observedData); + caf::PdmUiObjectEditorHandle::updateUiAllObjectEditors(); } //-------------------------------------------------------------------------------------------------- @@ -136,7 +138,7 @@ RimObservedData* RimObservedDataCollection::createAndAddRsmObservedDataFromFile( } this->updateConnectedEditors(); - + caf::PdmUiObjectEditorHandle::updateUiAllObjectEditors(); return observedData; } @@ -198,5 +200,6 @@ RimObservedData* RimObservedDataCollection::createAndAddCvsObservedDataFromFile( } this->updateConnectedEditors(); + caf::PdmUiObjectEditorHandle::updateUiAllObjectEditors(); return observedData; } From fa66cf14cdb41783ecbfd8920f7f2eb3d164baea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Wed, 31 Jan 2018 08:32:14 +0100 Subject: [PATCH 55/78] #2229 curve creator. Update when adding/deleting calculated curves as well --- .../SummaryPlotCommands/RicSummaryCurveCalculator.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculator.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculator.cpp index 55f7a60ce5..b3cb154cef 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculator.cpp +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculator.cpp @@ -28,6 +28,7 @@ #include "cafPdmUiListEditor.h" #include "cafPdmUiPushButtonEditor.h" #include "cafPdmUiTreeSelectionEditor.h" +#include "cafPdmUiObjectEditorHandle.h" CAF_PDM_SOURCE_INIT(RicSummaryCurveCalculator, "RicSummaryCurveCalculator"); @@ -134,6 +135,7 @@ void RicSummaryCurveCalculator::fieldChangedByUi(const caf::PdmFieldHandle* chan m_currentCalculation = nullptr; this->updateConnectedEditors(); + caf::PdmUiObjectEditorHandle::updateUiAllObjectEditors(); } } } @@ -247,6 +249,7 @@ bool RicSummaryCurveCalculator::calculate() const } m_currentCalculation()->updateDependentCurvesAndPlots(); + caf::PdmUiObjectEditorHandle::updateUiAllObjectEditors(); } return true; @@ -268,7 +271,7 @@ void RicSummaryCurveCalculator::defineEditorAttribute(const caf::PdmFieldHandle* } //-------------------------------------------------------------------------------------------------- -/// +/// f //-------------------------------------------------------------------------------------------------- void RicSummaryCurveCalculator::onEditorWidgetsCreated() { From 60afae10adb3d3336b0e39442f8a59ceda45ebf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Wed, 31 Jan 2018 15:34:50 +0100 Subject: [PATCH 56/78] #2429, #2430. Display perforations correctly --- ApplicationCode/ProjectDataModel/RimEclipseView.cpp | 2 ++ .../ProjectDataModel/RimSimWellInViewCollection.cpp | 7 +++++++ ApplicationCode/ProjectDataModel/RimView.cpp | 2 +- ApplicationCode/ProjectDataModel/RimView.h | 2 +- .../ProjectDataModel/RimWellPathCollection.cpp | 13 +++++++++++++ .../ProjectDataModel/RimWellPathCollection.h | 2 ++ 6 files changed, 26 insertions(+), 2 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp index 10967ed631..49cc223a6f 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp @@ -1559,6 +1559,8 @@ bool RimEclipseView::isTimeStepDependentDataVisible() const if (this->faultResultSettings->customFaultResult()->isTernarySaturationSelected()) return true; } + if (this->wellPathCollection()->anyWellsContainingPerforationIntervals()) return true; + return false; } diff --git a/ApplicationCode/ProjectDataModel/RimSimWellInViewCollection.cpp b/ApplicationCode/ProjectDataModel/RimSimWellInViewCollection.cpp index fd82a86b03..66c298c664 100644 --- a/ApplicationCode/ProjectDataModel/RimSimWellInViewCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimSimWellInViewCollection.cpp @@ -320,6 +320,13 @@ void RimSimWellInViewCollection::fieldChangedByUi(const caf::PdmFieldHandle* cha if (&isActive == changedField) { this->updateUiIconFromToggleField(); + + RimView* view; + firstAncestorOrThisOfType(view); + if (view) + { + view->hasUserRequestedAnimation = true; + } } if (&m_showWellLabel == changedField) diff --git a/ApplicationCode/ProjectDataModel/RimView.cpp b/ApplicationCode/ProjectDataModel/RimView.cpp index 00df6206a9..9ad8e8535c 100644 --- a/ApplicationCode/ProjectDataModel/RimView.cpp +++ b/ApplicationCode/ProjectDataModel/RimView.cpp @@ -436,7 +436,7 @@ void RimView::endAnimation() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimWellPathCollection* RimView::wellPathCollection() +RimWellPathCollection* RimView::wellPathCollection() const { RimProject* proj = nullptr; this->firstAncestorOrThisOfTypeAsserted(proj); diff --git a/ApplicationCode/ProjectDataModel/RimView.h b/ApplicationCode/ProjectDataModel/RimView.h index 8bd337cebb..7164fcb062 100644 --- a/ApplicationCode/ProjectDataModel/RimView.h +++ b/ApplicationCode/ProjectDataModel/RimView.h @@ -210,7 +210,7 @@ class RimView : public RimViewWindow virtual void onLoadDataAndUpdate() = 0; - RimWellPathCollection* wellPathCollection(); + RimWellPathCollection* wellPathCollection() const; QPointer m_viewer; diff --git a/ApplicationCode/ProjectDataModel/RimWellPathCollection.cpp b/ApplicationCode/ProjectDataModel/RimWellPathCollection.cpp index 6b0a745863..f02e2528af 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellPathCollection.cpp @@ -37,6 +37,7 @@ #include "RimProject.h" #include "RimWellLogFile.h" #include "RimWellPath.h" +#include "RimPerforationCollection.h" #include "RiuMainWindow.h" @@ -478,6 +479,18 @@ void RimWellPathCollection::updateFilePathsFromProjectPath(const QString& newPro } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimWellPathCollection::anyWellsContainingPerforationIntervals() const +{ + for (const auto& wellPath : wellPaths) + { + if (!wellPath->perforationIntervalCollection()->perforations().empty()) return true; + } + return false; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimWellPathCollection.h b/ApplicationCode/ProjectDataModel/RimWellPathCollection.h index a4b4c87479..904b705c3d 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathCollection.h +++ b/ApplicationCode/ProjectDataModel/RimWellPathCollection.h @@ -122,6 +122,8 @@ class RimWellPathCollection : public caf::PdmObject const cvf::BoundingBox& wellPathClipBoundingBox, const caf::DisplayCoordTransform* displayCoordTransform); void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath); + bool anyWellsContainingPerforationIntervals() const; + protected: virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; From 740baf661ccc2dfa2ba69f74a15f1c61548e4305 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Wed, 31 Jan 2018 15:38:36 +0100 Subject: [PATCH 57/78] Upped to version 2018.01.01-patch.04 --- ResInsightVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index a68a1dac23..bac7877ebd 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -10,7 +10,7 @@ set(RESINSIGHT_VERSION_TEXT "-patch") # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -set(RESINSIGHT_DEV_VERSION ".03") +set(RESINSIGHT_DEV_VERSION ".04") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") From 71310061887a851c109b8f757091a001e5f532c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Thu, 1 Feb 2018 09:10:31 +0100 Subject: [PATCH 58/78] #2422 perforations. Update tree view after perforations import --- .../RicWellPathImportPerforationIntervalsFeature.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ApplicationCode/Commands/CompletionCommands/RicWellPathImportPerforationIntervalsFeature.cpp b/ApplicationCode/Commands/CompletionCommands/RicWellPathImportPerforationIntervalsFeature.cpp index 8c14b4ff9b..79d225d22f 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicWellPathImportPerforationIntervalsFeature.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicWellPathImportPerforationIntervalsFeature.cpp @@ -71,6 +71,7 @@ void RicWellPathImportPerforationIntervalsFeature::onActionTriggered(bool isChec std::map > perforationIntervals = RifPerforationIntervalReader::readPerforationIntervals(wellPathFilePaths); + RimPerforationInterval* lastPerforationInterval = nullptr; for (auto& entry : perforationIntervals) { RimWellPath* wellPath = wellPathCollection->tryFindMatchingWellPath(entry.first); @@ -95,14 +96,21 @@ void RicWellPathImportPerforationIntervalsFeature::onActionTriggered(bool isChec perforationInterval->setDate(interval.date); } wellPath->perforationIntervalCollection()->appendPerforation(perforationInterval); + lastPerforationInterval = perforationInterval; } } } + wellPathCollection->uiCapability()->updateConnectedEditors(); if (app->project()) { app->project()->createDisplayModelAndRedrawAllViews(); } + + if (lastPerforationInterval) + { + RiuMainWindow::instance()->selectAsCurrentItem(lastPerforationInterval); + } } //-------------------------------------------------------------------------------------------------- From c8e002d532f175b8c0c2303eaa01046927753726 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 16 Jan 2018 07:54:03 +0100 Subject: [PATCH 59/78] #2374 Fracture : Incomplete results when computing intersected StimPlan cells --- .../ReservoirDataModel/RigWellPath.cpp | 26 ++++--- .../ReservoirDataModel/RigWellPath.h | 3 +- .../RigWellPathStimplanIntersector.cpp | 2 +- .../RigWellPathIntersectionTools-Test.cpp | 72 ++++++++++++++++++- 4 files changed, 89 insertions(+), 14 deletions(-) diff --git a/ApplicationCode/ReservoirDataModel/RigWellPath.cpp b/ApplicationCode/ReservoirDataModel/RigWellPath.cpp index f8b2bb072d..401160ebac 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellPath.cpp +++ b/ApplicationCode/ReservoirDataModel/RigWellPath.cpp @@ -215,35 +215,41 @@ std::pair, std::vector > RigWellPath::clippedPoi //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RigWellPath::wellPathPointsIncludingFractureIntersection(double fractureIntersectionMD) const +std::vector RigWellPath::wellPathPointsIncludingInterpolatedIntersectionPoint(double intersectionMeasuredDepth) const { std::vector points; if (m_measuredDepths.empty()) return points; - cvf::Vec3d fractureWellPathPpoint = interpolatedPointAlongWellPath(fractureIntersectionMD); + cvf::Vec3d interpolatedWellPathPoint = interpolatedPointAlongWellPath(intersectionMeasuredDepth); - for (size_t i = 0; i < m_measuredDepths.size()-1; i++) + for (size_t i = 0; i < m_measuredDepths.size() - 1; i++) { - if (m_measuredDepths[i] < fractureIntersectionMD) + if (m_measuredDepths[i] == intersectionMeasuredDepth) { points.push_back(m_wellPathPoints[i]); - if (m_measuredDepths[i + 1] > fractureIntersectionMD) + } + else if (m_measuredDepths[i] < intersectionMeasuredDepth) + { + points.push_back(m_wellPathPoints[i]); + if (m_measuredDepths[i + 1] > intersectionMeasuredDepth) { - points.push_back(fractureWellPathPpoint); + points.push_back(interpolatedWellPathPoint); } } - else if (m_measuredDepths[i] < fractureIntersectionMD) + else if (m_measuredDepths[i] > intersectionMeasuredDepth) { if (i == 0) { - points.push_back(fractureWellPathPpoint); + points.push_back(interpolatedWellPathPoint); + } + else + { + points.push_back(m_wellPathPoints[i]); } - points.push_back(m_wellPathPoints[i]); } } points.push_back(m_wellPathPoints.back()); return points; - } diff --git a/ApplicationCode/ReservoirDataModel/RigWellPath.h b/ApplicationCode/ReservoirDataModel/RigWellPath.h index 9f66d4d68a..94f39b026b 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellPath.h +++ b/ApplicationCode/ReservoirDataModel/RigWellPath.h @@ -47,7 +47,8 @@ class RigWellPath : public cvf::Object std::pair, std::vector > clippedPointSubset(double startMD, double endMD) const; - std::vector wellPathPointsIncludingFractureIntersection(double fractureIntersectionMD) const; + std::vector wellPathPointsIncludingInterpolatedIntersectionPoint(double intersectionMeasuredDepth) const; + private: bool m_hasDatumElevation; double m_datumElevation; diff --git a/ApplicationCode/ReservoirDataModel/RigWellPathStimplanIntersector.cpp b/ApplicationCode/ReservoirDataModel/RigWellPathStimplanIntersector.cpp index 44eb2181d3..46c7c821c3 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellPathStimplanIntersector.cpp +++ b/ApplicationCode/ReservoirDataModel/RigWellPathStimplanIntersector.cpp @@ -37,7 +37,7 @@ RigWellPathStimplanIntersector::RigWellPathStimplanIntersector(const RigWellPath* wellpathGeom, RimFracture* rimFracture) { - std::vector wellPathPoints = wellpathGeom->wellPathPointsIncludingFractureIntersection(rimFracture->fractureMD()); + std::vector wellPathPoints = wellpathGeom->wellPathPointsIncludingInterpolatedIntersectionPoint(rimFracture->fractureMD()); cvf::Mat4d fractureXf = rimFracture->transformMatrix(); double wellRadius = rimFracture->wellRadius(rimFracture->fractureUnit()); std::vector > stpCellPolygons; diff --git a/ApplicationCode/UnitTests/RigWellPathIntersectionTools-Test.cpp b/ApplicationCode/UnitTests/RigWellPathIntersectionTools-Test.cpp index 2ae678cf1f..777057a2ae 100644 --- a/ApplicationCode/UnitTests/RigWellPathIntersectionTools-Test.cpp +++ b/ApplicationCode/UnitTests/RigWellPathIntersectionTools-Test.cpp @@ -18,7 +18,75 @@ #include "gtest/gtest.h" -#include "RigWellPathIntersectionTools.h" +#include "RigWellPath.h" -#include "cvfStructGrid.h" +#include "cvfBase.h" +#include "cvfVector3.h" + +#include + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +TEST(RigWellPathTest, FindWellPathCoordsIncludingIntersectionPoint) +{ + RigWellPath wellPathGeometry; + { + std::vector wellPathPoints; + std::vector mdValues; + + wellPathPoints.push_back(cvf::Vec3d(0.0, 0.0, 0.0)); + wellPathPoints.push_back(cvf::Vec3d(0.0, 1.0, 0.0)); + wellPathPoints.push_back(cvf::Vec3d(0.0, 2.0, 0.0)); + wellPathPoints.push_back(cvf::Vec3d(0.0, 3.0, 0.0)); + wellPathPoints.push_back(cvf::Vec3d(0.0, 4.0, 0.0)); + + mdValues.push_back(0.0); + mdValues.push_back(1.0); + mdValues.push_back(2.0); + mdValues.push_back(3.0); + mdValues.push_back(4.0); + + + wellPathGeometry.m_wellPathPoints = wellPathPoints; + wellPathGeometry.m_measuredDepths = mdValues; + } + + // Before first MD + { + auto wellPathPoints = wellPathGeometry.wellPathPointsIncludingInterpolatedIntersectionPoint(-1.0); + EXPECT_EQ(5u, wellPathPoints.size()); + } + + // Identical to first MD + { + auto wellPathPoints = wellPathGeometry.wellPathPointsIncludingInterpolatedIntersectionPoint(0.0); + EXPECT_EQ(5u, wellPathPoints.size()); + } + + // Identical to second MD + { + auto wellPathPoints = wellPathGeometry.wellPathPointsIncludingInterpolatedIntersectionPoint(1.0); + EXPECT_EQ(5u, wellPathPoints.size()); + } + + // Between first and second MD + { + auto wellPathPoints = wellPathGeometry.wellPathPointsIncludingInterpolatedIntersectionPoint(0.3); + EXPECT_EQ(6u, wellPathPoints.size()); + } + + // Identical to lastMD + { + auto wellPathPoints = wellPathGeometry.wellPathPointsIncludingInterpolatedIntersectionPoint(4.0); + EXPECT_EQ(5u, wellPathPoints.size()); + } + + // Larger than lastMD + { + auto wellPathPoints = wellPathGeometry.wellPathPointsIncludingInterpolatedIntersectionPoint(10.0); + EXPECT_EQ(5u, wellPathPoints.size()); + } +} From dc0c6d1b4706880cb03e797162d897b4c037c1b7 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 2 Feb 2018 09:37:00 +0100 Subject: [PATCH 60/78] #2443 : Remove obsolete includes of QMessageBox --- .../CompletionCommands/RicExportFishbonesLateralsFeature.cpp | 1 - .../CompletionCommands/RicExportFishbonesWellSegmentsFeature.cpp | 1 - .../ExportCommands/RicSaveEclipseInputVisibleCellsFeature.cpp | 1 - .../ExportCommands/RicSnapshotViewToClipboardFeature.cpp | 1 - .../Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp | 1 - .../Commands/OctaveScriptCommands/RicDeleteScriptPathFeature.cpp | 1 - .../Commands/RicConvertAllFractureTemplatesToFieldFeature.cpp | 1 - .../Commands/RicConvertAllFractureTemplatesToMetricFeature.cpp | 1 - .../Commands/RicConvertFractureTemplateUnitFeature.cpp | 1 - .../SummaryPlotCommands/RicAsciiExportSummaryPlotFeature.cpp | 1 - .../WellLogCommands/RicAsciiExportWellLogPlotFeature.cpp | 1 - .../ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp | 1 - 12 files changed, 12 deletions(-) diff --git a/ApplicationCode/Commands/CompletionCommands/RicExportFishbonesLateralsFeature.cpp b/ApplicationCode/Commands/CompletionCommands/RicExportFishbonesLateralsFeature.cpp index 74c8a32526..bc36f9192a 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicExportFishbonesLateralsFeature.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicExportFishbonesLateralsFeature.cpp @@ -32,7 +32,6 @@ #include #include -#include CAF_CMD_SOURCE_INIT(RicExportFishbonesLateralsFeature, "RicExportFishbonesLateralsFeature"); diff --git a/ApplicationCode/Commands/CompletionCommands/RicExportFishbonesWellSegmentsFeature.cpp b/ApplicationCode/Commands/CompletionCommands/RicExportFishbonesWellSegmentsFeature.cpp index 1431b059a2..e7b206eb85 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicExportFishbonesWellSegmentsFeature.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicExportFishbonesWellSegmentsFeature.cpp @@ -43,7 +43,6 @@ #include "cvfMath.h" #include -#include #include diff --git a/ApplicationCode/Commands/ExportCommands/RicSaveEclipseInputVisibleCellsFeature.cpp b/ApplicationCode/Commands/ExportCommands/RicSaveEclipseInputVisibleCellsFeature.cpp index f8dbf19272..5f4f31b112 100644 --- a/ApplicationCode/Commands/ExportCommands/RicSaveEclipseInputVisibleCellsFeature.cpp +++ b/ApplicationCode/Commands/ExportCommands/RicSaveEclipseInputVisibleCellsFeature.cpp @@ -42,7 +42,6 @@ #include #include -#include CAF_CMD_SOURCE_INIT(RicSaveEclipseInputVisibleCellsFeature, "RicSaveEclipseInputVisibleCellsFeature"); CAF_CMD_SOURCE_INIT(RicSaveEclipseInputActiveVisibleCellsFeature, "RicSaveEclipseInputActiveVisibleCellsFeature"); diff --git a/ApplicationCode/Commands/ExportCommands/RicSnapshotViewToClipboardFeature.cpp b/ApplicationCode/Commands/ExportCommands/RicSnapshotViewToClipboardFeature.cpp index 7678fc5f71..499efe5ed5 100644 --- a/ApplicationCode/Commands/ExportCommands/RicSnapshotViewToClipboardFeature.cpp +++ b/ApplicationCode/Commands/ExportCommands/RicSnapshotViewToClipboardFeature.cpp @@ -35,7 +35,6 @@ #include #include #include -#include CAF_CMD_SOURCE_INIT(RicSnapshotViewToClipboardFeature, "RicSnapshotViewToClipboardFeature"); diff --git a/ApplicationCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp b/ApplicationCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp index 86cd089a76..dd4f5c114f 100644 --- a/ApplicationCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp +++ b/ApplicationCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp @@ -36,7 +36,6 @@ #include #include #include -#include CAF_CMD_SOURCE_INIT(RicSnapshotViewToFileFeature, "RicSnapshotViewToFileFeature"); diff --git a/ApplicationCode/Commands/OctaveScriptCommands/RicDeleteScriptPathFeature.cpp b/ApplicationCode/Commands/OctaveScriptCommands/RicDeleteScriptPathFeature.cpp index 02f046326b..745dc7d3ef 100644 --- a/ApplicationCode/Commands/OctaveScriptCommands/RicDeleteScriptPathFeature.cpp +++ b/ApplicationCode/Commands/OctaveScriptCommands/RicDeleteScriptPathFeature.cpp @@ -31,7 +31,6 @@ #include "cvfAssert.h" #include -#include CAF_CMD_SOURCE_INIT(RicDeleteScriptPathFeature, "RicDeleteScriptPathFeature"); diff --git a/ApplicationCode/Commands/RicConvertAllFractureTemplatesToFieldFeature.cpp b/ApplicationCode/Commands/RicConvertAllFractureTemplatesToFieldFeature.cpp index 6934214627..f554dd318c 100644 --- a/ApplicationCode/Commands/RicConvertAllFractureTemplatesToFieldFeature.cpp +++ b/ApplicationCode/Commands/RicConvertAllFractureTemplatesToFieldFeature.cpp @@ -39,7 +39,6 @@ #include "cvfAssert.h" #include -#include #include #include diff --git a/ApplicationCode/Commands/RicConvertAllFractureTemplatesToMetricFeature.cpp b/ApplicationCode/Commands/RicConvertAllFractureTemplatesToMetricFeature.cpp index 617f91c9f0..62c6593472 100644 --- a/ApplicationCode/Commands/RicConvertAllFractureTemplatesToMetricFeature.cpp +++ b/ApplicationCode/Commands/RicConvertAllFractureTemplatesToMetricFeature.cpp @@ -40,7 +40,6 @@ #include #include -#include #include CAF_CMD_SOURCE_INIT(RicConvertAllFractureTemplatesToMetricFeature, "RicConvertAllFractureTemplatesToMetricFeature"); diff --git a/ApplicationCode/Commands/RicConvertFractureTemplateUnitFeature.cpp b/ApplicationCode/Commands/RicConvertFractureTemplateUnitFeature.cpp index c0e81c537a..8756fb11e6 100644 --- a/ApplicationCode/Commands/RicConvertFractureTemplateUnitFeature.cpp +++ b/ApplicationCode/Commands/RicConvertFractureTemplateUnitFeature.cpp @@ -39,7 +39,6 @@ #include "cvfAssert.h" #include -#include #include #include diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicAsciiExportSummaryPlotFeature.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicAsciiExportSummaryPlotFeature.cpp index f441dfc4d7..42800378a9 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/RicAsciiExportSummaryPlotFeature.cpp +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicAsciiExportSummaryPlotFeature.cpp @@ -36,7 +36,6 @@ #include #include #include -#include diff --git a/ApplicationCode/Commands/WellLogCommands/RicAsciiExportWellLogPlotFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicAsciiExportWellLogPlotFeature.cpp index f4f8c37791..4e83bcbb78 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicAsciiExportWellLogPlotFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicAsciiExportWellLogPlotFeature.cpp @@ -35,7 +35,6 @@ #include #include #include -#include diff --git a/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp b/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp index 259948df34..d371bc762e 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp @@ -44,7 +44,6 @@ #include "cvfVector3.h" #include -#include #include #include From ba09906163e4cbbbdd388189c7aa5ee7637ae7da Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 2 Feb 2018 09:37:34 +0100 Subject: [PATCH 61/78] #2443 Replace QMessageBox with RiaLogging to avoid blocking of batch commands --- .../Commands/ExportCommands/RicExportFaultsFeature.cpp | 4 ++-- .../RicSaveEclipseResultAsInputPropertyExec.cpp | 5 +++-- .../ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp | 3 +-- .../ExportCommands/RicSnapshotAllViewsToFileFeature.cpp | 3 +-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/ApplicationCode/Commands/ExportCommands/RicExportFaultsFeature.cpp b/ApplicationCode/Commands/ExportCommands/RicExportFaultsFeature.cpp index 96e8af90ac..2a36d63a46 100644 --- a/ApplicationCode/Commands/ExportCommands/RicExportFaultsFeature.cpp +++ b/ApplicationCode/Commands/ExportCommands/RicExportFaultsFeature.cpp @@ -20,6 +20,7 @@ #include "RicExportFaultsFeature.h" #include "RiaApplication.h" +#include "RiaLogging.h" #include "RigEclipseCaseData.h" #include "RigFault.h" @@ -33,7 +34,6 @@ #include #include -#include CAF_CMD_SOURCE_INIT(RicExportFaultsFeature, "RicExportFaultsFeature"); @@ -191,7 +191,7 @@ void RicExportFaultsFeature::saveFault(QString completeFilename, const RigMainGr if (!exportFile.open(QIODevice::WriteOnly) ) { - QMessageBox::critical(NULL, "ResInsight - Export Faults", "Could not open the file :\n" + completeFilename); + RiaLogging::error("Could not open the file : " + completeFilename); } QTextStream stream(&exportFile); diff --git a/ApplicationCode/Commands/ExportCommands/RicSaveEclipseResultAsInputPropertyExec.cpp b/ApplicationCode/Commands/ExportCommands/RicSaveEclipseResultAsInputPropertyExec.cpp index b9ffe7fb15..209c13a23d 100644 --- a/ApplicationCode/Commands/ExportCommands/RicSaveEclipseResultAsInputPropertyExec.cpp +++ b/ApplicationCode/Commands/ExportCommands/RicSaveEclipseResultAsInputPropertyExec.cpp @@ -20,6 +20,7 @@ #include "RicSaveEclipseResultAsInputPropertyExec.h" #include "RiaApplication.h" +#include "RiaLogging.h" #include "RicExportFeatureImpl.h" @@ -38,7 +39,7 @@ #include "cafPdmUiPropertyViewDialog.h" #include "cafUtils.h" -#include + //-------------------------------------------------------------------------------------------------- /// @@ -101,7 +102,7 @@ void RicSaveEclipseResultAsInputPropertyExec::redo() bool isOk = RifEclipseInputFileTools::writeBinaryResultToTextFile(exportSettings.fileName, m_cellColors->reservoirView()->eclipseCase()->eclipseCaseData(), timeStep, m_cellColors, exportSettings.eclipseKeyword, exportSettings.undefinedValue); if (!isOk) { - QMessageBox::critical(NULL, "File export", "Failed to exported current result to " + exportSettings.fileName); + RiaLogging::error("Failed to exported current result to " + exportSettings.fileName); } } } diff --git a/ApplicationCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp b/ApplicationCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp index b91b150254..b00dab064b 100644 --- a/ApplicationCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp +++ b/ApplicationCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp @@ -38,7 +38,6 @@ #include #include #include -#include CAF_CMD_SOURCE_INIT(RicSnapshotAllPlotsToFileFeature, "RicSnapshotAllPlotsToFileFeature"); @@ -63,7 +62,7 @@ void RicSnapshotAllPlotsToFileFeature::saveAllPlots() exportSnapshotOfAllPlotsIntoFolder(snapshotFolderName); QString text = QString("Exported snapshots to folder : \n%1").arg(snapshotFolderName); - QMessageBox::information(nullptr, "Export Snapshots To Folder", text); + RiaLogging::info(text); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.cpp b/ApplicationCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.cpp index 48ca2cf578..e516785cd0 100644 --- a/ApplicationCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.cpp +++ b/ApplicationCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.cpp @@ -44,7 +44,6 @@ #include #include #include -#include CAF_CMD_SOURCE_INIT(RicSnapshotAllViewsToFileFeature, "RicSnapshotAllViewsToFileFeature"); @@ -64,7 +63,7 @@ void RicSnapshotAllViewsToFileFeature::saveAllViews() exportSnapshotOfAllViewsIntoFolder(snapshotFolderName); QString text = QString("Exported snapshots to folder : \n%1").arg(snapshotFolderName); - QMessageBox::information(nullptr, "Export Snapshots To Folder", text); + RiaLogging::info(text); } //-------------------------------------------------------------------------------------------------- From b0ca4f3199e1e1ec4f13bf322bcc2b4c1e4973aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Fri, 2 Feb 2018 14:17:10 +0100 Subject: [PATCH 62/78] #2086 Handle extended file name chars on Linux for eclipse cases and summary cases --- .../FileInterface/CMakeLists_files.cmake | 2 + .../RifEclipseOutputFileTools.cpp | 15 +++--- .../RifEclipseRestartFilesetAccess.cpp | 6 ++- .../FileInterface/RifEclipseSummaryTools.cpp | 52 ++++++++++--------- .../FileInterface/RifEclipseSummaryTools.h | 12 +++-- .../RifEclipseUnifiedRestartFileAccess.cpp | 7 +-- .../FileInterface/RifReaderEclipseOutput.cpp | 7 +-- .../FileInterface/RifReaderEclipseRft.cpp | 12 +++-- .../FileInterface/RifReaderEclipseRft.h | 4 +- .../FileInterface/RifReaderEclipseSummary.cpp | 15 +++--- .../FileInterface/RifReaderEclipseSummary.h | 4 +- .../FileInterface/RifStringTools.cpp | 43 +++++++++++++++ .../FileInterface/RifStringTools.h | 38 ++++++++++++++ .../ProjectDataModel/RimEclipseResultCase.cpp | 2 +- .../Summary/RimFileSummaryCase.cpp | 6 +-- .../Summary/RimSummaryCaseMainCollection.cpp | 2 +- 16 files changed, 164 insertions(+), 63 deletions(-) create mode 100644 ApplicationCode/FileInterface/RifStringTools.cpp create mode 100644 ApplicationCode/FileInterface/RifStringTools.h diff --git a/ApplicationCode/FileInterface/CMakeLists_files.cmake b/ApplicationCode/FileInterface/CMakeLists_files.cmake index e437ee7c5b..af5063534b 100644 --- a/ApplicationCode/FileInterface/CMakeLists_files.cmake +++ b/ApplicationCode/FileInterface/CMakeLists_files.cmake @@ -40,6 +40,7 @@ ${CEE_CURRENT_LIST_DIR}RifCsvUserData.h ${CEE_CURRENT_LIST_DIR}RifCsvUserDataParser.h ${CEE_CURRENT_LIST_DIR}RifWellPathFormationReader.h ${CEE_CURRENT_LIST_DIR}RifWellPathFormationsImporter.h +${CEE_CURRENT_LIST_DIR}RifStringTools.h # HDF5 file reader is directly included in ResInsight main CmakeList.txt #${CEE_CURRENT_LIST_DIR}RifHdf5Reader.h ) @@ -84,6 +85,7 @@ ${CEE_CURRENT_LIST_DIR}RifCsvUserData.cpp ${CEE_CURRENT_LIST_DIR}RifCsvUserDataParser.cpp ${CEE_CURRENT_LIST_DIR}RifWellPathFormationReader.cpp ${CEE_CURRENT_LIST_DIR}RifWellPathFormationsImporter.cpp +${CEE_CURRENT_LIST_DIR}RifStringTools.cpp # HDF5 file reader is directly included in ResInsight main CmakeList.txt #${CEE_CURRENT_LIST_DIR}RifHdf5Reader.cpp diff --git a/ApplicationCode/FileInterface/RifEclipseOutputFileTools.cpp b/ApplicationCode/FileInterface/RifEclipseOutputFileTools.cpp index 915e953488..7059ff548b 100644 --- a/ApplicationCode/FileInterface/RifEclipseOutputFileTools.cpp +++ b/ApplicationCode/FileInterface/RifEclipseOutputFileTools.cpp @@ -22,6 +22,7 @@ #include "RifEclipseRestartFilesetAccess.h" #include "RifEclipseUnifiedRestartFileAccess.h" +#include "RifStringTools.h" #include "RiaQDateTimeTools.h" #include "ert/ecl/ecl_file.h" @@ -183,7 +184,7 @@ void RifEclipseOutputFileTools::timeSteps(ecl_file_type* ecl_file, std::vector* values) { - ecl_kw_type* kwData = ecl_file_iget_named_kw(ecl_file, keyword.toAscii().data(), static_cast(fileKeywordOccurrence)); + ecl_kw_type* kwData = ecl_file_iget_named_kw(ecl_file, RifStringTools::toNativeEncoded(keyword).data(), static_cast(fileKeywordOccurrence)); if (kwData) { size_t numValues = ecl_kw_get_size(kwData); @@ -205,7 +206,7 @@ bool RifEclipseOutputFileTools::keywordData(ecl_file_type* ecl_file, const QStri //-------------------------------------------------------------------------------------------------- bool RifEclipseOutputFileTools::keywordData(ecl_file_type* ecl_file, const QString& keyword, size_t fileKeywordOccurrence, std::vector* values) { - ecl_kw_type* kwData = ecl_file_iget_named_kw(ecl_file, keyword.toAscii().data(), static_cast(fileKeywordOccurrence)); + ecl_kw_type* kwData = ecl_file_iget_named_kw(ecl_file, RifStringTools::toNativeEncoded(keyword).data(), static_cast(fileKeywordOccurrence)); if (kwData) { size_t numValues = ecl_kw_get_size(kwData); @@ -232,7 +233,7 @@ QString RifEclipseOutputFileTools::firstFileNameOfType(const QStringList& fileSe { bool formatted = false; int reportNumber = -1; - if (ecl_util_get_file_type(fileSet.at(i).toAscii().data(), &formatted, &reportNumber) == fileType) + if (ecl_util_get_file_type(RifStringTools::toNativeEncoded(fileSet.at(i)).data(), &formatted, &reportNumber) == fileType) { return fileSet.at(i); } @@ -253,7 +254,7 @@ QStringList RifEclipseOutputFileTools::filterFileNamesOfType(const QStringList& { bool formatted = false; int reportNumber = -1; - if (ecl_util_get_file_type(fileSet.at(i).toAscii().data(), &formatted, &reportNumber) == fileType) + if (ecl_util_get_file_type(RifStringTools::toNativeEncoded(fileSet.at(i)).data(), &formatted, &reportNumber) == fileType) { fileNames.append(fileSet.at(i)); } @@ -276,12 +277,12 @@ bool RifEclipseOutputFileTools::findSiblingFilesWithSameBaseName(const QString& QString fileNameBase = QFileInfo(fullPathFileName).baseName(); stringlist_type* eclipseFiles = stringlist_alloc_new(); - ecl_util_select_filelist(filePath.toAscii().data(), fileNameBase.toAscii().data(), ECL_OTHER_FILE, false, eclipseFiles); + ecl_util_select_filelist(RifStringTools::toNativeEncoded(filePath).data(), RifStringTools::toNativeEncoded(fileNameBase).data(), ECL_OTHER_FILE, false, eclipseFiles); int i; for (i = 0; i < stringlist_get_size(eclipseFiles); i++) { - baseNameFiles->append(stringlist_safe_iget(eclipseFiles, i)); + baseNameFiles->append(RifStringTools::fromNativeEncoded(stringlist_safe_iget(eclipseFiles, i))); } stringlist_free(eclipseFiles); @@ -294,7 +295,7 @@ bool RifEclipseOutputFileTools::findSiblingFilesWithSameBaseName(const QString& //-------------------------------------------------------------------------------------------------- void RifEclipseOutputFileTools::readGridDimensions(const QString& gridFileName, std::vector< std::vector >& gridDimensions) { - ecl_grid_type * grid = ecl_grid_alloc(gridFileName.toAscii().data()); // bootstrap ecl_grid instance + ecl_grid_type * grid = ecl_grid_alloc(RifStringTools::toNativeEncoded(gridFileName).data()); // bootstrap ecl_grid instance stringlist_type * lgr_names = ecl_grid_alloc_lgr_name_list( grid ); // get a list of all the lgr names. //printf("grid:%s has %d a total of %d lgr's \n", grid_filename , stringlist_get_size( lgr_names )); diff --git a/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp b/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp index 7522865d98..5aed25e384 100644 --- a/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp +++ b/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp @@ -20,6 +20,8 @@ #include "RifEclipseRestartFilesetAccess.h" #include "RifEclipseOutputFileTools.h" +#include "RifStringTools.h" + #include "cafProgressInfo.h" #include "ert/ecl/ecl_file.h" @@ -270,7 +272,7 @@ void RifEclipseRestartFilesetAccess::openTimeStep(size_t timeStep) if (m_ecl_files[timeStep] == NULL) { int index = static_cast(timeStep); - ecl_file_type* ecl_file = ecl_file_open(m_fileNames[index].toAscii().data(), ECL_FILE_CLOSE_STREAM); + ecl_file_type* ecl_file = ecl_file_open(RifStringTools::toNativeEncoded(m_fileNames[index]).data(), ECL_FILE_CLOSE_STREAM); m_ecl_files[timeStep] = ecl_file; @@ -295,7 +297,7 @@ int RifEclipseRestartFilesetAccess::reportNumber(const ecl_file_type* ecl_file) fileNameUpper = fileNameUpper.toUpper(); // Convert to upper case, as ecl_util_filename_report_nr does not handle lower case file extensions - int reportNumber = ecl_util_filename_report_nr(fileNameUpper.toAscii().data()); + int reportNumber = ecl_util_filename_report_nr(RifStringTools::toNativeEncoded(fileNameUpper).data()); return reportNumber; } diff --git a/ApplicationCode/FileInterface/RifEclipseSummaryTools.cpp b/ApplicationCode/FileInterface/RifEclipseSummaryTools.cpp index 641ac5abb8..225100f5e9 100644 --- a/ApplicationCode/FileInterface/RifEclipseSummaryTools.cpp +++ b/ApplicationCode/FileInterface/RifEclipseSummaryTools.cpp @@ -20,17 +20,21 @@ #include "RiaSummaryCurveAnalyzer.h" #include "RifReaderEclipseSummary.h" +#include "RifStringTools.h" #include "cafAppEnum.h" #include "ert/ecl/ecl_util.h" +#include +#include + #include //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RifEclipseSummaryTools::findSummaryHeaderFile(const std::string& inputFile, std::string* headerFile, bool* isFormatted) +void RifEclipseSummaryTools::findSummaryHeaderFile(const QString& inputFile, QString* headerFile, bool* isFormatted) { findSummaryHeaderFileInfo(inputFile, headerFile, NULL, NULL, isFormatted); } @@ -38,9 +42,9 @@ void RifEclipseSummaryTools::findSummaryHeaderFile(const std::string& inputFile, //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RifEclipseSummaryTools::findSummaryFiles(const std::string& inputFile, - std::string* headerFile, - std::vector* dataFiles) +void RifEclipseSummaryTools::findSummaryFiles(const QString& inputFile, + QString* headerFile, + QStringList* dataFiles) { dataFiles->clear(); headerFile->clear(); @@ -49,21 +53,21 @@ void RifEclipseSummaryTools::findSummaryFiles(const std::string& inputFile, char* myBase = NULL; char* myExtention = NULL; - util_alloc_file_components(inputFile.data(), &myPath, &myBase, &myExtention); + util_alloc_file_components(RifStringTools::toNativeEncoded(inputFile).data(), &myPath, &myBase, &myExtention); - std::string path; if(myPath) path = myPath; - std::string base; if(myBase) base = myBase; + QString path; if(myPath) path = RifStringTools::fromNativeEncoded(myPath); + QString base; if(myBase) base = RifStringTools::fromNativeEncoded(myBase); std::string extention; if(myExtention) extention = myExtention; - if(path.empty() || base.empty()) return ; + if(path.isEmpty() || base.isEmpty()) return ; char* myHeaderFile = NULL; stringlist_type* summary_file_list = stringlist_alloc_new(); - ecl_util_alloc_summary_files(path.data(), base.data(), extention.data(), &myHeaderFile, summary_file_list); + ecl_util_alloc_summary_files(RifStringTools::toNativeEncoded(path).data(), RifStringTools::toNativeEncoded(base).data(), extention.data(), &myHeaderFile, summary_file_list); if(myHeaderFile) { - (*headerFile) = myHeaderFile; + (*headerFile) = RifStringTools::fromNativeEncoded(myHeaderFile); util_safe_free(myHeaderFile); } @@ -71,7 +75,7 @@ void RifEclipseSummaryTools::findSummaryFiles(const std::string& inputFile, { for(int i = 0; i < stringlist_get_size(summary_file_list); i++) { - dataFiles->push_back(stringlist_iget(summary_file_list,i)); + dataFiles->push_back(RifStringTools::fromNativeEncoded(stringlist_iget(summary_file_list,i))); } } stringlist_free(summary_file_list); @@ -83,12 +87,12 @@ void RifEclipseSummaryTools::findSummaryFiles(const std::string& inputFile, //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RifEclipseSummaryTools::hasSummaryFiles(const std::string& gridFileName) +bool RifEclipseSummaryTools::hasSummaryFiles(const QString& gridFileName) { - std::string headerFileName; - std::vector dataFileNames; + QString headerFileName; + QStringList dataFileNames; RifEclipseSummaryTools::findSummaryFiles(gridFileName, &headerFileName, &dataFileNames); - if (!headerFileName.empty() && dataFileNames.size()) return true; + if (!headerFileName.isEmpty() && dataFileNames.size()) return true; return false; } @@ -96,25 +100,25 @@ bool RifEclipseSummaryTools::hasSummaryFiles(const std::string& gridFileName) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RifEclipseSummaryTools::findSummaryDataFiles(const std::string& caseFile) +QStringList RifEclipseSummaryTools::findSummaryDataFiles(const QString& caseFile) { - std::vector fileNames; + QStringList fileNames; - std::string path; - std::string base; + QString path; + QString base; findSummaryHeaderFileInfo(caseFile, NULL, &path, &base, NULL); - if (path.empty() || base.empty()) return fileNames; + if (path.isEmpty() || base.isEmpty()) return fileNames; char* header_file = NULL; stringlist_type* summary_file_list = stringlist_alloc_new(); - ecl_util_alloc_summary_files(path.data(), base.data(), NULL, &header_file, summary_file_list); + ecl_util_alloc_summary_files(RifStringTools::toNativeEncoded(path).data(), RifStringTools::toNativeEncoded(base).data(), NULL, &header_file, summary_file_list); if (stringlist_get_size( summary_file_list ) > 0) { for (int i = 0; i < stringlist_get_size(summary_file_list); i++) { - fileNames.push_back(stringlist_iget(summary_file_list, i)); + fileNames.push_back(RifStringTools::fromNativeEncoded(stringlist_iget(summary_file_list, i))); } } @@ -163,13 +167,13 @@ void RifEclipseSummaryTools::dumpMetaData(RifSummaryReaderInterface* readerEclip //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RifEclipseSummaryTools::findSummaryHeaderFileInfo(const std::string& inputFile, std::string* headerFile, std::string* path, std::string* base, bool* isFormatted) +void RifEclipseSummaryTools::findSummaryHeaderFileInfo(const QString& inputFile, QString* headerFile, QString* path, QString* base, bool* isFormatted) { char* myPath = NULL; char* myBase = NULL; bool formattedFile = true; - util_alloc_file_components(inputFile.data(), &myPath, &myBase, NULL); + util_alloc_file_components(RifStringTools::toNativeEncoded(inputFile).data(), &myPath, &myBase, NULL); char* myHeaderFile = ecl_util_alloc_exfilename(myPath, myBase, ECL_SUMMARY_HEADER_FILE, true, -1); if (!myHeaderFile) diff --git a/ApplicationCode/FileInterface/RifEclipseSummaryTools.h b/ApplicationCode/FileInterface/RifEclipseSummaryTools.h index 61b474208f..d2e99047e7 100644 --- a/ApplicationCode/FileInterface/RifEclipseSummaryTools.h +++ b/ApplicationCode/FileInterface/RifEclipseSummaryTools.h @@ -24,6 +24,8 @@ #include class RifSummaryReaderInterface; +class QStringList; +class QString; //================================================================================================== // @@ -33,13 +35,13 @@ class RifSummaryReaderInterface; class RifEclipseSummaryTools { public: - static void findSummaryHeaderFile(const std::string& inputFile, std::string* headerFile, bool* isFormatted); - static std::vector findSummaryDataFiles(const std::string& caseFile); + static void findSummaryHeaderFile(const QString& inputFile, QString* headerFile, bool* isFormatted); + static QStringList findSummaryDataFiles(const QString& caseFile); - static void findSummaryFiles(const std::string& inputFile, std::string* headerFile, std::vector* dataFiles); - static bool hasSummaryFiles(const std::string& gridFileName); + static void findSummaryFiles(const QString& inputFile, QString* headerFile, QStringList* dataFiles); + static bool hasSummaryFiles(const QString& gridFileName); static void dumpMetaData(RifSummaryReaderInterface* readerEclipseSummary); private: - static void findSummaryHeaderFileInfo(const std::string& inputFile, std::string* headerFile, std::string* path, std::string* base, bool* isFormatted); + static void findSummaryHeaderFileInfo(const QString& inputFile, QString* headerFile, QString* path, QString* base, bool* isFormatted); }; diff --git a/ApplicationCode/FileInterface/RifEclipseUnifiedRestartFileAccess.cpp b/ApplicationCode/FileInterface/RifEclipseUnifiedRestartFileAccess.cpp index 0589ca4a90..8170365e84 100644 --- a/ApplicationCode/FileInterface/RifEclipseUnifiedRestartFileAccess.cpp +++ b/ApplicationCode/FileInterface/RifEclipseUnifiedRestartFileAccess.cpp @@ -26,6 +26,7 @@ #include "RifEclipseOutputFileTools.h" #include "RifReaderSettings.h" +#include "RifStringTools.h" #include "ert/ecl/ecl_file.h" #include "ert/ecl/ecl_kw_magic.h" @@ -83,7 +84,7 @@ bool RifEclipseUnifiedRestartFileAccess::openFile() if (resultFileInfo.lastModified() < indexFileInfo.lastModified()) { - m_ecl_file = ecl_file_fast_open(m_filename.toAscii().data(), indexFileName.toAscii().data(), ECL_FILE_CLOSE_STREAM); + m_ecl_file = ecl_file_fast_open(RifStringTools::toNativeEncoded(m_filename).data(), RifStringTools::toNativeEncoded(indexFileName).data(), ECL_FILE_CLOSE_STREAM); if (!m_ecl_file) { RiaLogging::error(QString("Failed to open file %1 using index file.").arg(m_filename)); @@ -99,7 +100,7 @@ bool RifEclipseUnifiedRestartFileAccess::openFile() if (!m_ecl_file) { - m_ecl_file = ecl_file_open(m_filename.toAscii().data(), ECL_FILE_CLOSE_STREAM); + m_ecl_file = ecl_file_open(RifStringTools::toNativeEncoded(m_filename).data(), ECL_FILE_CLOSE_STREAM); if (!m_ecl_file) { RiaLogging::error(QString("Failed to open file %1").arg(m_filename)); @@ -112,7 +113,7 @@ bool RifEclipseUnifiedRestartFileAccess::openFile() QString resultPath = fi.absolutePath(); if (caf::Utils::isFolderWritable(resultPath)) { - bool success = ecl_file_write_index(m_ecl_file, indexFileName.toAscii().data()); + bool success = ecl_file_write_index(m_ecl_file, RifStringTools::toNativeEncoded(indexFileName).data()); if (success) { diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp index 3bfababb90..5a13358a2b 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp @@ -28,6 +28,7 @@ #include "RifEclipseOutputFileTools.h" #include "RifHdf5ReaderInterface.h" #include "RifReaderSettings.h" +#include "RifStringTools.h" #ifdef USE_HDF5 #include "RifHdf5Reader.h" @@ -374,7 +375,7 @@ bool RifReaderEclipseOutput::open(const QString& fileName, RigEclipseCaseData* e // Read geometry // Todo: Needs to check existence of file before calling ert, else it will abort - ecl_grid_type * mainEclGrid = ecl_grid_alloc( fileName.toAscii().data() ); + ecl_grid_type * mainEclGrid = ecl_grid_alloc( RifStringTools::toNativeEncoded(fileName).data() ); progInfo.incrementProgress(); @@ -722,7 +723,7 @@ bool RifReaderEclipseOutput::readActiveCellInfo() QString egridFileName = RifEclipseOutputFileTools::firstFileNameOfType(m_filesWithSameBaseName, ECL_EGRID_FILE); if (egridFileName.size() > 0) { - ecl_file_type* ecl_file = ecl_file_open(egridFileName.toAscii().data(), ECL_FILE_CLOSE_STREAM); + ecl_file_type* ecl_file = ecl_file_open(RifStringTools::toNativeEncoded(egridFileName).data(), ECL_FILE_CLOSE_STREAM); if (!ecl_file) return false; int actnumKeywordCount = ecl_file_get_num_named_kw(ecl_file, ACTNUM_KW); @@ -2213,7 +2214,7 @@ void RifReaderEclipseOutput::openInitFile() QString initFileName = RifEclipseOutputFileTools::firstFileNameOfType(m_filesWithSameBaseName, ECL_INIT_FILE); if (initFileName.size() > 0) { - m_ecl_init_file = ecl_file_open(initFileName.toAscii().data(), ECL_FILE_CLOSE_STREAM); + m_ecl_init_file = ecl_file_open(RifStringTools::toNativeEncoded(initFileName).data(), ECL_FILE_CLOSE_STREAM); } } diff --git a/ApplicationCode/FileInterface/RifReaderEclipseRft.cpp b/ApplicationCode/FileInterface/RifReaderEclipseRft.cpp index 400bda77aa..21a1d976a1 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseRft.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseRft.cpp @@ -21,6 +21,8 @@ #include "RiaLogging.h" #include "RiaQDateTimeTools.h" +#include "RifStringTools.h" + #include "cafVecIjk.h" #include "ert/ecl/ecl_rft_file.h" @@ -28,7 +30,7 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifReaderEclipseRft::RifReaderEclipseRft(const std::string& fileName): +RifReaderEclipseRft::RifReaderEclipseRft(const QString& fileName): m_fileName(fileName), m_ecl_rft_file(nullptr) { } @@ -45,15 +47,15 @@ RifReaderEclipseRft::~RifReaderEclipseRft() //-------------------------------------------------------------------------------------------------- void RifReaderEclipseRft::open() { - if (m_fileName.empty()) return; + if (m_fileName.isEmpty()) return; - RiaLogging::info(QString("Opening file '%1'").arg(m_fileName.c_str())); + RiaLogging::info(QString("Opening file '%1'").arg( m_fileName)); - m_ecl_rft_file = ecl_rft_file_alloc_case(m_fileName.data()); + m_ecl_rft_file = ecl_rft_file_alloc_case(RifStringTools::toNativeEncoded(m_fileName).data()); if (m_ecl_rft_file == NULL) { - RiaLogging::warning(QString("Libecl could not find/open file '%'").arg(m_fileName.c_str())); + RiaLogging::warning(QString("Libecl could not find/open file '%'").arg( m_fileName)); return; } diff --git a/ApplicationCode/FileInterface/RifReaderEclipseRft.h b/ApplicationCode/FileInterface/RifReaderEclipseRft.h index ecd055d370..f082dcac12 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseRft.h +++ b/ApplicationCode/FileInterface/RifReaderEclipseRft.h @@ -41,7 +41,7 @@ namespace caf class RifReaderEclipseRft : public cvf::Object { public: - RifReaderEclipseRft(const std::string& fileName); + RifReaderEclipseRft(const QString& fileName); ~RifReaderEclipseRft(); const std::vector& eclipseRftAddresses(); @@ -63,7 +63,7 @@ class RifReaderEclipseRft : public cvf::Object // Taken from ecl_rft_file.h and ecl_rft_node.h typedef struct ecl_rft_file_struct ecl_rft_file_type; - std::string m_fileName; + QString m_fileName; ecl_rft_file_type* m_ecl_rft_file; std::vector m_eclipseRftAddresses; std::set m_wellNames; diff --git a/ApplicationCode/FileInterface/RifReaderEclipseSummary.cpp b/ApplicationCode/FileInterface/RifReaderEclipseSummary.cpp index a3aa42cf00..0bd235bdcb 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseSummary.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseSummary.cpp @@ -17,6 +17,7 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RifReaderEclipseSummary.h" +#include "RifStringTools.h" #include "ert/ecl/ecl_sum.h" @@ -24,6 +25,8 @@ #include #include +#include +#include #include "ert/ecl/smspec_node.h" //-------------------------------------------------------------------------------------------------- @@ -51,23 +54,23 @@ RifReaderEclipseSummary::~RifReaderEclipseSummary() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RifReaderEclipseSummary::open(const std::string& headerFileName, const std::vector& dataFileNames) +bool RifReaderEclipseSummary::open(const QString& headerFileName, const QStringList& dataFileNames) { assert(m_ecl_sum == NULL); - if (headerFileName.empty() || dataFileNames.size() == 0) return false; + if (headerFileName.isEmpty() || dataFileNames.size() == 0) return false; - assert(!headerFileName.empty()); + assert(!headerFileName.isEmpty()); assert(dataFileNames.size() > 0); stringlist_type* dataFiles = stringlist_alloc_new(); - for (size_t i = 0; i < dataFileNames.size(); i++) + for (int i = 0; i < dataFileNames.size(); i++) { - stringlist_append_copy(dataFiles, dataFileNames[i].data()); + stringlist_append_copy(dataFiles, RifStringTools::toNativeEncoded(dataFileNames[i]).data()); } std::string itemSeparatorInVariableNames = ":"; - m_ecl_sum = ecl_sum_fread_alloc(headerFileName.data(), dataFiles, itemSeparatorInVariableNames.data(), false); + m_ecl_sum = ecl_sum_fread_alloc(RifStringTools::toNativeEncoded(headerFileName).data(), dataFiles, itemSeparatorInVariableNames.data(), false); stringlist_free(dataFiles); diff --git a/ApplicationCode/FileInterface/RifReaderEclipseSummary.h b/ApplicationCode/FileInterface/RifReaderEclipseSummary.h index 841f957118..2162c38314 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseSummary.h +++ b/ApplicationCode/FileInterface/RifReaderEclipseSummary.h @@ -25,6 +25,8 @@ #include #include +class QString; +class QStringList; //================================================================================================== // @@ -36,7 +38,7 @@ class RifReaderEclipseSummary : public RifSummaryReaderInterface RifReaderEclipseSummary(); ~RifReaderEclipseSummary(); - bool open(const std::string& headerFileName, const std::vector& dataFileNames); + bool open(const QString& headerFileName, const QStringList& dataFileNames); virtual const std::vector& timeSteps(const RifEclipseSummaryAddress& resultAddress) const override; diff --git a/ApplicationCode/FileInterface/RifStringTools.cpp b/ApplicationCode/FileInterface/RifStringTools.cpp new file mode 100644 index 0000000000..a1fcefd537 --- /dev/null +++ b/ApplicationCode/FileInterface/RifStringTools.cpp @@ -0,0 +1,43 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2011- Statoil ASA +// Copyright (C) 2013- Ceetron Solutions AS +// Copyright (C) 2011-2012 Ceetron AS +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RifStringTools.h" + + +const std::string RifStringTools::toNativeEncoded(const QString& qstring) +{ +#ifdef WIN32 + return std::string(qstring.toLatin1().data()); +#else + return std::string(qstring.toUtf8().data()); +#endif +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const QString RifStringTools::fromNativeEncoded(const char* native) +{ +#ifdef WIN32 + return QString::fromLatin1(native); +#else + return QString::fromUtf8(native); +#endif +} diff --git a/ApplicationCode/FileInterface/RifStringTools.h b/ApplicationCode/FileInterface/RifStringTools.h new file mode 100644 index 0000000000..face0d1c11 --- /dev/null +++ b/ApplicationCode/FileInterface/RifStringTools.h @@ -0,0 +1,38 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2011- Statoil ASA +// Copyright (C) 2013- Ceetron Solutions AS +// Copyright (C) 2011-2012 Ceetron AS +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include +#include +#include + +//================================================================================================== +// +// +// +//================================================================================================== +class RifStringTools +{ +public: + static const std::string toNativeEncoded(const QString& qstring); + + static const QString fromNativeEncoded(const char* native); +}; diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp index cebd388f37..334d08dad2 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp @@ -208,7 +208,7 @@ bool RimEclipseResultCase::importGridAndResultMetaData(bool showTimeStepFilter) if (rftFileInfo.exists()) { RiaLogging::info(QString("RFT file found")); - m_readerEclipseRft = new RifReaderEclipseRft(rftFileInfo.filePath().toStdString()); + m_readerEclipseRft = new RifReaderEclipseRft(rftFileInfo.filePath()); } diff --git a/ApplicationCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp b/ApplicationCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp index 2ebaffb2a9..d8a34c1512 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp @@ -91,9 +91,9 @@ void RimFileSummaryCase::createSummaryReaderInterface() //-------------------------------------------------------------------------------------------------- RifReaderEclipseSummary* RimFileSummaryCase::findRelatedFilesAndCreateReader(const QString& headerFileName) { - std::string headerFileNameStd; - std::vector dataFileNames; - std::string nativeSumHeadFileName = QDir::toNativeSeparators(headerFileName).toStdString(); + QString headerFileNameStd; + QStringList dataFileNames; + QString nativeSumHeadFileName = QDir::toNativeSeparators(headerFileName); RifEclipseSummaryTools::findSummaryFiles(nativeSumHeadFileName, &headerFileNameStd, &dataFileNames); RifReaderEclipseSummary* summaryFileReader = new RifReaderEclipseSummary; diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp index 855d589d6e..e75b1d9797 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp @@ -267,7 +267,7 @@ void RimSummaryCaseMainCollection::loadAllSummaryCaseData() RimSummaryCase* RimSummaryCaseMainCollection::createAndAddSummaryCaseFromEclipseResultCase(RimEclipseResultCase* eclResCase) { QString gridFileName = eclResCase->gridFileName(); - if(RifEclipseSummaryTools::hasSummaryFiles(QDir::toNativeSeparators(gridFileName).toStdString())) + if(RifEclipseSummaryTools::hasSummaryFiles(QDir::toNativeSeparators(gridFileName))) { RimGridSummaryCase* newSumCase = new RimGridSummaryCase(); this->m_cases.push_back(newSumCase); From d5116d894223788e86e754b42d5c04680692d910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Fri, 2 Feb 2018 15:03:41 +0100 Subject: [PATCH 63/78] #2086 Fix well GUI name for well paths when extended ascii chars in name --- ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp b/ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp index f8ee1103b6..ea40779a48 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp +++ b/ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp @@ -21,6 +21,8 @@ #include "RigWellLogCurveData.h" +#include "RifStringTools.h" + #include "RimWellLogCurve.h" #include "well.hpp" @@ -80,11 +82,8 @@ bool RigWellLogFile::open(const QString& fileName, QString* errorMessage) try { int wellFormat = NRLib::Well::LAS; -#ifdef _WINDOWS - well = NRLib::Well::ReadWell(fileName.toStdString(), wellFormat); -#else - well = NRLib::Well::ReadWell(fileName.toUtf8().data(), wellFormat); -#endif + + well = NRLib::Well::ReadWell(RifStringTools::toNativeEncoded(fileName).data(), wellFormat); if (!well) { return false; @@ -152,7 +151,7 @@ void RigWellLogFile::close() QString RigWellLogFile::wellName() const { CVF_ASSERT(m_wellLogFile); - return QString::fromStdString(m_wellLogFile->GetWellName()); + return RifStringTools::fromNativeEncoded(m_wellLogFile->GetWellName().data()); } //-------------------------------------------------------------------------------------------------- From 98a94c0525ba550cd2bf52bae09613305510476c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Fri, 2 Feb 2018 15:44:28 +0100 Subject: [PATCH 64/78] #2086 Moved RifStringTools -> RiaStringEncodingTools --- .../Application/Tools/CMakeLists_files.cmake | 2 ++ .../Tools/RiaStringEncodingTools.cpp} | 6 +++--- .../Tools/RiaStringEncodingTools.h} | 2 +- .../FileInterface/CMakeLists_files.cmake | 2 -- .../RifEclipseOutputFileTools.cpp | 16 +++++++-------- .../RifEclipseRestartFilesetAccess.cpp | 6 +++--- .../FileInterface/RifEclipseSummaryTools.cpp | 20 +++++++++---------- .../RifEclipseUnifiedRestartFileAccess.cpp | 8 ++++---- .../FileInterface/RifReaderEclipseOutput.cpp | 8 ++++---- .../FileInterface/RifReaderEclipseRft.cpp | 4 ++-- .../FileInterface/RifReaderEclipseSummary.cpp | 6 +++--- .../ReservoirDataModel/RigWellLogFile.cpp | 6 +++--- 12 files changed, 43 insertions(+), 43 deletions(-) rename ApplicationCode/{FileInterface/RifStringTools.cpp => Application/Tools/RiaStringEncodingTools.cpp} (87%) rename ApplicationCode/{FileInterface/RifStringTools.h => Application/Tools/RiaStringEncodingTools.h} (97%) diff --git a/ApplicationCode/Application/Tools/CMakeLists_files.cmake b/ApplicationCode/Application/Tools/CMakeLists_files.cmake index b34441b458..8a38c31b7a 100644 --- a/ApplicationCode/Application/Tools/CMakeLists_files.cmake +++ b/ApplicationCode/Application/Tools/CMakeLists_files.cmake @@ -24,6 +24,7 @@ ${CEE_CURRENT_LIST_DIR}RiaStdStringTools.h ${CEE_CURRENT_LIST_DIR}RiaSummaryCurveAnalyzer.h ${CEE_CURRENT_LIST_DIR}RiaSimWellBranchTools.h ${CEE_CURRENT_LIST_DIR}RiaProjectFileVersionTools.h +${CEE_CURRENT_LIST_DIR}RiaStringEncodingTools.h ) set (SOURCE_GROUP_SOURCE_FILES @@ -45,6 +46,7 @@ ${CEE_CURRENT_LIST_DIR}RiaStdStringTools.cpp ${CEE_CURRENT_LIST_DIR}RiaSummaryCurveAnalyzer.cpp ${CEE_CURRENT_LIST_DIR}RiaSimWellBranchTools.cpp ${CEE_CURRENT_LIST_DIR}RiaProjectFileVersionTools.cpp +${CEE_CURRENT_LIST_DIR}RiaStringEncodingTools.cpp ) list(APPEND CODE_HEADER_FILES diff --git a/ApplicationCode/FileInterface/RifStringTools.cpp b/ApplicationCode/Application/Tools/RiaStringEncodingTools.cpp similarity index 87% rename from ApplicationCode/FileInterface/RifStringTools.cpp rename to ApplicationCode/Application/Tools/RiaStringEncodingTools.cpp index a1fcefd537..7aeb63cd31 100644 --- a/ApplicationCode/FileInterface/RifStringTools.cpp +++ b/ApplicationCode/Application/Tools/RiaStringEncodingTools.cpp @@ -18,10 +18,10 @@ // ///////////////////////////////////////////////////////////////////////////////// -#include "RifStringTools.h" +#include "RiaStringEncodingTools.h" -const std::string RifStringTools::toNativeEncoded(const QString& qstring) +const std::string RiaStringEncodingTools::toNativeEncoded(const QString& qstring) { #ifdef WIN32 return std::string(qstring.toLatin1().data()); @@ -33,7 +33,7 @@ const std::string RifStringTools::toNativeEncoded(const QString& qstring) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -const QString RifStringTools::fromNativeEncoded(const char* native) +const QString RiaStringEncodingTools::fromNativeEncoded(const char* native) { #ifdef WIN32 return QString::fromLatin1(native); diff --git a/ApplicationCode/FileInterface/RifStringTools.h b/ApplicationCode/Application/Tools/RiaStringEncodingTools.h similarity index 97% rename from ApplicationCode/FileInterface/RifStringTools.h rename to ApplicationCode/Application/Tools/RiaStringEncodingTools.h index face0d1c11..524117dc02 100644 --- a/ApplicationCode/FileInterface/RifStringTools.h +++ b/ApplicationCode/Application/Tools/RiaStringEncodingTools.h @@ -29,7 +29,7 @@ // // //================================================================================================== -class RifStringTools +class RiaStringEncodingTools { public: static const std::string toNativeEncoded(const QString& qstring); diff --git a/ApplicationCode/FileInterface/CMakeLists_files.cmake b/ApplicationCode/FileInterface/CMakeLists_files.cmake index af5063534b..e437ee7c5b 100644 --- a/ApplicationCode/FileInterface/CMakeLists_files.cmake +++ b/ApplicationCode/FileInterface/CMakeLists_files.cmake @@ -40,7 +40,6 @@ ${CEE_CURRENT_LIST_DIR}RifCsvUserData.h ${CEE_CURRENT_LIST_DIR}RifCsvUserDataParser.h ${CEE_CURRENT_LIST_DIR}RifWellPathFormationReader.h ${CEE_CURRENT_LIST_DIR}RifWellPathFormationsImporter.h -${CEE_CURRENT_LIST_DIR}RifStringTools.h # HDF5 file reader is directly included in ResInsight main CmakeList.txt #${CEE_CURRENT_LIST_DIR}RifHdf5Reader.h ) @@ -85,7 +84,6 @@ ${CEE_CURRENT_LIST_DIR}RifCsvUserData.cpp ${CEE_CURRENT_LIST_DIR}RifCsvUserDataParser.cpp ${CEE_CURRENT_LIST_DIR}RifWellPathFormationReader.cpp ${CEE_CURRENT_LIST_DIR}RifWellPathFormationsImporter.cpp -${CEE_CURRENT_LIST_DIR}RifStringTools.cpp # HDF5 file reader is directly included in ResInsight main CmakeList.txt #${CEE_CURRENT_LIST_DIR}RifHdf5Reader.cpp diff --git a/ApplicationCode/FileInterface/RifEclipseOutputFileTools.cpp b/ApplicationCode/FileInterface/RifEclipseOutputFileTools.cpp index 7059ff548b..898b003a4d 100644 --- a/ApplicationCode/FileInterface/RifEclipseOutputFileTools.cpp +++ b/ApplicationCode/FileInterface/RifEclipseOutputFileTools.cpp @@ -22,7 +22,7 @@ #include "RifEclipseRestartFilesetAccess.h" #include "RifEclipseUnifiedRestartFileAccess.h" -#include "RifStringTools.h" +#include "RiaStringEncodingTools.h" #include "RiaQDateTimeTools.h" #include "ert/ecl/ecl_file.h" @@ -184,7 +184,7 @@ void RifEclipseOutputFileTools::timeSteps(ecl_file_type* ecl_file, std::vector* values) { - ecl_kw_type* kwData = ecl_file_iget_named_kw(ecl_file, RifStringTools::toNativeEncoded(keyword).data(), static_cast(fileKeywordOccurrence)); + ecl_kw_type* kwData = ecl_file_iget_named_kw(ecl_file, RiaStringEncodingTools::toNativeEncoded(keyword).data(), static_cast(fileKeywordOccurrence)); if (kwData) { size_t numValues = ecl_kw_get_size(kwData); @@ -206,7 +206,7 @@ bool RifEclipseOutputFileTools::keywordData(ecl_file_type* ecl_file, const QStri //-------------------------------------------------------------------------------------------------- bool RifEclipseOutputFileTools::keywordData(ecl_file_type* ecl_file, const QString& keyword, size_t fileKeywordOccurrence, std::vector* values) { - ecl_kw_type* kwData = ecl_file_iget_named_kw(ecl_file, RifStringTools::toNativeEncoded(keyword).data(), static_cast(fileKeywordOccurrence)); + ecl_kw_type* kwData = ecl_file_iget_named_kw(ecl_file, RiaStringEncodingTools::toNativeEncoded(keyword).data(), static_cast(fileKeywordOccurrence)); if (kwData) { size_t numValues = ecl_kw_get_size(kwData); @@ -233,7 +233,7 @@ QString RifEclipseOutputFileTools::firstFileNameOfType(const QStringList& fileSe { bool formatted = false; int reportNumber = -1; - if (ecl_util_get_file_type(RifStringTools::toNativeEncoded(fileSet.at(i)).data(), &formatted, &reportNumber) == fileType) + if (ecl_util_get_file_type(RiaStringEncodingTools::toNativeEncoded(fileSet.at(i)).data(), &formatted, &reportNumber) == fileType) { return fileSet.at(i); } @@ -254,7 +254,7 @@ QStringList RifEclipseOutputFileTools::filterFileNamesOfType(const QStringList& { bool formatted = false; int reportNumber = -1; - if (ecl_util_get_file_type(RifStringTools::toNativeEncoded(fileSet.at(i)).data(), &formatted, &reportNumber) == fileType) + if (ecl_util_get_file_type(RiaStringEncodingTools::toNativeEncoded(fileSet.at(i)).data(), &formatted, &reportNumber) == fileType) { fileNames.append(fileSet.at(i)); } @@ -277,12 +277,12 @@ bool RifEclipseOutputFileTools::findSiblingFilesWithSameBaseName(const QString& QString fileNameBase = QFileInfo(fullPathFileName).baseName(); stringlist_type* eclipseFiles = stringlist_alloc_new(); - ecl_util_select_filelist(RifStringTools::toNativeEncoded(filePath).data(), RifStringTools::toNativeEncoded(fileNameBase).data(), ECL_OTHER_FILE, false, eclipseFiles); + ecl_util_select_filelist(RiaStringEncodingTools::toNativeEncoded(filePath).data(), RiaStringEncodingTools::toNativeEncoded(fileNameBase).data(), ECL_OTHER_FILE, false, eclipseFiles); int i; for (i = 0; i < stringlist_get_size(eclipseFiles); i++) { - baseNameFiles->append(RifStringTools::fromNativeEncoded(stringlist_safe_iget(eclipseFiles, i))); + baseNameFiles->append(RiaStringEncodingTools::fromNativeEncoded(stringlist_safe_iget(eclipseFiles, i))); } stringlist_free(eclipseFiles); @@ -295,7 +295,7 @@ bool RifEclipseOutputFileTools::findSiblingFilesWithSameBaseName(const QString& //-------------------------------------------------------------------------------------------------- void RifEclipseOutputFileTools::readGridDimensions(const QString& gridFileName, std::vector< std::vector >& gridDimensions) { - ecl_grid_type * grid = ecl_grid_alloc(RifStringTools::toNativeEncoded(gridFileName).data()); // bootstrap ecl_grid instance + ecl_grid_type * grid = ecl_grid_alloc(RiaStringEncodingTools::toNativeEncoded(gridFileName).data()); // bootstrap ecl_grid instance stringlist_type * lgr_names = ecl_grid_alloc_lgr_name_list( grid ); // get a list of all the lgr names. //printf("grid:%s has %d a total of %d lgr's \n", grid_filename , stringlist_get_size( lgr_names )); diff --git a/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp b/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp index 5aed25e384..6ea396a867 100644 --- a/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp +++ b/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp @@ -20,7 +20,7 @@ #include "RifEclipseRestartFilesetAccess.h" #include "RifEclipseOutputFileTools.h" -#include "RifStringTools.h" +#include "RiaStringEncodingTools.h" #include "cafProgressInfo.h" @@ -272,7 +272,7 @@ void RifEclipseRestartFilesetAccess::openTimeStep(size_t timeStep) if (m_ecl_files[timeStep] == NULL) { int index = static_cast(timeStep); - ecl_file_type* ecl_file = ecl_file_open(RifStringTools::toNativeEncoded(m_fileNames[index]).data(), ECL_FILE_CLOSE_STREAM); + ecl_file_type* ecl_file = ecl_file_open(RiaStringEncodingTools::toNativeEncoded(m_fileNames[index]).data(), ECL_FILE_CLOSE_STREAM); m_ecl_files[timeStep] = ecl_file; @@ -297,7 +297,7 @@ int RifEclipseRestartFilesetAccess::reportNumber(const ecl_file_type* ecl_file) fileNameUpper = fileNameUpper.toUpper(); // Convert to upper case, as ecl_util_filename_report_nr does not handle lower case file extensions - int reportNumber = ecl_util_filename_report_nr(RifStringTools::toNativeEncoded(fileNameUpper).data()); + int reportNumber = ecl_util_filename_report_nr(RiaStringEncodingTools::toNativeEncoded(fileNameUpper).data()); return reportNumber; } diff --git a/ApplicationCode/FileInterface/RifEclipseSummaryTools.cpp b/ApplicationCode/FileInterface/RifEclipseSummaryTools.cpp index 225100f5e9..c1d2bd76c1 100644 --- a/ApplicationCode/FileInterface/RifEclipseSummaryTools.cpp +++ b/ApplicationCode/FileInterface/RifEclipseSummaryTools.cpp @@ -20,7 +20,7 @@ #include "RiaSummaryCurveAnalyzer.h" #include "RifReaderEclipseSummary.h" -#include "RifStringTools.h" +#include "RiaStringEncodingTools.h" #include "cafAppEnum.h" @@ -53,10 +53,10 @@ void RifEclipseSummaryTools::findSummaryFiles(const QString& inputFile, char* myBase = NULL; char* myExtention = NULL; - util_alloc_file_components(RifStringTools::toNativeEncoded(inputFile).data(), &myPath, &myBase, &myExtention); + util_alloc_file_components(RiaStringEncodingTools::toNativeEncoded(inputFile).data(), &myPath, &myBase, &myExtention); - QString path; if(myPath) path = RifStringTools::fromNativeEncoded(myPath); - QString base; if(myBase) base = RifStringTools::fromNativeEncoded(myBase); + QString path; if(myPath) path = RiaStringEncodingTools::fromNativeEncoded(myPath); + QString base; if(myBase) base = RiaStringEncodingTools::fromNativeEncoded(myBase); std::string extention; if(myExtention) extention = myExtention; if(path.isEmpty() || base.isEmpty()) return ; @@ -64,10 +64,10 @@ void RifEclipseSummaryTools::findSummaryFiles(const QString& inputFile, char* myHeaderFile = NULL; stringlist_type* summary_file_list = stringlist_alloc_new(); - ecl_util_alloc_summary_files(RifStringTools::toNativeEncoded(path).data(), RifStringTools::toNativeEncoded(base).data(), extention.data(), &myHeaderFile, summary_file_list); + ecl_util_alloc_summary_files(RiaStringEncodingTools::toNativeEncoded(path).data(), RiaStringEncodingTools::toNativeEncoded(base).data(), extention.data(), &myHeaderFile, summary_file_list); if(myHeaderFile) { - (*headerFile) = RifStringTools::fromNativeEncoded(myHeaderFile); + (*headerFile) = RiaStringEncodingTools::fromNativeEncoded(myHeaderFile); util_safe_free(myHeaderFile); } @@ -75,7 +75,7 @@ void RifEclipseSummaryTools::findSummaryFiles(const QString& inputFile, { for(int i = 0; i < stringlist_get_size(summary_file_list); i++) { - dataFiles->push_back(RifStringTools::fromNativeEncoded(stringlist_iget(summary_file_list,i))); + dataFiles->push_back(RiaStringEncodingTools::fromNativeEncoded(stringlist_iget(summary_file_list,i))); } } stringlist_free(summary_file_list); @@ -113,12 +113,12 @@ QStringList RifEclipseSummaryTools::findSummaryDataFiles(const QString& caseFile char* header_file = NULL; stringlist_type* summary_file_list = stringlist_alloc_new(); - ecl_util_alloc_summary_files(RifStringTools::toNativeEncoded(path).data(), RifStringTools::toNativeEncoded(base).data(), NULL, &header_file, summary_file_list); + ecl_util_alloc_summary_files(RiaStringEncodingTools::toNativeEncoded(path).data(), RiaStringEncodingTools::toNativeEncoded(base).data(), NULL, &header_file, summary_file_list); if (stringlist_get_size( summary_file_list ) > 0) { for (int i = 0; i < stringlist_get_size(summary_file_list); i++) { - fileNames.push_back(RifStringTools::fromNativeEncoded(stringlist_iget(summary_file_list, i))); + fileNames.push_back(RiaStringEncodingTools::fromNativeEncoded(stringlist_iget(summary_file_list, i))); } } @@ -173,7 +173,7 @@ void RifEclipseSummaryTools::findSummaryHeaderFileInfo(const QString& inputFile, char* myBase = NULL; bool formattedFile = true; - util_alloc_file_components(RifStringTools::toNativeEncoded(inputFile).data(), &myPath, &myBase, NULL); + util_alloc_file_components(RiaStringEncodingTools::toNativeEncoded(inputFile).data(), &myPath, &myBase, NULL); char* myHeaderFile = ecl_util_alloc_exfilename(myPath, myBase, ECL_SUMMARY_HEADER_FILE, true, -1); if (!myHeaderFile) diff --git a/ApplicationCode/FileInterface/RifEclipseUnifiedRestartFileAccess.cpp b/ApplicationCode/FileInterface/RifEclipseUnifiedRestartFileAccess.cpp index 8170365e84..a363924309 100644 --- a/ApplicationCode/FileInterface/RifEclipseUnifiedRestartFileAccess.cpp +++ b/ApplicationCode/FileInterface/RifEclipseUnifiedRestartFileAccess.cpp @@ -26,7 +26,7 @@ #include "RifEclipseOutputFileTools.h" #include "RifReaderSettings.h" -#include "RifStringTools.h" +#include "RiaStringEncodingTools.h" #include "ert/ecl/ecl_file.h" #include "ert/ecl/ecl_kw_magic.h" @@ -84,7 +84,7 @@ bool RifEclipseUnifiedRestartFileAccess::openFile() if (resultFileInfo.lastModified() < indexFileInfo.lastModified()) { - m_ecl_file = ecl_file_fast_open(RifStringTools::toNativeEncoded(m_filename).data(), RifStringTools::toNativeEncoded(indexFileName).data(), ECL_FILE_CLOSE_STREAM); + m_ecl_file = ecl_file_fast_open(RiaStringEncodingTools::toNativeEncoded(m_filename).data(), RiaStringEncodingTools::toNativeEncoded(indexFileName).data(), ECL_FILE_CLOSE_STREAM); if (!m_ecl_file) { RiaLogging::error(QString("Failed to open file %1 using index file.").arg(m_filename)); @@ -100,7 +100,7 @@ bool RifEclipseUnifiedRestartFileAccess::openFile() if (!m_ecl_file) { - m_ecl_file = ecl_file_open(RifStringTools::toNativeEncoded(m_filename).data(), ECL_FILE_CLOSE_STREAM); + m_ecl_file = ecl_file_open(RiaStringEncodingTools::toNativeEncoded(m_filename).data(), ECL_FILE_CLOSE_STREAM); if (!m_ecl_file) { RiaLogging::error(QString("Failed to open file %1").arg(m_filename)); @@ -113,7 +113,7 @@ bool RifEclipseUnifiedRestartFileAccess::openFile() QString resultPath = fi.absolutePath(); if (caf::Utils::isFolderWritable(resultPath)) { - bool success = ecl_file_write_index(m_ecl_file, RifStringTools::toNativeEncoded(indexFileName).data()); + bool success = ecl_file_write_index(m_ecl_file, RiaStringEncodingTools::toNativeEncoded(indexFileName).data()); if (success) { diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp index 5a13358a2b..5ea9100be5 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp @@ -28,7 +28,7 @@ #include "RifEclipseOutputFileTools.h" #include "RifHdf5ReaderInterface.h" #include "RifReaderSettings.h" -#include "RifStringTools.h" +#include "RiaStringEncodingTools.h" #ifdef USE_HDF5 #include "RifHdf5Reader.h" @@ -375,7 +375,7 @@ bool RifReaderEclipseOutput::open(const QString& fileName, RigEclipseCaseData* e // Read geometry // Todo: Needs to check existence of file before calling ert, else it will abort - ecl_grid_type * mainEclGrid = ecl_grid_alloc( RifStringTools::toNativeEncoded(fileName).data() ); + ecl_grid_type * mainEclGrid = ecl_grid_alloc( RiaStringEncodingTools::toNativeEncoded(fileName).data() ); progInfo.incrementProgress(); @@ -723,7 +723,7 @@ bool RifReaderEclipseOutput::readActiveCellInfo() QString egridFileName = RifEclipseOutputFileTools::firstFileNameOfType(m_filesWithSameBaseName, ECL_EGRID_FILE); if (egridFileName.size() > 0) { - ecl_file_type* ecl_file = ecl_file_open(RifStringTools::toNativeEncoded(egridFileName).data(), ECL_FILE_CLOSE_STREAM); + ecl_file_type* ecl_file = ecl_file_open(RiaStringEncodingTools::toNativeEncoded(egridFileName).data(), ECL_FILE_CLOSE_STREAM); if (!ecl_file) return false; int actnumKeywordCount = ecl_file_get_num_named_kw(ecl_file, ACTNUM_KW); @@ -2214,7 +2214,7 @@ void RifReaderEclipseOutput::openInitFile() QString initFileName = RifEclipseOutputFileTools::firstFileNameOfType(m_filesWithSameBaseName, ECL_INIT_FILE); if (initFileName.size() > 0) { - m_ecl_init_file = ecl_file_open(RifStringTools::toNativeEncoded(initFileName).data(), ECL_FILE_CLOSE_STREAM); + m_ecl_init_file = ecl_file_open(RiaStringEncodingTools::toNativeEncoded(initFileName).data(), ECL_FILE_CLOSE_STREAM); } } diff --git a/ApplicationCode/FileInterface/RifReaderEclipseRft.cpp b/ApplicationCode/FileInterface/RifReaderEclipseRft.cpp index 21a1d976a1..71e056ce54 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseRft.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseRft.cpp @@ -21,7 +21,7 @@ #include "RiaLogging.h" #include "RiaQDateTimeTools.h" -#include "RifStringTools.h" +#include "RiaStringEncodingTools.h" #include "cafVecIjk.h" @@ -51,7 +51,7 @@ void RifReaderEclipseRft::open() RiaLogging::info(QString("Opening file '%1'").arg( m_fileName)); - m_ecl_rft_file = ecl_rft_file_alloc_case(RifStringTools::toNativeEncoded(m_fileName).data()); + m_ecl_rft_file = ecl_rft_file_alloc_case(RiaStringEncodingTools::toNativeEncoded(m_fileName).data()); if (m_ecl_rft_file == NULL) { diff --git a/ApplicationCode/FileInterface/RifReaderEclipseSummary.cpp b/ApplicationCode/FileInterface/RifReaderEclipseSummary.cpp index 0bd235bdcb..9d7b153f3d 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseSummary.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseSummary.cpp @@ -17,7 +17,7 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RifReaderEclipseSummary.h" -#include "RifStringTools.h" +#include "RiaStringEncodingTools.h" #include "ert/ecl/ecl_sum.h" @@ -66,11 +66,11 @@ bool RifReaderEclipseSummary::open(const QString& headerFileName, const QStringL stringlist_type* dataFiles = stringlist_alloc_new(); for (int i = 0; i < dataFileNames.size(); i++) { - stringlist_append_copy(dataFiles, RifStringTools::toNativeEncoded(dataFileNames[i]).data()); + stringlist_append_copy(dataFiles, RiaStringEncodingTools::toNativeEncoded(dataFileNames[i]).data()); } std::string itemSeparatorInVariableNames = ":"; - m_ecl_sum = ecl_sum_fread_alloc(RifStringTools::toNativeEncoded(headerFileName).data(), dataFiles, itemSeparatorInVariableNames.data(), false); + m_ecl_sum = ecl_sum_fread_alloc(RiaStringEncodingTools::toNativeEncoded(headerFileName).data(), dataFiles, itemSeparatorInVariableNames.data(), false); stringlist_free(dataFiles); diff --git a/ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp b/ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp index ea40779a48..110be82073 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp +++ b/ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp @@ -21,7 +21,7 @@ #include "RigWellLogCurveData.h" -#include "RifStringTools.h" +#include "RiaStringEncodingTools.h" #include "RimWellLogCurve.h" @@ -83,7 +83,7 @@ bool RigWellLogFile::open(const QString& fileName, QString* errorMessage) { int wellFormat = NRLib::Well::LAS; - well = NRLib::Well::ReadWell(RifStringTools::toNativeEncoded(fileName).data(), wellFormat); + well = NRLib::Well::ReadWell(RiaStringEncodingTools::toNativeEncoded(fileName).data(), wellFormat); if (!well) { return false; @@ -151,7 +151,7 @@ void RigWellLogFile::close() QString RigWellLogFile::wellName() const { CVF_ASSERT(m_wellLogFile); - return RifStringTools::fromNativeEncoded(m_wellLogFile->GetWellName().data()); + return RiaStringEncodingTools::fromNativeEncoded(m_wellLogFile->GetWellName().data()); } //-------------------------------------------------------------------------------------------------- From 5a7133f6e2594f87bb295830dbdefae572dfacc2 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Sat, 3 Feb 2018 09:14:53 +0100 Subject: [PATCH 65/78] Fix disabled test --- ApplicationCode/UnitTests/EclipseRftReader-Test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApplicationCode/UnitTests/EclipseRftReader-Test.cpp b/ApplicationCode/UnitTests/EclipseRftReader-Test.cpp index b4ab3d0d9c..ae9e645ebd 100644 --- a/ApplicationCode/UnitTests/EclipseRftReader-Test.cpp +++ b/ApplicationCode/UnitTests/EclipseRftReader-Test.cpp @@ -11,7 +11,7 @@ //TEST(RifReaderEclipseRftTest, TestRifEclipseRftAddress) TEST(DISABLED_RifReaderEclipseRftTest, TestRifEclipseRftAddress) { - std::string filename = "C:\\Users\\Rebecca Cox\\Dropbox\\norne\\norne\\NORNE_ATW2013.RFT"; + QString filename = "C:\\Users\\Rebecca Cox\\Dropbox\\norne\\norne\\NORNE_ATW2013.RFT"; RifReaderEclipseRft reader(filename); From 082b82214d66f577f80f55c5f839088bf66ef276 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 5 Feb 2018 08:47:10 +0100 Subject: [PATCH 66/78] #2444 Batch : Fix support for multiple replaceCase in command file --- .../RicfCommandFileExecutor.cpp | 114 ++++++++++++++++-- .../RicfCommandFileExecutor.h | 5 + .../CommandFileInterface/RicfReplaceCase.cpp | 79 +++++++++--- .../CommandFileInterface/RicfReplaceCase.h | 42 +++++-- .../UnitTests/RifcCommandCore-Test.cpp | 44 ++++++- 5 files changed, 248 insertions(+), 36 deletions(-) diff --git a/ApplicationCode/CommandFileInterface/RicfCommandFileExecutor.cpp b/ApplicationCode/CommandFileInterface/RicfCommandFileExecutor.cpp index 2d3035a1a8..bdef74898e 100644 --- a/ApplicationCode/CommandFileInterface/RicfCommandFileExecutor.cpp +++ b/ApplicationCode/CommandFileInterface/RicfCommandFileExecutor.cpp @@ -18,11 +18,14 @@ #include "RicfCommandFileExecutor.h" -#include "RifcCommandFileReader.h" -#include "RicfCommandObject.h" - #include "RiaLogging.h" +#include "RicfCloseProject.h" +#include "RicfCommandObject.h" +#include "RicfOpenProject.h" +#include "RicfReplaceCase.h" +#include "RifcCommandFileReader.h" + namespace caf { template<> void RicfCommandFileExecutor::ExportTypeEnum::setUp() @@ -54,22 +57,44 @@ RicfCommandFileExecutor::~RicfCommandFileExecutor() //-------------------------------------------------------------------------------------------------- void RicfCommandFileExecutor::executeCommands(QTextStream& stream) { - std::vector commands = RicfCommandFileReader::readCommands(stream, caf::PdmDefaultObjectFactory::instance(), &m_messages); - for (auto message : m_messages.m_messages) + std::vector executableCommands; { - if (message.first == RicfMessages::MESSAGE_WARNING) - { - RiaLogging::warning(QString("Command file parsing warning: %1").arg(message.second)); - } - else + std::vector fileCommands = RicfCommandFileReader::readCommands(stream, caf::PdmDefaultObjectFactory::instance(), &m_messages); + for (auto message : m_messages.m_messages) { - RiaLogging::error(QString("Command file parsing error: %1").arg(message.second)); - return; + if (message.first == RicfMessages::MESSAGE_WARNING) + { + RiaLogging::warning(QString("Command file parsing warning: %1").arg(message.second)); + } + else + { + RiaLogging::error(QString("Command file parsing error: %1").arg(message.second)); + + for (auto& command : fileCommands) + { + delete command; + command = nullptr; + } + + return; + } } + + executableCommands = RicfCommandFileExecutor::prepareFileCommandsForExecution(fileCommands); } - for (RicfCommandObject* command : commands) + + for (auto& command : executableCommands) { command->execute(); + + delete command; + command = nullptr; + } + + // All command objects should be deleted and grounded at this point + for (auto c : executableCommands) + { + CAF_ASSERT(c == nullptr); } } @@ -119,3 +144,66 @@ RicfCommandFileExecutor* RicfCommandFileExecutor::instance() static RicfCommandFileExecutor* commandFileExecutorInstance = new RicfCommandFileExecutor(); return commandFileExecutorInstance; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RicfCommandFileExecutor::prepareFileCommandsForExecution(const std::vector& commandsReadFromFile) +{ + // This function will merge multiple RicfSingleCaseReplace object by a single RicfMultiCaseReplace object + // A command file version for multi case replace was rejected by @hhgs 2018-02-02 + // + // The reason for this is based on two requirements + // 1. Ability to aggregate info from multiple replaceCase() statements in a command file + // 2. Improve performance, as a replace case is implemented by reading a project file from XML and replace file paths + // during project loading + + std::vector executableCommands; + { + std::vector objectsToBeDeleted; + std::vector batchOfReplaceCaseFileObjects; + + std::map aggregatedCasePathPairs; + + for (RicfCommandObject* command : commandsReadFromFile) + { + RicfSingleCaseReplace* fileReplaceCase = dynamic_cast(command); + if (fileReplaceCase) + { + aggregatedCasePathPairs[fileReplaceCase->caseId()] = fileReplaceCase->filePath(); + + batchOfReplaceCaseFileObjects.push_back(fileReplaceCase); + objectsToBeDeleted.push_back(fileReplaceCase); + } + else + { + if (!batchOfReplaceCaseFileObjects.empty()) + { + RicfMultiCaseReplace* multiCaseReplace = new RicfMultiCaseReplace; + multiCaseReplace->setCaseReplacePairs(aggregatedCasePathPairs); + + executableCommands.push_back(multiCaseReplace); + + batchOfReplaceCaseFileObjects.clear(); + } + + if (dynamic_cast(command) || dynamic_cast(command)) + { + // Reset aggregation when openProject or closeProject is issued + aggregatedCasePathPairs.clear(); + } + + executableCommands.push_back(command); + } + } + + // Delete RicfSingleCaseReplace objects, as they are replaced by RicfMultiCaseReplace + for (auto objToDelete : objectsToBeDeleted) + { + delete objToDelete; + objToDelete = nullptr; + } + } + + return executableCommands; +} diff --git a/ApplicationCode/CommandFileInterface/RicfCommandFileExecutor.h b/ApplicationCode/CommandFileInterface/RicfCommandFileExecutor.h index 5724f8a270..3c38789a2c 100644 --- a/ApplicationCode/CommandFileInterface/RicfCommandFileExecutor.h +++ b/ApplicationCode/CommandFileInterface/RicfCommandFileExecutor.h @@ -23,6 +23,9 @@ #include "cafAppEnum.h" #include +#include + +class RicfCommandObject; //================================================================================================== // @@ -53,6 +56,8 @@ class RicfCommandFileExecutor static RicfCommandFileExecutor* instance(); + static std::vector prepareFileCommandsForExecution(const std::vector& commandsReadFromFile); + private: RicfMessages m_messages; diff --git a/ApplicationCode/CommandFileInterface/RicfReplaceCase.cpp b/ApplicationCode/CommandFileInterface/RicfReplaceCase.cpp index 669e41d3fd..4cfe9c5b92 100644 --- a/ApplicationCode/CommandFileInterface/RicfReplaceCase.cpp +++ b/ApplicationCode/CommandFileInterface/RicfReplaceCase.cpp @@ -18,18 +18,20 @@ #include "RicfReplaceCase.h" -#include "RicfCommandFileExecutor.h" - #include "RiaApplication.h" #include "RiaLogging.h" #include "RiaProjectModifier.h" -CAF_PDM_SOURCE_INIT(RicfReplaceCase, "replaceCase"); +#include "RicfCommandFileExecutor.h" + +#include "RimProject.h" + +CAF_PDM_SOURCE_INIT(RicfSingleCaseReplace, "replaceCase"); //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RicfReplaceCase::RicfReplaceCase() +RicfSingleCaseReplace::RicfSingleCaseReplace() { RICF_InitField(&m_caseId, "caseId", -1, "Case ID", "", "", ""); RICF_InitField(&m_newGridFile, "newGridFile", QString(), "New Grid File", "", "", ""); @@ -38,11 +40,56 @@ RicfReplaceCase::RicfReplaceCase() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicfReplaceCase::execute() +int RicfSingleCaseReplace::caseId() const +{ + return m_caseId; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RicfSingleCaseReplace::filePath() const +{ + return m_newGridFile; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicfSingleCaseReplace::execute() +{ + // Never call execute on this object, information is aggregated into RicfMultiCaseReplace + CAF_ASSERT(false); +} + + + + +CAF_PDM_SOURCE_INIT(RicfMultiCaseReplace, "replaceCaseImpl_no_support_for_command_file_text_parsing"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicfMultiCaseReplace::RicfMultiCaseReplace() { - if (m_newGridFile().isNull()) +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicfMultiCaseReplace::setCaseReplacePairs(const std::map& caseIdToGridFileNameMap) +{ + m_caseIdToGridFileNameMap = caseIdToGridFileNameMap; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicfMultiCaseReplace::execute() +{ + if (m_caseIdToGridFileNameMap.empty()) { - RiaLogging::error("replaceCase: Required parameter newGridFile."); + RiaLogging::error("replaceCaseImpl: No replacements available."); return; } @@ -53,15 +100,19 @@ void RicfReplaceCase::execute() return; } - cvf::ref projectModifier = new RiaProjectModifier; - if (m_caseId() == -1) - { - projectModifier->setReplaceCaseFirstOccurrence(m_newGridFile()); - } - else + for (const auto& a : m_caseIdToGridFileNameMap) { - projectModifier->setReplaceCase(m_caseId(), m_newGridFile()); + const auto caseId = a.first; + const auto filePath = a.second; + if (caseId < 0) + { + projectModifier->setReplaceCaseFirstOccurrence(filePath); + } + else + { + projectModifier->setReplaceCase(caseId, filePath); + } } RiaApplication::instance()->loadProject(lastProjectPath, RiaApplication::PLA_NONE, projectModifier.p()); diff --git a/ApplicationCode/CommandFileInterface/RicfReplaceCase.h b/ApplicationCode/CommandFileInterface/RicfReplaceCase.h index aa739cc63d..031a241b6b 100644 --- a/ApplicationCode/CommandFileInterface/RicfReplaceCase.h +++ b/ApplicationCode/CommandFileInterface/RicfReplaceCase.h @@ -1,17 +1,17 @@ ///////////////////////////////////////////////////////////////////////////////// // // 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 +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// @@ -23,16 +23,22 @@ #include "cafPdmField.h" //================================================================================================== +// RicfSingleCaseReplace represents the parsed command from text file able to replace one case ID with +// a new file name // +// This is the preferred interface on file, based on discussion with @hhgs 2018-02-02 // -// +// Multiple objects of this type can be aggregated into RicfMultipleReplaceCase //================================================================================================== -class RicfReplaceCase : public RicfCommandObject +class RicfSingleCaseReplace : public RicfCommandObject { CAF_PDM_HEADER_INIT; public: - RicfReplaceCase(); + RicfSingleCaseReplace(); + + int caseId() const; + QString filePath() const; virtual void execute() override; @@ -40,3 +46,25 @@ class RicfReplaceCase : public RicfCommandObject caf::PdmField m_newGridFile; caf::PdmField m_caseId; }; + +//================================================================================================== +// RicfMultipleReplaceCase represents multiple caseId-gridFileName pairs +// +// NB! This object has no support for parsing a text command. This object is created by aggregating +// multiple RicfSingleCaseReplace objects +// +//================================================================================================== +class RicfMultiCaseReplace : public RicfCommandObject +{ + CAF_PDM_HEADER_INIT; + +public: + RicfMultiCaseReplace(); + + void setCaseReplacePairs(const std::map& caseIdToGridFileNameMap); + + virtual void execute() override; + +private: + std::map m_caseIdToGridFileNameMap; +}; diff --git a/ApplicationCode/UnitTests/RifcCommandCore-Test.cpp b/ApplicationCode/UnitTests/RifcCommandCore-Test.cpp index cab6432d43..7842a67e2d 100644 --- a/ApplicationCode/UnitTests/RifcCommandCore-Test.cpp +++ b/ApplicationCode/UnitTests/RifcCommandCore-Test.cpp @@ -1,9 +1,11 @@ #include "gtest/gtest.h" -#include "RifcCommandFileReader.h" +#include "RicfCommandFileExecutor.h" #include "RicfCommandObject.h" -#include "cafPdmField.h" #include "RicfMessages.h" +#include "RifcCommandFileReader.h" + +#include "cafPdmField.h" class TestCommand1: public RicfCommandObject { @@ -165,3 +167,41 @@ TEST(RicfCommands, EmptyArgumentList) delete(obj); } } + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +TEST(RicfCommands, TransformFileCommandObjectsToExecutableCommandObjects) +{ + QString commandString = R"( + replaceCase(newGridFile="/1.EGRID", caseId=1) + replaceCase(newGridFile="/2.EGRID", caseId=2) + + openProject(path="/home/user/ResInsightProject.rsp") + replaceCase(newGridFile="/3.EGRID", caseId=3) + replaceCase(newGridFile="/4.EGRID", caseId=4) + + exportSnapshots() + replaceCase(newGridFile="/6.EGRID", caseId=6) + replaceCase(newGridFile="/7.EGRID", caseId=7) + + closeProject() + + )"; + + QTextStream inputStream(&commandString); + RicfMessages errors; + + auto objects = RicfCommandFileReader::readCommands(inputStream, caf::PdmDefaultObjectFactory::instance(), &errors); + EXPECT_TRUE(errors.m_messages.empty()); + EXPECT_EQ((size_t)9, objects.size()); + + auto exeObjects = RicfCommandFileExecutor::prepareFileCommandsForExecution(objects); + EXPECT_EQ((size_t)6, exeObjects.size()); + + for (auto obj : exeObjects) + { + delete(obj); + } +} From 0dff40f6581270ea256da2001ae4d04ff8f93dc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Mon, 5 Feb 2018 14:13:28 +0100 Subject: [PATCH 67/78] #2434. Ignore NOECHO keyword in grdecl files --- ApplicationCode/FileInterface/RifEclipseInputFileTools.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ApplicationCode/FileInterface/RifEclipseInputFileTools.cpp b/ApplicationCode/FileInterface/RifEclipseInputFileTools.cpp index 4755a4f06a..cdabcf0f1a 100644 --- a/ApplicationCode/FileInterface/RifEclipseInputFileTools.cpp +++ b/ApplicationCode/FileInterface/RifEclipseInputFileTools.cpp @@ -440,6 +440,7 @@ const std::vector& RifEclipseInputFileTools::invalidPropertyDataKeyword keywords.push_back("ZCORN"); keywords.push_back("SPECGRID"); keywords.push_back("MAPAXES"); + keywords.push_back("NOECHO"); keywords.push_back(faultsKeyword); From 0843c3e464c3769734d4f257f9a2a0cfabf36cc7 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 8 Feb 2018 10:18:01 +0100 Subject: [PATCH 68/78] #2451 Export Completion : Exclude main bore cells correctly --- .../RicFishbonesTransmissibilityCalculationFeatureImp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp b/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp index de2f92fe33..f0279515b7 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp @@ -80,7 +80,7 @@ std::vector RicFishbonesTransmissibilityCalculationFeatureImp std::map > wellBorePartsInCells; //wellBore = main bore or fishbone lateral findFishboneLateralsWellBoreParts(wellBorePartsInCells, wellPath, settings); findFishboneImportedLateralsWellBoreParts(wellBorePartsInCells, wellPath, settings); - if (!wellBorePartsInCells.empty()) + if (!wellBorePartsInCells.empty() && !settings.excludeMainBoreForFishbones) { findMainWellBoreParts(wellBorePartsInCells, wellPath, settings); } From 39949923a6a82d3380e7f18b35e3f17a31d3d441 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 8 Feb 2018 10:25:43 +0100 Subject: [PATCH 69/78] #2451 Export Completion : Remove obsolete test --- .../RicWellPathExportCompletionDataFeature.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp b/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp index f14b8d6f37..5a79b164f3 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp @@ -537,11 +537,6 @@ RigCompletionData RicWellPathExportCompletionDataFeature::combineEclipseCellComp return resultCompletion; //Returning empty completion, should not be exported } - if (settings.excludeMainBoreForFishbones && completionType == RigCompletionData::FISHBONES && completion.isMainBore()) - { - continue; - } - totalTrans = totalTrans + completion.transmissibility(); } From 2e0069456f9c165b825194e0a65e9dc085f7a6cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Thu, 8 Feb 2018 11:37:07 +0100 Subject: [PATCH 70/78] #2453 Stim plan. Removed double string splitting loop --- ApplicationCode/FileInterface/RifStimPlanXmlReader.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ApplicationCode/FileInterface/RifStimPlanXmlReader.cpp b/ApplicationCode/FileInterface/RifStimPlanXmlReader.cpp index ab99c3747b..13587f0f3b 100644 --- a/ApplicationCode/FileInterface/RifStimPlanXmlReader.cpp +++ b/ApplicationCode/FileInterface/RifStimPlanXmlReader.cpp @@ -224,12 +224,13 @@ std::vector> RifStimPlanXmlReader::getAllDepthDataAtTimeSte if (xmlStream.isCDATA()) { QString depthDataStr = xmlStream.text().toString(); - for (int i = 0; i < depthDataStr.split(' ').size(); i++) + QStringList splitted = depthDataStr.split(' '); + for (int i = 0; i < splitted.size(); i++) { if (i < static_cast(startingNegValuesXs)) continue; else { - QString value = depthDataStr.split(' ')[i]; + QString value = splitted[i]; if ( value != "") { propertyValuesAtDepth.push_back(value.toDouble()); From f053dfa8e33e583cceefc7d2564cbe09fa27cd4c Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 8 Feb 2018 13:17:18 +0100 Subject: [PATCH 71/78] #2446 : Snapshot : Improve generated file, always use _ in generated filename --- .../ExportCommands/RicSnapshotFilenameGenerator.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ApplicationCode/Commands/ExportCommands/RicSnapshotFilenameGenerator.cpp b/ApplicationCode/Commands/ExportCommands/RicSnapshotFilenameGenerator.cpp index 30edda7a76..37128b6591 100644 --- a/ApplicationCode/Commands/ExportCommands/RicSnapshotFilenameGenerator.cpp +++ b/ApplicationCode/Commands/ExportCommands/RicSnapshotFilenameGenerator.cpp @@ -68,8 +68,10 @@ QString RicSnapshotFilenameGenerator::generateSnapshotFilenameForRimView(RimView .arg(rimView->name()) .arg(resultName(rimView)); - if ( timeSteps.size() ) fileName += QString("_%1_%2").arg(timeStep, 2, 10, QChar('0')) - .arg(timeSteps[timeStep].replace(".", "-")); + if ( !timeSteps.empty() ) fileName += QString("_%1_%2").arg(timeStep, 2, 10, QChar('0')) + .arg(timeSteps[timeStep]); + + fileName.replace("-", "_"); fileName = caf::Utils::makeValidFileBasename(fileName); From 6e16a47b0d32acc8db0ce36ea20df45eea55bc22 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 9 Feb 2018 11:19:04 +0100 Subject: [PATCH 72/78] #2446 : Replace - with _ for all generated file names --- .../RicSnapshotFilenameGenerator.cpp | 21 +++++++++++++++---- .../RicSnapshotFilenameGenerator.h | 1 + 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/ApplicationCode/Commands/ExportCommands/RicSnapshotFilenameGenerator.cpp b/ApplicationCode/Commands/ExportCommands/RicSnapshotFilenameGenerator.cpp index 37128b6591..6db72f2815 100644 --- a/ApplicationCode/Commands/ExportCommands/RicSnapshotFilenameGenerator.cpp +++ b/ApplicationCode/Commands/ExportCommands/RicSnapshotFilenameGenerator.cpp @@ -51,7 +51,7 @@ QString RicSnapshotFilenameGenerator::generateSnapshotFileName(RimViewWindow* vi fileName = viewWindow->uiCapability()->uiName(); } - fileName = caf::Utils::makeValidFileBasename(fileName); + fileName = makeValidFileName(fileName); return fileName; } @@ -71,9 +71,7 @@ QString RicSnapshotFilenameGenerator::generateSnapshotFilenameForRimView(RimView if ( !timeSteps.empty() ) fileName += QString("_%1_%2").arg(timeStep, 2, 10, QChar('0')) .arg(timeSteps[timeStep]); - fileName.replace("-", "_"); - - fileName = caf::Utils::makeValidFileBasename(fileName); + fileName = makeValidFileName(fileName); return fileName; } @@ -111,3 +109,18 @@ QString RicSnapshotFilenameGenerator::resultName(RimView * rimView) return ""; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RicSnapshotFilenameGenerator::makeValidFileName(const QString& filename) +{ + QString trimmedString = filename; + + // Use lowercase instead of dash before calling caf::Utils::makeValidFileBasename + trimmedString.replace("-", "_"); + + trimmedString = caf::Utils::makeValidFileBasename(trimmedString); + + return trimmedString; +} diff --git a/ApplicationCode/Commands/ExportCommands/RicSnapshotFilenameGenerator.h b/ApplicationCode/Commands/ExportCommands/RicSnapshotFilenameGenerator.h index 37916b7697..9532f6b37d 100644 --- a/ApplicationCode/Commands/ExportCommands/RicSnapshotFilenameGenerator.h +++ b/ApplicationCode/Commands/ExportCommands/RicSnapshotFilenameGenerator.h @@ -34,4 +34,5 @@ class RicSnapshotFilenameGenerator private: static QString generateSnapshotFilenameForRimView(RimView* rimView); static QString resultName(RimView* rimView); + static QString makeValidFileName(const QString& filename); }; From b8c9989d0b309b1bd1ec42055f3d6785f53386f2 Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Mon, 12 Feb 2018 09:40:10 +0100 Subject: [PATCH 73/78] #2458 Cell Result: Select chosen result type on load --- ApplicationCode/ProjectDataModel/RimGeoMechCellColors.cpp | 1 + ApplicationCode/ProjectDataModel/RimGeoMechCellColors.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechCellColors.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechCellColors.cpp index 6798c2e7ef..7b7c81a1b6 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechCellColors.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechCellColors.cpp @@ -76,6 +76,7 @@ void RimGeoMechCellColors::updateIconState() //-------------------------------------------------------------------------------------------------- void RimGeoMechCellColors::initAfterRead() { + RimGeoMechResultDefinition::initAfterRead(); updateIconState(); } diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechCellColors.h b/ApplicationCode/ProjectDataModel/RimGeoMechCellColors.h index 24e7a0fa22..c3da0cb14c 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechCellColors.h +++ b/ApplicationCode/ProjectDataModel/RimGeoMechCellColors.h @@ -42,7 +42,7 @@ class RimGeoMechCellColors : public RimGeoMechResultDefinition caf::PdmChildField legendConfig; void updateIconState(); - virtual void initAfterRead(); + virtual void initAfterRead() override; protected: void updateLegendCategorySettings() override; From b49396b88c4b9d72f380b91f39397afee2a4f344 Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Tue, 13 Feb 2018 10:49:26 +0100 Subject: [PATCH 74/78] #588 GeoMech Color result: Make active result visible in property editor when selecting a object ofType/containing Result definition --- .../ProjectDataModel/RimGeoMechResultDefinition.cpp | 13 +++++++++++-- .../ProjectDataModel/RimGeoMechResultDefinition.h | 3 ++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp index 77decdf994..df30ec308f 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp @@ -94,8 +94,7 @@ RimGeoMechResultDefinition::RimGeoMechResultDefinition(void) m_resultVariableUiField.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName()); m_resultVariableUiField.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP); - - + m_isChangedByField = false; } //-------------------------------------------------------------------------------------------------- @@ -122,6 +121,14 @@ void RimGeoMechResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm timeLapseGr->add(&m_timeLapseBaseTimestepUiField); } + if (!m_isChangedByField) + { + m_resultPositionTypeUiField = m_resultPositionType; + m_resultVariableUiField = composeFieldCompString(m_resultFieldName(), m_resultComponentName()); + } + + m_isChangedByField = false; + uiOrdering.skipRemainingFields(true); } @@ -187,6 +194,8 @@ void RimGeoMechResultDefinition::setGeoMechCase(RimGeoMechCase* geomCase) //-------------------------------------------------------------------------------------------------- void RimGeoMechResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) { + m_isChangedByField = true; + if( &m_resultPositionTypeUiField == changedField || &m_isTimeLapseResultUiField == changedField || &m_timeLapseBaseTimestepUiField == changedField) diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.h b/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.h index 428406fe06..bb4dfeeb7a 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.h +++ b/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.h @@ -113,6 +113,7 @@ class RimGeoMechResultDefinition : public caf::PdmObject caf::PdmField m_isTimeLapseResultUiField; caf::PdmField m_timeLapseBaseTimestepUiField; - caf::PdmPointer m_geomCase; + + bool m_isChangedByField; }; From 4d39136212f6ba856dc1d6afa7ce7d0da466151c Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Mon, 19 Feb 2018 09:29:14 +0100 Subject: [PATCH 75/78] #2403 Extraction curves: Fix curves without vertical connections --- .../RigWellLogCurveData.cpp | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/ApplicationCode/ReservoirDataModel/RigWellLogCurveData.cpp b/ApplicationCode/ReservoirDataModel/RigWellLogCurveData.cpp index 8afe4b9163..674a6bc46d 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellLogCurveData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigWellLogCurveData.cpp @@ -274,11 +274,11 @@ void RigWellLogCurveData::calculateIntervalsOfContinousValidValues() //-------------------------------------------------------------------------------------------------- /// Splits the start stop interval between cells that are not close enough. -/// The depth values are expected to contain pair of depths: Depth at cell enter, and cell leave //-------------------------------------------------------------------------------------------------- -void RigWellLogCurveData::splitIntervalAtEmptySpace(const std::vector& depthValues, - size_t startIdx, size_t stopIdx, - std::vector< std::pair >* intervals) +void RigWellLogCurveData::splitIntervalAtEmptySpace(const std::vector& depthValues, + size_t startIdx, + size_t stopIdx, + std::vector< std::pair >* intervals) { CVF_ASSERT(intervals); @@ -293,20 +293,31 @@ void RigWellLogCurveData::splitIntervalAtEmptySpace(const std::vector& d // !! TODO: Find a reasonable tolerance const double depthDiffTolerance = 0.1; - // Find intervals containing depth values that should be connected - size_t intStartIdx = startIdx; - for (size_t vIdx = startIdx + 1; vIdx < stopIdx; vIdx += 2) + // Find intervals containing depth values that should be connected: + // + // vIdx = 0 is the first point of a well, usually outside of the model. Further depth values are + // organized in pairs of depths (in and out of a cell), and sometimes the depths varies slightly. If + // the distance between a depth pair is larger than the depthDiffTolerance, the two sections will be split + // into two intervals. + // + // The first pair is located at vIdx = 1 & 2. If startIdx = 0, an offset of 1 is added to vIdx, to access + // that pair in the loop. If startIdx = 1 (can happen if the start point is inside of the model and invalid), + // the offset is not needed. + + size_t intervalStartIdx = startIdx; + size_t offset = 1 - startIdx % 2; + for (size_t vIdx = startIdx + offset; vIdx < stopIdx; vIdx += 2) { if (cvf::Math::abs(depthValues[vIdx + 1] - depthValues[vIdx]) > depthDiffTolerance) { - intervals->push_back(std::make_pair(intStartIdx, vIdx)); - intStartIdx = vIdx + 1; + intervals->push_back(std::make_pair(intervalStartIdx, vIdx)); + intervalStartIdx = vIdx + 1; } } - if (intStartIdx <= stopIdx) + if (intervalStartIdx <= stopIdx) { - intervals->push_back(std::make_pair(intStartIdx, stopIdx)); + intervals->push_back(std::make_pair(intervalStartIdx, stopIdx)); } } From 119752bf04356f99ba30cdfcff7e21c2b4eb2e4f Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Mon, 19 Feb 2018 14:15:42 +0100 Subject: [PATCH 76/78] #2501 Result Plot: Add "Show Plot Data" to context menu --- .../ProjectDataModel/Summary/RimSummaryPlot.h | 4 +- .../UserInterface/CMakeLists_files.cmake | 1 + .../UserInterface/RiuResultQwtPlot.cpp | 84 +++++++++++++++++-- .../UserInterface/RiuResultQwtPlot.h | 23 ++++- .../RiuSelectionChangedHandler.cpp | 6 +- 5 files changed, 104 insertions(+), 14 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.h index fe43619508..b3393077f0 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -129,11 +129,11 @@ class RimSummaryPlot : public RimViewWindow protected: // Overridden PDM methods - virtual caf::PdmFieldHandle* userDescriptionField(); + virtual caf::PdmFieldHandle* userDescriptionField() override; virtual QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override; virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override; - virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute); + virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override; virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; virtual void onLoadDataAndUpdate() override; diff --git a/ApplicationCode/UserInterface/CMakeLists_files.cmake b/ApplicationCode/UserInterface/CMakeLists_files.cmake index f6219706d6..58e825d702 100644 --- a/ApplicationCode/UserInterface/CMakeLists_files.cmake +++ b/ApplicationCode/UserInterface/CMakeLists_files.cmake @@ -149,6 +149,7 @@ ${CEE_CURRENT_LIST_DIR}RiuMainPlotWindow.h ${CEE_CURRENT_LIST_DIR}RiuPvtPlotPanel.h ${CEE_CURRENT_LIST_DIR}RiuRelativePermeabilityPlotPanel.h ${CEE_CURRENT_LIST_DIR}RiuResultInfoPanel.h +${CEE_CURRENT_LIST_DIR}RiuResultQwtPlot.h ${CEE_CURRENT_LIST_DIR}RiuTextDialog.h ${CEE_CURRENT_LIST_DIR}RiuViewer.h ${CEE_CURRENT_LIST_DIR}RiuProcessMonitor.h diff --git a/ApplicationCode/UserInterface/RiuResultQwtPlot.cpp b/ApplicationCode/UserInterface/RiuResultQwtPlot.cpp index f6bec832ac..ae65202248 100644 --- a/ApplicationCode/UserInterface/RiuResultQwtPlot.cpp +++ b/ApplicationCode/UserInterface/RiuResultQwtPlot.cpp @@ -22,8 +22,11 @@ #include "RigCurveDataTools.h" #include "RimContextCommandBuilder.h" +#include "RimCase.h" #include "RiuLineSegmentQwtPlotCurve.h" +#include "RiuSummaryQwtPlot.h" +#include "RiuTextDialog.h" #include "cafCmdFeatureMenuBuilder.h" @@ -41,7 +44,6 @@ #include #include -#include "RiuSummaryQwtPlot.h" //-------------------------------------------------------------------------------------------------- @@ -64,7 +66,7 @@ RiuResultQwtPlot::~RiuResultQwtPlot() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuResultQwtPlot::addCurve(const QString& curveName, const cvf::Color3f& curveColor, const std::vector& dateTimes, const std::vector& timeHistoryValues) +void RiuResultQwtPlot::addCurve(const RimCase* rimCase, const QString& curveName, const cvf::Color3f& curveColor, const std::vector& dateTimes, const std::vector& timeHistoryValues) { if (dateTimes.empty() || timeHistoryValues.empty()) { @@ -84,21 +86,28 @@ void RiuResultQwtPlot::addCurve(const QString& curveName, const cvf::Color3f& cu this->setAxisScale( QwtPlot::xTop, QwtDate::toDouble(dateTimes.front()), QwtDate::toDouble(dateTimes.back())); this->replot(); + + int caseId = rimCase->caseId; + + m_caseNames[caseId] = rimCase->caseUserDescription; + m_curveNames[caseId].push_back(curveName); + m_curveData[caseId].push_back(timeHistoryValues); + m_timeSteps[caseId] = dateTimes; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuResultQwtPlot::addCurve(const QString& curveName, const cvf::Color3f& curveColor, const std::vector& frameTimes, const std::vector& timeHistoryValues) +void RiuResultQwtPlot::addCurve(const RimCase* rimCase, const QString& curveName, const cvf::Color3f& curveColor, const std::vector& frameTimes, const std::vector& timeHistoryValues) { std::vector dateTimes; - for (size_t i = 0; i < frameTimes.size(); i++) + for (double frameTime : frameTimes) { - dateTimes.push_back(QwtDate::toDateTime(frameTimes[i])); + dateTimes.push_back(QwtDate::toDateTime(frameTime)); } - addCurve(curveName, curveColor, dateTimes, timeHistoryValues); + addCurve(rimCase, curveName, curveColor, dateTimes, timeHistoryValues); } //-------------------------------------------------------------------------------------------------- @@ -113,6 +122,11 @@ void RiuResultQwtPlot::deleteAllCurves() } m_plotCurves.clear(); + + m_caseNames.clear(); + m_curveNames.clear(); + m_curveData.clear(); + m_timeSteps.clear(); } //-------------------------------------------------------------------------------------------------- @@ -141,9 +155,14 @@ void RiuResultQwtPlot::contextMenuEvent(QContextMenuEvent* event) menuBuilder << "RicNewGridTimeHistoryCurveFeature"; + const int curveCount = this->itemList(QwtPlotItem::Rtti_PlotCurve).count(); + + QAction* act = menu.addAction("Show Plot Data", this, SLOT(slotCurrentPlotDataInTextDialog())); + act->setEnabled(curveCount > 0); + menuBuilder.appendToMenu(&menu); - if (menu.actions().size() > 0) + if (!menu.actions().empty()) { menu.exec(event->globalPos()); } @@ -171,3 +190,54 @@ void RiuResultQwtPlot::setDefaults() QwtLegend* legend = new QwtLegend(this); this->insertLegend(legend, BottomLegend); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiuResultQwtPlot::asciiDataForUiSelectedCurves() const +{ + QString out; + + for (std::pair caseIdAndName : m_caseNames) + { + int caseId = caseIdAndName.first; + out += "Case: " + caseIdAndName.second; + out += "\n"; + + for (size_t i = 0; i < m_timeSteps.at(caseId).size(); i++) //time steps & data points + { + if (i == 0) + { + out += "Date and time"; + for (QString curveName : m_curveNames.at(caseId)) + { + out += "\t" + curveName; + } + } + out += "\n"; + out += m_timeSteps.at(caseId)[i].toString("yyyy-MM-dd hh:mm:ss "); + + for (size_t j = 0; j < m_curveData.at(caseId).size(); j++) // curves + { + out += "\t" + QString::number(m_curveData.at(caseId)[j][i], 'g', 6); + } + } + out += "\n\n"; + } + + return out; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuResultQwtPlot::slotCurrentPlotDataInTextDialog() +{ + QString outTxt = asciiDataForUiSelectedCurves(); + + RiuTextDialog* textDialog = new RiuTextDialog(this); + textDialog->setMinimumSize(400, 600); + textDialog->setWindowTitle("Result Plot Data"); + textDialog->setText(outTxt); + textDialog->show(); +} diff --git a/ApplicationCode/UserInterface/RiuResultQwtPlot.h b/ApplicationCode/UserInterface/RiuResultQwtPlot.h index c08250accc..53e792c4f6 100644 --- a/ApplicationCode/UserInterface/RiuResultQwtPlot.h +++ b/ApplicationCode/UserInterface/RiuResultQwtPlot.h @@ -21,6 +21,11 @@ #include "qwt_plot.h" +#include +#include +#include + +class RimCase; class QwtPlotCurve; class QwtPlotGrid; @@ -36,15 +41,19 @@ namespace cvf //================================================================================================== class RiuResultQwtPlot : public QwtPlot { + Q_OBJECT + public: explicit RiuResultQwtPlot(QWidget* parent = NULL); virtual ~RiuResultQwtPlot(); - void addCurve(const QString& curveName, + void addCurve(const RimCase* rimCase, + const QString& curveName, const cvf::Color3f& curveColor, const std::vector& dateTimes, const std::vector& timeHistoryValues); - void addCurve(const QString& curveName, + void addCurve(const RimCase* rimCase, + const QString& curveName, const cvf::Color3f& curveColor, const std::vector& frameTimes, const std::vector& timeHistoryValues); @@ -59,7 +68,17 @@ class RiuResultQwtPlot : public QwtPlot private: void setDefaults(); + QString asciiDataForUiSelectedCurves() const; + +private slots: + void slotCurrentPlotDataInTextDialog(); + private: std::vector m_plotCurves; + + std::map m_caseNames; + std::map > m_timeSteps; + std::map >> m_curveData; + std::map > m_curveNames; }; diff --git a/ApplicationCode/UserInterface/RiuSelectionChangedHandler.cpp b/ApplicationCode/UserInterface/RiuSelectionChangedHandler.cpp index d75604513f..aec9a19a0c 100644 --- a/ApplicationCode/UserInterface/RiuSelectionChangedHandler.cpp +++ b/ApplicationCode/UserInterface/RiuSelectionChangedHandler.cpp @@ -154,7 +154,7 @@ void RiuSelectionChangedHandler::addCurveFromSelectionItem(const RiuEclipseSelec std::vector timeHistoryValues = RigTimeHistoryResultAccessor::timeHistoryValues(eclipseView->eclipseCase()->eclipseCaseData(), eclipseView->cellResult(), eclipseSelectionItem->m_gridIndex, eclipseSelectionItem->m_gridLocalCellIndex, timeStepDates.size()); CVF_ASSERT(timeStepDates.size() == timeHistoryValues.size()); - RiuMainWindow::instance()->resultPlot()->addCurve(curveName, eclipseSelectionItem->m_color, timeStepDates, timeHistoryValues); + RiuMainWindow::instance()->resultPlot()->addCurve(eclipseView->eclipseCase(), curveName, eclipseSelectionItem->m_color, timeStepDates, timeHistoryValues); } } @@ -223,7 +223,7 @@ void RiuSelectionChangedHandler::addCurveFromSelectionItem(const RiuGeoMechSelec std::vector dates = geoMechView->geoMechCase()->timeStepDates(); if (dates.size() == timeHistoryValues.size()) { - RiuMainWindow::instance()->resultPlot()->addCurve(curveName, geomSelectionItem->m_color, dates, timeHistoryValues); + RiuMainWindow::instance()->resultPlot()->addCurve(geoMechView->geoMechCase(), curveName, geomSelectionItem->m_color, dates, timeHistoryValues); } else { @@ -233,7 +233,7 @@ void RiuSelectionChangedHandler::addCurveFromSelectionItem(const RiuGeoMechSelec dummyStepTimes.push_back(i); } - RiuMainWindow::instance()->resultPlot()->addCurve(curveName, geomSelectionItem->m_color, dummyStepTimes, timeHistoryValues); + RiuMainWindow::instance()->resultPlot()->addCurve(geoMechView->geoMechCase(), curveName, geomSelectionItem->m_color, dummyStepTimes, timeHistoryValues); } } } From 65f93814febf29b26c5d9ea21417fe65b3a9db82 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 20 Feb 2018 13:35:31 +0100 Subject: [PATCH 77/78] #2468 Multi grid statistics : Initialize filename before creating data access object --- ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp index 5ea9100be5..15743cdffc 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp @@ -694,7 +694,7 @@ bool RifReaderEclipseOutput::openAndReadActiveCellData(const QString& fileName, // Keep the set of files of interest m_filesWithSameBaseName = fileSet; m_eclipseCase = eclipseCase; - + m_fileName = fileName; if (!readActiveCellInfo()) { From 2b8a19d472d6ee84028d164298293cb190aa7054 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 22 Feb 2018 07:25:37 +0100 Subject: [PATCH 78/78] Upped to version 2018.01.1 --- ResInsightVersion.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index bac7877ebd..6d09cf4146 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -1,16 +1,16 @@ set(RESINSIGHT_MAJOR_VERSION 2018) set(RESINSIGHT_MINOR_VERSION 01) -set(RESINSIGHT_PATCH_VERSION 00) +set(RESINSIGHT_PATCH_VERSION 1) # Opional text with no restrictions -set(RESINSIGHT_VERSION_TEXT "-patch") +#set(RESINSIGHT_VERSION_TEXT "-patch") # Optional text # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -set(RESINSIGHT_DEV_VERSION ".04") +#set(RESINSIGHT_DEV_VERSION ".00") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f")