mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Added grouping of small contributions to well distribution plot
This commit is contained in:
parent
bf61c76e51
commit
260ff04b19
@ -65,6 +65,8 @@ RimWellDistributionPlot::RimWellDistributionPlot(RiaDefines::PhaseType phase)
|
|||||||
CAF_PDM_InitField(&m_timeStepIndex, "TimeStepIndex", -1, "Time Step", "", "", "");
|
CAF_PDM_InitField(&m_timeStepIndex, "TimeStepIndex", -1, "Time Step", "", "", "");
|
||||||
CAF_PDM_InitField(&m_wellName, "WellName", QString("None"), "Well", "", "", "");
|
CAF_PDM_InitField(&m_wellName, "WellName", QString("None"), "Well", "", "", "");
|
||||||
CAF_PDM_InitField(&m_phase, "Phase", caf::AppEnum<RiaDefines::PhaseType>(phase), "Phase", "", "", "");
|
CAF_PDM_InitField(&m_phase, "Phase", caf::AppEnum<RiaDefines::PhaseType>(phase), "Phase", "", "", "");
|
||||||
|
CAF_PDM_InitField(&m_groupSmallContributions, "GroupSmallContributions", true, "Group Small Contributions", "", "", "");
|
||||||
|
CAF_PDM_InitField(&m_smallContributionsRelativeThreshold, "SmallContributionsRelativeThreshold", 0.005, "Relative Threshold [0, 1]", "", "", "");
|
||||||
|
|
||||||
m_showWindow = false;
|
m_showWindow = false;
|
||||||
m_showPlotLegends = true;
|
m_showPlotLegends = true;
|
||||||
@ -87,6 +89,15 @@ void RimWellDistributionPlot::setDataSourceParameters(RimEclipseResultCase* ecli
|
|||||||
m_wellName = targetWellName;
|
m_wellName = targetWellName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimWellDistributionPlot::setPlotOptions(bool groupSmallContributions, double smallContributionsRelativeThreshold)
|
||||||
|
{
|
||||||
|
m_groupSmallContributions = groupSmallContributions;
|
||||||
|
m_smallContributionsRelativeThreshold = smallContributionsRelativeThreshold;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -329,8 +340,11 @@ void RimWellDistributionPlot::onLoadDataAndUpdate()
|
|||||||
RigTofWellDistributionCalculator calc(m_case, m_wellName, m_timeStepIndex, m_phase());
|
RigTofWellDistributionCalculator calc(m_case, m_wellName, m_timeStepIndex, m_phase());
|
||||||
//tim.reportLapTimeMS("calc");
|
//tim.reportLapTimeMS("calc");
|
||||||
|
|
||||||
//calc.groupSmallContributions(0.005);
|
if (m_groupSmallContributions)
|
||||||
//tim.reportLapTimeMS("group");
|
{
|
||||||
|
calc.groupSmallContributions(m_smallContributionsRelativeThreshold);
|
||||||
|
//tim.reportLapTimeMS("group");
|
||||||
|
}
|
||||||
|
|
||||||
const RimFlowDiagSolution* flowDiagSolution = m_case->defaultFlowDiagSolution();
|
const RimFlowDiagSolution* flowDiagSolution = m_case->defaultFlowDiagSolution();
|
||||||
|
|
||||||
@ -422,11 +436,14 @@ void RimWellDistributionPlot::populatePlotWidgetWithCurveData(const RigTofWellDi
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellDistributionPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
void RimWellDistributionPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||||
{
|
{
|
||||||
caf::PdmUiGroup* group = uiOrdering.addNewGroup("Plot Data");
|
uiOrdering.add(&m_case);
|
||||||
group->add(&m_case);
|
uiOrdering.add(&m_timeStepIndex);
|
||||||
group->add(&m_timeStepIndex);
|
uiOrdering.add(&m_wellName);
|
||||||
group->add(&m_wellName);
|
uiOrdering.add(&m_phase);
|
||||||
group->add(&m_phase);
|
uiOrdering.add(&m_groupSmallContributions);
|
||||||
|
uiOrdering.add(&m_smallContributionsRelativeThreshold);
|
||||||
|
|
||||||
|
m_smallContributionsRelativeThreshold.uiCapability()->setUiReadOnly(m_groupSmallContributions == false);
|
||||||
|
|
||||||
RimPlot::defineUiOrdering(uiConfigName, uiOrdering);
|
RimPlot::defineUiOrdering(uiConfigName, uiOrdering);
|
||||||
//uiOrdering.skipRemainingFields();
|
//uiOrdering.skipRemainingFields();
|
||||||
|
@ -46,6 +46,7 @@ public:
|
|||||||
~RimWellDistributionPlot() override;
|
~RimWellDistributionPlot() override;
|
||||||
|
|
||||||
void setDataSourceParameters(RimEclipseResultCase* eclipseResultCase, int timeStepIndex, QString targetWellName);
|
void setDataSourceParameters(RimEclipseResultCase* eclipseResultCase, int timeStepIndex, QString targetWellName);
|
||||||
|
void setPlotOptions(bool groupSmallContributions, double smallContributionsRelativeThreshold);
|
||||||
|
|
||||||
// RimPlot implementations
|
// RimPlot implementations
|
||||||
virtual RiuQwtPlotWidget* viewer() override;
|
virtual RiuQwtPlotWidget* viewer() override;
|
||||||
@ -91,6 +92,8 @@ private:
|
|||||||
caf::PdmField<int> m_timeStepIndex;
|
caf::PdmField<int> m_timeStepIndex;
|
||||||
caf::PdmField<QString> m_wellName;
|
caf::PdmField<QString> m_wellName;
|
||||||
caf::PdmField< caf::AppEnum<RiaDefines::PhaseType>> m_phase;
|
caf::PdmField< caf::AppEnum<RiaDefines::PhaseType>> m_phase;
|
||||||
|
caf::PdmField<bool> m_groupSmallContributions;
|
||||||
|
caf::PdmField<double> m_smallContributionsRelativeThreshold;
|
||||||
|
|
||||||
QPointer<RiuQwtPlotWidget> m_plotWidget;
|
QPointer<RiuQwtPlotWidget> m_plotWidget;
|
||||||
};
|
};
|
||||||
|
@ -63,6 +63,8 @@ RimWellDistributionPlotCollection::RimWellDistributionPlotCollection()
|
|||||||
CAF_PDM_InitFieldNoDefault(&m_case, "Case", "Case", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&m_case, "Case", "Case", "", "", "");
|
||||||
CAF_PDM_InitField(&m_timeStepIndex, "TimeStepIndex", -1, "Time Step", "", "", "");
|
CAF_PDM_InitField(&m_timeStepIndex, "TimeStepIndex", -1, "Time Step", "", "", "");
|
||||||
CAF_PDM_InitField(&m_wellName, "WellName", QString("None"), "Well", "", "", "");
|
CAF_PDM_InitField(&m_wellName, "WellName", QString("None"), "Well", "", "", "");
|
||||||
|
CAF_PDM_InitField(&m_groupSmallContributions, "GroupSmallContributions", true, "Group Small Contributions", "", "", "");
|
||||||
|
CAF_PDM_InitField(&m_smallContributionsRelativeThreshold, "SmallContributionsRelativeThreshold", 0.005, "Relative Threshold [0, 1]", "", "", "");
|
||||||
|
|
||||||
m_plotWindowTitle = "Well Distribution Plots";
|
m_plotWindowTitle = "Well Distribution Plots";
|
||||||
m_columnCountEnum = RimMultiPlotWindow::COLUMNS_UNLIMITED;
|
m_columnCountEnum = RimMultiPlotWindow::COLUMNS_UNLIMITED;
|
||||||
@ -100,10 +102,13 @@ void RimWellDistributionPlotCollection::onLoadDataAndUpdate()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellDistributionPlotCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
void RimWellDistributionPlotCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||||
{
|
{
|
||||||
caf::PdmUiGroup* group = uiOrdering.addNewGroup("Plot Data");
|
uiOrdering.add(&m_case);
|
||||||
group->add(&m_case);
|
uiOrdering.add(&m_timeStepIndex);
|
||||||
group->add(&m_timeStepIndex);
|
uiOrdering.add(&m_wellName);
|
||||||
group->add(&m_wellName);
|
uiOrdering.add(&m_groupSmallContributions);
|
||||||
|
uiOrdering.add(&m_smallContributionsRelativeThreshold);
|
||||||
|
|
||||||
|
m_smallContributionsRelativeThreshold.uiCapability()->setUiReadOnly(m_groupSmallContributions == false);
|
||||||
|
|
||||||
//RimMultiPlotWindow::defineUiOrdering(uiConfigName, uiOrdering);
|
//RimMultiPlotWindow::defineUiOrdering(uiConfigName, uiOrdering);
|
||||||
uiOrdering.skipRemainingFields();
|
uiOrdering.skipRemainingFields();
|
||||||
@ -182,9 +187,11 @@ void RimWellDistributionPlotCollection::fieldChangedByUi(const caf::PdmFieldHand
|
|||||||
bool shouldRecalculatePlotData = false;
|
bool shouldRecalculatePlotData = false;
|
||||||
if (changedField == &m_case ||
|
if (changedField == &m_case ||
|
||||||
changedField == &m_timeStepIndex ||
|
changedField == &m_timeStepIndex ||
|
||||||
changedField == &m_wellName)
|
changedField == &m_wellName ||
|
||||||
|
changedField == &m_groupSmallContributions ||
|
||||||
|
changedField == &m_smallContributionsRelativeThreshold)
|
||||||
{
|
{
|
||||||
applyPlotDataParametersToContainedPlots();
|
applyPlotParametersToContainedPlots();
|
||||||
shouldRecalculatePlotData = true;
|
shouldRecalculatePlotData = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,7 +207,7 @@ void RimWellDistributionPlotCollection::fieldChangedByUi(const caf::PdmFieldHand
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellDistributionPlotCollection::applyPlotDataParametersToContainedPlots()
|
void RimWellDistributionPlotCollection::applyPlotParametersToContainedPlots()
|
||||||
{
|
{
|
||||||
const size_t numPlots = plotCount();
|
const size_t numPlots = plotCount();
|
||||||
for (size_t i = 0; i < numPlots; i++)
|
for (size_t i = 0; i < numPlots; i++)
|
||||||
@ -210,6 +217,7 @@ void RimWellDistributionPlotCollection::applyPlotDataParametersToContainedPlots(
|
|||||||
if (aPlot)
|
if (aPlot)
|
||||||
{
|
{
|
||||||
aPlot->setDataSourceParameters(m_case, m_timeStepIndex, m_wellName);
|
aPlot->setDataSourceParameters(m_case, m_timeStepIndex, m_wellName);
|
||||||
|
aPlot->setPlotOptions(m_groupSmallContributions, m_smallContributionsRelativeThreshold);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,10 +58,12 @@ private:
|
|||||||
private:
|
private:
|
||||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||||
void fixupDependentFieldsAfterCaseChange();
|
void fixupDependentFieldsAfterCaseChange();
|
||||||
void applyPlotDataParametersToContainedPlots();
|
void applyPlotParametersToContainedPlots();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmPtrField<RimEclipseResultCase*> m_case;
|
caf::PdmPtrField<RimEclipseResultCase*> m_case;
|
||||||
caf::PdmField<int> m_timeStepIndex;
|
caf::PdmField<int> m_timeStepIndex;
|
||||||
caf::PdmField<QString> m_wellName;
|
caf::PdmField<QString> m_wellName;
|
||||||
|
caf::PdmField<bool> m_groupSmallContributions;
|
||||||
|
caf::PdmField<double> m_smallContributionsRelativeThreshold;
|
||||||
};
|
};
|
||||||
|
@ -159,9 +159,9 @@ void RigTofWellDistributionCalculator::groupSmallContributions(double smallContr
|
|||||||
|
|
||||||
std::vector<ContribWellEntry> sourceEntryArr = std::move(m_contributingWells);
|
std::vector<ContribWellEntry> sourceEntryArr = std::move(m_contributingWells);
|
||||||
|
|
||||||
ContribWellEntry groupEntry;
|
ContribWellEntry groupingEntry;
|
||||||
groupEntry.name = "Other";
|
groupingEntry.name = "Other";
|
||||||
groupEntry.accumulatedVolAlongTof.resize(m_tofInIncreasingOrder.size(), 0);
|
groupingEntry.accumulatedVolAlongTof.resize(m_tofInIncreasingOrder.size(), 0);
|
||||||
bool anySmallContribsDetected = false;
|
bool anySmallContribsDetected = false;
|
||||||
|
|
||||||
for (const ContribWellEntry& sourceEntry : sourceEntryArr)
|
for (const ContribWellEntry& sourceEntry : sourceEntryArr)
|
||||||
@ -173,9 +173,9 @@ void RigTofWellDistributionCalculator::groupSmallContributions(double smallContr
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < groupEntry.accumulatedVolAlongTof.size(); i++)
|
for (size_t i = 0; i < groupingEntry.accumulatedVolAlongTof.size(); i++)
|
||||||
{
|
{
|
||||||
groupEntry.accumulatedVolAlongTof[i] += sourceEntry.accumulatedVolAlongTof[i];
|
groupingEntry.accumulatedVolAlongTof[i] += sourceEntry.accumulatedVolAlongTof[i];
|
||||||
}
|
}
|
||||||
anySmallContribsDetected = true;
|
anySmallContribsDetected = true;
|
||||||
}
|
}
|
||||||
@ -183,7 +183,7 @@ void RigTofWellDistributionCalculator::groupSmallContributions(double smallContr
|
|||||||
|
|
||||||
if (anySmallContribsDetected)
|
if (anySmallContribsDetected)
|
||||||
{
|
{
|
||||||
m_contributingWells.push_back(groupEntry);
|
m_contributingWells.push_back(groupingEntry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user