#3154 Implement Common Data Source for Well Log Plots

This commit is contained in:
Gaute Lindkvist
2018-07-10 12:44:58 +02:00
parent 714aafc05c
commit 06e3ca238a
14 changed files with 692 additions and 209 deletions

View File

@@ -88,12 +88,12 @@ RimWellLogExtractionCurve::RimWellLogExtractionCurve()
{
CAF_PDM_InitObject("Well Log Curve", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_trajectoryType, "TrajectoryType", "Trajectory", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_trajectoryType, "TrajectoryType", "Trajectory Type", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_wellPath, "CurveWellPath", " ", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_wellPath, "CurveWellPath", "Well Name", "", "", "");
m_wellPath.uiCapability()->setUiTreeChildrenHidden(true);
CAF_PDM_InitField(&m_simWellName, "SimulationWellName", QString("None"), " ", "", "", "");
CAF_PDM_InitField(&m_simWellName, "SimulationWellName", QString("None"), "Well Name", "", "", "");
CAF_PDM_InitField(&m_branchDetection, "BranchDetection", true, "Branch Detection", "",
"Compute branches based on how simulation well cells are organized", "");
CAF_PDM_InitField(&m_branchIndex, "Branch", 0, "Branch Index", "", "", "");
@@ -211,6 +211,14 @@ void RimWellLogExtractionCurve::setPropertiesFromView(Rim3dView* view)
clearGeneratedSimWellPaths();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogExtractionCurve::TrajectoryType RimWellLogExtractionCurve::trajectoryType() const
{
return m_trajectoryType();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -230,7 +238,7 @@ void RimWellLogExtractionCurve::clampTimestep()
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::clampBranchIndex()
{
int branchCount = static_cast<int>(simulationWellBranches().size());
int branchCount = static_cast<int>(RiaSimWellBranchTools::simulationWellBranches(m_simWellName, m_branchDetection).size());
if ( branchCount > 0 )
{
if ( m_branchIndex >= branchCount ) m_branchIndex = branchCount - 1;
@@ -253,7 +261,7 @@ void RimWellLogExtractionCurve::fieldChangedByUi(const caf::PdmFieldHandle* chan
{
clampTimestep();
auto wellNameSet = findSortedWellNames();
auto wellNameSet = sortedSimWellNames();
if (!wellNameSet.count(m_simWellName())) m_simWellName = "None";
clearGeneratedSimWellPaths();
@@ -332,7 +340,7 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate(bool updateParentPlot)
}
else
{
std::vector<const RigWellPath*> simWellBranches = simulationWellBranches();
std::vector<const RigWellPath*> simWellBranches = RiaSimWellBranchTools::simulationWellBranches(m_simWellName, m_branchDetection);
if (m_branchIndex >= 0 && m_branchIndex < static_cast<int>(simWellBranches.size()))
{
auto wellBranch = simWellBranches[m_branchIndex];
@@ -457,19 +465,13 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate(bool updateParentPlot)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<QString> RimWellLogExtractionCurve::findSortedWellNames()
std::set<QString> RimWellLogExtractionCurve::sortedSimWellNames()
{
std::set<QString> sortedWellNames;
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());
if ( eclipseCase && eclipseCase->eclipseCaseData() )
if (eclipseCase)
{
const cvf::Collection<RigSimWellData>& simWellData = eclipseCase->eclipseCaseData()->wellResults();
for ( size_t wIdx = 0; wIdx < simWellData.size(); ++wIdx )
{
sortedWellNames.insert(simWellData[wIdx]->m_wellName);
}
sortedWellNames = eclipseCase->sortedSimWellNames();
}
return sortedWellNames;
@@ -497,14 +499,6 @@ void RimWellLogExtractionCurve::clearGeneratedSimWellPaths()
m_wellPathsWithExtractors.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<const RigWellPath*> RimWellLogExtractionCurve::simulationWellBranches() const
{
return RiaSimWellBranchTools::simulationWellBranches(m_simWellName, m_branchDetection);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -543,7 +537,7 @@ QList<caf::PdmOptionItemInfo> RimWellLogExtractionCurve::calculateValueOptions(c
}
else if (fieldNeedingOptions == &m_simWellName)
{
std::set<QString> sortedWellNames = this->findSortedWellNames();
std::set<QString> sortedWellNames = this->sortedSimWellNames();
QIcon simWellIcon(":/Well.png");
for ( const QString& wname: sortedWellNames )
@@ -558,7 +552,7 @@ QList<caf::PdmOptionItemInfo> RimWellLogExtractionCurve::calculateValueOptions(c
}
else if (fieldNeedingOptions == &m_branchIndex)
{
auto branches = simulationWellBranches();
auto branches = RiaSimWellBranchTools::simulationWellBranches(m_simWellName, m_branchDetection);
options = RiaSimWellBranchTools::valueOptionsForBranchIndexField(branches);
}
@@ -580,28 +574,28 @@ void RimWellLogExtractionCurve::defineUiOrdering(QString uiConfigName, caf::PdmU
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value());
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());
curveDataGroup->add(&m_trajectoryType);
if (m_trajectoryType() == WELL_PATH)
{
curveDataGroup->add(&m_wellPath);
}
else
{
curveDataGroup->add(&m_simWellName);
RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequiredFromSimWellName(curveDataGroup,
m_simWellName,
m_branchDetection,
m_branchIndex);
}
if (eclipseCase)
{
curveDataGroup->add(&m_trajectoryType);
if (m_trajectoryType() == WELL_PATH)
{
curveDataGroup->add(&m_wellPath);
}
else
{
curveDataGroup->add(&m_simWellName);
RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequiredFromSimWellName(curveDataGroup,
m_simWellName,
m_branchDetection,
m_branchIndex);
}
m_eclipseResultDefinition->uiOrdering(uiConfigName, *curveDataGroup);
}
else if (geomCase)
{
curveDataGroup->add(&m_wellPath);
m_geomResultDefinition->uiOrdering(uiConfigName, *curveDataGroup);
}
@@ -691,7 +685,7 @@ QString RimWellLogExtractionCurve::createCurveAutoName()
if (!wellName().isEmpty())
{
generatedCurveName += wellName();
if (m_trajectoryType == SIMULATION_WELL && simulationWellBranches().size() > 1)
if (m_trajectoryType == SIMULATION_WELL && RiaSimWellBranchTools::simulationWellBranches(m_simWellName, m_branchDetection).size() > 1)
{
generatedCurveName.push_back(" Br" + QString::number(m_branchIndex + 1));
}
@@ -824,6 +818,22 @@ QString RimWellLogExtractionCurve::wellDate() const
return (m_timeStep >= 0 && m_timeStep < timeStepNames.size()) ? timeStepNames[m_timeStep] : "";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimWellLogExtractionCurve::branchIndex() const
{
return m_branchIndex();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogExtractionCurve::branchDetection() const
{
return m_branchDetection();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -894,3 +904,35 @@ void RimWellLogExtractionCurve::setGeoMechResultAddress(const RigFemResultAddres
{
m_geomResultDefinition->setResultAddress(resAddr);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::setTrajectoryType(TrajectoryType trajectoryType)
{
m_trajectoryType = trajectoryType;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::setWellName(QString wellName)
{
m_simWellName = wellName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::setBranchDetection(bool branchDetection)
{
m_branchDetection = branchDetection;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::setBranchIndex(int index)
{
m_branchIndex = index;
}