Janitor : Use enum class

This commit is contained in:
Magne Sjaastad 2021-05-26 10:56:21 +02:00
parent 19d650f619
commit 3fca5f15ae
18 changed files with 100 additions and 90 deletions

View File

@ -183,4 +183,13 @@ enum class RINavigationPolicy : short
NAVIGATION_POLICY_RMS
};
enum class WellProductionType : short
{
PRODUCER,
OIL_INJECTOR,
GAS_INJECTOR,
WATER_INJECTOR,
UNDEFINED_PRODUCTION_TYPE
};
}; // namespace RiaDefines

View File

@ -188,8 +188,9 @@ std::vector<QString>
{
RimFlowDiagSolution::TracerStatusType requestedTracerType = RimFlowDiagSolution::TracerStatusType::UNDEFINED;
const RigWellResultFrame::WellProductionType prodType = simWellData->wellProductionType( timeStep );
if ( prodType == RigWellResultFrame::PRODUCER || prodType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE )
const RiaDefines::WellProductionType prodType = simWellData->wellProductionType( timeStep );
if ( prodType == RiaDefines::WellProductionType::PRODUCER ||
prodType == RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE )
{
requestedTracerType = RimFlowDiagSolution::TracerStatusType::INJECTOR;
}

View File

@ -1684,23 +1684,23 @@ void RifReaderEclipseOutput::readWellCells( const ecl_grid_type* mainEclGrid, bo
well_type_enum ert_well_type = well_state_get_type( ert_well_state );
if ( ert_well_type == ECL_WELL_PRODUCER )
{
wellResFrame.m_productionType = RigWellResultFrame::PRODUCER;
wellResFrame.m_productionType = RiaDefines::WellProductionType::PRODUCER;
}
else if ( ert_well_type == ECL_WELL_WATER_INJECTOR )
{
wellResFrame.m_productionType = RigWellResultFrame::WATER_INJECTOR;
wellResFrame.m_productionType = RiaDefines::WellProductionType::WATER_INJECTOR;
}
else if ( ert_well_type == ECL_WELL_GAS_INJECTOR )
{
wellResFrame.m_productionType = RigWellResultFrame::GAS_INJECTOR;
wellResFrame.m_productionType = RiaDefines::WellProductionType::GAS_INJECTOR;
}
else if ( ert_well_type == ECL_WELL_OIL_INJECTOR )
{
wellResFrame.m_productionType = RigWellResultFrame::OIL_INJECTOR;
wellResFrame.m_productionType = RiaDefines::WellProductionType::OIL_INJECTOR;
}
else
{
wellResFrame.m_productionType = RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE;
wellResFrame.m_productionType = RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE;
}
wellResFrame.m_isOpen = well_state_is_open( ert_well_state );

View File

@ -435,19 +435,19 @@ void RivSimWellPipesPartMgr::updatePipeResultColor( size_t frameIndex )
{
switch ( wResFrame.m_productionType )
{
case RigWellResultFrame::PRODUCER:
case RiaDefines::WellProductionType::PRODUCER:
cellState = producerState;
break;
case RigWellResultFrame::OIL_INJECTOR:
case RiaDefines::WellProductionType::OIL_INJECTOR:
cellState = hcInjectorState;
break;
case RigWellResultFrame::GAS_INJECTOR:
case RiaDefines::WellProductionType::GAS_INJECTOR:
cellState = hcInjectorState;
break;
case RigWellResultFrame::WATER_INJECTOR:
case RiaDefines::WellProductionType::WATER_INJECTOR:
cellState = waterInjectorState;
break;
case RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE:
case RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE:
cellState = defaultState;
break;
}

View File

@ -64,11 +64,11 @@ void RivWellConnectionsPartMgr::appendDynamicGeometryPartsToModel( cvf::ModelBas
if ( !m_rimWell->simWellData()->hasWellResult( frameIndex ) ) return;
if ( !m_rimWell->simWellData()->wellResultFrame( frameIndex ).m_isOpen ) return;
if ( m_rimWell->simWellData()->wellResultFrame( frameIndex ).m_productionType ==
RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE )
RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE )
return;
bool isProducer =
( m_rimWell->simWellData()->wellResultFrame( frameIndex ).m_productionType == RigWellResultFrame::PRODUCER );
bool isProducer = ( m_rimWell->simWellData()->wellResultFrame( frameIndex ).m_productionType ==
RiaDefines::WellProductionType::PRODUCER );
double pipeRadius = m_rimWell->pipeRadius();
cvf::Vec3d wellHeadTop;
@ -133,11 +133,11 @@ void RivWellConnectionsPartMgr::appendDynamicGeometryPartsToModel( cvf::ModelBas
if ( !otherWell->simWellData()->hasWellResult( frameIndex ) ) continue;
if ( !otherWell->simWellData()->wellResultFrame( frameIndex ).m_isOpen ) continue;
if ( otherWell->simWellData()->wellResultFrame( frameIndex ).m_productionType ==
RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE )
RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE )
continue;
bool isOtherProducer =
( otherWell->simWellData()->wellResultFrame( frameIndex ).m_productionType == RigWellResultFrame::PRODUCER );
bool isOtherProducer = ( otherWell->simWellData()->wellResultFrame( frameIndex ).m_productionType ==
RiaDefines::WellProductionType::PRODUCER );
{
std::string otherWellName = otherWell->name().toStdString();

View File

@ -315,8 +315,9 @@ void RivWellDiskPartMgr::buildWellDiskParts( size_t frameIndex, const caf::Displ
}
// Add visual indicator for well type injector
if ( productionType == RigWellResultFrame::OIL_INJECTOR || productionType == RigWellResultFrame::GAS_INJECTOR ||
productionType == RigWellResultFrame::WATER_INJECTOR )
if ( productionType == RiaDefines::WellProductionType::OIL_INJECTOR ||
productionType == RiaDefines::WellProductionType::GAS_INJECTOR ||
productionType == RiaDefines::WellProductionType::WATER_INJECTOR )
{
cvf::GeometryBuilderFaceList builder;
cvf::Vec3f pos( 0.0, 0.0, 0.0 );
@ -514,17 +515,17 @@ RimSimWellInViewCollection* RivWellDiskPartMgr::simWellInViewCollection()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Color4f RivWellDiskPartMgr::getWellInjectionColor( RigWellResultFrame::WellProductionType productionType )
cvf::Color4f RivWellDiskPartMgr::getWellInjectionColor( RiaDefines::WellProductionType productionType )
{
if ( productionType == RigWellResultFrame::OIL_INJECTOR )
if ( productionType == RiaDefines::WellProductionType::OIL_INJECTOR )
{
return cvf::Color4f( cvf::Color3::ORANGE );
}
else if ( productionType == RigWellResultFrame::GAS_INJECTOR )
else if ( productionType == RiaDefines::WellProductionType::GAS_INJECTOR )
{
return cvf::Color4f( cvf::Color3::RED );
}
else if ( productionType == RigWellResultFrame::WATER_INJECTOR )
else if ( productionType == RiaDefines::WellProductionType::WATER_INJECTOR )
{
return cvf::Color4f( cvf::Color3::BLUE );
}

View File

@ -18,12 +18,11 @@
#pragma once
#include "RigWellResultPoint.h"
#include "cafPdmPointer.h"
#include "cvfObject.h"
#include "cvfString.h"
#include "cvfVector3.h"
namespace cvf
{
@ -39,9 +38,15 @@ namespace caf
class DisplayCoordTransform;
}
namespace RiaDefines
{
enum class WellProductionType : short;
}
class Rim3dView;
class RimSimWellInView;
class RimSimWellInViewCollection;
class RigWellResultFrame;
class RivWellDiskPartMgr : public cvf::Object
{
@ -65,7 +70,7 @@ private:
Rim3dView* viewWithSettings();
RimSimWellInViewCollection* simWellInViewCollection();
static cvf::Color4f getWellInjectionColor( RigWellResultFrame::WellProductionType productionType );
static cvf::Color4f getWellInjectionColor( RiaDefines::WellProductionType productionType );
static QString formatNumber( double num );
static double baseScaleFactor();

View File

@ -191,7 +191,7 @@ void RivWellHeadPartMgr::buildWellHeadParts( size_t f
textPosition.z() += 1.2 * arrowLength;
cvf::Mat4f matr;
if ( wellResultFrame.m_productionType != RigWellResultFrame::PRODUCER )
if ( wellResultFrame.m_productionType != RiaDefines::WellProductionType::PRODUCER )
{
matr = cvf::Mat4f::fromRotation( cvf::Vec3f( 1.0f, 0.0f, 0.0f ), cvf::Math::toRadians( 180.0f ) );
}
@ -205,7 +205,7 @@ void RivWellHeadPartMgr::buildWellHeadParts( size_t f
matr( 1, 1 ) *= ijScaleFactor;
matr( 2, 2 ) *= arrowLength;
if ( wellResultFrame.m_productionType != RigWellResultFrame::PRODUCER )
if ( wellResultFrame.m_productionType != RiaDefines::WellProductionType::PRODUCER )
{
arrowPosition.z() += arrowLength;
}
@ -253,19 +253,19 @@ void RivWellHeadPartMgr::buildWellHeadParts( size_t f
{
if ( wellResultFrame.m_isOpen )
{
if ( wellResultFrame.m_productionType == RigWellResultFrame::PRODUCER )
if ( wellResultFrame.m_productionType == RiaDefines::WellProductionType::PRODUCER )
{
headColor = cvf::Color4f( cvf::Color3::GREEN );
}
else if ( wellResultFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR )
else if ( wellResultFrame.m_productionType == RiaDefines::WellProductionType::OIL_INJECTOR )
{
headColor = cvf::Color4f( cvf::Color3::ORANGE );
}
else if ( wellResultFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR )
else if ( wellResultFrame.m_productionType == RiaDefines::WellProductionType::GAS_INJECTOR )
{
headColor = cvf::Color4f( cvf::Color3::RED );
}
else if ( wellResultFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR )
else if ( wellResultFrame.m_productionType == RiaDefines::WellProductionType::WATER_INJECTOR )
{
headColor = cvf::Color4f( cvf::Color3::BLUE );
}

View File

@ -209,16 +209,16 @@ cvf::Color3f RivWellSpheresPartMgr::wellCellColor( const RigWellResultFrame& wel
{
switch ( wellResultFrame.m_productionType )
{
case RigWellResultFrame::PRODUCER:
case RiaDefines::WellProductionType::PRODUCER:
cellColor = cvf::Color3f::GREEN;
break;
case RigWellResultFrame::OIL_INJECTOR:
case RiaDefines::WellProductionType::OIL_INJECTOR:
cellColor = cvf::Color3f::RED;
break;
case RigWellResultFrame::GAS_INJECTOR:
case RiaDefines::WellProductionType::GAS_INJECTOR:
cellColor = cvf::Color3f::RED;
break;
case RigWellResultFrame::WATER_INJECTOR:
case RiaDefines::WellProductionType::WATER_INJECTOR:
cellColor = cvf::Color3f::BLUE;
break;
}

View File

@ -179,8 +179,9 @@ std::map<std::string, std::vector<int>> RimFlowDiagSolution::allTracerActiveCell
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 );
bool isInjectorWell =
( wellResFrame.m_productionType != RiaDefines::WellProductionType::PRODUCER &&
wellResFrame.m_productionType != RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE );
std::string wellName = simWellData[wIdx]->m_wellName.toStdString();
std::string wellNameXf = addCrossFlowEnding( simWellData[wIdx]->m_wellName ).toStdString();
@ -242,16 +243,16 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusOverall(
tracerStatus = TracerStatusType::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 == RiaDefines::WellProductionType::GAS_INJECTOR ||
wellResFrame.m_productionType == RiaDefines::WellProductionType::OIL_INJECTOR ||
wellResFrame.m_productionType == RiaDefines::WellProductionType::WATER_INJECTOR )
{
if ( tracerStatus == TracerStatusType::PRODUCER )
tracerStatus = TracerStatusType::VARYING;
else
tracerStatus = TracerStatusType::INJECTOR;
}
else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER )
else if ( wellResFrame.m_productionType == RiaDefines::WellProductionType::PRODUCER )
{
if ( tracerStatus == TracerStatusType::INJECTOR )
tracerStatus = TracerStatusType::VARYING;
@ -298,16 +299,16 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusInTimeSte
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 == RiaDefines::WellProductionType::GAS_INJECTOR ||
wellResFrame.m_productionType == RiaDefines::WellProductionType::OIL_INJECTOR ||
wellResFrame.m_productionType == RiaDefines::WellProductionType::WATER_INJECTOR )
{
if ( hasCrossFlowEnding( tracerName ) ) return TracerStatusType::PRODUCER;
return TracerStatusType::INJECTOR;
}
else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER ||
wellResFrame.m_productionType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE )
else if ( wellResFrame.m_productionType == RiaDefines::WellProductionType::PRODUCER ||
wellResFrame.m_productionType == RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE )
{
if ( hasCrossFlowEnding( tracerName ) ) return TracerStatusType::INJECTOR;

View File

@ -260,9 +260,9 @@ void RimWellAllocationPlot::updateFromWell()
if ( tracerFractionCellValues.size() )
{
bool isProducer =
( simWellData->wellProductionType( m_timeStep ) == RigWellResultFrame::PRODUCER ||
simWellData->wellProductionType( m_timeStep ) == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE );
bool isProducer = ( simWellData->wellProductionType( m_timeStep ) == RiaDefines::WellProductionType::PRODUCER ||
simWellData->wellProductionType( m_timeStep ) ==
RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE );
RigEclCellIndexCalculator cellIdxCalc( m_case->eclipseCaseData()->mainGrid(),
m_case->eclipseCaseData()->activeCellInfo(
RiaDefines::PorosityModelType::MATRIX_MODEL ) );
@ -444,8 +444,9 @@ std::map<QString, const std::vector<double>*>
{
RimFlowDiagSolution::TracerStatusType requestedTracerType = RimFlowDiagSolution::TracerStatusType::UNDEFINED;
const RigWellResultFrame::WellProductionType prodType = simWellData->wellProductionType( m_timeStep );
if ( prodType == RigWellResultFrame::PRODUCER || prodType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE )
const RiaDefines::WellProductionType prodType = simWellData->wellProductionType( m_timeStep );
if ( prodType == RiaDefines::WellProductionType::PRODUCER ||
prodType == RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE )
{
requestedTracerType = RimFlowDiagSolution::TracerStatusType::INJECTOR;
}
@ -593,23 +594,23 @@ QString RimWellAllocationPlot::wellStatusTextForTimeStep( const QString&
{
const RigWellResultFrame& wellResultFrame = simWellData->wellResultFrame( timeStep );
RigWellResultFrame::WellProductionType prodType = wellResultFrame.m_productionType;
RiaDefines::WellProductionType prodType = wellResultFrame.m_productionType;
switch ( prodType )
{
case RigWellResultFrame::PRODUCER:
case RiaDefines::WellProductionType::PRODUCER:
statusText = "Producer";
break;
case RigWellResultFrame::OIL_INJECTOR:
case RiaDefines::WellProductionType::OIL_INJECTOR:
statusText = "Oil Injector";
break;
case RigWellResultFrame::GAS_INJECTOR:
case RiaDefines::WellProductionType::GAS_INJECTOR:
statusText = "Gas Injector";
break;
case RigWellResultFrame::WATER_INJECTOR:
case RiaDefines::WellProductionType::WATER_INJECTOR:
statusText = "Water Injector";
break;
case RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE:
case RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE:
break;
default:
break;

View File

@ -102,9 +102,9 @@ bool RimSimWellInViewTools::isInjector( RimSimWellInView* well )
{
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 == RiaDefines::WellProductionType::OIL_INJECTOR ||
wrf.m_productionType == RiaDefines::WellProductionType::GAS_INJECTOR ||
wrf.m_productionType == RiaDefines::WellProductionType::WATER_INJECTOR )
{
return true;
}

View File

@ -409,11 +409,11 @@ void RimStreamlineInViewCollection::findStartCells( int
if ( point.isValid() && point.m_isOpen )
{
RigCell cell = grids[point.m_gridIndex]->cell( point.m_gridCellIndex );
if ( frame.m_productionType == RigWellResultFrame::WellProductionType::PRODUCER )
if ( frame.m_productionType == RiaDefines::WellProductionType::PRODUCER )
{
outProducerCells.push_back( std::pair<QString, RigCell>( swdata->m_wellName, cell ) );
}
else if ( frame.m_productionType != RigWellResultFrame::WellProductionType::UNDEFINED_PRODUCTION_TYPE )
else if ( frame.m_productionType != RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE )
{
outInjectorCells.push_back( std::pair<QString, RigCell>( swdata->m_wellName, cell ) );
}

View File

@ -400,7 +400,7 @@ void RigReservoirBuilderMock::addWellData( RigEclipseCaseData* eclipseCase, RigG
{
RigWellResultFrame& wellCells = wellCellsTimeHistory->m_wellCellsTimeSteps[timeIdx];
wellCells.m_productionType = RigWellResultFrame::PRODUCER;
wellCells.m_productionType = RiaDefines::WellProductionType::PRODUCER;
wellCells.m_isOpen = true;
wellCells.m_wellHead.m_gridIndex = 0;

View File

@ -311,7 +311,7 @@ bool RigSimWellData::isMultiSegmentWell() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigWellResultFrame::WellProductionType RigSimWellData::wellProductionType( size_t resultTimeStepIndex ) const
RiaDefines::WellProductionType RigSimWellData::wellProductionType( size_t resultTimeStepIndex ) const
{
if ( hasWellResult( resultTimeStepIndex ) )
{
@ -320,7 +320,7 @@ RigWellResultFrame::WellProductionType RigSimWellData::wellProductionType( size_
}
else
{
return RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE;
return RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE;
}
}

View File

@ -41,9 +41,9 @@ public:
bool hasWellResult( size_t resultTimeStepIndex ) const;
bool hasAnyValidCells( size_t resultTimeStepIndex ) const;
const RigWellResultFrame& wellResultFrame( size_t resultTimeStepIndex ) const;
bool isOpen( size_t resultTimeStepIndex ) const;
RigWellResultFrame::WellProductionType wellProductionType( size_t resultTimeStepIndex ) const;
const RigWellResultFrame& wellResultFrame( size_t resultTimeStepIndex ) const;
bool isOpen( size_t resultTimeStepIndex ) const;
RiaDefines::WellProductionType wellProductionType( size_t resultTimeStepIndex ) const;
const RigWellResultFrame& staticWellCells() const;

View File

@ -18,6 +18,8 @@
#pragma once
#include "RiaDefines.h"
#include "cvfVector3.h"
#include <QDateTime>
@ -83,19 +85,9 @@ struct RigWellResultBranch
//==================================================================================================
class RigWellResultFrame
{
public:
enum WellProductionType
{
PRODUCER,
OIL_INJECTOR,
GAS_INJECTOR,
WATER_INJECTOR,
UNDEFINED_PRODUCTION_TYPE
};
public:
RigWellResultFrame()
: m_productionType( UNDEFINED_PRODUCTION_TYPE )
: m_productionType( RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE )
, m_isOpen( false )
{
}
@ -103,11 +95,11 @@ public:
const RigWellResultPoint* findResultCellWellHeadIncluded( size_t gridIndex, size_t gridCellIndex ) const;
const RigWellResultPoint* findResultCellWellHeadExcluded( size_t gridIndex, size_t gridCellIndex ) const;
RigWellResultPoint wellHeadOrStartCell() const;
WellProductionType m_productionType;
bool m_isOpen;
RigWellResultPoint m_wellHead;
QDateTime m_timestamp;
RigWellResultPoint wellHeadOrStartCell() const;
RiaDefines::WellProductionType m_productionType;
bool m_isOpen;
RigWellResultPoint m_wellHead;
QDateTime m_timestamp;
std::vector<RigWellResultBranch> m_wellResultBranches;
};

View File

@ -176,16 +176,16 @@ public:
{
switch ( currentWellResult->wellResultFrame( tsIdx ).m_productionType )
{
case RigWellResultFrame::PRODUCER:
case RiaDefines::WellProductionType::PRODUCER:
wellType = "Producer";
break;
case RigWellResultFrame::OIL_INJECTOR:
case RiaDefines::WellProductionType::OIL_INJECTOR:
wellType = "OilInjector";
break;
case RigWellResultFrame::WATER_INJECTOR:
case RiaDefines::WellProductionType::WATER_INJECTOR:
wellType = "WaterInjector";
break;
case RigWellResultFrame::GAS_INJECTOR:
case RiaDefines::WellProductionType::GAS_INJECTOR:
wellType = "GasInjector";
break;
}