mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2522 Mohr circle: Update plot on 3D view selection
This commit is contained in:
parent
d6974bfdba
commit
28efe4661d
@ -182,6 +182,7 @@ void RiuMainWindow::cleanupGuiCaseClose()
|
|||||||
m_resultQwtPlot->deleteAllCurves();
|
m_resultQwtPlot->deleteAllCurves();
|
||||||
if (m_relPermPlotPanel) m_relPermPlotPanel->clearPlot();
|
if (m_relPermPlotPanel) m_relPermPlotPanel->clearPlot();
|
||||||
if (m_pvtPlotPanel) m_pvtPlotPanel->clearPlot();
|
if (m_pvtPlotPanel) m_pvtPlotPanel->clearPlot();
|
||||||
|
if (m_mohrsCirclePlot) m_mohrsCirclePlot->clearPlot();
|
||||||
|
|
||||||
if (m_pdmUiPropertyView)
|
if (m_pdmUiPropertyView)
|
||||||
{
|
{
|
||||||
@ -915,6 +916,14 @@ RiuPvtPlotPanel* RiuMainWindow::pvtPlotPanel()
|
|||||||
return m_pvtPlotPanel;
|
return m_pvtPlotPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiuMohrsCirclePlot* RiuMainWindow::mohrsCirclePlot()
|
||||||
|
{
|
||||||
|
return m_mohrsCirclePlot;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -118,6 +118,7 @@ public:
|
|||||||
RiuResultQwtPlot* resultPlot();
|
RiuResultQwtPlot* resultPlot();
|
||||||
RiuRelativePermeabilityPlotPanel* relativePermeabilityPlotPanel();
|
RiuRelativePermeabilityPlotPanel* relativePermeabilityPlotPanel();
|
||||||
RiuPvtPlotPanel* pvtPlotPanel();
|
RiuPvtPlotPanel* pvtPlotPanel();
|
||||||
|
RiuMohrsCirclePlot* mohrsCirclePlot();
|
||||||
RiuMessagePanel* messagePanel();
|
RiuMessagePanel* messagePanel();
|
||||||
|
|
||||||
void showProcessMonitorDockPanel();
|
void showProcessMonitorDockPanel();
|
||||||
|
@ -20,6 +20,16 @@
|
|||||||
|
|
||||||
#include "qwt_round_scale_draw.h"
|
#include "qwt_round_scale_draw.h"
|
||||||
#include "qwt_symbol.h"
|
#include "qwt_symbol.h"
|
||||||
|
#include "RiuSelectionManager.h"
|
||||||
|
|
||||||
|
#include "RigFemPartCollection.h"
|
||||||
|
#include "RigFemPartResultsCollection.h"
|
||||||
|
#include "RigGeoMechCaseData.h"
|
||||||
|
|
||||||
|
#include "RimGeoMechCase.h"
|
||||||
|
#include "RimGeoMechCellColors.h"
|
||||||
|
#include "RimGeoMechResultDefinition.h"
|
||||||
|
#include "RimGeoMechView.h"
|
||||||
|
|
||||||
#include "cvfAssert.h"
|
#include "cvfAssert.h"
|
||||||
|
|
||||||
@ -72,6 +82,41 @@ void RiuMohrsCirclePlot::setPrincipalsAndRedrawCircles(double p1, double p2, dou
|
|||||||
redrawCircles();
|
redrawCircles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiuMohrsCirclePlot::updateOnSelectionChanged(const RiuSelectionItem* selectionItem)
|
||||||
|
{
|
||||||
|
const RiuGeoMechSelectionItem* geoMechSelectionItem = dynamic_cast<const RiuGeoMechSelectionItem*>(selectionItem);
|
||||||
|
|
||||||
|
RimGeoMechView* geoMechView = geoMechSelectionItem ? geoMechSelectionItem->m_view : nullptr;
|
||||||
|
|
||||||
|
bool mustClearPlot = true;
|
||||||
|
|
||||||
|
if (this->isVisible() && geoMechSelectionItem && geoMechView)
|
||||||
|
{
|
||||||
|
const size_t gridIndex = geoMechSelectionItem->m_gridIndex;
|
||||||
|
const size_t cellIndex = geoMechSelectionItem->m_cellIndex;
|
||||||
|
if (queryDataAndUpdatePlot(geoMechView, gridIndex, cellIndex))
|
||||||
|
{
|
||||||
|
mustClearPlot = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mustClearPlot)
|
||||||
|
{
|
||||||
|
this->clearPlot();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiuMohrsCirclePlot::clearPlot()
|
||||||
|
{
|
||||||
|
deleteCircles();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -127,6 +172,39 @@ void RiuMohrsCirclePlot::deleteCircles()
|
|||||||
m_mohrCirclesMarkers.clear();
|
m_mohrCirclesMarkers.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RiuMohrsCirclePlot::queryDataAndUpdatePlot(RimGeoMechView* geoMechView, size_t gridIndex, size_t cellIndex)
|
||||||
|
{
|
||||||
|
if (!geoMechView) return false;
|
||||||
|
|
||||||
|
RigFemPartResultsCollection* resultCollection = geoMechView->geoMechCase()->geoMechData()->femPartResults();
|
||||||
|
if (!resultCollection) return false;
|
||||||
|
|
||||||
|
int frameIdx = geoMechView->currentTimeStep();
|
||||||
|
|
||||||
|
RigFemResultAddress currentAddress = geoMechView->cellResult->resultAddress();
|
||||||
|
|
||||||
|
//TODO: All tensors are calculated everytime this function is called. FIX
|
||||||
|
std::vector<caf::Ten3f> vertexTensors = resultCollection->tensors(currentAddress, 0, frameIdx);
|
||||||
|
RigFemPart* femPart = geoMechView->geoMechCase()->geoMechData()->femParts()->part(gridIndex);
|
||||||
|
|
||||||
|
caf::Ten3f tensorSumOfElmNodes = vertexTensors[femPart->elementNodeResultIdx((int)cellIndex, 0)];
|
||||||
|
for (int i = 1; i < 8; i++)
|
||||||
|
{
|
||||||
|
tensorSumOfElmNodes = tensorSumOfElmNodes + vertexTensors[femPart->elementNodeResultIdx((int)cellIndex, i)];
|
||||||
|
}
|
||||||
|
|
||||||
|
caf::Ten3f elmTensor = tensorSumOfElmNodes * (1.0 / 8.0);
|
||||||
|
|
||||||
|
cvf::Vec3f principalDirs[3];
|
||||||
|
cvf::Vec3f elmPrincipals = elmTensor.calculatePrincipals(principalDirs);
|
||||||
|
|
||||||
|
setPrincipalsAndRedrawCircles(elmPrincipals[0], elmPrincipals[1], elmPrincipals[2]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
|
class RiuSelectionItem;
|
||||||
|
class RimGeoMechView;
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@ -41,6 +43,9 @@ public:
|
|||||||
void setPrincipals(double p1, double p2, double p3);
|
void setPrincipals(double p1, double p2, double p3);
|
||||||
void setPrincipalsAndRedrawCircles(double p1, double p2, double p3);
|
void setPrincipalsAndRedrawCircles(double p1, double p2, double p3);
|
||||||
|
|
||||||
|
void updateOnSelectionChanged(const RiuSelectionItem* selectionItem);
|
||||||
|
void clearPlot();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual QSize sizeHint() const override;
|
virtual QSize sizeHint() const override;
|
||||||
virtual QSize minimumSizeHint() const override;
|
virtual QSize minimumSizeHint() const override;
|
||||||
@ -48,6 +53,8 @@ protected:
|
|||||||
void redrawCircles();
|
void redrawCircles();
|
||||||
void deleteCircles();
|
void deleteCircles();
|
||||||
|
|
||||||
|
bool queryDataAndUpdatePlot(RimGeoMechView* geoMechView, size_t gridIndex, size_t cellIndex);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct MohrCircle
|
struct MohrCircle
|
||||||
{
|
{
|
||||||
|
@ -29,25 +29,26 @@
|
|||||||
#include "RigTimeHistoryResultAccessor.h"
|
#include "RigTimeHistoryResultAccessor.h"
|
||||||
#include "RiuFemTimeHistoryResultAccessor.h"
|
#include "RiuFemTimeHistoryResultAccessor.h"
|
||||||
|
|
||||||
|
#include "Rim2dIntersectionView.h"
|
||||||
#include "RimEclipseCase.h"
|
#include "RimEclipseCase.h"
|
||||||
#include "RimEclipseCellColors.h"
|
#include "RimEclipseCellColors.h"
|
||||||
#include "RimEclipseView.h"
|
#include "RimEclipseView.h"
|
||||||
#include "RimGeoMechCase.h"
|
#include "RimGeoMechCase.h"
|
||||||
#include "RimGeoMechResultDefinition.h"
|
#include "RimGeoMechResultDefinition.h"
|
||||||
#include "RimGeoMechView.h"
|
#include "RimGeoMechView.h"
|
||||||
#include "Rim2dIntersectionView.h"
|
|
||||||
#include "RimIntersection.h"
|
#include "RimIntersection.h"
|
||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
|
|
||||||
#include "RiuFemResultTextBuilder.h"
|
#include "RiuFemResultTextBuilder.h"
|
||||||
#include "RiuMainWindow.h"
|
#include "RiuMainWindow.h"
|
||||||
|
#include "RiuMohrsCirclePlot.h"
|
||||||
|
#include "RiuPvtPlotPanel.h"
|
||||||
|
#include "RiuPvtPlotUpdater.h"
|
||||||
|
#include "RiuRelativePermeabilityPlotPanel.h"
|
||||||
|
#include "RiuRelativePermeabilityPlotUpdater.h"
|
||||||
#include "RiuResultQwtPlot.h"
|
#include "RiuResultQwtPlot.h"
|
||||||
#include "RiuResultTextBuilder.h"
|
#include "RiuResultTextBuilder.h"
|
||||||
#include "RiuSelectionManager.h"
|
#include "RiuSelectionManager.h"
|
||||||
#include "RiuRelativePermeabilityPlotPanel.h"
|
|
||||||
#include "RiuPvtPlotPanel.h"
|
|
||||||
#include "RiuRelativePermeabilityPlotUpdater.h"
|
|
||||||
#include "RiuPvtPlotUpdater.h"
|
|
||||||
|
|
||||||
#include <QStatusBar>
|
#include <QStatusBar>
|
||||||
|
|
||||||
@ -107,6 +108,8 @@ void RiuSelectionChangedHandler::handleItemAppended(const RiuSelectionItem* item
|
|||||||
RiuPvtPlotUpdater* pvtPlotUpdater = RiuMainWindow::instance()->pvtPlotPanel()->plotUpdater();
|
RiuPvtPlotUpdater* pvtPlotUpdater = RiuMainWindow::instance()->pvtPlotPanel()->plotUpdater();
|
||||||
pvtPlotUpdater->updateOnSelectionChanged(item);
|
pvtPlotUpdater->updateOnSelectionChanged(item);
|
||||||
|
|
||||||
|
RiuMainWindow::instance()->mohrsCirclePlot()->updateOnSelectionChanged(item);
|
||||||
|
|
||||||
updateResultInfo(item);
|
updateResultInfo(item);
|
||||||
|
|
||||||
scheduleUpdateForAllVisibleViews();
|
scheduleUpdateForAllVisibleViews();
|
||||||
|
Loading…
Reference in New Issue
Block a user