mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2592 3D well log curves: Visualize results
This commit is contained in:
parent
3da3856c51
commit
cf4830e0ad
@ -18,22 +18,26 @@
|
||||
|
||||
#include "Riv3dWellLogCurveGeomertyGenerator.h"
|
||||
|
||||
#include "RigCurveDataTools.h"
|
||||
#include "RigWellPath.h"
|
||||
|
||||
#include "cvfPrimitiveSetIndexedUInt.h"
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
|
||||
#include "cvfPrimitiveSetIndexedUInt.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createCurveLine(const caf::DisplayCoordTransform* displayCoordTransform, const Rim3dWellLogCurve* rim3dWellLogCurve) const
|
||||
cvf::ref<cvf::DrawableGeo>
|
||||
Riv3dWellLogCurveGeometryGenerator::createCurveLine(const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
const Rim3dWellLogCurve* rim3dWellLogCurve) const
|
||||
{
|
||||
std::vector<cvf::Vec3f> vertices = createCurveVertices(rim3dWellLogCurve, displayCoordTransform);
|
||||
std::vector<cvf::uint> indices = createPolylineIndices(vertices.size());
|
||||
std::vector<cvf::Vec3f> vertices;
|
||||
std::vector<cvf::uint> indices;
|
||||
|
||||
createCurveVerticesAndIndices(rim3dWellLogCurve, displayCoordTransform, &vertices, &indices);
|
||||
|
||||
cvf::ref<cvf::PrimitiveSetIndexedUInt> indexedUInt = new cvf::PrimitiveSetIndexedUInt(cvf::PrimitiveType::PT_LINES);
|
||||
cvf::ref<cvf::UIntArray> indexArray = new cvf::UIntArray(indices);
|
||||
cvf::ref<cvf::UIntArray> indexArray = new cvf::UIntArray(indices);
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> drawable = new cvf::DrawableGeo();
|
||||
|
||||
@ -47,9 +51,10 @@ cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createCurveLine(c
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createGrid(const caf::DisplayCoordTransform* displayCoordTransform, const Rim3dWellLogCurve* rim3dWellLogCurve) const
|
||||
cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createGrid(const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
const Rim3dWellLogCurve* rim3dWellLogCurve) const
|
||||
{
|
||||
std::vector<cvf::Vec3d> wellPathPoints = m_wellPathGeometry->m_wellPathPoints;
|
||||
|
||||
@ -82,7 +87,7 @@ cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createGrid(const
|
||||
}
|
||||
|
||||
cvf::ref<cvf::PrimitiveSetIndexedUInt> indexedUInt = new cvf::PrimitiveSetIndexedUInt(cvf::PrimitiveType::PT_LINES);
|
||||
cvf::ref<cvf::UIntArray> indexArray = new cvf::UIntArray(indices);
|
||||
cvf::ref<cvf::UIntArray> indexArray = new cvf::UIntArray(indices);
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> drawable = new cvf::DrawableGeo();
|
||||
|
||||
@ -96,60 +101,88 @@ cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createGrid(const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<cvf::Vec3f> Riv3dWellLogCurveGeometryGenerator::createCurveVertices(const Rim3dWellLogCurve* rim3dWellLogCurve, const caf::DisplayCoordTransform* displayCoordTransform) const
|
||||
void Riv3dWellLogCurveGeometryGenerator::createCurveVerticesAndIndices(const Rim3dWellLogCurve* rim3dWellLogCurve,
|
||||
const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
std::vector<cvf::Vec3f>* vertices,
|
||||
std::vector<cvf::uint>* indices) const
|
||||
{
|
||||
std::vector<cvf::Vec3d> wellPathPoints;
|
||||
wellPathPoints = m_wellPathGeometry->m_wellPathPoints;
|
||||
std::vector<double> resultValues;
|
||||
std::vector<double> mds;
|
||||
rim3dWellLogCurve->resultValuesAndMds(&resultValues, &mds);
|
||||
|
||||
std::vector<cvf::Vec3f> vertices;
|
||||
vertices.resize(wellPathPoints.size());
|
||||
CVF_ASSERT(resultValues.size() == mds.size());
|
||||
|
||||
std::vector<cvf::Vec3d> wellPathPoints;
|
||||
wellPathPoints.reserve(mds.size());
|
||||
|
||||
for (double md : mds)
|
||||
{
|
||||
wellPathPoints.push_back(m_wellPathGeometry->interpolatedPointAlongWellPath(md));
|
||||
}
|
||||
|
||||
vertices->resize(wellPathPoints.size());
|
||||
|
||||
std::vector<cvf::Vec3d> curveNormals;
|
||||
curveNormals.reserve(wellPathPoints.size());
|
||||
|
||||
|
||||
for (size_t i = 0; i < wellPathPoints.size() - 1; i += 2)
|
||||
{
|
||||
cvf::Vec3d z = zForDrawPlane(rim3dWellLogCurve->drawPlane());
|
||||
|
||||
cvf::Vec3d y = normalBetweenPoints(wellPathPoints[i], wellPathPoints[i+1], z);
|
||||
cvf::Vec3d y = normalBetweenPoints(wellPathPoints[i], wellPathPoints[i + 1], z);
|
||||
|
||||
curveNormals.push_back(y);
|
||||
curveNormals.push_back(y);
|
||||
}
|
||||
|
||||
double maxResult = -HUGE_VAL;
|
||||
double minResult = HUGE_VAL;
|
||||
|
||||
for (double result : resultValues)
|
||||
{
|
||||
if (!RigCurveDataTools::isValidValue(result, false)) continue;
|
||||
|
||||
maxResult = std::max(result, maxResult);
|
||||
minResult = std::min(result, minResult);
|
||||
}
|
||||
|
||||
double range = maxResult - minResult;
|
||||
double factor = 60.0 / range;
|
||||
|
||||
for (size_t i = 0; i < curveNormals.size(); i++)
|
||||
{
|
||||
vertices[i] = cvf::Vec3f(displayCoordTransform->transformToDisplayCoord(wellPathPoints[i] + curveNormals[i] * 30));
|
||||
cvf::Vec3d result(0, 0, 0);
|
||||
|
||||
if (RigCurveDataTools::isValidValue(resultValues[i], false))
|
||||
{
|
||||
result = resultValues[i] * factor * curveNormals[i];
|
||||
}
|
||||
|
||||
(*vertices)[i] =
|
||||
cvf::Vec3f(displayCoordTransform->transformToDisplayCoord(wellPathPoints[i] + curveNormals[i] * 30 + result));
|
||||
}
|
||||
|
||||
return vertices;
|
||||
}
|
||||
std::vector<std::pair<size_t, size_t>> valuesIntervals =
|
||||
RigCurveDataTools::calculateIntervalsOfValidValues(resultValues, false);
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<cvf::uint> Riv3dWellLogCurveGeometryGenerator::createPolylineIndices(size_t vertexCount) const
|
||||
{
|
||||
std::vector<cvf::uint> indices;
|
||||
indices.resize((vertexCount - 1) * 2);
|
||||
|
||||
cvf::uint counter = 0;
|
||||
for (size_t i = 0; i < indices.size(); i++)
|
||||
for (const std::pair<size_t, size_t>& interval : valuesIntervals)
|
||||
{
|
||||
indices[i] = counter;
|
||||
if (i % 2 == 0) counter++;
|
||||
for (size_t i = interval.first; i < interval.second; i++)
|
||||
{
|
||||
indices->push_back(cvf::uint(i));
|
||||
indices->push_back(cvf::uint(i + 1));
|
||||
}
|
||||
}
|
||||
|
||||
return indices;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d Riv3dWellLogCurveGeometryGenerator::normalBetweenPoints(const cvf::Vec3d& pt1, const cvf::Vec3d& pt2, const cvf::Vec3d& z) const
|
||||
cvf::Vec3d Riv3dWellLogCurveGeometryGenerator::normalBetweenPoints(const cvf::Vec3d& pt1,
|
||||
const cvf::Vec3d& pt2,
|
||||
const cvf::Vec3d& z) const
|
||||
{
|
||||
cvf::Vec3d x = (pt2 - pt1).getNormalized();
|
||||
|
||||
@ -157,7 +190,7 @@ cvf::Vec3d Riv3dWellLogCurveGeometryGenerator::normalBetweenPoints(const cvf::Ve
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d Riv3dWellLogCurveGeometryGenerator::zForDrawPlane(const Rim3dWellLogCurve::DrawPlane& drawPlane) const
|
||||
{
|
||||
@ -179,7 +212,7 @@ cvf::Vec3d Riv3dWellLogCurveGeometryGenerator::zForDrawPlane(const Rim3dWellLogC
|
||||
}
|
||||
else
|
||||
{
|
||||
//Default: Horizontal left
|
||||
// Default: Horizontal left
|
||||
return cvf::Vec3d(0, 0, -1);
|
||||
}
|
||||
}
|
||||
|
@ -45,10 +45,10 @@ public:
|
||||
cvf::ref<cvf::DrawableGeo> createGrid(const caf::DisplayCoordTransform* displayCoordTransform, const Rim3dWellLogCurve* rim3dWellLogCurve) const;
|
||||
|
||||
private:
|
||||
std::vector<cvf::Vec3f> createCurveVertices(const Rim3dWellLogCurve* rim3dWellLogCurve,
|
||||
const caf::DisplayCoordTransform* displayCoordTransform) const;
|
||||
|
||||
std::vector<cvf::uint> createPolylineIndices(size_t vertexCount) const;
|
||||
void createCurveVerticesAndIndices(const Rim3dWellLogCurve* rim3dWellLogCurve,
|
||||
const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
std::vector<cvf::Vec3f>* vertices,
|
||||
std::vector<cvf::uint>* indices) const;
|
||||
|
||||
cvf::Vec3d normalBetweenPoints(const cvf::Vec3d& pt1, const cvf::Vec3d& pt2, const cvf::Vec3d& z) const;
|
||||
cvf::Vec3d zForDrawPlane(const Rim3dWellLogCurve::DrawPlane& drawPlane) const;
|
||||
|
@ -18,6 +18,10 @@
|
||||
|
||||
#include "Rim3dWellLogCurve.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RigEclipseWellLogExtractor.h"
|
||||
#include "RigGeoMechWellLogExtractor.h"
|
||||
#include "RigResultAccessorFactory.h"
|
||||
#include "Rim3dView.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
@ -26,7 +30,10 @@
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechResultDefinition.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -148,6 +155,68 @@ Rim3dWellLogCurve::DrawPlane Rim3dWellLogCurve::drawPlane() const
|
||||
return m_drawPlane();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim3dWellLogCurve::resultValuesAndMds(std::vector<double>* resultValues, std::vector<double>* measuredDepthValues) const
|
||||
{
|
||||
CAF_ASSERT(resultValues != nullptr);
|
||||
CAF_ASSERT(measuredDepthValues != nullptr);
|
||||
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
|
||||
RimMainPlotCollection* mainPlotCollection = proj->mainPlotCollection;
|
||||
if (!mainPlotCollection) return;
|
||||
|
||||
RimWellLogPlotCollection* wellLogCollection = mainPlotCollection->wellLogPlotCollection();
|
||||
if (!wellLogCollection) return;
|
||||
|
||||
cvf::ref<RigEclipseWellLogExtractor> eclExtractor;
|
||||
cvf::ref<RigGeoMechWellLogExtractor> geomExtractor;
|
||||
|
||||
RimWellPath* wellPath;
|
||||
firstAncestorOrThisOfType(wellPath);
|
||||
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case());
|
||||
|
||||
if (eclipseCase)
|
||||
{
|
||||
eclExtractor = wellLogCollection->findOrCreateExtractor(wellPath, eclipseCase);
|
||||
}
|
||||
else
|
||||
{
|
||||
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case());
|
||||
if (geomCase)
|
||||
{
|
||||
geomExtractor = wellLogCollection->findOrCreateExtractor(wellPath, geomCase);
|
||||
}
|
||||
}
|
||||
|
||||
if (eclExtractor.notNull() && eclipseCase)
|
||||
{
|
||||
*measuredDepthValues = eclExtractor->measuredDepth();
|
||||
|
||||
m_eclipseResultDefinition->loadResult();
|
||||
|
||||
cvf::ref<RigResultAccessor> resAcc = RigResultAccessorFactory::createFromResultDefinition(eclipseCase->eclipseCaseData(),
|
||||
0,
|
||||
m_timeStep,
|
||||
m_eclipseResultDefinition);
|
||||
if (resAcc.notNull())
|
||||
{
|
||||
eclExtractor->curveData(resAcc.p(), resultValues);
|
||||
}
|
||||
}
|
||||
else if (geomExtractor.notNull())
|
||||
{
|
||||
*measuredDepthValues = geomExtractor->measuredDepth();
|
||||
|
||||
m_geomResultDefinition->loadResult();
|
||||
|
||||
geomExtractor->curveData(m_geomResultDefinition->resultAddress(), m_timeStep, resultValues);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -222,7 +291,6 @@ void Rim3dWellLogCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin
|
||||
else if (geomCase)
|
||||
{
|
||||
m_geomResultDefinition->uiOrdering(uiConfigName, *curveDataGroup);
|
||||
|
||||
}
|
||||
|
||||
if ((eclipseCase && m_eclipseResultDefinition->hasDynamicResult())
|
||||
|
@ -68,6 +68,8 @@ public:
|
||||
|
||||
DrawPlane drawPlane() const;
|
||||
|
||||
void resultValuesAndMds(std::vector<double>* resultValues, std::vector<double>* measuredDepthValues) const;
|
||||
|
||||
private:
|
||||
virtual caf::PdmFieldHandle* objectToggleField() override;
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
|
@ -60,8 +60,6 @@ public:
|
||||
static std::vector<std::pair<size_t, size_t>> computePolyLineStartStopIndices(const CurveIntervals& intervals);
|
||||
|
||||
public:
|
||||
// Helper methods, available as public to be able to access from unit tests
|
||||
|
||||
static bool isValidValue(double value, bool allowPositiveValuesOnly);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user