Whitespace

This commit is contained in:
Magne Sjaastad 2019-03-27 19:20:42 +01:00
parent d0a23252ab
commit 77dbd8a25f
5 changed files with 175 additions and 175 deletions

View File

@ -1,17 +1,17 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@ -30,11 +30,11 @@
#include "RimEclipsePropertyFilterCollection.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseView.h"
#include "RimSimWellInViewCollection.h"
#include "RimFaultInViewCollection.h"
#include "RimFlowDiagSolution.h"
#include "RimProject.h"
#include "RimSimWellInView.h"
#include "RimSimWellInViewCollection.h"
#include "RimViewManipulator.h"
#include "Riu3DMainWindowTools.h"
@ -43,14 +43,16 @@
#include "cafCmdFeatureManager.h"
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimEclipseView* RicShowContributingWellsFeatureImpl::manipulateSelectedView(RimEclipseResultCase* eclipseResultCase, QString wellName, int timeStep)
RimEclipseView* RicShowContributingWellsFeatureImpl::manipulateSelectedView(RimEclipseResultCase* eclipseResultCase,
QString wellName,
int timeStep)
{
RimEclipseView* viewToManipulate = RicSelectOrCreateViewFeatureImpl::showViewSelection(
eclipseResultCase, "lastUsedWellAllocationView", "ContributingWells_" + wellName, "Show Contributing Wells in View");
if (!viewToManipulate) return nullptr;
if (!viewToManipulate) return nullptr;
RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(viewToManipulate, wellName, timeStep);
@ -63,9 +65,11 @@ RimEclipseView* RicShowContributingWellsFeatureImpl::manipulateSelectedView(RimE
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(RimEclipseView* viewToModify, const QString& wellName, int timeStep)
void RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(RimEclipseView* viewToModify,
const QString& wellName,
int timeStep)
{
CVF_ASSERT(viewToModify);
@ -91,7 +95,7 @@ void RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(RimE
flowDiagSolution = eclipseResultCase->defaultFlowDiagSolution();
}
//assert(flowDiagSolution);
// assert(flowDiagSolution);
CVF_ASSERT(flowDiagSolution);
RimFlowDiagSolution::TracerStatusType tracerStatus = flowDiagSolution->tracerStatusInTimeStep(selectedWell->name(), timeStep);
@ -99,7 +103,7 @@ void RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(RimE
{
return;
}
viewToModify->setCurrentTimeStep(timeStep);
viewToModify->cellResult()->setResultType(RiaDefines::FLOW_DIAGNOSTICS);
viewToModify->cellResult()->setResultVariable("MaxFractionTracer");
@ -107,27 +111,27 @@ void RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(RimE
switch (tracerStatus)
{
case RimFlowDiagSolution::PRODUCER:
viewToModify->cellResult()->setFlowDiagTracerSelectionType(RimEclipseResultDefinition::FLOW_TR_INJECTORS);
break;
case RimFlowDiagSolution::INJECTOR:
viewToModify->cellResult()->setFlowDiagTracerSelectionType(RimEclipseResultDefinition::FLOW_TR_PRODUCERS);
break;
case RimFlowDiagSolution::PRODUCER:
viewToModify->cellResult()->setFlowDiagTracerSelectionType(RimEclipseResultDefinition::FLOW_TR_INJECTORS);
break;
case RimFlowDiagSolution::INJECTOR:
viewToModify->cellResult()->setFlowDiagTracerSelectionType(RimEclipseResultDefinition::FLOW_TR_PRODUCERS);
break;
default:
CVF_ASSERT(false);
break;
default:
CVF_ASSERT(false);
break;
}
viewToModify->cellResult()->loadDataAndUpdate();
viewToModify->cellResult()->updateConnectedEditors();
std::vector<QString> tracerNames = findContributingTracerNames(flowDiagSolution, selectedWell->simWellData(), timeStep);
for (RimSimWellInView* w : viewToModify->wellCollection()->wells())
{
if (std::find(tracerNames.begin(), tracerNames.end(), w->name()) != tracerNames.end()
|| selectedWell->name() == w->name())
if (std::find(tracerNames.begin(), tracerNames.end(), w->name()) != tracerNames.end() ||
selectedWell->name() == w->name())
{
w->showWell = true;
}
@ -166,12 +170,11 @@ void RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(RimE
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RicShowContributingWellsFeatureImpl::findContributingTracerNames(
const RimFlowDiagSolution* flowDiagSolution,
const RigSimWellData* simWellData,
int timeStep)
std::vector<QString> RicShowContributingWellsFeatureImpl::findContributingTracerNames(const RimFlowDiagSolution* flowDiagSolution,
const RigSimWellData* simWellData,
int timeStep)
{
std::vector<QString> tracerCellFractionValues;
@ -180,8 +183,7 @@ std::vector<QString> RicShowContributingWellsFeatureImpl::findContributingTracer
RimFlowDiagSolution::TracerStatusType requestedTracerType = RimFlowDiagSolution::UNDEFINED;
const RigWellResultFrame::WellProductionType prodType = simWellData->wellProductionType(timeStep);
if ( prodType == RigWellResultFrame::PRODUCER
|| prodType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE)
if (prodType == RigWellResultFrame::PRODUCER || prodType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE)
{
requestedTracerType = RimFlowDiagSolution::INJECTOR;
}
@ -202,4 +204,3 @@ std::vector<QString> RicShowContributingWellsFeatureImpl::findContributingTracer
return tracerCellFractionValues;
}

View File

@ -1,17 +1,17 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@ -31,27 +31,29 @@
CAF_CMD_SOURCE_INIT(RicShowContributingWellsFromPlotFeature, "RicShowContributingWellsFromPlotFeature");
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RicShowContributingWellsFromPlotFeature::isCommandEnabled()
{
RimWellAllocationPlot* wellAllocationPlot = dynamic_cast<RimWellAllocationPlot*>(RiaApplication::instance()->activePlotWindow());
RimWellAllocationPlot* wellAllocationPlot =
dynamic_cast<RimWellAllocationPlot*>(RiaApplication::instance()->activePlotWindow());
if (wellAllocationPlot) return true;
return false;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicShowContributingWellsFromPlotFeature::onActionTriggered(bool isChecked)
{
RimWellAllocationPlot* wellAllocationPlot = dynamic_cast<RimWellAllocationPlot*>(RiaApplication::instance()->activePlotWindow());
RimWellAllocationPlot* wellAllocationPlot =
dynamic_cast<RimWellAllocationPlot*>(RiaApplication::instance()->activePlotWindow());
if (!wellAllocationPlot) return;
int timeStep = wellAllocationPlot->timeStep();
int timeStep = wellAllocationPlot->timeStep();
QString wellName = wellAllocationPlot->wellName();
RimEclipseResultCase* wellAllocationResultCase = wellAllocationPlot->rimCase();
@ -60,10 +62,10 @@ void RicShowContributingWellsFromPlotFeature::onActionTriggered(bool isChecked)
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicShowContributingWellsFromPlotFeature::setupActionLook(QAction* actionToSetup)
{
//actionToSetup->setIcon(QIcon(":/new_icon16x16.png"));
// actionToSetup->setIcon(QIcon(":/new_icon16x16.png"));
actionToSetup->setText("Show Contributing Wells");
}

View File

@ -1,17 +1,17 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@ -20,19 +20,15 @@
#include "cafCmdFeature.h"
//==================================================================================================
///
///
//==================================================================================================
class RicShowContributingWellsFromPlotFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
void onActionTriggered(bool isChecked) override;
void setupActionLook(QAction* actionToSetup) override;
};

View File

@ -1,17 +1,17 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@ -22,16 +22,16 @@
#include "RiaApplication.h"
#include "RimProject.h"
#include "RimEclipseView.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseView.h"
#include "RimProject.h"
#include "RiuMainWindow.h"
#include "cafPdmUiPropertyViewDialog.h"
//==================================================================================================
///
///
//==================================================================================================
RimEclipseView* RicSelectOrCreateViewFeatureImpl::showViewSelection(RimEclipseResultCase* resultCase,
const QString& lastUsedViewKey,
@ -73,14 +73,15 @@ RimEclipseView* RicSelectOrCreateViewFeatureImpl::showViewSelection(RimEclipseRe
viewToManipulate = featureUi.selectedView();
}
QString refFromProjectToView = caf::PdmReferenceHelper::referenceFromRootToObject(RiaApplication::instance()->project(), viewToManipulate);
QString refFromProjectToView =
caf::PdmReferenceHelper::referenceFromRootToObject(RiaApplication::instance()->project(), viewToManipulate);
RiaApplication::instance()->setCacheDataObject(lastUsedViewKey, refFromProjectToView);
return viewToManipulate;
}
//==================================================================================================
///
///
//==================================================================================================
void RicSelectOrCreateViewFeatureImpl::focusView(RimEclipseView* view)
{
@ -90,14 +91,16 @@ void RicSelectOrCreateViewFeatureImpl::focusView(RimEclipseView* view)
}
//==================================================================================================
///
///
//==================================================================================================
RimEclipseView* RicSelectOrCreateViewFeatureImpl::getDefaultSelectedView(RimEclipseResultCase* resultCase, const QString& lastUsedViewKey)
RimEclipseView* RicSelectOrCreateViewFeatureImpl::getDefaultSelectedView(RimEclipseResultCase* resultCase,
const QString& lastUsedViewKey)
{
RimEclipseView* defaultSelectedView = nullptr;
QString lastUsedViewRef = RiaApplication::instance()->cacheDataObject(lastUsedViewKey).toString();
RimEclipseView* lastUsedView = dynamic_cast<RimEclipseView*>(caf::PdmReferenceHelper::objectFromReference(RiaApplication::instance()->project(), lastUsedViewRef));
QString lastUsedViewRef = RiaApplication::instance()->cacheDataObject(lastUsedViewKey).toString();
RimEclipseView* lastUsedView = dynamic_cast<RimEclipseView*>(
caf::PdmReferenceHelper::objectFromReference(RiaApplication::instance()->project(), lastUsedViewRef));
if (lastUsedView)
{
RimEclipseResultCase* lastUsedViewResultCase = nullptr;

View File

@ -1,35 +1,35 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimFlowCharacteristicsPlot.h"
#include "RigFlowDiagResults.h"
#include "RigEclipseCaseData.h"
#include "RigActiveCellInfo.h"
#include "RigEclipseCaseData.h"
#include "RigFlowDiagResults.h"
#include "RimEclipseResultCase.h"
#include "RimFlowDiagSolution.h"
#include "RimProject.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseView.h"
#include "RimEclipsePropertyFilter.h"
#include "RimEclipsePropertyFilterCollection.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseView.h"
#include "RimFaultInViewCollection.h"
#include "RimFlowDiagSolution.h"
#include "RimProject.h"
#include "RicEclipsePropertyFilterFeatureImpl.h"
#include "RicSelectOrCreateViewFeatureImpl.h"
@ -46,23 +46,21 @@
#include <cmath> // Needed for HUGE_VAL on Linux
namespace caf
{
template<>
void AppEnum< RimFlowCharacteristicsPlot::TimeSelectionType >::setUp()
{
addItem(RimFlowCharacteristicsPlot::ALL_AVAILABLE, "ALL_AVAILABLE", "All With Calculated Flow Diagnostics");
addItem(RimFlowCharacteristicsPlot::SELECTED, "SELECTED", "Selected");
setDefault(RimFlowCharacteristicsPlot::SELECTED);
}
template<>
void AppEnum<RimFlowCharacteristicsPlot::TimeSelectionType>::setUp()
{
addItem(RimFlowCharacteristicsPlot::ALL_AVAILABLE, "ALL_AVAILABLE", "All With Calculated Flow Diagnostics");
addItem(RimFlowCharacteristicsPlot::SELECTED, "SELECTED", "Selected");
setDefault(RimFlowCharacteristicsPlot::SELECTED);
}
} // namespace caf
CAF_PDM_SOURCE_INIT(RimFlowCharacteristicsPlot, "FlowCharacteristicsPlot");
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimFlowCharacteristicsPlot::RimFlowCharacteristicsPlot()
{
@ -79,8 +77,13 @@ RimFlowCharacteristicsPlot::RimFlowCharacteristicsPlot()
CAF_PDM_InitFieldNoDefault(&m_applyTimeSteps, "ApplyTimeSteps", "", "", "", "");
caf::PdmUiPushButtonEditor::configureEditorForField(&m_applyTimeSteps);
CAF_PDM_InitField(&m_maxPvFraction, "CellPVThreshold", 0.1, "Aquifer Cell Threshold", "", "Exclude Aquifer Effects by adding a Cell Pore Volume Threshold as Fraction of Total Pore Volume.", "");
CAF_PDM_InitField(&m_maxPvFraction,
"CellPVThreshold",
0.1,
"Aquifer Cell Threshold",
"",
"Exclude Aquifer Effects by adding a Cell Pore Volume Threshold as Fraction of Total Pore Volume.",
"");
CAF_PDM_InitField(&m_showLegend, "ShowLegend", true, "Legend", "", "", "");
@ -101,24 +104,23 @@ RimFlowCharacteristicsPlot::RimFlowCharacteristicsPlot()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimFlowCharacteristicsPlot::~RimFlowCharacteristicsPlot()
{
removeMdiWindowFromMdiArea();
deleteViewWidget();
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimFlowCharacteristicsPlot::setFromFlowSolution(RimFlowDiagSolution* flowSolution)
{
if ( !flowSolution )
if (!flowSolution)
{
m_case = nullptr;
m_case = nullptr;
m_cellFilterView = nullptr;
}
else
@ -133,66 +135,67 @@ void RimFlowCharacteristicsPlot::setFromFlowSolution(RimFlowDiagSolution* flowSo
}
m_flowDiagSolution = flowSolution;
m_showWindow = true;
m_showWindow = true;
onLoadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimFlowCharacteristicsPlot::deleteViewWidget()
{
if (m_flowCharPlotWidget)
{
m_flowCharPlotWidget->deleteLater();
m_flowCharPlotWidget= nullptr;
m_flowCharPlotWidget = nullptr;
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimFlowCharacteristicsPlot::updateCurrentTimeStep()
{
if (m_timeStepSelectionType() != ALL_AVAILABLE) return;
if (!m_flowDiagSolution()) return;
RigFlowDiagResults* flowResult = m_flowDiagSolution->flowDiagResults();
std::vector<int> calculatedTimesteps = flowResult->calculatedTimeSteps(RigFlowDiagResultAddress::PHASE_ALL);
RigFlowDiagResults* flowResult = m_flowDiagSolution->flowDiagResults();
std::vector<int> calculatedTimesteps = flowResult->calculatedTimeSteps(RigFlowDiagResultAddress::PHASE_ALL);
if (m_currentlyPlottedTimeSteps == calculatedTimesteps) return;
this->onLoadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimFlowCharacteristicsPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
QList<caf::PdmOptionItemInfo> RimFlowCharacteristicsPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly)
{
QList<caf::PdmOptionItemInfo> options;
if ( fieldNeedingOptions == &m_case )
if (fieldNeedingOptions == &m_case)
{
RimProject* proj = nullptr;
this->firstAncestorOrThisOfType(proj);
if ( proj )
if (proj)
{
std::vector<RimEclipseResultCase*> cases;
proj->descendantsIncludingThisOfType(cases);
for ( RimEclipseResultCase* c : cases )
for (RimEclipseResultCase* c : cases)
{
if ( c->defaultFlowDiagSolution() )
if (c->defaultFlowDiagSolution())
{
options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, false, c->uiIcon()));
}
}
}
}
else if ( fieldNeedingOptions == &m_cellFilterView )
else if (fieldNeedingOptions == &m_cellFilterView)
{
if ( m_case )
if (m_case)
{
for (RimEclipseView* view : m_case()->reservoirViews())
{
@ -200,28 +203,29 @@ QList<caf::PdmOptionItemInfo> RimFlowCharacteristicsPlot::calculateValueOptions(
}
}
}
else if ( fieldNeedingOptions == &m_flowDiagSolution )
else if (fieldNeedingOptions == &m_flowDiagSolution)
{
if ( m_case )
if (m_case)
{
std::vector<RimFlowDiagSolution*> flowSols = m_case->flowDiagSolutions();
options.push_back(caf::PdmOptionItemInfo("None", nullptr));
for ( RimFlowDiagSolution* flowSol : flowSols )
for (RimFlowDiagSolution* flowSol : flowSols)
{
options.push_back(caf::PdmOptionItemInfo(flowSol->userDescription(), flowSol, false, flowSol->uiIcon()));
}
}
}
else if ( fieldNeedingOptions == &m_selectedTimeStepsUi )
else if (fieldNeedingOptions == &m_selectedTimeStepsUi)
{
if ( m_flowDiagSolution && m_case )
if (m_flowDiagSolution && m_case)
{
QStringList timeStepDates = m_case->timeStepStrings();
std::vector<int> calculatedTimeSteps = m_flowDiagSolution()->flowDiagResults()->calculatedTimeSteps(RigFlowDiagResultAddress::PHASE_ALL);
QStringList timeStepDates = m_case->timeStepStrings();
std::vector<int> calculatedTimeSteps =
m_flowDiagSolution()->flowDiagResults()->calculatedTimeSteps(RigFlowDiagResultAddress::PHASE_ALL);
for (int tsIdx = 0; tsIdx < timeStepDates.size(); ++tsIdx)
{
auto it = std::find(calculatedTimeSteps.begin(), calculatedTimeSteps.end(), tsIdx);
auto it = std::find(calculatedTimeSteps.begin(), calculatedTimeSteps.end(), tsIdx);
QString itemText = timeStepDates[tsIdx];
if (it != calculatedTimeSteps.end())
{
@ -235,7 +239,7 @@ QList<caf::PdmOptionItemInfo> RimFlowCharacteristicsPlot::calculateValueOptions(
{
if (m_flowDiagSolution)
{
std::vector<QString> tracerNames = m_flowDiagSolution->tracerNames();
std::vector<QString> tracerNames = m_flowDiagSolution->tracerNames();
std::vector<std::pair<QString, QString>> sortedTracerNames;
for (QString tracerName : tracerNames)
{
@ -263,18 +267,18 @@ QList<caf::PdmOptionItemInfo> RimFlowCharacteristicsPlot::calculateValueOptions(
QString prefix;
switch (tracerStatus)
{
case RimFlowDiagSolution::INJECTOR:
prefix = "I : ";
break;
case RimFlowDiagSolution::PRODUCER:
prefix = "P : ";
break;
case RimFlowDiagSolution::VARYING:
prefix = "I/P: ";
break;
case RimFlowDiagSolution::UNDEFINED:
prefix = "U : ";
break;
case RimFlowDiagSolution::INJECTOR:
prefix = "I : ";
break;
case RimFlowDiagSolution::PRODUCER:
prefix = "P : ";
break;
case RimFlowDiagSolution::VARYING:
prefix = "I/P: ";
break;
case RimFlowDiagSolution::UNDEFINED:
prefix = "U : ";
break;
}
sortedTracerNames.push_back(std::make_pair(prefix + tracerName, tracerName));
}
@ -282,10 +286,9 @@ QList<caf::PdmOptionItemInfo> RimFlowCharacteristicsPlot::calculateValueOptions(
std::sort(sortedTracerNames.begin(),
sortedTracerNames.end(),
[](const std::pair<QString, QString>& a, const std::pair<QString, QString>& b) -> bool
{
return a.first < b.first;
});
[](const std::pair<QString, QString>& a, const std::pair<QString, QString>& b) -> bool {
return a.first < b.first;
});
for (auto& tracer : sortedTracerNames)
{
@ -295,11 +298,10 @@ QList<caf::PdmOptionItemInfo> RimFlowCharacteristicsPlot::calculateValueOptions(
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimFlowCharacteristicsPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
@ -321,7 +323,7 @@ void RimFlowCharacteristicsPlot::defineUiOrdering(QString uiConfigName, caf::Pdm
}
if (!m_case() && defaultCase)
{
m_case = defaultCase;
m_case = defaultCase;
m_flowDiagSolution = m_case->defaultFlowDiagSolution();
if (!m_case()->reservoirViews.empty())
{
@ -348,8 +350,7 @@ void RimFlowCharacteristicsPlot::defineUiOrdering(QString uiConfigName, caf::Pdm
{
caf::PdmUiGroup* regionGroup = uiOrdering.addNewGroup("Region");
regionGroup->add(&m_cellFilter);
if (m_cellFilter() == RigFlowDiagResults::CELLS_COMMUNICATION ||
m_cellFilter() == RigFlowDiagResults::CELLS_DRAINED ||
if (m_cellFilter() == RigFlowDiagResults::CELLS_COMMUNICATION || m_cellFilter() == RigFlowDiagResults::CELLS_DRAINED ||
m_cellFilter() == RigFlowDiagResults::CELLS_FLOODED)
{
regionGroup->add(&m_tracerFilter);
@ -365,8 +366,7 @@ void RimFlowCharacteristicsPlot::defineUiOrdering(QString uiConfigName, caf::Pdm
{
regionGroup->add(&m_minCommunication);
}
else if (m_cellFilter() == RigFlowDiagResults::CELLS_DRAINED ||
m_cellFilter() == RigFlowDiagResults::CELLS_FLOODED)
else if (m_cellFilter() == RigFlowDiagResults::CELLS_DRAINED || m_cellFilter() == RigFlowDiagResults::CELLS_FLOODED)
{
regionGroup->add(&m_maxTof);
}
@ -384,9 +384,11 @@ void RimFlowCharacteristicsPlot::defineUiOrdering(QString uiConfigName, caf::Pdm
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimFlowCharacteristicsPlot::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
void RimFlowCharacteristicsPlot::defineEditorAttribute(const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute)
{
if (field == &m_applyTimeSteps)
{
@ -407,7 +409,7 @@ void RimFlowCharacteristicsPlot::defineEditorAttribute(const caf::PdmFieldHandle
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QWidget* RimFlowCharacteristicsPlot::viewWidget()
{
@ -415,7 +417,7 @@ QWidget* RimFlowCharacteristicsPlot::viewWidget()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimFlowCharacteristicsPlot::zoomAll()
{
@ -423,13 +425,15 @@ void RimFlowCharacteristicsPlot::zoomAll()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimFlowCharacteristicsPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
void RimFlowCharacteristicsPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue)
{
RimViewWindow::fieldChangedByUi(changedField, oldValue, newValue);
if ( &m_case == changedField )
if (&m_case == changedField)
{
m_flowDiagSolution = m_case->defaultFlowDiagSolution();
m_currentlyPlottedTimeSteps.clear();
@ -481,7 +485,8 @@ void RimFlowCharacteristicsPlot::fieldChangedByUi(const caf::PdmFieldHandle* cha
{
if (m_flowDiagSolution)
{
std::vector<int> timeSteps = m_flowDiagSolution()->flowDiagResults()->calculatedTimeSteps(RigFlowDiagResultAddress::PHASE_ALL);
std::vector<int> timeSteps =
m_flowDiagSolution()->flowDiagResults()->calculatedTimeSteps(RigFlowDiagResultAddress::PHASE_ALL);
if (!timeSteps.empty())
{
timeStep = timeSteps[0];
@ -526,7 +531,7 @@ void RimFlowCharacteristicsPlot::fieldChangedByUi(const caf::PdmFieldHandle* cha
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QImage RimFlowCharacteristicsPlot::snapshotWindowContent()
{
@ -535,14 +540,14 @@ QImage RimFlowCharacteristicsPlot::snapshotWindowContent()
if (m_flowCharPlotWidget)
{
QPixmap pix = QPixmap::grabWidget(m_flowCharPlotWidget);
image = pix.toImage();
image = pix.toImage();
}
return image;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimFlowCharacteristicsPlot::onLoadDataAndUpdate()
{
@ -550,23 +555,23 @@ void RimFlowCharacteristicsPlot::onLoadDataAndUpdate()
if (m_flowDiagSolution && m_flowCharPlotWidget)
{
RigFlowDiagResults* flowResult = m_flowDiagSolution->flowDiagResults();
std::vector<int> calculatedTimesteps = flowResult->calculatedTimeSteps(RigFlowDiagResultAddress::PHASE_ALL);
RigFlowDiagResults* flowResult = m_flowDiagSolution->flowDiagResults();
std::vector<int> calculatedTimesteps = flowResult->calculatedTimeSteps(RigFlowDiagResultAddress::PHASE_ALL);
if (m_timeStepSelectionType == SELECTED)
{
for (int tsIdx : m_selectedTimeSteps())
{
{
m_flowDiagSolution()->flowDiagResults()->maxAbsPairFlux(tsIdx);
}
calculatedTimesteps = m_selectedTimeSteps();
}
m_currentlyPlottedTimeSteps = calculatedTimesteps;
std::vector<QDateTime> timeStepDates = m_case->timeStepDates();
QStringList timeStepStrings = m_case->timeStepStrings();
std::vector<double> lorenzVals(timeStepDates.size(), HUGE_VAL);
std::vector<QDateTime> timeStepDates = m_case->timeStepDates();
QStringList timeStepStrings = m_case->timeStepStrings();
std::vector<double> lorenzVals(timeStepDates.size(), HUGE_VAL);
m_flowCharPlotWidget->removeAllCurves();
@ -594,7 +599,7 @@ void RimFlowCharacteristicsPlot::onLoadDataAndUpdate()
}
RigActiveCellInfo* activeCellInfo = m_case()->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL);
std::vector<char> visibleActiveCells(activeCellInfo->reservoirActiveCellCount(), 0);
std::vector<char> visibleActiveCells(activeCellInfo->reservoirActiveCellCount(), 0);
for (size_t i = 0; i < visibleCells.size(); ++i)
{
@ -610,12 +615,8 @@ void RimFlowCharacteristicsPlot::onLoadDataAndUpdate()
}
else
{
auto flowCharResults = flowResult->flowCharacteristicsResults(timeStepIdx,
m_cellFilter(),
selectedTracerNames,
m_maxPvFraction(),
m_minCommunication(),
m_maxTof());
auto flowCharResults = flowResult->flowCharacteristicsResults(
timeStepIdx, m_cellFilter(), selectedTracerNames, m_maxPvFraction(), m_minCommunication(), m_maxTof());
timeStepToFlowResultMap[timeStepIdx] = flowCharResults;
}
lorenzVals[timeStepIdx] = timeStepToFlowResultMap[timeStepIdx].m_lorenzCoefficient;
@ -623,9 +624,8 @@ void RimFlowCharacteristicsPlot::onLoadDataAndUpdate()
m_flowCharPlotWidget->setLorenzCurve(timeStepStrings, timeStepDates, lorenzVals);
for ( int timeStepIdx: calculatedTimesteps )
for (int timeStepIdx : calculatedTimesteps)
{
const auto& flowCharResults = timeStepToFlowResultMap[timeStepIdx];
m_flowCharPlotWidget->addFlowCapStorageCapCurve(timeStepDates[timeStepIdx],
@ -641,7 +641,7 @@ void RimFlowCharacteristicsPlot::onLoadDataAndUpdate()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimFlowCharacteristicsPlot::viewGeometryUpdated()
{
@ -653,12 +653,10 @@ void RimFlowCharacteristicsPlot::viewGeometryUpdated()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QWidget* RimFlowCharacteristicsPlot::createViewWidget(QWidget* mainWindowParent)
{
m_flowCharPlotWidget = new RiuFlowCharacteristicsPlot(this, mainWindowParent);
return m_flowCharPlotWidget;
}