#1174 Made 3D main window pop up, and set wether to show Max Fractrion Injectors or Producers. Set timestep in 3D view to match plot.

This commit is contained in:
Jacob Støren 2017-03-02 16:10:18 +01:00
parent b8c2c8e943
commit f15d698342
8 changed files with 122 additions and 49 deletions

View File

@ -32,6 +32,8 @@
#include "RiuMainWindow.h"
#include <QAction>
#include "cafCmdFeatureManager.h"
#include "RimFlowDiagSolution.h"
CAF_CMD_SOURCE_INIT(RicShowContributingWellsFromPlotFeature, "RicShowContributingWellsFromPlotFeature");
@ -58,53 +60,80 @@ void RicShowContributingWellsFromPlotFeature::onActionTriggered(bool isChecked)
if (!wellAllocationPlot) return;
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
if (!activeView) return;
if (activeView)
int timeStep = wellAllocationPlot->timeStep();
QString wellName = wellAllocationPlot->wellName();
const std::vector<QString> contributingTracers = wellAllocationPlot->contributingTracerNames();
RimFlowDiagSolution* flowSolution = wellAllocationPlot->flowDiagSolution();
if ( !flowSolution ) return;
RimFlowDiagSolution::TracerStatusType tracerStatus = flowSolution->tracerStatusInTimeStep(wellName, timeStep);
if (!(tracerStatus == RimFlowDiagSolution::INJECTOR || tracerStatus == RimFlowDiagSolution::PRODUCER) ) return;
activeView->cellResult()->setResultType(RimDefines::FLOW_DIAGNOSTICS);
activeView->cellResult()->setResultVariable("MaxFractionTracer");
switch (tracerStatus)
{
activeView->cellResult()->setResultType(RimDefines::FLOW_DIAGNOSTICS);
activeView->cellResult()->setResultVariable("MaxFractionTracer");
activeView->cellResult()->loadDataAndUpdate();
case RimFlowDiagSolution::PRODUCER:
activeView->cellResult()->setFlowDiagTracerSelectionType(RimEclipseResultDefinition::FLOW_TR_INJECTORS);
break;
case RimFlowDiagSolution::INJECTOR:
activeView->cellResult()->setFlowDiagTracerSelectionType(RimEclipseResultDefinition::FLOW_TR_PRODUCERS);
break;
activeView->cellResult()->updateConnectedEditors();
const std::vector<QString> contributingTracers = wellAllocationPlot->contributingTracerNames();
for (RimEclipseWell* well : activeView->wellCollection()->wells())
{
if (std::find(contributingTracers.begin(), contributingTracers.end(), well->name()) != contributingTracers.end()
|| wellAllocationPlot->wellName() == well->name())
{
well->showWell = true;
}
else
{
well->showWell = false;
}
}
// Disable all existing property filters, and
// create a new property filter based on TOF for current well
RimEclipsePropertyFilterCollection* propertyFilterCollection = activeView->eclipsePropertyFilterCollection();
for (RimEclipsePropertyFilter* f : propertyFilterCollection->propertyFilters())
{
f->isActive = false;
}
RimEclipsePropertyFilter* propertyFilter = new RimEclipsePropertyFilter();
propertyFilterCollection->propertyFilters().push_back(propertyFilter);
propertyFilter->resultDefinition()->setEclipseCase(activeView->eclipseCase());
propertyFilter->resultDefinition()->setTofAndSelectTracer(wellAllocationPlot->wellName());
propertyFilter->resultDefinition()->loadDataAndUpdate();
propertyFilterCollection->updateConnectedEditors();
RiuMainWindow::instance()->setExpanded(propertyFilterCollection, true);
activeView->scheduleCreateDisplayModelAndRedraw();
default:
CVF_ASSERT(false);
break;
}
activeView->setCurrentTimeStep(timeStep);
activeView->cellResult()->loadDataAndUpdate();
activeView->cellResult()->updateConnectedEditors();
for ( RimEclipseWell* well : activeView->wellCollection()->wells() )
{
if ( std::find(contributingTracers.begin(), contributingTracers.end(), well->name()) != contributingTracers.end()
|| wellAllocationPlot->wellName() == well->name() )
{
well->showWell = true;
}
else
{
well->showWell = false;
}
}
// Disable all existing property filters, and
// create a new property filter based on TOF for current well
RimEclipsePropertyFilterCollection* propertyFilterCollection = activeView->eclipsePropertyFilterCollection();
for ( RimEclipsePropertyFilter* f : propertyFilterCollection->propertyFilters() )
{
f->isActive = false;
}
RimEclipsePropertyFilter* propertyFilter = new RimEclipsePropertyFilter();
propertyFilterCollection->propertyFilters().push_back(propertyFilter);
propertyFilter->resultDefinition()->setEclipseCase(activeView->eclipseCase());
propertyFilter->resultDefinition()->setTofAndSelectTracer(wellAllocationPlot->wellName());
propertyFilter->resultDefinition()->loadDataAndUpdate();
propertyFilterCollection->updateConnectedEditors();
RiuMainWindow::instance()->setExpanded(propertyFilterCollection, true);
activeView->scheduleCreateDisplayModelAndRedraw();
auto* feature = caf::CmdFeatureManager::instance()->getCommandFeature("RicShowMainWindowFeature");
feature->actionTriggered(false);
}
//--------------------------------------------------------------------------------------------------

View File

@ -518,6 +518,22 @@ RimTotalWellAllocationPlot* RimWellAllocationPlot::totalWellFlowPlot()
return m_totalWellAllocationPlot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFlowDiagSolution* RimWellAllocationPlot::flowDiagSolution()
{
return m_flowDiagSolution();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimWellAllocationPlot::timeStep()
{
return m_timeStep();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -68,7 +68,8 @@ public:
RimWellLogPlot* accumulatedWellFlowPlot();
RimTotalWellAllocationPlot* totalWellFlowPlot();
RimFlowDiagSolution* flowDiagSolution();
int timeStep();
QString wellName() const;
const std::vector<QString> contributingTracerNames() const;

View File

@ -257,8 +257,7 @@ void RimEclipseResultDefinition::setTofAndSelectTracer(const QString& tracerName
{
setResultType(RimDefines::FLOW_DIAGNOSTICS);
setResultVariable("TOF");
m_flowTracerSelectionMode = FLOW_TR_BY_SELECTION;
setFlowDiagTracerSelectionType(FLOW_TR_BY_SELECTION);
std::vector<QString> tracers;
tracers.push_back(tracerName);
@ -646,6 +645,14 @@ RigFlowDiagResultAddress RimEclipseResultDefinition::flowDiagResAddress() const
return RigFlowDiagResultAddress(m_resultVariable().toStdString(), selTracerNames);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseResultDefinition::setFlowDiagTracerSelectionType(FlowTracerSelectionType selectionType)
{
m_flowTracerSelectionMode = selectionType;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -71,6 +71,8 @@ public:
RimFlowDiagSolution* flowDiagSolution();
RigFlowDiagResultAddress flowDiagResAddress() const;
void setFlowDiagTracerSelectionType(FlowTracerSelectionType selectionType);
QString resultVariableUiName() const;
QString resultVariableUiShortName() const;

View File

@ -296,7 +296,7 @@ void RimView::scheduleCreateDisplayModelAndRedraw()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimView::setCurrentTimeStep(int frameIndex)
void RimView::setCurrentTimeStepAndUpdate(int frameIndex)
{
m_currentTimeStep = frameIndex;
clampCurrentTimestep();
@ -308,6 +308,22 @@ void RimView::setCurrentTimeStep(int frameIndex)
}
this->updateCurrentTimeStep();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimView::setCurrentTimeStep(int frameIndex)
{
m_currentTimeStep = frameIndex;
clampCurrentTimestep();
this->hasUserRequestedAnimation = true;
if (this->propertyFilterCollection() && this->propertyFilterCollection()->hasActiveDynamicFilters())
{
m_currentReservoirCellVisibility = NULL;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -137,6 +137,8 @@ public:
// Animation
int currentTimeStep() const { return m_currentTimeStep;}
void setCurrentTimeStep(int frameIdx);
void updateCurrentTimeStepAndRedraw();
virtual void scheduleGeometryRegen(RivCellSetEnum geometryType) = 0;
@ -231,7 +233,7 @@ private:
RimViewLinker* viewLinkerIfMasterView() const;
friend class RiuViewer;
void setCurrentTimeStep(int frameIdx);
void setCurrentTimeStepAndUpdate(int frameIdx);
void endAnimation();
private:

View File

@ -634,7 +634,7 @@ void RiuViewer::setCurrentFrame(int frameIndex)
cvf::Rendering* firstRendering = m_mainRendering.p();
CVF_ASSERT(firstRendering);
if (m_rimView) m_rimView->setCurrentTimeStep(frameIndex);
if (m_rimView) m_rimView->setCurrentTimeStepAndUpdate(frameIndex);
animationControl()->setCurrentFrameOnly(frameIndex);