#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

@@ -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;
};