#2227 Well formations: Remove fluids from Level type

This commit is contained in:
Rebecca Cox 2017-12-11 16:07:15 +01:00
parent fb876f8fdc
commit 3e5209d1a7
2 changed files with 75 additions and 61 deletions

View File

@ -33,10 +33,17 @@ RigWellPathFormations::RigWellPathFormations(const std::vector<RigWellPathFormat
for (const RigWellPathFormation& formation : formations) for (const RigWellPathFormation& formation : formations)
{ {
FormationLevel level = detectLevel(formation.formationName); if (isFluid(formation.formationName))
m_formationsLevelsPresent[level] = true; {
m_fluids.push_back(formation);
}
else
{
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));
}
} }
} }
@ -58,9 +65,6 @@ struct MeasuredDepthComp
void RigWellPathFormations::measuredDepthAndFormationNamesWithoutDuplicatesOnDepth(std::vector<QString>* names, void RigWellPathFormations::measuredDepthAndFormationNamesWithoutDuplicatesOnDepth(std::vector<QString>* names,
std::vector<double>* measuredDepths) const std::vector<double>* measuredDepths) const
{ {
names->clear();
measuredDepths->clear();
std::map<double, bool, MeasuredDepthComp> tempMakeVectorUniqueOnMeasuredDepth; std::map<double, bool, MeasuredDepthComp> tempMakeVectorUniqueOnMeasuredDepth;
for (const std::pair<RigWellPathFormation, FormationLevel>& formation : m_formations) for (const std::pair<RigWellPathFormation, FormationLevel>& formation : m_formations)
@ -96,18 +100,21 @@ struct LevelAndName
QString name; QString name;
}; };
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
enum PICK_POSITION enum PICK_POSITION
{ {
TOP, TOP,
BASE BASE
}; };
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void evaluateFormations(const std::vector<std::pair<RigWellPathFormation, RigWellPathFormations::FormationLevel>>& formations, void evaluateFormationsForOnePosition(const std::vector<std::pair<RigWellPathFormation, RigWellPathFormations::FormationLevel>>& formations,
const RigWellPathFormations::FormationLevel& maxLevel, const RigWellPathFormations::FormationLevel& maxLevel, const PICK_POSITION& position,
bool includeFluids, const PICK_POSITION& position, std::map<double, LevelAndName, MeasuredDepthComp>* uniqueListMaker)
std::map<double, LevelAndName, MeasuredDepthComp>* uniqueListMaker)
{ {
QString postFix; QString postFix;
@ -132,15 +139,6 @@ void evaluateFormations(const std::vector<std::pair<RigWellPathFormation, RigWel
md = formation.first.mdBase; md = formation.first.mdBase;
} }
if (formation.second == RigWellPathFormations::FLUID)
{
if (includeFluids)
{
(*uniqueListMaker)[md] = LevelAndName(formation.second, formation.first.formationName + postFix);
}
continue;
}
if (formation.second > maxLevel) continue; if (formation.second > maxLevel) continue;
if (!uniqueListMaker->count(md) || uniqueListMaker->at(md).level < formation.second) if (!uniqueListMaker->count(md) || uniqueListMaker->at(md).level < formation.second)
@ -150,25 +148,42 @@ void evaluateFormations(const std::vector<std::pair<RigWellPathFormation, RigWel
} }
} }
void evaluateFluids(const std::vector<std::pair<RigWellPathFormation, RigWellPathFormations::FormationLevel>>& formations, void evaluateFormations(const std::vector<std::pair<RigWellPathFormation, RigWellPathFormations::FormationLevel>>& formations,
std::map<double, LevelAndName, MeasuredDepthComp>* uniqueListMaker) const RigWellPathFormations::FormationLevel& maxLevel,
std::vector<QString>* names, std::vector<double>* measuredDepths)
{ {
for (const std::pair<RigWellPathFormation, RigWellPathFormations::FormationLevel>& formation : formations) std::map<double, LevelAndName, MeasuredDepthComp> tempMakeVectorUniqueOnMeasuredDepth;
evaluateFormationsForOnePosition(formations, maxLevel, PICK_POSITION::TOP, &tempMakeVectorUniqueOnMeasuredDepth);
evaluateFormationsForOnePosition(formations, maxLevel, PICK_POSITION::BASE, &tempMakeVectorUniqueOnMeasuredDepth);
for (auto it = tempMakeVectorUniqueOnMeasuredDepth.begin(); it != tempMakeVectorUniqueOnMeasuredDepth.end(); it++)
{ {
if (formation.second == RigWellPathFormations::FLUID) measuredDepths->push_back(it->first);
{ names->push_back(it->second.name);
(*uniqueListMaker)[formation.first.mdBase] = }
LevelAndName(formation.second, formation.first.formationName + " Base"); }
}
void evaluateFluids(const std::vector<RigWellPathFormation>& fluidFormations,
std::vector<QString>* names, std::vector<double>* measuredDepths)
{
std::map<double, QString, MeasuredDepthComp> uniqueListMaker;
for (const RigWellPathFormation& formation : fluidFormations)
{
uniqueListMaker[formation.mdBase] = formation.formationName + " Base";
} }
for (const std::pair<RigWellPathFormation, RigWellPathFormations::FormationLevel>& formation : formations) for (const RigWellPathFormation& formation : fluidFormations)
{ {
if (formation.second == RigWellPathFormations::FLUID) uniqueListMaker[formation.mdTop] = formation.formationName + " Top";
{ }
(*uniqueListMaker)[formation.first.mdTop] =
LevelAndName(formation.second, formation.first.formationName + " Top"); for (auto it = uniqueListMaker.begin(); it != uniqueListMaker.end(); it++)
} {
measuredDepths->push_back(it->first);
names->push_back(it->second);
} }
} }
@ -182,34 +197,22 @@ void RigWellPathFormations::measuredDepthAndFormationNamesUpToLevel(FormationLev
names->clear(); names->clear();
measuredDepths->clear(); measuredDepths->clear();
std::map<double, LevelAndName, MeasuredDepthComp> tempMakeVectorUniqueOnMeasuredDepth; if (includeFluids)
{
evaluateFluids(m_fluids, names, measuredDepths);
}
if (maxLevel == RigWellPathFormations::NONE) if (maxLevel == RigWellPathFormations::NONE)
{ {
if (includeFluids) return;
{
evaluateFluids(m_formations, &tempMakeVectorUniqueOnMeasuredDepth);
}
else
{
return;
}
} }
else if (maxLevel == RigWellPathFormations::ALL) else if (maxLevel == RigWellPathFormations::ALL)
{ {
measuredDepthAndFormationNamesWithoutDuplicatesOnDepth(names, measuredDepths); measuredDepthAndFormationNamesWithoutDuplicatesOnDepth(names, measuredDepths);
return;
} }
else else
{ {
evaluateFormations(m_formations, maxLevel, includeFluids, PICK_POSITION::TOP, &tempMakeVectorUniqueOnMeasuredDepth); evaluateFormations(m_formations, maxLevel, names, measuredDepths);
evaluateFormations(m_formations, maxLevel, includeFluids, PICK_POSITION::BASE, &tempMakeVectorUniqueOnMeasuredDepth);
}
for (auto it = tempMakeVectorUniqueOnMeasuredDepth.begin(); it != tempMakeVectorUniqueOnMeasuredDepth.end(); it++)
{
measuredDepths->push_back(it->first);
names->push_back(it->second.name);
} }
} }
@ -248,7 +251,21 @@ QString RigWellPathFormations::keyInFile() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
size_t RigWellPathFormations::formationNamesCount() const size_t RigWellPathFormations::formationNamesCount() const
{ {
return m_formations.size(); return m_formations.size() + m_fluids.size();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RigWellPathFormations::isFluid(QString formationName)
{
formationName = formationName.trimmed();
if (formationName == "OIL" || formationName == "GAS" || formationName == "WATER")
{
return true;
}
return false;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -258,11 +275,6 @@ RigWellPathFormations::FormationLevel RigWellPathFormations::detectLevel(QString
{ {
formationName = formationName.trimmed(); formationName = formationName.trimmed();
if (formationName == "OIL" || formationName == "GAS" || formationName == "WATER")
{
return RigWellPathFormations::FLUID;
}
bool isGroupName = true; bool isGroupName = true;
for (QChar c : formationName) for (QChar c : formationName)
{ {

View File

@ -39,12 +39,9 @@ class RigWellPathFormations : public cvf::Object
public: public:
RigWellPathFormations(const std::vector<RigWellPathFormation>& formations, const QString& filePath, const QString& key); RigWellPathFormations(const std::vector<RigWellPathFormation>& formations, const QString& filePath, const QString& key);
void measuredDepthAndFormationNamesWithoutDuplicatesOnDepth(std::vector<QString>* names,
std::vector<double>* measuredDepths) const;
enum FormationLevel enum FormationLevel
{ {
GROUP, LEVEL0, LEVEL1, LEVEL2, LEVEL3, LEVEL4, LEVEL5, LEVEL6, LEVEL7, LEVEL8, LEVEL9, LEVEL10, ALL, FLUID, UNKNOWN, NONE GROUP, LEVEL0, LEVEL1, LEVEL2, LEVEL3, LEVEL4, LEVEL5, LEVEL6, LEVEL7, LEVEL8, LEVEL9, LEVEL10, ALL, UNKNOWN, NONE
}; };
void measuredDepthAndFormationNamesUpToLevel(FormationLevel level, std::vector<QString>* names, void measuredDepthAndFormationNamesUpToLevel(FormationLevel level, std::vector<QString>* names,
@ -58,6 +55,10 @@ public:
size_t formationNamesCount() const; size_t formationNamesCount() const;
private: private:
void measuredDepthAndFormationNamesWithoutDuplicatesOnDepth(std::vector<QString>* names,
std::vector<double>* measuredDepths) const;
bool isFluid(QString formationName);
FormationLevel detectLevel(QString formationName); FormationLevel detectLevel(QString formationName);
private: private:
@ -67,4 +68,5 @@ private:
std::map<FormationLevel, bool> m_formationsLevelsPresent; std::map<FormationLevel, bool> m_formationsLevelsPresent;
std::vector<std::pair<RigWellPathFormation, FormationLevel>> m_formations; std::vector<std::pair<RigWellPathFormation, FormationLevel>> m_formations;
std::vector<RigWellPathFormation> m_fluids;
}; };