From 0a0cb584b5e384bad2cfcaae8ad58910c6e325e8 Mon Sep 17 00:00:00 2001 From: Gaute Lindkvist Date: Mon, 2 Jul 2018 09:47:34 +0200 Subject: [PATCH] Move hard coded parameter names to RiaDefines --- ApplicationCode/Application/RiaDefines.cpp | 82 +++++++++++++++++++ ApplicationCode/Application/RiaDefines.h | 17 ++++ .../RicNewWellBoreStabilityPlotFeature.cpp | 16 ++-- .../RigFemPartResultsCollection.cpp | 17 ++-- .../RimGeoMechResultDefinition.cpp | 4 +- .../RigGeoMechWellLogExtractor.cpp | 9 +- 6 files changed, 124 insertions(+), 21 deletions(-) diff --git a/ApplicationCode/Application/RiaDefines.cpp b/ApplicationCode/Application/RiaDefines.cpp index 3d38462776..c3f448b8a6 100644 --- a/ApplicationCode/Application/RiaDefines.cpp +++ b/ApplicationCode/Application/RiaDefines.cpp @@ -353,6 +353,88 @@ QString RiaDefines::activeFormationNamesResultName() return "Active Formation Names"; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::wellPathAzimuthResultName() +{ + return "Azimuth"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::wellPathInclinationResultName() +{ + return "Inclination"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::wellPathPPResultName() +{ + return "PP"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::wellPathSHResultName() +{ + return "SH"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::wellPathOBGResultName() +{ + return "OBG"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::wellPathFGResultName() +{ + return "FG"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::wellPathSFGResultName() +{ + return "SFG"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::wellPathCasingShoeSizeChannelName() +{ + return "CASING_SIZE"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RiaDefines::wellPathAngleResultNames() +{ + return { RiaDefines::wellPathAzimuthResultName(), RiaDefines::wellPathInclinationResultName() }; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RiaDefines::wellPathStabilityResultNames() +{ + return { RiaDefines::wellPathFGResultName(), RiaDefines::wellPathOBGResultName(), + RiaDefines::wellPathPPResultName(), RiaDefines::wellPathSFGResultName(), + RiaDefines::wellPathSHResultName() }; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Application/RiaDefines.h b/ApplicationCode/Application/RiaDefines.h index c03ffdd0da..240a14b703 100644 --- a/ApplicationCode/Application/RiaDefines.h +++ b/ApplicationCode/Application/RiaDefines.h @@ -21,6 +21,7 @@ #pragma once #include +#include namespace RiaDefines { @@ -85,6 +86,22 @@ namespace RiaDefines QString activeFormationNamesResultName(); + // Well path derived results + QString wellPathAzimuthResultName(); + QString wellPathInclinationResultName(); + QString wellPathPPResultName(); + QString wellPathSHResultName(); + QString wellPathOBGResultName(); + QString wellPathFGResultName(); + QString wellPathSFGResultName(); + + // Well path casing shoe size + QString wellPathCasingShoeSizeChannelName(); + + // List of well path derived results + std::vector wellPathAngleResultNames(); + std::vector wellPathStabilityResultNames(); + //Units and conversions enum DepthUnitType { diff --git a/ApplicationCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.cpp index f0d20a3bcf..1253241c5d 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.cpp @@ -193,15 +193,15 @@ void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack(RimWellLogPl stabilityCurvesTrack->setAutoScaleXEnabled(true); stabilityCurvesTrack->setTickIntervals(0.5, 0.05); stabilityCurvesTrack->enableGridLines(RimWellLogTrack::GRID_X_MAJOR_AND_MINOR); - std::vector resultNames = { "PP", "SH", "OGB", "FractureGradient", "ShearFailureGradient" }; + std::vector resultNames = RiaDefines::wellPathStabilityResultNames(); - for (std::string& resultName : resultNames) + for (const QString& resultName : resultNames) { - RigFemResultAddress resAddr(RIG_WELLPATH_DERIVED, resultName, ""); + RigFemResultAddress resAddr(RIG_WELLPATH_DERIVED, resultName.toStdString(), ""); RimWellLogExtractionCurve* curve = RicWellLogTools::addExtractionCurve(stabilityCurvesTrack, geoMechView, wellPath, nullptr, 0, false, false); curve->setGeoMechResultAddress(resAddr); curve->setCurrentTimeStep(geoMechView->currentTimeStep()); - curve->setCustomName(QString::fromStdString(resultName)); + curve->setCustomName(resultName); curve->loadDataAndUpdate(false); } stabilityCurvesTrack->calculateXZoomRangeAndUpdateQwt(); @@ -216,15 +216,15 @@ void RicNewWellBoreStabilityPlotFeature::createAnglesTrack(RimWellLogPlot* plot, double minValue = 360.0, maxValue = 0.0; const double epsilon = 1.0e-3; const double angleIncrement = 90.0; - std::vector resultNames = { "Azimuth", "Inclination" }; + std::vector resultNames = RiaDefines::wellPathAngleResultNames(); - for (std::string& resultName : resultNames) + for (const QString& resultName : resultNames) { - RigFemResultAddress resAddr(RIG_WELLPATH_DERIVED, resultName, ""); + RigFemResultAddress resAddr(RIG_WELLPATH_DERIVED, resultName.toStdString(), ""); RimWellLogExtractionCurve* curve = RicWellLogTools::addExtractionCurve(wellPathAnglesTrack, geoMechView, wellPath, nullptr, 0, false, false); curve->setGeoMechResultAddress(resAddr); curve->setCurrentTimeStep(geoMechView->currentTimeStep()); - curve->setCustomName(QString::fromStdString(resultName)); + curve->setCustomName(resultName); curve->loadDataAndUpdate(false); double actualMinValue = minValue, actualMaxValue = maxValue; diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp index b089a1eb86..f6afd30873 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp @@ -484,13 +484,16 @@ std::map > RigFemPartResultsCollection::sc } else if (resPos == RIG_WELLPATH_DERIVED) { - fieldCompNames["Azimuth"]; - fieldCompNames["FractureGradient"]; - fieldCompNames["Inclination"]; - fieldCompNames["PP"]; - fieldCompNames["OBG"]; - fieldCompNames["SH"]; - fieldCompNames["ShearFailureGradient"]; + std::vector angles = RiaDefines::wellPathAngleResultNames(); + for (QString angle : angles) + { + fieldCompNames[angle.toStdString()]; + } + std::vector derivedResults = RiaDefines::wellPathStabilityResultNames(); + for (QString result : derivedResults) + { + fieldCompNames[result.toStdString()]; + } } } diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp index 8256fed1ea..06bf63fe4c 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp @@ -483,8 +483,8 @@ void RimGeoMechResultDefinition::loadResult() { if (m_geomCase && m_geomCase->geoMechData()) { - if (this->resultAddress().fieldName == "FractureGradient" || - this->resultAddress().fieldName == "ShearFailureGradient") + if (this->resultAddress().fieldName == RiaDefines::wellPathFGResultName().toStdString() || + this->resultAddress().fieldName == RiaDefines::wellPathSFGResultName().toStdString()) { RigFemResultAddress stressResAddr(RIG_ELEMENT_NODAL, std::string("ST"), ""); RigFemResultAddress porBarResAddr(RIG_ELEMENT_NODAL, std::string("POR-Bar"), ""); diff --git a/ApplicationCode/ReservoirDataModel/RigGeoMechWellLogExtractor.cpp b/ApplicationCode/ReservoirDataModel/RigGeoMechWellLogExtractor.cpp index d78326968c..c3edd7800a 100644 --- a/ApplicationCode/ReservoirDataModel/RigGeoMechWellLogExtractor.cpp +++ b/ApplicationCode/ReservoirDataModel/RigGeoMechWellLogExtractor.cpp @@ -22,6 +22,7 @@ //================================================================================================== #include "RigGeoMechWellLogExtractor.h" +#include "RiaDefines.h" #include "RigFemTypes.h" #include "RigGeoMechBoreHoleStressCalculator.h" #include "RigFemPart.h" @@ -60,7 +61,7 @@ void RigGeoMechWellLogExtractor::curveData(const RigFemResultAddress& resAddr, i if (resAddr.resultPosType == RIG_WELLPATH_DERIVED) { - if (resAddr.fieldName == "FractureGradient" || resAddr.fieldName == "ShearFailureGradient") + if (resAddr.fieldName == RiaDefines::wellPathFGResultName().toStdString() || resAddr.fieldName == RiaDefines::wellPathSFGResultName().toStdString()) { wellBoreWallCurveData(resAddr, frameIndex, values); return; @@ -214,7 +215,7 @@ void RigGeoMechWellLogExtractor::wellBoreWallCurveData(const RigFemResultAddress const double uniaxialStrengthInBars = 100.0; CVF_ASSERT(values); - CVF_ASSERT(resAddr.fieldName == "FractureGradient" || resAddr.fieldName == "ShearFailureGradient"); + CVF_ASSERT(resAddr.fieldName == RiaDefines::wellPathFGResultName().toStdString() || resAddr.fieldName == RiaDefines::wellPathSFGResultName().toStdString()); const RigFemPart* femPart = m_caseData->femParts()->part(0); const std::vector& nodeCoords = femPart->nodes().coordinates; @@ -266,13 +267,13 @@ void RigGeoMechWellLogExtractor::wellBoreWallCurveData(const RigFemResultAddress RigGeoMechBoreHoleStressCalculator sigmaCalculator(wellPathStressDouble, porePressure, poissonRatio, uniaxialStrengthInBars, 32); double resultValue = 0.0; - if (resAddr.fieldName == "FractureGradient") + if (resAddr.fieldName == RiaDefines::wellPathFGResultName().toStdString()) { resultValue = sigmaCalculator.solveFractureGradient(); } else { - CVF_ASSERT(resAddr.fieldName == "ShearFailureGradient"); + CVF_ASSERT(resAddr.fieldName == RiaDefines::wellPathSFGResultName().toStdString()); resultValue = sigmaCalculator.solveStassiDalia(); } double effectiveDepth = -m_intersections[intersectionIdx].z() + m_rkbDiff;