#2358 fracture. Display values in resultInfo panel when clicking on stim plan fracture cell

This commit is contained in:
Bjørn Erik Jensen 2018-01-23 14:13:45 +01:00
parent bc5139257f
commit 1c668ce3b4
4 changed files with 131 additions and 3 deletions

View File

@ -55,8 +55,10 @@ bool RicWellPathViewerEventHandler::handleEvent(const RicViewerEventObject& even
cvf::uint wellPathTriangleIndex = cvf::UNDEFINED_UINT;
const RivWellPathSourceInfo* wellPathSourceInfo = nullptr;
for (const auto & partAndTriangleIndexPair : eventObject.m_partAndTriangleIndexPairs)
if(eventObject.m_partAndTriangleIndexPairs.size() > 0)
{
const auto & partAndTriangleIndexPair = eventObject.m_partAndTriangleIndexPairs.front();
const cvf::Part* part = partAndTriangleIndexPair.first;
const RivObjectSourceInfo* sourceInfo = dynamic_cast<const RivObjectSourceInfo*>(part->sourceInfo());
@ -69,7 +71,6 @@ bool RicWellPathViewerEventHandler::handleEvent(const RicViewerEventObject& even
{
wellPathSourceInfo = dynamic_cast<const RivWellPathSourceInfo*>(part->sourceInfo());
wellPathTriangleIndex = partAndTriangleIndexPair.second;
break;
}
}

View File

@ -245,6 +245,100 @@ std::vector<double> RivWellFracturePartMgr::mirrorDataAtSingleDepth(std::vector<
return mirroredValuesAtGivenDepth;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const QString RivWellFracturePartMgr::resultInfoText(const RimEclipseView& activeView, cvf::Vec3d domainIntersectionPoint) const
{
QString text;
if (m_rimFracture.isNull()) return text;
RimEllipseFractureTemplate* ellipseFractureTemplate = dynamic_cast<RimEllipseFractureTemplate*>(m_rimFracture->fractureTemplate());
RimStimPlanFractureTemplate* stimPlanTemplate = dynamic_cast<RimStimPlanFractureTemplate*>(m_rimFracture->fractureTemplate());
if (ellipseFractureTemplate)
{
text.append("Result value: ");
text.append(QString::number(ellipseFractureTemplate->conductivity()) + "\n");
}
else if (stimPlanTemplate)
{
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
const RigFractureCell* cell = getFractureCellAtDomainCoord(domainIntersectionPoint);
RimStimPlanColors* stimPlanColors = activeView.stimPlanColors;
QString condValueText = cell ? QString::number(cell->getConductivtyValue()) : "-";
QString iText = cell ? QString::number(cell->getI()) : "-";
QString jText = cell ? QString::number(cell->getJ()) : "-";
// Conductivity
text.append("Result value: ");
text.append(stimPlanColors->resultName() + " ");
text.append(condValueText + "\n");
// Cell index
text.append("Cell Index: ");
text.append(iText + ", " + jText + "\n");
#endif // USE_PROTOTYPE_FEATURE_FRACTURES
}
return text;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RigFractureCell* RivWellFracturePartMgr::getFractureCellAtDomainCoord(cvf::Vec3d domainCoord) const
{
if (!m_rimFracture) return nullptr;
cvf::Mat4d toFractureXf = m_rimFracture->transformMatrix().getInverted();
cvf::Vec3d fractureCoord = domainCoord.getTransformedPoint(toFractureXf);
const RimStimPlanFractureTemplate* stimPlanTempl = dynamic_cast<RimStimPlanFractureTemplate*>(m_rimFracture->fractureTemplate());
if (!stimPlanTempl) return nullptr;
const RigFractureGrid* grid = stimPlanTempl->fractureGrid();
size_t cellI = cvf::UNDEFINED_SIZE_T;
size_t cellJ = cvf::UNDEFINED_SIZE_T;
const std::vector<RigFractureCell>& cells = grid->fractureCells();
for (int i = 0; i < grid->iCellCount(); i++)
{
const RigFractureCell& cell = cells[i * grid->jCellCount()];
std::vector<cvf::Vec3d> polygon = cell.getPolygon();
double xmin = polygon[0].x();
double xmax = polygon[2].x();
if (fractureCoord.x() >= xmin && fractureCoord.x() <= xmax)
{
cellI = cell.getI();
break;
}
}
for (int j = 0; j < grid->jCellCount(); j++)
{
const RigFractureCell& cell = cells[j];
std::vector<cvf::Vec3d> polygon = cell.getPolygon();
double ymin = polygon[2].y();
double ymax = polygon[0].y();
if (fractureCoord.y() >= ymin && fractureCoord.y() <= ymax)
{
cellJ = cell.getJ();
break;
}
}
if (cellI != cvf::UNDEFINED_SIZE_T && cellJ != cvf::UNDEFINED_SIZE_T)
{
return &grid->cellFromIndex(grid->getGlobalIndexFromIJ(cellI, cellJ));
}
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -25,6 +25,7 @@
#include "cafPdmPointer.h"
#include <QString>
#include <vector>
namespace cvf
@ -43,6 +44,7 @@ namespace caf
class RimFracture;
class RimStimPlanFractureTemplate;
class RimEclipseView;
class RigFractureCell;
//--------------------------------------------------------------------------------------------------
///
@ -57,6 +59,10 @@ public:
static std::vector<double> mirrorDataAtSingleDepth(std::vector<double> depthData);
const QString resultInfoText(const RimEclipseView& activeView, cvf::Vec3d domainIntersectionPoint) const;
const RigFractureCell* getFractureCellAtDomainCoord(cvf::Vec3d domainCoord) const;
private:
cvf::ref<cvf::Part> createEllipseSurfacePart(const RimEclipseView& activeView);
cvf::ref<cvf::Part> createStimPlanColorInterpolatedSurfacePart(const RimEclipseView& activeView);
@ -79,5 +85,5 @@ private:
static cvf::ref<cvf::DrawableGeo> buildDrawableGeoFromTriangles(const std::vector<cvf::uint>& triangleIndices, const std::vector<cvf::Vec3f>& nodeCoords);
private:
caf::PdmPointer<RimFracture> m_rimFracture;
caf::PdmPointer<RimFracture> m_rimFracture;
};

View File

@ -44,6 +44,7 @@
#include "RimEclipseView.h"
#include "RimFaultInView.h"
#include "RimFaultInViewCollection.h"
#include "RimFracture.h"
#include "RimGeoMechCase.h"
#include "RimGeoMechCellColors.h"
#include "RimGeoMechView.h"
@ -68,6 +69,7 @@
#include "RivSourceInfo.h"
#include "RivTernarySaturationOverlayItem.h"
#include "RivWellPathSourceInfo.h"
#include "RivWellFracturePartMgr.h"
#include "cafCmdExecCommandManager.h"
#include "cafCmdFeatureManager.h"
@ -87,6 +89,7 @@
#include <QStatusBar>
#include <array>
#include "RimPerforationInterval.h"
#include "RimStimPlanFractureTemplate.h"
@ -491,6 +494,30 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
if (rivObjectSourceInfo)
{
RiuMainWindow::instance()->selectAsCurrentItem(rivObjectSourceInfo->object());
RimFracture* fracture = dynamic_cast<RimFracture*>(rivObjectSourceInfo->object());
RimStimPlanFractureTemplate* stimPlanTempl = fracture ? dynamic_cast<RimStimPlanFractureTemplate*>(fracture->fractureTemplate()) : nullptr;
if (stimPlanTempl)
{
// Set fracture resultInfo text
QString resultInfoText;
cvf::ref<caf::DisplayCoordTransform> transForm = m_reservoirView->displayCoordTransform();
cvf::Vec3d domainCoord = transForm->translateToDomainCoord(globalIntersectionPoint);
RimEclipseView* eclView = dynamic_cast<RimEclipseView*>(m_reservoirView.p());
RivWellFracturePartMgr* partMgr = fracture->fracturePartManager();
if (eclView) resultInfoText = partMgr->resultInfoText(*eclView, domainCoord);
// Set intersection point result text
QString intersectionPointText;
intersectionPointText.sprintf("Intersection point : Global [E: %.2f, N: %.2f, Depth: %.2f]", domainCoord.x(), domainCoord.y(), -domainCoord.z());
resultInfoText.append(intersectionPointText);
// Display result info text
RiuMainWindow::instance()->setResultInfo(resultInfoText);
}
}
if (rivSourceInfo)