mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4683 clang-format on all files in ApplicationCode
This commit is contained in:
@@ -23,24 +23,25 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigWellPathFormations::RigWellPathFormations(const std::vector<RigWellPathFormation>& formations, const QString& filePath,
|
||||
const QString& key)
|
||||
RigWellPathFormations::RigWellPathFormations( const std::vector<RigWellPathFormation>& formations,
|
||||
const QString& filePath,
|
||||
const QString& key )
|
||||
{
|
||||
m_filePath = filePath;
|
||||
m_keyInFile = key;
|
||||
|
||||
for (const RigWellPathFormation& formation : formations)
|
||||
for ( const RigWellPathFormation& formation : formations )
|
||||
{
|
||||
if (isFluid(formation.formationName))
|
||||
if ( isFluid( formation.formationName ) )
|
||||
{
|
||||
m_fluids.push_back(formation);
|
||||
m_fluids.push_back( formation );
|
||||
}
|
||||
else
|
||||
{
|
||||
FormationLevel level = detectLevel(formation.formationName);
|
||||
FormationLevel level = detectLevel( formation.formationName );
|
||||
m_formationsLevelsPresent[level] = true;
|
||||
|
||||
m_formations.push_back(std::pair<RigWellPathFormation, FormationLevel>(formation, level));
|
||||
m_formations.push_back( std::pair<RigWellPathFormation, FormationLevel>( formation, level ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,60 +49,57 @@ RigWellPathFormations::RigWellPathFormations(const std::vector<RigWellPathFormat
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigWellPathFormations::depthAndFormationNamesWithoutDuplicatesOnDepth(std::vector<QString>* names,
|
||||
std::vector<double>* measuredDepths,
|
||||
RimWellLogPlot::DepthTypeEnum depthType) const
|
||||
void RigWellPathFormations::depthAndFormationNamesWithoutDuplicatesOnDepth( std::vector<QString>* names,
|
||||
std::vector<double>* measuredDepths,
|
||||
RimWellLogPlot::DepthTypeEnum depthType ) const
|
||||
{
|
||||
std::map<double, bool, DepthComp> tempMakeVectorUniqueOnMeasuredDepth;
|
||||
|
||||
if (depthType == RimWellLogPlot::MEASURED_DEPTH)
|
||||
if ( depthType == RimWellLogPlot::MEASURED_DEPTH )
|
||||
{
|
||||
for (const std::pair<RigWellPathFormation, FormationLevel>& formation : m_formations)
|
||||
for ( const std::pair<RigWellPathFormation, FormationLevel>& formation : m_formations )
|
||||
{
|
||||
if (!tempMakeVectorUniqueOnMeasuredDepth.count(formation.first.mdTop))
|
||||
if ( !tempMakeVectorUniqueOnMeasuredDepth.count( formation.first.mdTop ) )
|
||||
{
|
||||
measuredDepths->push_back(formation.first.mdTop);
|
||||
names->push_back(formation.first.formationName + " Top");
|
||||
measuredDepths->push_back( formation.first.mdTop );
|
||||
names->push_back( formation.first.formationName + " Top" );
|
||||
tempMakeVectorUniqueOnMeasuredDepth[formation.first.mdTop] = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (const std::pair<RigWellPathFormation, FormationLevel>& formation : m_formations)
|
||||
for ( const std::pair<RigWellPathFormation, FormationLevel>& formation : m_formations )
|
||||
{
|
||||
if (!tempMakeVectorUniqueOnMeasuredDepth.count(formation.first.mdBase))
|
||||
if ( !tempMakeVectorUniqueOnMeasuredDepth.count( formation.first.mdBase ) )
|
||||
{
|
||||
measuredDepths->push_back(formation.first.mdBase);
|
||||
names->push_back(formation.first.formationName + " Base");
|
||||
measuredDepths->push_back( formation.first.mdBase );
|
||||
names->push_back( formation.first.formationName + " Base" );
|
||||
tempMakeVectorUniqueOnMeasuredDepth[formation.first.mdBase] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH)
|
||||
else if ( depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH )
|
||||
{
|
||||
for (const std::pair<RigWellPathFormation, FormationLevel>& formation : m_formations)
|
||||
for ( const std::pair<RigWellPathFormation, FormationLevel>& formation : m_formations )
|
||||
{
|
||||
if (!tempMakeVectorUniqueOnMeasuredDepth.count(formation.first.tvdTop))
|
||||
if ( !tempMakeVectorUniqueOnMeasuredDepth.count( formation.first.tvdTop ) )
|
||||
{
|
||||
measuredDepths->push_back(formation.first.tvdTop);
|
||||
names->push_back(formation.first.formationName + " Top");
|
||||
measuredDepths->push_back( formation.first.tvdTop );
|
||||
names->push_back( formation.first.formationName + " Top" );
|
||||
tempMakeVectorUniqueOnMeasuredDepth[formation.first.tvdTop] = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (const std::pair<RigWellPathFormation, FormationLevel>& formation : m_formations)
|
||||
for ( const std::pair<RigWellPathFormation, FormationLevel>& formation : m_formations )
|
||||
{
|
||||
if (!tempMakeVectorUniqueOnMeasuredDepth.count(formation.first.tvdBase))
|
||||
if ( !tempMakeVectorUniqueOnMeasuredDepth.count( formation.first.tvdBase ) )
|
||||
{
|
||||
measuredDepths->push_back(formation.first.tvdBase);
|
||||
names->push_back(formation.first.formationName + " Base");
|
||||
measuredDepths->push_back( formation.first.tvdBase );
|
||||
names->push_back( formation.first.formationName + " Base" );
|
||||
tempMakeVectorUniqueOnMeasuredDepth[formation.first.tvdBase] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
for (const std::pair<RigWellPathFormation, FormationLevel>& formation : m_formations)
|
||||
{
|
||||
@@ -151,12 +149,14 @@ void RigWellPathFormations::depthAndFormationNamesWithoutDuplicatesOnDepth(std::
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigWellPathFormations::evaluateFormationsForOnePosition(
|
||||
const std::vector<std::pair<RigWellPathFormation, FormationLevel>>& formations,
|
||||
const FormationLevel& maxLevel, const PickPosition& position,
|
||||
std::map<double, LevelAndName, DepthComp>* uniqueListMaker, RimWellLogPlot::DepthTypeEnum depthType) const
|
||||
const FormationLevel& maxLevel,
|
||||
const PickPosition& position,
|
||||
std::map<double, LevelAndName, DepthComp>* uniqueListMaker,
|
||||
RimWellLogPlot::DepthTypeEnum depthType ) const
|
||||
{
|
||||
QString postFix;
|
||||
|
||||
if (position == TOP)
|
||||
if ( position == TOP )
|
||||
{
|
||||
postFix = " Top";
|
||||
}
|
||||
@@ -165,13 +165,13 @@ void RigWellPathFormations::evaluateFormationsForOnePosition(
|
||||
postFix = " Base";
|
||||
}
|
||||
|
||||
for (const std::pair<RigWellPathFormation, FormationLevel>& formation : formations)
|
||||
for ( const std::pair<RigWellPathFormation, FormationLevel>& formation : formations )
|
||||
{
|
||||
double depth;
|
||||
|
||||
if (depthType == RimWellLogPlot::MEASURED_DEPTH)
|
||||
if ( depthType == RimWellLogPlot::MEASURED_DEPTH )
|
||||
{
|
||||
if (position == TOP)
|
||||
if ( position == TOP )
|
||||
{
|
||||
depth = formation.first.mdTop;
|
||||
}
|
||||
@@ -180,9 +180,9 @@ void RigWellPathFormations::evaluateFormationsForOnePosition(
|
||||
depth = formation.first.mdBase;
|
||||
}
|
||||
}
|
||||
else if (depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH)
|
||||
else if ( depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH )
|
||||
{
|
||||
if (position == TOP)
|
||||
if ( position == TOP )
|
||||
{
|
||||
depth = formation.first.tvdTop;
|
||||
}
|
||||
@@ -191,13 +191,14 @@ void RigWellPathFormations::evaluateFormationsForOnePosition(
|
||||
depth = formation.first.tvdBase;
|
||||
}
|
||||
}
|
||||
else return;
|
||||
else
|
||||
return;
|
||||
|
||||
if (formation.second > maxLevel) continue;
|
||||
if ( formation.second > maxLevel ) continue;
|
||||
|
||||
if (!uniqueListMaker->count(depth) || uniqueListMaker->at(depth).level < formation.second)
|
||||
if ( !uniqueListMaker->count( depth ) || uniqueListMaker->at( depth ).level < formation.second )
|
||||
{
|
||||
(*uniqueListMaker)[depth] = LevelAndName(formation.second, formation.first.formationName + postFix);
|
||||
( *uniqueListMaker )[depth] = LevelAndName( formation.second, formation.first.formationName + postFix );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -205,94 +206,103 @@ void RigWellPathFormations::evaluateFormationsForOnePosition(
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigWellPathFormations::evaluateFormations(const std::vector<std::pair<RigWellPathFormation, FormationLevel>>& formations,
|
||||
const FormationLevel& maxLevel, std::vector<QString>* names,
|
||||
std::vector<double>* depths, RimWellLogPlot::DepthTypeEnum depthType) const
|
||||
void RigWellPathFormations::evaluateFormations( const std::vector<std::pair<RigWellPathFormation, FormationLevel>>& formations,
|
||||
const FormationLevel& maxLevel,
|
||||
std::vector<QString>* names,
|
||||
std::vector<double>* depths,
|
||||
RimWellLogPlot::DepthTypeEnum depthType ) const
|
||||
{
|
||||
std::map<double, LevelAndName, DepthComp> tempMakeVectorUniqueOnDepth;
|
||||
|
||||
evaluateFormationsForOnePosition(formations, maxLevel, PickPosition::TOP, &tempMakeVectorUniqueOnDepth, depthType);
|
||||
evaluateFormationsForOnePosition(formations, maxLevel, PickPosition::BASE, &tempMakeVectorUniqueOnDepth, depthType);
|
||||
evaluateFormationsForOnePosition( formations, maxLevel, PickPosition::TOP, &tempMakeVectorUniqueOnDepth, depthType );
|
||||
evaluateFormationsForOnePosition( formations, maxLevel, PickPosition::BASE, &tempMakeVectorUniqueOnDepth, depthType );
|
||||
|
||||
for (const std::pair<double, LevelAndName>& uniqueDepth : tempMakeVectorUniqueOnDepth)
|
||||
for ( const std::pair<double, LevelAndName>& uniqueDepth : tempMakeVectorUniqueOnDepth )
|
||||
{
|
||||
depths->push_back(uniqueDepth.first);
|
||||
names->push_back(uniqueDepth.second.name);
|
||||
depths->push_back( uniqueDepth.first );
|
||||
names->push_back( uniqueDepth.second.name );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigWellPathFormations::evaluateFluids(const std::vector<RigWellPathFormation>& fluidFormations, std::vector<QString>* names,
|
||||
std::vector<double>* depths, RimWellLogPlot::DepthTypeEnum depthType) const
|
||||
void RigWellPathFormations::evaluateFluids( const std::vector<RigWellPathFormation>& fluidFormations,
|
||||
std::vector<QString>* names,
|
||||
std::vector<double>* depths,
|
||||
RimWellLogPlot::DepthTypeEnum depthType ) const
|
||||
{
|
||||
std::map<double, QString, DepthComp> uniqueListMaker;
|
||||
|
||||
for (const RigWellPathFormation& formation : fluidFormations)
|
||||
for ( const RigWellPathFormation& formation : fluidFormations )
|
||||
{
|
||||
double depthBase;
|
||||
if (depthType == RimWellLogPlot::MEASURED_DEPTH)
|
||||
if ( depthType == RimWellLogPlot::MEASURED_DEPTH )
|
||||
{
|
||||
depthBase = formation.mdBase;
|
||||
}
|
||||
else if (depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH)
|
||||
else if ( depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH )
|
||||
{
|
||||
depthBase = formation.tvdBase;
|
||||
}
|
||||
else return;
|
||||
else
|
||||
return;
|
||||
|
||||
uniqueListMaker[depthBase] = formation.formationName + " Base";
|
||||
}
|
||||
|
||||
for (const RigWellPathFormation& formation : fluidFormations)
|
||||
for ( const RigWellPathFormation& formation : fluidFormations )
|
||||
{
|
||||
double depthTop;
|
||||
if (depthType == RimWellLogPlot::MEASURED_DEPTH)
|
||||
if ( depthType == RimWellLogPlot::MEASURED_DEPTH )
|
||||
{
|
||||
depthTop = formation.mdTop;
|
||||
}
|
||||
else if (depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH)
|
||||
else if ( depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH )
|
||||
{
|
||||
depthTop = formation.tvdTop;
|
||||
}
|
||||
else return;
|
||||
else
|
||||
return;
|
||||
|
||||
uniqueListMaker[depthTop] = formation.formationName + " Top";
|
||||
}
|
||||
|
||||
for (const std::pair<double, QString>& depthAndFormation : uniqueListMaker)
|
||||
for ( const std::pair<double, QString>& depthAndFormation : uniqueListMaker )
|
||||
{
|
||||
depths->push_back(depthAndFormation.first);
|
||||
names->push_back(depthAndFormation.second);
|
||||
depths->push_back( depthAndFormation.first );
|
||||
names->push_back( depthAndFormation.second );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigWellPathFormations::depthAndFormationNamesUpToLevel(FormationLevel level, std::vector<QString>* names, std::vector<double>* depths,
|
||||
bool includeFluids, RimWellLogPlot::DepthTypeEnum depthType) const
|
||||
void RigWellPathFormations::depthAndFormationNamesUpToLevel( FormationLevel level,
|
||||
std::vector<QString>* names,
|
||||
std::vector<double>* depths,
|
||||
bool includeFluids,
|
||||
RimWellLogPlot::DepthTypeEnum depthType ) const
|
||||
{
|
||||
names->clear();
|
||||
depths->clear();
|
||||
|
||||
if (includeFluids)
|
||||
if ( includeFluids )
|
||||
{
|
||||
evaluateFluids(m_fluids, names, depths, depthType);
|
||||
evaluateFluids( m_fluids, names, depths, depthType );
|
||||
}
|
||||
|
||||
if (level == RigWellPathFormations::NONE)
|
||||
if ( level == RigWellPathFormations::NONE )
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (level == RigWellPathFormations::ALL)
|
||||
else if ( level == RigWellPathFormations::ALL )
|
||||
{
|
||||
depthAndFormationNamesWithoutDuplicatesOnDepth(names, depths, depthType);
|
||||
depthAndFormationNamesWithoutDuplicatesOnDepth( names, depths, depthType );
|
||||
}
|
||||
else
|
||||
{
|
||||
evaluateFormations(m_formations, level, names, depths, depthType);
|
||||
evaluateFormations( m_formations, level, names, depths, depthType );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,9 +313,9 @@ std::vector<RigWellPathFormations::FormationLevel> RigWellPathFormations::format
|
||||
{
|
||||
std::vector<RigWellPathFormations::FormationLevel> formationLevels;
|
||||
|
||||
for (const std::pair<RigWellPathFormations::FormationLevel, bool>& formationLevel : m_formationsLevelsPresent)
|
||||
for ( const std::pair<RigWellPathFormations::FormationLevel, bool>& formationLevel : m_formationsLevelsPresent )
|
||||
{
|
||||
formationLevels.push_back(formationLevel.first);
|
||||
formationLevels.push_back( formationLevel.first );
|
||||
}
|
||||
return formationLevels;
|
||||
}
|
||||
@@ -337,11 +347,11 @@ size_t RigWellPathFormations::formationNamesCount() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigWellPathFormations::isFluid(QString formationName)
|
||||
bool RigWellPathFormations::isFluid( QString formationName )
|
||||
{
|
||||
formationName = formationName.trimmed();
|
||||
|
||||
if (formationName == "OIL" || formationName == "GAS" || formationName == "WATER")
|
||||
if ( formationName == "OIL" || formationName == "GAS" || formationName == "WATER" )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -351,82 +361,93 @@ bool RigWellPathFormations::isFluid(QString formationName)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigWellPathFormations::FormationLevel RigWellPathFormations::detectLevel(QString formationName)
|
||||
RigWellPathFormations::FormationLevel RigWellPathFormations::detectLevel( QString formationName )
|
||||
{
|
||||
formationName = formationName.trimmed();
|
||||
|
||||
bool isGroupName = true;
|
||||
for (QChar c : formationName)
|
||||
for ( QChar c : formationName )
|
||||
{
|
||||
if (c.isLower())
|
||||
if ( c.isLower() )
|
||||
{
|
||||
isGroupName = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isGroupName)
|
||||
if ( isGroupName )
|
||||
{
|
||||
return RigWellPathFormations::GROUP;
|
||||
}
|
||||
|
||||
QStringList formationNameSplitted = formationName.split(" ");
|
||||
QStringList formationNameSplitted = formationName.split( " " );
|
||||
|
||||
std::vector<QString> levelDesctiptorCandidates;
|
||||
|
||||
for (QString word : formationNameSplitted)
|
||||
for ( QString word : formationNameSplitted )
|
||||
{
|
||||
for (const QChar& c : word)
|
||||
for ( const QChar& c : word )
|
||||
{
|
||||
if (c.isDigit())
|
||||
if ( c.isDigit() )
|
||||
{
|
||||
levelDesctiptorCandidates.push_back(word);
|
||||
levelDesctiptorCandidates.push_back( word );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (levelDesctiptorCandidates.empty())
|
||||
if ( levelDesctiptorCandidates.empty() )
|
||||
{
|
||||
return RigWellPathFormations::LEVEL0;
|
||||
}
|
||||
|
||||
if (levelDesctiptorCandidates.size() > 1)
|
||||
if ( levelDesctiptorCandidates.size() > 1 )
|
||||
{
|
||||
for (auto it = levelDesctiptorCandidates.begin(); it != levelDesctiptorCandidates.end(); it++)
|
||||
for ( auto it = levelDesctiptorCandidates.begin(); it != levelDesctiptorCandidates.end(); it++ )
|
||||
{
|
||||
for (const QChar& c : *it)
|
||||
for ( const QChar& c : *it )
|
||||
{
|
||||
if (c.isLetter())
|
||||
if ( c.isLetter() )
|
||||
{
|
||||
levelDesctiptorCandidates.erase(it);
|
||||
levelDesctiptorCandidates.erase( it );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (levelDesctiptorCandidates.size() != 1) return RigWellPathFormations::UNKNOWN;
|
||||
if ( levelDesctiptorCandidates.size() != 1 ) return RigWellPathFormations::UNKNOWN;
|
||||
|
||||
QString levelDescriptor = levelDesctiptorCandidates[0];
|
||||
|
||||
QStringList joinedLevel = levelDescriptor.split('+');
|
||||
if (joinedLevel.size() > 1)
|
||||
QStringList joinedLevel = levelDescriptor.split( '+' );
|
||||
if ( joinedLevel.size() > 1 )
|
||||
{
|
||||
levelDescriptor = joinedLevel[0];
|
||||
}
|
||||
|
||||
int dotCount = levelDescriptor.count('.');
|
||||
int dotCount = levelDescriptor.count( '.' );
|
||||
|
||||
switch (dotCount)
|
||||
switch ( dotCount )
|
||||
{
|
||||
case 0: return RigWellPathFormations::LEVEL1;
|
||||
case 1: return RigWellPathFormations::LEVEL2;
|
||||
case 2: return RigWellPathFormations::LEVEL3;
|
||||
case 3: return RigWellPathFormations::LEVEL4;
|
||||
case 4: return RigWellPathFormations::LEVEL5;
|
||||
case 5: return RigWellPathFormations::LEVEL6;
|
||||
case 6: return RigWellPathFormations::LEVEL7;
|
||||
case 7: return RigWellPathFormations::LEVEL8;
|
||||
case 8: return RigWellPathFormations::LEVEL9;
|
||||
case 9: return RigWellPathFormations::LEVEL10;
|
||||
default: break;
|
||||
case 0:
|
||||
return RigWellPathFormations::LEVEL1;
|
||||
case 1:
|
||||
return RigWellPathFormations::LEVEL2;
|
||||
case 2:
|
||||
return RigWellPathFormations::LEVEL3;
|
||||
case 3:
|
||||
return RigWellPathFormations::LEVEL4;
|
||||
case 4:
|
||||
return RigWellPathFormations::LEVEL5;
|
||||
case 5:
|
||||
return RigWellPathFormations::LEVEL6;
|
||||
case 6:
|
||||
return RigWellPathFormations::LEVEL7;
|
||||
case 7:
|
||||
return RigWellPathFormations::LEVEL8;
|
||||
case 8:
|
||||
return RigWellPathFormations::LEVEL9;
|
||||
case 9:
|
||||
return RigWellPathFormations::LEVEL10;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return RigWellPathFormations::UNKNOWN;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user