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_wellName, "WellName", QString("None"), "Well", "", "", "");
|
||||
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_showPlotLegends = true;
|
||||
@ -87,6 +89,15 @@ void RimWellDistributionPlot::setDataSourceParameters(RimEclipseResultCase* ecli
|
||||
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());
|
||||
//tim.reportLapTimeMS("calc");
|
||||
|
||||
//calc.groupSmallContributions(0.005);
|
||||
//tim.reportLapTimeMS("group");
|
||||
if (m_groupSmallContributions)
|
||||
{
|
||||
calc.groupSmallContributions(m_smallContributionsRelativeThreshold);
|
||||
//tim.reportLapTimeMS("group");
|
||||
}
|
||||
|
||||
const RimFlowDiagSolution* flowDiagSolution = m_case->defaultFlowDiagSolution();
|
||||
|
||||
@ -422,11 +436,14 @@ void RimWellDistributionPlot::populatePlotWidgetWithCurveData(const RigTofWellDi
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
caf::PdmUiGroup* group = uiOrdering.addNewGroup("Plot Data");
|
||||
group->add(&m_case);
|
||||
group->add(&m_timeStepIndex);
|
||||
group->add(&m_wellName);
|
||||
group->add(&m_phase);
|
||||
uiOrdering.add(&m_case);
|
||||
uiOrdering.add(&m_timeStepIndex);
|
||||
uiOrdering.add(&m_wellName);
|
||||
uiOrdering.add(&m_phase);
|
||||
uiOrdering.add(&m_groupSmallContributions);
|
||||
uiOrdering.add(&m_smallContributionsRelativeThreshold);
|
||||
|
||||
m_smallContributionsRelativeThreshold.uiCapability()->setUiReadOnly(m_groupSmallContributions == false);
|
||||
|
||||
RimPlot::defineUiOrdering(uiConfigName, uiOrdering);
|
||||
//uiOrdering.skipRemainingFields();
|
||||
|
@ -46,6 +46,7 @@ public:
|
||||
~RimWellDistributionPlot() override;
|
||||
|
||||
void setDataSourceParameters(RimEclipseResultCase* eclipseResultCase, int timeStepIndex, QString targetWellName);
|
||||
void setPlotOptions(bool groupSmallContributions, double smallContributionsRelativeThreshold);
|
||||
|
||||
// RimPlot implementations
|
||||
virtual RiuQwtPlotWidget* viewer() override;
|
||||
@ -91,6 +92,8 @@ private:
|
||||
caf::PdmField<int> m_timeStepIndex;
|
||||
caf::PdmField<QString> m_wellName;
|
||||
caf::PdmField< caf::AppEnum<RiaDefines::PhaseType>> m_phase;
|
||||
caf::PdmField<bool> m_groupSmallContributions;
|
||||
caf::PdmField<double> m_smallContributionsRelativeThreshold;
|
||||
|
||||
QPointer<RiuQwtPlotWidget> m_plotWidget;
|
||||
};
|
||||
|
@ -63,6 +63,8 @@ RimWellDistributionPlotCollection::RimWellDistributionPlotCollection()
|
||||
CAF_PDM_InitFieldNoDefault(&m_case, "Case", "Case", "", "", "");
|
||||
CAF_PDM_InitField(&m_timeStepIndex, "TimeStepIndex", -1, "Time Step", "", "", "");
|
||||
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_columnCountEnum = RimMultiPlotWindow::COLUMNS_UNLIMITED;
|
||||
@ -100,10 +102,13 @@ void RimWellDistributionPlotCollection::onLoadDataAndUpdate()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
caf::PdmUiGroup* group = uiOrdering.addNewGroup("Plot Data");
|
||||
group->add(&m_case);
|
||||
group->add(&m_timeStepIndex);
|
||||
group->add(&m_wellName);
|
||||
uiOrdering.add(&m_case);
|
||||
uiOrdering.add(&m_timeStepIndex);
|
||||
uiOrdering.add(&m_wellName);
|
||||
uiOrdering.add(&m_groupSmallContributions);
|
||||
uiOrdering.add(&m_smallContributionsRelativeThreshold);
|
||||
|
||||
m_smallContributionsRelativeThreshold.uiCapability()->setUiReadOnly(m_groupSmallContributions == false);
|
||||
|
||||
//RimMultiPlotWindow::defineUiOrdering(uiConfigName, uiOrdering);
|
||||
uiOrdering.skipRemainingFields();
|
||||
@ -182,9 +187,11 @@ void RimWellDistributionPlotCollection::fieldChangedByUi(const caf::PdmFieldHand
|
||||
bool shouldRecalculatePlotData = false;
|
||||
if (changedField == &m_case ||
|
||||
changedField == &m_timeStepIndex ||
|
||||
changedField == &m_wellName)
|
||||
changedField == &m_wellName ||
|
||||
changedField == &m_groupSmallContributions ||
|
||||
changedField == &m_smallContributionsRelativeThreshold)
|
||||
{
|
||||
applyPlotDataParametersToContainedPlots();
|
||||
applyPlotParametersToContainedPlots();
|
||||
shouldRecalculatePlotData = true;
|
||||
}
|
||||
|
||||
@ -200,7 +207,7 @@ void RimWellDistributionPlotCollection::fieldChangedByUi(const caf::PdmFieldHand
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::applyPlotDataParametersToContainedPlots()
|
||||
void RimWellDistributionPlotCollection::applyPlotParametersToContainedPlots()
|
||||
{
|
||||
const size_t numPlots = plotCount();
|
||||
for (size_t i = 0; i < numPlots; i++)
|
||||
@ -210,6 +217,7 @@ void RimWellDistributionPlotCollection::applyPlotDataParametersToContainedPlots(
|
||||
if (aPlot)
|
||||
{
|
||||
aPlot->setDataSourceParameters(m_case, m_timeStepIndex, m_wellName);
|
||||
aPlot->setPlotOptions(m_groupSmallContributions, m_smallContributionsRelativeThreshold);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,10 +58,12 @@ private:
|
||||
private:
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
void fixupDependentFieldsAfterCaseChange();
|
||||
void applyPlotDataParametersToContainedPlots();
|
||||
void applyPlotParametersToContainedPlots();
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimEclipseResultCase*> m_case;
|
||||
caf::PdmField<int> m_timeStepIndex;
|
||||
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);
|
||||
|
||||
ContribWellEntry groupEntry;
|
||||
groupEntry.name = "Other";
|
||||
groupEntry.accumulatedVolAlongTof.resize(m_tofInIncreasingOrder.size(), 0);
|
||||
ContribWellEntry groupingEntry;
|
||||
groupingEntry.name = "Other";
|
||||
groupingEntry.accumulatedVolAlongTof.resize(m_tofInIncreasingOrder.size(), 0);
|
||||
bool anySmallContribsDetected = false;
|
||||
|
||||
for (const ContribWellEntry& sourceEntry : sourceEntryArr)
|
||||
@ -173,9 +173,9 @@ void RigTofWellDistributionCalculator::groupSmallContributions(double smallContr
|
||||
}
|
||||
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;
|
||||
}
|
||||
@ -183,7 +183,7 @@ void RigTofWellDistributionCalculator::groupSmallContributions(double smallContr
|
||||
|
||||
if (anySmallContribsDetected)
|
||||
{
|
||||
m_contributingWells.push_back(groupEntry);
|
||||
m_contributingWells.push_back(groupingEntry);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user