#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) 2016- 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.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -32,26 +32,26 @@
#include "RimEclipseView.h"
#include "RimSimWellInViewCollection.h"
CAF_PDM_SOURCE_INIT(RimFlowDiagSolution, "FlowDiagSolution");
CAF_PDM_SOURCE_INIT( RimFlowDiagSolution, "FlowDiagSolution" );
#define CROSS_FLOW_ENDING "-XF"
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RimFlowDiagSolution::hasCrossFlowEnding(const QString& tracerName)
bool RimFlowDiagSolution::hasCrossFlowEnding( const QString& tracerName )
{
return tracerName.endsWith(CROSS_FLOW_ENDING);
return tracerName.endsWith( CROSS_FLOW_ENDING );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString RimFlowDiagSolution::removeCrossFlowEnding(const QString& tracerName)
QString RimFlowDiagSolution::removeCrossFlowEnding( const QString& tracerName )
{
if (tracerName.endsWith(CROSS_FLOW_ENDING))
if ( tracerName.endsWith( CROSS_FLOW_ENDING ) )
{
return tracerName.left(tracerName.size() - 3);
return tracerName.left( tracerName.size() - 3 );
}
else
{
@@ -60,32 +60,29 @@ QString RimFlowDiagSolution::removeCrossFlowEnding(const QString& tracerName)
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString RimFlowDiagSolution::addCrossFlowEnding(const QString& wellName)
QString RimFlowDiagSolution::addCrossFlowEnding( const QString& wellName )
{
return wellName + CROSS_FLOW_ENDING;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimFlowDiagSolution::RimFlowDiagSolution(void)
RimFlowDiagSolution::RimFlowDiagSolution( void )
{
CAF_PDM_InitObject("Flow Diagnostics Solution", "", "", "");
CAF_PDM_InitField(&m_userDescription, "UserDescription", QString("All Wells") ,"Description", "", "","");
CAF_PDM_InitObject( "Flow Diagnostics Solution", "", "", "" );
CAF_PDM_InitField( &m_userDescription, "UserDescription", QString( "All Wells" ), "Description", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimFlowDiagSolution::~RimFlowDiagSolution(void)
{
}
RimFlowDiagSolution::~RimFlowDiagSolution( void ) {}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString RimFlowDiagSolution::userDescription() const
{
@@ -93,7 +90,7 @@ QString RimFlowDiagSolution::userDescription() const
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RigFlowDiagResults* RimFlowDiagSolution::flowDiagResults()
{
@@ -102,38 +99,37 @@ RigFlowDiagResults* RimFlowDiagSolution::flowDiagResults()
size_t timeStepCount;
{
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase);
CVF_ASSERT(eclCase && eclCase->eclipseCaseData() );
this->firstAncestorOrThisOfType( eclCase );
timeStepCount = eclCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->maxTimeStepCount();
CVF_ASSERT( eclCase && eclCase->eclipseCaseData() );
timeStepCount = eclCase->eclipseCaseData()->results( RiaDefines::MATRIX_MODEL )->maxTimeStepCount();
}
m_flowDiagResults = new RigFlowDiagResults(this, timeStepCount);
m_flowDiagResults = new RigFlowDiagResults( this, timeStepCount );
}
return m_flowDiagResults.p();
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RimFlowDiagSolution::tracerNames() const
{
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase);
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType( eclCase );
std::vector<QString> tracerNameSet;
if (eclCase && eclCase->eclipseCaseData())
if ( eclCase && eclCase->eclipseCaseData() )
{
const cvf::Collection<RigSimWellData>& simWellData = eclCase->eclipseCaseData()->wellResults();
for (size_t wIdx = 0; wIdx < simWellData.size(); ++wIdx)
for ( size_t wIdx = 0; wIdx < simWellData.size(); ++wIdx )
{
tracerNameSet.push_back(simWellData[wIdx]->m_wellName);
tracerNameSet.push_back(addCrossFlowEnding(simWellData[wIdx]->m_wellName));
tracerNameSet.push_back( simWellData[wIdx]->m_wellName );
tracerNameSet.push_back( addCrossFlowEnding( simWellData[wIdx]->m_wellName ) );
}
}
@@ -141,77 +137,79 @@ std::vector<QString> RimFlowDiagSolution::tracerNames() const
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
std::map<std::string, std::vector<int> > RimFlowDiagSolution::allInjectorTracerActiveCellIndices(size_t timeStepIndex) const
std::map<std::string, std::vector<int>> RimFlowDiagSolution::allInjectorTracerActiveCellIndices( size_t timeStepIndex ) const
{
return allTracerActiveCellIndices(timeStepIndex, true);
return allTracerActiveCellIndices( timeStepIndex, true );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
std::map<std::string, std::vector<int> > RimFlowDiagSolution::allProducerTracerActiveCellIndices(size_t timeStepIndex) const
std::map<std::string, std::vector<int>> RimFlowDiagSolution::allProducerTracerActiveCellIndices( size_t timeStepIndex ) const
{
return allTracerActiveCellIndices(timeStepIndex, false);
return allTracerActiveCellIndices( timeStepIndex, false );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
std::map<std::string, std::vector<int> > RimFlowDiagSolution::allTracerActiveCellIndices(size_t timeStepIndex, bool useInjectors) const
std::map<std::string, std::vector<int>> RimFlowDiagSolution::allTracerActiveCellIndices( size_t timeStepIndex,
bool useInjectors ) const
{
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase);
this->firstAncestorOrThisOfType( eclCase );
std::map<std::string, std::vector<int> > tracersWithCells;
std::map<std::string, std::vector<int>> tracersWithCells;
if (eclCase && eclCase->eclipseCaseData())
if ( eclCase && eclCase->eclipseCaseData() )
{
const cvf::Collection<RigSimWellData>& simWellData = eclCase->eclipseCaseData()->wellResults();
RigMainGrid* mainGrid = eclCase->eclipseCaseData()->mainGrid();
RigActiveCellInfo* activeCellInfo = eclCase->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL); //Todo: Must come from the results definition
const cvf::Collection<RigSimWellData>& simWellData = eclCase->eclipseCaseData()->wellResults();
RigMainGrid* mainGrid = eclCase->eclipseCaseData()->mainGrid();
RigActiveCellInfo* activeCellInfo = eclCase->eclipseCaseData()->activeCellInfo(
RiaDefines::MATRIX_MODEL ); // Todo: Must come from the results definition
for ( size_t wIdx = 0; wIdx < simWellData.size(); ++wIdx )
{
if (!simWellData[wIdx]->hasWellResult(timeStepIndex) ) continue;
const RigWellResultFrame& wellResFrame = simWellData[wIdx]->wellResultFrame(timeStepIndex);
bool isInjectorWell = ( wellResFrame.m_productionType != RigWellResultFrame::PRODUCER
&& wellResFrame.m_productionType != RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE);
if ( !simWellData[wIdx]->hasWellResult( timeStepIndex ) ) continue;
const RigWellResultFrame& wellResFrame = simWellData[wIdx]->wellResultFrame( timeStepIndex );
bool isInjectorWell = ( wellResFrame.m_productionType != RigWellResultFrame::PRODUCER &&
wellResFrame.m_productionType != RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE );
std::string wellName = simWellData[wIdx]->m_wellName.toStdString();
std::string wellNameXf = addCrossFlowEnding(simWellData[wIdx]->m_wellName).toStdString();
std::string wellNameXf = addCrossFlowEnding( simWellData[wIdx]->m_wellName ).toStdString();
std::vector<int>& tracerCells = tracersWithCells[wellName];
std::vector<int>& tracerCells = tracersWithCells[wellName];
std::vector<int>& tracerCellsCrossFlow = tracersWithCells[wellNameXf];
for (const RigWellResultBranch& wBr: wellResFrame.m_wellResultBranches)
for ( const RigWellResultBranch& wBr : wellResFrame.m_wellResultBranches )
{
for (const RigWellResultPoint& wrp: wBr.m_branchResultPoints)
for ( const RigWellResultPoint& wrp : wBr.m_branchResultPoints )
{
if (wrp.isValid() && wrp.m_isOpen
&& ( (useInjectors && wrp.flowRate() < 0.0) || (!useInjectors && wrp.flowRate() > 0.0) ) )
if ( wrp.isValid() && wrp.m_isOpen &&
( ( useInjectors && wrp.flowRate() < 0.0 ) || ( !useInjectors && wrp.flowRate() > 0.0 ) ) )
{
RigGridBase * grid = mainGrid->gridByIndex(wrp.m_gridIndex);
size_t reservoirCellIndex = grid->reservoirCellIndex(wrp.m_gridCellIndex);
RigGridBase* grid = mainGrid->gridByIndex( wrp.m_gridIndex );
size_t reservoirCellIndex = grid->reservoirCellIndex( wrp.m_gridCellIndex );
int cellActiveIndex = static_cast<int>(activeCellInfo->cellResultIndex(reservoirCellIndex));
int cellActiveIndex = static_cast<int>( activeCellInfo->cellResultIndex( reservoirCellIndex ) );
if ( useInjectors == isInjectorWell )
{
tracerCells.push_back(cellActiveIndex);
tracerCells.push_back( cellActiveIndex );
}
else
else
{
tracerCellsCrossFlow.push_back(cellActiveIndex);
tracerCellsCrossFlow.push_back( cellActiveIndex );
}
}
}
}
if (tracerCells.empty()) tracersWithCells.erase(wellName);
if (tracerCellsCrossFlow.empty()) tracersWithCells.erase(wellNameXf);
if ( tracerCells.empty() ) tracersWithCells.erase( wellName );
if ( tracerCellsCrossFlow.empty() ) tracersWithCells.erase( wellNameXf );
}
}
@@ -219,38 +217,42 @@ std::map<std::string, std::vector<int> > RimFlowDiagSolution::allTracerActiveCel
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusOverall(const QString& tracerName) const
RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusOverall( const QString& tracerName ) const
{
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfTypeAsserted(eclCase);
this->firstAncestorOrThisOfTypeAsserted( eclCase );
TracerStatusType tracerStatus = UNDEFINED;
if (eclCase && eclCase->eclipseCaseData())
if ( eclCase && eclCase->eclipseCaseData() )
{
const cvf::Collection<RigSimWellData>& simWellData = eclCase->eclipseCaseData()->wellResults();
for ( size_t wIdx = 0; wIdx < simWellData.size(); ++wIdx )
{
QString wellName = removeCrossFlowEnding(tracerName);
QString wellName = removeCrossFlowEnding( tracerName );
if ( simWellData[wIdx]->m_wellName != wellName ) continue;
tracerStatus = CLOSED;
for ( const RigWellResultFrame& wellResFrame : simWellData[wIdx]->m_wellCellsTimeSteps )
{
if ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR )
if ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR ||
wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR ||
wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR )
{
if ( tracerStatus == PRODUCER ) tracerStatus = VARYING;
else tracerStatus = INJECTOR;
if ( tracerStatus == PRODUCER )
tracerStatus = VARYING;
else
tracerStatus = INJECTOR;
}
else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER )
{
if ( tracerStatus == INJECTOR ) tracerStatus = VARYING;
else tracerStatus = PRODUCER;
if ( tracerStatus == INJECTOR )
tracerStatus = VARYING;
else
tracerStatus = PRODUCER;
}
if ( tracerStatus == VARYING ) break;
}
@@ -258,10 +260,12 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusOverall(c
break;
}
if (hasCrossFlowEnding(tracerName))
if ( hasCrossFlowEnding( tracerName ) )
{
if (tracerStatus == PRODUCER) tracerStatus = INJECTOR;
else if (tracerStatus == INJECTOR) tracerStatus = PRODUCER;
if ( tracerStatus == PRODUCER )
tracerStatus = INJECTOR;
else if ( tracerStatus == INJECTOR )
tracerStatus = PRODUCER;
}
}
@@ -269,44 +273,45 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusOverall(c
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusInTimeStep(const QString& tracerName, size_t timeStepIndex) const
RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusInTimeStep( const QString& tracerName,
size_t timeStepIndex ) const
{
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfTypeAsserted(eclCase);
this->firstAncestorOrThisOfTypeAsserted( eclCase );
if (eclCase && eclCase->eclipseCaseData())
if ( eclCase && eclCase->eclipseCaseData() )
{
const cvf::Collection<RigSimWellData>& simWellData = eclCase->eclipseCaseData()->wellResults();
for ( size_t wIdx = 0; wIdx < simWellData.size(); ++wIdx )
{
QString wellName = removeCrossFlowEnding(tracerName);
QString wellName = removeCrossFlowEnding( tracerName );
if ( simWellData[wIdx]->m_wellName != wellName ) continue;
if (!simWellData[wIdx]->hasWellResult(timeStepIndex)) return CLOSED;
if ( !simWellData[wIdx]->hasWellResult( timeStepIndex ) ) return CLOSED;
const RigWellResultFrame& wellResFrame = simWellData[wIdx]->wellResultFrame(timeStepIndex);
const RigWellResultFrame& wellResFrame = simWellData[wIdx]->wellResultFrame( timeStepIndex );
if ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR )
if ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR ||
wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR ||
wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR )
{
if ( hasCrossFlowEnding(tracerName) ) return PRODUCER;
if ( hasCrossFlowEnding( tracerName ) ) return PRODUCER;
return INJECTOR;
}
else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER
|| wellResFrame.m_productionType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE )
else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER ||
wellResFrame.m_productionType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE )
{
if ( hasCrossFlowEnding(tracerName) ) return INJECTOR;
if ( hasCrossFlowEnding( tracerName ) ) return INJECTOR;
return PRODUCER;
}
else
{
CVF_ASSERT(false);
CVF_ASSERT( false );
}
}
}
@@ -315,32 +320,31 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusInTimeSte
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
cvf::Color3f RimFlowDiagSolution::tracerColor(const QString& tracerName) const
cvf::Color3f RimFlowDiagSolution::tracerColor( const QString& tracerName ) const
{
QString wellName = removeCrossFlowEnding(tracerName);
QString wellName = removeCrossFlowEnding( tracerName );
if (wellName == RIG_FLOW_TOTAL_NAME) return cvf::Color3f::LIGHT_GRAY;
if (wellName == RIG_RESERVOIR_TRACER_NAME) return cvf::Color3f::LIGHT_GRAY;
if (wellName == RIG_TINY_TRACER_GROUP_NAME) return cvf::Color3f::DARK_GRAY;
if ( wellName == RIG_FLOW_TOTAL_NAME ) return cvf::Color3f::LIGHT_GRAY;
if ( wellName == RIG_RESERVOIR_TRACER_NAME ) return cvf::Color3f::LIGHT_GRAY;
if ( wellName == RIG_TINY_TRACER_GROUP_NAME ) return cvf::Color3f::DARK_GRAY;
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase);
this->firstAncestorOrThisOfType( eclCase );
if ( eclCase )
{
return eclCase->defaultWellColor(wellName);
return eclCase->defaultWellColor( wellName );
}
return cvf::Color3f::LIGHT_GRAY;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimFlowDiagSolution::userDescriptionField()
{
return &m_userDescription;
}