Janitor : Use const ref when possible

This commit is contained in:
Magne Sjaastad 2019-11-03 12:19:24 +01:00
parent 93f6bc8c72
commit b46124efd7
19 changed files with 64 additions and 62 deletions

View File

@ -53,7 +53,9 @@ void RiaImageFileCompare::reset()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaImageFileCompare::runComparison( QString imgFileName, QString refFileName, QString diffFileName )
bool RiaImageFileCompare::runComparison( const QString& imgFileName,
const QString& refFileName,
const QString& diffFileName )
{
reset();

View File

@ -39,7 +39,7 @@ public:
explicit RiaImageFileCompare( QString compareExecutable );
~RiaImageFileCompare();
bool runComparison( QString imgFileName, QString refFileName, QString diffFileName );
bool runComparison( const QString& imgFileName, const QString& refFileName, const QString& diffFileName );
bool imagesEqual() const;
ErrorType error() const;
QString errorMessage() const;

View File

@ -110,7 +110,7 @@ void RicfCommandFileExecutor::executeCommands( QTextStream& stream )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicfCommandFileExecutor::setExportPath( ExportType type, QString path )
void RicfCommandFileExecutor::setExportPath( ExportType type, const QString& path )
{
m_exportPaths[type] = path;
}

View File

@ -53,7 +53,7 @@ public:
~RicfCommandFileExecutor();
void executeCommands( QTextStream& stream );
void setExportPath( ExportType type, QString path );
void setExportPath( ExportType type, const QString& path );
QString getExportPath( ExportType type ) const;
void setLastProjectPath( const QString& path );
QString getLastProjectPath() const;

View File

@ -47,7 +47,7 @@
struct WellBorePartForTransCalc
{
WellBorePartForTransCalc(
cvf::Vec3d lengthsInCell, double wellRadius, double skinFactor, bool isMainBore, QString metaData )
cvf::Vec3d lengthsInCell, double wellRadius, double skinFactor, bool isMainBore, const QString& metaData )
: lengthsInCell( lengthsInCell )
, wellRadius( wellRadius )
, skinFactor( skinFactor )

View File

@ -126,8 +126,8 @@ void RicWellPathFractureReportItem::setUnitSystem( RiaEclipseUnitTools::UnitSyst
///
//--------------------------------------------------------------------------------------------------
void RicWellPathFractureReportItem::setPressureDepletionParameters( bool performPDDScaling,
QString timeStepString,
QString wbhpString,
const QString& timeStepString,
const QString& wbhpString,
double userWBHP,
double actualWBHP,
double minPressureDrop,

View File

@ -39,8 +39,8 @@ public:
void setAreaWeightedPermeability( double permeability );
void setUnitSystem( RiaEclipseUnitTools::UnitSystem unitSystem );
void setPressureDepletionParameters( bool performPressureDepletionScaling,
QString timeStepString,
QString wbhpString,
const QString& timeStepString,
const QString& wbhpString,
double userWBHP,
double actualWBHP,
double minPressureDrop,

View File

@ -136,8 +136,8 @@ class IjkBoundingBox
public:
IjkBoundingBox()
: m_min( {MAX_SIZE_T, MAX_SIZE_T, MAX_SIZE_T} )
, m_max( {MAX_SIZE_T, MAX_SIZE_T, MAX_SIZE_T} )
: m_min( { MAX_SIZE_T, MAX_SIZE_T, MAX_SIZE_T } )
, m_max( { MAX_SIZE_T, MAX_SIZE_T, MAX_SIZE_T } )
{
}
@ -172,7 +172,7 @@ public:
{
if ( !isValid() )
{
m_min = m_max = {i, j, k};
m_min = m_max = { i, j, k };
}
else
{
@ -370,7 +370,7 @@ void RicExportLgrFeature::writeLgrs( QTextStream& stream, const std::vector<LgrI
RifTextDataTableFormatter formatter( stream );
formatter.comment( QString( "LGR: " ) + lgrInfo.name );
formatter.keyword( "CARFIN" );
formatter.header( {RifTextDataTableColumn( "Name" ),
formatter.header( { RifTextDataTableColumn( "Name" ),
RifTextDataTableColumn( "I1" ),
RifTextDataTableColumn( "I2" ),
RifTextDataTableColumn( "J1" ),
@ -379,7 +379,7 @@ void RicExportLgrFeature::writeLgrs( QTextStream& stream, const std::vector<LgrI
RifTextDataTableColumn( "K2" ),
RifTextDataTableColumn( "NX" ),
RifTextDataTableColumn( "NY" ),
RifTextDataTableColumn( "NZ" )} );
RifTextDataTableColumn( "NZ" ) } );
formatter.add( lgrInfo.name );
formatter.addOneBasedCellIndex( lgrInfo.mainGridStartCell.i() );
@ -553,7 +553,7 @@ std::vector<LgrInfo>
for ( const auto& intersectionCell : intersectingCells )
{
auto lgrName = lgrNameFactory.newName( "", lgrId );
lgrs.push_back( buildLgr( lgrId++, lgrName, eclipseCase, wellPath->name(), {intersectionCell}, lgrSizes ) );
lgrs.push_back( buildLgr( lgrId++, lgrName, eclipseCase, wellPath->name(), { intersectionCell }, lgrSizes ) );
}
return lgrs;
}
@ -724,7 +724,7 @@ std::vector<RigCompletionDataGridCell>
std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>>
RicExportLgrFeature::cellsIntersectingCompletions_PerCompletion(
RimEclipseCase* eclipseCase,
const std::vector<RimWellPath*> wellPaths,
const std::vector<RimWellPath*>& wellPaths,
size_t timeStep,
const std::set<RigCompletionData::CompletionType>& completionTypes,
QStringList* wellsIntersectingOtherLgrs )
@ -944,9 +944,9 @@ const RigGridBase* RicExportLgrFeature::hostGrid( const RigMainGrid* mainGrid, s
//--------------------------------------------------------------------------------------------------
LgrNameFactory::LgrNameFactory()
{
m_counters = {{RigCompletionData::FRACTURE, {"FRAC", 1}},
{RigCompletionData::FISHBONES, {"FB", 1}},
{RigCompletionData::PERFORATION, {"PERF", 1}}};
m_counters = { { RigCompletionData::FRACTURE, { "FRAC", 1 } },
{ RigCompletionData::FISHBONES, { "FB", 1 } },
{ RigCompletionData::PERFORATION, { "PERF", 1 } } };
}
//--------------------------------------------------------------------------------------------------

View File

@ -232,7 +232,7 @@ private:
static std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>>
cellsIntersectingCompletions_PerCompletion( RimEclipseCase* eclipseCase,
const std::vector<RimWellPath*> wellPaths,
const std::vector<RimWellPath*>& wellPaths,
size_t timeStep,
const std::set<RigCompletionData::CompletionType>& completionTypes,
QStringList* wellsIntersectingOtherLgrs );

View File

@ -208,7 +208,7 @@ bool RicImportSummaryCasesFeature::createSummaryCasesFromFiles( const QStringLis
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicImportSummaryCasesFeature::addSummaryCases( const std::vector<RimSummaryCase*> cases )
void RicImportSummaryCasesFeature::addSummaryCases( const std::vector<RimSummaryCase*>& cases )
{
RiaApplication* app = RiaApplication::instance();
RimProject* proj = app->project();
@ -223,7 +223,7 @@ void RicImportSummaryCasesFeature::addSummaryCases( const std::vector<RimSummary
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicImportSummaryCasesFeature::addCasesToGroupIfRelevant( const std::vector<RimSummaryCase*> cases )
void RicImportSummaryCasesFeature::addCasesToGroupIfRelevant( const std::vector<RimSummaryCase*>& cases )
{
std::vector<RimSummaryCaseCollection*> selectedColl = caf::selectedObjectsByTypeStrict<RimSummaryCaseCollection*>();

View File

@ -44,8 +44,8 @@ public:
static bool createSummaryCasesFromFiles( const QStringList& fileName,
std::vector<RimSummaryCase*>* newCases,
bool ensembleOrGroup = false );
static void addSummaryCases( const std::vector<RimSummaryCase*> cases );
static void addCasesToGroupIfRelevant( const std::vector<RimSummaryCase*> cases );
static void addSummaryCases( const std::vector<RimSummaryCase*>& cases );
static void addCasesToGroupIfRelevant( const std::vector<RimSummaryCase*>& cases );
static QStringList runRecursiveSummaryCaseFileSearchDialog( const QString& dialogTitle, const QString& pathCacheName );

View File

@ -145,8 +145,8 @@ public:
RicSummaryCaseRestartDialogResult( Status _status,
RicSummaryCaseRestartDialog::ImportOptions _summaryImportOption,
RicSummaryCaseRestartDialog::ImportOptions _gridImportOption,
QStringList _summaryFiles,
QStringList _gridFiles,
const QStringList& _summaryFiles,
const QStringList& _gridFiles,
bool _applyToAll )
: status( _status )
, summaryImportOption( _summaryImportOption )

View File

@ -286,7 +286,7 @@ std::set<QDateTime>
///
//--------------------------------------------------------------------------------------------------
std::set<QDateTime> RifReaderEclipseRft::availableTimeSteps(
const QString& wellName, const std::set<RifEclipseRftAddress::RftWellLogChannelType> relevantChannels )
const QString& wellName, const std::set<RifEclipseRftAddress::RftWellLogChannelType>& relevantChannels )
{
if ( !m_ecl_rft_file )
{

View File

@ -50,7 +50,7 @@ public:
std::set<QDateTime> availableTimeSteps( const QString& wellName ) override;
std::set<QDateTime>
availableTimeSteps( const QString& wellName,
const std::set<RifEclipseRftAddress::RftWellLogChannelType> relevantChannels ) override;
const std::set<RifEclipseRftAddress::RftWellLogChannelType>& relevantChannels ) override;
std::set<QDateTime> availableTimeSteps( const QString& wellName,
const RifEclipseRftAddress::RftWellLogChannelType& wellLogChannelName ) override;

View File

@ -59,10 +59,10 @@ std::set<RifEclipseRftAddress> RifReaderEnsembleStatisticsRft::eclipseRftAddress
}
else if ( regularAddress.wellLogChannel() == RifEclipseRftAddress::PRESSURE )
{
std::set<RifEclipseRftAddress::RftWellLogChannelType> statChannels = {RifEclipseRftAddress::PRESSURE_P10,
std::set<RifEclipseRftAddress::RftWellLogChannelType> statChannels = { RifEclipseRftAddress::PRESSURE_P10,
RifEclipseRftAddress::PRESSURE_P50,
RifEclipseRftAddress::PRESSURE_P90,
RifEclipseRftAddress::PRESSURE_MEAN};
RifEclipseRftAddress::PRESSURE_MEAN };
for ( auto channel : statChannels )
{
statisticsAddresses.insert(
@ -132,7 +132,7 @@ std::set<QDateTime> RifReaderEnsembleStatisticsRft::availableTimeSteps(
///
//--------------------------------------------------------------------------------------------------
std::set<QDateTime> RifReaderEnsembleStatisticsRft::availableTimeSteps(
const QString& wellName, const std::set<RifEclipseRftAddress::RftWellLogChannelType> relevantChannels )
const QString& wellName, const std::set<RifEclipseRftAddress::RftWellLogChannelType>& relevantChannels )
{
std::set<QDateTime> allTimeSteps;
for ( auto summaryCase : m_summaryCaseCollection->allSummaryCases() )

View File

@ -37,7 +37,7 @@ public:
const RifEclipseRftAddress::RftWellLogChannelType& wellLogChannelName ) override;
std::set<QDateTime>
availableTimeSteps( const QString& wellName,
const std::set<RifEclipseRftAddress::RftWellLogChannelType> relevantChannels ) override;
const std::set<RifEclipseRftAddress::RftWellLogChannelType>& relevantChannels ) override;
std::set<RifEclipseRftAddress::RftWellLogChannelType> availableWellLogChannels( const QString& wellName ) override;
std::set<QString> wellNames() override;

View File

@ -330,7 +330,7 @@ std::set<QDateTime> RifReaderFmuRft::availableTimeSteps( const QString& wellName
auto it = m_allWellObservations.find( wellName );
if ( it != m_allWellObservations.end() )
{
return {it->second.dateTime};
return { it->second.dateTime };
}
return {};
}
@ -340,7 +340,7 @@ std::set<QDateTime> RifReaderFmuRft::availableTimeSteps( const QString& wellName
//--------------------------------------------------------------------------------------------------
std::set<QDateTime>
RifReaderFmuRft::availableTimeSteps( const QString& wellName,
const std::set<RifEclipseRftAddress::RftWellLogChannelType> relevantChannels )
const std::set<RifEclipseRftAddress::RftWellLogChannelType>& relevantChannels )
{
if ( relevantChannels.count( RifEclipseRftAddress::TVD ) || relevantChannels.count( RifEclipseRftAddress::MD ) ||
relevantChannels.count( RifEclipseRftAddress::PRESSURE ) )
@ -362,7 +362,7 @@ std::set<RifEclipseRftAddress::RftWellLogChannelType> RifReaderFmuRft::available
if ( !m_allWellObservations.empty() )
{
return {RifEclipseRftAddress::TVD, RifEclipseRftAddress::MD, RifEclipseRftAddress::PRESSURE};
return { RifEclipseRftAddress::TVD, RifEclipseRftAddress::MD, RifEclipseRftAddress::PRESSURE };
}
return {};
}

View File

@ -76,7 +76,7 @@ public:
std::set<QDateTime>
availableTimeSteps( const QString& wellName,
const std::set<RifEclipseRftAddress::RftWellLogChannelType> relevantChannels ) override;
const std::set<RifEclipseRftAddress::RftWellLogChannelType>& relevantChannels ) override;
std::set<QDateTime> availableTimeSteps( const QString& wellName ) override;
std::set<QDateTime> availableTimeSteps( const QString& wellName,
const RifEclipseRftAddress::RftWellLogChannelType& wellLogChannelName ) override;

View File

@ -35,7 +35,7 @@ public:
virtual std::set<QDateTime>
availableTimeSteps( const QString& wellName,
const std::set<RifEclipseRftAddress::RftWellLogChannelType> relevantChannels ) = 0;
const std::set<RifEclipseRftAddress::RftWellLogChannelType>& relevantChannels ) = 0;
virtual std::set<QDateTime> availableTimeSteps( const QString& wellName ) = 0;
virtual std::set<QDateTime>
availableTimeSteps( const QString& wellName,