Janitor : Use enum class

This commit is contained in:
Magne Sjaastad 2021-05-18 15:31:40 +02:00
parent d4f4f20e6e
commit 78e4e1cd5c
4 changed files with 32 additions and 29 deletions

View File

@ -32,26 +32,26 @@ namespace caf
template<>
void RicExportCompletionDataSettingsUi::ExportSplitType::setUp()
{
addItem(RicExportCompletionDataSettingsUi::UNIFIED_FILE, "UNIFIED_FILE", "Unified File");
addItem(RicExportCompletionDataSettingsUi::SPLIT_ON_WELL, "SPLIT_ON_WELL", "Split on Well");
addItem(RicExportCompletionDataSettingsUi::SPLIT_ON_WELL_AND_COMPLETION_TYPE, "SPLIT_ON_WELL_AND_COMPLETION_TYPE", "Split on Well and Completion Type");
setDefault(RicExportCompletionDataSettingsUi::SPLIT_ON_WELL_AND_COMPLETION_TYPE);
addItem(RicExportCompletionDataSettingsUi::ExportSplit::UNIFIED_FILE, "UNIFIED_FILE", "Unified File");
addItem(RicExportCompletionDataSettingsUi::ExportSplit::SPLIT_ON_WELL, "SPLIT_ON_WELL", "Split on Well");
addItem(RicExportCompletionDataSettingsUi::ExportSplit::SPLIT_ON_WELL_AND_COMPLETION_TYPE, "SPLIT_ON_WELL_AND_COMPLETION_TYPE", "Split on Well and Completion Type");
setDefault(RicExportCompletionDataSettingsUi::ExportSplit::SPLIT_ON_WELL_AND_COMPLETION_TYPE);
}
template<>
void RicExportCompletionDataSettingsUi::CompdatExportType::setUp()
{
addItem(RicExportCompletionDataSettingsUi::TRANSMISSIBILITIES, "TRANSMISSIBILITIES", "Calculated Transmissibilities");
addItem(RicExportCompletionDataSettingsUi::WPIMULT_AND_DEFAULT_CONNECTION_FACTORS, "WPIMULT_AND_DEFAULT_CONNECTION_FACTORS", "Default Connection Factors and WPIMULT (Fractures Not Supported)");
setDefault(RicExportCompletionDataSettingsUi::TRANSMISSIBILITIES);
addItem(RicExportCompletionDataSettingsUi::CompdatExport::TRANSMISSIBILITIES, "TRANSMISSIBILITIES", "Calculated Transmissibilities");
addItem(RicExportCompletionDataSettingsUi::CompdatExport::WPIMULT_AND_DEFAULT_CONNECTION_FACTORS, "WPIMULT_AND_DEFAULT_CONNECTION_FACTORS", "Default Connection Factors and WPIMULT (Fractures Not Supported)");
setDefault(RicExportCompletionDataSettingsUi::CompdatExport::TRANSMISSIBILITIES);
}
template<>
void RicExportCompletionDataSettingsUi::CombinationModeType::setUp()
{
addItem(RicExportCompletionDataSettingsUi::INDIVIDUALLY, "INDIVIDUALLY", "Individually");
addItem(RicExportCompletionDataSettingsUi::COMBINED, "COMBINED", "Combined");
setDefault(RicExportCompletionDataSettingsUi::INDIVIDUALLY);
addItem(RicExportCompletionDataSettingsUi::CombinationMode::INDIVIDUALLY, "INDIVIDUALLY", "Individually");
addItem(RicExportCompletionDataSettingsUi::CombinationMode::COMBINED, "COMBINED", "Combined");
setDefault(RicExportCompletionDataSettingsUi::CombinationMode::INDIVIDUALLY);
}
template<>
@ -199,7 +199,7 @@ void RicExportCompletionDataSettingsUi::showFishbonesInUi( bool enable )
//--------------------------------------------------------------------------------------------------
bool RicExportCompletionDataSettingsUi::reportCompletionsTypesIndividually() const
{
return m_reportCompletionTypesSeparately() == INDIVIDUALLY;
return m_reportCompletionTypesSeparately() == CombinationMode::INDIVIDUALLY;
}
//--------------------------------------------------------------------------------------------------
@ -270,11 +270,11 @@ void RicExportCompletionDataSettingsUi::fieldChangedByUi( const caf::PdmFieldHan
{
if ( changedField == &compdatExport )
{
if ( compdatExport == WPIMULT_AND_DEFAULT_CONNECTION_FACTORS )
if ( compdatExport == CompdatExport::WPIMULT_AND_DEFAULT_CONNECTION_FACTORS )
{
includeFractures = false;
}
else if ( compdatExport == TRANSMISSIBILITIES || includeMsw )
else if ( compdatExport == CompdatExport::TRANSMISSIBILITIES || includeMsw )
{
includeFractures = true;
}
@ -385,7 +385,7 @@ void RicExportCompletionDataSettingsUi::defineUiOrdering( QString uiConfigName,
group->add( &m_reportCompletionTypesSeparately );
group->add( &folder );
if ( fileSplit() == UNIFIED_FILE )
if ( fileSplit() == ExportSplit::UNIFIED_FILE )
{
group->add( &m_useCustomFileName );
@ -453,8 +453,8 @@ void RicExportCompletionDataSettingsUi::defineUiOrdering( QString uiConfigName,
}
// Set visibility
includeFractures.uiCapability()->setUiHidden( compdatExport == WPIMULT_AND_DEFAULT_CONNECTION_FACTORS &&
!includeMsw );
includeFractures.uiCapability()->setUiHidden(
compdatExport == CompdatExport::WPIMULT_AND_DEFAULT_CONNECTION_FACTORS && !includeMsw );
}
if ( !m_displayForSimWell )

View File

@ -34,7 +34,7 @@ class RicExportCompletionDataSettingsUi : public RicCaseAndFileExportSettingsUi
public:
// Exported in .proto file. Do not change without changing .proto
enum ExportSplit
enum class ExportSplit
{
UNIFIED_FILE,
SPLIT_ON_WELL,
@ -43,7 +43,7 @@ public:
typedef caf::AppEnum<ExportSplit> ExportSplitType;
// Exported in .proto file. Do not change without changing .proto
enum CompdatExport
enum class CompdatExport
{
TRANSMISSIBILITIES,
WPIMULT_AND_DEFAULT_CONNECTION_FACTORS,
@ -51,7 +51,7 @@ public:
typedef caf::AppEnum<CompdatExport> CompdatExportType;
// Exported in .proto file. Do not change without changing .proto
enum CombinationMode
enum class CombinationMode
{
INDIVIDUALLY,
COMBINED,

View File

@ -269,7 +269,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
const QString eclipseCaseName = exportSettings.caseToApply->caseUserDescription();
if ( exportSettings.fileSplit == RicExportCompletionDataSettingsUi::UNIFIED_FILE )
if ( exportSettings.fileSplit == RicExportCompletionDataSettingsUi::ExportSplit::UNIFIED_FILE )
{
QString fileName = exportSettings.customFileName();
if ( fileName.isEmpty() ) fileName = QString( "UnifiedCompletions_%1" ).arg( eclipseCaseName );
@ -283,7 +283,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
exportSettings.exportDataSourceAsComment(),
exportSettings.exportWelspec() );
}
else if ( exportSettings.fileSplit == RicExportCompletionDataSettingsUi::SPLIT_ON_WELL )
else if ( exportSettings.fileSplit == RicExportCompletionDataSettingsUi::ExportSplit::SPLIT_ON_WELL )
{
for ( auto wellPath : topLevelWellPaths )
{
@ -318,7 +318,8 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
exportSettings.exportWelspec() );
}
}
else if ( exportSettings.fileSplit == RicExportCompletionDataSettingsUi::SPLIT_ON_WELL_AND_COMPLETION_TYPE )
else if ( exportSettings.fileSplit ==
RicExportCompletionDataSettingsUi::ExportSplit::SPLIT_ON_WELL_AND_COMPLETION_TYPE )
{
std::vector<RigCompletionData::CompletionType> completionTypes;
completionTypes.push_back( RigCompletionData::CompletionType::FISHBONES );
@ -380,8 +381,8 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
}
// Export sim wells
if ( exportSettings.fileSplit == RicExportCompletionDataSettingsUi::SPLIT_ON_WELL ||
exportSettings.fileSplit == RicExportCompletionDataSettingsUi::SPLIT_ON_WELL_AND_COMPLETION_TYPE )
if ( exportSettings.fileSplit == RicExportCompletionDataSettingsUi::ExportSplit::SPLIT_ON_WELL ||
exportSettings.fileSplit == RicExportCompletionDataSettingsUi::ExportSplit::SPLIT_ON_WELL_AND_COMPLETION_TYPE )
{
for ( auto simWell : simWells )
{
@ -568,7 +569,7 @@ RigCompletionData RicWellPathExportCompletionDataFeatureImpl::combineEclipseCell
combinedDFactor = dFactorCalculator.weightedMean() / completions.size();
}
if ( settings.compdatExport == RicExportCompletionDataSettingsUi::TRANSMISSIBILITIES )
if ( settings.compdatExport == RicExportCompletionDataSettingsUi::CompdatExport::TRANSMISSIBILITIES )
{
resultCompletion.setCombinedValuesExplicitTrans( combinedTrans,
combinedKh,
@ -578,7 +579,8 @@ RigCompletionData RicWellPathExportCompletionDataFeatureImpl::combineEclipseCell
cellDirection,
completionType );
}
else if ( settings.compdatExport == RicExportCompletionDataSettingsUi::WPIMULT_AND_DEFAULT_CONNECTION_FACTORS )
else if ( settings.compdatExport ==
RicExportCompletionDataSettingsUi::CompdatExport::WPIMULT_AND_DEFAULT_CONNECTION_FACTORS )
{
// calculate trans for main bore - but as Eclipse will do it!
double transmissibilityEclipseCalculation =
@ -954,7 +956,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompdatAndWpimultTables(
QString gridName = gridCompletions.first;
exportCompdatTableUsingFormatter( formatter, gridName, completions );
if ( exportType == RicExportCompletionDataSettingsUi::WPIMULT_AND_DEFAULT_CONNECTION_FACTORS )
if ( exportType == RicExportCompletionDataSettingsUi::CompdatExport::WPIMULT_AND_DEFAULT_CONNECTION_FACTORS )
{
exportWpimultTableUsingFormatter( formatter, gridName, completions );
}

View File

@ -68,7 +68,7 @@ void RicWellPathExportMswCompletionsImpl::exportWellSegmentsForAllCompletions(
{
std::shared_ptr<QFile> unifiedExportFile;
std::shared_ptr<QFile> unifiedLgrExportFile;
if ( exportSettings.fileSplit() == RicExportCompletionDataSettingsUi::UNIFIED_FILE )
if ( exportSettings.fileSplit() == RicExportCompletionDataSettingsUi::ExportSplit::UNIFIED_FILE )
{
{
QString fileName;
@ -115,7 +115,8 @@ void RicWellPathExportMswCompletionsImpl::exportWellSegmentsForAllCompletions(
completion->componentType() == RiaDefines::WellPathComponentType::FISHBONES;
} );
if ( exportSettings.fileSplit() == RicExportCompletionDataSettingsUi::SPLIT_ON_WELL && !unifiedWellPathFile )
if ( exportSettings.fileSplit() == RicExportCompletionDataSettingsUi::ExportSplit::SPLIT_ON_WELL &&
!unifiedWellPathFile )
{
QString wellFileName = QString( "%1_UnifiedCompletions_MSW_%2" )
.arg( wellPath->name(), exportSettings.caseToApply->caseUserDescription() );