#3420 Result info. Fix cordinate system translations. Renaming to improve readability

This commit is contained in:
Bjørn Erik Jensen 2018-09-27 14:47:15 +02:00
parent a3d8fc1fb3
commit 0c05c93a72
14 changed files with 63 additions and 56 deletions

View File

@ -2625,7 +2625,7 @@ RigFemClosestResultIndexCalculator::RigFemClosestResultIndexCalculator(RigFemPar
RigFemResultPosEnum resultPosition,
int elementIndex,
int m_face,
const cvf::Vec3d& m_intersectionPoint)
const cvf::Vec3d& intersectionPointInDomain)
{
m_resultIndexToClosestResult = -1;
m_closestNodeId = -1;
@ -2643,8 +2643,8 @@ RigFemClosestResultIndexCalculator::RigFemClosestResultIndexCalculator(RigFemPar
for ( int lNodeIdx = 0; lNodeIdx < elmNodeCount; ++lNodeIdx )
{
int nodeIdx = elmentConn[lNodeIdx];
cvf::Vec3f nodePos = femPart->nodes().coordinates[nodeIdx];
float dist = (nodePos - cvf::Vec3f(m_intersectionPoint)).lengthSquared();
cvf::Vec3f nodePosInDomain = femPart->nodes().coordinates[nodeIdx];
float dist = (nodePosInDomain - cvf::Vec3f(intersectionPointInDomain)).lengthSquared();
if ( dist < minDist )
{
closestLocalNode = lNodeIdx;
@ -2694,8 +2694,8 @@ RigFemClosestResultIndexCalculator::RigFemClosestResultIndexCalculator(RigFemPar
for ( int faceNodIdx = 0; faceNodIdx < faceNodeCount; ++faceNodIdx )
{
int nodeIdx = elmNodeIndices[localElmNodeIndicesForFace[faceNodIdx]];
cvf::Vec3f nodePos = femPart->nodes().coordinates[nodeIdx];
float dist = (nodePos - cvf::Vec3f(m_intersectionPoint)).lengthSquared();
cvf::Vec3f nodePosInDomain = femPart->nodes().coordinates[nodeIdx];
float dist = (nodePosInDomain - cvf::Vec3f(intersectionPointInDomain)).lengthSquared();
if ( dist < minDist )
{
closestLocFaceNode = faceNodIdx;

View File

@ -159,7 +159,7 @@ public:
RigFemResultPosEnum resultPosition,
int elementIndex,
int m_face,
const cvf::Vec3d& m_intersectionPoint);
const cvf::Vec3d& intersectionPointInDomain);
int resultIndexToClosestResult() { return m_resultIndexToClosestResult; }
int closestNodeId() { return m_closestNodeId; }

View File

@ -69,7 +69,7 @@ void RimGeoMechGeometrySelectionItem::setFromSelectionItem(const RiuGeoMechSelec
m_intersectionTriangle_1 = cvf::Vec3d(selectionItem->m_intersectionTriangle[1]);
m_intersectionTriangle_2 = cvf::Vec3d(selectionItem->m_intersectionTriangle[2]);
m_localIntersectionPoint = selectionItem->m_localIntersectionPoint;
m_localIntersectionPoint = selectionItem->m_localIntersectionPointInDisplay;
}
//--------------------------------------------------------------------------------------------------

View File

@ -39,7 +39,7 @@ RimEclipseGeometrySelectionItem::RimEclipseGeometrySelectionItem()
CAF_PDM_InitFieldNoDefault(&m_eclipseCase, "EclipseCase", "Eclipse Case", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_gridIndex, "GridIndex", "Grid Index", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_cellIndex, "CellIndex", "Cell Index", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_localIntersectionPoint, "LocalIntersectionPoint", "local Intersection Point", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_localIntersectionPointInDisplay, "LocalIntersectionPoint", "local Intersection Point", "", "", "");
}
//--------------------------------------------------------------------------------------------------
@ -56,7 +56,7 @@ void RimEclipseGeometrySelectionItem::setFromSelectionItem(const RiuEclipseSelec
{
m_gridIndex = selectionItem->m_gridIndex;
m_cellIndex = selectionItem->m_gridLocalCellIndex;
m_localIntersectionPoint = selectionItem->m_localIntersectionPoint;
m_localIntersectionPointInDisplay = selectionItem->m_localIntersectionPointInDisplay;
m_eclipseCase = selectionItem->m_view->eclipseCase();
}

View File

@ -51,6 +51,6 @@ private:
caf::PdmField<size_t> m_gridIndex;
caf::PdmField<size_t> m_cellIndex;
caf::PdmField<cvf::Vec3d> m_localIntersectionPoint;
caf::PdmField<cvf::Vec3d> m_localIntersectionPointInDisplay;
};

View File

@ -56,16 +56,16 @@ RiuFemResultTextBuilder::RiuFemResultTextBuilder(RimGeoMechView* reservoirView,
m_cellIndex = cellIndex;
m_timeStepIndex = timeStepIndex;
m_intersectionPoint = cvf::Vec3d::UNDEFINED;
m_intersectionPointInDisplay = cvf::Vec3d::UNDEFINED;
m_face = cvf::StructGridInterface::NO_FACE;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuFemResultTextBuilder::setIntersectionPoint(cvf::Vec3d intersectionPoint)
void RiuFemResultTextBuilder::setIntersectionPointInDisplay(cvf::Vec3d intersectionPointInDisplay)
{
m_intersectionPoint = intersectionPoint;
m_intersectionPointInDisplay = intersectionPointInDisplay;
}
//--------------------------------------------------------------------------------------------------
@ -153,13 +153,13 @@ QString RiuFemResultTextBuilder::geometrySelectionText(QString itemSeparator)
QString formattedText;
if (m_2dIntersectionView)
{
formattedText.sprintf("Horizontal length from well start: %.2f", m_intersectionPoint.x());
formattedText.sprintf("Horizontal length from well start: %.2f", m_intersectionPointInDisplay.x());
text += formattedText + itemSeparator;
cvf::Mat4d t = m_2dIntersectionView->flatIntersectionPartMgr()->unflattenTransformMatrix(m_intersectionPoint);
cvf::Mat4d t = m_2dIntersectionView->flatIntersectionPartMgr()->unflattenTransformMatrix(m_intersectionPointInDisplay);
if (!t.isZero())
{
cvf::Vec3d intPt = m_intersectionPoint.getTransformedPoint(t);
cvf::Vec3d intPt = m_intersectionPointInDisplay.getTransformedPoint(t);
formattedText.sprintf("Intersection point : [E: %.2f, N: %.2f, Depth: %.2f]", intPt.x(), intPt.y(), -intPt.z());
text += formattedText;
}
@ -167,7 +167,7 @@ QString RiuFemResultTextBuilder::geometrySelectionText(QString itemSeparator)
else
{
cvf::ref<caf::DisplayCoordTransform> transForm = m_reservoirView->displayCoordTransform();
cvf::Vec3d domainCoord = transForm->translateToDomainCoord(m_intersectionPoint);
cvf::Vec3d domainCoord = transForm->translateToDomainCoord(m_intersectionPointInDisplay);
formattedText.sprintf("Intersection point : [E: %.2f, N: %.2f, Depth: %.2f]", domainCoord.x(), domainCoord.y(), -domainCoord.z());
text += formattedText;
@ -386,11 +386,12 @@ QString RiuFemResultTextBuilder::closestNodeResultText(RimGeoMechResultDefinitio
RigFemPart* femPart = geomData->femParts()->part(m_gridIndex);
RigFemResultPosEnum activeResultPosition = resultColors->resultPositionType();
cvf::Vec3d intersectionPointInDomain = m_reservoirView->displayCoordTransform()->translateToDomainCoord(m_intersectionPointInDisplay);
RigFemClosestResultIndexCalculator closestIndexCalc(femPart,
activeResultPosition,
m_cellIndex,
m_face,
m_intersectionPoint);
intersectionPointInDomain);
int resultIndex = closestIndexCalc.resultIndexToClosestResult();
int closestNodeId = closestIndexCalc.closestNodeId();
int closestElmNodResIdx = closestIndexCalc.closestElementNodeResIdx();

View File

@ -45,7 +45,7 @@ class RiuFemResultTextBuilder
public:
RiuFemResultTextBuilder(RimGeoMechView* reservoirView, int gridIndex, int cellIndex, int timeStepIndex);
void setFace(int face);
void setIntersectionPoint(cvf::Vec3d intersectionPoint);
void setIntersectionPointInDisplay(cvf::Vec3d intersectionPointInDisplay);
void setIntersectionTriangle(const std::array<cvf::Vec3f, 3>& triangle);
void set2dIntersectionView(Rim2dIntersectionView* intersectionView);
@ -75,5 +75,5 @@ private:
bool m_isIntersectionTriangleSet;
std::array<cvf::Vec3f, 3> m_intersectionTriangle;
cvf::Vec3d m_intersectionPoint;
cvf::Vec3d m_intersectionPointInDisplay;
};

View File

@ -37,13 +37,13 @@ RiuFemTimeHistoryResultAccessor::RiuFemTimeHistoryResultAccessor(RigGeoMechCaseD
size_t gridIndex,
int elementIndex,
int face,
const cvf::Vec3d& intersectionPoint)
const cvf::Vec3d& intersectionPointInDomain)
: m_geoMechCaseData(geomData),
m_femResultAddress(femResultAddress),
m_gridIndex(gridIndex),
m_elementIndex(elementIndex),
m_face(face),
m_intersectionPoint(intersectionPoint),
m_intersectionPointInDomain(intersectionPointInDomain),
m_hasIntersectionTriangle(false)
{
computeTimeHistoryData();
@ -57,14 +57,14 @@ RiuFemTimeHistoryResultAccessor::RiuFemTimeHistoryResultAccessor(RigGeoMechCaseD
size_t gridIndex,
int elementIndex,
int face,
const cvf::Vec3d& intersectionPoint,
const cvf::Vec3d& intersectionPointInDomain,
const std::array<cvf::Vec3f, 3>& intersectionTriangle)
: m_geoMechCaseData(geomData),
m_femResultAddress(femResultAddress),
m_gridIndex(gridIndex),
m_elementIndex(elementIndex),
m_face(face),
m_intersectionPoint(intersectionPoint),
m_intersectionPointInDomain(intersectionPointInDomain),
m_hasIntersectionTriangle(true),
m_intersectionTriangle(intersectionTriangle)
{
@ -94,7 +94,7 @@ QString RiuFemTimeHistoryResultAccessor::geometrySelectionText() const
j++;
k++;
cvf::Vec3d domainCoord = m_intersectionPoint;
cvf::Vec3d domainCoord = m_intersectionPointInDomain;
text += QString(", ijk[%1, %2, %3] ").arg(i).arg(j).arg(k);
QString formattedText;
@ -126,7 +126,7 @@ void RiuFemTimeHistoryResultAccessor::computeTimeHistoryData()
m_femResultAddress.resultPosType,
m_elementIndex,
m_face,
m_intersectionPoint );
m_intersectionPointInDomain );
int scalarResultIndex = closestCalc.resultIndexToClosestResult();
m_closestNodeId = closestCalc.closestNodeId();

View File

@ -36,14 +36,14 @@ public:
size_t gridIndex,
int elementIndex,
int face,
const cvf::Vec3d& intersectionPoint);
const cvf::Vec3d& intersectionPointInDomain);
RiuFemTimeHistoryResultAccessor(RigGeoMechCaseData* geomData,
RigFemResultAddress femResultAddress,
size_t gridIndex,
int elementIndex,
int face,
const cvf::Vec3d& intersectionPoint,
const cvf::Vec3d& intersectionPointInDomain,
const std::array<cvf::Vec3f, 3>& m_intersectionTriangle);
QString geometrySelectionText() const;
@ -62,7 +62,7 @@ private:
int m_face;
int m_closestNodeId;
cvf::Vec3d m_intersectionPoint;
cvf::Vec3d m_intersectionPointInDomain;
bool m_hasIntersectionTriangle;
std::array<cvf::Vec3f, 3> m_intersectionTriangle;

View File

@ -57,7 +57,7 @@ RiuResultTextBuilder::RiuResultTextBuilder(RimEclipseView* reservoirView, size_t
m_timeStepIndex = timeStepIndex;
m_nncIndex = cvf::UNDEFINED_SIZE_T;
m_intersectionPoint = cvf::Vec3d::UNDEFINED;
m_intersectionPointInDisplay = cvf::Vec3d::UNDEFINED;
m_face = cvf::StructGridInterface::NO_FACE;
}
@ -95,7 +95,7 @@ RiuResultTextBuilder::RiuResultTextBuilder(RimEclipseView* reservoirView, size_t
m_timeStepIndex = timeStepIndex;
m_nncIndex = cvf::UNDEFINED_SIZE_T;
m_intersectionPoint = cvf::Vec3d::UNDEFINED;
m_intersectionPointInDisplay = cvf::Vec3d::UNDEFINED;
m_face = cvf::StructGridInterface::NO_FACE;
}
@ -110,9 +110,9 @@ void RiuResultTextBuilder::setNncIndex(size_t nncIndex)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuResultTextBuilder::setIntersectionPoint(cvf::Vec3d intersectionPoint)
void RiuResultTextBuilder::setIntersectionPointInDisplay(cvf::Vec3d intersectionPointInDisplay)
{
m_intersectionPoint = intersectionPoint;
m_intersectionPointInDisplay = intersectionPointInDisplay;
}
//--------------------------------------------------------------------------------------------------
@ -226,21 +226,21 @@ QString RiuResultTextBuilder::geometrySelectionText(QString itemSeparator)
}
}
if (m_intersectionPoint != cvf::Vec3d::UNDEFINED)
if (m_intersectionPointInDisplay != cvf::Vec3d::UNDEFINED)
{
cvf::ref<caf::DisplayCoordTransform> transForm = m_reservoirView->displayCoordTransform();
cvf::Vec3d domainCoord = transForm->translateToDomainCoord(m_intersectionPoint);
cvf::Vec3d domainCoord = transForm->translateToDomainCoord(m_intersectionPointInDisplay);
QString formattedText;
if (m_2dIntersectionView)
{
formattedText.sprintf("Horizontal length from well start: %.2f", m_intersectionPoint.x());
formattedText.sprintf("Horizontal length from well start: %.2f", m_intersectionPointInDisplay.x());
text += formattedText + itemSeparator;
cvf::Mat4d t = m_2dIntersectionView->flatIntersectionPartMgr()->unflattenTransformMatrix(m_intersectionPoint);
cvf::Mat4d t = m_2dIntersectionView->flatIntersectionPartMgr()->unflattenTransformMatrix(m_intersectionPointInDisplay);
if (!t.isZero())
{
cvf::Vec3d intPt = m_intersectionPoint.getTransformedPoint(t);
cvf::Vec3d intPt = m_intersectionPointInDisplay.getTransformedPoint(t);
formattedText.sprintf("Intersection point : [E: %.2f, N: %.2f, Depth: %.2f]", intPt.x(), intPt.y(), -intPt.z());
text += formattedText;
}

View File

@ -46,7 +46,7 @@ public:
void setFace(cvf::StructGridInterface::FaceType face);
void setNncIndex(size_t nncIndex);
void setIntersectionPoint(cvf::Vec3d intersectionPoint);
void setIntersectionPointInDisplay(cvf::Vec3d intersectionPointInDisplay);
void set2dIntersectionView(Rim2dIntersectionView* intersectionView);
QString mainResultText();
@ -83,5 +83,5 @@ private:
size_t m_nncIndex;
cvf::Vec3d m_intersectionPoint;
cvf::Vec3d m_intersectionPointInDisplay;
};

View File

@ -52,6 +52,8 @@
#include <QStatusBar>
#include <cafDisplayCoordTransform.h>
#include <assert.h>
@ -160,7 +162,9 @@ void RiuSelectionChangedHandler::addCurveFromSelectionItem(const RiuEclipseSelec
curveName += ", ";
curveName += QString("Grid index %1").arg(eclipseSelectionItem->m_gridIndex);
curveName += ", ";
curveName += RigTimeHistoryResultAccessor::geometrySelectionText(eclipseView->eclipseCase()->eclipseCaseData(), eclipseSelectionItem->m_gridIndex, eclipseSelectionItem->m_gridLocalCellIndex);
curveName += RigTimeHistoryResultAccessor::geometrySelectionText(eclipseView->eclipseCase()->eclipseCaseData(),
eclipseSelectionItem->m_gridIndex,
eclipseSelectionItem->m_gridLocalCellIndex);
std::vector<double> timeHistoryValues = RigTimeHistoryResultAccessor::timeHistoryValues(eclipseView->eclipseCase()->eclipseCaseData(), eclipseView->cellResult(), eclipseSelectionItem->m_gridIndex, eclipseSelectionItem->m_gridLocalCellIndex, timeStepDates.size());
@ -185,6 +189,8 @@ void RiuSelectionChangedHandler::addCurveFromSelectionItem(const RiuGeoMechSelec
{
std::unique_ptr<RiuFemTimeHistoryResultAccessor> timeHistResultAccessor;
cvf::Vec3d intersectionPointInDomain = geoMechView->displayCoordTransform()->translateToDomainCoord(geomSelectionItem->m_localIntersectionPointInDisplay);
if ( geomSelectionItem->m_hasIntersectionTriangle )
{
timeHistResultAccessor = std::unique_ptr<RiuFemTimeHistoryResultAccessor>(
@ -193,7 +199,7 @@ void RiuSelectionChangedHandler::addCurveFromSelectionItem(const RiuGeoMechSelec
geomSelectionItem->m_gridIndex,
static_cast<int>(geomSelectionItem->m_cellIndex),
geomSelectionItem->m_elementFace,
geomSelectionItem->m_localIntersectionPoint,
intersectionPointInDomain,
geomSelectionItem->m_intersectionTriangle));
}
else
@ -204,7 +210,7 @@ void RiuSelectionChangedHandler::addCurveFromSelectionItem(const RiuGeoMechSelec
geomSelectionItem->m_gridIndex,
static_cast<int>(geomSelectionItem->m_cellIndex),
geomSelectionItem->m_elementFace,
geomSelectionItem->m_localIntersectionPoint));
intersectionPointInDomain));
}
QString curveName;
@ -348,7 +354,7 @@ void RiuSelectionChangedHandler::updateResultInfo(const RiuSelectionItem* itemAd
RiuResultTextBuilder textBuilder(eclipseView, eclipseSelectionItem->m_gridIndex, eclipseSelectionItem->m_gridLocalCellIndex, eclipseView->currentTimeStep());
textBuilder.setFace(eclipseSelectionItem->m_face);
textBuilder.setNncIndex(eclipseSelectionItem->m_nncIndex);
textBuilder.setIntersectionPoint(eclipseSelectionItem->m_localIntersectionPoint);
textBuilder.setIntersectionPointInDisplay(eclipseSelectionItem->m_localIntersectionPointInDisplay);
textBuilder.set2dIntersectionView(intersectionView);
resultInfo = textBuilder.mainResultText();
@ -361,7 +367,7 @@ void RiuSelectionChangedHandler::updateResultInfo(const RiuSelectionItem* itemAd
RimGeoMechView* geomView = geomSelectionItem->m_view.p();
RiuFemResultTextBuilder textBuilder(geomView, (int)geomSelectionItem->m_gridIndex, (int)geomSelectionItem->m_cellIndex, geomView->currentTimeStep());
textBuilder.setIntersectionPoint(geomSelectionItem->m_localIntersectionPoint);
textBuilder.setIntersectionPointInDisplay(geomSelectionItem->m_localIntersectionPointInDisplay);
textBuilder.setFace(geomSelectionItem->m_elementFace);
textBuilder.set2dIntersectionView(intersectionView);
if (geomSelectionItem->m_hasIntersectionTriangle) textBuilder.setIntersectionTriangle(geomSelectionItem->m_intersectionTriangle);

View File

@ -163,14 +163,14 @@ RiuEclipseSelectionItem::RiuEclipseSelectionItem(RimEclipseView* view,
size_t nncIndex,
cvf::Color3f color,
cvf::StructGridInterface::FaceType face,
const cvf::Vec3d& localIntersectionPoint)
const cvf::Vec3d& localIntersectionPointInDisplay)
: m_view(view),
m_gridIndex(gridIndex),
m_gridLocalCellIndex(cellIndex),
m_nncIndex(nncIndex),
m_color(color),
m_face(face),
m_localIntersectionPoint(localIntersectionPoint)
m_localIntersectionPointInDisplay(localIntersectionPointInDisplay)
{
}
@ -182,14 +182,14 @@ RiuGeoMechSelectionItem::RiuGeoMechSelectionItem(RimGeoMechView* view,
size_t cellIndex,
cvf::Color3f color,
int elementFace,
const cvf::Vec3d& localIntersectionPoint)
const cvf::Vec3d& localIntersectionPointInDisplay)
: m_view(view)
, m_gridIndex(gridIndex)
, m_cellIndex(cellIndex)
, m_color(color)
, m_elementFace(elementFace)
, m_hasIntersectionTriangle(false)
, m_localIntersectionPoint(localIntersectionPoint)
, m_localIntersectionPointInDisplay(localIntersectionPointInDisplay)
{
}
@ -201,7 +201,7 @@ RiuGeoMechSelectionItem::RiuGeoMechSelectionItem(RimGeoMechView*
size_t cellIndex,
cvf::Color3f color,
int elementFace,
const cvf::Vec3d& localIntersectionPoint,
const cvf::Vec3d& localIntersectionPointInDisplay,
const std::array<cvf::Vec3f, 3>& intersectionTriangle)
: m_view(view)
, m_gridIndex(gridIndex)
@ -210,7 +210,7 @@ RiuGeoMechSelectionItem::RiuGeoMechSelectionItem(RimGeoMechView*
, m_elementFace(elementFace)
, m_hasIntersectionTriangle(true)
, m_intersectionTriangle(intersectionTriangle)
, m_localIntersectionPoint(localIntersectionPoint)
, m_localIntersectionPointInDisplay(localIntersectionPointInDisplay)
{
}

View File

@ -137,7 +137,7 @@ public:
size_t nncIndex,
cvf::Color3f color,
cvf::StructGridInterface::FaceType face,
const cvf::Vec3d& localIntersectionPoint);
const cvf::Vec3d& localIntersectionPointInDisplay);
virtual ~RiuEclipseSelectionItem() {};
@ -153,7 +153,7 @@ public:
size_t m_nncIndex;
cvf::Color3f m_color;
cvf::StructGridInterface::FaceType m_face;
cvf::Vec3d m_localIntersectionPoint;
cvf::Vec3d m_localIntersectionPointInDisplay;
};
@ -170,14 +170,14 @@ public:
size_t cellIndex,
cvf::Color3f color,
int elementFace,
const cvf::Vec3d& localIntersectionPoint);
const cvf::Vec3d& localIntersectionPointInDisplay);
explicit RiuGeoMechSelectionItem(RimGeoMechView* view,
size_t gridIndex,
size_t cellIndex,
cvf::Color3f color,
int elementFace,
const cvf::Vec3d& localIntersectionPoint,
const cvf::Vec3d& localIntersectionPointInDisplay,
const std::array<cvf::Vec3f, 3>& intersectionTriangle );
virtual ~RiuGeoMechSelectionItem() {};
@ -194,7 +194,7 @@ public:
int m_elementFace;
bool m_hasIntersectionTriangle;
std::array<cvf::Vec3f, 3> m_intersectionTriangle;
cvf::Vec3d m_localIntersectionPoint;
cvf::Vec3d m_localIntersectionPointInDisplay;
};