mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2227 Well formation: Make level filter dynamic
This commit is contained in:
parent
fa3d9c4fc2
commit
406c371682
@ -94,7 +94,9 @@ namespace caf
|
||||
addItem(RigWellPathFormation::LEVEL1, "LEVEL1", "Level 1");
|
||||
addItem(RigWellPathFormation::LEVEL2, "LEVEL2", "Level 2");
|
||||
addItem(RigWellPathFormation::LEVEL3, "LEVEL3", "Level 3");
|
||||
setDefault(RigWellPathFormation::ALL);
|
||||
addItem(RigWellPathFormation::LEVEL4, "LEVEL4", "Level 4");
|
||||
addItem(RigWellPathFormation::LEVEL5, "LEVEL5", "Level 5");
|
||||
addItem(RigWellPathFormation::LEVEL6, "LEVEL6", "Level 6");
|
||||
}
|
||||
}
|
||||
|
||||
@ -349,6 +351,27 @@ QList<caf::PdmOptionItemInfo> RimWellLogTrack::calculateValueOptions(const caf::
|
||||
auto simulationWellBranches = RiaSimWellBranchTools::simulationWellBranches(m_formationSimWellName(), m_formationBranchDetection);
|
||||
options = RiaSimWellBranchTools::valueOptionsForBranchIndexField(simulationWellBranches);
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_formationLevel)
|
||||
{
|
||||
if (m_formationWellPath)
|
||||
{
|
||||
const RigWellPathFormations* formations = m_formationWellPath->formationsGeometry();
|
||||
if (formations)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(caf::AppEnum<RigWellPathFormation::FormationLevel>::uiText(RigWellPathFormation::ALL),
|
||||
caf::AppEnum<RigWellPathFormation::FormationLevel>::fromText("All")));
|
||||
|
||||
for (const RigWellPathFormation::FormationLevel& level : formations->formationsLevelsPresent())
|
||||
{
|
||||
size_t index = caf::AppEnum<RigWellPathFormation::FormationLevel>::index(level);
|
||||
if (index >= caf::AppEnum<RigWellPathFormation::FormationLevel>::size()) continue;
|
||||
|
||||
options.push_back(caf::PdmOptionItemInfo(caf::AppEnum<RigWellPathFormation::FormationLevel>::uiTextFromIndex(index),
|
||||
caf::AppEnum<RigWellPathFormation::FormationLevel>::fromIndex(index)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
@ -768,8 +791,11 @@ void RimWellLogTrack::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
||||
else if (m_formationSource() == WELL_PICK_FILTER)
|
||||
{
|
||||
formationGroup->add(&m_formationWellPath);
|
||||
formationGroup->add(&m_formationLevel);
|
||||
formationGroup->add(&m_showformationFluids);
|
||||
if (m_formationWellPath())
|
||||
{
|
||||
formationGroup->add(&m_formationLevel);
|
||||
formationGroup->add(&m_showformationFluids);
|
||||
}
|
||||
}
|
||||
|
||||
uiOrderingForVisibleXRange(uiOrdering);
|
||||
@ -1106,6 +1132,8 @@ void RimWellLogTrack::setFormationFieldsUiReadOnly(bool readOnly /*= true*/)
|
||||
m_formationCase.uiCapability()->setUiReadOnly(readOnly);
|
||||
m_formationWellPath.uiCapability()->setUiReadOnly(readOnly);
|
||||
m_formationBranchIndex.uiCapability()->setUiReadOnly(readOnly);
|
||||
m_formationLevel.uiCapability()->setUiReadOnly(readOnly);
|
||||
m_showformationFluids.uiCapability()->setUiReadOnly(readOnly);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -31,16 +31,12 @@ RigWellPathFormations::RigWellPathFormations(std::vector<RigWellPathFormation> f
|
||||
m_filePath = filePath;
|
||||
m_keyInFile = key;
|
||||
m_formations = formations;
|
||||
m_maxLevelDetected = RigWellPathFormation::ALL;
|
||||
|
||||
for (RigWellPathFormation& formation : m_formations)
|
||||
{
|
||||
RigWellPathFormation::FormationLevel level = detectLevel(formation.formationName);
|
||||
formation.level = level;
|
||||
if (level > m_maxLevelDetected)
|
||||
{
|
||||
m_maxLevelDetected = level;
|
||||
}
|
||||
formation.level = level;
|
||||
m_formationsLevelsPresent[level] = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,90 +84,112 @@ void RigWellPathFormations::measuredDepthAndFormationNamesWithoutDuplicatesOnDep
|
||||
}
|
||||
}
|
||||
|
||||
struct NameAndMD
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
struct LevelAndName
|
||||
{
|
||||
NameAndMD(RigWellPathFormation::FormationLevel level, QString name, double md) : m_level(level), m_name(name), m_md(md) {}
|
||||
NameAndMD() {}
|
||||
RigWellPathFormation::FormationLevel m_level;
|
||||
QString m_name;
|
||||
double m_md;
|
||||
LevelAndName() {}
|
||||
LevelAndName(RigWellPathFormation::FormationLevel level, QString name) : level(level), name(name) {}
|
||||
|
||||
RigWellPathFormation::FormationLevel level;
|
||||
QString name;
|
||||
};
|
||||
|
||||
enum PICK_POSITION
|
||||
{
|
||||
TOP,
|
||||
BASE
|
||||
};
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void evaluateFormations(const std::vector<RigWellPathFormation>& formations, const RigWellPathFormation::FormationLevel& maxLevel,
|
||||
bool includeFluids, const PICK_POSITION& position,
|
||||
std::map<double, LevelAndName, MeasuredDepthComp>* uniqueListMaker)
|
||||
{
|
||||
QString postFix;
|
||||
|
||||
if (position == TOP)
|
||||
{
|
||||
postFix = " Top";
|
||||
}
|
||||
else
|
||||
{
|
||||
postFix = " Base";
|
||||
}
|
||||
|
||||
for (const RigWellPathFormation& formation : formations)
|
||||
{
|
||||
double md;
|
||||
if (position == TOP)
|
||||
{
|
||||
md = formation.mdTop;
|
||||
}
|
||||
else
|
||||
{
|
||||
md = formation.mdBase;
|
||||
}
|
||||
|
||||
if (formation.level == RigWellPathFormation::FLUIDS)
|
||||
{
|
||||
if (includeFluids)
|
||||
{
|
||||
(*uniqueListMaker)[md] = LevelAndName(formation.level, formation.formationName + postFix);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (formation.level > maxLevel) continue;
|
||||
|
||||
if (!uniqueListMaker->count(md) || uniqueListMaker->at(md).level < formation.level)
|
||||
{
|
||||
(*uniqueListMaker)[md] = LevelAndName(formation.level, formation.formationName + postFix);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigWellPathFormations::measuredDepthAndFormationNamesUpToLevel(RigWellPathFormation::FormationLevel level,
|
||||
void RigWellPathFormations::measuredDepthAndFormationNamesUpToLevel(RigWellPathFormation::FormationLevel maxLevel,
|
||||
std::vector<QString>* names,
|
||||
std::vector<double>* measuredDepths, bool includeFluids) const
|
||||
{
|
||||
names->clear();
|
||||
measuredDepths->clear();
|
||||
|
||||
if (level == RigWellPathFormation::ALL)
|
||||
if (maxLevel == RigWellPathFormation::ALL)
|
||||
{
|
||||
measuredDepthAndFormationNamesWithoutDuplicatesOnDepth(names, measuredDepths);
|
||||
return;
|
||||
}
|
||||
|
||||
std::map<double, NameAndMD, MeasuredDepthComp> tempMakeVectorUniqueOnMeasuredDepth;
|
||||
std::map<double, LevelAndName, MeasuredDepthComp> tempMakeVectorUniqueOnMeasuredDepth;
|
||||
|
||||
for (RigWellPathFormation formation : m_formations)
|
||||
{
|
||||
if (formation.level == RigWellPathFormation::FLUIDS)
|
||||
{
|
||||
if (includeFluids)
|
||||
{
|
||||
tempMakeVectorUniqueOnMeasuredDepth[formation.mdTop] =
|
||||
NameAndMD(formation.level, formation.formationName + " Top", formation.mdTop);
|
||||
}
|
||||
else continue;
|
||||
}
|
||||
evaluateFormations(m_formations, maxLevel, includeFluids, PICK_POSITION::TOP, &tempMakeVectorUniqueOnMeasuredDepth);
|
||||
|
||||
if (level < formation.level) continue;
|
||||
|
||||
if (!tempMakeVectorUniqueOnMeasuredDepth.count(formation.mdTop) ||
|
||||
tempMakeVectorUniqueOnMeasuredDepth.at(formation.mdTop).m_level < formation.level)
|
||||
{
|
||||
tempMakeVectorUniqueOnMeasuredDepth[formation.mdTop] =
|
||||
NameAndMD(formation.level, formation.formationName + " Top", formation.mdTop);
|
||||
}
|
||||
}
|
||||
|
||||
for (RigWellPathFormation formation : m_formations)
|
||||
{
|
||||
if (formation.level == RigWellPathFormation::FLUIDS)
|
||||
{
|
||||
if (includeFluids)
|
||||
{
|
||||
tempMakeVectorUniqueOnMeasuredDepth[formation.mdTop] =
|
||||
NameAndMD(formation.level, formation.formationName + " Base", formation.mdTop);
|
||||
}
|
||||
else continue;
|
||||
}
|
||||
|
||||
if (level < formation.level) continue;
|
||||
|
||||
if (!tempMakeVectorUniqueOnMeasuredDepth.count(formation.mdBase) ||
|
||||
tempMakeVectorUniqueOnMeasuredDepth.at(formation.mdBase).m_level < formation.level)
|
||||
{
|
||||
tempMakeVectorUniqueOnMeasuredDepth[formation.mdBase] =
|
||||
NameAndMD(formation.level, formation.formationName + " Base", formation.mdBase);
|
||||
}
|
||||
}
|
||||
evaluateFormations(m_formations, maxLevel, includeFluids, PICK_POSITION::BASE, &tempMakeVectorUniqueOnMeasuredDepth);
|
||||
|
||||
for (auto it = tempMakeVectorUniqueOnMeasuredDepth.begin(); it != tempMakeVectorUniqueOnMeasuredDepth.end(); it++)
|
||||
{
|
||||
names->push_back(it->second.m_name);
|
||||
measuredDepths->push_back(it->second.m_md);
|
||||
measuredDepths->push_back(it->first);
|
||||
names->push_back(it->second.name);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigWellPathFormation::FormationLevel RigWellPathFormations::maxFormationLevel() const
|
||||
std::vector<RigWellPathFormation::FormationLevel> RigWellPathFormations::formationsLevelsPresent() const
|
||||
{
|
||||
return m_maxLevelDetected;
|
||||
std::vector<RigWellPathFormation::FormationLevel> formationLevels;
|
||||
|
||||
for (auto it = m_formationsLevelsPresent.begin(); it != m_formationsLevelsPresent.end(); it++)
|
||||
{
|
||||
formationLevels.push_back(it->first);
|
||||
}
|
||||
return formationLevels;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -257,7 +275,7 @@ RigWellPathFormation::FormationLevel RigWellPathFormations::detectLevel(QString
|
||||
}
|
||||
}
|
||||
}
|
||||
if (levelDesctiptorCandidates.size() != 1) return RigWellPathFormation::ALL;
|
||||
if (levelDesctiptorCandidates.size() != 1) return RigWellPathFormation::UNKNOWN;
|
||||
|
||||
QString levelDescriptor = levelDesctiptorCandidates[0];
|
||||
|
||||
@ -270,7 +288,10 @@ RigWellPathFormation::FormationLevel RigWellPathFormations::detectLevel(QString
|
||||
case 0: return RigWellPathFormation::LEVEL1;
|
||||
case 1: return RigWellPathFormation::LEVEL2;
|
||||
case 2: return RigWellPathFormation::LEVEL3;
|
||||
case 3: return RigWellPathFormation::LEVEL4;
|
||||
case 4: return RigWellPathFormation::LEVEL5;
|
||||
case 5: return RigWellPathFormation::LEVEL6;
|
||||
default: break;
|
||||
}
|
||||
return RigWellPathFormation::ALL;
|
||||
return RigWellPathFormation::UNKNOWN;
|
||||
}
|
||||
|
@ -36,8 +36,12 @@ struct RigWellPathFormation
|
||||
LEVEL1,
|
||||
LEVEL2,
|
||||
LEVEL3,
|
||||
LEVEL4,
|
||||
LEVEL5,
|
||||
LEVEL6,
|
||||
ALL,
|
||||
FLUIDS
|
||||
FLUIDS,
|
||||
UNKNOWN
|
||||
};
|
||||
|
||||
double mdTop;
|
||||
@ -57,7 +61,7 @@ public:
|
||||
void measuredDepthAndFormationNamesUpToLevel(RigWellPathFormation::FormationLevel level, std::vector<QString>* names,
|
||||
std::vector<double>* measuredDepths, bool includeFluids) const;
|
||||
|
||||
RigWellPathFormation::FormationLevel maxFormationLevel() const;
|
||||
std::vector<RigWellPathFormation::FormationLevel> formationsLevelsPresent() const;
|
||||
|
||||
QString filePath() const;
|
||||
QString keyInFile() const;
|
||||
@ -71,7 +75,7 @@ private:
|
||||
QString m_filePath;
|
||||
QString m_keyInFile;
|
||||
|
||||
RigWellPathFormation::FormationLevel m_maxLevelDetected;
|
||||
std::map<RigWellPathFormation::FormationLevel, bool> m_formationsLevelsPresent;
|
||||
|
||||
std::vector<RigWellPathFormation> m_formations;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user