#4683 clang-format on all files in ApplicationCode

This commit is contained in:
Magne Sjaastad
2019-09-06 10:40:57 +02:00
parent 3a317504bb
commit fe9e567825
2092 changed files with 117952 additions and 111846 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.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -26,6 +26,8 @@
#include "RigSimWellData.h"
#include "RiaSummaryTools.h"
#include "Rim3dView.h"
#include "RimEclipseResultCase.h"
#include "RimGridSummaryCase.h"
#include "RimMainPlotCollection.h"
@@ -37,8 +39,6 @@
#include "RimSummaryCurveAppearanceCalculator.h"
#include "RimSummaryPlot.h"
#include "RimSummaryPlotCollection.h"
#include "Rim3dView.h"
#include "RiaSummaryTools.h"
#include "RiuPlotMainWindow.h"
@@ -46,20 +46,20 @@
#include <QAction>
CAF_CMD_SOURCE_INIT(RicPlotProductionRateFeature, "RicPlotProductionRateFeature");
CAF_CMD_SOURCE_INIT( RicPlotProductionRateFeature, "RicPlotProductionRateFeature" );
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RicPlotProductionRateFeature::isCommandEnabled()
{
std::vector<RimSimWellInView*> collection;
caf::SelectionManager::instance()->objectsByType(&collection);
caf::SelectionManager::instance()->objectsByType( &collection );
for (RimSimWellInView* well : collection)
for ( RimSimWellInView* well : collection )
{
RimGridSummaryCase* gridSummaryCase = RicPlotProductionRateFeature::gridSummaryCaseForWell(well);
if (gridSummaryCase)
RimGridSummaryCase* gridSummaryCase = RicPlotProductionRateFeature::gridSummaryCaseForWell( well );
if ( gridSummaryCase )
{
return true;
}
@@ -69,64 +69,78 @@ bool RicPlotProductionRateFeature::isCommandEnabled()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicPlotProductionRateFeature::onActionTriggered(bool isChecked)
void RicPlotProductionRateFeature::onActionTriggered( bool isChecked )
{
RimProject* project = RiaApplication::instance()->project();
CAF_ASSERT(project);
CAF_ASSERT( project );
RimSummaryCaseMainCollection* sumCaseColl = project->activeOilField() ? project->activeOilField()->summaryCaseMainCollection() : nullptr;
if (!sumCaseColl) return;
RimSummaryCaseMainCollection* sumCaseColl = project->activeOilField()
? project->activeOilField()->summaryCaseMainCollection()
: nullptr;
if ( !sumCaseColl ) return;
RimSummaryPlotCollection* summaryPlotColl = RiaSummaryTools::summaryPlotCollection();
std::vector<RimSimWellInView*> collection;
caf::SelectionManager::instance()->objectsByType(&collection);
caf::SelectionManager::instance()->objectsByType( &collection );
RimSummaryPlot* summaryPlotToSelect = nullptr;
for (RimSimWellInView* well : collection)
for ( RimSimWellInView* well : collection )
{
RimGridSummaryCase* gridSummaryCase = RicPlotProductionRateFeature::gridSummaryCaseForWell(well);
if (!gridSummaryCase) continue;
RimGridSummaryCase* gridSummaryCase = RicPlotProductionRateFeature::gridSummaryCaseForWell( well );
if ( !gridSummaryCase ) continue;
QString description = "Well Production Rates : ";
if (isInjector(well))
if ( isInjector( well ) )
{
description = "Well Injection Rates : ";
}
description += well->name();
RimSummaryPlot* plot = summaryPlotColl->createNamedSummaryPlot(description);
RimSummaryPlot* plot = summaryPlotColl->createNamedSummaryPlot( description );
if (isInjector(well))
if ( isInjector( well ) )
{
// Left Axis
RiaDefines::PlotAxis plotAxis = RiaDefines::PLOT_AXIS_LEFT;
{
// Note : The parameter "WOIR" is probably never-existing, but we check for existence before creating curve
// Oil
// Note : The parameter "WOIR" is probably never-existing, but we check for existence before creating
// curve Oil
QString parameterName = "WOIR";
RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
plotAxis, RimSummaryCurveAppearanceCalculator::cycledGreenColor(0));
RicPlotProductionRateFeature::addSummaryCurve( plot,
well,
gridSummaryCase,
parameterName,
plotAxis,
RimSummaryCurveAppearanceCalculator::cycledGreenColor( 0 ) );
}
{
// Water
QString parameterName = "WWIR";
RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
plotAxis, RimSummaryCurveAppearanceCalculator::cycledBlueColor(0));
RicPlotProductionRateFeature::addSummaryCurve( plot,
well,
gridSummaryCase,
parameterName,
plotAxis,
RimSummaryCurveAppearanceCalculator::cycledBlueColor( 0 ) );
}
{
// Gas
QString parameterName = "WGIR";
RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
plotAxis, RimSummaryCurveAppearanceCalculator::cycledRedColor(0));
RicPlotProductionRateFeature::addSummaryCurve( plot,
well,
gridSummaryCase,
parameterName,
plotAxis,
RimSummaryCurveAppearanceCalculator::cycledRedColor( 0 ) );
}
}
else
@@ -134,30 +148,41 @@ void RicPlotProductionRateFeature::onActionTriggered(bool isChecked)
// Left Axis
RiaDefines::PlotAxis plotAxis = RiaDefines::PLOT_AXIS_LEFT;
{
// Oil
QString parameterName = "WOPR";
RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
plotAxis, RimSummaryCurveAppearanceCalculator::cycledGreenColor(0));
RicPlotProductionRateFeature::addSummaryCurve( plot,
well,
gridSummaryCase,
parameterName,
plotAxis,
RimSummaryCurveAppearanceCalculator::cycledGreenColor( 0 ) );
}
{
// Water
QString parameterName = "WWPR";
RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
plotAxis, RimSummaryCurveAppearanceCalculator::cycledBlueColor(0));
RicPlotProductionRateFeature::addSummaryCurve( plot,
well,
gridSummaryCase,
parameterName,
plotAxis,
RimSummaryCurveAppearanceCalculator::cycledBlueColor( 0 ) );
}
{
// Gas
QString parameterName = "WGPR";
RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
plotAxis, RimSummaryCurveAppearanceCalculator::cycledRedColor(0));
RicPlotProductionRateFeature::addSummaryCurve( plot,
well,
gridSummaryCase,
parameterName,
plotAxis,
RimSummaryCurveAppearanceCalculator::cycledRedColor( 0 ) );
}
}
// Right Axis
{
@@ -165,14 +190,24 @@ void RicPlotProductionRateFeature::onActionTriggered(bool isChecked)
{
QString parameterName = "WTHP";
RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
plotAxis, RimSummaryCurveAppearanceCalculator::cycledNoneRGBBrColor(0));
RicPlotProductionRateFeature::addSummaryCurve( plot,
well,
gridSummaryCase,
parameterName,
plotAxis,
RimSummaryCurveAppearanceCalculator::cycledNoneRGBBrColor(
0 ) );
}
{
QString parameterName = "WBHP";
RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
plotAxis, RimSummaryCurveAppearanceCalculator::cycledNoneRGBBrColor(1));
RicPlotProductionRateFeature::addSummaryCurve( plot,
well,
gridSummaryCase,
parameterName,
plotAxis,
RimSummaryCurveAppearanceCalculator::cycledNoneRGBBrColor(
1 ) );
}
}
@@ -182,13 +217,13 @@ void RicPlotProductionRateFeature::onActionTriggered(bool isChecked)
summaryPlotToSelect = plot;
}
if (summaryPlotToSelect)
if ( summaryPlotToSelect )
{
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->getOrCreateAndShowMainPlotWindow();
if (mainPlotWindow)
if ( mainPlotWindow )
{
mainPlotWindow->selectAsCurrentItem(summaryPlotToSelect);
mainPlotWindow->setExpanded(summaryPlotToSelect);
mainPlotWindow->selectAsCurrentItem( summaryPlotToSelect );
mainPlotWindow->setExpanded( summaryPlotToSelect );
mainPlotWindow->tileSubWindows();
}
@@ -196,31 +231,34 @@ void RicPlotProductionRateFeature::onActionTriggered(bool isChecked)
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicPlotProductionRateFeature::setupActionLook(QAction* actionToSetup)
void RicPlotProductionRateFeature::setupActionLook( QAction* actionToSetup )
{
//actionToSetup->setIcon(QIcon(":/WellAllocPlot16x16.png"));
actionToSetup->setText("Plot Production Rates");
// actionToSetup->setIcon(QIcon(":/WellAllocPlot16x16.png"));
actionToSetup->setText( "Plot Production Rates" );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimGridSummaryCase* RicPlotProductionRateFeature::gridSummaryCaseForWell(RimSimWellInView* well)
RimGridSummaryCase* RicPlotProductionRateFeature::gridSummaryCaseForWell( RimSimWellInView* well )
{
RimProject* project = RiaApplication::instance()->project();
if (!project) return nullptr;
if ( !project ) return nullptr;
RimSummaryCaseMainCollection* sumCaseColl = project->activeOilField() ? project->activeOilField()->summaryCaseMainCollection() : nullptr;
if (!sumCaseColl) return nullptr;
RimSummaryCaseMainCollection* sumCaseColl = project->activeOilField()
? project->activeOilField()->summaryCaseMainCollection()
: nullptr;
if ( !sumCaseColl ) return nullptr;
RimEclipseResultCase* eclCase = nullptr;
well->firstAncestorOrThisOfType(eclCase);
if (eclCase)
well->firstAncestorOrThisOfType( eclCase );
if ( eclCase )
{
RimGridSummaryCase* gridSummaryCase = dynamic_cast<RimGridSummaryCase*>(sumCaseColl->findSummaryCaseFromEclipseResultCase(eclCase));
if (gridSummaryCase)
RimGridSummaryCase* gridSummaryCase = dynamic_cast<RimGridSummaryCase*>(
sumCaseColl->findSummaryCaseFromEclipseResultCase( eclCase ) );
if ( gridSummaryCase )
{
return gridSummaryCase;
}
@@ -230,25 +268,25 @@ RimGridSummaryCase* RicPlotProductionRateFeature::gridSummaryCaseForWell(RimSimW
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RicPlotProductionRateFeature::isInjector(RimSimWellInView* well)
bool RicPlotProductionRateFeature::isInjector( RimSimWellInView* well )
{
RigSimWellData* wRes = well->simWellData();
if (wRes)
if ( wRes )
{
Rim3dView* rimView = nullptr;
well->firstAncestorOrThisOfTypeAsserted(rimView);
well->firstAncestorOrThisOfTypeAsserted( rimView );
int currentTimeStep = rimView->currentTimeStep();
if (wRes->hasWellResult(currentTimeStep))
if ( wRes->hasWellResult( currentTimeStep ) )
{
const RigWellResultFrame& wrf = wRes->wellResultFrame(currentTimeStep);
const RigWellResultFrame& wrf = wRes->wellResultFrame( currentTimeStep );
if ( wrf.m_productionType == RigWellResultFrame::OIL_INJECTOR
|| wrf.m_productionType == RigWellResultFrame::GAS_INJECTOR
|| wrf.m_productionType == RigWellResultFrame::WATER_INJECTOR)
if ( wrf.m_productionType == RigWellResultFrame::OIL_INJECTOR ||
wrf.m_productionType == RigWellResultFrame::GAS_INJECTOR ||
wrf.m_productionType == RigWellResultFrame::WATER_INJECTOR )
{
return true;
}
@@ -259,44 +297,46 @@ bool RicPlotProductionRateFeature::isInjector(RimSimWellInView* well)
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimSummaryCurve* RicPlotProductionRateFeature::addSummaryCurve( RimSummaryPlot* plot, const RimSimWellInView* well,
RimGridSummaryCase* gridSummaryCase, const QString& vectorName,
RiaDefines::PlotAxis plotAxis, const cvf::Color3f& color)
RimSummaryCurve* RicPlotProductionRateFeature::addSummaryCurve( RimSummaryPlot* plot,
const RimSimWellInView* well,
RimGridSummaryCase* gridSummaryCase,
const QString& vectorName,
RiaDefines::PlotAxis plotAxis,
const cvf::Color3f& color )
{
CVF_ASSERT(plot);
CVF_ASSERT(gridSummaryCase);
CVF_ASSERT(well);
CVF_ASSERT( plot );
CVF_ASSERT( gridSummaryCase );
CVF_ASSERT( well );
RifEclipseSummaryAddress addr(RifEclipseSummaryAddress::SUMMARY_WELL,
vectorName.toStdString(),
-1,
-1,
"",
well->name().toStdString(),
-1,
"",
-1,
-1,
-1,
-1,
false);
RifEclipseSummaryAddress addr( RifEclipseSummaryAddress::SUMMARY_WELL,
vectorName.toStdString(),
-1,
-1,
"",
well->name().toStdString(),
-1,
"",
-1,
-1,
-1,
-1,
false );
if (!gridSummaryCase->summaryReader()->hasAddress(addr))
if ( !gridSummaryCase->summaryReader()->hasAddress( addr ) )
{
return nullptr;
}
RimSummaryCurve* newCurve = new RimSummaryCurve();
plot->addCurveAndUpdate(newCurve);
plot->addCurveAndUpdate( newCurve );
newCurve->setSummaryCaseY(gridSummaryCase);
newCurve->setSummaryAddressYAndApplyInterpolation(addr);
newCurve->setColor(color);
newCurve->setLeftOrRightAxisY(plotAxis);
newCurve->loadDataAndUpdate(true);
newCurve->setSummaryCaseY( gridSummaryCase );
newCurve->setSummaryAddressYAndApplyInterpolation( addr );
newCurve->setColor( color );
newCurve->setLeftOrRightAxisY( plotAxis );
newCurve->loadDataAndUpdate( true );
return newCurve;
}