#2483 Intersections : Use branch detection switch in "Simulation Wells"

This commit is contained in:
Magne Sjaastad 2018-03-02 11:25:47 +01:00
parent 3fc99a73bc
commit db276fff03
5 changed files with 60 additions and 24 deletions

View File

@ -155,9 +155,7 @@ void RimIntersection::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|| changedField == &isActive || changedField == &isActive
|| changedField == &type) || changedField == &type)
{ {
m_wellBranchCenterlines.clear(); recomputeSimulationWellBranchData();
updateWellCenterline();
m_branchIndex = -1;
} }
if (changedField == &simulationWell if (changedField == &simulationWell
@ -231,8 +229,8 @@ void RimIntersection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
else if (type == CS_SIMULATION_WELL) else if (type == CS_SIMULATION_WELL)
{ {
geometryGroup->add(&simulationWell); geometryGroup->add(&simulationWell);
updateWellCenterline(); updateSimulationWellCenterline();
if (simulationWell() && m_wellBranchCenterlines.size() > 1) if (simulationWell() && m_simulationWellBranchCenterlines.size() > 1)
{ {
geometryGroup->add(&m_branchIndex); geometryGroup->add(&m_branchIndex);
} }
@ -322,9 +320,9 @@ QList<caf::PdmOptionItemInfo> RimIntersection::calculateValueOptions(const caf::
} }
else if (fieldNeedingOptions == &m_branchIndex) else if (fieldNeedingOptions == &m_branchIndex)
{ {
updateWellCenterline(); updateSimulationWellCenterline();
size_t branchCount = m_wellBranchCenterlines.size(); size_t branchCount = m_simulationWellBranchCenterlines.size();
options.push_back(caf::PdmOptionItemInfo("All", -1)); options.push_back(caf::PdmOptionItemInfo("All", -1));
@ -411,16 +409,16 @@ std::vector< std::vector <cvf::Vec3d> > RimIntersection::polyLines(double * hori
{ {
if (simulationWell()) if (simulationWell())
{ {
updateWellCenterline(); updateSimulationWellCenterline();
if (0 <= m_branchIndex && m_branchIndex < static_cast<int>(m_wellBranchCenterlines.size())) if (0 <= m_branchIndex && m_branchIndex < static_cast<int>(m_simulationWellBranchCenterlines.size()))
{ {
lines.push_back(m_wellBranchCenterlines[m_branchIndex]); lines.push_back(m_simulationWellBranchCenterlines[m_branchIndex]);
} }
if (m_branchIndex == -1) if (m_branchIndex == -1)
{ {
lines = m_wellBranchCenterlines; lines = m_simulationWellBranchCenterlines;
} }
} }
} }
@ -488,32 +486,35 @@ std::vector< std::vector <cvf::Vec3d> > RimIntersection::polyLinesForExtrusionDi
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimIntersection::updateWellCenterline() const void RimIntersection::updateSimulationWellCenterline() const
{ {
if (isActive() && type == CS_SIMULATION_WELL && simulationWell()) if (isActive() && type == CS_SIMULATION_WELL && simulationWell())
{ {
if (m_wellBranchCenterlines.size() == 0) if (m_simulationWellBranchCenterlines.size() == 0)
{ {
RimEclipseCase* rimEclCase = nullptr; RimEclipseCase* rimEclCase = nullptr;
simulationWell->firstAncestorOrThisOfType(rimEclCase); simulationWell->firstAncestorOrThisOfType(rimEclCase);
if (rimEclCase) if (rimEclCase)
{ {
bool includeCellCenters = false; RimSimWellInViewCollection* simWellCollection = nullptr;
bool detectBrances = true; simulationWell->firstAncestorOrThisOfTypeAsserted(simWellCollection);
bool includeCellCenters = simulationWell->isUsingCellCenterForPipe();
bool detectBrances = simWellCollection->isAutoDetectingBranches;
RigEclipseCaseData* caseData = rimEclCase->eclipseCaseData(); RigEclipseCaseData* caseData = rimEclCase->eclipseCaseData();
auto branches = caseData->simulationWellBranches(simulationWell->name, includeCellCenters, detectBrances); auto branches = caseData->simulationWellBranches(simulationWell->name, includeCellCenters, detectBrances);
for (auto b : branches) for (auto b : branches)
{ {
m_wellBranchCenterlines.push_back(b->m_wellPathPoints); m_simulationWellBranchCenterlines.push_back(b->m_wellPathPoints);
} }
} }
} }
} }
else else
{ {
m_wellBranchCenterlines.clear(); m_simulationWellBranchCenterlines.clear();
} }
} }
@ -884,6 +885,21 @@ void RimIntersection::setLengthDown(double lengthDown)
m_lengthDown = lengthDown; m_lengthDown = lengthDown;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersection::recomputeSimulationWellBranchData()
{
if (type() == CS_SIMULATION_WELL)
{
m_simulationWellBranchCenterlines.clear();
updateSimulationWellCenterline();
m_branchIndex = -1;
m_crossSectionPartMgr = nullptr;
}
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -101,6 +101,8 @@ public:
void setLengthUp(double heightUp); void setLengthUp(double heightUp);
void setLengthDown(double heightDown); void setLengthDown(double heightDown);
void recomputeSimulationWellBranchData();
protected: protected:
virtual caf::PdmFieldHandle* userDescriptionField(); virtual caf::PdmFieldHandle* userDescriptionField();
virtual caf::PdmFieldHandle* objectToggleField(); virtual caf::PdmFieldHandle* objectToggleField();
@ -130,7 +132,7 @@ private:
RimSimWellInViewCollection* simulationWellCollection(); RimSimWellInViewCollection* simulationWellCollection();
void updateAzimuthLine(); void updateAzimuthLine();
void updateWellCenterline() const; void updateSimulationWellCenterline() const;
void updateWellExtentDefaultValue(); void updateWellExtentDefaultValue();
void addExtents(std::vector<cvf::Vec3d> &polyLine) const; void addExtents(std::vector<cvf::Vec3d> &polyLine) const;
void clipToReservoir(std::vector<cvf::Vec3d> &polyLinee, double * horizontalLengthAlongWellToClipPoint) const; void clipToReservoir(std::vector<cvf::Vec3d> &polyLinee, double * horizontalLengthAlongWellToClipPoint) const;
@ -141,5 +143,5 @@ private:
cvf::ref<RivIntersectionPartMgr> m_crossSectionPartMgr; cvf::ref<RivIntersectionPartMgr> m_crossSectionPartMgr;
mutable mutable
std::vector< std::vector <cvf::Vec3d> > m_wellBranchCenterlines; std::vector< std::vector <cvf::Vec3d> > m_simulationWellBranchCenterlines;
}; };

View File

@ -19,8 +19,8 @@
#include "RimIntersectionCollection.h" #include "RimIntersectionCollection.h"
#include "Rim2dIntersectionViewCollection.h"
#include "Rim2dIntersectionView.h" #include "Rim2dIntersectionView.h"
#include "Rim2dIntersectionViewCollection.h"
#include "Rim3dView.h" #include "Rim3dView.h"
#include "RimCase.h" #include "RimCase.h"
#include "RimIntersection.h" #include "RimIntersection.h"
@ -167,6 +167,17 @@ std::vector<RimIntersectionBox*> RimIntersectionCollection::intersectionBoxes()
return m_intersectionBoxes.childObjects(); return m_intersectionBoxes.childObjects();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionCollection::recomputeSimWellBranchData()
{
for (const auto& intersection : intersections())
{
intersection->recomputeSimulationWellBranchData();
}
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -62,6 +62,7 @@ public:
void syncronize2dIntersectionViews(); void syncronize2dIntersectionViews();
void scheduleCreateDisplayModelAndRedraw2dIntersectionViews(); void scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
void recomputeSimWellBranchData();
// Visualization interface // Visualization interface

View File

@ -28,12 +28,14 @@
#include "RigSimWellData.h" #include "RigSimWellData.h"
#include "RimEclipseCase.h" #include "RimEclipseCase.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseView.h" #include "RimEclipseView.h"
#include "RimIntersectionCollection.h"
#include "RimProject.h" #include "RimProject.h"
#include "RimSimWellInView.h"
#include "RimWellAllocationPlot.h"
#include "RimSimWellFracture.h" #include "RimSimWellFracture.h"
#include "RimSimWellFractureCollection.h" #include "RimSimWellFractureCollection.h"
#include "RimSimWellInView.h"
#include "RimWellAllocationPlot.h"
#include "RiuMainWindow.h" #include "RiuMainWindow.h"
@ -41,7 +43,6 @@
#include "cafPdmUiPushButtonEditor.h" #include "cafPdmUiPushButtonEditor.h"
#include "cafPdmUiCheckBoxTristateEditor.h" #include "cafPdmUiCheckBoxTristateEditor.h"
#include "RimEclipseResultCase.h"
namespace caf namespace caf
@ -460,8 +461,13 @@ void RimSimWellInViewCollection::fieldChangedByUi(const caf::PdmFieldHandle* cha
if (m_reservoirView) m_reservoirView->scheduleCreateDisplayModelAndRedraw(); if (m_reservoirView) m_reservoirView->scheduleCreateDisplayModelAndRedraw();
} }
if (&wellPipeCoordType == changedField) if (&wellPipeCoordType == changedField || &isAutoDetectingBranches == changedField)
{ {
if (m_reservoirView)
{
m_reservoirView->crossSectionCollection()->recomputeSimWellBranchData();
}
for (RimSimWellInView* w : wells) for (RimSimWellInView* w : wells)
{ {
for (RimSimWellFracture* frac : w->simwellFractureCollection()->simwellFractures()) for (RimSimWellFracture* frac : w->simwellFractureCollection()->simwellFractures())