Fix whitespace and includes

This commit is contained in:
Magne Sjaastad committed 2019-03-12 09:22:48 +01:00
1 parent 246326229e
commit f7600199c7
6 files changed
+159 -160

No files matched your search

@@ -21,8 +21,9 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifEclipseRftAddress::RifEclipseRftAddress(QString wellName, QDateTime timeStep, RftWellLogChannelType wellLogChannelName) :
m_wellName(wellName), m_wellLogChannel(wellLogChannelName)
RifEclipseRftAddress::RifEclipseRftAddress(QString wellName, QDateTime timeStep, RftWellLogChannelType wellLogChannelName)
: m_wellName(wellName)
, m_wellLogChannel(wellLogChannelName)
{
timeStep.setTimeSpec(Qt::TimeSpec::UTC);
@@ -53,4 +54,3 @@ bool operator<(const RifEclipseRftAddress& first, const RifEclipseRftAddress& se
return false;
}
@@ -226,8 +226,8 @@ bool RimWellPlotTools::hasFlowData(RimEclipseResultCase* gridCase)
for (const QString& channelName : FLOW_DATA_NAMES)
{
if (eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->hasResultEntry(RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE,
channelName)) )
if (eclipseCaseData->results(RiaDefines::MATRIX_MODEL)
->hasResultEntry(RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, channelName)))
{
return true;
}
@@ -75,9 +75,6 @@ public:
static std::map<QDateTime, std::set<RifDataSourceForRftPlt>> timeStepsMapFromGridCase(RimEclipseCase* gridCase);
static RiaRftPltCurveDefinition curveDefFromCurve(const RimWellLogCurve* curve);
template<typename T>
static void appendSet(std::set<T>& destSet, const std::set<T>& setToAppend);
// others
static bool hasFlowData(const RimWellLogFile* wellLogFile);
static bool hasAssociatedWellPath(const QString& wellName);
@@ -138,12 +135,3 @@ private:
};
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<typename T>
void RimWellPlotTools::appendSet(std::set<T>& destSet, const std::set<T>& setToAppend)
{
destSet.insert(setToAppend.begin(), setToAppend.end());
}
@@ -35,6 +35,7 @@
#include "RigWellLogExtractor.h"
#include "RigWellPath.h"
#include "RimDataSourceForRftPlt.h"
#include "RimEclipseCase.h"
#include "RimEclipseCaseCollection.h"
#include "RimEclipseResultCase.h"
@@ -62,19 +63,18 @@
#include "cafPdmUiTreeSelectionEditor.h"
#include "cafVecIjk.h"
#include <QMessageBox>
#include <algorithm>
#include <iterator>
#include <tuple>
#include "QMessageBox"
CAF_PDM_SOURCE_INIT(RimWellPltPlot, "WellPltPlot");
namespace caf
{
template<>
void caf::AppEnum< FlowType>::setUp()
void caf::AppEnum<FlowType>::setUp()
{
addItem(FLOW_TYPE_PHASE_SPLIT, "PHASE_SPLIT", "Phase Split");
addItem(FLOW_TYPE_TOTAL, "TOTAL", "Total Flow");
@@ -82,14 +82,14 @@ void caf::AppEnum< FlowType>::setUp()
}
template<>
void caf::AppEnum< FlowPhase>::setUp()
void caf::AppEnum<FlowPhase>::setUp()
{
addItem(FLOW_PHASE_OIL, "PHASE_OIL", "Oil");
addItem(FLOW_PHASE_GAS, "PHASE_GAS", "Gas");
addItem(FLOW_PHASE_WATER, "PHASE_WATER", "Water");
addItem(FLOW_PHASE_TOTAL, "PHASE_TOTAL", "Total");
}
}
} // namespace caf
//--------------------------------------------------------------------------------------------------
///
@@ -134,7 +134,7 @@ RimWellPltPlot::RimWellPltPlot()
CAF_PDM_InitFieldNoDefault(&m_phases, "Phases", "Phases", "", "", "");
m_phases.uiCapability()->setUiEditorTypeName(caf::PdmUiTreeSelectionEditor::uiEditorTypeName());
m_phases = std::vector<caf::AppEnum<FlowPhase>>({ FLOW_PHASE_OIL, FLOW_PHASE_GAS, FLOW_PHASE_WATER });
m_phases = std::vector<caf::AppEnum<FlowPhase>>({FLOW_PHASE_OIL, FLOW_PHASE_GAS, FLOW_PHASE_WATER});
m_phases.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
this->setAsPlotMdiWindow();
@@ -164,13 +164,12 @@ void RimWellPltPlot::deleteViewWidget()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPltPlot::setPlotXAxisTitles(RimWellLogTrack* plotTrack)
{
std::set< RiaEclipseUnitTools::UnitSystem> presentUnitSystems;
std::set<RiaEclipseUnitTools::UnitSystem> presentUnitSystems;
for (const RifDataSourceForRftPlt& source : m_selectedSources.v())
{
if (source.eclCase()) presentUnitSystems.insert(source.eclCase()->eclipseCaseData()->unitsType());
@@ -181,24 +180,32 @@ void RimWellPltPlot::setPlotXAxisTitles(RimWellLogTrack* plotTrack)
// Todo: Handle different units in the relevant las channels
switch (source.wellLogFile()->wellLogFileData()->depthUnit())
{
case RiaDefines::UNIT_METER: presentUnitSystems.insert(RiaEclipseUnitTools::UNITS_METRIC);
case RiaDefines::UNIT_FEET: presentUnitSystems.insert(RiaEclipseUnitTools::UNITS_FIELD);
case RiaDefines::UNIT_NONE: presentUnitSystems.insert(RiaEclipseUnitTools::UNITS_UNKNOWN);
case RiaDefines::UNIT_METER:
presentUnitSystems.insert(RiaEclipseUnitTools::UNITS_METRIC);
case RiaDefines::UNIT_FEET:
presentUnitSystems.insert(RiaEclipseUnitTools::UNITS_FIELD);
case RiaDefines::UNIT_NONE:
presentUnitSystems.insert(RiaEclipseUnitTools::UNITS_UNKNOWN);
}
}
}
}
if (presentUnitSystems.size() > 1) { QMessageBox::warning(nullptr, "ResInsight PLT Plot", "Inconsistent units in PLT plot");}
if (presentUnitSystems.size() > 1)
{
QMessageBox::warning(nullptr, "ResInsight PLT Plot", "Inconsistent units in PLT plot");
}
if (presentUnitSystems.size() <= 0 ) return;
if (presentUnitSystems.size() <= 0) return;
RiaEclipseUnitTools::UnitSystem unitSet = *presentUnitSystems.begin();
QString axisTitle;
if (m_useReservoirConditionCurves) axisTitle += RimWellPlotTools::flowPlotAxisTitle(RimWellLogFile::WELL_FLOW_COND_RESERVOIR, unitSet);
if (m_useReservoirConditionCurves)
axisTitle += RimWellPlotTools::flowPlotAxisTitle(RimWellLogFile::WELL_FLOW_COND_RESERVOIR, unitSet);
if (m_useReservoirConditionCurves && m_useStandardConditionCurves) axisTitle += " | ";
if (m_useStandardConditionCurves) axisTitle += RimWellPlotTools::flowPlotAxisTitle(RimWellLogFile::WELL_FLOW_COND_STANDARD, unitSet);
if (m_useStandardConditionCurves)
axisTitle += RimWellPlotTools::flowPlotAxisTitle(RimWellLogFile::WELL_FLOW_COND_STANDARD, unitSet);
plotTrack->setXAxisTitle(axisTitle);
#if 0
@@ -223,7 +230,7 @@ void RimWellPltPlot::setPlotXAxisTitles(RimWellLogTrack* plotTrack)
}
plotTrack->setXAxisTitle("Surface Flow Rate " + unitText);
#endif
#endif
}
//--------------------------------------------------------------------------------------------------
@@ -238,13 +245,13 @@ void RimWellPltPlot::updateFormationsOnPlot() const
RimCase* formationNamesCase = m_wellLogPlot->trackByIndex(0)->formationNamesCase();
if ( !formationNamesCase )
if (!formationNamesCase)
{
/// Set default case. Todo : Use the first of the selected cases in the plot
std::vector<RimCase*> cases;
proj->allCases(cases);
if ( !cases.empty() )
if (!cases.empty())
{
formationNamesCase = cases[0];
}
@@ -277,7 +284,7 @@ void RimWellPltPlot::updateWidgetTitleWindowTitle()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set < RiaRftPltCurveDefinition > RimWellPltPlot::selectedCurveDefs() const
std::set<RiaRftPltCurveDefinition> RimWellPltPlot::selectedCurveDefs() const
{
std::set<RifEclipseRftAddress::RftWellLogChannelType> channelTypesToUse = RifEclipseRftAddress::pltPlotChannelTypes();
@@ -297,14 +304,21 @@ public:
RigResultPointCalculator() {}
virtual ~RigResultPointCalculator() {}
const std::vector <cvf::Vec3d>& pipeBranchCLCoords() { return m_pipeBranchCLCoords; }
const std::vector <RigWellResultPoint>& pipeBranchWellResultPoints() { return m_pipeBranchWellResultPoints; }
const std::vector <double>& pipeBranchMeasuredDepths() { return m_pipeBranchMeasuredDepths; }
const std::vector<cvf::Vec3d>& pipeBranchCLCoords()
{
return m_pipeBranchCLCoords;
}
const std::vector<RigWellResultPoint>& pipeBranchWellResultPoints()
{
return m_pipeBranchWellResultPoints;
}
const std::vector<double>& pipeBranchMeasuredDepths()
{
return m_pipeBranchMeasuredDepths;
}
protected:
RigEclipseWellLogExtractor* findWellLogExtractor(const QString& wellPathName,
RimEclipseResultCase* eclCase)
RigEclipseWellLogExtractor* findWellLogExtractor(const QString& wellPathName, RimEclipseResultCase* eclCase)
{
RimProject* proj = RiaApplication::instance()->project();
RimWellPath* wellPath = proj->wellPathByName(wellPathName);
@@ -314,10 +328,9 @@ protected:
return eclExtractor;
}
std::vector <cvf::Vec3d> m_pipeBranchCLCoords;
std::vector <RigWellResultPoint> m_pipeBranchWellResultPoints;
std::vector <double> m_pipeBranchMeasuredDepths;
std::vector<cvf::Vec3d> m_pipeBranchCLCoords;
std::vector<RigWellResultPoint> m_pipeBranchWellResultPoints;
std::vector<double> m_pipeBranchMeasuredDepths;
};
//--------------------------------------------------------------------------------------------------
@@ -327,11 +340,8 @@ protected:
class RigRftResultPointCalculator : public RigResultPointCalculator
{
public:
RigRftResultPointCalculator(const QString& wellPathName,
RimEclipseResultCase* eclCase,
QDateTime m_timeStep)
RigRftResultPointCalculator(const QString& wellPathName, RimEclipseResultCase* eclCase, QDateTime m_timeStep)
{
RifEclipseRftAddress gasRateAddress(RimWellPlotTools::simWellName(wellPathName), m_timeStep, RifEclipseRftAddress::GRAT);
RifEclipseRftAddress oilRateAddress(RimWellPlotTools::simWellName(wellPathName), m_timeStep, RifEclipseRftAddress::ORAT);
RifEclipseRftAddress watRateAddress(RimWellPlotTools::simWellName(wellPathName), m_timeStep, RifEclipseRftAddress::WRAT);
@@ -389,60 +399,61 @@ public:
resPoint.m_gridIndex = 0; // Always main grid
resPoint.m_gridCellIndex = globCellIdx; // Shortcut, since we only have main grid results from RFT
resPoint.m_gasRate = RiaEclipseUnitTools::convertSurfaceGasFlowRateToOilEquivalents(eclCase->eclipseCaseData()->unitsType(),
gasRates[it->second]);
resPoint.m_gasRate = RiaEclipseUnitTools::convertSurfaceGasFlowRateToOilEquivalents(
eclCase->eclipseCaseData()->unitsType(), gasRates[it->second]);
resPoint.m_oilRate = oilRates[it->second];
resPoint.m_waterRate = watRates[it->second];
m_pipeBranchWellResultPoints.push_back(resPoint);
if ( wpExIdx < intersections.size() - 1 )
if (wpExIdx < intersections.size() - 1)
{
m_pipeBranchWellResultPoints.push_back(RigWellResultPoint()); // Invalid res point describing the "line" between the cells
m_pipeBranchWellResultPoints.push_back(
RigWellResultPoint()); // Invalid res point describing the "line" between the cells
}
}
}
};
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class RigSimWellResultPointCalculator: public RigResultPointCalculator
class RigSimWellResultPointCalculator : public RigResultPointCalculator
{
public:
RigSimWellResultPointCalculator(const QString& wellPathName,
RimEclipseResultCase* eclCase,
QDateTime m_timeStep)
RigSimWellResultPointCalculator(const QString& wellPathName, RimEclipseResultCase* eclCase, QDateTime m_timeStep)
{
// Find timestep index from qdatetime
const std::vector<QDateTime> timeSteps = eclCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->timeStepDates();
size_t tsIdx = timeSteps.size();
for ( tsIdx = 0; tsIdx < timeSteps.size(); ++tsIdx) { if (timeSteps[tsIdx] == m_timeStep) break; }
for (tsIdx = 0; tsIdx < timeSteps.size(); ++tsIdx)
{
if (timeSteps[tsIdx] == m_timeStep) break;
}
if (tsIdx >= timeSteps.size()) return;
// Build search map into simulation well data
std::map<size_t, std::pair<size_t, size_t> > globCellIdxToIdxInSimWellBranch;
std::map<size_t, std::pair<size_t, size_t>> globCellIdxToIdxInSimWellBranch;
const RimWellPath* wellPath = RimWellPlotTools::wellPathByWellPathNameOrSimWellName(wellPathName);
const RigSimWellData* simWell = wellPath != nullptr ? eclCase->eclipseCaseData()->findSimWellData(wellPath->associatedSimulationWellName()) : nullptr;
const RigSimWellData* simWell =
wellPath != nullptr ? eclCase->eclipseCaseData()->findSimWellData(wellPath->associatedSimulationWellName()) : nullptr;
if (!simWell) return;
if (!simWell->hasWellResult(tsIdx)) return;
const RigWellResultFrame & resFrame = simWell->wellResultFrame(tsIdx);
const RigWellResultFrame& resFrame = simWell->wellResultFrame(tsIdx);
const RigMainGrid* mainGrid = eclCase->eclipseCaseData()->mainGrid();
for (size_t brIdx = 0; brIdx < resFrame.m_wellResultBranches.size(); ++brIdx)
{
const std::vector<RigWellResultPoint>& branchResPoints = resFrame.m_wellResultBranches[brIdx].m_branchResultPoints;
for ( size_t wrpIdx = 0; wrpIdx < branchResPoints.size(); wrpIdx++ )
for (size_t wrpIdx = 0; wrpIdx < branchResPoints.size(); wrpIdx++)
{
const RigGridBase* grid = mainGrid->gridByIndex(branchResPoints[wrpIdx].m_gridIndex);
size_t globalCellIndex = grid->reservoirCellIndex(branchResPoints[wrpIdx].m_gridCellIndex);
@@ -477,18 +488,19 @@ public:
m_pipeBranchCLCoords.push_back(intersections[wpExIdx].endPoint);
m_pipeBranchMeasuredDepths.push_back(intersections[wpExIdx].endMD);
const RigWellResultPoint& resPoint = resFrame.m_wellResultBranches[it->second.first].m_branchResultPoints[it->second.second];
const RigWellResultPoint& resPoint =
resFrame.m_wellResultBranches[it->second.first].m_branchResultPoints[it->second.second];
m_pipeBranchWellResultPoints.push_back(resPoint);
if ( wpExIdx < intersections.size() - 1 )
if (wpExIdx < intersections.size() - 1)
{
m_pipeBranchWellResultPoints.push_back(RigWellResultPoint()); // Invalid res point describing the "line" between the cells
m_pipeBranchWellResultPoints.push_back(
RigWellResultPoint()); // Invalid res point describing the "line" between the cells
}
}
}
};
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -508,7 +520,7 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
QString dateFormatString;
{
std::vector<QDateTime> allTimeSteps;
for ( const RiaRftPltCurveDefinition& curveDefToAdd : curveDefs )
for (const RiaRftPltCurveDefinition& curveDefToAdd : curveDefs)
{
allTimeSteps.push_back(curveDefToAdd.timeStep());
}
@@ -518,7 +530,7 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
// Add curves
for (const RiaRftPltCurveDefinition& curveDefToAdd : curveDefs)
{
std::set<FlowPhase> selectedPhases = std::set<FlowPhase>(m_phases().begin(), m_phases().end()) ;
std::set<FlowPhase> selectedPhases = std::set<FlowPhase>(m_phases().begin(), m_phases().end());
RifDataSourceForRftPlt sourceDef = curveDefToAdd.address();
QDateTime timeStep = curveDefToAdd.timeStep();
@@ -530,24 +542,20 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
{
curveName += sourceDef.eclCase() ? sourceDef.eclCase()->caseUserDescription() : "";
curveName += sourceDef.wellLogFile() ? sourceDef.wellLogFile()->name() : "";
if ( sourceDef.sourceType() == RifDataSourceForRftPlt::RFT ) curveName += ", RFT";
if (sourceDef.sourceType() == RifDataSourceForRftPlt::RFT) curveName += ", RFT";
curveName += ", " + RiaQDateTimeTools::toStringUsingApplicationLocale(timeStep, dateFormatString);
}
RimEclipseResultCase* rimEclipseResultCase = dynamic_cast<RimEclipseResultCase*>(sourceDef.eclCase());
if ( sourceDef.sourceType() == RifDataSourceForRftPlt::RFT )
if (sourceDef.sourceType() == RifDataSourceForRftPlt::RFT)
{
resultPointCalc.reset(new RigRftResultPointCalculator(m_wellPathName,
rimEclipseResultCase,
timeStep));
resultPointCalc.reset(new RigRftResultPointCalculator(m_wellPathName, rimEclipseResultCase, timeStep));
}
else if (sourceDef.sourceType() == RifDataSourceForRftPlt::GRID)
{
resultPointCalc.reset(new RigSimWellResultPointCalculator(m_wellPathName,
rimEclipseResultCase,
timeStep));
resultPointCalc.reset(new RigSimWellResultPointCalculator(m_wellPathName, rimEclipseResultCase, timeStep));
}
RiaEclipseUnitTools::UnitSystem unitSet = RiaEclipseUnitTools::UNITS_UNKNOWN;
@@ -558,12 +566,10 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
if (resultPointCalc != nullptr)
{
if ( resultPointCalc->pipeBranchCLCoords().size() )
if (resultPointCalc->pipeBranchCLCoords().size())
{
if ( selectedPhases.count(FLOW_PHASE_TOTAL)
&& m_useReservoirConditionCurves()
&& sourceDef.sourceType() == RifDataSourceForRftPlt::GRID )
if (selectedPhases.count(FLOW_PHASE_TOTAL) && m_useReservoirConditionCurves() &&
sourceDef.sourceType() == RifDataSourceForRftPlt::GRID)
{
RigAccWellFlowCalculator wfTotalAccumulator(resultPointCalc->pipeBranchCLCoords(),
resultPointCalc->pipeBranchWellResultPoints(),
@@ -574,7 +580,8 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
QString curveUnitText = RimWellPlotTools::flowUnitText(RimWellLogFile::WELL_FLOW_COND_RESERVOIR, unitSet);
const std::vector<double> accFlow = wfTotalAccumulator.accumulatedTracerFlowPrPseudoLength(RIG_FLOW_TOTAL_NAME, 0);
const std::vector<double> accFlow =
wfTotalAccumulator.accumulatedTracerFlowPrPseudoLength(RIG_FLOW_TOTAL_NAME, 0);
addStackedCurve(curveName + ", " + RIG_FLOW_TOTAL_NAME + " " + curveUnitText,
depthValues,
accFlow,
@@ -585,34 +592,39 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
curveGroupId++;
}
if ( m_useStandardConditionCurves() )
if (m_useStandardConditionCurves())
{
RigAccWellFlowCalculator wfPhaseAccumulator(resultPointCalc->pipeBranchCLCoords(),
resultPointCalc->pipeBranchWellResultPoints(),
resultPointCalc->pipeBranchMeasuredDepths(),
false);
const std::vector<double>& depthValues = wfPhaseAccumulator.pseudoLengthFromTop(0);
std::vector<QString> tracerNames = wfPhaseAccumulator.tracerNames();
for ( const QString& tracerName: tracerNames )
for (const QString& tracerName : tracerNames)
{
auto color = tracerName == RIG_FLOW_OIL_NAME ? cvf::Color3f::DARK_GREEN :
tracerName == RIG_FLOW_GAS_NAME ? cvf::Color3f::DARK_RED :
tracerName == RIG_FLOW_WATER_NAME ? cvf::Color3f::BLUE :
cvf::Color3f::DARK_GRAY;
auto color = tracerName == RIG_FLOW_OIL_NAME
? cvf::Color3f::DARK_GREEN
: tracerName == RIG_FLOW_GAS_NAME
? cvf::Color3f::DARK_RED
: tracerName == RIG_FLOW_WATER_NAME ? cvf::Color3f::BLUE : cvf::Color3f::DARK_GRAY;
if ( tracerName == RIG_FLOW_OIL_NAME && selectedPhases.count(FLOW_PHASE_OIL)
|| tracerName == RIG_FLOW_GAS_NAME && selectedPhases.count(FLOW_PHASE_GAS)
|| tracerName == RIG_FLOW_WATER_NAME && selectedPhases.count(FLOW_PHASE_WATER) )
if (tracerName == RIG_FLOW_OIL_NAME && selectedPhases.count(FLOW_PHASE_OIL) ||
tracerName == RIG_FLOW_GAS_NAME && selectedPhases.count(FLOW_PHASE_GAS) ||
tracerName == RIG_FLOW_WATER_NAME && selectedPhases.count(FLOW_PHASE_WATER))
{
FlowPhase flowPhase = FLOW_PHASE_NONE;
if (tracerName == RIG_FLOW_OIL_NAME) flowPhase = FLOW_PHASE_OIL;
else if (tracerName == RIG_FLOW_GAS_NAME) flowPhase = FLOW_PHASE_GAS;
else if (tracerName == RIG_FLOW_WATER_NAME) flowPhase = FLOW_PHASE_WATER;
QString curveUnitText = RimWellPlotTools::curveUnitText(RimWellLogFile::WELL_FLOW_COND_STANDARD, unitSet, flowPhase);
if (tracerName == RIG_FLOW_OIL_NAME)
flowPhase = FLOW_PHASE_OIL;
else if (tracerName == RIG_FLOW_GAS_NAME)
flowPhase = FLOW_PHASE_GAS;
else if (tracerName == RIG_FLOW_WATER_NAME)
flowPhase = FLOW_PHASE_WATER;
QString curveUnitText =
RimWellPlotTools::curveUnitText(RimWellLogFile::WELL_FLOW_COND_STANDARD, unitSet, flowPhase);
const std::vector<double> accFlow = wfPhaseAccumulator.accumulatedTracerFlowPrPseudoLength(tracerName, 0);
const std::vector<double> accFlow =
wfPhaseAccumulator.accumulatedTracerFlowPrPseudoLength(tracerName, 0);
addStackedCurve(curveName + ", " + tracerName + " " + curveUnitText,
depthValues,
accFlow,
@@ -625,30 +637,30 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
}
}
}
else if ( sourceDef.sourceType() == RifDataSourceForRftPlt::OBSERVED )
else if (sourceDef.sourceType() == RifDataSourceForRftPlt::OBSERVED)
{
if ( sourceDef.wellLogFile() && sourceDef.wellLogFile()->wellLogFileData() )
if (sourceDef.wellLogFile() && sourceDef.wellLogFile()->wellLogFileData())
{
RimWellLogFile::WellFlowCondition flowCondition = sourceDef.wellLogFile()->wellFlowRateCondition();
if ( (m_useStandardConditionCurves() && flowCondition == RimWellLogFile::WELL_FLOW_COND_STANDARD)
|| (m_useReservoirConditionCurves() && flowCondition == RimWellLogFile::WELL_FLOW_COND_RESERVOIR) )
if ((m_useStandardConditionCurves() && flowCondition == RimWellLogFile::WELL_FLOW_COND_STANDARD) ||
(m_useReservoirConditionCurves() && flowCondition == RimWellLogFile::WELL_FLOW_COND_RESERVOIR))
{
using ChannelValNameIdxTuple = std::tuple<double, QString, int> ;
using ChannelValNameIdxTuple = std::tuple<double, QString, int>;
RigWellLogFile* wellLogFileData = sourceDef.wellLogFile()->wellLogFileData();
QStringList channelNames = wellLogFileData->wellLogChannelNames();
std::multiset< ChannelValNameIdxTuple > sortedChannels;
std::vector<std::vector<double> > channelData;
std::multiset<ChannelValNameIdxTuple> sortedChannels;
std::vector<std::vector<double>> channelData;
channelData.resize(channelNames.size());
for ( int chIdx = 0; chIdx < channelNames.size(); ++chIdx )
for (int chIdx = 0; chIdx < channelNames.size(); ++chIdx)
{
QString channelName = channelNames[chIdx];
channelData[chIdx] = wellLogFileData->values(channelName);
if ( channelData[chIdx].size() )
if (channelData[chIdx].size())
{
sortedChannels.insert(ChannelValNameIdxTuple(-fabs(channelData[chIdx].front()), channelName, chIdx));
}
@@ -663,22 +675,25 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
if (depthUnit == RiaDefines::UNIT_METER) unitSystem = RiaEclipseUnitTools::UNITS_METRIC;
}
for ( const ChannelValNameIdxTuple& channelInfo: sortedChannels )
for (const ChannelValNameIdxTuple& channelInfo : sortedChannels)
{
const auto& channelName = std::get<1>(channelInfo);
if ( selectedPhases.count(RimWellPlotTools::flowPhaseFromChannelName(channelName)) > 0 )
if (selectedPhases.count(RimWellPlotTools::flowPhaseFromChannelName(channelName)) > 0)
{
auto color = RimWellPlotTools::isOilFlowChannel(channelName) ? cvf::Color3f::DARK_GREEN :
RimWellPlotTools::isGasFlowChannel(channelName) ? cvf::Color3f::DARK_RED :
RimWellPlotTools::isWaterFlowChannel(channelName) ? cvf::Color3f::BLUE :
cvf::Color3f::DARK_GRAY;
auto color = RimWellPlotTools::isOilFlowChannel(channelName)
? cvf::Color3f::DARK_GREEN
: RimWellPlotTools::isGasFlowChannel(channelName)
? cvf::Color3f::DARK_RED
: RimWellPlotTools::isWaterFlowChannel(channelName) ? cvf::Color3f::BLUE
: cvf::Color3f::DARK_GRAY;
FlowPhase flowPhase = FLOW_PHASE_NONE;
if (RimWellPlotTools::isOilFlowChannel(channelName)) flowPhase = FLOW_PHASE_OIL;
else if (RimWellPlotTools::isGasFlowChannel(channelName)) flowPhase = FLOW_PHASE_GAS;
else if (RimWellPlotTools::isWaterFlowChannel(channelName)) flowPhase = FLOW_PHASE_WATER;
if (RimWellPlotTools::isOilFlowChannel(channelName))
flowPhase = FLOW_PHASE_OIL;
else if (RimWellPlotTools::isGasFlowChannel(channelName))
flowPhase = FLOW_PHASE_GAS;
else if (RimWellPlotTools::isWaterFlowChannel(channelName))
flowPhase = FLOW_PHASE_WATER;
QString curveUnitText = RimWellPlotTools::curveUnitText(flowCondition, unitSystem, flowPhase);
addStackedCurve(curveName + ", " + channelName + " " + curveUnitText,
@@ -691,7 +706,7 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
// Total flow channel will end up first, so just increment the group
// idx to make the rest of the phases group together
if ( RimWellPlotTools::isTotalFlowChannel(channelName) ) curveGroupId++;
if (RimWellPlotTools::isTotalFlowChannel(channelName)) curveGroupId++;
}
}
}
@@ -801,7 +816,8 @@ const char* RimWellPltPlot::plotNameFormatString()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimWellPltPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
QList<caf::PdmOptionItemInfo> RimWellPltPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly)
{
QList<caf::PdmOptionItemInfo> options;
const QString simWellName = RimWellPlotTools::simWellName(m_wellPathName);
@@ -828,11 +844,12 @@ QList<caf::PdmOptionItemInfo> RimWellPltPlot::calculateValueOptions(const caf::P
}
}
if ( availableRftSources.size() )
if (availableRftSources.size())
{
options.push_back(caf::PdmOptionItemInfo::createHeader(RifDataSourceForRftPlt::sourceTypeUiText(RifDataSourceForRftPlt::RFT), true));
options.push_back(caf::PdmOptionItemInfo::createHeader(
RifDataSourceForRftPlt::sourceTypeUiText(RifDataSourceForRftPlt::RFT), true));
for ( const auto& addr : availableRftSources )
for (const auto& addr : availableRftSources)
{
auto item = caf::PdmOptionItemInfo(addr.eclCase()->caseUserDescription(), QVariant::fromValue(addr));
item.setLevel(1);
@@ -843,7 +860,8 @@ QList<caf::PdmOptionItemInfo> RimWellPltPlot::calculateValueOptions(const caf::P
const std::vector<RimEclipseResultCase*> gridCases = RimWellPlotTools::gridCasesForWell(simWellName);
if (gridCases.size() > 0)
{
options.push_back(caf::PdmOptionItemInfo::createHeader(RifDataSourceForRftPlt::sourceTypeUiText(RifDataSourceForRftPlt::GRID), true));
options.push_back(caf::PdmOptionItemInfo::createHeader(
RifDataSourceForRftPlt::sourceTypeUiText(RifDataSourceForRftPlt::GRID), true));
}
for (const auto& gridCase : gridCases)
@@ -856,7 +874,8 @@ QList<caf::PdmOptionItemInfo> RimWellPltPlot::calculateValueOptions(const caf::P
if (RimWellPlotTools::wellLogFilesContainingFlow(m_wellPathName).size() > 0)
{
options.push_back(caf::PdmOptionItemInfo::createHeader(RifDataSourceForRftPlt::sourceTypeUiText(RifDataSourceForRftPlt::OBSERVED), true));
options.push_back(caf::PdmOptionItemInfo::createHeader(
RifDataSourceForRftPlt::sourceTypeUiText(RifDataSourceForRftPlt::OBSERVED), true));
auto addr = RifDataSourceForRftPlt(RifDataSourceForRftPlt::OBSERVED);
auto item = caf::PdmOptionItemInfo("Observed Data", QVariant::fromValue(addr));
@@ -869,10 +888,8 @@ QList<caf::PdmOptionItemInfo> RimWellPltPlot::calculateValueOptions(const caf::P
{
std::set<RifEclipseRftAddress::RftWellLogChannelType> channelTypesToUse = RifEclipseRftAddress::pltPlotChannelTypes();
RimWellPlotTools::calculateValueOptionsForTimeSteps(RimWellPlotTools::simWellName(m_wellPathName),
selectedSourcesExpanded(),
channelTypesToUse,
options);
RimWellPlotTools::calculateValueOptionsForTimeSteps(
RimWellPlotTools::simWellName(m_wellPathName), selectedSourcesExpanded(), channelTypesToUse, options);
}
if (fieldNeedingOptions == &m_phases)
@@ -918,7 +935,8 @@ void RimWellPltPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
{
if (!wellPath->wellPathGeometry())
{
QString tmp = QString("Display of Measured Depth (MD) for Grid or RFT curves is not possible without a well log path, and the curve will be hidden in this mode.\n\n");
QString tmp = QString("Display of Measured Depth (MD) for Grid or RFT curves is not possible without a "
"well log path, and the curve will be hidden in this mode.\n\n");
QMessageBox::warning(nullptr, "Grid/RFT curve without MD", tmp);
@@ -930,8 +948,7 @@ void RimWellPltPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
}
}
if (changedField == &m_selectedSources ||
changedField == &m_selectedTimeSteps)
if (changedField == &m_selectedSources || changedField == &m_selectedTimeSteps)
{
updateFormationsOnPlot();
syncSourcesIoFieldFromGuiField();
@@ -942,16 +959,14 @@ void RimWellPltPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
plotTrack->calculateXZoomRangeAndUpdateQwt();
}
if ( changedField == &m_useStandardConditionCurves
|| changedField == &m_useReservoirConditionCurves
|| changedField == &m_phases)
if (changedField == &m_useStandardConditionCurves || changedField == &m_useReservoirConditionCurves ||
changedField == &m_phases)
{
syncCurvesFromUiSelection();
m_wellLogPlot->updateDepthZoom();
RimWellLogTrack* const plotTrack = m_wellLogPlot->trackByIndex(0);
plotTrack->calculateXZoomRangeAndUpdateQwt();
}
}
@@ -1023,11 +1038,13 @@ void RimWellPltPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPltPlot::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
void RimWellPltPlot::defineEditorAttribute(const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute)
{
if (field == &m_phases)
{
caf::PdmUiTreeSelectionEditorAttribute* attrib = dynamic_cast<caf::PdmUiTreeSelectionEditorAttribute*> (attribute);
caf::PdmUiTreeSelectionEditorAttribute* attrib = dynamic_cast<caf::PdmUiTreeSelectionEditorAttribute*>(attribute);
attrib->showTextFilter = false;
attrib->showToggleAllCheckbox = false;
}
@@ -1076,7 +1093,6 @@ void RimWellPltPlot::syncSourcesIoFieldFromGuiField()
{
m_selectedSourcesForIo.push_back(new RimDataSourceForRftPlt(addr));
}
}
//--------------------------------------------------------------------------------------------------
@@ -1084,7 +1100,7 @@ void RimWellPltPlot::syncSourcesIoFieldFromGuiField()
//--------------------------------------------------------------------------------------------------
void RimWellPltPlot::calculateValueOptionsForWells(QList<caf::PdmOptionItemInfo>& options)
{
RimProject * proj = RiaApplication::instance()->project();
RimProject* proj = RiaApplication::instance()->project();
if (proj != nullptr)
{
@@ -1093,7 +1109,7 @@ void RimWellPltPlot::calculateValueOptionsForWells(QList<caf::PdmOptionItemInfo>
{
const QString wellName = wellPath->name();
if(wellPath->wellPathGeometry() || RimWellPlotTools::hasFlowData(wellPath))
if (wellPath->wellPathGeometry() || RimWellPlotTools::hasFlowData(wellPath))
options.push_back(caf::PdmOptionItemInfo(wellName, wellName));
}
}
@@ -17,12 +17,8 @@
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimViewWindow.h"
#include "RigFlowDiagResultAddress.h"
#include "RimDataSourceForRftPlt.h"
#include "RifDataSourceForRftPltQMetaType.h"
#include "RimPlotCurve.h"
#include "RimWellPlotTools.h"
#include "cafPdmField.h"
@@ -34,9 +30,9 @@
#include <QPointer>
#include <QDate>
#include <QMetaType>
#include <set>
#include <map>
#include "RifEclipseRftAddress.h"
class RimEclipseCase;
class RimEclipseResultCase;
@@ -46,6 +42,8 @@ class RimWellLogPlot;
class RimWellPath;
class RiuWellPltPlot;
class RimWellLogTrack;
class RiaRftPltCurveDefinition;
class RimDataSourceForRftPlt;
namespace cvf {
@@ -103,7 +101,6 @@ protected:
void initAfterLoad();
private:
void syncSourcesIoFieldFromGuiField();
void syncCurvesFromUiSelection();
@@ -21,11 +21,6 @@
#include "RimViewWindow.h"
#include "RiaRftPltCurveDefinition.h"
#include "RimCase.h"
#include "RimPlotCurve.h"
#include "RifDataSourceForRftPltQMetaType.h"
#include "cafPdmField.h"
@@ -36,6 +31,7 @@
#include <QDate>
#include <QMetaType>
#include <QPointer>
#include <map>
#include <set>
#include <utility>
@@ -48,6 +44,8 @@ class RimWellLogPlot;
class RimWellPath;
class RiuWellRftPlot;
class RigEclipseCaseData;
class RiaRftPltCurveDefinition;
class RifDataSourceForRftPlt;
namespace cvf {
class Color3f;
@@ -82,12 +80,13 @@ public:
RimWellLogPlot* wellLogPlot() const;
void setSimWellOrWellPathName(const QString& currWellName);
int branchIndex() const;
static const char* plotNameFormatString();
void applyInitialSelections();
static const char* plotNameFormatString();
protected:
// Overridden PDM methods
caf::PdmFieldHandle* userDescriptionField() override { return &m_userName; }
@@ -104,10 +103,8 @@ protected:
private:
void calculateValueOptionsForWells(QList<caf::PdmOptionItemInfo>& options);
void updateEditorsFromCurves();
void updateWidgetTitleWindowTitle();
void syncCurvesFromUiSelection();
std::set<RiaRftPltCurveDefinition> selectedCurveDefs() const;
@@ -116,6 +113,7 @@ private:
void updateCurvesInPlot(const std::set<RiaRftPltCurveDefinition>& allCurveDefs,
const std::set<RiaRftPltCurveDefinition>& curveDefsToAdd,
const std::set<RimWellLogCurve*>& curvesToDelete);
std::vector<RifDataSourceForRftPlt> selectedSourcesExpanded() const;
// RimViewWindow overrides