Janitor : Remove duplicated code

This commit is contained in:
Magne Sjaastad 2021-05-26 12:35:20 +02:00
parent 9d58769f89
commit 098fda9816
5 changed files with 19 additions and 12 deletions

View File

@ -284,3 +284,16 @@ QString RiaDefines::defaultDirectoryLabel( RiaDefines::ImportFileType fileType )
return defaultDirLabel;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaDefines::isInjector( WellProductionType wellProductionType )
{
if ( wellProductionType == RiaDefines::WellProductionType::GAS_INJECTOR ||
wellProductionType == RiaDefines::WellProductionType::OIL_INJECTOR ||
wellProductionType == RiaDefines::WellProductionType::WATER_INJECTOR )
return true;
return false;
}

View File

@ -192,4 +192,6 @@ enum class WellProductionType : short
UNDEFINED_PRODUCTION_TYPE
};
bool isInjector( WellProductionType wellProductionType );
}; // namespace RiaDefines

View File

@ -316,9 +316,7 @@ void RivWellDiskPartMgr::buildWellDiskParts( size_t frameIndex, const caf::Displ
}
// Add visual indicator for well type injector
if ( productionType == RiaDefines::WellProductionType::OIL_INJECTOR ||
productionType == RiaDefines::WellProductionType::GAS_INJECTOR ||
productionType == RiaDefines::WellProductionType::WATER_INJECTOR )
if ( RiaDefines::isInjector( productionType ) )
{
cvf::GeometryBuilderFaceList builder;
cvf::Vec3f pos( 0.0, 0.0, 0.0 );

View File

@ -244,9 +244,7 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusOverall(
tracerStatus = TracerStatusType::CLOSED;
for ( const RigWellResultFrame& wellResFrame : simWellData[wIdx]->m_wellCellsTimeSteps )
{
if ( wellResFrame.m_productionType == RiaDefines::WellProductionType::GAS_INJECTOR ||
wellResFrame.m_productionType == RiaDefines::WellProductionType::OIL_INJECTOR ||
wellResFrame.m_productionType == RiaDefines::WellProductionType::WATER_INJECTOR )
if ( RiaDefines::isInjector( wellResFrame.m_productionType ) )
{
if ( tracerStatus == TracerStatusType::PRODUCER )
tracerStatus = TracerStatusType::VARYING;
@ -300,9 +298,7 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusInTimeSte
const RigWellResultFrame* wellResFrame = simWellData[wIdx]->wellResultFrame( timeStepIndex );
if ( wellResFrame->m_productionType == RiaDefines::WellProductionType::GAS_INJECTOR ||
wellResFrame->m_productionType == RiaDefines::WellProductionType::OIL_INJECTOR ||
wellResFrame->m_productionType == RiaDefines::WellProductionType::WATER_INJECTOR )
if ( RiaDefines::isInjector( wellResFrame->m_productionType ) )
{
if ( hasCrossFlowEnding( tracerName ) ) return TracerStatusType::PRODUCER;

View File

@ -103,9 +103,7 @@ bool RimSimWellInViewTools::isInjector( RimSimWellInView* well )
{
const RigWellResultFrame* wrf = wRes->wellResultFrame( currentTimeStep );
if ( wrf->m_productionType == RiaDefines::WellProductionType::OIL_INJECTOR ||
wrf->m_productionType == RiaDefines::WellProductionType::GAS_INJECTOR ||
wrf->m_productionType == RiaDefines::WellProductionType::WATER_INJECTOR )
if ( RiaDefines::isInjector( wrf->m_productionType ) )
{
return true;
}